@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,756 @@
1
+ export declare const CONTROL_PROTOCOL_VERSION: 1;
2
+ export declare const ENCRYPTED_RELAY_PROTOCOL_VERSION: 1;
3
+ export declare const LOOPBACK_PROTOCOL_VERSION: 1;
4
+ export declare const DEFAULT_LOOPBACK_PORT: 28485;
5
+ export declare const RELAY_ENCRYPTION_SUITE: "P256-HKDF-SHA256-AES256GCM";
6
+ export declare const SYNC_PROTOCOL_VERSION: 1;
7
+ export declare const CONTRACT_SETUP_CAPABILITY: "contract-setup-v1";
8
+ export declare const RELAY_REQUIRED_CAPABILITIES: readonly ["authorization-activation", "encrypted-relay", "policy-ack"];
9
+ export declare const RELAY_CAPABILITIES: readonly ["authorization-activation", "encrypted-relay", "policy-ack", "contract-setup-v1"];
10
+ export declare const AUTHORITY_PROOF_VERSION: 1;
11
+ export declare const AUTHORITY_PROOF_ALGORITHM: "P256-SHA256";
12
+ export declare const AUTHORITY_PROOF_DOMAIN: "mdbase-authority-request-proof-v1";
13
+ export declare const AUTHORITY_PROOF_HEADERS: {
14
+ readonly version: "x-mdbase-proof-version";
15
+ readonly timestamp: "x-mdbase-proof-timestamp";
16
+ readonly nonce: "x-mdbase-proof-nonce";
17
+ readonly signature: "x-mdbase-proof-signature";
18
+ };
19
+ /**
20
+ * Validate a native OAuth callback against the publisher of its web manifest.
21
+ * Reverse-domain private-use schemes keep native app identity tied to the
22
+ * manifest origin; PKCE remains mandatory at the authorization boundary.
23
+ */
24
+ export declare function isNativeRedirectUri(url: URL, publisherHostname?: string): boolean;
25
+ export declare const CONNECT_SCHEMA_IDS: {
26
+ readonly appManifest: "https://mdbase.dev/connect/schemas/mdbase-app.v1.json";
27
+ readonly notificationWebhook: "https://mdbase.dev/connect/schemas/notification-webhook.v1.json";
28
+ readonly dataContract: "https://mdbase.dev/schemas/v0.3/data-contract.schema.json";
29
+ readonly eventActionInterop: "https://mdbase.dev/schemas/interop/v0.1/profile.schema.json";
30
+ readonly protocol: "https://mdbase.dev/connect/schemas/connect-protocol.v1.json";
31
+ readonly encryptedRelay: "https://mdbase.dev/connect/schemas/encrypted-relay.v1.json";
32
+ readonly sync: "https://mdbase.dev/connect/schemas/sync.v1.json";
33
+ };
34
+ 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";
35
+ export interface NotificationCriterion {
36
+ /** Stable, manifest-owned identifier selected by an installation. */
37
+ id: string;
38
+ /** Runtime event contract evaluated at the collection authority. */
39
+ event: ContractRequirement;
40
+ /** Canonical mdbase CEL. Event content never leaves the authority for evaluation. */
41
+ if?: {
42
+ $expr: string;
43
+ };
44
+ debounce?: string;
45
+ minimum_interval?: string;
46
+ /** Static Web Push copy. Dynamic record content is intentionally unsupported. */
47
+ presentation: {
48
+ title: string;
49
+ body?: string;
50
+ tag?: string;
51
+ };
52
+ }
53
+ export type NativeNotificationDelivery = {
54
+ /**
55
+ * Connect sends through FCM using revocable, least-privilege authority
56
+ * granted by the application's Firebase project.
57
+ */
58
+ mode: "managed_fcm";
59
+ firebase_project_id: string;
60
+ } | {
61
+ /**
62
+ * Connect sends a signed, content-free signal to infrastructure operated
63
+ * by the application developer. That infrastructure owns APNs/FCM.
64
+ */
65
+ mode: "webhook";
66
+ url: string;
67
+ };
68
+ export interface ApplicationNotifications {
69
+ criteria: NotificationCriterion[];
70
+ /** Optional native delivery route. Web Push registration remains independent. */
71
+ native_delivery?: NativeNotificationDelivery;
72
+ }
73
+ /**
74
+ * The declaration bundled with an application build and registered inline.
75
+ *
76
+ * `id` is stable presentation metadata rather than proof of a publisher. Each
77
+ * exact declaration is independently identified and authorized by Connect.
78
+ */
79
+ interface MdbaseAppManifestBase {
80
+ manifest_version: 1;
81
+ id: string;
82
+ name: string;
83
+ requirements?: ApplicationRequirements;
84
+ provisions?: ApplicationProvisions;
85
+ notifications?: ApplicationNotifications;
86
+ }
87
+ export interface MdbaseWebAppManifest extends MdbaseAppManifestBase {
88
+ /** Omitted by existing v1 declarations; explicit `web` is equivalent. */
89
+ distribution?: "web";
90
+ homepage: string;
91
+ icon?: string;
92
+ redirect_uris: string[];
93
+ }
94
+ export interface MdbasePortableAppManifest extends MdbaseAppManifestBase {
95
+ /**
96
+ * A downloaded, publisher-unverified application opened from a local file.
97
+ * Portable declarations use device authorization and never claim a web origin.
98
+ */
99
+ distribution: "portable";
100
+ /** Optional HTTPS page where the user can inspect the project or source. */
101
+ project_url?: string;
102
+ /** Optional HTTPS icon on the project URL's origin. */
103
+ icon?: string;
104
+ }
105
+ export type MdbaseAppManifest = MdbaseWebAppManifest | MdbasePortableAppManifest;
106
+ export interface NotificationSignal {
107
+ /** Stable idempotency key generated by the collection authority. */
108
+ signal_id: string;
109
+ grant_id: string;
110
+ criterion_id: string;
111
+ /** Opaque authority cursor used by the app to retrieve current state after waking. */
112
+ cursor: string;
113
+ }
114
+ export interface NotificationPresentation {
115
+ title: string;
116
+ body?: string;
117
+ tag?: string;
118
+ }
119
+ export interface MdbaseNotification {
120
+ type: "mdbase.notification";
121
+ version: 1;
122
+ signal_id: string;
123
+ criterion_id: string;
124
+ cursor: string;
125
+ presentation: NotificationPresentation;
126
+ }
127
+ export interface NotificationWebhook {
128
+ type: "mdbase.notification.webhook";
129
+ version: 1;
130
+ delivery_id: string;
131
+ /** Opaque application grant reference returned during authorization. */
132
+ connection_id: string;
133
+ notification: MdbaseNotification;
134
+ }
135
+ export interface ContractRequirement {
136
+ id: string;
137
+ /** Exact semantic version of the collection-local mdbase data contract. */
138
+ version: string;
139
+ }
140
+ export interface ApplicationRequirements {
141
+ contracts: ContractRequirement[];
142
+ /** Access boundary requested after compatibility and provisioning checks. */
143
+ access?: "contract" | "full_collection";
144
+ /** Restrict authorization to durable provider-backed collections. */
145
+ collection_kind?: "hosted";
146
+ }
147
+ export interface TypePackManifestResource {
148
+ kind: "contract" | "type" | "schema";
149
+ source: string;
150
+ target: string;
151
+ digest: string;
152
+ }
153
+ export interface TypePackManifest {
154
+ kind: "mdbase.type-pack";
155
+ id: string;
156
+ version: string;
157
+ name?: string;
158
+ description?: string;
159
+ resources: TypePackManifestResource[];
160
+ [extension: `x-${string}`]: unknown;
161
+ }
162
+ export interface TypePackSourceResource {
163
+ source: string;
164
+ document: string;
165
+ }
166
+ export interface TypePackProvision {
167
+ /** Canonical type-pack manifest shown during approval and verified on install. */
168
+ manifest: TypePackManifest;
169
+ /** Exact UTF-8 resource bytes, keyed by each manifest source path. */
170
+ resources: TypePackSourceResource[];
171
+ /** Data contracts expected after the complete pack is installed. */
172
+ provides: ContractRequirement[];
173
+ }
174
+ export interface TypePackResourceDiff {
175
+ target: string;
176
+ kind: "contract" | "type" | "schema";
177
+ action: "create" | "replace" | "unchanged";
178
+ digest: string;
179
+ }
180
+ export interface TypePackInstallResult {
181
+ id: string;
182
+ version: string;
183
+ resources: TypePackResourceDiff[];
184
+ cleanup_deferred: boolean;
185
+ }
186
+ export interface ApplicationProvisions {
187
+ type_packs: TypePackProvision[];
188
+ }
189
+ export type ContractSetupChoice = {
190
+ contract: ContractRequirement;
191
+ mode: "starter";
192
+ } | {
193
+ contract: ContractRequirement;
194
+ mode: "existing";
195
+ type_name: string;
196
+ /** Exact type source revision shown during approval. */
197
+ type_revision: string;
198
+ fields: Record<string, string>;
199
+ binding?: JsonObject;
200
+ };
201
+ export interface GrantScope {
202
+ /**
203
+ * Exact contract definitions and sorted implementation sets approved by the
204
+ * user. Digests make the scope fail closed if either the interface or any
205
+ * provider changes after approval.
206
+ */
207
+ contracts: CollectionContractDescriptor[];
208
+ access: "contract" | "full_collection";
209
+ }
210
+ export interface RelayOperationRequest {
211
+ type: "operation_request";
212
+ protocol_version: 1;
213
+ request_id: string;
214
+ grant_id: string;
215
+ collection_id: string;
216
+ application_id: string;
217
+ operation: CollectionOperation;
218
+ input: unknown;
219
+ }
220
+ export interface RelayOperationResponse {
221
+ type: "operation_response";
222
+ protocol_version: 1;
223
+ request_id: string;
224
+ ok: boolean;
225
+ result?: unknown;
226
+ error?: {
227
+ code: string;
228
+ message: string;
229
+ };
230
+ }
231
+ export interface MdbaseOperationRequest<Input = unknown> {
232
+ protocol_version: 1;
233
+ request_id: string;
234
+ input: Input;
235
+ }
236
+ export type MdbaseOperationResponse<Result = unknown> = {
237
+ protocol_version: 1;
238
+ request_id: string;
239
+ ok: true;
240
+ result: Result;
241
+ } | {
242
+ protocol_version: 1;
243
+ request_id: string;
244
+ ok: false;
245
+ error: {
246
+ code: string;
247
+ message: string;
248
+ details?: unknown;
249
+ };
250
+ };
251
+ export interface GrantPolicy {
252
+ id: string;
253
+ application_id: string;
254
+ collection_id: string;
255
+ operations: CollectionOperation[];
256
+ scope: GrantScope;
257
+ application_name: string;
258
+ /** Distribution profile used when the exact application manifest was approved. */
259
+ application_distribution?: "web" | "portable";
260
+ application_homepage: string;
261
+ /** Informational HTTPS project page for a downloaded portable application. */
262
+ application_project_url?: string;
263
+ /** Exact browser origin authorized to use this grant over loopback. */
264
+ application_origin?: string;
265
+ application_icon?: string;
266
+ collection_name: string;
267
+ /** Approval-time criterion snapshot evaluated only by this collection authority. */
268
+ notification_criteria?: NotificationCriterion[];
269
+ created_at: string;
270
+ encryption?: GrantEncryption;
271
+ }
272
+ export interface GrantEncryption {
273
+ protocol_version: 1;
274
+ suite: typeof RELAY_ENCRYPTION_SUITE;
275
+ key_id: string;
276
+ scope_epoch: number;
277
+ connector_id: string;
278
+ collection_id: string;
279
+ application_agreement_public_key: string;
280
+ connector_agreement_public_key: string;
281
+ }
282
+ export interface EncryptedRelayEnvelope {
283
+ protocol_version: 1;
284
+ suite: typeof RELAY_ENCRYPTION_SUITE;
285
+ request_id: string;
286
+ grant_id: string;
287
+ application_id: string;
288
+ connector_id: string;
289
+ collection_id: string;
290
+ operation: CollectionOperation;
291
+ scope_epoch: number;
292
+ key_id: string;
293
+ counter: string;
294
+ ciphertext: string;
295
+ }
296
+ export interface SyncRecord<Frontmatter extends JsonObject = JsonObject> {
297
+ record_id: string;
298
+ path: string;
299
+ revision: string;
300
+ frontmatter: Frontmatter;
301
+ body: string;
302
+ types: string[];
303
+ }
304
+ export interface SyncCollectionResources {
305
+ revision: string;
306
+ spec_version: string;
307
+ types: CollectionTypeDescriptor[];
308
+ contracts: CollectionContractDescriptor[];
309
+ documents?: SyncResourceDocument[];
310
+ }
311
+ export interface SyncResourceDocument {
312
+ path: string;
313
+ kind: "configuration" | "type" | "contract" | "schema" | "view";
314
+ /** SHA-256 revision of the exact UTF-8 document (`sha256:<lowercase hex>`). */
315
+ revision: string;
316
+ document: string;
317
+ }
318
+ export interface AuthoritySnapshotRecord<Frontmatter extends JsonObject = JsonObject> {
319
+ record: SyncRecord<Frontmatter>;
320
+ document: string;
321
+ }
322
+ export interface AuthoritySnapshot<Frontmatter extends JsonObject = JsonObject> {
323
+ protocol_version: 1;
324
+ collection_id: string;
325
+ source_head: number;
326
+ source_revision: string;
327
+ manifest_digest: string;
328
+ resources: SyncCollectionResources;
329
+ records: Array<AuthoritySnapshotRecord<Frontmatter>>;
330
+ }
331
+ export interface AuthorityImportManifest {
332
+ protocol_version: 1;
333
+ collection_id: string;
334
+ source_head: number;
335
+ source_revision: string;
336
+ manifest_digest: string;
337
+ resources: SyncCollectionResources;
338
+ record_count: number;
339
+ }
340
+ export interface AuthorityImportRecord {
341
+ record_id: string;
342
+ path: string;
343
+ document: string;
344
+ }
345
+ export interface AuthorityImportSnapshot {
346
+ protocol_version: 1;
347
+ collection_id: string;
348
+ source_head: number;
349
+ source_revision: string;
350
+ manifest_digest: string;
351
+ resources: SyncCollectionResources;
352
+ records: AuthorityImportRecord[];
353
+ }
354
+ export interface AuthorityImportRecordPage {
355
+ protocol_version: 1;
356
+ page: number;
357
+ records: AuthorityImportRecord[];
358
+ }
359
+ export interface SyncSession {
360
+ protocol_version: 1;
361
+ session_id: string;
362
+ replica_id: string;
363
+ collection_id: string;
364
+ mode: "read_only" | "read_write";
365
+ scope_epoch: number;
366
+ retained_after: number;
367
+ head: number;
368
+ snapshot_id: string;
369
+ resources: SyncCollectionResources;
370
+ }
371
+ export interface SyncSnapshotPage<Frontmatter extends JsonObject = JsonObject> {
372
+ protocol_version: 1;
373
+ snapshot_id: string;
374
+ scope_epoch: number;
375
+ cursor: number;
376
+ records: Array<SyncSnapshotRecord<Frontmatter>>;
377
+ next_page?: string;
378
+ }
379
+ export interface SyncSnapshotRecord<Frontmatter extends JsonObject = JsonObject> extends SyncRecord<Frontmatter> {
380
+ /** Exact bytes whose SHA-256 revision and parsed metadata match this record. */
381
+ document: string;
382
+ }
383
+ export type SyncChange<Frontmatter extends JsonObject = JsonObject> = {
384
+ sequence: number;
385
+ type: "put";
386
+ record: SyncRecord<Frontmatter>;
387
+ } | {
388
+ sequence: number;
389
+ type: "remove";
390
+ record_id: string;
391
+ previous_path: string;
392
+ revision: string;
393
+ };
394
+ export interface SyncChangesPage<Frontmatter extends JsonObject = JsonObject> {
395
+ protocol_version: 1;
396
+ scope_epoch: number;
397
+ events: Array<SyncChange<Frontmatter>>;
398
+ cursor: number;
399
+ head: number;
400
+ has_more: boolean;
401
+ reset_required: boolean;
402
+ }
403
+ export interface SyncMutation {
404
+ mutation_id: string;
405
+ replica_id: string;
406
+ scope_epoch: number;
407
+ operation: "create" | "update" | "rename" | "delete";
408
+ record_id: string;
409
+ base_revision?: string;
410
+ input: JsonObject;
411
+ created_at: string;
412
+ causal_predecessor?: string;
413
+ }
414
+ export interface SyncConflict<Frontmatter extends JsonObject = JsonObject> {
415
+ record_id: string;
416
+ mutation: SyncMutation;
417
+ current?: SyncRecord<Frontmatter>;
418
+ current_revision?: string;
419
+ }
420
+ export type SyncMutationReceipt<Frontmatter extends JsonObject = JsonObject> = {
421
+ mutation_id: string;
422
+ status: "applied" | "previously_applied";
423
+ sequence: number;
424
+ record?: SyncRecord<Frontmatter>;
425
+ } | {
426
+ mutation_id: string;
427
+ status: "conflicted";
428
+ conflict: SyncConflict<Frontmatter>;
429
+ } | {
430
+ mutation_id: string;
431
+ status: "rejected";
432
+ error: {
433
+ code: string;
434
+ message: string;
435
+ };
436
+ };
437
+ export type EncryptedRelayOperationRequest = EncryptedRelayEnvelope & {
438
+ type: "encrypted_operation_request";
439
+ };
440
+ export type EncryptedRelayOperationResponse = EncryptedRelayEnvelope & {
441
+ type: "encrypted_operation_response";
442
+ };
443
+ export interface RelayPolicySnapshot {
444
+ type: "policy_snapshot";
445
+ protocol_version: 1;
446
+ request_id: string;
447
+ revision: string;
448
+ grants: GrantPolicy[];
449
+ }
450
+ export interface RelayHello {
451
+ type: "relay_hello";
452
+ protocol_version: 1;
453
+ connector_version: string;
454
+ capabilities: string[];
455
+ }
456
+ export interface RelayWelcome {
457
+ type: "relay_welcome";
458
+ protocol_version: 1;
459
+ session_id: string;
460
+ capabilities: string[];
461
+ }
462
+ export interface RelayIncompatible {
463
+ type: "relay_incompatible";
464
+ protocol_version: 1;
465
+ code: "connector_upgrade_required";
466
+ message: string;
467
+ update_url: string;
468
+ }
469
+ export interface RelayPolicyApplied {
470
+ type: "policy_applied";
471
+ protocol_version: 1;
472
+ request_id: string;
473
+ revision: string;
474
+ ok: boolean;
475
+ error?: {
476
+ code: string;
477
+ message: string;
478
+ details?: unknown;
479
+ };
480
+ }
481
+ export interface AuthorizationCollectionOffer {
482
+ collection_id: string;
483
+ display_name: string;
484
+ spec_version: string;
485
+ contracts: CollectionContractDescriptor[];
486
+ /** Minimal schema metadata; type source and collection paths never leave the authority. */
487
+ types: CollectionTypeDescriptor[];
488
+ }
489
+ export interface AuthorizationOfferResponse {
490
+ type: "authorization_offer_response";
491
+ protocol_version: 1;
492
+ request_id: string;
493
+ paused: boolean;
494
+ collections: AuthorizationCollectionOffer[];
495
+ }
496
+ export interface AuthorizationActivationResponse {
497
+ type: "authorization_activation_response";
498
+ protocol_version: 1;
499
+ request_id: string;
500
+ ok: boolean;
501
+ contracts: CollectionContractDescriptor[];
502
+ /** Exact setup plan applied by the authority. */
503
+ contract_setups: ContractSetupChoice[];
504
+ error?: {
505
+ code: string;
506
+ message: string;
507
+ details?: unknown;
508
+ };
509
+ }
510
+ export interface ConnectorCollection {
511
+ id: string;
512
+ display_name: string;
513
+ spec_version: string;
514
+ enabled: boolean;
515
+ contracts: CollectionContractDescriptor[];
516
+ }
517
+ export type JsonObject = Record<string, unknown>;
518
+ export interface MdbaseDiagnostic {
519
+ severity: "error" | "warning" | "info";
520
+ code: string;
521
+ message: string;
522
+ path?: string;
523
+ field?: string;
524
+ type?: string;
525
+ schema_location?: string;
526
+ details?: unknown;
527
+ }
528
+ export interface MdbaseOperationEnvelope<Result = JsonObject> {
529
+ valid: boolean;
530
+ result: Result;
531
+ diagnostics: MdbaseDiagnostic[];
532
+ }
533
+ export interface SavedViewPresentation extends JsonObject {
534
+ type: string;
535
+ fallback?: string;
536
+ mappings?: Record<string, string>;
537
+ options?: JsonObject;
538
+ }
539
+ export interface SavedViewSource {
540
+ path: string;
541
+ format: string;
542
+ revision: string;
543
+ writable: boolean;
544
+ }
545
+ export interface SavedNamedView {
546
+ id: string;
547
+ name: string;
548
+ properties: SavedViewProperty[];
549
+ presentation?: SavedViewPresentation;
550
+ }
551
+ export interface SavedViewProperty {
552
+ key: string;
553
+ label?: string;
554
+ description?: string;
555
+ format?: string;
556
+ hidden?: boolean;
557
+ }
558
+ export interface SavedViewDocument {
559
+ id: string;
560
+ name: string;
561
+ source: SavedViewSource;
562
+ views: SavedNamedView[];
563
+ }
564
+ export interface SavedViewList {
565
+ views: SavedViewDocument[];
566
+ meta: {
567
+ total_count: number;
568
+ };
569
+ }
570
+ export interface SavedViewSourceDocument {
571
+ path: string;
572
+ format: string;
573
+ revision: string;
574
+ document: string;
575
+ }
576
+ export interface ReadViewSourceInput {
577
+ path: string;
578
+ }
579
+ export interface CreateViewSourceInput {
580
+ document: string;
581
+ path?: string;
582
+ format?: string;
583
+ name?: string;
584
+ }
585
+ export interface UpdateViewSourceInput {
586
+ path: string;
587
+ document: string;
588
+ if_revision?: string;
589
+ }
590
+ export interface DeleteViewSourceInput {
591
+ path: string;
592
+ if_revision?: string;
593
+ }
594
+ export interface DeleteViewSourceResult {
595
+ path: string;
596
+ deleted: boolean;
597
+ }
598
+ export interface ExecuteViewInput {
599
+ path: string;
600
+ view: string;
601
+ context?: {
602
+ path: string;
603
+ } | null;
604
+ limit?: number;
605
+ offset?: number;
606
+ render?: boolean;
607
+ }
608
+ /**
609
+ * A saved-view row always includes the canonical frontmatter used to evaluate
610
+ * the view. Empty-frontmatter Markdown is represented by an empty object.
611
+ */
612
+ export interface SavedViewRecord<Frontmatter extends JsonObject = JsonObject> extends Omit<QueryRecord<Frontmatter>, "effective_frontmatter"> {
613
+ effective_frontmatter: Frontmatter;
614
+ values?: JsonObject;
615
+ }
616
+ export interface SavedViewExecution<Frontmatter extends JsonObject = JsonObject> {
617
+ results: Array<SavedViewRecord<Frontmatter>>;
618
+ meta: {
619
+ total_count: number;
620
+ has_more: boolean;
621
+ view: {
622
+ path: string;
623
+ id: string;
624
+ };
625
+ context?: {
626
+ path: string;
627
+ };
628
+ groups?: Array<{
629
+ values: JsonObject;
630
+ count: number;
631
+ summaries: JsonObject;
632
+ }>;
633
+ };
634
+ }
635
+ export interface CollectionFileMetadata extends JsonObject {
636
+ name: string;
637
+ folder: string;
638
+ size: number;
639
+ mtime: string;
640
+ tags?: string[];
641
+ links?: unknown[];
642
+ embeds?: unknown[];
643
+ }
644
+ export interface DataContractViewIdentity {
645
+ id: string;
646
+ version: string;
647
+ digest: string;
648
+ type: string;
649
+ implementation_digest: string;
650
+ }
651
+ /**
652
+ * A projected query row. Frontmatter members are optional because
653
+ * `frontmatter_mode` selects which fixed-semantics representation is returned.
654
+ */
655
+ export interface QueryRecord<Frontmatter extends JsonObject = JsonObject> {
656
+ path: string;
657
+ frontmatter?: Frontmatter;
658
+ effective_frontmatter?: Frontmatter;
659
+ body?: string;
660
+ types: string[];
661
+ file: Partial<CollectionFileMetadata> & {
662
+ path?: string;
663
+ };
664
+ /** Present when the authority returned a normalized contract projection. */
665
+ contract?: DataContractViewIdentity;
666
+ }
667
+ /** An authoritative record or a field-limited data-contract projection. */
668
+ export interface RecordDocument<Frontmatter extends JsonObject = JsonObject> {
669
+ path: string;
670
+ revision: string;
671
+ types: string[];
672
+ frontmatter: Frontmatter;
673
+ effective_frontmatter: Frontmatter;
674
+ /** Omitted from contract-scoped results. */
675
+ body?: string;
676
+ /**
677
+ * The exact UTF-8 Markdown source, including frontmatter delimiters,
678
+ * comments, quoting, whitespace, line endings, and trailing newline.
679
+ * Returned only when the operation requests it.
680
+ */
681
+ document?: string;
682
+ file: Partial<CollectionFileMetadata> & {
683
+ path?: string;
684
+ };
685
+ /** Present when the authority returned a normalized contract projection. */
686
+ contract?: DataContractViewIdentity;
687
+ }
688
+ export interface CollectionTypeDescriptor {
689
+ name: string;
690
+ version?: number;
691
+ description?: string;
692
+ /** Digest of the exact type source used as a setup precondition. */
693
+ revision?: string;
694
+ /** Collection-relative source path. */
695
+ path?: string;
696
+ /** Complete portable type frontmatter, including extension declarations. */
697
+ definition?: JsonObject;
698
+ schema: JsonObject;
699
+ collection?: JsonObject;
700
+ lifecycle?: JsonObject;
701
+ extensions: Record<string, unknown>;
702
+ }
703
+ export interface CollectionTypeDocument {
704
+ name: string;
705
+ path: string;
706
+ revision: string;
707
+ document: string;
708
+ }
709
+ export interface CollectionContractDescriptor {
710
+ /** Collection operations expose only record contracts. */
711
+ contract_type: "record";
712
+ id: string;
713
+ version: string;
714
+ /** Digest of the resolved contract schemas and metadata. */
715
+ digest: string;
716
+ /** Resolved portable record-view schema. */
717
+ schema: JsonObject;
718
+ /** Resolved implementation-binding schema, when the contract declares one. */
719
+ binding_schema?: JsonObject;
720
+ /** Every type currently implementing this exact contract, sorted by type name. */
721
+ implementations: CollectionContractImplementationDescriptor[];
722
+ }
723
+ export interface CollectionContractImplementationDescriptor {
724
+ type_name: string;
725
+ type_version: number;
726
+ type_path?: string;
727
+ /** Digest of the contract digest, type schema, fields, and binding. */
728
+ digest: string;
729
+ fields: Record<string, string>;
730
+ binding?: JsonObject;
731
+ }
732
+ export interface CollectionDescription {
733
+ protocol_version: 1;
734
+ collection_id: string;
735
+ display_name: string;
736
+ spec_version: string;
737
+ operations: CollectionOperation[];
738
+ change_cursor: number;
739
+ types: CollectionTypeDescriptor[];
740
+ contracts: CollectionContractDescriptor[];
741
+ /** Canonical collection settings; extension and implementation-specific values are omitted. */
742
+ configuration?: JsonObject;
743
+ }
744
+ export interface CollectionChange {
745
+ cursor: number;
746
+ type: string;
747
+ occurred_at: string;
748
+ payload: JsonObject;
749
+ }
750
+ export interface CollectionChangesPage {
751
+ events: CollectionChange[];
752
+ cursor: number;
753
+ has_more: boolean;
754
+ reset: boolean;
755
+ }
756
+ export {};