ggsql-wasm 0.2.7
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/LICENSE +7 -0
- package/ggsql_wasm.d.ts +105 -0
- package/ggsql_wasm.js +832 -0
- package/ggsql_wasm_bg.wasm +0 -0
- package/package.json +25 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2026 ggsql authors
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/ggsql_wasm.d.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Persistent ggsql context for WASM
|
|
6
|
+
*
|
|
7
|
+
* Create once and reuse for multiple queries to avoid memory issues.
|
|
8
|
+
* Uses interior mutability to avoid wasm_bindgen's &mut self aliasing issues.
|
|
9
|
+
*/
|
|
10
|
+
export class GgsqlContext {
|
|
11
|
+
free(): void;
|
|
12
|
+
[Symbol.dispose](): void;
|
|
13
|
+
/**
|
|
14
|
+
* Execute a ggsql query and return Vega-Lite JSON
|
|
15
|
+
*/
|
|
16
|
+
execute(query: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Execute SQL-only query and return JSON with columns/rows
|
|
19
|
+
*/
|
|
20
|
+
execute_sql(query: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Check whether a query contains a VISUALISE clause
|
|
23
|
+
*/
|
|
24
|
+
has_visual(query: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* List all registered tables
|
|
27
|
+
*/
|
|
28
|
+
list_tables(): any;
|
|
29
|
+
/**
|
|
30
|
+
* Create a new ggsql context
|
|
31
|
+
*/
|
|
32
|
+
constructor();
|
|
33
|
+
/**
|
|
34
|
+
* Register all known builtin datasets (e.g. ggsql:penguins)
|
|
35
|
+
*/
|
|
36
|
+
register_builtin_datasets(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Register a CSV file as a table from raw bytes
|
|
39
|
+
*/
|
|
40
|
+
register_csv(name: string, data: Uint8Array): void;
|
|
41
|
+
/**
|
|
42
|
+
* Register a Parquet file as a table from raw bytes
|
|
43
|
+
*/
|
|
44
|
+
register_parquet(name: string, data: Uint8Array): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Unregister a table
|
|
47
|
+
*/
|
|
48
|
+
unregister(name: string): void;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
52
|
+
|
|
53
|
+
export interface InitOutput {
|
|
54
|
+
readonly memory: WebAssembly.Memory;
|
|
55
|
+
readonly __wbg_ggsqlcontext_free: (a: number, b: number) => void;
|
|
56
|
+
readonly ggsqlcontext_new: (a: number) => void;
|
|
57
|
+
readonly ggsqlcontext_execute: (a: number, b: number, c: number, d: number) => void;
|
|
58
|
+
readonly ggsqlcontext_has_visual: (a: number, b: number, c: number) => number;
|
|
59
|
+
readonly ggsqlcontext_execute_sql: (a: number, b: number, c: number, d: number) => void;
|
|
60
|
+
readonly ggsqlcontext_register_csv: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
61
|
+
readonly ggsqlcontext_register_parquet: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
62
|
+
readonly ggsqlcontext_register_builtin_datasets: (a: number) => number;
|
|
63
|
+
readonly ggsqlcontext_unregister: (a: number, b: number, c: number, d: number) => void;
|
|
64
|
+
readonly ggsqlcontext_list_tables: (a: number) => number;
|
|
65
|
+
readonly rust_sqlite_wasm_getentropy: (a: number, b: number) => number;
|
|
66
|
+
readonly rust_sqlite_wasm_assert_fail: (a: number, b: number, c: number, d: number) => void;
|
|
67
|
+
readonly rust_sqlite_wasm_abort: () => void;
|
|
68
|
+
readonly rust_sqlite_wasm_localtime: (a: number) => number;
|
|
69
|
+
readonly rust_sqlite_wasm_malloc: (a: number) => number;
|
|
70
|
+
readonly rust_sqlite_wasm_free: (a: number) => void;
|
|
71
|
+
readonly rust_sqlite_wasm_realloc: (a: number, b: number) => number;
|
|
72
|
+
readonly rust_sqlite_wasm_calloc: (a: number, b: number) => number;
|
|
73
|
+
readonly sqlite3_os_init: () => number;
|
|
74
|
+
readonly sqlite3_os_end: () => number;
|
|
75
|
+
readonly __wasm_bindgen_func_elem_7507: (a: number, b: number, c: number, d: number) => void;
|
|
76
|
+
readonly __wasm_bindgen_func_elem_7576: (a: number, b: number, c: number, d: number) => void;
|
|
77
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
78
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
79
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
80
|
+
readonly __wbindgen_export4: (a: number, b: number) => void;
|
|
81
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
82
|
+
readonly __wbindgen_export5: (a: number, b: number, c: number) => void;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
89
|
+
* a precompiled `WebAssembly.Module`.
|
|
90
|
+
*
|
|
91
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
92
|
+
*
|
|
93
|
+
* @returns {InitOutput}
|
|
94
|
+
*/
|
|
95
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
99
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
100
|
+
*
|
|
101
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
102
|
+
*
|
|
103
|
+
* @returns {Promise<InitOutput>}
|
|
104
|
+
*/
|
|
105
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/ggsql_wasm.js
ADDED
|
@@ -0,0 +1,832 @@
|
|
|
1
|
+
/* @ts-self-types="./ggsql_wasm.d.ts" */
|
|
2
|
+
import { convert_csv, convert_parquet } from './snippets/ggsql-wasm-3dd2d89ecaa2feb4/library/dist/lib.js';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Persistent ggsql context for WASM
|
|
7
|
+
*
|
|
8
|
+
* Create once and reuse for multiple queries to avoid memory issues.
|
|
9
|
+
* Uses interior mutability to avoid wasm_bindgen's &mut self aliasing issues.
|
|
10
|
+
*/
|
|
11
|
+
export class GgsqlContext {
|
|
12
|
+
__destroy_into_raw() {
|
|
13
|
+
const ptr = this.__wbg_ptr;
|
|
14
|
+
this.__wbg_ptr = 0;
|
|
15
|
+
GgsqlContextFinalization.unregister(this);
|
|
16
|
+
return ptr;
|
|
17
|
+
}
|
|
18
|
+
free() {
|
|
19
|
+
const ptr = this.__destroy_into_raw();
|
|
20
|
+
wasm.__wbg_ggsqlcontext_free(ptr, 0);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Execute a ggsql query and return Vega-Lite JSON
|
|
24
|
+
* @param {string} query
|
|
25
|
+
* @returns {string}
|
|
26
|
+
*/
|
|
27
|
+
execute(query) {
|
|
28
|
+
let deferred3_0;
|
|
29
|
+
let deferred3_1;
|
|
30
|
+
try {
|
|
31
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
32
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
33
|
+
const len0 = WASM_VECTOR_LEN;
|
|
34
|
+
wasm.ggsqlcontext_execute(retptr, this.__wbg_ptr, ptr0, len0);
|
|
35
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
36
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
37
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
38
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
39
|
+
var ptr2 = r0;
|
|
40
|
+
var len2 = r1;
|
|
41
|
+
if (r3) {
|
|
42
|
+
ptr2 = 0; len2 = 0;
|
|
43
|
+
throw takeObject(r2);
|
|
44
|
+
}
|
|
45
|
+
deferred3_0 = ptr2;
|
|
46
|
+
deferred3_1 = len2;
|
|
47
|
+
return getStringFromWasm0(ptr2, len2);
|
|
48
|
+
} finally {
|
|
49
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
50
|
+
wasm.__wbindgen_export5(deferred3_0, deferred3_1, 1);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Execute SQL-only query and return JSON with columns/rows
|
|
55
|
+
* @param {string} query
|
|
56
|
+
* @returns {string}
|
|
57
|
+
*/
|
|
58
|
+
execute_sql(query) {
|
|
59
|
+
let deferred3_0;
|
|
60
|
+
let deferred3_1;
|
|
61
|
+
try {
|
|
62
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
63
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
64
|
+
const len0 = WASM_VECTOR_LEN;
|
|
65
|
+
wasm.ggsqlcontext_execute_sql(retptr, this.__wbg_ptr, ptr0, len0);
|
|
66
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
67
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
68
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
69
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
70
|
+
var ptr2 = r0;
|
|
71
|
+
var len2 = r1;
|
|
72
|
+
if (r3) {
|
|
73
|
+
ptr2 = 0; len2 = 0;
|
|
74
|
+
throw takeObject(r2);
|
|
75
|
+
}
|
|
76
|
+
deferred3_0 = ptr2;
|
|
77
|
+
deferred3_1 = len2;
|
|
78
|
+
return getStringFromWasm0(ptr2, len2);
|
|
79
|
+
} finally {
|
|
80
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
81
|
+
wasm.__wbindgen_export5(deferred3_0, deferred3_1, 1);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Check whether a query contains a VISUALISE clause
|
|
86
|
+
* @param {string} query
|
|
87
|
+
* @returns {boolean}
|
|
88
|
+
*/
|
|
89
|
+
has_visual(query) {
|
|
90
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
91
|
+
const len0 = WASM_VECTOR_LEN;
|
|
92
|
+
const ret = wasm.ggsqlcontext_has_visual(this.__wbg_ptr, ptr0, len0);
|
|
93
|
+
return ret !== 0;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* List all registered tables
|
|
97
|
+
* @returns {any}
|
|
98
|
+
*/
|
|
99
|
+
list_tables() {
|
|
100
|
+
const ret = wasm.ggsqlcontext_list_tables(this.__wbg_ptr);
|
|
101
|
+
return takeObject(ret);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Create a new ggsql context
|
|
105
|
+
*/
|
|
106
|
+
constructor() {
|
|
107
|
+
try {
|
|
108
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
109
|
+
wasm.ggsqlcontext_new(retptr);
|
|
110
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
111
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
112
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
113
|
+
if (r2) {
|
|
114
|
+
throw takeObject(r1);
|
|
115
|
+
}
|
|
116
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
117
|
+
GgsqlContextFinalization.register(this, this.__wbg_ptr, this);
|
|
118
|
+
return this;
|
|
119
|
+
} finally {
|
|
120
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Register all known builtin datasets (e.g. ggsql:penguins)
|
|
125
|
+
* @returns {Promise<void>}
|
|
126
|
+
*/
|
|
127
|
+
register_builtin_datasets() {
|
|
128
|
+
const ret = wasm.ggsqlcontext_register_builtin_datasets(this.__wbg_ptr);
|
|
129
|
+
return takeObject(ret);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Register a CSV file as a table from raw bytes
|
|
133
|
+
* @param {string} name
|
|
134
|
+
* @param {Uint8Array} data
|
|
135
|
+
*/
|
|
136
|
+
register_csv(name, data) {
|
|
137
|
+
try {
|
|
138
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
139
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
140
|
+
const len0 = WASM_VECTOR_LEN;
|
|
141
|
+
const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_export);
|
|
142
|
+
const len1 = WASM_VECTOR_LEN;
|
|
143
|
+
wasm.ggsqlcontext_register_csv(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
144
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
145
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
146
|
+
if (r1) {
|
|
147
|
+
throw takeObject(r0);
|
|
148
|
+
}
|
|
149
|
+
} finally {
|
|
150
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Register a Parquet file as a table from raw bytes
|
|
155
|
+
* @param {string} name
|
|
156
|
+
* @param {Uint8Array} data
|
|
157
|
+
* @returns {Promise<void>}
|
|
158
|
+
*/
|
|
159
|
+
register_parquet(name, data) {
|
|
160
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
161
|
+
const len0 = WASM_VECTOR_LEN;
|
|
162
|
+
const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_export);
|
|
163
|
+
const len1 = WASM_VECTOR_LEN;
|
|
164
|
+
const ret = wasm.ggsqlcontext_register_parquet(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
165
|
+
return takeObject(ret);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Unregister a table
|
|
169
|
+
* @param {string} name
|
|
170
|
+
*/
|
|
171
|
+
unregister(name) {
|
|
172
|
+
try {
|
|
173
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
174
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
175
|
+
const len0 = WASM_VECTOR_LEN;
|
|
176
|
+
wasm.ggsqlcontext_unregister(retptr, this.__wbg_ptr, ptr0, len0);
|
|
177
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
178
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
179
|
+
if (r1) {
|
|
180
|
+
throw takeObject(r0);
|
|
181
|
+
}
|
|
182
|
+
} finally {
|
|
183
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (Symbol.dispose) GgsqlContext.prototype[Symbol.dispose] = GgsqlContext.prototype.free;
|
|
188
|
+
function __wbg_get_imports() {
|
|
189
|
+
const import0 = {
|
|
190
|
+
__proto__: null,
|
|
191
|
+
__wbg___wbindgen_debug_string_ab4b34d23d6778bd: function(arg0, arg1) {
|
|
192
|
+
const ret = debugString(getObject(arg1));
|
|
193
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
194
|
+
const len1 = WASM_VECTOR_LEN;
|
|
195
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
196
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
197
|
+
},
|
|
198
|
+
__wbg___wbindgen_is_function_3baa9db1a987f47d: function(arg0) {
|
|
199
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
200
|
+
return ret;
|
|
201
|
+
},
|
|
202
|
+
__wbg___wbindgen_is_object_63322ec0cd6ea4ef: function(arg0) {
|
|
203
|
+
const val = getObject(arg0);
|
|
204
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
205
|
+
return ret;
|
|
206
|
+
},
|
|
207
|
+
__wbg___wbindgen_is_string_6df3bf7ef1164ed3: function(arg0) {
|
|
208
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
209
|
+
return ret;
|
|
210
|
+
},
|
|
211
|
+
__wbg___wbindgen_is_undefined_29a43b4d42920abd: function(arg0) {
|
|
212
|
+
const ret = getObject(arg0) === undefined;
|
|
213
|
+
return ret;
|
|
214
|
+
},
|
|
215
|
+
__wbg___wbindgen_string_get_7ed5322991caaec5: function(arg0, arg1) {
|
|
216
|
+
const obj = getObject(arg1);
|
|
217
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
218
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
219
|
+
var len1 = WASM_VECTOR_LEN;
|
|
220
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
221
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
222
|
+
},
|
|
223
|
+
__wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
|
|
224
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
225
|
+
},
|
|
226
|
+
__wbg__wbg_cb_unref_b46c9b5a9f08ec37: function(arg0) {
|
|
227
|
+
getObject(arg0)._wbg_cb_unref();
|
|
228
|
+
},
|
|
229
|
+
__wbg_call_a24592a6f349a97e: function() { return handleError(function (arg0, arg1, arg2) {
|
|
230
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
231
|
+
return addHeapObject(ret);
|
|
232
|
+
}, arguments); },
|
|
233
|
+
__wbg_convert_csv_04f2d9050a7f1f9d: function() { return handleError(function (arg0, arg1) {
|
|
234
|
+
const ret = convert_csv(getArrayU8FromWasm0(arg0, arg1));
|
|
235
|
+
return addHeapObject(ret);
|
|
236
|
+
}, arguments); },
|
|
237
|
+
__wbg_convert_parquet_79a152947f01c3c2: function() { return handleError(function (arg0, arg1) {
|
|
238
|
+
const ret = convert_parquet(getArrayU8FromWasm0(arg0, arg1));
|
|
239
|
+
return addHeapObject(ret);
|
|
240
|
+
}, arguments); },
|
|
241
|
+
__wbg_crypto_38df2bab126b63dc: function(arg0) {
|
|
242
|
+
const ret = getObject(arg0).crypto;
|
|
243
|
+
return addHeapObject(ret);
|
|
244
|
+
},
|
|
245
|
+
__wbg_from_0dbf29f09e7fb200: function(arg0) {
|
|
246
|
+
const ret = Array.from(getObject(arg0));
|
|
247
|
+
return addHeapObject(ret);
|
|
248
|
+
},
|
|
249
|
+
__wbg_getDate_a6d29e0195e2b922: function(arg0) {
|
|
250
|
+
const ret = getObject(arg0).getDate();
|
|
251
|
+
return ret;
|
|
252
|
+
},
|
|
253
|
+
__wbg_getDay_d40b1e1b4ed9ae92: function(arg0) {
|
|
254
|
+
const ret = getObject(arg0).getDay();
|
|
255
|
+
return ret;
|
|
256
|
+
},
|
|
257
|
+
__wbg_getFullYear_87c6d68ce4941f16: function(arg0) {
|
|
258
|
+
const ret = getObject(arg0).getFullYear();
|
|
259
|
+
return ret;
|
|
260
|
+
},
|
|
261
|
+
__wbg_getHours_bba0ffaba65cf3f1: function(arg0) {
|
|
262
|
+
const ret = getObject(arg0).getHours();
|
|
263
|
+
return ret;
|
|
264
|
+
},
|
|
265
|
+
__wbg_getMinutes_240bbdd69fb6e5d0: function(arg0) {
|
|
266
|
+
const ret = getObject(arg0).getMinutes();
|
|
267
|
+
return ret;
|
|
268
|
+
},
|
|
269
|
+
__wbg_getMonth_774597931909564c: function(arg0) {
|
|
270
|
+
const ret = getObject(arg0).getMonth();
|
|
271
|
+
return ret;
|
|
272
|
+
},
|
|
273
|
+
__wbg_getRandomValues_477b66419bbb968d: function() { return handleError(function (arg0, arg1) {
|
|
274
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
275
|
+
}, arguments); },
|
|
276
|
+
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
|
|
277
|
+
getObject(arg0).getRandomValues(getObject(arg1));
|
|
278
|
+
}, arguments); },
|
|
279
|
+
__wbg_getRandomValues_ef12552bf5acd2fe: function() { return handleError(function (arg0, arg1) {
|
|
280
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
281
|
+
}, arguments); },
|
|
282
|
+
__wbg_getSeconds_95f730540087b3b6: function(arg0) {
|
|
283
|
+
const ret = getObject(arg0).getSeconds();
|
|
284
|
+
return ret;
|
|
285
|
+
},
|
|
286
|
+
__wbg_getTime_da7c55f52b71e8c6: function(arg0) {
|
|
287
|
+
const ret = getObject(arg0).getTime();
|
|
288
|
+
return ret;
|
|
289
|
+
},
|
|
290
|
+
__wbg_getTimezoneOffset_31f57a5389d0d57c: function(arg0) {
|
|
291
|
+
const ret = getObject(arg0).getTimezoneOffset();
|
|
292
|
+
return ret;
|
|
293
|
+
},
|
|
294
|
+
__wbg_get_6011fa3a58f61074: function() { return handleError(function (arg0, arg1) {
|
|
295
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
296
|
+
return addHeapObject(ret);
|
|
297
|
+
}, arguments); },
|
|
298
|
+
__wbg_get_8360291721e2339f: function(arg0, arg1) {
|
|
299
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
300
|
+
return addHeapObject(ret);
|
|
301
|
+
},
|
|
302
|
+
__wbg_length_3d4ecd04bd8d22f1: function(arg0) {
|
|
303
|
+
const ret = getObject(arg0).length;
|
|
304
|
+
return ret;
|
|
305
|
+
},
|
|
306
|
+
__wbg_length_9f1775224cf1d815: function(arg0) {
|
|
307
|
+
const ret = getObject(arg0).length;
|
|
308
|
+
return ret;
|
|
309
|
+
},
|
|
310
|
+
__wbg_length_d807629e96c741b8: function(arg0) {
|
|
311
|
+
const ret = getObject(arg0).length;
|
|
312
|
+
return ret;
|
|
313
|
+
},
|
|
314
|
+
__wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
|
|
315
|
+
const ret = getObject(arg0).msCrypto;
|
|
316
|
+
return addHeapObject(ret);
|
|
317
|
+
},
|
|
318
|
+
__wbg_new_0_4d657201ced14de3: function() {
|
|
319
|
+
const ret = new Date();
|
|
320
|
+
return addHeapObject(ret);
|
|
321
|
+
},
|
|
322
|
+
__wbg_new_0c7403db6e782f19: function(arg0) {
|
|
323
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
324
|
+
return addHeapObject(ret);
|
|
325
|
+
},
|
|
326
|
+
__wbg_new_1c0925936314b719: function(arg0) {
|
|
327
|
+
const ret = new Float64Array(getObject(arg0));
|
|
328
|
+
return addHeapObject(ret);
|
|
329
|
+
},
|
|
330
|
+
__wbg_new_682678e2f47e32bc: function() {
|
|
331
|
+
const ret = new Array();
|
|
332
|
+
return addHeapObject(ret);
|
|
333
|
+
},
|
|
334
|
+
__wbg_new_7913666fe5070684: function(arg0) {
|
|
335
|
+
const ret = new Date(getObject(arg0));
|
|
336
|
+
return addHeapObject(ret);
|
|
337
|
+
},
|
|
338
|
+
__wbg_new_typed_323f37fd55ab048d: function(arg0, arg1) {
|
|
339
|
+
try {
|
|
340
|
+
var state0 = {a: arg0, b: arg1};
|
|
341
|
+
var cb0 = (arg0, arg1) => {
|
|
342
|
+
const a = state0.a;
|
|
343
|
+
state0.a = 0;
|
|
344
|
+
try {
|
|
345
|
+
return __wasm_bindgen_func_elem_7576(a, state0.b, arg0, arg1);
|
|
346
|
+
} finally {
|
|
347
|
+
state0.a = a;
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
const ret = new Promise(cb0);
|
|
351
|
+
return addHeapObject(ret);
|
|
352
|
+
} finally {
|
|
353
|
+
state0.a = 0;
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
__wbg_new_with_length_8c854e41ea4dae9b: function(arg0) {
|
|
357
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
358
|
+
return addHeapObject(ret);
|
|
359
|
+
},
|
|
360
|
+
__wbg_new_with_year_month_day_c5da92578bfcdd66: function(arg0, arg1, arg2) {
|
|
361
|
+
const ret = new Date(arg0 >>> 0, arg1, arg2);
|
|
362
|
+
return addHeapObject(ret);
|
|
363
|
+
},
|
|
364
|
+
__wbg_node_84ea875411254db1: function(arg0) {
|
|
365
|
+
const ret = getObject(arg0).node;
|
|
366
|
+
return addHeapObject(ret);
|
|
367
|
+
},
|
|
368
|
+
__wbg_process_44c7a14e11e9f69e: function(arg0) {
|
|
369
|
+
const ret = getObject(arg0).process;
|
|
370
|
+
return addHeapObject(ret);
|
|
371
|
+
},
|
|
372
|
+
__wbg_prototypesetcall_a6b02eb00b0f4ce2: function(arg0, arg1, arg2) {
|
|
373
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
374
|
+
},
|
|
375
|
+
__wbg_prototypesetcall_c5875dab42ff6b97: function(arg0, arg1, arg2) {
|
|
376
|
+
Float64Array.prototype.set.call(getArrayF64FromWasm0(arg0, arg1), getObject(arg2));
|
|
377
|
+
},
|
|
378
|
+
__wbg_push_471a5b068a5295f6: function(arg0, arg1) {
|
|
379
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
|
380
|
+
return ret;
|
|
381
|
+
},
|
|
382
|
+
__wbg_queueMicrotask_5d15a957e6aa920e: function(arg0) {
|
|
383
|
+
queueMicrotask(getObject(arg0));
|
|
384
|
+
},
|
|
385
|
+
__wbg_queueMicrotask_f8819e5ffc402f36: function(arg0) {
|
|
386
|
+
const ret = getObject(arg0).queueMicrotask;
|
|
387
|
+
return addHeapObject(ret);
|
|
388
|
+
},
|
|
389
|
+
__wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
|
|
390
|
+
getObject(arg0).randomFillSync(takeObject(arg1));
|
|
391
|
+
}, arguments); },
|
|
392
|
+
__wbg_random_ce7f6871aed001dd: function() {
|
|
393
|
+
const ret = Math.random();
|
|
394
|
+
return ret;
|
|
395
|
+
},
|
|
396
|
+
__wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
|
|
397
|
+
const ret = module.require;
|
|
398
|
+
return addHeapObject(ret);
|
|
399
|
+
}, arguments); },
|
|
400
|
+
__wbg_resolve_e6c466bc1052f16c: function(arg0) {
|
|
401
|
+
const ret = Promise.resolve(getObject(arg0));
|
|
402
|
+
return addHeapObject(ret);
|
|
403
|
+
},
|
|
404
|
+
__wbg_static_accessor_GLOBAL_8cfadc87a297ca02: function() {
|
|
405
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
406
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
407
|
+
},
|
|
408
|
+
__wbg_static_accessor_GLOBAL_THIS_602256ae5c8f42cf: function() {
|
|
409
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
410
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
411
|
+
},
|
|
412
|
+
__wbg_static_accessor_SELF_e445c1c7484aecc3: function() {
|
|
413
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
414
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
415
|
+
},
|
|
416
|
+
__wbg_static_accessor_WINDOW_f20e8576ef1e0f17: function() {
|
|
417
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
418
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
419
|
+
},
|
|
420
|
+
__wbg_subarray_f8ca46a25b1f5e0d: function(arg0, arg1, arg2) {
|
|
421
|
+
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
|
422
|
+
return addHeapObject(ret);
|
|
423
|
+
},
|
|
424
|
+
__wbg_then_792e0c862b060889: function(arg0, arg1, arg2) {
|
|
425
|
+
const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
|
|
426
|
+
return addHeapObject(ret);
|
|
427
|
+
},
|
|
428
|
+
__wbg_then_8e16ee11f05e4827: function(arg0, arg1) {
|
|
429
|
+
const ret = getObject(arg0).then(getObject(arg1));
|
|
430
|
+
return addHeapObject(ret);
|
|
431
|
+
},
|
|
432
|
+
__wbg_versions_276b2795b1c6a219: function(arg0) {
|
|
433
|
+
const ret = getObject(arg0).versions;
|
|
434
|
+
return addHeapObject(ret);
|
|
435
|
+
},
|
|
436
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
437
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 305, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
438
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_7507);
|
|
439
|
+
return addHeapObject(ret);
|
|
440
|
+
},
|
|
441
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
442
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
443
|
+
const ret = arg0;
|
|
444
|
+
return addHeapObject(ret);
|
|
445
|
+
},
|
|
446
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
447
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
448
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
449
|
+
return addHeapObject(ret);
|
|
450
|
+
},
|
|
451
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
452
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
453
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
454
|
+
return addHeapObject(ret);
|
|
455
|
+
},
|
|
456
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
457
|
+
const ret = getObject(arg0);
|
|
458
|
+
return addHeapObject(ret);
|
|
459
|
+
},
|
|
460
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
461
|
+
takeObject(arg0);
|
|
462
|
+
},
|
|
463
|
+
};
|
|
464
|
+
return {
|
|
465
|
+
__proto__: null,
|
|
466
|
+
"./ggsql_wasm_bg.js": import0,
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function __wasm_bindgen_func_elem_7507(arg0, arg1, arg2) {
|
|
471
|
+
try {
|
|
472
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
473
|
+
wasm.__wasm_bindgen_func_elem_7507(retptr, arg0, arg1, addHeapObject(arg2));
|
|
474
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
475
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
476
|
+
if (r1) {
|
|
477
|
+
throw takeObject(r0);
|
|
478
|
+
}
|
|
479
|
+
} finally {
|
|
480
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function __wasm_bindgen_func_elem_7576(arg0, arg1, arg2, arg3) {
|
|
485
|
+
wasm.__wasm_bindgen_func_elem_7576(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
const GgsqlContextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
489
|
+
? { register: () => {}, unregister: () => {} }
|
|
490
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_ggsqlcontext_free(ptr >>> 0, 1));
|
|
491
|
+
|
|
492
|
+
function addHeapObject(obj) {
|
|
493
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
494
|
+
const idx = heap_next;
|
|
495
|
+
heap_next = heap[idx];
|
|
496
|
+
|
|
497
|
+
heap[idx] = obj;
|
|
498
|
+
return idx;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
502
|
+
? { register: () => {}, unregister: () => {} }
|
|
503
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_export4(state.a, state.b));
|
|
504
|
+
|
|
505
|
+
function debugString(val) {
|
|
506
|
+
// primitive types
|
|
507
|
+
const type = typeof val;
|
|
508
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
509
|
+
return `${val}`;
|
|
510
|
+
}
|
|
511
|
+
if (type == 'string') {
|
|
512
|
+
return `"${val}"`;
|
|
513
|
+
}
|
|
514
|
+
if (type == 'symbol') {
|
|
515
|
+
const description = val.description;
|
|
516
|
+
if (description == null) {
|
|
517
|
+
return 'Symbol';
|
|
518
|
+
} else {
|
|
519
|
+
return `Symbol(${description})`;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (type == 'function') {
|
|
523
|
+
const name = val.name;
|
|
524
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
525
|
+
return `Function(${name})`;
|
|
526
|
+
} else {
|
|
527
|
+
return 'Function';
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
// objects
|
|
531
|
+
if (Array.isArray(val)) {
|
|
532
|
+
const length = val.length;
|
|
533
|
+
let debug = '[';
|
|
534
|
+
if (length > 0) {
|
|
535
|
+
debug += debugString(val[0]);
|
|
536
|
+
}
|
|
537
|
+
for(let i = 1; i < length; i++) {
|
|
538
|
+
debug += ', ' + debugString(val[i]);
|
|
539
|
+
}
|
|
540
|
+
debug += ']';
|
|
541
|
+
return debug;
|
|
542
|
+
}
|
|
543
|
+
// Test for built-in
|
|
544
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
545
|
+
let className;
|
|
546
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
547
|
+
className = builtInMatches[1];
|
|
548
|
+
} else {
|
|
549
|
+
// Failed to match the standard '[object ClassName]'
|
|
550
|
+
return toString.call(val);
|
|
551
|
+
}
|
|
552
|
+
if (className == 'Object') {
|
|
553
|
+
// we're a user defined class or Object
|
|
554
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
555
|
+
// easier than looping through ownProperties of `val`.
|
|
556
|
+
try {
|
|
557
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
558
|
+
} catch (_) {
|
|
559
|
+
return 'Object';
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
// errors
|
|
563
|
+
if (val instanceof Error) {
|
|
564
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
565
|
+
}
|
|
566
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
567
|
+
return className;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
function dropObject(idx) {
|
|
571
|
+
if (idx < 1028) return;
|
|
572
|
+
heap[idx] = heap_next;
|
|
573
|
+
heap_next = idx;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
function getArrayF64FromWasm0(ptr, len) {
|
|
577
|
+
ptr = ptr >>> 0;
|
|
578
|
+
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
582
|
+
ptr = ptr >>> 0;
|
|
583
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
let cachedDataViewMemory0 = null;
|
|
587
|
+
function getDataViewMemory0() {
|
|
588
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
589
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
590
|
+
}
|
|
591
|
+
return cachedDataViewMemory0;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
let cachedFloat64ArrayMemory0 = null;
|
|
595
|
+
function getFloat64ArrayMemory0() {
|
|
596
|
+
if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
|
|
597
|
+
cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
|
|
598
|
+
}
|
|
599
|
+
return cachedFloat64ArrayMemory0;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function getStringFromWasm0(ptr, len) {
|
|
603
|
+
ptr = ptr >>> 0;
|
|
604
|
+
return decodeText(ptr, len);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
let cachedUint8ArrayMemory0 = null;
|
|
608
|
+
function getUint8ArrayMemory0() {
|
|
609
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
610
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
611
|
+
}
|
|
612
|
+
return cachedUint8ArrayMemory0;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
function getObject(idx) { return heap[idx]; }
|
|
616
|
+
|
|
617
|
+
function handleError(f, args) {
|
|
618
|
+
try {
|
|
619
|
+
return f.apply(this, args);
|
|
620
|
+
} catch (e) {
|
|
621
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
let heap = new Array(1024).fill(undefined);
|
|
626
|
+
heap.push(undefined, null, true, false);
|
|
627
|
+
|
|
628
|
+
let heap_next = heap.length;
|
|
629
|
+
|
|
630
|
+
function isLikeNone(x) {
|
|
631
|
+
return x === undefined || x === null;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
635
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
636
|
+
const real = (...args) => {
|
|
637
|
+
|
|
638
|
+
// First up with a closure we increment the internal reference
|
|
639
|
+
// count. This ensures that the Rust closure environment won't
|
|
640
|
+
// be deallocated while we're invoking it.
|
|
641
|
+
state.cnt++;
|
|
642
|
+
const a = state.a;
|
|
643
|
+
state.a = 0;
|
|
644
|
+
try {
|
|
645
|
+
return f(a, state.b, ...args);
|
|
646
|
+
} finally {
|
|
647
|
+
state.a = a;
|
|
648
|
+
real._wbg_cb_unref();
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
real._wbg_cb_unref = () => {
|
|
652
|
+
if (--state.cnt === 0) {
|
|
653
|
+
wasm.__wbindgen_export4(state.a, state.b);
|
|
654
|
+
state.a = 0;
|
|
655
|
+
CLOSURE_DTORS.unregister(state);
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
659
|
+
return real;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
663
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
664
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
665
|
+
WASM_VECTOR_LEN = arg.length;
|
|
666
|
+
return ptr;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
670
|
+
if (realloc === undefined) {
|
|
671
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
672
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
673
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
674
|
+
WASM_VECTOR_LEN = buf.length;
|
|
675
|
+
return ptr;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
let len = arg.length;
|
|
679
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
680
|
+
|
|
681
|
+
const mem = getUint8ArrayMemory0();
|
|
682
|
+
|
|
683
|
+
let offset = 0;
|
|
684
|
+
|
|
685
|
+
for (; offset < len; offset++) {
|
|
686
|
+
const code = arg.charCodeAt(offset);
|
|
687
|
+
if (code > 0x7F) break;
|
|
688
|
+
mem[ptr + offset] = code;
|
|
689
|
+
}
|
|
690
|
+
if (offset !== len) {
|
|
691
|
+
if (offset !== 0) {
|
|
692
|
+
arg = arg.slice(offset);
|
|
693
|
+
}
|
|
694
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
695
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
696
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
697
|
+
|
|
698
|
+
offset += ret.written;
|
|
699
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
WASM_VECTOR_LEN = offset;
|
|
703
|
+
return ptr;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
function takeObject(idx) {
|
|
707
|
+
const ret = getObject(idx);
|
|
708
|
+
dropObject(idx);
|
|
709
|
+
return ret;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
713
|
+
cachedTextDecoder.decode();
|
|
714
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
715
|
+
let numBytesDecoded = 0;
|
|
716
|
+
function decodeText(ptr, len) {
|
|
717
|
+
numBytesDecoded += len;
|
|
718
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
719
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
720
|
+
cachedTextDecoder.decode();
|
|
721
|
+
numBytesDecoded = len;
|
|
722
|
+
}
|
|
723
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
const cachedTextEncoder = new TextEncoder();
|
|
727
|
+
|
|
728
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
729
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
730
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
731
|
+
view.set(buf);
|
|
732
|
+
return {
|
|
733
|
+
read: arg.length,
|
|
734
|
+
written: buf.length
|
|
735
|
+
};
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
let WASM_VECTOR_LEN = 0;
|
|
740
|
+
|
|
741
|
+
let wasmModule, wasm;
|
|
742
|
+
function __wbg_finalize_init(instance, module) {
|
|
743
|
+
wasm = instance.exports;
|
|
744
|
+
wasmModule = module;
|
|
745
|
+
cachedDataViewMemory0 = null;
|
|
746
|
+
cachedFloat64ArrayMemory0 = null;
|
|
747
|
+
cachedUint8ArrayMemory0 = null;
|
|
748
|
+
return wasm;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
async function __wbg_load(module, imports) {
|
|
752
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
753
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
754
|
+
try {
|
|
755
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
756
|
+
} catch (e) {
|
|
757
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
758
|
+
|
|
759
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
760
|
+
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);
|
|
761
|
+
|
|
762
|
+
} else { throw e; }
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
const bytes = await module.arrayBuffer();
|
|
767
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
768
|
+
} else {
|
|
769
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
770
|
+
|
|
771
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
772
|
+
return { instance, module };
|
|
773
|
+
} else {
|
|
774
|
+
return instance;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
function expectedResponseType(type) {
|
|
779
|
+
switch (type) {
|
|
780
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
781
|
+
}
|
|
782
|
+
return false;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
function initSync(module) {
|
|
787
|
+
if (wasm !== undefined) return wasm;
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
if (module !== undefined) {
|
|
791
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
792
|
+
({module} = module)
|
|
793
|
+
} else {
|
|
794
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
const imports = __wbg_get_imports();
|
|
799
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
800
|
+
module = new WebAssembly.Module(module);
|
|
801
|
+
}
|
|
802
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
803
|
+
return __wbg_finalize_init(instance, module);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
async function __wbg_init(module_or_path) {
|
|
807
|
+
if (wasm !== undefined) return wasm;
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
if (module_or_path !== undefined) {
|
|
811
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
812
|
+
({module_or_path} = module_or_path)
|
|
813
|
+
} else {
|
|
814
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
if (module_or_path === undefined) {
|
|
819
|
+
module_or_path = new URL('ggsql_wasm_bg.wasm', import.meta.url);
|
|
820
|
+
}
|
|
821
|
+
const imports = __wbg_get_imports();
|
|
822
|
+
|
|
823
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
824
|
+
module_or_path = fetch(module_or_path);
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
828
|
+
|
|
829
|
+
return __wbg_finalize_init(instance, module);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ggsql-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"collaborators": [
|
|
5
|
+
"ggsql Team"
|
|
6
|
+
],
|
|
7
|
+
"description": "WebAssembly bindings for ggsql.",
|
|
8
|
+
"version": "0.2.7",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/posit-dev/ggsql"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"ggsql_wasm_bg.wasm",
|
|
16
|
+
"ggsql_wasm.js",
|
|
17
|
+
"ggsql_wasm.d.ts"
|
|
18
|
+
],
|
|
19
|
+
"main": "ggsql_wasm.js",
|
|
20
|
+
"homepage": "https://ggsql.org",
|
|
21
|
+
"types": "ggsql_wasm.d.ts",
|
|
22
|
+
"sideEffects": [
|
|
23
|
+
"./snippets/*"
|
|
24
|
+
]
|
|
25
|
+
}
|