@here/olp-sdk-dataservice-read 1.12.2 → 1.13.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/lib/client/ArtifactClient.d.ts +1 -1
- package/package.json +9 -6
- package/bundle.umd.dev.js +0 -13112
- package/bundle.umd.min.js +0 -1
- package/lib/cache/MetadataCacheRepository.js +0 -129
- package/lib/cache/QuadTreeIndexCacheRepository.js +0 -59
- package/lib/cache/index.js +0 -32
- package/lib/client/ArtifactClient.js +0 -96
- package/lib/client/CatalogClient.js +0 -206
- package/lib/client/CatalogRequest.js +0 -47
- package/lib/client/CatalogVersionRequest.js +0 -85
- package/lib/client/CatalogsRequest.js +0 -67
- package/lib/client/ConfigClient.js +0 -72
- package/lib/client/DataRequest.js +0 -115
- package/lib/client/IndexLayerClient.js +0 -111
- package/lib/client/IndexQueryRequest.js +0 -63
- package/lib/client/LayerVersionsRequest.js +0 -64
- package/lib/client/PartitionsRequest.js +0 -124
- package/lib/client/PollRequest.js +0 -63
- package/lib/client/QuadKeyPartitionsRequest.js +0 -110
- package/lib/client/QuadTreeIndexRequest.js +0 -168
- package/lib/client/QueryClient.js +0 -169
- package/lib/client/SchemaDetailsRequest.js +0 -68
- package/lib/client/SchemaRequest.js +0 -67
- package/lib/client/SeekRequest.js +0 -70
- package/lib/client/StatisticsClient.js +0 -127
- package/lib/client/StatisticsRequest.js +0 -134
- package/lib/client/StreamLayerClient.js +0 -252
- package/lib/client/SubscribeRequest.js +0 -101
- package/lib/client/SummaryRequest.js +0 -66
- package/lib/client/TileRequest.js +0 -118
- package/lib/client/UnsubscribeRequest.js +0 -63
- package/lib/client/VersionedLayerClient.js +0 -230
- package/lib/client/VolatileLayerClient.js +0 -194
- package/lib/client/index.js +0 -57
- package/lib/index.js +0 -33
- package/lib/utils/getTile.js +0 -166
- package/lib/utils/index.js +0 -33
- package/lib/utils/validateBillingTag.js +0 -37
- package/lib/utils/validatePartitionsIdsList.js +0 -38
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (C) 2019-2020 HERE Europe B.V.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*
|
|
17
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
18
|
-
* License-Filename: LICENSE
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.StatisticsRequest = exports.CoverageDataType = void 0;
|
|
22
|
-
const olp_sdk_dataservice_read_1 = require("@here/olp-sdk-dataservice-read");
|
|
23
|
-
/**
|
|
24
|
-
* A map type that is supported by the platform Statistics Service.
|
|
25
|
-
*/
|
|
26
|
-
var CoverageDataType;
|
|
27
|
-
(function (CoverageDataType) {
|
|
28
|
-
/** Represents the availability of data in partitions. */
|
|
29
|
-
CoverageDataType["BITMAP"] = "tilemap";
|
|
30
|
-
/** A heatmap that represents a partition size. */
|
|
31
|
-
CoverageDataType["SIZEMAP"] = "heatmap/size";
|
|
32
|
-
/** A heatmap that represents partition update time. */
|
|
33
|
-
CoverageDataType["TIMEMAP"] = "heatmap/age";
|
|
34
|
-
})(CoverageDataType = exports.CoverageDataType || (exports.CoverageDataType = {}));
|
|
35
|
-
/**
|
|
36
|
-
* Prepares information for calls to get statistics from the platform Statistics Service.
|
|
37
|
-
*/
|
|
38
|
-
class StatisticsRequest {
|
|
39
|
-
/**
|
|
40
|
-
* Gets the configured [[HRN]] string of the catalog HERE Resource Name(HRN) for the request.
|
|
41
|
-
*
|
|
42
|
-
* @return The configured [[HRN]] string.
|
|
43
|
-
*/
|
|
44
|
-
getCatalogHrn() {
|
|
45
|
-
return this.catalogHrn;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Gets a layer ID for the request.
|
|
49
|
-
*
|
|
50
|
-
* @return The layer ID string.
|
|
51
|
-
*/
|
|
52
|
-
getLayerId() {
|
|
53
|
-
return this.layerId;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Gets a map type that is supported by the platform Statistics Service.
|
|
57
|
-
*
|
|
58
|
-
* @return The requested map type.
|
|
59
|
-
*/
|
|
60
|
-
getTypemap() {
|
|
61
|
-
return this.typemap;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Gets a tile level for the request.
|
|
65
|
-
* @return The requested tile level string.
|
|
66
|
-
*/
|
|
67
|
-
getDataLevel() {
|
|
68
|
-
return this.dataLevel;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* A setter for the provided catalog HERE Resource Name (HRN).
|
|
72
|
-
*
|
|
73
|
-
* @param hrn The catalog HRN.
|
|
74
|
-
* @returns The updated [[StatisticsRequest]] instance that you can use to chain methods.
|
|
75
|
-
*/
|
|
76
|
-
withCatalogHrn(hrn) {
|
|
77
|
-
this.catalogHrn = hrn.toString();
|
|
78
|
-
return this;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* A setter for the requested `layerId` string.
|
|
82
|
-
*
|
|
83
|
-
* @param layerId The ID of the layer.
|
|
84
|
-
* @returns The updated [[StatisticsRequest]] instance that you can use to chain methods.
|
|
85
|
-
*/
|
|
86
|
-
withLayerId(layerId) {
|
|
87
|
-
this.layerId = layerId;
|
|
88
|
-
return this;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* A setter for the provided `coverageDataType` string.
|
|
92
|
-
*
|
|
93
|
-
* @param coverageDataType Points at one of the following Statistic API endpoints:
|
|
94
|
-
* * BITMAP – fetches a bitmap that represents the availability of data in partitions.
|
|
95
|
-
* * SIZEMAP – fetches a heatmap that represents a partition size.
|
|
96
|
-
* * TIMEMAP – fetches a heatmap that represents partition update time.
|
|
97
|
-
* @returns The updated [[StatisticsRequest]] instance that you can use to chain methods.
|
|
98
|
-
*/
|
|
99
|
-
withTypemap(coverageDataType) {
|
|
100
|
-
this.typemap = coverageDataType;
|
|
101
|
-
return this;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* A setter for the provided `dataLevel` string.
|
|
105
|
-
*
|
|
106
|
-
* @param dataLevel dataLevel Specify the tile level about which you want to get statistical data.
|
|
107
|
-
* @returns The updated [[StatisticsRequest]] instance that you can use to chain methods.
|
|
108
|
-
*/
|
|
109
|
-
withDataLevel(dataLevel) {
|
|
110
|
-
this.dataLevel = Number(dataLevel);
|
|
111
|
-
return this;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* An optional free-form tag that is used for grouping billing records together.
|
|
115
|
-
*
|
|
116
|
-
* If supplied, it must be 4–16 characters long and contain only alphanumeric ASCII characters [A-Za-z0-9].
|
|
117
|
-
*
|
|
118
|
-
* @param tag The `BillingTag` string.
|
|
119
|
-
* @return The updated [[StatisticsRequest]] instance that you can use to chain methods.
|
|
120
|
-
*/
|
|
121
|
-
withBillingTag(tag) {
|
|
122
|
-
this.billingTag = olp_sdk_dataservice_read_1.validateBillingTag(tag);
|
|
123
|
-
return this;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Gets a billing tag to group billing records together.
|
|
127
|
-
*
|
|
128
|
-
* @return The `BillingTag` string.
|
|
129
|
-
*/
|
|
130
|
-
getBillingTag() {
|
|
131
|
-
return this.billingTag;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
exports.StatisticsRequest = StatisticsRequest;
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (C) 2020 HERE Europe B.V.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*
|
|
17
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
18
|
-
* License-Filename: LICENSE
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.StreamLayerClient = void 0;
|
|
31
|
-
const olp_sdk_core_1 = require("@here/olp-sdk-core");
|
|
32
|
-
const olp_sdk_dataservice_api_1 = require("@here/olp-sdk-dataservice-api");
|
|
33
|
-
/**
|
|
34
|
-
* Describes a stream layer.
|
|
35
|
-
*/
|
|
36
|
-
class StreamLayerClient {
|
|
37
|
-
/**
|
|
38
|
-
* Creates the [[StreamLayerClient]] instance.
|
|
39
|
-
*
|
|
40
|
-
* @param params The [[StreamLayerClientParams]] instance.
|
|
41
|
-
* @return The [[StreamLayerClient]] instance.
|
|
42
|
-
*/
|
|
43
|
-
constructor(params) {
|
|
44
|
-
this.apiVersion = "v2";
|
|
45
|
-
this.catalogHrn = params.catalogHrn;
|
|
46
|
-
this.layerId = params.layerId;
|
|
47
|
-
this.settings = params.settings;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Enables message consumption from a specific stream layer. Use the base path returned from the API Lookup service.
|
|
51
|
-
* For mode = parallel, one unit of parallelism currently equals 1 MBps inbound or 2 MBps outbound,
|
|
52
|
-
* whichever is greater, rounded up to the nearest integer.
|
|
53
|
-
* The number of subscriptions within the same group cannot exceed the parallelism allowed.
|
|
54
|
-
* For more details see
|
|
55
|
-
* [Get Data from a Stream Layer](https://developer.here.com/documentation/data-api/data_dev_guide/rest/getting-data-stream.html)
|
|
56
|
-
*
|
|
57
|
-
* @param request The [[SubscribeRequest]] instance of the configured request parameters.
|
|
58
|
-
* @param abortSignal A signal object that allows you to communicate with a request (such as the `fetch` request)
|
|
59
|
-
* and, if required, abort it using the `AbortController` object.
|
|
60
|
-
*
|
|
61
|
-
* For more information, see the [`AbortController` documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
|
62
|
-
*
|
|
63
|
-
* @returns Subscription Id
|
|
64
|
-
*/
|
|
65
|
-
subscribe(request, abortSignal) {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
const requestBuilder = yield olp_sdk_core_1.RequestFactory.create("stream", this.apiVersion, this.settings, this.catalogHrn, abortSignal).catch(error => Promise.reject(error));
|
|
68
|
-
const subscribtionRequestParams = {
|
|
69
|
-
layerId: this.layerId,
|
|
70
|
-
mode: request.getMode(),
|
|
71
|
-
consumerId: request.getConsumerId(),
|
|
72
|
-
subscriptionId: request.getSubscriptionId(),
|
|
73
|
-
subscriptionProperties: request.getSubscriptionProperties()
|
|
74
|
-
};
|
|
75
|
-
const subscriptionResult = yield olp_sdk_dataservice_api_1.StreamApi.subscribe(requestBuilder, subscribtionRequestParams)
|
|
76
|
-
.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
const xCorrelationId = res.headers.get("X-Correlation-Id") || undefined;
|
|
78
|
-
const responseData = yield res.json();
|
|
79
|
-
return Promise.resolve(Object.assign({ xCorrelationId }, responseData));
|
|
80
|
-
}))
|
|
81
|
-
.catch(err => Promise.reject(err));
|
|
82
|
-
// Update xCorrelationId
|
|
83
|
-
this.xCorrelationId = subscriptionResult.xCorrelationId;
|
|
84
|
-
this.subscribtionNodeBaseUrl = subscriptionResult.nodeBaseURL;
|
|
85
|
-
return Promise.resolve(subscriptionResult.subscriptionId);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Consumes data from a layer. Returns messages from a stream layer.
|
|
90
|
-
* If the data size is less than 1 MB, the data field will be populated.
|
|
91
|
-
* If the data size is greater than 1 MB, a data handle will be returned pointing to the object stored in the Blob store.
|
|
92
|
-
*
|
|
93
|
-
* @param request The [[PollRequest]] instance of the configured request parameters.
|
|
94
|
-
* @param abortSignal A signal object that allows you to communicate with a request (such as the `fetch` request)
|
|
95
|
-
* and, if required, abort it using the `AbortController` object.
|
|
96
|
-
*
|
|
97
|
-
* For more information, see the [`AbortController` documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
|
98
|
-
*
|
|
99
|
-
* @returns Messages [[StreamApi.Messages]] from a stream layer
|
|
100
|
-
*/
|
|
101
|
-
poll(request, abortSignal) {
|
|
102
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
if (request.getMode() === "parallel" && !request.getSubscriptionId()) {
|
|
104
|
-
return Promise.reject(new Error("Error: for 'parallel' mode 'subscriptionId' is required."));
|
|
105
|
-
}
|
|
106
|
-
if (!this.subscribtionNodeBaseUrl) {
|
|
107
|
-
return Promise.reject(new Error(`No valid nodeBaseurl provided for the subscribtion id=${request.getSubscriptionId()}, please check your subscribtion`));
|
|
108
|
-
}
|
|
109
|
-
const requestBuilder = new olp_sdk_core_1.DataStoreRequestBuilder(this.settings.downloadManager, this.subscribtionNodeBaseUrl, this.settings.token, abortSignal);
|
|
110
|
-
const consumeDataParams = {
|
|
111
|
-
layerId: this.layerId,
|
|
112
|
-
mode: request.getMode(),
|
|
113
|
-
subscriptionId: request.getSubscriptionId(),
|
|
114
|
-
xCorrelationId: this.xCorrelationId
|
|
115
|
-
};
|
|
116
|
-
const consumeResponse = yield olp_sdk_dataservice_api_1.StreamApi.consumeData(requestBuilder, consumeDataParams)
|
|
117
|
-
.then((response) => __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
const data = yield response.json();
|
|
119
|
-
return Promise.resolve({
|
|
120
|
-
xCorrelationId: response.headers.get("X-Correlation-Id") ||
|
|
121
|
-
undefined,
|
|
122
|
-
data: data && data.messages ? data.messages : []
|
|
123
|
-
});
|
|
124
|
-
}))
|
|
125
|
-
.catch(error => Promise.reject(error));
|
|
126
|
-
// Update xCorrelationId
|
|
127
|
-
this.xCorrelationId = consumeResponse.xCorrelationId;
|
|
128
|
-
if (consumeResponse.data.length > 0) {
|
|
129
|
-
// Commit offsets
|
|
130
|
-
const latestOffsets = consumeResponse.data
|
|
131
|
-
.map(msg => msg.offset)
|
|
132
|
-
.reduce((acc, curr) => {
|
|
133
|
-
acc[curr.partition] =
|
|
134
|
-
acc[curr.partition] > curr.offset
|
|
135
|
-
? acc[curr.partition]
|
|
136
|
-
: curr.offset;
|
|
137
|
-
return acc;
|
|
138
|
-
}, {});
|
|
139
|
-
yield olp_sdk_dataservice_api_1.StreamApi.doCommitOffsets(requestBuilder, {
|
|
140
|
-
commitOffsets: {
|
|
141
|
-
offsets: Object.keys(latestOffsets).map(key => ({
|
|
142
|
-
partition: +key,
|
|
143
|
-
offset: latestOffsets[key]
|
|
144
|
-
}))
|
|
145
|
-
},
|
|
146
|
-
subscriptionId: request.getSubscriptionId(),
|
|
147
|
-
mode: request.getMode(),
|
|
148
|
-
layerId: this.layerId,
|
|
149
|
-
xCorrelationId: this.xCorrelationId
|
|
150
|
-
}).catch((error) => __awaiter(this, void 0, void 0, function* () {
|
|
151
|
-
console.log(`Commit offsets unsuccessful, error=${error.message}`);
|
|
152
|
-
}));
|
|
153
|
-
}
|
|
154
|
-
return Promise.resolve(consumeResponse.data);
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Method deletes a subscription to a layer. This operation removes the subscription from the service.
|
|
159
|
-
*
|
|
160
|
-
* @param request The [[UnsubscribeRequest]] instance of the configured request parameters.
|
|
161
|
-
* @param abortSignal A signal object that allows you to communicate with a request (such as the `fetch` request)
|
|
162
|
-
* and, if required, abort it using the `AbortController` object.
|
|
163
|
-
*
|
|
164
|
-
* For more information, see the [`AbortController` documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
|
165
|
-
*/
|
|
166
|
-
unsubscribe(request, abortSignal) {
|
|
167
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
-
if (request.getMode() === "parallel" && !request.getSubscriptionId()) {
|
|
169
|
-
return Promise.reject(new Error("Error: for 'parallel' mode 'subscriptionId' is required."));
|
|
170
|
-
}
|
|
171
|
-
if (!this.subscribtionNodeBaseUrl) {
|
|
172
|
-
return Promise.reject(new Error(`Subscribtion error. No valid nodeBaseurl provided for the subscribtion id=${request.getSubscriptionId()}, please check your subscribtion`));
|
|
173
|
-
}
|
|
174
|
-
const requestBuilder = new olp_sdk_core_1.DataStoreRequestBuilder(this.settings.downloadManager, this.subscribtionNodeBaseUrl, this.settings.token, abortSignal);
|
|
175
|
-
return olp_sdk_dataservice_api_1.StreamApi.deleteSubscription(requestBuilder, {
|
|
176
|
-
layerId: this.layerId,
|
|
177
|
-
mode: request.getMode(),
|
|
178
|
-
subscriptionId: request.getSubscriptionId(),
|
|
179
|
-
xCorrelationId: this.xCorrelationId
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Fetches partition data using data handle.
|
|
185
|
-
*
|
|
186
|
-
* @param message The message data of partition metadata.
|
|
187
|
-
* @param abortSignal A signal object that allows you to communicate with a request (such as the `fetch` request)
|
|
188
|
-
* and, if required, abort it using the `AbortController` object.
|
|
189
|
-
*
|
|
190
|
-
* For more information, see the [`AbortController` documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
|
191
|
-
*
|
|
192
|
-
* @return The data from the requested partition.
|
|
193
|
-
*/
|
|
194
|
-
getData(message, abortSignal) {
|
|
195
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
-
if (!message.metaData || !message.metaData.dataHandle) {
|
|
197
|
-
return Promise.reject(new Error("No data handle for this partition"));
|
|
198
|
-
}
|
|
199
|
-
const requestBuilder = yield olp_sdk_core_1.RequestFactory.create("blob", "v1", this.settings, this.catalogHrn, abortSignal).catch(error => Promise.reject(error));
|
|
200
|
-
return olp_sdk_dataservice_api_1.BlobApi.getBlob(requestBuilder, {
|
|
201
|
-
dataHandle: message.metaData.dataHandle,
|
|
202
|
-
layerId: this.layerId
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Method allows to start reading data from a specified offset.
|
|
208
|
-
* The message pointer can be moved to any offset in the layer (topic).
|
|
209
|
-
* Message consumption will start from that offset. Once you seek to an offset,
|
|
210
|
-
* there is no returning to the initial offset, unless the initial offset is saved.
|
|
211
|
-
*
|
|
212
|
-
* @param request The [[SeekRequest]] instance of the configured request parameters.
|
|
213
|
-
* @param abortSignal A signal object that allows you to communicate with a request (such as the `fetch` request)
|
|
214
|
-
* and, if required, abort it using the `AbortController` object.
|
|
215
|
-
*
|
|
216
|
-
* For more information, see the [`AbortController` documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
|
217
|
-
*
|
|
218
|
-
* @returns Response with status 200 if success.
|
|
219
|
-
*/
|
|
220
|
-
seek(request, abortSignal) {
|
|
221
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
222
|
-
const offsetsObject = request.getSeekOffsets();
|
|
223
|
-
if (!offsetsObject ||
|
|
224
|
-
!offsetsObject.offsets ||
|
|
225
|
-
!offsetsObject.offsets.length) {
|
|
226
|
-
return Promise.reject(new Error("Error: offsets are required."));
|
|
227
|
-
}
|
|
228
|
-
if (request.getMode() === "parallel" && !request.getSubscriptionId()) {
|
|
229
|
-
return Promise.reject(new Error("Error: for 'parallel' mode 'subscriptionId' is required."));
|
|
230
|
-
}
|
|
231
|
-
if (!this.subscribtionNodeBaseUrl) {
|
|
232
|
-
return Promise.reject(new Error(`Subscribtion error. No valid nodeBaseurl provided for the subscribtion id=${request.getSubscriptionId()}, please check your subscribtion`));
|
|
233
|
-
}
|
|
234
|
-
const requestBuilder = new olp_sdk_core_1.DataStoreRequestBuilder(this.settings.downloadManager, this.subscribtionNodeBaseUrl, this.settings.token, abortSignal);
|
|
235
|
-
return olp_sdk_dataservice_api_1.StreamApi.seekToOffset(requestBuilder, {
|
|
236
|
-
layerId: this.layerId,
|
|
237
|
-
seekOffsets: offsetsObject,
|
|
238
|
-
mode: request.getMode(),
|
|
239
|
-
subscriptionId: request.getSubscriptionId(),
|
|
240
|
-
xCorrelationId: this.xCorrelationId
|
|
241
|
-
})
|
|
242
|
-
.then((response) => __awaiter(this, void 0, void 0, function* () {
|
|
243
|
-
this.xCorrelationId =
|
|
244
|
-
response.headers.get("X-Correlation-Id") ||
|
|
245
|
-
this.xCorrelationId;
|
|
246
|
-
return response;
|
|
247
|
-
}))
|
|
248
|
-
.catch(err => Promise.reject(err));
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
exports.StreamLayerClient = StreamLayerClient;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (C) 2020 HERE Europe B.V.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*
|
|
17
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
18
|
-
* License-Filename: LICENSE
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.SubscribeRequest = void 0;
|
|
22
|
-
/**
|
|
23
|
-
* Prepares information for calls to the platform Stream Service.
|
|
24
|
-
*/
|
|
25
|
-
class SubscribeRequest {
|
|
26
|
-
/**
|
|
27
|
-
* Gets the subscription mode for the request.
|
|
28
|
-
*
|
|
29
|
-
* @return The subscription mode.
|
|
30
|
-
*/
|
|
31
|
-
getMode() {
|
|
32
|
-
return this.mode;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* A setter for the provided subscription mode.
|
|
36
|
-
*
|
|
37
|
-
* @param mode The subscription mode.
|
|
38
|
-
* @returns The [[SubscribeRequest]] instance that you can use to chain methods.
|
|
39
|
-
*/
|
|
40
|
-
withMode(mode) {
|
|
41
|
-
this.mode = mode;
|
|
42
|
-
return this;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Gets the subscription id for the request.
|
|
46
|
-
*
|
|
47
|
-
* @return The subscription id.
|
|
48
|
-
*/
|
|
49
|
-
getSubscriptionId() {
|
|
50
|
-
return this.subscriptionId;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* A setter for the provided subscription id.
|
|
54
|
-
*
|
|
55
|
-
* @param id The subscription id.
|
|
56
|
-
* @returns The [[SubscribeRequest]] instance that you can use to chain methods.
|
|
57
|
-
*/
|
|
58
|
-
withSubscriptionId(id) {
|
|
59
|
-
this.subscriptionId = id;
|
|
60
|
-
return this;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Gets the consumer id for the request.
|
|
64
|
-
*
|
|
65
|
-
* @return The consumer id.
|
|
66
|
-
*/
|
|
67
|
-
getConsumerId() {
|
|
68
|
-
return this.consumerId;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* A setter for the provided consumer id.
|
|
72
|
-
*
|
|
73
|
-
* @param id The consumer id.
|
|
74
|
-
* @returns The [[SubscribeRequest]] instance that you can use to chain methods.
|
|
75
|
-
*/
|
|
76
|
-
withConsumerId(id) {
|
|
77
|
-
this.consumerId = id;
|
|
78
|
-
return this;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Gets the subscriptionProperties for the request - consumer properties to use for this subscription.
|
|
82
|
-
*
|
|
83
|
-
* @return The subscriptionProperties.
|
|
84
|
-
*/
|
|
85
|
-
getSubscriptionProperties() {
|
|
86
|
-
return this.subscriptionProperties;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* A setter for the provided subscription properties.
|
|
90
|
-
*
|
|
91
|
-
* @param props The subscriptionProperties - consumer properties to use for this subscription.
|
|
92
|
-
* For more information, see the [subscription properties]
|
|
93
|
-
* (https://developer.here.com/documentation/data-api/data_dev_guide/rest/getting-data-stream.html#subscription-properties)
|
|
94
|
-
* @returns The [[SubscribeRequest]] instance that you can use to chain methods.
|
|
95
|
-
*/
|
|
96
|
-
withSubscriptionProperties(props) {
|
|
97
|
-
this.subscriptionProperties = props;
|
|
98
|
-
return this;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
exports.SubscribeRequest = SubscribeRequest;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SummaryRequest = void 0;
|
|
4
|
-
const olp_sdk_dataservice_read_1 = require("@here/olp-sdk-dataservice-read");
|
|
5
|
-
/**
|
|
6
|
-
* Prepares information for calls to get a summary from the platform Statistics Service.
|
|
7
|
-
*/
|
|
8
|
-
class SummaryRequest {
|
|
9
|
-
/**
|
|
10
|
-
* Gets the configured [[HRN]] string of the catalog HERE Resource Name(HRN) for the request.
|
|
11
|
-
*
|
|
12
|
-
* @return The configured [[HRN]] string.
|
|
13
|
-
*/
|
|
14
|
-
getCatalogHrn() {
|
|
15
|
-
return this.catalogHrn;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Gets a layer ID for the request.
|
|
19
|
-
*
|
|
20
|
-
* @return The layer ID string.
|
|
21
|
-
*/
|
|
22
|
-
getLayerId() {
|
|
23
|
-
return this.layerId;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* A setter for the provided catalog HERE Resource Name (HRN).
|
|
27
|
-
*
|
|
28
|
-
* @param hrn The catalog HRN.
|
|
29
|
-
* @returns The [[SummaryRequest]] instance that you can use to chain methods.
|
|
30
|
-
*/
|
|
31
|
-
withCatalogHrn(hrn) {
|
|
32
|
-
this.catalogHrn = hrn.toString();
|
|
33
|
-
return this;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* A setter for the provided `layerId` string.
|
|
37
|
-
*
|
|
38
|
-
* @param layerId The ID of the layer.
|
|
39
|
-
* @returns The [[SummaryRequest]] instance that you can use to chain methods.
|
|
40
|
-
*/
|
|
41
|
-
withLayerId(layerId) {
|
|
42
|
-
this.layerId = layerId;
|
|
43
|
-
return this;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* An optional free-form tag that is used for grouping billing records together.
|
|
47
|
-
*
|
|
48
|
-
* If supplied, it must be 4–16 characters long and contain only alphanumeric ASCII characters [A-Za-z0-9].
|
|
49
|
-
*
|
|
50
|
-
* @param tag The `BillingTag` string.
|
|
51
|
-
* @return The updated [[SummaryRequest]] instance that you can use to chain methods.
|
|
52
|
-
*/
|
|
53
|
-
withBillingTag(tag) {
|
|
54
|
-
this.billingTag = olp_sdk_dataservice_read_1.validateBillingTag(tag);
|
|
55
|
-
return this;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Gets a billing tag to group billing records together.
|
|
59
|
-
*
|
|
60
|
-
* @return The `BillingTag` string.
|
|
61
|
-
*/
|
|
62
|
-
getBillingTag() {
|
|
63
|
-
return this.billingTag;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.SummaryRequest = SummaryRequest;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (C) 2020-2021 HERE Europe B.V.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*
|
|
17
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
18
|
-
* License-Filename: LICENSE
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.TileRequest = void 0;
|
|
22
|
-
const olp_sdk_core_1 = require("@here/olp-sdk-core");
|
|
23
|
-
const olp_sdk_dataservice_read_1 = require("@here/olp-sdk-dataservice-read");
|
|
24
|
-
/**
|
|
25
|
-
* Prepares information for calls to get the tile blob data by the tile key.
|
|
26
|
-
*
|
|
27
|
-
* This class works only with versioned and volatile layers where the partitioning scheme is HERE Tile.
|
|
28
|
-
*
|
|
29
|
-
* You can initialize the request class once for a specific catalog, layer, and version (@see [[TileRequestParams]])
|
|
30
|
-
* and use it many times to get the a tile.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
*
|
|
34
|
-
* ```
|
|
35
|
-
* const params: TileRequestParams = {
|
|
36
|
-
* settings: "% your `OlpClientSettings` instance % ",
|
|
37
|
-
* catalogHrn: "% the HRN instance of your catalog %",
|
|
38
|
-
* layerId: "% your layer ID %",
|
|
39
|
-
* layerType: "% versioned or volatile %",
|
|
40
|
-
* catalogVersion: "% the catalog version; for versioned layers, the latest version is used by default %"
|
|
41
|
-
* }
|
|
42
|
-
*
|
|
43
|
-
* const request = new TileRequest(params);
|
|
44
|
-
*
|
|
45
|
-
* const requestForTile1 = request.withTileKey(yourTileKey1);
|
|
46
|
-
* const requestForTile2 = request.withTileKey(yourTileKey2);
|
|
47
|
-
*
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
class TileRequest {
|
|
51
|
-
constructor() {
|
|
52
|
-
this.fetchOption = olp_sdk_core_1.FetchOptions.OnlineIfNotFound;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* A geometric area represented as a HERE tile.
|
|
56
|
-
*
|
|
57
|
-
* @param quadKey Addresses a tile in the quadtree.
|
|
58
|
-
* @returns The updated [[TileRequest]] instance that you can use to chain methods.
|
|
59
|
-
*/
|
|
60
|
-
withTileKey(quadKey) {
|
|
61
|
-
this.quadKey = quadKey;
|
|
62
|
-
return this;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* An optional free-form tag that is used for grouping billing records together.
|
|
66
|
-
*
|
|
67
|
-
* If supplied, it must be 4–16 characters long and contain only alphanumeric ASCII characters [A–Za–z0–9].
|
|
68
|
-
*
|
|
69
|
-
* @param tag The `BillingTag` string.
|
|
70
|
-
* @return The updated [[TileRequest]] instance that you can use to chain methods.
|
|
71
|
-
*/
|
|
72
|
-
withBillingTag(tag) {
|
|
73
|
-
this.billingTag = olp_sdk_dataservice_read_1.validateBillingTag(tag);
|
|
74
|
-
return this;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Gets the configured [[QuadKey]] object for the request.
|
|
78
|
-
*
|
|
79
|
-
* @return The configured [[QuadKey]] object.
|
|
80
|
-
*/
|
|
81
|
-
getTileKey() {
|
|
82
|
-
return this.quadKey;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Gets a billing tag to group billing records together.
|
|
86
|
-
*
|
|
87
|
-
* @return The `BillingTag` string.
|
|
88
|
-
*/
|
|
89
|
-
getBillingTag() {
|
|
90
|
-
return this.billingTag;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Sets the fetch option that you can use to set the source from
|
|
94
|
-
* which data should be fetched.
|
|
95
|
-
*
|
|
96
|
-
* @see `getFetchOption()` for information on usage and format.
|
|
97
|
-
*
|
|
98
|
-
* @param option The `FetchOption` enum.
|
|
99
|
-
*
|
|
100
|
-
* @return A reference to the updated `PartitionsRequest` instance.
|
|
101
|
-
*/
|
|
102
|
-
withFetchOption(option) {
|
|
103
|
-
this.fetchOption = option;
|
|
104
|
-
return this;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Gets the fetch option that controls how requests are handled.
|
|
108
|
-
*
|
|
109
|
-
* The default option is `OnlineIfNotFound`. It queries the network if
|
|
110
|
-
* the requested resource is not in the cache.
|
|
111
|
-
*
|
|
112
|
-
* @return The fetch option.
|
|
113
|
-
*/
|
|
114
|
-
getFetchOption() {
|
|
115
|
-
return this.fetchOption;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
exports.TileRequest = TileRequest;
|