@mdbase-dev/connect-protocol 0.1.0-beta.93 → 0.1.0-beta.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdbase-dev/connect-protocol",
3
- "version": "0.1.0-beta.93",
3
+ "version": "0.1.0-beta.95",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "scripts": {
38
38
  "build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json",
39
- "test": "node --test test/*.test.mjs && node ../../scripts/generate-connect-problems.mjs --check && node ../../scripts/generate-operation-catalog.mjs --check",
39
+ "test": "node --test test/*.test.mjs && node ../../scripts/generate-connect-problems.mjs --check && node ../../scripts/generate-operation-catalog.mjs --check && node ../../scripts/generate-application-capabilities.mjs --check",
40
40
  "typecheck": "tsc -p tsconfig.json --noEmit"
41
41
  }
42
42
  }
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "catalog_version": 1,
4
+ "capabilities": [
5
+ { "id": "collection.inspect", "operations": ["describe"] },
6
+ { "id": "records.watch", "operations": ["changes"] },
7
+ { "id": "records.read", "operations": ["read"] },
8
+ { "id": "records.query", "operations": ["query"] },
9
+ { "id": "records.validate", "operations": ["validate"] },
10
+ { "id": "records.create", "operations": ["create"] },
11
+ { "id": "records.update", "operations": ["update"] },
12
+ { "id": "records.delete", "operations": ["delete"] },
13
+ { "id": "records.rename", "operations": ["rename"] },
14
+ { "id": "views.list", "operations": ["list_views"] },
15
+ { "id": "views.execute", "operations": ["execute_view"] },
16
+ { "id": "views.source.read", "operations": ["read_view_source"] },
17
+ { "id": "views.source.create", "operations": ["create_view_source"] },
18
+ { "id": "views.source.update", "operations": ["update_view_source"] },
19
+ { "id": "views.source.delete", "operations": ["delete_view_source"] },
20
+ { "id": "definitions.contracts.current", "operations": [] },
21
+ { "id": "definitions.read", "operations": ["read_type"] },
22
+ { "id": "definitions.create", "operations": ["create_type"] },
23
+ { "id": "definitions.update", "operations": ["update_type"] },
24
+ { "id": "definitions.type-pack.inspect", "operations": ["assess_type_pack"] },
25
+ { "id": "definitions.type-pack.apply", "operations": ["assess_type_pack", "apply_type_pack"] },
26
+ { "id": "collection.setup.apply", "operations": ["assess_collection_setup", "apply_collection_setup"] },
27
+ { "id": "timers.list", "operations": ["list_timers"] },
28
+ { "id": "timers.put", "operations": ["put_timer"] },
29
+ { "id": "timers.cancel", "operations": ["cancel_timer"] },
30
+ { "id": "timers.reconcile", "operations": ["reconcile_timers"] },
31
+ { "id": "sync.offline-replica", "operations": ["sync"] },
32
+ { "id": "notifications.background-delivery", "operations": [] },
33
+ { "id": "files.list", "operations": [] },
34
+ { "id": "files.read", "operations": [] },
35
+ { "id": "files.add", "operations": [] },
36
+ { "id": "files.replace", "operations": [] },
37
+ { "id": "files.move", "operations": [] },
38
+ { "id": "files.delete", "operations": [] }
39
+ ]
40
+ }
@@ -0,0 +1,68 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "catalog_version": 2,
4
+ "capabilities": [
5
+ {
6
+ "id": "collection.read",
7
+ "operations": [
8
+ "describe",
9
+ "changes",
10
+ "read",
11
+ "query",
12
+ "list_views",
13
+ "execute_view",
14
+ "read_view_source",
15
+ "validate",
16
+ "read_type"
17
+ ]
18
+ },
19
+ {
20
+ "id": "records.create",
21
+ "operations": ["create"]
22
+ },
23
+ {
24
+ "id": "records.edit",
25
+ "operations": ["update", "rename"]
26
+ },
27
+ {
28
+ "id": "records.delete",
29
+ "operations": ["delete"]
30
+ },
31
+ {
32
+ "id": "views.manage",
33
+ "operations": [
34
+ "create_view_source",
35
+ "update_view_source",
36
+ "delete_view_source"
37
+ ]
38
+ },
39
+ {
40
+ "id": "definitions.manage",
41
+ "operations": [
42
+ "create_type",
43
+ "update_type",
44
+ "assess_type_pack",
45
+ "apply_type_pack"
46
+ ]
47
+ },
48
+ {
49
+ "id": "background.schedule",
50
+ "operations": [
51
+ "list_timers",
52
+ "put_timer",
53
+ "cancel_timer",
54
+ "reconcile_timers"
55
+ ]
56
+ },
57
+ {
58
+ "id": "offline.replica",
59
+ "operations": ["sync"]
60
+ }
61
+ ],
62
+ "structured_authorities": {
63
+ "application_setup": [
64
+ "assess_collection_setup",
65
+ "apply_collection_setup"
66
+ ]
67
+ }
68
+ }
@@ -2955,6 +2955,46 @@
2955
2955
  }
2956
2956
  }
2957
2957
  },
2958
+ {
2959
+ "type": "object",
2960
+ "additionalProperties": false,
2961
+ "required": [
2962
+ "problem_version",
2963
+ "code",
2964
+ "category",
2965
+ "recovery",
2966
+ "message"
2967
+ ],
2968
+ "properties": {
2969
+ "problem_version": {
2970
+ "const": 1
2971
+ },
2972
+ "code": {
2973
+ "const": "legacy_scope_reauthorization_required"
2974
+ },
2975
+ "category": {
2976
+ "const": "authorization"
2977
+ },
2978
+ "recovery": {
2979
+ "const": "reauthorize"
2980
+ },
2981
+ "message": {
2982
+ "type": "string",
2983
+ "minLength": 1
2984
+ },
2985
+ "operation_outcome": {
2986
+ "enum": [
2987
+ "not_sent",
2988
+ "rejected",
2989
+ "unknown"
2990
+ ]
2991
+ },
2992
+ "trace_id": {
2993
+ "type": "string",
2994
+ "minLength": 1
2995
+ }
2996
+ }
2997
+ },
2958
2998
  {
2959
2999
  "type": "object",
2960
3000
  "additionalProperties": false,
@@ -250,6 +250,7 @@
250
250
  "invalid_read_cursor": { "category": "validation", "recovery": "fix_request" },
251
251
  "invalid_request": { "category": "validation", "recovery": "fix_request" },
252
252
  "invalid_token_response": { "category": "integrity", "recovery": "contact_support" },
253
+ "legacy_scope_reauthorization_required": { "category": "authorization", "recovery": "reauthorize" },
253
254
  "managed_fcm_not_declared": { "category": "compatibility", "recovery": "fix_request" },
254
255
  "manifest_load_failed": { "category": "availability", "recovery": "retry" },
255
256
  "manifest_required": { "category": "validation", "recovery": "fix_request" },
@@ -274,6 +274,7 @@
274
274
  "file_capability": {
275
275
  "$ref": "https://mdbase.dev/connect/schemas/files.v1.json#/$defs/fileCapability"
276
276
  },
277
+ "application_declaration": {},
277
278
  "application_authorization": { "$ref": "#/$defs/applicationAuthorizationProof" }
278
279
  }
279
280
  },
@@ -0,0 +1,405 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://mdbase.dev/connect/schemas/mdbase-app.legacy-v1.json",
4
+ "title": "mdbase connect bundled application manifest v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["manifest_version", "id", "name"],
8
+ "properties": {
9
+ "manifest_version": { "const": 1 },
10
+ "distribution": {
11
+ "enum": ["web", "portable"],
12
+ "description": "Portable declarations use device authorization and do not claim a browser origin."
13
+ },
14
+ "id": {
15
+ "type": "string",
16
+ "minLength": 5,
17
+ "maxLength": 150,
18
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z][a-z0-9-]*){2,}$",
19
+ "description": "Stable reverse-domain application identifier. This is presentation metadata, not publisher authentication."
20
+ },
21
+ "name": { "type": "string", "minLength": 1, "maxLength": 100 },
22
+ "homepage": { "type": "string", "format": "uri", "pattern": "^https://" },
23
+ "project_url": { "type": "string", "format": "uri", "pattern": "^https://" },
24
+ "icon": { "type": "string", "format": "uri", "pattern": "^https://" },
25
+ "redirect_uris": {
26
+ "type": "array",
27
+ "minItems": 1,
28
+ "maxItems": 10,
29
+ "uniqueItems": true,
30
+ "items": {
31
+ "type": "string",
32
+ "format": "uri",
33
+ "description": "An HTTPS URI on the homepage origin or a private-use scheme derived from the application ID."
34
+ }
35
+ },
36
+ "requirements": { "$ref": "#/$defs/requirements" },
37
+ "provisions": {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "required": ["type_packs"],
41
+ "properties": {
42
+ "configuration": {
43
+ "type": "array",
44
+ "maxItems": 50,
45
+ "items": { "$ref": "#/$defs/configurationProvision" }
46
+ },
47
+ "type_packs": {
48
+ "type": "array",
49
+ "maxItems": 20,
50
+ "items": { "$ref": "#/$defs/typePackProvision" }
51
+ }
52
+ }
53
+ },
54
+ "notifications": {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": ["criteria"],
58
+ "properties": {
59
+ "criteria": {
60
+ "type": "array",
61
+ "maxItems": 50,
62
+ "items": { "$ref": "#/$defs/notificationCriterion" }
63
+ },
64
+ "native_delivery": { "$ref": "#/$defs/nativeNotificationDelivery" }
65
+ }
66
+ }
67
+ },
68
+ "oneOf": [
69
+ {
70
+ "required": ["homepage", "redirect_uris"],
71
+ "properties": {
72
+ "distribution": { "const": "web" },
73
+ "homepage": true,
74
+ "redirect_uris": true,
75
+ "project_url": false
76
+ }
77
+ },
78
+ {
79
+ "required": ["distribution"],
80
+ "properties": {
81
+ "distribution": { "const": "portable" },
82
+ "homepage": false,
83
+ "redirect_uris": false
84
+ }
85
+ }
86
+ ],
87
+ "$defs": {
88
+ "identifier": {
89
+ "type": "string",
90
+ "minLength": 1,
91
+ "maxLength": 100,
92
+ "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$"
93
+ },
94
+ "duration": {
95
+ "type": "string",
96
+ "pattern": "^[0-9]+(ms|s|m|h|d)$"
97
+ },
98
+ "contract": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["id", "version", "digest"],
102
+ "properties": {
103
+ "id": { "$ref": "#/$defs/identifier" },
104
+ "version": {
105
+ "type": "string",
106
+ "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-]+)*)?$"
107
+ },
108
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
109
+ }
110
+ },
111
+ "requirements": {
112
+ "type": "object",
113
+ "additionalProperties": false,
114
+ "required": ["access", "contracts"],
115
+ "properties": {
116
+ "capabilities": { "$ref": "#/$defs/capabilityRequirements" },
117
+ "access": {
118
+ "const": "full_collection",
119
+ "description": "Compatibility declaration for collection-level application authorization."
120
+ },
121
+ "collection_kind": {
122
+ "const": "hosted",
123
+ "description": "Require a durable provider-backed collection with direct sync support."
124
+ },
125
+ "files": { "$ref": "#/$defs/fileRequirement" },
126
+ "configuration": {
127
+ "type": "array",
128
+ "maxItems": 50,
129
+ "items": { "$ref": "#/$defs/configurationRequirement" }
130
+ },
131
+ "contracts": {
132
+ "type": "array",
133
+ "maxItems": 20,
134
+ "uniqueItems": true,
135
+ "items": { "$ref": "#/$defs/contract" }
136
+ }
137
+ }
138
+ },
139
+ "capabilityRequirements": {
140
+ "type": "object",
141
+ "additionalProperties": false,
142
+ "required": ["contract_version", "required"],
143
+ "properties": {
144
+ "contract_version": { "const": 1 },
145
+ "required": {
146
+ "type": "array",
147
+ "maxItems": 32,
148
+ "uniqueItems": true,
149
+ "items": { "$ref": "#/$defs/applicationCapability" }
150
+ },
151
+ "optional": {
152
+ "type": "array",
153
+ "maxItems": 32,
154
+ "uniqueItems": true,
155
+ "items": { "$ref": "#/$defs/applicationCapability" }
156
+ }
157
+ }
158
+ },
159
+ "configurationValue": {
160
+ "anyOf": [
161
+ { "type": "string" },
162
+ { "type": "number" },
163
+ { "type": "boolean" },
164
+ { "type": "null" }
165
+ ]
166
+ },
167
+ "configurationRequirement": {
168
+ "type": "object",
169
+ "additionalProperties": false,
170
+ "required": ["id", "path", "predicate", "value"],
171
+ "properties": {
172
+ "id": {
173
+ "type": "string",
174
+ "minLength": 1,
175
+ "maxLength": 100,
176
+ "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
177
+ },
178
+ "path": { "type": "string", "minLength": 1, "maxLength": 1024 },
179
+ "predicate": { "const": "contains" },
180
+ "value": { "$ref": "#/$defs/configurationValue" }
181
+ }
182
+ },
183
+ "configurationProvision": {
184
+ "type": "object",
185
+ "additionalProperties": false,
186
+ "required": ["requirement", "operation", "path", "value"],
187
+ "properties": {
188
+ "requirement": {
189
+ "type": "string",
190
+ "minLength": 1,
191
+ "maxLength": 100,
192
+ "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
193
+ },
194
+ "operation": { "const": "set_add" },
195
+ "path": { "type": "string", "minLength": 1, "maxLength": 1024 },
196
+ "value": { "$ref": "#/$defs/configurationValue" }
197
+ }
198
+ },
199
+ "applicationCapability": {
200
+ "enum": [
201
+ "collection.inspect",
202
+ "records.watch",
203
+ "records.read",
204
+ "records.query",
205
+ "records.validate",
206
+ "records.create",
207
+ "records.update",
208
+ "records.delete",
209
+ "records.rename",
210
+ "views.list",
211
+ "views.execute",
212
+ "views.source.read",
213
+ "views.source.create",
214
+ "views.source.update",
215
+ "views.source.delete",
216
+ "definitions.contracts.current",
217
+ "definitions.read",
218
+ "definitions.create",
219
+ "definitions.update",
220
+ "definitions.type-pack.inspect",
221
+ "definitions.type-pack.apply",
222
+ "collection.setup.apply",
223
+ "timers.list",
224
+ "timers.put",
225
+ "timers.cancel",
226
+ "timers.reconcile",
227
+ "sync.offline-replica",
228
+ "notifications.background-delivery",
229
+ "files.list",
230
+ "files.read",
231
+ "files.add",
232
+ "files.replace",
233
+ "files.move",
234
+ "files.delete"
235
+ ]
236
+ },
237
+ "fileRequirement": {
238
+ "type": "object",
239
+ "additionalProperties": false,
240
+ "required": ["actions", "scope"],
241
+ "properties": {
242
+ "actions": {
243
+ "type": "array",
244
+ "minItems": 1,
245
+ "maxItems": 6,
246
+ "uniqueItems": true,
247
+ "items": {
248
+ "enum": ["list", "read", "add", "replace", "move", "delete"]
249
+ }
250
+ },
251
+ "scope": { "$ref": "#/$defs/fileScope" }
252
+ }
253
+ },
254
+ "fileScope": {
255
+ "oneOf": [
256
+ {
257
+ "type": "object",
258
+ "additionalProperties": false,
259
+ "required": ["kind", "folders"],
260
+ "properties": {
261
+ "kind": { "const": "selected_folders" },
262
+ "folders": {
263
+ "type": "array",
264
+ "minItems": 1,
265
+ "maxItems": 100,
266
+ "uniqueItems": true,
267
+ "items": {
268
+ "type": "string",
269
+ "minLength": 1,
270
+ "maxLength": 1024,
271
+ "pattern": "^(?!/)(?!\\.)(?!.*//)(?!.*\\\\)(?!.*/\\.)(?!(?:_contracts|_schemas|_types|_views|node_modules)(?:/|$))(?!.*\\/(?:_contracts|_schemas|_types|_views|node_modules)(?:/|$))(?!.*/$).+$"
272
+ }
273
+ }
274
+ }
275
+ },
276
+ {
277
+ "type": "object",
278
+ "additionalProperties": false,
279
+ "required": ["kind"],
280
+ "properties": { "kind": { "const": "collection" } }
281
+ }
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
+ "uniqueItems": true,
300
+ "items": { "$ref": "#/$defs/contract" }
301
+ }
302
+ }
303
+ },
304
+ "typePackManifest": {
305
+ "type": "object",
306
+ "required": ["kind", "id", "version", "resources"],
307
+ "properties": {
308
+ "kind": { "const": "mdbase.type-pack" },
309
+ "id": { "$ref": "#/$defs/identifier" },
310
+ "version": { "$ref": "#/$defs/contract/properties/version" },
311
+ "name": { "type": "string", "minLength": 1, "maxLength": 100 },
312
+ "description": { "type": "string", "maxLength": 500 },
313
+ "resources": {
314
+ "type": "array",
315
+ "minItems": 1,
316
+ "maxItems": 100,
317
+ "items": { "$ref": "#/$defs/typePackManifestResource" }
318
+ }
319
+ },
320
+ "patternProperties": { "^x-[A-Za-z][A-Za-z0-9._:-]{0,127}$": true },
321
+ "additionalProperties": false
322
+ },
323
+ "typePackManifestResource": {
324
+ "type": "object",
325
+ "additionalProperties": false,
326
+ "required": ["kind", "mode", "source", "target", "digest"],
327
+ "properties": {
328
+ "kind": { "enum": ["contract", "type", "schema"] },
329
+ "mode": { "enum": ["managed", "seed"] },
330
+ "source": { "type": "string", "minLength": 1, "maxLength": 240 },
331
+ "target": { "type": "string", "minLength": 1, "maxLength": 240 },
332
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
333
+ }
334
+ },
335
+ "typePackSourceResource": {
336
+ "type": "object",
337
+ "additionalProperties": false,
338
+ "required": ["source", "document"],
339
+ "properties": {
340
+ "source": { "type": "string", "minLength": 1, "maxLength": 240 },
341
+ "document": { "type": "string", "maxLength": 262144 }
342
+ }
343
+ },
344
+ "notificationCriterion": {
345
+ "type": "object",
346
+ "additionalProperties": false,
347
+ "required": ["id", "event", "presentation"],
348
+ "properties": {
349
+ "id": { "$ref": "#/$defs/identifier" },
350
+ "event": { "$ref": "#/$defs/contract" },
351
+ "if": {
352
+ "type": "object",
353
+ "additionalProperties": false,
354
+ "required": ["$expr"],
355
+ "properties": {
356
+ "$expr": { "type": "string", "minLength": 1, "maxLength": 4096 }
357
+ }
358
+ },
359
+ "debounce": { "$ref": "#/$defs/duration" },
360
+ "minimum_interval": { "$ref": "#/$defs/duration" },
361
+ "presentation": {
362
+ "type": "object",
363
+ "additionalProperties": false,
364
+ "required": ["title"],
365
+ "properties": {
366
+ "title": { "type": "string", "minLength": 1, "maxLength": 80 },
367
+ "body": { "type": "string", "maxLength": 160 },
368
+ "tag": { "type": "string", "minLength": 1, "maxLength": 80 }
369
+ }
370
+ }
371
+ }
372
+ },
373
+ "nativeNotificationDelivery": {
374
+ "oneOf": [
375
+ {
376
+ "type": "object",
377
+ "additionalProperties": false,
378
+ "required": ["mode", "firebase_project_id"],
379
+ "properties": {
380
+ "mode": { "const": "managed_fcm" },
381
+ "firebase_project_id": {
382
+ "type": "string",
383
+ "minLength": 6,
384
+ "maxLength": 63,
385
+ "pattern": "^[a-z][a-z0-9-]*[a-z0-9]$"
386
+ }
387
+ }
388
+ },
389
+ {
390
+ "type": "object",
391
+ "additionalProperties": false,
392
+ "required": ["mode", "url"],
393
+ "properties": {
394
+ "mode": { "const": "webhook" },
395
+ "url": {
396
+ "type": "string",
397
+ "format": "uri",
398
+ "pattern": "^https://"
399
+ }
400
+ }
401
+ }
402
+ ]
403
+ }
404
+ }
405
+ }