@syntropika/tembra-engine-wasm 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -17
- package/dist/assets.d.ts +2 -0
- package/dist/assets.js +7 -0
- package/dist/contracts.d.ts +140 -0
- package/dist/contracts.js +666 -0
- package/dist/contracts_bg.wasm +0 -0
- package/dist/contracts_bg.wasm.d.ts +25 -0
- package/dist/interpreter/interpreter.wasm +0 -0
- package/dist/tembra.d.ts +13 -7
- package/dist/tembra.js +361 -22
- package/dist/tembra_bg.wasm +0 -0
- package/dist/tembra_bg.wasm.d.ts +5 -3
- package/package.json +12 -2
|
@@ -0,0 +1,666 @@
|
|
|
1
|
+
/* @ts-self-types="./contracts.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Immutable artifact data shares one prepared contract across isolated installations.
|
|
5
|
+
*/
|
|
6
|
+
export class WasmArtifact {
|
|
7
|
+
__destroy_into_raw() {
|
|
8
|
+
const ptr = this.__wbg_ptr;
|
|
9
|
+
this.__wbg_ptr = 0;
|
|
10
|
+
WasmArtifactFinalization.unregister(this);
|
|
11
|
+
return ptr;
|
|
12
|
+
}
|
|
13
|
+
free() {
|
|
14
|
+
const ptr = this.__destroy_into_raw();
|
|
15
|
+
wasm.__wbg_wasmartifact_free(ptr, 0);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Bind an export (by interface identity) or import (by world binding) method once.
|
|
19
|
+
* @param {string} binding
|
|
20
|
+
* @param {string} method
|
|
21
|
+
* @param {boolean} exports
|
|
22
|
+
* @returns {number}
|
|
23
|
+
*/
|
|
24
|
+
bind(binding, method, exports) {
|
|
25
|
+
try {
|
|
26
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
27
|
+
const ptr0 = passStringToWasm0(binding, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
28
|
+
const len0 = WASM_VECTOR_LEN;
|
|
29
|
+
const ptr1 = passStringToWasm0(method, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
30
|
+
const len1 = WASM_VECTOR_LEN;
|
|
31
|
+
wasm.wasmartifact_bind(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, exports);
|
|
32
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
33
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
34
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
35
|
+
if (r2) {
|
|
36
|
+
throw takeObject(r1);
|
|
37
|
+
}
|
|
38
|
+
return r0 >>> 0;
|
|
39
|
+
} finally {
|
|
40
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Read identity without copying the implementation through JSON.
|
|
45
|
+
* @returns {string}
|
|
46
|
+
*/
|
|
47
|
+
description() {
|
|
48
|
+
let deferred1_0;
|
|
49
|
+
let deferred1_1;
|
|
50
|
+
try {
|
|
51
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
52
|
+
wasm.wasmartifact_description(retptr, this.__wbg_ptr);
|
|
53
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
54
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
55
|
+
deferred1_0 = r0;
|
|
56
|
+
deferred1_1 = r1;
|
|
57
|
+
return getStringFromWasm0(r0, r1);
|
|
58
|
+
} finally {
|
|
59
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
60
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Decode and re-validate the prepared contract before a browser creates any guest authority.
|
|
65
|
+
* @param {Uint8Array} bytes
|
|
66
|
+
*/
|
|
67
|
+
constructor(bytes) {
|
|
68
|
+
try {
|
|
69
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
70
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
71
|
+
const len0 = WASM_VECTOR_LEN;
|
|
72
|
+
wasm.wasmartifact_new(retptr, ptr0, len0);
|
|
73
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
74
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
75
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
76
|
+
if (r2) {
|
|
77
|
+
throw takeObject(r1);
|
|
78
|
+
}
|
|
79
|
+
this.__wbg_ptr = r0;
|
|
80
|
+
WasmArtifactFinalization.register(this, this.__wbg_ptr, this);
|
|
81
|
+
return this;
|
|
82
|
+
} finally {
|
|
83
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Answer the typed install-time queries: `install`, `implementation` and `describe`.
|
|
88
|
+
* @param {string} packet
|
|
89
|
+
* @returns {string}
|
|
90
|
+
*/
|
|
91
|
+
request(packet) {
|
|
92
|
+
let deferred2_0;
|
|
93
|
+
let deferred2_1;
|
|
94
|
+
try {
|
|
95
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
96
|
+
const ptr0 = passStringToWasm0(packet, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
97
|
+
const len0 = WASM_VECTOR_LEN;
|
|
98
|
+
wasm.wasmartifact_request(retptr, this.__wbg_ptr, ptr0, len0);
|
|
99
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
100
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
101
|
+
deferred2_0 = r0;
|
|
102
|
+
deferred2_1 = r1;
|
|
103
|
+
return getStringFromWasm0(r0, r1);
|
|
104
|
+
} finally {
|
|
105
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
106
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Copy source once when creating a fresh interpreter heap.
|
|
111
|
+
* @returns {string}
|
|
112
|
+
*/
|
|
113
|
+
source() {
|
|
114
|
+
let deferred2_0;
|
|
115
|
+
let deferred2_1;
|
|
116
|
+
try {
|
|
117
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
118
|
+
wasm.wasmartifact_source(retptr, this.__wbg_ptr);
|
|
119
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
120
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
121
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
122
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
123
|
+
var ptr1 = r0;
|
|
124
|
+
var len1 = r1;
|
|
125
|
+
if (r3) {
|
|
126
|
+
ptr1 = 0; len1 = 0;
|
|
127
|
+
throw takeObject(r2);
|
|
128
|
+
}
|
|
129
|
+
deferred2_0 = ptr1;
|
|
130
|
+
deferred2_1 = len1;
|
|
131
|
+
return getStringFromWasm0(ptr1, len1);
|
|
132
|
+
} finally {
|
|
133
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
134
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Validate a JSON argument tuple or result through a bound slot; returns the ok/error envelope.
|
|
139
|
+
* @param {number} slot
|
|
140
|
+
* @param {boolean} _arguments
|
|
141
|
+
* @param {string} value
|
|
142
|
+
* @returns {string}
|
|
143
|
+
*/
|
|
144
|
+
validate(slot, _arguments, value) {
|
|
145
|
+
let deferred2_0;
|
|
146
|
+
let deferred2_1;
|
|
147
|
+
try {
|
|
148
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
149
|
+
const ptr0 = passStringToWasm0(value, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
150
|
+
const len0 = WASM_VECTOR_LEN;
|
|
151
|
+
wasm.wasmartifact_validate(retptr, this.__wbg_ptr, slot, _arguments, ptr0, len0);
|
|
152
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
153
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
154
|
+
deferred2_0 = r0;
|
|
155
|
+
deferred2_1 = r1;
|
|
156
|
+
return getStringFromWasm0(r0, r1);
|
|
157
|
+
} finally {
|
|
158
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
159
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (Symbol.dispose) WasmArtifact.prototype[Symbol.dispose] = WasmArtifact.prototype.free;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Metadata of a compiled Orb whose exact bytes a host-trusted prepared adapter was built from.
|
|
167
|
+
*
|
|
168
|
+
* Native tooling verified the component's real WIT types against this contract before it
|
|
169
|
+
* generated the adapter; the browser only re-checks the binding by digest. It answers the same
|
|
170
|
+
* install-time queries as [`WasmArtifact`] and carries no executable payload.
|
|
171
|
+
*/
|
|
172
|
+
export class WasmPreparedComponent {
|
|
173
|
+
__destroy_into_raw() {
|
|
174
|
+
const ptr = this.__wbg_ptr;
|
|
175
|
+
this.__wbg_ptr = 0;
|
|
176
|
+
WasmPreparedComponentFinalization.unregister(this);
|
|
177
|
+
return ptr;
|
|
178
|
+
}
|
|
179
|
+
free() {
|
|
180
|
+
const ptr = this.__destroy_into_raw();
|
|
181
|
+
wasm.__wbg_wasmpreparedcomponent_free(ptr, 0);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Bind an export (by interface identity) or import (by world binding) method once.
|
|
185
|
+
* @param {string} binding
|
|
186
|
+
* @param {string} method
|
|
187
|
+
* @param {boolean} exports
|
|
188
|
+
* @returns {number}
|
|
189
|
+
*/
|
|
190
|
+
bind(binding, method, exports) {
|
|
191
|
+
try {
|
|
192
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
193
|
+
const ptr0 = passStringToWasm0(binding, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
194
|
+
const len0 = WASM_VECTOR_LEN;
|
|
195
|
+
const ptr1 = passStringToWasm0(method, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
196
|
+
const len1 = WASM_VECTOR_LEN;
|
|
197
|
+
wasm.wasmpreparedcomponent_bind(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, exports);
|
|
198
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
199
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
200
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
201
|
+
if (r2) {
|
|
202
|
+
throw takeObject(r1);
|
|
203
|
+
}
|
|
204
|
+
return r0 >>> 0;
|
|
205
|
+
} finally {
|
|
206
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Compiled contribution roles and their priorities, as a JSON object.
|
|
211
|
+
* @returns {string}
|
|
212
|
+
*/
|
|
213
|
+
contributions() {
|
|
214
|
+
let deferred1_0;
|
|
215
|
+
let deferred1_1;
|
|
216
|
+
try {
|
|
217
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
218
|
+
wasm.wasmpreparedcomponent_contributions(retptr, this.__wbg_ptr);
|
|
219
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
220
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
221
|
+
deferred1_0 = r0;
|
|
222
|
+
deferred1_1 = r1;
|
|
223
|
+
return getStringFromWasm0(r0, r1);
|
|
224
|
+
} finally {
|
|
225
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
226
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Read identity as `WasmArtifact.description` does, with kind `component`.
|
|
231
|
+
* @returns {string}
|
|
232
|
+
*/
|
|
233
|
+
description() {
|
|
234
|
+
let deferred1_0;
|
|
235
|
+
let deferred1_1;
|
|
236
|
+
try {
|
|
237
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
238
|
+
wasm.wasmpreparedcomponent_description(retptr, this.__wbg_ptr);
|
|
239
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
240
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
241
|
+
deferred1_0 = r0;
|
|
242
|
+
deferred1_1 = r1;
|
|
243
|
+
return getStringFromWasm0(r0, r1);
|
|
244
|
+
} finally {
|
|
245
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
246
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* The lowercase hexadecimal SHA-256 digest that selected the adapter.
|
|
251
|
+
* @returns {string}
|
|
252
|
+
*/
|
|
253
|
+
digest() {
|
|
254
|
+
let deferred1_0;
|
|
255
|
+
let deferred1_1;
|
|
256
|
+
try {
|
|
257
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
258
|
+
wasm.wasmpreparedcomponent_digest(retptr, this.__wbg_ptr);
|
|
259
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
260
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
261
|
+
deferred1_0 = r0;
|
|
262
|
+
deferred1_1 = r1;
|
|
263
|
+
return getStringFromWasm0(r0, r1);
|
|
264
|
+
} finally {
|
|
265
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
266
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Declared hooks and their composition (`series`, `waterfall`, `bail`), as a JSON object.
|
|
271
|
+
* @returns {string}
|
|
272
|
+
*/
|
|
273
|
+
hooks() {
|
|
274
|
+
let deferred1_0;
|
|
275
|
+
let deferred1_1;
|
|
276
|
+
try {
|
|
277
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
278
|
+
wasm.wasmpreparedcomponent_hooks(retptr, this.__wbg_ptr);
|
|
279
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
280
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
281
|
+
deferred1_0 = r0;
|
|
282
|
+
deferred1_1 = r1;
|
|
283
|
+
return getStringFromWasm0(r0, r1);
|
|
284
|
+
} finally {
|
|
285
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
286
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Hash `bytes` and decode their metadata only when the digest is one of `digests`, the
|
|
291
|
+
* SHA-256 digests of the application's registered prepared adapters.
|
|
292
|
+
* @param {Uint8Array} bytes
|
|
293
|
+
* @param {string[]} digests
|
|
294
|
+
*/
|
|
295
|
+
constructor(bytes, digests) {
|
|
296
|
+
try {
|
|
297
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
298
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
299
|
+
const len0 = WASM_VECTOR_LEN;
|
|
300
|
+
const ptr1 = passArrayJsValueToWasm0(digests, wasm.__wbindgen_export);
|
|
301
|
+
const len1 = WASM_VECTOR_LEN;
|
|
302
|
+
wasm.wasmpreparedcomponent_new(retptr, ptr0, len0, ptr1, len1);
|
|
303
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
304
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
305
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
306
|
+
if (r2) {
|
|
307
|
+
throw takeObject(r1);
|
|
308
|
+
}
|
|
309
|
+
this.__wbg_ptr = r0;
|
|
310
|
+
WasmPreparedComponentFinalization.register(this, this.__wbg_ptr, this);
|
|
311
|
+
return this;
|
|
312
|
+
} finally {
|
|
313
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Answer the typed install-time queries: `install`, `implementation` and `describe`.
|
|
318
|
+
* @param {string} packet
|
|
319
|
+
* @returns {string}
|
|
320
|
+
*/
|
|
321
|
+
request(packet) {
|
|
322
|
+
let deferred2_0;
|
|
323
|
+
let deferred2_1;
|
|
324
|
+
try {
|
|
325
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
326
|
+
const ptr0 = passStringToWasm0(packet, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
327
|
+
const len0 = WASM_VECTOR_LEN;
|
|
328
|
+
wasm.wasmpreparedcomponent_request(retptr, this.__wbg_ptr, ptr0, len0);
|
|
329
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
330
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
331
|
+
deferred2_0 = r0;
|
|
332
|
+
deferred2_1 = r1;
|
|
333
|
+
return getStringFromWasm0(r0, r1);
|
|
334
|
+
} finally {
|
|
335
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
336
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Service policies (`lifetime`, `linger_ms`) by exported interface, as a JSON object.
|
|
341
|
+
* @returns {string}
|
|
342
|
+
*/
|
|
343
|
+
services() {
|
|
344
|
+
let deferred1_0;
|
|
345
|
+
let deferred1_1;
|
|
346
|
+
try {
|
|
347
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
348
|
+
wasm.wasmpreparedcomponent_services(retptr, this.__wbg_ptr);
|
|
349
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
350
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
351
|
+
deferred1_0 = r0;
|
|
352
|
+
deferred1_1 = r1;
|
|
353
|
+
return getStringFromWasm0(r0, r1);
|
|
354
|
+
} finally {
|
|
355
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
356
|
+
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Validate a JSON argument tuple or result through a bound slot; returns the ok/error envelope.
|
|
361
|
+
* @param {number} slot
|
|
362
|
+
* @param {boolean} _arguments
|
|
363
|
+
* @param {string} value
|
|
364
|
+
* @returns {string}
|
|
365
|
+
*/
|
|
366
|
+
validate(slot, _arguments, value) {
|
|
367
|
+
let deferred2_0;
|
|
368
|
+
let deferred2_1;
|
|
369
|
+
try {
|
|
370
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
371
|
+
const ptr0 = passStringToWasm0(value, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
372
|
+
const len0 = WASM_VECTOR_LEN;
|
|
373
|
+
wasm.wasmpreparedcomponent_validate(retptr, this.__wbg_ptr, slot, _arguments, ptr0, len0);
|
|
374
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
375
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
376
|
+
deferred2_0 = r0;
|
|
377
|
+
deferred2_1 = r1;
|
|
378
|
+
return getStringFromWasm0(r0, r1);
|
|
379
|
+
} finally {
|
|
380
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
381
|
+
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
if (Symbol.dispose) WasmPreparedComponent.prototype[Symbol.dispose] = WasmPreparedComponent.prototype.free;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Whether `bytes` claim a compiled component (Orb metadata without a source bundle).
|
|
389
|
+
*
|
|
390
|
+
* A cheap container scan that selects the browser execution path; it grants nothing.
|
|
391
|
+
* @param {Uint8Array} bytes
|
|
392
|
+
* @returns {boolean}
|
|
393
|
+
*/
|
|
394
|
+
export function compiledArtifact(bytes) {
|
|
395
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
396
|
+
const len0 = WASM_VECTOR_LEN;
|
|
397
|
+
const ret = wasm.compiledArtifact(ptr0, len0);
|
|
398
|
+
return ret !== 0;
|
|
399
|
+
}
|
|
400
|
+
function __wbg_get_imports() {
|
|
401
|
+
const import0 = {
|
|
402
|
+
__proto__: null,
|
|
403
|
+
__wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
|
|
404
|
+
const obj = getObject(arg1);
|
|
405
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
406
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
407
|
+
var len1 = WASM_VECTOR_LEN;
|
|
408
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
409
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
410
|
+
},
|
|
411
|
+
__wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
|
|
412
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
413
|
+
},
|
|
414
|
+
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
415
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
416
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
417
|
+
return addHeapObject(ret);
|
|
418
|
+
},
|
|
419
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
420
|
+
takeObject(arg0);
|
|
421
|
+
},
|
|
422
|
+
};
|
|
423
|
+
return {
|
|
424
|
+
__proto__: null,
|
|
425
|
+
"./contracts_bg.js": import0,
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
const WasmArtifactFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
430
|
+
? { register: () => {}, unregister: () => {} }
|
|
431
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmartifact_free(ptr, 1));
|
|
432
|
+
const WasmPreparedComponentFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
433
|
+
? { register: () => {}, unregister: () => {} }
|
|
434
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmpreparedcomponent_free(ptr, 1));
|
|
435
|
+
|
|
436
|
+
function addHeapObject(obj) {
|
|
437
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
438
|
+
const idx = heap_next;
|
|
439
|
+
heap_next = heap[idx];
|
|
440
|
+
|
|
441
|
+
heap[idx] = obj;
|
|
442
|
+
return idx;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
function dropObject(idx) {
|
|
446
|
+
if (idx < 1028) return;
|
|
447
|
+
heap[idx] = heap_next;
|
|
448
|
+
heap_next = idx;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
let cachedDataViewMemory0 = null;
|
|
452
|
+
function getDataViewMemory0() {
|
|
453
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
454
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
455
|
+
}
|
|
456
|
+
return cachedDataViewMemory0;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function getStringFromWasm0(ptr, len) {
|
|
460
|
+
return decodeText(ptr >>> 0, len);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
let cachedUint8ArrayMemory0 = null;
|
|
464
|
+
function getUint8ArrayMemory0() {
|
|
465
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
466
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
467
|
+
}
|
|
468
|
+
return cachedUint8ArrayMemory0;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
function getObject(idx) { return heap[idx]; }
|
|
472
|
+
|
|
473
|
+
let heap = new Array(1024).fill(undefined);
|
|
474
|
+
heap.push(undefined, null, true, false);
|
|
475
|
+
|
|
476
|
+
let heap_next = heap.length;
|
|
477
|
+
|
|
478
|
+
function isLikeNone(x) {
|
|
479
|
+
return x === undefined || x === null;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
483
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
484
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
485
|
+
WASM_VECTOR_LEN = arg.length;
|
|
486
|
+
return ptr;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
490
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
491
|
+
const mem = getDataViewMemory0();
|
|
492
|
+
for (let i = 0; i < array.length; i++) {
|
|
493
|
+
mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
|
|
494
|
+
}
|
|
495
|
+
WASM_VECTOR_LEN = array.length;
|
|
496
|
+
return ptr;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
500
|
+
if (realloc === undefined) {
|
|
501
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
502
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
503
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
504
|
+
WASM_VECTOR_LEN = buf.length;
|
|
505
|
+
return ptr;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
let len = arg.length;
|
|
509
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
510
|
+
|
|
511
|
+
const mem = getUint8ArrayMemory0();
|
|
512
|
+
|
|
513
|
+
let offset = 0;
|
|
514
|
+
|
|
515
|
+
for (; offset < len; offset++) {
|
|
516
|
+
const code = arg.charCodeAt(offset);
|
|
517
|
+
if (code > 0x7F) break;
|
|
518
|
+
mem[ptr + offset] = code;
|
|
519
|
+
}
|
|
520
|
+
if (offset !== len) {
|
|
521
|
+
if (offset !== 0) {
|
|
522
|
+
arg = arg.slice(offset);
|
|
523
|
+
}
|
|
524
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
525
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
526
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
527
|
+
|
|
528
|
+
offset += ret.written;
|
|
529
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
WASM_VECTOR_LEN = offset;
|
|
533
|
+
return ptr;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function takeObject(idx) {
|
|
537
|
+
const ret = getObject(idx);
|
|
538
|
+
dropObject(idx);
|
|
539
|
+
return ret;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
543
|
+
cachedTextDecoder.decode();
|
|
544
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
545
|
+
let numBytesDecoded = 0;
|
|
546
|
+
function decodeText(ptr, len) {
|
|
547
|
+
numBytesDecoded += len;
|
|
548
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
549
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
550
|
+
cachedTextDecoder.decode();
|
|
551
|
+
numBytesDecoded = len;
|
|
552
|
+
}
|
|
553
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
const cachedTextEncoder = new TextEncoder();
|
|
557
|
+
|
|
558
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
559
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
560
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
561
|
+
view.set(buf);
|
|
562
|
+
return {
|
|
563
|
+
read: arg.length,
|
|
564
|
+
written: buf.length
|
|
565
|
+
};
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
let WASM_VECTOR_LEN = 0;
|
|
570
|
+
|
|
571
|
+
let wasmModule, wasmInstance, wasm;
|
|
572
|
+
function __wbg_finalize_init(instance, module) {
|
|
573
|
+
wasmInstance = instance;
|
|
574
|
+
wasm = instance.exports;
|
|
575
|
+
wasmModule = module;
|
|
576
|
+
cachedDataViewMemory0 = null;
|
|
577
|
+
cachedUint8ArrayMemory0 = null;
|
|
578
|
+
return wasm;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
async function __wbg_load(module, imports) {
|
|
582
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
583
|
+
if (!module.ok) {
|
|
584
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
588
|
+
try {
|
|
589
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
590
|
+
} catch (e) {
|
|
591
|
+
const validResponse = expectedResponseType(module.type);
|
|
592
|
+
|
|
593
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
594
|
+
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);
|
|
595
|
+
|
|
596
|
+
} else { throw e; }
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
const bytes = await module.arrayBuffer();
|
|
601
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
602
|
+
} else {
|
|
603
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
604
|
+
|
|
605
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
606
|
+
return { instance, module };
|
|
607
|
+
} else {
|
|
608
|
+
return instance;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
function expectedResponseType(type) {
|
|
613
|
+
switch (type) {
|
|
614
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
615
|
+
}
|
|
616
|
+
return false;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
function initSync(module) {
|
|
621
|
+
if (wasm !== undefined) return wasm;
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
if (module !== undefined) {
|
|
625
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
626
|
+
({module} = module)
|
|
627
|
+
} else {
|
|
628
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
const imports = __wbg_get_imports();
|
|
633
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
634
|
+
module = new WebAssembly.Module(module);
|
|
635
|
+
}
|
|
636
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
637
|
+
return __wbg_finalize_init(instance, module);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
async function __wbg_init(module_or_path) {
|
|
641
|
+
if (wasm !== undefined) return wasm;
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
if (module_or_path !== undefined) {
|
|
645
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
646
|
+
({module_or_path} = module_or_path)
|
|
647
|
+
} else {
|
|
648
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
if (module_or_path === undefined) {
|
|
653
|
+
module_or_path = new URL('contracts_bg.wasm', import.meta.url);
|
|
654
|
+
}
|
|
655
|
+
const imports = __wbg_get_imports();
|
|
656
|
+
|
|
657
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
658
|
+
module_or_path = fetch(module_or_path);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
662
|
+
|
|
663
|
+
return __wbg_finalize_init(instance, module);
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_wasmartifact_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_wasmpreparedcomponent_free: (a: number, b: number) => void;
|
|
6
|
+
export const compiledArtifact: (a: number, b: number) => number;
|
|
7
|
+
export const wasmartifact_bind: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
8
|
+
export const wasmartifact_description: (a: number, b: number) => void;
|
|
9
|
+
export const wasmartifact_new: (a: number, b: number, c: number) => void;
|
|
10
|
+
export const wasmartifact_request: (a: number, b: number, c: number, d: number) => void;
|
|
11
|
+
export const wasmartifact_source: (a: number, b: number) => void;
|
|
12
|
+
export const wasmartifact_validate: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
13
|
+
export const wasmpreparedcomponent_bind: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
14
|
+
export const wasmpreparedcomponent_contributions: (a: number, b: number) => void;
|
|
15
|
+
export const wasmpreparedcomponent_description: (a: number, b: number) => void;
|
|
16
|
+
export const wasmpreparedcomponent_digest: (a: number, b: number) => void;
|
|
17
|
+
export const wasmpreparedcomponent_hooks: (a: number, b: number) => void;
|
|
18
|
+
export const wasmpreparedcomponent_new: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
19
|
+
export const wasmpreparedcomponent_request: (a: number, b: number, c: number, d: number) => void;
|
|
20
|
+
export const wasmpreparedcomponent_services: (a: number, b: number) => void;
|
|
21
|
+
export const wasmpreparedcomponent_validate: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
22
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
23
|
+
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
24
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
25
|
+
export const __wbindgen_export3: (a: number, b: number, c: number) => void;
|
|
Binary file
|