@shapeshift-labs/frontier-lang 0.1.0 → 0.4.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 +238 -153
- package/dist/index.d.ts +9 -202
- package/dist/index.js +9 -608
- package/package.json +22 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,202 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
readonly law?: "semilattice" | "commutative" | "associative" | "idempotent";
|
|
11
|
-
readonly condition?: string;
|
|
12
|
-
readonly customName?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface SemanticRegion {
|
|
16
|
-
readonly id: string;
|
|
17
|
-
readonly access?: "read" | "write" | "readwrite" | "effect" | "schema" | "evidence";
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface BaseNode {
|
|
21
|
-
readonly kind: NodeKind;
|
|
22
|
-
readonly id: SemanticId;
|
|
23
|
-
readonly name: string;
|
|
24
|
-
readonly parentId?: SemanticId;
|
|
25
|
-
readonly regions?: readonly SemanticRegion[];
|
|
26
|
-
readonly metadata?: JsonObject;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface CompileTarget {
|
|
30
|
-
readonly language: "typescript" | "javascript" | string;
|
|
31
|
-
readonly packageName?: string;
|
|
32
|
-
readonly emitPath?: string;
|
|
33
|
-
readonly moduleFormat?: "esm" | "commonjs";
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface ModuleNode extends BaseNode {
|
|
37
|
-
readonly kind: "module";
|
|
38
|
-
readonly imports?: readonly string[];
|
|
39
|
-
readonly targets?: readonly CompileTarget[];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface FieldDeclaration {
|
|
43
|
-
readonly id: SemanticId;
|
|
44
|
-
readonly name: string;
|
|
45
|
-
readonly type: string;
|
|
46
|
-
readonly key?: boolean;
|
|
47
|
-
readonly merge?: MergePolicy;
|
|
48
|
-
readonly metadata?: JsonObject;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface EntityNode extends BaseNode {
|
|
52
|
-
readonly kind: "entity";
|
|
53
|
-
readonly fields: readonly FieldDeclaration[];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface StateCollection {
|
|
57
|
-
readonly id: SemanticId;
|
|
58
|
-
readonly name: string;
|
|
59
|
-
readonly type: string;
|
|
60
|
-
readonly merge?: MergePolicy;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface StateNode extends BaseNode {
|
|
64
|
-
readonly kind: "state";
|
|
65
|
-
readonly collections: readonly StateCollection[];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface ActionNode extends BaseNode {
|
|
69
|
-
readonly kind: "action";
|
|
70
|
-
readonly input?: string;
|
|
71
|
-
readonly returns?: string;
|
|
72
|
-
readonly reads?: readonly string[];
|
|
73
|
-
readonly writes?: readonly string[];
|
|
74
|
-
readonly uses?: readonly string[];
|
|
75
|
-
readonly throws?: readonly string[];
|
|
76
|
-
readonly body?: readonly JsonObject[];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export interface ViewNode extends BaseNode {
|
|
80
|
-
readonly kind: "view";
|
|
81
|
-
readonly reads?: readonly string[];
|
|
82
|
-
readonly dispatches?: readonly string[];
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface MigrationNode extends BaseNode {
|
|
86
|
-
readonly kind: "migration";
|
|
87
|
-
readonly fromVersion: string;
|
|
88
|
-
readonly toVersion: string;
|
|
89
|
-
readonly changes: readonly JsonObject[];
|
|
90
|
-
readonly invariants?: readonly string[];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export interface EffectNode extends BaseNode {
|
|
94
|
-
readonly kind: "effect";
|
|
95
|
-
readonly capability: string;
|
|
96
|
-
readonly resources?: readonly string[];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface TargetNode extends BaseNode {
|
|
100
|
-
readonly kind: "target";
|
|
101
|
-
readonly target: CompileTarget;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export type SemanticNode = ModuleNode | EntityNode | StateNode | ActionNode | ViewNode | MigrationNode | EffectNode | TargetNode;
|
|
105
|
-
|
|
106
|
-
export interface FrontierLangDocument {
|
|
107
|
-
readonly kind: "frontier.lang.document";
|
|
108
|
-
readonly version: 1;
|
|
109
|
-
readonly id: SemanticId;
|
|
110
|
-
readonly name: string;
|
|
111
|
-
readonly rootIds: readonly SemanticId[];
|
|
112
|
-
readonly nodes: Readonly<Record<SemanticId, SemanticNode>>;
|
|
113
|
-
readonly history?: readonly ReplayEvent[];
|
|
114
|
-
readonly metadata?: JsonObject;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export type SemanticPatchOperation =
|
|
118
|
-
| { readonly op: "upsertNode"; readonly node: SemanticNode; readonly touches?: readonly SemanticRegion[] }
|
|
119
|
-
| { readonly op: "removeNode"; readonly id: SemanticId; readonly touches?: readonly SemanticRegion[] }
|
|
120
|
-
| { readonly op: "renameNode"; readonly id: SemanticId; readonly name: string; readonly touches?: readonly SemanticRegion[] }
|
|
121
|
-
| { readonly op: "moveNode"; readonly id: SemanticId; readonly parentId?: SemanticId; readonly touches?: readonly SemanticRegion[] }
|
|
122
|
-
| { readonly op: "updateNode"; readonly id: SemanticId; readonly set: JsonObject; readonly touches?: readonly SemanticRegion[] }
|
|
123
|
-
| { readonly op: "addEvidence"; readonly evidence: EvidenceRecord; readonly touches?: readonly SemanticRegion[] };
|
|
124
|
-
|
|
125
|
-
export interface EvidenceRecord {
|
|
126
|
-
readonly id: string;
|
|
127
|
-
readonly kind: "typecheck" | "test" | "replay" | "proof" | "trace" | "review" | "note";
|
|
128
|
-
readonly status: "passed" | "failed" | "unknown";
|
|
129
|
-
readonly path?: string;
|
|
130
|
-
readonly summary?: string;
|
|
131
|
-
readonly metadata?: JsonObject;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export interface SemanticPatchBundle {
|
|
135
|
-
readonly kind: "frontier.lang.patch";
|
|
136
|
-
readonly version: 1;
|
|
137
|
-
readonly id: string;
|
|
138
|
-
readonly baseHash?: string;
|
|
139
|
-
readonly targetHash?: string;
|
|
140
|
-
readonly author?: string;
|
|
141
|
-
readonly risk?: "low" | "medium" | "high" | "unknown";
|
|
142
|
-
readonly operations: readonly SemanticPatchOperation[];
|
|
143
|
-
readonly evidence?: readonly EvidenceRecord[];
|
|
144
|
-
readonly metadata?: JsonObject;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export interface ReplayEvent {
|
|
148
|
-
readonly id: string;
|
|
149
|
-
readonly at?: string;
|
|
150
|
-
readonly actor?: string;
|
|
151
|
-
readonly patch: SemanticPatchBundle;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export type MergeStatus =
|
|
155
|
-
| "safe-by-disjoint-region"
|
|
156
|
-
| "safe-by-same-change"
|
|
157
|
-
| "safe-by-merge-law"
|
|
158
|
-
| "conflict-by-overlap"
|
|
159
|
-
| "conflict-by-effect-overlap"
|
|
160
|
-
| "unknown-by-dynamic-effect"
|
|
161
|
-
| "unknown-needs-review";
|
|
162
|
-
|
|
163
|
-
export interface MergeAdmission {
|
|
164
|
-
readonly status: MergeStatus;
|
|
165
|
-
readonly autoMergeable: boolean;
|
|
166
|
-
readonly reasons: readonly string[];
|
|
167
|
-
readonly overlappingNodeIds: readonly SemanticId[];
|
|
168
|
-
readonly overlappingRegions: readonly string[];
|
|
169
|
-
readonly overlappingEffects: readonly string[];
|
|
170
|
-
readonly evidence: readonly EvidenceRecord[];
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export interface EmitTypeScriptOptions {
|
|
174
|
-
readonly banner?: string;
|
|
175
|
-
readonly includeRuntimeTypes?: boolean;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export declare function moduleNode(input: Omit<ModuleNode, "kind">): ModuleNode;
|
|
179
|
-
export declare function entityNode(input: Omit<EntityNode, "kind">): EntityNode;
|
|
180
|
-
export declare function stateNode(input: Omit<StateNode, "kind">): StateNode;
|
|
181
|
-
export declare function actionNode(input: Omit<ActionNode, "kind">): ActionNode;
|
|
182
|
-
export declare function viewNode(input: Omit<ViewNode, "kind">): ViewNode;
|
|
183
|
-
export declare function migrationNode(input: Omit<MigrationNode, "kind">): MigrationNode;
|
|
184
|
-
export declare function effectNode(input: Omit<EffectNode, "kind">): EffectNode;
|
|
185
|
-
export declare function targetNode(input: Omit<TargetNode, "kind">): TargetNode;
|
|
186
|
-
export declare function createPatch(input: Omit<SemanticPatchBundle, "kind" | "version">): SemanticPatchBundle;
|
|
187
|
-
export declare function createDocument(input: {
|
|
188
|
-
readonly id: SemanticId;
|
|
189
|
-
readonly name: string;
|
|
190
|
-
readonly nodes: readonly SemanticNode[];
|
|
191
|
-
readonly rootIds?: readonly SemanticId[];
|
|
192
|
-
readonly history?: readonly ReplayEvent[];
|
|
193
|
-
readonly metadata?: JsonObject;
|
|
194
|
-
}): FrontierLangDocument;
|
|
195
|
-
export declare function stableStringify(value: unknown): string;
|
|
196
|
-
export declare function hashSemanticValue(value: unknown): string;
|
|
197
|
-
export declare function hashDocumentBase(document: FrontierLangDocument): string;
|
|
198
|
-
export declare function validateDocument(document: FrontierLangDocument): readonly string[];
|
|
199
|
-
export declare function applySemanticPatch(document: FrontierLangDocument, patch: SemanticPatchBundle, event?: ReplayEvent): FrontierLangDocument;
|
|
200
|
-
export declare function replayDocument(initial: FrontierLangDocument, events: readonly ReplayEvent[]): FrontierLangDocument;
|
|
201
|
-
export declare function classifyMerge(base: FrontierLangDocument, left: SemanticPatchBundle, right: SemanticPatchBundle): MergeAdmission;
|
|
202
|
-
export declare function emitTypeScript(document: FrontierLangDocument, options?: EmitTypeScriptOptions): string;
|
|
1
|
+
export * from "@shapeshift-labs/frontier-lang-kernel";
|
|
2
|
+
export * from "@shapeshift-labs/frontier-lang-parser";
|
|
3
|
+
export * from "@shapeshift-labs/frontier-lang-checker";
|
|
4
|
+
export * from "@shapeshift-labs/frontier-lang-typescript";
|
|
5
|
+
export * from "@shapeshift-labs/frontier-lang-javascript";
|
|
6
|
+
export * from "@shapeshift-labs/frontier-lang-rust";
|
|
7
|
+
export * from "@shapeshift-labs/frontier-lang-python";
|
|
8
|
+
export * from "@shapeshift-labs/frontier-lang-c";
|
|
9
|
+
export * from "@shapeshift-labs/frontier-lang-compiler";
|