@mdbase-dev/connect-protocol 0.1.0-beta.100

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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/dist/application-authorization.d.ts +32 -0
  3. package/dist/application-authorization.js +207 -0
  4. package/dist/capabilities.d.ts +73 -0
  5. package/dist/capabilities.js +92 -0
  6. package/dist/collection-setup.d.ts +90 -0
  7. package/dist/collection-setup.js +1 -0
  8. package/dist/compatibility.d.ts +37 -0
  9. package/dist/compatibility.js +65 -0
  10. package/dist/connect-problems.generated.d.ts +1388 -0
  11. package/dist/connect-problems.generated.js +574 -0
  12. package/dist/files.d.ts +269 -0
  13. package/dist/files.js +426 -0
  14. package/dist/index.d.ts +878 -0
  15. package/dist/index.js +94 -0
  16. package/dist/manifest.d.ts +62 -0
  17. package/dist/manifest.js +527 -0
  18. package/dist/mutation-fingerprint.d.ts +6 -0
  19. package/dist/mutation-fingerprint.js +116 -0
  20. package/dist/operations.d.ts +15 -0
  21. package/dist/operations.js +194 -0
  22. package/dist/type-packs.d.ts +133 -0
  23. package/dist/type-packs.js +30 -0
  24. package/package.json +42 -0
  25. package/schemas/application-capability-catalog.v1.json +40 -0
  26. package/schemas/application-capability-catalog.v2.json +68 -0
  27. package/schemas/catalog.json +17 -0
  28. package/schemas/connect-problem.v1.schema.json +5132 -0
  29. package/schemas/connect-problems.v1.catalog.json +351 -0
  30. package/schemas/connect-protocol.v1.schema.json +800 -0
  31. package/schemas/data-contract.schema.json +163 -0
  32. package/schemas/encrypted-relay.v1.schema.json +63 -0
  33. package/schemas/encrypted-relay.v2.schema.json +63 -0
  34. package/schemas/encrypted-relay.v3.schema.json +64 -0
  35. package/schemas/files.v1.schema.json +507 -0
  36. package/schemas/interop/v0.1/action-cancellation.schema.json +6 -0
  37. package/schemas/interop/v0.1/action-invocation.schema.json +6 -0
  38. package/schemas/interop/v0.1/action-outcome.schema.json +6 -0
  39. package/schemas/interop/v0.1/action-provider-declaration.schema.json +6 -0
  40. package/schemas/interop/v0.1/action-request.schema.json +6 -0
  41. package/schemas/interop/v0.1/conformance-claim.schema.json +6 -0
  42. package/schemas/interop/v0.1/event-source-declaration.schema.json +6 -0
  43. package/schemas/interop/v0.1/event.schema.json +6 -0
  44. package/schemas/interop/v0.1/profile.schema.json +456 -0
  45. package/schemas/mdbase-app.legacy-v1.schema.json +405 -0
  46. package/schemas/mdbase-app.schema.json +381 -0
  47. package/schemas/mdbase-query.v0.3.schema.json +171 -0
  48. package/schemas/notification-webhook.v1.schema.json +56 -0
  49. package/schemas/operation-catalog.v1.json +42 -0
  50. package/schemas/operation-mutation-classification.v1.json +537 -0
  51. package/schemas/sync.v1.schema.json +483 -0
@@ -0,0 +1,800 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://mdbase.dev/connect/schemas/connect-protocol.v1.json",
4
+ "title": "mdbase connect protocol 1",
5
+ "description": "Canonical wire shapes shared by applications, the control plane, and connectors.",
6
+ "oneOf": [
7
+ { "$ref": "#/$defs/relayHello" },
8
+ { "$ref": "#/$defs/relayWelcome" },
9
+ { "$ref": "#/$defs/relayIncompatible" },
10
+ { "$ref": "#/$defs/relayOperationRequest" },
11
+ { "$ref": "#/$defs/relayOperationResponse" },
12
+ { "$ref": "#/$defs/relayPolicySnapshot" },
13
+ { "$ref": "#/$defs/relayPolicyApplied" },
14
+ { "$ref": "#/$defs/authorizationOfferRequest" },
15
+ { "$ref": "#/$defs/authorizationOfferResponse" },
16
+ { "$ref": "#/$defs/authorizationActivationRequest" },
17
+ { "$ref": "#/$defs/authorizationActivationResponse" }
18
+ ],
19
+ "$defs": {
20
+ "uuid": {
21
+ "type": "string",
22
+ "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
23
+ },
24
+ "operation": {
25
+ "enum": ["describe", "changes", "read", "query", "list_views", "execute_view", "read_view_source", "create_view_source", "update_view_source", "delete_view_source", "validate", "create", "update", "delete", "rename", "read_type", "create_type", "update_type", "assess_type_pack", "apply_type_pack", "assess_collection_setup", "apply_collection_setup", "list_timers", "put_timer", "cancel_timer", "reconcile_timers", "sync"]
26
+ },
27
+ "connectContractRequirements": {
28
+ "type": "object",
29
+ "additionalProperties": false,
30
+ "required": ["operation_transport", "authorization_binding", "semantic_capabilities"],
31
+ "properties": {
32
+ "operation_transport": { "type": "integer", "minimum": 1 },
33
+ "authorization_binding": { "type": "integer", "minimum": 1 },
34
+ "semantic_capabilities": { "type": "integer", "minimum": 1 },
35
+ "durable_mutation": { "type": "integer", "minimum": 1 }
36
+ }
37
+ },
38
+ "connectContractSupport": {
39
+ "type": "object",
40
+ "additionalProperties": false,
41
+ "required": ["operation_transport", "authorization_binding", "semantic_capabilities", "durable_mutation"],
42
+ "properties": {
43
+ "operation_transport": { "$ref": "#/$defs/versionSet" },
44
+ "authorization_binding": { "$ref": "#/$defs/versionSet" },
45
+ "semantic_capabilities": { "$ref": "#/$defs/versionSet" },
46
+ "durable_mutation": { "$ref": "#/$defs/versionSet" }
47
+ }
48
+ },
49
+ "versionSet": {
50
+ "type": "array",
51
+ "minItems": 1,
52
+ "uniqueItems": true,
53
+ "items": { "type": "integer", "minimum": 1 }
54
+ },
55
+ "contractRequirement": {
56
+ "type": "object",
57
+ "additionalProperties": false,
58
+ "required": ["id", "version", "digest"],
59
+ "properties": {
60
+ "id": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$" },
61
+ "version": { "$ref": "#/$defs/semanticVersion" },
62
+ "digest": { "$ref": "#/$defs/digest" }
63
+ }
64
+ },
65
+ "semanticVersion": {
66
+ "type": "string",
67
+ "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$"
68
+ },
69
+ "digest": {
70
+ "type": "string",
71
+ "pattern": "^sha256:[0-9a-f]{64}$"
72
+ },
73
+ "grantScope": {
74
+ "type": "object",
75
+ "additionalProperties": false,
76
+ "required": ["access", "contracts"],
77
+ "properties": {
78
+ "access": { "enum": ["contract", "full_collection"] },
79
+ "contracts": {
80
+ "type": "array",
81
+ "maxItems": 20,
82
+ "items": { "$ref": "#/$defs/collectionContract" }
83
+ }
84
+ }
85
+ },
86
+ "diagnostic": {
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "required": ["severity", "code", "message"],
90
+ "properties": {
91
+ "severity": { "enum": ["error", "warning", "info"] },
92
+ "code": { "type": "string", "minLength": 1 },
93
+ "message": { "type": "string" },
94
+ "path": { "type": "string" },
95
+ "field": { "type": "string" },
96
+ "type": { "type": "string" },
97
+ "schema_location": { "type": "string" },
98
+ "details": true
99
+ }
100
+ },
101
+ "operationEnvelope": {
102
+ "type": "object",
103
+ "additionalProperties": false,
104
+ "required": ["valid", "result", "diagnostics"],
105
+ "properties": {
106
+ "valid": { "type": "boolean" },
107
+ "result": true,
108
+ "diagnostics": { "type": "array", "items": { "$ref": "#/$defs/diagnostic" } }
109
+ }
110
+ },
111
+ "relayHello": {
112
+ "type": "object",
113
+ "additionalProperties": false,
114
+ "required": ["type", "protocol_version", "connector_version", "capabilities", "contract_support"],
115
+ "properties": {
116
+ "type": { "const": "relay_hello" },
117
+ "protocol_version": { "const": 1 },
118
+ "connector_version": { "type": "string", "minLength": 1, "maxLength": 100 },
119
+ "capabilities": {
120
+ "type": "array",
121
+ "uniqueItems": true,
122
+ "items": { "type": "string", "minLength": 1, "maxLength": 100 }
123
+ },
124
+ "contract_support": { "$ref": "#/$defs/connectContractSupport" }
125
+ }
126
+ },
127
+ "relayWelcome": {
128
+ "type": "object",
129
+ "additionalProperties": false,
130
+ "required": ["type", "protocol_version", "session_id", "capabilities", "contract_support"],
131
+ "properties": {
132
+ "type": { "const": "relay_welcome" },
133
+ "protocol_version": { "const": 1 },
134
+ "session_id": { "type": "string", "minLength": 1, "maxLength": 100 },
135
+ "capabilities": {
136
+ "type": "array",
137
+ "uniqueItems": true,
138
+ "items": { "type": "string", "minLength": 1, "maxLength": 100 }
139
+ },
140
+ "contract_support": { "$ref": "#/$defs/connectContractSupport" }
141
+ }
142
+ },
143
+ "relayIncompatible": {
144
+ "type": "object",
145
+ "additionalProperties": false,
146
+ "required": ["type", "protocol_version", "code", "message", "minimum_connector_version", "update_url"],
147
+ "properties": {
148
+ "type": { "const": "relay_incompatible" },
149
+ "protocol_version": { "const": 1 },
150
+ "code": { "enum": ["connector_upgrade_required", "transport_protocol_incompatible", "authorization_binding_incompatible", "capability_contract_incompatible", "durable_mutation_unsupported"] },
151
+ "message": { "type": "string", "minLength": 1 },
152
+ "details": {
153
+ "type": "object",
154
+ "additionalProperties": false,
155
+ "required": ["contract", "required", "supported", "peer"],
156
+ "properties": {
157
+ "contract": { "enum": ["operation_transport", "authorization_binding", "semantic_capabilities", "durable_mutation"] },
158
+ "required": { "$ref": "#/$defs/versionSet" },
159
+ "supported": { "type": "array", "uniqueItems": true, "items": { "type": "integer", "minimum": 1 } },
160
+ "peer": { "const": "connector" }
161
+ }
162
+ },
163
+ "minimum_connector_version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?$" },
164
+ "update_url": { "type": "string", "format": "uri", "pattern": "^https://" }
165
+ }
166
+ },
167
+ "relayOperationRequest": {
168
+ "type": "object",
169
+ "additionalProperties": false,
170
+ "required": ["type", "protocol_version", "request_id", "grant_id", "collection_id", "application_id", "operation", "input"],
171
+ "properties": {
172
+ "type": { "const": "operation_request" },
173
+ "protocol_version": { "const": 3 },
174
+ "request_id": { "$ref": "#/$defs/uuid" },
175
+ "grant_id": { "$ref": "#/$defs/uuid" },
176
+ "collection_id": { "$ref": "#/$defs/uuid" },
177
+ "application_id": { "$ref": "#/$defs/uuid" },
178
+ "operation": { "$ref": "#/$defs/operation" },
179
+ "input": true
180
+ }
181
+ },
182
+ "operationHttpRequest": {
183
+ "type": "object",
184
+ "additionalProperties": false,
185
+ "required": ["protocol_version", "request_id", "input"],
186
+ "properties": {
187
+ "protocol_version": { "const": 3 },
188
+ "request_id": { "$ref": "#/$defs/uuid" },
189
+ "input": true
190
+ }
191
+ },
192
+ "operationHttpResponse": {
193
+ "type": "object",
194
+ "additionalProperties": false,
195
+ "required": ["protocol_version", "request_id", "ok"],
196
+ "properties": {
197
+ "protocol_version": { "const": 3 },
198
+ "request_id": { "$ref": "#/$defs/uuid" },
199
+ "ok": { "type": "boolean" },
200
+ "result": true,
201
+ "problem": { "$ref": "https://schemas.mdbase.dev/connect/problem/v1" }
202
+ },
203
+ "allOf": [
204
+ {
205
+ "if": { "properties": { "ok": { "const": true } }, "required": ["ok"] },
206
+ "then": {
207
+ "required": ["result"],
208
+ "not": { "properties": { "problem": true }, "required": ["problem"] }
209
+ },
210
+ "else": {
211
+ "required": ["problem"],
212
+ "not": { "properties": { "result": true }, "required": ["result"] }
213
+ }
214
+ }
215
+ ]
216
+ },
217
+ "relayOperationResponse": {
218
+ "type": "object",
219
+ "additionalProperties": false,
220
+ "required": ["type", "protocol_version", "request_id", "ok"],
221
+ "properties": {
222
+ "type": { "const": "operation_response" },
223
+ "protocol_version": { "const": 3 },
224
+ "request_id": { "$ref": "#/$defs/uuid" },
225
+ "ok": { "type": "boolean" },
226
+ "result": true,
227
+ "problem": { "$ref": "https://schemas.mdbase.dev/connect/problem/v1" }
228
+ },
229
+ "allOf": [
230
+ {
231
+ "if": { "properties": { "ok": { "const": true } }, "required": ["ok"] },
232
+ "then": {
233
+ "properties": { "result": true },
234
+ "required": ["result"],
235
+ "not": { "properties": { "problem": true }, "required": ["problem"] }
236
+ },
237
+ "else": {
238
+ "properties": { "problem": true },
239
+ "required": ["problem"],
240
+ "not": { "properties": { "result": true }, "required": ["result"] }
241
+ }
242
+ }
243
+ ]
244
+ },
245
+ "grantPolicy": {
246
+ "type": "object",
247
+ "additionalProperties": false,
248
+ "required": ["id", "application_id", "collection_id", "operations", "scope", "application_name", "application_distribution", "application_homepage", "application_origin", "collection_name", "created_at", "encryption", "application_authorization"],
249
+ "properties": {
250
+ "id": { "$ref": "#/$defs/uuid" },
251
+ "application_id": { "$ref": "#/$defs/uuid" },
252
+ "collection_id": { "$ref": "#/$defs/uuid" },
253
+ "operations": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/operation" } },
254
+ "scope": { "$ref": "#/$defs/grantScope" },
255
+ "application_name": { "type": "string", "minLength": 1 },
256
+ "application_distribution": { "enum": ["web", "portable"] },
257
+ "application_homepage": { "type": "string" },
258
+ "application_project_url": { "type": "string", "format": "uri" },
259
+ "application_origin": {
260
+ "anyOf": [
261
+ { "const": "null" },
262
+ { "type": "string", "format": "uri" }
263
+ ]
264
+ },
265
+ "application_icon": { "type": "string" },
266
+ "collection_name": { "type": "string", "minLength": 1 },
267
+ "notification_criteria": {
268
+ "type": "array",
269
+ "maxItems": 50,
270
+ "items": { "$ref": "#/$defs/notificationCriterion" }
271
+ },
272
+ "created_at": { "type": "string", "format": "date-time" },
273
+ "encryption": { "$ref": "#/$defs/grantEncryption" },
274
+ "file_capability": {
275
+ "$ref": "https://mdbase.dev/connect/schemas/files.v1.json#/$defs/fileCapability"
276
+ },
277
+ "application_declaration": {},
278
+ "application_authorization": { "$ref": "#/$defs/applicationAuthorizationProof" }
279
+ }
280
+ },
281
+ "applicationAuthorizationProof": {
282
+ "type": "object",
283
+ "additionalProperties": false,
284
+ "required": ["binding", "signature"],
285
+ "properties": {
286
+ "binding": { "$ref": "#/$defs/applicationAuthorizationBinding" },
287
+ "signature": { "type": "string", "pattern": "^[A-Za-z0-9_-]{86}$" }
288
+ }
289
+ },
290
+ "applicationAuthorizationBinding": {
291
+ "type": "object",
292
+ "additionalProperties": false,
293
+ "required": ["protocol_version", "authorization_id", "application_id", "application_declaration_id", "application_manifest_digest", "application_installation_id", "installation_signing_public_key", "grant_agreement_public_key", "grant_signing_public_key", "flow", "authorization_nonce", "issued_at", "expires_at", "code_challenge", "contracts", "requested_operations"],
294
+ "properties": {
295
+ "protocol_version": { "const": 4 },
296
+ "authorization_id": { "$ref": "#/$defs/uuid" },
297
+ "application_id": { "$ref": "#/$defs/uuid" },
298
+ "application_declaration_id": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)+$" },
299
+ "application_manifest_digest": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
300
+ "application_installation_id": { "$ref": "#/$defs/uuid" },
301
+ "installation_signing_public_key": { "$ref": "#/$defs/p256PublicKey" },
302
+ "grant_agreement_public_key": { "$ref": "#/$defs/p256PublicKey" },
303
+ "grant_signing_public_key": { "$ref": "#/$defs/p256PublicKey" },
304
+ "flow": { "enum": ["authorization_code", "device_code"] },
305
+ "authorization_nonce": { "type": "string", "pattern": "^[A-Za-z0-9_-]{43}$" },
306
+ "issued_at": { "type": "string", "format": "date-time" },
307
+ "expires_at": { "type": "string", "format": "date-time" },
308
+ "redirect_uri": { "type": "string", "format": "uri" },
309
+ "state": { "type": "string", "maxLength": 500 },
310
+ "code_challenge": { "type": "string", "pattern": "^[A-Za-z0-9_-]{43}$" },
311
+ "contracts": { "$ref": "#/$defs/connectContractRequirements" },
312
+ "requested_operations": {
313
+ "type": "array",
314
+ "uniqueItems": true,
315
+ "items": { "$ref": "#/$defs/operation" }
316
+ },
317
+ "requested_files": {
318
+ "$ref": "https://mdbase.dev/connect/schemas/files.v1.json#/$defs/applicationFileRequirement"
319
+ },
320
+ "collection_id": { "$ref": "#/$defs/uuid" }
321
+ }
322
+ },
323
+ "p256PublicKey": {
324
+ "type": "string",
325
+ "pattern": "^[A-Za-z0-9_-]{87}$"
326
+ },
327
+ "authorizationCollectionOffer": {
328
+ "type": "object",
329
+ "additionalProperties": false,
330
+ "required": ["collection_id", "display_name", "spec_version", "contracts"],
331
+ "properties": {
332
+ "collection_id": { "$ref": "#/$defs/uuid" },
333
+ "display_name": { "type": "string", "minLength": 1, "maxLength": 200 },
334
+ "spec_version": { "type": "string", "minLength": 1, "maxLength": 30 },
335
+ "contracts": {
336
+ "type": "array",
337
+ "maxItems": 100,
338
+ "items": { "$ref": "#/$defs/collectionContract" }
339
+ },
340
+ "types": {
341
+ "type": "array",
342
+ "maxItems": 100,
343
+ "items": { "$ref": "#/$defs/authorizationTypeCandidate" }
344
+ }
345
+ }
346
+ },
347
+ "applicationRequirements": {
348
+ "type": "object",
349
+ "additionalProperties": false,
350
+ "required": ["contracts"],
351
+ "properties": {
352
+ "contracts": {
353
+ "type": "array",
354
+ "maxItems": 20,
355
+ "items": { "$ref": "#/$defs/contractRequirement" }
356
+ },
357
+ "configuration": {
358
+ "type": "array",
359
+ "maxItems": 100,
360
+ "items": { "$ref": "#/$defs/configurationRequirement" }
361
+ },
362
+ "access": { "enum": ["contract", "full_collection"] },
363
+ "collection_kind": { "const": "hosted" },
364
+ "files": {
365
+ "$ref": "https://mdbase.dev/connect/schemas/files.v1.json#/$defs/applicationFileRequirement"
366
+ }
367
+ }
368
+ },
369
+ "typePackProvision": {
370
+ "type": "object",
371
+ "additionalProperties": false,
372
+ "required": ["manifest", "resources", "provides"],
373
+ "properties": {
374
+ "manifest": { "$ref": "#/$defs/typePackManifest" },
375
+ "resources": {
376
+ "type": "array",
377
+ "minItems": 1,
378
+ "maxItems": 100,
379
+ "items": { "$ref": "#/$defs/typePackSourceResource" }
380
+ },
381
+ "provides": {
382
+ "type": "array",
383
+ "maxItems": 20,
384
+ "items": { "$ref": "#/$defs/contractRequirement" }
385
+ }
386
+ }
387
+ },
388
+ "typePackManifest": {
389
+ "type": "object",
390
+ "required": ["kind", "id", "version", "resources"],
391
+ "properties": {
392
+ "kind": { "const": "mdbase.type-pack" },
393
+ "id": { "type": "string", "minLength": 3 },
394
+ "version": { "$ref": "#/$defs/semanticVersion" },
395
+ "name": { "type": "string", "minLength": 1 },
396
+ "description": { "type": "string" },
397
+ "resources": {
398
+ "type": "array",
399
+ "minItems": 1,
400
+ "items": { "$ref": "#/$defs/typePackManifestResource" }
401
+ }
402
+ },
403
+ "patternProperties": { "^x-[A-Za-z][A-Za-z0-9._:-]{0,127}$": true },
404
+ "additionalProperties": false
405
+ },
406
+ "typePackManifestResource": {
407
+ "type": "object",
408
+ "additionalProperties": false,
409
+ "required": ["kind", "mode", "source", "target", "digest"],
410
+ "properties": {
411
+ "kind": { "enum": ["contract", "type", "schema"] },
412
+ "mode": { "enum": ["managed", "seed"] },
413
+ "source": { "type": "string", "minLength": 1, "maxLength": 500 },
414
+ "target": { "type": "string", "minLength": 1, "maxLength": 500 },
415
+ "digest": { "$ref": "#/$defs/digest" }
416
+ }
417
+ },
418
+ "typePackSourceResource": {
419
+ "type": "object",
420
+ "additionalProperties": false,
421
+ "required": ["source", "document"],
422
+ "properties": {
423
+ "source": { "type": "string", "minLength": 1, "maxLength": 500 },
424
+ "document": { "type": "string", "maxLength": 262144 }
425
+ }
426
+ },
427
+ "applicationProvisions": {
428
+ "type": "object",
429
+ "additionalProperties": false,
430
+ "required": ["type_packs"],
431
+ "properties": {
432
+ "type_packs": {
433
+ "type": "array",
434
+ "maxItems": 100,
435
+ "items": { "$ref": "#/$defs/typePackProvision" }
436
+ },
437
+ "configuration": {
438
+ "type": "array",
439
+ "maxItems": 100,
440
+ "items": { "$ref": "#/$defs/configurationProvision" }
441
+ }
442
+ }
443
+ },
444
+ "configurationRequirement": {
445
+ "type": "object",
446
+ "additionalProperties": false,
447
+ "required": ["id", "path", "predicate", "value"],
448
+ "properties": {
449
+ "id": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$" },
450
+ "path": { "type": "string", "pattern": "^/x-[^/]+(?:/.*)?$", "maxLength": 1024 },
451
+ "predicate": { "const": "contains" },
452
+ "value": { "oneOf": [
453
+ { "type": "string" },
454
+ { "type": "number" },
455
+ { "type": "boolean" },
456
+ { "type": "null" }
457
+ ] }
458
+ }
459
+ },
460
+ "configurationProvision": {
461
+ "type": "object",
462
+ "additionalProperties": false,
463
+ "required": ["requirement", "operation", "path", "value"],
464
+ "properties": {
465
+ "requirement": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$" },
466
+ "operation": { "const": "set_add" },
467
+ "path": { "type": "string", "pattern": "^/x-[^/]+(?:/.*)?$", "maxLength": 1024 },
468
+ "value": { "oneOf": [
469
+ { "type": "string" },
470
+ { "type": "number" },
471
+ { "type": "boolean" },
472
+ { "type": "null" }
473
+ ] }
474
+ }
475
+ },
476
+ "authorizationOfferRequest": {
477
+ "type": "object",
478
+ "additionalProperties": false,
479
+ "required": ["type", "protocol_version", "request_id", "authorization_id"],
480
+ "properties": {
481
+ "type": { "const": "authorization_offer_request" },
482
+ "protocol_version": { "const": 1 },
483
+ "request_id": { "$ref": "#/$defs/uuid" },
484
+ "authorization_id": { "$ref": "#/$defs/uuid" },
485
+ "requirements": { "$ref": "#/$defs/applicationRequirements" },
486
+ "provisions": { "$ref": "#/$defs/applicationProvisions" }
487
+ }
488
+ },
489
+ "authorizationOfferResponse": {
490
+ "type": "object",
491
+ "additionalProperties": false,
492
+ "required": ["type", "protocol_version", "request_id", "paused", "collections"],
493
+ "properties": {
494
+ "type": { "const": "authorization_offer_response" },
495
+ "protocol_version": { "const": 1 },
496
+ "request_id": { "$ref": "#/$defs/uuid" },
497
+ "paused": { "type": "boolean" },
498
+ "collections": {
499
+ "type": "array",
500
+ "maxItems": 1000,
501
+ "items": { "$ref": "#/$defs/authorizationCollectionOffer" }
502
+ }
503
+ }
504
+ },
505
+ "authorizationActivationRequest": {
506
+ "type": "object",
507
+ "additionalProperties": false,
508
+ "required": ["type", "protocol_version", "request_id", "authorization_id", "application_declaration_id", "application_manifest_digest", "collection_id", "requirements", "provisions", "contract_setups", "grant"],
509
+ "properties": {
510
+ "type": { "const": "authorization_activation_request" },
511
+ "protocol_version": { "const": 1 },
512
+ "request_id": { "$ref": "#/$defs/uuid" },
513
+ "authorization_id": { "$ref": "#/$defs/uuid" },
514
+ "application_declaration_id": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)+$" },
515
+ "application_manifest_digest": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
516
+ "collection_id": { "$ref": "#/$defs/uuid" },
517
+ "requirements": { "$ref": "#/$defs/applicationRequirements" },
518
+ "provisions": { "$ref": "#/$defs/applicationProvisions" },
519
+ "contract_setups": {
520
+ "type": "array",
521
+ "maxItems": 20,
522
+ "items": { "$ref": "#/$defs/contractSetupChoice" }
523
+ },
524
+ "grant": { "$ref": "#/$defs/grantPolicy" }
525
+ }
526
+ },
527
+ "authorizationActivationResponse": {
528
+ "type": "object",
529
+ "additionalProperties": false,
530
+ "required": ["type", "protocol_version", "request_id", "ok", "contracts", "contract_setups"],
531
+ "properties": {
532
+ "type": { "const": "authorization_activation_response" },
533
+ "protocol_version": { "const": 1 },
534
+ "request_id": { "$ref": "#/$defs/uuid" },
535
+ "ok": { "type": "boolean" },
536
+ "contracts": {
537
+ "type": "array",
538
+ "maxItems": 100,
539
+ "items": { "$ref": "#/$defs/collectionContract" }
540
+ },
541
+ "contract_setups": {
542
+ "type": "array",
543
+ "maxItems": 20,
544
+ "items": { "$ref": "#/$defs/contractSetupChoice" }
545
+ },
546
+ "setup_assessment": true,
547
+ "provision_receipt": true,
548
+ "error": {
549
+ "type": "object",
550
+ "additionalProperties": false,
551
+ "required": ["code", "message"],
552
+ "properties": {
553
+ "code": { "type": "string", "minLength": 1 },
554
+ "message": { "type": "string", "minLength": 1 },
555
+ "details": true
556
+ }
557
+ }
558
+ },
559
+ "allOf": [
560
+ {
561
+ "if": { "properties": { "ok": { "const": true } }, "required": ["ok"] },
562
+ "then": {
563
+ "not": { "properties": { "error": true }, "required": ["error"] }
564
+ },
565
+ "else": {
566
+ "required": ["error"]
567
+ }
568
+ }
569
+ ]
570
+ },
571
+ "notificationCriterion": {
572
+ "type": "object",
573
+ "additionalProperties": false,
574
+ "required": ["id", "event", "presentation"],
575
+ "properties": {
576
+ "id": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$" },
577
+ "event": { "$ref": "#/$defs/contractRequirement" },
578
+ "if": {
579
+ "type": "object",
580
+ "additionalProperties": false,
581
+ "required": ["$expr"],
582
+ "properties": { "$expr": { "type": "string", "minLength": 1, "maxLength": 4096 } }
583
+ },
584
+ "debounce": { "type": "string", "pattern": "^[0-9]+(ms|s|m|h|d)$" },
585
+ "minimum_interval": { "type": "string", "pattern": "^[0-9]+(ms|s|m|h|d)$" },
586
+ "presentation": {
587
+ "type": "object",
588
+ "additionalProperties": false,
589
+ "required": ["title"],
590
+ "properties": {
591
+ "title": { "type": "string", "minLength": 1, "maxLength": 80 },
592
+ "body": { "type": "string", "maxLength": 160 },
593
+ "tag": { "type": "string", "minLength": 1, "maxLength": 80 }
594
+ }
595
+ }
596
+ }
597
+ },
598
+ "grantEncryption": {
599
+ "type": "object",
600
+ "additionalProperties": false,
601
+ "required": ["protocol_version", "suite", "key_id", "scope_epoch", "connector_id", "collection_id", "application_agreement_public_key", "connector_agreement_public_key"],
602
+ "properties": {
603
+ "protocol_version": { "const": 1 },
604
+ "suite": { "const": "P256-HKDF-SHA256-AES256GCM" },
605
+ "key_id": { "type": "string", "minLength": 1, "maxLength": 200 },
606
+ "scope_epoch": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
607
+ "connector_id": { "$ref": "#/$defs/uuid" },
608
+ "collection_id": { "$ref": "#/$defs/uuid" },
609
+ "application_agreement_public_key": { "type": "string", "minLength": 80, "maxLength": 200, "pattern": "^[A-Za-z0-9_-]+$" },
610
+ "connector_agreement_public_key": { "type": "string", "minLength": 80, "maxLength": 200, "pattern": "^[A-Za-z0-9_-]+$" }
611
+ }
612
+ },
613
+ "relayPolicySnapshot": {
614
+ "type": "object",
615
+ "additionalProperties": false,
616
+ "required": ["type", "protocol_version", "request_id", "revision", "grants"],
617
+ "oneOf": [
618
+ { "required": ["connector_id", "sequence", "lease_issued_at_ms", "lease_expires_at_ms"] },
619
+ { "not": { "anyOf": [
620
+ { "required": ["connector_id"] },
621
+ { "required": ["sequence"] },
622
+ { "required": ["lease_issued_at_ms"] },
623
+ { "required": ["lease_expires_at_ms"] }
624
+ ] } }
625
+ ],
626
+ "properties": {
627
+ "type": { "const": "policy_snapshot" },
628
+ "protocol_version": { "const": 1 },
629
+ "request_id": { "$ref": "#/$defs/uuid" },
630
+ "revision": { "$ref": "#/$defs/digest" },
631
+ "connector_id": { "$ref": "#/$defs/uuid" },
632
+ "sequence": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
633
+ "lease_issued_at_ms": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
634
+ "lease_expires_at_ms": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
635
+ "grants": { "type": "array", "items": { "$ref": "#/$defs/grantPolicy" } }
636
+ }
637
+ },
638
+ "relayPolicyApplied": {
639
+ "type": "object",
640
+ "additionalProperties": false,
641
+ "required": ["type", "protocol_version", "request_id", "revision", "ok"],
642
+ "properties": {
643
+ "type": { "const": "policy_applied" },
644
+ "protocol_version": { "const": 1 },
645
+ "request_id": { "$ref": "#/$defs/uuid" },
646
+ "revision": { "$ref": "#/$defs/digest" },
647
+ "ok": { "type": "boolean" },
648
+ "error": {
649
+ "type": "object",
650
+ "additionalProperties": false,
651
+ "required": ["code", "message"],
652
+ "properties": {
653
+ "code": { "type": "string", "minLength": 1 },
654
+ "message": { "type": "string" },
655
+ "details": true
656
+ }
657
+ }
658
+ },
659
+ "allOf": [
660
+ {
661
+ "if": { "properties": { "ok": { "const": true } }, "required": ["ok"] },
662
+ "then": { "not": { "properties": { "error": true }, "required": ["error"] } },
663
+ "else": { "required": ["error"] }
664
+ }
665
+ ]
666
+ },
667
+ "collectionDescription": {
668
+ "type": "object",
669
+ "additionalProperties": false,
670
+ "required": ["protocol_version", "collection_id", "display_name", "spec_version", "operations", "change_cursor", "types", "contracts"],
671
+ "properties": {
672
+ "protocol_version": { "const": 1 },
673
+ "collection_id": { "$ref": "#/$defs/uuid" },
674
+ "display_name": { "type": "string", "minLength": 1 },
675
+ "spec_version": { "type": "string", "minLength": 1 },
676
+ "operations": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/operation" } },
677
+ "change_cursor": { "type": "integer", "minimum": 0 },
678
+ "types": { "type": "array", "items": { "$ref": "#/$defs/collectionType" } },
679
+ "contracts": { "type": "array", "items": { "$ref": "#/$defs/collectionContract" } },
680
+ "configuration": { "type": "object", "description": "Canonical portable collection settings. Extension and implementation-specific values are omitted." }
681
+ }
682
+ },
683
+ "collectionType": {
684
+ "type": "object",
685
+ "additionalProperties": false,
686
+ "required": ["name", "schema", "extensions"],
687
+ "properties": {
688
+ "name": { "type": "string", "minLength": 1 },
689
+ "version": { "type": "integer", "minimum": 1 },
690
+ "description": { "type": "string" },
691
+ "revision": { "$ref": "#/$defs/digest" },
692
+ "path": { "type": "string", "minLength": 1, "description": "Collection-relative source path." },
693
+ "definition": { "type": "object", "description": "Complete portable type frontmatter, including extension declarations." },
694
+ "schema": { "type": "object" },
695
+ "collection": { "type": "object" },
696
+ "lifecycle": { "type": "object" },
697
+ "extensions": { "type": "object" }
698
+ }
699
+ },
700
+ "authorizationTypeCandidate": {
701
+ "type": "object",
702
+ "additionalProperties": false,
703
+ "required": ["name", "revision", "schema", "extensions"],
704
+ "properties": {
705
+ "name": { "type": "string", "minLength": 1, "maxLength": 100 },
706
+ "version": { "type": "integer", "minimum": 1 },
707
+ "description": { "type": "string" },
708
+ "revision": { "$ref": "#/$defs/digest" },
709
+ "schema": { "type": "object" },
710
+ "extensions": { "type": "object", "maxProperties": 0 }
711
+ }
712
+ },
713
+ "collectionContract": {
714
+ "type": "object",
715
+ "additionalProperties": false,
716
+ "required": ["contract_type", "id", "version", "digest", "schema", "implementations"],
717
+ "properties": {
718
+ "contract_type": { "const": "record" },
719
+ "id": { "type": "string", "minLength": 1 },
720
+ "version": { "$ref": "#/$defs/semanticVersion" },
721
+ "digest": { "$ref": "#/$defs/digest" },
722
+ "schema": { "type": "object" },
723
+ "binding_schema": { "type": "object" },
724
+ "implementations": {
725
+ "type": "array",
726
+ "minItems": 1,
727
+ "items": { "$ref": "#/$defs/collectionContractImplementation" }
728
+ }
729
+ }
730
+ },
731
+ "collectionContractImplementation": {
732
+ "type": "object",
733
+ "additionalProperties": false,
734
+ "required": ["type_name", "type_version", "digest", "fields"],
735
+ "properties": {
736
+ "type_name": { "type": "string", "minLength": 1 },
737
+ "type_version": { "type": "integer", "minimum": 1 },
738
+ "type_path": { "type": "string", "minLength": 1 },
739
+ "digest": { "$ref": "#/$defs/digest" },
740
+ "fields": {
741
+ "type": "object",
742
+ "additionalProperties": { "type": "string", "minLength": 1 }
743
+ },
744
+ "binding": { "type": "object" }
745
+ }
746
+ },
747
+ "contractSetupChoice": {
748
+ "oneOf": [
749
+ {
750
+ "type": "object",
751
+ "additionalProperties": false,
752
+ "required": ["contract", "mode"],
753
+ "properties": {
754
+ "contract": { "$ref": "#/$defs/contractRequirement" },
755
+ "mode": { "const": "starter" }
756
+ }
757
+ },
758
+ {
759
+ "type": "object",
760
+ "additionalProperties": false,
761
+ "required": ["contract", "mode", "type_name", "type_revision", "fields"],
762
+ "properties": {
763
+ "contract": { "$ref": "#/$defs/contractRequirement" },
764
+ "mode": { "const": "existing" },
765
+ "type_name": { "type": "string", "minLength": 1, "maxLength": 100 },
766
+ "type_revision": { "$ref": "#/$defs/digest" },
767
+ "fields": {
768
+ "type": "object",
769
+ "maxProperties": 100,
770
+ "additionalProperties": { "type": "string", "minLength": 1, "maxLength": 500 }
771
+ },
772
+ "binding": { "type": "object" }
773
+ }
774
+ }
775
+ ]
776
+ },
777
+ "changesPage": {
778
+ "type": "object",
779
+ "additionalProperties": false,
780
+ "required": ["events", "cursor", "has_more", "reset"],
781
+ "properties": {
782
+ "events": { "type": "array", "items": { "$ref": "#/$defs/change" } },
783
+ "cursor": { "type": "integer", "minimum": 0 },
784
+ "has_more": { "type": "boolean" },
785
+ "reset": { "type": "boolean" }
786
+ }
787
+ },
788
+ "change": {
789
+ "type": "object",
790
+ "additionalProperties": false,
791
+ "required": ["cursor", "type", "occurred_at", "payload"],
792
+ "properties": {
793
+ "cursor": { "type": "integer", "minimum": 1 },
794
+ "type": { "type": "string", "minLength": 1 },
795
+ "occurred_at": { "type": "string", "format": "date-time" },
796
+ "payload": { "type": "object" }
797
+ }
798
+ }
799
+ }
800
+ }