@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
package/lib/utils/getTile.js
DELETED
|
@@ -1,166 +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
|
-
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.fetchQuadTreeIndex = exports.getTile = 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
|
-
* Fetches asynchronously data from a tile or from its nearest ancestor if not found.
|
|
36
|
-
*
|
|
37
|
-
* The tile is a geometric area represented as a HERE tile.
|
|
38
|
-
* The quad tree metadata fetches the blob of needed tile from the HERE Query Service,
|
|
39
|
-
* then caches it, and returns to the user.
|
|
40
|
-
* To disable caching of metadata use `request.withFetchOption(FetchOptions.OnlineOnly)`.
|
|
41
|
-
*
|
|
42
|
-
* @param request Requests the [[TileRequest]] instance with the configured parameters.
|
|
43
|
-
* @see [[TileRequest]]
|
|
44
|
-
*
|
|
45
|
-
* @param abortSignal The signal object that allows you to communicate with a request (such as the `fetch` request)
|
|
46
|
-
* and, if required, abort it using the `AbortController` object.
|
|
47
|
-
* @see the [`AbortController` documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
*
|
|
51
|
-
* ```
|
|
52
|
-
* const params: GetTileParams = {
|
|
53
|
-
* settings: "% your `OlpClientSettings` instance % ",
|
|
54
|
-
* catalogHrn: "% the HRN instance of your catalog %",
|
|
55
|
-
* layerId: "% your layer ID %",
|
|
56
|
-
* layerType: "% versioned or volatile %",
|
|
57
|
-
* }
|
|
58
|
-
*
|
|
59
|
-
* const request = new TileRequest();
|
|
60
|
-
*
|
|
61
|
-
* const tile1 = await getTile(request.withTileKey(yourTileKey1), params);
|
|
62
|
-
* const tile2 = await getTile(request.withTileKey(yourTileKey2), params);
|
|
63
|
-
*
|
|
64
|
-
* ```
|
|
65
|
-
*
|
|
66
|
-
* @returns The blob of the requested tile or the blob of the closest parent Tile.
|
|
67
|
-
*/
|
|
68
|
-
function getTile(request, params, abortSignal) {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
let catalogVersion;
|
|
71
|
-
const quadKey = request.getTileKey();
|
|
72
|
-
if (!quadKey) {
|
|
73
|
-
return Promise.reject(new Error("Please provide correct QuadKey"));
|
|
74
|
-
}
|
|
75
|
-
if (params.layerType === "versioned") {
|
|
76
|
-
catalogVersion = params.catalogVersion;
|
|
77
|
-
}
|
|
78
|
-
const blobType = params.layerType === "versioned" ? "blob" : "volatile-blob";
|
|
79
|
-
const blobRequestBuilder = yield olp_sdk_core_1.RequestFactory.create(blobType, "v1", params.settings, params.catalogHrn, abortSignal).catch(error => Promise.reject(error));
|
|
80
|
-
const delta = 4;
|
|
81
|
-
const requestedTileKey = olp_sdk_core_1.TileKey.fromRowColumnLevel(quadKey.row, quadKey.column, quadKey.level);
|
|
82
|
-
let quadTreeIndex = null;
|
|
83
|
-
if (request.getFetchOption() !== olp_sdk_core_1.FetchOptions.OnlineOnly) {
|
|
84
|
-
const cache = new olp_sdk_dataservice_read_1.QuadTreeIndexCacheRepository(params.settings.cache);
|
|
85
|
-
for (let i = 1; i <= delta; i++) {
|
|
86
|
-
const parentInCache = requestedTileKey.changedLevelBy(-i);
|
|
87
|
-
const cachedTree = cache.get({
|
|
88
|
-
hrn: params.catalogHrn.toString(),
|
|
89
|
-
layerId: params.layerId,
|
|
90
|
-
depth: delta,
|
|
91
|
-
root: parentInCache,
|
|
92
|
-
version: catalogVersion
|
|
93
|
-
});
|
|
94
|
-
if (cachedTree) {
|
|
95
|
-
quadTreeIndex = cachedTree;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
const parentTileKey = requestedTileKey.changedLevelBy(-delta);
|
|
100
|
-
if (!quadTreeIndex) {
|
|
101
|
-
quadTreeIndex = yield fetchQuadTreeIndex(Object.assign(Object.assign({}, params), { catalogVersion, depth: delta, fetchOptions: request.getFetchOption(), tileKey: parentTileKey, abortSignal, billingTag: request.getBillingTag() })).catch(e => Promise.reject(e));
|
|
102
|
-
}
|
|
103
|
-
if (!quadTreeIndex.subQuads || !quadTreeIndex.subQuads.length) {
|
|
104
|
-
return Promise.resolve(new Response("No Content", {
|
|
105
|
-
status: 204,
|
|
106
|
-
statusText: "No Content"
|
|
107
|
-
}));
|
|
108
|
-
}
|
|
109
|
-
// Return the data for the requested QuadKey or for the closest parent
|
|
110
|
-
const subQuads = quadTreeIndex.subQuads;
|
|
111
|
-
let currentTileKey = requestedTileKey;
|
|
112
|
-
let currentDelta = delta;
|
|
113
|
-
for (let level = currentTileKey.level; level >= parentTileKey.level; --level) {
|
|
114
|
-
const metadata = subQuads.find(item => item.subQuadKey === currentTileKey.getSubHereTile(currentDelta));
|
|
115
|
-
if (metadata) {
|
|
116
|
-
return olp_sdk_dataservice_api_1.BlobApi.getBlob(blobRequestBuilder, {
|
|
117
|
-
dataHandle: metadata.dataHandle,
|
|
118
|
-
layerId: params.layerId,
|
|
119
|
-
billingTag: request.getBillingTag()
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
try {
|
|
123
|
-
currentTileKey = currentTileKey.parent();
|
|
124
|
-
currentDelta = parentTileKey.level - currentTileKey.level;
|
|
125
|
-
}
|
|
126
|
-
catch (error) {
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return Promise.reject(new Error(`Error getting blob for Tile: ${JSON.stringify(quadKey)}`));
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
exports.getTile = getTile;
|
|
134
|
-
/**
|
|
135
|
-
* The function should request quad tree index for the parent tile with delta 4
|
|
136
|
-
* and cache the responses in cache for later calls.
|
|
137
|
-
* @hidden
|
|
138
|
-
*/
|
|
139
|
-
function fetchQuadTreeIndex(params) {
|
|
140
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
-
const cache = new olp_sdk_dataservice_read_1.QuadTreeIndexCacheRepository(params.settings.cache);
|
|
142
|
-
const queryClient = new olp_sdk_dataservice_read_1.QueryClient(params.settings);
|
|
143
|
-
const quadTreeIndexRequest = new olp_sdk_dataservice_read_1.QuadTreeIndexRequest(params.catalogHrn, params.layerId, params.layerType)
|
|
144
|
-
.withQuadKey(params.tileKey)
|
|
145
|
-
.withDepth(params.depth);
|
|
146
|
-
if (params.layerType === "versioned") {
|
|
147
|
-
quadTreeIndexRequest.withVersion(params.catalogVersion);
|
|
148
|
-
}
|
|
149
|
-
const quadTreeIndex = yield queryClient
|
|
150
|
-
.fetchQuadTreeIndex(quadTreeIndexRequest, params.abortSignal)
|
|
151
|
-
.catch(err => Promise.reject(err));
|
|
152
|
-
if (params.fetchOptions !== olp_sdk_core_1.FetchOptions.OnlineOnly &&
|
|
153
|
-
quadTreeIndex.subQuads) {
|
|
154
|
-
cache.put({
|
|
155
|
-
hrn: params.catalogHrn.toString(),
|
|
156
|
-
layerId: params.layerId,
|
|
157
|
-
depth: params.depth,
|
|
158
|
-
root: params.tileKey,
|
|
159
|
-
tree: quadTreeIndex,
|
|
160
|
-
version: params.catalogVersion
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
return Promise.resolve(quadTreeIndex);
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
exports.fetchQuadTreeIndex = fetchQuadTreeIndex;
|
package/lib/utils/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
23
|
-
}) : (function(o, m, k, k2) {
|
|
24
|
-
if (k2 === undefined) k2 = k;
|
|
25
|
-
o[k2] = m[k];
|
|
26
|
-
}));
|
|
27
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
28
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
29
|
-
};
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
__exportStar(require("./validateBillingTag"), exports);
|
|
32
|
-
__exportStar(require("./validatePartitionsIdsList"), exports);
|
|
33
|
-
__exportStar(require("./getTile"), exports);
|
|
@@ -1,37 +0,0 @@
|
|
|
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.validateBillingTag = void 0;
|
|
22
|
-
/**
|
|
23
|
-
* Validates the billinig tag.
|
|
24
|
-
*
|
|
25
|
-
* It must be 4–16 characters long and contain only alphanumeric ASCII characters [A-Za-z0-9].
|
|
26
|
-
*
|
|
27
|
-
* @param tag The string that represents the billing tag.
|
|
28
|
-
* @return The billing tag if it's valid. Otherwise, throws an error.
|
|
29
|
-
*/
|
|
30
|
-
function validateBillingTag(tag) {
|
|
31
|
-
const pattern = /^[A-Za-z0-9_-]{4,16}$/;
|
|
32
|
-
if (!pattern.test(tag)) {
|
|
33
|
-
throw new Error("The billing tag must be between 4 - 16 characters, contain only alpha/numeric ASCII characters [A-Za-z0-9]");
|
|
34
|
-
}
|
|
35
|
-
return tag;
|
|
36
|
-
}
|
|
37
|
-
exports.validateBillingTag = validateBillingTag;
|
|
@@ -1,38 +0,0 @@
|
|
|
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.validatePartitionsIdsList = void 0;
|
|
22
|
-
/**
|
|
23
|
-
* Validates a list of partitions IDs.
|
|
24
|
-
*
|
|
25
|
-
* It must be between 1–100 items.
|
|
26
|
-
*
|
|
27
|
-
* @param list The lists of strings that represent the partitions IDs.
|
|
28
|
-
* @returns The list of strings if it's valid. Otherwise, throws an error.
|
|
29
|
-
*/
|
|
30
|
-
function validatePartitionsIdsList(list) {
|
|
31
|
-
const LIST_MAX_LENGTH = 100;
|
|
32
|
-
const length = list.length;
|
|
33
|
-
if (length < 1 || length > LIST_MAX_LENGTH) {
|
|
34
|
-
throw new Error("The partition ids quantity must be between 1 - 100");
|
|
35
|
-
}
|
|
36
|
-
return list;
|
|
37
|
-
}
|
|
38
|
-
exports.validatePartitionsIdsList = validatePartitionsIdsList;
|