@casoon/opengrid 0.1.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/CHANGELOG.md +256 -0
- package/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +123 -0
- package/engine/opengrid_wasm.d.ts +130 -0
- package/engine/opengrid_wasm.js +455 -0
- package/engine/opengrid_wasm_bg.wasm +0 -0
- package/engine/opengrid_wasm_bg.wasm.d.ts +19 -0
- package/loader.d.ts +683 -0
- package/loader.js +1000 -0
- package/package.json +58 -0
- package/pkg/opengrid_web_components.d.ts +222 -0
- package/pkg/opengrid_web_components.js +1248 -0
- package/pkg/opengrid_web_components_bg.wasm +0 -0
- package/pkg/opengrid_web_components_bg.wasm.d.ts +31 -0
- package/pkg/snippets/opengrid-web-core-e0ef3c8948ce8a1e/inline0.js +22 -0
- package/pkg/snippets/opengrid-web-core-e0ef3c8948ce8a1e/inline1.js +25 -0
- package/worker.js +59 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The engine the browser talks to: a set of in-memory sources.
|
|
6
|
+
*
|
|
7
|
+
* One instance holds one [`LocalDataSource`] per name
|
|
8
|
+
* (plan/spezifikation/03-datasource.md). The demo registers `orders` and runs
|
|
9
|
+
* the example query of `spezifikation/02-query-modell.md` against it.
|
|
10
|
+
*/
|
|
11
|
+
export class Engine {
|
|
12
|
+
free(): void;
|
|
13
|
+
[Symbol.dispose](): void;
|
|
14
|
+
/**
|
|
15
|
+
* Runs a query JSON and answers with the result JSON.
|
|
16
|
+
*
|
|
17
|
+
* The result is the wire shape of a [`QueryResult`]: `total_count` for the
|
|
18
|
+
* number before paging, `row_count` for this page, and one
|
|
19
|
+
* `{ "name", "values" }` object per output column, in schema order.
|
|
20
|
+
*/
|
|
21
|
+
execute(query_json: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Reads CSV bytes against an explicit schema and registers the source.
|
|
24
|
+
*
|
|
25
|
+
* The schema is required — ingest never guesses types, and an inferred
|
|
26
|
+
* proposal is a suggestion a UI may show
|
|
27
|
+
* (plan/spezifikation/04-local-engine.md §Ingest).
|
|
28
|
+
*/
|
|
29
|
+
load_csv(name: string, bytes: Uint8Array, schema_json: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* An engine without data. `load_csv` adds sources.
|
|
32
|
+
*/
|
|
33
|
+
constructor();
|
|
34
|
+
/**
|
|
35
|
+
* The names of the registered sources, in unspecified order.
|
|
36
|
+
*/
|
|
37
|
+
source_names(): string[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The planner in the browser: who answers which half of a query (point 28).
|
|
42
|
+
*
|
|
43
|
+
* The page holds a remote source it cannot change and an engine it can. This
|
|
44
|
+
* object decides between them and does the local half:
|
|
45
|
+
*
|
|
46
|
+
* 1. [`plan`](Planner::plan) turns a query into the query for the source, the
|
|
47
|
+
* query for the client, and a sentence describing the split.
|
|
48
|
+
* 2. The page sends the source query wherever it goes and gets an answer back.
|
|
49
|
+
* 3. [`finish`](Planner::finish) runs the client query over that answer.
|
|
50
|
+
*
|
|
51
|
+
* It holds no state between the two calls on purpose: the plan travels as JSON
|
|
52
|
+
* through the page, which is also what makes it readable from outside
|
|
53
|
+
* (plan/spezifikation/05-planner.md: "Offengelegt für Debugging").
|
|
54
|
+
*/
|
|
55
|
+
export class Planner {
|
|
56
|
+
free(): void;
|
|
57
|
+
[Symbol.dispose](): void;
|
|
58
|
+
/**
|
|
59
|
+
* Runs `client_query_json` over `result_json` — the source's answer.
|
|
60
|
+
*
|
|
61
|
+
* This is the hybrid return path E14 names: the partial result becomes
|
|
62
|
+
* Arrow batches again and the engine finishes the query over them, which
|
|
63
|
+
* includes recounting `total_count` — filtering or grouping changed it.
|
|
64
|
+
*/
|
|
65
|
+
finish(client_query_json: string, result_json: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* A planner for a source with `schema_json` and `capabilities_json`, in
|
|
68
|
+
* `mode` (`local`, `remote`, `hybrid` or `auto`).
|
|
69
|
+
*
|
|
70
|
+
* Both JSON documents are what `GET /source/{name}` answers, so a page can
|
|
71
|
+
* hand them straight through without knowing their shape.
|
|
72
|
+
*/
|
|
73
|
+
constructor(schema_json: string, capabilities_json: string, mode: string);
|
|
74
|
+
/**
|
|
75
|
+
* Splits `query_json`, answering the plan as JSON.
|
|
76
|
+
*
|
|
77
|
+
* `mode` overrides the planner's own mode when it is not empty — that is
|
|
78
|
+
* how the element's `mode` attribute reaches the planner without rebuilding
|
|
79
|
+
* it on every attribute change.
|
|
80
|
+
*
|
|
81
|
+
* The answer is `{ mode, describe, steps, source, client }`: `source` is the
|
|
82
|
+
* query to send on, `client` the query to hand back to
|
|
83
|
+
* [`finish`](Planner::finish), or `null` when the source answers it all.
|
|
84
|
+
*/
|
|
85
|
+
plan(query_json: string, mode: string): string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
89
|
+
|
|
90
|
+
export interface InitOutput {
|
|
91
|
+
readonly memory: WebAssembly.Memory;
|
|
92
|
+
readonly __wbg_engine_free: (a: number, b: number) => void;
|
|
93
|
+
readonly __wbg_planner_free: (a: number, b: number) => void;
|
|
94
|
+
readonly engine_execute: (a: number, b: number, c: number) => [number, number, number, number];
|
|
95
|
+
readonly engine_load_csv: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
96
|
+
readonly engine_new: () => number;
|
|
97
|
+
readonly engine_source_names: (a: number) => [number, number];
|
|
98
|
+
readonly planner_finish: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
99
|
+
readonly planner_new: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
100
|
+
readonly planner_plan: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
101
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
102
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
103
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
104
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
105
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
106
|
+
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
107
|
+
readonly __wbindgen_start: () => void;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
114
|
+
* a precompiled `WebAssembly.Module`.
|
|
115
|
+
*
|
|
116
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
117
|
+
*
|
|
118
|
+
* @returns {InitOutput}
|
|
119
|
+
*/
|
|
120
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
124
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
125
|
+
*
|
|
126
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
127
|
+
*
|
|
128
|
+
* @returns {Promise<InitOutput>}
|
|
129
|
+
*/
|
|
130
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
/* @ts-self-types="./opengrid_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The engine the browser talks to: a set of in-memory sources.
|
|
5
|
+
*
|
|
6
|
+
* One instance holds one [`LocalDataSource`] per name
|
|
7
|
+
* (plan/spezifikation/03-datasource.md). The demo registers `orders` and runs
|
|
8
|
+
* the example query of `spezifikation/02-query-modell.md` against it.
|
|
9
|
+
*/
|
|
10
|
+
export class Engine {
|
|
11
|
+
__destroy_into_raw() {
|
|
12
|
+
const ptr = this.__wbg_ptr;
|
|
13
|
+
this.__wbg_ptr = 0;
|
|
14
|
+
EngineFinalization.unregister(this);
|
|
15
|
+
return ptr;
|
|
16
|
+
}
|
|
17
|
+
free() {
|
|
18
|
+
const ptr = this.__destroy_into_raw();
|
|
19
|
+
wasm.__wbg_engine_free(ptr, 0);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Runs a query JSON and answers with the result JSON.
|
|
23
|
+
*
|
|
24
|
+
* The result is the wire shape of a [`QueryResult`]: `total_count` for the
|
|
25
|
+
* number before paging, `row_count` for this page, and one
|
|
26
|
+
* `{ "name", "values" }` object per output column, in schema order.
|
|
27
|
+
* @param {string} query_json
|
|
28
|
+
* @returns {string}
|
|
29
|
+
*/
|
|
30
|
+
execute(query_json) {
|
|
31
|
+
let deferred3_0;
|
|
32
|
+
let deferred3_1;
|
|
33
|
+
try {
|
|
34
|
+
const ptr0 = passStringToWasm0(query_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
35
|
+
const len0 = WASM_VECTOR_LEN;
|
|
36
|
+
const ret = wasm.engine_execute(this.__wbg_ptr, ptr0, len0);
|
|
37
|
+
var ptr2 = ret[0];
|
|
38
|
+
var len2 = ret[1];
|
|
39
|
+
if (ret[3]) {
|
|
40
|
+
ptr2 = 0; len2 = 0;
|
|
41
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
42
|
+
}
|
|
43
|
+
deferred3_0 = ptr2;
|
|
44
|
+
deferred3_1 = len2;
|
|
45
|
+
return getStringFromWasm0(ptr2, len2);
|
|
46
|
+
} finally {
|
|
47
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Reads CSV bytes against an explicit schema and registers the source.
|
|
52
|
+
*
|
|
53
|
+
* The schema is required — ingest never guesses types, and an inferred
|
|
54
|
+
* proposal is a suggestion a UI may show
|
|
55
|
+
* (plan/spezifikation/04-local-engine.md §Ingest).
|
|
56
|
+
* @param {string} name
|
|
57
|
+
* @param {Uint8Array} bytes
|
|
58
|
+
* @param {string} schema_json
|
|
59
|
+
*/
|
|
60
|
+
load_csv(name, bytes, schema_json) {
|
|
61
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
62
|
+
const len0 = WASM_VECTOR_LEN;
|
|
63
|
+
const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
64
|
+
const len1 = WASM_VECTOR_LEN;
|
|
65
|
+
const ptr2 = passStringToWasm0(schema_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
66
|
+
const len2 = WASM_VECTOR_LEN;
|
|
67
|
+
const ret = wasm.engine_load_csv(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
68
|
+
if (ret[1]) {
|
|
69
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* An engine without data. `load_csv` adds sources.
|
|
74
|
+
*/
|
|
75
|
+
constructor() {
|
|
76
|
+
const ret = wasm.engine_new();
|
|
77
|
+
this.__wbg_ptr = ret;
|
|
78
|
+
EngineFinalization.register(this, this.__wbg_ptr, this);
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The names of the registered sources, in unspecified order.
|
|
83
|
+
* @returns {string[]}
|
|
84
|
+
*/
|
|
85
|
+
source_names() {
|
|
86
|
+
const ret = wasm.engine_source_names(this.__wbg_ptr);
|
|
87
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
88
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
89
|
+
return v1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (Symbol.dispose) Engine.prototype[Symbol.dispose] = Engine.prototype.free;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The planner in the browser: who answers which half of a query (point 28).
|
|
96
|
+
*
|
|
97
|
+
* The page holds a remote source it cannot change and an engine it can. This
|
|
98
|
+
* object decides between them and does the local half:
|
|
99
|
+
*
|
|
100
|
+
* 1. [`plan`](Planner::plan) turns a query into the query for the source, the
|
|
101
|
+
* query for the client, and a sentence describing the split.
|
|
102
|
+
* 2. The page sends the source query wherever it goes and gets an answer back.
|
|
103
|
+
* 3. [`finish`](Planner::finish) runs the client query over that answer.
|
|
104
|
+
*
|
|
105
|
+
* It holds no state between the two calls on purpose: the plan travels as JSON
|
|
106
|
+
* through the page, which is also what makes it readable from outside
|
|
107
|
+
* (plan/spezifikation/05-planner.md: "Offengelegt für Debugging").
|
|
108
|
+
*/
|
|
109
|
+
export class Planner {
|
|
110
|
+
__destroy_into_raw() {
|
|
111
|
+
const ptr = this.__wbg_ptr;
|
|
112
|
+
this.__wbg_ptr = 0;
|
|
113
|
+
PlannerFinalization.unregister(this);
|
|
114
|
+
return ptr;
|
|
115
|
+
}
|
|
116
|
+
free() {
|
|
117
|
+
const ptr = this.__destroy_into_raw();
|
|
118
|
+
wasm.__wbg_planner_free(ptr, 0);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Runs `client_query_json` over `result_json` — the source's answer.
|
|
122
|
+
*
|
|
123
|
+
* This is the hybrid return path E14 names: the partial result becomes
|
|
124
|
+
* Arrow batches again and the engine finishes the query over them, which
|
|
125
|
+
* includes recounting `total_count` — filtering or grouping changed it.
|
|
126
|
+
* @param {string} client_query_json
|
|
127
|
+
* @param {string} result_json
|
|
128
|
+
* @returns {string}
|
|
129
|
+
*/
|
|
130
|
+
finish(client_query_json, result_json) {
|
|
131
|
+
let deferred4_0;
|
|
132
|
+
let deferred4_1;
|
|
133
|
+
try {
|
|
134
|
+
const ptr0 = passStringToWasm0(client_query_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
135
|
+
const len0 = WASM_VECTOR_LEN;
|
|
136
|
+
const ptr1 = passStringToWasm0(result_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
137
|
+
const len1 = WASM_VECTOR_LEN;
|
|
138
|
+
const ret = wasm.planner_finish(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
139
|
+
var ptr3 = ret[0];
|
|
140
|
+
var len3 = ret[1];
|
|
141
|
+
if (ret[3]) {
|
|
142
|
+
ptr3 = 0; len3 = 0;
|
|
143
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
144
|
+
}
|
|
145
|
+
deferred4_0 = ptr3;
|
|
146
|
+
deferred4_1 = len3;
|
|
147
|
+
return getStringFromWasm0(ptr3, len3);
|
|
148
|
+
} finally {
|
|
149
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* A planner for a source with `schema_json` and `capabilities_json`, in
|
|
154
|
+
* `mode` (`local`, `remote`, `hybrid` or `auto`).
|
|
155
|
+
*
|
|
156
|
+
* Both JSON documents are what `GET /source/{name}` answers, so a page can
|
|
157
|
+
* hand them straight through without knowing their shape.
|
|
158
|
+
* @param {string} schema_json
|
|
159
|
+
* @param {string} capabilities_json
|
|
160
|
+
* @param {string} mode
|
|
161
|
+
*/
|
|
162
|
+
constructor(schema_json, capabilities_json, mode) {
|
|
163
|
+
const ptr0 = passStringToWasm0(schema_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
164
|
+
const len0 = WASM_VECTOR_LEN;
|
|
165
|
+
const ptr1 = passStringToWasm0(capabilities_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
166
|
+
const len1 = WASM_VECTOR_LEN;
|
|
167
|
+
const ptr2 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
168
|
+
const len2 = WASM_VECTOR_LEN;
|
|
169
|
+
const ret = wasm.planner_new(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
170
|
+
if (ret[2]) {
|
|
171
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
172
|
+
}
|
|
173
|
+
this.__wbg_ptr = ret[0];
|
|
174
|
+
PlannerFinalization.register(this, this.__wbg_ptr, this);
|
|
175
|
+
return this;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Splits `query_json`, answering the plan as JSON.
|
|
179
|
+
*
|
|
180
|
+
* `mode` overrides the planner's own mode when it is not empty — that is
|
|
181
|
+
* how the element's `mode` attribute reaches the planner without rebuilding
|
|
182
|
+
* it on every attribute change.
|
|
183
|
+
*
|
|
184
|
+
* The answer is `{ mode, describe, steps, source, client }`: `source` is the
|
|
185
|
+
* query to send on, `client` the query to hand back to
|
|
186
|
+
* [`finish`](Planner::finish), or `null` when the source answers it all.
|
|
187
|
+
* @param {string} query_json
|
|
188
|
+
* @param {string} mode
|
|
189
|
+
* @returns {string}
|
|
190
|
+
*/
|
|
191
|
+
plan(query_json, mode) {
|
|
192
|
+
let deferred4_0;
|
|
193
|
+
let deferred4_1;
|
|
194
|
+
try {
|
|
195
|
+
const ptr0 = passStringToWasm0(query_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
196
|
+
const len0 = WASM_VECTOR_LEN;
|
|
197
|
+
const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
198
|
+
const len1 = WASM_VECTOR_LEN;
|
|
199
|
+
const ret = wasm.planner_plan(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
200
|
+
var ptr3 = ret[0];
|
|
201
|
+
var len3 = ret[1];
|
|
202
|
+
if (ret[3]) {
|
|
203
|
+
ptr3 = 0; len3 = 0;
|
|
204
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
205
|
+
}
|
|
206
|
+
deferred4_0 = ptr3;
|
|
207
|
+
deferred4_1 = len3;
|
|
208
|
+
return getStringFromWasm0(ptr3, len3);
|
|
209
|
+
} finally {
|
|
210
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (Symbol.dispose) Planner.prototype[Symbol.dispose] = Planner.prototype.free;
|
|
215
|
+
function __wbg_get_imports() {
|
|
216
|
+
const import0 = {
|
|
217
|
+
__proto__: null,
|
|
218
|
+
__wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
|
|
219
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
220
|
+
return ret;
|
|
221
|
+
},
|
|
222
|
+
__wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
|
|
223
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
224
|
+
},
|
|
225
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
226
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
227
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
228
|
+
return ret;
|
|
229
|
+
},
|
|
230
|
+
__wbindgen_init_externref_table: function() {
|
|
231
|
+
const table = wasm.__wbindgen_externrefs;
|
|
232
|
+
const offset = table.grow(4);
|
|
233
|
+
table.set(0, undefined);
|
|
234
|
+
table.set(offset + 0, undefined);
|
|
235
|
+
table.set(offset + 1, null);
|
|
236
|
+
table.set(offset + 2, true);
|
|
237
|
+
table.set(offset + 3, false);
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
return {
|
|
241
|
+
__proto__: null,
|
|
242
|
+
"./opengrid_wasm_bg.js": import0,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const EngineFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
247
|
+
? { register: () => {}, unregister: () => {} }
|
|
248
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_engine_free(ptr, 1));
|
|
249
|
+
const PlannerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
250
|
+
? { register: () => {}, unregister: () => {} }
|
|
251
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_planner_free(ptr, 1));
|
|
252
|
+
|
|
253
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
254
|
+
ptr = ptr >>> 0;
|
|
255
|
+
const mem = getDataViewMemory0();
|
|
256
|
+
const result = [];
|
|
257
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
258
|
+
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
259
|
+
}
|
|
260
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
261
|
+
return result;
|
|
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
|
+
return decodeText(ptr >>> 0, len);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
let cachedUint8ArrayMemory0 = null;
|
|
277
|
+
function getUint8ArrayMemory0() {
|
|
278
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
279
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
280
|
+
}
|
|
281
|
+
return cachedUint8ArrayMemory0;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
285
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
286
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
287
|
+
WASM_VECTOR_LEN = arg.length;
|
|
288
|
+
return ptr;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
292
|
+
if (realloc === undefined) {
|
|
293
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
294
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
295
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
296
|
+
WASM_VECTOR_LEN = buf.length;
|
|
297
|
+
return ptr;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
let len = arg.length;
|
|
301
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
302
|
+
|
|
303
|
+
const mem = getUint8ArrayMemory0();
|
|
304
|
+
|
|
305
|
+
let offset = 0;
|
|
306
|
+
|
|
307
|
+
for (; offset < len; offset++) {
|
|
308
|
+
const code = arg.charCodeAt(offset);
|
|
309
|
+
if (code > 0x7F) break;
|
|
310
|
+
mem[ptr + offset] = code;
|
|
311
|
+
}
|
|
312
|
+
if (offset !== len) {
|
|
313
|
+
if (offset !== 0) {
|
|
314
|
+
arg = arg.slice(offset);
|
|
315
|
+
}
|
|
316
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
317
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
318
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
319
|
+
|
|
320
|
+
offset += ret.written;
|
|
321
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
WASM_VECTOR_LEN = offset;
|
|
325
|
+
return ptr;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function takeFromExternrefTable0(idx) {
|
|
329
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
330
|
+
wasm.__externref_table_dealloc(idx);
|
|
331
|
+
return value;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
335
|
+
cachedTextDecoder.decode();
|
|
336
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
337
|
+
let numBytesDecoded = 0;
|
|
338
|
+
function decodeText(ptr, len) {
|
|
339
|
+
numBytesDecoded += len;
|
|
340
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
341
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
342
|
+
cachedTextDecoder.decode();
|
|
343
|
+
numBytesDecoded = len;
|
|
344
|
+
}
|
|
345
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
const cachedTextEncoder = new TextEncoder();
|
|
349
|
+
|
|
350
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
351
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
352
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
353
|
+
view.set(buf);
|
|
354
|
+
return {
|
|
355
|
+
read: arg.length,
|
|
356
|
+
written: buf.length
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
let WASM_VECTOR_LEN = 0;
|
|
362
|
+
|
|
363
|
+
let wasmModule, wasmInstance, wasm;
|
|
364
|
+
function __wbg_finalize_init(instance, module) {
|
|
365
|
+
wasmInstance = instance;
|
|
366
|
+
wasm = instance.exports;
|
|
367
|
+
wasmModule = module;
|
|
368
|
+
cachedDataViewMemory0 = null;
|
|
369
|
+
cachedUint8ArrayMemory0 = null;
|
|
370
|
+
wasm.__wbindgen_start();
|
|
371
|
+
return wasm;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
async function __wbg_load(module, imports) {
|
|
375
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
376
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
377
|
+
try {
|
|
378
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
379
|
+
} catch (e) {
|
|
380
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
381
|
+
|
|
382
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
383
|
+
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);
|
|
384
|
+
|
|
385
|
+
} else { throw e; }
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const bytes = await module.arrayBuffer();
|
|
390
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
391
|
+
} else {
|
|
392
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
393
|
+
|
|
394
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
395
|
+
return { instance, module };
|
|
396
|
+
} else {
|
|
397
|
+
return instance;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
function expectedResponseType(type) {
|
|
402
|
+
switch (type) {
|
|
403
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
404
|
+
}
|
|
405
|
+
return false;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function initSync(module) {
|
|
410
|
+
if (wasm !== undefined) return wasm;
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
if (module !== undefined) {
|
|
414
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
415
|
+
({module} = module)
|
|
416
|
+
} else {
|
|
417
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
const imports = __wbg_get_imports();
|
|
422
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
423
|
+
module = new WebAssembly.Module(module);
|
|
424
|
+
}
|
|
425
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
426
|
+
return __wbg_finalize_init(instance, module);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
async function __wbg_init(module_or_path) {
|
|
430
|
+
if (wasm !== undefined) return wasm;
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
if (module_or_path !== undefined) {
|
|
434
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
435
|
+
({module_or_path} = module_or_path)
|
|
436
|
+
} else {
|
|
437
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
if (module_or_path === undefined) {
|
|
442
|
+
module_or_path = new URL('opengrid_wasm_bg.wasm', import.meta.url);
|
|
443
|
+
}
|
|
444
|
+
const imports = __wbg_get_imports();
|
|
445
|
+
|
|
446
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
447
|
+
module_or_path = fetch(module_or_path);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
451
|
+
|
|
452
|
+
return __wbg_finalize_init(instance, module);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_engine_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_planner_free: (a: number, b: number) => void;
|
|
6
|
+
export const engine_execute: (a: number, b: number, c: number) => [number, number, number, number];
|
|
7
|
+
export const engine_load_csv: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
8
|
+
export const engine_new: () => number;
|
|
9
|
+
export const engine_source_names: (a: number) => [number, number];
|
|
10
|
+
export const planner_finish: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
11
|
+
export const planner_new: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
12
|
+
export const planner_plan: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
13
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
14
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
15
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
16
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
17
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
18
|
+
export const __externref_drop_slice: (a: number, b: number) => void;
|
|
19
|
+
export const __wbindgen_start: () => void;
|