@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.
Files changed (58) hide show
  1. package/README.md +6 -2
  2. package/dist/schemas/action-receipt.schema.json +105 -11
  3. package/dist/schemas/approval-decision.schema.json +30 -0
  4. package/dist/schemas/claim-record.schema.json +30 -0
  5. package/dist/schemas/decision-to-pay-template.schema.json +346 -0
  6. package/dist/schemas/delivery-decision.schema.json +28 -0
  7. package/dist/schemas/delivery-packet.schema.json +58 -0
  8. package/dist/schemas/evaluation-assertion.schema.json +37 -0
  9. package/dist/schemas/external-work-binding.schema.json +83 -0
  10. package/dist/schemas/external-work-state-map.schema.json +29 -0
  11. package/dist/schemas/payable-obligation.schema.json +312 -0
  12. package/dist/schemas/payment-terms.schema.json +287 -0
  13. package/dist/schemas/settlement-receipt.schema.json +53 -0
  14. package/dist/schemas/topic-action-request.schema.json +30 -0
  15. package/dist/schemas/topic-contract-state.schema.json +29 -3
  16. package/dist/schemas/topic-flow-binding.schema.json +28 -0
  17. package/dist/schemas/topic-kind-profile.schema.json +32 -2
  18. package/dist/schemas/topic-operation.schema.json +2 -2
  19. package/dist/schemas/topic-state.schema.json +14 -0
  20. package/dist/schemas/work-item-snapshot.schema.json +73 -0
  21. package/dist/src/action-runtime/types.d.ts +101 -0
  22. package/dist/src/action-runtime/types.js +12 -0
  23. package/dist/src/action-runtime/types.js.map +1 -0
  24. package/dist/src/contracts/schemas.d.ts +3611 -130
  25. package/dist/src/contracts/schemas.js +28 -0
  26. package/dist/src/contracts/schemas.js.map +1 -1
  27. package/dist/src/contracts/topic-contract.d.ts +8 -1
  28. package/dist/src/contracts/topic-contract.js.map +1 -1
  29. package/dist/src/contracts/topic-kind-profile.d.ts +29 -0
  30. package/dist/src/contracts/topic-kind-profile.js +31 -0
  31. package/dist/src/contracts/topic-kind-profile.js.map +1 -1
  32. package/dist/src/errors.d.ts +1 -1
  33. package/dist/src/errors.js.map +1 -1
  34. package/dist/src/index.d.ts +4 -1
  35. package/dist/src/index.js +4 -1
  36. package/dist/src/index.js.map +1 -1
  37. package/dist/src/projector/payload.d.ts +47 -0
  38. package/dist/src/projector/payload.js +140 -2
  39. package/dist/src/projector/payload.js.map +1 -1
  40. package/dist/src/projector/state.js +150 -0
  41. package/dist/src/projector/state.js.map +1 -1
  42. package/dist/src/projector/types.d.ts +15 -3
  43. package/dist/src/projector/types.js.map +1 -1
  44. package/dist/src/work-bridge/mapping.d.ts +2 -0
  45. package/dist/src/work-bridge/mapping.js +17 -0
  46. package/dist/src/work-bridge/mapping.js.map +1 -0
  47. package/dist/src/work-bridge/project.d.ts +7 -0
  48. package/dist/src/work-bridge/project.js +262 -0
  49. package/dist/src/work-bridge/project.js.map +1 -0
  50. package/dist/src/work-bridge/types.d.ts +232 -0
  51. package/dist/src/work-bridge/types.js +26 -0
  52. package/dist/src/work-bridge/types.js.map +1 -0
  53. package/package.json +4 -2
  54. package/templates/decision-to-pay/README.md +59 -0
  55. package/templates/decision-to-pay/milestone-payment-release.template.json +195 -0
  56. package/templates/decision-to-pay/outcome-payment-claim.template.json +198 -0
  57. package/templates/decision-to-pay/payment-on-delivery.template.json +198 -0
  58. package/templates/decision-to-pay/verified-work-payment.template.json +283 -0
@@ -0,0 +1,58 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/delivery-packet.schema.json",
4
+ "title": "Delivery Packet v1",
5
+ "type": "object",
6
+ "required": ["version", "deliveryPacketId", "sequence", "topicId", "bindingId", "contract", "workItemSnapshot", "deliverables", "evidence", "traces", "submittedBy", "submittedAt", "capability", "status", "digest"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "deliveryPacketId": { "$ref": "#/$defs/uuidV7" },
10
+ "sequence": { "type": "integer", "minimum": 1 },
11
+ "topicId": { "$ref": "#/$defs/topicId" },
12
+ "bindingId": { "$ref": "#/$defs/uuidV7" },
13
+ "supersedes": { "$ref": "#/$defs/uuidV7" },
14
+ "contract": {
15
+ "type": "object",
16
+ "required": ["revision", "digest", "status"],
17
+ "properties": {
18
+ "revision": { "type": "string", "minLength": 1 },
19
+ "digest": { "$ref": "#/$defs/digest" },
20
+ "status": { "const": "accepted" }
21
+ },
22
+ "additionalProperties": false
23
+ },
24
+ "workItemSnapshot": {
25
+ "type": "object",
26
+ "required": ["snapshotId", "ref", "digest"],
27
+ "properties": {
28
+ "snapshotId": { "$ref": "#/$defs/uuidV7" },
29
+ "ref": { "type": "string", "format": "uri" },
30
+ "digest": { "$ref": "#/$defs/digest" }
31
+ },
32
+ "additionalProperties": false
33
+ },
34
+ "deliverables": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/artifact" } },
35
+ "evidence": { "type": "array", "items": { "$ref": "#/$defs/evidence" } },
36
+ "traces": { "type": "array", "items": { "$ref": "#/$defs/artifact" } },
37
+ "paymentTerms": {
38
+ "type": "object",
39
+ "required": ["ref", "digest"],
40
+ "properties": { "ref": { "type": "string", "format": "uri" }, "digest": { "$ref": "#/$defs/digest" } },
41
+ "additionalProperties": false
42
+ },
43
+ "submittedBy": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
44
+ "submittedAt": { "type": "string", "format": "date-time" },
45
+ "capability": { "type": "string", "minLength": 1 },
46
+ "status": { "const": "submitted" },
47
+ "digest": { "$ref": "#/$defs/digest" },
48
+ "extensions": { "type": "object" }
49
+ },
50
+ "$defs": {
51
+ "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}$" },
52
+ "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}$" },
53
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
54
+ "artifact": { "type": "object", "required": ["type", "uri", "digest"], "properties": { "type": { "type": "string", "minLength": 1 }, "uri": { "type": "string", "format": "uri" }, "digest": { "$ref": "#/$defs/digest" }, "label": { "type": "string", "minLength": 1 }, "mediaType": { "type": "string", "minLength": 1 } }, "additionalProperties": false },
55
+ "evidence": { "type": "object", "required": ["type", "uri", "digest", "provenanceClass"], "properties": { "type": { "type": "string", "minLength": 1 }, "uri": { "type": "string", "format": "uri" }, "digest": { "$ref": "#/$defs/digest" }, "provenanceClass": { "enum": ["claimant_provided", "client_assisted", "server_verified", "third_party_attested"] }, "label": { "type": "string", "minLength": 1 } }, "additionalProperties": false }
56
+ },
57
+ "additionalProperties": false
58
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/evaluation-assertion.schema.json",
4
+ "title": "Evaluation assertion v1",
5
+ "type": "object",
6
+ "required": ["version", "evaluationId", "topicId", "deliveryPacketId", "deliveryPacketDigest", "rubric", "evidenceDigests", "traceDigests", "outcome", "result", "evaluatorDid", "evaluatedAt", "capability", "signature", "digest"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "evaluationId": { "$ref": "#/$defs/uuidV7" },
10
+ "topicId": { "$ref": "#/$defs/topicId" },
11
+ "deliveryPacketId": { "$ref": "#/$defs/uuidV7" },
12
+ "deliveryPacketDigest": { "$ref": "#/$defs/digest" },
13
+ "rubric": {
14
+ "type": "object",
15
+ "required": ["id", "version", "ref", "digest", "governanceStatus"],
16
+ "properties": { "id": { "type": "string", "minLength": 1 }, "version": { "type": "string", "minLength": 1 }, "ref": { "type": "string", "format": "uri" }, "digest": { "$ref": "#/$defs/digest" }, "governanceStatus": { "const": "approved" } },
17
+ "additionalProperties": false
18
+ },
19
+ "evidenceDigests": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/digest" } },
20
+ "traceDigests": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/digest" } },
21
+ "outcome": { "enum": ["supported", "refuted", "insufficient_evidence", "human_review", "disputed", "superseded"] },
22
+ "confidence": { "type": "number", "minimum": 0, "maximum": 1 },
23
+ "result": { "type": "object" },
24
+ "evaluatorDid": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
25
+ "evaluatedAt": { "type": "string", "format": "date-time" },
26
+ "capability": { "type": "string", "minLength": 1 },
27
+ "signature": { "type": "object", "required": ["type", "verificationMethod", "value"], "properties": { "type": { "type": "string", "minLength": 1 }, "verificationMethod": { "type": "string", "format": "uri" }, "value": { "type": "string", "minLength": 1 } }, "additionalProperties": false },
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
+ }
@@ -0,0 +1,83 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/external-work-binding.schema.json",
4
+ "title": "External work binding v1",
5
+ "type": "object",
6
+ "required": ["version", "bindingId", "topicId", "role", "createdFrom", "external", "syncPolicy", "workState", "checkpoint", "identity", "health", "createdBy", "createdAt"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "bindingId": { "$ref": "#/$defs/uuidV7" },
10
+ "topicId": { "$ref": "#/$defs/topicId" },
11
+ "role": { "enum": ["primary", "child", "related", "verification", "delivery"] },
12
+ "createdFrom": { "enum": ["topic", "external"] },
13
+ "external": {
14
+ "type": "object",
15
+ "required": ["provider", "resourceType", "organizationId", "resourceId", "identifier", "url"],
16
+ "properties": {
17
+ "provider": { "type": "string", "pattern": "^[a-z][a-z0-9.-]{0,63}$" },
18
+ "resourceType": { "type": "string", "minLength": 1, "maxLength": 80 },
19
+ "organizationId": { "type": "string", "minLength": 1, "maxLength": 256 },
20
+ "teamId": { "type": "string", "minLength": 1, "maxLength": 256 },
21
+ "resourceId": { "type": "string", "minLength": 1, "maxLength": 256 },
22
+ "identifier": { "type": "string", "minLength": 1, "maxLength": 128 },
23
+ "url": { "type": "string", "format": "uri" }
24
+ },
25
+ "additionalProperties": false
26
+ },
27
+ "syncPolicy": {
28
+ "type": "object",
29
+ "required": ["mode", "direction", "comments", "files", "delete", "fieldPolicy"],
30
+ "properties": {
31
+ "mode": { "enum": ["link_only", "governed_projection"] },
32
+ "direction": { "enum": ["external_to_topic", "topic_to_external", "bidirectional"] },
33
+ "comments": { "enum": ["none", "explicit_promote"] },
34
+ "files": { "enum": ["none", "reference_only", "explicit_ingest"] },
35
+ "delete": { "const": "tombstone" },
36
+ "fieldPolicy": {
37
+ "type": "object",
38
+ "required": ["id", "version", "digest"],
39
+ "properties": {
40
+ "id": { "type": "string", "format": "uri" },
41
+ "version": { "type": "integer", "minimum": 1 },
42
+ "digest": { "$ref": "#/$defs/digest" }
43
+ },
44
+ "additionalProperties": false
45
+ }
46
+ },
47
+ "additionalProperties": false
48
+ },
49
+ "workState": { "enum": ["planned", "ready", "in_progress", "blocked", "handoff_ready", "handed_off", "cancelled"] },
50
+ "checkpoint": {
51
+ "type": "object",
52
+ "required": ["topicRevision", "syncedAt"],
53
+ "properties": {
54
+ "topicRevision": { "type": "string", "minLength": 1 },
55
+ "effectiveContractDigest": { "$ref": "#/$defs/digest" },
56
+ "externalUpdatedAt": { "type": "string", "format": "date-time" },
57
+ "externalSnapshotDigest": { "$ref": "#/$defs/digest" },
58
+ "lastEventId": { "type": "string", "minLength": 1, "maxLength": 256 },
59
+ "syncedAt": { "type": "string", "format": "date-time" }
60
+ },
61
+ "additionalProperties": false
62
+ },
63
+ "identity": {
64
+ "type": "object",
65
+ "required": ["bridgeDid"],
66
+ "properties": {
67
+ "bridgeDid": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
68
+ "externalAppActorId": { "type": "string", "minLength": 1, "maxLength": 256 }
69
+ },
70
+ "additionalProperties": false
71
+ },
72
+ "health": { "enum": ["up_to_date", "changes_pending", "degraded", "disconnected", "conflicted", "permission_lost"] },
73
+ "createdBy": { "type": "string", "minLength": 1 },
74
+ "createdAt": { "type": "string", "format": "date-time" },
75
+ "extensions": { "type": "object" }
76
+ },
77
+ "$defs": {
78
+ "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}$" },
79
+ "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}$" },
80
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
81
+ },
82
+ "additionalProperties": false
83
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://topic-protocol.ixo.world/schemas/external-work-state-map.schema.json",
4
+ "title": "External work state mapping profile v1",
5
+ "type": "object",
6
+ "required": ["version", "profileId", "provider", "organizationId", "teamId", "mappings"],
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "profileId": { "type": "string", "format": "uri" },
10
+ "provider": { "type": "string", "pattern": "^[a-z][a-z0-9.-]{0,63}$" },
11
+ "organizationId": { "type": "string", "minLength": 1, "maxLength": 256 },
12
+ "teamId": { "type": "string", "minLength": 1, "maxLength": 256 },
13
+ "mappings": {
14
+ "type": "array",
15
+ "minItems": 1,
16
+ "items": {
17
+ "type": "object",
18
+ "required": ["workflowStateId", "category", "workState"],
19
+ "properties": {
20
+ "workflowStateId": { "type": "string", "minLength": 1, "maxLength": 256 },
21
+ "category": { "enum": ["triage", "backlog", "unstarted", "started", "completed", "canceled"] },
22
+ "workState": { "enum": ["planned", "ready", "in_progress", "blocked", "handoff_ready", "handed_off", "cancelled"] }
23
+ },
24
+ "additionalProperties": false
25
+ }
26
+ }
27
+ },
28
+ "additionalProperties": false
29
+ }
@@ -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
+ }