@opengeni/artifact-kernel-wasm-presentation 0.2.2
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 +190 -0
- package/README.md +12 -0
- package/dist/artifact-kernel-runtime.json +60 -0
- package/dist/artifact_kernel_presentation.d.ts +140 -0
- package/dist/artifact_kernel_presentation.js +571 -0
- package/dist/artifact_kernel_presentation_bg.wasm +0 -0
- package/dist/artifact_kernel_presentation_bg.wasm.d.ts +24 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +23 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Cloudgeni-ai
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# `@opengeni/artifact-kernel-wasm-presentation`
|
|
2
|
+
|
|
3
|
+
Exact, capability-scoped WebAssembly runtime for the OpenGeni presentation editor.
|
|
4
|
+
It is generated from the safe Rust artifact kernel and loaded only in the SDK's
|
|
5
|
+
dedicated module Worker. It performs no runtime download or version discovery.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { editableArtifactKernelRuntime } from "@opengeni/artifact-kernel-wasm-presentation";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Pass the runtime into `@opengeni/sdk/editable-artifacts`; the Worker verifies
|
|
12
|
+
its exact build/protocol/model/command identity before loading artifact state.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"runtimeIdentity": {
|
|
4
|
+
"schemaVersion": 1,
|
|
5
|
+
"target": "wasm-web",
|
|
6
|
+
"modality": "presentation",
|
|
7
|
+
"packageName": "@opengeni/artifact-kernel-wasm-presentation",
|
|
8
|
+
"packageVersion": "0.2.2",
|
|
9
|
+
"artifactToolVersion": "0.2.2",
|
|
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",
|
|
12
|
+
"abiVersion": 1,
|
|
13
|
+
"protocolVersion": 1,
|
|
14
|
+
"modelSchemaVersion": 1,
|
|
15
|
+
"commandVersion": 1
|
|
16
|
+
},
|
|
17
|
+
"capabilities": {
|
|
18
|
+
"bytes": 1860,
|
|
19
|
+
"sha256": "sha256:f56b1f32090988039df0c31ba054172aa89174ba8bdfa6419afe5c0d7a921421"
|
|
20
|
+
},
|
|
21
|
+
"sizeBudget": {
|
|
22
|
+
"wasmBytes": 393216,
|
|
23
|
+
"wasmGzipBytes": 131072,
|
|
24
|
+
"glueBytes": 32768
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
{
|
|
28
|
+
"path": "artifact_kernel_presentation_bg.wasm",
|
|
29
|
+
"bytes": 296525,
|
|
30
|
+
"sha256": "sha256:0ffb017b4af39dafa0dc4d1660576202dfd64fc638bce5f891cd8e3d7e33e605",
|
|
31
|
+
"gzipBytes": 94594
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"path": "artifact_kernel_presentation_bg.wasm.d.ts",
|
|
35
|
+
"bytes": 1781,
|
|
36
|
+
"sha256": "sha256:c41a44659297ad907afc0dad2f859a1c40aa202106a7546346b42555966f202e"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "artifact_kernel_presentation.d.ts",
|
|
40
|
+
"bytes": 5421,
|
|
41
|
+
"sha256": "sha256:05058c5d78fe3b2d5714bab44d2be38aa8d3b34447369cacda9f62dd47dab398"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"path": "artifact_kernel_presentation.js",
|
|
45
|
+
"bytes": 20754,
|
|
46
|
+
"sha256": "sha256:c17ea97373307a5693f36bb01aa2f77818d09a2b5ae32b7776ebbf194b09b38f",
|
|
47
|
+
"gzipBytes": 3532
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"path": "index.d.ts",
|
|
51
|
+
"bytes": 2309,
|
|
52
|
+
"sha256": "sha256:77b3e6604e9be9e0cce1e7ca02ea1c82e5aa8e3af2c700e32ebd8423e303369d"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"path": "index.js",
|
|
56
|
+
"bytes": 2266,
|
|
57
|
+
"sha256": "sha256:6f6d68af4084a669aace0e2891bbc629b1c2ccc2e8e52596edad45a3a0ef1d78"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Stateful WebAssembly presentation-kernel handle.
|
|
6
|
+
*/
|
|
7
|
+
export class ArtifactPresentationSession {
|
|
8
|
+
private constructor();
|
|
9
|
+
free(): void;
|
|
10
|
+
[Symbol.dispose](): void;
|
|
11
|
+
/**
|
|
12
|
+
* Applies one complete command transaction and returns its OGAPR001 receipt.
|
|
13
|
+
*/
|
|
14
|
+
applyCommands(command_envelope: Uint8Array): Uint8Array;
|
|
15
|
+
/**
|
|
16
|
+
* Releases the in-memory presentation state.
|
|
17
|
+
*/
|
|
18
|
+
close(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Creates an empty in-memory presentation from a canonical namespace envelope.
|
|
21
|
+
*/
|
|
22
|
+
static create(namespace_envelope: Uint8Array): ArtifactPresentationSession;
|
|
23
|
+
/**
|
|
24
|
+
* Idempotent explicit-resource-management alias for close.
|
|
25
|
+
*/
|
|
26
|
+
dispose(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Creates an independent in-memory presentation branch.
|
|
29
|
+
*/
|
|
30
|
+
fork(): ArtifactPresentationSession;
|
|
31
|
+
/**
|
|
32
|
+
* Reports whether presentation state has been released.
|
|
33
|
+
*/
|
|
34
|
+
isClosed(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Opens one validated canonical OGAPRS01 snapshot.
|
|
37
|
+
*/
|
|
38
|
+
static open(snapshot: Uint8Array): ArtifactPresentationSession;
|
|
39
|
+
/**
|
|
40
|
+
* Executes one bounded presentation projection query.
|
|
41
|
+
*/
|
|
42
|
+
query(query_envelope: Uint8Array): Uint8Array;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the current presentation revision as a JavaScript bigint.
|
|
45
|
+
*/
|
|
46
|
+
revision(): bigint;
|
|
47
|
+
/**
|
|
48
|
+
* Serializes the exact canonical presentation snapshot.
|
|
49
|
+
*/
|
|
50
|
+
snapshot(): Uint8Array;
|
|
51
|
+
/**
|
|
52
|
+
* Returns SHA-256 of the exact canonical snapshot.
|
|
53
|
+
*/
|
|
54
|
+
stateHash(): string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Atomically applies one OGAPC001 command envelope to an OGAPRS01 snapshot.
|
|
59
|
+
*/
|
|
60
|
+
export function applyPresentationCommands(snapshot: Uint8Array, command_envelope: Uint8Array): Uint8Array;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Returns the canonical encoded build-identity envelope.
|
|
64
|
+
*
|
|
65
|
+
* The identity lets loaders fail closed when the operation protocol, snapshot
|
|
66
|
+
* schema, or kernel implementation is incompatible.
|
|
67
|
+
*/
|
|
68
|
+
export function buildIdentity(): Uint8Array;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Strictly validates and re-encodes one canonical OGAPRS01 snapshot.
|
|
72
|
+
*/
|
|
73
|
+
export function canonicalizePresentationSnapshot(snapshot: Uint8Array): Uint8Array;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Returns the canonical encoded capability envelope.
|
|
77
|
+
*
|
|
78
|
+
* JavaScript receives a fresh `Uint8Array`; callers may mutate it without
|
|
79
|
+
* affecting subsequent calls.
|
|
80
|
+
*/
|
|
81
|
+
export function capabilities(): Uint8Array;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Creates an empty presentation from a canonical namespace envelope.
|
|
85
|
+
*/
|
|
86
|
+
export function createPresentation(namespace_envelope: Uint8Array): Uint8Array;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Executes one bounded OGAPQ001 presentation projection query.
|
|
90
|
+
*/
|
|
91
|
+
export function queryPresentation(snapshot: Uint8Array, query_envelope: Uint8Array): Uint8Array;
|
|
92
|
+
|
|
93
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
94
|
+
|
|
95
|
+
export interface InitOutput {
|
|
96
|
+
readonly memory: WebAssembly.Memory;
|
|
97
|
+
readonly __wbg_artifactpresentationsession_free: (a: number, b: number) => void;
|
|
98
|
+
readonly applyPresentationCommands: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
99
|
+
readonly artifactpresentationsession_applyCommands: (a: number, b: number, c: number, d: number) => void;
|
|
100
|
+
readonly artifactpresentationsession_close: (a: number) => void;
|
|
101
|
+
readonly artifactpresentationsession_create: (a: number, b: number, c: number) => void;
|
|
102
|
+
readonly artifactpresentationsession_fork: (a: number, b: number) => void;
|
|
103
|
+
readonly artifactpresentationsession_isClosed: (a: number) => number;
|
|
104
|
+
readonly artifactpresentationsession_open: (a: number, b: number, c: number) => void;
|
|
105
|
+
readonly artifactpresentationsession_query: (a: number, b: number, c: number, d: number) => void;
|
|
106
|
+
readonly artifactpresentationsession_revision: (a: number, b: number) => void;
|
|
107
|
+
readonly artifactpresentationsession_snapshot: (a: number, b: number) => void;
|
|
108
|
+
readonly artifactpresentationsession_stateHash: (a: number, b: number) => void;
|
|
109
|
+
readonly buildIdentity: (a: number) => void;
|
|
110
|
+
readonly canonicalizePresentationSnapshot: (a: number, b: number, c: number) => void;
|
|
111
|
+
readonly capabilities: (a: number) => void;
|
|
112
|
+
readonly createPresentation: (a: number, b: number, c: number) => void;
|
|
113
|
+
readonly queryPresentation: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
114
|
+
readonly artifactpresentationsession_dispose: (a: number) => void;
|
|
115
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
116
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
117
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number) => void;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
124
|
+
* a precompiled `WebAssembly.Module`.
|
|
125
|
+
*
|
|
126
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
127
|
+
*
|
|
128
|
+
* @returns {InitOutput}
|
|
129
|
+
*/
|
|
130
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
134
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
135
|
+
*
|
|
136
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
137
|
+
*
|
|
138
|
+
* @returns {Promise<InitOutput>}
|
|
139
|
+
*/
|
|
140
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
/* @ts-self-types="./artifact_kernel_presentation.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Stateful WebAssembly presentation-kernel handle.
|
|
5
|
+
*/
|
|
6
|
+
export class ArtifactPresentationSession {
|
|
7
|
+
static __wrap(ptr) {
|
|
8
|
+
const obj = Object.create(ArtifactPresentationSession.prototype);
|
|
9
|
+
obj.__wbg_ptr = ptr;
|
|
10
|
+
ArtifactPresentationSessionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
11
|
+
return obj;
|
|
12
|
+
}
|
|
13
|
+
__destroy_into_raw() {
|
|
14
|
+
const ptr = this.__wbg_ptr;
|
|
15
|
+
this.__wbg_ptr = 0;
|
|
16
|
+
ArtifactPresentationSessionFinalization.unregister(this);
|
|
17
|
+
return ptr;
|
|
18
|
+
}
|
|
19
|
+
free() {
|
|
20
|
+
const ptr = this.__destroy_into_raw();
|
|
21
|
+
wasm.__wbg_artifactpresentationsession_free(ptr, 0);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Applies one complete command transaction and returns its OGAPR001 receipt.
|
|
25
|
+
* @param {Uint8Array} command_envelope
|
|
26
|
+
* @returns {Uint8Array}
|
|
27
|
+
*/
|
|
28
|
+
applyCommands(command_envelope) {
|
|
29
|
+
try {
|
|
30
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
31
|
+
const ptr0 = passArray8ToWasm0(command_envelope, wasm.__wbindgen_export);
|
|
32
|
+
const len0 = WASM_VECTOR_LEN;
|
|
33
|
+
wasm.artifactpresentationsession_applyCommands(retptr, this.__wbg_ptr, ptr0, len0);
|
|
34
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
35
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
36
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
37
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
38
|
+
if (r3) {
|
|
39
|
+
throw takeObject(r2);
|
|
40
|
+
}
|
|
41
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
42
|
+
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
43
|
+
return v2;
|
|
44
|
+
} finally {
|
|
45
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Releases the in-memory presentation state.
|
|
50
|
+
*/
|
|
51
|
+
close() {
|
|
52
|
+
wasm.artifactpresentationsession_close(this.__wbg_ptr);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Creates an empty in-memory presentation from a canonical namespace envelope.
|
|
56
|
+
* @param {Uint8Array} namespace_envelope
|
|
57
|
+
* @returns {ArtifactPresentationSession}
|
|
58
|
+
*/
|
|
59
|
+
static create(namespace_envelope) {
|
|
60
|
+
try {
|
|
61
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
62
|
+
const ptr0 = passArray8ToWasm0(namespace_envelope, wasm.__wbindgen_export);
|
|
63
|
+
const len0 = WASM_VECTOR_LEN;
|
|
64
|
+
wasm.artifactpresentationsession_create(retptr, ptr0, len0);
|
|
65
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
66
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
67
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
68
|
+
if (r2) {
|
|
69
|
+
throw takeObject(r1);
|
|
70
|
+
}
|
|
71
|
+
return ArtifactPresentationSession.__wrap(r0);
|
|
72
|
+
} finally {
|
|
73
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Idempotent explicit-resource-management alias for close.
|
|
78
|
+
*/
|
|
79
|
+
dispose() {
|
|
80
|
+
wasm.artifactpresentationsession_dispose(this.__wbg_ptr);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Creates an independent in-memory presentation branch.
|
|
84
|
+
* @returns {ArtifactPresentationSession}
|
|
85
|
+
*/
|
|
86
|
+
fork() {
|
|
87
|
+
try {
|
|
88
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
89
|
+
wasm.artifactpresentationsession_fork(retptr, this.__wbg_ptr);
|
|
90
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
91
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
92
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
93
|
+
if (r2) {
|
|
94
|
+
throw takeObject(r1);
|
|
95
|
+
}
|
|
96
|
+
return ArtifactPresentationSession.__wrap(r0);
|
|
97
|
+
} finally {
|
|
98
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Reports whether presentation state has been released.
|
|
103
|
+
* @returns {boolean}
|
|
104
|
+
*/
|
|
105
|
+
isClosed() {
|
|
106
|
+
const ret = wasm.artifactpresentationsession_isClosed(this.__wbg_ptr);
|
|
107
|
+
return ret !== 0;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Opens one validated canonical OGAPRS01 snapshot.
|
|
111
|
+
* @param {Uint8Array} snapshot
|
|
112
|
+
* @returns {ArtifactPresentationSession}
|
|
113
|
+
*/
|
|
114
|
+
static open(snapshot) {
|
|
115
|
+
try {
|
|
116
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
117
|
+
const ptr0 = passArray8ToWasm0(snapshot, wasm.__wbindgen_export);
|
|
118
|
+
const len0 = WASM_VECTOR_LEN;
|
|
119
|
+
wasm.artifactpresentationsession_open(retptr, ptr0, len0);
|
|
120
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
121
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
122
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
123
|
+
if (r2) {
|
|
124
|
+
throw takeObject(r1);
|
|
125
|
+
}
|
|
126
|
+
return ArtifactPresentationSession.__wrap(r0);
|
|
127
|
+
} finally {
|
|
128
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Executes one bounded presentation projection query.
|
|
133
|
+
* @param {Uint8Array} query_envelope
|
|
134
|
+
* @returns {Uint8Array}
|
|
135
|
+
*/
|
|
136
|
+
query(query_envelope) {
|
|
137
|
+
try {
|
|
138
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
139
|
+
const ptr0 = passArray8ToWasm0(query_envelope, wasm.__wbindgen_export);
|
|
140
|
+
const len0 = WASM_VECTOR_LEN;
|
|
141
|
+
wasm.artifactpresentationsession_query(retptr, this.__wbg_ptr, ptr0, len0);
|
|
142
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
143
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
144
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
145
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
146
|
+
if (r3) {
|
|
147
|
+
throw takeObject(r2);
|
|
148
|
+
}
|
|
149
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
150
|
+
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
151
|
+
return v2;
|
|
152
|
+
} finally {
|
|
153
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Returns the current presentation revision as a JavaScript bigint.
|
|
158
|
+
* @returns {bigint}
|
|
159
|
+
*/
|
|
160
|
+
revision() {
|
|
161
|
+
try {
|
|
162
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
163
|
+
wasm.artifactpresentationsession_revision(retptr, this.__wbg_ptr);
|
|
164
|
+
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
165
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
166
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
167
|
+
if (r3) {
|
|
168
|
+
throw takeObject(r2);
|
|
169
|
+
}
|
|
170
|
+
return BigInt.asUintN(64, r0);
|
|
171
|
+
} finally {
|
|
172
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Serializes the exact canonical presentation snapshot.
|
|
177
|
+
* @returns {Uint8Array}
|
|
178
|
+
*/
|
|
179
|
+
snapshot() {
|
|
180
|
+
try {
|
|
181
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
182
|
+
wasm.artifactpresentationsession_snapshot(retptr, this.__wbg_ptr);
|
|
183
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
184
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
185
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
186
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
187
|
+
if (r3) {
|
|
188
|
+
throw takeObject(r2);
|
|
189
|
+
}
|
|
190
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
191
|
+
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
192
|
+
return v1;
|
|
193
|
+
} finally {
|
|
194
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Returns SHA-256 of the exact canonical snapshot.
|
|
199
|
+
* @returns {string}
|
|
200
|
+
*/
|
|
201
|
+
stateHash() {
|
|
202
|
+
let deferred2_0;
|
|
203
|
+
let deferred2_1;
|
|
204
|
+
try {
|
|
205
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
206
|
+
wasm.artifactpresentationsession_stateHash(retptr, this.__wbg_ptr);
|
|
207
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
208
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
209
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
210
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
211
|
+
var ptr1 = r0;
|
|
212
|
+
var len1 = r1;
|
|
213
|
+
if (r3) {
|
|
214
|
+
ptr1 = 0; len1 = 0;
|
|
215
|
+
throw takeObject(r2);
|
|
216
|
+
}
|
|
217
|
+
deferred2_0 = ptr1;
|
|
218
|
+
deferred2_1 = len1;
|
|
219
|
+
return getStringFromWasm0(ptr1, len1);
|
|
220
|
+
} finally {
|
|
221
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
222
|
+
wasm.__wbindgen_export2(deferred2_0, deferred2_1, 1);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (Symbol.dispose) ArtifactPresentationSession.prototype[Symbol.dispose] = ArtifactPresentationSession.prototype.free;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Atomically applies one OGAPC001 command envelope to an OGAPRS01 snapshot.
|
|
230
|
+
* @param {Uint8Array} snapshot
|
|
231
|
+
* @param {Uint8Array} command_envelope
|
|
232
|
+
* @returns {Uint8Array}
|
|
233
|
+
*/
|
|
234
|
+
export function applyPresentationCommands(snapshot, command_envelope) {
|
|
235
|
+
try {
|
|
236
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
237
|
+
const ptr0 = passArray8ToWasm0(snapshot, wasm.__wbindgen_export);
|
|
238
|
+
const len0 = WASM_VECTOR_LEN;
|
|
239
|
+
const ptr1 = passArray8ToWasm0(command_envelope, wasm.__wbindgen_export);
|
|
240
|
+
const len1 = WASM_VECTOR_LEN;
|
|
241
|
+
wasm.applyPresentationCommands(retptr, ptr0, len0, ptr1, len1);
|
|
242
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
243
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
244
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
245
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
246
|
+
if (r3) {
|
|
247
|
+
throw takeObject(r2);
|
|
248
|
+
}
|
|
249
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
250
|
+
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
251
|
+
return v3;
|
|
252
|
+
} finally {
|
|
253
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Returns the canonical encoded build-identity envelope.
|
|
259
|
+
*
|
|
260
|
+
* The identity lets loaders fail closed when the operation protocol, snapshot
|
|
261
|
+
* schema, or kernel implementation is incompatible.
|
|
262
|
+
* @returns {Uint8Array}
|
|
263
|
+
*/
|
|
264
|
+
export function buildIdentity() {
|
|
265
|
+
try {
|
|
266
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
267
|
+
wasm.buildIdentity(retptr);
|
|
268
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
269
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
270
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
271
|
+
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
272
|
+
return v1;
|
|
273
|
+
} finally {
|
|
274
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Strictly validates and re-encodes one canonical OGAPRS01 snapshot.
|
|
280
|
+
* @param {Uint8Array} snapshot
|
|
281
|
+
* @returns {Uint8Array}
|
|
282
|
+
*/
|
|
283
|
+
export function canonicalizePresentationSnapshot(snapshot) {
|
|
284
|
+
try {
|
|
285
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
286
|
+
const ptr0 = passArray8ToWasm0(snapshot, wasm.__wbindgen_export);
|
|
287
|
+
const len0 = WASM_VECTOR_LEN;
|
|
288
|
+
wasm.canonicalizePresentationSnapshot(retptr, ptr0, len0);
|
|
289
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
290
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
291
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
292
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
293
|
+
if (r3) {
|
|
294
|
+
throw takeObject(r2);
|
|
295
|
+
}
|
|
296
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
297
|
+
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
298
|
+
return v2;
|
|
299
|
+
} finally {
|
|
300
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Returns the canonical encoded capability envelope.
|
|
306
|
+
*
|
|
307
|
+
* JavaScript receives a fresh `Uint8Array`; callers may mutate it without
|
|
308
|
+
* affecting subsequent calls.
|
|
309
|
+
* @returns {Uint8Array}
|
|
310
|
+
*/
|
|
311
|
+
export function capabilities() {
|
|
312
|
+
try {
|
|
313
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
314
|
+
wasm.capabilities(retptr);
|
|
315
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
316
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
317
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
318
|
+
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
319
|
+
return v1;
|
|
320
|
+
} finally {
|
|
321
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Creates an empty presentation from a canonical namespace envelope.
|
|
327
|
+
* @param {Uint8Array} namespace_envelope
|
|
328
|
+
* @returns {Uint8Array}
|
|
329
|
+
*/
|
|
330
|
+
export function createPresentation(namespace_envelope) {
|
|
331
|
+
try {
|
|
332
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
333
|
+
const ptr0 = passArray8ToWasm0(namespace_envelope, wasm.__wbindgen_export);
|
|
334
|
+
const len0 = WASM_VECTOR_LEN;
|
|
335
|
+
wasm.createPresentation(retptr, ptr0, len0);
|
|
336
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
337
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
338
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
339
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
340
|
+
if (r3) {
|
|
341
|
+
throw takeObject(r2);
|
|
342
|
+
}
|
|
343
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
344
|
+
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
345
|
+
return v2;
|
|
346
|
+
} finally {
|
|
347
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Executes one bounded OGAPQ001 presentation projection query.
|
|
353
|
+
* @param {Uint8Array} snapshot
|
|
354
|
+
* @param {Uint8Array} query_envelope
|
|
355
|
+
* @returns {Uint8Array}
|
|
356
|
+
*/
|
|
357
|
+
export function queryPresentation(snapshot, query_envelope) {
|
|
358
|
+
try {
|
|
359
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
360
|
+
const ptr0 = passArray8ToWasm0(snapshot, wasm.__wbindgen_export);
|
|
361
|
+
const len0 = WASM_VECTOR_LEN;
|
|
362
|
+
const ptr1 = passArray8ToWasm0(query_envelope, wasm.__wbindgen_export);
|
|
363
|
+
const len1 = WASM_VECTOR_LEN;
|
|
364
|
+
wasm.queryPresentation(retptr, ptr0, len0, ptr1, len1);
|
|
365
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
366
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
367
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
368
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
369
|
+
if (r3) {
|
|
370
|
+
throw takeObject(r2);
|
|
371
|
+
}
|
|
372
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
373
|
+
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
374
|
+
return v3;
|
|
375
|
+
} finally {
|
|
376
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
function __wbg_get_imports() {
|
|
380
|
+
const import0 = {
|
|
381
|
+
__proto__: null,
|
|
382
|
+
__wbg_Error_408e67f47ca7b58b: function(arg0, arg1) {
|
|
383
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
384
|
+
return addHeapObject(ret);
|
|
385
|
+
},
|
|
386
|
+
__wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
|
|
387
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
388
|
+
},
|
|
389
|
+
};
|
|
390
|
+
return {
|
|
391
|
+
__proto__: null,
|
|
392
|
+
"./artifact_kernel_presentation_bg.js": import0,
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const ArtifactPresentationSessionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
397
|
+
? { register: () => {}, unregister: () => {} }
|
|
398
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_artifactpresentationsession_free(ptr, 1));
|
|
399
|
+
|
|
400
|
+
function addHeapObject(obj) {
|
|
401
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
402
|
+
const idx = heap_next;
|
|
403
|
+
heap_next = heap[idx];
|
|
404
|
+
|
|
405
|
+
heap[idx] = obj;
|
|
406
|
+
return idx;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function dropObject(idx) {
|
|
410
|
+
if (idx < 1028) return;
|
|
411
|
+
heap[idx] = heap_next;
|
|
412
|
+
heap_next = idx;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
416
|
+
ptr = ptr >>> 0;
|
|
417
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
let cachedDataViewMemory0 = null;
|
|
421
|
+
function getDataViewMemory0() {
|
|
422
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
423
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
424
|
+
}
|
|
425
|
+
return cachedDataViewMemory0;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function getStringFromWasm0(ptr, len) {
|
|
429
|
+
return decodeText(ptr >>> 0, len);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
let cachedUint8ArrayMemory0 = null;
|
|
433
|
+
function getUint8ArrayMemory0() {
|
|
434
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
435
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
436
|
+
}
|
|
437
|
+
return cachedUint8ArrayMemory0;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function getObject(idx) { return heap[idx]; }
|
|
441
|
+
|
|
442
|
+
let heap = new Array(1024).fill(undefined);
|
|
443
|
+
heap.push(undefined, null, true, false);
|
|
444
|
+
|
|
445
|
+
let heap_next = heap.length;
|
|
446
|
+
|
|
447
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
448
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
449
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
450
|
+
WASM_VECTOR_LEN = arg.length;
|
|
451
|
+
return ptr;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function takeObject(idx) {
|
|
455
|
+
const ret = getObject(idx);
|
|
456
|
+
dropObject(idx);
|
|
457
|
+
return ret;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
461
|
+
cachedTextDecoder.decode();
|
|
462
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
463
|
+
let numBytesDecoded = 0;
|
|
464
|
+
function decodeText(ptr, len) {
|
|
465
|
+
numBytesDecoded += len;
|
|
466
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
467
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
468
|
+
cachedTextDecoder.decode();
|
|
469
|
+
numBytesDecoded = len;
|
|
470
|
+
}
|
|
471
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
let WASM_VECTOR_LEN = 0;
|
|
475
|
+
|
|
476
|
+
let wasmModule, wasmInstance, wasm;
|
|
477
|
+
function __wbg_finalize_init(instance, module) {
|
|
478
|
+
wasmInstance = instance;
|
|
479
|
+
wasm = instance.exports;
|
|
480
|
+
wasmModule = module;
|
|
481
|
+
cachedDataViewMemory0 = null;
|
|
482
|
+
cachedUint8ArrayMemory0 = null;
|
|
483
|
+
return wasm;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
async function __wbg_load(module, imports) {
|
|
487
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
488
|
+
if (!module.ok) {
|
|
489
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
493
|
+
try {
|
|
494
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
495
|
+
} catch (e) {
|
|
496
|
+
const validResponse = expectedResponseType(module.type);
|
|
497
|
+
|
|
498
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
499
|
+
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);
|
|
500
|
+
|
|
501
|
+
} else { throw e; }
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
const bytes = await module.arrayBuffer();
|
|
506
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
507
|
+
} else {
|
|
508
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
509
|
+
|
|
510
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
511
|
+
return { instance, module };
|
|
512
|
+
} else {
|
|
513
|
+
return instance;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
function expectedResponseType(type) {
|
|
518
|
+
switch (type) {
|
|
519
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
520
|
+
}
|
|
521
|
+
return false;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
function initSync(module) {
|
|
526
|
+
if (wasm !== undefined) return wasm;
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
if (module !== undefined) {
|
|
530
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
531
|
+
({module} = module)
|
|
532
|
+
} else {
|
|
533
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
const imports = __wbg_get_imports();
|
|
538
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
539
|
+
module = new WebAssembly.Module(module);
|
|
540
|
+
}
|
|
541
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
542
|
+
return __wbg_finalize_init(instance, module);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
async function __wbg_init(module_or_path) {
|
|
546
|
+
if (wasm !== undefined) return wasm;
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
if (module_or_path !== undefined) {
|
|
550
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
551
|
+
({module_or_path} = module_or_path)
|
|
552
|
+
} else {
|
|
553
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
if (module_or_path === undefined) {
|
|
558
|
+
module_or_path = new URL('artifact_kernel_presentation_bg.wasm', import.meta.url);
|
|
559
|
+
}
|
|
560
|
+
const imports = __wbg_get_imports();
|
|
561
|
+
|
|
562
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
563
|
+
module_or_path = fetch(module_or_path);
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
567
|
+
|
|
568
|
+
return __wbg_finalize_init(instance, module);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_artifactpresentationsession_free: (a: number, b: number) => void;
|
|
5
|
+
export const applyPresentationCommands: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
6
|
+
export const artifactpresentationsession_applyCommands: (a: number, b: number, c: number, d: number) => void;
|
|
7
|
+
export const artifactpresentationsession_close: (a: number) => void;
|
|
8
|
+
export const artifactpresentationsession_create: (a: number, b: number, c: number) => void;
|
|
9
|
+
export const artifactpresentationsession_fork: (a: number, b: number) => void;
|
|
10
|
+
export const artifactpresentationsession_isClosed: (a: number) => number;
|
|
11
|
+
export const artifactpresentationsession_open: (a: number, b: number, c: number) => void;
|
|
12
|
+
export const artifactpresentationsession_query: (a: number, b: number, c: number, d: number) => void;
|
|
13
|
+
export const artifactpresentationsession_revision: (a: number, b: number) => void;
|
|
14
|
+
export const artifactpresentationsession_snapshot: (a: number, b: number) => void;
|
|
15
|
+
export const artifactpresentationsession_stateHash: (a: number, b: number) => void;
|
|
16
|
+
export const buildIdentity: (a: number) => void;
|
|
17
|
+
export const canonicalizePresentationSnapshot: (a: number, b: number, c: number) => void;
|
|
18
|
+
export const capabilities: (a: number) => void;
|
|
19
|
+
export const createPresentation: (a: number, b: number, c: number) => void;
|
|
20
|
+
export const queryPresentation: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
21
|
+
export const artifactpresentationsession_dispose: (a: number) => void;
|
|
22
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
23
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
24
|
+
export const __wbindgen_export2: (a: number, b: number, c: number) => void;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type ArtifactKernelRuntimeIdentity = Readonly<{
|
|
2
|
+
schemaVersion: 1;
|
|
3
|
+
target: "wasm-web";
|
|
4
|
+
modality: "presentation";
|
|
5
|
+
packageName: "@opengeni/artifact-kernel-wasm-presentation";
|
|
6
|
+
packageVersion: "0.2.2";
|
|
7
|
+
artifactToolVersion: "0.2.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";
|
|
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";
|
|
10
|
+
abiVersion: 1;
|
|
11
|
+
protocolVersion: 1;
|
|
12
|
+
modelSchemaVersion: 1;
|
|
13
|
+
commandVersion: 1;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const artifactKernelRuntimeIdentity: ArtifactKernelRuntimeIdentity;
|
|
16
|
+
export declare const artifactKernelPackageIdentity: ArtifactKernelRuntimeIdentity;
|
|
17
|
+
export declare const editableArtifactKernelAssets: Readonly<{
|
|
18
|
+
modality: "presentation";
|
|
19
|
+
wasmGlueUrl: URL;
|
|
20
|
+
wasmBinaryUrl: URL;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const editableArtifactKernelRuntime: Readonly<{
|
|
23
|
+
modality: "presentation";
|
|
24
|
+
wasmGlueUrl: URL;
|
|
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";
|
|
27
|
+
protocolVersion: 1;
|
|
28
|
+
modelSchemaVersion: 1;
|
|
29
|
+
commandVersion: 1;
|
|
30
|
+
}>;
|
|
31
|
+
export declare function loadArtifactKernelBinding(): Promise<typeof import("./artifact_kernel_presentation.js")>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const artifactKernelRuntimeIdentity = Object.freeze({"schemaVersion":1,"target":"wasm-web","modality":"presentation","packageName":"@opengeni/artifact-kernel-wasm-presentation","packageVersion":"0.2.2","artifactToolVersion":"0.2.2","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});
|
|
2
|
+
export const artifactKernelPackageIdentity = artifactKernelRuntimeIdentity;
|
|
3
|
+
export const editableArtifactKernelAssets = Object.freeze({
|
|
4
|
+
modality: "presentation",
|
|
5
|
+
wasmGlueUrl: new URL("./artifact_kernel_presentation.js", import.meta.url),
|
|
6
|
+
wasmBinaryUrl: new URL("./artifact_kernel_presentation_bg.wasm", import.meta.url),
|
|
7
|
+
});
|
|
8
|
+
export const editableArtifactKernelRuntime = Object.freeze({
|
|
9
|
+
...editableArtifactKernelAssets,
|
|
10
|
+
kernelVersion: artifactKernelRuntimeIdentity.kernelVersion,
|
|
11
|
+
protocolVersion: artifactKernelRuntimeIdentity.protocolVersion,
|
|
12
|
+
modelSchemaVersion: artifactKernelRuntimeIdentity.modelSchemaVersion,
|
|
13
|
+
commandVersion: artifactKernelRuntimeIdentity.commandVersion,
|
|
14
|
+
});
|
|
15
|
+
let initialization;
|
|
16
|
+
export async function loadArtifactKernelBinding() {
|
|
17
|
+
initialization ??= (async () => {
|
|
18
|
+
const binding = await import(/* @vite-ignore */ editableArtifactKernelAssets.wasmGlueUrl.href);
|
|
19
|
+
await binding.default({ module_or_path: editableArtifactKernelAssets.wasmBinaryUrl });
|
|
20
|
+
return binding;
|
|
21
|
+
})();
|
|
22
|
+
return initialization;
|
|
23
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opengeni/artifact-kernel-wasm-presentation",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "Exact lazy WebAssembly runtime for OpenGeni presentation editing.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Cloudgeni-ai/opengeni.git",
|
|
9
|
+
"directory": "packages/artifact-kernel-wasm-presentation"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"module": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./runtime-manifest": "./dist/artifact-kernel-runtime.json"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public",
|
|
29
|
+
"provenance": true
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "bun ../../scripts/build-artifact-kernel-wasm-packages.ts --modality presentation --asset-root ./dist",
|
|
33
|
+
"prepublishOnly": "bash ../../scripts/prepublish-guard"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=18"
|
|
37
|
+
},
|
|
38
|
+
"opengeniArtifactKernelAsset": {
|
|
39
|
+
"schemaVersion": 1,
|
|
40
|
+
"target": "wasm-web",
|
|
41
|
+
"modality": "presentation"
|
|
42
|
+
}
|
|
43
|
+
}
|