@ixo/topic-protocol 0.7.0 → 0.8.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 +4 -2
- package/dist/schemas/action-receipt.schema.json +105 -11
- package/dist/schemas/decision-to-pay-template.schema.json +346 -0
- package/dist/schemas/payable-obligation.schema.json +312 -0
- package/dist/schemas/payment-terms.schema.json +287 -0
- package/dist/schemas/topic-action-request.schema.json +30 -0
- package/dist/schemas/topic-contract-state.schema.json +29 -3
- package/dist/schemas/topic-flow-binding.schema.json +28 -0
- package/dist/schemas/topic-kind-profile.schema.json +32 -2
- package/dist/schemas/topic-operation.schema.json +2 -2
- package/dist/src/action-runtime/types.d.ts +101 -0
- package/dist/src/action-runtime/types.js +12 -0
- package/dist/src/action-runtime/types.js.map +1 -0
- package/dist/src/contracts/schemas.d.ts +2608 -463
- package/dist/src/contracts/schemas.js +10 -0
- package/dist/src/contracts/schemas.js.map +1 -1
- package/dist/src/contracts/topic-contract.d.ts +8 -1
- package/dist/src/contracts/topic-contract.js.map +1 -1
- package/dist/src/contracts/topic-kind-profile.d.ts +29 -0
- package/dist/src/contracts/topic-kind-profile.js +31 -0
- package/dist/src/contracts/topic-kind-profile.js.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/projector/payload.d.ts +18 -0
- package/dist/src/projector/payload.js +57 -1
- package/dist/src/projector/payload.js.map +1 -1
- package/dist/src/projector/state.js +144 -0
- package/dist/src/projector/state.js.map +1 -1
- package/dist/src/projector/types.d.ts +13 -3
- package/dist/src/projector/types.js.map +1 -1
- package/package.json +4 -2
- package/templates/decision-to-pay/README.md +59 -0
- package/templates/decision-to-pay/milestone-payment-release.template.json +195 -0
- package/templates/decision-to-pay/outcome-payment-claim.template.json +198 -0
- package/templates/decision-to-pay/payment-on-delivery.template.json +198 -0
- package/templates/decision-to-pay/verified-work-payment.template.json +283 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://topic-protocol.ixo.world/schemas/payable-obligation.schema.json",
|
|
4
|
+
"title": "IXO Payable Obligation envelope v1",
|
|
5
|
+
"description": "A non-authoritative envelope whose lifecycle axes are derived from referenced Topic Protocol records.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"version",
|
|
9
|
+
"type",
|
|
10
|
+
"id",
|
|
11
|
+
"revision",
|
|
12
|
+
"status",
|
|
13
|
+
"topicId",
|
|
14
|
+
"basis",
|
|
15
|
+
"paymentTerms",
|
|
16
|
+
"payerDid",
|
|
17
|
+
"claimantDid",
|
|
18
|
+
"requested",
|
|
19
|
+
"sourceResources",
|
|
20
|
+
"evidence",
|
|
21
|
+
"axisProjection",
|
|
22
|
+
"recordRefs",
|
|
23
|
+
"replayKey",
|
|
24
|
+
"projectionAuthority"
|
|
25
|
+
],
|
|
26
|
+
"properties": {
|
|
27
|
+
"$schema": { "type": "string", "minLength": 1 },
|
|
28
|
+
"version": { "const": 1 },
|
|
29
|
+
"type": { "const": "org.ixo.payable-obligation" },
|
|
30
|
+
"id": { "type": "string", "pattern": "^urn:ixo:payable-obligation:[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
|
|
31
|
+
"revision": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
32
|
+
"supersedes": { "$ref": "#/$defs/resourceDigestRef" },
|
|
33
|
+
"status": { "enum": ["draft", "submitted", "withdrawn", "superseded"] },
|
|
34
|
+
"topicId": { "$ref": "#/$defs/topicId" },
|
|
35
|
+
"basis": { "enum": ["work_delivery", "physical_delivery", "milestone", "outcome", "invoice", "reimbursement", "eligibility", "usage", "custom"] },
|
|
36
|
+
"paymentTerms": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"required": ["id", "revision", "ref", "digest"],
|
|
39
|
+
"properties": {
|
|
40
|
+
"id": { "type": "string", "pattern": "^urn:ixo:payment-terms:" },
|
|
41
|
+
"revision": { "type": "string", "minLength": 1 },
|
|
42
|
+
"ref": { "type": "string", "format": "uri-reference" },
|
|
43
|
+
"digest": { "$ref": "#/$defs/digest" }
|
|
44
|
+
},
|
|
45
|
+
"additionalProperties": false
|
|
46
|
+
},
|
|
47
|
+
"payerDid": { "$ref": "#/$defs/did" },
|
|
48
|
+
"claimantDid": { "$ref": "#/$defs/did" },
|
|
49
|
+
"requested": { "$ref": "#/$defs/requested" },
|
|
50
|
+
"sourceResources": {
|
|
51
|
+
"type": "array",
|
|
52
|
+
"minItems": 1,
|
|
53
|
+
"items": { "$ref": "#/$defs/resourceDigestRef" }
|
|
54
|
+
},
|
|
55
|
+
"evidence": {
|
|
56
|
+
"type": "array",
|
|
57
|
+
"items": { "$ref": "#/$defs/evidence" }
|
|
58
|
+
},
|
|
59
|
+
"axisProjection": { "$ref": "#/$defs/axisProjection" },
|
|
60
|
+
"recordRefs": { "$ref": "#/$defs/recordRefs" },
|
|
61
|
+
"reasons": {
|
|
62
|
+
"type": "array",
|
|
63
|
+
"minItems": 1,
|
|
64
|
+
"items": { "type": "string", "minLength": 1, "maxLength": 2000 }
|
|
65
|
+
},
|
|
66
|
+
"replayKey": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
67
|
+
"submittedBy": { "$ref": "#/$defs/did" },
|
|
68
|
+
"submittedAt": { "type": "string", "format": "date-time" },
|
|
69
|
+
"projectionAuthority": { "const": "referenced_topic_protocol_records" },
|
|
70
|
+
"extensions": { "type": "object" }
|
|
71
|
+
},
|
|
72
|
+
"additionalProperties": false,
|
|
73
|
+
"allOf": [
|
|
74
|
+
{
|
|
75
|
+
"if": { "properties": { "status": { "const": "submitted" } }, "required": ["status"] },
|
|
76
|
+
"then": {
|
|
77
|
+
"properties": {
|
|
78
|
+
"submittedBy": { "$ref": "#/$defs/did" },
|
|
79
|
+
"submittedAt": { "type": "string", "format": "date-time" }
|
|
80
|
+
},
|
|
81
|
+
"required": ["submittedBy", "submittedAt"]
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"if": {
|
|
86
|
+
"properties": {
|
|
87
|
+
"axisProjection": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"properties": { "delivery": { "enum": ["submitted", "accepted", "returned", "rejected"] } },
|
|
90
|
+
"required": ["delivery"]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"then": {
|
|
95
|
+
"properties": {
|
|
96
|
+
"recordRefs": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"required": ["deliveryPacket"],
|
|
99
|
+
"properties": { "deliveryPacket": { "$ref": "#/$defs/protocolRecordRef" } }
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"if": {
|
|
106
|
+
"properties": {
|
|
107
|
+
"axisProjection": {
|
|
108
|
+
"type": "object",
|
|
109
|
+
"properties": { "delivery": { "enum": ["accepted", "returned", "rejected"] } },
|
|
110
|
+
"required": ["delivery"]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"then": {
|
|
115
|
+
"properties": {
|
|
116
|
+
"recordRefs": {
|
|
117
|
+
"type": "object",
|
|
118
|
+
"required": ["deliveryDecision"],
|
|
119
|
+
"properties": { "deliveryDecision": { "$ref": "#/$defs/protocolRecordRef" } }
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"if": {
|
|
126
|
+
"properties": {
|
|
127
|
+
"axisProjection": {
|
|
128
|
+
"type": "object",
|
|
129
|
+
"properties": { "evaluation": { "enum": ["supported", "refuted", "insufficient_evidence", "human_review", "disputed", "superseded"] } },
|
|
130
|
+
"required": ["evaluation"]
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"then": {
|
|
135
|
+
"properties": {
|
|
136
|
+
"recordRefs": {
|
|
137
|
+
"type": "object",
|
|
138
|
+
"required": ["evaluations"],
|
|
139
|
+
"properties": { "evaluations": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/protocolRecordRef" } } }
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"if": {
|
|
146
|
+
"properties": {
|
|
147
|
+
"axisProjection": {
|
|
148
|
+
"type": "object",
|
|
149
|
+
"properties": { "approval": { "enum": ["approved", "rejected", "changes_requested", "superseded"] } },
|
|
150
|
+
"required": ["approval"]
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"then": {
|
|
155
|
+
"properties": {
|
|
156
|
+
"recordRefs": {
|
|
157
|
+
"type": "object",
|
|
158
|
+
"required": ["approval"],
|
|
159
|
+
"properties": { "approval": { "$ref": "#/$defs/protocolRecordRef" } }
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"if": {
|
|
166
|
+
"properties": {
|
|
167
|
+
"axisProjection": {
|
|
168
|
+
"type": "object",
|
|
169
|
+
"properties": { "claim": { "enum": ["pending", "approved", "rejected", "disputed", "invalidated", "flagged"] } },
|
|
170
|
+
"required": ["claim"]
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"then": {
|
|
175
|
+
"properties": {
|
|
176
|
+
"recordRefs": {
|
|
177
|
+
"type": "object",
|
|
178
|
+
"required": ["claim"],
|
|
179
|
+
"properties": { "claim": { "$ref": "#/$defs/protocolRecordRef" } }
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"if": {
|
|
186
|
+
"properties": {
|
|
187
|
+
"axisProjection": {
|
|
188
|
+
"type": "object",
|
|
189
|
+
"properties": { "settlement": { "enum": ["authorised", "submitted", "confirmed", "failed", "refunded"] } },
|
|
190
|
+
"required": ["settlement"]
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"then": {
|
|
195
|
+
"properties": {
|
|
196
|
+
"recordRefs": {
|
|
197
|
+
"type": "object",
|
|
198
|
+
"required": ["settlements"],
|
|
199
|
+
"properties": { "settlements": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/protocolRecordRef" } } }
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"if": {
|
|
206
|
+
"properties": {
|
|
207
|
+
"axisProjection": {
|
|
208
|
+
"type": "object",
|
|
209
|
+
"properties": { "settlement": { "enum": ["authorised", "submitted", "confirmed"] } },
|
|
210
|
+
"required": ["settlement"]
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
"then": {
|
|
215
|
+
"properties": {
|
|
216
|
+
"axisProjection": {
|
|
217
|
+
"type": "object",
|
|
218
|
+
"properties": {
|
|
219
|
+
"delivery": { "const": "accepted" },
|
|
220
|
+
"evaluation": { "const": "supported" },
|
|
221
|
+
"approval": { "const": "approved" },
|
|
222
|
+
"claim": { "const": "approved" }
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"recordRefs": {
|
|
226
|
+
"type": "object",
|
|
227
|
+
"properties": {
|
|
228
|
+
"deliveryPacket": { "$ref": "#/$defs/protocolRecordRef" },
|
|
229
|
+
"deliveryDecision": { "$ref": "#/$defs/protocolRecordRef" },
|
|
230
|
+
"evaluations": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/protocolRecordRef" } },
|
|
231
|
+
"approval": { "$ref": "#/$defs/protocolRecordRef" },
|
|
232
|
+
"claim": { "$ref": "#/$defs/protocolRecordRef" },
|
|
233
|
+
"settlements": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/protocolRecordRef" } }
|
|
234
|
+
},
|
|
235
|
+
"required": ["deliveryPacket", "deliveryDecision", "evaluations", "approval", "claim", "settlements"]
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
"$defs": {
|
|
242
|
+
"did": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
|
|
243
|
+
"topicId": { "type": "string", "pattern": "^ixo:topic:[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
|
|
244
|
+
"digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
|
|
245
|
+
"decimal": { "type": "string", "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]+)?$" },
|
|
246
|
+
"requested": {
|
|
247
|
+
"type": "object",
|
|
248
|
+
"required": ["amount", "asset", "recipient"],
|
|
249
|
+
"properties": {
|
|
250
|
+
"amount": { "$ref": "#/$defs/decimal" },
|
|
251
|
+
"asset": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
252
|
+
"recipient": { "type": "string", "minLength": 1, "maxLength": 256 }
|
|
253
|
+
},
|
|
254
|
+
"additionalProperties": false
|
|
255
|
+
},
|
|
256
|
+
"resourceDigestRef": {
|
|
257
|
+
"type": "object",
|
|
258
|
+
"required": ["type", "ref", "digest"],
|
|
259
|
+
"properties": {
|
|
260
|
+
"type": { "type": "string", "minLength": 1 },
|
|
261
|
+
"ref": { "type": "string", "format": "uri-reference" },
|
|
262
|
+
"digest": { "$ref": "#/$defs/digest" }
|
|
263
|
+
},
|
|
264
|
+
"additionalProperties": false
|
|
265
|
+
},
|
|
266
|
+
"evidence": {
|
|
267
|
+
"type": "object",
|
|
268
|
+
"required": ["type", "uri", "digest", "provenanceClass"],
|
|
269
|
+
"properties": {
|
|
270
|
+
"type": { "type": "string", "minLength": 1 },
|
|
271
|
+
"uri": { "type": "string", "format": "uri-reference" },
|
|
272
|
+
"digest": { "$ref": "#/$defs/digest" },
|
|
273
|
+
"provenanceClass": { "enum": ["claimant_provided", "client_assisted", "server_verified", "third_party_attested"] },
|
|
274
|
+
"label": { "type": "string", "minLength": 1 }
|
|
275
|
+
},
|
|
276
|
+
"additionalProperties": false
|
|
277
|
+
},
|
|
278
|
+
"axisProjection": {
|
|
279
|
+
"type": "object",
|
|
280
|
+
"required": ["delivery", "evaluation", "approval", "claim", "settlement"],
|
|
281
|
+
"properties": {
|
|
282
|
+
"delivery": { "enum": ["not_created", "not_required", "pending", "submitted", "accepted", "returned", "rejected"] },
|
|
283
|
+
"evaluation": { "enum": ["not_created", "not_required", "pending", "supported", "refuted", "insufficient_evidence", "human_review", "disputed", "superseded"] },
|
|
284
|
+
"approval": { "enum": ["not_created", "pending", "approved", "rejected", "changes_requested", "superseded"] },
|
|
285
|
+
"claim": { "enum": ["not_created", "pending", "approved", "rejected", "disputed", "invalidated", "flagged"] },
|
|
286
|
+
"settlement": { "enum": ["not_created", "unfunded", "funded", "held", "authorised", "submitted", "confirmed", "failed", "refunded"] }
|
|
287
|
+
},
|
|
288
|
+
"additionalProperties": false
|
|
289
|
+
},
|
|
290
|
+
"protocolRecordRef": {
|
|
291
|
+
"type": "object",
|
|
292
|
+
"required": ["id", "digest"],
|
|
293
|
+
"properties": {
|
|
294
|
+
"id": { "type": "string", "minLength": 1, "maxLength": 512 },
|
|
295
|
+
"digest": { "$ref": "#/$defs/digest" }
|
|
296
|
+
},
|
|
297
|
+
"additionalProperties": false
|
|
298
|
+
},
|
|
299
|
+
"recordRefs": {
|
|
300
|
+
"type": "object",
|
|
301
|
+
"properties": {
|
|
302
|
+
"deliveryPacket": { "$ref": "#/$defs/protocolRecordRef" },
|
|
303
|
+
"deliveryDecision": { "$ref": "#/$defs/protocolRecordRef" },
|
|
304
|
+
"evaluations": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/protocolRecordRef" } },
|
|
305
|
+
"approval": { "$ref": "#/$defs/protocolRecordRef" },
|
|
306
|
+
"claim": { "$ref": "#/$defs/protocolRecordRef" },
|
|
307
|
+
"settlements": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/protocolRecordRef" } }
|
|
308
|
+
},
|
|
309
|
+
"additionalProperties": false
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://topic-protocol.ixo.world/schemas/payment-terms.schema.json",
|
|
4
|
+
"title": "IXO Payment Terms resource v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"version",
|
|
8
|
+
"type",
|
|
9
|
+
"id",
|
|
10
|
+
"revision",
|
|
11
|
+
"status",
|
|
12
|
+
"payer",
|
|
13
|
+
"payee",
|
|
14
|
+
"asset",
|
|
15
|
+
"calculation",
|
|
16
|
+
"paymentCondition",
|
|
17
|
+
"timing",
|
|
18
|
+
"approvalPolicy",
|
|
19
|
+
"settlementPolicy",
|
|
20
|
+
"disputePolicy",
|
|
21
|
+
"capabilityRequirements",
|
|
22
|
+
"authoredBy",
|
|
23
|
+
"authoredAt"
|
|
24
|
+
],
|
|
25
|
+
"properties": {
|
|
26
|
+
"$schema": { "type": "string", "minLength": 1 },
|
|
27
|
+
"version": { "const": 1 },
|
|
28
|
+
"type": { "const": "org.ixo.payment-terms" },
|
|
29
|
+
"id": { "type": "string", "pattern": "^urn:ixo:payment-terms:[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
|
|
30
|
+
"revision": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
31
|
+
"status": { "enum": ["draft", "accepted", "superseded"] },
|
|
32
|
+
"payer": { "$ref": "#/$defs/payer" },
|
|
33
|
+
"payee": { "$ref": "#/$defs/payee" },
|
|
34
|
+
"asset": { "$ref": "#/$defs/asset" },
|
|
35
|
+
"calculation": {
|
|
36
|
+
"oneOf": [
|
|
37
|
+
{ "$ref": "#/$defs/fixedCalculation" },
|
|
38
|
+
{ "$ref": "#/$defs/formulaCalculation" },
|
|
39
|
+
{ "$ref": "#/$defs/milestoneCalculation" },
|
|
40
|
+
{ "$ref": "#/$defs/outcomeCalculation" }
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"paymentCondition": { "$ref": "#/$defs/paymentCondition" },
|
|
44
|
+
"timing": { "$ref": "#/$defs/timing" },
|
|
45
|
+
"partialPayments": { "$ref": "#/$defs/partialPayments" },
|
|
46
|
+
"approvalPolicy": { "$ref": "#/$defs/approvalPolicy" },
|
|
47
|
+
"settlementPolicy": { "$ref": "#/$defs/settlementPolicy" },
|
|
48
|
+
"disputePolicy": { "$ref": "#/$defs/disputePolicy" },
|
|
49
|
+
"capabilityRequirements": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"minItems": 1,
|
|
52
|
+
"items": { "$ref": "#/$defs/capabilityRequirement" }
|
|
53
|
+
},
|
|
54
|
+
"authoredBy": { "$ref": "#/$defs/did" },
|
|
55
|
+
"authoredAt": { "type": "string", "format": "date-time" },
|
|
56
|
+
"extensions": { "type": "object" }
|
|
57
|
+
},
|
|
58
|
+
"additionalProperties": false,
|
|
59
|
+
"allOf": [
|
|
60
|
+
{
|
|
61
|
+
"if": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"properties": { "calculation": { "type": "object", "properties": { "model": { "const": "outcome" } }, "required": ["model"] } },
|
|
64
|
+
"required": ["calculation"]
|
|
65
|
+
},
|
|
66
|
+
"then": {
|
|
67
|
+
"properties": {
|
|
68
|
+
"paymentCondition": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"properties": {
|
|
71
|
+
"type": { "const": "outcome_supported" },
|
|
72
|
+
"supportedEvaluationsRequired": { "type": "integer", "minimum": 1 }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"$defs": {
|
|
80
|
+
"did": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
|
|
81
|
+
"digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
|
|
82
|
+
"decimal": { "type": "string", "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]+)?$" },
|
|
83
|
+
"policyRef": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"required": ["ref", "version", "digest"],
|
|
86
|
+
"properties": {
|
|
87
|
+
"ref": { "type": "string", "format": "uri" },
|
|
88
|
+
"version": { "type": "string", "minLength": 1 },
|
|
89
|
+
"digest": { "$ref": "#/$defs/digest" }
|
|
90
|
+
},
|
|
91
|
+
"additionalProperties": false
|
|
92
|
+
},
|
|
93
|
+
"payer": {
|
|
94
|
+
"type": "object",
|
|
95
|
+
"required": ["did"],
|
|
96
|
+
"properties": {
|
|
97
|
+
"did": { "$ref": "#/$defs/did" },
|
|
98
|
+
"label": { "type": "string", "minLength": 1, "maxLength": 280 }
|
|
99
|
+
},
|
|
100
|
+
"additionalProperties": false
|
|
101
|
+
},
|
|
102
|
+
"payee": {
|
|
103
|
+
"type": "object",
|
|
104
|
+
"required": ["did", "recipient"],
|
|
105
|
+
"properties": {
|
|
106
|
+
"did": { "$ref": "#/$defs/did" },
|
|
107
|
+
"recipient": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
108
|
+
"label": { "type": "string", "minLength": 1, "maxLength": 280 }
|
|
109
|
+
},
|
|
110
|
+
"additionalProperties": false
|
|
111
|
+
},
|
|
112
|
+
"asset": {
|
|
113
|
+
"type": "object",
|
|
114
|
+
"required": ["id"],
|
|
115
|
+
"properties": {
|
|
116
|
+
"id": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
117
|
+
"decimals": { "type": "integer", "minimum": 0, "maximum": 30 }
|
|
118
|
+
},
|
|
119
|
+
"additionalProperties": false
|
|
120
|
+
},
|
|
121
|
+
"fixedCalculation": {
|
|
122
|
+
"type": "object",
|
|
123
|
+
"required": ["model", "amount"],
|
|
124
|
+
"properties": {
|
|
125
|
+
"model": { "const": "fixed" },
|
|
126
|
+
"amount": { "$ref": "#/$defs/decimal" }
|
|
127
|
+
},
|
|
128
|
+
"additionalProperties": false
|
|
129
|
+
},
|
|
130
|
+
"formulaCalculation": {
|
|
131
|
+
"type": "object",
|
|
132
|
+
"required": ["model", "formula"],
|
|
133
|
+
"properties": {
|
|
134
|
+
"model": { "const": "formula" },
|
|
135
|
+
"formula": { "$ref": "#/$defs/policyRef" },
|
|
136
|
+
"maximumAmount": { "$ref": "#/$defs/decimal" },
|
|
137
|
+
"requiredInputTypes": {
|
|
138
|
+
"type": "array",
|
|
139
|
+
"minItems": 1,
|
|
140
|
+
"uniqueItems": true,
|
|
141
|
+
"items": { "type": "string", "minLength": 1 }
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"additionalProperties": false
|
|
145
|
+
},
|
|
146
|
+
"milestoneCalculation": {
|
|
147
|
+
"type": "object",
|
|
148
|
+
"required": ["model", "milestoneId", "amount"],
|
|
149
|
+
"properties": {
|
|
150
|
+
"model": { "const": "milestone" },
|
|
151
|
+
"milestoneId": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
152
|
+
"amount": { "$ref": "#/$defs/decimal" }
|
|
153
|
+
},
|
|
154
|
+
"additionalProperties": false
|
|
155
|
+
},
|
|
156
|
+
"outcomeCalculation": {
|
|
157
|
+
"type": "object",
|
|
158
|
+
"required": ["model", "rubric", "amountRule"],
|
|
159
|
+
"properties": {
|
|
160
|
+
"model": { "const": "outcome" },
|
|
161
|
+
"rubric": { "$ref": "#/$defs/policyRef" },
|
|
162
|
+
"amountRule": { "$ref": "#/$defs/policyRef" },
|
|
163
|
+
"maximumAmount": { "$ref": "#/$defs/decimal" }
|
|
164
|
+
},
|
|
165
|
+
"additionalProperties": false
|
|
166
|
+
},
|
|
167
|
+
"paymentCondition": {
|
|
168
|
+
"type": "object",
|
|
169
|
+
"required": ["type", "requiredEvidenceTypes", "deliveryDecisionRequired", "supportedEvaluationsRequired"],
|
|
170
|
+
"properties": {
|
|
171
|
+
"type": {
|
|
172
|
+
"enum": ["delivery_accepted", "milestone_accepted", "outcome_supported", "obligation_approved"]
|
|
173
|
+
},
|
|
174
|
+
"requiredEvidenceTypes": {
|
|
175
|
+
"type": "array",
|
|
176
|
+
"uniqueItems": true,
|
|
177
|
+
"items": { "type": "string", "minLength": 1 }
|
|
178
|
+
},
|
|
179
|
+
"deliveryDecisionRequired": { "type": "boolean" },
|
|
180
|
+
"supportedEvaluationsRequired": { "type": "integer", "minimum": 0, "maximum": 100 }
|
|
181
|
+
},
|
|
182
|
+
"additionalProperties": false
|
|
183
|
+
},
|
|
184
|
+
"timing": {
|
|
185
|
+
"type": "object",
|
|
186
|
+
"required": ["trigger"],
|
|
187
|
+
"properties": {
|
|
188
|
+
"trigger": { "enum": ["claim_approved", "fixed_date"] },
|
|
189
|
+
"dueWithin": { "type": "string", "pattern": "^P" },
|
|
190
|
+
"dueAt": { "type": "string", "format": "date-time" },
|
|
191
|
+
"timezone": { "type": "string", "minLength": 1 }
|
|
192
|
+
},
|
|
193
|
+
"additionalProperties": false,
|
|
194
|
+
"allOf": [
|
|
195
|
+
{
|
|
196
|
+
"if": { "type": "object", "properties": { "trigger": { "const": "claim_approved" } }, "required": ["trigger"] },
|
|
197
|
+
"then": { "properties": { "dueWithin": { "type": "string", "pattern": "^P" } }, "required": ["dueWithin"] }
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"if": { "type": "object", "properties": { "trigger": { "const": "fixed_date" } }, "required": ["trigger"] },
|
|
201
|
+
"then": {
|
|
202
|
+
"properties": {
|
|
203
|
+
"dueAt": { "type": "string", "format": "date-time" },
|
|
204
|
+
"timezone": { "type": "string", "minLength": 1 }
|
|
205
|
+
},
|
|
206
|
+
"required": ["dueAt", "timezone"]
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
"partialPayments": {
|
|
212
|
+
"type": "object",
|
|
213
|
+
"required": ["allowed"],
|
|
214
|
+
"properties": {
|
|
215
|
+
"allowed": { "type": "boolean" },
|
|
216
|
+
"minimumAmount": { "$ref": "#/$defs/decimal" },
|
|
217
|
+
"maximumInstallments": { "type": "integer", "minimum": 1, "maximum": 1000 }
|
|
218
|
+
},
|
|
219
|
+
"additionalProperties": false
|
|
220
|
+
},
|
|
221
|
+
"approvalPolicy": {
|
|
222
|
+
"type": "object",
|
|
223
|
+
"required": ["policy", "authorityDids", "requiredApprovals", "humanConfirmationRequired"],
|
|
224
|
+
"properties": {
|
|
225
|
+
"policy": { "$ref": "#/$defs/policyRef" },
|
|
226
|
+
"authorityDids": {
|
|
227
|
+
"type": "array",
|
|
228
|
+
"minItems": 1,
|
|
229
|
+
"uniqueItems": true,
|
|
230
|
+
"items": { "$ref": "#/$defs/did" }
|
|
231
|
+
},
|
|
232
|
+
"requiredApprovals": { "type": "integer", "minimum": 1, "maximum": 100 },
|
|
233
|
+
"humanConfirmationRequired": { "type": "boolean" }
|
|
234
|
+
},
|
|
235
|
+
"additionalProperties": false
|
|
236
|
+
},
|
|
237
|
+
"settlementPolicy": {
|
|
238
|
+
"type": "object",
|
|
239
|
+
"required": ["allowedPaymentRails", "fundingCheckRequired", "identityCheckRequired", "kycCheckRequired", "sanctionsCheckRequired", "humanConfirmationRequired"],
|
|
240
|
+
"properties": {
|
|
241
|
+
"allowedPaymentRails": {
|
|
242
|
+
"type": "array",
|
|
243
|
+
"minItems": 1,
|
|
244
|
+
"uniqueItems": true,
|
|
245
|
+
"items": { "type": "string", "minLength": 1, "maxLength": 128 }
|
|
246
|
+
},
|
|
247
|
+
"fundingCheckRequired": { "type": "boolean" },
|
|
248
|
+
"identityCheckRequired": { "type": "boolean" },
|
|
249
|
+
"kycCheckRequired": { "type": "boolean" },
|
|
250
|
+
"sanctionsCheckRequired": { "type": "boolean" },
|
|
251
|
+
"humanConfirmationRequired": { "type": "boolean" },
|
|
252
|
+
"humanConfirmationThreshold": { "$ref": "#/$defs/decimal" }
|
|
253
|
+
},
|
|
254
|
+
"additionalProperties": false
|
|
255
|
+
},
|
|
256
|
+
"disputePolicy": {
|
|
257
|
+
"type": "object",
|
|
258
|
+
"required": ["window", "authorityDids", "allowedRemedies"],
|
|
259
|
+
"properties": {
|
|
260
|
+
"window": { "type": "string", "pattern": "^P" },
|
|
261
|
+
"authorityDids": {
|
|
262
|
+
"type": "array",
|
|
263
|
+
"minItems": 1,
|
|
264
|
+
"uniqueItems": true,
|
|
265
|
+
"items": { "$ref": "#/$defs/did" }
|
|
266
|
+
},
|
|
267
|
+
"allowedRemedies": {
|
|
268
|
+
"type": "array",
|
|
269
|
+
"minItems": 1,
|
|
270
|
+
"uniqueItems": true,
|
|
271
|
+
"items": { "enum": ["withhold", "return_for_changes", "partial_payment", "refund", "recovery", "escalate"] }
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
"additionalProperties": false
|
|
275
|
+
},
|
|
276
|
+
"capabilityRequirement": {
|
|
277
|
+
"type": "object",
|
|
278
|
+
"required": ["action", "ability", "resource"],
|
|
279
|
+
"properties": {
|
|
280
|
+
"action": { "enum": ["submit_delivery", "accept_delivery", "evaluate", "approve", "record_claim", "record_settlement", "resolve_dispute"] },
|
|
281
|
+
"ability": { "type": "string", "minLength": 1 },
|
|
282
|
+
"resource": { "type": "string", "minLength": 1 }
|
|
283
|
+
},
|
|
284
|
+
"additionalProperties": false
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://topic-protocol.ixo.world/schemas/topic-action-request.schema.json",
|
|
4
|
+
"title": "Topic Action Request v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["version", "requestId", "topicId", "topicRevision", "actionType", "actionContractDigest", "executor", "inputs", "requestedBy", "requestedAt", "idempotencyKey", "confirmation", "capability"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"version": { "const": 1 },
|
|
9
|
+
"requestId": { "type": "string", "minLength": 1 },
|
|
10
|
+
"topicId": { "type": "string", "pattern": "^ixo:topic:[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
|
|
11
|
+
"topicRevision": { "type": "string", "minLength": 1 },
|
|
12
|
+
"actionType": { "type": "string", "pattern": "^qi/[a-z0-9]+(?:[._-][a-z0-9]+)*$" },
|
|
13
|
+
"actionContractDigest": { "$ref": "#/$defs/digest" },
|
|
14
|
+
"executor": { "enum": ["qi-flow", "qiforge", "mcp"] },
|
|
15
|
+
"inputs": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"required": ["digest"],
|
|
18
|
+
"properties": { "digest": { "$ref": "#/$defs/digest" }, "ref": { "type": "string", "minLength": 1 } },
|
|
19
|
+
"additionalProperties": false
|
|
20
|
+
},
|
|
21
|
+
"requestedBy": { "type": "string", "pattern": "^did:" },
|
|
22
|
+
"requestedAt": { "type": "string", "format": "date-time" },
|
|
23
|
+
"idempotencyKey": { "type": "string", "minLength": 1 },
|
|
24
|
+
"confirmation": { "enum": ["not-required", "required", "confirmed"] },
|
|
25
|
+
"flowBindingId": { "type": "string", "minLength": 1 },
|
|
26
|
+
"capability": { "type": "string", "minLength": 1 }
|
|
27
|
+
},
|
|
28
|
+
"additionalProperties": false,
|
|
29
|
+
"$defs": { "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } }
|
|
30
|
+
}
|