@qaecy/cue-sdk 0.0.13 → 0.0.16
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 +151 -0
- package/assets/wasm/dir_scanner_wasm.js +461 -0
- package/assets/wasm/dir_scanner_wasm_bg.wasm +0 -0
- package/cue-DiFnK22Q.js +8564 -0
- package/index.d.ts +4 -0
- package/index.js +17 -15
- package/lib/api.d.ts +22 -1
- package/lib/cue.d.ts +14 -0
- package/lib/documents.d.ts +8 -2
- package/lib/entities.d.ts +37 -1
- package/lib/gis.d.ts +89 -0
- package/lib/models.d.ts +44 -0
- package/lib/project-view.d.ts +5 -0
- package/lib/schema.d.ts +6 -1
- package/lib/tables.d.ts +14 -0
- package/node.js +20 -18
- package/package.json +1 -1
- package/variables.d.ts +2 -0
- package/cue-wp0EyOko.js +0 -3614
package/README.md
CHANGED
|
@@ -155,6 +155,17 @@ const data = await cue.api.sparql(
|
|
|
155
155
|
);
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
+
### `cue.api.language` / `cue.api.setLanguage(lang)`
|
|
159
|
+
|
|
160
|
+
Active language used for language-sensitive SPARQL label queries (e.g. schema category labels and document text fields). Defaults to `'en'`. All project classes (`CueProjectSchema`, `CueProjectDocuments`, `CueProjectEntities`) read this shared value at query time.
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
cue.api.setLanguage('da');
|
|
164
|
+
console.log(cue.api.language); // 'da'
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
When using `CueProjectView`, prefer calling `view.setLanguage(lang)` — it updates `api.language` **and** reloads language-sensitive cached data (schema labels, document subjects/summaries) for the new language.
|
|
168
|
+
|
|
158
169
|
## Projects
|
|
159
170
|
|
|
160
171
|
Manage Cue projects via `cue.api.projects` (`CueProjects`).
|
|
@@ -188,6 +199,34 @@ const project = await cue.api.projects.createProject({
|
|
|
188
199
|
});
|
|
189
200
|
```
|
|
190
201
|
|
|
202
|
+
## Entities
|
|
203
|
+
|
|
204
|
+
Entity data for a project is accessed via a `CueProjectView`. Create a view with `cue.createProjectView(projectId)` and use `view.entities` (`CueProjectEntities`) for all entity-level operations.
|
|
205
|
+
|
|
206
|
+
### `view.entities.buildSummaryGraph(format?)`
|
|
207
|
+
|
|
208
|
+
Fetches a project-level summary of entity category relationships: how many times entities of one category point to entities of another via each predicate, ordered by descending occurrence count.
|
|
209
|
+
|
|
210
|
+
| Parameter | Type | Description |
|
|
211
|
+
|---|---|---|
|
|
212
|
+
| `format` | `'graph'` \| `'md'` \| `undefined` | `'graph'` returns structured nodes + edges (`SummaryGraphData`); `'md'` returns a compact aligned text table; omit for the raw SPARQL JSON result |
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
// Structured graph — nodes and edges separated
|
|
216
|
+
const g = await view.entities.buildSummaryGraph('graph');
|
|
217
|
+
// g.entities → [{ iri: 'https://…FloorPlanDrawing' }, …]
|
|
218
|
+
// g.relations → [{ sourceID, predicate, targetID, weight }, …]
|
|
219
|
+
|
|
220
|
+
// Compact markdown table
|
|
221
|
+
const md = await view.entities.buildSummaryGraph('md');
|
|
222
|
+
// qcy:FloorPlanDrawing -> qcy:includesBuildingEntity -> qcy:BuildingZone (5652)
|
|
223
|
+
// qcy:Activity -> qcy:involvesBuildingEntity -> qcy:BuildingElement (4003)
|
|
224
|
+
// qcy:BuildingElement -> qcy:elementHasMaterial -> qcy:Material (3551)
|
|
225
|
+
|
|
226
|
+
// Raw SPARQL JSON result
|
|
227
|
+
const raw = await view.entities.buildSummaryGraph();
|
|
228
|
+
```
|
|
229
|
+
|
|
191
230
|
## Node.js — file sync
|
|
192
231
|
|
|
193
232
|
For server-side or CLI use with file-sync capabilities, import from `@qaecy/cue-sdk/node`:
|
|
@@ -237,6 +276,118 @@ Returns a `SyncResult`:
|
|
|
237
276
|
| `totalSize` | `number` | Total size across all files |
|
|
238
277
|
| `rdfWritten` | `boolean` | Whether any RDF metadata was written |
|
|
239
278
|
|
|
279
|
+
## GIS
|
|
280
|
+
|
|
281
|
+
Reactive GIS service for querying spatial features within a map viewport. Accessed via the lazy getter `cue.gis` — the `CueGis` instance is created on first access and reused for the lifetime of the `Cue` object.
|
|
282
|
+
|
|
283
|
+
The `js/cue-gis` library (gateway routing, adapters, OpenStreetMap, Matrikel, etc.) is **bundled inside the SDK** — no extra install needed.
|
|
284
|
+
|
|
285
|
+
### Quick example
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
const gis = cue.gis;
|
|
289
|
+
|
|
290
|
+
// Set the active project (drives the Cue-authenticated data source)
|
|
291
|
+
gis.setProjectId('my-project-id');
|
|
292
|
+
|
|
293
|
+
// Subscribe to results
|
|
294
|
+
const unsubCats = gis.onAvailableCategories((cats) => {
|
|
295
|
+
console.log('Available categories:', cats.map(c => c.label));
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
const unsubFeatures = gis.onFeaturesChange((featuresMap) => {
|
|
299
|
+
for (const [category, features] of featuresMap) {
|
|
300
|
+
console.log(`${category}: ${features.length} features`);
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
gis.onLoadingChange((loading) => console.log('Loading:', loading));
|
|
305
|
+
|
|
306
|
+
// On every map pan/zoom (e.g. from a Mapbox moveend event):
|
|
307
|
+
map.on('moveend', () => {
|
|
308
|
+
const b = map.getBounds();
|
|
309
|
+
gis.setBbox([b.getWest(), b.getSouth(), b.getEast(), b.getNorth()]);
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
// When the user toggles a category:
|
|
313
|
+
gis.setSelectedCategories(new Set(['cadastre', 'building']));
|
|
314
|
+
|
|
315
|
+
// Cleanup (e.g. on sign-out or component destroy):
|
|
316
|
+
unsubCats();
|
|
317
|
+
unsubFeatures();
|
|
318
|
+
gis.destroy();
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### `cue.gis.setProjectId(projectId)`
|
|
322
|
+
|
|
323
|
+
Set the active project. Triggers a new query when a bbox is set. Pass `null` to clear.
|
|
324
|
+
|
|
325
|
+
```typescript
|
|
326
|
+
cue.gis.setProjectId('my-project-id');
|
|
327
|
+
cue.gis.setProjectId(null); // clear
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### `cue.gis.setBbox(bbox)`
|
|
331
|
+
|
|
332
|
+
Set the current map viewport as `[west, south, east, north]` (WGS-84). Triggers a debounced query (1.5 s) to list available categories and reload selected features.
|
|
333
|
+
|
|
334
|
+
```typescript
|
|
335
|
+
cue.gis.setBbox([8.5, 47.3, 8.6, 47.4]);
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### `cue.gis.setSelectedCategories(categories)`
|
|
339
|
+
|
|
340
|
+
Replace the full set of selected categories. Features for newly selected categories are fetched immediately; deselected ones are dropped from the results.
|
|
341
|
+
|
|
342
|
+
```typescript
|
|
343
|
+
cue.gis.setSelectedCategories(new Set(['cadastre', 'building', 'greenspace']));
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### `cue.gis.onAvailableCategories(callback)` → unsubscribe
|
|
347
|
+
|
|
348
|
+
Subscribe to the list of feature-category descriptors available in the current viewport. Replays the current value immediately.
|
|
349
|
+
|
|
350
|
+
```typescript
|
|
351
|
+
const unsub = cue.gis.onAvailableCategories((cats) => {
|
|
352
|
+
// cats: GisCategoryDescriptor[]
|
|
353
|
+
renderCategoryPanel(cats);
|
|
354
|
+
});
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### `cue.gis.onFeaturesChange(callback)` → unsubscribe
|
|
358
|
+
|
|
359
|
+
Subscribe to the live feature map (category → features). Replays the current value immediately.
|
|
360
|
+
|
|
361
|
+
```typescript
|
|
362
|
+
const unsub = cue.gis.onFeaturesChange((map) => {
|
|
363
|
+
// map: Map<FeatureCategory, GisFeature[]>
|
|
364
|
+
for (const [cat, features] of map) renderLayer(cat, features);
|
|
365
|
+
});
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### `cue.gis.onLoadingChange(callback)` → unsubscribe
|
|
369
|
+
|
|
370
|
+
Subscribe to the global loading state. `true` while any query is in flight.
|
|
371
|
+
|
|
372
|
+
```typescript
|
|
373
|
+
const unsub = cue.gis.onLoadingChange((loading) => showSpinner(loading));
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### `cue.gis.destroy()`
|
|
377
|
+
|
|
378
|
+
Cancel all in-flight requests, clear all listeners, and reset internal state. Call on sign-out or component teardown.
|
|
379
|
+
|
|
380
|
+
### Types
|
|
381
|
+
|
|
382
|
+
| Type | Description |
|
|
383
|
+
|---|---|
|
|
384
|
+
| `GisBBox` | `[west, south, east, north]` — WGS-84 decimal degrees |
|
|
385
|
+
| `FeatureCategory` | `'address' \| 'poi' \| 'railway' \| 'natural' \| 'manmade' \| 'cadastre' \| 'building' \| 'greenspace' \| 'paved' \| 'zone'` |
|
|
386
|
+
| `GisCategoryDescriptor` | `{ category, label, description, preferredColor }` |
|
|
387
|
+
| `GisFeature` | Full feature record with geometry, properties, tier, source info |
|
|
388
|
+
| `GisFeaturesMap` | `Map<FeatureCategory, GisFeature[]>` |
|
|
389
|
+
| `CueGis` | The class exposed via `cue.gis` |
|
|
390
|
+
|
|
240
391
|
## Advanced
|
|
241
392
|
|
|
242
393
|
Access the raw Firebase `Auth` instance for advanced use cases:
|
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
/* @ts-self-types="./dir_scanner_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Attempts to extract the unit count from any supported file and returns a plain JS
|
|
5
|
+
* object `{ units: number, error: string | null }`.
|
|
6
|
+
*
|
|
7
|
+
* `original_path` is used only for extension detection.
|
|
8
|
+
*
|
|
9
|
+
* ```js
|
|
10
|
+
* const buf = await file.arrayBuffer();
|
|
11
|
+
* const result = debug_file(file.name, new Uint8Array(buf));
|
|
12
|
+
* console.log(result); // { units: 12, error: null }
|
|
13
|
+
* ```
|
|
14
|
+
* @param {string} original_path
|
|
15
|
+
* @param {Uint8Array} data
|
|
16
|
+
* @returns {any}
|
|
17
|
+
*/
|
|
18
|
+
export function debug_file(original_path, data) {
|
|
19
|
+
const ptr0 = passStringToWasm0(original_path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
20
|
+
const len0 = WASM_VECTOR_LEN;
|
|
21
|
+
const ret = wasm.debug_file(ptr0, len0, data);
|
|
22
|
+
return ret;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Scans a list of in-memory files and returns per-extension metrics sorted by
|
|
27
|
+
* file count descending.
|
|
28
|
+
*
|
|
29
|
+
* Each element of `files` must be a plain JS object with:
|
|
30
|
+
* - `originalPath` (string) — used for extension detection
|
|
31
|
+
* - `data` (Uint8Array | ArrayBuffer) — raw file bytes
|
|
32
|
+
*
|
|
33
|
+
* Returns a JS array of metric objects, or throws on invalid input.
|
|
34
|
+
*
|
|
35
|
+
* # Example (JavaScript)
|
|
36
|
+
* ```js
|
|
37
|
+
* import init, { scan } from './pkg/dir_scanner_wasm.js';
|
|
38
|
+
* await init();
|
|
39
|
+
*
|
|
40
|
+
* const response = await fetch('/docs/report.pdf');
|
|
41
|
+
* const data = new Uint8Array(await response.arrayBuffer());
|
|
42
|
+
*
|
|
43
|
+
* const metrics = scan([{ originalPath: 'report.pdf', data }]);
|
|
44
|
+
* console.log(metrics);
|
|
45
|
+
* // [{ ext: 'pdf', count: 1, percentOfFiltered: 100, percentOfAll: 100, units: 5, sizeMb: 0.12 }]
|
|
46
|
+
* ```
|
|
47
|
+
* @param {Array<any>} files
|
|
48
|
+
* @returns {any}
|
|
49
|
+
*/
|
|
50
|
+
export function scan(files) {
|
|
51
|
+
const ret = wasm.scan(files);
|
|
52
|
+
if (ret[2]) {
|
|
53
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
54
|
+
}
|
|
55
|
+
return takeFromExternrefTable0(ret[0]);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Returns a plain JS object mapping each file's original path to its unit count.
|
|
60
|
+
*
|
|
61
|
+
* Accepts the same `files` array as [`scan`].
|
|
62
|
+
*
|
|
63
|
+
* # Example (JavaScript)
|
|
64
|
+
* ```js
|
|
65
|
+
* const fileMap = scan_file_map(files);
|
|
66
|
+
* // { "docs/report.pdf": 5, "slides/deck.pptx": 12 }
|
|
67
|
+
* ```
|
|
68
|
+
* @param {Array<any>} files
|
|
69
|
+
* @returns {any}
|
|
70
|
+
*/
|
|
71
|
+
export function scan_file_map(files) {
|
|
72
|
+
const ret = wasm.scan_file_map(files);
|
|
73
|
+
if (ret[2]) {
|
|
74
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
75
|
+
}
|
|
76
|
+
return takeFromExternrefTable0(ret[0]);
|
|
77
|
+
}
|
|
78
|
+
function __wbg_get_imports() {
|
|
79
|
+
const import0 = {
|
|
80
|
+
__proto__: null,
|
|
81
|
+
__wbg_Error_960c155d3d49e4c2: function(arg0, arg1) {
|
|
82
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
83
|
+
return ret;
|
|
84
|
+
},
|
|
85
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
86
|
+
const ret = String(arg1);
|
|
87
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
88
|
+
const len1 = WASM_VECTOR_LEN;
|
|
89
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
90
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
91
|
+
},
|
|
92
|
+
__wbg___wbindgen_debug_string_ab4b34d23d6778bd: function(arg0, arg1) {
|
|
93
|
+
const ret = debugString(arg1);
|
|
94
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
95
|
+
const len1 = WASM_VECTOR_LEN;
|
|
96
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
97
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
98
|
+
},
|
|
99
|
+
__wbg___wbindgen_string_get_7ed5322991caaec5: function(arg0, arg1) {
|
|
100
|
+
const obj = arg1;
|
|
101
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
102
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
103
|
+
var len1 = WASM_VECTOR_LEN;
|
|
104
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
105
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
106
|
+
},
|
|
107
|
+
__wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
|
|
108
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
109
|
+
},
|
|
110
|
+
__wbg_get_6011fa3a58f61074: function() { return handleError(function (arg0, arg1) {
|
|
111
|
+
const ret = Reflect.get(arg0, arg1);
|
|
112
|
+
return ret;
|
|
113
|
+
}, arguments); },
|
|
114
|
+
__wbg_get_unchecked_17f53dad852b9588: function(arg0, arg1) {
|
|
115
|
+
const ret = arg0[arg1 >>> 0];
|
|
116
|
+
return ret;
|
|
117
|
+
},
|
|
118
|
+
__wbg_length_3d4ecd04bd8d22f1: function(arg0) {
|
|
119
|
+
const ret = arg0.length;
|
|
120
|
+
return ret;
|
|
121
|
+
},
|
|
122
|
+
__wbg_length_9f1775224cf1d815: function(arg0) {
|
|
123
|
+
const ret = arg0.length;
|
|
124
|
+
return ret;
|
|
125
|
+
},
|
|
126
|
+
__wbg_log_7e1aa9064a1dbdbd: function(arg0) {
|
|
127
|
+
console.log(arg0);
|
|
128
|
+
},
|
|
129
|
+
__wbg_new_0c7403db6e782f19: function(arg0) {
|
|
130
|
+
const ret = new Uint8Array(arg0);
|
|
131
|
+
return ret;
|
|
132
|
+
},
|
|
133
|
+
__wbg_new_682678e2f47e32bc: function() {
|
|
134
|
+
const ret = new Array();
|
|
135
|
+
return ret;
|
|
136
|
+
},
|
|
137
|
+
__wbg_new_aa8d0fa9762c29bd: function() {
|
|
138
|
+
const ret = new Object();
|
|
139
|
+
return ret;
|
|
140
|
+
},
|
|
141
|
+
__wbg_prototypesetcall_a6b02eb00b0f4ce2: function(arg0, arg1, arg2) {
|
|
142
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
143
|
+
},
|
|
144
|
+
__wbg_set_022bee52d0b05b19: function() { return handleError(function (arg0, arg1, arg2) {
|
|
145
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
146
|
+
return ret;
|
|
147
|
+
}, arguments); },
|
|
148
|
+
__wbg_set_3bf1de9fab0cd644: function(arg0, arg1, arg2) {
|
|
149
|
+
arg0[arg1 >>> 0] = arg2;
|
|
150
|
+
},
|
|
151
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
152
|
+
arg0[arg1] = arg2;
|
|
153
|
+
},
|
|
154
|
+
__wbg_warn_3cc416af27dbdc02: function(arg0) {
|
|
155
|
+
console.warn(arg0);
|
|
156
|
+
},
|
|
157
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
158
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
159
|
+
const ret = arg0;
|
|
160
|
+
return ret;
|
|
161
|
+
},
|
|
162
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
163
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
164
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
165
|
+
return ret;
|
|
166
|
+
},
|
|
167
|
+
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
168
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
169
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
170
|
+
return ret;
|
|
171
|
+
},
|
|
172
|
+
__wbindgen_init_externref_table: function() {
|
|
173
|
+
const table = wasm.__wbindgen_externrefs;
|
|
174
|
+
const offset = table.grow(4);
|
|
175
|
+
table.set(0, undefined);
|
|
176
|
+
table.set(offset + 0, undefined);
|
|
177
|
+
table.set(offset + 1, null);
|
|
178
|
+
table.set(offset + 2, true);
|
|
179
|
+
table.set(offset + 3, false);
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
return {
|
|
183
|
+
__proto__: null,
|
|
184
|
+
"./dir_scanner_wasm_bg.js": import0,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function addToExternrefTable0(obj) {
|
|
189
|
+
const idx = wasm.__externref_table_alloc();
|
|
190
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
191
|
+
return idx;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function debugString(val) {
|
|
195
|
+
// primitive types
|
|
196
|
+
const type = typeof val;
|
|
197
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
198
|
+
return `${val}`;
|
|
199
|
+
}
|
|
200
|
+
if (type == 'string') {
|
|
201
|
+
return `"${val}"`;
|
|
202
|
+
}
|
|
203
|
+
if (type == 'symbol') {
|
|
204
|
+
const description = val.description;
|
|
205
|
+
if (description == null) {
|
|
206
|
+
return 'Symbol';
|
|
207
|
+
} else {
|
|
208
|
+
return `Symbol(${description})`;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (type == 'function') {
|
|
212
|
+
const name = val.name;
|
|
213
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
214
|
+
return `Function(${name})`;
|
|
215
|
+
} else {
|
|
216
|
+
return 'Function';
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// objects
|
|
220
|
+
if (Array.isArray(val)) {
|
|
221
|
+
const length = val.length;
|
|
222
|
+
let debug = '[';
|
|
223
|
+
if (length > 0) {
|
|
224
|
+
debug += debugString(val[0]);
|
|
225
|
+
}
|
|
226
|
+
for(let i = 1; i < length; i++) {
|
|
227
|
+
debug += ', ' + debugString(val[i]);
|
|
228
|
+
}
|
|
229
|
+
debug += ']';
|
|
230
|
+
return debug;
|
|
231
|
+
}
|
|
232
|
+
// Test for built-in
|
|
233
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
234
|
+
let className;
|
|
235
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
236
|
+
className = builtInMatches[1];
|
|
237
|
+
} else {
|
|
238
|
+
// Failed to match the standard '[object ClassName]'
|
|
239
|
+
return toString.call(val);
|
|
240
|
+
}
|
|
241
|
+
if (className == 'Object') {
|
|
242
|
+
// we're a user defined class or Object
|
|
243
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
244
|
+
// easier than looping through ownProperties of `val`.
|
|
245
|
+
try {
|
|
246
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
247
|
+
} catch (_) {
|
|
248
|
+
return 'Object';
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// errors
|
|
252
|
+
if (val instanceof Error) {
|
|
253
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
254
|
+
}
|
|
255
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
256
|
+
return className;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
260
|
+
ptr = ptr >>> 0;
|
|
261
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
let cachedDataViewMemory0 = null;
|
|
265
|
+
function getDataViewMemory0() {
|
|
266
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
267
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
268
|
+
}
|
|
269
|
+
return cachedDataViewMemory0;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function getStringFromWasm0(ptr, len) {
|
|
273
|
+
ptr = ptr >>> 0;
|
|
274
|
+
return decodeText(ptr, len);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
let cachedUint8ArrayMemory0 = null;
|
|
278
|
+
function getUint8ArrayMemory0() {
|
|
279
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
280
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
281
|
+
}
|
|
282
|
+
return cachedUint8ArrayMemory0;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function handleError(f, args) {
|
|
286
|
+
try {
|
|
287
|
+
return f.apply(this, args);
|
|
288
|
+
} catch (e) {
|
|
289
|
+
const idx = addToExternrefTable0(e);
|
|
290
|
+
wasm.__wbindgen_exn_store(idx);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function isLikeNone(x) {
|
|
295
|
+
return x === undefined || x === null;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
299
|
+
if (realloc === undefined) {
|
|
300
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
301
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
302
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
303
|
+
WASM_VECTOR_LEN = buf.length;
|
|
304
|
+
return ptr;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
let len = arg.length;
|
|
308
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
309
|
+
|
|
310
|
+
const mem = getUint8ArrayMemory0();
|
|
311
|
+
|
|
312
|
+
let offset = 0;
|
|
313
|
+
|
|
314
|
+
for (; offset < len; offset++) {
|
|
315
|
+
const code = arg.charCodeAt(offset);
|
|
316
|
+
if (code > 0x7F) break;
|
|
317
|
+
mem[ptr + offset] = code;
|
|
318
|
+
}
|
|
319
|
+
if (offset !== len) {
|
|
320
|
+
if (offset !== 0) {
|
|
321
|
+
arg = arg.slice(offset);
|
|
322
|
+
}
|
|
323
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
324
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
325
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
326
|
+
|
|
327
|
+
offset += ret.written;
|
|
328
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
WASM_VECTOR_LEN = offset;
|
|
332
|
+
return ptr;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function takeFromExternrefTable0(idx) {
|
|
336
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
337
|
+
wasm.__externref_table_dealloc(idx);
|
|
338
|
+
return value;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
342
|
+
cachedTextDecoder.decode();
|
|
343
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
344
|
+
let numBytesDecoded = 0;
|
|
345
|
+
function decodeText(ptr, len) {
|
|
346
|
+
numBytesDecoded += len;
|
|
347
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
348
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
349
|
+
cachedTextDecoder.decode();
|
|
350
|
+
numBytesDecoded = len;
|
|
351
|
+
}
|
|
352
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
const cachedTextEncoder = new TextEncoder();
|
|
356
|
+
|
|
357
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
358
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
359
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
360
|
+
view.set(buf);
|
|
361
|
+
return {
|
|
362
|
+
read: arg.length,
|
|
363
|
+
written: buf.length
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
let WASM_VECTOR_LEN = 0;
|
|
369
|
+
|
|
370
|
+
let wasmModule, wasm;
|
|
371
|
+
function __wbg_finalize_init(instance, module) {
|
|
372
|
+
wasm = instance.exports;
|
|
373
|
+
wasmModule = module;
|
|
374
|
+
cachedDataViewMemory0 = null;
|
|
375
|
+
cachedUint8ArrayMemory0 = null;
|
|
376
|
+
wasm.__wbindgen_start();
|
|
377
|
+
return wasm;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
async function __wbg_load(module, imports) {
|
|
381
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
382
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
383
|
+
try {
|
|
384
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
385
|
+
} catch (e) {
|
|
386
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
387
|
+
|
|
388
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
389
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
390
|
+
|
|
391
|
+
} else { throw e; }
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
const bytes = await module.arrayBuffer();
|
|
396
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
397
|
+
} else {
|
|
398
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
399
|
+
|
|
400
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
401
|
+
return { instance, module };
|
|
402
|
+
} else {
|
|
403
|
+
return instance;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
function expectedResponseType(type) {
|
|
408
|
+
switch (type) {
|
|
409
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
410
|
+
}
|
|
411
|
+
return false;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function initSync(module) {
|
|
416
|
+
if (wasm !== undefined) return wasm;
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
if (module !== undefined) {
|
|
420
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
421
|
+
({module} = module)
|
|
422
|
+
} else {
|
|
423
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
const imports = __wbg_get_imports();
|
|
428
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
429
|
+
module = new WebAssembly.Module(module);
|
|
430
|
+
}
|
|
431
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
432
|
+
return __wbg_finalize_init(instance, module);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
async function __wbg_init(module_or_path) {
|
|
436
|
+
if (wasm !== undefined) return wasm;
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
if (module_or_path !== undefined) {
|
|
440
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
441
|
+
({module_or_path} = module_or_path)
|
|
442
|
+
} else {
|
|
443
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
if (module_or_path === undefined) {
|
|
448
|
+
module_or_path = new URL('dir_scanner_wasm_bg.wasm', import.meta.url);
|
|
449
|
+
}
|
|
450
|
+
const imports = __wbg_get_imports();
|
|
451
|
+
|
|
452
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
453
|
+
module_or_path = fetch(module_or_path);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
457
|
+
|
|
458
|
+
return __wbg_finalize_init(instance, module);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|