@benrogmans/lemma-engine 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/lemma.d.ts +139 -19
- package/lemma.js +820 -93
- package/lemma_bg.wasm +0 -0
- package/lemma_bg.wasm.d.ts +39 -12
- package/package.json +2 -7
package/README.md
CHANGED
|
@@ -46,12 +46,12 @@ const engine = new WasmEngine();
|
|
|
46
46
|
|
|
47
47
|
### Core Methods
|
|
48
48
|
|
|
49
|
-
#### `
|
|
49
|
+
#### `addLemmaFile(code: string, filename: string): string`
|
|
50
50
|
|
|
51
51
|
Adds a Lemma document to the engine.
|
|
52
52
|
|
|
53
53
|
```javascript
|
|
54
|
-
const result = engine.
|
|
54
|
+
const result = engine.addLemmaFile(`
|
|
55
55
|
doc employee_contract
|
|
56
56
|
|
|
57
57
|
fact salary = 5000 eur
|
|
@@ -78,7 +78,7 @@ Evaluates a document with optional runtime facts.
|
|
|
78
78
|
// Evaluate with default facts
|
|
79
79
|
const result1 = engine.evaluate('employee_contract', '{}');
|
|
80
80
|
|
|
81
|
-
// Evaluate with runtime fact
|
|
81
|
+
// Evaluate with runtime fact values (as JSON object)
|
|
82
82
|
const result2 = engine.evaluate('employee_contract', JSON.stringify({
|
|
83
83
|
salary: 6000,
|
|
84
84
|
vacation_days: 30
|
|
@@ -162,7 +162,7 @@ async function calculatePricing() {
|
|
|
162
162
|
|
|
163
163
|
// Load the document
|
|
164
164
|
const loadResult = JSON.parse(
|
|
165
|
-
engine.
|
|
165
|
+
engine.addLemmaFile(pricingDoc, 'pricing.lemma')
|
|
166
166
|
);
|
|
167
167
|
|
|
168
168
|
if (!loadResult.success) {
|
|
@@ -263,7 +263,7 @@ async function typedExample() {
|
|
|
263
263
|
```javascript
|
|
264
264
|
try {
|
|
265
265
|
const result = JSON.parse(
|
|
266
|
-
engine.
|
|
266
|
+
engine.addLemmaFile('invalid syntax', 'bad.lemma')
|
|
267
267
|
);
|
|
268
268
|
|
|
269
269
|
if (!result.success) {
|
package/lemma.d.ts
CHANGED
|
@@ -1,42 +1,162 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
type ReadableStreamReaderMode = "byob";
|
|
5
|
+
|
|
6
|
+
export class IntoUnderlyingByteSource {
|
|
7
|
+
private constructor();
|
|
8
|
+
free(): void;
|
|
9
|
+
[Symbol.dispose](): void;
|
|
10
|
+
cancel(): void;
|
|
11
|
+
pull(controller: any): Promise<any>;
|
|
12
|
+
start(controller: any): void;
|
|
13
|
+
readonly autoAllocateChunkSize: number;
|
|
14
|
+
readonly type: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class IntoUnderlyingSink {
|
|
18
|
+
private constructor();
|
|
19
|
+
free(): void;
|
|
20
|
+
[Symbol.dispose](): void;
|
|
21
|
+
abort(reason: any): Promise<any>;
|
|
22
|
+
close(): Promise<any>;
|
|
23
|
+
write(chunk: any): Promise<any>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class IntoUnderlyingSource {
|
|
27
|
+
private constructor();
|
|
28
|
+
free(): void;
|
|
29
|
+
[Symbol.dispose](): void;
|
|
30
|
+
cancel(): void;
|
|
31
|
+
pull(controller: any): Promise<any>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Raw options for [`pipeTo()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo).
|
|
36
|
+
*/
|
|
37
|
+
export class PipeOptions {
|
|
38
|
+
private constructor();
|
|
39
|
+
free(): void;
|
|
40
|
+
[Symbol.dispose](): void;
|
|
41
|
+
readonly preventAbort: boolean;
|
|
42
|
+
readonly preventCancel: boolean;
|
|
43
|
+
readonly preventClose: boolean;
|
|
44
|
+
readonly signal: AbortSignal | undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export class QueuingStrategy {
|
|
48
|
+
private constructor();
|
|
49
|
+
free(): void;
|
|
50
|
+
[Symbol.dispose](): void;
|
|
51
|
+
readonly highWaterMark: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Raw options for [`getReader()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/getReader).
|
|
56
|
+
*/
|
|
57
|
+
export class ReadableStreamGetReaderOptions {
|
|
58
|
+
private constructor();
|
|
59
|
+
free(): void;
|
|
60
|
+
[Symbol.dispose](): void;
|
|
61
|
+
readonly mode: ReadableStreamReaderMode;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export class ServerConfig {
|
|
65
|
+
free(): void;
|
|
66
|
+
[Symbol.dispose](): void;
|
|
67
|
+
constructor(into_server: AsyncIterator<any>, from_server: WritableStream);
|
|
68
|
+
}
|
|
69
|
+
|
|
4
70
|
export class WasmEngine {
|
|
5
71
|
free(): void;
|
|
6
72
|
[Symbol.dispose](): void;
|
|
7
|
-
addLemmaCode(code: string, source: string): string;
|
|
8
|
-
evaluate(doc_name: string, fact_values_json: string): string;
|
|
9
|
-
evaluateRules(doc_name: string, rule_names_json: string, fact_values_json: string): string;
|
|
10
73
|
/**
|
|
11
|
-
*
|
|
74
|
+
* Add Lemma source (e.g. file contents). Returns a Promise that resolves to a JSON string result.
|
|
75
|
+
*/
|
|
76
|
+
addLemmaFile(code: string, source: string): Promise<any>;
|
|
77
|
+
/**
|
|
78
|
+
* Evaluate rules in a document.
|
|
12
79
|
*
|
|
13
|
-
*
|
|
80
|
+
* Pass `rule_names_json` as `"[]"` or `""` to evaluate all rules.
|
|
81
|
+
* Pass a JSON array like `'["total","discount"]'` to evaluate specific rules.
|
|
14
82
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
83
|
+
evaluate(doc_name: string, rule_names_json: string, fact_values_json: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* Format Lemma source code. Returns a JSON string: `{ "success": true, "formatted": "..." }`
|
|
86
|
+
* or `{ "success": false, "error": "..." }`. Only formats if the source parses successfully.
|
|
87
|
+
* Call from JS (e.g. Monaco playground) to implement "Format" without an LSP; there is no on-save in the browser.
|
|
88
|
+
*/
|
|
89
|
+
formatSource(code: string, source_attribute: string): string;
|
|
90
|
+
/**
|
|
91
|
+
* Return the full document schema: all facts and rules with their types.
|
|
92
|
+
*
|
|
93
|
+
* Returns the `DocumentSchema` used by all Lemma interfaces, serialized as
|
|
94
|
+
* JSON. Use `getSchema` with specific rule names to get only the facts
|
|
95
|
+
* required by those rules.
|
|
96
|
+
*/
|
|
97
|
+
getSchema(doc_name: string, rule_names_json: string): string;
|
|
17
98
|
invert(_doc_name: string, _rule_name: string, _target_json: string, _provided_values_json: string): string;
|
|
99
|
+
/**
|
|
100
|
+
* List all loaded documents with their full schemas.
|
|
101
|
+
*
|
|
102
|
+
* Returns `{ success: true, documents: [DocumentSchema, ...] }` sorted by
|
|
103
|
+
* document name, consistent with the HTTP and MCP interfaces.
|
|
104
|
+
*/
|
|
18
105
|
listDocuments(): string;
|
|
19
106
|
constructor();
|
|
20
107
|
}
|
|
21
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Run the Lemma LSP over the given streams. Call from JS after creating
|
|
111
|
+
* an AsyncIterator (client → server messages) and a WritableStream (server → client).
|
|
112
|
+
*/
|
|
113
|
+
export function serve(config: ServerConfig): Promise<void>;
|
|
114
|
+
|
|
22
115
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
23
116
|
|
|
24
117
|
export interface InitOutput {
|
|
25
118
|
readonly memory: WebAssembly.Memory;
|
|
119
|
+
readonly __wbg_serverconfig_free: (a: number, b: number) => void;
|
|
120
|
+
readonly serve: (a: number) => number;
|
|
121
|
+
readonly serverconfig_new: (a: number, b: number) => number;
|
|
122
|
+
readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
123
|
+
readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
|
124
|
+
readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
|
|
125
|
+
readonly __wbg_pipeoptions_free: (a: number, b: number) => void;
|
|
126
|
+
readonly __wbg_queuingstrategy_free: (a: number, b: number) => void;
|
|
127
|
+
readonly __wbg_readablestreamgetreaderoptions_free: (a: number, b: number) => void;
|
|
128
|
+
readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
129
|
+
readonly intounderlyingbytesource_cancel: (a: number) => void;
|
|
130
|
+
readonly intounderlyingbytesource_pull: (a: number, b: number) => number;
|
|
131
|
+
readonly intounderlyingbytesource_start: (a: number, b: number) => void;
|
|
132
|
+
readonly intounderlyingbytesource_type: (a: number) => number;
|
|
133
|
+
readonly intounderlyingsink_abort: (a: number, b: number) => number;
|
|
134
|
+
readonly intounderlyingsink_close: (a: number) => number;
|
|
135
|
+
readonly intounderlyingsink_write: (a: number, b: number) => number;
|
|
136
|
+
readonly intounderlyingsource_cancel: (a: number) => void;
|
|
137
|
+
readonly intounderlyingsource_pull: (a: number, b: number) => number;
|
|
138
|
+
readonly pipeoptions_preventAbort: (a: number) => number;
|
|
139
|
+
readonly pipeoptions_preventCancel: (a: number) => number;
|
|
140
|
+
readonly pipeoptions_preventClose: (a: number) => number;
|
|
141
|
+
readonly pipeoptions_signal: (a: number) => number;
|
|
142
|
+
readonly queuingstrategy_highWaterMark: (a: number) => number;
|
|
143
|
+
readonly readablestreamgetreaderoptions_mode: (a: number) => number;
|
|
26
144
|
readonly __wbg_wasmengine_free: (a: number, b: number) => void;
|
|
27
|
-
readonly
|
|
28
|
-
readonly wasmengine_evaluate: (a: number, b: number, c: number, d: number, e: number
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
33
|
-
readonly wasmengine_listDocuments: (a: number) => [number, number];
|
|
145
|
+
readonly wasmengine_addLemmaFile: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
146
|
+
readonly wasmengine_evaluate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
147
|
+
readonly wasmengine_formatSource: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
148
|
+
readonly wasmengine_getSchema: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
149
|
+
readonly wasmengine_invert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
150
|
+
readonly wasmengine_listDocuments: (a: number, b: number) => void;
|
|
34
151
|
readonly wasmengine_new: () => number;
|
|
35
|
-
readonly
|
|
36
|
-
readonly
|
|
37
|
-
readonly
|
|
38
|
-
readonly
|
|
39
|
-
readonly
|
|
152
|
+
readonly __wasm_bindgen_func_elem_8774: (a: number, b: number) => void;
|
|
153
|
+
readonly __wasm_bindgen_func_elem_9930: (a: number, b: number, c: number, d: number) => void;
|
|
154
|
+
readonly __wasm_bindgen_func_elem_8789: (a: number, b: number, c: number) => void;
|
|
155
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
156
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
157
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
158
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
159
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
40
160
|
}
|
|
41
161
|
|
|
42
162
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
package/lemma.js
CHANGED
|
@@ -1,4 +1,230 @@
|
|
|
1
1
|
/* @ts-self-types="./lemma.d.ts" */
|
|
2
|
+
import { bytes_literal } from './snippets/wasm-streams-42e57edbcd526312/inline0.js';
|
|
3
|
+
|
|
4
|
+
export class IntoUnderlyingByteSource {
|
|
5
|
+
__destroy_into_raw() {
|
|
6
|
+
const ptr = this.__wbg_ptr;
|
|
7
|
+
this.__wbg_ptr = 0;
|
|
8
|
+
IntoUnderlyingByteSourceFinalization.unregister(this);
|
|
9
|
+
return ptr;
|
|
10
|
+
}
|
|
11
|
+
free() {
|
|
12
|
+
const ptr = this.__destroy_into_raw();
|
|
13
|
+
wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @returns {number}
|
|
17
|
+
*/
|
|
18
|
+
get autoAllocateChunkSize() {
|
|
19
|
+
const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
|
|
20
|
+
return ret >>> 0;
|
|
21
|
+
}
|
|
22
|
+
cancel() {
|
|
23
|
+
const ptr = this.__destroy_into_raw();
|
|
24
|
+
wasm.intounderlyingbytesource_cancel(ptr);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @param {any} controller
|
|
28
|
+
* @returns {Promise<any>}
|
|
29
|
+
*/
|
|
30
|
+
pull(controller) {
|
|
31
|
+
const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, addHeapObject(controller));
|
|
32
|
+
return takeObject(ret);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @param {any} controller
|
|
36
|
+
*/
|
|
37
|
+
start(controller) {
|
|
38
|
+
wasm.intounderlyingbytesource_start(this.__wbg_ptr, addHeapObject(controller));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @returns {any}
|
|
42
|
+
*/
|
|
43
|
+
get type() {
|
|
44
|
+
const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
|
|
45
|
+
return takeObject(ret);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
|
|
49
|
+
|
|
50
|
+
export class IntoUnderlyingSink {
|
|
51
|
+
__destroy_into_raw() {
|
|
52
|
+
const ptr = this.__wbg_ptr;
|
|
53
|
+
this.__wbg_ptr = 0;
|
|
54
|
+
IntoUnderlyingSinkFinalization.unregister(this);
|
|
55
|
+
return ptr;
|
|
56
|
+
}
|
|
57
|
+
free() {
|
|
58
|
+
const ptr = this.__destroy_into_raw();
|
|
59
|
+
wasm.__wbg_intounderlyingsink_free(ptr, 0);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @param {any} reason
|
|
63
|
+
* @returns {Promise<any>}
|
|
64
|
+
*/
|
|
65
|
+
abort(reason) {
|
|
66
|
+
const ptr = this.__destroy_into_raw();
|
|
67
|
+
const ret = wasm.intounderlyingsink_abort(ptr, addHeapObject(reason));
|
|
68
|
+
return takeObject(ret);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @returns {Promise<any>}
|
|
72
|
+
*/
|
|
73
|
+
close() {
|
|
74
|
+
const ptr = this.__destroy_into_raw();
|
|
75
|
+
const ret = wasm.intounderlyingsink_close(ptr);
|
|
76
|
+
return takeObject(ret);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @param {any} chunk
|
|
80
|
+
* @returns {Promise<any>}
|
|
81
|
+
*/
|
|
82
|
+
write(chunk) {
|
|
83
|
+
const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, addHeapObject(chunk));
|
|
84
|
+
return takeObject(ret);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
|
|
88
|
+
|
|
89
|
+
export class IntoUnderlyingSource {
|
|
90
|
+
__destroy_into_raw() {
|
|
91
|
+
const ptr = this.__wbg_ptr;
|
|
92
|
+
this.__wbg_ptr = 0;
|
|
93
|
+
IntoUnderlyingSourceFinalization.unregister(this);
|
|
94
|
+
return ptr;
|
|
95
|
+
}
|
|
96
|
+
free() {
|
|
97
|
+
const ptr = this.__destroy_into_raw();
|
|
98
|
+
wasm.__wbg_intounderlyingsource_free(ptr, 0);
|
|
99
|
+
}
|
|
100
|
+
cancel() {
|
|
101
|
+
const ptr = this.__destroy_into_raw();
|
|
102
|
+
wasm.intounderlyingsource_cancel(ptr);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* @param {any} controller
|
|
106
|
+
* @returns {Promise<any>}
|
|
107
|
+
*/
|
|
108
|
+
pull(controller) {
|
|
109
|
+
const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, addHeapObject(controller));
|
|
110
|
+
return takeObject(ret);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Raw options for [`pipeTo()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo).
|
|
117
|
+
*/
|
|
118
|
+
export class PipeOptions {
|
|
119
|
+
__destroy_into_raw() {
|
|
120
|
+
const ptr = this.__wbg_ptr;
|
|
121
|
+
this.__wbg_ptr = 0;
|
|
122
|
+
PipeOptionsFinalization.unregister(this);
|
|
123
|
+
return ptr;
|
|
124
|
+
}
|
|
125
|
+
free() {
|
|
126
|
+
const ptr = this.__destroy_into_raw();
|
|
127
|
+
wasm.__wbg_pipeoptions_free(ptr, 0);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* @returns {boolean}
|
|
131
|
+
*/
|
|
132
|
+
get preventAbort() {
|
|
133
|
+
const ret = wasm.pipeoptions_preventAbort(this.__wbg_ptr);
|
|
134
|
+
return ret !== 0;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* @returns {boolean}
|
|
138
|
+
*/
|
|
139
|
+
get preventCancel() {
|
|
140
|
+
const ret = wasm.pipeoptions_preventCancel(this.__wbg_ptr);
|
|
141
|
+
return ret !== 0;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @returns {boolean}
|
|
145
|
+
*/
|
|
146
|
+
get preventClose() {
|
|
147
|
+
const ret = wasm.pipeoptions_preventClose(this.__wbg_ptr);
|
|
148
|
+
return ret !== 0;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* @returns {AbortSignal | undefined}
|
|
152
|
+
*/
|
|
153
|
+
get signal() {
|
|
154
|
+
const ret = wasm.pipeoptions_signal(this.__wbg_ptr);
|
|
155
|
+
return takeObject(ret);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (Symbol.dispose) PipeOptions.prototype[Symbol.dispose] = PipeOptions.prototype.free;
|
|
159
|
+
|
|
160
|
+
export class QueuingStrategy {
|
|
161
|
+
__destroy_into_raw() {
|
|
162
|
+
const ptr = this.__wbg_ptr;
|
|
163
|
+
this.__wbg_ptr = 0;
|
|
164
|
+
QueuingStrategyFinalization.unregister(this);
|
|
165
|
+
return ptr;
|
|
166
|
+
}
|
|
167
|
+
free() {
|
|
168
|
+
const ptr = this.__destroy_into_raw();
|
|
169
|
+
wasm.__wbg_queuingstrategy_free(ptr, 0);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* @returns {number}
|
|
173
|
+
*/
|
|
174
|
+
get highWaterMark() {
|
|
175
|
+
const ret = wasm.queuingstrategy_highWaterMark(this.__wbg_ptr);
|
|
176
|
+
return ret;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (Symbol.dispose) QueuingStrategy.prototype[Symbol.dispose] = QueuingStrategy.prototype.free;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Raw options for [`getReader()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/getReader).
|
|
183
|
+
*/
|
|
184
|
+
export class ReadableStreamGetReaderOptions {
|
|
185
|
+
__destroy_into_raw() {
|
|
186
|
+
const ptr = this.__wbg_ptr;
|
|
187
|
+
this.__wbg_ptr = 0;
|
|
188
|
+
ReadableStreamGetReaderOptionsFinalization.unregister(this);
|
|
189
|
+
return ptr;
|
|
190
|
+
}
|
|
191
|
+
free() {
|
|
192
|
+
const ptr = this.__destroy_into_raw();
|
|
193
|
+
wasm.__wbg_readablestreamgetreaderoptions_free(ptr, 0);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* @returns {ReadableStreamReaderMode}
|
|
197
|
+
*/
|
|
198
|
+
get mode() {
|
|
199
|
+
const ret = wasm.readablestreamgetreaderoptions_mode(this.__wbg_ptr);
|
|
200
|
+
return __wbindgen_enum_ReadableStreamReaderMode[ret];
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (Symbol.dispose) ReadableStreamGetReaderOptions.prototype[Symbol.dispose] = ReadableStreamGetReaderOptions.prototype.free;
|
|
204
|
+
|
|
205
|
+
export class ServerConfig {
|
|
206
|
+
__destroy_into_raw() {
|
|
207
|
+
const ptr = this.__wbg_ptr;
|
|
208
|
+
this.__wbg_ptr = 0;
|
|
209
|
+
ServerConfigFinalization.unregister(this);
|
|
210
|
+
return ptr;
|
|
211
|
+
}
|
|
212
|
+
free() {
|
|
213
|
+
const ptr = this.__destroy_into_raw();
|
|
214
|
+
wasm.__wbg_serverconfig_free(ptr, 0);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* @param {AsyncIterator<any>} into_server
|
|
218
|
+
* @param {WritableStream} from_server
|
|
219
|
+
*/
|
|
220
|
+
constructor(into_server, from_server) {
|
|
221
|
+
const ret = wasm.serverconfig_new(addHeapObject(into_server), addHeapObject(from_server));
|
|
222
|
+
this.__wbg_ptr = ret >>> 0;
|
|
223
|
+
ServerConfigFinalization.register(this, this.__wbg_ptr, this);
|
|
224
|
+
return this;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (Symbol.dispose) ServerConfig.prototype[Symbol.dispose] = ServerConfig.prototype.free;
|
|
2
228
|
|
|
3
229
|
export class WasmEngine {
|
|
4
230
|
__destroy_into_raw() {
|
|
@@ -12,111 +238,107 @@ export class WasmEngine {
|
|
|
12
238
|
wasm.__wbg_wasmengine_free(ptr, 0);
|
|
13
239
|
}
|
|
14
240
|
/**
|
|
241
|
+
* Add Lemma source (e.g. file contents). Returns a Promise that resolves to a JSON string result.
|
|
15
242
|
* @param {string} code
|
|
16
243
|
* @param {string} source
|
|
17
|
-
* @returns {
|
|
18
|
-
*/
|
|
19
|
-
addLemmaCode(code, source) {
|
|
20
|
-
let deferred3_0;
|
|
21
|
-
let deferred3_1;
|
|
22
|
-
try {
|
|
23
|
-
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
24
|
-
const len0 = WASM_VECTOR_LEN;
|
|
25
|
-
const ptr1 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
26
|
-
const len1 = WASM_VECTOR_LEN;
|
|
27
|
-
const ret = wasm.wasmengine_addLemmaCode(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
28
|
-
deferred3_0 = ret[0];
|
|
29
|
-
deferred3_1 = ret[1];
|
|
30
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
31
|
-
} finally {
|
|
32
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* @param {string} doc_name
|
|
37
|
-
* @param {string} fact_values_json
|
|
38
|
-
* @returns {string}
|
|
244
|
+
* @returns {Promise<any>}
|
|
39
245
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const len1 = WASM_VECTOR_LEN;
|
|
48
|
-
const ret = wasm.wasmengine_evaluate(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
49
|
-
deferred3_0 = ret[0];
|
|
50
|
-
deferred3_1 = ret[1];
|
|
51
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
52
|
-
} finally {
|
|
53
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
54
|
-
}
|
|
246
|
+
addLemmaFile(code, source) {
|
|
247
|
+
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
248
|
+
const len0 = WASM_VECTOR_LEN;
|
|
249
|
+
const ptr1 = passStringToWasm0(source, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
250
|
+
const len1 = WASM_VECTOR_LEN;
|
|
251
|
+
const ret = wasm.wasmengine_addLemmaFile(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
252
|
+
return takeObject(ret);
|
|
55
253
|
}
|
|
56
254
|
/**
|
|
255
|
+
* Evaluate rules in a document.
|
|
256
|
+
*
|
|
257
|
+
* Pass `rule_names_json` as `"[]"` or `""` to evaluate all rules.
|
|
258
|
+
* Pass a JSON array like `'["total","discount"]'` to evaluate specific rules.
|
|
57
259
|
* @param {string} doc_name
|
|
58
260
|
* @param {string} rule_names_json
|
|
59
261
|
* @param {string} fact_values_json
|
|
60
262
|
* @returns {string}
|
|
61
263
|
*/
|
|
62
|
-
|
|
264
|
+
evaluate(doc_name, rule_names_json, fact_values_json) {
|
|
63
265
|
let deferred4_0;
|
|
64
266
|
let deferred4_1;
|
|
65
267
|
try {
|
|
66
|
-
const
|
|
268
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
269
|
+
const ptr0 = passStringToWasm0(doc_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
67
270
|
const len0 = WASM_VECTOR_LEN;
|
|
68
|
-
const ptr1 = passStringToWasm0(rule_names_json, wasm.
|
|
271
|
+
const ptr1 = passStringToWasm0(rule_names_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
69
272
|
const len1 = WASM_VECTOR_LEN;
|
|
70
|
-
const ptr2 = passStringToWasm0(fact_values_json, wasm.
|
|
273
|
+
const ptr2 = passStringToWasm0(fact_values_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
71
274
|
const len2 = WASM_VECTOR_LEN;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
275
|
+
wasm.wasmengine_evaluate(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
276
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
277
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
278
|
+
deferred4_0 = r0;
|
|
279
|
+
deferred4_1 = r1;
|
|
280
|
+
return getStringFromWasm0(r0, r1);
|
|
76
281
|
} finally {
|
|
77
|
-
wasm.
|
|
282
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
283
|
+
wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
|
|
78
284
|
}
|
|
79
285
|
}
|
|
80
286
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* @param {string}
|
|
287
|
+
* Format Lemma source code. Returns a JSON string: `{ "success": true, "formatted": "..." }`
|
|
288
|
+
* or `{ "success": false, "error": "..." }`. Only formats if the source parses successfully.
|
|
289
|
+
* Call from JS (e.g. Monaco playground) to implement "Format" without an LSP; there is no on-save in the browser.
|
|
290
|
+
* @param {string} code
|
|
291
|
+
* @param {string} source_attribute
|
|
85
292
|
* @returns {string}
|
|
86
293
|
*/
|
|
87
|
-
|
|
88
|
-
let
|
|
89
|
-
let
|
|
294
|
+
formatSource(code, source_attribute) {
|
|
295
|
+
let deferred3_0;
|
|
296
|
+
let deferred3_1;
|
|
90
297
|
try {
|
|
91
|
-
const
|
|
298
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
299
|
+
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
92
300
|
const len0 = WASM_VECTOR_LEN;
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
301
|
+
const ptr1 = passStringToWasm0(source_attribute, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
302
|
+
const len1 = WASM_VECTOR_LEN;
|
|
303
|
+
wasm.wasmengine_formatSource(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
304
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
305
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
306
|
+
deferred3_0 = r0;
|
|
307
|
+
deferred3_1 = r1;
|
|
308
|
+
return getStringFromWasm0(r0, r1);
|
|
97
309
|
} finally {
|
|
98
|
-
wasm.
|
|
310
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
311
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
99
312
|
}
|
|
100
313
|
}
|
|
101
314
|
/**
|
|
315
|
+
* Return the full document schema: all facts and rules with their types.
|
|
316
|
+
*
|
|
317
|
+
* Returns the `DocumentSchema` used by all Lemma interfaces, serialized as
|
|
318
|
+
* JSON. Use `getSchema` with specific rule names to get only the facts
|
|
319
|
+
* required by those rules.
|
|
102
320
|
* @param {string} doc_name
|
|
103
321
|
* @param {string} rule_names_json
|
|
104
322
|
* @returns {string}
|
|
105
323
|
*/
|
|
106
|
-
|
|
324
|
+
getSchema(doc_name, rule_names_json) {
|
|
107
325
|
let deferred3_0;
|
|
108
326
|
let deferred3_1;
|
|
109
327
|
try {
|
|
110
|
-
const
|
|
328
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
329
|
+
const ptr0 = passStringToWasm0(doc_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
111
330
|
const len0 = WASM_VECTOR_LEN;
|
|
112
|
-
const ptr1 = passStringToWasm0(rule_names_json, wasm.
|
|
331
|
+
const ptr1 = passStringToWasm0(rule_names_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
113
332
|
const len1 = WASM_VECTOR_LEN;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
333
|
+
wasm.wasmengine_getSchema(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
334
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
335
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
336
|
+
deferred3_0 = r0;
|
|
337
|
+
deferred3_1 = r1;
|
|
338
|
+
return getStringFromWasm0(r0, r1);
|
|
118
339
|
} finally {
|
|
119
|
-
wasm.
|
|
340
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
341
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
120
342
|
}
|
|
121
343
|
}
|
|
122
344
|
/**
|
|
@@ -130,35 +352,47 @@ export class WasmEngine {
|
|
|
130
352
|
let deferred5_0;
|
|
131
353
|
let deferred5_1;
|
|
132
354
|
try {
|
|
133
|
-
const
|
|
355
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
356
|
+
const ptr0 = passStringToWasm0(_doc_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
134
357
|
const len0 = WASM_VECTOR_LEN;
|
|
135
|
-
const ptr1 = passStringToWasm0(_rule_name, wasm.
|
|
358
|
+
const ptr1 = passStringToWasm0(_rule_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
136
359
|
const len1 = WASM_VECTOR_LEN;
|
|
137
|
-
const ptr2 = passStringToWasm0(_target_json, wasm.
|
|
360
|
+
const ptr2 = passStringToWasm0(_target_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
138
361
|
const len2 = WASM_VECTOR_LEN;
|
|
139
|
-
const ptr3 = passStringToWasm0(_provided_values_json, wasm.
|
|
362
|
+
const ptr3 = passStringToWasm0(_provided_values_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
140
363
|
const len3 = WASM_VECTOR_LEN;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
364
|
+
wasm.wasmengine_invert(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
365
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
366
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
367
|
+
deferred5_0 = r0;
|
|
368
|
+
deferred5_1 = r1;
|
|
369
|
+
return getStringFromWasm0(r0, r1);
|
|
145
370
|
} finally {
|
|
146
|
-
wasm.
|
|
371
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
372
|
+
wasm.__wbindgen_export4(deferred5_0, deferred5_1, 1);
|
|
147
373
|
}
|
|
148
374
|
}
|
|
149
375
|
/**
|
|
376
|
+
* List all loaded documents with their full schemas.
|
|
377
|
+
*
|
|
378
|
+
* Returns `{ success: true, documents: [DocumentSchema, ...] }` sorted by
|
|
379
|
+
* document name, consistent with the HTTP and MCP interfaces.
|
|
150
380
|
* @returns {string}
|
|
151
381
|
*/
|
|
152
382
|
listDocuments() {
|
|
153
383
|
let deferred1_0;
|
|
154
384
|
let deferred1_1;
|
|
155
385
|
try {
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
386
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
387
|
+
wasm.wasmengine_listDocuments(retptr, this.__wbg_ptr);
|
|
388
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
389
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
390
|
+
deferred1_0 = r0;
|
|
391
|
+
deferred1_1 = r1;
|
|
392
|
+
return getStringFromWasm0(r0, r1);
|
|
160
393
|
} finally {
|
|
161
|
-
wasm.
|
|
394
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
395
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
162
396
|
}
|
|
163
397
|
}
|
|
164
398
|
constructor() {
|
|
@@ -170,12 +404,101 @@ export class WasmEngine {
|
|
|
170
404
|
}
|
|
171
405
|
if (Symbol.dispose) WasmEngine.prototype[Symbol.dispose] = WasmEngine.prototype.free;
|
|
172
406
|
|
|
407
|
+
/**
|
|
408
|
+
* Run the Lemma LSP over the given streams. Call from JS after creating
|
|
409
|
+
* an AsyncIterator (client → server messages) and a WritableStream (server → client).
|
|
410
|
+
* @param {ServerConfig} config
|
|
411
|
+
* @returns {Promise<void>}
|
|
412
|
+
*/
|
|
413
|
+
export function serve(config) {
|
|
414
|
+
_assertClass(config, ServerConfig);
|
|
415
|
+
var ptr0 = config.__destroy_into_raw();
|
|
416
|
+
const ret = wasm.serve(ptr0);
|
|
417
|
+
return takeObject(ret);
|
|
418
|
+
}
|
|
419
|
+
|
|
173
420
|
function __wbg_get_imports() {
|
|
174
421
|
const import0 = {
|
|
175
422
|
__proto__: null,
|
|
423
|
+
__wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
|
|
424
|
+
const ret = debugString(getObject(arg1));
|
|
425
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
426
|
+
const len1 = WASM_VECTOR_LEN;
|
|
427
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
428
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
429
|
+
},
|
|
430
|
+
__wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
|
|
431
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
432
|
+
return ret;
|
|
433
|
+
},
|
|
434
|
+
__wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
|
|
435
|
+
const val = getObject(arg0);
|
|
436
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
437
|
+
return ret;
|
|
438
|
+
},
|
|
439
|
+
__wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
|
|
440
|
+
const ret = getObject(arg0) === undefined;
|
|
441
|
+
return ret;
|
|
442
|
+
},
|
|
443
|
+
__wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
|
|
444
|
+
const obj = getObject(arg1);
|
|
445
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
446
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
447
|
+
var len1 = WASM_VECTOR_LEN;
|
|
448
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
449
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
450
|
+
},
|
|
176
451
|
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
177
452
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
178
453
|
},
|
|
454
|
+
__wbg__wbg_cb_unref_d9b87ff7982e3b21: function(arg0) {
|
|
455
|
+
getObject(arg0)._wbg_cb_unref();
|
|
456
|
+
},
|
|
457
|
+
__wbg_buffer_e0346dab6225d121: function(arg0) {
|
|
458
|
+
const ret = getObject(arg0).buffer;
|
|
459
|
+
return addHeapObject(ret);
|
|
460
|
+
},
|
|
461
|
+
__wbg_byobRequest_338ee64e53ddd87b: function(arg0) {
|
|
462
|
+
const ret = getObject(arg0).byobRequest;
|
|
463
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
464
|
+
},
|
|
465
|
+
__wbg_byteLength_96fd6c084c1a7a0d: function(arg0) {
|
|
466
|
+
const ret = getObject(arg0).byteLength;
|
|
467
|
+
return ret;
|
|
468
|
+
},
|
|
469
|
+
__wbg_byteOffset_c9e81ef47dca6819: function(arg0) {
|
|
470
|
+
const ret = getObject(arg0).byteOffset;
|
|
471
|
+
return ret;
|
|
472
|
+
},
|
|
473
|
+
__wbg_bytes_literal_aea1dac9bf84850e: function() {
|
|
474
|
+
const ret = bytes_literal();
|
|
475
|
+
return addHeapObject(ret);
|
|
476
|
+
},
|
|
477
|
+
__wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
|
|
478
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
479
|
+
return addHeapObject(ret);
|
|
480
|
+
}, arguments); },
|
|
481
|
+
__wbg_call_4708e0c13bdc8e95: function() { return handleError(function (arg0, arg1, arg2) {
|
|
482
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
483
|
+
return addHeapObject(ret);
|
|
484
|
+
}, arguments); },
|
|
485
|
+
__wbg_close_7c18aa67b8539098: function(arg0) {
|
|
486
|
+
getObject(arg0).close();
|
|
487
|
+
},
|
|
488
|
+
__wbg_close_7c324b6e045f281a: function(arg0) {
|
|
489
|
+
getObject(arg0).close();
|
|
490
|
+
},
|
|
491
|
+
__wbg_close_c40d5219e03385a2: function(arg0) {
|
|
492
|
+
const ret = getObject(arg0).close();
|
|
493
|
+
return addHeapObject(ret);
|
|
494
|
+
},
|
|
495
|
+
__wbg_done_57b39ecd9addfe81: function(arg0) {
|
|
496
|
+
const ret = getObject(arg0).done;
|
|
497
|
+
return ret;
|
|
498
|
+
},
|
|
499
|
+
__wbg_enqueue_6c79790ce6e00627: function(arg0, arg1) {
|
|
500
|
+
getObject(arg0).enqueue(getObject(arg1));
|
|
501
|
+
},
|
|
179
502
|
__wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {
|
|
180
503
|
let deferred0_0;
|
|
181
504
|
let deferred0_1;
|
|
@@ -184,28 +507,254 @@ function __wbg_get_imports() {
|
|
|
184
507
|
deferred0_1 = arg1;
|
|
185
508
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
186
509
|
} finally {
|
|
187
|
-
wasm.
|
|
510
|
+
wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
|
|
188
511
|
}
|
|
189
512
|
},
|
|
513
|
+
__wbg_fetch_a9bc66c159c18e19: function(arg0) {
|
|
514
|
+
const ret = fetch(getObject(arg0));
|
|
515
|
+
return addHeapObject(ret);
|
|
516
|
+
},
|
|
517
|
+
__wbg_getWriter_1d11da1210cc84ba: function() { return handleError(function (arg0) {
|
|
518
|
+
const ret = getObject(arg0).getWriter();
|
|
519
|
+
return addHeapObject(ret);
|
|
520
|
+
}, arguments); },
|
|
521
|
+
__wbg_instanceof_Error_8573fe0b0b480f46: function(arg0) {
|
|
522
|
+
let result;
|
|
523
|
+
try {
|
|
524
|
+
result = getObject(arg0) instanceof Error;
|
|
525
|
+
} catch (_) {
|
|
526
|
+
result = false;
|
|
527
|
+
}
|
|
528
|
+
const ret = result;
|
|
529
|
+
return ret;
|
|
530
|
+
},
|
|
531
|
+
__wbg_instanceof_Response_ee1d54d79ae41977: function(arg0) {
|
|
532
|
+
let result;
|
|
533
|
+
try {
|
|
534
|
+
result = getObject(arg0) instanceof Response;
|
|
535
|
+
} catch (_) {
|
|
536
|
+
result = false;
|
|
537
|
+
}
|
|
538
|
+
const ret = result;
|
|
539
|
+
return ret;
|
|
540
|
+
},
|
|
541
|
+
__wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
|
|
542
|
+
let result;
|
|
543
|
+
try {
|
|
544
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
545
|
+
} catch (_) {
|
|
546
|
+
result = false;
|
|
547
|
+
}
|
|
548
|
+
const ret = result;
|
|
549
|
+
return ret;
|
|
550
|
+
},
|
|
551
|
+
__wbg_length_32ed9a279acd054c: function(arg0) {
|
|
552
|
+
const ret = getObject(arg0).length;
|
|
553
|
+
return ret;
|
|
554
|
+
},
|
|
555
|
+
__wbg_message_9ddc4b9a62a7c379: function(arg0) {
|
|
556
|
+
const ret = getObject(arg0).message;
|
|
557
|
+
return addHeapObject(ret);
|
|
558
|
+
},
|
|
559
|
+
__wbg_name_446e25ef2cfdab5a: function(arg0) {
|
|
560
|
+
const ret = getObject(arg0).name;
|
|
561
|
+
return addHeapObject(ret);
|
|
562
|
+
},
|
|
563
|
+
__wbg_new_074b505417ada2d9: function() { return handleError(function () {
|
|
564
|
+
const ret = new URLSearchParams();
|
|
565
|
+
return addHeapObject(ret);
|
|
566
|
+
}, arguments); },
|
|
567
|
+
__wbg_new_361308b2356cecd0: function() {
|
|
568
|
+
const ret = new Object();
|
|
569
|
+
return addHeapObject(ret);
|
|
570
|
+
},
|
|
571
|
+
__wbg_new_64284bd487f9d239: function() { return handleError(function () {
|
|
572
|
+
const ret = new Headers();
|
|
573
|
+
return addHeapObject(ret);
|
|
574
|
+
}, arguments); },
|
|
575
|
+
__wbg_new_72b49615380db768: function(arg0, arg1) {
|
|
576
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
577
|
+
return addHeapObject(ret);
|
|
578
|
+
},
|
|
190
579
|
__wbg_new_8a6f238a6ece86ea: function() {
|
|
191
580
|
const ret = new Error();
|
|
581
|
+
return addHeapObject(ret);
|
|
582
|
+
},
|
|
583
|
+
__wbg_new_b5d9e2fb389fef91: function(arg0, arg1) {
|
|
584
|
+
try {
|
|
585
|
+
var state0 = {a: arg0, b: arg1};
|
|
586
|
+
var cb0 = (arg0, arg1) => {
|
|
587
|
+
const a = state0.a;
|
|
588
|
+
state0.a = 0;
|
|
589
|
+
try {
|
|
590
|
+
return __wasm_bindgen_func_elem_9930(a, state0.b, arg0, arg1);
|
|
591
|
+
} finally {
|
|
592
|
+
state0.a = a;
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
const ret = new Promise(cb0);
|
|
596
|
+
return addHeapObject(ret);
|
|
597
|
+
} finally {
|
|
598
|
+
state0.a = state0.b = 0;
|
|
599
|
+
}
|
|
600
|
+
},
|
|
601
|
+
__wbg_new_c2f21774701ddac7: function() { return handleError(function (arg0, arg1) {
|
|
602
|
+
const ret = new URL(getStringFromWasm0(arg0, arg1));
|
|
603
|
+
return addHeapObject(ret);
|
|
604
|
+
}, arguments); },
|
|
605
|
+
__wbg_new_from_slice_a3d2629dc1826784: function(arg0, arg1) {
|
|
606
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
607
|
+
return addHeapObject(ret);
|
|
608
|
+
},
|
|
609
|
+
__wbg_new_no_args_1c7c842f08d00ebb: function(arg0, arg1) {
|
|
610
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
611
|
+
return addHeapObject(ret);
|
|
612
|
+
},
|
|
613
|
+
__wbg_new_with_byte_offset_and_length_aa261d9c9da49eb1: function(arg0, arg1, arg2) {
|
|
614
|
+
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
615
|
+
return addHeapObject(ret);
|
|
616
|
+
},
|
|
617
|
+
__wbg_new_with_str_a7c7f835549b152a: function() { return handleError(function (arg0, arg1) {
|
|
618
|
+
const ret = new Request(getStringFromWasm0(arg0, arg1));
|
|
619
|
+
return addHeapObject(ret);
|
|
620
|
+
}, arguments); },
|
|
621
|
+
__wbg_new_with_str_and_init_a61cbc6bdef21614: function() { return handleError(function (arg0, arg1, arg2) {
|
|
622
|
+
const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
|
|
623
|
+
return addHeapObject(ret);
|
|
624
|
+
}, arguments); },
|
|
625
|
+
__wbg_next_0a5e0f8af98146aa: function() { return handleError(function (arg0) {
|
|
626
|
+
const ret = getObject(arg0).next();
|
|
627
|
+
return addHeapObject(ret);
|
|
628
|
+
}, arguments); },
|
|
629
|
+
__wbg_ok_87f537440a0acf85: function(arg0) {
|
|
630
|
+
const ret = getObject(arg0).ok;
|
|
192
631
|
return ret;
|
|
193
632
|
},
|
|
633
|
+
__wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
|
|
634
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
635
|
+
},
|
|
636
|
+
__wbg_queueMicrotask_0aa0a927f78f5d98: function(arg0) {
|
|
637
|
+
const ret = getObject(arg0).queueMicrotask;
|
|
638
|
+
return addHeapObject(ret);
|
|
639
|
+
},
|
|
640
|
+
__wbg_queueMicrotask_5bb536982f78a56f: function(arg0) {
|
|
641
|
+
queueMicrotask(getObject(arg0));
|
|
642
|
+
},
|
|
643
|
+
__wbg_ready_2258e8118fee9761: function(arg0) {
|
|
644
|
+
const ret = getObject(arg0).ready;
|
|
645
|
+
return addHeapObject(ret);
|
|
646
|
+
},
|
|
647
|
+
__wbg_releaseLock_aea38d9ddf66ea11: function(arg0) {
|
|
648
|
+
getObject(arg0).releaseLock();
|
|
649
|
+
},
|
|
650
|
+
__wbg_resolve_002c4b7d9d8f6b64: function(arg0) {
|
|
651
|
+
const ret = Promise.resolve(getObject(arg0));
|
|
652
|
+
return addHeapObject(ret);
|
|
653
|
+
},
|
|
654
|
+
__wbg_respond_f90c76a13ed2dae9: function(arg0, arg1) {
|
|
655
|
+
getObject(arg0).respond(arg1 >>> 0);
|
|
656
|
+
},
|
|
657
|
+
__wbg_search_143f09a35047e800: function(arg0, arg1) {
|
|
658
|
+
const ret = getObject(arg1).search;
|
|
659
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
660
|
+
const len1 = WASM_VECTOR_LEN;
|
|
661
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
662
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
663
|
+
},
|
|
664
|
+
__wbg_set_cc56eefd2dd91957: function(arg0, arg1, arg2) {
|
|
665
|
+
getObject(arg0).set(getArrayU8FromWasm0(arg1, arg2));
|
|
666
|
+
},
|
|
667
|
+
__wbg_set_headers_cfc5f4b2c1f20549: function(arg0, arg1) {
|
|
668
|
+
getObject(arg0).headers = getObject(arg1);
|
|
669
|
+
},
|
|
670
|
+
__wbg_set_method_c3e20375f5ae7fac: function(arg0, arg1, arg2) {
|
|
671
|
+
getObject(arg0).method = getStringFromWasm0(arg1, arg2);
|
|
672
|
+
},
|
|
673
|
+
__wbg_set_search_1d369b0f3868e132: function(arg0, arg1, arg2) {
|
|
674
|
+
getObject(arg0).search = getStringFromWasm0(arg1, arg2);
|
|
675
|
+
},
|
|
194
676
|
__wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {
|
|
195
|
-
const ret = arg1.stack;
|
|
196
|
-
const ptr1 = passStringToWasm0(ret, wasm.
|
|
677
|
+
const ret = getObject(arg1).stack;
|
|
678
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
197
679
|
const len1 = WASM_VECTOR_LEN;
|
|
198
680
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
199
681
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
200
682
|
},
|
|
201
|
-
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
683
|
+
__wbg_static_accessor_GLOBAL_12837167ad935116: function() {
|
|
684
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
685
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
686
|
+
},
|
|
687
|
+
__wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
|
|
688
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
689
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
690
|
+
},
|
|
691
|
+
__wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
|
|
692
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
693
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
694
|
+
},
|
|
695
|
+
__wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
|
|
696
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
697
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
698
|
+
},
|
|
699
|
+
__wbg_status_89d7e803db911ee7: function(arg0) {
|
|
700
|
+
const ret = getObject(arg0).status;
|
|
701
|
+
return ret;
|
|
702
|
+
},
|
|
703
|
+
__wbg_text_083b8727c990c8c0: function() { return handleError(function (arg0) {
|
|
704
|
+
const ret = getObject(arg0).text();
|
|
705
|
+
return addHeapObject(ret);
|
|
706
|
+
}, arguments); },
|
|
707
|
+
__wbg_then_0d9fe2c7b1857d32: function(arg0, arg1, arg2) {
|
|
708
|
+
const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
|
|
709
|
+
return addHeapObject(ret);
|
|
710
|
+
},
|
|
711
|
+
__wbg_then_b9e7b3b5f1a9e1b5: function(arg0, arg1) {
|
|
712
|
+
const ret = getObject(arg0).then(getObject(arg1));
|
|
713
|
+
return addHeapObject(ret);
|
|
714
|
+
},
|
|
715
|
+
__wbg_toString_029ac24421fd7a24: function(arg0) {
|
|
716
|
+
const ret = getObject(arg0).toString();
|
|
717
|
+
return addHeapObject(ret);
|
|
718
|
+
},
|
|
719
|
+
__wbg_toString_964ff7fe6eca8362: function(arg0) {
|
|
720
|
+
const ret = getObject(arg0).toString();
|
|
721
|
+
return addHeapObject(ret);
|
|
722
|
+
},
|
|
723
|
+
__wbg_url_36c39f6580d05409: function(arg0, arg1) {
|
|
724
|
+
const ret = getObject(arg1).url;
|
|
725
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
726
|
+
const len1 = WASM_VECTOR_LEN;
|
|
727
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
728
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
729
|
+
},
|
|
730
|
+
__wbg_value_0546255b415e96c1: function(arg0) {
|
|
731
|
+
const ret = getObject(arg0).value;
|
|
732
|
+
return addHeapObject(ret);
|
|
733
|
+
},
|
|
734
|
+
__wbg_view_b29b448440a527c0: function(arg0) {
|
|
735
|
+
const ret = getObject(arg0).view;
|
|
736
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
737
|
+
},
|
|
738
|
+
__wbg_write_c4a2180120884395: function(arg0, arg1) {
|
|
739
|
+
const ret = getObject(arg0).write(takeObject(arg1));
|
|
740
|
+
return addHeapObject(ret);
|
|
741
|
+
},
|
|
742
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
743
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1159, function: Function { arguments: [Externref], shim_idx: 1160, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
744
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_8774, __wasm_bindgen_func_elem_8789);
|
|
745
|
+
return addHeapObject(ret);
|
|
746
|
+
},
|
|
747
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
748
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
749
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
750
|
+
return addHeapObject(ret);
|
|
751
|
+
},
|
|
752
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
753
|
+
const ret = getObject(arg0);
|
|
754
|
+
return addHeapObject(ret);
|
|
755
|
+
},
|
|
756
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
757
|
+
takeObject(arg0);
|
|
209
758
|
},
|
|
210
759
|
};
|
|
211
760
|
return {
|
|
@@ -214,10 +763,136 @@ function __wbg_get_imports() {
|
|
|
214
763
|
};
|
|
215
764
|
}
|
|
216
765
|
|
|
766
|
+
function __wasm_bindgen_func_elem_8789(arg0, arg1, arg2) {
|
|
767
|
+
wasm.__wasm_bindgen_func_elem_8789(arg0, arg1, addHeapObject(arg2));
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
function __wasm_bindgen_func_elem_9930(arg0, arg1, arg2, arg3) {
|
|
771
|
+
wasm.__wasm_bindgen_func_elem_9930(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
const __wbindgen_enum_ReadableStreamReaderMode = ["byob"];
|
|
776
|
+
const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
777
|
+
? { register: () => {}, unregister: () => {} }
|
|
778
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1));
|
|
779
|
+
const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
780
|
+
? { register: () => {}, unregister: () => {} }
|
|
781
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1));
|
|
782
|
+
const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
783
|
+
? { register: () => {}, unregister: () => {} }
|
|
784
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1));
|
|
785
|
+
const PipeOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
786
|
+
? { register: () => {}, unregister: () => {} }
|
|
787
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_pipeoptions_free(ptr >>> 0, 1));
|
|
788
|
+
const QueuingStrategyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
789
|
+
? { register: () => {}, unregister: () => {} }
|
|
790
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_queuingstrategy_free(ptr >>> 0, 1));
|
|
791
|
+
const ReadableStreamGetReaderOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
792
|
+
? { register: () => {}, unregister: () => {} }
|
|
793
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_readablestreamgetreaderoptions_free(ptr >>> 0, 1));
|
|
794
|
+
const ServerConfigFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
795
|
+
? { register: () => {}, unregister: () => {} }
|
|
796
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_serverconfig_free(ptr >>> 0, 1));
|
|
217
797
|
const WasmEngineFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
218
798
|
? { register: () => {}, unregister: () => {} }
|
|
219
799
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmengine_free(ptr >>> 0, 1));
|
|
220
800
|
|
|
801
|
+
function addHeapObject(obj) {
|
|
802
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
803
|
+
const idx = heap_next;
|
|
804
|
+
heap_next = heap[idx];
|
|
805
|
+
|
|
806
|
+
heap[idx] = obj;
|
|
807
|
+
return idx;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
function _assertClass(instance, klass) {
|
|
811
|
+
if (!(instance instanceof klass)) {
|
|
812
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
817
|
+
? { register: () => {}, unregister: () => {} }
|
|
818
|
+
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
|
|
819
|
+
|
|
820
|
+
function debugString(val) {
|
|
821
|
+
// primitive types
|
|
822
|
+
const type = typeof val;
|
|
823
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
824
|
+
return `${val}`;
|
|
825
|
+
}
|
|
826
|
+
if (type == 'string') {
|
|
827
|
+
return `"${val}"`;
|
|
828
|
+
}
|
|
829
|
+
if (type == 'symbol') {
|
|
830
|
+
const description = val.description;
|
|
831
|
+
if (description == null) {
|
|
832
|
+
return 'Symbol';
|
|
833
|
+
} else {
|
|
834
|
+
return `Symbol(${description})`;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
if (type == 'function') {
|
|
838
|
+
const name = val.name;
|
|
839
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
840
|
+
return `Function(${name})`;
|
|
841
|
+
} else {
|
|
842
|
+
return 'Function';
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
// objects
|
|
846
|
+
if (Array.isArray(val)) {
|
|
847
|
+
const length = val.length;
|
|
848
|
+
let debug = '[';
|
|
849
|
+
if (length > 0) {
|
|
850
|
+
debug += debugString(val[0]);
|
|
851
|
+
}
|
|
852
|
+
for(let i = 1; i < length; i++) {
|
|
853
|
+
debug += ', ' + debugString(val[i]);
|
|
854
|
+
}
|
|
855
|
+
debug += ']';
|
|
856
|
+
return debug;
|
|
857
|
+
}
|
|
858
|
+
// Test for built-in
|
|
859
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
860
|
+
let className;
|
|
861
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
862
|
+
className = builtInMatches[1];
|
|
863
|
+
} else {
|
|
864
|
+
// Failed to match the standard '[object ClassName]'
|
|
865
|
+
return toString.call(val);
|
|
866
|
+
}
|
|
867
|
+
if (className == 'Object') {
|
|
868
|
+
// we're a user defined class or Object
|
|
869
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
870
|
+
// easier than looping through ownProperties of `val`.
|
|
871
|
+
try {
|
|
872
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
873
|
+
} catch (_) {
|
|
874
|
+
return 'Object';
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
// errors
|
|
878
|
+
if (val instanceof Error) {
|
|
879
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
880
|
+
}
|
|
881
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
882
|
+
return className;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
function dropObject(idx) {
|
|
886
|
+
if (idx < 132) return;
|
|
887
|
+
heap[idx] = heap_next;
|
|
888
|
+
heap_next = idx;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
892
|
+
ptr = ptr >>> 0;
|
|
893
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
894
|
+
}
|
|
895
|
+
|
|
221
896
|
let cachedDataViewMemory0 = null;
|
|
222
897
|
function getDataViewMemory0() {
|
|
223
898
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
@@ -239,6 +914,53 @@ function getUint8ArrayMemory0() {
|
|
|
239
914
|
return cachedUint8ArrayMemory0;
|
|
240
915
|
}
|
|
241
916
|
|
|
917
|
+
function getObject(idx) { return heap[idx]; }
|
|
918
|
+
|
|
919
|
+
function handleError(f, args) {
|
|
920
|
+
try {
|
|
921
|
+
return f.apply(this, args);
|
|
922
|
+
} catch (e) {
|
|
923
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
let heap = new Array(128).fill(undefined);
|
|
928
|
+
heap.push(undefined, null, true, false);
|
|
929
|
+
|
|
930
|
+
let heap_next = heap.length;
|
|
931
|
+
|
|
932
|
+
function isLikeNone(x) {
|
|
933
|
+
return x === undefined || x === null;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
937
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
938
|
+
const real = (...args) => {
|
|
939
|
+
|
|
940
|
+
// First up with a closure we increment the internal reference
|
|
941
|
+
// count. This ensures that the Rust closure environment won't
|
|
942
|
+
// be deallocated while we're invoking it.
|
|
943
|
+
state.cnt++;
|
|
944
|
+
const a = state.a;
|
|
945
|
+
state.a = 0;
|
|
946
|
+
try {
|
|
947
|
+
return f(a, state.b, ...args);
|
|
948
|
+
} finally {
|
|
949
|
+
state.a = a;
|
|
950
|
+
real._wbg_cb_unref();
|
|
951
|
+
}
|
|
952
|
+
};
|
|
953
|
+
real._wbg_cb_unref = () => {
|
|
954
|
+
if (--state.cnt === 0) {
|
|
955
|
+
state.dtor(state.a, state.b);
|
|
956
|
+
state.a = 0;
|
|
957
|
+
CLOSURE_DTORS.unregister(state);
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
961
|
+
return real;
|
|
962
|
+
}
|
|
963
|
+
|
|
242
964
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
243
965
|
if (realloc === undefined) {
|
|
244
966
|
const buf = cachedTextEncoder.encode(arg);
|
|
@@ -276,6 +998,12 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
276
998
|
return ptr;
|
|
277
999
|
}
|
|
278
1000
|
|
|
1001
|
+
function takeObject(idx) {
|
|
1002
|
+
const ret = getObject(idx);
|
|
1003
|
+
dropObject(idx);
|
|
1004
|
+
return ret;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
279
1007
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
280
1008
|
cachedTextDecoder.decode();
|
|
281
1009
|
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
@@ -311,7 +1039,6 @@ function __wbg_finalize_init(instance, module) {
|
|
|
311
1039
|
wasmModule = module;
|
|
312
1040
|
cachedDataViewMemory0 = null;
|
|
313
1041
|
cachedUint8ArrayMemory0 = null;
|
|
314
|
-
wasm.__wbindgen_start();
|
|
315
1042
|
return wasm;
|
|
316
1043
|
}
|
|
317
1044
|
|
package/lemma_bg.wasm
CHANGED
|
Binary file
|
package/lemma_bg.wasm.d.ts
CHANGED
|
@@ -1,17 +1,44 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_serverconfig_free: (a: number, b: number) => void;
|
|
5
|
+
export const serve: (a: number) => number;
|
|
6
|
+
export const serverconfig_new: (a: number, b: number) => number;
|
|
7
|
+
export const __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
8
|
+
export const __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
|
9
|
+
export const __wbg_intounderlyingsource_free: (a: number, b: number) => void;
|
|
10
|
+
export const __wbg_pipeoptions_free: (a: number, b: number) => void;
|
|
11
|
+
export const __wbg_queuingstrategy_free: (a: number, b: number) => void;
|
|
12
|
+
export const __wbg_readablestreamgetreaderoptions_free: (a: number, b: number) => void;
|
|
13
|
+
export const intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
14
|
+
export const intounderlyingbytesource_cancel: (a: number) => void;
|
|
15
|
+
export const intounderlyingbytesource_pull: (a: number, b: number) => number;
|
|
16
|
+
export const intounderlyingbytesource_start: (a: number, b: number) => void;
|
|
17
|
+
export const intounderlyingbytesource_type: (a: number) => number;
|
|
18
|
+
export const intounderlyingsink_abort: (a: number, b: number) => number;
|
|
19
|
+
export const intounderlyingsink_close: (a: number) => number;
|
|
20
|
+
export const intounderlyingsink_write: (a: number, b: number) => number;
|
|
21
|
+
export const intounderlyingsource_cancel: (a: number) => void;
|
|
22
|
+
export const intounderlyingsource_pull: (a: number, b: number) => number;
|
|
23
|
+
export const pipeoptions_preventAbort: (a: number) => number;
|
|
24
|
+
export const pipeoptions_preventCancel: (a: number) => number;
|
|
25
|
+
export const pipeoptions_preventClose: (a: number) => number;
|
|
26
|
+
export const pipeoptions_signal: (a: number) => number;
|
|
27
|
+
export const queuingstrategy_highWaterMark: (a: number) => number;
|
|
28
|
+
export const readablestreamgetreaderoptions_mode: (a: number) => number;
|
|
4
29
|
export const __wbg_wasmengine_free: (a: number, b: number) => void;
|
|
5
|
-
export const
|
|
6
|
-
export const wasmengine_evaluate: (a: number, b: number, c: number, d: number, e: number
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
11
|
-
export const wasmengine_listDocuments: (a: number) => [number, number];
|
|
30
|
+
export const wasmengine_addLemmaFile: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
31
|
+
export const wasmengine_evaluate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
32
|
+
export const wasmengine_formatSource: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
33
|
+
export const wasmengine_getSchema: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
34
|
+
export const wasmengine_invert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
35
|
+
export const wasmengine_listDocuments: (a: number, b: number) => void;
|
|
12
36
|
export const wasmengine_new: () => number;
|
|
13
|
-
export const
|
|
14
|
-
export const
|
|
15
|
-
export const
|
|
16
|
-
export const
|
|
17
|
-
export const
|
|
37
|
+
export const __wasm_bindgen_func_elem_8774: (a: number, b: number) => void;
|
|
38
|
+
export const __wasm_bindgen_func_elem_9930: (a: number, b: number, c: number, d: number) => void;
|
|
39
|
+
export const __wasm_bindgen_func_elem_8789: (a: number, b: number, c: number) => void;
|
|
40
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
41
|
+
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
42
|
+
export const __wbindgen_export3: (a: number) => void;
|
|
43
|
+
export const __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
44
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@benrogmans/lemma-engine",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.7.4",
|
|
4
|
+
"description": "Language Server Protocol implementation for Lemma",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lemma.js",
|
|
7
7
|
"types": "lemma.d.ts",
|
|
@@ -13,11 +13,6 @@
|
|
|
13
13
|
"lemma_bg.wasm.d.ts"
|
|
14
14
|
],
|
|
15
15
|
"keywords": [
|
|
16
|
-
"logic",
|
|
17
|
-
"rules",
|
|
18
|
-
"declarative",
|
|
19
|
-
"dsl",
|
|
20
|
-
"rust",
|
|
21
16
|
"wasm",
|
|
22
17
|
"webassembly"
|
|
23
18
|
],
|