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

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.
@@ -0,0 +1,660 @@
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", "install_type_pack", "list_timers", "put_timer", "cancel_timer", "reconcile_timers", "sync"]
26
+ },
27
+ "contractRequirement": {
28
+ "type": "object",
29
+ "additionalProperties": false,
30
+ "required": ["id", "version"],
31
+ "properties": {
32
+ "id": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$" },
33
+ "version": { "$ref": "#/$defs/semanticVersion" }
34
+ }
35
+ },
36
+ "semanticVersion": {
37
+ "type": "string",
38
+ "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-]+)*)?$"
39
+ },
40
+ "digest": {
41
+ "type": "string",
42
+ "pattern": "^sha256:[0-9a-f]{64}$"
43
+ },
44
+ "grantScope": {
45
+ "type": "object",
46
+ "additionalProperties": false,
47
+ "required": ["access", "contracts"],
48
+ "properties": {
49
+ "access": { "enum": ["contract", "full_collection"] },
50
+ "contracts": {
51
+ "type": "array",
52
+ "maxItems": 20,
53
+ "items": { "$ref": "#/$defs/collectionContract" }
54
+ }
55
+ }
56
+ },
57
+ "diagnostic": {
58
+ "type": "object",
59
+ "additionalProperties": false,
60
+ "required": ["severity", "code", "message"],
61
+ "properties": {
62
+ "severity": { "enum": ["error", "warning", "info"] },
63
+ "code": { "type": "string", "minLength": 1 },
64
+ "message": { "type": "string" },
65
+ "path": { "type": "string" },
66
+ "field": { "type": "string" },
67
+ "type": { "type": "string" },
68
+ "schema_location": { "type": "string" },
69
+ "details": true
70
+ }
71
+ },
72
+ "operationEnvelope": {
73
+ "type": "object",
74
+ "additionalProperties": false,
75
+ "required": ["valid", "result", "diagnostics"],
76
+ "properties": {
77
+ "valid": { "type": "boolean" },
78
+ "result": true,
79
+ "diagnostics": { "type": "array", "items": { "$ref": "#/$defs/diagnostic" } }
80
+ }
81
+ },
82
+ "relayHello": {
83
+ "type": "object",
84
+ "additionalProperties": false,
85
+ "required": ["type", "protocol_version", "connector_version", "capabilities"],
86
+ "properties": {
87
+ "type": { "const": "relay_hello" },
88
+ "protocol_version": { "const": 1 },
89
+ "connector_version": { "type": "string", "minLength": 1, "maxLength": 100 },
90
+ "capabilities": {
91
+ "type": "array",
92
+ "uniqueItems": true,
93
+ "items": { "type": "string", "minLength": 1, "maxLength": 100 }
94
+ }
95
+ }
96
+ },
97
+ "relayWelcome": {
98
+ "type": "object",
99
+ "additionalProperties": false,
100
+ "required": ["type", "protocol_version", "session_id", "capabilities"],
101
+ "properties": {
102
+ "type": { "const": "relay_welcome" },
103
+ "protocol_version": { "const": 1 },
104
+ "session_id": { "type": "string", "minLength": 1, "maxLength": 100 },
105
+ "capabilities": {
106
+ "type": "array",
107
+ "uniqueItems": true,
108
+ "items": { "type": "string", "minLength": 1, "maxLength": 100 }
109
+ }
110
+ }
111
+ },
112
+ "relayIncompatible": {
113
+ "type": "object",
114
+ "additionalProperties": false,
115
+ "required": ["type", "protocol_version", "code", "message", "update_url"],
116
+ "properties": {
117
+ "type": { "const": "relay_incompatible" },
118
+ "protocol_version": { "const": 1 },
119
+ "code": { "const": "connector_upgrade_required" },
120
+ "message": { "type": "string", "minLength": 1 },
121
+ "update_url": { "type": "string", "format": "uri", "pattern": "^https://" }
122
+ }
123
+ },
124
+ "relayOperationRequest": {
125
+ "type": "object",
126
+ "additionalProperties": false,
127
+ "required": ["type", "protocol_version", "request_id", "grant_id", "collection_id", "application_id", "operation", "input"],
128
+ "properties": {
129
+ "type": { "const": "operation_request" },
130
+ "protocol_version": { "const": 1 },
131
+ "request_id": { "$ref": "#/$defs/uuid" },
132
+ "grant_id": { "$ref": "#/$defs/uuid" },
133
+ "collection_id": { "$ref": "#/$defs/uuid" },
134
+ "application_id": { "$ref": "#/$defs/uuid" },
135
+ "operation": { "$ref": "#/$defs/operation" },
136
+ "input": true
137
+ }
138
+ },
139
+ "operationHttpRequest": {
140
+ "type": "object",
141
+ "additionalProperties": false,
142
+ "required": ["protocol_version", "request_id", "input"],
143
+ "properties": {
144
+ "protocol_version": { "const": 1 },
145
+ "request_id": { "$ref": "#/$defs/uuid" },
146
+ "input": true
147
+ }
148
+ },
149
+ "operationHttpResponse": {
150
+ "type": "object",
151
+ "additionalProperties": false,
152
+ "required": ["protocol_version", "request_id", "ok"],
153
+ "properties": {
154
+ "protocol_version": { "const": 1 },
155
+ "request_id": { "$ref": "#/$defs/uuid" },
156
+ "ok": { "type": "boolean" },
157
+ "result": true,
158
+ "error": {
159
+ "type": "object",
160
+ "additionalProperties": false,
161
+ "required": ["code", "message"],
162
+ "properties": {
163
+ "code": { "type": "string", "minLength": 1 },
164
+ "message": { "type": "string" },
165
+ "details": true
166
+ }
167
+ }
168
+ },
169
+ "allOf": [
170
+ {
171
+ "if": { "properties": { "ok": { "const": true } }, "required": ["ok"] },
172
+ "then": {
173
+ "required": ["result"],
174
+ "not": { "properties": { "error": true }, "required": ["error"] }
175
+ },
176
+ "else": {
177
+ "required": ["error"],
178
+ "not": { "properties": { "result": true }, "required": ["result"] }
179
+ }
180
+ }
181
+ ]
182
+ },
183
+ "relayOperationResponse": {
184
+ "type": "object",
185
+ "additionalProperties": false,
186
+ "required": ["type", "protocol_version", "request_id", "ok"],
187
+ "properties": {
188
+ "type": { "const": "operation_response" },
189
+ "protocol_version": { "const": 1 },
190
+ "request_id": { "$ref": "#/$defs/uuid" },
191
+ "ok": { "type": "boolean" },
192
+ "result": true,
193
+ "error": {
194
+ "type": "object",
195
+ "additionalProperties": false,
196
+ "required": ["code", "message"],
197
+ "properties": {
198
+ "code": { "type": "string", "minLength": 1 },
199
+ "message": { "type": "string" }
200
+ }
201
+ }
202
+ },
203
+ "allOf": [
204
+ {
205
+ "if": { "properties": { "ok": { "const": true } }, "required": ["ok"] },
206
+ "then": {
207
+ "properties": { "result": true },
208
+ "required": ["result"],
209
+ "not": { "properties": { "error": true }, "required": ["error"] }
210
+ },
211
+ "else": {
212
+ "properties": { "error": true },
213
+ "required": ["error"],
214
+ "not": { "properties": { "result": true }, "required": ["result"] }
215
+ }
216
+ }
217
+ ]
218
+ },
219
+ "grantPolicy": {
220
+ "type": "object",
221
+ "additionalProperties": false,
222
+ "required": ["id", "application_id", "collection_id", "operations", "scope", "application_name", "application_homepage", "collection_name", "created_at"],
223
+ "properties": {
224
+ "id": { "$ref": "#/$defs/uuid" },
225
+ "application_id": { "$ref": "#/$defs/uuid" },
226
+ "collection_id": { "$ref": "#/$defs/uuid" },
227
+ "operations": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/operation" } },
228
+ "scope": { "$ref": "#/$defs/grantScope" },
229
+ "application_name": { "type": "string", "minLength": 1 },
230
+ "application_distribution": { "enum": ["web", "portable"] },
231
+ "application_homepage": { "type": "string" },
232
+ "application_project_url": { "type": "string", "format": "uri" },
233
+ "application_origin": {
234
+ "anyOf": [
235
+ { "const": "null" },
236
+ { "type": "string", "format": "uri" }
237
+ ]
238
+ },
239
+ "application_icon": { "type": "string" },
240
+ "collection_name": { "type": "string", "minLength": 1 },
241
+ "notification_criteria": {
242
+ "type": "array",
243
+ "maxItems": 50,
244
+ "items": { "$ref": "#/$defs/notificationCriterion" }
245
+ },
246
+ "created_at": { "type": "string", "format": "date-time" },
247
+ "encryption": { "$ref": "#/$defs/grantEncryption" }
248
+ }
249
+ },
250
+ "authorizationCollectionOffer": {
251
+ "type": "object",
252
+ "additionalProperties": false,
253
+ "required": ["collection_id", "display_name", "spec_version", "contracts"],
254
+ "properties": {
255
+ "collection_id": { "$ref": "#/$defs/uuid" },
256
+ "display_name": { "type": "string", "minLength": 1, "maxLength": 200 },
257
+ "spec_version": { "type": "string", "minLength": 1, "maxLength": 30 },
258
+ "contracts": {
259
+ "type": "array",
260
+ "maxItems": 100,
261
+ "items": { "$ref": "#/$defs/collectionContract" }
262
+ },
263
+ "types": {
264
+ "type": "array",
265
+ "maxItems": 100,
266
+ "items": { "$ref": "#/$defs/authorizationTypeCandidate" }
267
+ }
268
+ }
269
+ },
270
+ "applicationRequirements": {
271
+ "type": "object",
272
+ "additionalProperties": false,
273
+ "required": ["contracts"],
274
+ "properties": {
275
+ "contracts": {
276
+ "type": "array",
277
+ "maxItems": 20,
278
+ "items": { "$ref": "#/$defs/contractRequirement" }
279
+ },
280
+ "access": { "enum": ["contract", "full_collection"] },
281
+ "collection_kind": { "const": "hosted" }
282
+ }
283
+ },
284
+ "typePackProvision": {
285
+ "type": "object",
286
+ "additionalProperties": false,
287
+ "required": ["manifest", "resources", "provides"],
288
+ "properties": {
289
+ "manifest": { "$ref": "#/$defs/typePackManifest" },
290
+ "resources": {
291
+ "type": "array",
292
+ "minItems": 1,
293
+ "maxItems": 100,
294
+ "items": { "$ref": "#/$defs/typePackSourceResource" }
295
+ },
296
+ "provides": {
297
+ "type": "array",
298
+ "maxItems": 20,
299
+ "items": { "$ref": "#/$defs/contractRequirement" }
300
+ }
301
+ }
302
+ },
303
+ "typePackManifest": {
304
+ "type": "object",
305
+ "required": ["kind", "id", "version", "resources"],
306
+ "properties": {
307
+ "kind": { "const": "mdbase.type-pack" },
308
+ "id": { "type": "string", "minLength": 3 },
309
+ "version": { "$ref": "#/$defs/semanticVersion" },
310
+ "name": { "type": "string", "minLength": 1 },
311
+ "description": { "type": "string" },
312
+ "resources": {
313
+ "type": "array",
314
+ "minItems": 1,
315
+ "items": { "$ref": "#/$defs/typePackManifestResource" }
316
+ }
317
+ },
318
+ "patternProperties": { "^x-[A-Za-z][A-Za-z0-9._:-]{0,127}$": true },
319
+ "additionalProperties": false
320
+ },
321
+ "typePackManifestResource": {
322
+ "type": "object",
323
+ "additionalProperties": false,
324
+ "required": ["kind", "source", "target", "digest"],
325
+ "properties": {
326
+ "kind": { "enum": ["contract", "type", "schema"] },
327
+ "source": { "type": "string", "minLength": 1, "maxLength": 500 },
328
+ "target": { "type": "string", "minLength": 1, "maxLength": 500 },
329
+ "digest": { "$ref": "#/$defs/digest" }
330
+ }
331
+ },
332
+ "typePackSourceResource": {
333
+ "type": "object",
334
+ "additionalProperties": false,
335
+ "required": ["source", "document"],
336
+ "properties": {
337
+ "source": { "type": "string", "minLength": 1, "maxLength": 500 },
338
+ "document": { "type": "string", "maxLength": 262144 }
339
+ }
340
+ },
341
+ "applicationProvisions": {
342
+ "type": "object",
343
+ "additionalProperties": false,
344
+ "required": ["type_packs"],
345
+ "properties": {
346
+ "type_packs": {
347
+ "type": "array",
348
+ "maxItems": 100,
349
+ "items": { "$ref": "#/$defs/typePackProvision" }
350
+ }
351
+ }
352
+ },
353
+ "authorizationOfferRequest": {
354
+ "type": "object",
355
+ "additionalProperties": false,
356
+ "required": ["type", "protocol_version", "request_id", "authorization_id"],
357
+ "properties": {
358
+ "type": { "const": "authorization_offer_request" },
359
+ "protocol_version": { "const": 1 },
360
+ "request_id": { "$ref": "#/$defs/uuid" },
361
+ "authorization_id": { "$ref": "#/$defs/uuid" },
362
+ "requirements": { "$ref": "#/$defs/applicationRequirements" },
363
+ "provisions": { "$ref": "#/$defs/applicationProvisions" }
364
+ }
365
+ },
366
+ "authorizationOfferResponse": {
367
+ "type": "object",
368
+ "additionalProperties": false,
369
+ "required": ["type", "protocol_version", "request_id", "paused", "collections"],
370
+ "properties": {
371
+ "type": { "const": "authorization_offer_response" },
372
+ "protocol_version": { "const": 1 },
373
+ "request_id": { "$ref": "#/$defs/uuid" },
374
+ "paused": { "type": "boolean" },
375
+ "collections": {
376
+ "type": "array",
377
+ "maxItems": 1000,
378
+ "items": { "$ref": "#/$defs/authorizationCollectionOffer" }
379
+ }
380
+ }
381
+ },
382
+ "authorizationActivationRequest": {
383
+ "type": "object",
384
+ "additionalProperties": false,
385
+ "required": ["type", "protocol_version", "request_id", "authorization_id", "collection_id", "requirements", "provisions", "contract_setups", "grant"],
386
+ "properties": {
387
+ "type": { "const": "authorization_activation_request" },
388
+ "protocol_version": { "const": 1 },
389
+ "request_id": { "$ref": "#/$defs/uuid" },
390
+ "authorization_id": { "$ref": "#/$defs/uuid" },
391
+ "collection_id": { "$ref": "#/$defs/uuid" },
392
+ "requirements": { "$ref": "#/$defs/applicationRequirements" },
393
+ "provisions": { "$ref": "#/$defs/applicationProvisions" },
394
+ "contract_setups": {
395
+ "type": "array",
396
+ "maxItems": 20,
397
+ "items": { "$ref": "#/$defs/contractSetupChoice" }
398
+ },
399
+ "grant": { "$ref": "#/$defs/grantPolicy" }
400
+ }
401
+ },
402
+ "authorizationActivationResponse": {
403
+ "type": "object",
404
+ "additionalProperties": false,
405
+ "required": ["type", "protocol_version", "request_id", "ok", "contracts", "contract_setups"],
406
+ "properties": {
407
+ "type": { "const": "authorization_activation_response" },
408
+ "protocol_version": { "const": 1 },
409
+ "request_id": { "$ref": "#/$defs/uuid" },
410
+ "ok": { "type": "boolean" },
411
+ "contracts": {
412
+ "type": "array",
413
+ "maxItems": 100,
414
+ "items": { "$ref": "#/$defs/collectionContract" }
415
+ },
416
+ "contract_setups": {
417
+ "type": "array",
418
+ "maxItems": 20,
419
+ "items": { "$ref": "#/$defs/contractSetupChoice" }
420
+ },
421
+ "error": {
422
+ "type": "object",
423
+ "additionalProperties": false,
424
+ "required": ["code", "message"],
425
+ "properties": {
426
+ "code": { "type": "string", "minLength": 1 },
427
+ "message": { "type": "string", "minLength": 1 },
428
+ "details": true
429
+ }
430
+ }
431
+ },
432
+ "allOf": [
433
+ {
434
+ "if": { "properties": { "ok": { "const": true } }, "required": ["ok"] },
435
+ "then": {
436
+ "not": { "properties": { "error": true }, "required": ["error"] }
437
+ },
438
+ "else": {
439
+ "required": ["error"]
440
+ }
441
+ }
442
+ ]
443
+ },
444
+ "notificationCriterion": {
445
+ "type": "object",
446
+ "additionalProperties": false,
447
+ "required": ["id", "event", "presentation"],
448
+ "properties": {
449
+ "id": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$" },
450
+ "event": { "$ref": "#/$defs/contractRequirement" },
451
+ "if": {
452
+ "type": "object",
453
+ "additionalProperties": false,
454
+ "required": ["$expr"],
455
+ "properties": { "$expr": { "type": "string", "minLength": 1, "maxLength": 4096 } }
456
+ },
457
+ "debounce": { "type": "string", "pattern": "^[0-9]+(ms|s|m|h|d)$" },
458
+ "minimum_interval": { "type": "string", "pattern": "^[0-9]+(ms|s|m|h|d)$" },
459
+ "presentation": {
460
+ "type": "object",
461
+ "additionalProperties": false,
462
+ "required": ["title"],
463
+ "properties": {
464
+ "title": { "type": "string", "minLength": 1, "maxLength": 80 },
465
+ "body": { "type": "string", "maxLength": 160 },
466
+ "tag": { "type": "string", "minLength": 1, "maxLength": 80 }
467
+ }
468
+ }
469
+ }
470
+ },
471
+ "grantEncryption": {
472
+ "type": "object",
473
+ "additionalProperties": false,
474
+ "required": ["protocol_version", "suite", "key_id", "scope_epoch", "connector_id", "collection_id", "application_agreement_public_key", "connector_agreement_public_key"],
475
+ "properties": {
476
+ "protocol_version": { "const": 1 },
477
+ "suite": { "const": "P256-HKDF-SHA256-AES256GCM" },
478
+ "key_id": { "type": "string", "minLength": 1, "maxLength": 200 },
479
+ "scope_epoch": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
480
+ "connector_id": { "$ref": "#/$defs/uuid" },
481
+ "collection_id": { "$ref": "#/$defs/uuid" },
482
+ "application_agreement_public_key": { "type": "string", "minLength": 80, "maxLength": 200, "pattern": "^[A-Za-z0-9_-]+$" },
483
+ "connector_agreement_public_key": { "type": "string", "minLength": 80, "maxLength": 200, "pattern": "^[A-Za-z0-9_-]+$" }
484
+ }
485
+ },
486
+ "relayPolicySnapshot": {
487
+ "type": "object",
488
+ "additionalProperties": false,
489
+ "required": ["type", "protocol_version", "request_id", "revision", "grants"],
490
+ "properties": {
491
+ "type": { "const": "policy_snapshot" },
492
+ "protocol_version": { "const": 1 },
493
+ "request_id": { "$ref": "#/$defs/uuid" },
494
+ "revision": { "$ref": "#/$defs/digest" },
495
+ "grants": { "type": "array", "items": { "$ref": "#/$defs/grantPolicy" } }
496
+ }
497
+ },
498
+ "relayPolicyApplied": {
499
+ "type": "object",
500
+ "additionalProperties": false,
501
+ "required": ["type", "protocol_version", "request_id", "revision", "ok"],
502
+ "properties": {
503
+ "type": { "const": "policy_applied" },
504
+ "protocol_version": { "const": 1 },
505
+ "request_id": { "$ref": "#/$defs/uuid" },
506
+ "revision": { "$ref": "#/$defs/digest" },
507
+ "ok": { "type": "boolean" },
508
+ "error": {
509
+ "type": "object",
510
+ "additionalProperties": false,
511
+ "required": ["code", "message"],
512
+ "properties": {
513
+ "code": { "type": "string", "minLength": 1 },
514
+ "message": { "type": "string" },
515
+ "details": true
516
+ }
517
+ }
518
+ },
519
+ "allOf": [
520
+ {
521
+ "if": { "properties": { "ok": { "const": true } }, "required": ["ok"] },
522
+ "then": { "not": { "properties": { "error": true }, "required": ["error"] } },
523
+ "else": { "required": ["error"] }
524
+ }
525
+ ]
526
+ },
527
+ "collectionDescription": {
528
+ "type": "object",
529
+ "additionalProperties": false,
530
+ "required": ["protocol_version", "collection_id", "display_name", "spec_version", "operations", "change_cursor", "types", "contracts"],
531
+ "properties": {
532
+ "protocol_version": { "const": 1 },
533
+ "collection_id": { "$ref": "#/$defs/uuid" },
534
+ "display_name": { "type": "string", "minLength": 1 },
535
+ "spec_version": { "type": "string", "minLength": 1 },
536
+ "operations": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/operation" } },
537
+ "change_cursor": { "type": "integer", "minimum": 0 },
538
+ "types": { "type": "array", "items": { "$ref": "#/$defs/collectionType" } },
539
+ "contracts": { "type": "array", "items": { "$ref": "#/$defs/collectionContract" } },
540
+ "configuration": { "type": "object", "description": "Canonical portable collection settings. Extension and implementation-specific values are omitted." }
541
+ }
542
+ },
543
+ "collectionType": {
544
+ "type": "object",
545
+ "additionalProperties": false,
546
+ "required": ["name", "schema", "extensions"],
547
+ "properties": {
548
+ "name": { "type": "string", "minLength": 1 },
549
+ "version": { "type": "integer", "minimum": 1 },
550
+ "description": { "type": "string" },
551
+ "revision": { "$ref": "#/$defs/digest" },
552
+ "path": { "type": "string", "minLength": 1, "description": "Collection-relative source path." },
553
+ "definition": { "type": "object", "description": "Complete portable type frontmatter, including extension declarations." },
554
+ "schema": { "type": "object" },
555
+ "collection": { "type": "object" },
556
+ "lifecycle": { "type": "object" },
557
+ "extensions": { "type": "object" }
558
+ }
559
+ },
560
+ "authorizationTypeCandidate": {
561
+ "type": "object",
562
+ "additionalProperties": false,
563
+ "required": ["name", "revision", "schema", "extensions"],
564
+ "properties": {
565
+ "name": { "type": "string", "minLength": 1, "maxLength": 100 },
566
+ "version": { "type": "integer", "minimum": 1 },
567
+ "description": { "type": "string" },
568
+ "revision": { "$ref": "#/$defs/digest" },
569
+ "schema": { "type": "object" },
570
+ "extensions": { "type": "object", "maxProperties": 0 }
571
+ }
572
+ },
573
+ "collectionContract": {
574
+ "type": "object",
575
+ "additionalProperties": false,
576
+ "required": ["contract_type", "id", "version", "digest", "schema", "implementations"],
577
+ "properties": {
578
+ "contract_type": { "const": "record" },
579
+ "id": { "type": "string", "minLength": 1 },
580
+ "version": { "$ref": "#/$defs/semanticVersion" },
581
+ "digest": { "$ref": "#/$defs/digest" },
582
+ "schema": { "type": "object" },
583
+ "binding_schema": { "type": "object" },
584
+ "implementations": {
585
+ "type": "array",
586
+ "minItems": 1,
587
+ "items": { "$ref": "#/$defs/collectionContractImplementation" }
588
+ }
589
+ }
590
+ },
591
+ "collectionContractImplementation": {
592
+ "type": "object",
593
+ "additionalProperties": false,
594
+ "required": ["type_name", "type_version", "digest", "fields"],
595
+ "properties": {
596
+ "type_name": { "type": "string", "minLength": 1 },
597
+ "type_version": { "type": "integer", "minimum": 1 },
598
+ "type_path": { "type": "string", "minLength": 1 },
599
+ "digest": { "$ref": "#/$defs/digest" },
600
+ "fields": {
601
+ "type": "object",
602
+ "additionalProperties": { "type": "string", "minLength": 1 }
603
+ },
604
+ "binding": { "type": "object" }
605
+ }
606
+ },
607
+ "contractSetupChoice": {
608
+ "oneOf": [
609
+ {
610
+ "type": "object",
611
+ "additionalProperties": false,
612
+ "required": ["contract", "mode"],
613
+ "properties": {
614
+ "contract": { "$ref": "#/$defs/contractRequirement" },
615
+ "mode": { "const": "starter" }
616
+ }
617
+ },
618
+ {
619
+ "type": "object",
620
+ "additionalProperties": false,
621
+ "required": ["contract", "mode", "type_name", "type_revision", "fields"],
622
+ "properties": {
623
+ "contract": { "$ref": "#/$defs/contractRequirement" },
624
+ "mode": { "const": "existing" },
625
+ "type_name": { "type": "string", "minLength": 1, "maxLength": 100 },
626
+ "type_revision": { "$ref": "#/$defs/digest" },
627
+ "fields": {
628
+ "type": "object",
629
+ "maxProperties": 100,
630
+ "additionalProperties": { "type": "string", "minLength": 1, "maxLength": 500 }
631
+ },
632
+ "binding": { "type": "object" }
633
+ }
634
+ }
635
+ ]
636
+ },
637
+ "changesPage": {
638
+ "type": "object",
639
+ "additionalProperties": false,
640
+ "required": ["events", "cursor", "has_more", "reset"],
641
+ "properties": {
642
+ "events": { "type": "array", "items": { "$ref": "#/$defs/change" } },
643
+ "cursor": { "type": "integer", "minimum": 0 },
644
+ "has_more": { "type": "boolean" },
645
+ "reset": { "type": "boolean" }
646
+ }
647
+ },
648
+ "change": {
649
+ "type": "object",
650
+ "additionalProperties": false,
651
+ "required": ["cursor", "type", "occurred_at", "payload"],
652
+ "properties": {
653
+ "cursor": { "type": "integer", "minimum": 1 },
654
+ "type": { "type": "string", "minLength": 1 },
655
+ "occurred_at": { "type": "string", "format": "date-time" },
656
+ "payload": { "type": "object" }
657
+ }
658
+ }
659
+ }
660
+ }