@loaders.gl/ogc 5.0.0-beta.1 → 5.0.0-beta.4
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 +4 -2
- package/dist/{wms/gml-loader.cjs → gml-loader.cjs} +2757 -3796
- package/dist/gml-loader.cjs.map +6 -0
- package/dist/gml-loader.d.ts +2 -0
- package/dist/gml-loader.d.ts.map +1 -0
- package/dist/gml-loader.js +2 -0
- package/dist/gml-loader.js.map +1 -0
- package/dist/index.cjs +342 -4376
- package/dist/index.cjs.map +3 -3
- package/dist/stac/index.cjs +19 -1041
- package/dist/stac/index.cjs.map +3 -3
- package/dist/stac/stac-source-loader-types.js +3 -3
- package/dist/stac/stac-source-loader-types.js.map +1 -1
- package/dist/{stac/stac-source.cjs → stac-source.cjs} +212 -779
- package/dist/stac-source.cjs.map +6 -0
- package/dist/stac-source.d.ts +2 -0
- package/dist/stac-source.d.ts.map +1 -0
- package/dist/stac-source.js +2 -0
- package/dist/stac-source.js.map +1 -0
- package/dist/wms/bundled.cjs +2561 -3514
- package/dist/wms/bundled.cjs.map +3 -3
- package/dist/wms/csw-capabilities-loader-with-parser.d.ts +1 -1
- package/dist/wms/csw-capabilities-loader-with-parser.d.ts.map +1 -1
- package/dist/wms/csw-capabilities-loader.d.ts +1 -1
- package/dist/wms/csw-capabilities-loader.d.ts.map +1 -1
- package/dist/wms/csw-capabilities-loader.js +1 -1
- package/dist/wms/csw-domain-loader-with-parser.d.ts +1 -1
- package/dist/wms/csw-domain-loader-with-parser.d.ts.map +1 -1
- package/dist/wms/csw-domain-loader.d.ts +1 -1
- package/dist/wms/csw-domain-loader.d.ts.map +1 -1
- package/dist/wms/csw-domain-loader.js +1 -1
- package/dist/wms/csw-records-loader-with-parser.d.ts +1 -1
- package/dist/wms/csw-records-loader-with-parser.d.ts.map +1 -1
- package/dist/wms/csw-records-loader.d.ts +1 -1
- package/dist/wms/csw-records-loader.d.ts.map +1 -1
- package/dist/wms/csw-records-loader.js +1 -1
- package/dist/wms/csw-source-loader.js +1 -1
- package/dist/wms/gml-loader-types.js +2 -2
- package/dist/wms/gml-loader-types.js.map +1 -1
- package/dist/wms/index.cjs +3040 -3892
- package/dist/wms/index.cjs.map +3 -3
- package/dist/wms/lib/parsers/csw/parse-csw-capabilities.d.ts +1 -1
- package/dist/wms/lib/parsers/csw/parse-csw-capabilities.d.ts.map +1 -1
- package/dist/wms/lib/parsers/csw/parse-csw-domain.d.ts +1 -1
- package/dist/wms/lib/parsers/csw/parse-csw-domain.d.ts.map +1 -1
- package/dist/wms/lib/parsers/csw/parse-csw-records.d.ts +1 -1
- package/dist/wms/lib/parsers/csw/parse-csw-records.d.ts.map +1 -1
- package/dist/wms/lib/parsers/csw/parse-csw-records.js +2 -5
- package/dist/wms/lib/parsers/csw/parse-csw-records.js.map +1 -1
- package/dist/wms/lib/parsers/csw/parse-exception-report.js +2 -2
- package/dist/wms/lib/parsers/csw/parse-exception-report.js.map +1 -1
- package/dist/wms/lib/parsers/wms/parse-wms-error.d.ts.map +1 -1
- package/dist/wms/lib/parsers/wms/parse-wms-error.js +3 -1
- package/dist/wms/lib/parsers/wms/parse-wms-error.js.map +1 -1
- package/dist/wms/lib/parsers/wms/parse-wms-layer-description.d.ts +1 -1
- package/dist/wms/lib/parsers/wms/parse-wms-layer-description.d.ts.map +1 -1
- package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.js +1 -1
- package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.js.map +1 -1
- package/dist/wms/lib/parsers/xml/parse-xml-text.d.ts +1 -1
- package/dist/wms/lib/parsers/xml/parse-xml-text.d.ts.map +1 -1
- package/dist/wms/lib/parsers/xml/parse-xml-text.js +2 -1
- package/dist/wms/lib/parsers/xml/parse-xml-text.js.map +1 -1
- package/dist/wms/unbundled.cjs +316 -3333
- package/dist/wms/unbundled.cjs.map +3 -3
- package/dist/wms/wcs-source-loader.js +1 -1
- package/dist/wms/wcs-source-loader.js.map +1 -1
- package/dist/wms/wfs-capabilities-loader.js +1 -1
- package/dist/wms/wfs-source-loader.d.ts +2 -2
- package/dist/wms/wfs-source-loader.js +2 -2
- package/dist/wms/wip/wcs-capabilities-loader.js +1 -1
- package/dist/wms/wip/wmts-capabilities-loader-with-parser.d.ts +1 -1
- package/dist/wms/wip/wmts-capabilities-loader-with-parser.d.ts.map +1 -1
- package/dist/wms/wip/wmts-capabilities-loader.d.ts +1 -1
- package/dist/wms/wip/wmts-capabilities-loader.d.ts.map +1 -1
- package/dist/wms/wip/wmts-capabilities-loader.js +1 -1
- package/dist/wms/wms-capabilities-loader-with-parser.d.ts +1 -1
- package/dist/wms/wms-capabilities-loader-with-parser.d.ts.map +1 -1
- package/dist/wms/wms-capabilities-loader.d.ts +1 -1
- package/dist/wms/wms-capabilities-loader.d.ts.map +1 -1
- package/dist/wms/wms-capabilities-loader.js +1 -1
- package/dist/wms/wms-error-loader.js +1 -1
- package/dist/wms/wms-source-loader.d.ts +2 -2
- package/dist/wms/wms-source-loader.d.ts.map +1 -1
- package/dist/wms/wms-source-loader.js +3 -3
- package/dist/wms/wms-source-loader.js.map +1 -1
- package/dist/wms/wmts-capabilities-loader.js +1 -1
- package/dist/wms/wmts-capabilities-loader.js.map +1 -1
- package/dist/wms/wmts-source-loader.d.ts +2 -2
- package/dist/wms/wmts-source-loader.d.ts.map +1 -1
- package/dist/wms/wmts-source-loader.js +3 -3
- package/dist/wms/wmts-source-loader.js.map +1 -1
- package/dist/{wms/wmts-capabilities-loader-with-parser.cjs → wmts-capabilities-loader-with-parser.cjs} +227 -179
- package/dist/wmts-capabilities-loader-with-parser.cjs.map +6 -0
- package/dist/wmts-capabilities-loader-with-parser.d.ts +2 -0
- package/dist/wmts-capabilities-loader-with-parser.d.ts.map +1 -0
- package/dist/wmts-capabilities-loader-with-parser.js +3 -0
- package/dist/wmts-capabilities-loader-with-parser.js.map +1 -0
- package/package.json +27 -20
- package/src/gml-loader.ts +1 -0
- package/src/stac/stac-source-loader-types.ts +2 -2
- package/src/stac-source.ts +1 -0
- package/src/wms/csw-capabilities-loader-with-parser.ts +1 -1
- package/src/wms/csw-capabilities-loader.ts +1 -1
- package/src/wms/csw-domain-loader-with-parser.ts +1 -1
- package/src/wms/csw-domain-loader.ts +1 -1
- package/src/wms/csw-records-loader-with-parser.ts +1 -1
- package/src/wms/csw-records-loader.ts +1 -1
- package/src/wms/gml-loader-types.ts +1 -1
- package/src/wms/lib/parsers/csw/parse-csw-capabilities.ts +1 -1
- package/src/wms/lib/parsers/csw/parse-csw-domain.ts +1 -1
- package/src/wms/lib/parsers/csw/parse-csw-records.ts +3 -6
- package/src/wms/lib/parsers/csw/parse-exception-report.ts +2 -2
- package/src/wms/lib/parsers/wms/parse-wms-error.ts +3 -1
- package/src/wms/lib/parsers/wms/parse-wms-layer-description.ts +1 -1
- package/src/wms/lib/parsers/wmts/parse-wmts-capabilities.ts +1 -1
- package/src/wms/lib/parsers/xml/parse-xml-text.ts +3 -2
- package/src/wms/wcs-source-loader.ts +1 -1
- package/src/wms/wfs-source-loader.ts +2 -2
- package/src/wms/wip/wms-feature-info-loader-with-parser.ts +1 -1
- package/src/wms/wip/wms-feature-info-loader.ts +1 -1
- package/src/wms/wip/wms-layer-description-loader-with-parser.ts +1 -1
- package/src/wms/wip/wms-layer-description-loader.ts +1 -1
- package/src/wms/wip/wmts-capabilities-loader-with-parser.ts +1 -1
- package/src/wms/wip/wmts-capabilities-loader.ts +1 -1
- package/src/wms/wms-capabilities-loader-with-parser.ts +1 -1
- package/src/wms/wms-capabilities-loader.ts +1 -1
- package/src/wms/wms-source-loader.ts +5 -13
- package/src/wms/wmts-capabilities-loader.ts +1 -1
- package/src/wms/wmts-source-loader.ts +5 -5
- package/src/wmts-capabilities-loader-with-parser.ts +2 -0
- package/dist/stac/stac-source.cjs.map +0 -6
- package/dist/wms/gml-loader.cjs.map +0 -6
- package/dist/wms/wmts-capabilities-loader-with-parser.cjs.map +0 -6
package/dist/stac/index.cjs
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __esm = (fn, res, err) => function __init() {
|
|
7
|
-
if (err) throw err[0];
|
|
8
|
-
try {
|
|
9
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
-
} catch (e) {
|
|
11
|
-
throw err = [e], e;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
8
|
var __export = (target, all) => {
|
|
15
9
|
for (var name in all)
|
|
16
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -23,1052 +17,36 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
17
|
}
|
|
24
18
|
return to;
|
|
25
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
26
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
29
|
|
|
28
|
-
// ../core/src/loader-utils/lib/log-utils/log.ts
|
|
29
|
-
function createLog() {
|
|
30
|
-
const log2 = new import_log.Log({ id: "loaders.gl" });
|
|
31
|
-
globalThis.loaders ||= {};
|
|
32
|
-
globalThis.loaders.log = log2;
|
|
33
|
-
globalThis.loaders.version = version;
|
|
34
|
-
globalThis.probe ||= {};
|
|
35
|
-
globalThis.probe.loaders = log2;
|
|
36
|
-
return log2;
|
|
37
|
-
}
|
|
38
|
-
var import_log, VERSION, version, log;
|
|
39
|
-
var init_log = __esm({
|
|
40
|
-
"../core/src/loader-utils/lib/log-utils/log.ts"() {
|
|
41
|
-
"use strict";
|
|
42
|
-
import_log = require("probe.gl/log");
|
|
43
|
-
VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
44
|
-
version = VERSION[0] >= "0" && VERSION[0] <= "9" ? `v${VERSION}` : "";
|
|
45
|
-
log = createLog();
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// ../core/src/loader-utils/lib/javascript-utils/is-type.ts
|
|
50
|
-
var isObject, isPureObject;
|
|
51
|
-
var init_is_type = __esm({
|
|
52
|
-
"../core/src/loader-utils/lib/javascript-utils/is-type.ts"() {
|
|
53
|
-
"use strict";
|
|
54
|
-
isObject = (value) => value !== null && typeof value === "object";
|
|
55
|
-
isPureObject = (value) => isObject(value) && value.constructor === {}.constructor;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// ../core/src/loader-utils/lib/option-utils/merge-options.ts
|
|
60
|
-
function mergeOptions(baseOptions, newOptions) {
|
|
61
|
-
return mergeOptionsRecursively(baseOptions || {}, newOptions);
|
|
62
|
-
}
|
|
63
|
-
function mergeOptionsRecursively(baseOptions, newOptions, level = 0) {
|
|
64
|
-
if (level > 3) {
|
|
65
|
-
return newOptions;
|
|
66
|
-
}
|
|
67
|
-
const options = { ...baseOptions };
|
|
68
|
-
for (const [key, newValue] of Object.entries(newOptions)) {
|
|
69
|
-
if (isPureObject(newValue)) {
|
|
70
|
-
options[key] = mergeOptionsRecursively(
|
|
71
|
-
options[key] || {},
|
|
72
|
-
newOptions[key],
|
|
73
|
-
level + 1
|
|
74
|
-
);
|
|
75
|
-
} else {
|
|
76
|
-
options[key] = newOptions[key];
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return options;
|
|
80
|
-
}
|
|
81
|
-
var init_merge_options = __esm({
|
|
82
|
-
"../core/src/loader-utils/lib/option-utils/merge-options.ts"() {
|
|
83
|
-
"use strict";
|
|
84
|
-
init_is_type();
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
// ../core/src/loader-utils/lib/request-utils/authentication.ts
|
|
89
|
-
function resolveCredentials(credentials, authentications = []) {
|
|
90
|
-
if (credentials.every(isAuthentication)) return credentials;
|
|
91
|
-
return credentials.map((credential, index) => {
|
|
92
|
-
if (isAuthentication(credential)) return credential;
|
|
93
|
-
const AuthenticationClass = authentications.find(
|
|
94
|
-
(authentication2) => authentication2.type === (credential == null ? void 0 : credential.type)
|
|
95
|
-
);
|
|
96
|
-
if (!AuthenticationClass) {
|
|
97
|
-
throw new Error(`No authentication class registered for credential at index ${index}.`);
|
|
98
|
-
}
|
|
99
|
-
let authentication;
|
|
100
|
-
try {
|
|
101
|
-
authentication = new AuthenticationClass(credential);
|
|
102
|
-
} catch {
|
|
103
|
-
throw new Error(`Invalid authentication configuration at index ${index}.`);
|
|
104
|
-
}
|
|
105
|
-
if (!isAuthentication(authentication)) {
|
|
106
|
-
throw new Error(`Authentication class returned an invalid credential at index ${index}.`);
|
|
107
|
-
}
|
|
108
|
-
return authentication;
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
function resolveAuthenticationOptions(options) {
|
|
112
|
-
var _a, _b;
|
|
113
|
-
if (!((_b = (_a = options.core) == null ? void 0 : _a.credentials) == null ? void 0 : _b.length)) return options;
|
|
114
|
-
const credentials = resolveCredentials(options.core.credentials, options.core.authentications);
|
|
115
|
-
if (credentials === options.core.credentials) return options;
|
|
116
|
-
return { ...options, core: { ...options.core, credentials } };
|
|
117
|
-
}
|
|
118
|
-
function isAuthentication(credential) {
|
|
119
|
-
if (!credential || typeof credential !== "object") return false;
|
|
120
|
-
if (typeof credential.id !== "string" || !Array.isArray(credential.origins)) return false;
|
|
121
|
-
if (credential.type === "request") return typeof credential.authenticate === "function";
|
|
122
|
-
return (credential.type === "header" || credential.type === "query-parameter") && typeof credential.name === "string" && (typeof credential.token === "string" || typeof credential.token === "function") && Array.isArray(credential.refreshStatusCodes);
|
|
123
|
-
}
|
|
124
|
-
var init_authentication = __esm({
|
|
125
|
-
"../core/src/loader-utils/lib/request-utils/authentication.ts"() {
|
|
126
|
-
"use strict";
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
// ../core/src/loader-utils/lib/request-utils/request-credentials.ts
|
|
131
|
-
function createAuthenticatedFetch(options) {
|
|
132
|
-
const suppliedFetch = options.fetch || ((url, requestOptions) => fetch(url, requestOptions));
|
|
133
|
-
const existingMetadata = suppliedFetch[AUTHENTICATED_FETCH];
|
|
134
|
-
const credentialResolutions = new Map(existingMetadata == null ? void 0 : existingMetadata.credentialResolutions);
|
|
135
|
-
const resolvedCredentials = resolveCredentials(
|
|
136
|
-
options.credentials.map((credential) => credentialResolutions.get(credential) || credential),
|
|
137
|
-
options.authentications
|
|
138
|
-
);
|
|
139
|
-
options.credentials.forEach((credential, index) => {
|
|
140
|
-
credentialResolutions.set(credential, resolvedCredentials[index]);
|
|
141
|
-
});
|
|
142
|
-
if (!options.fetchOptions && (!resolvedCredentials.length || (existingMetadata == null ? void 0 : existingMetadata.credentials.length) === resolvedCredentials.length && resolvedCredentials.every(
|
|
143
|
-
(credential, index) => credential === existingMetadata.credentials[index]
|
|
144
|
-
)))
|
|
145
|
-
return suppliedFetch;
|
|
146
|
-
const baseFetch = (existingMetadata == null ? void 0 : existingMetadata.fetch) || suppliedFetch;
|
|
147
|
-
const credentials = existingMetadata ? [.../* @__PURE__ */ new Set([...resolvedCredentials, ...existingMetadata.credentials])] : resolvedCredentials;
|
|
148
|
-
const fetchOptions = mergeFetchOptions(
|
|
149
|
-
(existingMetadata == null ? void 0 : existingMetadata.fetchOptions) || {},
|
|
150
|
-
options.fetchOptions
|
|
151
|
-
);
|
|
152
|
-
const tokenCredentials = credentials.filter(
|
|
153
|
-
(credential) => credential.type !== "request"
|
|
154
|
-
);
|
|
155
|
-
const requestCredentials = credentials.filter(
|
|
156
|
-
(credential) => credential.type === "request"
|
|
157
|
-
);
|
|
158
|
-
for (const credential of requestCredentials) normalizeRequestOrigins(credential.origins);
|
|
159
|
-
const authenticatedFetch = async (url, requestOptions = {}) => {
|
|
160
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
161
|
-
requestOptions = mergeFetchOptions(fetchOptions, requestOptions);
|
|
162
|
-
(_a = requestOptions.signal) == null ? void 0 : _a.throwIfAborted();
|
|
163
|
-
if (!credentials.length) return baseFetch(url, requestOptions);
|
|
164
|
-
const resolvedURL = parseHTTPURL(url);
|
|
165
|
-
const authorization = resolvedURL ? await authorizeRequest(resolvedURL, requestOptions, tokenCredentials) : { url, options: requestOptions, credentials: [] };
|
|
166
|
-
const signedRequest = await authenticateRequest(authorization, requestCredentials, "request");
|
|
167
|
-
const response = await baseFetch(signedRequest.url, signedRequest.options);
|
|
168
|
-
const refreshableCredentials = [];
|
|
169
|
-
for (const resolvedCredential of authorization.credentials) {
|
|
170
|
-
const { credential } = resolvedCredential;
|
|
171
|
-
if (typeof credential.token === "function" && (isReplayableRequest(requestOptions) || ((_b = credential.canReplayRequest) == null ? void 0 : _b.call(credential, url, requestOptions))) && (isReplayableRequest(signedRequest.options) || ((_c = credential.canReplayRequest) == null ? void 0 : _c.call(credential, signedRequest.url, signedRequest.options))) && (credential.refreshStatusCodes.includes(response.status) || await ((_d = credential.shouldRefresh) == null ? void 0 : _d.call(credential, response))))
|
|
172
|
-
refreshableCredentials.push(resolvedCredential);
|
|
173
|
-
}
|
|
174
|
-
const shouldRetrySignature = isReplayableRequest(requestOptions) && isReplayableRequest(signedRequest.options) && signedRequest.credentials.some(
|
|
175
|
-
(credential) => {
|
|
176
|
-
var _a2;
|
|
177
|
-
return (_a2 = credential.refreshStatusCodes) == null ? void 0 : _a2.includes(response.status);
|
|
178
|
-
}
|
|
179
|
-
);
|
|
180
|
-
if (!refreshableCredentials.length && !shouldRetrySignature) return response;
|
|
181
|
-
(_e = requestOptions.signal) == null ? void 0 : _e.throwIfAborted();
|
|
182
|
-
const refreshedTokens = /* @__PURE__ */ new Map();
|
|
183
|
-
await Promise.all(
|
|
184
|
-
refreshableCredentials.map(async ({ credential }) => {
|
|
185
|
-
const token = await refreshCredential(credential, url, response);
|
|
186
|
-
if (token) refreshedTokens.set(credential, token);
|
|
187
|
-
})
|
|
188
|
-
);
|
|
189
|
-
if (!refreshedTokens.size && !shouldRetrySignature) return response;
|
|
190
|
-
await ((_f = response.body) == null ? void 0 : _f.cancel().catch(() => {
|
|
191
|
-
}));
|
|
192
|
-
(_g = requestOptions.signal) == null ? void 0 : _g.throwIfAborted();
|
|
193
|
-
const replayAuthorization = resolvedURL ? await authorizeRequest(
|
|
194
|
-
resolvedURL,
|
|
195
|
-
requestOptions,
|
|
196
|
-
tokenCredentials,
|
|
197
|
-
refreshedTokens,
|
|
198
|
-
authorization.credentials
|
|
199
|
-
) : { url, options: requestOptions };
|
|
200
|
-
const replayRequest = await authenticateRequest(
|
|
201
|
-
replayAuthorization,
|
|
202
|
-
requestCredentials,
|
|
203
|
-
"retry",
|
|
204
|
-
response
|
|
205
|
-
);
|
|
206
|
-
return baseFetch(replayRequest.url, replayRequest.options);
|
|
207
|
-
};
|
|
208
|
-
Object.defineProperty(authenticatedFetch, AUTHENTICATED_FETCH, {
|
|
209
|
-
value: {
|
|
210
|
-
fetch: baseFetch,
|
|
211
|
-
credentials,
|
|
212
|
-
credentialResolutions,
|
|
213
|
-
fetchOptions
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
return authenticatedFetch;
|
|
217
|
-
}
|
|
218
|
-
function getAuthenticatedFetch(options = {}) {
|
|
219
|
-
var _a, _b, _c;
|
|
220
|
-
const fetchOption = options.fetch ?? ((_a = options.core) == null ? void 0 : _a.fetch);
|
|
221
|
-
let fetchFunction;
|
|
222
|
-
if (typeof fetchOption === "function") {
|
|
223
|
-
fetchFunction = fetchOption;
|
|
224
|
-
} else {
|
|
225
|
-
fetchFunction = (url, requestOptions) => fetch(url, requestOptions);
|
|
226
|
-
}
|
|
227
|
-
const fetchOptions = typeof fetchOption === "object" && fetchOption ? fetchOption : void 0;
|
|
228
|
-
return createAuthenticatedFetch({
|
|
229
|
-
fetch: fetchFunction,
|
|
230
|
-
fetchOptions: options.signal ? { ...fetchOptions, signal: options.signal } : fetchOptions,
|
|
231
|
-
credentials: ((_b = options.core) == null ? void 0 : _b.credentials) || [],
|
|
232
|
-
authentications: (_c = options.core) == null ? void 0 : _c.authentications
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
function mergeFetchOptions(defaultOptions, requestOptions) {
|
|
236
|
-
const mergedOptions = { ...defaultOptions, ...requestOptions };
|
|
237
|
-
if (defaultOptions.headers || (requestOptions == null ? void 0 : requestOptions.headers)) {
|
|
238
|
-
const headers = new Headers(defaultOptions.headers);
|
|
239
|
-
new Headers(requestOptions == null ? void 0 : requestOptions.headers).forEach((value, key) => headers.set(key, value));
|
|
240
|
-
mergedOptions.headers = headers;
|
|
241
|
-
}
|
|
242
|
-
return mergedOptions;
|
|
243
|
-
}
|
|
244
|
-
async function authenticateRequest(request, credentials, reason, response) {
|
|
245
|
-
const appliedCredentials = [];
|
|
246
|
-
const signal = request.options.signal;
|
|
247
|
-
for (const credential of credentials) {
|
|
248
|
-
const origin = getRequestOrigin(request.url);
|
|
249
|
-
if (!origin || !normalizeRequestOrigins(credential.origins).includes(origin)) continue;
|
|
250
|
-
signal == null ? void 0 : signal.throwIfAborted();
|
|
251
|
-
const authenticatedRequest = await credential.authenticate({
|
|
252
|
-
url: request.url,
|
|
253
|
-
options: { ...request.options, headers: new Headers(request.options.headers) },
|
|
254
|
-
reason,
|
|
255
|
-
response: response ? { status: response.status, headers: new Headers(response.headers) } : void 0
|
|
256
|
-
});
|
|
257
|
-
if (!authenticatedRequest || typeof authenticatedRequest.url !== "string" || !authenticatedRequest.options || typeof authenticatedRequest.options !== "object") {
|
|
258
|
-
throw new Error("Authentication callback returned an invalid request.");
|
|
259
|
-
}
|
|
260
|
-
request = {
|
|
261
|
-
url: authenticatedRequest.url,
|
|
262
|
-
options: { ...authenticatedRequest.options, ...signal ? { signal } : {} }
|
|
263
|
-
};
|
|
264
|
-
appliedCredentials.push(credential);
|
|
265
|
-
}
|
|
266
|
-
signal == null ? void 0 : signal.throwIfAborted();
|
|
267
|
-
return { ...request, credentials: appliedCredentials };
|
|
268
|
-
}
|
|
269
|
-
function getRequestOrigin(url) {
|
|
270
|
-
try {
|
|
271
|
-
const parsedURL = new URL(url);
|
|
272
|
-
if (!parsedURL.host || parsedURL.username || parsedURL.password) return null;
|
|
273
|
-
return parsedURL.origin !== "null" ? parsedURL.origin : `${parsedURL.protocol}//${parsedURL.host}`;
|
|
274
|
-
} catch {
|
|
275
|
-
return null;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
function normalizeRequestOrigins(origins) {
|
|
279
|
-
if (!origins.length)
|
|
280
|
-
throw new Error("Request authentication requires at least one exact origin.");
|
|
281
|
-
return origins.map((origin) => {
|
|
282
|
-
const resolvedOrigin = getRequestOrigin(origin);
|
|
283
|
-
let url;
|
|
284
|
-
try {
|
|
285
|
-
url = new URL(origin);
|
|
286
|
-
} catch {
|
|
287
|
-
throw new Error("Invalid request authentication origin.");
|
|
288
|
-
}
|
|
289
|
-
if (!resolvedOrigin || url.pathname && url.pathname !== "/" || url.search || url.hash) {
|
|
290
|
-
throw new Error("Invalid request authentication origin.");
|
|
291
|
-
}
|
|
292
|
-
return resolvedOrigin;
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
async function authorizeRequest(sourceURL, requestOptions, credentials, tokenOverrides = /* @__PURE__ */ new Map(), previousCredentials = []) {
|
|
296
|
-
const url = new URL(sourceURL);
|
|
297
|
-
const headers = new Headers(requestOptions.headers);
|
|
298
|
-
const resolvedCredentials = [];
|
|
299
|
-
const previousTokens = new Map(
|
|
300
|
-
previousCredentials.map(({ credential, token }) => [credential, token])
|
|
301
|
-
);
|
|
302
|
-
for (const credential of credentials) {
|
|
303
|
-
if (!credential.origins.includes(url.origin)) continue;
|
|
304
|
-
const overrideToken = tokenOverrides.get(credential);
|
|
305
|
-
const previousToken = previousTokens.get(credential);
|
|
306
|
-
const ownsQueryParameter = credential.type === "query-parameter" && previousToken !== void 0;
|
|
307
|
-
const ownsHeader = credential.type === "header" && previousToken !== void 0;
|
|
308
|
-
if (credential.type === "query-parameter" && url.searchParams.has(credential.name) && !ownsQueryParameter || credential.type === "header" && headers.has(credential.name) && !ownsHeader) {
|
|
309
|
-
continue;
|
|
310
|
-
}
|
|
311
|
-
const token = overrideToken ?? previousToken ?? await resolveToken(credential.token, { url: sourceURL.toString(), reason: "request" });
|
|
312
|
-
if (!token) continue;
|
|
313
|
-
if (credential.type === "query-parameter") {
|
|
314
|
-
url.searchParams.set(credential.name, token);
|
|
315
|
-
} else {
|
|
316
|
-
headers.set(credential.name, `${credential.prefix || ""}${token}`);
|
|
317
|
-
}
|
|
318
|
-
resolvedCredentials.push({ credential, token });
|
|
319
|
-
}
|
|
320
|
-
return {
|
|
321
|
-
url: url.toString(),
|
|
322
|
-
options: { ...requestOptions, headers },
|
|
323
|
-
credentials: resolvedCredentials
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
async function refreshCredential(credential, url, response) {
|
|
327
|
-
const existingPromise = refreshPromises.get(credential);
|
|
328
|
-
if (existingPromise) return existingPromise;
|
|
329
|
-
const tokenProvider = credential.token;
|
|
330
|
-
const promise = Promise.resolve(
|
|
331
|
-
tokenProvider({
|
|
332
|
-
url,
|
|
333
|
-
reason: "refresh",
|
|
334
|
-
response: { status: response.status, headers: response.headers }
|
|
335
|
-
})
|
|
336
|
-
).finally(() => refreshPromises.delete(credential));
|
|
337
|
-
refreshPromises.set(credential, promise);
|
|
338
|
-
return promise;
|
|
339
|
-
}
|
|
340
|
-
async function resolveToken(token, context) {
|
|
341
|
-
return typeof token === "function" ? token(context) : token;
|
|
342
|
-
}
|
|
343
|
-
function parseHTTPURL(url) {
|
|
344
|
-
try {
|
|
345
|
-
const parsedURL = new URL(url);
|
|
346
|
-
return ["http:", "https:"].includes(parsedURL.protocol) ? parsedURL : null;
|
|
347
|
-
} catch {
|
|
348
|
-
return null;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
function isReplayableRequest(options) {
|
|
352
|
-
const method = (options.method || "GET").toUpperCase();
|
|
353
|
-
if (!["GET", "HEAD", "OPTIONS", "PUT", "DELETE"].includes(method)) return false;
|
|
354
|
-
return !(options.body && typeof ReadableStream !== "undefined" && options.body instanceof ReadableStream);
|
|
355
|
-
}
|
|
356
|
-
var AUTHENTICATED_FETCH, refreshPromises;
|
|
357
|
-
var init_request_credentials = __esm({
|
|
358
|
-
"../core/src/loader-utils/lib/request-utils/request-credentials.ts"() {
|
|
359
|
-
"use strict";
|
|
360
|
-
init_authentication();
|
|
361
|
-
AUTHENTICATED_FETCH = /* @__PURE__ */ Symbol("loaders.gl.authenticated-fetch");
|
|
362
|
-
refreshPromises = /* @__PURE__ */ new WeakMap();
|
|
363
|
-
}
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
// ../core/src/loader-utils/lib/path-utils/file-aliases.ts
|
|
367
|
-
function resolvePath(filename) {
|
|
368
|
-
for (const alias in fileAliases) {
|
|
369
|
-
if (filename.startsWith(alias)) {
|
|
370
|
-
const replacement = fileAliases[alias];
|
|
371
|
-
filename = filename.replace(alias, replacement);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
if (!filename.startsWith("http://") && !filename.startsWith("https://")) {
|
|
375
|
-
filename = `${pathPrefix}${filename}`;
|
|
376
|
-
}
|
|
377
|
-
return filename;
|
|
378
|
-
}
|
|
379
|
-
var pathPrefix, fileAliases;
|
|
380
|
-
var init_file_aliases = __esm({
|
|
381
|
-
"../core/src/loader-utils/lib/path-utils/file-aliases.ts"() {
|
|
382
|
-
"use strict";
|
|
383
|
-
pathPrefix = "";
|
|
384
|
-
fileAliases = {};
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
// ../core/src/loader-utils/lib/sources/data-source.ts
|
|
389
|
-
function getFetchFunction(options) {
|
|
390
|
-
return getAuthenticatedFetch(options);
|
|
391
|
-
}
|
|
392
|
-
function getSourceLoaderOptions(options) {
|
|
393
|
-
var _a;
|
|
394
|
-
if (options.loadOptions !== void 0 || ((_a = options.core) == null ? void 0 : _a.loadOptions) !== void 0) {
|
|
395
|
-
throw new Error(
|
|
396
|
-
"Source loadOptions and core.loadOptions were removed. Use core and root loader namespaces directly."
|
|
397
|
-
);
|
|
398
|
-
}
|
|
399
|
-
const loadOptions = { ...options };
|
|
400
|
-
if (options == null ? void 0 : options.core) {
|
|
401
|
-
loadOptions.core = { ...options.core };
|
|
402
|
-
const parserCore = loadOptions.core;
|
|
403
|
-
for (const key of ["type", "attributions", "loaders", "onError", "loadOptions"]) {
|
|
404
|
-
delete parserCore[key];
|
|
405
|
-
}
|
|
406
|
-
if (Object.keys(parserCore).length === 0) {
|
|
407
|
-
delete loadOptions.core;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
const topLevelBaseUri = typeof loadOptions.baseUri === "string" ? loadOptions.baseUri : void 0;
|
|
411
|
-
const topLevelBaseUrl = typeof loadOptions.baseUrl === "string" ? loadOptions.baseUrl : void 0;
|
|
412
|
-
if (topLevelBaseUri !== void 0 || topLevelBaseUrl !== void 0) {
|
|
413
|
-
loadOptions.core ||= {};
|
|
414
|
-
if (loadOptions.core.baseUrl === void 0) {
|
|
415
|
-
loadOptions.core.baseUrl = topLevelBaseUrl ?? topLevelBaseUri;
|
|
416
|
-
}
|
|
417
|
-
delete loadOptions.baseUri;
|
|
418
|
-
delete loadOptions.baseUrl;
|
|
419
|
-
}
|
|
420
|
-
return loadOptions;
|
|
421
|
-
}
|
|
422
|
-
function normalizeError(error, message) {
|
|
423
|
-
if (error instanceof Error) {
|
|
424
|
-
return error;
|
|
425
|
-
}
|
|
426
|
-
if (typeof error === "string") {
|
|
427
|
-
return new Error(error);
|
|
428
|
-
}
|
|
429
|
-
return new Error(message);
|
|
430
|
-
}
|
|
431
|
-
function unavailableCoreApiMethod(methodName) {
|
|
432
|
-
return () => {
|
|
433
|
-
throw new Error(
|
|
434
|
-
`CoreAPI.${methodName} is unavailable. Use @loaders.gl/core.createDataSource().`
|
|
435
|
-
);
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
var UNAVAILABLE_CORE_API, DataSource;
|
|
439
|
-
var init_data_source = __esm({
|
|
440
|
-
"../core/src/loader-utils/lib/sources/data-source.ts"() {
|
|
441
|
-
"use strict";
|
|
442
|
-
init_merge_options();
|
|
443
|
-
init_file_aliases();
|
|
444
|
-
init_log();
|
|
445
|
-
init_request_credentials();
|
|
446
|
-
init_authentication();
|
|
447
|
-
UNAVAILABLE_CORE_API = {
|
|
448
|
-
fetchFile: unavailableCoreApiMethod("fetchFile"),
|
|
449
|
-
parse: unavailableCoreApiMethod("parse"),
|
|
450
|
-
parseFile: unavailableCoreApiMethod("parseFile"),
|
|
451
|
-
parseSync: unavailableCoreApiMethod("parseSync"),
|
|
452
|
-
parseInBatches: unavailableCoreApiMethod("parseInBatches"),
|
|
453
|
-
load: unavailableCoreApiMethod("load"),
|
|
454
|
-
loadInBatches: unavailableCoreApiMethod("loadInBatches")
|
|
455
|
-
};
|
|
456
|
-
DataSource = class _DataSource {
|
|
457
|
-
static defaultOptions = {
|
|
458
|
-
core: {
|
|
459
|
-
type: "auto",
|
|
460
|
-
attributions: [],
|
|
461
|
-
loaders: [],
|
|
462
|
-
onError: void 0
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
optionsType;
|
|
466
|
-
options;
|
|
467
|
-
data;
|
|
468
|
-
url;
|
|
469
|
-
/** Shared parser options derived from the source options, excluding source-only core controls. */
|
|
470
|
-
loadOptions;
|
|
471
|
-
/** A resolved fetch function extracted from the shared core options. */
|
|
472
|
-
fetch;
|
|
473
|
-
/** Shared source-level runtime hooks, when supplied by the source factory. */
|
|
474
|
-
coreApi;
|
|
475
|
-
/** Whether a real CoreAPI instance was injected by the integration layer. */
|
|
476
|
-
hasCoreApi;
|
|
477
|
-
_needsRefresh = true;
|
|
478
|
-
constructor(data, options, defaultOptions, coreApi) {
|
|
479
|
-
this.options = mergeOptions(
|
|
480
|
-
mergeOptions(_DataSource.defaultOptions, defaultOptions || {}),
|
|
481
|
-
options
|
|
482
|
-
);
|
|
483
|
-
this.data = data;
|
|
484
|
-
this.url = typeof data === "string" ? resolvePath(data) : "";
|
|
485
|
-
const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(this.options));
|
|
486
|
-
this.loadOptions = loadOptions;
|
|
487
|
-
const fetch2 = getFetchFunction(loadOptions);
|
|
488
|
-
this.coreApi = coreApi || UNAVAILABLE_CORE_API;
|
|
489
|
-
this.hasCoreApi = Boolean(coreApi);
|
|
490
|
-
this.fetch = fetch2;
|
|
491
|
-
}
|
|
492
|
-
setProps(options) {
|
|
493
|
-
const mergedOptions = mergeOptions(this.options, options);
|
|
494
|
-
const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(mergedOptions));
|
|
495
|
-
this.options = mergedOptions;
|
|
496
|
-
this.loadOptions = loadOptions;
|
|
497
|
-
this.fetch = getFetchFunction(loadOptions);
|
|
498
|
-
this.setNeedsRefresh();
|
|
499
|
-
}
|
|
500
|
-
/** Mark this data source as needing a refresh (redraw) */
|
|
501
|
-
setNeedsRefresh() {
|
|
502
|
-
this._needsRefresh = true;
|
|
503
|
-
}
|
|
504
|
-
/**
|
|
505
|
-
* Does this data source need refreshing?
|
|
506
|
-
* @note The specifics of the refresh mechanism depends on type of data source
|
|
507
|
-
*/
|
|
508
|
-
getNeedsRefresh(clear = true) {
|
|
509
|
-
const needsRefresh = this._needsRefresh;
|
|
510
|
-
if (clear) {
|
|
511
|
-
this._needsRefresh = false;
|
|
512
|
-
}
|
|
513
|
-
return needsRefresh;
|
|
514
|
-
}
|
|
515
|
-
/** Reports a source-level failure through the configured callback or the shared logger. */
|
|
516
|
-
reportError(error, message) {
|
|
517
|
-
var _a;
|
|
518
|
-
const normalizedError = normalizeError(error, message);
|
|
519
|
-
const callback = (_a = this.options.core) == null ? void 0 : _a.onError;
|
|
520
|
-
if (callback) {
|
|
521
|
-
callback(normalizedError, this);
|
|
522
|
-
} else {
|
|
523
|
-
log.warn(`${this.constructor.name}: ${normalizedError.message}`)();
|
|
524
|
-
}
|
|
525
|
-
return normalizedError;
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
}
|
|
529
|
-
});
|
|
530
|
-
|
|
531
|
-
// ../core/src/loader-utils/index.ts
|
|
532
|
-
var init_loader_utils = __esm({
|
|
533
|
-
"../core/src/loader-utils/index.ts"() {
|
|
534
|
-
"use strict";
|
|
535
|
-
init_data_source();
|
|
536
|
-
}
|
|
537
|
-
});
|
|
538
|
-
|
|
539
|
-
// src/stac/stac-source-loader-types.ts
|
|
540
|
-
async function preloadSTACSourceLoader() {
|
|
541
|
-
const { STACSourceLoaderWithParser: STACSourceLoaderWithParser2 } = await Promise.resolve().then(() => (init_stac_source(), stac_source_exports));
|
|
542
|
-
return STACSourceLoaderWithParser2;
|
|
543
|
-
}
|
|
544
|
-
var VERSION2, STACSourceLoader;
|
|
545
|
-
var init_stac_source_loader_types = __esm({
|
|
546
|
-
"src/stac/stac-source-loader-types.ts"() {
|
|
547
|
-
"use strict";
|
|
548
|
-
VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
549
|
-
STACSourceLoader = {
|
|
550
|
-
dataType: null,
|
|
551
|
-
batchType: null,
|
|
552
|
-
name: "STACSourceLoader",
|
|
553
|
-
id: "stac-source",
|
|
554
|
-
module: "ogc",
|
|
555
|
-
version: VERSION2,
|
|
556
|
-
extensions: ["json"],
|
|
557
|
-
mimeTypes: ["application/json", "application/geo+json"],
|
|
558
|
-
type: "stac",
|
|
559
|
-
fromUrl: true,
|
|
560
|
-
fromBlob: false,
|
|
561
|
-
options: {
|
|
562
|
-
stac: {
|
|
563
|
-
maxDepth: 32,
|
|
564
|
-
maxRequests: 1e3
|
|
565
|
-
}
|
|
566
|
-
},
|
|
567
|
-
defaultOptions: {
|
|
568
|
-
stac: {
|
|
569
|
-
maxDepth: 32,
|
|
570
|
-
maxRequests: 1e3
|
|
571
|
-
}
|
|
572
|
-
},
|
|
573
|
-
testURL: (url) => /(?:^|[/_.-])stac(?:[/_.?#-]|$)|\/(?:catalog|collection)\.json(?:$|[?#])/i.test(url),
|
|
574
|
-
preload: preloadSTACSourceLoader,
|
|
575
|
-
createDataSource(_data, _options, _coreApi) {
|
|
576
|
-
throw new Error(
|
|
577
|
-
"STACSourceLoader requires async load() or an explicit @loaders.gl/ogc/stac/stac-source import"
|
|
578
|
-
);
|
|
579
|
-
}
|
|
580
|
-
};
|
|
581
|
-
}
|
|
582
|
-
});
|
|
583
|
-
|
|
584
|
-
// src/stac/stac-source.ts
|
|
585
|
-
var stac_source_exports = {};
|
|
586
|
-
__export(stac_source_exports, {
|
|
587
|
-
STACSource: () => STACSource,
|
|
588
|
-
STACSourceLoader: () => STACSourceLoaderWithParser,
|
|
589
|
-
STACSourceLoaderWithParser: () => STACSourceLoaderWithParser
|
|
590
|
-
});
|
|
591
|
-
function createSearchRequest(link, baseUrl, query) {
|
|
592
|
-
const { signal: _signal, ...body } = query;
|
|
593
|
-
return {
|
|
594
|
-
url: resolveUrl(link.href, baseUrl),
|
|
595
|
-
method: link.method || "POST",
|
|
596
|
-
headers: link.headers,
|
|
597
|
-
body
|
|
598
|
-
};
|
|
599
|
-
}
|
|
600
|
-
function createNextRequest(link, baseUrl, previousRequest) {
|
|
601
|
-
const linkBody = link.body || {};
|
|
602
|
-
return {
|
|
603
|
-
url: resolveUrl(link.href, baseUrl),
|
|
604
|
-
method: link.method || previousRequest.method,
|
|
605
|
-
headers: { ...previousRequest.headers, ...link.headers },
|
|
606
|
-
body: link.merge ? { ...previousRequest.body, ...linkBody } : link.body
|
|
607
|
-
};
|
|
608
|
-
}
|
|
609
|
-
function getRequestKey(request) {
|
|
610
|
-
return `${request.method} ${request.url} ${JSON.stringify(request.body || {})}`;
|
|
611
|
-
}
|
|
612
|
-
function appendQuery(url, body) {
|
|
613
|
-
const parsedUrl = new URL(url);
|
|
614
|
-
for (const [key, value] of Object.entries(body)) {
|
|
615
|
-
if (value !== void 0) {
|
|
616
|
-
parsedUrl.searchParams.set(key, Array.isArray(value) ? value.join(",") : String(value));
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
return parsedUrl.href;
|
|
620
|
-
}
|
|
621
|
-
function resolveUrl(url, baseUrl) {
|
|
622
|
-
return new URL(url, baseUrl).href;
|
|
623
|
-
}
|
|
624
|
-
function findLink(links, relation) {
|
|
625
|
-
return links.find((link) => link.rel === relation);
|
|
626
|
-
}
|
|
627
|
-
function assertResponse(response, url) {
|
|
628
|
-
if (!response.ok) {
|
|
629
|
-
throw new Error(`STAC request failed (${response.status} ${response.statusText}): ${url}`);
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
function validateTraversalLimit(name, value) {
|
|
633
|
-
if (!Number.isSafeInteger(value) || value < 1) {
|
|
634
|
-
throw new Error(`STAC ${name} must be a positive integer`);
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
function throwIfAborted(signal) {
|
|
638
|
-
if (signal == null ? void 0 : signal.aborted) {
|
|
639
|
-
throw signal.reason || new DOMException("The operation was aborted", "AbortError");
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
function waitForPromiseWithSignal(promise, signal) {
|
|
643
|
-
if (!signal) {
|
|
644
|
-
return promise;
|
|
645
|
-
}
|
|
646
|
-
throwIfAborted(signal);
|
|
647
|
-
return new Promise((resolve, reject) => {
|
|
648
|
-
const handleAbort = () => reject(signal.reason || new DOMException("The operation was aborted", "AbortError"));
|
|
649
|
-
signal.addEventListener("abort", handleAbort, { once: true });
|
|
650
|
-
void promise.then(resolve, reject).finally(() => signal.removeEventListener("abort", handleAbort));
|
|
651
|
-
});
|
|
652
|
-
}
|
|
653
|
-
function validateObject(value, url) {
|
|
654
|
-
if (!isRecord(value)) {
|
|
655
|
-
throw new Error(`Invalid STAC JSON document: ${url}`);
|
|
656
|
-
}
|
|
657
|
-
if (value.type === "Catalog" || value.type === "Collection") {
|
|
658
|
-
if (typeof value.id !== "string" || !Array.isArray(value.links)) {
|
|
659
|
-
throw new Error(`Invalid STAC Catalog or Collection: ${url}`);
|
|
660
|
-
}
|
|
661
|
-
return value;
|
|
662
|
-
}
|
|
663
|
-
if (value.type === "Feature") {
|
|
664
|
-
if (typeof value.id !== "string" || !isRecord(value.assets) || !Array.isArray(value.links)) {
|
|
665
|
-
throw new Error(`Invalid STAC Item: ${url}`);
|
|
666
|
-
}
|
|
667
|
-
return value;
|
|
668
|
-
}
|
|
669
|
-
if (value.type === "FeatureCollection") {
|
|
670
|
-
return validateItemCollection(value, url);
|
|
671
|
-
}
|
|
672
|
-
throw new Error(`Unsupported STAC object type at ${url}`);
|
|
673
|
-
}
|
|
674
|
-
function validateItemCollection(value, url) {
|
|
675
|
-
if (!isRecord(value) || value.type !== "FeatureCollection" || !Array.isArray(value.features) || !Array.isArray(value.links)) {
|
|
676
|
-
throw new Error(`Invalid STAC ItemCollection: ${url}`);
|
|
677
|
-
}
|
|
678
|
-
for (const item of value.features) {
|
|
679
|
-
if (!isItem(item)) {
|
|
680
|
-
throw new Error(`Invalid STAC Item in ItemCollection: ${url}`);
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
return value;
|
|
684
|
-
}
|
|
685
|
-
function validateCollections(value, url) {
|
|
686
|
-
if (!isRecord(value) || !Array.isArray(value.collections) || !Array.isArray(value.links)) {
|
|
687
|
-
throw new Error(`Invalid STAC Collections response: ${url}`);
|
|
688
|
-
}
|
|
689
|
-
if (!value.collections.every(isCollection)) {
|
|
690
|
-
throw new Error(`Invalid Collection in STAC Collections response: ${url}`);
|
|
691
|
-
}
|
|
692
|
-
return value;
|
|
693
|
-
}
|
|
694
|
-
function isCatalog(value) {
|
|
695
|
-
return isRecord(value) && value.type === "Catalog" && Array.isArray(value.links);
|
|
696
|
-
}
|
|
697
|
-
function isCollection(value) {
|
|
698
|
-
return isRecord(value) && value.type === "Collection" && Array.isArray(value.links);
|
|
699
|
-
}
|
|
700
|
-
function isItem(value) {
|
|
701
|
-
return isRecord(value) && value.type === "Feature" && typeof value.id === "string" && isRecord(value.assets) && Array.isArray(value.links);
|
|
702
|
-
}
|
|
703
|
-
function isItemCollection(value) {
|
|
704
|
-
return isRecord(value) && value.type === "FeatureCollection" && Array.isArray(value.features) && Array.isArray(value.links);
|
|
705
|
-
}
|
|
706
|
-
function isRecord(value) {
|
|
707
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
708
|
-
}
|
|
709
|
-
function matchesItem(item, query) {
|
|
710
|
-
if (query.ids && !query.ids.includes(item.id)) {
|
|
711
|
-
return false;
|
|
712
|
-
}
|
|
713
|
-
if (query.collections && (!item.collection || !query.collections.includes(item.collection))) {
|
|
714
|
-
return false;
|
|
715
|
-
}
|
|
716
|
-
if (query.bbox && item.bbox && !intersectsBoundingBox(query.bbox, item.bbox)) {
|
|
717
|
-
return false;
|
|
718
|
-
}
|
|
719
|
-
return !query.datetime || intersectsDatetime(query.datetime, item);
|
|
720
|
-
}
|
|
721
|
-
function intersectsBoundingBox(left, right) {
|
|
722
|
-
const leftMaximumX = left.length === 6 ? left[3] : left[2];
|
|
723
|
-
const leftMaximumY = left.length === 6 ? left[4] : left[3];
|
|
724
|
-
const rightMaximumX = right.length === 6 ? right[3] : right[2];
|
|
725
|
-
const rightMaximumY = right.length === 6 ? right[4] : right[3];
|
|
726
|
-
return !(leftMaximumX < right[0] || rightMaximumX < left[0] || leftMaximumY < right[1] || rightMaximumY < left[1]);
|
|
727
|
-
}
|
|
728
|
-
function intersectsDatetime(datetime, item) {
|
|
729
|
-
const queryInterval = parseDatetimeInterval(datetime, true);
|
|
730
|
-
const itemDatetime = item.properties.datetime;
|
|
731
|
-
const itemInterval = typeof itemDatetime === "string" ? parseDatetimeInterval(itemDatetime, false) : parseItemDatetimeInterval(item);
|
|
732
|
-
if (!itemInterval) {
|
|
733
|
-
return true;
|
|
734
|
-
}
|
|
735
|
-
return queryInterval[0] <= itemInterval[1] && itemInterval[0] <= queryInterval[1];
|
|
736
|
-
}
|
|
737
|
-
function parseDatetimeInterval(datetime, throwOnInvalid) {
|
|
738
|
-
const parts = datetime.split("/");
|
|
739
|
-
const start = parts[0] === ".." ? Number.NEGATIVE_INFINITY : Date.parse(parts[0]);
|
|
740
|
-
const endPart = parts.length > 1 ? parts[1] : parts[0];
|
|
741
|
-
const end = endPart === ".." ? Number.POSITIVE_INFINITY : Date.parse(endPart);
|
|
742
|
-
if (parts.length > 2 || Number.isNaN(start) || Number.isNaN(end) || start > end) {
|
|
743
|
-
if (throwOnInvalid) {
|
|
744
|
-
throw new Error(`Invalid STAC datetime: ${datetime}`);
|
|
745
|
-
}
|
|
746
|
-
return [Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY];
|
|
747
|
-
}
|
|
748
|
-
return [start, end];
|
|
749
|
-
}
|
|
750
|
-
function parseItemDatetimeInterval(item) {
|
|
751
|
-
const start = item.properties.start_datetime;
|
|
752
|
-
const end = item.properties.end_datetime;
|
|
753
|
-
if (!start || !end) {
|
|
754
|
-
return null;
|
|
755
|
-
}
|
|
756
|
-
return parseDatetimeInterval(`${start}/${end}`, false);
|
|
757
|
-
}
|
|
758
|
-
var DEFAULT_MAX_DEPTH, DEFAULT_MAX_REQUESTS, _preloadSTACSourceLoader, _createMetadataDataSource, STACSourceLoaderBase, STACSourceLoaderWithParser, STACSource;
|
|
759
|
-
var init_stac_source = __esm({
|
|
760
|
-
"src/stac/stac-source.ts"() {
|
|
761
|
-
"use strict";
|
|
762
|
-
init_loader_utils();
|
|
763
|
-
init_stac_source_loader_types();
|
|
764
|
-
DEFAULT_MAX_DEPTH = 32;
|
|
765
|
-
DEFAULT_MAX_REQUESTS = 1e3;
|
|
766
|
-
({
|
|
767
|
-
preload: _preloadSTACSourceLoader,
|
|
768
|
-
createDataSource: _createMetadataDataSource,
|
|
769
|
-
...STACSourceLoaderBase
|
|
770
|
-
} = STACSourceLoader);
|
|
771
|
-
STACSourceLoaderWithParser = {
|
|
772
|
-
...STACSourceLoaderBase,
|
|
773
|
-
createDataSource(data, options, coreApi) {
|
|
774
|
-
if (typeof data !== "string") {
|
|
775
|
-
throw new Error("STACSource requires a catalog URL");
|
|
776
|
-
}
|
|
777
|
-
return new STACSource(data, options, coreApi);
|
|
778
|
-
}
|
|
779
|
-
};
|
|
780
|
-
STACSource = class extends DataSource {
|
|
781
|
-
/** Features exposed through the protocol-neutral catalog interface. */
|
|
782
|
-
capabilities = Object.freeze({
|
|
783
|
-
search: true,
|
|
784
|
-
pagination: true,
|
|
785
|
-
hierarchy: true,
|
|
786
|
-
spatialFilter: true,
|
|
787
|
-
temporalFilter: true,
|
|
788
|
-
textFilter: false,
|
|
789
|
-
cql2Filter: false,
|
|
790
|
-
collections: true,
|
|
791
|
-
assets: true
|
|
792
|
-
});
|
|
793
|
-
/** Cached root initialization shared by metadata and query methods. */
|
|
794
|
-
rootPromise = null;
|
|
795
|
-
/** Source document URL retained for resolving relative links and assets. */
|
|
796
|
-
documentUrls = /* @__PURE__ */ new WeakMap();
|
|
797
|
-
/** Creates a source for a static STAC root or STAC API landing page. */
|
|
798
|
-
constructor(url, options, coreApi) {
|
|
799
|
-
super(url, options, STACSourceLoaderWithParser.defaultOptions, coreApi);
|
|
800
|
-
}
|
|
801
|
-
/** Returns the cached root Catalog or Collection. */
|
|
802
|
-
async getRoot(options = {}) {
|
|
803
|
-
throwIfAborted(options.signal);
|
|
804
|
-
if (!this.rootPromise) {
|
|
805
|
-
const rootPromise = this.fetchObject(this.url).then((object) => {
|
|
806
|
-
if (!isCatalog(object) && !isCollection(object)) {
|
|
807
|
-
throw new Error(`STAC root must be a Catalog or Collection: ${this.url}`);
|
|
808
|
-
}
|
|
809
|
-
return object;
|
|
810
|
-
});
|
|
811
|
-
this.rootPromise = rootPromise;
|
|
812
|
-
void rootPromise.catch(() => {
|
|
813
|
-
if (this.rootPromise === rootPromise) {
|
|
814
|
-
this.rootPromise = null;
|
|
815
|
-
}
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
|
-
return await waitForPromiseWithSignal(this.rootPromise, options.signal);
|
|
819
|
-
}
|
|
820
|
-
/** Returns root metadata and whether a STAC API search relation was discovered. */
|
|
821
|
-
async getMetadata(options = {}) {
|
|
822
|
-
const root = await this.getRoot(options);
|
|
823
|
-
const conformsTo = Array.isArray(root.conformsTo) ? root.conformsTo : [];
|
|
824
|
-
return {
|
|
825
|
-
root,
|
|
826
|
-
mode: findLink(root.links, "search") || conformsTo.length > 0 ? "api" : "static",
|
|
827
|
-
conformsTo
|
|
828
|
-
};
|
|
829
|
-
}
|
|
830
|
-
/**
|
|
831
|
-
* Lists collections from an API Collections endpoint or a static catalog hierarchy.
|
|
832
|
-
* Static traversal follows `child` links but never fetches Item links.
|
|
833
|
-
*/
|
|
834
|
-
async getCollections(options = {}) {
|
|
835
|
-
const metadata = await this.getMetadata({ signal: options.signal });
|
|
836
|
-
if (metadata.mode === "api") {
|
|
837
|
-
return await this.getAPICollections(metadata.root, options.signal);
|
|
838
|
-
}
|
|
839
|
-
return await this.getStaticCollections(metadata.root, options);
|
|
840
|
-
}
|
|
841
|
-
/**
|
|
842
|
-
* Searches a STAC API and follows `next` links until all result pages are consumed.
|
|
843
|
-
* Throws for static catalogs; use `traverse()` to opt into client-side crawling.
|
|
844
|
-
*/
|
|
845
|
-
async *search(query = {}) {
|
|
846
|
-
const root = await this.getRoot({ signal: query.signal });
|
|
847
|
-
const searchLink = findLink(root.links, "search");
|
|
848
|
-
if (!searchLink) {
|
|
849
|
-
throw new Error("This is a static STAC catalog; use STACSource.traverse() explicitly");
|
|
850
|
-
}
|
|
851
|
-
let request = createSearchRequest(
|
|
852
|
-
searchLink,
|
|
853
|
-
this.getDocumentUrl(root),
|
|
854
|
-
query
|
|
855
|
-
);
|
|
856
|
-
const visitedRequests = /* @__PURE__ */ new Set();
|
|
857
|
-
while (request) {
|
|
858
|
-
throwIfAborted(query.signal);
|
|
859
|
-
const requestKey = getRequestKey(request);
|
|
860
|
-
if (visitedRequests.has(requestKey)) {
|
|
861
|
-
throw new Error(`STAC pagination cycle detected at ${request.url}`);
|
|
862
|
-
}
|
|
863
|
-
visitedRequests.add(requestKey);
|
|
864
|
-
const page = await this.fetchItemCollection(request, query.signal);
|
|
865
|
-
for (const item of page.features) {
|
|
866
|
-
yield item;
|
|
867
|
-
}
|
|
868
|
-
const nextLink = findLink(page.links, "next");
|
|
869
|
-
request = nextLink ? createNextRequest(nextLink, this.getDocumentUrl(page), request) : null;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
/**
|
|
873
|
-
* Explicitly traverses a static STAC link graph with cycle, depth, and request limits.
|
|
874
|
-
* Optional standard Item Search constraints are evaluated locally.
|
|
875
|
-
*/
|
|
876
|
-
async *traverse(options = {}) {
|
|
877
|
-
var _a, _b;
|
|
878
|
-
const root = await this.getRoot({ signal: options.signal });
|
|
879
|
-
const maxDepth = options.maxDepth ?? ((_a = this.options.stac) == null ? void 0 : _a.maxDepth) ?? DEFAULT_MAX_DEPTH;
|
|
880
|
-
const maxRequests = options.maxRequests ?? ((_b = this.options.stac) == null ? void 0 : _b.maxRequests) ?? DEFAULT_MAX_REQUESTS;
|
|
881
|
-
validateTraversalLimit("maxDepth", maxDepth);
|
|
882
|
-
validateTraversalLimit("maxRequests", maxRequests);
|
|
883
|
-
const rootUrl = this.getDocumentUrl(root);
|
|
884
|
-
const queue = [{ url: rootUrl, depth: 0 }];
|
|
885
|
-
const visitedUrls = /* @__PURE__ */ new Set();
|
|
886
|
-
let requestCount = 0;
|
|
887
|
-
while (queue.length > 0) {
|
|
888
|
-
throwIfAborted(options.signal);
|
|
889
|
-
const entry = queue.shift();
|
|
890
|
-
if (visitedUrls.has(entry.url)) {
|
|
891
|
-
continue;
|
|
892
|
-
}
|
|
893
|
-
if (requestCount >= maxRequests) {
|
|
894
|
-
throw new Error(`STAC traversal exceeded maxRequests (${maxRequests})`);
|
|
895
|
-
}
|
|
896
|
-
visitedUrls.add(entry.url);
|
|
897
|
-
requestCount++;
|
|
898
|
-
const object = entry.url === rootUrl ? root : await this.fetchObject(entry.url, options.signal);
|
|
899
|
-
if (isItem(object)) {
|
|
900
|
-
if (matchesItem(object, options)) {
|
|
901
|
-
yield object;
|
|
902
|
-
}
|
|
903
|
-
continue;
|
|
904
|
-
}
|
|
905
|
-
if (isItemCollection(object)) {
|
|
906
|
-
for (const item of object.features) {
|
|
907
|
-
if (matchesItem(item, options)) {
|
|
908
|
-
yield item;
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
for (const link of object.links) {
|
|
913
|
-
if (link.rel !== "child" && link.rel !== "item") {
|
|
914
|
-
continue;
|
|
915
|
-
}
|
|
916
|
-
const depth = link.rel === "child" ? entry.depth + 1 : entry.depth;
|
|
917
|
-
if (depth <= maxDepth) {
|
|
918
|
-
queue.push({ url: resolveUrl(link.href, this.getDocumentUrl(object)), depth });
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
/** Returns matching Item assets with document-relative URLs resolved to absolute URLs. */
|
|
924
|
-
getAssets(item, selection = {}) {
|
|
925
|
-
const baseUrl = this.documentUrls.get(item) || this.url;
|
|
926
|
-
const requiredRoles = new Set(selection.roles || []);
|
|
927
|
-
const requiredMediaTypes = new Set(selection.mediaTypes || []);
|
|
928
|
-
return Object.entries(item.assets).filter(([, asset]) => {
|
|
929
|
-
var _a;
|
|
930
|
-
const matchesRole = requiredRoles.size === 0 || ((_a = asset.roles) == null ? void 0 : _a.some((role) => requiredRoles.has(role)));
|
|
931
|
-
const matchesMediaType = requiredMediaTypes.size === 0 || Boolean(asset.type && requiredMediaTypes.has(asset.type));
|
|
932
|
-
return matchesRole && matchesMediaType;
|
|
933
|
-
}).map(([key, asset]) => ({ ...asset, key, href: resolveUrl(asset.href, baseUrl) }));
|
|
934
|
-
}
|
|
935
|
-
/** Fetches every page from a STAC API Collections relation. */
|
|
936
|
-
async getAPICollections(root, signal) {
|
|
937
|
-
const collectionsLink = findLink(root.links, "data") || findLink(root.links, "collections");
|
|
938
|
-
if (!collectionsLink) {
|
|
939
|
-
return isCollection(root) ? [root] : [];
|
|
940
|
-
}
|
|
941
|
-
const collections = [];
|
|
942
|
-
const visitedUrls = /* @__PURE__ */ new Set();
|
|
943
|
-
let url = resolveUrl(collectionsLink.href, this.getDocumentUrl(root));
|
|
944
|
-
while (url) {
|
|
945
|
-
throwIfAborted(signal);
|
|
946
|
-
if (visitedUrls.has(url)) {
|
|
947
|
-
throw new Error(`STAC Collections pagination cycle detected at ${url}`);
|
|
948
|
-
}
|
|
949
|
-
visitedUrls.add(url);
|
|
950
|
-
const response = await this.fetch(url, { signal });
|
|
951
|
-
assertResponse(response, url);
|
|
952
|
-
const page = validateCollections(await response.json(), url);
|
|
953
|
-
this.attachDocumentUrl(page, url);
|
|
954
|
-
for (const collection of page.collections) {
|
|
955
|
-
this.attachDocumentUrl(collection, url);
|
|
956
|
-
}
|
|
957
|
-
collections.push(...page.collections);
|
|
958
|
-
const nextLink = findLink(page.links, "next");
|
|
959
|
-
url = nextLink ? resolveUrl(nextLink.href, url) : null;
|
|
960
|
-
}
|
|
961
|
-
return collections;
|
|
962
|
-
}
|
|
963
|
-
/** Traverses only static `child` links to collect Collection documents. */
|
|
964
|
-
async getStaticCollections(root, options) {
|
|
965
|
-
var _a, _b;
|
|
966
|
-
const maxDepth = options.maxDepth ?? ((_a = this.options.stac) == null ? void 0 : _a.maxDepth) ?? DEFAULT_MAX_DEPTH;
|
|
967
|
-
const maxRequests = options.maxRequests ?? ((_b = this.options.stac) == null ? void 0 : _b.maxRequests) ?? DEFAULT_MAX_REQUESTS;
|
|
968
|
-
validateTraversalLimit("maxDepth", maxDepth);
|
|
969
|
-
validateTraversalLimit("maxRequests", maxRequests);
|
|
970
|
-
const rootUrl = this.getDocumentUrl(root);
|
|
971
|
-
const queue = [{ url: rootUrl, depth: 0 }];
|
|
972
|
-
const visitedUrls = /* @__PURE__ */ new Set();
|
|
973
|
-
const collections = [];
|
|
974
|
-
let requestCount = 0;
|
|
975
|
-
while (queue.length > 0) {
|
|
976
|
-
throwIfAborted(options.signal);
|
|
977
|
-
const entry = queue.shift();
|
|
978
|
-
if (visitedUrls.has(entry.url)) {
|
|
979
|
-
continue;
|
|
980
|
-
}
|
|
981
|
-
if (requestCount >= maxRequests) {
|
|
982
|
-
throw new Error(`STAC collection traversal exceeded maxRequests (${maxRequests})`);
|
|
983
|
-
}
|
|
984
|
-
visitedUrls.add(entry.url);
|
|
985
|
-
requestCount++;
|
|
986
|
-
const object = entry.url === rootUrl ? root : await this.fetchObject(entry.url, options.signal);
|
|
987
|
-
if (isCollection(object)) {
|
|
988
|
-
collections.push(object);
|
|
989
|
-
}
|
|
990
|
-
if (!isCatalog(object) && !isCollection(object)) {
|
|
991
|
-
continue;
|
|
992
|
-
}
|
|
993
|
-
if (entry.depth < maxDepth) {
|
|
994
|
-
for (const link of object.links) {
|
|
995
|
-
if (link.rel === "child") {
|
|
996
|
-
queue.push({
|
|
997
|
-
url: resolveUrl(link.href, this.getDocumentUrl(object)),
|
|
998
|
-
depth: entry.depth + 1
|
|
999
|
-
});
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
return collections;
|
|
1005
|
-
}
|
|
1006
|
-
/** Fetches and validates one core STAC document. */
|
|
1007
|
-
async fetchObject(url, signal) {
|
|
1008
|
-
throwIfAborted(signal);
|
|
1009
|
-
const response = await this.fetch(url, { signal });
|
|
1010
|
-
assertResponse(response, url);
|
|
1011
|
-
const object = validateObject(await response.json(), url);
|
|
1012
|
-
this.attachDocumentUrl(object, url);
|
|
1013
|
-
if (isItemCollection(object)) {
|
|
1014
|
-
for (const item of object.features) {
|
|
1015
|
-
this.attachDocumentUrl(item, url);
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
return object;
|
|
1019
|
-
}
|
|
1020
|
-
/** Executes one STAC API Item Search page request. */
|
|
1021
|
-
async fetchItemCollection(request, signal) {
|
|
1022
|
-
const headers = new Headers(request.headers);
|
|
1023
|
-
let url = request.url;
|
|
1024
|
-
let body;
|
|
1025
|
-
if (request.method === "POST") {
|
|
1026
|
-
headers.set("content-type", "application/json");
|
|
1027
|
-
body = JSON.stringify(request.body || {});
|
|
1028
|
-
} else if (request.body && Object.keys(request.body).length > 0) {
|
|
1029
|
-
url = appendQuery(url, request.body);
|
|
1030
|
-
}
|
|
1031
|
-
const response = await this.fetch(url, { method: request.method, headers, body, signal });
|
|
1032
|
-
assertResponse(response, url);
|
|
1033
|
-
const page = validateItemCollection(await response.json(), url);
|
|
1034
|
-
this.attachDocumentUrl(page, url);
|
|
1035
|
-
for (const item of page.features) {
|
|
1036
|
-
this.attachDocumentUrl(item, url);
|
|
1037
|
-
}
|
|
1038
|
-
return page;
|
|
1039
|
-
}
|
|
1040
|
-
/** Associates an object and its nested links with the fetched document URL. */
|
|
1041
|
-
attachDocumentUrl(object, url) {
|
|
1042
|
-
this.documentUrls.set(object, url);
|
|
1043
|
-
}
|
|
1044
|
-
/** Returns the URL from which a STAC object was fetched. */
|
|
1045
|
-
getDocumentUrl(object) {
|
|
1046
|
-
return this.documentUrls.get(object) || this.url;
|
|
1047
|
-
}
|
|
1048
|
-
};
|
|
1049
|
-
}
|
|
1050
|
-
});
|
|
1051
|
-
|
|
1052
30
|
// dist/stac/index.js
|
|
1053
31
|
var index_exports = {};
|
|
1054
32
|
__export(index_exports, {
|
|
1055
|
-
STACSourceLoader: () =>
|
|
33
|
+
STACSourceLoader: () => STACSourceLoader
|
|
1056
34
|
});
|
|
1057
35
|
module.exports = __toCommonJS(index_exports);
|
|
1058
36
|
|
|
1059
37
|
// dist/stac/stac-source-loader-types.js
|
|
1060
|
-
var
|
|
1061
|
-
async function
|
|
1062
|
-
const { STACSourceLoaderWithParser
|
|
1063
|
-
return
|
|
38
|
+
var VERSION = true ? "5.0.0-beta.4" : "latest";
|
|
39
|
+
async function preloadSTACSourceLoader() {
|
|
40
|
+
const { STACSourceLoaderWithParser } = await import("@loaders.gl/ogc/stac-source");
|
|
41
|
+
return STACSourceLoaderWithParser;
|
|
1064
42
|
}
|
|
1065
|
-
var
|
|
43
|
+
var STACSourceLoader = {
|
|
1066
44
|
dataType: null,
|
|
1067
45
|
batchType: null,
|
|
1068
46
|
name: "STACSourceLoader",
|
|
1069
47
|
id: "stac-source",
|
|
1070
48
|
module: "ogc",
|
|
1071
|
-
version:
|
|
49
|
+
version: VERSION,
|
|
1072
50
|
extensions: ["json"],
|
|
1073
51
|
mimeTypes: ["application/json", "application/geo+json"],
|
|
1074
52
|
type: "stac",
|
|
@@ -1087,9 +65,9 @@ var STACSourceLoader2 = {
|
|
|
1087
65
|
}
|
|
1088
66
|
},
|
|
1089
67
|
testURL: (url) => /(?:^|[/_.-])stac(?:[/_.?#-]|$)|\/(?:catalog|collection)\.json(?:$|[?#])/i.test(url),
|
|
1090
|
-
preload:
|
|
68
|
+
preload: preloadSTACSourceLoader,
|
|
1091
69
|
createDataSource(_data, _options, _coreApi) {
|
|
1092
|
-
throw new Error("STACSourceLoader requires async load() or an explicit @loaders.gl/ogc/stac
|
|
70
|
+
throw new Error("STACSourceLoader requires async load() or an explicit @loaders.gl/ogc/stac-source import");
|
|
1093
71
|
}
|
|
1094
72
|
};
|
|
1095
73
|
//# sourceMappingURL=index.cjs.map
|