@hyperscale0/udl 1.0.0-beta.1 → 1.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 +78 -25
- package/README.md +37 -99
- package/conformance/README.md +44 -41
- package/conformance/evolution/action-contract.expected.json +10 -0
- package/conformance/evolution/action-contract.live.udl +44 -0
- package/conformance/evolution/action-contract.next.udl +45 -0
- package/conformance/evolution/product-identity.expected.json +10 -0
- package/conformance/evolution/product-identity.live.udl +55 -0
- package/conformance/evolution/product-identity.next.udl +55 -0
- package/conformance/evolution/version-required.expected.json +10 -0
- package/conformance/evolution/version-required.live.udl +55 -0
- package/conformance/evolution/version-required.next.udl +58 -0
- package/conformance/invalid/action-without-transition.expected.json +10 -0
- package/conformance/invalid/{verb-without-transition.udl → action-without-transition.udl} +7 -2
- package/conformance/invalid/agent-description-too-long.expected.json +10 -0
- package/conformance/invalid/agent-description-too-long.udl +57 -0
- package/conformance/invalid/blank-title.expected.json +1 -1
- package/conformance/invalid/blank-title.udl +6 -2
- package/conformance/invalid/composition-dial-duplicate-key.expected.json +10 -0
- package/conformance/invalid/composition-dial-duplicate-key.udl +73 -0
- package/conformance/invalid/depth-budget.expected.json +1 -1
- package/conformance/invalid/duplicate-subject.expected.json +10 -0
- package/conformance/invalid/duplicate-subject.udl +230 -0
- package/conformance/invalid/forged-effects.expected.json +10 -0
- package/conformance/invalid/forged-effects.udl +76 -0
- package/conformance/invalid/format-version.expected.json +1 -1
- package/conformance/invalid/format-version.udl +6 -2
- package/conformance/invalid/instrument-id-not-snake-case.expected.json +10 -0
- package/conformance/invalid/{noun-id-not-snake-case.udl → instrument-id-not-snake-case.udl} +6 -2
- package/conformance/invalid/invalid-aggregate-gate-shape.expected.json +10 -0
- package/conformance/invalid/invalid-aggregate-gate-shape.udl +1819 -0
- package/conformance/invalid/invalid-check-duration.expected.json +10 -0
- package/conformance/invalid/invalid-check-duration.udl +219 -0
- package/conformance/invalid/invalid-dial-anchor.expected.json +10 -0
- package/conformance/invalid/invalid-dial-anchor.udl +219 -0
- package/conformance/invalid/invalid-exception-parent-ref.expected.json +10 -0
- package/conformance/invalid/invalid-exception-parent-ref.udl +2487 -0
- package/conformance/invalid/invalid-exposure-shape.expected.json +10 -0
- package/conformance/invalid/invalid-exposure-shape.udl +1819 -0
- package/conformance/invalid/invalid-remainder.expected.json +10 -0
- package/conformance/invalid/invalid-remainder.udl +220 -0
- package/conformance/invalid/invalid-schema-keyword.expected.json +10 -0
- package/conformance/invalid/invalid-schema-keyword.udl +220 -0
- package/conformance/invalid/invalid-utf8.expected.json +1 -1
- package/conformance/invalid/malformed-json.expected.json +1 -1
- package/conformance/invalid/missing-create-action.expected.json +10 -0
- package/conformance/invalid/{missing-create-verb.udl → missing-create-action.udl} +5 -2
- package/conformance/invalid/missing-exception-amount-field.expected.json +10 -0
- package/conformance/invalid/missing-exception-amount-field.udl +2487 -0
- package/conformance/invalid/missing-exception-contract.expected.json +14 -0
- package/conformance/invalid/missing-exception-contract.udl +2523 -0
- package/conformance/invalid/missing-exception-reason-field.expected.json +10 -0
- package/conformance/invalid/missing-exception-reason-field.udl +2487 -0
- package/conformance/invalid/not-an-object.expected.json +1 -1
- package/conformance/invalid/payout-reconcile-not-a-bank-debit.expected.json +10 -0
- package/conformance/invalid/payout-reconcile-not-a-bank-debit.udl +259 -0
- package/conformance/invalid/quote-freeze-set-incomplete.expected.json +10 -0
- package/conformance/invalid/quote-freeze-set-incomplete.udl +261 -0
- package/conformance/invalid/quote-named-reference-gate.expected.json +10 -0
- package/conformance/invalid/quote-named-reference-gate.udl +50 -0
- package/conformance/invalid/reconcile-named-reference-gate.expected.json +10 -0
- package/conformance/invalid/reconcile-named-reference-gate.udl +50 -0
- package/conformance/invalid/unknown-key.expected.json +1 -1
- package/conformance/invalid/unknown-key.udl +6 -2
- package/conformance/invalid/unknown-reference-gate-field.expected.json +10 -0
- package/conformance/invalid/unknown-reference-gate-field.udl +1819 -0
- package/conformance/invalid/unknown-required-field.expected.json +10 -0
- package/conformance/invalid/unknown-required-field.udl +220 -0
- package/conformance/invalid/unreachable-state.expected.json +2 -2
- package/conformance/invalid/unreachable-state.udl +6 -2
- package/conformance/invalid/wrong-exception-amount-field.expected.json +10 -0
- package/conformance/invalid/wrong-exception-amount-field.udl +2487 -0
- package/conformance/invalid/wrong-exception-reason-field.expected.json +10 -0
- package/conformance/invalid/wrong-exception-reason-field.udl +2487 -0
- package/conformance/valid/agent-description.expected.json +6 -0
- package/conformance/valid/agent-description.udl +66 -0
- package/conformance/valid/cards.expected.json +1 -0
- package/conformance/valid/cards.udl +843 -356
- package/conformance/valid/commerce-escrow.expected.json +1 -0
- package/conformance/valid/commerce-escrow.udl +792 -291
- package/conformance/valid/compiled-crowdfunding.expected.json +6 -0
- package/conformance/valid/compiled-crowdfunding.udl +1843 -0
- package/conformance/valid/compiled-watch-club.expected.json +6 -0
- package/conformance/valid/compiled-watch-club.udl +2486 -0
- package/conformance/valid/complete-contract.expected.json +6 -0
- package/conformance/valid/complete-contract.udl +218 -0
- package/conformance/valid/effect-signatures.expected.json +6 -0
- package/conformance/valid/effect-signatures.udl +75 -0
- package/conformance/valid/hand-edited.expected.json +1 -0
- package/conformance/valid/hand-edited.udl +1 -1
- package/conformance/valid/insured-car-marketplace.expected.json +1 -0
- package/conformance/valid/insured-car-marketplace.udl +534 -315
- package/conformance/valid/insured-travel.expected.json +2 -1
- package/conformance/valid/insured-travel.udl +1489 -641
- package/conformance/valid/minimal.expected.json +1 -0
- package/conformance/valid/minimal.udl +18 -14
- package/conformance/valid/protection.expected.json +1 -0
- package/conformance/valid/protection.udl +719 -304
- package/conformance/valid/string-escaping.expected.json +6 -0
- package/conformance/valid/string-escaping.udl +54 -0
- package/dist/canonical.d.ts +2 -0
- package/dist/canonical.d.ts.map +1 -1
- package/dist/canonical.js +7 -0
- package/dist/canonical.js.map +1 -1
- package/dist/check-profiles.d.ts +57 -0
- package/dist/check-profiles.d.ts.map +1 -0
- package/dist/check-profiles.js +62 -0
- package/dist/check-profiles.js.map +1 -0
- package/dist/cli.js +48 -4
- package/dist/cli.js.map +1 -1
- package/dist/diagnostics.d.ts +168 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +164 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/effects.d.ts +41 -0
- package/dist/effects.d.ts.map +1 -0
- package/dist/effects.js +110 -0
- package/dist/effects.js.map +1 -0
- package/dist/evolution.d.ts +51 -18
- package/dist/evolution.d.ts.map +1 -1
- package/dist/evolution.js +244 -102
- package/dist/evolution.js.map +1 -1
- package/dist/finance.d.ts +17 -13
- package/dist/finance.d.ts.map +1 -1
- package/dist/finance.js +165 -109
- package/dist/finance.js.map +1 -1
- package/dist/index.d.ts +12 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +2 -2
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +4 -3
- package/dist/limits.js.map +1 -1
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +6 -16
- package/dist/parser.js.map +1 -1
- package/dist/schema.d.ts +2059 -135
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +759 -73
- package/dist/schema.js.map +1 -1
- package/dist/validation.d.ts +22 -9
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +1463 -457
- package/dist/validation.js.map +1 -1
- package/docs/README.md +14 -0
- package/docs/guide/01-a-document.md +37 -0
- package/docs/guide/02-money-steps.md +23 -0
- package/docs/guide/03-laws.md +18 -0
- package/docs/guide/04-fees-and-remainder.md +15 -0
- package/docs/guide/05-checks-updates-dials.md +7 -0
- package/docs/guide/06-effects.md +11 -0
- package/docs/guide/07-evolution.md +11 -0
- package/docs/guide/08-implementing.md +13 -0
- package/docs/llms-full.txt +1241 -0
- package/docs/llms.txt +14 -0
- package/docs/reference/canonical.md +16 -0
- package/docs/reference/clauses.md +986 -0
- package/docs/reference/cli.md +22 -0
- package/docs/reference/diagnostics.md +32 -0
- package/package.json +6 -2
- package/skills/udl/SKILL.md +28 -0
- package/spec/README.md +82 -51
- package/spec/udl.schema.json +1191 -119
- package/src/canonical.ts +11 -0
- package/src/check-profiles.ts +80 -0
- package/src/cli.ts +49 -3
- package/src/diagnostics.ts +221 -0
- package/src/effects.ts +163 -0
- package/src/evolution.ts +375 -125
- package/src/finance.ts +255 -160
- package/src/index.ts +50 -14
- package/src/limits.ts +4 -3
- package/src/parser.ts +15 -18
- package/src/schema.ts +855 -81
- package/src/validation.ts +2666 -560
- package/conformance/invalid/missing-create-verb.expected.json +0 -10
- package/conformance/invalid/noun-id-not-snake-case.expected.json +0 -10
- package/conformance/invalid/verb-without-transition.expected.json +0 -10
package/src/index.ts
CHANGED
|
@@ -1,54 +1,92 @@
|
|
|
1
1
|
export { canonicalizeUdl, parseUdl } from "./parser.js";
|
|
2
|
-
export { serializeUdl } from "./canonical.js";
|
|
2
|
+
export { canonicalDigest, serializeUdl } from "./canonical.js";
|
|
3
|
+
export { issue, udlDiagnostic, udlDiagnostics } from "./diagnostics.js";
|
|
4
|
+
export type {
|
|
5
|
+
UdlDiagnostic,
|
|
6
|
+
UdlDiagnosticFamily,
|
|
7
|
+
UdlIssue,
|
|
8
|
+
UdlIssueCategory,
|
|
9
|
+
UdlIssueCode,
|
|
10
|
+
} from "./diagnostics.js";
|
|
11
|
+
export {
|
|
12
|
+
udlCheckEvidenceProfile,
|
|
13
|
+
udlCheckEvidenceProfiles,
|
|
14
|
+
type UdlCheckEvidenceProfile,
|
|
15
|
+
} from "./check-profiles.js";
|
|
3
16
|
export { fixedIsoDurationMs } from "./duration.js";
|
|
4
17
|
export {
|
|
5
|
-
|
|
18
|
+
deriveUdlActionEffects,
|
|
19
|
+
movementClass,
|
|
20
|
+
udlEffectKinds,
|
|
21
|
+
type DerivedUdlEffects,
|
|
22
|
+
type UdlEffectKind,
|
|
23
|
+
type UdlMovementClass,
|
|
24
|
+
} from "./effects.js";
|
|
25
|
+
export {
|
|
26
|
+
analyzeInstrumentFinance,
|
|
6
27
|
type FinanceIssue,
|
|
7
28
|
type FinanceOptions,
|
|
8
29
|
} from "./finance.js";
|
|
9
30
|
export {
|
|
10
|
-
|
|
31
|
+
diffInstrumentEvolution,
|
|
11
32
|
diffValidatedUdlEvolution,
|
|
12
|
-
|
|
33
|
+
snapshotUdlInstrument,
|
|
13
34
|
} from "./evolution.js";
|
|
14
35
|
export type {
|
|
15
36
|
EvolutionFieldSnapshot,
|
|
16
37
|
EvolutionMoveSnapshot,
|
|
17
38
|
EvolutionStepSnapshot,
|
|
18
39
|
EvolutionTransitionSnapshot,
|
|
19
|
-
|
|
20
|
-
|
|
40
|
+
EvolutionActionSnapshot,
|
|
41
|
+
InstrumentEvolutionSnapshot,
|
|
21
42
|
} from "./evolution.js";
|
|
22
43
|
export {
|
|
44
|
+
quoteExpiresAtRefKey,
|
|
45
|
+
quoteFrozenRefKey,
|
|
46
|
+
quoteSeededRefKeys,
|
|
23
47
|
UDL_FORMAT_VERSION,
|
|
48
|
+
udlClauseVocabulary,
|
|
24
49
|
udlDocumentSchema,
|
|
50
|
+
udlInstrumentActionIdSchema,
|
|
25
51
|
udlKernelOperationSchema,
|
|
26
|
-
|
|
52
|
+
udlProviderFamilyIdSchema,
|
|
53
|
+
udlPublicActionSchema,
|
|
27
54
|
} from "./schema.js";
|
|
28
55
|
export type {
|
|
29
56
|
UdlAggregate,
|
|
30
57
|
UdlAggregateCondition,
|
|
31
58
|
UdlBinding,
|
|
59
|
+
UdlCompositionDial,
|
|
32
60
|
UdlDeclaredValuePolicy,
|
|
33
61
|
UdlDecision,
|
|
62
|
+
UdlDial,
|
|
34
63
|
UdlDocument,
|
|
35
64
|
UdlDue,
|
|
65
|
+
UdlEffects,
|
|
36
66
|
UdlExample,
|
|
37
67
|
UdlGate,
|
|
38
68
|
UdlKernelOperation,
|
|
39
69
|
UdlLifecycle,
|
|
40
70
|
UdlLifecycleTransition,
|
|
41
|
-
|
|
42
|
-
|
|
71
|
+
UdlInstrument,
|
|
72
|
+
UdlInstrumentSubject,
|
|
43
73
|
UdlPayout,
|
|
44
|
-
|
|
74
|
+
UdlQuote,
|
|
75
|
+
UdlProviderFamilyId,
|
|
76
|
+
UdlCheckRequirement,
|
|
77
|
+
UdlClauseCardinality,
|
|
78
|
+
UdlClauseEffect,
|
|
79
|
+
UdlReconcile,
|
|
80
|
+
UdlRemainder,
|
|
45
81
|
UdlStep,
|
|
46
82
|
UdlSubject,
|
|
47
|
-
|
|
48
|
-
|
|
83
|
+
UdlAction,
|
|
84
|
+
UdlClauseVocabularyEntry,
|
|
49
85
|
} from "./schema.js";
|
|
50
86
|
export {
|
|
51
87
|
assertValidUdl,
|
|
88
|
+
isReconcileExceptionChild,
|
|
89
|
+
reconcileExceptionChildProblems,
|
|
52
90
|
openReferenceShapeBudget,
|
|
53
91
|
UdlError,
|
|
54
92
|
validateUdl,
|
|
@@ -57,7 +95,5 @@ export {
|
|
|
57
95
|
} from "./validation.js";
|
|
58
96
|
export type {
|
|
59
97
|
ReferenceShapeBudget,
|
|
60
|
-
UdlIssue,
|
|
61
|
-
UdlIssueCode,
|
|
62
98
|
UdlValidationResult,
|
|
63
99
|
} from "./validation.js";
|
package/src/limits.ts
CHANGED
|
@@ -5,7 +5,7 @@ export const UDL_LIMITS = Object.freeze({
|
|
|
5
5
|
financeStates: 32,
|
|
6
6
|
financeTransitionEdges: 128,
|
|
7
7
|
financeTransitions: 64,
|
|
8
|
-
|
|
8
|
+
financeActions: 64,
|
|
9
9
|
financeWork: 4_096,
|
|
10
10
|
maxDepth: 24,
|
|
11
11
|
maxKeyLength: 128,
|
|
@@ -23,10 +23,11 @@ export const UDL_LIMITS = Object.freeze({
|
|
|
23
23
|
/**
|
|
24
24
|
* Reference-shape classifications one `ReferenceShapeBudget` may buy. Each
|
|
25
25
|
* one compiles a JSON Schema validator, and a document controls both factors
|
|
26
|
-
* of the
|
|
26
|
+
* of the instruments x gate-fields product that asks for them.
|
|
27
27
|
*/
|
|
28
28
|
maxSchemaProbes: 2_048,
|
|
29
|
-
|
|
29
|
+
// The complete 2026-09-01 platform catalog serializes to 402,126 bytes.
|
|
30
|
+
maxSourceBytes: 512 * 1_024,
|
|
30
31
|
maxStringLength: 2_048,
|
|
31
32
|
maxTotalStringLength: 256 * 1_024,
|
|
32
33
|
});
|
package/src/parser.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { serializeUdl } from "./canonical.js";
|
|
2
|
+
import { issue } from "./diagnostics.js";
|
|
2
3
|
import { UDL_LIMITS } from "./limits.js";
|
|
3
4
|
import type { UdlDocument } from "./schema.js";
|
|
4
|
-
import { assertValidUdl, UdlError
|
|
5
|
+
import { assertValidUdl, UdlError } from "./validation.js";
|
|
5
6
|
|
|
6
7
|
const utf8Decoder = new TextDecoder("utf-8", { fatal: true });
|
|
7
8
|
|
|
@@ -14,11 +15,11 @@ export function parseUdl(source: string | Uint8Array): UdlDocument {
|
|
|
14
15
|
: source.byteLength;
|
|
15
16
|
if (sourceBytes > UDL_LIMITS.maxSourceBytes) {
|
|
16
17
|
throw new UdlError([
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
issue(
|
|
19
|
+
"UDL1004",
|
|
20
|
+
"$",
|
|
21
|
+
`UDL source exceeds ${UDL_LIMITS.maxSourceBytes} bytes`,
|
|
22
|
+
),
|
|
22
23
|
]);
|
|
23
24
|
}
|
|
24
25
|
return parseUdlText(
|
|
@@ -32,12 +33,11 @@ function parseUdlText(source: string): UdlDocument {
|
|
|
32
33
|
value = JSON.parse(source) as unknown;
|
|
33
34
|
} catch (error) {
|
|
34
35
|
throw new UdlError([
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
36
|
+
issue(
|
|
37
|
+
"UDL1002",
|
|
38
|
+
"$",
|
|
39
|
+
error instanceof Error ? error.message : "could not parse JSON",
|
|
40
|
+
),
|
|
41
41
|
]);
|
|
42
42
|
}
|
|
43
43
|
return assertValidUdl(value);
|
|
@@ -51,11 +51,8 @@ function decodeUdlBytes(source: Uint8Array): string {
|
|
|
51
51
|
try {
|
|
52
52
|
return utf8Decoder.decode(source);
|
|
53
53
|
} catch {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
path: "$",
|
|
58
|
-
};
|
|
59
|
-
throw new UdlError([issue]);
|
|
54
|
+
throw new UdlError([
|
|
55
|
+
issue("UDL1001", "$", "UDL bytes must be valid UTF-8"),
|
|
56
|
+
]);
|
|
60
57
|
}
|
|
61
58
|
}
|