@oona/vlo 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1,382 @@
1
+ /* @ts-self-types="./vlo_kernel.d.ts" */
2
+
3
+ /**
4
+ * Hash `(kernel_state, state)`; input `StateHashInput`, value `StateHashOutput`.
5
+ * @param {string} input
6
+ * @returns {string}
7
+ */
8
+ export function compute_state_hash(input) {
9
+ let deferred2_0;
10
+ let deferred2_1;
11
+ try {
12
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
13
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
14
+ const len0 = WASM_VECTOR_LEN;
15
+ wasm.compute_state_hash(retptr, ptr0, len0);
16
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
17
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
18
+ deferred2_0 = r0;
19
+ deferred2_1 = r1;
20
+ return getStringFromWasm0(r0, r1);
21
+ } finally {
22
+ wasm.__wbindgen_add_to_stack_pointer(16);
23
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
24
+ }
25
+ }
26
+
27
+ /**
28
+ * Derive `task_id`, `idempotency_key` and `child_run_id`; input `DeriveIdsInput`, value `DeriveIdsOutput`.
29
+ * @param {string} input
30
+ * @returns {string}
31
+ */
32
+ export function derive_ids(input) {
33
+ let deferred2_0;
34
+ let deferred2_1;
35
+ try {
36
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
37
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
38
+ const len0 = WASM_VECTOR_LEN;
39
+ wasm.derive_ids(retptr, ptr0, len0);
40
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
41
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
42
+ deferred2_0 = r0;
43
+ deferred2_1 = r1;
44
+ return getStringFromWasm0(r0, r1);
45
+ } finally {
46
+ wasm.__wbindgen_add_to_stack_pointer(16);
47
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Kernel crate version, protocol version and feature list.
53
+ * @returns {string}
54
+ */
55
+ export function kernel_version() {
56
+ let deferred1_0;
57
+ let deferred1_1;
58
+ try {
59
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
60
+ wasm.kernel_version(retptr);
61
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
62
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
63
+ deferred1_0 = r0;
64
+ deferred1_1 = r1;
65
+ return getStringFromWasm0(r0, r1);
66
+ } finally {
67
+ wasm.__wbindgen_add_to_stack_pointer(16);
68
+ wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Plan the next attempt from policy, cause and journaled `random`; input `PlanRetryInput`, value `RetryPlan`.
74
+ * @param {string} input
75
+ * @returns {string}
76
+ */
77
+ export function plan_retry(input) {
78
+ let deferred2_0;
79
+ let deferred2_1;
80
+ try {
81
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
82
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
83
+ const len0 = WASM_VECTOR_LEN;
84
+ wasm.plan_retry(retptr, ptr0, len0);
85
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
86
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
87
+ deferred2_0 = r0;
88
+ deferred2_1 = r1;
89
+ return getStringFromWasm0(r0, r1);
90
+ } finally {
91
+ wasm.__wbindgen_add_to_stack_pointer(16);
92
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
93
+ }
94
+ }
95
+
96
+ /**
97
+ * Classify an event into a reducer call or a lifecycle write-set; input `PrepareEventInput`, value `Prepared`.
98
+ * @param {string} input
99
+ * @returns {string}
100
+ */
101
+ export function prepare_event(input) {
102
+ let deferred2_0;
103
+ let deferred2_1;
104
+ try {
105
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
106
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
107
+ const len0 = WASM_VECTOR_LEN;
108
+ wasm.prepare_event(retptr, ptr0, len0);
109
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
110
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
111
+ deferred2_0 = r0;
112
+ deferred2_1 = r1;
113
+ return getStringFromWasm0(r0, r1);
114
+ } finally {
115
+ wasm.__wbindgen_add_to_stack_pointer(16);
116
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
117
+ }
118
+ }
119
+
120
+ /**
121
+ * Turn a reducer's `(state, commands)` into the write-set; input `ReduceStepInput`, value `Transition`.
122
+ * @param {string} input
123
+ * @returns {string}
124
+ */
125
+ export function reduce_step(input) {
126
+ let deferred2_0;
127
+ let deferred2_1;
128
+ try {
129
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
130
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
131
+ const len0 = WASM_VECTOR_LEN;
132
+ wasm.reduce_step(retptr, ptr0, len0);
133
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
134
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
135
+ deferred2_0 = r0;
136
+ deferred2_1 = r1;
137
+ return getStringFromWasm0(r0, r1);
138
+ } finally {
139
+ wasm.__wbindgen_add_to_stack_pointer(16);
140
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
141
+ }
142
+ }
143
+
144
+ /**
145
+ * Find the first divergent `(seq, hash)` between journal and re-fold; input `RefoldCheckInput`, value `RefoldCheckOutput`.
146
+ * @param {string} input
147
+ * @returns {string}
148
+ */
149
+ export function refold_check(input) {
150
+ let deferred2_0;
151
+ let deferred2_1;
152
+ try {
153
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
154
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
155
+ const len0 = WASM_VECTOR_LEN;
156
+ wasm.refold_check(retptr, ptr0, len0);
157
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
158
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
159
+ deferred2_0 = r0;
160
+ deferred2_1 = r1;
161
+ return getStringFromWasm0(r0, r1);
162
+ } finally {
163
+ wasm.__wbindgen_add_to_stack_pointer(16);
164
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Field and enum checks on an event envelope; input `EventInput`, value `ValidateEventOutput`.
170
+ * @param {string} input
171
+ * @returns {string}
172
+ */
173
+ export function validate_event(input) {
174
+ let deferred2_0;
175
+ let deferred2_1;
176
+ try {
177
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
178
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
179
+ const len0 = WASM_VECTOR_LEN;
180
+ wasm.validate_event(retptr, ptr0, len0);
181
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
182
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
183
+ deferred2_0 = r0;
184
+ deferred2_1 = r1;
185
+ return getStringFromWasm0(r0, r1);
186
+ } finally {
187
+ wasm.__wbindgen_add_to_stack_pointer(16);
188
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
189
+ }
190
+ }
191
+ function __wbg_get_imports() {
192
+ const import0 = {
193
+ __proto__: null,
194
+ };
195
+ return {
196
+ __proto__: null,
197
+ "./vlo_kernel_bg.js": import0,
198
+ };
199
+ }
200
+
201
+ let cachedDataViewMemory0 = null;
202
+ function getDataViewMemory0() {
203
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
204
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
205
+ }
206
+ return cachedDataViewMemory0;
207
+ }
208
+
209
+ function getStringFromWasm0(ptr, len) {
210
+ return decodeText(ptr >>> 0, len);
211
+ }
212
+
213
+ let cachedUint8ArrayMemory0 = null;
214
+ function getUint8ArrayMemory0() {
215
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
216
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
217
+ }
218
+ return cachedUint8ArrayMemory0;
219
+ }
220
+
221
+ function passStringToWasm0(arg, malloc, realloc) {
222
+ if (realloc === undefined) {
223
+ const buf = cachedTextEncoder.encode(arg);
224
+ const ptr = malloc(buf.length, 1) >>> 0;
225
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
226
+ WASM_VECTOR_LEN = buf.length;
227
+ return ptr;
228
+ }
229
+
230
+ let len = arg.length;
231
+ let ptr = malloc(len, 1) >>> 0;
232
+
233
+ const mem = getUint8ArrayMemory0();
234
+
235
+ let offset = 0;
236
+
237
+ for (; offset < len; offset++) {
238
+ const code = arg.charCodeAt(offset);
239
+ if (code > 0x7F) break;
240
+ mem[ptr + offset] = code;
241
+ }
242
+ if (offset !== len) {
243
+ if (offset !== 0) {
244
+ arg = arg.slice(offset);
245
+ }
246
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
247
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
248
+ const ret = cachedTextEncoder.encodeInto(arg, view);
249
+
250
+ offset += ret.written;
251
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
252
+ }
253
+
254
+ WASM_VECTOR_LEN = offset;
255
+ return ptr;
256
+ }
257
+
258
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
259
+ cachedTextDecoder.decode();
260
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
261
+ let numBytesDecoded = 0;
262
+ function decodeText(ptr, len) {
263
+ numBytesDecoded += len;
264
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
265
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
266
+ cachedTextDecoder.decode();
267
+ numBytesDecoded = len;
268
+ }
269
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
270
+ }
271
+
272
+ const cachedTextEncoder = new TextEncoder();
273
+
274
+ if (!('encodeInto' in cachedTextEncoder)) {
275
+ cachedTextEncoder.encodeInto = function (arg, view) {
276
+ const buf = cachedTextEncoder.encode(arg);
277
+ view.set(buf);
278
+ return {
279
+ read: arg.length,
280
+ written: buf.length
281
+ };
282
+ };
283
+ }
284
+
285
+ let WASM_VECTOR_LEN = 0;
286
+
287
+ let wasmModule, wasmInstance, wasm;
288
+ function __wbg_finalize_init(instance, module) {
289
+ wasmInstance = instance;
290
+ wasm = instance.exports;
291
+ wasmModule = module;
292
+ cachedDataViewMemory0 = null;
293
+ cachedUint8ArrayMemory0 = null;
294
+ return wasm;
295
+ }
296
+
297
+ async function __wbg_load(module, imports) {
298
+ if (typeof Response === 'function' && module instanceof Response) {
299
+ if (!module.ok) {
300
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
301
+ }
302
+
303
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
304
+ try {
305
+ return await WebAssembly.instantiateStreaming(module, imports);
306
+ } catch (e) {
307
+ const validResponse = expectedResponseType(module.type);
308
+
309
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
310
+ 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);
311
+
312
+ } else { throw e; }
313
+ }
314
+ }
315
+
316
+ const bytes = await module.arrayBuffer();
317
+ return await WebAssembly.instantiate(bytes, imports);
318
+ } else {
319
+ const instance = await WebAssembly.instantiate(module, imports);
320
+
321
+ if (instance instanceof WebAssembly.Instance) {
322
+ return { instance, module };
323
+ } else {
324
+ return instance;
325
+ }
326
+ }
327
+
328
+ function expectedResponseType(type) {
329
+ switch (type) {
330
+ case 'basic': case 'cors': case 'default': return true;
331
+ }
332
+ return false;
333
+ }
334
+ }
335
+
336
+ function initSync(module) {
337
+ if (wasm !== undefined) return wasm;
338
+
339
+
340
+ if (module !== undefined) {
341
+ if (Object.getPrototypeOf(module) === Object.prototype) {
342
+ ({module} = module)
343
+ } else {
344
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
345
+ }
346
+ }
347
+
348
+ const imports = __wbg_get_imports();
349
+ if (!(module instanceof WebAssembly.Module)) {
350
+ module = new WebAssembly.Module(module);
351
+ }
352
+ const instance = new WebAssembly.Instance(module, imports);
353
+ return __wbg_finalize_init(instance, module);
354
+ }
355
+
356
+ async function __wbg_init(module_or_path) {
357
+ if (wasm !== undefined) return wasm;
358
+
359
+
360
+ if (module_or_path !== undefined) {
361
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
362
+ ({module_or_path} = module_or_path)
363
+ } else {
364
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
365
+ }
366
+ }
367
+
368
+ if (module_or_path === undefined) {
369
+ module_or_path = new URL('vlo_kernel_bg.wasm', import.meta.url);
370
+ }
371
+ const imports = __wbg_get_imports();
372
+
373
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
374
+ module_or_path = fetch(module_or_path);
375
+ }
376
+
377
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
378
+
379
+ return __wbg_finalize_init(instance, module);
380
+ }
381
+
382
+ export { initSync, __wbg_init as default };
Binary file
@@ -0,0 +1,15 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const compute_state_hash: (a: number, b: number, c: number) => void;
5
+ export const derive_ids: (a: number, b: number, c: number) => void;
6
+ export const kernel_version: (a: number) => void;
7
+ export const plan_retry: (a: number, b: number, c: number) => void;
8
+ export const prepare_event: (a: number, b: number, c: number) => void;
9
+ export const reduce_step: (a: number, b: number, c: number) => void;
10
+ export const refold_check: (a: number, b: number, c: number) => void;
11
+ export const validate_event: (a: number, b: number, c: number) => void;
12
+ export const __wbindgen_add_to_stack_pointer: (a: number) => number;
13
+ export const __wbindgen_export: (a: number, b: number) => number;
14
+ export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
15
+ export const __wbindgen_export3: (a: number, b: number, c: number) => void;