@here/olp-sdk-dataservice-read 1.13.0 → 2.0.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 +1 -1
- package/bundle.umd.dev.js +301 -0
- package/bundle.umd.min.js +1 -0
- package/lib/cache/MetadataCacheRepository.js +129 -0
- package/lib/cache/QuadTreeIndexCacheRepository.js +59 -0
- package/lib/cache/index.js +32 -0
- package/lib/client/ArtifactClient.js +96 -0
- package/lib/client/CatalogClient.js +206 -0
- package/lib/client/CatalogRequest.js +47 -0
- package/lib/client/CatalogVersionRequest.js +85 -0
- package/lib/client/CatalogsRequest.js +67 -0
- package/lib/client/ConfigClient.js +72 -0
- package/lib/client/DataRequest.js +115 -0
- package/lib/client/IndexLayerClient.js +111 -0
- package/lib/client/IndexQueryRequest.js +63 -0
- package/lib/client/LayerVersionsRequest.js +64 -0
- package/lib/client/PartitionsRequest.js +124 -0
- package/lib/client/PollRequest.js +63 -0
- package/lib/client/QuadKeyPartitionsRequest.js +110 -0
- package/lib/client/QuadTreeIndexRequest.js +168 -0
- package/lib/client/QueryClient.js +169 -0
- package/lib/client/SchemaDetailsRequest.js +68 -0
- package/lib/client/SchemaRequest.js +67 -0
- package/lib/client/SeekRequest.js +70 -0
- package/lib/client/StatisticsClient.js +127 -0
- package/lib/client/StatisticsRequest.js +134 -0
- package/lib/client/StreamLayerClient.js +252 -0
- package/lib/client/SubscribeRequest.js +101 -0
- package/lib/client/SummaryRequest.js +66 -0
- package/lib/client/TileRequest.js +118 -0
- package/lib/client/UnsubscribeRequest.js +63 -0
- package/lib/client/VersionedLayerClient.js +230 -0
- package/lib/client/VolatileLayerClient.js +194 -0
- package/lib/client/index.js +57 -0
- package/lib/index.js +33 -0
- package/lib/utils/getTile.js +166 -0
- package/lib/utils/index.js +33 -0
- package/lib/utils/validateBillingTag.js +37 -0
- package/lib/utils/validatePartitionsIdsList.js +38 -0
- package/package.json +9 -9
- package/webpack.config.js +26 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (C) 2019-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.QuadTreeIndexRequest = void 0;
|
|
22
|
+
const olp_sdk_dataservice_read_1 = require("@here/olp-sdk-dataservice-read");
|
|
23
|
+
/**
|
|
24
|
+
* Prepares information for calls to get quadtree metadata from the Query Service API.
|
|
25
|
+
*
|
|
26
|
+
* This class works only with versioned or volatile layers where the partitioning scheme is HERE Tile.
|
|
27
|
+
*/
|
|
28
|
+
class QuadTreeIndexRequest {
|
|
29
|
+
/**
|
|
30
|
+
* Constructs the [[QuadTreeIndexRequest]] instance for fetching the quadtree index from the Query Service API
|
|
31
|
+
* for volatile or versioned layers
|
|
32
|
+
*
|
|
33
|
+
* @param catalogHrn The catalog HERE Resource Name ([[HRN]]).
|
|
34
|
+
* @param layerId The ID of the layer.
|
|
35
|
+
* @param layerType The type of layer that you want to use for the request. By default, a layer of the versioned type is used.
|
|
36
|
+
* @return The [[QuadTreeIndexRequest]] instance
|
|
37
|
+
*/
|
|
38
|
+
constructor(catalogHrn, layerId, layerType = "versioned") {
|
|
39
|
+
this.catalogHrn = catalogHrn;
|
|
40
|
+
this.layerId = layerId;
|
|
41
|
+
this.layerType = layerType;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The version of the catalog against which you want to run the query.
|
|
45
|
+
* It must be a valid catalog version.
|
|
46
|
+
*
|
|
47
|
+
* @param version Specify the catalog version or, if you want to use the latest catalog version, set to undefined.
|
|
48
|
+
* @returns The updated [[QuadKeyPartitionsRequest]] instance that you can use to chain methods.
|
|
49
|
+
*/
|
|
50
|
+
withVersion(version) {
|
|
51
|
+
this.version = version;
|
|
52
|
+
return this;
|
|
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 [[QuadKeyPartitionsRequest]] instance that you can use to chain methods.
|
|
59
|
+
*/
|
|
60
|
+
withQuadKey(quadKey) {
|
|
61
|
+
this.quadKey = quadKey;
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The recursion depth of the response.
|
|
66
|
+
* The maximum allowed value for the depth parameter is 4.
|
|
67
|
+
*
|
|
68
|
+
* @param depth The recursion depth of the response.
|
|
69
|
+
* @returns The updated [[QuadKeyPartitionsRequest]] instance that you can use to chain methods.
|
|
70
|
+
*
|
|
71
|
+
* If set to 0, the response includes only data from the quadkey specified in the request.
|
|
72
|
+
* In this way, the depth describes the maximum length of the subQuadKeys in the response.
|
|
73
|
+
*/
|
|
74
|
+
withDepth(depth) {
|
|
75
|
+
this.depth = depth;
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* An optional free-form tag that is used for grouping billing records together.
|
|
80
|
+
*
|
|
81
|
+
* If supplied, it must be 4–16 characters long and contain only alphanumeric ASCII characters [A-Za-z0-9].
|
|
82
|
+
*
|
|
83
|
+
* @param tag The `BillingTag` string.
|
|
84
|
+
* @return The updated [[QuadTreeIndexRequest]] instance that you can use to chain methods.
|
|
85
|
+
*/
|
|
86
|
+
withBillingTag(tag) {
|
|
87
|
+
this.billingTag = olp_sdk_dataservice_read_1.validateBillingTag(tag);
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A setter for the provided additional fields.
|
|
92
|
+
*
|
|
93
|
+
* @param additionalFields Array of strings. Array could contain next values "dataSize" | "checksum" | "compressedDataSize | "crc"".
|
|
94
|
+
* This values could be useful for getPartitions method from versionedLayerClient and volatileLayerClient.
|
|
95
|
+
*
|
|
96
|
+
* @returns The updated [[QuadTreeIndexRequest]] instance that you can use to chain methods.
|
|
97
|
+
*/
|
|
98
|
+
withAdditionalFields(additionalFields) {
|
|
99
|
+
this.additionalFields = additionalFields;
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The configured catalog version for the request.
|
|
104
|
+
*
|
|
105
|
+
* @return The catalog version number.
|
|
106
|
+
*/
|
|
107
|
+
getVersion() {
|
|
108
|
+
return this.version;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Gets the configured [[QuadKey]] object for the request.
|
|
112
|
+
*
|
|
113
|
+
* @return The the configured [[QuadKey]] object.
|
|
114
|
+
*/
|
|
115
|
+
getQuadKey() {
|
|
116
|
+
return this.quadKey;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Gets the configured depth for the request.
|
|
120
|
+
*
|
|
121
|
+
* @return The number of the configured depth.
|
|
122
|
+
*/
|
|
123
|
+
getDepth() {
|
|
124
|
+
return this.depth || 0;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Gets the configured type of the layer for the request.
|
|
128
|
+
* By default, a layer of the versioned type is used.
|
|
129
|
+
*
|
|
130
|
+
* @return The layer type.
|
|
131
|
+
*/
|
|
132
|
+
getLayerType() {
|
|
133
|
+
return this.layerType;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Gets the configured [[HRN]] instance of the catalog HERE Resource Name(HRN) for the request.
|
|
137
|
+
*
|
|
138
|
+
* @return The configured [[HRN]] instance.
|
|
139
|
+
*/
|
|
140
|
+
getCatalogHrn() {
|
|
141
|
+
return this.catalogHrn;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Gets a layer ID for the request.
|
|
145
|
+
*
|
|
146
|
+
* @return The layer ID string.
|
|
147
|
+
*/
|
|
148
|
+
getLayerId() {
|
|
149
|
+
return this.layerId;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Gets a billing tag to group billing records together.
|
|
153
|
+
*
|
|
154
|
+
* @return The `BillingTag` string.
|
|
155
|
+
*/
|
|
156
|
+
getBillingTag() {
|
|
157
|
+
return this.billingTag;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Gets the additional fields for the request.
|
|
161
|
+
*
|
|
162
|
+
* @return Additional fields.
|
|
163
|
+
*/
|
|
164
|
+
getAdditionalFields() {
|
|
165
|
+
return this.additionalFields;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
exports.QuadTreeIndexRequest = QuadTreeIndexRequest;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (C) 2019-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
|
+
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.QueryClient = 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
|
+
const olp_sdk_dataservice_read_1 = require("@here/olp-sdk-dataservice-read");
|
|
34
|
+
/**
|
|
35
|
+
* A client for the Query Service API that provides a way to get information (metadata)
|
|
36
|
+
* about layers and partitions stored in a catalog.
|
|
37
|
+
* This service exposes the metadata for a single partition that you can query one by one or using a parent tile.
|
|
38
|
+
*/
|
|
39
|
+
class QueryClient {
|
|
40
|
+
/**
|
|
41
|
+
* Constructs a new client for the Query Service API.
|
|
42
|
+
*
|
|
43
|
+
* @param settings The [[OlpClientSettings]] instance.
|
|
44
|
+
* @return The [[QueryClient]] instance.
|
|
45
|
+
*/
|
|
46
|
+
constructor(settings) {
|
|
47
|
+
this.settings = settings;
|
|
48
|
+
this.apiVersion = "v1";
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Fetches the quadtree index.
|
|
52
|
+
*
|
|
53
|
+
* @param request The configured [[QuadTreeIndexRequest]] instance.
|
|
54
|
+
* @param abortSignal A signal object that allows you to communicate with a request (such as the `fetch` request)
|
|
55
|
+
* and, if required, abort it using the `AbortController` object.
|
|
56
|
+
*
|
|
57
|
+
* For more information, see the [`AbortController` documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
|
58
|
+
*
|
|
59
|
+
* @return The quadtree index object.
|
|
60
|
+
*/
|
|
61
|
+
fetchQuadTreeIndex(request, abortSignal) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const quadKey = request.getQuadKey();
|
|
64
|
+
const layerId = request.getLayerId();
|
|
65
|
+
if (!quadKey || !olp_sdk_core_1.TileKey.isValid(quadKey)) {
|
|
66
|
+
return Promise.reject("Please provide correct QuadKey");
|
|
67
|
+
}
|
|
68
|
+
if (!layerId) {
|
|
69
|
+
return Promise.reject("Please provide correct Id of the Layer");
|
|
70
|
+
}
|
|
71
|
+
let catalogVersion = request.getVersion();
|
|
72
|
+
if (request.getLayerType() === "versioned" &&
|
|
73
|
+
catalogVersion === undefined) {
|
|
74
|
+
catalogVersion = yield this.getCatalogLatestVersion(request.getCatalogHrn(), abortSignal, request.getBillingTag()).catch(error => Promise.reject(`Error getting the last catalog version: ${error}`));
|
|
75
|
+
}
|
|
76
|
+
if (request.getLayerType() === "versioned" &&
|
|
77
|
+
catalogVersion === undefined) {
|
|
78
|
+
return Promise.reject(`Please provide correct catalog version`);
|
|
79
|
+
}
|
|
80
|
+
const requestBuilder = yield olp_sdk_core_1.RequestFactory.create("query", this.apiVersion, this.settings, request.getCatalogHrn(), abortSignal).catch(error => Promise.reject(`Erorr creating request object for query service: ${error}`));
|
|
81
|
+
const subQuadKeysMaxLength = request.getDepth();
|
|
82
|
+
let fetchingQuadTreeIndexFunction;
|
|
83
|
+
let paramsForFetchQuadTreeIndex = {
|
|
84
|
+
version: 0,
|
|
85
|
+
layerId,
|
|
86
|
+
depth: subQuadKeysMaxLength,
|
|
87
|
+
quadKey: olp_sdk_core_1.TileKey.fromRowColumnLevel(quadKey.row, quadKey.column, quadKey.level)
|
|
88
|
+
.mortonCode()
|
|
89
|
+
.toString(),
|
|
90
|
+
billingTag: request.getBillingTag(),
|
|
91
|
+
additionalFields: request.getAdditionalFields()
|
|
92
|
+
};
|
|
93
|
+
if (request.getLayerType() === "volatile") {
|
|
94
|
+
fetchingQuadTreeIndexFunction = olp_sdk_dataservice_api_1.QueryApi.quadTreeIndexVolatile;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
fetchingQuadTreeIndexFunction = olp_sdk_dataservice_api_1.QueryApi.quadTreeIndex;
|
|
98
|
+
paramsForFetchQuadTreeIndex = Object.assign(Object.assign({}, paramsForFetchQuadTreeIndex), { version: catalogVersion });
|
|
99
|
+
}
|
|
100
|
+
return fetchingQuadTreeIndexFunction(requestBuilder, paramsForFetchQuadTreeIndex);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Gets partitions using their IDs.
|
|
105
|
+
*
|
|
106
|
+
* @param request The `PartitionsRequest` instance.
|
|
107
|
+
* @param layerId The ID of the layer from which you want to get partitions.
|
|
108
|
+
* @param hrn The HERE Resource Name (HRN) of the layer.
|
|
109
|
+
* @param abortSignal A signal object that allows you to communicate with a request (such as the `fetch` request)
|
|
110
|
+
* and, if required, abort it using the `AbortController` object.
|
|
111
|
+
*
|
|
112
|
+
* For more information, see the [`AbortController` documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
|
113
|
+
*
|
|
114
|
+
* @return The requested partitions.
|
|
115
|
+
*/
|
|
116
|
+
getPartitionsById(request, layerId, hrn, abortSignal, catalogVersion) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
const idsList = request.getPartitionIds();
|
|
119
|
+
if (!idsList) {
|
|
120
|
+
return Promise.reject("Please provide correct partitionIds list");
|
|
121
|
+
}
|
|
122
|
+
const cache = new olp_sdk_dataservice_read_1.MetadataCacheRepository(this.settings.cache);
|
|
123
|
+
if (request.getFetchOption() !== olp_sdk_core_1.FetchOptions.OnlineOnly) {
|
|
124
|
+
const cachedPartitions = cache.get(request, hrn.toString(), layerId, catalogVersion);
|
|
125
|
+
if (cachedPartitions) {
|
|
126
|
+
return Promise.resolve({
|
|
127
|
+
partitions: cachedPartitions
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const requestBuilder = yield olp_sdk_core_1.RequestFactory.create("query", this.apiVersion, this.settings, hrn, abortSignal).catch(error => Promise.reject(`Erorr creating request object for query service: ${error}`));
|
|
132
|
+
const medatada = yield olp_sdk_dataservice_api_1.QueryApi.getPartitionsById(requestBuilder, {
|
|
133
|
+
layerId,
|
|
134
|
+
partition: idsList,
|
|
135
|
+
additionalFields: request.getAdditionalFields(),
|
|
136
|
+
version: catalogVersion !== undefined ? `${catalogVersion}` : undefined
|
|
137
|
+
}).catch(err => Promise.reject(err));
|
|
138
|
+
if (request.getFetchOption() !== olp_sdk_core_1.FetchOptions.OnlineOnly &&
|
|
139
|
+
medatada &&
|
|
140
|
+
medatada.partitions &&
|
|
141
|
+
medatada.partitions.length) {
|
|
142
|
+
const partitions = medatada.partitions.map(partition => ({
|
|
143
|
+
checksum: partition.checksum,
|
|
144
|
+
compressedDataSize: partition.compressedDataSize,
|
|
145
|
+
dataHandle: partition.dataHandle || "",
|
|
146
|
+
dataSize: partition.dataSize,
|
|
147
|
+
partition: partition.partition,
|
|
148
|
+
version: partition.version
|
|
149
|
+
}));
|
|
150
|
+
cache.put(request, hrn.toString(), layerId, partitions, catalogVersion);
|
|
151
|
+
}
|
|
152
|
+
return Promise.resolve(medatada);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Gets the latest available catalog version
|
|
157
|
+
*/
|
|
158
|
+
getCatalogLatestVersion(catalogHrn, abortSignal, billingTag) {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
const request = yield olp_sdk_core_1.RequestFactory.create("metadata", this.apiVersion, this.settings, catalogHrn, abortSignal).catch(error => Promise.reject(`Erorr creating request object for metadata service: ${error}`));
|
|
161
|
+
const latestVersion = yield olp_sdk_dataservice_api_1.MetadataApi.latestVersion(request, {
|
|
162
|
+
startVersion: -1,
|
|
163
|
+
billingTag
|
|
164
|
+
}).catch(error => Promise.reject(error));
|
|
165
|
+
return Promise.resolve(latestVersion.version);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
exports.QueryClient = QueryClient;
|
|
@@ -0,0 +1,68 @@
|
|
|
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.SchemaDetailsRequest = void 0;
|
|
22
|
+
const olp_sdk_dataservice_read_1 = require("@here/olp-sdk-dataservice-read");
|
|
23
|
+
/**
|
|
24
|
+
* Prepares information for calls to the platform Artifact Service.
|
|
25
|
+
*/
|
|
26
|
+
class SchemaDetailsRequest {
|
|
27
|
+
/**
|
|
28
|
+
* Gets schema metadata for the request.
|
|
29
|
+
*
|
|
30
|
+
* @param schemaDetailsRequest The [[SchemaDetailsRequest]] instance.
|
|
31
|
+
* @returns An object with the schema metadata.
|
|
32
|
+
*/
|
|
33
|
+
getSchema() {
|
|
34
|
+
return this.schemaHrn;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Sets a value of a schema HERE Resource Name (HRN) that is used in
|
|
38
|
+
* the `getSchema` and `getSchemaDetails` methods of [[ArtifactClient]].
|
|
39
|
+
*
|
|
40
|
+
* @param schemaHrn The layer schema HRN.
|
|
41
|
+
* @return The updated [[SchemaDetailsRequest]] instance that you can use to chain methods.
|
|
42
|
+
*/
|
|
43
|
+
withSchema(schemaHrn) {
|
|
44
|
+
this.schemaHrn = schemaHrn;
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* An optional free-form tag that is used for grouping billing records together.
|
|
49
|
+
*
|
|
50
|
+
* If supplied, it must be 4–16 characters long and contain only alphanumeric ASCII characters [A-Za-z0-9].
|
|
51
|
+
*
|
|
52
|
+
* @param tag The `BillingTag` string.
|
|
53
|
+
* @return The updated [[SchemaDetailsRequest]] instance that you can use to chain methods.
|
|
54
|
+
*/
|
|
55
|
+
withBillingTag(tag) {
|
|
56
|
+
this.billingTag = olp_sdk_dataservice_read_1.validateBillingTag(tag);
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Gets a billing tag to group billing records together.
|
|
61
|
+
*
|
|
62
|
+
* @return The `BillingTag` string.
|
|
63
|
+
*/
|
|
64
|
+
getBillingTag() {
|
|
65
|
+
return this.billingTag;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.SchemaDetailsRequest = SchemaDetailsRequest;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (C) 2019 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.SchemaRequest = void 0;
|
|
22
|
+
const olp_sdk_dataservice_read_1 = require("@here/olp-sdk-dataservice-read");
|
|
23
|
+
/**
|
|
24
|
+
* Prepares information for calls to the platform Artifact Service.
|
|
25
|
+
*/
|
|
26
|
+
class SchemaRequest {
|
|
27
|
+
/**
|
|
28
|
+
* Gets the `Variant` object of the schema for the request.
|
|
29
|
+
*
|
|
30
|
+
* @return The `Variant` object of the schema.
|
|
31
|
+
*/
|
|
32
|
+
getVariant() {
|
|
33
|
+
return this.variant;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Sets a value of a schema HERE Resource Name (HRN) that is used in
|
|
37
|
+
* the `getSchema` and `getSchemaDetails` methods of [[ArtifactClient]].
|
|
38
|
+
*
|
|
39
|
+
* @param variant The `Variant` object of the schema
|
|
40
|
+
* @return The [[SchemaRequest]] instance that you can use to chain methods.
|
|
41
|
+
*/
|
|
42
|
+
withVariant(variant) {
|
|
43
|
+
this.variant = variant;
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* An optional free-form tag that is used for grouping billing records together.
|
|
48
|
+
*
|
|
49
|
+
* If supplied, it must be 4–16 characters long and contain only alphanumeric ASCII characters [A-Za-z0-9].
|
|
50
|
+
*
|
|
51
|
+
* @param tag The `BillingTag` string.
|
|
52
|
+
* @return The updated [[SchemaRequest]] instance that you can use to chain methods.
|
|
53
|
+
*/
|
|
54
|
+
withBillingTag(tag) {
|
|
55
|
+
this.billingTag = olp_sdk_dataservice_read_1.validateBillingTag(tag);
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Gets a billing tag to group billing records together.
|
|
60
|
+
*
|
|
61
|
+
* @return The `BillingTag` string.
|
|
62
|
+
*/
|
|
63
|
+
getBillingTag() {
|
|
64
|
+
return this.billingTag;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.SchemaRequest = SchemaRequest;
|
|
@@ -0,0 +1,70 @@
|
|
|
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.SeekRequest = void 0;
|
|
22
|
+
/**
|
|
23
|
+
* Prepares information for calls to the platform Stream Service.
|
|
24
|
+
*/
|
|
25
|
+
class SeekRequest {
|
|
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 [[SeekRequest]] 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 [[SeekRequest]] instance that you can use to chain methods.
|
|
57
|
+
*/
|
|
58
|
+
withSubscriptionId(id) {
|
|
59
|
+
this.subscriptionId = id;
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
withSeekOffsets(offsets) {
|
|
63
|
+
this.offsets = offsets;
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
getSeekOffsets() {
|
|
67
|
+
return this.offsets;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.SeekRequest = SeekRequest;
|
|
@@ -0,0 +1,127 @@
|
|
|
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
|
+
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.StatisticsClient = 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
|
+
const olp_sdk_dataservice_read_1 = require("@here/olp-sdk-dataservice-read");
|
|
34
|
+
/**
|
|
35
|
+
* A client for the platform Statistics Service.
|
|
36
|
+
*/
|
|
37
|
+
class StatisticsClient {
|
|
38
|
+
/**
|
|
39
|
+
* Creates the [[StatisticsClient]] instance.
|
|
40
|
+
*
|
|
41
|
+
* @param settings The [[OlpClientSettings]] instance.
|
|
42
|
+
*
|
|
43
|
+
* @return The [[StatisticsClient]] instance.
|
|
44
|
+
*/
|
|
45
|
+
constructor(settings) {
|
|
46
|
+
this.settings = settings;
|
|
47
|
+
this.apiVersion = "v1";
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Fetches and returns a layer summary from the platform Statistics Service.
|
|
51
|
+
*
|
|
52
|
+
* @param summaryRequest Parameters that are needed to fetch the layer summary.
|
|
53
|
+
* Includes [[catalogHrn]] and [[layerId]].
|
|
54
|
+
*
|
|
55
|
+
* @returns A promise with the layer summary.
|
|
56
|
+
*/
|
|
57
|
+
getSummary(summaryRequest) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const layerId = summaryRequest.getLayerId();
|
|
60
|
+
const catalogHrn = summaryRequest.getCatalogHrn();
|
|
61
|
+
if (catalogHrn === undefined) {
|
|
62
|
+
return Promise.reject(new Error(`No catalogHrn provided`));
|
|
63
|
+
}
|
|
64
|
+
if (layerId === undefined) {
|
|
65
|
+
return Promise.reject(new Error(`No layerId provided`));
|
|
66
|
+
}
|
|
67
|
+
const coverageRequestBuilder = yield this.getRequestBuilder(catalogHrn).catch(error => Promise.reject(error));
|
|
68
|
+
return olp_sdk_dataservice_api_1.CoverageApi.getDataCoverageSummary(coverageRequestBuilder, {
|
|
69
|
+
layerId
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Depending on the map type that you specify in the [[StatisticsRequest]] instance, gets the [[StatisticsRequest]] instance
|
|
75
|
+
* with one of the following settings:
|
|
76
|
+
* * BITMAP – fetches a bitmap that represents the availability of data in partitions.
|
|
77
|
+
* * SIZEMAP – fetches a heatmap that represents a partition size.
|
|
78
|
+
* * TIMEMAP – fetches a heatmap that represents partition update time.
|
|
79
|
+
*
|
|
80
|
+
* @param statisticsRequest The [[StatisticsRequest]] instance with the requested settings.
|
|
81
|
+
*
|
|
82
|
+
* @return The [StatisticsRequest]] instance with the requested settings.
|
|
83
|
+
*/
|
|
84
|
+
getStatistics(statisticsRequest) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
const layerId = statisticsRequest.getLayerId();
|
|
87
|
+
const catalogHRN = statisticsRequest.getCatalogHrn();
|
|
88
|
+
const typemap = statisticsRequest.getTypemap();
|
|
89
|
+
const datalevel = statisticsRequest.getDataLevel();
|
|
90
|
+
if (catalogHRN === undefined) {
|
|
91
|
+
return Promise.reject(new Error(`No catalogHrn provided`));
|
|
92
|
+
}
|
|
93
|
+
if (layerId === undefined) {
|
|
94
|
+
return Promise.reject(new Error(`No layerId provided`));
|
|
95
|
+
}
|
|
96
|
+
if (typemap === undefined) {
|
|
97
|
+
return Promise.reject(new Error(`No typemap provided`));
|
|
98
|
+
}
|
|
99
|
+
const coverageRequestBuilder = yield this.getRequestBuilder(catalogHRN).catch(error => Promise.reject(error));
|
|
100
|
+
let request;
|
|
101
|
+
switch (typemap) {
|
|
102
|
+
case olp_sdk_dataservice_read_1.CoverageDataType.BITMAP:
|
|
103
|
+
request = olp_sdk_dataservice_api_1.CoverageApi.getDataCoverageTile;
|
|
104
|
+
break;
|
|
105
|
+
case olp_sdk_dataservice_read_1.CoverageDataType.SIZEMAP:
|
|
106
|
+
request = olp_sdk_dataservice_api_1.CoverageApi.getDataCoverageSizeMap;
|
|
107
|
+
break;
|
|
108
|
+
case olp_sdk_dataservice_read_1.CoverageDataType.TIMEMAP:
|
|
109
|
+
request = olp_sdk_dataservice_api_1.CoverageApi.getDataCoverageTimeMap;
|
|
110
|
+
break;
|
|
111
|
+
default:
|
|
112
|
+
return Promise.reject(new Error(`Incorrect typemap provided: ${typemap}`));
|
|
113
|
+
}
|
|
114
|
+
return request(coverageRequestBuilder, {
|
|
115
|
+
layerId,
|
|
116
|
+
datalevel,
|
|
117
|
+
catalogHRN
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
getRequestBuilder(hrn) {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
return olp_sdk_core_1.RequestFactory.create("statistics", this.apiVersion, this.settings, olp_sdk_core_1.HRN.fromString(hrn));
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.StatisticsClient = StatisticsClient;
|