Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async getDataHandleByPartitionId(
partitionId: string,
version?: number
): Promise {
const queryRequestBilder = await this.getRequestBuilder("query");
const latestVersion = version || (await this.getLatestVersion());
const partitions = await QueryApi.getPartitionsById(
queryRequestBilder,
{
version: `${latestVersion}`,
layerId: this.layerId,
partition: [partitionId]
}
);
const partition = partitions.partitions.find(element => {
return element.partition === partitionId;
});
return partition && partition.dataHandle
? partition.dataHandle
: Promise.reject(
`No partition dataHandle for partition ${partitionId}. HRN: ${this.hrn}`
);
private async downloadPartitionData(
partitionId: string
): Promise {
const queryRequestBilder = await this.getRequestBuilder("query");
const latestVersion = await this.getLatestVersion();
return QueryApi.getPartitionsById(queryRequestBilder, {
version: `${latestVersion}`,
layerId: this.layerId,
partition: [partitionId]
});
}
private async downloadPartitionData(
partitionId: string
): Promise {
const queryRequestBilder = await this.getRequestBuilder("query");
return QueryApi.getPartitionsById(queryRequestBilder, {
layerId: this.layerId,
partition: [partitionId]
});
}
private async getDataHandleByPartitionId(
partitionId: string
): Promise {
const queryRequestBilder = await this.getRequestBuilder("query");
const partitions = await QueryApi.getPartitionsById(
queryRequestBilder,
{
layerId: this.layerId,
partition: [partitionId]
}
);
const partition = partitions.partitions.find(element => {
return element.partition === partitionId;
});
return partition && partition.dataHandle
? partition.dataHandle
: Promise.reject(
`No partition dataHandle for partition ${partitionId}. HRN: ${this.hrn}`
);
}
return Promise.reject("Please provide correct partitionIds list");
}
const requestBuilder = await RequestFactory.create(
"query",
this.apiVersion,
this.settings,
hrn,
abortSignal
).catch(error =>
Promise.reject(
`Erorr creating request object for query service: ${error}`
)
);
return QueryApi.getPartitionsById(
requestBuilder,
{
layerId,
partition: idsList,
version: version ? `${version}` : undefined,
}
);
}