@loaders.gl/sql 5.0.0-alpha.6 → 5.0.0-alpha.8
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/dist/arrow-query.cjs +22 -9
- package/dist/arrow-query.cjs.map +1 -1
- package/dist/duckdb-sql-source.d.ts +50 -3
- package/dist/duckdb-sql-source.d.ts.map +1 -1
- package/dist/duckdb-sql-source.js +1 -1
- package/dist/index.cjs +237 -72
- package/dist/index.cjs.map +3 -3
- package/dist/snowflake-sql-source.d.ts +50 -3
- package/dist/snowflake-sql-source.d.ts.map +1 -1
- package/dist/snowflake-sql-source.js +2 -2
- package/dist/snowflake-sql-source.js.map +1 -1
- package/package.json +5 -5
- package/src/snowflake-sql-source.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -97,25 +97,95 @@ function mergeOptionsRecursively(baseOptions, newOptions, level = 0) {
|
|
|
97
97
|
return options;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
// ../loader-utils/src/lib/request-utils/authentication.ts
|
|
101
|
+
function resolveCredentials(credentials, authentications = []) {
|
|
102
|
+
if (credentials.every(isAuthentication)) return credentials;
|
|
103
|
+
return credentials.map((credential, index) => {
|
|
104
|
+
if (isAuthentication(credential)) return credential;
|
|
105
|
+
const AuthenticationClass = authentications.find(
|
|
106
|
+
(authentication2) => authentication2.type === (credential == null ? void 0 : credential.type)
|
|
107
|
+
);
|
|
108
|
+
if (!AuthenticationClass) {
|
|
109
|
+
throw new Error(`No authentication class registered for credential at index ${index}.`);
|
|
110
|
+
}
|
|
111
|
+
let authentication;
|
|
112
|
+
try {
|
|
113
|
+
authentication = new AuthenticationClass(credential);
|
|
114
|
+
} catch {
|
|
115
|
+
throw new Error(`Invalid authentication configuration at index ${index}.`);
|
|
116
|
+
}
|
|
117
|
+
if (!isAuthentication(authentication)) {
|
|
118
|
+
throw new Error(`Authentication class returned an invalid credential at index ${index}.`);
|
|
119
|
+
}
|
|
120
|
+
return authentication;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function resolveAuthenticationOptions(options) {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
if (!((_b = (_a = options.core) == null ? void 0 : _a.credentials) == null ? void 0 : _b.length)) return options;
|
|
126
|
+
const credentials = resolveCredentials(options.core.credentials, options.core.authentications);
|
|
127
|
+
if (credentials === options.core.credentials) return options;
|
|
128
|
+
return { ...options, core: { ...options.core, credentials } };
|
|
129
|
+
}
|
|
130
|
+
function isAuthentication(credential) {
|
|
131
|
+
if (!credential || typeof credential !== "object") return false;
|
|
132
|
+
if (typeof credential.id !== "string" || !Array.isArray(credential.origins)) return false;
|
|
133
|
+
if (credential.type === "request") return typeof credential.authenticate === "function";
|
|
134
|
+
return (credential.type === "header" || credential.type === "query-parameter") && typeof credential.name === "string" && (typeof credential.token === "string" || typeof credential.token === "function") && Array.isArray(credential.refreshStatusCodes);
|
|
135
|
+
}
|
|
136
|
+
|
|
100
137
|
// ../loader-utils/src/lib/request-utils/request-credentials.ts
|
|
101
138
|
var AUTHENTICATED_FETCH = /* @__PURE__ */ Symbol("loaders.gl.authenticated-fetch");
|
|
102
139
|
var refreshPromises = /* @__PURE__ */ new WeakMap();
|
|
103
140
|
function createAuthenticatedFetch(options) {
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
141
|
+
const suppliedFetch = options.fetch || ((url, requestOptions) => fetch(url, requestOptions));
|
|
142
|
+
const existingMetadata = suppliedFetch[AUTHENTICATED_FETCH];
|
|
143
|
+
const credentialResolutions = new Map(existingMetadata == null ? void 0 : existingMetadata.credentialResolutions);
|
|
144
|
+
const resolvedCredentials = resolveCredentials(
|
|
145
|
+
options.credentials.map((credential) => credentialResolutions.get(credential) || credential),
|
|
146
|
+
options.authentications
|
|
147
|
+
);
|
|
148
|
+
options.credentials.forEach((credential, index) => {
|
|
149
|
+
credentialResolutions.set(credential, resolvedCredentials[index]);
|
|
150
|
+
});
|
|
151
|
+
if (!options.fetchOptions && (!resolvedCredentials.length || (existingMetadata == null ? void 0 : existingMetadata.credentials.length) === resolvedCredentials.length && resolvedCredentials.every(
|
|
152
|
+
(credential, index) => credential === existingMetadata.credentials[index]
|
|
153
|
+
)))
|
|
154
|
+
return suppliedFetch;
|
|
155
|
+
const baseFetch = (existingMetadata == null ? void 0 : existingMetadata.fetch) || suppliedFetch;
|
|
156
|
+
const credentials = existingMetadata ? [.../* @__PURE__ */ new Set([...resolvedCredentials, ...existingMetadata.credentials])] : resolvedCredentials;
|
|
157
|
+
const fetchOptions = mergeFetchOptions(
|
|
158
|
+
(existingMetadata == null ? void 0 : existingMetadata.fetchOptions) || {},
|
|
159
|
+
options.fetchOptions
|
|
160
|
+
);
|
|
161
|
+
const tokenCredentials = credentials.filter(
|
|
162
|
+
(credential) => credential.type !== "request"
|
|
163
|
+
);
|
|
164
|
+
const requestCredentials = credentials.filter(
|
|
165
|
+
(credential) => credential.type === "request"
|
|
166
|
+
);
|
|
167
|
+
for (const credential of requestCredentials) normalizeRequestOrigins(credential.origins);
|
|
108
168
|
const authenticatedFetch = async (url, requestOptions = {}) => {
|
|
109
|
-
var _a, _b, _c;
|
|
169
|
+
var _a, _b, _c, _d;
|
|
170
|
+
requestOptions = mergeFetchOptions(fetchOptions, requestOptions);
|
|
171
|
+
if ((_a = requestOptions.signal) == null ? void 0 : _a.aborted) throw createAbortError();
|
|
172
|
+
if (!credentials.length) return baseFetch(url, requestOptions);
|
|
110
173
|
const resolvedURL = parseHTTPURL(url);
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
const response = await baseFetch(
|
|
174
|
+
const authorization = resolvedURL ? await authorizeRequest(resolvedURL, requestOptions, tokenCredentials) : { url, options: requestOptions, credentials: [] };
|
|
175
|
+
const signedRequest = await authenticateRequest(authorization, requestCredentials, "request");
|
|
176
|
+
const response = await baseFetch(signedRequest.url, signedRequest.options);
|
|
114
177
|
const refreshableCredentials = authorization.credentials.filter(
|
|
115
178
|
({ credential }) => typeof credential.token === "function" && credential.refreshStatusCodes.includes(response.status)
|
|
116
179
|
);
|
|
117
|
-
|
|
118
|
-
|
|
180
|
+
const shouldRetrySignature = signedRequest.credentials.some(
|
|
181
|
+
(credential) => {
|
|
182
|
+
var _a2;
|
|
183
|
+
return (_a2 = credential.refreshStatusCodes) == null ? void 0 : _a2.includes(response.status);
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
if (!refreshableCredentials.length && !shouldRetrySignature || !isReplayableRequest(requestOptions) || !isReplayableRequest(signedRequest.options))
|
|
187
|
+
return response;
|
|
188
|
+
if ((_b = requestOptions.signal) == null ? void 0 : _b.aborted) throw createAbortError();
|
|
119
189
|
const refreshedTokens = /* @__PURE__ */ new Map();
|
|
120
190
|
await Promise.all(
|
|
121
191
|
refreshableCredentials.map(async ({ credential }) => {
|
|
@@ -123,24 +193,111 @@ function createAuthenticatedFetch(options) {
|
|
|
123
193
|
if (token) refreshedTokens.set(credential, token);
|
|
124
194
|
})
|
|
125
195
|
);
|
|
126
|
-
if (!refreshedTokens.size) return response;
|
|
127
|
-
await ((
|
|
196
|
+
if (!refreshedTokens.size && !shouldRetrySignature) return response;
|
|
197
|
+
await ((_c = response.body) == null ? void 0 : _c.cancel().catch(() => {
|
|
128
198
|
}));
|
|
129
|
-
if ((
|
|
130
|
-
const replayAuthorization = await authorizeRequest(
|
|
199
|
+
if ((_d = requestOptions.signal) == null ? void 0 : _d.aborted) throw createAbortError();
|
|
200
|
+
const replayAuthorization = resolvedURL ? await authorizeRequest(
|
|
131
201
|
resolvedURL,
|
|
132
202
|
requestOptions,
|
|
133
|
-
|
|
203
|
+
tokenCredentials,
|
|
134
204
|
refreshedTokens,
|
|
135
205
|
authorization.credentials
|
|
206
|
+
) : { url, options: requestOptions };
|
|
207
|
+
const replayRequest = await authenticateRequest(
|
|
208
|
+
replayAuthorization,
|
|
209
|
+
requestCredentials,
|
|
210
|
+
"retry",
|
|
211
|
+
response
|
|
136
212
|
);
|
|
137
|
-
return baseFetch(
|
|
213
|
+
return baseFetch(replayRequest.url, replayRequest.options);
|
|
138
214
|
};
|
|
139
215
|
Object.defineProperty(authenticatedFetch, AUTHENTICATED_FETCH, {
|
|
140
|
-
value:
|
|
216
|
+
value: {
|
|
217
|
+
fetch: baseFetch,
|
|
218
|
+
credentials,
|
|
219
|
+
credentialResolutions,
|
|
220
|
+
fetchOptions
|
|
221
|
+
}
|
|
141
222
|
});
|
|
142
223
|
return authenticatedFetch;
|
|
143
224
|
}
|
|
225
|
+
function getAuthenticatedFetch(options = {}) {
|
|
226
|
+
var _a, _b, _c;
|
|
227
|
+
const fetchOption = options.fetch ?? ((_a = options.core) == null ? void 0 : _a.fetch);
|
|
228
|
+
let fetchFunction;
|
|
229
|
+
if (typeof fetchOption === "function") {
|
|
230
|
+
fetchFunction = fetchOption;
|
|
231
|
+
} else {
|
|
232
|
+
fetchFunction = (url, requestOptions) => fetch(url, requestOptions);
|
|
233
|
+
}
|
|
234
|
+
return createAuthenticatedFetch({
|
|
235
|
+
fetch: fetchFunction,
|
|
236
|
+
fetchOptions: typeof fetchOption === "object" && fetchOption ? fetchOption : void 0,
|
|
237
|
+
credentials: ((_b = options.core) == null ? void 0 : _b.credentials) || [],
|
|
238
|
+
authentications: (_c = options.core) == null ? void 0 : _c.authentications
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
function mergeFetchOptions(defaultOptions, requestOptions) {
|
|
242
|
+
const mergedOptions = { ...defaultOptions, ...requestOptions };
|
|
243
|
+
if (defaultOptions.headers || (requestOptions == null ? void 0 : requestOptions.headers)) {
|
|
244
|
+
const headers = new Headers(defaultOptions.headers);
|
|
245
|
+
new Headers(requestOptions == null ? void 0 : requestOptions.headers).forEach((value, key) => headers.set(key, value));
|
|
246
|
+
mergedOptions.headers = headers;
|
|
247
|
+
}
|
|
248
|
+
return mergedOptions;
|
|
249
|
+
}
|
|
250
|
+
async function authenticateRequest(request, credentials, reason, response) {
|
|
251
|
+
const appliedCredentials = [];
|
|
252
|
+
const signal = request.options.signal;
|
|
253
|
+
for (const credential of credentials) {
|
|
254
|
+
const origin = getRequestOrigin(request.url);
|
|
255
|
+
if (!origin || !normalizeRequestOrigins(credential.origins).includes(origin)) continue;
|
|
256
|
+
if (signal == null ? void 0 : signal.aborted) throw createAbortError();
|
|
257
|
+
const authenticatedRequest = await credential.authenticate({
|
|
258
|
+
url: request.url,
|
|
259
|
+
options: { ...request.options, headers: new Headers(request.options.headers) },
|
|
260
|
+
reason,
|
|
261
|
+
response: response ? { status: response.status, headers: new Headers(response.headers) } : void 0
|
|
262
|
+
});
|
|
263
|
+
if (!authenticatedRequest || typeof authenticatedRequest.url !== "string" || !authenticatedRequest.options || typeof authenticatedRequest.options !== "object") {
|
|
264
|
+
throw new Error("Authentication callback returned an invalid request.");
|
|
265
|
+
}
|
|
266
|
+
request = {
|
|
267
|
+
url: authenticatedRequest.url,
|
|
268
|
+
options: { ...authenticatedRequest.options, ...signal ? { signal } : {} }
|
|
269
|
+
};
|
|
270
|
+
appliedCredentials.push(credential);
|
|
271
|
+
}
|
|
272
|
+
if (signal == null ? void 0 : signal.aborted) throw createAbortError();
|
|
273
|
+
return { ...request, credentials: appliedCredentials };
|
|
274
|
+
}
|
|
275
|
+
function getRequestOrigin(url) {
|
|
276
|
+
try {
|
|
277
|
+
const parsedURL = new URL(url);
|
|
278
|
+
if (!parsedURL.host || parsedURL.username || parsedURL.password) return null;
|
|
279
|
+
return parsedURL.origin !== "null" ? parsedURL.origin : `${parsedURL.protocol}//${parsedURL.host}`;
|
|
280
|
+
} catch {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
function normalizeRequestOrigins(origins) {
|
|
285
|
+
if (!origins.length)
|
|
286
|
+
throw new Error("Request authentication requires at least one exact origin.");
|
|
287
|
+
return origins.map((origin) => {
|
|
288
|
+
const resolvedOrigin = getRequestOrigin(origin);
|
|
289
|
+
let url;
|
|
290
|
+
try {
|
|
291
|
+
url = new URL(origin);
|
|
292
|
+
} catch {
|
|
293
|
+
throw new Error("Invalid request authentication origin.");
|
|
294
|
+
}
|
|
295
|
+
if (!resolvedOrigin || url.pathname && url.pathname !== "/" || url.search || url.hash) {
|
|
296
|
+
throw new Error("Invalid request authentication origin.");
|
|
297
|
+
}
|
|
298
|
+
return resolvedOrigin;
|
|
299
|
+
});
|
|
300
|
+
}
|
|
144
301
|
async function authorizeRequest(sourceURL, requestOptions, credentials, tokenOverrides = /* @__PURE__ */ new Map(), previousCredentials = []) {
|
|
145
302
|
const url = new URL(sourceURL);
|
|
146
303
|
const headers = new Headers(requestOptions.headers);
|
|
@@ -237,7 +394,6 @@ var DataSource = class _DataSource {
|
|
|
237
394
|
core: {
|
|
238
395
|
type: "auto",
|
|
239
396
|
attributions: [],
|
|
240
|
-
loadOptions: {},
|
|
241
397
|
loaders: [],
|
|
242
398
|
onError: void 0
|
|
243
399
|
}
|
|
@@ -246,9 +402,9 @@ var DataSource = class _DataSource {
|
|
|
246
402
|
options;
|
|
247
403
|
data;
|
|
248
404
|
url;
|
|
249
|
-
/**
|
|
405
|
+
/** Shared parser options derived from the source options, excluding source-only core controls. */
|
|
250
406
|
loadOptions;
|
|
251
|
-
/** A resolved fetch function extracted from
|
|
407
|
+
/** A resolved fetch function extracted from the shared core options. */
|
|
252
408
|
fetch;
|
|
253
409
|
/** Shared source-level runtime hooks, when supplied by the source factory. */
|
|
254
410
|
coreApi;
|
|
@@ -256,15 +412,13 @@ var DataSource = class _DataSource {
|
|
|
256
412
|
hasCoreApi;
|
|
257
413
|
_needsRefresh = true;
|
|
258
414
|
constructor(data, options, defaultOptions, coreApi) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
this.options = { ...options };
|
|
264
|
-
}
|
|
415
|
+
this.options = mergeOptions(
|
|
416
|
+
mergeOptions(_DataSource.defaultOptions, defaultOptions || {}),
|
|
417
|
+
options
|
|
418
|
+
);
|
|
265
419
|
this.data = data;
|
|
266
420
|
this.url = typeof data === "string" ? resolvePath(data) : "";
|
|
267
|
-
const loadOptions =
|
|
421
|
+
const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(this.options));
|
|
268
422
|
this.loadOptions = loadOptions;
|
|
269
423
|
const fetch2 = getFetchFunction(loadOptions);
|
|
270
424
|
this.coreApi = coreApi || UNAVAILABLE_CORE_API;
|
|
@@ -272,7 +426,11 @@ var DataSource = class _DataSource {
|
|
|
272
426
|
this.fetch = fetch2;
|
|
273
427
|
}
|
|
274
428
|
setProps(options) {
|
|
275
|
-
|
|
429
|
+
const mergedOptions = mergeOptions(this.options, options);
|
|
430
|
+
const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(mergedOptions));
|
|
431
|
+
this.options = mergedOptions;
|
|
432
|
+
this.loadOptions = loadOptions;
|
|
433
|
+
this.fetch = getFetchFunction(loadOptions);
|
|
276
434
|
this.setNeedsRefresh();
|
|
277
435
|
}
|
|
278
436
|
/** Mark this data source as needing a refresh (redraw) */
|
|
@@ -304,39 +462,25 @@ var DataSource = class _DataSource {
|
|
|
304
462
|
}
|
|
305
463
|
};
|
|
306
464
|
function getFetchFunction(options) {
|
|
307
|
-
|
|
308
|
-
const fetchOption = (options == null ? void 0 : options.fetch) ?? ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a.fetch);
|
|
309
|
-
let fetchFunction;
|
|
310
|
-
if (typeof fetchOption === "function") {
|
|
311
|
-
fetchFunction = (url, fetchOptions) => fetchOption(url, fetchOptions);
|
|
312
|
-
} else if (fetchOption) {
|
|
313
|
-
fetchFunction = (url, requestOptions) => fetch(url, mergeFetchOptions(fetchOption, requestOptions));
|
|
314
|
-
} else {
|
|
315
|
-
fetchFunction = (url, requestOptions) => fetch(url, requestOptions);
|
|
316
|
-
}
|
|
317
|
-
return createAuthenticatedFetch({
|
|
318
|
-
fetch: fetchFunction,
|
|
319
|
-
credentials: ((_b = options == null ? void 0 : options.core) == null ? void 0 : _b.credentials) || []
|
|
320
|
-
});
|
|
465
|
+
return getAuthenticatedFetch(options);
|
|
321
466
|
}
|
|
322
|
-
function
|
|
323
|
-
|
|
324
|
-
if (
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}
|
|
329
|
-
function mergeHeaders(defaultHeaders, requestHeaders) {
|
|
330
|
-
const headers = new Headers(defaultHeaders);
|
|
331
|
-
if (requestHeaders) {
|
|
332
|
-
new Headers(requestHeaders).forEach((value, key) => headers.set(key, value));
|
|
467
|
+
function getSourceLoaderOptions(options) {
|
|
468
|
+
var _a;
|
|
469
|
+
if (options.loadOptions !== void 0 || ((_a = options.core) == null ? void 0 : _a.loadOptions) !== void 0) {
|
|
470
|
+
throw new Error(
|
|
471
|
+
"Source loadOptions and core.loadOptions were removed. Use core and root loader namespaces directly."
|
|
472
|
+
);
|
|
333
473
|
}
|
|
334
|
-
return headers;
|
|
335
|
-
}
|
|
336
|
-
function normalizeDirectLoaderOptions(options) {
|
|
337
474
|
const loadOptions = { ...options };
|
|
338
475
|
if (options == null ? void 0 : options.core) {
|
|
339
476
|
loadOptions.core = { ...options.core };
|
|
477
|
+
const parserCore = loadOptions.core;
|
|
478
|
+
for (const key of ["type", "attributions", "loaders", "onError", "loadOptions"]) {
|
|
479
|
+
delete parserCore[key];
|
|
480
|
+
}
|
|
481
|
+
if (Object.keys(parserCore).length === 0) {
|
|
482
|
+
delete loadOptions.core;
|
|
483
|
+
}
|
|
340
484
|
}
|
|
341
485
|
const topLevelBaseUri = typeof loadOptions.baseUri === "string" ? loadOptions.baseUri : void 0;
|
|
342
486
|
const topLevelBaseUrl = typeof loadOptions.baseUrl === "string" ? loadOptions.baseUrl : void 0;
|
|
@@ -1144,6 +1288,7 @@ function validateSQLIdentifier(identifier) {
|
|
|
1144
1288
|
var arrow5 = __toESM(require("apache-arrow"), 1);
|
|
1145
1289
|
|
|
1146
1290
|
// ../schema-utils/src/lib/schema/data-type.ts
|
|
1291
|
+
var import_types = require("@math.gl/types");
|
|
1147
1292
|
function getDataTypeFromValue(value, defaultNumberType = "float32") {
|
|
1148
1293
|
if (value instanceof Date) {
|
|
1149
1294
|
return "date-millisecond";
|
|
@@ -1174,6 +1319,9 @@ function getDataTypeFromArray(array) {
|
|
|
1174
1319
|
return { type: "null", nullable: true };
|
|
1175
1320
|
}
|
|
1176
1321
|
function getDataTypeFromTypedArray(array) {
|
|
1322
|
+
if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
|
|
1323
|
+
return "float16";
|
|
1324
|
+
}
|
|
1177
1325
|
switch (array.constructor) {
|
|
1178
1326
|
case Int8Array:
|
|
1179
1327
|
return "int8";
|
|
@@ -1188,6 +1336,10 @@ function getDataTypeFromTypedArray(array) {
|
|
|
1188
1336
|
return "int32";
|
|
1189
1337
|
case Uint32Array:
|
|
1190
1338
|
return "uint32";
|
|
1339
|
+
case BigInt64Array:
|
|
1340
|
+
return "int64";
|
|
1341
|
+
case BigUint64Array:
|
|
1342
|
+
return "uint64";
|
|
1191
1343
|
case Float32Array:
|
|
1192
1344
|
return "float32";
|
|
1193
1345
|
case Float64Array:
|
|
@@ -1215,6 +1367,8 @@ function getArrayTypeFromDataType(type, nullable) {
|
|
|
1215
1367
|
return Float32Array;
|
|
1216
1368
|
case "float64":
|
|
1217
1369
|
return Float64Array;
|
|
1370
|
+
case "float16":
|
|
1371
|
+
return (0, import_types.getFloat16ArrayConstructor)();
|
|
1218
1372
|
default:
|
|
1219
1373
|
break;
|
|
1220
1374
|
}
|
|
@@ -1271,6 +1425,13 @@ function serializeArrowType(arrowType) {
|
|
|
1271
1425
|
if (isArrowViewType(arrowType, "Utf8View")) {
|
|
1272
1426
|
return "utf8-view";
|
|
1273
1427
|
}
|
|
1428
|
+
if (isOptionalArrowType(arrowType, "LargeList")) {
|
|
1429
|
+
const largeListType = arrowType;
|
|
1430
|
+
return {
|
|
1431
|
+
type: "large-list",
|
|
1432
|
+
children: [serializeArrowField(largeListType.valueField)]
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1274
1435
|
switch (arrowType.constructor) {
|
|
1275
1436
|
case arrow.Null:
|
|
1276
1437
|
return "null";
|
|
@@ -1409,12 +1570,6 @@ function serializeArrowType(arrowType) {
|
|
|
1409
1570
|
type: "list",
|
|
1410
1571
|
children: [serializeArrowField(listField)]
|
|
1411
1572
|
};
|
|
1412
|
-
case arrow.LargeList:
|
|
1413
|
-
const largeListType = arrowType;
|
|
1414
|
-
return {
|
|
1415
|
-
type: "large-list",
|
|
1416
|
-
children: [serializeArrowField(largeListType.valueField)]
|
|
1417
|
-
};
|
|
1418
1573
|
case arrow.FixedSizeList:
|
|
1419
1574
|
const fixedSizeList = arrowType;
|
|
1420
1575
|
return {
|
|
@@ -1467,7 +1622,13 @@ function deserializeArrowType(dataType, options) {
|
|
|
1467
1622
|
}
|
|
1468
1623
|
case "large-list": {
|
|
1469
1624
|
const field = deserializeArrowField(dataType.children[0], options);
|
|
1470
|
-
|
|
1625
|
+
const LargeList = getOptionalArrowConstructor("LargeList");
|
|
1626
|
+
if (!LargeList) {
|
|
1627
|
+
throw new Error(
|
|
1628
|
+
"LargeList requires an Apache Arrow runtime that exports the LargeList constructor"
|
|
1629
|
+
);
|
|
1630
|
+
}
|
|
1631
|
+
return new LargeList(field);
|
|
1471
1632
|
}
|
|
1472
1633
|
case "fixed-size-list": {
|
|
1473
1634
|
const child = deserializeArrowField(dataType.children[0], options);
|
|
@@ -1563,11 +1724,11 @@ function deserializeArrowType(dataType, options) {
|
|
|
1563
1724
|
throw new Error("array type not supported");
|
|
1564
1725
|
}
|
|
1565
1726
|
}
|
|
1566
|
-
function
|
|
1567
|
-
return arrow;
|
|
1727
|
+
function getOptionalArrowConstructor(typeName) {
|
|
1728
|
+
return arrow[typeName];
|
|
1568
1729
|
}
|
|
1569
1730
|
function isArrowViewType(arrowType, viewTypeName) {
|
|
1570
|
-
const constructor =
|
|
1731
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
1571
1732
|
if (constructor && arrowType instanceof constructor) {
|
|
1572
1733
|
return true;
|
|
1573
1734
|
}
|
|
@@ -1575,12 +1736,16 @@ function isArrowViewType(arrowType, viewTypeName) {
|
|
|
1575
1736
|
const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
|
|
1576
1737
|
return Boolean(guard == null ? void 0 : guard(arrowType));
|
|
1577
1738
|
}
|
|
1739
|
+
function isOptionalArrowType(arrowType, typeName) {
|
|
1740
|
+
const constructor = getOptionalArrowConstructor(typeName);
|
|
1741
|
+
return Boolean(constructor && arrowType instanceof constructor);
|
|
1742
|
+
}
|
|
1578
1743
|
function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
|
|
1579
1744
|
const viewTypeMode = (options == null ? void 0 : options.viewTypes) || "never";
|
|
1580
1745
|
if (viewTypeMode === "never") {
|
|
1581
1746
|
return fallbackType;
|
|
1582
1747
|
}
|
|
1583
|
-
const constructor =
|
|
1748
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
1584
1749
|
if (constructor) {
|
|
1585
1750
|
return new constructor();
|
|
1586
1751
|
}
|
|
@@ -1592,7 +1757,7 @@ function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
|
|
|
1592
1757
|
return fallbackType;
|
|
1593
1758
|
}
|
|
1594
1759
|
function makeRequiredArrowViewType(viewTypeName) {
|
|
1595
|
-
const constructor =
|
|
1760
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
1596
1761
|
if (!constructor) {
|
|
1597
1762
|
throw new Error(
|
|
1598
1763
|
`${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
|
|
@@ -3104,7 +3269,7 @@ function throwIfAborted2(signal) {
|
|
|
3104
3269
|
}
|
|
3105
3270
|
|
|
3106
3271
|
// dist/duckdb-sql-source.js
|
|
3107
|
-
var VERSION2 = true ? "5.0.0-alpha.
|
|
3272
|
+
var VERSION2 = true ? "5.0.0-alpha.8" : "latest";
|
|
3108
3273
|
var DuckDBSQLSource = {
|
|
3109
3274
|
dataType: null,
|
|
3110
3275
|
batchType: null,
|
|
@@ -3400,7 +3565,7 @@ function getDuckDBDatabasePath(url, options) {
|
|
|
3400
3565
|
}
|
|
3401
3566
|
|
|
3402
3567
|
// dist/snowflake-sql-source.js
|
|
3403
|
-
var VERSION3 = true ? "5.0.0-alpha.
|
|
3568
|
+
var VERSION3 = true ? "5.0.0-alpha.8" : "latest";
|
|
3404
3569
|
var SnowflakeSQLSource = {
|
|
3405
3570
|
dataType: null,
|
|
3406
3571
|
batchType: null,
|
|
@@ -3557,8 +3722,8 @@ async function executeSnowflakeStatement(context, baseStatementUrl, authorizatio
|
|
|
3557
3722
|
return response;
|
|
3558
3723
|
}
|
|
3559
3724
|
async function fetchSnowflakeJson(context, url, authorization, requestInit) {
|
|
3560
|
-
var _a
|
|
3561
|
-
const customFetch = (
|
|
3725
|
+
var _a;
|
|
3726
|
+
const customFetch = (_a = context.options.core) == null ? void 0 : _a.fetch;
|
|
3562
3727
|
const headers = new Headers(requestInit.headers);
|
|
3563
3728
|
headers.set("Authorization", authorization.startsWith("Bearer ") ? authorization : `Bearer ${authorization}`);
|
|
3564
3729
|
headers.set("Accept", "application/json");
|