@here/olp-sdk-dataservice-read 2.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/bundle.umd.dev.js +12548 -76
- package/bundle.umd.min.js +1 -1
- package/index.js +5 -1
- package/index.web.js +5 -1
- package/lib/cache/MetadataCacheRepository.js +1 -0
- package/lib/cache/QuadTreeIndexCacheRepository.js +1 -0
- package/lib/cache/index.js +5 -1
- package/lib/client/ArtifactClient.d.ts +2 -1
- package/lib/client/ArtifactClient.js +31 -43
- package/lib/client/CatalogClient.d.ts +3 -1
- package/lib/client/CatalogClient.js +59 -78
- package/lib/client/CatalogRequest.js +4 -3
- package/lib/client/CatalogVersionRequest.js +6 -3
- package/lib/client/CatalogsRequest.js +5 -3
- package/lib/client/ConfigClient.d.ts +1 -1
- package/lib/client/ConfigClient.js +13 -23
- package/lib/client/DataRequest.js +7 -6
- package/lib/client/IndexLayerClient.d.ts +1 -1
- package/lib/client/IndexLayerClient.js +37 -40
- package/lib/client/IndexQueryRequest.js +2 -0
- package/lib/client/LayerVersionsRequest.js +5 -3
- package/lib/client/PartitionsRequest.js +10 -7
- package/lib/client/PollRequest.js +2 -0
- package/lib/client/QuadKeyPartitionsRequest.d.ts +1 -1
- package/lib/client/QuadKeyPartitionsRequest.js +7 -3
- package/lib/client/QuadTreeIndexRequest.d.ts +1 -1
- package/lib/client/QuadTreeIndexRequest.js +11 -3
- package/lib/client/QueryClient.d.ts +2 -1
- package/lib/client/QueryClient.js +85 -96
- package/lib/client/SchemaDetailsRequest.js +5 -3
- package/lib/client/SchemaRequest.js +5 -3
- package/lib/client/SeekRequest.js +3 -0
- package/lib/client/StatisticsClient.d.ts +2 -1
- package/lib/client/StatisticsClient.js +51 -65
- package/lib/client/StatisticsRequest.js +9 -4
- package/lib/client/StreamLayerClient.d.ts +4 -1
- package/lib/client/StreamLayerClient.js +117 -139
- package/lib/client/SubscribeRequest.js +4 -0
- package/lib/client/SummaryRequest.js +5 -2
- package/lib/client/TileRequest.js +6 -6
- package/lib/client/UnsubscribeRequest.js +2 -0
- package/lib/client/VersionedLayerClient.d.ts +45 -1
- package/lib/client/VersionedLayerClient.js +133 -147
- package/lib/client/VolatileLayerClient.d.ts +4 -1
- package/lib/client/VolatileLayerClient.js +104 -108
- package/lib/client/index.js +5 -1
- package/lib/index.js +5 -1
- package/lib/utils/getTile.d.ts +37 -1
- package/lib/utils/getTile.js +121 -132
- package/lib/utils/index.js +5 -1
- package/lib/utils/validateBillingTag.js +1 -2
- package/lib/utils/validatePartitionsIdsList.js +1 -2
- package/package.json +11 -55
- package/webpack.config.js +2 -7
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { HRN, OlpClientSettings } from "@here/olp-sdk-core";
|
|
2
2
|
import { MetadataApi, QueryApi } from "@here/olp-sdk-dataservice-api";
|
|
3
|
-
import {
|
|
3
|
+
import { TileResponse } from "../utils/getTile";
|
|
4
|
+
import { DataRequest } from "./DataRequest";
|
|
5
|
+
import { PartitionsRequest } from "./PartitionsRequest";
|
|
6
|
+
import { QuadKeyPartitionsRequest } from "./QuadKeyPartitionsRequest";
|
|
7
|
+
import { TileRequest } from "./TileRequest";
|
|
4
8
|
/**
|
|
5
9
|
* Parameters for use to initialize VersionLayerClient.
|
|
6
10
|
*/
|
|
@@ -52,6 +56,46 @@ export declare class VersionedLayerClient {
|
|
|
52
56
|
* @return Tile data (if it exists) or the nearest parent tile data
|
|
53
57
|
*/
|
|
54
58
|
getAggregatedData(request: TileRequest, abortSignal?: AbortSignal): Promise<Response>;
|
|
59
|
+
/**
|
|
60
|
+
* @brief Fetches data of a tile or its closest ancestor.
|
|
61
|
+
* Use this API for tile-tree structures where children tile data is aggregated and stored in parent tiles.
|
|
62
|
+
*
|
|
63
|
+
* @param request The `TileRequest` instance that contains a complete set
|
|
64
|
+
* of request parameters.
|
|
65
|
+
* @param abortSignal A signal object that allows you to communicate with a request (such as the `fetch` request)
|
|
66
|
+
* and, if required, abort it using the `AbortController` object.
|
|
67
|
+
* @param options An optional object that can include the `includeTileKey` flag to indicate whether the parent tile key should be included in the response.
|
|
68
|
+
*
|
|
69
|
+
* For more information, see the [`AbortController` documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
|
70
|
+
*
|
|
71
|
+
* @return Tile data (if it exists) or the nearest parent tile data including the parent tile key
|
|
72
|
+
*/
|
|
73
|
+
getAggregatedData(request: TileRequest, abortSignal: AbortSignal | undefined, options: {
|
|
74
|
+
includeTileKey: true;
|
|
75
|
+
}): Promise<TileResponse>;
|
|
76
|
+
/**
|
|
77
|
+
* @brief Fetches data of a tile or its closest ancestor.
|
|
78
|
+
*
|
|
79
|
+
* Same as the two-argument `getAggregatedData`, for callers that pass an
|
|
80
|
+
* options object with `includeTileKey` disabled or omitted.
|
|
81
|
+
*
|
|
82
|
+
* @return Tile data (if it exists) or the nearest parent tile data
|
|
83
|
+
*/
|
|
84
|
+
getAggregatedData(request: TileRequest, abortSignal: AbortSignal | undefined, options: {
|
|
85
|
+
includeTileKey?: false;
|
|
86
|
+
}): Promise<Response>;
|
|
87
|
+
/**
|
|
88
|
+
* @brief Fetches data of a tile or its closest ancestor.
|
|
89
|
+
*
|
|
90
|
+
* Same as the two-argument `getAggregatedData`, for an `includeTileKey`
|
|
91
|
+
* flag whose value is only known at run time. Narrow the result before
|
|
92
|
+
* using it.
|
|
93
|
+
*
|
|
94
|
+
* @return A `TileResponse` if the flag was `true`, otherwise the tile data
|
|
95
|
+
*/
|
|
96
|
+
getAggregatedData(request: TileRequest, abortSignal: AbortSignal | undefined, options: {
|
|
97
|
+
includeTileKey?: boolean;
|
|
98
|
+
}): Promise<Response | TileResponse>;
|
|
55
99
|
/**
|
|
56
100
|
* Fetches partition data using one of the following methods: ID, quadkey, or data handle.
|
|
57
101
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (C) 2019-
|
|
3
|
+
* Copyright (C) 2019-2026 HERE Europe B.V.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -17,31 +17,41 @@
|
|
|
17
17
|
* SPDX-License-Identifier: Apache-2.0
|
|
18
18
|
* License-Filename: LICENSE
|
|
19
19
|
*/
|
|
20
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
21
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
22
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
23
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
24
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
25
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
26
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
21
|
exports.VersionedLayerClient = void 0;
|
|
31
22
|
const olp_sdk_core_1 = require("@here/olp-sdk-core");
|
|
32
23
|
const olp_sdk_dataservice_api_1 = require("@here/olp-sdk-dataservice-api");
|
|
33
|
-
const
|
|
24
|
+
const MetadataCacheRepository_1 = require("../cache/MetadataCacheRepository");
|
|
25
|
+
const getTile_1 = require("../utils/getTile");
|
|
26
|
+
const PartitionsRequest_1 = require("./PartitionsRequest");
|
|
27
|
+
const QuadKeyPartitionsRequest_1 = require("./QuadKeyPartitionsRequest");
|
|
28
|
+
const QuadTreeIndexRequest_1 = require("./QuadTreeIndexRequest");
|
|
29
|
+
const QueryClient_1 = require("./QueryClient");
|
|
34
30
|
/**
|
|
35
31
|
* Describes a versioned layer and provides the possibility to get partitions metadata and data.
|
|
36
32
|
*/
|
|
37
33
|
class VersionedLayerClient {
|
|
34
|
+
apiVersion = "v1";
|
|
35
|
+
/**
|
|
36
|
+
* HRN of the catalog.
|
|
37
|
+
*/
|
|
38
|
+
hrn;
|
|
39
|
+
/**
|
|
40
|
+
* The ID of the layer.
|
|
41
|
+
*/
|
|
42
|
+
layerId;
|
|
43
|
+
/**
|
|
44
|
+
* The [[OlpClientSettings]] instance.
|
|
45
|
+
*/
|
|
46
|
+
settings;
|
|
47
|
+
// Layer version.
|
|
48
|
+
version;
|
|
38
49
|
/**
|
|
39
50
|
* Creates the [[VersionedLayerClient]] instance with VersionedLayerClientParams.
|
|
40
51
|
*
|
|
41
52
|
* @param params parameters for use to initialize VersionLayerClient.
|
|
42
53
|
*/
|
|
43
54
|
constructor(params) {
|
|
44
|
-
this.apiVersion = "v1";
|
|
45
55
|
this.hrn = params.catalogHrn.toString();
|
|
46
56
|
this.layerId = params.layerId;
|
|
47
57
|
this.settings = params.settings;
|
|
@@ -49,34 +59,22 @@ class VersionedLayerClient {
|
|
|
49
59
|
this.version = params.version;
|
|
50
60
|
}
|
|
51
61
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
let catalogVersion = this.version;
|
|
68
|
-
if (catalogVersion === undefined) {
|
|
69
|
-
catalogVersion = yield this.getLatestVersion(request.getBillingTag());
|
|
70
|
-
}
|
|
71
|
-
const params = {
|
|
72
|
-
catalogHrn: olp_sdk_core_1.HRN.fromString(this.hrn),
|
|
73
|
-
layerId: this.layerId,
|
|
74
|
-
layerType: "versioned",
|
|
75
|
-
settings: this.settings,
|
|
76
|
-
catalogVersion
|
|
77
|
-
};
|
|
78
|
-
return olp_sdk_dataservice_read_1.getTile(request, params, abortSignal);
|
|
62
|
+
async getAggregatedData(request, abortSignal, options) {
|
|
63
|
+
let catalogVersion = this.version;
|
|
64
|
+
if (catalogVersion === undefined) {
|
|
65
|
+
catalogVersion = await this.getLatestVersion(request.getBillingTag());
|
|
66
|
+
}
|
|
67
|
+
const params = {
|
|
68
|
+
catalogHrn: olp_sdk_core_1.HRN.fromString(this.hrn),
|
|
69
|
+
layerId: this.layerId,
|
|
70
|
+
layerType: "versioned",
|
|
71
|
+
settings: this.settings,
|
|
72
|
+
catalogVersion
|
|
73
|
+
};
|
|
74
|
+
const tileResponse = await (0, getTile_1.getTile)(request, params, abortSignal, {
|
|
75
|
+
includeTileKey: true
|
|
79
76
|
});
|
|
77
|
+
return options?.includeTileKey ? tileResponse : tileResponse.response;
|
|
80
78
|
}
|
|
81
79
|
/**
|
|
82
80
|
* Fetches partition data using one of the following methods: ID, quadkey, or data handle.
|
|
@@ -89,84 +87,80 @@ class VersionedLayerClient {
|
|
|
89
87
|
*
|
|
90
88
|
* @return The data from the requested partition.
|
|
91
89
|
*/
|
|
92
|
-
getData(dataRequest, abortSignal) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return Promise.reject(new Error(`No data provided. Add dataHandle, partitionId or quadKey to the DataRequest object`));
|
|
111
|
-
});
|
|
90
|
+
async getData(dataRequest, abortSignal) {
|
|
91
|
+
const dataHandle = dataRequest.getDataHandle();
|
|
92
|
+
if (dataHandle) {
|
|
93
|
+
return this.downloadPartition(dataHandle, abortSignal, dataRequest.getBillingTag());
|
|
94
|
+
}
|
|
95
|
+
const partitionId = dataRequest.getPartitionId();
|
|
96
|
+
if (this.version === undefined) {
|
|
97
|
+
// fetch the latest version and lock it to the instance.
|
|
98
|
+
this.version = await this.getLatestVersion(dataRequest.getBillingTag());
|
|
99
|
+
}
|
|
100
|
+
if (this.version === undefined) {
|
|
101
|
+
return Promise.reject(new Error(`Unable to retrieve latest version. Please provide version to the DataRequest or lock version in the constructor`));
|
|
102
|
+
}
|
|
103
|
+
if (partitionId) {
|
|
104
|
+
const partitionIdDataHandle = await this.getDataHandleByPartitionId(partitionId, dataRequest.getFetchOption(), dataRequest.getBillingTag());
|
|
105
|
+
return this.downloadPartition(partitionIdDataHandle, abortSignal, dataRequest.getBillingTag());
|
|
106
|
+
}
|
|
107
|
+
return Promise.reject(new Error(`No data provided. Add dataHandle, partitionId or quadKey to the DataRequest object`));
|
|
112
108
|
}
|
|
113
|
-
getPartitions(request, abortSignal) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
109
|
+
async getPartitions(request, abortSignal) {
|
|
110
|
+
if (this.version === undefined) {
|
|
111
|
+
// fetch the latest version and lock it to the instance.
|
|
112
|
+
this.version = await this.getLatestVersion(request.getBillingTag());
|
|
113
|
+
}
|
|
114
|
+
if (this.version === undefined) {
|
|
115
|
+
return Promise.reject(new Error(`Unable to retrieve latest version. Please provide version to the Request or lock version in the constructor`));
|
|
116
|
+
}
|
|
117
|
+
if (request instanceof QuadKeyPartitionsRequest_1.QuadKeyPartitionsRequest) {
|
|
118
|
+
const quadKey = request.getQuadKey();
|
|
119
|
+
if (!quadKey) {
|
|
120
|
+
return Promise.reject(new Error("Please provide correct QuadKey"));
|
|
121
121
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
const queryClient = new QueryClient_1.QueryClient(this.settings);
|
|
123
|
+
const quadTreeIndexRequest = new QuadTreeIndexRequest_1.QuadTreeIndexRequest(olp_sdk_core_1.HRN.fromString(this.hrn), this.layerId, "versioned")
|
|
124
|
+
.withQuadKey(quadKey)
|
|
125
|
+
.withVersion(this.version)
|
|
126
|
+
.withDepth(request.getDepth())
|
|
127
|
+
.withAdditionalFields(request.getAdditionalFields());
|
|
128
|
+
return queryClient.fetchQuadTreeIndex(quadTreeIndexRequest, abortSignal);
|
|
129
|
+
}
|
|
130
|
+
if (request.getPartitionIds()) {
|
|
131
|
+
const queryClient = new QueryClient_1.QueryClient(this.settings);
|
|
132
|
+
return queryClient.getPartitionsById(request, this.layerId, olp_sdk_core_1.HRN.fromString(this.hrn), abortSignal, this.version);
|
|
133
|
+
}
|
|
134
|
+
const cache = new MetadataCacheRepository_1.MetadataCacheRepository(this.settings.cache);
|
|
135
|
+
if (request.getFetchOption() !== olp_sdk_core_1.FetchOptions.OnlineOnly) {
|
|
136
|
+
const partitions = cache.get(request, this.hrn.toString(), this.layerId, this.version);
|
|
137
|
+
if (partitions) {
|
|
138
|
+
const additionalFields = request.getAdditionalFields();
|
|
139
|
+
let existFields;
|
|
140
|
+
if (additionalFields) {
|
|
141
|
+
existFields = additionalFields.filter((field) => {
|
|
142
|
+
return partitions.every((partition) => partition[field] !== undefined);
|
|
143
|
+
});
|
|
126
144
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
.
|
|
130
|
-
.
|
|
131
|
-
.withDepth(request.getDepth())
|
|
132
|
-
.withAdditionalFields(request.getAdditionalFields());
|
|
133
|
-
return queryClient.fetchQuadTreeIndex(quadTreeIndexRequest, abortSignal);
|
|
134
|
-
}
|
|
135
|
-
if (request.getPartitionIds()) {
|
|
136
|
-
const queryClient = new olp_sdk_dataservice_read_1.QueryClient(this.settings);
|
|
137
|
-
return queryClient.getPartitionsById(request, this.layerId, olp_sdk_core_1.HRN.fromString(this.hrn), abortSignal, this.version);
|
|
138
|
-
}
|
|
139
|
-
const cache = new olp_sdk_dataservice_read_1.MetadataCacheRepository(this.settings.cache);
|
|
140
|
-
if (request.getFetchOption() !== olp_sdk_core_1.FetchOptions.OnlineOnly) {
|
|
141
|
-
const partitions = cache.get(request, this.hrn.toString(), this.layerId, this.version);
|
|
142
|
-
if (partitions) {
|
|
143
|
-
const additionalFields = request.getAdditionalFields();
|
|
144
|
-
let existFields;
|
|
145
|
-
if (additionalFields) {
|
|
146
|
-
existFields = additionalFields.filter((field) => {
|
|
147
|
-
return partitions.every(partition => partition[field] !== undefined);
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
if (!additionalFields ||
|
|
151
|
-
!existFields ||
|
|
152
|
-
additionalFields.length === existFields.length) {
|
|
153
|
-
return Promise.resolve({ partitions });
|
|
154
|
-
}
|
|
145
|
+
if (!additionalFields ||
|
|
146
|
+
!existFields ||
|
|
147
|
+
additionalFields.length === existFields.length) {
|
|
148
|
+
return Promise.resolve({ partitions });
|
|
155
149
|
}
|
|
156
150
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (request.getFetchOption() !== olp_sdk_core_1.FetchOptions.OnlineOnly &&
|
|
165
|
-
metadata.partitions.length) {
|
|
166
|
-
cache.put(request, this.hrn.toString(), this.layerId, metadata.partitions, this.version);
|
|
167
|
-
}
|
|
168
|
-
return Promise.resolve(metadata);
|
|
151
|
+
}
|
|
152
|
+
const metaRequestBilder = await this.getRequestBuilder("metadata", olp_sdk_core_1.HRN.fromString(this.hrn), abortSignal);
|
|
153
|
+
const metadata = await olp_sdk_dataservice_api_1.MetadataApi.getPartitions(metaRequestBilder, {
|
|
154
|
+
version: this.version,
|
|
155
|
+
layerId: this.layerId,
|
|
156
|
+
additionalFields: request.getAdditionalFields(),
|
|
157
|
+
billingTag: request.getBillingTag()
|
|
169
158
|
});
|
|
159
|
+
if (request.getFetchOption() !== olp_sdk_core_1.FetchOptions.OnlineOnly &&
|
|
160
|
+
metadata.partitions.length) {
|
|
161
|
+
cache.put(request, this.hrn.toString(), this.layerId, metadata.partitions, this.version);
|
|
162
|
+
}
|
|
163
|
+
return Promise.resolve(metadata);
|
|
170
164
|
}
|
|
171
165
|
/**
|
|
172
166
|
* Fetch and returns partition metadata
|
|
@@ -175,44 +169,38 @@ class VersionedLayerClient {
|
|
|
175
169
|
* @param fetchOption The option of caching (online only or return from cache if exist)
|
|
176
170
|
* @returns A promise of partition metadata which used to get partition data
|
|
177
171
|
*/
|
|
178
|
-
getDataHandleByPartitionId(partitionId, fetchOption, billingTag) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
: Promise.reject(new olp_sdk_core_1.HttpError(olp_sdk_core_1.STATUS_CODES.NOT_FOUND, `No partition dataHandle for partition ${partitionId}. HRN: ${this.hrn}`));
|
|
193
|
-
});
|
|
172
|
+
async getDataHandleByPartitionId(partitionId, fetchOption, billingTag) {
|
|
173
|
+
const queryClient = new QueryClient_1.QueryClient(this.settings);
|
|
174
|
+
const partitionsRequest = new PartitionsRequest_1.PartitionsRequest()
|
|
175
|
+
.withPartitionIds([partitionId])
|
|
176
|
+
.withFetchOption(fetchOption);
|
|
177
|
+
if (billingTag) {
|
|
178
|
+
partitionsRequest.withBillingTag(billingTag);
|
|
179
|
+
}
|
|
180
|
+
const metadata = await queryClient.getPartitionsById(partitionsRequest, this.layerId, olp_sdk_core_1.HRN.fromString(this.hrn), undefined, this.version);
|
|
181
|
+
return metadata.partitions &&
|
|
182
|
+
metadata.partitions[0] &&
|
|
183
|
+
metadata.partitions[0].dataHandle
|
|
184
|
+
? metadata.partitions[0].dataHandle
|
|
185
|
+
: Promise.reject(new olp_sdk_core_1.HttpError(olp_sdk_core_1.STATUS_CODES.NOT_FOUND, `No partition dataHandle for partition ${partitionId}. HRN: ${this.hrn}`));
|
|
194
186
|
}
|
|
195
187
|
/**
|
|
196
188
|
* Gets the latest available catalog version what can be used as latest layer version
|
|
197
189
|
*/
|
|
198
|
-
getLatestVersion(billingTag) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
billingTag
|
|
204
|
-
}).catch(error => Promise.reject(error));
|
|
205
|
-
return Promise.resolve(latestVersion.version);
|
|
190
|
+
async getLatestVersion(billingTag) {
|
|
191
|
+
const builder = await this.getRequestBuilder("metadata", olp_sdk_core_1.HRN.fromString(this.hrn));
|
|
192
|
+
const latestVersion = await olp_sdk_dataservice_api_1.MetadataApi.latestVersion(builder, {
|
|
193
|
+
startVersion: -1,
|
|
194
|
+
billingTag
|
|
206
195
|
});
|
|
196
|
+
return Promise.resolve(latestVersion.version);
|
|
207
197
|
}
|
|
208
|
-
downloadPartition(dataHandle, abortSignal, billingTag) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
billingTag
|
|
215
|
-
});
|
|
198
|
+
async downloadPartition(dataHandle, abortSignal, billingTag) {
|
|
199
|
+
const builder = await this.getRequestBuilder("blob", olp_sdk_core_1.HRN.fromString(this.hrn), abortSignal);
|
|
200
|
+
return olp_sdk_dataservice_api_1.BlobApi.getBlob(builder, {
|
|
201
|
+
dataHandle,
|
|
202
|
+
layerId: this.layerId,
|
|
203
|
+
billingTag
|
|
216
204
|
});
|
|
217
205
|
}
|
|
218
206
|
/**
|
|
@@ -221,10 +209,8 @@ class VersionedLayerClient {
|
|
|
221
209
|
*
|
|
222
210
|
* @returns requestBuilder
|
|
223
211
|
*/
|
|
224
|
-
getRequestBuilder(builderType, hrn, abortSignal) {
|
|
225
|
-
return
|
|
226
|
-
return olp_sdk_core_1.RequestFactory.create(builderType, this.apiVersion, this.settings, hrn, abortSignal);
|
|
227
|
-
});
|
|
212
|
+
async getRequestBuilder(builderType, hrn, abortSignal) {
|
|
213
|
+
return olp_sdk_core_1.RequestFactory.create(builderType, this.apiVersion, this.settings, hrn, abortSignal);
|
|
228
214
|
}
|
|
229
215
|
}
|
|
230
216
|
exports.VersionedLayerClient = VersionedLayerClient;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { HRN, OlpClientSettings } from "@here/olp-sdk-core";
|
|
2
2
|
import { MetadataApi, QueryApi } from "@here/olp-sdk-dataservice-api";
|
|
3
|
-
import { DataRequest
|
|
3
|
+
import { DataRequest } from "./DataRequest";
|
|
4
|
+
import { PartitionsRequest } from "./PartitionsRequest";
|
|
5
|
+
import { QuadKeyPartitionsRequest } from "./QuadKeyPartitionsRequest";
|
|
6
|
+
import { TileRequest } from "./TileRequest";
|
|
4
7
|
/**
|
|
5
8
|
* Parameters for use to initialize VolatileLayerClient.
|
|
6
9
|
*/
|