@ixo/topic-protocol 0.7.0 → 1.0.0-rc.1
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 +9 -2
- package/dist/schemas/action-receipt.schema.json +105 -11
- package/dist/schemas/decision-to-pay-template-v2.schema.json +301 -0
- package/dist/schemas/decision-to-pay-template.schema.json +346 -0
- package/dist/schemas/payable-obligation-v2.schema.json +319 -0
- package/dist/schemas/payable-obligation.schema.json +312 -0
- package/dist/schemas/payment-terms-v2.schema.json +238 -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-body.schema.json +66 -0
- package/dist/schemas/topic-contract-state.schema.json +70 -276
- 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-recipe.schema.json +19 -0
- package/dist/schemas/topic-root.schema.json +17 -1
- package/dist/schemas/topic-shape.schema.json +79 -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 +4706 -966
- package/dist/src/contracts/schemas.js +22 -0
- package/dist/src/contracts/schemas.js.map +1 -1
- package/dist/src/contracts/topic-contract.d.ts +38 -6
- package/dist/src/contracts/topic-contract.js +3 -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 +12 -3
- package/dist/src/index.js +11 -2
- 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 +22 -4
- package/dist/src/projector/types.js.map +1 -1
- package/dist/src/shapes/canonical.d.ts +2 -0
- package/dist/src/shapes/canonical.js +20 -0
- package/dist/src/shapes/canonical.js.map +1 -0
- package/dist/src/shapes/claims.d.ts +12 -0
- package/dist/src/shapes/claims.js +20 -0
- package/dist/src/shapes/claims.js.map +1 -0
- package/dist/src/shapes/now.d.ts +2 -0
- package/dist/src/shapes/now.js +42 -0
- package/dist/src/shapes/now.js.map +1 -0
- package/dist/src/shapes/progress.d.ts +3 -0
- package/dist/src/shapes/progress.js +176 -0
- package/dist/src/shapes/progress.js.map +1 -0
- package/dist/src/shapes/recipes.d.ts +5 -0
- package/dist/src/shapes/recipes.js +337 -0
- package/dist/src/shapes/recipes.js.map +1 -0
- package/dist/src/shapes/resolver.d.ts +14 -0
- package/dist/src/shapes/resolver.js +111 -0
- package/dist/src/shapes/resolver.js.map +1 -0
- package/dist/src/shapes/state.d.ts +53 -0
- package/dist/src/shapes/state.js +2 -0
- package/dist/src/shapes/state.js.map +1 -0
- package/dist/src/shapes/types.d.ts +241 -0
- package/dist/src/shapes/types.js +42 -0
- package/dist/src/shapes/types.js.map +1 -0
- package/package.json +6 -2
- package/recipes/README.md +12 -0
- package/recipes/agent-delivery.json +607 -0
- package/recipes/registry.json +41 -0
- package/recipes/research-brief.json +460 -0
- package/recipes/verified-work-payment.json +663 -0
- package/templates/decision-to-pay/README.md +67 -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
- package/templates/decision-to-pay/verified-work-payment.v0.2.template.json +319 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://topic-protocol.ixo.world/schemas/payable-obligation-v2.schema.json",
|
|
4
|
+
"title": "IXO Claims-native Payable Obligation projection v2",
|
|
5
|
+
"description": "A read-only projection of authoritative Deed, AuthZ and IXO Claims module state. It cannot approve, evaluate, settle or reverse payment.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"$schema",
|
|
9
|
+
"version",
|
|
10
|
+
"type",
|
|
11
|
+
"id",
|
|
12
|
+
"projectionAuthority",
|
|
13
|
+
"observedAt",
|
|
14
|
+
"observedHeight",
|
|
15
|
+
"deedDid",
|
|
16
|
+
"topicId",
|
|
17
|
+
"state",
|
|
18
|
+
"paymentTerms",
|
|
19
|
+
"collection",
|
|
20
|
+
"acceptedBid",
|
|
21
|
+
"submitAuthorization",
|
|
22
|
+
"intent",
|
|
23
|
+
"claim",
|
|
24
|
+
"evaluation",
|
|
25
|
+
"payment",
|
|
26
|
+
"disputes",
|
|
27
|
+
"sourceRefs"
|
|
28
|
+
],
|
|
29
|
+
"properties": {
|
|
30
|
+
"$schema": { "type": "string", "minLength": 1 },
|
|
31
|
+
"version": { "const": 2 },
|
|
32
|
+
"type": { "const": "org.ixo.payable-obligation" },
|
|
33
|
+
"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}$" },
|
|
34
|
+
"projectionAuthority": { "const": "ixo_claims_module" },
|
|
35
|
+
"observedAt": { "type": "string", "format": "date-time" },
|
|
36
|
+
"observedHeight": { "$ref": "#/$defs/positiveUint" },
|
|
37
|
+
"deedDid": { "$ref": "#/$defs/did" },
|
|
38
|
+
"topicId": { "$ref": "#/$defs/topicId" },
|
|
39
|
+
"state": {
|
|
40
|
+
"enum": [
|
|
41
|
+
"awaiting_authorization",
|
|
42
|
+
"awaiting_intent",
|
|
43
|
+
"intent_active",
|
|
44
|
+
"claim_submitted",
|
|
45
|
+
"awaiting_evaluation",
|
|
46
|
+
"flagged",
|
|
47
|
+
"approved",
|
|
48
|
+
"rejected",
|
|
49
|
+
"invalidated",
|
|
50
|
+
"paid",
|
|
51
|
+
"payment_failed",
|
|
52
|
+
"disputed"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"paymentTerms": { "$ref": "#/$defs/resourceRef" },
|
|
56
|
+
"collection": { "$ref": "#/$defs/collectionProjection" },
|
|
57
|
+
"acceptedBid": { "$ref": "#/$defs/bidProjection" },
|
|
58
|
+
"submitAuthorization": { "$ref": "#/$defs/authorizationProjection" },
|
|
59
|
+
"intent": { "$ref": "#/$defs/intentProjection" },
|
|
60
|
+
"claim": { "$ref": "#/$defs/claimProjection" },
|
|
61
|
+
"evaluation": { "$ref": "#/$defs/evaluationProjection" },
|
|
62
|
+
"payment": { "$ref": "#/$defs/paymentProjection" },
|
|
63
|
+
"disputes": { "type": "array", "items": { "$ref": "#/$defs/disputeProjection" } },
|
|
64
|
+
"sourceRefs": {
|
|
65
|
+
"type": "array",
|
|
66
|
+
"minItems": 3,
|
|
67
|
+
"items": { "$ref": "#/$defs/resourceRef" }
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"additionalProperties": false,
|
|
71
|
+
"allOf": [
|
|
72
|
+
{
|
|
73
|
+
"if": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"properties": {
|
|
76
|
+
"evaluation": {
|
|
77
|
+
"type": "object",
|
|
78
|
+
"properties": { "status": { "enum": ["APPROVED", "REJECTED", "FLAGGED", "INVALIDATED"] } },
|
|
79
|
+
"required": ["status"]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"required": ["evaluation"]
|
|
83
|
+
},
|
|
84
|
+
"then": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"properties": {
|
|
87
|
+
"evaluation": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"properties": {
|
|
90
|
+
"chain": { "$ref": "#/$defs/chainRef" },
|
|
91
|
+
"receipt": { "$ref": "#/$defs/receiptProjection" }
|
|
92
|
+
},
|
|
93
|
+
"required": ["chain", "receipt"]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"if": {
|
|
100
|
+
"type": "object",
|
|
101
|
+
"properties": {
|
|
102
|
+
"evaluation": {
|
|
103
|
+
"type": "object",
|
|
104
|
+
"properties": { "status": { "const": "FLAGGED" } },
|
|
105
|
+
"required": ["status"]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"then": {
|
|
110
|
+
"type": "object",
|
|
111
|
+
"properties": {
|
|
112
|
+
"state": { "const": "flagged" },
|
|
113
|
+
"payment": {
|
|
114
|
+
"type": "object",
|
|
115
|
+
"properties": { "status": { "enum": ["NO_PAYMENT", "PROMISED", "GUARANTEED"] } }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"if": {
|
|
122
|
+
"type": "object",
|
|
123
|
+
"properties": {
|
|
124
|
+
"payment": {
|
|
125
|
+
"type": "object",
|
|
126
|
+
"properties": { "status": { "const": "PAID" } },
|
|
127
|
+
"required": ["status"]
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"then": {
|
|
132
|
+
"type": "object",
|
|
133
|
+
"properties": {
|
|
134
|
+
"state": { "const": "paid" },
|
|
135
|
+
"evaluation": {
|
|
136
|
+
"type": "object",
|
|
137
|
+
"properties": { "status": { "const": "APPROVED" } },
|
|
138
|
+
"required": ["status"]
|
|
139
|
+
},
|
|
140
|
+
"payment": {
|
|
141
|
+
"type": "object",
|
|
142
|
+
"properties": { "chain": { "$ref": "#/$defs/chainRef" } },
|
|
143
|
+
"required": ["chain"]
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"if": {
|
|
150
|
+
"type": "object",
|
|
151
|
+
"properties": { "state": { "const": "disputed" } },
|
|
152
|
+
"required": ["state"]
|
|
153
|
+
},
|
|
154
|
+
"then": {
|
|
155
|
+
"type": "object",
|
|
156
|
+
"properties": { "disputes": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/disputeProjection" } } }
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
"$defs": {
|
|
161
|
+
"did": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
|
|
162
|
+
"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}$" },
|
|
163
|
+
"digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
|
|
164
|
+
"positiveUint": { "type": "string", "pattern": "^[1-9][0-9]*$" },
|
|
165
|
+
"uint": { "type": "string", "pattern": "^(0|[1-9][0-9]*)$" },
|
|
166
|
+
"address": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
167
|
+
"chainRef": {
|
|
168
|
+
"type": "object",
|
|
169
|
+
"required": ["txHash", "height"],
|
|
170
|
+
"properties": {
|
|
171
|
+
"txHash": { "type": "string", "pattern": "^[0-9A-Fa-f]{64}$" },
|
|
172
|
+
"height": { "$ref": "#/$defs/positiveUint" }
|
|
173
|
+
},
|
|
174
|
+
"additionalProperties": false
|
|
175
|
+
},
|
|
176
|
+
"resourceRef": {
|
|
177
|
+
"type": "object",
|
|
178
|
+
"required": ["type", "ref", "digest"],
|
|
179
|
+
"properties": {
|
|
180
|
+
"type": { "type": "string", "minLength": 1 },
|
|
181
|
+
"ref": { "type": "string", "format": "uri-reference" },
|
|
182
|
+
"digest": { "$ref": "#/$defs/digest" }
|
|
183
|
+
},
|
|
184
|
+
"additionalProperties": false
|
|
185
|
+
},
|
|
186
|
+
"nativeAmount": {
|
|
187
|
+
"type": "object",
|
|
188
|
+
"required": ["denom", "amount"],
|
|
189
|
+
"properties": {
|
|
190
|
+
"denom": { "type": "string", "minLength": 1 },
|
|
191
|
+
"amount": { "$ref": "#/$defs/positiveUint" }
|
|
192
|
+
},
|
|
193
|
+
"additionalProperties": false
|
|
194
|
+
},
|
|
195
|
+
"collectionProjection": {
|
|
196
|
+
"type": "object",
|
|
197
|
+
"required": ["collectionId", "entityDid", "protocolDid", "state", "intentPolicy", "configurationDigest", "created"],
|
|
198
|
+
"properties": {
|
|
199
|
+
"collectionId": { "$ref": "#/$defs/positiveUint" },
|
|
200
|
+
"entityDid": { "$ref": "#/$defs/did" },
|
|
201
|
+
"protocolDid": { "$ref": "#/$defs/did" },
|
|
202
|
+
"state": { "enum": ["OPEN", "PAUSED", "CLOSED"] },
|
|
203
|
+
"intentPolicy": { "enum": ["ALLOW", "DENY", "REQUIRED"] },
|
|
204
|
+
"configurationDigest": { "$ref": "#/$defs/digest" },
|
|
205
|
+
"created": { "$ref": "#/$defs/chainRef" }
|
|
206
|
+
},
|
|
207
|
+
"additionalProperties": false
|
|
208
|
+
},
|
|
209
|
+
"bidProjection": {
|
|
210
|
+
"type": "object",
|
|
211
|
+
"required": ["bidId", "serviceAgentDid", "serviceAgentAddress", "acceptedAt", "termsDigest"],
|
|
212
|
+
"properties": {
|
|
213
|
+
"bidId": { "type": "string", "minLength": 1 },
|
|
214
|
+
"serviceAgentDid": { "$ref": "#/$defs/did" },
|
|
215
|
+
"serviceAgentAddress": { "$ref": "#/$defs/address" },
|
|
216
|
+
"acceptedAt": { "type": "string", "format": "date-time" },
|
|
217
|
+
"termsDigest": { "$ref": "#/$defs/digest" }
|
|
218
|
+
},
|
|
219
|
+
"additionalProperties": false
|
|
220
|
+
},
|
|
221
|
+
"authorizationProjection": {
|
|
222
|
+
"type": "object",
|
|
223
|
+
"required": ["typeUrl", "granter", "grantee", "collectionId", "agentQuota", "maxNativeAmount", "intentDurationNs", "expiresAt", "grant"],
|
|
224
|
+
"properties": {
|
|
225
|
+
"typeUrl": { "const": "/ixo.claims.v1beta1.SubmitClaimAuthorization" },
|
|
226
|
+
"granter": { "$ref": "#/$defs/address" },
|
|
227
|
+
"grantee": { "$ref": "#/$defs/address" },
|
|
228
|
+
"collectionId": { "$ref": "#/$defs/positiveUint" },
|
|
229
|
+
"agentQuota": { "$ref": "#/$defs/positiveUint" },
|
|
230
|
+
"maxNativeAmount": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/nativeAmount" } },
|
|
231
|
+
"intentDurationNs": { "$ref": "#/$defs/uint" },
|
|
232
|
+
"memberAddress": { "$ref": "#/$defs/address" },
|
|
233
|
+
"expiresAt": { "type": "string", "format": "date-time" },
|
|
234
|
+
"grant": { "$ref": "#/$defs/chainRef" },
|
|
235
|
+
"revoked": { "$ref": "#/$defs/chainRef" }
|
|
236
|
+
},
|
|
237
|
+
"additionalProperties": false
|
|
238
|
+
},
|
|
239
|
+
"intentProjection": {
|
|
240
|
+
"type": "object",
|
|
241
|
+
"required": ["required", "status"],
|
|
242
|
+
"properties": {
|
|
243
|
+
"required": { "type": "boolean" },
|
|
244
|
+
"intentId": { "$ref": "#/$defs/positiveUint" },
|
|
245
|
+
"status": { "enum": ["NOT_CREATED", "ACTIVE", "FULFILLED", "EXPIRED"] },
|
|
246
|
+
"amount": { "type": "array", "items": { "$ref": "#/$defs/nativeAmount" } },
|
|
247
|
+
"expiresAt": { "type": "string", "format": "date-time" },
|
|
248
|
+
"chain": { "$ref": "#/$defs/chainRef" }
|
|
249
|
+
},
|
|
250
|
+
"additionalProperties": false
|
|
251
|
+
},
|
|
252
|
+
"claimProjection": {
|
|
253
|
+
"type": "object",
|
|
254
|
+
"required": ["claimId", "collectionId", "agentDid", "agentAddress", "useIntent", "evidenceDigest", "chain"],
|
|
255
|
+
"properties": {
|
|
256
|
+
"claimId": { "type": "string", "minLength": 1 },
|
|
257
|
+
"collectionId": { "$ref": "#/$defs/positiveUint" },
|
|
258
|
+
"agentDid": { "$ref": "#/$defs/did" },
|
|
259
|
+
"agentAddress": { "$ref": "#/$defs/address" },
|
|
260
|
+
"useIntent": { "type": "boolean" },
|
|
261
|
+
"evidenceDigest": { "$ref": "#/$defs/digest" },
|
|
262
|
+
"chain": { "$ref": "#/$defs/chainRef" }
|
|
263
|
+
},
|
|
264
|
+
"additionalProperties": false
|
|
265
|
+
},
|
|
266
|
+
"receiptProjection": {
|
|
267
|
+
"type": "object",
|
|
268
|
+
"required": ["udid", "cid", "digest", "issuerDid", "signatureVerified", "claimDigest", "rubricDigest"],
|
|
269
|
+
"properties": {
|
|
270
|
+
"udid": { "type": "string", "minLength": 1 },
|
|
271
|
+
"cid": { "type": "string", "minLength": 1 },
|
|
272
|
+
"digest": { "$ref": "#/$defs/digest" },
|
|
273
|
+
"issuerDid": { "$ref": "#/$defs/did" },
|
|
274
|
+
"signatureVerified": { "const": true },
|
|
275
|
+
"claimDigest": { "$ref": "#/$defs/digest" },
|
|
276
|
+
"rubricDigest": { "$ref": "#/$defs/digest" }
|
|
277
|
+
},
|
|
278
|
+
"additionalProperties": false
|
|
279
|
+
},
|
|
280
|
+
"evaluationProjection": {
|
|
281
|
+
"type": "object",
|
|
282
|
+
"required": ["status"],
|
|
283
|
+
"properties": {
|
|
284
|
+
"status": { "enum": ["PENDING", "APPROVED", "REJECTED", "FLAGGED", "INVALIDATED"] },
|
|
285
|
+
"evaluatorDid": { "$ref": "#/$defs/did" },
|
|
286
|
+
"oracleDid": { "$ref": "#/$defs/did" },
|
|
287
|
+
"reason": { "type": "integer", "minimum": 0 },
|
|
288
|
+
"receipt": { "$ref": "#/$defs/receiptProjection" },
|
|
289
|
+
"chain": { "$ref": "#/$defs/chainRef" },
|
|
290
|
+
"history": { "type": "array", "items": { "$ref": "#/$defs/chainRef" } }
|
|
291
|
+
},
|
|
292
|
+
"additionalProperties": false
|
|
293
|
+
},
|
|
294
|
+
"paymentProjection": {
|
|
295
|
+
"type": "object",
|
|
296
|
+
"required": ["status", "amount"],
|
|
297
|
+
"properties": {
|
|
298
|
+
"status": { "enum": ["NO_PAYMENT", "PROMISED", "AUTHORIZED", "GUARANTEED", "PAID", "FAILED", "DISPUTED_PAYMENT"] },
|
|
299
|
+
"amount": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/nativeAmount" } },
|
|
300
|
+
"chain": { "$ref": "#/$defs/chainRef" }
|
|
301
|
+
},
|
|
302
|
+
"additionalProperties": false
|
|
303
|
+
},
|
|
304
|
+
"disputeProjection": {
|
|
305
|
+
"type": "object",
|
|
306
|
+
"required": ["proof", "targetRole", "status", "deposit", "opened"],
|
|
307
|
+
"properties": {
|
|
308
|
+
"proof": { "type": "string", "minLength": 1 },
|
|
309
|
+
"targetRole": { "enum": ["SUBMITTER", "EVALUATOR"] },
|
|
310
|
+
"status": { "enum": ["OPEN", "AWARDED", "DISMISSED"] },
|
|
311
|
+
"deposit": { "$ref": "#/$defs/nativeAmount" },
|
|
312
|
+
"opened": { "$ref": "#/$defs/chainRef" },
|
|
313
|
+
"resolved": { "$ref": "#/$defs/chainRef" },
|
|
314
|
+
"adjudicatorDid": { "$ref": "#/$defs/did" }
|
|
315
|
+
},
|
|
316
|
+
"additionalProperties": false
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
@@ -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
|
+
}
|