@benrogmans/lemma-engine 0.7.5 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,191 @@
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 2025 Ben Rogmans
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.
191
+
package/README.md CHANGED
@@ -48,23 +48,23 @@ const engine = new WasmEngine();
48
48
 
49
49
  #### `addLemmaFile(code: string, filename: string): string`
50
50
 
51
- Adds a Lemma document to the engine.
51
+ Adds a Lemma spec to the engine.
52
52
 
53
53
  ```javascript
54
54
  const result = engine.addLemmaFile(`
55
- doc employee_contract
55
+ spec employee_contract
56
56
 
57
- fact salary = 5000 eur
58
- fact start_date = 2024-01-15
59
- fact vacation_days = 25
57
+ fact salary: 5000 eur
58
+ fact start_date: 2024-01-15
59
+ fact vacation_days: 25
60
60
 
61
- rule annual_salary = salary * 12
62
- rule daily_rate = salary / 21
61
+ rule annual_salary: salary * 12
62
+ rule daily_rate: salary / 21
63
63
  `, 'employee.lemma');
64
64
 
65
65
  const response = JSON.parse(result);
66
66
  if (response.success) {
67
- console.log('Document loaded:', response.data);
67
+ console.log('Spec loaded:', response.data);
68
68
  } else {
69
69
  console.error('Error:', response.error);
70
70
  }
@@ -72,7 +72,7 @@ if (response.success) {
72
72
 
73
73
  #### `evaluate(docName: string, facts: string): string`
74
74
 
75
- Evaluates a document with optional runtime facts.
75
+ Evaluates a spec with optional runtime facts.
76
76
 
77
77
  ```javascript
78
78
  // Evaluate with default facts
@@ -86,24 +86,24 @@ const result2 = engine.evaluate('employee_contract', JSON.stringify({
86
86
 
87
87
  const response = JSON.parse(result2);
88
88
  if (response.success) {
89
- console.log('Document:', response.data.document);
89
+ console.log('Spec:', response.data.spec);
90
90
  console.log('Rules:', response.data.rules);
91
91
  // Access specific rule results directly:
92
92
  // response.data.rules.annual_salary.value
93
93
  }
94
94
  ```
95
95
 
96
- #### `listDocuments(): string`
96
+ #### `listSpecs(): string`
97
97
 
98
- Lists all loaded documents in the engine.
98
+ Lists all loaded specs in the engine.
99
99
 
100
100
  ```javascript
101
- const result = engine.listDocuments();
101
+ const result = engine.listSpecs();
102
102
  const response = JSON.parse(result);
103
103
 
104
104
  if (response.success) {
105
- console.log('Loaded documents:', response.data);
106
- // response.data is an array of document names
105
+ console.log('Loaded specs:', response.data);
106
+ // response.data is an array of spec names
107
107
  }
108
108
  ```
109
109
 
@@ -132,35 +132,35 @@ async function calculatePricing() {
132
132
 
133
133
  // Define pricing rules
134
134
  const pricingDoc = `
135
- doc product_pricing
135
+ spec product_pricing
136
136
 
137
- fact base_price = 100 usd
138
- fact quantity = 1
139
- fact is_member = false
140
- fact promo_code = ""
137
+ fact base_price: 100 usd
138
+ fact quantity: 1
139
+ fact is_member: false
140
+ fact promo_code: ""
141
141
 
142
- rule bulk_discount = 0%
142
+ rule bulk_discount: 0%
143
143
  unless quantity >= 10 then 5%
144
144
  unless quantity >= 50 then 10%
145
145
  unless quantity >= 100 then 15%
146
146
 
147
- rule member_discount = 0%
147
+ rule member_discount: 0%
148
148
  unless is_member then 10%
149
149
 
150
- rule promo_discount = 0%
150
+ rule promo_discount: 0%
151
151
  unless promo_code == "SAVE10" then 10%
152
152
  unless promo_code == "SAVE20" then 20%
153
153
 
154
- rule best_discount = bulk_discount?
155
- unless member_discount? >= bulk_discount? then member_discount?
156
- unless promo_discount? >= bulk_discount? then promo_discount?
157
- unless member_discount? >= promo_discount? then member_discount?
158
- unless promo_discount? >= member_discount? then promo_discount?
154
+ rule best_discount: bulk_discount
155
+ unless member_discount >= bulk_discount then member_discount
156
+ unless promo_discount >= bulk_discount then promo_discount
157
+ unless member_discount >= promo_discount then member_discount
158
+ unless promo_discount >= member_discount then promo_discount
159
159
 
160
- rule final_price = base_price * quantity * (1 - best_discount?)
160
+ rule final_price: base_price * quantity * (1 - best_discount)
161
161
  `;
162
162
 
163
- // Load the document
163
+ // Load the spec
164
164
  const loadResult = JSON.parse(
165
165
  engine.addLemmaFile(pricingDoc, 'pricing.lemma')
166
166
  );
@@ -219,7 +219,7 @@ interface PricingResults {
219
219
  interface EvaluationResponse {
220
220
  success: boolean;
221
221
  data?: {
222
- document: string;
222
+ spec: string;
223
223
  rules: {
224
224
  [ruleName: string]: {
225
225
  value: any; // The computed value (e.g., {Number: "100"})
@@ -233,14 +233,14 @@ interface EvaluationResponse {
233
233
  };
234
234
  };
235
235
  error?: string;
236
- warnings?: string[]; // Document-level warnings
236
+ warnings?: string[]; // Spec-level warnings
237
237
  }
238
238
 
239
239
  async function typedExample() {
240
240
  await init();
241
241
  const engine = new WasmEngine();
242
242
 
243
- // ... load document
243
+ // ... load spec
244
244
 
245
245
  const facts = {
246
246
  quantity: 10,
@@ -279,8 +279,8 @@ try {
279
279
  ### Performance Tips
280
280
 
281
281
  1. **Initialize once**: The WASM module should be initialized once per application
282
- 2. **Reuse engines**: Create one `WasmEngine` and load multiple documents
283
- 3. **Batch operations**: Load all documents before evaluating
282
+ 2. **Reuse engines**: Create one `WasmEngine` and load multiple specs
283
+ 3. **Batch operations**: Load all specs before evaluating
284
284
  4. **Cache results**: Evaluation results can be cached if facts don't change
285
285
 
286
286
  ### Compatibility
package/lemma.d.ts CHANGED
@@ -70,39 +70,26 @@ export class ServerConfig {
70
70
  export class WasmEngine {
71
71
  free(): void;
72
72
  [Symbol.dispose](): void;
73
- /**
74
- * Add Lemma source (e.g. file contents). Returns a Promise that resolves to a JSON string result.
75
- */
76
73
  addLemmaFile(code: string, source: string): Promise<any>;
77
74
  /**
78
- * Evaluate rules in a document.
79
- *
80
- * Pass `rule_names_json` as `"[]"` or `""` to evaluate all rules.
81
- * Pass a JSON array like `'["total","discount"]'` to evaluate specific rules.
75
+ * Evaluate at current time.
82
76
  */
83
- evaluate(doc_name: string, rule_names_json: string, fact_values_json: string): string;
77
+ evaluate(spec_name: string, hash: string, rule_names_json: string, fact_values_json: string): string;
84
78
  /**
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.
79
+ * Evaluate at a specific datetime.
88
80
  */
81
+ evaluateEffective(spec_name: string, effective: string, hash: string, rule_names_json: string, fact_values_json: string): string;
89
82
  formatSource(code: string, source_attribute: string): string;
90
83
  /**
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.
84
+ * Schema at current time.
96
85
  */
97
- getSchema(doc_name: string, rule_names_json: string): string;
98
- invert(_doc_name: string, _rule_name: string, _target_json: string, _provided_values_json: string): string;
86
+ getSchema(spec_name: string, rule_names_json: string): string;
99
87
  /**
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.
88
+ * Schema at a specific datetime.
104
89
  */
105
- listDocuments(): string;
90
+ getSchemaEffective(spec_name: string, effective: string, rule_names_json: string): string;
91
+ invert(_spec_name: string, _rule_name: string, _target_json: string, _provided_values_json: string): string;
92
+ listSpecs(): string;
106
93
  constructor();
107
94
  }
108
95
 
@@ -143,15 +130,19 @@ export interface InitOutput {
143
130
  readonly readablestreamgetreaderoptions_mode: (a: number) => number;
144
131
  readonly __wbg_wasmengine_free: (a: number, b: number) => void;
145
132
  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;
133
+ readonly wasmengine_evaluate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
134
+ readonly wasmengine_evaluateEffective: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
147
135
  readonly wasmengine_formatSource: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
148
136
  readonly wasmengine_getSchema: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
137
+ readonly wasmengine_getSchemaEffective: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
149
138
  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;
139
+ readonly wasmengine_listSpecs: (a: number, b: number) => void;
151
140
  readonly wasmengine_new: () => number;
152
- readonly __wasm_bindgen_func_elem_8773: (a: number, b: number) => void;
153
- readonly __wasm_bindgen_func_elem_9929: (a: number, b: number, c: number, d: number) => void;
154
- readonly __wasm_bindgen_func_elem_8788: (a: number, b: number, c: number) => void;
141
+ readonly __wasm_bindgen_func_elem_9296: (a: number, b: number) => void;
142
+ readonly __wasm_bindgen_func_elem_356: (a: number, b: number) => void;
143
+ readonly __wasm_bindgen_func_elem_10439: (a: number, b: number, c: number, d: number) => void;
144
+ readonly __wasm_bindgen_func_elem_2709: (a: number, b: number, c: number, d: number) => void;
145
+ readonly __wasm_bindgen_func_elem_10458: (a: number, b: number, c: number, d: number) => void;
155
146
  readonly __wbindgen_export: (a: number, b: number) => number;
156
147
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
157
148
  readonly __wbindgen_export3: (a: number) => void;
package/lemma.js CHANGED
@@ -238,7 +238,6 @@ export class WasmEngine {
238
238
  wasm.__wbg_wasmengine_free(ptr, 0);
239
239
  }
240
240
  /**
241
- * Add Lemma source (e.g. file contents). Returns a Promise that resolves to a JSON string result.
242
241
  * @param {string} code
243
242
  * @param {string} source
244
243
  * @returns {Promise<any>}
@@ -252,41 +251,73 @@ export class WasmEngine {
252
251
  return takeObject(ret);
253
252
  }
254
253
  /**
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.
259
- * @param {string} doc_name
254
+ * Evaluate at current time.
255
+ * @param {string} spec_name
256
+ * @param {string} hash
260
257
  * @param {string} rule_names_json
261
258
  * @param {string} fact_values_json
262
259
  * @returns {string}
263
260
  */
264
- evaluate(doc_name, rule_names_json, fact_values_json) {
265
- let deferred4_0;
266
- let deferred4_1;
261
+ evaluate(spec_name, hash, rule_names_json, fact_values_json) {
262
+ let deferred5_0;
263
+ let deferred5_1;
267
264
  try {
268
265
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
269
- const ptr0 = passStringToWasm0(doc_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
266
+ const ptr0 = passStringToWasm0(spec_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
270
267
  const len0 = WASM_VECTOR_LEN;
271
- const ptr1 = passStringToWasm0(rule_names_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
268
+ const ptr1 = passStringToWasm0(hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
272
269
  const len1 = WASM_VECTOR_LEN;
273
- const ptr2 = passStringToWasm0(fact_values_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
270
+ const ptr2 = passStringToWasm0(rule_names_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
274
271
  const len2 = WASM_VECTOR_LEN;
275
- wasm.wasmengine_evaluate(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
272
+ const ptr3 = passStringToWasm0(fact_values_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
273
+ const len3 = WASM_VECTOR_LEN;
274
+ wasm.wasmengine_evaluate(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
276
275
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
277
276
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
278
- deferred4_0 = r0;
279
- deferred4_1 = r1;
277
+ deferred5_0 = r0;
278
+ deferred5_1 = r1;
280
279
  return getStringFromWasm0(r0, r1);
281
280
  } finally {
282
281
  wasm.__wbindgen_add_to_stack_pointer(16);
283
- wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
282
+ wasm.__wbindgen_export4(deferred5_0, deferred5_1, 1);
283
+ }
284
+ }
285
+ /**
286
+ * Evaluate at a specific datetime.
287
+ * @param {string} spec_name
288
+ * @param {string} effective
289
+ * @param {string} hash
290
+ * @param {string} rule_names_json
291
+ * @param {string} fact_values_json
292
+ * @returns {string}
293
+ */
294
+ evaluateEffective(spec_name, effective, hash, rule_names_json, fact_values_json) {
295
+ let deferred6_0;
296
+ let deferred6_1;
297
+ try {
298
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
299
+ const ptr0 = passStringToWasm0(spec_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
300
+ const len0 = WASM_VECTOR_LEN;
301
+ const ptr1 = passStringToWasm0(effective, wasm.__wbindgen_export, wasm.__wbindgen_export2);
302
+ const len1 = WASM_VECTOR_LEN;
303
+ const ptr2 = passStringToWasm0(hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
304
+ const len2 = WASM_VECTOR_LEN;
305
+ const ptr3 = passStringToWasm0(rule_names_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
306
+ const len3 = WASM_VECTOR_LEN;
307
+ const ptr4 = passStringToWasm0(fact_values_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
308
+ const len4 = WASM_VECTOR_LEN;
309
+ wasm.wasmengine_evaluateEffective(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
310
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
311
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
312
+ deferred6_0 = r0;
313
+ deferred6_1 = r1;
314
+ return getStringFromWasm0(r0, r1);
315
+ } finally {
316
+ wasm.__wbindgen_add_to_stack_pointer(16);
317
+ wasm.__wbindgen_export4(deferred6_0, deferred6_1, 1);
284
318
  }
285
319
  }
286
320
  /**
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
321
  * @param {string} code
291
322
  * @param {string} source_attribute
292
323
  * @returns {string}
@@ -312,21 +343,17 @@ export class WasmEngine {
312
343
  }
313
344
  }
314
345
  /**
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.
320
- * @param {string} doc_name
346
+ * Schema at current time.
347
+ * @param {string} spec_name
321
348
  * @param {string} rule_names_json
322
349
  * @returns {string}
323
350
  */
324
- getSchema(doc_name, rule_names_json) {
351
+ getSchema(spec_name, rule_names_json) {
325
352
  let deferred3_0;
326
353
  let deferred3_1;
327
354
  try {
328
355
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
329
- const ptr0 = passStringToWasm0(doc_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
356
+ const ptr0 = passStringToWasm0(spec_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
330
357
  const len0 = WASM_VECTOR_LEN;
331
358
  const ptr1 = passStringToWasm0(rule_names_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
332
359
  const len1 = WASM_VECTOR_LEN;
@@ -342,18 +369,47 @@ export class WasmEngine {
342
369
  }
343
370
  }
344
371
  /**
345
- * @param {string} _doc_name
372
+ * Schema at a specific datetime.
373
+ * @param {string} spec_name
374
+ * @param {string} effective
375
+ * @param {string} rule_names_json
376
+ * @returns {string}
377
+ */
378
+ getSchemaEffective(spec_name, effective, rule_names_json) {
379
+ let deferred4_0;
380
+ let deferred4_1;
381
+ try {
382
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
383
+ const ptr0 = passStringToWasm0(spec_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
384
+ const len0 = WASM_VECTOR_LEN;
385
+ const ptr1 = passStringToWasm0(effective, wasm.__wbindgen_export, wasm.__wbindgen_export2);
386
+ const len1 = WASM_VECTOR_LEN;
387
+ const ptr2 = passStringToWasm0(rule_names_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
388
+ const len2 = WASM_VECTOR_LEN;
389
+ wasm.wasmengine_getSchemaEffective(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
390
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
391
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
392
+ deferred4_0 = r0;
393
+ deferred4_1 = r1;
394
+ return getStringFromWasm0(r0, r1);
395
+ } finally {
396
+ wasm.__wbindgen_add_to_stack_pointer(16);
397
+ wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
398
+ }
399
+ }
400
+ /**
401
+ * @param {string} _spec_name
346
402
  * @param {string} _rule_name
347
403
  * @param {string} _target_json
348
404
  * @param {string} _provided_values_json
349
405
  * @returns {string}
350
406
  */
351
- invert(_doc_name, _rule_name, _target_json, _provided_values_json) {
407
+ invert(_spec_name, _rule_name, _target_json, _provided_values_json) {
352
408
  let deferred5_0;
353
409
  let deferred5_1;
354
410
  try {
355
411
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
356
- const ptr0 = passStringToWasm0(_doc_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
412
+ const ptr0 = passStringToWasm0(_spec_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
357
413
  const len0 = WASM_VECTOR_LEN;
358
414
  const ptr1 = passStringToWasm0(_rule_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
359
415
  const len1 = WASM_VECTOR_LEN;
@@ -373,18 +429,14 @@ export class WasmEngine {
373
429
  }
374
430
  }
375
431
  /**
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.
380
432
  * @returns {string}
381
433
  */
382
- listDocuments() {
434
+ listSpecs() {
383
435
  let deferred1_0;
384
436
  let deferred1_1;
385
437
  try {
386
438
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
387
- wasm.wasmengine_listDocuments(retptr, this.__wbg_ptr);
439
+ wasm.wasmengine_listSpecs(retptr, this.__wbg_ptr);
388
440
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
389
441
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
390
442
  deferred1_0 = r0;
@@ -420,27 +472,27 @@ export function serve(config) {
420
472
  function __wbg_get_imports() {
421
473
  const import0 = {
422
474
  __proto__: null,
423
- __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
475
+ __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
424
476
  const ret = debugString(getObject(arg1));
425
477
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
426
478
  const len1 = WASM_VECTOR_LEN;
427
479
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
428
480
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
429
481
  },
430
- __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
482
+ __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
431
483
  const ret = typeof(getObject(arg0)) === 'function';
432
484
  return ret;
433
485
  },
434
- __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
486
+ __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
435
487
  const val = getObject(arg0);
436
488
  const ret = typeof(val) === 'object' && val !== null;
437
489
  return ret;
438
490
  },
439
- __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
491
+ __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
440
492
  const ret = getObject(arg0) === undefined;
441
493
  return ret;
442
494
  },
443
- __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
495
+ __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
444
496
  const obj = getObject(arg1);
445
497
  const ret = typeof(obj) === 'string' ? obj : undefined;
446
498
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
@@ -448,58 +500,54 @@ function __wbg_get_imports() {
448
500
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
449
501
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
450
502
  },
451
- __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
503
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
452
504
  throw new Error(getStringFromWasm0(arg0, arg1));
453
505
  },
454
- __wbg__wbg_cb_unref_d9b87ff7982e3b21: function(arg0) {
506
+ __wbg__wbg_cb_unref_6b5b6b8576d35cb1: function(arg0) {
455
507
  getObject(arg0)._wbg_cb_unref();
456
508
  },
457
- __wbg_buffer_e0346dab6225d121: function(arg0) {
509
+ __wbg_buffer_e0851da9dee8b991: function(arg0) {
458
510
  const ret = getObject(arg0).buffer;
459
511
  return addHeapObject(ret);
460
512
  },
461
- __wbg_byobRequest_338ee64e53ddd87b: function(arg0) {
513
+ __wbg_byobRequest_b7b7dc91511df816: function(arg0) {
462
514
  const ret = getObject(arg0).byobRequest;
463
515
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
464
516
  },
465
- __wbg_byteLength_96fd6c084c1a7a0d: function(arg0) {
517
+ __wbg_byteLength_811fef9e08eaa78e: function(arg0) {
466
518
  const ret = getObject(arg0).byteLength;
467
519
  return ret;
468
520
  },
469
- __wbg_byteOffset_c9e81ef47dca6819: function(arg0) {
521
+ __wbg_byteOffset_ea230546a0297033: function(arg0) {
470
522
  const ret = getObject(arg0).byteOffset;
471
523
  return ret;
472
524
  },
473
- __wbg_bytes_literal_aea1dac9bf84850e: function() {
525
+ __wbg_bytes_literal_e5a87f6707f097d2: function() {
474
526
  const ret = bytes_literal();
475
527
  return addHeapObject(ret);
476
528
  },
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) {
529
+ __wbg_call_2d781c1f4d5c0ef8: function() { return handleError(function (arg0, arg1, arg2) {
482
530
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
483
531
  return addHeapObject(ret);
484
532
  }, arguments); },
485
- __wbg_close_7c18aa67b8539098: function(arg0) {
486
- getObject(arg0).close();
533
+ __wbg_close_45c653345d40a7e8: function(arg0) {
534
+ const ret = getObject(arg0).close();
535
+ return addHeapObject(ret);
487
536
  },
488
- __wbg_close_7c324b6e045f281a: function(arg0) {
537
+ __wbg_close_7a687d357ff8e0e0: function(arg0) {
489
538
  getObject(arg0).close();
490
539
  },
491
- __wbg_close_c40d5219e03385a2: function(arg0) {
492
- const ret = getObject(arg0).close();
493
- return addHeapObject(ret);
540
+ __wbg_close_8d217f4c57faede7: function(arg0) {
541
+ getObject(arg0).close();
494
542
  },
495
- __wbg_done_57b39ecd9addfe81: function(arg0) {
543
+ __wbg_done_08ce71ee07e3bd17: function(arg0) {
496
544
  const ret = getObject(arg0).done;
497
545
  return ret;
498
546
  },
499
- __wbg_enqueue_6c79790ce6e00627: function(arg0, arg1) {
547
+ __wbg_enqueue_74e7ffeb3e67888a: function(arg0, arg1) {
500
548
  getObject(arg0).enqueue(getObject(arg1));
501
549
  },
502
- __wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {
550
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
503
551
  let deferred0_0;
504
552
  let deferred0_1;
505
553
  try {
@@ -510,15 +558,23 @@ function __wbg_get_imports() {
510
558
  wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
511
559
  }
512
560
  },
513
- __wbg_fetch_a9bc66c159c18e19: function(arg0) {
561
+ __wbg_fetch_8d9b732df7467c44: function(arg0) {
514
562
  const ret = fetch(getObject(arg0));
515
563
  return addHeapObject(ret);
516
564
  },
517
- __wbg_getWriter_1d11da1210cc84ba: function() { return handleError(function (arg0) {
565
+ __wbg_getTime_1dad7b5386ddd2d9: function(arg0) {
566
+ const ret = getObject(arg0).getTime();
567
+ return ret;
568
+ },
569
+ __wbg_getTimezoneOffset_639bcf2dde21158b: function(arg0) {
570
+ const ret = getObject(arg0).getTimezoneOffset();
571
+ return ret;
572
+ },
573
+ __wbg_getWriter_149120e35db2c28d: function() { return handleError(function (arg0) {
518
574
  const ret = getObject(arg0).getWriter();
519
575
  return addHeapObject(ret);
520
576
  }, arguments); },
521
- __wbg_instanceof_Error_8573fe0b0b480f46: function(arg0) {
577
+ __wbg_instanceof_Error_4691a5b466e32a80: function(arg0) {
522
578
  let result;
523
579
  try {
524
580
  result = getObject(arg0) instanceof Error;
@@ -528,7 +584,7 @@ function __wbg_get_imports() {
528
584
  const ret = result;
529
585
  return ret;
530
586
  },
531
- __wbg_instanceof_Response_ee1d54d79ae41977: function(arg0) {
587
+ __wbg_instanceof_Response_9b4d9fd451e051b1: function(arg0) {
532
588
  let result;
533
589
  try {
534
590
  result = getObject(arg0) instanceof Response;
@@ -538,7 +594,7 @@ function __wbg_get_imports() {
538
594
  const ret = result;
539
595
  return ret;
540
596
  },
541
- __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
597
+ __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
542
598
  let result;
543
599
  try {
544
600
  result = getObject(arg0) instanceof Uint8Array;
@@ -548,46 +604,62 @@ function __wbg_get_imports() {
548
604
  const ret = result;
549
605
  return ret;
550
606
  },
551
- __wbg_length_32ed9a279acd054c: function(arg0) {
607
+ __wbg_length_ea16607d7b61445b: function(arg0) {
552
608
  const ret = getObject(arg0).length;
553
609
  return ret;
554
610
  },
555
- __wbg_message_9ddc4b9a62a7c379: function(arg0) {
611
+ __wbg_message_00d63f20c41713dd: function(arg0) {
556
612
  const ret = getObject(arg0).message;
557
613
  return addHeapObject(ret);
558
614
  },
559
- __wbg_name_446e25ef2cfdab5a: function(arg0) {
615
+ __wbg_name_ecf53d5e050a495d: function(arg0) {
560
616
  const ret = getObject(arg0).name;
561
617
  return addHeapObject(ret);
562
618
  },
563
- __wbg_new_074b505417ada2d9: function() { return handleError(function () {
619
+ __wbg_new_0837727332ac86ba: function() { return handleError(function () {
620
+ const ret = new Headers();
621
+ return addHeapObject(ret);
622
+ }, arguments); },
623
+ __wbg_new_0_1dcafdf5e786e876: function() {
624
+ const ret = new Date();
625
+ return addHeapObject(ret);
626
+ },
627
+ __wbg_new_227d7c05414eb861: function() {
628
+ const ret = new Error();
629
+ return addHeapObject(ret);
630
+ },
631
+ __wbg_new_5415f704ce1c4eda: function() { return handleError(function () {
564
632
  const ret = new URLSearchParams();
565
633
  return addHeapObject(ret);
566
634
  }, arguments); },
567
- __wbg_new_361308b2356cecd0: function() {
635
+ __wbg_new_ab79df5bd7c26067: function() {
568
636
  const ret = new Object();
569
637
  return addHeapObject(ret);
570
638
  },
571
- __wbg_new_64284bd487f9d239: function() { return handleError(function () {
572
- const ret = new Headers();
639
+ __wbg_new_bb1018d527df73cb: function() { return handleError(function (arg0, arg1) {
640
+ const ret = new URL(getStringFromWasm0(arg0, arg1));
573
641
  return addHeapObject(ret);
574
642
  }, arguments); },
575
- __wbg_new_72b49615380db768: function(arg0, arg1) {
643
+ __wbg_new_d15cb560a6a0e5f0: function(arg0, arg1) {
576
644
  const ret = new Error(getStringFromWasm0(arg0, arg1));
577
645
  return addHeapObject(ret);
578
646
  },
579
- __wbg_new_8a6f238a6ece86ea: function() {
580
- const ret = new Error();
647
+ __wbg_new_fd94ca5c9639abd2: function(arg0) {
648
+ const ret = new Date(getObject(arg0));
649
+ return addHeapObject(ret);
650
+ },
651
+ __wbg_new_from_slice_22da9388ac046e50: function(arg0, arg1) {
652
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
581
653
  return addHeapObject(ret);
582
654
  },
583
- __wbg_new_b5d9e2fb389fef91: function(arg0, arg1) {
655
+ __wbg_new_typed_aaaeaf29cf802876: function(arg0, arg1) {
584
656
  try {
585
657
  var state0 = {a: arg0, b: arg1};
586
658
  var cb0 = (arg0, arg1) => {
587
659
  const a = state0.a;
588
660
  state0.a = 0;
589
661
  try {
590
- return __wasm_bindgen_func_elem_9929(a, state0.b, arg0, arg1);
662
+ return __wasm_bindgen_func_elem_10458(a, state0.b, arg0, arg1);
591
663
  } finally {
592
664
  state0.a = a;
593
665
  }
@@ -598,153 +670,151 @@ function __wbg_get_imports() {
598
670
  state0.a = state0.b = 0;
599
671
  }
600
672
  },
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) {
673
+ __wbg_new_with_byte_offset_and_length_b2ec5bf7b2f35743: function(arg0, arg1, arg2) {
614
674
  const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
615
675
  return addHeapObject(ret);
616
676
  },
617
- __wbg_new_with_str_a7c7f835549b152a: function() { return handleError(function (arg0, arg1) {
677
+ __wbg_new_with_str_4c859c3e69e6cb15: function() { return handleError(function (arg0, arg1) {
618
678
  const ret = new Request(getStringFromWasm0(arg0, arg1));
619
679
  return addHeapObject(ret);
620
680
  }, arguments); },
621
- __wbg_new_with_str_and_init_a61cbc6bdef21614: function() { return handleError(function (arg0, arg1, arg2) {
681
+ __wbg_new_with_str_and_init_b4b54d1a819bc724: function() { return handleError(function (arg0, arg1, arg2) {
622
682
  const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
623
683
  return addHeapObject(ret);
624
684
  }, arguments); },
625
- __wbg_next_0a5e0f8af98146aa: function() { return handleError(function (arg0) {
685
+ __wbg_next_9c645ba5e1273237: function() { return handleError(function (arg0) {
626
686
  const ret = getObject(arg0).next();
627
687
  return addHeapObject(ret);
628
688
  }, arguments); },
629
- __wbg_ok_87f537440a0acf85: function(arg0) {
689
+ __wbg_ok_7ec8b94facac7704: function(arg0) {
630
690
  const ret = getObject(arg0).ok;
631
691
  return ret;
632
692
  },
633
- __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
693
+ __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
634
694
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
635
695
  },
636
- __wbg_queueMicrotask_0aa0a927f78f5d98: function(arg0) {
696
+ __wbg_queueMicrotask_0c399741342fb10f: function(arg0) {
637
697
  const ret = getObject(arg0).queueMicrotask;
638
698
  return addHeapObject(ret);
639
699
  },
640
- __wbg_queueMicrotask_5bb536982f78a56f: function(arg0) {
700
+ __wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
641
701
  queueMicrotask(getObject(arg0));
642
702
  },
643
- __wbg_ready_2258e8118fee9761: function(arg0) {
703
+ __wbg_ready_bf757735fa2c98fc: function(arg0) {
644
704
  const ret = getObject(arg0).ready;
645
705
  return addHeapObject(ret);
646
706
  },
647
- __wbg_releaseLock_aea38d9ddf66ea11: function(arg0) {
707
+ __wbg_releaseLock_48ae86fe0d5c344a: function(arg0) {
648
708
  getObject(arg0).releaseLock();
649
709
  },
650
- __wbg_resolve_002c4b7d9d8f6b64: function(arg0) {
710
+ __wbg_resolve_ae8d83246e5bcc12: function(arg0) {
651
711
  const ret = Promise.resolve(getObject(arg0));
652
712
  return addHeapObject(ret);
653
713
  },
654
- __wbg_respond_f90c76a13ed2dae9: function(arg0, arg1) {
714
+ __wbg_respond_137ffa35de748507: function(arg0, arg1) {
655
715
  getObject(arg0).respond(arg1 >>> 0);
656
716
  },
657
- __wbg_search_143f09a35047e800: function(arg0, arg1) {
717
+ __wbg_search_35617fb7936183df: function(arg0, arg1) {
658
718
  const ret = getObject(arg1).search;
659
719
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
660
720
  const len1 = WASM_VECTOR_LEN;
661
721
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
662
722
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
663
723
  },
664
- __wbg_set_cc56eefd2dd91957: function(arg0, arg1, arg2) {
724
+ __wbg_set_8c0b3ffcf05d61c2: function(arg0, arg1, arg2) {
665
725
  getObject(arg0).set(getArrayU8FromWasm0(arg1, arg2));
666
726
  },
667
- __wbg_set_headers_cfc5f4b2c1f20549: function(arg0, arg1) {
727
+ __wbg_set_headers_3c8fecc693b75327: function(arg0, arg1) {
668
728
  getObject(arg0).headers = getObject(arg1);
669
729
  },
670
- __wbg_set_method_c3e20375f5ae7fac: function(arg0, arg1, arg2) {
730
+ __wbg_set_method_8c015e8bcafd7be1: function(arg0, arg1, arg2) {
671
731
  getObject(arg0).method = getStringFromWasm0(arg1, arg2);
672
732
  },
673
- __wbg_set_search_1d369b0f3868e132: function(arg0, arg1, arg2) {
733
+ __wbg_set_search_bd09fe57b201bac5: function(arg0, arg1, arg2) {
674
734
  getObject(arg0).search = getStringFromWasm0(arg1, arg2);
675
735
  },
676
- __wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {
736
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
677
737
  const ret = getObject(arg1).stack;
678
738
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
679
739
  const len1 = WASM_VECTOR_LEN;
680
740
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
681
741
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
682
742
  },
683
- __wbg_static_accessor_GLOBAL_12837167ad935116: function() {
743
+ __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
684
744
  const ret = typeof global === 'undefined' ? null : global;
685
745
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
686
746
  },
687
- __wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
747
+ __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913: function() {
688
748
  const ret = typeof globalThis === 'undefined' ? null : globalThis;
689
749
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
690
750
  },
691
- __wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
751
+ __wbg_static_accessor_SELF_f207c857566db248: function() {
692
752
  const ret = typeof self === 'undefined' ? null : self;
693
753
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
694
754
  },
695
- __wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
755
+ __wbg_static_accessor_WINDOW_bb9f1ba69d61b386: function() {
696
756
  const ret = typeof window === 'undefined' ? null : window;
697
757
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
698
758
  },
699
- __wbg_status_89d7e803db911ee7: function(arg0) {
759
+ __wbg_status_318629ab93a22955: function(arg0) {
700
760
  const ret = getObject(arg0).status;
701
761
  return ret;
702
762
  },
703
- __wbg_text_083b8727c990c8c0: function() { return handleError(function (arg0) {
763
+ __wbg_text_372f5b91442c50f9: function() { return handleError(function (arg0) {
704
764
  const ret = getObject(arg0).text();
705
765
  return addHeapObject(ret);
706
766
  }, arguments); },
707
- __wbg_then_0d9fe2c7b1857d32: function(arg0, arg1, arg2) {
708
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
767
+ __wbg_then_098abe61755d12f6: function(arg0, arg1) {
768
+ const ret = getObject(arg0).then(getObject(arg1));
709
769
  return addHeapObject(ret);
710
770
  },
711
- __wbg_then_b9e7b3b5f1a9e1b5: function(arg0, arg1) {
712
- const ret = getObject(arg0).then(getObject(arg1));
771
+ __wbg_then_9e335f6dd892bc11: function(arg0, arg1, arg2) {
772
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
713
773
  return addHeapObject(ret);
714
774
  },
715
- __wbg_toString_029ac24421fd7a24: function(arg0) {
775
+ __wbg_toString_3272fa0dfd05dd87: function(arg0) {
716
776
  const ret = getObject(arg0).toString();
717
777
  return addHeapObject(ret);
718
778
  },
719
- __wbg_toString_964ff7fe6eca8362: function(arg0) {
779
+ __wbg_toString_fca8b5e46235cfb4: function(arg0) {
720
780
  const ret = getObject(arg0).toString();
721
781
  return addHeapObject(ret);
722
782
  },
723
- __wbg_url_36c39f6580d05409: function(arg0, arg1) {
783
+ __wbg_url_b6f96880b733816c: function(arg0, arg1) {
724
784
  const ret = getObject(arg1).url;
725
785
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
726
786
  const len1 = WASM_VECTOR_LEN;
727
787
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
728
788
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
729
789
  },
730
- __wbg_value_0546255b415e96c1: function(arg0) {
790
+ __wbg_value_21fc78aab0322612: function(arg0) {
731
791
  const ret = getObject(arg0).value;
732
792
  return addHeapObject(ret);
733
793
  },
734
- __wbg_view_b29b448440a527c0: function(arg0) {
794
+ __wbg_view_98a9719f4bca1157: function(arg0) {
735
795
  const ret = getObject(arg0).view;
736
796
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
737
797
  },
738
- __wbg_write_c4a2180120884395: function(arg0, arg1) {
798
+ __wbg_write_1efac7e6738150f4: function(arg0, arg1) {
739
799
  const ret = getObject(arg0).write(takeObject(arg1));
740
800
  return addHeapObject(ret);
741
801
  },
742
802
  __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_8773, __wasm_bindgen_func_elem_8788);
803
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1185, function: Function { arguments: [Externref], shim_idx: 1238, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
804
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9296, __wasm_bindgen_func_elem_10439);
745
805
  return addHeapObject(ret);
746
806
  },
747
807
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
808
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 7, function: Function { arguments: [NamedExternref("IteratorResult<any>")], shim_idx: 8, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
809
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_356, __wasm_bindgen_func_elem_2709);
810
+ return addHeapObject(ret);
811
+ },
812
+ __wbindgen_cast_0000000000000003: function(arg0) {
813
+ // Cast intrinsic for `F64 -> Externref`.
814
+ const ret = arg0;
815
+ return addHeapObject(ret);
816
+ },
817
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
748
818
  // Cast intrinsic for `Ref(String) -> Externref`.
749
819
  const ret = getStringFromWasm0(arg0, arg1);
750
820
  return addHeapObject(ret);
@@ -763,12 +833,36 @@ function __wbg_get_imports() {
763
833
  };
764
834
  }
765
835
 
766
- function __wasm_bindgen_func_elem_8788(arg0, arg1, arg2) {
767
- wasm.__wasm_bindgen_func_elem_8788(arg0, arg1, addHeapObject(arg2));
836
+ function __wasm_bindgen_func_elem_10439(arg0, arg1, arg2) {
837
+ try {
838
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
839
+ wasm.__wasm_bindgen_func_elem_10439(retptr, arg0, arg1, addHeapObject(arg2));
840
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
841
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
842
+ if (r1) {
843
+ throw takeObject(r0);
844
+ }
845
+ } finally {
846
+ wasm.__wbindgen_add_to_stack_pointer(16);
847
+ }
848
+ }
849
+
850
+ function __wasm_bindgen_func_elem_2709(arg0, arg1, arg2) {
851
+ try {
852
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
853
+ wasm.__wasm_bindgen_func_elem_2709(retptr, arg0, arg1, addHeapObject(arg2));
854
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
855
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
856
+ if (r1) {
857
+ throw takeObject(r0);
858
+ }
859
+ } finally {
860
+ wasm.__wbindgen_add_to_stack_pointer(16);
861
+ }
768
862
  }
769
863
 
770
- function __wasm_bindgen_func_elem_9929(arg0, arg1, arg2, arg3) {
771
- wasm.__wasm_bindgen_func_elem_9929(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
864
+ function __wasm_bindgen_func_elem_10458(arg0, arg1, arg2, arg3) {
865
+ wasm.__wasm_bindgen_func_elem_10458(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
772
866
  }
773
867
 
774
868
 
@@ -883,7 +977,7 @@ function debugString(val) {
883
977
  }
884
978
 
885
979
  function dropObject(idx) {
886
- if (idx < 132) return;
980
+ if (idx < 1028) return;
887
981
  heap[idx] = heap_next;
888
982
  heap_next = idx;
889
983
  }
@@ -924,7 +1018,7 @@ function handleError(f, args) {
924
1018
  }
925
1019
  }
926
1020
 
927
- let heap = new Array(128).fill(undefined);
1021
+ let heap = new Array(1024).fill(undefined);
928
1022
  heap.push(undefined, null, true, false);
929
1023
 
930
1024
  let heap_next = heap.length;
package/lemma_bg.wasm CHANGED
Binary file
@@ -28,15 +28,19 @@ export const queuingstrategy_highWaterMark: (a: number) => number;
28
28
  export const readablestreamgetreaderoptions_mode: (a: number) => number;
29
29
  export const __wbg_wasmengine_free: (a: number, b: number) => void;
30
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;
31
+ export const wasmengine_evaluate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
32
+ export const wasmengine_evaluateEffective: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
32
33
  export const wasmengine_formatSource: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
33
34
  export const wasmengine_getSchema: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
35
+ export const wasmengine_getSchemaEffective: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
34
36
  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;
37
+ export const wasmengine_listSpecs: (a: number, b: number) => void;
36
38
  export const wasmengine_new: () => number;
37
- export const __wasm_bindgen_func_elem_8773: (a: number, b: number) => void;
38
- export const __wasm_bindgen_func_elem_9929: (a: number, b: number, c: number, d: number) => void;
39
- export const __wasm_bindgen_func_elem_8788: (a: number, b: number, c: number) => void;
39
+ export const __wasm_bindgen_func_elem_9296: (a: number, b: number) => void;
40
+ export const __wasm_bindgen_func_elem_356: (a: number, b: number) => void;
41
+ export const __wasm_bindgen_func_elem_10439: (a: number, b: number, c: number, d: number) => void;
42
+ export const __wasm_bindgen_func_elem_2709: (a: number, b: number, c: number, d: number) => void;
43
+ export const __wasm_bindgen_func_elem_10458: (a: number, b: number, c: number, d: number) => void;
40
44
  export const __wbindgen_export: (a: number, b: number) => number;
41
45
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
42
46
  export const __wbindgen_export3: (a: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@benrogmans/lemma-engine",
3
- "version": "0.7.5",
3
+ "version": "0.8.1",
4
4
  "description": "Language Server Protocol implementation for Lemma",
5
5
  "type": "module",
6
6
  "main": "lemma.js",