@lemmabase/lemma-engine 0.9.3 → 0.9.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/lemma.bindings.d.ts +15 -3
- package/lemma.bindings.js +57 -10
- package/lemma.d.ts +29 -0
- package/lemma.iife.js +1 -1
- package/lemma_bg.wasm +0 -0
- package/lemma_bg.wasm.d.ts +5 -3
- package/package.json +1 -1
package/lemma.bindings.d.ts
CHANGED
|
@@ -38,6 +38,10 @@ export class Engine {
|
|
|
38
38
|
*/
|
|
39
39
|
load(sources: any): void;
|
|
40
40
|
constructor();
|
|
41
|
+
/**
|
|
42
|
+
* Structural quality recommendations across loaded specs. Advisory only.
|
|
43
|
+
*/
|
|
44
|
+
quality(): any;
|
|
41
45
|
/**
|
|
42
46
|
* Remove a temporal spec slice. `effective`: ISO datetime string or omit for now.
|
|
43
47
|
*/
|
|
@@ -62,6 +66,12 @@ export class Engine {
|
|
|
62
66
|
* `attribute` is the source label (path or `@owner/repo`). Omit for a volatile source.
|
|
63
67
|
*/
|
|
64
68
|
update(repository: string | null | undefined, spec: string, effective: string | null | undefined, code: string, attribute?: string | null): void;
|
|
69
|
+
/**
|
|
70
|
+
* Create an engine with custom [`crate::ResourceLimits`].
|
|
71
|
+
*
|
|
72
|
+
* Pass a plain object of limit keys (same names as Rust / Java). Unknown keys throw.
|
|
73
|
+
*/
|
|
74
|
+
static withLimits(limits: any): Engine;
|
|
65
75
|
}
|
|
66
76
|
|
|
67
77
|
export class IntoUnderlyingByteSource {
|
|
@@ -131,14 +141,16 @@ export interface InitOutput {
|
|
|
131
141
|
readonly engine_list: (a: number, b: number) => void;
|
|
132
142
|
readonly engine_load: (a: number, b: number, c: number) => void;
|
|
133
143
|
readonly engine_new: () => number;
|
|
144
|
+
readonly engine_quality: (a: number, b: number) => void;
|
|
134
145
|
readonly engine_remove: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
135
146
|
readonly engine_run: (a: number, b: number, c: number) => void;
|
|
136
147
|
readonly engine_show: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
137
148
|
readonly engine_source: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
138
149
|
readonly engine_update: (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;
|
|
139
|
-
readonly
|
|
140
|
-
readonly
|
|
141
|
-
readonly
|
|
150
|
+
readonly engine_withLimits: (a: number, b: number) => void;
|
|
151
|
+
readonly __wasm_bindgen_func_elem_12532: (a: number, b: number, c: number, d: number) => void;
|
|
152
|
+
readonly __wasm_bindgen_func_elem_2733: (a: number, b: number, c: number, d: number) => void;
|
|
153
|
+
readonly __wasm_bindgen_func_elem_12539: (a: number, b: number, c: number, d: number) => void;
|
|
142
154
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
143
155
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
144
156
|
readonly __wbindgen_export3: (a: number) => void;
|
package/lemma.bindings.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/* @ts-self-types="./lemma.d.ts" */
|
|
2
2
|
|
|
3
3
|
export class Engine {
|
|
4
|
+
static __wrap(ptr) {
|
|
5
|
+
const obj = Object.create(Engine.prototype);
|
|
6
|
+
obj.__wbg_ptr = ptr;
|
|
7
|
+
EngineFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
8
|
+
return obj;
|
|
9
|
+
}
|
|
4
10
|
__destroy_into_raw() {
|
|
5
11
|
const ptr = this.__wbg_ptr;
|
|
6
12
|
this.__wbg_ptr = 0;
|
|
@@ -114,6 +120,25 @@ export class Engine {
|
|
|
114
120
|
EngineFinalization.register(this, this.__wbg_ptr, this);
|
|
115
121
|
return this;
|
|
116
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Structural quality recommendations across loaded specs. Advisory only.
|
|
125
|
+
* @returns {any}
|
|
126
|
+
*/
|
|
127
|
+
quality() {
|
|
128
|
+
try {
|
|
129
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
130
|
+
wasm.engine_quality(retptr, this.__wbg_ptr);
|
|
131
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
132
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
133
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
134
|
+
if (r2) {
|
|
135
|
+
throw takeObject(r1);
|
|
136
|
+
}
|
|
137
|
+
return takeObject(r0);
|
|
138
|
+
} finally {
|
|
139
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
117
142
|
/**
|
|
118
143
|
* Remove a temporal spec slice. `effective`: ISO datetime string or omit for now.
|
|
119
144
|
* @param {string | null | undefined} repository
|
|
@@ -259,6 +284,28 @@ export class Engine {
|
|
|
259
284
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
260
285
|
}
|
|
261
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* Create an engine with custom [`crate::ResourceLimits`].
|
|
289
|
+
*
|
|
290
|
+
* Pass a plain object of limit keys (same names as Rust / Java). Unknown keys throw.
|
|
291
|
+
* @param {any} limits
|
|
292
|
+
* @returns {Engine}
|
|
293
|
+
*/
|
|
294
|
+
static withLimits(limits) {
|
|
295
|
+
try {
|
|
296
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
297
|
+
wasm.engine_withLimits(retptr, addHeapObject(limits));
|
|
298
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
299
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
300
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
301
|
+
if (r2) {
|
|
302
|
+
throw takeObject(r1);
|
|
303
|
+
}
|
|
304
|
+
return Engine.__wrap(r0);
|
|
305
|
+
} finally {
|
|
306
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
262
309
|
}
|
|
263
310
|
if (Symbol.dispose) Engine.prototype[Symbol.dispose] = Engine.prototype.free;
|
|
264
311
|
|
|
@@ -723,7 +770,7 @@ function __wbg_get_imports() {
|
|
|
723
770
|
const a = state0.a;
|
|
724
771
|
state0.a = 0;
|
|
725
772
|
try {
|
|
726
|
-
return
|
|
773
|
+
return __wasm_bindgen_func_elem_12539(a, state0.b, arg0, arg1);
|
|
727
774
|
} finally {
|
|
728
775
|
state0.a = a;
|
|
729
776
|
}
|
|
@@ -882,13 +929,13 @@ function __wbg_get_imports() {
|
|
|
882
929
|
return addHeapObject(ret);
|
|
883
930
|
},
|
|
884
931
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
885
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
886
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
932
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1404, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
933
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_12532);
|
|
887
934
|
return addHeapObject(ret);
|
|
888
935
|
},
|
|
889
936
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
890
937
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("IteratorResult<any>")], shim_idx: 7, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
891
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
938
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2733);
|
|
892
939
|
return addHeapObject(ret);
|
|
893
940
|
},
|
|
894
941
|
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
@@ -925,10 +972,10 @@ function __wbg_get_imports() {
|
|
|
925
972
|
};
|
|
926
973
|
}
|
|
927
974
|
|
|
928
|
-
function
|
|
975
|
+
function __wasm_bindgen_func_elem_12532(arg0, arg1, arg2) {
|
|
929
976
|
try {
|
|
930
977
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
931
|
-
wasm.
|
|
978
|
+
wasm.__wasm_bindgen_func_elem_12532(retptr, arg0, arg1, addHeapObject(arg2));
|
|
932
979
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
933
980
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
934
981
|
if (r1) {
|
|
@@ -939,10 +986,10 @@ function __wasm_bindgen_func_elem_12478(arg0, arg1, arg2) {
|
|
|
939
986
|
}
|
|
940
987
|
}
|
|
941
988
|
|
|
942
|
-
function
|
|
989
|
+
function __wasm_bindgen_func_elem_2733(arg0, arg1, arg2) {
|
|
943
990
|
try {
|
|
944
991
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
945
|
-
wasm.
|
|
992
|
+
wasm.__wasm_bindgen_func_elem_2733(retptr, arg0, arg1, addHeapObject(arg2));
|
|
946
993
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
947
994
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
948
995
|
if (r1) {
|
|
@@ -953,8 +1000,8 @@ function __wasm_bindgen_func_elem_2738(arg0, arg1, arg2) {
|
|
|
953
1000
|
}
|
|
954
1001
|
}
|
|
955
1002
|
|
|
956
|
-
function
|
|
957
|
-
wasm.
|
|
1003
|
+
function __wasm_bindgen_func_elem_12539(arg0, arg1, arg2, arg3) {
|
|
1004
|
+
wasm.__wasm_bindgen_func_elem_12539(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
958
1005
|
}
|
|
959
1006
|
|
|
960
1007
|
|
package/lemma.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ export interface RegistryFetchResult {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
declare module './lemma.bindings.js' {
|
|
13
|
+
namespace Engine {
|
|
14
|
+
/** Create engine with named limit overrides. Unknown keys throw. */
|
|
15
|
+
function withLimits(limits: Record<string, number>): Engine;
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
interface Engine {
|
|
14
19
|
/**
|
|
15
20
|
* Load Lemma source(s).
|
|
@@ -81,6 +86,11 @@ declare module './lemma.bindings.js' {
|
|
|
81
86
|
*/
|
|
82
87
|
format(code: string, attribute?: string | null): string;
|
|
83
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Structural quality recommendations across loaded specs. Advisory only.
|
|
91
|
+
*/
|
|
92
|
+
quality(): Recommendation[];
|
|
93
|
+
|
|
84
94
|
/**
|
|
85
95
|
* Evaluate a spec. Pass integers as numbers, decimals as strings in `data`.
|
|
86
96
|
*/
|
|
@@ -483,3 +493,22 @@ export interface ResourceLimits {
|
|
|
483
493
|
max_dag_specs: number;
|
|
484
494
|
max_normal_form_depth: number;
|
|
485
495
|
}
|
|
496
|
+
|
|
497
|
+
/** Source location on a quality recommendation. Same shape as {@link EngineErrorSource}. */
|
|
498
|
+
export interface RecommendationSource {
|
|
499
|
+
attribute: string;
|
|
500
|
+
line: number;
|
|
501
|
+
column: number;
|
|
502
|
+
length: number;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/** One structural quality recommendation from {@link Engine.quality}. */
|
|
506
|
+
export interface Recommendation {
|
|
507
|
+
/** Advisory prose only. Temporal identity is in `spec` + `effective_from`. */
|
|
508
|
+
message: string;
|
|
509
|
+
spec: string;
|
|
510
|
+
/** Declared temporal start of the analyzed slice, or null for Origin. */
|
|
511
|
+
effective_from: string | null;
|
|
512
|
+
repository: string | null;
|
|
513
|
+
source: RecommendationSource;
|
|
514
|
+
}
|