@listen-fire/movement-lang 0.15.2 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalog/types.d.ts +32 -1
- package/dist/checker/diagnostic.d.ts +4 -0
- package/dist/checker/rust_checker.d.ts +5 -0
- package/dist/checker/rust_checker.js +5 -1
- package/dist/checker/standard_library.d.ts +2 -2
- package/dist/expression/filter.js +1 -1
- package/dist/expression/formula.d.ts +1 -1
- package/dist/expression/formula.js +4 -3
- package/dist/expression/types.d.ts +5 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/language_version_value.d.ts +1 -1
- package/dist/language_version_value.js +1 -1
- package/dist/parser/ast.d.ts +8 -0
- package/dist/parser/ast.js +2 -0
- package/dist/service/description.d.ts +103 -0
- package/dist/service/description.js +142 -0
- package/dist/wasm/loader.d.ts +31 -3
- package/dist/wasm/loader.js +31 -4
- package/dist/wasm/movement.wasm +0 -0
- package/dist/wasm/movement_parser.wasm +0 -0
- package/package.json +1 -1
package/dist/catalog/types.d.ts
CHANGED
|
@@ -114,6 +114,10 @@ export interface AdapterSpec {
|
|
|
114
114
|
/** What a 0.12 settings listen on this module becomes as a traversal: the
|
|
115
115
|
* upgrade's rewrite of `listen to x { … }`. */
|
|
116
116
|
listenSettingsBecome?: SettingsBecome;
|
|
117
|
+
/** The release before which a host may have let only registered senders set
|
|
118
|
+
* a listen on this module off (Slack's `0.16.0`): an upgrade from an older
|
|
119
|
+
* key tells each listen whose filter does not limit it. */
|
|
120
|
+
listensLimitedBefore?: string;
|
|
117
121
|
}
|
|
118
122
|
/**
|
|
119
123
|
* A module's mapping from its 0.12 listen settings to the traversal a listen
|
|
@@ -266,7 +270,7 @@ export interface PluginSpec {
|
|
|
266
270
|
* where it is written, and an argument declared to take structured data
|
|
267
271
|
* (`json`) is handed a record's fields. Absent for an argument nobody typed.
|
|
268
272
|
*/
|
|
269
|
-
argTypes?: Record<string,
|
|
273
|
+
argTypes?: Record<string, PluginArgType>;
|
|
270
274
|
/**
|
|
271
275
|
* Arguments (⊆ `args`) a call MUST supply: a call missing one is
|
|
272
276
|
* MOV_THROUGH_ARG_MISSING.
|
|
@@ -302,6 +306,13 @@ export interface PluginSpec {
|
|
|
302
306
|
* what the stage would have handed it.
|
|
303
307
|
*/
|
|
304
308
|
fedByExtraction?: boolean;
|
|
309
|
+
/**
|
|
310
|
+
* The same arguments give the same answer until the host says otherwise, so
|
|
311
|
+
* a call of it may stand where only a pure expression may. Absent ⇒ not pure.
|
|
312
|
+
*/
|
|
313
|
+
pure?: boolean;
|
|
314
|
+
/** How long a host may keep a pure plugin's answer, in seconds. Only a pure plugin declares one. */
|
|
315
|
+
maxAgeSeconds?: number;
|
|
305
316
|
/**
|
|
306
317
|
* Arguments the EXTRACTION fills inside a `through [ … ]` stage — the engine
|
|
307
318
|
* feeds them from the `from [ … ]` source, which is why a stage never writes
|
|
@@ -378,6 +389,7 @@ export type PluginOutput = {
|
|
|
378
389
|
} | {
|
|
379
390
|
kind: 'record';
|
|
380
391
|
fields: Record<string, SchemaFieldType>;
|
|
392
|
+
maybeAbsent?: true;
|
|
381
393
|
} | {
|
|
382
394
|
kind: 'records';
|
|
383
395
|
fields: Record<string, SchemaFieldType>;
|
|
@@ -985,6 +997,9 @@ export interface CollectionSchema extends EdgeListening {
|
|
|
985
997
|
cursor?: boolean;
|
|
986
998
|
identity?: string;
|
|
987
999
|
version?: string;
|
|
1000
|
+
/** What the module says of what lands here, where the type has no position
|
|
1001
|
+
* to say it on (one known only by what is written to it). */
|
|
1002
|
+
description?: string;
|
|
988
1003
|
}
|
|
989
1004
|
/**
|
|
990
1005
|
* The schema of a constructed instance — produced per construction because
|
|
@@ -1306,6 +1321,15 @@ export type SchemaFieldType = 'text' | 'number' | 'boolean' | 'date' | 'datetime
|
|
|
1306
1321
|
kind: 'maybeAbsent';
|
|
1307
1322
|
of: SchemaFieldType;
|
|
1308
1323
|
}
|
|
1324
|
+
/** `text & Brand<"claim:email/address">`: `of`, narrowed by each brand, as
|
|
1325
|
+
* TypeScript's intersection narrows. A brand is a name compared whole,
|
|
1326
|
+
* never parsed. A branded value fits where `of` is asked for; a value
|
|
1327
|
+
* without the brand never fits where it is. */
|
|
1328
|
+
| {
|
|
1329
|
+
kind: 'branded';
|
|
1330
|
+
of: SchemaFieldType;
|
|
1331
|
+
brands: string[];
|
|
1332
|
+
}
|
|
1309
1333
|
/** A record's fields held as the field's value (`c.Current`): typed as a
|
|
1310
1334
|
* plain object of that position's fields, never as the record. It has no
|
|
1311
1335
|
* edges and no identity, so a checker refuses a walk, a write or a record
|
|
@@ -1314,6 +1338,13 @@ export type SchemaFieldType = 'text' | 'number' | 'boolean' | 'date' | 'datetime
|
|
|
1314
1338
|
kind: 'record';
|
|
1315
1339
|
position: SchemaPositionRef;
|
|
1316
1340
|
};
|
|
1341
|
+
/** What a plugin's argument takes: a field type, or one of several (`text &
|
|
1342
|
+
* Brand<"a"> | text & Brand<"b">`). A union is the checker's typing, which a
|
|
1343
|
+
* schema's field never is, so it lives here and not on `SchemaFieldType`. */
|
|
1344
|
+
export type PluginArgType = SchemaFieldType | {
|
|
1345
|
+
kind: 'union';
|
|
1346
|
+
of: PluginArgType[];
|
|
1347
|
+
};
|
|
1317
1348
|
/** Which record a `record` field holds: one record type of the instance, or
|
|
1318
1349
|
* one of several (`unions`). */
|
|
1319
1350
|
export type SchemaPositionRef = {
|
|
@@ -17,5 +17,9 @@ export interface Diagnostic {
|
|
|
17
17
|
/** The exact rewrite that resolves it, built from the author's own source —
|
|
18
18
|
* also spelled out in `message`, which is all a text reader sees. */
|
|
19
19
|
fix?: DiagnosticFix;
|
|
20
|
+
/** The library it came from, as the checked file's import names it
|
|
21
|
+
* (`lib/finance`), when it came from one. The message names it too; a host
|
|
22
|
+
* tells a library's fault by this, never by reading the message. */
|
|
23
|
+
file?: string;
|
|
20
24
|
}
|
|
21
25
|
export declare function diagnosticSeverity(diagnostic: Diagnostic): DiagnosticSeverity;
|
|
@@ -7,6 +7,11 @@ export interface RustCheckOptions {
|
|
|
7
7
|
languageVersion: LanguageVersion;
|
|
8
8
|
/** Checking for a move up from this release (`CheckOptions.upgradingFrom`). */
|
|
9
9
|
upgradingFrom?: LanguageVersion;
|
|
10
|
+
/** The catalog key of the pure plugin the host limits a listen's senders
|
|
11
|
+
* with (`@lf-platform/team/isMember`): an upgrade's `MOV_LISTEN_NOW_OPEN`
|
|
12
|
+
* then carries the check that calls it, as an unsafe fix
|
|
13
|
+
* (`CheckOptions.limiting_function`). */
|
|
14
|
+
limitingFunction?: string;
|
|
10
15
|
}
|
|
11
16
|
/** A source the Rust checker could not check: it does not parse, or the
|
|
12
17
|
* snapshot does not load. */
|
|
@@ -105,7 +105,10 @@ function compatibleInRust(request) {
|
|
|
105
105
|
throw new Error(`the Rust checker answered check.compatible with ${JSON.stringify(json)}`);
|
|
106
106
|
}
|
|
107
107
|
function callOptions(options) {
|
|
108
|
-
return
|
|
108
|
+
return {
|
|
109
|
+
...(options.upgradingFrom !== undefined ? { upgradingFrom: options.upgradingFrom } : {}),
|
|
110
|
+
...(options.limitingFunction !== undefined ? { limitingFunction: options.limitingFunction } : {}),
|
|
111
|
+
};
|
|
109
112
|
}
|
|
110
113
|
/** Every fact a stamp may carry; a stamp carries exactly one, as the
|
|
111
114
|
* engine's `join_check` holds it to. */
|
|
@@ -210,6 +213,7 @@ function diagnosticOf(value) {
|
|
|
210
213
|
...(severity !== undefined ? { severity } : {}),
|
|
211
214
|
...(value.upgrade === true ? { upgrade: true } : {}),
|
|
212
215
|
...(value.fix !== undefined ? { fix: fixOf(value.fix) } : {}),
|
|
216
|
+
...(typeof value.file === 'string' ? { file: value.file } : {}),
|
|
213
217
|
};
|
|
214
218
|
}
|
|
215
219
|
function fixOf(value) {
|
|
@@ -13,8 +13,8 @@ export interface StandardBuiltin {
|
|
|
13
13
|
* table (`surfaceTable`) gives the name an author writes. */
|
|
14
14
|
name: string;
|
|
15
15
|
params: readonly StandardBuiltinParam[];
|
|
16
|
-
/** What a call gives back, as
|
|
17
|
-
*
|
|
16
|
+
/** What a call gives back, as a program writes a type (`text[]`,
|
|
17
|
+
* `text | null`), or `derived`: it follows from the arguments. */
|
|
18
18
|
returns: string;
|
|
19
19
|
/** One line for listings. `RETIRED — …` for a built-in kept only so old
|
|
20
20
|
* automations still read. */
|
|
@@ -40,7 +40,7 @@ const PURE_KINDS = new Set([
|
|
|
40
40
|
'property',
|
|
41
41
|
'edge_property',
|
|
42
42
|
'alias_ref',
|
|
43
|
-
// `@current_date` / `@
|
|
43
|
+
// `@current_date` / `@current_timestamp` — an ambient scalar
|
|
44
44
|
// the engine resolves with no adapter, no AI, no traversal. A childless leaf,
|
|
45
45
|
// so `isPurePredicate` admits it with no recursion (childExpressions → []).
|
|
46
46
|
'meta',
|
|
@@ -52,7 +52,7 @@ export interface FormulaCapabilities {
|
|
|
52
52
|
resources: boolean;
|
|
53
53
|
llm: boolean;
|
|
54
54
|
/**
|
|
55
|
-
* KG-bound global identifiers (`@id`, `@
|
|
55
|
+
* KG-bound global identifiers (`@id`, `@parent.*`,
|
|
56
56
|
* `@current_date`, `@input_channel_name`). True for the TG field
|
|
57
57
|
* editor where these resolve against the surrounding action node /
|
|
58
58
|
* pipeline context. False for adapter-source filter authoring (trigger
|
|
@@ -296,6 +296,9 @@ function serialize(expr, resolve, parentPrec = 0, resolveStaticValue, resolveEdg
|
|
|
296
296
|
case 'at': {
|
|
297
297
|
return `AT(${ser(expr.expression)}, ${ser(expr.index)})`;
|
|
298
298
|
}
|
|
299
|
+
case 'field': {
|
|
300
|
+
return `${ser(expr.expression)}${expr.optional === true ? '?.' : '.'}${quoteName(expr.field)}`;
|
|
301
|
+
}
|
|
299
302
|
}
|
|
300
303
|
// Shorthand for recursive calls that threads resolveStaticValue/resolveEdgeInfo through
|
|
301
304
|
function ser(e, prec = 0) {
|
|
@@ -1085,8 +1088,6 @@ const FUNCTION_COMPLETIONS = [
|
|
|
1085
1088
|
];
|
|
1086
1089
|
const SPECIAL_COMPLETIONS = [
|
|
1087
1090
|
{ label: '@id', insert: '@id', kind: 'special' },
|
|
1088
|
-
{ label: '@user_name', insert: '@user_name', kind: 'special' },
|
|
1089
|
-
{ label: '@user_email', insert: '@user_email', kind: 'special' },
|
|
1090
1091
|
{ label: '@current_date', insert: '@current_date', kind: 'special' },
|
|
1091
1092
|
{ label: '@input_channel_name', insert: '@input_channel_name', kind: 'special' },
|
|
1092
1093
|
{ label: '@parent.created', insert: '@parent.created', kind: 'special' },
|
|
@@ -1580,7 +1581,7 @@ function getCompletions(input, cursorPos, properties, edges, contextNodeTypeId,
|
|
|
1580
1581
|
// Early check: typing @ prefix for special completions. Gated on the
|
|
1581
1582
|
// `kgGlobals` capability — adapter-source authoring contexts (e.g.
|
|
1582
1583
|
// trigger filters) have no parent action node or KG identifiers in
|
|
1583
|
-
// scope, so offering @parent / @id
|
|
1584
|
+
// scope, so offering @parent / @id would mislead.
|
|
1584
1585
|
const specialPrefix = textBefore.match(/@([a-zA-Z0-9_.]*)?$/);
|
|
1585
1586
|
if (specialPrefix) {
|
|
1586
1587
|
if (capabilities.kgGlobals === false)
|
|
@@ -470,6 +470,11 @@ export type Expression =
|
|
|
470
470
|
type: 'at';
|
|
471
471
|
expression: Expression;
|
|
472
472
|
index: Expression;
|
|
473
|
+
} | {
|
|
474
|
+
type: 'field';
|
|
475
|
+
expression: Expression;
|
|
476
|
+
field: string;
|
|
477
|
+
optional?: boolean;
|
|
473
478
|
} | {
|
|
474
479
|
type: 'aggregate';
|
|
475
480
|
fn: Aggregation['function'];
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export * from './parser/ast';
|
|
|
3
3
|
export * from './parser/await_words';
|
|
4
4
|
export * from './parser/scan';
|
|
5
5
|
export * from './parser/parse';
|
|
6
|
-
export { MovementParserNotReady, assertParserReady, callJudgeArrival, callLandingMisfits, callLandingNode, callListenIdentity, EngineStackRanOut, initEngine, initParser, isParserReady, openEngineSegment, type EngineSegment, } from './wasm/loader';
|
|
6
|
+
export { MovementParserNotReady, assertParserReady, callExplainArrival, callJudgeArrival, callLandingMisfits, callLandingNode, callListenIdentity, EngineStackRanOut, initEngine, initParser, isParserReady, openEngineSegment, type EngineSegment, } from './wasm/loader';
|
|
7
7
|
export * from './expression/bridge';
|
|
8
8
|
export * from './expression/chunk';
|
|
9
9
|
export * from './expression/file_value';
|
|
@@ -19,4 +19,5 @@ export * from './checker/standard_library';
|
|
|
19
19
|
export type { MExpr } from './parser/expression/tree';
|
|
20
20
|
export * from './service/snapshot';
|
|
21
21
|
export * from './service/language_service';
|
|
22
|
+
export * from './service/description';
|
|
22
23
|
export * from './language_version';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.openEngineSegment = exports.isParserReady = exports.initParser = exports.initEngine = exports.EngineStackRanOut = exports.callListenIdentity = exports.callLandingNode = exports.callLandingMisfits = exports.callJudgeArrival = exports.assertParserReady = exports.MovementParserNotReady = void 0;
|
|
17
|
+
exports.openEngineSegment = exports.isParserReady = exports.initParser = exports.initEngine = exports.EngineStackRanOut = exports.callListenIdentity = exports.callLandingNode = exports.callLandingMisfits = exports.callJudgeArrival = exports.callExplainArrival = exports.assertParserReady = exports.MovementParserNotReady = void 0;
|
|
18
18
|
__exportStar(require("./never"), exports);
|
|
19
19
|
__exportStar(require("./parser/ast"), exports);
|
|
20
20
|
__exportStar(require("./parser/await_words"), exports);
|
|
@@ -23,6 +23,7 @@ __exportStar(require("./parser/parse"), exports);
|
|
|
23
23
|
var loader_1 = require("./wasm/loader");
|
|
24
24
|
Object.defineProperty(exports, "MovementParserNotReady", { enumerable: true, get: function () { return loader_1.MovementParserNotReady; } });
|
|
25
25
|
Object.defineProperty(exports, "assertParserReady", { enumerable: true, get: function () { return loader_1.assertParserReady; } });
|
|
26
|
+
Object.defineProperty(exports, "callExplainArrival", { enumerable: true, get: function () { return loader_1.callExplainArrival; } });
|
|
26
27
|
Object.defineProperty(exports, "callJudgeArrival", { enumerable: true, get: function () { return loader_1.callJudgeArrival; } });
|
|
27
28
|
Object.defineProperty(exports, "callLandingMisfits", { enumerable: true, get: function () { return loader_1.callLandingMisfits; } });
|
|
28
29
|
Object.defineProperty(exports, "callLandingNode", { enumerable: true, get: function () { return loader_1.callLandingNode; } });
|
|
@@ -46,4 +47,5 @@ __exportStar(require("./checker/story_analysis"), exports);
|
|
|
46
47
|
__exportStar(require("./checker/standard_library"), exports);
|
|
47
48
|
__exportStar(require("./service/snapshot"), exports);
|
|
48
49
|
__exportStar(require("./service/language_service"), exports);
|
|
50
|
+
__exportStar(require("./service/description"), exports);
|
|
49
51
|
__exportStar(require("./language_version"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "0.
|
|
1
|
+
export declare const PACKAGE_VERSION = "0.16.0";
|
|
@@ -5,4 +5,4 @@ exports.PACKAGE_VERSION = void 0;
|
|
|
5
5
|
// scripts/build-packages.cjs (a source and its build sit at different depths
|
|
6
6
|
// beside package.json, so neither can require it by one relative path).
|
|
7
7
|
// __test__/language_version.unit.test.ts holds it equal to package.json.
|
|
8
|
-
exports.PACKAGE_VERSION = '0.
|
|
8
|
+
exports.PACKAGE_VERSION = '0.16.0';
|
package/dist/parser/ast.d.ts
CHANGED
|
@@ -1306,6 +1306,14 @@ export type ValueTypeRef = {
|
|
|
1306
1306
|
keys: ValueTypeKey[];
|
|
1307
1307
|
span: Span;
|
|
1308
1308
|
}
|
|
1309
|
+
/** `text & Brand<"claim:email/address">`: `of` narrowed by each brand,
|
|
1310
|
+
* TypeScript's intersection. A brand is a name, compared and never parsed. */
|
|
1311
|
+
| {
|
|
1312
|
+
kind: 'branded';
|
|
1313
|
+
of: ValueTypeMember;
|
|
1314
|
+
brands: string[];
|
|
1315
|
+
span: Span;
|
|
1316
|
+
}
|
|
1309
1317
|
/**
|
|
1310
1318
|
* `<(c: <Company>) => <text>>` — a CLOSURE type,
|
|
1311
1319
|
* TypeScript's function type: what each parameter takes and what calling it
|
package/dist/parser/ast.js
CHANGED
|
@@ -201,5 +201,7 @@ function spellValueType(type) {
|
|
|
201
201
|
return `{ ${type.keys.map(key => `${key.name}${key.optional ? '?' : ''}: ${spellValueType(key.type)}`).join(', ')} }`;
|
|
202
202
|
case 'closure':
|
|
203
203
|
return `(${type.params.map(param => `${param.name}: <${param.type !== undefined ? spellParamType(param.type) : '?'}>`).join(', ')}) => <${spellParamType(type.returns)}>`;
|
|
204
|
+
case 'branded':
|
|
205
|
+
return [spellValueType(type.of), ...[...new Set(type.brands)].sort().map((brand) => `Brand<${JSON.stringify(brand)}>`)].join(' & ');
|
|
204
206
|
}
|
|
205
207
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { CatalogSnapshot } from './snapshot';
|
|
2
|
+
/** How much of a place to show. Absent: all of it. */
|
|
3
|
+
export interface Showing {
|
|
4
|
+
/** At most this many fields per list: required first, then identifying. */
|
|
5
|
+
fields?: number;
|
|
6
|
+
/** At most this many options per enum, the rest counted (`"a" | "b" | …+3`). */
|
|
7
|
+
enumOptions?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface DescriptionLevels {
|
|
10
|
+
/** How much of the place itself. */
|
|
11
|
+
showing?: Showing;
|
|
12
|
+
/** How much of where each of its edges lands. */
|
|
13
|
+
landings?: Showing;
|
|
14
|
+
}
|
|
15
|
+
export interface DescribedField {
|
|
16
|
+
name: string;
|
|
17
|
+
/** The whole field as the catalog writes it: `` `Message Id`!* text ``,
|
|
18
|
+
* `` `Reply Markup` json (write only) ``. */
|
|
19
|
+
written: string;
|
|
20
|
+
/** Its name and marks alone, as a write's field list writes it: `Text!`. */
|
|
21
|
+
markedName: string;
|
|
22
|
+
/** Its type as a program writes it. */
|
|
23
|
+
type: string;
|
|
24
|
+
required: boolean;
|
|
25
|
+
identifying: boolean;
|
|
26
|
+
readOnly: boolean;
|
|
27
|
+
/** A field only a write gives, on a type that can be read. */
|
|
28
|
+
writeOnly: boolean;
|
|
29
|
+
/** A read's WHERE must set it with `==`. */
|
|
30
|
+
pinned: boolean;
|
|
31
|
+
description?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface DescribedFields {
|
|
34
|
+
shown: DescribedField[];
|
|
35
|
+
/** How many `Showing.fields` left out. */
|
|
36
|
+
cut: number;
|
|
37
|
+
}
|
|
38
|
+
export interface DescribedEdge {
|
|
39
|
+
name: string;
|
|
40
|
+
/** The hop alone, as a walk writes it: ``-[:`Linked Users`]->``. */
|
|
41
|
+
step: string;
|
|
42
|
+
/** The hop, where it lands and what it can do: ``-[:Replies]-> Message [w]``. */
|
|
43
|
+
hop: string;
|
|
44
|
+
/** The type it lands on; null where its members land apart. */
|
|
45
|
+
target: string | null;
|
|
46
|
+
read: boolean;
|
|
47
|
+
write: boolean;
|
|
48
|
+
fires: boolean;
|
|
49
|
+
description?: string;
|
|
50
|
+
/** What a write along it takes, where one can be written. */
|
|
51
|
+
writes?: DescribedFields;
|
|
52
|
+
/** Where it lands, one level deep: its own edges carry no landing. */
|
|
53
|
+
lands?: DescribedPlace;
|
|
54
|
+
}
|
|
55
|
+
export type Known = 'whole' | 'open' | 'undescribed';
|
|
56
|
+
export interface DescribedPlace {
|
|
57
|
+
/** The type's name as its module shows it. */
|
|
58
|
+
name: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
/** `open`: its module has fields no description names; `undescribed`: nothing has looked at it. */
|
|
61
|
+
known: Known;
|
|
62
|
+
/** What it may be, where it is one of several types. */
|
|
63
|
+
members: string[];
|
|
64
|
+
fields: DescribedFields;
|
|
65
|
+
edges: DescribedEdge[];
|
|
66
|
+
}
|
|
67
|
+
export interface DescribedDiagnostic {
|
|
68
|
+
code: string;
|
|
69
|
+
message: string;
|
|
70
|
+
severity: 'error' | 'warning' | 'info';
|
|
71
|
+
}
|
|
72
|
+
/** Every connection a snapshot describes, at its root. */
|
|
73
|
+
export interface CatalogDescription {
|
|
74
|
+
/** The notation's one line, said once at the top of a text in it. */
|
|
75
|
+
legend: string;
|
|
76
|
+
connections: Array<{
|
|
77
|
+
adapter: string;
|
|
78
|
+
key: string;
|
|
79
|
+
place: DescribedPlace;
|
|
80
|
+
}>;
|
|
81
|
+
}
|
|
82
|
+
/** The one connection or place an address names. */
|
|
83
|
+
export interface AddressDescription {
|
|
84
|
+
legend: string;
|
|
85
|
+
diagnostics: DescribedDiagnostic[];
|
|
86
|
+
/** Null where a diagnostic is an error, or nothing describes where it lands. */
|
|
87
|
+
place: DescribedPlace | null;
|
|
88
|
+
/** An address with no walk: each record type the connection holds, by the
|
|
89
|
+
* name a program's type writes (`<c-[:Message]->>`). */
|
|
90
|
+
records?: Array<{
|
|
91
|
+
name: string;
|
|
92
|
+
place: DescribedPlace;
|
|
93
|
+
}>;
|
|
94
|
+
}
|
|
95
|
+
/** Every connection `snapshot` describes, each at its root with where each of its edges lands. */
|
|
96
|
+
export declare function describeCatalog(snapshot: CatalogSnapshot, levels?: DescriptionLevels): CatalogDescription;
|
|
97
|
+
/**
|
|
98
|
+
* The connection or place `address` names, written as `listen-fire catalog
|
|
99
|
+
* '<address>'` takes one (`'@lf/slack:team_workspace-[:Channels]->'`): read,
|
|
100
|
+
* checked and walked by the checker, so a misspelt edge comes back as its
|
|
101
|
+
* diagnostic.
|
|
102
|
+
*/
|
|
103
|
+
export declare function describeAddress(snapshot: CatalogSnapshot, address: string, levels?: DescriptionLevels): AddressDescription;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// What a catalog holds, as the one description every tool reads
|
|
3
|
+
// (crates/movement-checker/src/description.rs), through the movement
|
|
4
|
+
// artifact's `describe_query` export. Every name, type, hop and mark arrives
|
|
5
|
+
// spelled as `listen-fire catalog` spells it: a caller chooses how much to
|
|
6
|
+
// show (`Showing`) and lays the parts out, and never spells one itself.
|
|
7
|
+
//
|
|
8
|
+
// It loads with the engine artifact, which a browser never downloads.
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.describeCatalog = describeCatalog;
|
|
11
|
+
exports.describeAddress = describeAddress;
|
|
12
|
+
const loader_1 = require("../wasm/loader");
|
|
13
|
+
const rust_checker_1 = require("../checker/rust_checker");
|
|
14
|
+
/** Every connection `snapshot` describes, each at its root with where each of its edges lands. */
|
|
15
|
+
function describeCatalog(snapshot, levels = {}) {
|
|
16
|
+
const answer = ask(snapshot, levels);
|
|
17
|
+
if (!isRecord(answer) || !Array.isArray(answer.connections))
|
|
18
|
+
throw malformed('catalog description', answer);
|
|
19
|
+
return {
|
|
20
|
+
legend: stringOf(answer.legend, 'legend'),
|
|
21
|
+
connections: answer.connections.map((connection) => {
|
|
22
|
+
if (!isRecord(connection))
|
|
23
|
+
throw malformed('connection', connection);
|
|
24
|
+
return { adapter: stringOf(connection.adapter, 'adapter'), key: stringOf(connection.key, 'key'), place: placeOf(connection.place) };
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The connection or place `address` names, written as `listen-fire catalog
|
|
30
|
+
* '<address>'` takes one (`'@lf/slack:team_workspace-[:Channels]->'`): read,
|
|
31
|
+
* checked and walked by the checker, so a misspelt edge comes back as its
|
|
32
|
+
* diagnostic.
|
|
33
|
+
*/
|
|
34
|
+
function describeAddress(snapshot, address, levels = {}) {
|
|
35
|
+
const answer = ask(snapshot, { address, ...levels });
|
|
36
|
+
if (!isRecord(answer) || !Array.isArray(answer.diagnostics))
|
|
37
|
+
throw malformed('address description', answer);
|
|
38
|
+
const records = answer.records;
|
|
39
|
+
if (records !== undefined && !Array.isArray(records))
|
|
40
|
+
throw malformed('record types', records);
|
|
41
|
+
return {
|
|
42
|
+
legend: stringOf(answer.legend, 'legend'),
|
|
43
|
+
diagnostics: answer.diagnostics.map(diagnosticOf),
|
|
44
|
+
place: answer.place === null ? null : placeOf(answer.place),
|
|
45
|
+
...(records !== undefined
|
|
46
|
+
? {
|
|
47
|
+
records: records.map((record) => {
|
|
48
|
+
if (!isRecord(record))
|
|
49
|
+
throw malformed('record type', record);
|
|
50
|
+
return { name: stringOf(record.name, 'record type name'), place: placeOf(record.place) };
|
|
51
|
+
}),
|
|
52
|
+
}
|
|
53
|
+
: {}),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function ask(snapshot, request) {
|
|
57
|
+
const reply = (0, loader_1.callDescribeQuery)(JSON.stringify(snapshot), JSON.stringify(request));
|
|
58
|
+
if (!reply.ok)
|
|
59
|
+
throw rust_checker_1.RustCheckRefused.of(reply.json);
|
|
60
|
+
return reply.json;
|
|
61
|
+
}
|
|
62
|
+
function placeOf(value) {
|
|
63
|
+
if (!isRecord(value) || !Array.isArray(value.members) || !Array.isArray(value.edges))
|
|
64
|
+
throw malformed('place', value);
|
|
65
|
+
return {
|
|
66
|
+
name: stringOf(value.name, 'place name'),
|
|
67
|
+
...optionalString(value.description, 'place description'),
|
|
68
|
+
known: knownOf(value.known),
|
|
69
|
+
members: value.members.map((member) => stringOf(member, 'member')),
|
|
70
|
+
fields: fieldsOf(value.fields),
|
|
71
|
+
edges: value.edges.map(edgeOf),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function knownOf(value) {
|
|
75
|
+
if (value === 'whole' || value === 'open' || value === 'undescribed')
|
|
76
|
+
return value;
|
|
77
|
+
throw malformed('known', value);
|
|
78
|
+
}
|
|
79
|
+
function fieldsOf(value) {
|
|
80
|
+
if (!isRecord(value) || !Array.isArray(value.shown) || typeof value.cut !== 'number')
|
|
81
|
+
throw malformed('field list', value);
|
|
82
|
+
return { shown: value.shown.map(fieldOf), cut: value.cut };
|
|
83
|
+
}
|
|
84
|
+
function fieldOf(value) {
|
|
85
|
+
if (!isRecord(value))
|
|
86
|
+
throw malformed('field', value);
|
|
87
|
+
return {
|
|
88
|
+
name: stringOf(value.name, 'field name'),
|
|
89
|
+
written: stringOf(value.written, 'field'),
|
|
90
|
+
markedName: stringOf(value.markedName, 'field name and marks'),
|
|
91
|
+
type: stringOf(value.type, 'field type'),
|
|
92
|
+
required: booleanOf(value.required, 'required'),
|
|
93
|
+
identifying: booleanOf(value.identifying, 'identifying'),
|
|
94
|
+
readOnly: booleanOf(value.readOnly, 'readOnly'),
|
|
95
|
+
writeOnly: booleanOf(value.writeOnly, 'writeOnly'),
|
|
96
|
+
pinned: booleanOf(value.pinned, 'pinned'),
|
|
97
|
+
...optionalString(value.description, 'field description'),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function edgeOf(value) {
|
|
101
|
+
if (!isRecord(value) || (value.target !== null && typeof value.target !== 'string'))
|
|
102
|
+
throw malformed('edge', value);
|
|
103
|
+
return {
|
|
104
|
+
name: stringOf(value.name, 'edge name'),
|
|
105
|
+
step: stringOf(value.step, 'step'),
|
|
106
|
+
hop: stringOf(value.hop, 'hop'),
|
|
107
|
+
target: value.target,
|
|
108
|
+
read: booleanOf(value.read, 'read'),
|
|
109
|
+
write: booleanOf(value.write, 'write'),
|
|
110
|
+
fires: booleanOf(value.fires, 'fires'),
|
|
111
|
+
...optionalString(value.description, 'edge description'),
|
|
112
|
+
...(value.writes !== undefined ? { writes: fieldsOf(value.writes) } : {}),
|
|
113
|
+
...(value.lands !== undefined ? { lands: placeOf(value.lands) } : {}),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function diagnosticOf(value) {
|
|
117
|
+
if (!isRecord(value))
|
|
118
|
+
throw malformed('diagnostic', value);
|
|
119
|
+
const { severity } = value;
|
|
120
|
+
if (severity !== 'error' && severity !== 'warning' && severity !== 'info')
|
|
121
|
+
throw malformed('severity', severity);
|
|
122
|
+
return { code: stringOf(value.code, 'code'), message: stringOf(value.message, 'message'), severity };
|
|
123
|
+
}
|
|
124
|
+
function stringOf(value, what) {
|
|
125
|
+
if (typeof value !== 'string')
|
|
126
|
+
throw malformed(what, value);
|
|
127
|
+
return value;
|
|
128
|
+
}
|
|
129
|
+
function booleanOf(value, what) {
|
|
130
|
+
if (typeof value !== 'boolean')
|
|
131
|
+
throw malformed(what, value);
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
function optionalString(value, what) {
|
|
135
|
+
return value === undefined ? {} : { description: stringOf(value, what) };
|
|
136
|
+
}
|
|
137
|
+
function isRecord(value) {
|
|
138
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
139
|
+
}
|
|
140
|
+
function malformed(what, value) {
|
|
141
|
+
return new Error(`the describing query answered a ${what} that is not one: ${JSON.stringify(value)?.slice(0, 200)}`);
|
|
142
|
+
}
|
package/dist/wasm/loader.d.ts
CHANGED
|
@@ -61,6 +61,9 @@ export declare function callCatalog(snapshotJson: string, queryJson: string): {
|
|
|
61
61
|
export interface CheckCallOptions {
|
|
62
62
|
/** The release a move up starts from. */
|
|
63
63
|
upgradingFrom?: string;
|
|
64
|
+
/** The catalog key of the pure plugin the host limits a listen's senders
|
|
65
|
+
* with: an open listen told so on an upgrade is offered its check. */
|
|
66
|
+
limitingFunction?: string;
|
|
64
67
|
}
|
|
65
68
|
/**
|
|
66
69
|
* The Rust checker over `source` (crates/movement-checker/src/abi.rs
|
|
@@ -140,6 +143,19 @@ export declare function callLanguageQuery(source: string, snapshotJson: string,
|
|
|
140
143
|
ok: boolean;
|
|
141
144
|
json: unknown;
|
|
142
145
|
};
|
|
146
|
+
/**
|
|
147
|
+
* The describing query (crates/movement-language/src/describe.rs
|
|
148
|
+
* `describe_query`): the snapshot and the request as JSON, and the reply —
|
|
149
|
+
* what the snapshot holds, or the one connection or place an address names,
|
|
150
|
+
* as the description value — or `{error}` for a snapshot or a request that
|
|
151
|
+
* does not read.
|
|
152
|
+
*
|
|
153
|
+
* @internal Used by the description's wrapper (service/description.ts).
|
|
154
|
+
*/
|
|
155
|
+
export declare function callDescribeQuery(snapshotJson: string, requestJson: string): {
|
|
156
|
+
ok: boolean;
|
|
157
|
+
json: unknown;
|
|
158
|
+
};
|
|
143
159
|
/**
|
|
144
160
|
* The checker's story analysis (crates/movement-checker/src/story.rs
|
|
145
161
|
* `story_analysis`): `callCheckProgram`'s inputs, and the reply —
|
|
@@ -155,9 +171,10 @@ export declare function callStoryAnalysis(source: string, snapshotJson: string,
|
|
|
155
171
|
};
|
|
156
172
|
/**
|
|
157
173
|
* Whether an arrival fires a listen (crates/movement-engine/src/abi.rs
|
|
158
|
-
* `judge_arrival`): `{plan, arrival, nowMs}` as JSON, and the reply
|
|
159
|
-
* verdict, `{fires: true}`, `{skips}
|
|
160
|
-
*
|
|
174
|
+
* `judge_arrival`): `{plan, arrival, nowMs, answers?}` as JSON, and the reply
|
|
175
|
+
* — the verdict, `{fires: true}`, `{skips}`, `{undecided}`, or `{asks}` for a
|
|
176
|
+
* host function the answers do not answer yet — or `{error}` for an input
|
|
177
|
+
* that does not read.
|
|
161
178
|
*
|
|
162
179
|
* @internal Used by the engine's judge (movement-engine triggers/listen_plans.ts).
|
|
163
180
|
*/
|
|
@@ -165,6 +182,17 @@ export declare function callJudgeArrival(inputJson: string): {
|
|
|
165
182
|
ok: boolean;
|
|
166
183
|
json: unknown;
|
|
167
184
|
};
|
|
185
|
+
/**
|
|
186
|
+
* `callJudgeArrival`'s verdict with the term of the filter that skipped the
|
|
187
|
+
* arrival (crates/movement-engine/src/abi.rs `explain_arrival`): the same
|
|
188
|
+
* input, and the reply `{verdict, firstFailed?}`, or `{error}`.
|
|
189
|
+
*
|
|
190
|
+
* @internal Used by the engine's judge (movement-engine triggers/listen_plans.ts).
|
|
191
|
+
*/
|
|
192
|
+
export declare function callExplainArrival(inputJson: string): {
|
|
193
|
+
ok: boolean;
|
|
194
|
+
json: unknown;
|
|
195
|
+
};
|
|
168
196
|
/**
|
|
169
197
|
* What makes a listen one listen (crates/movement-engine/src/abi.rs
|
|
170
198
|
* `listen_identity`, `ListenPlan::identity`): the plan as JSON, and the reply
|
package/dist/wasm/loader.js
CHANGED
|
@@ -35,8 +35,10 @@ exports.callStandardLibrary = callStandardLibrary;
|
|
|
35
35
|
exports.callLanguageVersion = callLanguageVersion;
|
|
36
36
|
exports.callLanguageStanding = callLanguageStanding;
|
|
37
37
|
exports.callLanguageQuery = callLanguageQuery;
|
|
38
|
+
exports.callDescribeQuery = callDescribeQuery;
|
|
38
39
|
exports.callStoryAnalysis = callStoryAnalysis;
|
|
39
40
|
exports.callJudgeArrival = callJudgeArrival;
|
|
41
|
+
exports.callExplainArrival = callExplainArrival;
|
|
40
42
|
exports.callListenIdentity = callListenIdentity;
|
|
41
43
|
exports.callLandingNode = callLandingNode;
|
|
42
44
|
exports.callLandingMisfits = callLandingMisfits;
|
|
@@ -129,7 +131,7 @@ function callCatalog(snapshotJson, queryJson) {
|
|
|
129
131
|
return call('catalog_query', [snapshotJson, queryJson], []);
|
|
130
132
|
}
|
|
131
133
|
function optionsJson(options) {
|
|
132
|
-
return JSON.stringify({ upgradingFrom: options.upgradingFrom ?? null });
|
|
134
|
+
return JSON.stringify({ upgradingFrom: options.upgradingFrom ?? null, limitingFunction: options.limitingFunction ?? null });
|
|
133
135
|
}
|
|
134
136
|
/**
|
|
135
137
|
* The Rust checker over `source` (crates/movement-checker/src/abi.rs
|
|
@@ -202,6 +204,18 @@ function callLanguageStanding(pin) {
|
|
|
202
204
|
function callLanguageQuery(source, snapshotJson, queryJson) {
|
|
203
205
|
return callChecker('language_query', [source, snapshotJson, queryJson], []);
|
|
204
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* The describing query (crates/movement-language/src/describe.rs
|
|
209
|
+
* `describe_query`): the snapshot and the request as JSON, and the reply —
|
|
210
|
+
* what the snapshot holds, or the one connection or place an address names,
|
|
211
|
+
* as the description value — or `{error}` for a snapshot or a request that
|
|
212
|
+
* does not read.
|
|
213
|
+
*
|
|
214
|
+
* @internal Used by the description's wrapper (service/description.ts).
|
|
215
|
+
*/
|
|
216
|
+
function callDescribeQuery(snapshotJson, requestJson) {
|
|
217
|
+
return callChecker('describe_query', [snapshotJson, requestJson], []);
|
|
218
|
+
}
|
|
205
219
|
/**
|
|
206
220
|
* The checker's story analysis (crates/movement-checker/src/story.rs
|
|
207
221
|
* `story_analysis`): `callCheckProgram`'s inputs, and the reply —
|
|
@@ -216,15 +230,26 @@ function callStoryAnalysis(source, snapshotJson, options) {
|
|
|
216
230
|
}
|
|
217
231
|
/**
|
|
218
232
|
* Whether an arrival fires a listen (crates/movement-engine/src/abi.rs
|
|
219
|
-
* `judge_arrival`): `{plan, arrival, nowMs}` as JSON, and the reply
|
|
220
|
-
* verdict, `{fires: true}`, `{skips}
|
|
221
|
-
*
|
|
233
|
+
* `judge_arrival`): `{plan, arrival, nowMs, answers?}` as JSON, and the reply
|
|
234
|
+
* — the verdict, `{fires: true}`, `{skips}`, `{undecided}`, or `{asks}` for a
|
|
235
|
+
* host function the answers do not answer yet — or `{error}` for an input
|
|
236
|
+
* that does not read.
|
|
222
237
|
*
|
|
223
238
|
* @internal Used by the engine's judge (movement-engine triggers/listen_plans.ts).
|
|
224
239
|
*/
|
|
225
240
|
function callJudgeArrival(inputJson) {
|
|
226
241
|
return callChecker('judge_arrival', [inputJson], []);
|
|
227
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* `callJudgeArrival`'s verdict with the term of the filter that skipped the
|
|
245
|
+
* arrival (crates/movement-engine/src/abi.rs `explain_arrival`): the same
|
|
246
|
+
* input, and the reply `{verdict, firstFailed?}`, or `{error}`.
|
|
247
|
+
*
|
|
248
|
+
* @internal Used by the engine's judge (movement-engine triggers/listen_plans.ts).
|
|
249
|
+
*/
|
|
250
|
+
function callExplainArrival(inputJson) {
|
|
251
|
+
return callChecker('explain_arrival', [inputJson], []);
|
|
252
|
+
}
|
|
228
253
|
/**
|
|
229
254
|
* What makes a listen one listen (crates/movement-engine/src/abi.rs
|
|
230
255
|
* `listen_identity`, `ListenPlan::identity`): the plan as JSON, and the reply
|
|
@@ -518,8 +543,10 @@ function readExports(raw) {
|
|
|
518
543
|
'language_version',
|
|
519
544
|
'language_standing',
|
|
520
545
|
'language_query',
|
|
546
|
+
'describe_query',
|
|
521
547
|
'story_analysis',
|
|
522
548
|
'judge_arrival',
|
|
549
|
+
'explain_arrival',
|
|
523
550
|
'listen_identity',
|
|
524
551
|
'landing_node',
|
|
525
552
|
'landing_misfits',
|
package/dist/wasm/movement.wasm
CHANGED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@listen-fire/movement-lang",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.16.0",
|
|
5
5
|
"description": "The data-movement language: the wasm parser, checker and engine with their loader and bindings, the version rule, the expression AST and the types the contracts name",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=22.23.4 <23"
|