@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,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,24 +17,17 @@
|
|
|
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.StatisticsClient = 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 StatisticsRequest_1 = require("./StatisticsRequest");
|
|
34
25
|
/**
|
|
35
26
|
* A client for the platform Statistics Service.
|
|
36
27
|
*/
|
|
37
28
|
class StatisticsClient {
|
|
29
|
+
settings;
|
|
30
|
+
apiVersion = "v1";
|
|
38
31
|
/**
|
|
39
32
|
* Creates the [[StatisticsClient]] instance.
|
|
40
33
|
*
|
|
@@ -44,7 +37,6 @@ class StatisticsClient {
|
|
|
44
37
|
*/
|
|
45
38
|
constructor(settings) {
|
|
46
39
|
this.settings = settings;
|
|
47
|
-
this.apiVersion = "v1";
|
|
48
40
|
}
|
|
49
41
|
/**
|
|
50
42
|
* Fetches and returns a layer summary from the platform Statistics Service.
|
|
@@ -54,20 +46,18 @@ class StatisticsClient {
|
|
|
54
46
|
*
|
|
55
47
|
* @returns A promise with the layer summary.
|
|
56
48
|
*/
|
|
57
|
-
getSummary(summaryRequest) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
layerId
|
|
70
|
-
});
|
|
49
|
+
async getSummary(summaryRequest) {
|
|
50
|
+
const layerId = summaryRequest.getLayerId();
|
|
51
|
+
const catalogHrn = summaryRequest.getCatalogHrn();
|
|
52
|
+
if (catalogHrn === undefined) {
|
|
53
|
+
return Promise.reject(new Error(`No catalogHrn provided`));
|
|
54
|
+
}
|
|
55
|
+
if (layerId === undefined) {
|
|
56
|
+
return Promise.reject(new Error(`No layerId provided`));
|
|
57
|
+
}
|
|
58
|
+
const coverageRequestBuilder = await this.getRequestBuilder(catalogHrn);
|
|
59
|
+
return olp_sdk_dataservice_api_1.CoverageApi.getDataCoverageSummary(coverageRequestBuilder, {
|
|
60
|
+
layerId
|
|
71
61
|
});
|
|
72
62
|
}
|
|
73
63
|
/**
|
|
@@ -81,47 +71,43 @@ class StatisticsClient {
|
|
|
81
71
|
*
|
|
82
72
|
* @return The [StatisticsRequest]] instance with the requested settings.
|
|
83
73
|
*/
|
|
84
|
-
getStatistics(statisticsRequest) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
catalogHRN
|
|
118
|
-
});
|
|
74
|
+
async getStatistics(statisticsRequest) {
|
|
75
|
+
const layerId = statisticsRequest.getLayerId();
|
|
76
|
+
const catalogHRN = statisticsRequest.getCatalogHrn();
|
|
77
|
+
const typemap = statisticsRequest.getTypemap();
|
|
78
|
+
const datalevel = statisticsRequest.getDataLevel();
|
|
79
|
+
if (catalogHRN === undefined) {
|
|
80
|
+
return Promise.reject(new Error(`No catalogHrn provided`));
|
|
81
|
+
}
|
|
82
|
+
if (layerId === undefined) {
|
|
83
|
+
return Promise.reject(new Error(`No layerId provided`));
|
|
84
|
+
}
|
|
85
|
+
if (typemap === undefined) {
|
|
86
|
+
return Promise.reject(new Error(`No typemap provided`));
|
|
87
|
+
}
|
|
88
|
+
const coverageRequestBuilder = await this.getRequestBuilder(catalogHRN);
|
|
89
|
+
let request;
|
|
90
|
+
switch (typemap) {
|
|
91
|
+
case StatisticsRequest_1.CoverageDataType.BITMAP:
|
|
92
|
+
request = olp_sdk_dataservice_api_1.CoverageApi.getDataCoverageTile;
|
|
93
|
+
break;
|
|
94
|
+
case StatisticsRequest_1.CoverageDataType.SIZEMAP:
|
|
95
|
+
request = olp_sdk_dataservice_api_1.CoverageApi.getDataCoverageSizeMap;
|
|
96
|
+
break;
|
|
97
|
+
case StatisticsRequest_1.CoverageDataType.TIMEMAP:
|
|
98
|
+
request = olp_sdk_dataservice_api_1.CoverageApi.getDataCoverageTimeMap;
|
|
99
|
+
break;
|
|
100
|
+
default:
|
|
101
|
+
return Promise.reject(new Error(`Incorrect typemap provided: ${typemap}`));
|
|
102
|
+
}
|
|
103
|
+
return request(coverageRequestBuilder, {
|
|
104
|
+
layerId,
|
|
105
|
+
datalevel,
|
|
106
|
+
catalogHRN
|
|
119
107
|
});
|
|
120
108
|
}
|
|
121
|
-
getRequestBuilder(hrn) {
|
|
122
|
-
return
|
|
123
|
-
return olp_sdk_core_1.RequestFactory.create("statistics", this.apiVersion, this.settings, olp_sdk_core_1.HRN.fromString(hrn));
|
|
124
|
-
});
|
|
109
|
+
async getRequestBuilder(hrn) {
|
|
110
|
+
return olp_sdk_core_1.RequestFactory.create("statistics", this.apiVersion, this.settings, olp_sdk_core_1.HRN.fromString(hrn));
|
|
125
111
|
}
|
|
126
112
|
}
|
|
127
113
|
exports.StatisticsClient = StatisticsClient;
|
|
@@ -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.
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.StatisticsRequest = exports.CoverageDataType = void 0;
|
|
22
|
-
const
|
|
22
|
+
const validateBillingTag_1 = require("../utils/validateBillingTag");
|
|
23
23
|
/**
|
|
24
24
|
* A map type that is supported by the platform Statistics Service.
|
|
25
25
|
*/
|
|
@@ -31,11 +31,16 @@ var CoverageDataType;
|
|
|
31
31
|
CoverageDataType["SIZEMAP"] = "heatmap/size";
|
|
32
32
|
/** A heatmap that represents partition update time. */
|
|
33
33
|
CoverageDataType["TIMEMAP"] = "heatmap/age";
|
|
34
|
-
})(CoverageDataType
|
|
34
|
+
})(CoverageDataType || (exports.CoverageDataType = CoverageDataType = {}));
|
|
35
35
|
/**
|
|
36
36
|
* Prepares information for calls to get statistics from the platform Statistics Service.
|
|
37
37
|
*/
|
|
38
38
|
class StatisticsRequest {
|
|
39
|
+
catalogHrn;
|
|
40
|
+
layerId;
|
|
41
|
+
typemap;
|
|
42
|
+
dataLevel;
|
|
43
|
+
billingTag;
|
|
39
44
|
/**
|
|
40
45
|
* Gets the configured [[HRN]] string of the catalog HERE Resource Name(HRN) for the request.
|
|
41
46
|
*
|
|
@@ -119,7 +124,7 @@ class StatisticsRequest {
|
|
|
119
124
|
* @return The updated [[StatisticsRequest]] instance that you can use to chain methods.
|
|
120
125
|
*/
|
|
121
126
|
withBillingTag(tag) {
|
|
122
|
-
this.billingTag =
|
|
127
|
+
this.billingTag = (0, validateBillingTag_1.validateBillingTag)(tag);
|
|
123
128
|
return this;
|
|
124
129
|
}
|
|
125
130
|
/**
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { HRN, OlpClientSettings } from "@here/olp-sdk-core";
|
|
2
2
|
import { StreamApi } from "@here/olp-sdk-dataservice-api";
|
|
3
|
-
import { PollRequest
|
|
3
|
+
import { PollRequest } from "./PollRequest";
|
|
4
|
+
import { SeekRequest } from "./SeekRequest";
|
|
5
|
+
import { SubscribeRequest } from "./SubscribeRequest";
|
|
6
|
+
import { UnsubscribeRequest } from "./UnsubscribeRequest";
|
|
4
7
|
export interface StreamLayerClientParams {
|
|
5
8
|
catalogHrn: HRN;
|
|
6
9
|
layerId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (C) 2020 HERE Europe B.V.
|
|
3
|
+
* Copyright (C) 2020-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,15 +17,6 @@
|
|
|
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.StreamLayerClient = void 0;
|
|
31
22
|
const olp_sdk_core_1 = require("@here/olp-sdk-core");
|
|
@@ -34,6 +25,12 @@ const olp_sdk_dataservice_api_1 = require("@here/olp-sdk-dataservice-api");
|
|
|
34
25
|
* Describes a stream layer.
|
|
35
26
|
*/
|
|
36
27
|
class StreamLayerClient {
|
|
28
|
+
apiVersion = "v2";
|
|
29
|
+
xCorrelationId;
|
|
30
|
+
subscribtionNodeBaseUrl;
|
|
31
|
+
catalogHrn;
|
|
32
|
+
layerId;
|
|
33
|
+
settings;
|
|
37
34
|
/**
|
|
38
35
|
* Creates the [[StreamLayerClient]] instance.
|
|
39
36
|
*
|
|
@@ -41,7 +38,6 @@ class StreamLayerClient {
|
|
|
41
38
|
* @return The [[StreamLayerClient]] instance.
|
|
42
39
|
*/
|
|
43
40
|
constructor(params) {
|
|
44
|
-
this.apiVersion = "v2";
|
|
45
41
|
this.catalogHrn = params.catalogHrn;
|
|
46
42
|
this.layerId = params.layerId;
|
|
47
43
|
this.settings = params.settings;
|
|
@@ -62,28 +58,24 @@ class StreamLayerClient {
|
|
|
62
58
|
*
|
|
63
59
|
* @returns Subscription Id
|
|
64
60
|
*/
|
|
65
|
-
subscribe(request, abortSignal) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
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);
|
|
61
|
+
async subscribe(request, abortSignal) {
|
|
62
|
+
const requestBuilder = await olp_sdk_core_1.RequestFactory.create("stream", this.apiVersion, this.settings, this.catalogHrn, abortSignal);
|
|
63
|
+
const subscribtionRequestParams = {
|
|
64
|
+
layerId: this.layerId,
|
|
65
|
+
mode: request.getMode(),
|
|
66
|
+
consumerId: request.getConsumerId(),
|
|
67
|
+
subscriptionId: request.getSubscriptionId(),
|
|
68
|
+
subscriptionProperties: request.getSubscriptionProperties()
|
|
69
|
+
};
|
|
70
|
+
const subscriptionResult = await olp_sdk_dataservice_api_1.StreamApi.subscribe(requestBuilder, subscribtionRequestParams).then(async (res) => {
|
|
71
|
+
const xCorrelationId = res.headers.get("X-Correlation-Id") || undefined;
|
|
72
|
+
const responseData = await res.json();
|
|
73
|
+
return Promise.resolve({ xCorrelationId, ...responseData });
|
|
86
74
|
});
|
|
75
|
+
// Update xCorrelationId
|
|
76
|
+
this.xCorrelationId = subscriptionResult.xCorrelationId;
|
|
77
|
+
this.subscribtionNodeBaseUrl = subscriptionResult.nodeBaseURL;
|
|
78
|
+
return Promise.resolve(subscriptionResult.subscriptionId);
|
|
87
79
|
}
|
|
88
80
|
/**
|
|
89
81
|
* Consumes data from a layer. Returns messages from a stream layer.
|
|
@@ -98,61 +90,56 @@ class StreamLayerClient {
|
|
|
98
90
|
*
|
|
99
91
|
* @returns Messages [[StreamApi.Messages]] from a stream layer
|
|
100
92
|
*/
|
|
101
|
-
poll(request, abortSignal) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
93
|
+
async poll(request, abortSignal) {
|
|
94
|
+
if (request.getMode() === "parallel" && !request.getSubscriptionId()) {
|
|
95
|
+
return Promise.reject(new Error("Error: for 'parallel' mode 'subscriptionId' is required."));
|
|
96
|
+
}
|
|
97
|
+
if (!this.subscribtionNodeBaseUrl) {
|
|
98
|
+
return Promise.reject(new Error(`No valid nodeBaseurl provided for the subscribtion id=${request.getSubscriptionId()}, please check your subscribtion`));
|
|
99
|
+
}
|
|
100
|
+
const requestBuilder = new olp_sdk_core_1.DataStoreRequestBuilder(this.settings.downloadManager, this.subscribtionNodeBaseUrl, this.settings.token, abortSignal);
|
|
101
|
+
const consumeDataParams = {
|
|
102
|
+
layerId: this.layerId,
|
|
103
|
+
mode: request.getMode(),
|
|
104
|
+
subscriptionId: request.getSubscriptionId(),
|
|
105
|
+
xCorrelationId: this.xCorrelationId
|
|
106
|
+
};
|
|
107
|
+
const consumeResponse = await olp_sdk_dataservice_api_1.StreamApi.consumeData(requestBuilder, consumeDataParams).then(async (response) => {
|
|
108
|
+
const data = await response.json();
|
|
109
|
+
return Promise.resolve({
|
|
110
|
+
xCorrelationId: response.headers.get("X-Correlation-Id") || undefined,
|
|
111
|
+
data: data && data.messages ? data.messages : []
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
// Update xCorrelationId
|
|
115
|
+
this.xCorrelationId = consumeResponse.xCorrelationId;
|
|
116
|
+
if (consumeResponse.data.length > 0) {
|
|
117
|
+
// Commit offsets
|
|
118
|
+
const latestOffsets = consumeResponse.data
|
|
119
|
+
.map((msg) => msg.offset)
|
|
120
|
+
.reduce((acc, curr) => {
|
|
121
|
+
acc[curr.partition] =
|
|
122
|
+
acc[curr.partition] > curr.offset
|
|
123
|
+
? acc[curr.partition]
|
|
124
|
+
: curr.offset;
|
|
125
|
+
return acc;
|
|
126
|
+
}, {});
|
|
127
|
+
await olp_sdk_dataservice_api_1.StreamApi.doCommitOffsets(requestBuilder, {
|
|
128
|
+
commitOffsets: {
|
|
129
|
+
offsets: Object.keys(latestOffsets).map((key) => ({
|
|
130
|
+
partition: +key,
|
|
131
|
+
offset: latestOffsets[key]
|
|
132
|
+
}))
|
|
133
|
+
},
|
|
113
134
|
subscriptionId: request.getSubscriptionId(),
|
|
135
|
+
mode: request.getMode(),
|
|
136
|
+
layerId: this.layerId,
|
|
114
137
|
xCorrelationId: this.xCorrelationId
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
-
});
|
|
138
|
+
}).catch(async (error) => {
|
|
139
|
+
console.log(`Commit offsets unsuccessful, error=${error.message}`);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return Promise.resolve(consumeResponse.data);
|
|
156
143
|
}
|
|
157
144
|
/**
|
|
158
145
|
* Method deletes a subscription to a layer. This operation removes the subscription from the service.
|
|
@@ -163,21 +150,19 @@ class StreamLayerClient {
|
|
|
163
150
|
*
|
|
164
151
|
* For more information, see the [`AbortController` documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
|
165
152
|
*/
|
|
166
|
-
unsubscribe(request, abortSignal) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
xCorrelationId: this.xCorrelationId
|
|
180
|
-
});
|
|
153
|
+
async unsubscribe(request, abortSignal) {
|
|
154
|
+
if (request.getMode() === "parallel" && !request.getSubscriptionId()) {
|
|
155
|
+
return Promise.reject(new Error("Error: for 'parallel' mode 'subscriptionId' is required."));
|
|
156
|
+
}
|
|
157
|
+
if (!this.subscribtionNodeBaseUrl) {
|
|
158
|
+
return Promise.reject(new Error(`Subscribtion error. No valid nodeBaseurl provided for the subscribtion id=${request.getSubscriptionId()}, please check your subscribtion`));
|
|
159
|
+
}
|
|
160
|
+
const requestBuilder = new olp_sdk_core_1.DataStoreRequestBuilder(this.settings.downloadManager, this.subscribtionNodeBaseUrl, this.settings.token, abortSignal);
|
|
161
|
+
return olp_sdk_dataservice_api_1.StreamApi.deleteSubscription(requestBuilder, {
|
|
162
|
+
layerId: this.layerId,
|
|
163
|
+
mode: request.getMode(),
|
|
164
|
+
subscriptionId: request.getSubscriptionId(),
|
|
165
|
+
xCorrelationId: this.xCorrelationId
|
|
181
166
|
});
|
|
182
167
|
}
|
|
183
168
|
/**
|
|
@@ -191,16 +176,14 @@ class StreamLayerClient {
|
|
|
191
176
|
*
|
|
192
177
|
* @return The data from the requested partition.
|
|
193
178
|
*/
|
|
194
|
-
getData(message, abortSignal) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
layerId: this.layerId
|
|
203
|
-
});
|
|
179
|
+
async getData(message, abortSignal) {
|
|
180
|
+
if (!message.metaData || !message.metaData.dataHandle) {
|
|
181
|
+
return Promise.reject(new Error("No data handle for this partition"));
|
|
182
|
+
}
|
|
183
|
+
const requestBuilder = await olp_sdk_core_1.RequestFactory.create("blob", "v1", this.settings, this.catalogHrn, abortSignal);
|
|
184
|
+
return olp_sdk_dataservice_api_1.BlobApi.getBlob(requestBuilder, {
|
|
185
|
+
dataHandle: message.metaData.dataHandle,
|
|
186
|
+
layerId: this.layerId
|
|
204
187
|
});
|
|
205
188
|
}
|
|
206
189
|
/**
|
|
@@ -217,35 +200,30 @@ class StreamLayerClient {
|
|
|
217
200
|
*
|
|
218
201
|
* @returns Response with status 200 if success.
|
|
219
202
|
*/
|
|
220
|
-
seek(request, abortSignal) {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
.
|
|
243
|
-
|
|
244
|
-
response.headers.get("X-Correlation-Id") ||
|
|
245
|
-
this.xCorrelationId;
|
|
246
|
-
return response;
|
|
247
|
-
}))
|
|
248
|
-
.catch(err => Promise.reject(err));
|
|
203
|
+
async seek(request, abortSignal) {
|
|
204
|
+
const offsetsObject = request.getSeekOffsets();
|
|
205
|
+
if (!offsetsObject ||
|
|
206
|
+
!offsetsObject.offsets ||
|
|
207
|
+
!offsetsObject.offsets.length) {
|
|
208
|
+
return Promise.reject(new Error("Error: offsets are required."));
|
|
209
|
+
}
|
|
210
|
+
if (request.getMode() === "parallel" && !request.getSubscriptionId()) {
|
|
211
|
+
return Promise.reject(new Error("Error: for 'parallel' mode 'subscriptionId' is required."));
|
|
212
|
+
}
|
|
213
|
+
if (!this.subscribtionNodeBaseUrl) {
|
|
214
|
+
return Promise.reject(new Error(`Subscribtion error. No valid nodeBaseurl provided for the subscribtion id=${request.getSubscriptionId()}, please check your subscribtion`));
|
|
215
|
+
}
|
|
216
|
+
const requestBuilder = new olp_sdk_core_1.DataStoreRequestBuilder(this.settings.downloadManager, this.subscribtionNodeBaseUrl, this.settings.token, abortSignal);
|
|
217
|
+
return olp_sdk_dataservice_api_1.StreamApi.seekToOffset(requestBuilder, {
|
|
218
|
+
layerId: this.layerId,
|
|
219
|
+
seekOffsets: offsetsObject,
|
|
220
|
+
mode: request.getMode(),
|
|
221
|
+
subscriptionId: request.getSubscriptionId(),
|
|
222
|
+
xCorrelationId: this.xCorrelationId
|
|
223
|
+
}).then(async (response) => {
|
|
224
|
+
this.xCorrelationId =
|
|
225
|
+
response.headers.get("X-Correlation-Id") || this.xCorrelationId;
|
|
226
|
+
return response;
|
|
249
227
|
});
|
|
250
228
|
}
|
|
251
229
|
}
|
|
@@ -23,6 +23,10 @@ exports.SubscribeRequest = void 0;
|
|
|
23
23
|
* Prepares information for calls to the platform Stream Service.
|
|
24
24
|
*/
|
|
25
25
|
class SubscribeRequest {
|
|
26
|
+
mode;
|
|
27
|
+
subscriptionId;
|
|
28
|
+
consumerId;
|
|
29
|
+
subscriptionProperties;
|
|
26
30
|
/**
|
|
27
31
|
* Gets the subscription mode for the request.
|
|
28
32
|
*
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SummaryRequest = void 0;
|
|
4
|
-
const
|
|
4
|
+
const validateBillingTag_1 = require("../utils/validateBillingTag");
|
|
5
5
|
/**
|
|
6
6
|
* Prepares information for calls to get a summary from the platform Statistics Service.
|
|
7
7
|
*/
|
|
8
8
|
class SummaryRequest {
|
|
9
|
+
catalogHrn;
|
|
10
|
+
layerId;
|
|
11
|
+
billingTag;
|
|
9
12
|
/**
|
|
10
13
|
* Gets the configured [[HRN]] string of the catalog HERE Resource Name(HRN) for the request.
|
|
11
14
|
*
|
|
@@ -51,7 +54,7 @@ class SummaryRequest {
|
|
|
51
54
|
* @return The updated [[SummaryRequest]] instance that you can use to chain methods.
|
|
52
55
|
*/
|
|
53
56
|
withBillingTag(tag) {
|
|
54
|
-
this.billingTag =
|
|
57
|
+
this.billingTag = (0, validateBillingTag_1.validateBillingTag)(tag);
|
|
55
58
|
return this;
|
|
56
59
|
}
|
|
57
60
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (C) 2020-
|
|
3
|
+
* Copyright (C) 2020-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.
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.TileRequest = void 0;
|
|
22
22
|
const olp_sdk_core_1 = require("@here/olp-sdk-core");
|
|
23
|
-
const
|
|
23
|
+
const validateBillingTag_1 = require("../utils/validateBillingTag");
|
|
24
24
|
/**
|
|
25
25
|
* Prepares information for calls to get the tile blob data by the tile key.
|
|
26
26
|
*
|
|
@@ -48,9 +48,9 @@ const olp_sdk_dataservice_read_1 = require("@here/olp-sdk-dataservice-read");
|
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
50
|
class TileRequest {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
quadKey;
|
|
52
|
+
billingTag;
|
|
53
|
+
fetchOption = olp_sdk_core_1.FetchOptions.OnlineIfNotFound;
|
|
54
54
|
/**
|
|
55
55
|
* A geometric area represented as a HERE tile.
|
|
56
56
|
*
|
|
@@ -70,7 +70,7 @@ class TileRequest {
|
|
|
70
70
|
* @return The updated [[TileRequest]] instance that you can use to chain methods.
|
|
71
71
|
*/
|
|
72
72
|
withBillingTag(tag) {
|
|
73
|
-
this.billingTag =
|
|
73
|
+
this.billingTag = (0, validateBillingTag_1.validateBillingTag)(tag);
|
|
74
74
|
return this;
|
|
75
75
|
}
|
|
76
76
|
/**
|