@mdbase-dev/connect-protocol 0.1.0-beta.25 → 0.1.0-beta.27

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/dist/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import type { ConnectProblem } from "./connect-problems.generated.js";
2
2
  import type { ApplicationFileRequirement, CollectionFileDescriptor, FileCapability } from "./files.js";
3
3
  import type { CollectionOperation } from "./operations.js";
4
+ import type { ContractRequirement, ContractSetupChoice, TypePackProvision } from "./type-packs.js";
4
5
  import type { ApplicationAuthorizationProof } from "./application-authorization.js";
5
6
  export * from "./connect-problems.generated.js";
6
7
  export * from "./files.js";
7
8
  export * from "./operations.js";
8
9
  export * from "./application-authorization.js";
10
+ export * from "./type-packs.js";
9
11
  export declare const CONTROL_PROTOCOL_VERSION: 1;
10
12
  export declare const ENCRYPTED_RELAY_PROTOCOL_VERSION: 1;
11
13
  export declare const FIRST_CONTACT_PROTOCOL_VERSION: 1;
@@ -142,11 +144,6 @@ export interface NotificationWebhook {
142
144
  connection_id: string;
143
145
  notification: MdbaseNotification;
144
146
  }
145
- export interface ContractRequirement {
146
- id: string;
147
- /** Exact semantic version of the collection-local mdbase data contract. */
148
- version: string;
149
- }
150
147
  export interface ApplicationRequirements {
151
148
  contracts: ContractRequirement[];
152
149
  /** Access boundary requested after compatibility and provisioning checks. */
@@ -156,60 +153,9 @@ export interface ApplicationRequirements {
156
153
  /** First-class non-Markdown file access requested independently of records. */
157
154
  files?: ApplicationFileRequirement;
158
155
  }
159
- export interface TypePackManifestResource {
160
- kind: "contract" | "type" | "schema";
161
- source: string;
162
- target: string;
163
- digest: string;
164
- }
165
- export interface TypePackManifest {
166
- kind: "mdbase.type-pack";
167
- id: string;
168
- version: string;
169
- name?: string;
170
- description?: string;
171
- resources: TypePackManifestResource[];
172
- [extension: `x-${string}`]: unknown;
173
- }
174
- export interface TypePackSourceResource {
175
- source: string;
176
- document: string;
177
- }
178
- export interface TypePackProvision {
179
- /** Canonical type-pack manifest shown during approval and verified on install. */
180
- manifest: TypePackManifest;
181
- /** Exact UTF-8 resource bytes, keyed by each manifest source path. */
182
- resources: TypePackSourceResource[];
183
- /** Data contracts expected after the complete pack is installed. */
184
- provides: ContractRequirement[];
185
- }
186
- export interface TypePackResourceDiff {
187
- target: string;
188
- kind: "contract" | "type" | "schema";
189
- action: "create" | "replace" | "unchanged";
190
- digest: string;
191
- }
192
- export interface TypePackInstallResult {
193
- id: string;
194
- version: string;
195
- resources: TypePackResourceDiff[];
196
- cleanup_deferred: boolean;
197
- }
198
156
  export interface ApplicationProvisions {
199
157
  type_packs: TypePackProvision[];
200
158
  }
201
- export type ContractSetupChoice = {
202
- contract: ContractRequirement;
203
- mode: "starter";
204
- } | {
205
- contract: ContractRequirement;
206
- mode: "existing";
207
- type_name: string;
208
- /** Exact type source revision shown during approval. */
209
- type_revision: string;
210
- fields: Record<string, string>;
211
- binding?: JsonObject;
212
- };
213
159
  export interface GrantScope {
214
160
  /**
215
161
  * Exact contract definitions and sorted implementation sets approved by the
@@ -336,7 +282,7 @@ export interface SyncCollectionResources {
336
282
  }
337
283
  export interface SyncResourceDocument {
338
284
  path: string;
339
- kind: "configuration" | "type" | "contract" | "schema" | "view";
285
+ kind: "configuration" | "lock" | "type" | "contract" | "schema" | "view";
340
286
  /** SHA-256 revision of the exact UTF-8 document (`sha256:<lowercase hex>`). */
341
287
  revision: string;
342
288
  document: string;
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ export * from "./connect-problems.generated.js";
2
2
  export * from "./files.js";
3
3
  export * from "./operations.js";
4
4
  export * from "./application-authorization.js";
5
+ export * from "./type-packs.js";
5
6
  export const CONTROL_PROTOCOL_VERSION = 1;
6
7
  export const ENCRYPTED_RELAY_PROTOCOL_VERSION = 1;
7
8
  export const FIRST_CONTACT_PROTOCOL_VERSION = 1;
@@ -1 +1 @@
1
- export type CollectionOperation = "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";
1
+ export type CollectionOperation = "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" | "list_timers" | "put_timer" | "cancel_timer" | "reconcile_timers" | "sync";
@@ -0,0 +1,133 @@
1
+ export interface ContractRequirement {
2
+ id: string;
3
+ /** Exact semantic version of the collection-local mdbase data contract. */
4
+ version: string;
5
+ /** Exact digest of the resolved portable contract identity. */
6
+ digest: string;
7
+ }
8
+ /** Exact identity of the standard record-created runtime event contract. */
9
+ export declare const MDBASE_RECORD_CREATED_CONTRACT: {
10
+ readonly id: "mdbase.record.created";
11
+ readonly version: "1.0.0";
12
+ readonly digest: "sha256:7f3bed6baa356ee9389e977ae7b77a102e2bee871a7c1d9f2026fc21cacdbfc9";
13
+ };
14
+ /** Exact identity of the standard record-modified runtime event contract. */
15
+ export declare const MDBASE_RECORD_MODIFIED_CONTRACT: {
16
+ readonly id: "mdbase.record.modified";
17
+ readonly version: "1.0.0";
18
+ readonly digest: "sha256:064187148a95701a1f5c749643d306d3c6708470b6b7ab0bf0c698d38dbcabe3";
19
+ };
20
+ /** Exact identity of the standard record-deleted runtime event contract. */
21
+ export declare const MDBASE_RECORD_DELETED_CONTRACT: {
22
+ readonly id: "mdbase.record.deleted";
23
+ readonly version: "1.0.0";
24
+ readonly digest: "sha256:84e5fb0f9d3bfdcd53f76cdc5035f94c7693fdea39a8ead190b10b422dd2ee09";
25
+ };
26
+ /** Exact identity of the standard record-renamed runtime event contract. */
27
+ export declare const MDBASE_RECORD_RENAMED_CONTRACT: {
28
+ readonly id: "mdbase.record.renamed";
29
+ readonly version: "1.0.0";
30
+ readonly digest: "sha256:c825ef8d7db775b784d7af27e6acdf6f2799d2c6440d486f5bfa78afcca71471";
31
+ };
32
+ /** Exact identity of the standard timer-fired runtime event contract. */
33
+ export declare const MDBASE_TIMER_FIRED_CONTRACT: {
34
+ readonly id: "mdbase.runtime.timer.fired";
35
+ readonly version: "1.0.0";
36
+ readonly digest: "sha256:41105be7a7abf33b31ced47e1e1965242236e40ccaea286b959b0a8c591f5642";
37
+ };
38
+ export interface TypePackManifestResource {
39
+ kind: "contract" | "type" | "schema";
40
+ mode: "managed" | "seed";
41
+ source: string;
42
+ target: string;
43
+ digest: string;
44
+ }
45
+ export interface TypePackManifest {
46
+ kind: "mdbase.type-pack";
47
+ id: string;
48
+ version: string;
49
+ name?: string;
50
+ description?: string;
51
+ resources: TypePackManifestResource[];
52
+ [extension: `x-${string}`]: unknown;
53
+ }
54
+ export interface TypePackSourceResource {
55
+ source: string;
56
+ document: string;
57
+ }
58
+ export interface TypePackProvision {
59
+ /** Canonical type-pack manifest shown during approval and verified on install. */
60
+ manifest: TypePackManifest;
61
+ /** Exact UTF-8 resource bytes, keyed by each manifest source path. */
62
+ resources: TypePackSourceResource[];
63
+ /** Data contracts expected after the complete pack is installed. */
64
+ provides: ContractRequirement[];
65
+ }
66
+ export interface TypePackResourceDiff {
67
+ source: string;
68
+ target: string;
69
+ kind: "contract" | "type" | "schema";
70
+ mode: "managed" | "seed";
71
+ action: "create" | "update" | "delete" | "adopt" | "unchanged" | "preserve" | "conflict";
72
+ digest: string;
73
+ current_digest?: string;
74
+ installed_digest?: string;
75
+ adopted_from_digest?: string;
76
+ reason?: string;
77
+ }
78
+ export interface TypePackReceipt {
79
+ id: string;
80
+ version: string;
81
+ digest: string;
82
+ installed_by: string;
83
+ resources: Omit<TypePackResourceDiff, "action" | "current_digest" | "installed_digest" | "reason">[];
84
+ }
85
+ export interface TypePackAssessment {
86
+ status: "current" | "install" | "upgrade" | "downgrade" | "reconfigure" | "conflict";
87
+ applicable: boolean;
88
+ assessment_digest: string;
89
+ current?: TypePackReceipt;
90
+ desired: TypePackReceipt;
91
+ resources: TypePackResourceDiff[];
92
+ lock: {
93
+ target: "mdbase.lock.yaml";
94
+ action: "create" | "update" | "unchanged";
95
+ digest: string;
96
+ };
97
+ contract_setups: {
98
+ choices: ContractSetupChoice[];
99
+ resources: TypePackResourceDiff[];
100
+ };
101
+ }
102
+ export interface TypePackApplyResult extends TypePackAssessment {
103
+ receipt: TypePackReceipt;
104
+ cleanup_deferred: boolean;
105
+ }
106
+ export interface AssessTypePackInput {
107
+ provision: TypePackProvision;
108
+ installed_by: string;
109
+ /** Explicit digest-pinned consent to claim differing unmanaged managed targets. */
110
+ adopt_resources?: Record<string, string>;
111
+ /** Seed resources deliberately omitted because the user selected an existing implementation. */
112
+ preserve_seed_targets?: string[];
113
+ /** Resolve canonical manifest targets to collection-specific paths. */
114
+ target_overrides?: Record<string, string>;
115
+ /** Reviewed edits to user-owned types, committed atomically with the pack. */
116
+ contract_setups?: ContractSetupChoice[];
117
+ }
118
+ export interface ApplyTypePackInput extends AssessTypePackInput {
119
+ expected_assessment_digest: string;
120
+ allow_downgrade?: boolean;
121
+ }
122
+ export type ContractSetupChoice = {
123
+ contract: ContractRequirement;
124
+ mode: "starter";
125
+ } | {
126
+ contract: ContractRequirement;
127
+ mode: "existing";
128
+ type_name: string;
129
+ /** Exact type source revision shown during approval. */
130
+ type_revision: string;
131
+ fields: Record<string, string>;
132
+ binding?: Record<string, unknown>;
133
+ };
@@ -0,0 +1,30 @@
1
+ /** Exact identity of the standard record-created runtime event contract. */
2
+ export const MDBASE_RECORD_CREATED_CONTRACT = {
3
+ id: "mdbase.record.created",
4
+ version: "1.0.0",
5
+ digest: "sha256:7f3bed6baa356ee9389e977ae7b77a102e2bee871a7c1d9f2026fc21cacdbfc9",
6
+ };
7
+ /** Exact identity of the standard record-modified runtime event contract. */
8
+ export const MDBASE_RECORD_MODIFIED_CONTRACT = {
9
+ id: "mdbase.record.modified",
10
+ version: "1.0.0",
11
+ digest: "sha256:064187148a95701a1f5c749643d306d3c6708470b6b7ab0bf0c698d38dbcabe3",
12
+ };
13
+ /** Exact identity of the standard record-deleted runtime event contract. */
14
+ export const MDBASE_RECORD_DELETED_CONTRACT = {
15
+ id: "mdbase.record.deleted",
16
+ version: "1.0.0",
17
+ digest: "sha256:84e5fb0f9d3bfdcd53f76cdc5035f94c7693fdea39a8ead190b10b422dd2ee09",
18
+ };
19
+ /** Exact identity of the standard record-renamed runtime event contract. */
20
+ export const MDBASE_RECORD_RENAMED_CONTRACT = {
21
+ id: "mdbase.record.renamed",
22
+ version: "1.0.0",
23
+ digest: "sha256:c825ef8d7db775b784d7af27e6acdf6f2799d2c6440d486f5bfa78afcca71471",
24
+ };
25
+ /** Exact identity of the standard timer-fired runtime event contract. */
26
+ export const MDBASE_TIMER_FIRED_CONTRACT = {
27
+ id: "mdbase.runtime.timer.fired",
28
+ version: "1.0.0",
29
+ digest: "sha256:41105be7a7abf33b31ced47e1e1965242236e40ccaea286b959b0a8c591f5642",
30
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdbase-dev/connect-protocol",
3
- "version": "0.1.0-beta.25",
3
+ "version": "0.1.0-beta.27",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,15 +22,16 @@
22
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
23
  },
24
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"]
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", "list_timers", "put_timer", "cancel_timer", "reconcile_timers", "sync"]
26
26
  },
27
27
  "contractRequirement": {
28
28
  "type": "object",
29
29
  "additionalProperties": false,
30
- "required": ["id", "version"],
30
+ "required": ["id", "version", "digest"],
31
31
  "properties": {
32
32
  "id": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$" },
33
- "version": { "$ref": "#/$defs/semanticVersion" }
33
+ "version": { "$ref": "#/$defs/semanticVersion" },
34
+ "digest": { "$ref": "#/$defs/digest" }
34
35
  }
35
36
  },
36
37
  "semanticVersion": {
@@ -371,9 +372,10 @@
371
372
  "typePackManifestResource": {
372
373
  "type": "object",
373
374
  "additionalProperties": false,
374
- "required": ["kind", "source", "target", "digest"],
375
+ "required": ["kind", "mode", "source", "target", "digest"],
375
376
  "properties": {
376
377
  "kind": { "enum": ["contract", "type", "schema"] },
378
+ "mode": { "enum": ["managed", "seed"] },
377
379
  "source": { "type": "string", "minLength": 1, "maxLength": 500 },
378
380
  "target": { "type": "string", "minLength": 1, "maxLength": 500 },
379
381
  "digest": { "$ref": "#/$defs/digest" }
@@ -14,7 +14,7 @@
14
14
  "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}$"
15
15
  },
16
16
  "operation": {
17
- "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", "file_control"]
17
+ "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", "list_timers", "put_timer", "cancel_timer", "reconcile_timers", "file_control"]
18
18
  },
19
19
  "envelope": {
20
20
  "type": "object",
@@ -93,13 +93,14 @@
93
93
  "contract": {
94
94
  "type": "object",
95
95
  "additionalProperties": false,
96
- "required": ["id", "version"],
96
+ "required": ["id", "version", "digest"],
97
97
  "properties": {
98
98
  "id": { "$ref": "#/$defs/identifier" },
99
99
  "version": {
100
100
  "type": "string",
101
101
  "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-]+)*)?$"
102
- }
102
+ },
103
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
103
104
  }
104
105
  },
105
106
  "requirements": {
@@ -213,9 +214,10 @@
213
214
  "typePackManifestResource": {
214
215
  "type": "object",
215
216
  "additionalProperties": false,
216
- "required": ["kind", "source", "target", "digest"],
217
+ "required": ["kind", "mode", "source", "target", "digest"],
217
218
  "properties": {
218
219
  "kind": { "enum": ["contract", "type", "schema"] },
220
+ "mode": { "enum": ["managed", "seed"] },
219
221
  "source": { "type": "string", "minLength": 1, "maxLength": 240 },
220
222
  "target": { "type": "string", "minLength": 1, "maxLength": 240 },
221
223
  "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
@@ -89,7 +89,7 @@
89
89
  "required": ["path", "kind", "revision", "document"],
90
90
  "properties": {
91
91
  "path": { "type": "string", "minLength": 1 },
92
- "kind": { "enum": ["configuration", "type", "contract", "schema", "view"] },
92
+ "kind": { "enum": ["configuration", "lock", "type", "contract", "schema", "view"] },
93
93
  "revision": { "$ref": "#/$defs/digest" },
94
94
  "document": { "type": "string" }
95
95
  }