@kalada/host 0.1.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/README.md +101 -0
- package/dist/index.cjs +2329 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +562 -0
- package/dist/index.d.ts +562 -0
- package/dist/index.js +2310 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
import { KaladaV1Diagnostic, KaladaV1Program, CompiledKaladaV1Program, KaladaValue, KaladaV1Limits, KaladaV1FunctionLimits } from '@kalada/core';
|
|
2
|
+
import { KaladaSyntaxDiagnostic, KaladaSyntaxStaticType, KaladaParseResult, KaladaSourceMapEntry, KaladaParseOptions } from '@kalada/syntax';
|
|
3
|
+
|
|
4
|
+
type EditorGraphEdgeCategory = "root" | "definition" | "child" | "resolution";
|
|
5
|
+
interface EditorGraphAdmissionRequest {
|
|
6
|
+
readonly maxEdges: number;
|
|
7
|
+
readonly definitions: number;
|
|
8
|
+
readonly children: number;
|
|
9
|
+
readonly resolutions: number;
|
|
10
|
+
readonly roots: number;
|
|
11
|
+
readonly evidenceReserve?: number;
|
|
12
|
+
}
|
|
13
|
+
interface EditorGraphAdmission {
|
|
14
|
+
readonly model: Readonly<{
|
|
15
|
+
readonly B: number;
|
|
16
|
+
readonly D: number;
|
|
17
|
+
readonly C: number;
|
|
18
|
+
readonly V: number;
|
|
19
|
+
readonly R: number;
|
|
20
|
+
readonly Q: number;
|
|
21
|
+
}>;
|
|
22
|
+
readonly requestedChildren: number;
|
|
23
|
+
readonly backboneAdmitted: boolean;
|
|
24
|
+
readonly truncated: boolean;
|
|
25
|
+
readonly total: number;
|
|
26
|
+
readonly remaining: number;
|
|
27
|
+
}
|
|
28
|
+
interface EditorGraphEdgeUsage {
|
|
29
|
+
readonly budget: number;
|
|
30
|
+
readonly root: number;
|
|
31
|
+
readonly definition: number;
|
|
32
|
+
readonly child: number;
|
|
33
|
+
readonly resolution: number;
|
|
34
|
+
readonly total: number;
|
|
35
|
+
readonly remaining: number;
|
|
36
|
+
}
|
|
37
|
+
interface EditorGraphEdgeMeter {
|
|
38
|
+
readonly claim: (category: EditorGraphEdgeCategory) => boolean;
|
|
39
|
+
readonly snapshot: () => EditorGraphEdgeUsage;
|
|
40
|
+
}
|
|
41
|
+
declare function calculateEditorGraphAdmission(request: EditorGraphAdmissionRequest): EditorGraphAdmission;
|
|
42
|
+
declare function createEditorGraphEdgeMeter(maxEdges: number): EditorGraphEdgeMeter;
|
|
43
|
+
|
|
44
|
+
type HostPath = readonly (string | number)[];
|
|
45
|
+
type EditorData = null | boolean | number | string | readonly EditorData[] | {
|
|
46
|
+
readonly [key: string]: EditorData;
|
|
47
|
+
};
|
|
48
|
+
interface EditorRelationShape {
|
|
49
|
+
readonly name: string;
|
|
50
|
+
readonly key?: string;
|
|
51
|
+
readonly shape: EditorShape;
|
|
52
|
+
}
|
|
53
|
+
interface EditorShapeEvidence {
|
|
54
|
+
readonly sourceId?: string;
|
|
55
|
+
readonly annotations?: EditorData;
|
|
56
|
+
readonly constraints?: EditorData;
|
|
57
|
+
readonly relations?: readonly EditorRelationShape[];
|
|
58
|
+
}
|
|
59
|
+
type EditorUnknownCode = "invalid-shape" | "unsupported-shape" | "depth-limit" | "node-limit" | "edge-limit" | "unresolved-reference";
|
|
60
|
+
interface EditorUnknownEvidence {
|
|
61
|
+
readonly code: EditorUnknownCode;
|
|
62
|
+
readonly path: HostPath;
|
|
63
|
+
}
|
|
64
|
+
type EditorScalarName = "null" | "boolean" | "number" | "integer" | "string" | "undefined" | "void" | "bigint" | "symbol" | "date" | "NaN" | "json" | "instant" | "duration";
|
|
65
|
+
interface EditorScalarShape extends EditorShapeEvidence {
|
|
66
|
+
readonly kind: "scalar";
|
|
67
|
+
readonly name: EditorScalarName;
|
|
68
|
+
}
|
|
69
|
+
interface EditorUnknownShape extends EditorShapeEvidence {
|
|
70
|
+
readonly kind: "unknown";
|
|
71
|
+
readonly reason?: string;
|
|
72
|
+
readonly evidenceCode?: EditorUnknownCode;
|
|
73
|
+
}
|
|
74
|
+
interface EditorObjectPropertyShape {
|
|
75
|
+
readonly name: string;
|
|
76
|
+
readonly required: boolean;
|
|
77
|
+
readonly presence?: "required" | "optional" | "unknown";
|
|
78
|
+
readonly shape: EditorShape;
|
|
79
|
+
}
|
|
80
|
+
interface EditorObjectShape extends EditorShapeEvidence {
|
|
81
|
+
readonly kind: "object";
|
|
82
|
+
readonly properties: readonly EditorObjectPropertyShape[];
|
|
83
|
+
readonly requiredNames?: readonly string[];
|
|
84
|
+
readonly additionalProperties?: EditorShape;
|
|
85
|
+
readonly unknownKeys?: "strip" | "reject" | "passthrough" | "schema" | "unknown";
|
|
86
|
+
}
|
|
87
|
+
interface EditorArrayShape extends EditorShapeEvidence {
|
|
88
|
+
readonly kind: "array";
|
|
89
|
+
readonly element: EditorShape;
|
|
90
|
+
}
|
|
91
|
+
interface EditorTupleShape extends EditorShapeEvidence {
|
|
92
|
+
readonly kind: "tuple";
|
|
93
|
+
readonly items: readonly EditorShape[];
|
|
94
|
+
readonly rest?: EditorShape;
|
|
95
|
+
}
|
|
96
|
+
interface EditorUnionShape extends EditorShapeEvidence {
|
|
97
|
+
readonly kind: "union";
|
|
98
|
+
readonly variants: readonly EditorShape[];
|
|
99
|
+
readonly semantics?: string;
|
|
100
|
+
readonly discriminator?: EditorData;
|
|
101
|
+
}
|
|
102
|
+
interface EditorReferenceShape extends EditorShapeEvidence {
|
|
103
|
+
readonly kind: "reference";
|
|
104
|
+
readonly definition: string;
|
|
105
|
+
readonly reference?: string;
|
|
106
|
+
readonly unresolved?: string;
|
|
107
|
+
}
|
|
108
|
+
interface EditorLiteralShape extends EditorShapeEvidence {
|
|
109
|
+
readonly kind: "literal";
|
|
110
|
+
readonly value: EditorData;
|
|
111
|
+
}
|
|
112
|
+
interface EditorEnumShape extends EditorShapeEvidence {
|
|
113
|
+
readonly kind: "enum";
|
|
114
|
+
readonly values: readonly EditorData[];
|
|
115
|
+
}
|
|
116
|
+
interface EditorNeverShape extends EditorShapeEvidence {
|
|
117
|
+
readonly kind: "never";
|
|
118
|
+
}
|
|
119
|
+
interface EditorUnconstrainedShape extends EditorShapeEvidence {
|
|
120
|
+
readonly kind: "unconstrained";
|
|
121
|
+
readonly domain: "json" | "js";
|
|
122
|
+
}
|
|
123
|
+
interface EditorOpaqueShape extends EditorShapeEvidence {
|
|
124
|
+
readonly kind: "opaque";
|
|
125
|
+
readonly reason: string;
|
|
126
|
+
}
|
|
127
|
+
interface EditorRecordShape extends EditorShapeEvidence {
|
|
128
|
+
readonly kind: "record";
|
|
129
|
+
readonly key: EditorShape;
|
|
130
|
+
readonly value: EditorShape;
|
|
131
|
+
readonly exhaustive: boolean | "unknown";
|
|
132
|
+
}
|
|
133
|
+
interface EditorIntersectionShape extends EditorShapeEvidence {
|
|
134
|
+
readonly kind: "intersection";
|
|
135
|
+
readonly operands: readonly EditorShape[];
|
|
136
|
+
}
|
|
137
|
+
interface EditorWrapperShape extends EditorShapeEvidence {
|
|
138
|
+
readonly kind: "wrapper";
|
|
139
|
+
readonly wrapper: string;
|
|
140
|
+
readonly inner: EditorShape;
|
|
141
|
+
readonly value?: EditorData;
|
|
142
|
+
}
|
|
143
|
+
type EditorShape = EditorScalarShape | EditorUnknownShape | EditorObjectShape | EditorArrayShape | EditorTupleShape | EditorUnionShape | EditorReferenceShape | EditorLiteralShape | EditorEnumShape | EditorNeverShape | EditorUnconstrainedShape | EditorOpaqueShape | EditorRecordShape | EditorIntersectionShape | EditorWrapperShape;
|
|
144
|
+
interface ManualEditorDefinition {
|
|
145
|
+
readonly name: string;
|
|
146
|
+
readonly shape: EditorShape;
|
|
147
|
+
}
|
|
148
|
+
interface ManualEditorShapeDocument {
|
|
149
|
+
readonly root: EditorShape;
|
|
150
|
+
readonly definitions?: readonly ManualEditorDefinition[];
|
|
151
|
+
readonly evidence?: readonly EditorUnknownCode[];
|
|
152
|
+
}
|
|
153
|
+
interface EditorGraphLimits {
|
|
154
|
+
readonly maxDepth: number;
|
|
155
|
+
readonly maxNodes: number;
|
|
156
|
+
readonly maxEdges: number;
|
|
157
|
+
}
|
|
158
|
+
interface EditorGraphInput {
|
|
159
|
+
readonly bindingId: string;
|
|
160
|
+
readonly path: HostPath;
|
|
161
|
+
readonly document: ManualEditorShapeDocument;
|
|
162
|
+
}
|
|
163
|
+
interface EditorEdge {
|
|
164
|
+
readonly nodeId: string;
|
|
165
|
+
readonly path: HostPath;
|
|
166
|
+
readonly cycle: boolean;
|
|
167
|
+
}
|
|
168
|
+
interface EditorPropertyEdge extends EditorEdge {
|
|
169
|
+
readonly name: string;
|
|
170
|
+
readonly required: boolean;
|
|
171
|
+
readonly presence?: "required" | "optional" | "unknown";
|
|
172
|
+
}
|
|
173
|
+
interface EditorRelationEdge extends EditorEdge {
|
|
174
|
+
readonly name: string;
|
|
175
|
+
readonly key?: string;
|
|
176
|
+
}
|
|
177
|
+
interface EditorNodeBase {
|
|
178
|
+
readonly id: string;
|
|
179
|
+
readonly path: HostPath;
|
|
180
|
+
readonly availability: "available" | "unavailable" | "unknown";
|
|
181
|
+
readonly evidence: readonly EditorUnknownEvidence[];
|
|
182
|
+
readonly sourceId?: string;
|
|
183
|
+
readonly annotations?: EditorData;
|
|
184
|
+
readonly constraints?: EditorData;
|
|
185
|
+
readonly relations?: readonly EditorRelationEdge[];
|
|
186
|
+
}
|
|
187
|
+
interface EditorScalarNode extends EditorNodeBase {
|
|
188
|
+
readonly kind: "scalar";
|
|
189
|
+
readonly name: EditorScalarName;
|
|
190
|
+
}
|
|
191
|
+
interface EditorUnknownNode extends EditorNodeBase {
|
|
192
|
+
readonly kind: "unknown";
|
|
193
|
+
readonly reason?: string;
|
|
194
|
+
}
|
|
195
|
+
interface EditorObjectNode extends EditorNodeBase {
|
|
196
|
+
readonly kind: "object";
|
|
197
|
+
readonly properties: readonly EditorPropertyEdge[];
|
|
198
|
+
readonly requiredNames?: readonly string[];
|
|
199
|
+
readonly unknownKeys?: "strip" | "reject" | "passthrough" | "schema" | "unknown";
|
|
200
|
+
readonly additionalProperties?: EditorEdge;
|
|
201
|
+
}
|
|
202
|
+
interface EditorArrayNode extends EditorNodeBase {
|
|
203
|
+
readonly kind: "array";
|
|
204
|
+
readonly element: EditorEdge;
|
|
205
|
+
}
|
|
206
|
+
interface EditorTupleNode extends EditorNodeBase {
|
|
207
|
+
readonly kind: "tuple";
|
|
208
|
+
readonly items: readonly EditorEdge[];
|
|
209
|
+
readonly rest?: EditorEdge;
|
|
210
|
+
}
|
|
211
|
+
interface EditorUnionNode extends EditorNodeBase {
|
|
212
|
+
readonly kind: "union";
|
|
213
|
+
readonly variants: readonly EditorEdge[];
|
|
214
|
+
readonly semantics?: string;
|
|
215
|
+
readonly discriminator?: EditorData;
|
|
216
|
+
}
|
|
217
|
+
interface EditorReferenceNode extends EditorNodeBase {
|
|
218
|
+
readonly kind: "reference";
|
|
219
|
+
readonly definition: string;
|
|
220
|
+
readonly status: "resolved" | "unresolved";
|
|
221
|
+
readonly target?: EditorEdge;
|
|
222
|
+
readonly reference?: string;
|
|
223
|
+
readonly unresolved?: string;
|
|
224
|
+
}
|
|
225
|
+
interface EditorLiteralNode extends EditorNodeBase {
|
|
226
|
+
readonly kind: "literal";
|
|
227
|
+
readonly value: EditorData;
|
|
228
|
+
}
|
|
229
|
+
interface EditorEnumNode extends EditorNodeBase {
|
|
230
|
+
readonly kind: "enum";
|
|
231
|
+
readonly values: readonly EditorData[];
|
|
232
|
+
}
|
|
233
|
+
interface EditorNeverNode extends EditorNodeBase {
|
|
234
|
+
readonly kind: "never";
|
|
235
|
+
}
|
|
236
|
+
interface EditorUnconstrainedNode extends EditorNodeBase {
|
|
237
|
+
readonly kind: "unconstrained";
|
|
238
|
+
readonly domain: "json" | "js";
|
|
239
|
+
}
|
|
240
|
+
interface EditorOpaqueNode extends EditorNodeBase {
|
|
241
|
+
readonly kind: "opaque";
|
|
242
|
+
readonly reason: string;
|
|
243
|
+
}
|
|
244
|
+
interface EditorRecordNode extends EditorNodeBase {
|
|
245
|
+
readonly kind: "record";
|
|
246
|
+
readonly key: EditorEdge;
|
|
247
|
+
readonly value: EditorEdge;
|
|
248
|
+
readonly exhaustive: boolean | "unknown";
|
|
249
|
+
}
|
|
250
|
+
interface EditorIntersectionNode extends EditorNodeBase {
|
|
251
|
+
readonly kind: "intersection";
|
|
252
|
+
readonly operands: readonly EditorEdge[];
|
|
253
|
+
}
|
|
254
|
+
interface EditorWrapperNode extends EditorNodeBase {
|
|
255
|
+
readonly kind: "wrapper";
|
|
256
|
+
readonly wrapper: string;
|
|
257
|
+
readonly inner: EditorEdge;
|
|
258
|
+
readonly value?: EditorData;
|
|
259
|
+
}
|
|
260
|
+
type EditorNode = EditorScalarNode | EditorUnknownNode | EditorObjectNode | EditorArrayNode | EditorTupleNode | EditorUnionNode | EditorReferenceNode | EditorLiteralNode | EditorEnumNode | EditorNeverNode | EditorUnconstrainedNode | EditorOpaqueNode | EditorRecordNode | EditorIntersectionNode | EditorWrapperNode;
|
|
261
|
+
interface EditorGraphRoot extends EditorEdge {
|
|
262
|
+
readonly bindingId: string;
|
|
263
|
+
}
|
|
264
|
+
interface EditorGraphDefinition {
|
|
265
|
+
readonly bindingId: string;
|
|
266
|
+
readonly name: string;
|
|
267
|
+
readonly nodeId: string;
|
|
268
|
+
readonly path: HostPath;
|
|
269
|
+
}
|
|
270
|
+
interface EditorGraph {
|
|
271
|
+
readonly format: "kalada-editor-graph-v1";
|
|
272
|
+
readonly nodeIdScope: "document-local";
|
|
273
|
+
readonly limits: EditorGraphLimits;
|
|
274
|
+
readonly roots: readonly EditorGraphRoot[];
|
|
275
|
+
readonly nodes: readonly EditorNode[];
|
|
276
|
+
readonly definitions: readonly EditorGraphDefinition[];
|
|
277
|
+
readonly evidence: readonly EditorUnknownEvidence[];
|
|
278
|
+
readonly admission?: EditorGraphEdgeUsage;
|
|
279
|
+
}
|
|
280
|
+
interface EditorTraversalOptions {
|
|
281
|
+
readonly maxDepth?: number;
|
|
282
|
+
readonly maxVisits?: number;
|
|
283
|
+
}
|
|
284
|
+
interface EditorTraversalStep {
|
|
285
|
+
readonly nodeId: string;
|
|
286
|
+
readonly path: HostPath;
|
|
287
|
+
readonly depth: number;
|
|
288
|
+
readonly via: "root" | "property" | "additional-property" | "element" | "item" | "rest" | "variant" | "operand" | "record-key" | "record-value" | "wrapper" | "relation" | "reference";
|
|
289
|
+
readonly cycle: boolean;
|
|
290
|
+
readonly availability: "available" | "unavailable" | "unknown";
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
type SerializablePrimitive = null | boolean | number | string;
|
|
294
|
+
type SerializableValue = SerializablePrimitive | readonly SerializableValue[] | {
|
|
295
|
+
readonly [key: string]: SerializableValue;
|
|
296
|
+
};
|
|
297
|
+
type CapabilityMode = "sync" | "async";
|
|
298
|
+
type CapabilityKind = "validator" | "codec";
|
|
299
|
+
interface ProviderIdentityInput {
|
|
300
|
+
readonly providerId?: string;
|
|
301
|
+
readonly providerVersion?: string;
|
|
302
|
+
readonly configurationDigest?: string;
|
|
303
|
+
readonly cacheable?: boolean;
|
|
304
|
+
}
|
|
305
|
+
interface CapabilityIdentityInput {
|
|
306
|
+
readonly capabilityId?: string;
|
|
307
|
+
readonly capabilityVersion?: string;
|
|
308
|
+
readonly configurationDigest?: string;
|
|
309
|
+
readonly cacheable?: boolean;
|
|
310
|
+
}
|
|
311
|
+
type Cacheability = Readonly<{
|
|
312
|
+
cacheable: true;
|
|
313
|
+
id: string;
|
|
314
|
+
version: string;
|
|
315
|
+
configurationDigest: string;
|
|
316
|
+
}> | Readonly<{
|
|
317
|
+
cacheable: false;
|
|
318
|
+
reason: "explicitly-disabled" | "missing-identity" | "provider-not-cacheable" | "capability-not-cacheable";
|
|
319
|
+
}>;
|
|
320
|
+
interface ManualValidatorCapability extends CapabilityIdentityInput {
|
|
321
|
+
readonly handle: string;
|
|
322
|
+
readonly kind: "validator";
|
|
323
|
+
readonly mode: CapabilityMode;
|
|
324
|
+
readonly decode: (value: unknown) => unknown;
|
|
325
|
+
}
|
|
326
|
+
interface ManualCodecCapability extends CapabilityIdentityInput {
|
|
327
|
+
readonly handle: string;
|
|
328
|
+
readonly kind: "codec";
|
|
329
|
+
readonly mode: CapabilityMode;
|
|
330
|
+
readonly convert: (value: unknown) => unknown;
|
|
331
|
+
}
|
|
332
|
+
type ManualCapability = ManualValidatorCapability | ManualCodecCapability;
|
|
333
|
+
interface CapabilityDeclaration {
|
|
334
|
+
readonly handle: string;
|
|
335
|
+
readonly kind: CapabilityKind;
|
|
336
|
+
readonly mode: CapabilityMode;
|
|
337
|
+
readonly capabilityId?: string;
|
|
338
|
+
readonly capabilityVersion?: string;
|
|
339
|
+
readonly configurationDigest?: string;
|
|
340
|
+
readonly identity: Cacheability;
|
|
341
|
+
}
|
|
342
|
+
type LiveCapability = Readonly<CapabilityDeclaration & {
|
|
343
|
+
readonly kind: "validator";
|
|
344
|
+
readonly decode: (value: unknown) => unknown;
|
|
345
|
+
}> | Readonly<CapabilityDeclaration & {
|
|
346
|
+
readonly kind: "codec";
|
|
347
|
+
readonly convert: (value: unknown) => unknown;
|
|
348
|
+
}>;
|
|
349
|
+
interface CapabilitySnapshot {
|
|
350
|
+
readonly scope: "instance";
|
|
351
|
+
readonly capabilities: Readonly<Record<string, LiveCapability>>;
|
|
352
|
+
}
|
|
353
|
+
interface ProvenanceEntry {
|
|
354
|
+
readonly providerId: string;
|
|
355
|
+
readonly providerVersion?: string;
|
|
356
|
+
readonly source?: string;
|
|
357
|
+
readonly extractor?: string;
|
|
358
|
+
readonly override?: string;
|
|
359
|
+
}
|
|
360
|
+
interface ManualBindingDescriptor {
|
|
361
|
+
readonly id: string;
|
|
362
|
+
readonly name: string;
|
|
363
|
+
readonly path: readonly string[];
|
|
364
|
+
readonly semanticType: KaladaSyntaxStaticType;
|
|
365
|
+
readonly editorShape?: ManualEditorShapeDocument;
|
|
366
|
+
readonly validatorHandle?: string;
|
|
367
|
+
readonly codecHandle?: string;
|
|
368
|
+
readonly metadata?: SerializableValue;
|
|
369
|
+
readonly provenance?: readonly ProvenanceEntry[];
|
|
370
|
+
}
|
|
371
|
+
interface ManualProviderInput extends ProviderIdentityInput {
|
|
372
|
+
readonly mode: CapabilityMode;
|
|
373
|
+
readonly bindings: readonly ManualBindingDescriptor[];
|
|
374
|
+
readonly capabilities?: readonly ManualCapability[];
|
|
375
|
+
}
|
|
376
|
+
interface NormalizedBinding {
|
|
377
|
+
readonly id: string;
|
|
378
|
+
readonly name: string;
|
|
379
|
+
readonly path: readonly string[];
|
|
380
|
+
readonly semanticType: KaladaSyntaxStaticType;
|
|
381
|
+
readonly editorShapeRoot?: string;
|
|
382
|
+
readonly validator?: CapabilityDeclaration;
|
|
383
|
+
readonly codec?: CapabilityDeclaration;
|
|
384
|
+
readonly metadata?: SerializableValue;
|
|
385
|
+
readonly provenance: readonly ProvenanceEntry[];
|
|
386
|
+
}
|
|
387
|
+
interface HostCompileBinding {
|
|
388
|
+
readonly id: string;
|
|
389
|
+
readonly name: string;
|
|
390
|
+
readonly semanticType: KaladaSyntaxStaticType;
|
|
391
|
+
}
|
|
392
|
+
interface HostCompileProjection {
|
|
393
|
+
readonly format: "kalada-host-compile-projection-v1";
|
|
394
|
+
readonly bindings: readonly HostCompileBinding[];
|
|
395
|
+
}
|
|
396
|
+
interface NormalizedEnvironment {
|
|
397
|
+
readonly format: "kalada-host-environment-v1";
|
|
398
|
+
readonly provider: Readonly<{
|
|
399
|
+
mode: CapabilityMode;
|
|
400
|
+
providerId?: string;
|
|
401
|
+
providerVersion?: string;
|
|
402
|
+
configurationDigest?: string;
|
|
403
|
+
identity: Cacheability;
|
|
404
|
+
}>;
|
|
405
|
+
readonly cacheability: Cacheability;
|
|
406
|
+
readonly compileProjection: HostCompileProjection;
|
|
407
|
+
readonly bindings: readonly NormalizedBinding[];
|
|
408
|
+
readonly capabilities: readonly CapabilityDeclaration[];
|
|
409
|
+
readonly editorGraph: EditorGraph;
|
|
410
|
+
}
|
|
411
|
+
type HostEnvironmentDiagnosticCode = "HOST_ENVIRONMENT_INVALID_PROVIDER" | "HOST_ENVIRONMENT_INVALID_IDENTITY" | "HOST_ENVIRONMENT_INVALID_CAPABILITY" | "HOST_ENVIRONMENT_DUPLICATE_CAPABILITY" | "HOST_ENVIRONMENT_INVALID_BINDING" | "HOST_ENVIRONMENT_DUPLICATE_BINDING" | "HOST_ENVIRONMENT_INVALID_SEMANTIC_TYPE" | "HOST_ENVIRONMENT_INVALID_METADATA" | "HOST_ENVIRONMENT_INVALID_PROVENANCE" | "HOST_ENVIRONMENT_UNKNOWN_CAPABILITY";
|
|
412
|
+
type HostDiagnosticPhase = "environment" | "parse" | "lower" | "compile" | "link" | "bind" | "evaluate";
|
|
413
|
+
interface Utf16Position {
|
|
414
|
+
readonly line: number;
|
|
415
|
+
readonly character: number;
|
|
416
|
+
}
|
|
417
|
+
interface Utf16Range {
|
|
418
|
+
readonly start: Utf16Position;
|
|
419
|
+
readonly end: Utf16Position;
|
|
420
|
+
}
|
|
421
|
+
interface HostDiagnosticSource {
|
|
422
|
+
readonly uri: string;
|
|
423
|
+
readonly range: Utf16Range;
|
|
424
|
+
}
|
|
425
|
+
type HostDiagnosticCause = Readonly<KaladaSyntaxDiagnostic | KaladaV1Diagnostic>;
|
|
426
|
+
interface HostDiagnostic {
|
|
427
|
+
readonly code: string;
|
|
428
|
+
readonly phase: HostDiagnosticPhase;
|
|
429
|
+
readonly message: string;
|
|
430
|
+
readonly source?: HostDiagnosticSource;
|
|
431
|
+
readonly bindingPath?: HostPath;
|
|
432
|
+
readonly provenance?: Readonly<Record<string, string>>;
|
|
433
|
+
readonly cause?: HostDiagnosticCause;
|
|
434
|
+
}
|
|
435
|
+
interface HostEnvironmentDiagnostic extends HostDiagnostic {
|
|
436
|
+
readonly code: HostEnvironmentDiagnosticCode;
|
|
437
|
+
readonly phase: "environment";
|
|
438
|
+
}
|
|
439
|
+
type DescribeEnvironmentResult = Readonly<{
|
|
440
|
+
ok: true;
|
|
441
|
+
environment: NormalizedEnvironment;
|
|
442
|
+
capabilitySnapshot: CapabilitySnapshot;
|
|
443
|
+
}> | Readonly<{
|
|
444
|
+
ok: false;
|
|
445
|
+
diagnostics: readonly HostEnvironmentDiagnostic[];
|
|
446
|
+
}>;
|
|
447
|
+
interface ManualProvider {
|
|
448
|
+
readonly kind: "manual";
|
|
449
|
+
readonly describe: () => DescribeEnvironmentResult;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
type HostExecutionDiagnosticCode = "HOST_PARSE_INVALID_SOURCE" | "HOST_COMPILE_INVALID_OPTIONS" | "HOST_COMPILE_INVALID_PROJECTION" | "HOST_LINK_INCOMPATIBLE_ENVIRONMENT" | "HOST_LINK_MISSING_BINDING" | "HOST_LINK_INVALID_CAPABILITY" | "HOST_LINK_ASYNC_UNSUPPORTED" | "HOST_BINDING_MISSING" | "HOST_BINDING_DECODE" | "HOST_BINDING_CONVERSION" | "HOST_BINDING_SEMANTIC";
|
|
453
|
+
type HostResult<T> = Readonly<{
|
|
454
|
+
ok: true;
|
|
455
|
+
value: T;
|
|
456
|
+
}> | Readonly<{
|
|
457
|
+
ok: false;
|
|
458
|
+
diagnostics: readonly HostDiagnostic[];
|
|
459
|
+
}>;
|
|
460
|
+
interface HostExpressionSource {
|
|
461
|
+
readonly uri: string;
|
|
462
|
+
readonly text: string;
|
|
463
|
+
}
|
|
464
|
+
interface HostParseOptions {
|
|
465
|
+
readonly sourceUri?: string;
|
|
466
|
+
readonly syntax?: KaladaParseOptions;
|
|
467
|
+
}
|
|
468
|
+
interface HostCompileOptions {
|
|
469
|
+
readonly profile?: string;
|
|
470
|
+
readonly limits?: Partial<KaladaV1Limits & KaladaV1FunctionLimits>;
|
|
471
|
+
}
|
|
472
|
+
interface HostPrepareOptions {
|
|
473
|
+
readonly parse?: HostParseOptions;
|
|
474
|
+
readonly compile?: HostCompileOptions;
|
|
475
|
+
}
|
|
476
|
+
interface ParsedExpression {
|
|
477
|
+
readonly format: "kalada-host-parsed-expression-v1";
|
|
478
|
+
readonly source: HostExpressionSource;
|
|
479
|
+
readonly syntax: KaladaParseResult;
|
|
480
|
+
readonly parseFingerprintInput: Readonly<Record<string, unknown>>;
|
|
481
|
+
}
|
|
482
|
+
interface CompiledExpression {
|
|
483
|
+
readonly format: "kalada-host-compiled-expression-v1";
|
|
484
|
+
readonly source: HostExpressionSource;
|
|
485
|
+
readonly parsed: ParsedExpression;
|
|
486
|
+
readonly program: KaladaV1Program<string>;
|
|
487
|
+
readonly sourceMap: readonly KaladaSourceMapEntry[];
|
|
488
|
+
readonly coreCompilation: CompiledKaladaV1Program<string>;
|
|
489
|
+
readonly dependencies: readonly string[];
|
|
490
|
+
readonly resultType: KaladaSyntaxStaticType;
|
|
491
|
+
readonly compileProjectionFingerprint: string;
|
|
492
|
+
readonly compileFingerprint: string;
|
|
493
|
+
}
|
|
494
|
+
interface HostLinkPlanSlot {
|
|
495
|
+
readonly index: number;
|
|
496
|
+
readonly bindingId: string;
|
|
497
|
+
readonly name: string;
|
|
498
|
+
readonly path: HostPath;
|
|
499
|
+
readonly semanticType: KaladaSyntaxStaticType;
|
|
500
|
+
readonly validator?: CapabilityDeclaration;
|
|
501
|
+
readonly codec?: CapabilityDeclaration;
|
|
502
|
+
}
|
|
503
|
+
interface PreparedExpression {
|
|
504
|
+
readonly format: "kalada-host-prepared-expression-v1";
|
|
505
|
+
readonly compiled: CompiledExpression;
|
|
506
|
+
readonly environment: NormalizedEnvironment;
|
|
507
|
+
readonly linkPlan: readonly HostLinkPlanSlot[];
|
|
508
|
+
readonly linkFingerprint?: string;
|
|
509
|
+
evaluate(values: unknown): HostResult<KaladaValue>;
|
|
510
|
+
}
|
|
511
|
+
type LinkExpressionResult = HostResult<PreparedExpression>;
|
|
512
|
+
type CompileExpressionResult = HostResult<CompiledExpression>;
|
|
513
|
+
type ParseExpressionResult = HostResult<ParsedExpression>;
|
|
514
|
+
type PrepareExpressionResult = HostResult<PreparedExpression>;
|
|
515
|
+
type EvaluateExpressionResult = HostResult<KaladaValue>;
|
|
516
|
+
|
|
517
|
+
declare function parseExpression(source: string, options?: HostParseOptions): ParseExpressionResult;
|
|
518
|
+
declare function compileExpression(parsed: ParsedExpression, projection: HostCompileProjection, options?: HostCompileOptions): CompileExpressionResult;
|
|
519
|
+
|
|
520
|
+
declare const DEFAULT_EDITOR_GRAPH_LIMITS: EditorGraphLimits;
|
|
521
|
+
declare function createEditorGraph(inputs: readonly EditorGraphInput[], requestedLimits?: Partial<EditorGraphLimits>): EditorGraph;
|
|
522
|
+
|
|
523
|
+
declare function traverseEditorGraph(graph: EditorGraph, options?: EditorTraversalOptions): readonly EditorTraversalStep[];
|
|
524
|
+
|
|
525
|
+
declare function prepareExpression(source: string, provider: ManualProvider, options?: HostPrepareOptions): PrepareExpressionResult;
|
|
526
|
+
declare function evaluateExpression(source: string, provider: ManualProvider, values: unknown, options?: HostPrepareOptions): EvaluateExpressionResult;
|
|
527
|
+
|
|
528
|
+
declare const HOST_COMPILE_FINGERPRINT_VERSION = "kalada-host-compile-fingerprint-v1";
|
|
529
|
+
declare const HOST_LINK_FINGERPRINT_VERSION = "kalada-host-link-fingerprint-v1";
|
|
530
|
+
|
|
531
|
+
declare function linkExpression(compiled: CompiledExpression, environment: NormalizedEnvironment, snapshot: CapabilitySnapshot): LinkExpressionResult;
|
|
532
|
+
|
|
533
|
+
declare function createManualProvider(input: ManualProviderInput): ManualProvider;
|
|
534
|
+
declare function describeEnvironment(provider: ManualProvider): DescribeEnvironmentResult;
|
|
535
|
+
declare function normalizeManualEnvironment(input: ManualProviderInput): DescribeEnvironmentResult;
|
|
536
|
+
|
|
537
|
+
type SemanticTypeResult = Readonly<{
|
|
538
|
+
ok: true;
|
|
539
|
+
value: KaladaSyntaxStaticType;
|
|
540
|
+
}> | Readonly<{
|
|
541
|
+
ok: false;
|
|
542
|
+
}>;
|
|
543
|
+
declare function readSemanticType(input: unknown): SemanticTypeResult;
|
|
544
|
+
|
|
545
|
+
interface SerializableLimits {
|
|
546
|
+
readonly maxDepth: number;
|
|
547
|
+
readonly maxNodes: number;
|
|
548
|
+
readonly maxCollectionSize: number;
|
|
549
|
+
readonly maxStringLength: number;
|
|
550
|
+
}
|
|
551
|
+
declare const DEFAULT_SERIALIZABLE_LIMITS: SerializableLimits;
|
|
552
|
+
type SerializableCloneResult = Readonly<{
|
|
553
|
+
ok: true;
|
|
554
|
+
value: SerializableValue;
|
|
555
|
+
}> | Readonly<{
|
|
556
|
+
ok: false;
|
|
557
|
+
reason: "invalid-value" | "accessor" | "cycle" | "depth-limit" | "size-limit";
|
|
558
|
+
path: HostPath;
|
|
559
|
+
}>;
|
|
560
|
+
declare function cloneSerializableData(input: unknown, limits?: SerializableLimits): SerializableCloneResult;
|
|
561
|
+
|
|
562
|
+
export { type Cacheability, type CapabilityDeclaration, type CapabilityIdentityInput, type CapabilityKind, type CapabilityMode, type CapabilitySnapshot, type CompileExpressionResult, type CompiledExpression, DEFAULT_EDITOR_GRAPH_LIMITS, DEFAULT_SERIALIZABLE_LIMITS, type DescribeEnvironmentResult, type EditorArrayNode, type EditorArrayShape, type EditorData, type EditorEdge, type EditorEnumNode, type EditorEnumShape, type EditorGraph, type EditorGraphAdmission, type EditorGraphAdmissionRequest, type EditorGraphDefinition, type EditorGraphEdgeCategory, type EditorGraphEdgeMeter, type EditorGraphEdgeUsage, type EditorGraphInput, type EditorGraphLimits, type EditorGraphRoot, type EditorIntersectionNode, type EditorIntersectionShape, type EditorLiteralNode, type EditorLiteralShape, type EditorNeverNode, type EditorNeverShape, type EditorNode, type EditorObjectNode, type EditorObjectPropertyShape, type EditorObjectShape, type EditorOpaqueNode, type EditorOpaqueShape, type EditorPropertyEdge, type EditorRecordNode, type EditorRecordShape, type EditorReferenceNode, type EditorReferenceShape, type EditorRelationEdge, type EditorRelationShape, type EditorScalarName, type EditorScalarNode, type EditorScalarShape, type EditorShape, type EditorTraversalOptions, type EditorTraversalStep, type EditorTupleNode, type EditorTupleShape, type EditorUnconstrainedNode, type EditorUnconstrainedShape, type EditorUnionNode, type EditorUnionShape, type EditorUnknownCode, type EditorUnknownEvidence, type EditorUnknownNode, type EditorUnknownShape, type EditorWrapperNode, type EditorWrapperShape, type EvaluateExpressionResult, HOST_COMPILE_FINGERPRINT_VERSION, HOST_LINK_FINGERPRINT_VERSION, type HostCompileBinding, type HostCompileOptions, type HostCompileProjection, type HostDiagnostic, type HostDiagnosticCause, type HostDiagnosticPhase, type HostDiagnosticSource, type HostEnvironmentDiagnostic, type HostEnvironmentDiagnosticCode, type HostExecutionDiagnosticCode, type HostExpressionSource, type HostLinkPlanSlot, type HostParseOptions, type HostPath, type HostPrepareOptions, type HostResult, type LinkExpressionResult, type LiveCapability, type ManualBindingDescriptor, type ManualCapability, type ManualCodecCapability, type ManualEditorDefinition, type ManualEditorShapeDocument, type ManualProvider, type ManualProviderInput, type ManualValidatorCapability, type NormalizedBinding, type NormalizedEnvironment, type ParseExpressionResult, type ParsedExpression, type PrepareExpressionResult, type PreparedExpression, type ProvenanceEntry, type ProviderIdentityInput, type SemanticTypeResult, type SerializableCloneResult, type SerializableLimits, type SerializablePrimitive, type SerializableValue, type Utf16Position, type Utf16Range, calculateEditorGraphAdmission, cloneSerializableData, compileExpression, createEditorGraph, createEditorGraphEdgeMeter, createManualProvider, describeEnvironment, evaluateExpression, linkExpression, normalizeManualEnvironment, parseExpression, prepareExpression, readSemanticType, traverseEditorGraph };
|