@mdbase-dev/connect-protocol 0.1.0-beta.126 → 0.1.0-beta.147
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/application-contract.d.ts +23 -0
- package/dist/application-contract.js +76 -0
- package/dist/application-declaration.d.ts +120 -0
- package/dist/application-declaration.js +1 -0
- package/dist/authorization-errors.d.ts +34 -0
- package/dist/authorization-errors.js +52 -0
- package/dist/connect-problems.generated.d.ts +134 -0
- package/dist/connect-problems.generated.js +23 -0
- package/dist/index.d.ts +10 -115
- package/dist/index.js +4 -0
- package/dist/manifest-validators.generated.d.ts +13 -0
- package/dist/manifest-validators.generated.js +7940 -0
- package/dist/manifest.d.ts +3 -0
- package/dist/manifest.js +70 -33
- package/dist/next-authorization.d.ts +30 -0
- package/dist/next-authorization.js +90 -0
- package/package.json +10 -4
- package/schemas/connect-problem.v1.schema.json +493 -0
- package/schemas/connect-problems.v1.catalog.json +21 -0
- package/schemas/connect-protocol.v1.schema.json +1 -0
- package/schemas/mdbase-app.legacy-v1.schema.json +25 -0
- package/schemas/mdbase-app.schema.json +25 -0
- package/schemas/next-trust.v1.schema.json +54 -0
|
@@ -3,8 +3,11 @@ export const CONNECT_PROBLEM_VERSION = 1;
|
|
|
3
3
|
export const CONNECT_PROBLEM_CATALOG = {
|
|
4
4
|
"access_denied": { category: "authorization", recovery: "reauthorize" },
|
|
5
5
|
"access_paused": { category: "availability", recovery: "resume_connector_access" },
|
|
6
|
+
"application_authorization_issuance_disabled": { category: "authorization", recovery: "reauthorize" },
|
|
6
7
|
"application_declaration_mismatch": { category: "authorization", recovery: "reauthorize" },
|
|
7
8
|
"application_identity_unavailable": { category: "compatibility", recovery: "upgrade_application" },
|
|
9
|
+
"application_reauthorization_required": { category: "authorization", recovery: "reauthorize" },
|
|
10
|
+
"application_semantic_version_mismatch": { category: "authorization", recovery: "reauthorize" },
|
|
8
11
|
"approval_window_blocked": { category: "authorization", recovery: "reauthorize" },
|
|
9
12
|
"authority_authorization_changed": { category: "authorization", recovery: "reauthorize" },
|
|
10
13
|
"authorization_binding_incompatible": { category: "compatibility", recovery: "upgrade_application" },
|
|
@@ -16,6 +19,7 @@ export const CONNECT_PROBLEM_CATALOG = {
|
|
|
16
19
|
"capability_contract_incompatible": { category: "compatibility", recovery: "upgrade_application" },
|
|
17
20
|
"change_cursor_reset": { category: "conflict", recovery: "refresh" },
|
|
18
21
|
"collection_access_denied": { category: "authorization", recovery: "reauthorize" },
|
|
22
|
+
"collection_claimed_by_newer_runtime": { category: "compatibility", recovery: "upgrade_connector" },
|
|
19
23
|
"collection_configuration_invalid": { category: "validation", recovery: "repair_collection" },
|
|
20
24
|
"collection_contracts_missing": { category: "compatibility", recovery: "choose_collection" },
|
|
21
25
|
"collection_incompatible": { category: "compatibility", recovery: "choose_collection" },
|
|
@@ -26,6 +30,7 @@ export const CONNECT_PROBLEM_CATALOG = {
|
|
|
26
30
|
"collection_not_ready": { category: "selection", recovery: "choose_collection" },
|
|
27
31
|
"collection_not_selected": { category: "selection", recovery: "choose_collection" },
|
|
28
32
|
"collection_type_registry_invalid": { category: "validation", recovery: "repair_collection" },
|
|
33
|
+
"collection_unavailable": { category: "availability", recovery: "choose_collection" },
|
|
29
34
|
"collection_version_unsupported": { category: "compatibility", recovery: "upgrade_collection" },
|
|
30
35
|
"concurrent_modification": { category: "conflict", recovery: "refresh" },
|
|
31
36
|
"connector_busy": { category: "availability", recovery: "retry" },
|
|
@@ -66,6 +71,7 @@ export const CONNECT_PROBLEM_CATALOG = {
|
|
|
66
71
|
"invalid_push_payload": { category: "validation", recovery: "fix_request" },
|
|
67
72
|
"invalid_push_subscription": { category: "validation", recovery: "fix_request" },
|
|
68
73
|
"invalid_read_cursor": { category: "validation", recovery: "fix_request" },
|
|
74
|
+
"invalid_replica": { category: "authorization", recovery: "reauthorize" },
|
|
69
75
|
"invalid_request": { category: "validation", recovery: "fix_request" },
|
|
70
76
|
"invalid_token_response": { category: "integrity", recovery: "contact_support" },
|
|
71
77
|
"legacy_scope_reauthorization_required": { category: "authorization", recovery: "reauthorize" },
|
|
@@ -79,6 +85,7 @@ export const CONNECT_PROBLEM_CATALOG = {
|
|
|
79
85
|
"not_authorized": { category: "authorization", recovery: "reauthorize" },
|
|
80
86
|
"not_remote_authority": { category: "compatibility", recovery: "choose_collection" },
|
|
81
87
|
"notification_criterion_not_declared": { category: "validation", recovery: "fix_request" },
|
|
88
|
+
"notification_grant_reauthorization_required": { category: "authorization", recovery: "reauthorize" },
|
|
82
89
|
"notification_reauthorization_required": { category: "authorization", recovery: "reauthorize" },
|
|
83
90
|
"notification_registration_failed": { category: "availability", recovery: "retry" },
|
|
84
91
|
"notification_unregistration_failed": { category: "availability", recovery: "retry" },
|
|
@@ -88,6 +95,7 @@ export const CONNECT_PROBLEM_CATALOG = {
|
|
|
88
95
|
"operation_failed": { category: "internal", recovery: "contact_support" },
|
|
89
96
|
"operation_invalid": { category: "validation", recovery: "fix_request" },
|
|
90
97
|
"operation_outcome_unknown": { category: "conflict", recovery: "resolve_outcome" },
|
|
98
|
+
"origin_denied": { category: "authorization", recovery: "reauthorize" },
|
|
91
99
|
"path_occupied": { category: "conflict", recovery: "resolve_conflict" },
|
|
92
100
|
"pending_mutation_unresolved": { category: "conflict", recovery: "resolve_outcome" },
|
|
93
101
|
"query_snapshot_changed": { category: "conflict", recovery: "refresh" },
|
|
@@ -102,8 +110,11 @@ export const CONNECT_PROBLEM_CATALOG = {
|
|
|
102
110
|
"registry_schema_incompatible": { category: "compatibility", recovery: "upgrade_connector" },
|
|
103
111
|
"relay_authorization_expired": { category: "authorization", recovery: "reauthorize" },
|
|
104
112
|
"relay_unavailable": { category: "availability", recovery: "retry" },
|
|
113
|
+
"replica_scope_denied": { category: "authorization", recovery: "reauthorize" },
|
|
105
114
|
"sandbox_unsupported": { category: "compatibility", recovery: "fix_request" },
|
|
115
|
+
"scope_changed": { category: "authorization", recovery: "reauthorize" },
|
|
106
116
|
"scope_denied": { category: "authorization", recovery: "reauthorize" },
|
|
117
|
+
"scope_epoch_stale": { category: "authorization", recovery: "reauthorize" },
|
|
107
118
|
"session_destroyed": { category: "cancellation", recovery: "none" },
|
|
108
119
|
"session_not_started": { category: "validation", recovery: "fix_request" },
|
|
109
120
|
"session_starting": { category: "availability", recovery: "retry" },
|
|
@@ -112,6 +123,7 @@ export const CONNECT_PROBLEM_CATALOG = {
|
|
|
112
123
|
"sync_failed": { category: "availability", recovery: "retry" },
|
|
113
124
|
"temporarily_unavailable": { category: "availability", recovery: "retry" },
|
|
114
125
|
"timeout": { category: "availability", recovery: "retry" },
|
|
126
|
+
"timer_grant_unavailable": { category: "authorization", recovery: "reauthorize" },
|
|
115
127
|
"token_exchange_failed": { category: "availability", recovery: "retry" },
|
|
116
128
|
"transport_protocol_incompatible": { category: "compatibility", recovery: "upgrade_connector" },
|
|
117
129
|
"type_pack_provision_failed": { category: "validation", recovery: "repair_collection" },
|
|
@@ -289,6 +301,17 @@ const CONNECT_PROBLEM_DETAIL_SCHEMAS = {
|
|
|
289
301
|
}
|
|
290
302
|
}
|
|
291
303
|
},
|
|
304
|
+
"collection_unavailable": {
|
|
305
|
+
"type": "object",
|
|
306
|
+
"required": [
|
|
307
|
+
"reason"
|
|
308
|
+
],
|
|
309
|
+
"properties": {
|
|
310
|
+
"reason": {
|
|
311
|
+
"type": "string"
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
},
|
|
292
315
|
"collection_version_unsupported": {
|
|
293
316
|
"type": "object",
|
|
294
317
|
"required": [
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { ConnectProblem } from "./connect-problems.generated.js";
|
|
2
2
|
import type { JsonObject, QueryRecord } from "./records.js";
|
|
3
3
|
export * from "./records.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { NotificationCriterion } from "./application-declaration.js";
|
|
5
|
+
export type { NotificationCriterion, NativeNotificationDelivery, ApplicationNotifications, CanonicalApplicationRequirements, MdbaseWebAppManifest, MdbasePortableAppManifest, MdbaseAppManifest, ApplicationRequirements, LegacyApplicationRequirements, LegacyMdbaseWebAppManifest, LegacyMdbasePortableAppManifest, LegacyMdbaseAppManifest, ApplicationProvisions } from "./application-declaration.js";
|
|
6
|
+
import type { CollectionFileDescriptor, FileCapability } from "./files.js";
|
|
5
7
|
import type { CollectionOperation } from "./operations.js";
|
|
6
|
-
import type {
|
|
7
|
-
import type { ContractRequirement, ContractSetupChoice, TypePackProvision } from "./type-packs.js";
|
|
8
|
-
import { type ConfigurationProvision, type ConfigurationRequirement } from "./collection-setup.js";
|
|
8
|
+
import type { ContractSetupChoice } from "./type-packs.js";
|
|
9
9
|
import type { ApplicationAuthorizationProof } from "./application-authorization.js";
|
|
10
10
|
export * from "./connect-problems.generated.js";
|
|
11
|
+
export { MdbaseConnectError, connectError, connectProblem, type ConnectErrorContext } from "./authorization-errors.js";
|
|
12
|
+
export { semanticContractVersion, authorizationOperations, authorizationFiles, validateAuthorizationSelection, declaredOperations, retainedCapabilities, DEFAULT_OPERATIONS, type MdbaseApplicationManifest, type MdbaseApplicationRequirements, type MdbaseApplicationCapabilityRequirements, type MdbaseApplicationCapabilityId } from "./application-contract.js";
|
|
11
13
|
export * from "./files.js";
|
|
12
14
|
export * from "./operations.js";
|
|
13
15
|
export * from "./change-events.generated.js";
|
|
@@ -28,6 +30,8 @@ export declare const CONTRACT_SETUP_CAPABILITY: "contract-setup-v1";
|
|
|
28
30
|
export declare const FILE_RELAY_CAPABILITY: "file-relay-v1";
|
|
29
31
|
export declare const PROTOCOL_USAGE_REPORT_CAPABILITY: "protocol-usage-report-v1";
|
|
30
32
|
export declare const POLICY_FRESHNESS_LEASE_CAPABILITY: "policy-freshness-lease-v1";
|
|
33
|
+
/** Opt-in raw account-bound next policy projection; never a legacy default. */
|
|
34
|
+
export declare const NEXT_ACCOUNT_CAPABILITY: "next_account_v1";
|
|
31
35
|
/** Advertised beta capabilities are intentionally broader than the beta baseline. */
|
|
32
36
|
export declare const RELAY_REQUIRED_CAPABILITIES: readonly ["application-authorization-v4", "authorization-activation", "encrypted-relay", "policy-ack"];
|
|
33
37
|
export declare const MINIMUM_CONNECTOR_VERSION: "0.1.0-beta.33";
|
|
@@ -62,81 +66,6 @@ export declare const CONNECT_SCHEMA_IDS: {
|
|
|
62
66
|
readonly files: "https://mdbase.dev/connect/schemas/files.v1.json";
|
|
63
67
|
readonly sync: "https://mdbase.dev/connect/schemas/sync.v1.json";
|
|
64
68
|
};
|
|
65
|
-
export interface NotificationCriterion {
|
|
66
|
-
/** Stable, manifest-owned identifier selected by an installation. */
|
|
67
|
-
id: string;
|
|
68
|
-
/** Runtime event contract evaluated at the collection authority. */
|
|
69
|
-
event: ContractRequirement;
|
|
70
|
-
/** Canonical mdbase CEL. Event content never leaves the authority for evaluation. */
|
|
71
|
-
if?: {
|
|
72
|
-
$expr: string;
|
|
73
|
-
};
|
|
74
|
-
debounce?: string;
|
|
75
|
-
minimum_interval?: string;
|
|
76
|
-
/** Static Web Push copy. Dynamic record content is intentionally unsupported. */
|
|
77
|
-
presentation: {
|
|
78
|
-
title: string;
|
|
79
|
-
body?: string;
|
|
80
|
-
tag?: string;
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
export type NativeNotificationDelivery = {
|
|
84
|
-
/**
|
|
85
|
-
* Connect sends through FCM using revocable, least-privilege authority
|
|
86
|
-
* granted by the application's Firebase project.
|
|
87
|
-
*/
|
|
88
|
-
mode: "managed_fcm";
|
|
89
|
-
firebase_project_id: string;
|
|
90
|
-
} | {
|
|
91
|
-
/**
|
|
92
|
-
* Connect sends a signed, content-free signal to infrastructure operated
|
|
93
|
-
* by the application developer. That infrastructure owns APNs/FCM.
|
|
94
|
-
*/
|
|
95
|
-
mode: "webhook";
|
|
96
|
-
url: string;
|
|
97
|
-
};
|
|
98
|
-
export interface ApplicationNotifications {
|
|
99
|
-
criteria: NotificationCriterion[];
|
|
100
|
-
/** Optional native delivery route. Web Push registration remains independent. */
|
|
101
|
-
native_delivery?: NativeNotificationDelivery;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* The declaration bundled with an application build and registered inline.
|
|
105
|
-
*
|
|
106
|
-
* `id` is stable presentation metadata rather than proof of a publisher. Each
|
|
107
|
-
* exact declaration is independently identified and authorized by Connect.
|
|
108
|
-
*/
|
|
109
|
-
export type CanonicalApplicationRequirements = Omit<ApplicationRequirements, "access" | "contracts"> & {
|
|
110
|
-
access: "full_collection";
|
|
111
|
-
contracts: [];
|
|
112
|
-
};
|
|
113
|
-
interface MdbaseAppManifestBase {
|
|
114
|
-
manifest_version: 1;
|
|
115
|
-
id: string;
|
|
116
|
-
name: string;
|
|
117
|
-
requirements: CanonicalApplicationRequirements;
|
|
118
|
-
provisions?: ApplicationProvisions;
|
|
119
|
-
notifications?: ApplicationNotifications;
|
|
120
|
-
}
|
|
121
|
-
export interface MdbaseWebAppManifest extends MdbaseAppManifestBase {
|
|
122
|
-
/** Omitted by existing v1 declarations; explicit `web` is equivalent. */
|
|
123
|
-
distribution?: "web";
|
|
124
|
-
homepage: string;
|
|
125
|
-
icon?: string;
|
|
126
|
-
redirect_uris: string[];
|
|
127
|
-
}
|
|
128
|
-
export interface MdbasePortableAppManifest extends MdbaseAppManifestBase {
|
|
129
|
-
/**
|
|
130
|
-
* A downloaded, publisher-unverified application opened from a local file.
|
|
131
|
-
* Portable declarations use device authorization and never claim a web origin.
|
|
132
|
-
*/
|
|
133
|
-
distribution: "portable";
|
|
134
|
-
/** Optional HTTPS page where the user can inspect the project or source. */
|
|
135
|
-
project_url?: string;
|
|
136
|
-
/** Optional HTTPS icon on the project URL's origin. */
|
|
137
|
-
icon?: string;
|
|
138
|
-
}
|
|
139
|
-
export type MdbaseAppManifest = MdbaseWebAppManifest | MdbasePortableAppManifest;
|
|
140
69
|
export interface NotificationSignal {
|
|
141
70
|
/** Stable idempotency key generated by the collection authority. */
|
|
142
71
|
signal_id: string;
|
|
@@ -166,43 +95,7 @@ export interface NotificationWebhook {
|
|
|
166
95
|
connection_id: string;
|
|
167
96
|
notification: MdbaseNotification;
|
|
168
97
|
}
|
|
169
|
-
export interface ApplicationRequirements {
|
|
170
|
-
contracts: ContractRequirement[];
|
|
171
|
-
/** Collection extension values required before the application is ready. */
|
|
172
|
-
configuration?: ConfigurationRequirement[];
|
|
173
|
-
/** Versioned semantic intent compiled by Connect into exact operations. */
|
|
174
|
-
capabilities?: ApplicationCapabilityRequirements;
|
|
175
|
-
/**
|
|
176
|
-
* Collection boundary request. New declarations must explicitly use
|
|
177
|
-
* `full_collection`; omitted and `contract` remain parseable only for legacy
|
|
178
|
-
* diagnosis and reauthorization.
|
|
179
|
-
*/
|
|
180
|
-
access?: "contract" | "full_collection";
|
|
181
|
-
/** Restrict authorization to durable provider-backed collections. */
|
|
182
|
-
collection_kind?: "hosted";
|
|
183
|
-
/** Explicit identity consent. Omission discloses no account metadata. */
|
|
184
|
-
people?: import("./people.js").ApplicationPeopleRequirement;
|
|
185
|
-
/** First-class non-Markdown file access requested independently of records. */
|
|
186
|
-
files?: ApplicationFileRequirement;
|
|
187
|
-
}
|
|
188
98
|
export { PEOPLE_PERMISSIONS, approvedPeoplePermissions, type AccountIdentity, type AccountProfile, type CurrentAccountResponse, type CollectionMemberProfile, type ApplicationPeopleRequirement, type PeoplePermission } from "./people.js";
|
|
189
|
-
export type LegacyApplicationRequirements = Omit<ApplicationRequirements, "capabilities" | "files" | "access" | "people"> & {
|
|
190
|
-
access: "full_collection";
|
|
191
|
-
capabilities?: LegacyApplicationCapabilityRequirements;
|
|
192
|
-
files?: LegacyApplicationFileRequirement;
|
|
193
|
-
};
|
|
194
|
-
export type LegacyMdbaseWebAppManifest = Omit<MdbaseWebAppManifest, "requirements"> & {
|
|
195
|
-
requirements: LegacyApplicationRequirements;
|
|
196
|
-
};
|
|
197
|
-
export type LegacyMdbasePortableAppManifest = Omit<MdbasePortableAppManifest, "requirements"> & {
|
|
198
|
-
requirements: LegacyApplicationRequirements;
|
|
199
|
-
};
|
|
200
|
-
export type LegacyMdbaseAppManifest = LegacyMdbaseWebAppManifest | LegacyMdbasePortableAppManifest;
|
|
201
|
-
export interface ApplicationProvisions {
|
|
202
|
-
type_packs: TypePackProvision[];
|
|
203
|
-
/** Narrow semantic changes that may satisfy configuration requirements. */
|
|
204
|
-
configuration?: ConfigurationProvision[];
|
|
205
|
-
}
|
|
206
99
|
export interface GrantScope {
|
|
207
100
|
/** Legacy scope only; canonical grants use an empty array and discover contracts through resources and semantic selectors. */
|
|
208
101
|
contracts: CollectionContractDescriptor[];
|
|
@@ -249,6 +142,8 @@ export type MdbaseOperationResponse<Result = unknown> = {
|
|
|
249
142
|
problem: ConnectProblem;
|
|
250
143
|
};
|
|
251
144
|
export interface GrantPolicy {
|
|
145
|
+
/** Consenting account UUID; mandatory only in negotiated next_account_v1 mode. */
|
|
146
|
+
account_id?: string;
|
|
252
147
|
/** Complete normalized JSON evidence; never independent operation authority. */
|
|
253
148
|
application_declaration?: unknown;
|
|
254
149
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,8 @@ import { FRESH_APPLICATION_AUTHORIZATION_CAPABILITIES } from "./capabilities.js"
|
|
|
2
2
|
export * from "./records.js";
|
|
3
3
|
import { YAML_DOCUMENT_RECORDS_CAPABILITY } from "./collection-setup.js";
|
|
4
4
|
export * from "./connect-problems.generated.js";
|
|
5
|
+
export { MdbaseConnectError, connectError, connectProblem } from "./authorization-errors.js";
|
|
6
|
+
export { semanticContractVersion, authorizationOperations, authorizationFiles, validateAuthorizationSelection, declaredOperations, retainedCapabilities, DEFAULT_OPERATIONS } from "./application-contract.js";
|
|
5
7
|
export * from "./files.js";
|
|
6
8
|
export * from "./operations.js";
|
|
7
9
|
export * from "./change-events.generated.js";
|
|
@@ -22,6 +24,8 @@ export const CONTRACT_SETUP_CAPABILITY = "contract-setup-v1";
|
|
|
22
24
|
export const FILE_RELAY_CAPABILITY = "file-relay-v1";
|
|
23
25
|
export const PROTOCOL_USAGE_REPORT_CAPABILITY = "protocol-usage-report-v1";
|
|
24
26
|
export const POLICY_FRESHNESS_LEASE_CAPABILITY = "policy-freshness-lease-v1";
|
|
27
|
+
/** Opt-in raw account-bound next policy projection; never a legacy default. */
|
|
28
|
+
export const NEXT_ACCOUNT_CAPABILITY = "next_account_v1";
|
|
25
29
|
/** Advertised beta capabilities are intentionally broader than the beta baseline. */
|
|
26
30
|
export const RELAY_REQUIRED_CAPABILITIES = [
|
|
27
31
|
"application-authorization-v4",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const appManifestValidator: typeof validate20;
|
|
2
|
+
declare function validate20(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
|
|
3
|
+
dynamicAnchors?: {} | undefined;
|
|
4
|
+
instancePath?: string | undefined;
|
|
5
|
+
rootData?: any;
|
|
6
|
+
}): boolean;
|
|
7
|
+
export declare const legacyAppManifestValidator: typeof validate47;
|
|
8
|
+
declare function validate47(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
|
|
9
|
+
dynamicAnchors?: {} | undefined;
|
|
10
|
+
instancePath?: string | undefined;
|
|
11
|
+
rootData?: any;
|
|
12
|
+
}): boolean;
|
|
13
|
+
export {};
|