@hyperscale0/udl 2.6.0 → 3.0.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/CHANGELOG.md +2 -322
- package/LICENSING.md +1 -2
- package/README.md +3 -114
- package/TRADEMARKS.md +2 -2
- package/dist/diagnostics.d.ts +21 -201
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +29 -193
- package/dist/diagnostics.js.map +1 -1
- package/dist/evolution.d.ts +3 -132
- package/dist/evolution.d.ts.map +1 -1
- package/dist/evolution.js +29 -633
- package/dist/evolution.js.map +1 -1
- package/dist/finance.d.ts +5 -72
- package/dist/finance.d.ts.map +1 -1
- package/dist/finance.js +233 -737
- package/dist/finance.js.map +1 -1
- package/dist/index.d.ts +7 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -12
- package/dist/index.js.map +1 -1
- package/dist/instrument-references.d.ts.map +1 -1
- package/dist/instrument-references.js +3 -2
- package/dist/instrument-references.js.map +1 -1
- package/dist/schema.d.ts +2079 -4564
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +270 -1609
- package/dist/schema.js.map +1 -1
- package/dist/validation.d.ts +8 -104
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +653 -3271
- package/dist/validation.js.map +1 -1
- package/docs/README.md +147 -14
- package/package.json +7 -11
- package/spec/README.md +151 -164
- package/spec/darb.udl.json +249 -0
- package/spec/udl.schema.json +4104 -3202
- package/src/diagnostics.ts +51 -246
- package/src/evolution.ts +39 -1045
- package/src/finance.ts +287 -1127
- package/src/index.ts +18 -142
- package/src/instrument-references.ts +3 -2
- package/src/schema.ts +285 -1843
- package/src/validation.ts +870 -5611
- package/conformance/README.md +0 -82
- package/conformance/evolution/action-contract.expected.json +0 -10
- package/conformance/evolution/action-contract.live.udl +0 -44
- package/conformance/evolution/action-contract.next.udl +0 -45
- package/conformance/evolution/product-identity.expected.json +0 -10
- package/conformance/evolution/product-identity.live.udl +0 -55
- package/conformance/evolution/product-identity.next.udl +0 -55
- package/conformance/evolution/version-required.expected.json +0 -10
- package/conformance/evolution/version-required.live.udl +0 -55
- package/conformance/evolution/version-required.next.udl +0 -58
- package/conformance/invalid/action-without-transition.expected.json +0 -10
- package/conformance/invalid/action-without-transition.udl +0 -60
- package/conformance/invalid/agent-description-too-long.expected.json +0 -10
- package/conformance/invalid/agent-description-too-long.udl +0 -57
- package/conformance/invalid/blank-title.expected.json +0 -10
- package/conformance/invalid/blank-title.udl +0 -54
- package/conformance/invalid/call-binds-results.expected.json +0 -10
- package/conformance/invalid/call-binds-results.udl +0 -314
- package/conformance/invalid/call-unknown-action.expected.json +0 -10
- package/conformance/invalid/call-unknown-action.udl +0 -314
- package/conformance/invalid/composition-dial-duplicate-key.expected.json +0 -10
- package/conformance/invalid/composition-dial-duplicate-key.udl +0 -73
- package/conformance/invalid/depth-budget.expected.json +0 -10
- package/conformance/invalid/depth-budget.udl +0 -49
- package/conformance/invalid/duplicate-subject.expected.json +0 -10
- package/conformance/invalid/duplicate-subject.udl +0 -230
- package/conformance/invalid/forged-effects.expected.json +0 -10
- package/conformance/invalid/forged-effects.udl +0 -76
- package/conformance/invalid/format-version.expected.json +0 -10
- package/conformance/invalid/format-version.udl +0 -54
- package/conformance/invalid/instrument-id-not-snake-case.expected.json +0 -10
- package/conformance/invalid/instrument-id-not-snake-case.udl +0 -54
- package/conformance/invalid/invalid-aggregate-gate-shape.expected.json +0 -10
- package/conformance/invalid/invalid-aggregate-gate-shape.udl +0 -1819
- package/conformance/invalid/invalid-check-duration.expected.json +0 -10
- package/conformance/invalid/invalid-check-duration.udl +0 -219
- package/conformance/invalid/invalid-dial-anchor.expected.json +0 -10
- package/conformance/invalid/invalid-dial-anchor.udl +0 -219
- package/conformance/invalid/invalid-exception-parent-ref.expected.json +0 -10
- package/conformance/invalid/invalid-exception-parent-ref.udl +0 -2487
- package/conformance/invalid/invalid-exposure-shape.expected.json +0 -10
- package/conformance/invalid/invalid-exposure-shape.udl +0 -1819
- package/conformance/invalid/invalid-journeys.expected.json +0 -10
- package/conformance/invalid/invalid-journeys.udl +0 -77
- package/conformance/invalid/invalid-remainder.expected.json +0 -10
- package/conformance/invalid/invalid-remainder.udl +0 -220
- package/conformance/invalid/invalid-schema-keyword.expected.json +0 -10
- package/conformance/invalid/invalid-schema-keyword.udl +0 -220
- package/conformance/invalid/invalid-utf8.expected.json +0 -10
- package/conformance/invalid/invalid-utf8.udl +0 -1
- package/conformance/invalid/leaf-effect-mismatch.expected.json +0 -10
- package/conformance/invalid/leaf-effect-mismatch.udl +0 -314
- package/conformance/invalid/malformed-json.expected.json +0 -10
- package/conformance/invalid/malformed-json.udl +0 -1
- package/conformance/invalid/missing-create-action.expected.json +0 -10
- package/conformance/invalid/missing-create-action.udl +0 -48
- package/conformance/invalid/missing-exception-amount-field.expected.json +0 -10
- package/conformance/invalid/missing-exception-amount-field.udl +0 -2487
- package/conformance/invalid/missing-exception-contract.expected.json +0 -14
- package/conformance/invalid/missing-exception-contract.udl +0 -2523
- package/conformance/invalid/missing-exception-reason-field.expected.json +0 -10
- package/conformance/invalid/missing-exception-reason-field.udl +0 -2487
- package/conformance/invalid/not-an-object.expected.json +0 -10
- package/conformance/invalid/not-an-object.udl +0 -1
- package/conformance/invalid/payout-reconcile-not-a-bank-debit.expected.json +0 -10
- package/conformance/invalid/payout-reconcile-not-a-bank-debit.udl +0 -259
- package/conformance/invalid/piece-plan-without-partition.expected.json +0 -10
- package/conformance/invalid/piece-plan-without-partition.udl +0 -305
- package/conformance/invalid/private-action-independent-approval.expected.json +0 -10
- package/conformance/invalid/private-action-independent-approval.udl +0 -314
- package/conformance/invalid/quote-freeze-set-incomplete.expected.json +0 -10
- package/conformance/invalid/quote-freeze-set-incomplete.udl +0 -261
- package/conformance/invalid/quote-named-reference-gate.expected.json +0 -10
- package/conformance/invalid/quote-named-reference-gate.udl +0 -50
- package/conformance/invalid/reconcile-named-reference-gate.expected.json +0 -10
- package/conformance/invalid/reconcile-named-reference-gate.udl +0 -50
- package/conformance/invalid/unfund-order-not-reversed.expected.json +0 -10
- package/conformance/invalid/unfund-order-not-reversed.udl +0 -314
- package/conformance/invalid/unknown-key.expected.json +0 -10
- package/conformance/invalid/unknown-key.udl +0 -55
- package/conformance/invalid/unknown-reference-gate-field.expected.json +0 -10
- package/conformance/invalid/unknown-reference-gate-field.udl +0 -1819
- package/conformance/invalid/unknown-required-field.expected.json +0 -10
- package/conformance/invalid/unknown-required-field.udl +0 -220
- package/conformance/invalid/unreachable-state.expected.json +0 -10
- package/conformance/invalid/unreachable-state.udl +0 -55
- package/conformance/invalid/wrong-exception-amount-field.expected.json +0 -10
- package/conformance/invalid/wrong-exception-amount-field.udl +0 -2487
- package/conformance/invalid/wrong-exception-reason-field.expected.json +0 -10
- package/conformance/invalid/wrong-exception-reason-field.udl +0 -2487
- package/conformance/valid/agent-description.expected.json +0 -6
- package/conformance/valid/agent-description.udl +0 -66
- package/conformance/valid/attested.expected.json +0 -6
- package/conformance/valid/attested.udl +0 -251
- package/conformance/valid/cards.expected.json +0 -6
- package/conformance/valid/cards.udl +0 -1579
- package/conformance/valid/commerce-escrow.expected.json +0 -6
- package/conformance/valid/commerce-escrow.udl +0 -1512
- package/conformance/valid/compiled-crowdfunding.expected.json +0 -6
- package/conformance/valid/compiled-crowdfunding.udl +0 -1843
- package/conformance/valid/compiled-watch-club.expected.json +0 -6
- package/conformance/valid/compiled-watch-club.udl +0 -2486
- package/conformance/valid/complete-contract.expected.json +0 -6
- package/conformance/valid/complete-contract.udl +0 -218
- package/conformance/valid/effect-signatures.expected.json +0 -6
- package/conformance/valid/effect-signatures.udl +0 -75
- package/conformance/valid/hand-edited.expected.json +0 -6
- package/conformance/valid/hand-edited.udl +0 -1
- package/conformance/valid/insured-car-marketplace.expected.json +0 -6
- package/conformance/valid/insured-car-marketplace.udl +0 -1050
- package/conformance/valid/insured-travel.expected.json +0 -6
- package/conformance/valid/insured-travel.udl +0 -3469
- package/conformance/valid/minimal.expected.json +0 -6
- package/conformance/valid/minimal.udl +0 -62
- package/conformance/valid/piece-plan-calls.expected.json +0 -6
- package/conformance/valid/piece-plan-calls.udl +0 -314
- package/conformance/valid/protection.expected.json +0 -6
- package/conformance/valid/protection.udl +0 -1551
- package/conformance/valid/string-escaping.expected.json +0 -6
- package/conformance/valid/string-escaping.udl +0 -54
- package/conformance/valid/vocabulary.expected.json +0 -6
- package/conformance/valid/vocabulary.udl +0 -2012
- package/dist/allocation.d.ts +0 -60
- package/dist/allocation.d.ts.map +0 -1
- package/dist/allocation.js +0 -177
- package/dist/allocation.js.map +0 -1
- package/dist/check-profiles.d.ts +0 -57
- package/dist/check-profiles.d.ts.map +0 -1
- package/dist/check-profiles.js +0 -62
- package/dist/check-profiles.js.map +0 -1
- package/dist/distribution.d.ts +0 -15
- package/dist/distribution.d.ts.map +0 -1
- package/dist/distribution.js +0 -49
- package/dist/distribution.js.map +0 -1
- package/dist/effects.d.ts +0 -58
- package/dist/effects.d.ts.map +0 -1
- package/dist/effects.js +0 -1126
- package/dist/effects.js.map +0 -1
- package/dist/reference.d.ts +0 -3
- package/dist/reference.d.ts.map +0 -1
- package/dist/reference.js +0 -28
- package/dist/reference.js.map +0 -1
- package/dist/vocabulary.d.ts +0 -23
- package/dist/vocabulary.d.ts.map +0 -1
- package/dist/vocabulary.js +0 -1052
- package/dist/vocabulary.js.map +0 -1
- package/docs/funding-custody.md +0 -165
- package/docs/guide/01-a-document.md +0 -37
- package/docs/guide/02-money-steps.md +0 -23
- package/docs/guide/03-laws.md +0 -18
- package/docs/guide/04-fees-and-remainder.md +0 -36
- package/docs/guide/05-checks-updates-dials.md +0 -7
- package/docs/guide/06-effects.md +0 -11
- package/docs/guide/07-evolution.md +0 -11
- package/docs/guide/08-implementing.md +0 -13
- package/docs/guide/09-schedules-and-allocation.md +0 -132
- package/docs/llms-full.txt +0 -2008
- package/docs/llms.txt +0 -14
- package/docs/piece-plans.md +0 -148
- package/docs/reference/canonical.md +0 -16
- package/docs/reference/clauses.md +0 -1585
- package/docs/reference/cli.md +0 -24
- package/docs/reference/diagnostics.md +0 -38
- package/skills/udl/SKILL.md +0 -28
- package/src/allocation.ts +0 -259
- package/src/check-profiles.ts +0 -80
- package/src/distribution.ts +0 -61
- package/src/effects.ts +0 -1920
- package/src/reference.ts +0 -31
- package/src/vocabulary.ts +0 -1635
package/src/diagnostics.ts
CHANGED
|
@@ -1,257 +1,62 @@
|
|
|
1
|
-
export type
|
|
2
|
-
| "
|
|
3
|
-
| "
|
|
4
|
-
| "
|
|
5
|
-
| "
|
|
6
|
-
| "
|
|
7
|
-
| "
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
| "
|
|
11
|
-
| "
|
|
12
|
-
| "
|
|
13
|
-
| "
|
|
14
|
-
| "gates"
|
|
15
|
-
| "lifecycle"
|
|
16
|
-
| "schema";
|
|
17
|
-
|
|
18
|
-
const diagnosticDefinitions = {
|
|
19
|
-
UDL1001: {
|
|
20
|
-
category: "invalid_utf8",
|
|
21
|
-
family: "admission",
|
|
22
|
-
title: "Invalid UTF-8",
|
|
23
|
-
fix: "Encode the document as valid UTF-8.",
|
|
24
|
-
},
|
|
25
|
-
UDL1002: {
|
|
26
|
-
category: "invalid_json",
|
|
27
|
-
family: "admission",
|
|
28
|
-
title: "Invalid JSON",
|
|
29
|
-
fix: "Repair the JSON syntax before validation.",
|
|
30
|
-
},
|
|
31
|
-
UDL1003: {
|
|
32
|
-
category: "invalid_shape",
|
|
33
|
-
family: "admission",
|
|
34
|
-
title: "Invalid document shape",
|
|
35
|
-
fix: "Match the published UDL JSON Schema.",
|
|
36
|
-
},
|
|
37
|
-
UDL1004: {
|
|
38
|
-
category: "resource_limit",
|
|
39
|
-
family: "admission",
|
|
40
|
-
title: "Resource limit exceeded",
|
|
41
|
-
fix: "Reduce the source size, nesting, values, strings, references, or financial paths named by the message.",
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
UDL2001: {
|
|
45
|
-
category: "invalid_semantics",
|
|
46
|
-
family: "document",
|
|
47
|
-
title: "Duplicate declaration",
|
|
48
|
-
fix: "Give each declaration a unique name.",
|
|
49
|
-
},
|
|
50
|
-
UDL2002: {
|
|
51
|
-
category: "invalid_semantics",
|
|
52
|
-
family: "document",
|
|
53
|
-
title: "Document law violation",
|
|
54
|
-
fix: "Repair the declaration, subject contract, or derived effects named by the message.",
|
|
55
|
-
},
|
|
56
|
-
UDL2005: {
|
|
57
|
-
category: "invalid_semantics",
|
|
58
|
-
family: "document",
|
|
59
|
-
title: "Derived effects mismatch",
|
|
60
|
-
fix: "Regenerate the action effects from its clauses.",
|
|
61
|
-
},
|
|
62
|
-
UDL2010: {
|
|
63
|
-
category: "invalid_semantics",
|
|
64
|
-
family: "document",
|
|
65
|
-
title: "Action graph violation",
|
|
66
|
-
fix: "Order all actions and calls without cycles or collisions, within depth and count limits.",
|
|
67
|
-
},
|
|
68
|
-
UDL2011: {
|
|
69
|
-
category: "invalid_semantics",
|
|
70
|
-
family: "document",
|
|
71
|
-
title: "Action binding violation",
|
|
72
|
-
fix: "Bind parameters to declared instance, piece, or caller variables without forward references or duplicate captures.",
|
|
73
|
-
},
|
|
74
|
-
UDL2012: {
|
|
75
|
-
category: "invalid_semantics",
|
|
76
|
-
family: "document",
|
|
77
|
-
title: "Action authority violation",
|
|
78
|
-
fix: "Match principal, approval, and recovery policies and keep field paths within tenant boundary.",
|
|
79
|
-
},
|
|
80
|
-
UDL2013: {
|
|
81
|
-
category: "invalid_semantics",
|
|
82
|
-
family: "document",
|
|
83
|
-
title: "Action effect or evidence violation",
|
|
84
|
-
fix: "Provide valid effect kind, matching effect signature, and non-empty evidence for every leaf.",
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
UDL3001: {
|
|
88
|
-
category: "invalid_semantics",
|
|
89
|
-
family: "lifecycle",
|
|
90
|
-
title: "Lifecycle is not closed",
|
|
91
|
-
fix: "Declare every state and action transition, and make every state reachable.",
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
UDL4001: {
|
|
95
|
-
category: "invalid_semantics",
|
|
96
|
-
family: "finance",
|
|
97
|
-
title: "Money graph violation",
|
|
98
|
-
fix: "Balance every funded amount and close every hold on each lifecycle path.",
|
|
99
|
-
},
|
|
100
|
-
UDL4002: {
|
|
101
|
-
category: "invalid_semantics",
|
|
102
|
-
family: "finance",
|
|
103
|
-
title: "Piece partition violation",
|
|
104
|
-
fix: "Match piece plan total, amounts, and payees to required immutable fields and declared partition.",
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
UDL5001: {
|
|
108
|
-
category: "invalid_semantics",
|
|
109
|
-
family: "gates",
|
|
110
|
-
title: "Reference gate violation",
|
|
111
|
-
fix: "Point the gate at a declared instrument, action, state, field, and reference.",
|
|
112
|
-
},
|
|
113
|
-
UDL5002: {
|
|
114
|
-
category: "invalid_semantics",
|
|
115
|
-
family: "gates",
|
|
116
|
-
title: "Check requirement violation",
|
|
117
|
-
fix: "Use a declared check with compatible evidence and recurrence.",
|
|
118
|
-
},
|
|
119
|
-
UDL5003: {
|
|
120
|
-
category: "invalid_semantics",
|
|
121
|
-
family: "gates",
|
|
122
|
-
title: "Exposure gate violation",
|
|
123
|
-
fix: "Use declared account and money fields for the exposure gate.",
|
|
124
|
-
},
|
|
125
|
-
UDL5004: {
|
|
126
|
-
category: "invalid_semantics",
|
|
127
|
-
family: "gates",
|
|
128
|
-
title: "Aggregate law violation",
|
|
129
|
-
fix: "Point the aggregate at compatible parent and child fields.",
|
|
130
|
-
},
|
|
131
|
-
UDL5005: {
|
|
132
|
-
category: "invalid_semantics",
|
|
133
|
-
family: "gates",
|
|
134
|
-
title: "Settlement or payout violation",
|
|
135
|
-
fix: "Use a declared settlement account and a compatible payout statement line.",
|
|
136
|
-
},
|
|
137
|
-
UDL5006: {
|
|
138
|
-
category: "invalid_semantics",
|
|
139
|
-
family: "gates",
|
|
140
|
-
title: "Quote and commit violation",
|
|
141
|
-
fix: "Declare one complete quote freeze set and one matching commit action.",
|
|
142
|
-
},
|
|
143
|
-
UDL5007: {
|
|
144
|
-
category: "invalid_semantics",
|
|
145
|
-
family: "gates",
|
|
146
|
-
title: "Reconcile exception child violation",
|
|
147
|
-
fix: "Name a declared child whose reference points back to this instrument.",
|
|
148
|
-
},
|
|
149
|
-
UDL5008: {
|
|
150
|
-
category: "invalid_semantics",
|
|
151
|
-
family: "gates",
|
|
152
|
-
title: "Action clause violation",
|
|
153
|
-
fix: "Repair the clause fields and keep incompatible clauses separate.",
|
|
154
|
-
},
|
|
155
|
-
UDL5009: {
|
|
156
|
-
category: "invalid_semantics",
|
|
157
|
-
family: "gates",
|
|
158
|
-
title: "Reconcile exception amount field is missing or optional",
|
|
159
|
-
fix: "Name the exception child's required money field in amountField.",
|
|
160
|
-
},
|
|
161
|
-
UDL5010: {
|
|
162
|
-
category: "invalid_semantics",
|
|
163
|
-
family: "gates",
|
|
164
|
-
title: "Reconcile exception amount field has the wrong type",
|
|
165
|
-
fix: "Point amountField at a money field declared by the exception child.",
|
|
166
|
-
},
|
|
167
|
-
UDL5011: {
|
|
168
|
-
category: "invalid_semantics",
|
|
169
|
-
family: "gates",
|
|
170
|
-
title: "Reconcile exception reason field is missing or optional",
|
|
171
|
-
fix: "Name the exception child's required text field in reasonField.",
|
|
172
|
-
},
|
|
173
|
-
UDL5012: {
|
|
174
|
-
category: "invalid_semantics",
|
|
175
|
-
family: "gates",
|
|
176
|
-
title: "Reconcile exception reason field has the wrong type",
|
|
177
|
-
fix: "Point reasonField at a required plain text field declared by the exception child.",
|
|
178
|
-
},
|
|
179
|
-
UDL5013: {
|
|
180
|
-
category: "invalid_semantics",
|
|
181
|
-
family: "gates",
|
|
182
|
-
title: "Piece stage violation",
|
|
183
|
-
fix: "Reference a declared piece plan and stage in the containing instrument.",
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
UDL6001: {
|
|
187
|
-
category: "invalid_semantics",
|
|
188
|
-
family: "schema",
|
|
189
|
-
title: "Unsupported JSON Schema",
|
|
190
|
-
fix: "Use only the sealed UDL JSON Schema subset.",
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
UDL7001: {
|
|
194
|
-
category: "invalid_evolution",
|
|
195
|
-
family: "evolution",
|
|
196
|
-
title: "Stored contract changed",
|
|
197
|
-
fix: "Keep stored identities and contracts unchanged, and add only allowed optional declarations.",
|
|
198
|
-
},
|
|
199
|
-
UDL7002: {
|
|
200
|
-
category: "invalid_evolution",
|
|
201
|
-
family: "evolution",
|
|
202
|
-
title: "Version was not increased",
|
|
203
|
-
fix: "Increase the product version for every semantic change.",
|
|
204
|
-
},
|
|
205
|
-
} as const satisfies Record<
|
|
206
|
-
string,
|
|
207
|
-
{
|
|
208
|
-
readonly category: UdlIssueCategory;
|
|
209
|
-
readonly family: UdlDiagnosticFamily;
|
|
210
|
-
readonly fix: string;
|
|
211
|
-
readonly title: string;
|
|
212
|
-
}
|
|
213
|
-
>;
|
|
214
|
-
|
|
215
|
-
export type UdlIssueCode = keyof typeof diagnosticDefinitions;
|
|
216
|
-
|
|
217
|
-
export interface UdlDiagnostic {
|
|
218
|
-
readonly category: UdlIssueCategory;
|
|
219
|
-
readonly code: UdlIssueCode;
|
|
220
|
-
readonly family: UdlDiagnosticFamily;
|
|
221
|
-
readonly fix: string;
|
|
222
|
-
readonly title: string;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export const udlDiagnostics: readonly UdlDiagnostic[] = Object.entries(
|
|
226
|
-
diagnosticDefinitions,
|
|
227
|
-
).map(([code, diagnostic]) => ({
|
|
228
|
-
code: code as UdlIssueCode,
|
|
229
|
-
...diagnostic,
|
|
230
|
-
}));
|
|
231
|
-
|
|
232
|
-
export function udlDiagnostic(code: string): UdlDiagnostic | undefined {
|
|
233
|
-
return udlDiagnostics.find((diagnostic) => diagnostic.code === code);
|
|
234
|
-
}
|
|
235
|
-
|
|
1
|
+
export type UdlIssueCode =
|
|
2
|
+
| "UDL1001"
|
|
3
|
+
| "UDL1002"
|
|
4
|
+
| "UDL1003"
|
|
5
|
+
| "UDL1004"
|
|
6
|
+
| "UDL2001"
|
|
7
|
+
| "UDL2002"
|
|
8
|
+
| "UDL2010"
|
|
9
|
+
| "UDL3001"
|
|
10
|
+
| "UDL4001"
|
|
11
|
+
| "UDL5001"
|
|
12
|
+
| "UDL7001"
|
|
13
|
+
| "UDL7002";
|
|
236
14
|
export interface UdlIssue {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
15
|
+
code: UdlIssueCode;
|
|
16
|
+
path: string;
|
|
17
|
+
message: string;
|
|
18
|
+
fix: string;
|
|
19
|
+
category: string;
|
|
242
20
|
}
|
|
243
|
-
|
|
21
|
+
const fixes: Record<UdlIssueCode, string> = {
|
|
22
|
+
UDL1001: "Encode the source as UTF-8.",
|
|
23
|
+
UDL1002: "Repair JSON syntax.",
|
|
24
|
+
UDL1003: "Use the UDL 3 typed grammar.",
|
|
25
|
+
UDL1004: "Reduce the declared structure or expansion.",
|
|
26
|
+
UDL2001: "Give each declaration a distinct name.",
|
|
27
|
+
UDL2002: "Repair the named type or declaration.",
|
|
28
|
+
UDL2010: "Remove the invocation cycle or reduce its expansion.",
|
|
29
|
+
UDL3001: "Declare reachable states and one transition per action.",
|
|
30
|
+
UDL4001:
|
|
31
|
+
"Fund owned accounts before spending and close them with zero balances.",
|
|
32
|
+
UDL5001: "Use a declared reference of the required type.",
|
|
33
|
+
UDL7001: "Preserve existing instance meaning or recreate the estate.",
|
|
34
|
+
UDL7002: "Increase the contract version.",
|
|
35
|
+
};
|
|
244
36
|
export function issue(
|
|
245
37
|
code: UdlIssueCode,
|
|
246
38
|
path: string,
|
|
247
|
-
|
|
39
|
+
message: string,
|
|
248
40
|
): UdlIssue {
|
|
249
|
-
const diagnostic = diagnosticDefinitions[code];
|
|
250
41
|
return {
|
|
251
|
-
category: diagnostic.category,
|
|
252
42
|
code,
|
|
253
|
-
fix: diagnostic.fix,
|
|
254
|
-
message: messageDetail ?? diagnostic.title,
|
|
255
43
|
path,
|
|
44
|
+
message,
|
|
45
|
+
fix: fixes[code],
|
|
46
|
+
category:
|
|
47
|
+
code === "UDL1003"
|
|
48
|
+
? "invalid_shape"
|
|
49
|
+
: code === "UDL1004"
|
|
50
|
+
? "resource_limit"
|
|
51
|
+
: "invalid_semantics",
|
|
256
52
|
};
|
|
257
53
|
}
|
|
54
|
+
export const udlDiagnostics = Object.entries(fixes).map(([code, fix]) => ({
|
|
55
|
+
code,
|
|
56
|
+
fix,
|
|
57
|
+
title: fix,
|
|
58
|
+
category: "invalid_semantics",
|
|
59
|
+
family: "document",
|
|
60
|
+
}));
|
|
61
|
+
export const udlDiagnostic = (code: string) =>
|
|
62
|
+
udlDiagnostics.find((d) => d.code === code);
|