@ixo/topic-protocol 0.6.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 +6 -2
- package/dist/schemas/action-receipt.schema.json +105 -11
- package/dist/schemas/approval-decision.schema.json +30 -0
- package/dist/schemas/claim-record.schema.json +30 -0
- package/dist/schemas/decision-to-pay-template.schema.json +346 -0
- package/dist/schemas/delivery-decision.schema.json +28 -0
- package/dist/schemas/delivery-packet.schema.json +58 -0
- package/dist/schemas/evaluation-assertion.schema.json +37 -0
- package/dist/schemas/external-work-binding.schema.json +83 -0
- package/dist/schemas/external-work-state-map.schema.json +29 -0
- package/dist/schemas/payable-obligation.schema.json +312 -0
- package/dist/schemas/payment-terms.schema.json +287 -0
- package/dist/schemas/settlement-receipt.schema.json +53 -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/schemas/topic-state.schema.json +14 -0
- package/dist/schemas/work-item-snapshot.schema.json +73 -0
- 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 +3611 -130
- package/dist/src/contracts/schemas.js +28 -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/errors.d.ts +1 -1
- package/dist/src/errors.js.map +1 -1
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.js +4 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/projector/payload.d.ts +47 -0
- package/dist/src/projector/payload.js +140 -2
- package/dist/src/projector/payload.js.map +1 -1
- package/dist/src/projector/state.js +150 -0
- package/dist/src/projector/state.js.map +1 -1
- package/dist/src/projector/types.d.ts +15 -3
- package/dist/src/projector/types.js.map +1 -1
- package/dist/src/work-bridge/mapping.d.ts +2 -0
- package/dist/src/work-bridge/mapping.js +17 -0
- package/dist/src/work-bridge/mapping.js.map +1 -0
- package/dist/src/work-bridge/project.d.ts +7 -0
- package/dist/src/work-bridge/project.js +262 -0
- package/dist/src/work-bridge/project.js.map +1 -0
- package/dist/src/work-bridge/types.d.ts +232 -0
- package/dist/src/work-bridge/types.js +26 -0
- package/dist/src/work-bridge/types.js.map +1 -0
- 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,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,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://topic-protocol.ixo.world/schemas/settlement-receipt.schema.json",
|
|
4
|
+
"title": "Settlement receipt v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["version", "settlementId", "topicId", "claimId", "deliveryPacketId", "deliveryPacketDigest", "evaluationIds", "approvalId", "policy", "idempotencyKey", "amount", "asset", "recipient", "paymentRail", "state", "finality", "signerDid", "recordedAt", "capability", "digest"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"version": { "const": 1 },
|
|
9
|
+
"settlementId": { "$ref": "#/$defs/uuidV7" },
|
|
10
|
+
"topicId": { "$ref": "#/$defs/topicId" },
|
|
11
|
+
"claimId": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
12
|
+
"deliveryPacketId": { "$ref": "#/$defs/uuidV7" },
|
|
13
|
+
"deliveryPacketDigest": { "$ref": "#/$defs/digest" },
|
|
14
|
+
"evaluationIds": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/uuidV7" } },
|
|
15
|
+
"approvalId": { "$ref": "#/$defs/uuidV7" },
|
|
16
|
+
"policy": { "type": "object", "required": ["ref", "digest"], "properties": { "ref": { "type": "string", "format": "uri" }, "digest": { "$ref": "#/$defs/digest" } }, "additionalProperties": false },
|
|
17
|
+
"idempotencyKey": { "type": "string", "minLength": 1, "maxLength": 512 },
|
|
18
|
+
"amount": { "type": "string", "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]+)?$" },
|
|
19
|
+
"asset": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
20
|
+
"recipient": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
21
|
+
"paymentRail": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
22
|
+
"transactionReference": { "type": "string", "minLength": 1, "maxLength": 512 },
|
|
23
|
+
"state": { "enum": ["unfunded", "funded", "held", "authorised", "submitted", "confirmed", "failed", "refunded"] },
|
|
24
|
+
"finality": { "type": "object", "required": ["state"], "properties": { "state": { "enum": ["pending", "confirmed", "failed"] }, "confirmations": { "type": "integer", "minimum": 0 }, "confirmedAt": { "type": "string", "format": "date-time" } }, "additionalProperties": false },
|
|
25
|
+
"signerDid": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
|
|
26
|
+
"recordedAt": { "type": "string", "format": "date-time" },
|
|
27
|
+
"capability": { "type": "string", "minLength": 1 },
|
|
28
|
+
"digest": { "$ref": "#/$defs/digest" },
|
|
29
|
+
"extensions": { "type": "object" }
|
|
30
|
+
},
|
|
31
|
+
"$defs": {
|
|
32
|
+
"uuidV7": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" },
|
|
33
|
+
"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}$" },
|
|
34
|
+
"digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
|
|
35
|
+
},
|
|
36
|
+
"additionalProperties": false,
|
|
37
|
+
"allOf": [
|
|
38
|
+
{
|
|
39
|
+
"if": { "properties": { "state": { "const": "confirmed" } }, "required": ["state"] },
|
|
40
|
+
"then": {
|
|
41
|
+
"required": ["transactionReference"],
|
|
42
|
+
"properties": {
|
|
43
|
+
"transactionReference": { "type": "string", "minLength": 1, "maxLength": 512 },
|
|
44
|
+
"finality": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"properties": { "state": { "const": "confirmed" }, "confirmedAt": { "type": "string", "format": "date-time" } },
|
|
47
|
+
"required": ["state", "confirmedAt"]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -281,7 +281,22 @@
|
|
|
281
281
|
"kindProfile": { "$ref": "#/$defs/kindProfileRef" },
|
|
282
282
|
"appearance": { "$ref": "#/$defs/appearance" },
|
|
283
283
|
"attachmentCount": { "type": "integer", "minimum": 0 },
|
|
284
|
-
"operationCount": { "type": "integer", "minimum": 0 }
|
|
284
|
+
"operationCount": { "type": "integer", "minimum": 0 },
|
|
285
|
+
"actions": {
|
|
286
|
+
"type": "array",
|
|
287
|
+
"maxItems": 500,
|
|
288
|
+
"items": {
|
|
289
|
+
"type": "object",
|
|
290
|
+
"required": ["request", "status", "operationId"],
|
|
291
|
+
"properties": {
|
|
292
|
+
"request": { "$ref": "https://topic-protocol.ixo.world/schemas/topic-action-request.schema.json" },
|
|
293
|
+
"latestReceipt": { "$ref": "https://topic-protocol.ixo.world/schemas/action-receipt.schema.json#/$defs/v2" },
|
|
294
|
+
"status": { "enum": ["requested", "awaiting_confirmation", "running", "succeeded", "failed", "rejected", "cancelled", "needs_verification"] },
|
|
295
|
+
"operationId": { "type": "string", "minLength": 1 }
|
|
296
|
+
},
|
|
297
|
+
"additionalProperties": false
|
|
298
|
+
}
|
|
299
|
+
}
|
|
285
300
|
},
|
|
286
301
|
"additionalProperties": true
|
|
287
302
|
},
|
|
@@ -293,16 +308,26 @@
|
|
|
293
308
|
},
|
|
294
309
|
"automation": {
|
|
295
310
|
"type": "object",
|
|
296
|
-
"required": ["provider", "scheduleId", "
|
|
311
|
+
"required": ["provider", "scheduleId", "recurrence", "status"],
|
|
297
312
|
"properties": {
|
|
298
313
|
"provider": { "const": "temporal" },
|
|
299
314
|
"scheduleId": { "type": "string", "minLength": 1 },
|
|
300
315
|
"actionId": { "type": "string", "minLength": 1 },
|
|
316
|
+
"target": {
|
|
317
|
+
"oneOf": [
|
|
318
|
+
{ "type": "object", "required": ["kind", "actionType"], "properties": { "kind": { "const": "action" }, "actionType": { "type": "string", "pattern": "^qi/" } }, "additionalProperties": false },
|
|
319
|
+
{ "type": "object", "required": ["kind", "bindingId"], "properties": { "kind": { "const": "flow" }, "bindingId": { "type": "string", "minLength": 1 } }, "additionalProperties": false }
|
|
320
|
+
]
|
|
321
|
+
},
|
|
301
322
|
"recurrence": { "$ref": "#/$defs/recurrence" },
|
|
302
323
|
"status": { "type": "string", "enum": ["pending", "active", "paused", "failed"] },
|
|
303
324
|
"nextRunAt": { "type": "string", "format": "date-time" }
|
|
304
325
|
},
|
|
305
|
-
"additionalProperties": false
|
|
326
|
+
"additionalProperties": false,
|
|
327
|
+
"anyOf": [
|
|
328
|
+
{ "properties": { "actionId": true }, "required": ["actionId"] },
|
|
329
|
+
{ "properties": { "target": true }, "required": ["target"] }
|
|
330
|
+
]
|
|
306
331
|
},
|
|
307
332
|
"bindings": {
|
|
308
333
|
"type": "object",
|
|
@@ -310,6 +335,7 @@
|
|
|
310
335
|
"governanceProposal": { "type": "object" },
|
|
311
336
|
"claims": { "type": "object" },
|
|
312
337
|
"automations": { "type": "array", "maxItems": 20, "items": { "$ref": "#/$defs/automation" } },
|
|
338
|
+
"flows": { "type": "array", "maxItems": 20, "items": { "$ref": "https://topic-protocol.ixo.world/schemas/topic-flow-binding.schema.json" } },
|
|
313
339
|
"context": { "type": "array", "maxItems": 100, "items": { "type": "object" } }
|
|
314
340
|
},
|
|
315
341
|
"additionalProperties": false
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://topic-protocol.ixo.world/schemas/topic-flow-binding.schema.json",
|
|
4
|
+
"title": "Topic Flow Binding v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["version", "bindingId", "topicId", "flowUri", "flowRevision", "flowDigest", "role", "actionManifestDigest", "controllerDid", "startPolicy", "triggerPolicy", "receiptPolicy", "status", "capability", "capabilityReferences", "createdBy", "createdAt"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"version": { "const": 1 },
|
|
9
|
+
"bindingId": { "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
|
+
"flowUri": { "type": "string", "pattern": "^ixo:flow:" },
|
|
12
|
+
"flowRevision": { "type": "string", "minLength": 1 },
|
|
13
|
+
"flowDigest": { "$ref": "#/$defs/digest" },
|
|
14
|
+
"role": { "enum": ["primary", "supporting"] },
|
|
15
|
+
"actionManifestDigest": { "$ref": "#/$defs/digest" },
|
|
16
|
+
"controllerDid": { "type": "string", "pattern": "^did:" },
|
|
17
|
+
"startPolicy": { "enum": ["manual", "on-topic-active", "scheduled", "event"] },
|
|
18
|
+
"triggerPolicy": { "type": "object" },
|
|
19
|
+
"receiptPolicy": { "enum": ["all", "terminal"] },
|
|
20
|
+
"status": { "enum": ["pending", "active", "paused", "closed", "failed"] },
|
|
21
|
+
"capability": { "type": "string", "minLength": 1 },
|
|
22
|
+
"capabilityReferences": { "type": "array", "minItems": 2, "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
|
|
23
|
+
"createdBy": { "type": "string", "pattern": "^did:" },
|
|
24
|
+
"createdAt": { "type": "string", "format": "date-time" }
|
|
25
|
+
},
|
|
26
|
+
"additionalProperties": false,
|
|
27
|
+
"$defs": { "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } }
|
|
28
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"type": "object",
|
|
6
6
|
"required": ["version", "id", "profileVersion", "label", "kind", "resource", "acceptance", "projection", "presentation"],
|
|
7
7
|
"properties": {
|
|
8
|
-
"version": { "
|
|
8
|
+
"version": { "enum": [1, 2] },
|
|
9
9
|
"id": { "type": "string", "format": "uri" },
|
|
10
10
|
"profileVersion": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
|
|
11
11
|
"label": { "type": "string", "minLength": 1, "maxLength": 80 },
|
|
@@ -76,7 +76,37 @@
|
|
|
76
76
|
"uniqueItems": true,
|
|
77
77
|
"maxItems": 20,
|
|
78
78
|
"items": { "type": "string", "minLength": 1, "maxLength": 128 }
|
|
79
|
+
},
|
|
80
|
+
"actionManifest": {
|
|
81
|
+
"type": "object",
|
|
82
|
+
"required": ["version", "digest"],
|
|
83
|
+
"properties": {
|
|
84
|
+
"version": { "type": "string", "minLength": 1, "maxLength": 40 },
|
|
85
|
+
"digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
|
|
86
|
+
},
|
|
87
|
+
"additionalProperties": false
|
|
88
|
+
},
|
|
89
|
+
"actions": {
|
|
90
|
+
"type": "array",
|
|
91
|
+
"uniqueItems": true,
|
|
92
|
+
"maxItems": 50,
|
|
93
|
+
"items": {
|
|
94
|
+
"type": "object",
|
|
95
|
+
"required": ["type", "role"],
|
|
96
|
+
"properties": {
|
|
97
|
+
"type": { "type": "string", "pattern": "^qi/[a-z0-9]+(?:[._-][a-z0-9]+)*$" },
|
|
98
|
+
"role": { "enum": ["primary", "supporting"] },
|
|
99
|
+
"label": { "type": "string", "minLength": 1, "maxLength": 80 }
|
|
100
|
+
},
|
|
101
|
+
"additionalProperties": false
|
|
102
|
+
}
|
|
79
103
|
}
|
|
80
104
|
},
|
|
81
|
-
"additionalProperties": false
|
|
105
|
+
"additionalProperties": false,
|
|
106
|
+
"allOf": [
|
|
107
|
+
{
|
|
108
|
+
"if": { "properties": { "version": { "const": 2 } }, "required": ["version"] },
|
|
109
|
+
"then": { "properties": { "actionManifest": true, "actions": true }, "required": ["actionManifest", "actions"] }
|
|
110
|
+
}
|
|
111
|
+
]
|
|
82
112
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"version": { "enum": [1, 2] },
|
|
9
9
|
"operationId": { "type": "string", "minLength": 1 },
|
|
10
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
|
-
"type": { "type": "string", "enum": ["rename", "change-status", "update-overview", "link-context", "unlink-context", "attach-files", "detach-files", "record-decision", "propose-contract", "update-contract", "accept-contract", "supersede-contract", "bind-automation", "update-automation", "pause-automation", "remove-automation", "redirect", "branch", "merge", "resolve-conflict"] },
|
|
11
|
+
"type": { "type": "string", "enum": ["rename", "change-status", "update-overview", "link-context", "unlink-context", "attach-files", "detach-files", "record-decision", "propose-contract", "update-contract", "accept-contract", "supersede-contract", "bind-automation", "update-automation", "pause-automation", "remove-automation", "bind-flow", "update-flow-binding", "unbind-flow", "request-action", "cancel-action", "record-action-receipt", "bind-external-work", "sync-external-work", "unlink-external-work", "submit-delivery", "record-delivery-decision", "record-evaluation", "record-approval", "record-claim", "record-settlement", "redirect", "branch", "merge", "resolve-conflict"] },
|
|
12
12
|
"previousRevision": { "type": "string", "minLength": 1 },
|
|
13
13
|
"actor": { "type": "string", "minLength": 1 },
|
|
14
14
|
"createdAt": { "type": "string", "format": "date-time" },
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
{
|
|
21
21
|
"if": {
|
|
22
22
|
"properties": {
|
|
23
|
-
"type": { "enum": ["propose-contract", "update-contract", "accept-contract", "supersede-contract", "bind-automation", "update-automation", "pause-automation", "remove-automation"] }
|
|
23
|
+
"type": { "enum": ["propose-contract", "update-contract", "accept-contract", "supersede-contract", "bind-automation", "update-automation", "pause-automation", "remove-automation", "bind-flow", "update-flow-binding", "unbind-flow", "request-action", "cancel-action", "record-action-receipt", "bind-external-work", "sync-external-work", "unlink-external-work", "submit-delivery", "record-delivery-decision", "record-evaluation", "record-approval", "record-claim", "record-settlement"] }
|
|
24
24
|
},
|
|
25
25
|
"required": ["type"]
|
|
26
26
|
},
|
|
@@ -33,6 +33,20 @@
|
|
|
33
33
|
]
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
|
+
"workBridge": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"required": ["bindings", "deliveryPackets", "deliveryDecisions", "evaluations", "approvals", "claims", "settlements"],
|
|
39
|
+
"properties": {
|
|
40
|
+
"bindings": { "type": "array", "items": { "type": "object", "required": ["bindingId", "topicId", "workState", "health", "lastOperationId"], "properties": { "bindingId": { "type": "string" }, "topicId": { "type": "string" }, "workState": { "type": "string" }, "health": { "type": "string" }, "lastOperationId": { "type": "string" } } } },
|
|
41
|
+
"deliveryPackets": { "type": "array", "items": { "$ref": "https://topic-protocol.ixo.world/schemas/delivery-packet.schema.json" } },
|
|
42
|
+
"deliveryDecisions": { "type": "array", "items": { "$ref": "https://topic-protocol.ixo.world/schemas/delivery-decision.schema.json" } },
|
|
43
|
+
"evaluations": { "type": "array", "items": { "$ref": "https://topic-protocol.ixo.world/schemas/evaluation-assertion.schema.json" } },
|
|
44
|
+
"approvals": { "type": "array", "items": { "$ref": "https://topic-protocol.ixo.world/schemas/approval-decision.schema.json" } },
|
|
45
|
+
"claims": { "type": "array", "items": { "$ref": "https://topic-protocol.ixo.world/schemas/claim-record.schema.json" } },
|
|
46
|
+
"settlements": { "type": "array", "items": { "$ref": "https://topic-protocol.ixo.world/schemas/settlement-receipt.schema.json" } }
|
|
47
|
+
},
|
|
48
|
+
"additionalProperties": false
|
|
49
|
+
},
|
|
36
50
|
"basedOnEvents": { "type": "array", "items": { "type": "string", "pattern": "^\\$" } },
|
|
37
51
|
"conflicts": { "type": "array", "items": { "type": "string" } }
|
|
38
52
|
},
|