@hyperscale0/udl 1.0.0-rc.1 → 1.0.123
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 +5 -211
- package/LICENSE.md +356 -0
- package/NOTICE.md +8 -0
- package/README.md +14 -106
- package/dist/canonical.d.ts.map +1 -1
- package/dist/canonical.js +1 -29
- package/dist/canonical.js.map +1 -1
- package/dist/diagnostics.d.ts +13 -165
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +33 -157
- package/dist/diagnostics.js.map +1 -1
- package/dist/field-value.d.ts +5 -0
- package/dist/field-value.d.ts.map +1 -0
- package/dist/field-value.js +85 -0
- package/dist/field-value.js.map +1 -0
- package/dist/finance.d.ts +10 -53
- package/dist/finance.d.ts.map +1 -1
- package/dist/finance.js +252 -536
- package/dist/finance.js.map +1 -1
- package/dist/index.d.ts +9 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/json.d.ts +2 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +30 -0
- package/dist/json.js.map +1 -0
- package/dist/limits.d.ts +3 -28
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +5 -31
- package/dist/limits.js.map +1 -1
- package/dist/object-contract.d.ts +140 -0
- package/dist/object-contract.d.ts.map +1 -0
- package/dist/object-contract.js +314 -0
- package/dist/object-contract.js.map +1 -0
- package/dist/object-semantics-schema.d.ts +5710 -0
- package/dist/object-semantics-schema.d.ts.map +1 -0
- package/dist/object-semantics-schema.js +119 -0
- package/dist/object-semantics-schema.js.map +1 -0
- package/dist/object-semantics.d.ts +6 -0
- package/dist/object-semantics.d.ts.map +1 -0
- package/dist/object-semantics.js +279 -0
- package/dist/object-semantics.js.map +1 -0
- package/dist/object-structures.d.ts +4 -0
- package/dist/object-structures.d.ts.map +1 -0
- package/dist/object-structures.js +134 -0
- package/dist/object-structures.js.map +1 -0
- package/dist/reporting-validation.d.ts +8 -0
- package/dist/reporting-validation.d.ts.map +1 -0
- package/dist/reporting-validation.js +252 -0
- package/dist/reporting-validation.js.map +1 -0
- package/dist/reporting.d.ts +477 -0
- package/dist/reporting.d.ts.map +1 -0
- package/dist/reporting.js +169 -0
- package/dist/reporting.js.map +1 -0
- package/dist/schema.d.ts +5572 -2710
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +444 -1121
- package/dist/schema.js.map +1 -1
- package/dist/validation.d.ts +10 -73
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +1109 -2569
- package/dist/validation.js.map +1 -1
- package/docs/assets/brand/manifest.json +30 -0
- package/docs/assets/brand/udl-horizontal-white.svg +1 -0
- package/docs/assets/brand/udl-horizontal.svg +1 -0
- package/docs/assets/brand/udl-stacked-white.svg +1 -0
- package/docs/assets/brand/udl-stacked.svg +1 -0
- package/docs/assets/udl.svg +11 -0
- package/package.json +13 -22
- package/spec/README.md +300 -172
- package/spec/cars.udl.json +249 -0
- package/spec/udl.schema.json +3066 -2242
- package/src/canonical.ts +1 -35
- package/src/diagnostics.ts +76 -209
- package/src/field-value.ts +87 -0
- package/src/finance.ts +327 -832
- package/src/index.ts +18 -95
- package/src/json.ts +34 -0
- package/src/limits.ts +5 -31
- package/src/object-contract.ts +559 -0
- package/src/object-semantics-schema.ts +148 -0
- package/src/object-semantics.ts +378 -0
- package/src/object-structures.ts +255 -0
- package/src/reporting-validation.ts +383 -0
- package/src/reporting.ts +178 -0
- package/src/schema.ts +510 -1277
- package/src/validation.ts +1630 -4545
- package/LICENSE +0 -661
- package/LICENSING.md +0 -51
- package/TRADEMARKS.md +0 -35
- 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/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-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/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/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/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/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 -54
- 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/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/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -184
- package/dist/cli.js.map +0 -1
- package/dist/effects.d.ts +0 -41
- package/dist/effects.d.ts.map +0 -1
- package/dist/effects.js +0 -110
- package/dist/effects.js.map +0 -1
- package/dist/evolution.d.ts +0 -120
- package/dist/evolution.d.ts.map +0 -1
- package/dist/evolution.js +0 -567
- package/dist/evolution.js.map +0 -1
- package/dist/parser.d.ts +0 -4
- package/dist/parser.d.ts.map +0 -1
- package/dist/parser.js +0 -44
- package/dist/parser.js.map +0 -1
- package/docs/README.md +0 -14
- 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 -15
- 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/llms-full.txt +0 -1241
- package/docs/llms.txt +0 -14
- package/docs/reference/canonical.md +0 -16
- package/docs/reference/clauses.md +0 -986
- package/docs/reference/cli.md +0 -22
- package/docs/reference/diagnostics.md +0 -32
- package/skills/udl/SKILL.md +0 -28
- package/src/check-profiles.ts +0 -80
- package/src/cli.ts +0 -196
- package/src/effects.ts +0 -163
- package/src/evolution.ts +0 -965
- package/src/parser.ts +0 -58
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
{
|
|
2
|
+
"udl": 1,
|
|
3
|
+
"version": 1,
|
|
4
|
+
"product": "cars",
|
|
5
|
+
"title": "Cars",
|
|
6
|
+
"currency": "SAR",
|
|
7
|
+
"parties": {
|
|
8
|
+
"buyer": {
|
|
9
|
+
"kind": "person"
|
|
10
|
+
},
|
|
11
|
+
"seller": {
|
|
12
|
+
"kind": "business"
|
|
13
|
+
},
|
|
14
|
+
"marketplace": {
|
|
15
|
+
"kind": "business"
|
|
16
|
+
},
|
|
17
|
+
"tax": {
|
|
18
|
+
"kind": "business"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"objects": [],
|
|
22
|
+
"instruments": [
|
|
23
|
+
{
|
|
24
|
+
"id": "sale",
|
|
25
|
+
"title": "Sale",
|
|
26
|
+
"summary": "Capped seller fee and VAT on held purchase money",
|
|
27
|
+
"fields": [
|
|
28
|
+
{
|
|
29
|
+
"name": "price",
|
|
30
|
+
"type": "money",
|
|
31
|
+
"minimum": "1"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "held",
|
|
35
|
+
"type": "account",
|
|
36
|
+
"owner": "self",
|
|
37
|
+
"book": "cash"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "deliveredAt",
|
|
41
|
+
"type": "date"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "returnVerified",
|
|
45
|
+
"type": "boolean"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "uncappedFee",
|
|
49
|
+
"type": "money"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "sellerFee",
|
|
53
|
+
"type": "money"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "serviceTax",
|
|
57
|
+
"type": "money"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "sellerNet",
|
|
61
|
+
"type": "money"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"calculate": [
|
|
65
|
+
{
|
|
66
|
+
"target": "uncappedFee",
|
|
67
|
+
"op": "rate",
|
|
68
|
+
"base": {
|
|
69
|
+
"field": "self.price"
|
|
70
|
+
},
|
|
71
|
+
"bps": {
|
|
72
|
+
"literal": 100
|
|
73
|
+
},
|
|
74
|
+
"rounding": "floor"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"target": "sellerFee",
|
|
78
|
+
"op": "minimum",
|
|
79
|
+
"values": [
|
|
80
|
+
{
|
|
81
|
+
"field": "self.uncappedFee"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"literal": "75000"
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"target": "serviceTax",
|
|
90
|
+
"op": "rate",
|
|
91
|
+
"base": {
|
|
92
|
+
"field": "self.sellerFee"
|
|
93
|
+
},
|
|
94
|
+
"bps": {
|
|
95
|
+
"literal": 1500
|
|
96
|
+
},
|
|
97
|
+
"rounding": "floor"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"target": "sellerNet",
|
|
101
|
+
"op": "subtract",
|
|
102
|
+
"base": {
|
|
103
|
+
"field": "self.price"
|
|
104
|
+
},
|
|
105
|
+
"subtract": [
|
|
106
|
+
{
|
|
107
|
+
"field": "self.sellerFee"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"field": "self.serviceTax"
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"lifecycle": {
|
|
116
|
+
"states": ["created", "funded", "accepted", "released", "refunded"],
|
|
117
|
+
"initial": "created",
|
|
118
|
+
"transitions": {
|
|
119
|
+
"fund": {
|
|
120
|
+
"from": ["created"],
|
|
121
|
+
"to": "funded"
|
|
122
|
+
},
|
|
123
|
+
"accept": {
|
|
124
|
+
"from": ["funded"],
|
|
125
|
+
"to": "accepted"
|
|
126
|
+
},
|
|
127
|
+
"release": {
|
|
128
|
+
"from": ["accepted"],
|
|
129
|
+
"to": "released"
|
|
130
|
+
},
|
|
131
|
+
"refund": {
|
|
132
|
+
"from": ["funded", "accepted"],
|
|
133
|
+
"to": "refunded"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"actions": {
|
|
138
|
+
"create": {
|
|
139
|
+
"summary": "Open a sale hold",
|
|
140
|
+
"event": "sale.create",
|
|
141
|
+
"actor": "caller",
|
|
142
|
+
"input": [],
|
|
143
|
+
"requires": [],
|
|
144
|
+
"moves": []
|
|
145
|
+
},
|
|
146
|
+
"fund": {
|
|
147
|
+
"summary": "Fund the purchase",
|
|
148
|
+
"event": "sale.fund",
|
|
149
|
+
"actor": "caller",
|
|
150
|
+
"input": [],
|
|
151
|
+
"requires": [],
|
|
152
|
+
"moves": [
|
|
153
|
+
{
|
|
154
|
+
"key": "fund",
|
|
155
|
+
"operation": "internal_transfer.create",
|
|
156
|
+
"amount": {
|
|
157
|
+
"field": "self.price"
|
|
158
|
+
},
|
|
159
|
+
"from": "party.buyer",
|
|
160
|
+
"to": "self.held"
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"publicAction": "fundSale"
|
|
164
|
+
},
|
|
165
|
+
"accept": {
|
|
166
|
+
"summary": "Accept delivery",
|
|
167
|
+
"event": "sale.accept",
|
|
168
|
+
"actor": "caller",
|
|
169
|
+
"input": [],
|
|
170
|
+
"requires": [],
|
|
171
|
+
"moves": [],
|
|
172
|
+
"deadline": {
|
|
173
|
+
"at": "self.deliveredAt",
|
|
174
|
+
"offset": 172800000
|
|
175
|
+
},
|
|
176
|
+
"publicAction": "acceptSale"
|
|
177
|
+
},
|
|
178
|
+
"release": {
|
|
179
|
+
"summary": "Pay seller net, fee and VAT",
|
|
180
|
+
"event": "sale.release",
|
|
181
|
+
"actor": "caller",
|
|
182
|
+
"input": [],
|
|
183
|
+
"requires": [],
|
|
184
|
+
"moves": [
|
|
185
|
+
{
|
|
186
|
+
"key": "seller",
|
|
187
|
+
"operation": "internal_transfer.create",
|
|
188
|
+
"amount": {
|
|
189
|
+
"field": "self.sellerNet"
|
|
190
|
+
},
|
|
191
|
+
"from": "self.held",
|
|
192
|
+
"to": "party.seller"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"key": "fee",
|
|
196
|
+
"operation": "internal_transfer.create",
|
|
197
|
+
"amount": {
|
|
198
|
+
"field": "self.sellerFee"
|
|
199
|
+
},
|
|
200
|
+
"from": "self.held",
|
|
201
|
+
"to": "party.marketplace"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"key": "tax",
|
|
205
|
+
"operation": "internal_transfer.create",
|
|
206
|
+
"amount": {
|
|
207
|
+
"field": "self.serviceTax"
|
|
208
|
+
},
|
|
209
|
+
"from": "self.held",
|
|
210
|
+
"to": "party.tax"
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
"publicAction": "releaseSale"
|
|
214
|
+
},
|
|
215
|
+
"refund": {
|
|
216
|
+
"summary": "Refund after verified return",
|
|
217
|
+
"event": "sale.refund",
|
|
218
|
+
"actor": "caller",
|
|
219
|
+
"input": [],
|
|
220
|
+
"requires": [
|
|
221
|
+
{
|
|
222
|
+
"kind": "compare",
|
|
223
|
+
"left": {
|
|
224
|
+
"field": "self.returnVerified"
|
|
225
|
+
},
|
|
226
|
+
"operator": "==",
|
|
227
|
+
"right": {
|
|
228
|
+
"literal": true
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
],
|
|
232
|
+
"moves": [
|
|
233
|
+
{
|
|
234
|
+
"key": "refund",
|
|
235
|
+
"operation": "internal_transfer.create",
|
|
236
|
+
"amount": {
|
|
237
|
+
"field": "self.price"
|
|
238
|
+
},
|
|
239
|
+
"from": "self.held",
|
|
240
|
+
"to": "party.buyer"
|
|
241
|
+
}
|
|
242
|
+
],
|
|
243
|
+
"publicAction": "refundSale"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"actionOrder": ["create", "fund", "accept", "release", "refund"]
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
}
|