@opengeni/artifact-kernel-wasm-spreadsheet 0.2.8 → 0.3.4-canary.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.
@@ -5,56 +5,56 @@
5
5
  "target": "wasm-web",
6
6
  "modality": "spreadsheet",
7
7
  "packageName": "@opengeni/artifact-kernel-wasm-spreadsheet",
8
- "packageVersion": "0.2.8",
9
- "artifactToolVersion": "0.2.8",
10
- "buildIdentity": "opengeni-artifact-kernel/0.1.0;abi=1;command=1;query=1;snapshot=1;document-snapshot=1;document-command=1;document-query=1;presentation-snapshot=1;presentation-command=1;presentation-query=1;text-layout-fonts=1;text-layout-request=1;text-layout-response=1;render-tile=1;render-patch=1;source=a9194d659991a0910e6f9f47510670b2857b927c2a1b818b13cf480521a986dd;toolchain=1367261bf04dd2fc4b2c6aa0ef397c21659ee1c973a9d98dcb8d84b46d68b06f",
11
- "kernelVersion": "opengeni-artifact-kernel/0.1.0;abi=1;command=1;query=1;snapshot=1;document-snapshot=1;document-command=1;document-query=1;presentation-snapshot=1;presentation-command=1;presentation-query=1;text-layout-fonts=1;text-layout-request=1;text-layout-response=1;render-tile=1;render-patch=1;source=a9194d659991a0910e6f9f47510670b2857b927c2a1b818b13cf480521a986dd;toolchain=1367261bf04dd2fc4b2c6aa0ef397c21659ee1c973a9d98dcb8d84b46d68b06f",
8
+ "packageVersion": "0.3.4-canary.0",
9
+ "artifactToolVersion": "0.3.4-canary.0",
10
+ "buildIdentity": "opengeni-artifact-kernel/0.1.0;abi=1;command=2;query=1;snapshot=2;collaboration-snapshot=2;committed-transaction=2;spreadsheet-model=2;document-snapshot=1;document-command=1;document-query=1;presentation-snapshot=1;presentation-command=1;presentation-query=1;text-layout-fonts=1;text-layout-request=1;text-layout-response=1;render-tile=1;render-patch=1;source=c6212bc4b63a1fbd2b974a06d87f2a1f3ddf24466d19940d5025fd128950bce1;toolchain=1367261bf04dd2fc4b2c6aa0ef397c21659ee1c973a9d98dcb8d84b46d68b06f",
11
+ "kernelVersion": "opengeni-artifact-kernel/0.1.0;abi=1;command=2;query=1;snapshot=2;collaboration-snapshot=2;committed-transaction=2;spreadsheet-model=2;document-snapshot=1;document-command=1;document-query=1;presentation-snapshot=1;presentation-command=1;presentation-query=1;text-layout-fonts=1;text-layout-request=1;text-layout-response=1;render-tile=1;render-patch=1;source=c6212bc4b63a1fbd2b974a06d87f2a1f3ddf24466d19940d5025fd128950bce1;toolchain=1367261bf04dd2fc4b2c6aa0ef397c21659ee1c973a9d98dcb8d84b46d68b06f",
12
12
  "abiVersion": 1,
13
13
  "protocolVersion": 1,
14
- "modelSchemaVersion": 1,
15
- "commandVersion": 1
14
+ "modelSchemaVersion": 2,
15
+ "commandVersion": 2
16
16
  },
17
17
  "capabilities": {
18
- "bytes": 1860,
19
- "sha256": "sha256:2cf756ab9078f337b58f299f1ebd79512540b4e44234482c52b56a9231039903"
18
+ "bytes": 1894,
19
+ "sha256": "sha256:772fd1b63dbb9ead2eadba2431c7fc71c172f8ce46abc5e89afef5a785c27de7"
20
20
  },
21
21
  "sizeBudget": {
22
22
  "wasmBytes": 786432,
23
23
  "wasmGzipBytes": 245760,
24
- "glueBytes": 32768
24
+ "glueBytes": 36864
25
25
  },
26
26
  "files": [
27
27
  {
28
28
  "path": "artifact_kernel_spreadsheet_bg.wasm",
29
- "bytes": 644645,
30
- "sha256": "sha256:7284d5161966ae59170a2a738f81c50cb8e455ad55953b032e706443314bd84b",
31
- "gzipBytes": 205911
29
+ "bytes": 733636,
30
+ "sha256": "sha256:060287f1df208439bfa9d43b5de4568a969ed9650d87829a2a979198f4037dd8",
31
+ "gzipBytes": 229815
32
32
  },
33
33
  {
34
34
  "path": "artifact_kernel_spreadsheet_bg.wasm.d.ts",
35
- "bytes": 1738,
36
- "sha256": "sha256:173077b78f0f6d2c8a18a3bdf60acbfb2b99e28c894c9fe1193658c8a22625de"
35
+ "bytes": 3016,
36
+ "sha256": "sha256:16c8af7ffd2ae2b1a17f032b497607995408f421137ffef734d52b39b1e6bc75"
37
37
  },
38
38
  {
39
39
  "path": "artifact_kernel_spreadsheet.d.ts",
40
- "bytes": 5125,
41
- "sha256": "sha256:ccaed56b6a80551a55fc73410f0022a75e238f1c9650b63c331b861ceaa82076"
40
+ "bytes": 9574,
41
+ "sha256": "sha256:feefc4a7f3937e8fc54c8046d96abdcc5d35c5fa45d82fdac8999152e1f836e7"
42
42
  },
43
43
  {
44
44
  "path": "artifact_kernel_spreadsheet.js",
45
- "bytes": 19333,
46
- "sha256": "sha256:473ddbd6869475a33e30b395055c41a7f36f7153ccb035c0de037106d96359ce",
47
- "gzipBytes": 3529
45
+ "bytes": 33434,
46
+ "sha256": "sha256:ad287e1944b64347d4a196fa554d5b941d2f771c1ffae7c09be3a2ef0d12a0c4",
47
+ "gzipBytes": 4606
48
48
  },
49
49
  {
50
50
  "path": "index.d.ts",
51
- "bytes": 2304,
52
- "sha256": "sha256:149f4a5e363f3b44b1870369cc1cbd630c9ead1337beead0b0a39e46f8d17c81"
51
+ "bytes": 2529,
52
+ "sha256": "sha256:44726b8a8191991cbb0048071e9d62ef14aaf6b96490efdca2799723adac4d69"
53
53
  },
54
54
  {
55
55
  "path": "index.js",
56
- "bytes": 2261,
57
- "sha256": "sha256:9f476eb3295c6087e84bed5be7e2e8f08286b65f5cde6e2139263512c437d459"
56
+ "bytes": 2417,
57
+ "sha256": "sha256:fb8b494a5d574d4a88f81a54b0ada2d8083a575b3789f77c573b63f20c99f9d0"
58
58
  }
59
59
  ]
60
60
  }
@@ -41,7 +41,7 @@ export class ArtifactCollaborationSession {
41
41
  */
42
42
  isClosed(): boolean;
43
43
  /**
44
- * Opens one canonical OGACRD01 full-state snapshot.
44
+ * Opens one canonical OGACRD02 full-state snapshot.
45
45
  */
46
46
  static open(snapshot: Uint8Array): ArtifactCollaborationSession;
47
47
  /**
@@ -53,15 +53,88 @@ export class ArtifactCollaborationSession {
53
53
  */
54
54
  revision(): bigint;
55
55
  /**
56
- * Returns the full canonical OGACRD01 snapshot.
56
+ * Returns the full canonical OGACRD02 snapshot.
57
57
  */
58
58
  snapshot(): Uint8Array;
59
59
  /**
60
- * Returns SHA-256 of the exact canonical OGACRD01 snapshot.
60
+ * Returns SHA-256 of the exact canonical OGACRD02 snapshot.
61
61
  */
62
62
  stateHash(): string;
63
63
  }
64
64
 
65
+ /**
66
+ * Stateful, in-memory kernel handle for interactive editing.
67
+ *
68
+ * A session validates/decodes once, applies many command envelopes directly
69
+ * to the in-memory model, and serializes only when `snapshot()` is requested.
70
+ * It remains synchronous so one Web Worker observes mutations in program
71
+ * order without locks or asynchronous re-entrancy.
72
+ */
73
+ export class ArtifactKernelSession {
74
+ private constructor();
75
+ free(): void;
76
+ [Symbol.dispose](): void;
77
+ /**
78
+ * Atomically applies a command envelope and returns its canonical receipt.
79
+ */
80
+ applyCommands(command_envelope: Uint8Array): Uint8Array;
81
+ /**
82
+ * Releases the in-memory workbook while retaining a closed JS handle.
83
+ *
84
+ * Calling this method repeatedly is safe. Further model operations return
85
+ * the stable `ARTIFACT_SESSION_CLOSED` protocol error.
86
+ */
87
+ close(): void;
88
+ /**
89
+ * Creates an empty in-memory workbook from a canonical namespace envelope.
90
+ */
91
+ static create(namespace_envelope: Uint8Array): ArtifactKernelSession;
92
+ /**
93
+ * Idempotent lifecycle alias for `close()`.
94
+ *
95
+ * JavaScript may call `free()` afterward to release the small Wasm handle
96
+ * itself; generated explicit-resource-management support does that
97
+ * automatically for `using` declarations.
98
+ */
99
+ dispose(): void;
100
+ /**
101
+ * Creates an independent in-memory branch without snapshot round trips.
102
+ */
103
+ fork(): ArtifactKernelSession;
104
+ /**
105
+ * Reports whether the workbook state has already been released.
106
+ */
107
+ isClosed(): boolean;
108
+ /**
109
+ * Opens and validates one canonical snapshot into memory.
110
+ */
111
+ static open(snapshot: Uint8Array): ArtifactKernelSession;
112
+ /**
113
+ * Executes one bounded viewport or workbook-metadata projection.
114
+ */
115
+ query(query_envelope: Uint8Array): Uint8Array;
116
+ /**
117
+ * Returns the current workbook revision as a JavaScript `bigint`.
118
+ */
119
+ revision(): bigint;
120
+ /**
121
+ * Serializes the current workbook as a canonical snapshot.
122
+ */
123
+ snapshot(): Uint8Array;
124
+ /**
125
+ * Returns SHA-256 of the exact canonical snapshot as lowercase text.
126
+ */
127
+ stateHash(): string;
128
+ }
129
+
130
+ /**
131
+ * Atomically applies an encoded command batch to a canonical snapshot.
132
+ *
133
+ * Neither input is mutated. A rejected command leaves the supplied snapshot
134
+ * untouched and is surfaced as a JavaScript `Error`.
135
+ */
136
+ export function applyCommands(snapshot: Uint8Array, command_envelope: Uint8Array): Uint8Array;
137
+
65
138
  /**
66
139
  * Returns the canonical encoded build-identity envelope.
67
140
  *
@@ -71,10 +144,15 @@ export class ArtifactCollaborationSession {
71
144
  export function buildIdentity(): Uint8Array;
72
145
 
73
146
  /**
74
- * Strictly validates and re-encodes a full OGACRD01 collaboration snapshot.
147
+ * Strictly validates and re-encodes a full OGACRD02 collaboration snapshot.
75
148
  */
76
149
  export function canonicalizeCollaborationSnapshot(snapshot: Uint8Array): Uint8Array;
77
150
 
151
+ /**
152
+ * Strictly validates and re-encodes a snapshot in canonical form.
153
+ */
154
+ export function canonicalizeSnapshot(snapshot: Uint8Array): Uint8Array;
155
+
78
156
  /**
79
157
  * Returns the canonical encoded capability envelope.
80
158
  *
@@ -83,11 +161,27 @@ export function canonicalizeCollaborationSnapshot(snapshot: Uint8Array): Uint8Ar
83
161
  */
84
162
  export function capabilities(): Uint8Array;
85
163
 
164
+ /**
165
+ * Creates a new workbook from an encoded replica namespace.
166
+ *
167
+ * On success JavaScript receives the workbook's canonical snapshot as a
168
+ * `Uint8Array`. Invalid or non-canonical inputs throw a JavaScript `Error`
169
+ * whose message retains the protocol's stable error code.
170
+ */
171
+ export function createWorkbook(namespace_envelope: Uint8Array): Uint8Array;
172
+
173
+ /**
174
+ * Executes one bounded OGAKQ001 read against a canonical snapshot.
175
+ */
176
+ export function query(snapshot: Uint8Array, query_envelope: Uint8Array): Uint8Array;
177
+
86
178
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
87
179
 
88
180
  export interface InitOutput {
89
181
  readonly memory: WebAssembly.Memory;
90
182
  readonly __wbg_artifactcollaborationsession_free: (a: number, b: number) => void;
183
+ readonly __wbg_artifactkernelsession_free: (a: number, b: number) => void;
184
+ readonly applyCommands: (a: number, b: number, c: number, d: number, e: number) => void;
91
185
  readonly artifactcollaborationsession_applyCommitted: (a: number, b: number, c: number, d: number) => void;
92
186
  readonly artifactcollaborationsession_authorTransaction: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
93
187
  readonly artifactcollaborationsession_close: (a: number) => void;
@@ -100,9 +194,23 @@ export interface InitOutput {
100
194
  readonly artifactcollaborationsession_revision: (a: number, b: number) => void;
101
195
  readonly artifactcollaborationsession_snapshot: (a: number, b: number) => void;
102
196
  readonly artifactcollaborationsession_stateHash: (a: number, b: number) => void;
197
+ readonly artifactkernelsession_applyCommands: (a: number, b: number, c: number, d: number) => void;
198
+ readonly artifactkernelsession_close: (a: number) => void;
199
+ readonly artifactkernelsession_create: (a: number, b: number, c: number) => void;
200
+ readonly artifactkernelsession_fork: (a: number, b: number) => void;
201
+ readonly artifactkernelsession_isClosed: (a: number) => number;
202
+ readonly artifactkernelsession_open: (a: number, b: number, c: number) => void;
203
+ readonly artifactkernelsession_query: (a: number, b: number, c: number, d: number) => void;
204
+ readonly artifactkernelsession_revision: (a: number, b: number) => void;
205
+ readonly artifactkernelsession_snapshot: (a: number, b: number) => void;
206
+ readonly artifactkernelsession_stateHash: (a: number, b: number) => void;
103
207
  readonly buildIdentity: (a: number) => void;
104
208
  readonly canonicalizeCollaborationSnapshot: (a: number, b: number, c: number) => void;
209
+ readonly canonicalizeSnapshot: (a: number, b: number, c: number) => void;
105
210
  readonly capabilities: (a: number) => void;
211
+ readonly createWorkbook: (a: number, b: number, c: number) => void;
212
+ readonly query: (a: number, b: number, c: number, d: number, e: number) => void;
213
+ readonly artifactkernelsession_dispose: (a: number) => void;
106
214
  readonly artifactcollaborationsession_dispose: (a: number) => void;
107
215
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
108
216
  readonly __wbindgen_export: (a: number, b: number) => number;
@@ -151,7 +151,7 @@ export class ArtifactCollaborationSession {
151
151
  return ret !== 0;
152
152
  }
153
153
  /**
154
- * Opens one canonical OGACRD01 full-state snapshot.
154
+ * Opens one canonical OGACRD02 full-state snapshot.
155
155
  * @param {Uint8Array} snapshot
156
156
  * @returns {ArtifactCollaborationSession}
157
157
  */
@@ -217,7 +217,7 @@ export class ArtifactCollaborationSession {
217
217
  }
218
218
  }
219
219
  /**
220
- * Returns the full canonical OGACRD01 snapshot.
220
+ * Returns the full canonical OGACRD02 snapshot.
221
221
  * @returns {Uint8Array}
222
222
  */
223
223
  snapshot() {
@@ -239,7 +239,7 @@ export class ArtifactCollaborationSession {
239
239
  }
240
240
  }
241
241
  /**
242
- * Returns SHA-256 of the exact canonical OGACRD01 snapshot.
242
+ * Returns SHA-256 of the exact canonical OGACRD02 snapshot.
243
243
  * @returns {string}
244
244
  */
245
245
  stateHash() {
@@ -269,6 +269,275 @@ export class ArtifactCollaborationSession {
269
269
  }
270
270
  if (Symbol.dispose) ArtifactCollaborationSession.prototype[Symbol.dispose] = ArtifactCollaborationSession.prototype.free;
271
271
 
272
+ /**
273
+ * Stateful, in-memory kernel handle for interactive editing.
274
+ *
275
+ * A session validates/decodes once, applies many command envelopes directly
276
+ * to the in-memory model, and serializes only when `snapshot()` is requested.
277
+ * It remains synchronous so one Web Worker observes mutations in program
278
+ * order without locks or asynchronous re-entrancy.
279
+ */
280
+ export class ArtifactKernelSession {
281
+ static __wrap(ptr) {
282
+ const obj = Object.create(ArtifactKernelSession.prototype);
283
+ obj.__wbg_ptr = ptr;
284
+ ArtifactKernelSessionFinalization.register(obj, obj.__wbg_ptr, obj);
285
+ return obj;
286
+ }
287
+ __destroy_into_raw() {
288
+ const ptr = this.__wbg_ptr;
289
+ this.__wbg_ptr = 0;
290
+ ArtifactKernelSessionFinalization.unregister(this);
291
+ return ptr;
292
+ }
293
+ free() {
294
+ const ptr = this.__destroy_into_raw();
295
+ wasm.__wbg_artifactkernelsession_free(ptr, 0);
296
+ }
297
+ /**
298
+ * Atomically applies a command envelope and returns its canonical receipt.
299
+ * @param {Uint8Array} command_envelope
300
+ * @returns {Uint8Array}
301
+ */
302
+ applyCommands(command_envelope) {
303
+ try {
304
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
305
+ const ptr0 = passArray8ToWasm0(command_envelope, wasm.__wbindgen_export);
306
+ const len0 = WASM_VECTOR_LEN;
307
+ wasm.artifactkernelsession_applyCommands(retptr, this.__wbg_ptr, ptr0, len0);
308
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
309
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
310
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
311
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
312
+ if (r3) {
313
+ throw takeObject(r2);
314
+ }
315
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
316
+ wasm.__wbindgen_export2(r0, r1 * 1, 1);
317
+ return v2;
318
+ } finally {
319
+ wasm.__wbindgen_add_to_stack_pointer(16);
320
+ }
321
+ }
322
+ /**
323
+ * Releases the in-memory workbook while retaining a closed JS handle.
324
+ *
325
+ * Calling this method repeatedly is safe. Further model operations return
326
+ * the stable `ARTIFACT_SESSION_CLOSED` protocol error.
327
+ */
328
+ close() {
329
+ wasm.artifactkernelsession_close(this.__wbg_ptr);
330
+ }
331
+ /**
332
+ * Creates an empty in-memory workbook from a canonical namespace envelope.
333
+ * @param {Uint8Array} namespace_envelope
334
+ * @returns {ArtifactKernelSession}
335
+ */
336
+ static create(namespace_envelope) {
337
+ try {
338
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
339
+ const ptr0 = passArray8ToWasm0(namespace_envelope, wasm.__wbindgen_export);
340
+ const len0 = WASM_VECTOR_LEN;
341
+ wasm.artifactkernelsession_create(retptr, ptr0, len0);
342
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
343
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
344
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
345
+ if (r2) {
346
+ throw takeObject(r1);
347
+ }
348
+ return ArtifactKernelSession.__wrap(r0);
349
+ } finally {
350
+ wasm.__wbindgen_add_to_stack_pointer(16);
351
+ }
352
+ }
353
+ /**
354
+ * Idempotent lifecycle alias for `close()`.
355
+ *
356
+ * JavaScript may call `free()` afterward to release the small Wasm handle
357
+ * itself; generated explicit-resource-management support does that
358
+ * automatically for `using` declarations.
359
+ */
360
+ dispose() {
361
+ wasm.artifactkernelsession_dispose(this.__wbg_ptr);
362
+ }
363
+ /**
364
+ * Creates an independent in-memory branch without snapshot round trips.
365
+ * @returns {ArtifactKernelSession}
366
+ */
367
+ fork() {
368
+ try {
369
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
370
+ wasm.artifactkernelsession_fork(retptr, this.__wbg_ptr);
371
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
372
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
373
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
374
+ if (r2) {
375
+ throw takeObject(r1);
376
+ }
377
+ return ArtifactKernelSession.__wrap(r0);
378
+ } finally {
379
+ wasm.__wbindgen_add_to_stack_pointer(16);
380
+ }
381
+ }
382
+ /**
383
+ * Reports whether the workbook state has already been released.
384
+ * @returns {boolean}
385
+ */
386
+ isClosed() {
387
+ const ret = wasm.artifactkernelsession_isClosed(this.__wbg_ptr);
388
+ return ret !== 0;
389
+ }
390
+ /**
391
+ * Opens and validates one canonical snapshot into memory.
392
+ * @param {Uint8Array} snapshot
393
+ * @returns {ArtifactKernelSession}
394
+ */
395
+ static open(snapshot) {
396
+ try {
397
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
398
+ const ptr0 = passArray8ToWasm0(snapshot, wasm.__wbindgen_export);
399
+ const len0 = WASM_VECTOR_LEN;
400
+ wasm.artifactkernelsession_open(retptr, ptr0, len0);
401
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
402
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
403
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
404
+ if (r2) {
405
+ throw takeObject(r1);
406
+ }
407
+ return ArtifactKernelSession.__wrap(r0);
408
+ } finally {
409
+ wasm.__wbindgen_add_to_stack_pointer(16);
410
+ }
411
+ }
412
+ /**
413
+ * Executes one bounded viewport or workbook-metadata projection.
414
+ * @param {Uint8Array} query_envelope
415
+ * @returns {Uint8Array}
416
+ */
417
+ query(query_envelope) {
418
+ try {
419
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
420
+ const ptr0 = passArray8ToWasm0(query_envelope, wasm.__wbindgen_export);
421
+ const len0 = WASM_VECTOR_LEN;
422
+ wasm.artifactkernelsession_query(retptr, this.__wbg_ptr, ptr0, len0);
423
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
424
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
425
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
426
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
427
+ if (r3) {
428
+ throw takeObject(r2);
429
+ }
430
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
431
+ wasm.__wbindgen_export2(r0, r1 * 1, 1);
432
+ return v2;
433
+ } finally {
434
+ wasm.__wbindgen_add_to_stack_pointer(16);
435
+ }
436
+ }
437
+ /**
438
+ * Returns the current workbook revision as a JavaScript `bigint`.
439
+ * @returns {bigint}
440
+ */
441
+ revision() {
442
+ try {
443
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
444
+ wasm.artifactkernelsession_revision(retptr, this.__wbg_ptr);
445
+ var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
446
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
447
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
448
+ if (r3) {
449
+ throw takeObject(r2);
450
+ }
451
+ return BigInt.asUintN(64, r0);
452
+ } finally {
453
+ wasm.__wbindgen_add_to_stack_pointer(16);
454
+ }
455
+ }
456
+ /**
457
+ * Serializes the current workbook as a canonical snapshot.
458
+ * @returns {Uint8Array}
459
+ */
460
+ snapshot() {
461
+ try {
462
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
463
+ wasm.artifactkernelsession_snapshot(retptr, this.__wbg_ptr);
464
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
465
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
466
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
467
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
468
+ if (r3) {
469
+ throw takeObject(r2);
470
+ }
471
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
472
+ wasm.__wbindgen_export2(r0, r1 * 1, 1);
473
+ return v1;
474
+ } finally {
475
+ wasm.__wbindgen_add_to_stack_pointer(16);
476
+ }
477
+ }
478
+ /**
479
+ * Returns SHA-256 of the exact canonical snapshot as lowercase text.
480
+ * @returns {string}
481
+ */
482
+ stateHash() {
483
+ let deferred2_0;
484
+ let deferred2_1;
485
+ try {
486
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
487
+ wasm.artifactkernelsession_stateHash(retptr, this.__wbg_ptr);
488
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
489
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
490
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
491
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
492
+ var ptr1 = r0;
493
+ var len1 = r1;
494
+ if (r3) {
495
+ ptr1 = 0; len1 = 0;
496
+ throw takeObject(r2);
497
+ }
498
+ deferred2_0 = ptr1;
499
+ deferred2_1 = len1;
500
+ return getStringFromWasm0(ptr1, len1);
501
+ } finally {
502
+ wasm.__wbindgen_add_to_stack_pointer(16);
503
+ wasm.__wbindgen_export2(deferred2_0, deferred2_1, 1);
504
+ }
505
+ }
506
+ }
507
+ if (Symbol.dispose) ArtifactKernelSession.prototype[Symbol.dispose] = ArtifactKernelSession.prototype.free;
508
+
509
+ /**
510
+ * Atomically applies an encoded command batch to a canonical snapshot.
511
+ *
512
+ * Neither input is mutated. A rejected command leaves the supplied snapshot
513
+ * untouched and is surfaced as a JavaScript `Error`.
514
+ * @param {Uint8Array} snapshot
515
+ * @param {Uint8Array} command_envelope
516
+ * @returns {Uint8Array}
517
+ */
518
+ export function applyCommands(snapshot, command_envelope) {
519
+ try {
520
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
521
+ const ptr0 = passArray8ToWasm0(snapshot, wasm.__wbindgen_export);
522
+ const len0 = WASM_VECTOR_LEN;
523
+ const ptr1 = passArray8ToWasm0(command_envelope, wasm.__wbindgen_export);
524
+ const len1 = WASM_VECTOR_LEN;
525
+ wasm.applyCommands(retptr, ptr0, len0, ptr1, len1);
526
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
527
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
528
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
529
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
530
+ if (r3) {
531
+ throw takeObject(r2);
532
+ }
533
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
534
+ wasm.__wbindgen_export2(r0, r1 * 1, 1);
535
+ return v3;
536
+ } finally {
537
+ wasm.__wbindgen_add_to_stack_pointer(16);
538
+ }
539
+ }
540
+
272
541
  /**
273
542
  * Returns the canonical encoded build-identity envelope.
274
543
  *
@@ -291,7 +560,7 @@ export function buildIdentity() {
291
560
  }
292
561
 
293
562
  /**
294
- * Strictly validates and re-encodes a full OGACRD01 collaboration snapshot.
563
+ * Strictly validates and re-encodes a full OGACRD02 collaboration snapshot.
295
564
  * @param {Uint8Array} snapshot
296
565
  * @returns {Uint8Array}
297
566
  */
@@ -316,6 +585,32 @@ export function canonicalizeCollaborationSnapshot(snapshot) {
316
585
  }
317
586
  }
318
587
 
588
+ /**
589
+ * Strictly validates and re-encodes a snapshot in canonical form.
590
+ * @param {Uint8Array} snapshot
591
+ * @returns {Uint8Array}
592
+ */
593
+ export function canonicalizeSnapshot(snapshot) {
594
+ try {
595
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
596
+ const ptr0 = passArray8ToWasm0(snapshot, wasm.__wbindgen_export);
597
+ const len0 = WASM_VECTOR_LEN;
598
+ wasm.canonicalizeSnapshot(retptr, ptr0, len0);
599
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
600
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
601
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
602
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
603
+ if (r3) {
604
+ throw takeObject(r2);
605
+ }
606
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
607
+ wasm.__wbindgen_export2(r0, r1 * 1, 1);
608
+ return v2;
609
+ } finally {
610
+ wasm.__wbindgen_add_to_stack_pointer(16);
611
+ }
612
+ }
613
+
319
614
  /**
320
615
  * Returns the canonical encoded capability envelope.
321
616
  *
@@ -336,6 +631,65 @@ export function capabilities() {
336
631
  wasm.__wbindgen_add_to_stack_pointer(16);
337
632
  }
338
633
  }
634
+
635
+ /**
636
+ * Creates a new workbook from an encoded replica namespace.
637
+ *
638
+ * On success JavaScript receives the workbook's canonical snapshot as a
639
+ * `Uint8Array`. Invalid or non-canonical inputs throw a JavaScript `Error`
640
+ * whose message retains the protocol's stable error code.
641
+ * @param {Uint8Array} namespace_envelope
642
+ * @returns {Uint8Array}
643
+ */
644
+ export function createWorkbook(namespace_envelope) {
645
+ try {
646
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
647
+ const ptr0 = passArray8ToWasm0(namespace_envelope, wasm.__wbindgen_export);
648
+ const len0 = WASM_VECTOR_LEN;
649
+ wasm.createWorkbook(retptr, ptr0, len0);
650
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
651
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
652
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
653
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
654
+ if (r3) {
655
+ throw takeObject(r2);
656
+ }
657
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
658
+ wasm.__wbindgen_export2(r0, r1 * 1, 1);
659
+ return v2;
660
+ } finally {
661
+ wasm.__wbindgen_add_to_stack_pointer(16);
662
+ }
663
+ }
664
+
665
+ /**
666
+ * Executes one bounded OGAKQ001 read against a canonical snapshot.
667
+ * @param {Uint8Array} snapshot
668
+ * @param {Uint8Array} query_envelope
669
+ * @returns {Uint8Array}
670
+ */
671
+ export function query(snapshot, query_envelope) {
672
+ try {
673
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
674
+ const ptr0 = passArray8ToWasm0(snapshot, wasm.__wbindgen_export);
675
+ const len0 = WASM_VECTOR_LEN;
676
+ const ptr1 = passArray8ToWasm0(query_envelope, wasm.__wbindgen_export);
677
+ const len1 = WASM_VECTOR_LEN;
678
+ wasm.query(retptr, ptr0, len0, ptr1, len1);
679
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
680
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
681
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
682
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
683
+ if (r3) {
684
+ throw takeObject(r2);
685
+ }
686
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
687
+ wasm.__wbindgen_export2(r0, r1 * 1, 1);
688
+ return v3;
689
+ } finally {
690
+ wasm.__wbindgen_add_to_stack_pointer(16);
691
+ }
692
+ }
339
693
  function __wbg_get_imports() {
340
694
  const import0 = {
341
695
  __proto__: null,
@@ -356,6 +710,9 @@ function __wbg_get_imports() {
356
710
  const ArtifactCollaborationSessionFinalization = (typeof FinalizationRegistry === 'undefined')
357
711
  ? { register: () => {}, unregister: () => {} }
358
712
  : new FinalizationRegistry(ptr => wasm.__wbg_artifactcollaborationsession_free(ptr, 1));
713
+ const ArtifactKernelSessionFinalization = (typeof FinalizationRegistry === 'undefined')
714
+ ? { register: () => {}, unregister: () => {} }
715
+ : new FinalizationRegistry(ptr => wasm.__wbg_artifactkernelsession_free(ptr, 1));
359
716
 
360
717
  function addHeapObject(obj) {
361
718
  if (heap_next === heap.length) heap.push(heap.length + 1);
@@ -2,6 +2,8 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_artifactcollaborationsession_free: (a: number, b: number) => void;
5
+ export const __wbg_artifactkernelsession_free: (a: number, b: number) => void;
6
+ export const applyCommands: (a: number, b: number, c: number, d: number, e: number) => void;
5
7
  export const artifactcollaborationsession_applyCommitted: (a: number, b: number, c: number, d: number) => void;
6
8
  export const artifactcollaborationsession_authorTransaction: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
7
9
  export const artifactcollaborationsession_close: (a: number) => void;
@@ -14,9 +16,23 @@ export const artifactcollaborationsession_query: (a: number, b: number, c: numbe
14
16
  export const artifactcollaborationsession_revision: (a: number, b: number) => void;
15
17
  export const artifactcollaborationsession_snapshot: (a: number, b: number) => void;
16
18
  export const artifactcollaborationsession_stateHash: (a: number, b: number) => void;
19
+ export const artifactkernelsession_applyCommands: (a: number, b: number, c: number, d: number) => void;
20
+ export const artifactkernelsession_close: (a: number) => void;
21
+ export const artifactkernelsession_create: (a: number, b: number, c: number) => void;
22
+ export const artifactkernelsession_fork: (a: number, b: number) => void;
23
+ export const artifactkernelsession_isClosed: (a: number) => number;
24
+ export const artifactkernelsession_open: (a: number, b: number, c: number) => void;
25
+ export const artifactkernelsession_query: (a: number, b: number, c: number, d: number) => void;
26
+ export const artifactkernelsession_revision: (a: number, b: number) => void;
27
+ export const artifactkernelsession_snapshot: (a: number, b: number) => void;
28
+ export const artifactkernelsession_stateHash: (a: number, b: number) => void;
17
29
  export const buildIdentity: (a: number) => void;
18
30
  export const canonicalizeCollaborationSnapshot: (a: number, b: number, c: number) => void;
31
+ export const canonicalizeSnapshot: (a: number, b: number, c: number) => void;
19
32
  export const capabilities: (a: number) => void;
33
+ export const createWorkbook: (a: number, b: number, c: number) => void;
34
+ export const query: (a: number, b: number, c: number, d: number, e: number) => void;
35
+ export const artifactkernelsession_dispose: (a: number) => void;
20
36
  export const artifactcollaborationsession_dispose: (a: number) => void;
21
37
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
22
38
  export const __wbindgen_export: (a: number, b: number) => number;
package/dist/index.d.ts CHANGED
@@ -3,14 +3,14 @@ export type ArtifactKernelRuntimeIdentity = Readonly<{
3
3
  target: "wasm-web";
4
4
  modality: "spreadsheet";
5
5
  packageName: "@opengeni/artifact-kernel-wasm-spreadsheet";
6
- packageVersion: "0.2.8";
7
- artifactToolVersion: "0.2.8";
8
- buildIdentity: "opengeni-artifact-kernel/0.1.0;abi=1;command=1;query=1;snapshot=1;document-snapshot=1;document-command=1;document-query=1;presentation-snapshot=1;presentation-command=1;presentation-query=1;text-layout-fonts=1;text-layout-request=1;text-layout-response=1;render-tile=1;render-patch=1;source=a9194d659991a0910e6f9f47510670b2857b927c2a1b818b13cf480521a986dd;toolchain=1367261bf04dd2fc4b2c6aa0ef397c21659ee1c973a9d98dcb8d84b46d68b06f";
9
- kernelVersion: "opengeni-artifact-kernel/0.1.0;abi=1;command=1;query=1;snapshot=1;document-snapshot=1;document-command=1;document-query=1;presentation-snapshot=1;presentation-command=1;presentation-query=1;text-layout-fonts=1;text-layout-request=1;text-layout-response=1;render-tile=1;render-patch=1;source=a9194d659991a0910e6f9f47510670b2857b927c2a1b818b13cf480521a986dd;toolchain=1367261bf04dd2fc4b2c6aa0ef397c21659ee1c973a9d98dcb8d84b46d68b06f";
6
+ packageVersion: "0.3.4-canary.0";
7
+ artifactToolVersion: "0.3.4-canary.0";
8
+ buildIdentity: "opengeni-artifact-kernel/0.1.0;abi=1;command=2;query=1;snapshot=2;collaboration-snapshot=2;committed-transaction=2;spreadsheet-model=2;document-snapshot=1;document-command=1;document-query=1;presentation-snapshot=1;presentation-command=1;presentation-query=1;text-layout-fonts=1;text-layout-request=1;text-layout-response=1;render-tile=1;render-patch=1;source=c6212bc4b63a1fbd2b974a06d87f2a1f3ddf24466d19940d5025fd128950bce1;toolchain=1367261bf04dd2fc4b2c6aa0ef397c21659ee1c973a9d98dcb8d84b46d68b06f";
9
+ kernelVersion: "opengeni-artifact-kernel/0.1.0;abi=1;command=2;query=1;snapshot=2;collaboration-snapshot=2;committed-transaction=2;spreadsheet-model=2;document-snapshot=1;document-command=1;document-query=1;presentation-snapshot=1;presentation-command=1;presentation-query=1;text-layout-fonts=1;text-layout-request=1;text-layout-response=1;render-tile=1;render-patch=1;source=c6212bc4b63a1fbd2b974a06d87f2a1f3ddf24466d19940d5025fd128950bce1;toolchain=1367261bf04dd2fc4b2c6aa0ef397c21659ee1c973a9d98dcb8d84b46d68b06f";
10
10
  abiVersion: 1;
11
11
  protocolVersion: 1;
12
- modelSchemaVersion: 1;
13
- commandVersion: 1;
12
+ modelSchemaVersion: 2;
13
+ commandVersion: 2;
14
14
  }>;
15
15
  export declare const artifactKernelRuntimeIdentity: ArtifactKernelRuntimeIdentity;
16
16
  export declare const artifactKernelPackageIdentity: ArtifactKernelRuntimeIdentity;
@@ -23,9 +23,9 @@ export declare const editableArtifactKernelRuntime: Readonly<{
23
23
  modality: "spreadsheet";
24
24
  wasmGlueUrl: URL;
25
25
  wasmBinaryUrl: URL;
26
- kernelVersion: "opengeni-artifact-kernel/0.1.0;abi=1;command=1;query=1;snapshot=1;document-snapshot=1;document-command=1;document-query=1;presentation-snapshot=1;presentation-command=1;presentation-query=1;text-layout-fonts=1;text-layout-request=1;text-layout-response=1;render-tile=1;render-patch=1;source=a9194d659991a0910e6f9f47510670b2857b927c2a1b818b13cf480521a986dd;toolchain=1367261bf04dd2fc4b2c6aa0ef397c21659ee1c973a9d98dcb8d84b46d68b06f";
26
+ kernelVersion: "opengeni-artifact-kernel/0.1.0;abi=1;command=2;query=1;snapshot=2;collaboration-snapshot=2;committed-transaction=2;spreadsheet-model=2;document-snapshot=1;document-command=1;document-query=1;presentation-snapshot=1;presentation-command=1;presentation-query=1;text-layout-fonts=1;text-layout-request=1;text-layout-response=1;render-tile=1;render-patch=1;source=c6212bc4b63a1fbd2b974a06d87f2a1f3ddf24466d19940d5025fd128950bce1;toolchain=1367261bf04dd2fc4b2c6aa0ef397c21659ee1c973a9d98dcb8d84b46d68b06f";
27
27
  protocolVersion: 1;
28
- modelSchemaVersion: 1;
29
- commandVersion: 1;
28
+ modelSchemaVersion: 2;
29
+ commandVersion: 2;
30
30
  }>;
31
31
  export declare function loadArtifactKernelBinding(): Promise<typeof import("./artifact_kernel_spreadsheet.js")>;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const artifactKernelRuntimeIdentity = Object.freeze({"schemaVersion":1,"target":"wasm-web","modality":"spreadsheet","packageName":"@opengeni/artifact-kernel-wasm-spreadsheet","packageVersion":"0.2.8","artifactToolVersion":"0.2.8","buildIdentity":"opengeni-artifact-kernel/0.1.0;abi=1;command=1;query=1;snapshot=1;document-snapshot=1;document-command=1;document-query=1;presentation-snapshot=1;presentation-command=1;presentation-query=1;text-layout-fonts=1;text-layout-request=1;text-layout-response=1;render-tile=1;render-patch=1;source=a9194d659991a0910e6f9f47510670b2857b927c2a1b818b13cf480521a986dd;toolchain=1367261bf04dd2fc4b2c6aa0ef397c21659ee1c973a9d98dcb8d84b46d68b06f","kernelVersion":"opengeni-artifact-kernel/0.1.0;abi=1;command=1;query=1;snapshot=1;document-snapshot=1;document-command=1;document-query=1;presentation-snapshot=1;presentation-command=1;presentation-query=1;text-layout-fonts=1;text-layout-request=1;text-layout-response=1;render-tile=1;render-patch=1;source=a9194d659991a0910e6f9f47510670b2857b927c2a1b818b13cf480521a986dd;toolchain=1367261bf04dd2fc4b2c6aa0ef397c21659ee1c973a9d98dcb8d84b46d68b06f","abiVersion":1,"protocolVersion":1,"modelSchemaVersion":1,"commandVersion":1});
1
+ export const artifactKernelRuntimeIdentity = Object.freeze({"schemaVersion":1,"target":"wasm-web","modality":"spreadsheet","packageName":"@opengeni/artifact-kernel-wasm-spreadsheet","packageVersion":"0.3.4-canary.0","artifactToolVersion":"0.3.4-canary.0","buildIdentity":"opengeni-artifact-kernel/0.1.0;abi=1;command=2;query=1;snapshot=2;collaboration-snapshot=2;committed-transaction=2;spreadsheet-model=2;document-snapshot=1;document-command=1;document-query=1;presentation-snapshot=1;presentation-command=1;presentation-query=1;text-layout-fonts=1;text-layout-request=1;text-layout-response=1;render-tile=1;render-patch=1;source=c6212bc4b63a1fbd2b974a06d87f2a1f3ddf24466d19940d5025fd128950bce1;toolchain=1367261bf04dd2fc4b2c6aa0ef397c21659ee1c973a9d98dcb8d84b46d68b06f","kernelVersion":"opengeni-artifact-kernel/0.1.0;abi=1;command=2;query=1;snapshot=2;collaboration-snapshot=2;committed-transaction=2;spreadsheet-model=2;document-snapshot=1;document-command=1;document-query=1;presentation-snapshot=1;presentation-command=1;presentation-query=1;text-layout-fonts=1;text-layout-request=1;text-layout-response=1;render-tile=1;render-patch=1;source=c6212bc4b63a1fbd2b974a06d87f2a1f3ddf24466d19940d5025fd128950bce1;toolchain=1367261bf04dd2fc4b2c6aa0ef397c21659ee1c973a9d98dcb8d84b46d68b06f","abiVersion":1,"protocolVersion":1,"modelSchemaVersion":2,"commandVersion":2});
2
2
  export const artifactKernelPackageIdentity = artifactKernelRuntimeIdentity;
3
3
  export const editableArtifactKernelAssets = Object.freeze({
4
4
  modality: "spreadsheet",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/artifact-kernel-wasm-spreadsheet",
3
- "version": "0.2.8",
3
+ "version": "0.3.4-canary.0",
4
4
  "description": "Exact lazy WebAssembly runtime for OpenGeni spreadsheet editing.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {