@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,456 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://mdbase.dev/schemas/interop/v0.1/profile.schema.json",
4
+ "title": "mdbase event and action interoperability profile 0.1",
5
+ "oneOf": [
6
+ { "$ref": "#/$defs/event" },
7
+ { "$ref": "#/$defs/actionRequest" },
8
+ { "$ref": "#/$defs/actionInvocation" },
9
+ { "$ref": "#/$defs/actionOutcome" },
10
+ { "$ref": "#/$defs/actionCancellation" },
11
+ { "$ref": "#/$defs/eventSourceDeclaration" },
12
+ { "$ref": "#/$defs/actionProviderDeclaration" },
13
+ { "$ref": "#/$defs/conformanceClaim" }
14
+ ],
15
+ "$defs": {
16
+ "contractId": {
17
+ "type": "string",
18
+ "minLength": 3,
19
+ "maxLength": 128,
20
+ "pattern": "^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)+$"
21
+ },
22
+ "semanticVersion": {
23
+ "type": "string",
24
+ "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-]+)*)?$"
25
+ },
26
+ "semanticVersionRequirement": {
27
+ "type": "string",
28
+ "minLength": 1,
29
+ "maxLength": 128
30
+ },
31
+ "digest": {
32
+ "type": "string",
33
+ "pattern": "^sha256:[0-9a-f]{64}$"
34
+ },
35
+ "portableId": {
36
+ "type": "string",
37
+ "minLength": 1,
38
+ "maxLength": 256,
39
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@/-]*$"
40
+ },
41
+ "exactContract": {
42
+ "type": "object",
43
+ "required": ["id", "version", "digest"],
44
+ "properties": {
45
+ "id": { "$ref": "#/$defs/contractId" },
46
+ "version": { "$ref": "#/$defs/semanticVersion" },
47
+ "digest": { "$ref": "#/$defs/digest" }
48
+ },
49
+ "additionalProperties": false
50
+ },
51
+ "contractRequirement": {
52
+ "type": "object",
53
+ "required": ["id", "version"],
54
+ "properties": {
55
+ "id": { "$ref": "#/$defs/contractId" },
56
+ "version": { "$ref": "#/$defs/semanticVersionRequirement" },
57
+ "digest": { "$ref": "#/$defs/digest" }
58
+ },
59
+ "additionalProperties": false
60
+ },
61
+ "implementationIdentity": {
62
+ "type": "object",
63
+ "required": ["application", "implementation", "version"],
64
+ "properties": {
65
+ "application": { "$ref": "#/$defs/portableId" },
66
+ "implementation": { "$ref": "#/$defs/portableId" },
67
+ "version": { "$ref": "#/$defs/semanticVersion" },
68
+ "instance_id": { "$ref": "#/$defs/portableId" }
69
+ },
70
+ "additionalProperties": false
71
+ },
72
+ "transportCapabilities": {
73
+ "type": "object",
74
+ "required": ["delivery", "ordering", "cancellation", "deadlines"],
75
+ "properties": {
76
+ "delivery": {
77
+ "type": "array",
78
+ "minItems": 1,
79
+ "uniqueItems": true,
80
+ "items": {
81
+ "enum": ["ephemeral", "at_least_once", "durable_cursor", "offline_queue"]
82
+ }
83
+ },
84
+ "ordering": {
85
+ "type": "array",
86
+ "uniqueItems": true,
87
+ "items": {
88
+ "enum": ["none", "source", "subject"]
89
+ }
90
+ },
91
+ "cancellation": { "type": "boolean" },
92
+ "deadlines": { "type": "boolean" },
93
+ "provider_discovery": { "type": "boolean" },
94
+ "max_payload_bytes": { "type": "integer", "minimum": 1 },
95
+ "outcome_retention_seconds": { "type": "integer", "minimum": 0 },
96
+ "request_deduplication": { "type": "boolean" },
97
+ "cross_process_identity": { "type": "boolean" }
98
+ },
99
+ "additionalProperties": false
100
+ },
101
+ "extensionValue": {
102
+ "oneOf": [
103
+ { "type": "null" },
104
+ { "type": "boolean" },
105
+ { "type": "integer" },
106
+ { "type": "number" },
107
+ { "type": "string" }
108
+ ]
109
+ },
110
+ "event": {
111
+ "title": "mdbase CloudEvents event envelope",
112
+ "type": "object",
113
+ "required": [
114
+ "specversion",
115
+ "id",
116
+ "source",
117
+ "type",
118
+ "time",
119
+ "datacontenttype",
120
+ "dataschema",
121
+ "data",
122
+ "mdbaseprofile",
123
+ "mdbasecontractversion",
124
+ "mdbasecontractdigest",
125
+ "mdbaseapplication",
126
+ "mdbaseimplementation",
127
+ "mdbaseimplementationversion"
128
+ ],
129
+ "properties": {
130
+ "specversion": { "const": "1.0" },
131
+ "id": { "$ref": "#/$defs/portableId" },
132
+ "source": { "type": "string", "format": "uri-reference", "minLength": 1 },
133
+ "type": { "$ref": "#/$defs/contractId" },
134
+ "time": { "type": "string", "format": "date-time" },
135
+ "subject": { "type": "string", "format": "uri-reference", "minLength": 1 },
136
+ "datacontenttype": { "const": "application/json" },
137
+ "dataschema": { "type": "string", "format": "uri", "minLength": 1 },
138
+ "data": true,
139
+ "mdbaseprofile": { "const": "0.1" },
140
+ "mdbasecontractversion": { "$ref": "#/$defs/semanticVersion" },
141
+ "mdbasecontractdigest": { "$ref": "#/$defs/digest" },
142
+ "mdbaseapplication": { "$ref": "#/$defs/portableId" },
143
+ "mdbaseimplementation": { "$ref": "#/$defs/portableId" },
144
+ "mdbaseimplementationversion": { "$ref": "#/$defs/semanticVersion" },
145
+ "mdbaseinstanceid": { "$ref": "#/$defs/portableId" },
146
+ "correlationid": { "$ref": "#/$defs/portableId" },
147
+ "causationid": { "$ref": "#/$defs/portableId" }
148
+ },
149
+ "propertyNames": { "pattern": "^[a-z0-9]+$" },
150
+ "additionalProperties": { "$ref": "#/$defs/extensionValue" }
151
+ },
152
+ "actionRequest": {
153
+ "title": "mdbase action request",
154
+ "type": "object",
155
+ "required": [
156
+ "kind",
157
+ "profile_version",
158
+ "request_id",
159
+ "contract",
160
+ "caller",
161
+ "created_at",
162
+ "input"
163
+ ],
164
+ "properties": {
165
+ "kind": { "const": "mdbase.action.request" },
166
+ "profile_version": { "const": "0.1" },
167
+ "request_id": { "$ref": "#/$defs/portableId" },
168
+ "contract": { "$ref": "#/$defs/contractRequirement" },
169
+ "caller": { "$ref": "#/$defs/implementationIdentity" },
170
+ "created_at": { "type": "string", "format": "date-time" },
171
+ "correlation_id": { "$ref": "#/$defs/portableId" },
172
+ "causation_id": { "$ref": "#/$defs/portableId" },
173
+ "subject": { "type": "string", "format": "uri-reference", "minLength": 1 },
174
+ "idempotency_key": { "type": "string", "minLength": 1, "maxLength": 512 },
175
+ "deadline": { "type": "string", "format": "date-time" },
176
+ "requested_provider": {
177
+ "type": "object",
178
+ "properties": {
179
+ "application": { "$ref": "#/$defs/portableId" },
180
+ "implementation": { "$ref": "#/$defs/portableId" },
181
+ "instance_id": { "$ref": "#/$defs/portableId" }
182
+ },
183
+ "minProperties": 1,
184
+ "additionalProperties": false
185
+ },
186
+ "authorization_context": {
187
+ "type": "string",
188
+ "format": "uri-reference",
189
+ "minLength": 1
190
+ },
191
+ "input": true
192
+ },
193
+ "additionalProperties": false
194
+ },
195
+ "actionInvocation": {
196
+ "title": "mdbase admitted action invocation",
197
+ "type": "object",
198
+ "required": [
199
+ "kind",
200
+ "profile_version",
201
+ "invocation_id",
202
+ "attempt_id",
203
+ "request_id",
204
+ "contract",
205
+ "caller",
206
+ "provider",
207
+ "provider_declaration_digest",
208
+ "handler_id",
209
+ "admitted_at",
210
+ "input"
211
+ ],
212
+ "properties": {
213
+ "kind": { "const": "mdbase.action.invocation" },
214
+ "profile_version": { "const": "0.1" },
215
+ "invocation_id": { "$ref": "#/$defs/portableId" },
216
+ "attempt_id": { "$ref": "#/$defs/portableId" },
217
+ "request_id": { "$ref": "#/$defs/portableId" },
218
+ "contract": { "$ref": "#/$defs/exactContract" },
219
+ "caller": { "$ref": "#/$defs/implementationIdentity" },
220
+ "provider": { "$ref": "#/$defs/implementationIdentity" },
221
+ "provider_declaration_digest": { "$ref": "#/$defs/digest" },
222
+ "handler_id": { "$ref": "#/$defs/portableId" },
223
+ "admitted_at": { "type": "string", "format": "date-time" },
224
+ "correlation_id": { "$ref": "#/$defs/portableId" },
225
+ "causation_id": { "$ref": "#/$defs/portableId" },
226
+ "subject": { "type": "string", "format": "uri-reference", "minLength": 1 },
227
+ "idempotency_key": { "type": "string", "minLength": 1, "maxLength": 512 },
228
+ "deadline": { "type": "string", "format": "date-time" },
229
+ "authorization_context": {
230
+ "type": "string",
231
+ "format": "uri-reference",
232
+ "minLength": 1
233
+ },
234
+ "input": true
235
+ },
236
+ "additionalProperties": false
237
+ },
238
+ "portableError": {
239
+ "type": "object",
240
+ "required": ["code", "message"],
241
+ "properties": {
242
+ "code": {
243
+ "enum": [
244
+ "unknown_contract",
245
+ "unsupported_contract_version",
246
+ "contract_digest_conflict",
247
+ "invalid_event_data",
248
+ "invalid_action_input",
249
+ "invalid_action_output",
250
+ "no_provider",
251
+ "ambiguous_provider",
252
+ "requested_provider_unavailable",
253
+ "unauthorized",
254
+ "capability_denied",
255
+ "request_rejected",
256
+ "deadline_exceeded",
257
+ "cancellation_unsupported",
258
+ "cancelled",
259
+ "handler_failure",
260
+ "outcome_indeterminate",
261
+ "transport_unavailable",
262
+ "unsupported_transport_capability"
263
+ ]
264
+ },
265
+ "message": { "type": "string", "minLength": 1 },
266
+ "details": true,
267
+ "retryable": { "type": "boolean" }
268
+ },
269
+ "additionalProperties": false
270
+ },
271
+ "actionOutcome": {
272
+ "title": "mdbase action outcome",
273
+ "type": "object",
274
+ "required": [
275
+ "kind",
276
+ "profile_version",
277
+ "outcome_id",
278
+ "request_id",
279
+ "invocation_id",
280
+ "attempt_id",
281
+ "contract",
282
+ "provider",
283
+ "provider_declaration_digest",
284
+ "status",
285
+ "completed_at"
286
+ ],
287
+ "properties": {
288
+ "kind": { "const": "mdbase.action.outcome" },
289
+ "profile_version": { "const": "0.1" },
290
+ "outcome_id": { "$ref": "#/$defs/portableId" },
291
+ "request_id": { "$ref": "#/$defs/portableId" },
292
+ "invocation_id": { "$ref": "#/$defs/portableId" },
293
+ "attempt_id": { "$ref": "#/$defs/portableId" },
294
+ "contract": { "$ref": "#/$defs/exactContract" },
295
+ "provider": { "$ref": "#/$defs/implementationIdentity" },
296
+ "provider_declaration_digest": { "$ref": "#/$defs/digest" },
297
+ "status": {
298
+ "enum": ["succeeded", "rejected", "failed", "cancelled", "outcome_indeterminate"]
299
+ },
300
+ "completed_at": { "type": "string", "format": "date-time" },
301
+ "output": true,
302
+ "error": { "$ref": "#/$defs/portableError" }
303
+ },
304
+ "allOf": [
305
+ {
306
+ "if": {
307
+ "properties": { "status": { "const": "succeeded" } },
308
+ "required": ["status"]
309
+ },
310
+ "then": {
311
+ "required": ["output"],
312
+ "not": { "required": ["error"] }
313
+ },
314
+ "else": {
315
+ "required": ["error"],
316
+ "not": { "required": ["output"] }
317
+ }
318
+ }
319
+ ],
320
+ "additionalProperties": false
321
+ },
322
+ "actionCancellation": {
323
+ "title": "mdbase action cancellation request",
324
+ "type": "object",
325
+ "required": ["kind", "profile_version", "cancellation_id", "request_id", "caller", "requested_at"],
326
+ "properties": {
327
+ "kind": { "const": "mdbase.action.cancel" },
328
+ "profile_version": { "const": "0.1" },
329
+ "cancellation_id": { "$ref": "#/$defs/portableId" },
330
+ "request_id": { "$ref": "#/$defs/portableId" },
331
+ "caller": { "$ref": "#/$defs/implementationIdentity" },
332
+ "requested_at": { "type": "string", "format": "date-time" },
333
+ "reason": { "type": "string", "maxLength": 1024 }
334
+ },
335
+ "additionalProperties": false
336
+ },
337
+ "eventSourceDeclaration": {
338
+ "title": "mdbase event-source declaration",
339
+ "type": "object",
340
+ "required": [
341
+ "kind",
342
+ "profile_version",
343
+ "declaration_id",
344
+ "declaration_digest",
345
+ "source",
346
+ "contracts"
347
+ ],
348
+ "properties": {
349
+ "kind": { "const": "mdbase.event-source" },
350
+ "profile_version": { "const": "0.1" },
351
+ "declaration_id": { "$ref": "#/$defs/portableId" },
352
+ "declaration_digest": { "$ref": "#/$defs/digest" },
353
+ "source": { "$ref": "#/$defs/implementationIdentity" },
354
+ "contracts": {
355
+ "type": "array",
356
+ "minItems": 1,
357
+ "items": {
358
+ "type": "object",
359
+ "required": ["requirement", "resolved"],
360
+ "properties": {
361
+ "requirement": { "$ref": "#/$defs/contractRequirement" },
362
+ "resolved": { "$ref": "#/$defs/exactContract" },
363
+ "binding": true,
364
+ "ordering": {
365
+ "type": "array",
366
+ "uniqueItems": true,
367
+ "items": { "enum": ["none", "source", "subject"] }
368
+ }
369
+ },
370
+ "additionalProperties": false
371
+ }
372
+ }
373
+ },
374
+ "additionalProperties": false
375
+ },
376
+ "actionProviderDeclaration": {
377
+ "title": "mdbase action-provider declaration",
378
+ "type": "object",
379
+ "required": [
380
+ "kind",
381
+ "profile_version",
382
+ "declaration_id",
383
+ "declaration_digest",
384
+ "provider",
385
+ "handlers"
386
+ ],
387
+ "properties": {
388
+ "kind": { "const": "mdbase.action-provider" },
389
+ "profile_version": { "const": "0.1" },
390
+ "declaration_id": { "$ref": "#/$defs/portableId" },
391
+ "declaration_digest": { "$ref": "#/$defs/digest" },
392
+ "provider": { "$ref": "#/$defs/implementationIdentity" },
393
+ "handlers": {
394
+ "type": "array",
395
+ "minItems": 1,
396
+ "items": {
397
+ "type": "object",
398
+ "required": ["handler_id", "requirement", "resolved"],
399
+ "properties": {
400
+ "handler_id": { "$ref": "#/$defs/portableId" },
401
+ "requirement": { "$ref": "#/$defs/contractRequirement" },
402
+ "resolved": { "$ref": "#/$defs/exactContract" },
403
+ "binding": true,
404
+ "idempotency": {
405
+ "type": "object",
406
+ "required": ["mode"],
407
+ "properties": {
408
+ "mode": { "enum": ["none", "request"] },
409
+ "retention_seconds": { "type": "integer", "minimum": 1 }
410
+ },
411
+ "additionalProperties": false
412
+ },
413
+ "cancellation": { "enum": ["none", "cooperative"] },
414
+ "max_concurrency": { "type": "integer", "minimum": 1 }
415
+ },
416
+ "additionalProperties": false
417
+ }
418
+ }
419
+ },
420
+ "additionalProperties": false
421
+ },
422
+ "conformanceClaim": {
423
+ "title": "mdbase interoperability conformance claim",
424
+ "type": "object",
425
+ "required": ["kind", "profile_version", "implementation", "roles", "transport"],
426
+ "properties": {
427
+ "kind": { "const": "mdbase.interop.conformance" },
428
+ "profile_version": { "const": "0.1" },
429
+ "implementation": { "$ref": "#/$defs/implementationIdentity" },
430
+ "roles": {
431
+ "type": "array",
432
+ "minItems": 1,
433
+ "uniqueItems": true,
434
+ "items": {
435
+ "enum": ["event_source", "event_consumer", "action_caller", "action_provider", "bridge"]
436
+ }
437
+ },
438
+ "transport": { "$ref": "#/$defs/transportCapabilities" },
439
+ "evidence": {
440
+ "type": "array",
441
+ "items": {
442
+ "type": "object",
443
+ "required": ["scenario", "result"],
444
+ "properties": {
445
+ "scenario": { "type": "string", "minLength": 1 },
446
+ "result": { "const": "pass" },
447
+ "uri": { "type": "string", "format": "uri-reference" }
448
+ },
449
+ "additionalProperties": false
450
+ }
451
+ }
452
+ },
453
+ "additionalProperties": false
454
+ }
455
+ }
456
+ }