@cereusdb/standard 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Standard CereusDB browser package. Everything in `@cereusdb/minimal`, plus PROJ-backed `ST_Transform` and CRS-aware reprojection support.
4
4
 
5
+ This package includes browser object stores for ranged remote Parquet reads and S3/GCS/Azure/HTTP providers.
6
+
5
7
  ## Install
6
8
 
7
9
  ```bash
@@ -31,12 +33,20 @@ Not included in this package:
31
33
  - S2 geography kernels
32
34
  - Raster `RS_*` functions
33
35
 
36
+ ## Object storage support
37
+
38
+ Browser object stores are included in `@cereusdb/standard`. Use `registerObjectStores()` to configure `http`, `s3`, `gcs`, or `azure` providers, then `registerParquetTable()` to register an exact Parquet object or provider-backed prefix.
39
+
34
40
  ## JS / TS API
35
41
 
36
42
  Exports:
37
43
 
38
44
  - `CereusDB`
39
45
  - `CereusDBOptions`
46
+ - `ObjectStoreRegistryConfig`
47
+ - `ObjectStoreConfig`
48
+ - `ObjectStoreProvider`
49
+ - `RegisterParquetTableOptions`
40
50
  - `RasterFormat`
41
51
  - `QueryResult`
42
52
 
@@ -44,6 +54,7 @@ Main types:
44
54
 
45
55
  ```ts
46
56
  type RasterFormat = 'geotiff' | 'tiff';
57
+ type ObjectStoreProvider = 'http' | 's3' | 'gcs' | 'azure';
47
58
 
48
59
  interface CereusDBOptions {
49
60
  wasmUrl?: string;
@@ -54,6 +65,24 @@ interface CereusDBOptions {
54
65
  | BufferSource
55
66
  | WebAssembly.Module
56
67
  | Promise<Response>;
68
+ objectStores?: ObjectStoreRegistryConfig;
69
+ }
70
+
71
+ interface ObjectStoreRegistryConfig {
72
+ maxConcurrency?: number;
73
+ stores: ObjectStoreConfig[];
74
+ }
75
+
76
+ interface ObjectStoreConfig {
77
+ name?: string;
78
+ provider: ObjectStoreProvider;
79
+ url: string;
80
+ options?: Record<string, string | number | boolean>;
81
+ }
82
+
83
+ interface RegisterParquetTableOptions {
84
+ fileExtension?: string;
85
+ targetPartitions?: number;
57
86
  }
58
87
  ```
59
88
 
@@ -65,6 +94,12 @@ class CereusDB {
65
94
  sql(query: string): Promise<Uint8Array>;
66
95
  sqlJSON(query: string): Promise<Record<string, unknown>[]>;
67
96
  registerRemoteParquet(name: string, url: string): Promise<void>;
97
+ registerObjectStores(config: ObjectStoreRegistryConfig): void;
98
+ registerParquetTable(
99
+ name: string,
100
+ url: string,
101
+ options?: RegisterParquetTableOptions,
102
+ ): Promise<void>;
68
103
  registerFile(name: string, file: File): Promise<void>;
69
104
  registerGeoJSON(name: string, geojson: string | object): void;
70
105
  registerRaster(name: string, data: BufferSource, format: RasterFormat): void;
@@ -80,6 +115,9 @@ API notes:
80
115
  - `sql()` returns Arrow IPC bytes as `Uint8Array`.
81
116
  - `sqlJSON()` returns parsed JSON rows.
82
117
  - `registerFile()` supports `.parquet`, `.geoparquet`, `.geojson`, and `.json` in this package.
118
+ - `registerObjectStores()` and `registerParquetTable()` support browser-backed ranged Parquet reads for `http`, `s3`, `gcs`, and `azure` providers.
119
+ - S3 temporary credentials use `access_key_id`, `secret_access_key`, and `token`, where `token` is the STS `SessionToken`.
120
+ - S3-compatible endpoints can be configured with `endpoint`; use `allow_http: true` for local HTTP endpoints such as MinIO or LocalStack.
83
121
  - `registerRaster()` and `registerGeoTIFF()` are part of the shared wrapper, but raster registration requires `@cereusdb/full`.
84
122
 
85
123
  ## Example
package/dist/index.d.ts CHANGED
@@ -13,8 +13,33 @@ export interface CereusDBOptions {
13
13
  wasmUrl?: string;
14
14
  /** Preloaded WASM bytes/module for Node or custom loaders. */
15
15
  wasmSource?: RequestInfo | URL | Response | BufferSource | WebAssembly.Module | Promise<Response>;
16
+ /** Browser-backed object stores to register at startup. */
17
+ objectStores?: ObjectStoreRegistryConfig;
16
18
  }
17
19
  export type RasterFormat = 'geotiff' | 'tiff';
20
+ export type ObjectStoreProvider = 'http' | 's3' | 'gcs' | 'azure';
21
+ export interface ObjectStoreRegistryConfig {
22
+ /** Maximum concurrent browser fetches used by object_store. */
23
+ maxConcurrency?: number;
24
+ /** Stores registered by URL prefix. */
25
+ stores: ObjectStoreConfig[];
26
+ }
27
+ export interface ObjectStoreConfig {
28
+ /** Optional diagnostic name. */
29
+ name?: string;
30
+ /** Backing provider. */
31
+ provider: ObjectStoreProvider;
32
+ /** URL prefix, for example https://host, s3://bucket, gs://bucket. */
33
+ url: string;
34
+ /** Upstream object_store option keys and primitive values. */
35
+ options?: Record<string, string | number | boolean>;
36
+ }
37
+ export interface RegisterParquetTableOptions {
38
+ /** File extension used during listing discovery. Defaults to .parquet. */
39
+ fileExtension?: string;
40
+ /** Optional DataFusion target partition count. */
41
+ targetPartitions?: number;
42
+ }
18
43
  export declare class CereusDB {
19
44
  private inner;
20
45
  private constructor();
@@ -36,6 +61,14 @@ export declare class CereusDB {
36
61
  * The server must support CORS.
37
62
  */
38
63
  registerRemoteParquet(name: string, url: string): Promise<void>;
64
+ /**
65
+ * Register browser-backed object stores for ranged and listing reads.
66
+ */
67
+ registerObjectStores(config: ObjectStoreRegistryConfig): void;
68
+ /**
69
+ * Register a remote Parquet object or prefix through DataFusion's listing table path.
70
+ */
71
+ registerParquetTable(name: string, url: string, options?: RegisterParquetTableOptions): Promise<void>;
39
72
  /**
40
73
  * Register a local file (from File API / drag-and-drop) as a table.
41
74
  * Currently supports Parquet, GeoJSON, and GeoTIFF rasters.
@@ -61,4 +94,5 @@ export declare class CereusDB {
61
94
  tables(): string[];
62
95
  /** Version string. */
63
96
  version(): string;
97
+ private objectStoreApi;
64
98
  }
package/dist/index.js CHANGED
@@ -29,7 +29,11 @@ export class CereusDB {
29
29
  await init({ module_or_path: source });
30
30
  }
31
31
  const inner = WasmCereusDB.create();
32
- return new CereusDB(inner);
32
+ const db = new CereusDB(inner);
33
+ if (options?.objectStores !== undefined) {
34
+ db.registerObjectStores(options.objectStores);
35
+ }
36
+ return db;
33
37
  }
34
38
  /**
35
39
  * Execute a SQL query and return results as Arrow IPC bytes.
@@ -51,6 +55,18 @@ export class CereusDB {
51
55
  async registerRemoteParquet(name, url) {
52
56
  await this.inner.register_remote_parquet(name, url);
53
57
  }
58
+ /**
59
+ * Register browser-backed object stores for ranged and listing reads.
60
+ */
61
+ registerObjectStores(config) {
62
+ this.objectStoreApi().register_object_stores(config);
63
+ }
64
+ /**
65
+ * Register a remote Parquet object or prefix through DataFusion's listing table path.
66
+ */
67
+ async registerParquetTable(name, url, options = {}) {
68
+ await this.objectStoreApi().register_parquet_table(name, url, options);
69
+ }
54
70
  /**
55
71
  * Register a local file (from File API / drag-and-drop) as a table.
56
72
  * Currently supports Parquet, GeoJSON, and GeoTIFF rasters.
@@ -105,4 +121,12 @@ export class CereusDB {
105
121
  version() {
106
122
  return this.inner.version();
107
123
  }
124
+ objectStoreApi() {
125
+ const api = this.inner;
126
+ if (typeof api.register_object_stores !== 'function' ||
127
+ typeof api.register_parquet_table !== 'function') {
128
+ throw new Error('Browser object stores are not available in this CereusDB build');
129
+ }
130
+ return api;
131
+ }
108
132
  }
@@ -27,11 +27,19 @@ export class CereusDB {
27
27
  * Requires the full GDAL-enabled build.
28
28
  */
29
29
  register_geotiff_buffer(table_name: string, data: Uint8Array): void;
30
+ /**
31
+ * Register browser-backed object stores for ranged/listing reads.
32
+ */
33
+ register_object_stores(config: any): void;
30
34
  /**
31
35
  * Register a Uint8Array containing Parquet data as a named table.
32
36
  * Use for files obtained via the browser File API.
33
37
  */
34
38
  register_parquet_buffer(table_name: string, data: Uint8Array): Promise<void>;
39
+ /**
40
+ * Register a remote Parquet object or prefix as a DataFusion listing table.
41
+ */
42
+ register_parquet_table(table_name: string, table_url: string, options: any): Promise<void>;
35
43
  /**
36
44
  * Register a raster buffer as a single-column raster table.
37
45
  * Requires the full GDAL-enabled build.
@@ -81,7 +89,9 @@ export interface InitOutput {
81
89
  readonly cereusdb_drop_table: (a: number, b: number, c: number) => [number, number];
82
90
  readonly cereusdb_register_geojson: (a: number, b: number, c: number, d: number, e: number) => [number, number];
83
91
  readonly cereusdb_register_geotiff_buffer: (a: number, b: number, c: number, d: number, e: number) => [number, number];
92
+ readonly cereusdb_register_object_stores: (a: number, b: any) => [number, number];
84
93
  readonly cereusdb_register_parquet_buffer: (a: number, b: number, c: number, d: number, e: number) => any;
94
+ readonly cereusdb_register_parquet_table: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
85
95
  readonly cereusdb_register_raster_buffer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
86
96
  readonly cereusdb_register_remote_parquet: (a: number, b: number, c: number, d: number, e: number) => any;
87
97
  readonly cereusdb_sql: (a: number, b: number, c: number) => any;
@@ -97,9 +107,9 @@ export interface InitOutput {
97
107
  readonly emscripten_builtin_free: (a: number) => void;
98
108
  readonly emscripten_builtin_malloc: (a: number) => number;
99
109
  readonly __cpp_exception: WebAssembly.Tag;
100
- readonly wasm_bindgen__closure__destroy__hcd35ec5c66a281ba: (a: number, b: number) => void;
101
- readonly wasm_bindgen__convert__closures_____invoke__h7573a8a64f443504: (a: number, b: number, c: any) => [number, number];
102
- readonly wasm_bindgen__convert__closures_____invoke__h3bcc27440de746c0: (a: number, b: number, c: any, d: any) => void;
110
+ readonly wasm_bindgen__closure__destroy__h2bfbe8d19302e783: (a: number, b: number) => void;
111
+ readonly wasm_bindgen__convert__closures_____invoke__h3c10a375d8fa7de6: (a: number, b: number, c: any) => [number, number];
112
+ readonly wasm_bindgen__convert__closures_____invoke__h62da4917f540b667: (a: number, b: number, c: any, d: any) => void;
103
113
  readonly __wbindgen_malloc: (a: number, b: number) => number;
104
114
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
105
115
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
@@ -2,6 +2,7 @@ import { createEnvImports, createWasiImports, setMemory } from "./env_shim.js?v=
2
2
  const __env = createEnvImports();
3
3
  const __wasi = createWasiImports();
4
4
  /* @ts-self-types="./cereusdb.d.ts" */
5
+ import { cereusdbFetch, cereusdbSetFetchConcurrency } from './snippets/cereusdb-object-store-3803cd296f83ecfa/inline0.js';
5
6
 
6
7
  /**
7
8
  * Main CereusDB instance for browser use.
@@ -110,6 +111,22 @@ export class CereusDB {
110
111
  throw takeFromExternrefTable0(ret[0]);
111
112
  }
112
113
  }
114
+ /**
115
+ * Register browser-backed object stores for ranged/listing reads.
116
+ * @param {any} config
117
+ */
118
+ register_object_stores(config) {
119
+ let ret;
120
+ __wbg_termination_guard();
121
+ try {
122
+ ret = wasm.cereusdb_register_object_stores(this.__wbg_ptr, config);;
123
+ } catch(e) {
124
+ __wbg_handle_catch(e);
125
+ }
126
+ if (ret[1]) {
127
+ throw takeFromExternrefTable0(ret[0]);
128
+ }
129
+ }
113
130
  /**
114
131
  * Register a Uint8Array containing Parquet data as a named table.
115
132
  * Use for files obtained via the browser File API.
@@ -131,6 +148,27 @@ export class CereusDB {
131
148
  }
132
149
  return ret;
133
150
  }
151
+ /**
152
+ * Register a remote Parquet object or prefix as a DataFusion listing table.
153
+ * @param {string} table_name
154
+ * @param {string} table_url
155
+ * @param {any} options
156
+ * @returns {Promise<void>}
157
+ */
158
+ register_parquet_table(table_name, table_url, options) {
159
+ const ptr0 = passStringToWasm0(table_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160
+ const len0 = WASM_VECTOR_LEN;
161
+ const ptr1 = passStringToWasm0(table_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
162
+ const len1 = WASM_VECTOR_LEN;
163
+ let ret;
164
+ __wbg_termination_guard();
165
+ try {
166
+ ret = wasm.cereusdb_register_parquet_table(this.__wbg_ptr, ptr0, len0, ptr1, len1, options);;
167
+ } catch(e) {
168
+ __wbg_handle_catch(e);
169
+ }
170
+ return ret;
171
+ }
134
172
  /**
135
173
  * Register a raster buffer as a single-column raster table.
136
174
  * Requires the full GDAL-enabled build.
@@ -309,6 +347,14 @@ const import44 = __wasi;
309
347
  function __wbg_get_imports() {
310
348
  const import0 = {
311
349
  __proto__: null,
350
+ __wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
351
+ const ret = Error(getStringFromWasm0(arg0, arg1));
352
+ return ret;
353
+ },
354
+ __wbg_Number_a5a435bd7bbec835: function(arg0) {
355
+ const ret = Number(arg0);
356
+ return ret;
357
+ },
312
358
  __wbg_String_8564e559799eccda: function(arg0, arg1) {
313
359
  const ret = String(arg1);
314
360
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -316,6 +362,17 @@ function __wbg_get_imports() {
316
362
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
317
363
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
318
364
  },
365
+ __wbg___wbindgen_bigint_get_as_i64_447a76b5c6ef7bda: function(arg0, arg1) {
366
+ const v = arg1;
367
+ const ret = typeof(v) === 'bigint' ? v : undefined;
368
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
369
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
370
+ },
371
+ __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
372
+ const v = arg0;
373
+ const ret = typeof(v) === 'boolean' ? v : undefined;
374
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
375
+ },
319
376
  __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
320
377
  const ret = debugString(arg1);
321
378
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -323,14 +380,57 @@ function __wbg_get_imports() {
323
380
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
324
381
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
325
382
  },
383
+ __wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
384
+ const ret = arg0 in arg1;
385
+ return ret;
386
+ },
387
+ __wbg___wbindgen_is_bigint_e2141d4f045b7eda: function(arg0) {
388
+ const ret = typeof(arg0) === 'bigint';
389
+ return ret;
390
+ },
326
391
  __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
327
392
  const ret = typeof(arg0) === 'function';
328
393
  return ret;
329
394
  },
395
+ __wbg___wbindgen_is_null_0b605fc6b167c56f: function(arg0) {
396
+ const ret = arg0 === null;
397
+ return ret;
398
+ },
399
+ __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
400
+ const val = arg0;
401
+ const ret = typeof(val) === 'object' && val !== null;
402
+ return ret;
403
+ },
404
+ __wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
405
+ const ret = typeof(arg0) === 'string';
406
+ return ret;
407
+ },
330
408
  __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
331
409
  const ret = arg0 === undefined;
332
410
  return ret;
333
411
  },
412
+ __wbg___wbindgen_jsval_eq_ee31bfad3e536463: function(arg0, arg1) {
413
+ const ret = arg0 === arg1;
414
+ return ret;
415
+ },
416
+ __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
417
+ const ret = arg0 == arg1;
418
+ return ret;
419
+ },
420
+ __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
421
+ const obj = arg1;
422
+ const ret = typeof(obj) === 'number' ? obj : undefined;
423
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
424
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
425
+ },
426
+ __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
427
+ const obj = arg1;
428
+ const ret = typeof(obj) === 'string' ? obj : undefined;
429
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
430
+ var len1 = WASM_VECTOR_LEN;
431
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
432
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
433
+ },
334
434
  __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
335
435
  throw new WebAssembly.Exception(__wbindgen_wrapped_jstag, [new Error(getStringFromWasm0(arg0, arg1))]);
336
436
  },
@@ -345,6 +445,25 @@ function __wbg_get_imports() {
345
445
  const ret = arg0.call(arg1, arg2);
346
446
  return ret;
347
447
  },
448
+ __wbg_call_e133b57c9155d22c: function(arg0, arg1) {
449
+ const ret = arg0.call(arg1);
450
+ return ret;
451
+ },
452
+ __wbg_cereusdbFetch_deb849058cc19990: function(arg0) {
453
+ const ret = cereusdbFetch(arg0);
454
+ return ret;
455
+ },
456
+ __wbg_cereusdbSetFetchConcurrency_fca2c11ec07fc658: function(arg0) {
457
+ cereusdbSetFetchConcurrency(arg0 >>> 0);
458
+ },
459
+ __wbg_done_08ce71ee07e3bd17: function(arg0) {
460
+ const ret = arg0.done;
461
+ return ret;
462
+ },
463
+ __wbg_entries_e8a20ff8c9757101: function(arg0) {
464
+ const ret = Object.entries(arg0);
465
+ return ret;
466
+ },
348
467
  __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
349
468
  let deferred0_0;
350
469
  let deferred0_1;
@@ -379,6 +498,42 @@ function __wbg_get_imports() {
379
498
  const ret = arg0.getTime();
380
499
  return ret;
381
500
  },
501
+ __wbg_get_326e41e095fb2575: function(arg0, arg1) {
502
+ const ret = Reflect.get(arg0, arg1);
503
+ return ret;
504
+ },
505
+ __wbg_get_a8ee5c45dabc1b3b: function(arg0, arg1) {
506
+ const ret = arg0[arg1 >>> 0];
507
+ return ret;
508
+ },
509
+ __wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
510
+ const ret = arg0[arg1 >>> 0];
511
+ return ret;
512
+ },
513
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
514
+ const ret = arg0[arg1];
515
+ return ret;
516
+ },
517
+ __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
518
+ let result;
519
+ try {
520
+ result = arg0 instanceof ArrayBuffer;
521
+ } catch (_) {
522
+ result = false;
523
+ }
524
+ const ret = result;
525
+ return ret;
526
+ },
527
+ __wbg_instanceof_Map_f194b366846aca0c: function(arg0) {
528
+ let result;
529
+ try {
530
+ result = arg0 instanceof Map;
531
+ } catch (_) {
532
+ result = false;
533
+ }
534
+ const ret = result;
535
+ return ret;
536
+ },
382
537
  __wbg_instanceof_Response_9b4d9fd451e051b1: function(arg0) {
383
538
  let result;
384
539
  try {
@@ -389,6 +544,16 @@ function __wbg_get_imports() {
389
544
  const ret = result;
390
545
  return ret;
391
546
  },
547
+ __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
548
+ let result;
549
+ try {
550
+ result = arg0 instanceof Uint8Array;
551
+ } catch (_) {
552
+ result = false;
553
+ }
554
+ const ret = result;
555
+ return ret;
556
+ },
392
557
  __wbg_instanceof_Window_23e677d2c6843922: function(arg0) {
393
558
  let result;
394
559
  try {
@@ -399,6 +564,22 @@ function __wbg_get_imports() {
399
564
  const ret = result;
400
565
  return ret;
401
566
  },
567
+ __wbg_isArray_33b91feb269ff46e: function(arg0) {
568
+ const ret = Array.isArray(arg0);
569
+ return ret;
570
+ },
571
+ __wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
572
+ const ret = Number.isSafeInteger(arg0);
573
+ return ret;
574
+ },
575
+ __wbg_iterator_d8f549ec8fb061b1: function() {
576
+ const ret = Symbol.iterator;
577
+ return ret;
578
+ },
579
+ __wbg_length_b3416cf66a5452c8: function(arg0) {
580
+ const ret = arg0.length;
581
+ return ret;
582
+ },
402
583
  __wbg_length_ea16607d7b61445b: function(arg0) {
403
584
  const ret = arg0.length;
404
585
  return ret;
@@ -433,7 +614,7 @@ function __wbg_get_imports() {
433
614
  const a = state0.a;
434
615
  state0.a = 0;
435
616
  try {
436
- return wasm_bindgen__convert__closures_____invoke__h3bcc27440de746c0(a, state0.b, arg0, arg1);
617
+ return wasm_bindgen__convert__closures_____invoke__h62da4917f540b667(a, state0.b, arg0, arg1);
437
618
  } finally {
438
619
  state0.a = a;
439
620
  }
@@ -452,6 +633,14 @@ function __wbg_get_imports() {
452
633
  const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
453
634
  return ret;
454
635
  },
636
+ __wbg_next_11b99ee6237339e3: function(arg0) {
637
+ const ret = arg0.next();
638
+ return ret;
639
+ },
640
+ __wbg_next_e01a967809d1aa68: function(arg0) {
641
+ const ret = arg0.next;
642
+ return ret;
643
+ },
455
644
  __wbg_now_e7c6795a7f81e10f: function(arg0) {
456
645
  const ret = arg0.now();
457
646
  return ret;
@@ -481,6 +670,9 @@ function __wbg_get_imports() {
481
670
  __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
482
671
  arg0[arg1 >>> 0] = arg2;
483
672
  },
673
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
674
+ arg0[arg1] = arg2;
675
+ },
484
676
  __wbg_set_8c0b3ffcf05d61c2: function(arg0, arg1, arg2) {
485
677
  arg0.set(getArrayU8FromWasm0(arg1, arg2));
486
678
  },
@@ -517,6 +709,10 @@ function __wbg_get_imports() {
517
709
  const ret = arg0.status;
518
710
  return ret;
519
711
  },
712
+ __wbg_stringify_5ae93966a84901ac: function(arg0) {
713
+ const ret = JSON.stringify(arg0);
714
+ return ret;
715
+ },
520
716
  __wbg_then_098abe61755d12f6: function(arg0, arg1) {
521
717
  const ret = arg0.then(arg1);
522
718
  return ret;
@@ -525,16 +721,35 @@ function __wbg_get_imports() {
525
721
  const ret = arg0.then(arg1, arg2);
526
722
  return ret;
527
723
  },
724
+ __wbg_value_21fc78aab0322612: function(arg0) {
725
+ const ret = arg0.value;
726
+ return ret;
727
+ },
528
728
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
529
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7156, function: Function { arguments: [Externref], shim_idx: 22227, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
530
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hcd35ec5c66a281ba, wasm_bindgen__convert__closures_____invoke__h7573a8a64f443504);
729
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 7576, function: Function { arguments: [Externref], shim_idx: 24828, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
730
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h2bfbe8d19302e783, wasm_bindgen__convert__closures_____invoke__h3c10a375d8fa7de6);
731
+ return ret;
732
+ },
733
+ __wbindgen_cast_0000000000000002: function(arg0) {
734
+ // Cast intrinsic for `F64 -> Externref`.
735
+ const ret = arg0;
531
736
  return ret;
532
737
  },
533
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
738
+ __wbindgen_cast_0000000000000003: function(arg0) {
739
+ // Cast intrinsic for `I64 -> Externref`.
740
+ const ret = arg0;
741
+ return ret;
742
+ },
743
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
534
744
  // Cast intrinsic for `Ref(String) -> Externref`.
535
745
  const ret = getStringFromWasm0(arg0, arg1);
536
746
  return ret;
537
747
  },
748
+ __wbindgen_cast_0000000000000005: function(arg0) {
749
+ // Cast intrinsic for `U64 -> Externref`.
750
+ const ret = BigInt.asUintN(64, arg0);
751
+ return ret;
752
+ },
538
753
  __wbindgen_init_externref_table: function() {
539
754
  const table = wasm.__wbindgen_externrefs;
540
755
  const offset = table.grow(4);
@@ -618,11 +833,11 @@ function __wbg_handle_catch(e) {
618
833
  getInt32ArrayMemory0()[__wbg_terminated_addr] = 1;
619
834
  throw e;
620
835
  }
621
- function wasm_bindgen__convert__closures_____invoke__h7573a8a64f443504(arg0, arg1, arg2) {
836
+ function wasm_bindgen__convert__closures_____invoke__h3c10a375d8fa7de6(arg0, arg1, arg2) {
622
837
  let ret;
623
838
  __wbg_termination_guard();
624
839
  try {
625
- ret = wasm.wasm_bindgen__convert__closures_____invoke__h7573a8a64f443504(arg0, arg1, arg2);;
840
+ ret = wasm.wasm_bindgen__convert__closures_____invoke__h3c10a375d8fa7de6(arg0, arg1, arg2);;
626
841
  } catch(e) {
627
842
  __wbg_handle_catch(e);
628
843
  }
@@ -631,10 +846,10 @@ function wasm_bindgen__convert__closures_____invoke__h7573a8a64f443504(arg0, arg
631
846
  }
632
847
  }
633
848
 
634
- function wasm_bindgen__convert__closures_____invoke__h3bcc27440de746c0(arg0, arg1, arg2, arg3) {
849
+ function wasm_bindgen__convert__closures_____invoke__h62da4917f540b667(arg0, arg1, arg2, arg3) {
635
850
  __wbg_termination_guard();
636
851
  try {
637
- wasm.wasm_bindgen__convert__closures_____invoke__h3bcc27440de746c0(arg0, arg1, arg2, arg3);
852
+ wasm.wasm_bindgen__convert__closures_____invoke__h62da4917f540b667(arg0, arg1, arg2, arg3);
638
853
  } catch(e) {
639
854
  __wbg_handle_catch(e);
640
855
  }
Binary file
@@ -14,7 +14,9 @@ export const cereusdb_create: () => [number, number, number];
14
14
  export const cereusdb_drop_table: (a: number, b: number, c: number) => [number, number];
15
15
  export const cereusdb_register_geojson: (a: number, b: number, c: number, d: number, e: number) => [number, number];
16
16
  export const cereusdb_register_geotiff_buffer: (a: number, b: number, c: number, d: number, e: number) => [number, number];
17
+ export const cereusdb_register_object_stores: (a: number, b: any) => [number, number];
17
18
  export const cereusdb_register_parquet_buffer: (a: number, b: number, c: number, d: number, e: number) => any;
19
+ export const cereusdb_register_parquet_table: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
18
20
  export const cereusdb_register_raster_buffer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
19
21
  export const cereusdb_register_remote_parquet: (a: number, b: number, c: number, d: number, e: number) => any;
20
22
  export const cereusdb_sql: (a: number, b: number, c: number) => any;
@@ -30,9 +32,9 @@ export const abort: () => void;
30
32
  export const emscripten_builtin_free: (a: number) => void;
31
33
  export const emscripten_builtin_malloc: (a: number) => number;
32
34
  export const __cpp_exception: WebAssembly.Tag;
33
- export const wasm_bindgen__closure__destroy__hcd35ec5c66a281ba: (a: number, b: number) => void;
34
- export const wasm_bindgen__convert__closures_____invoke__h7573a8a64f443504: (a: number, b: number, c: any) => [number, number];
35
- export const wasm_bindgen__convert__closures_____invoke__h3bcc27440de746c0: (a: number, b: number, c: any, d: any) => void;
35
+ export const wasm_bindgen__closure__destroy__h2bfbe8d19302e783: (a: number, b: number) => void;
36
+ export const wasm_bindgen__convert__closures_____invoke__h3c10a375d8fa7de6: (a: number, b: number, c: any) => [number, number];
37
+ export const wasm_bindgen__convert__closures_____invoke__h62da4917f540b667: (a: number, b: number, c: any, d: any) => void;
36
38
  export const __wbindgen_malloc: (a: number, b: number) => number;
37
39
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
38
40
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
@@ -0,0 +1,61 @@
1
+
2
+ let cereusdbFetchMaxConcurrency = 16;
3
+ let cereusdbFetchActive = 0;
4
+ const cereusdbFetchQueue = [];
5
+
6
+ function cereusdbPumpFetchQueue() {
7
+ while (cereusdbFetchActive < cereusdbFetchMaxConcurrency && cereusdbFetchQueue.length > 0) {
8
+ const task = cereusdbFetchQueue.shift();
9
+ cereusdbFetchActive += 1;
10
+ cereusdbExecuteFetch(task.request)
11
+ .then(task.resolve, task.reject)
12
+ .finally(() => {
13
+ cereusdbFetchActive -= 1;
14
+ cereusdbPumpFetchQueue();
15
+ });
16
+ }
17
+ }
18
+
19
+ async function cereusdbExecuteFetch(request) {
20
+ const headers = new Headers();
21
+ for (const [name, value] of request.headers) {
22
+ headers.append(name, value);
23
+ }
24
+
25
+ const init = {
26
+ method: request.method,
27
+ headers,
28
+ };
29
+
30
+ if (request.body !== undefined && request.body !== null) {
31
+ init.body = request.body;
32
+ }
33
+
34
+ const response = await fetch(request.url, init);
35
+ const responseHeaders = [];
36
+ response.headers.forEach((value, name) => {
37
+ responseHeaders.push([name, value]);
38
+ });
39
+
40
+ return {
41
+ status: response.status,
42
+ statusText: response.statusText,
43
+ headers: responseHeaders,
44
+ body: new Uint8Array(await response.arrayBuffer()),
45
+ };
46
+ }
47
+
48
+ export function cereusdbSetFetchConcurrency(maxConcurrency) {
49
+ const parsed = Number(maxConcurrency);
50
+ if (Number.isFinite(parsed) && parsed >= 1) {
51
+ cereusdbFetchMaxConcurrency = Math.min(Math.trunc(parsed), 256);
52
+ cereusdbPumpFetchQueue();
53
+ }
54
+ }
55
+
56
+ export function cereusdbFetch(request) {
57
+ return new Promise((resolve, reject) => {
58
+ cereusdbFetchQueue.push({ request, resolve, reject });
59
+ cereusdbPumpFetchQueue();
60
+ });
61
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cereusdb/standard",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Standard CereusDB browser package with GEOS and PROJ support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",