@mdbase-dev/connect 0.1.0-beta.31 → 0.1.0-beta.33

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.
Files changed (68) hide show
  1. package/README.md +112 -34
  2. package/dist/advanced.d.ts +9 -0
  3. package/dist/advanced.js +6 -0
  4. package/dist/application-session.d.ts +39 -14
  5. package/dist/application-session.js +201 -70
  6. package/dist/async.js +11 -5
  7. package/dist/authority-proof.d.ts +3 -0
  8. package/dist/authority-proof.js +24 -0
  9. package/dist/browser/integrity.json +1 -1
  10. package/dist/browser/mdbase-connect.min.js +3 -3
  11. package/dist/browser/mdbase-connect.min.js.sha384 +1 -1
  12. package/dist/browser.d.ts +3 -0
  13. package/dist/browser.js +5 -0
  14. package/dist/capabilities.js +2 -1
  15. package/dist/collection-client.d.ts +36 -33
  16. package/dist/collection-client.js +549 -104
  17. package/dist/connect-authorization-helpers.d.ts +3 -0
  18. package/dist/connect-authorization-helpers.js +13 -0
  19. package/dist/connect-options.d.ts +12 -4
  20. package/dist/connect.d.ts +12 -4
  21. package/dist/connect.js +102 -103
  22. package/dist/connection-file-transport.d.ts +2 -2
  23. package/dist/connection-file-transport.js +4 -4
  24. package/dist/connection-notifications.d.ts +10 -4
  25. package/dist/connection-notifications.js +41 -23
  26. package/dist/connection-transport.d.ts +19 -15
  27. package/dist/connection-transport.js +202 -202
  28. package/dist/connection-types.d.ts +5 -4
  29. package/dist/connection.d.ts +47 -46
  30. package/dist/connection.js +320 -162
  31. package/dist/crypto-entry.d.ts +7 -0
  32. package/dist/crypto-entry.js +4 -0
  33. package/dist/crypto.js +4 -4
  34. package/dist/external-store.d.ts +10 -0
  35. package/dist/external-store.js +10 -0
  36. package/dist/file-transfer-internals.d.ts +23 -0
  37. package/dist/file-transfer-internals.js +224 -0
  38. package/dist/files.d.ts +36 -14
  39. package/dist/files.js +92 -222
  40. package/dist/hosted-file-request.js +3 -3
  41. package/dist/index.d.ts +24 -19
  42. package/dist/index.js +10 -18
  43. package/dist/internal-types.d.ts +9 -1
  44. package/dist/local-file-transport.d.ts +2 -2
  45. package/dist/local-file-transport.js +13 -13
  46. package/dist/mdbase-connect.d.ts +6 -4
  47. package/dist/mdbase-connect.js +9 -8
  48. package/dist/notifications.d.ts +3 -2
  49. package/dist/operation-helpers.d.ts +3 -3
  50. package/dist/operation-helpers.js +17 -34
  51. package/dist/operation-types.d.ts +435 -45
  52. package/dist/outcomes.d.ts +15 -15
  53. package/dist/outcomes.js +13 -1
  54. package/dist/pending-mutation-store.d.ts +13 -0
  55. package/dist/pending-mutation-store.js +64 -0
  56. package/dist/request-budget.d.ts +27 -0
  57. package/dist/request-budget.js +95 -0
  58. package/dist/runtime-utils.d.ts +2 -0
  59. package/dist/runtime-utils.js +19 -0
  60. package/dist/session.d.ts +5 -4
  61. package/dist/session.js +6 -5
  62. package/dist/stored-token.d.ts +10 -0
  63. package/dist/stored-token.js +60 -0
  64. package/dist/token-response.d.ts +11 -0
  65. package/dist/token-response.js +77 -0
  66. package/dist/watch-policy.d.ts +8 -0
  67. package/dist/watch-policy.js +12 -0
  68. package/package.json +12 -2
@@ -1,33 +1,33 @@
1
- import type { CollectionOperation, ConnectProblem, JsonObject, QueryRecord, RecordDocument } from "@mdbase-dev/connect-protocol";
1
+ import type { CollectionOperation, ConnectProblem, ContractRequirement, JsonObject, MutationOperationIdentifier, TypePackProvision } from "@mdbase-dev/connect-protocol";
2
2
  export interface MdbaseDesiredTimer {
3
3
  /** Stable within the timer namespace. */
4
4
  id: string;
5
5
  /** RFC 3339 instant at which the authority should fire the timer. */
6
- fire_at: string;
6
+ fireAt: string;
7
7
  /** Private application data retained by the collection authority. */
8
8
  data?: unknown;
9
9
  }
10
10
  export interface MdbaseTimer extends MdbaseDesiredTimer {
11
- criterion_id: string;
11
+ criterionId: string;
12
12
  generation: number;
13
13
  status: "scheduled" | "firing" | "fired" | "cancelled";
14
- created_at: string;
15
- updated_at: string;
16
- fired_at: string | null;
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ firedAt: string | null;
17
17
  }
18
18
  export interface MdbaseTimerList {
19
19
  namespace: string;
20
20
  timers: MdbaseTimer[];
21
21
  }
22
22
  export interface MdbaseTimerReconciliation extends MdbaseTimerList {
23
- cancelled_ids: string[];
23
+ cancelledIds: string[];
24
24
  }
25
25
  export interface ReadInput {
26
26
  path: string;
27
27
  /** Select an exact approved contract view when more than one is possible. */
28
28
  contract?: DataContractSelector;
29
29
  /** Include the exact UTF-8 Markdown source; requires full-collection access. */
30
- include_document?: boolean;
30
+ includeDocument?: boolean;
31
31
  }
32
32
  export interface DataContractSelector {
33
33
  id: string;
@@ -35,38 +35,153 @@ export interface DataContractSelector {
35
35
  /** Required when several approved types implement the selected contract. */
36
36
  type?: string;
37
37
  }
38
+ export interface CollectionFileMetadata extends JsonObject {
39
+ name: string;
40
+ folder: string;
41
+ size: number;
42
+ mtime: string;
43
+ tags?: string[];
44
+ links?: unknown[];
45
+ embeds?: unknown[];
46
+ }
47
+ export interface DataContractViewIdentity {
48
+ id: string;
49
+ version: string;
50
+ digest: string;
51
+ type: string;
52
+ implementationDigest: string;
53
+ }
54
+ export interface QueryRecord<Frontmatter extends JsonObject = JsonObject> {
55
+ path: string;
56
+ frontmatter?: Frontmatter;
57
+ effectiveFrontmatter?: Frontmatter;
58
+ body?: string;
59
+ types: string[];
60
+ file: Partial<CollectionFileMetadata> & {
61
+ path?: string;
62
+ };
63
+ contract?: DataContractViewIdentity;
64
+ }
65
+ export interface RecordDocument<Frontmatter extends JsonObject = JsonObject> {
66
+ path: string;
67
+ revision: string;
68
+ types: string[];
69
+ frontmatter: Frontmatter;
70
+ effectiveFrontmatter: Frontmatter;
71
+ body?: string;
72
+ document?: string;
73
+ file: Partial<CollectionFileMetadata> & {
74
+ path?: string;
75
+ };
76
+ contract?: DataContractViewIdentity;
77
+ }
78
+ export interface CollectionTypeDescriptor {
79
+ name: string;
80
+ version?: number;
81
+ description?: string;
82
+ revision?: string;
83
+ path?: string;
84
+ definition?: JsonObject;
85
+ schema: JsonObject;
86
+ collection?: JsonObject;
87
+ lifecycle?: JsonObject;
88
+ extensions: Record<string, unknown>;
89
+ }
90
+ export interface CollectionContractImplementationDescriptor {
91
+ typeName: string;
92
+ typeVersion: number;
93
+ typePath?: string;
94
+ digest: string;
95
+ fields: Record<string, string>;
96
+ binding?: JsonObject;
97
+ }
98
+ export interface CollectionContractDescriptor {
99
+ contractType: "record";
100
+ id: string;
101
+ version: string;
102
+ digest: string;
103
+ schema: JsonObject;
104
+ bindingSchema?: JsonObject;
105
+ implementations: CollectionContractImplementationDescriptor[];
106
+ }
107
+ export interface CollectionDescription {
108
+ protocolVersion: 1;
109
+ collectionId: string;
110
+ displayName: string;
111
+ specVersion: string;
112
+ operations: CollectionOperation[];
113
+ changeCursor: number;
114
+ types: CollectionTypeDescriptor[];
115
+ contracts: CollectionContractDescriptor[];
116
+ configuration?: JsonObject;
117
+ }
118
+ export interface QueryProjection {
119
+ expression: string;
120
+ description?: string;
121
+ }
122
+ export interface QuerySelectionExpression {
123
+ name: string;
124
+ expression: string;
125
+ label?: string;
126
+ description?: string;
127
+ }
128
+ export interface QueryOrder {
129
+ field: string;
130
+ direction?: "asc" | "desc";
131
+ }
132
+ export interface QuerySummary {
133
+ field: string;
134
+ function: string;
135
+ name?: string;
136
+ label?: string;
137
+ }
138
+ /** Application-facing form of the canonical mdbase v0.3 query schema. */
38
139
  export interface QueryInput {
39
140
  /**
40
141
  * Contract-scoped queries accept only `types`, pagination,
41
- * `frontmatter_mode`, and `contract`; filter normalized fields in the app.
142
+ * `frontmatterMode`, and `contract`; filter normalized fields in the app.
42
143
  */
43
144
  types?: string[];
44
- where?: unknown;
45
- order_by?: unknown;
145
+ context?: {
146
+ this: {
147
+ path: string;
148
+ };
149
+ };
150
+ projections?: Record<string, QueryProjection>;
151
+ where?: string;
152
+ select?: Array<string | QuerySelectionExpression>;
153
+ orderBy?: QueryOrder[];
154
+ groupBy?: QueryOrder[];
155
+ summaryFunctions?: Record<string, QueryProjection>;
156
+ summaries?: QuerySummary[];
46
157
  limit?: number;
47
158
  offset?: number;
48
159
  /** Opaque token returned by the first metadata page for consistent, fast pagination. */
49
160
  snapshot?: string;
50
- include_body?: boolean;
51
- frontmatter_mode?: "effective" | "persisted" | "both";
161
+ includeBody?: boolean;
162
+ frontmatterMode?: "effective" | "persisted" | "both";
52
163
  /** Narrow a contract-scoped query to one exact contract/provider view. */
53
164
  contract?: DataContractSelector;
54
- [key: string]: unknown;
55
165
  }
56
166
  export interface QueryResult<Record extends JsonObject = JsonObject> {
57
- results: Array<QueryRecord<Record> & JsonObject>;
167
+ results: Array<QueryRecord<Record>>;
58
168
  meta?: {
59
- total_count: number;
60
- has_more: boolean;
169
+ totalCount: number;
170
+ hasMore: boolean;
61
171
  snapshot?: string;
62
- [key: string]: unknown;
63
172
  };
64
- [key: string]: unknown;
65
173
  }
66
174
  export interface QueryPagesOptions<Record extends JsonObject = JsonObject> {
67
175
  firstPageSize?: number;
68
176
  pageSize?: number;
69
177
  signal?: AbortSignal;
178
+ /** Independent budget for each page requested by this caller-driven iterator. */
179
+ pageTimeoutMs?: number | null;
180
+ onProgress?: (page: QueryPage<Record>) => void;
181
+ }
182
+ export interface QueryAllOptions<Record extends JsonObject = JsonObject> extends ConnectRequestOptions {
183
+ firstPageSize?: number;
184
+ pageSize?: number;
70
185
  onProgress?: (page: QueryPage<Record>) => void;
71
186
  }
72
187
  export interface QueryPage<Record extends JsonObject = JsonObject> {
@@ -78,8 +193,10 @@ export interface QueryPage<Record extends JsonObject = JsonObject> {
78
193
  complete: boolean;
79
194
  snapshot?: string;
80
195
  }
81
- export interface OperationRequestOptions {
196
+ export interface ConnectRequestOptions {
82
197
  signal?: AbortSignal;
198
+ /** Relative request budget. `null` deliberately disables the SDK default. */
199
+ timeoutMs?: number | null;
83
200
  }
84
201
  export interface MutationEstimate {
85
202
  /** Records whose links may be affected, excluding the record being mutated. */
@@ -98,8 +215,7 @@ export interface MutationProgress {
98
215
  completedUnits: number;
99
216
  estimate?: MutationEstimate;
100
217
  }
101
- export interface MutationProgressOptions {
102
- signal?: AbortSignal;
218
+ export interface MutationProgressOptions extends ConnectRequestOptions {
103
219
  onProgress?: (progress: MutationProgress) => void;
104
220
  }
105
221
  export interface RenameProgressOptions extends MutationProgressOptions {
@@ -111,9 +227,14 @@ export interface DeleteProgressOptions extends MutationProgressOptions {
111
227
  preflight?: DeletePreflightResult;
112
228
  }
113
229
  export interface PendingMutationSummary {
114
- operation: CollectionOperation;
115
- createdAt: number;
116
- resumable: true;
230
+ requestId: string;
231
+ operation: MutationOperationIdentifier;
232
+ fingerprint: string;
233
+ status: "pending" | "recovering" | "outcome_unknown";
234
+ createdAt: string;
235
+ }
236
+ export interface PendingMutation<Result = unknown> extends PendingMutationSummary {
237
+ recover(options?: ConnectRequestOptions): Promise<import("./outcomes.js").ConnectOutcome<Result>>;
117
238
  }
118
239
  export interface CreateInput<Frontmatter extends JsonObject = JsonObject> {
119
240
  path?: string;
@@ -122,16 +243,16 @@ export interface CreateInput<Frontmatter extends JsonObject = JsonObject> {
122
243
  frontmatter?: Partial<Frontmatter> & JsonObject;
123
244
  /** Requires full-collection access; contract creates are frontmatter-only. */
124
245
  body?: string;
125
- if_revision?: string;
246
+ ifRevision?: string;
126
247
  /** Include the resulting exact Markdown source in `result.document`. */
127
- include_document?: boolean;
248
+ includeDocument?: boolean;
128
249
  }
129
250
  interface UpdateInputBase {
130
251
  path: string;
131
252
  contract?: DataContractSelector;
132
- if_revision?: string;
253
+ ifRevision?: string;
133
254
  /** Include the resulting exact Markdown source; requires full-collection access. */
134
- include_document?: boolean;
255
+ includeDocument?: boolean;
135
256
  }
136
257
  export type UpdateInput<Frontmatter extends JsonObject = JsonObject> = UpdateInputBase & ({
137
258
  patch: Partial<Frontmatter> & JsonObject;
@@ -140,7 +261,7 @@ export type UpdateInput<Frontmatter extends JsonObject = JsonObject> = UpdateInp
140
261
  } | {
141
262
  /**
142
263
  * Replace the complete Markdown source. This is mutually exclusive with
143
- * `patch` and `body`, and implies `include_document`.
264
+ * `patch` and `body`, and implies `includeDocument`.
144
265
  */
145
266
  document: string;
146
267
  patch?: never;
@@ -149,22 +270,22 @@ export type UpdateInput<Frontmatter extends JsonObject = JsonObject> = UpdateInp
149
270
  export interface DeleteInput {
150
271
  path: string;
151
272
  contract?: DataContractSelector;
152
- check_backlinks?: boolean;
153
- if_revision?: string;
273
+ checkBacklinks?: boolean;
274
+ ifRevision?: string;
154
275
  }
155
276
  export interface DeleteResult {
156
277
  path: string;
157
278
  deleted: boolean;
158
- broken_links?: Array<{
279
+ brokenLinks?: Array<{
159
280
  path: string;
160
281
  }>;
161
282
  }
162
283
  export interface DeletePreflightResult {
163
284
  path: string;
164
285
  deleted: false;
165
- dry_run: true;
166
- would_delete: true;
167
- broken_links?: Array<{
286
+ dryRun: true;
287
+ wouldDelete: true;
288
+ brokenLinks?: Array<{
168
289
  path: string;
169
290
  }>;
170
291
  }
@@ -172,22 +293,22 @@ export interface RenameInput {
172
293
  from: string;
173
294
  to: string;
174
295
  contract?: DataContractSelector;
175
- update_refs?: boolean;
176
- if_revision?: string;
296
+ updateRefs?: boolean;
297
+ ifRevision?: string;
177
298
  /** Include the resulting exact Markdown source in `result.document`. */
178
- include_document?: boolean;
299
+ includeDocument?: boolean;
179
300
  }
180
301
  export interface RenameResult extends RecordDocument {
181
302
  from: string;
182
303
  to: string;
183
- references_updated?: JsonObject[];
304
+ referencesUpdated?: JsonObject[];
184
305
  }
185
306
  export interface RenamePreflightResult {
186
307
  from: string;
187
308
  to: string;
188
- dry_run: true;
189
- would_rename: true;
190
- references_affected?: Array<{
309
+ dryRun: true;
310
+ wouldRename: true;
311
+ referencesAffected?: Array<{
191
312
  path: string;
192
313
  field?: string;
193
314
  location?: string;
@@ -207,7 +328,246 @@ export interface CreateTypeInput {
207
328
  }
208
329
  export interface UpdateTypeInput extends ReadTypeInput {
209
330
  document: string;
210
- if_revision: string;
331
+ ifRevision: string;
332
+ }
333
+ export interface ReadViewSourceInput {
334
+ path: string;
335
+ }
336
+ export interface CreateViewSourceInput {
337
+ document: string;
338
+ path?: string;
339
+ format?: string;
340
+ name?: string;
341
+ }
342
+ export interface UpdateViewSourceInput {
343
+ path: string;
344
+ document: string;
345
+ ifRevision?: string;
346
+ }
347
+ export interface DeleteViewSourceInput {
348
+ path: string;
349
+ ifRevision?: string;
350
+ }
351
+ export interface DeleteViewSourceResult {
352
+ path: string;
353
+ deleted: boolean;
354
+ }
355
+ export interface ExecuteViewInput {
356
+ path: string;
357
+ view: string;
358
+ context?: {
359
+ path: string;
360
+ } | null;
361
+ limit?: number;
362
+ offset?: number;
363
+ render?: boolean;
364
+ }
365
+ export interface SavedViewPresentation extends JsonObject {
366
+ type: string;
367
+ fallback?: string;
368
+ mappings?: Record<string, string>;
369
+ options?: JsonObject;
370
+ }
371
+ export interface SavedViewSource {
372
+ path: string;
373
+ format: string;
374
+ revision: string;
375
+ writable: boolean;
376
+ }
377
+ export interface SavedViewProperty {
378
+ key: string;
379
+ label?: string;
380
+ description?: string;
381
+ format?: string;
382
+ hidden?: boolean;
383
+ }
384
+ export interface SavedNamedView {
385
+ id: string;
386
+ name: string;
387
+ properties: SavedViewProperty[];
388
+ presentation?: SavedViewPresentation;
389
+ }
390
+ export interface SavedViewDocument {
391
+ id: string;
392
+ name: string;
393
+ source: SavedViewSource;
394
+ views: SavedNamedView[];
395
+ }
396
+ export interface SavedViewList {
397
+ views: SavedViewDocument[];
398
+ meta: {
399
+ totalCount: number;
400
+ };
401
+ }
402
+ export interface SavedViewSourceDocument {
403
+ path: string;
404
+ format: string;
405
+ revision: string;
406
+ document: string;
407
+ }
408
+ export interface SavedViewRecord<Frontmatter extends JsonObject = JsonObject> extends Omit<QueryRecord<Frontmatter>, "effectiveFrontmatter"> {
409
+ effectiveFrontmatter: Frontmatter;
410
+ values?: JsonObject;
411
+ }
412
+ export interface SavedViewExecution<Frontmatter extends JsonObject = JsonObject> {
413
+ results: Array<SavedViewRecord<Frontmatter>>;
414
+ meta: {
415
+ totalCount: number;
416
+ hasMore: boolean;
417
+ view: {
418
+ path: string;
419
+ id: string;
420
+ };
421
+ context?: {
422
+ path: string;
423
+ };
424
+ groups?: Array<{
425
+ values: JsonObject;
426
+ count: number;
427
+ summaries: JsonObject;
428
+ }>;
429
+ };
430
+ }
431
+ export type ContractSetupChoice = {
432
+ contract: ContractRequirement;
433
+ mode: "starter";
434
+ } | {
435
+ contract: ContractRequirement;
436
+ mode: "existing";
437
+ typeName: string;
438
+ typeRevision: string;
439
+ fields: Record<string, string>;
440
+ binding?: Record<string, unknown>;
441
+ };
442
+ export interface TypePackResourceDiff {
443
+ source: string;
444
+ target: string;
445
+ kind: "contract" | "type" | "schema";
446
+ mode: "managed" | "seed";
447
+ action: "create" | "update" | "delete" | "adopt" | "unchanged" | "preserve" | "conflict";
448
+ digest: string;
449
+ currentDigest?: string;
450
+ installedDigest?: string;
451
+ adoptedFromDigest?: string;
452
+ reason?: string;
453
+ }
454
+ export interface TypePackReceipt {
455
+ id: string;
456
+ version: string;
457
+ digest: string;
458
+ installedBy: string;
459
+ resources: Array<Omit<TypePackResourceDiff, "action" | "currentDigest" | "installedDigest" | "reason">>;
460
+ }
461
+ export interface TypePackAssessment {
462
+ status: "current" | "install" | "upgrade" | "downgrade" | "reconfigure" | "conflict";
463
+ applicable: boolean;
464
+ assessmentDigest: string;
465
+ current?: TypePackReceipt;
466
+ desired: TypePackReceipt;
467
+ resources: TypePackResourceDiff[];
468
+ lock: {
469
+ target: "mdbase.lock.yaml";
470
+ action: "create" | "update" | "unchanged";
471
+ digest: string;
472
+ };
473
+ contractSetups: {
474
+ choices: ContractSetupChoice[];
475
+ resources: TypePackResourceDiff[];
476
+ };
477
+ }
478
+ export interface TypePackApplyResult extends TypePackAssessment {
479
+ receipt: TypePackReceipt;
480
+ cleanupDeferred: boolean;
481
+ }
482
+ export type ConfigurationContributionValue = string | number | boolean | null;
483
+ export interface ConfigurationRequirement {
484
+ id: string;
485
+ path: string;
486
+ predicate: "contains";
487
+ value: ConfigurationContributionValue;
488
+ }
489
+ export interface ConfigurationProvision {
490
+ requirement: string;
491
+ operation: "set_add";
492
+ path: string;
493
+ value: ConfigurationContributionValue;
494
+ }
495
+ export interface ApplicationCollectionSetupRequirements {
496
+ configuration: ConfigurationRequirement[];
497
+ }
498
+ export interface ApplicationCollectionSetupProvisions {
499
+ configuration: ConfigurationProvision[];
500
+ typePacks: TypePackProvision[];
501
+ }
502
+ export interface ConfigurationSetupConflict {
503
+ code: "configuration_path_conflict" | "configuration_type_conflict";
504
+ path: string;
505
+ expected: "mapping" | "sequence";
506
+ observed: "null" | "boolean" | "number" | "string" | "sequence" | "mapping" | "tagged";
507
+ message: string;
508
+ }
509
+ export interface ConfigurationSetupAssessment {
510
+ requirement: string;
511
+ path: string;
512
+ value: ConfigurationContributionValue;
513
+ action: "current" | "add" | "conflict";
514
+ conflict?: ConfigurationSetupConflict;
515
+ }
516
+ export interface CollectionSetupAssessment {
517
+ status: "current" | "provision" | "conflict";
518
+ applicable: boolean;
519
+ applicationId: string;
520
+ declarationDigest: string;
521
+ provisionDigest: string;
522
+ collectionRevision: string;
523
+ finalCollectionRevision: string;
524
+ configuration: ConfigurationSetupAssessment[];
525
+ typePacks: TypePackAssessment[];
526
+ finalResourceRevisions: Record<string, string>;
527
+ assessmentDigest: string;
528
+ }
529
+ export interface CollectionSetupReceipt {
530
+ applicationId: string;
531
+ declarationDigest: string;
532
+ provisionDigest: string;
533
+ assessmentDigest: string;
534
+ collectionRevision: string;
535
+ configuration: Array<{
536
+ requirement: string;
537
+ path: string;
538
+ value: ConfigurationContributionValue;
539
+ }>;
540
+ typePacks: TypePackReceipt[];
541
+ cleanupDeferred: boolean;
542
+ }
543
+ export interface CollectionSetupApplyResult {
544
+ assessment: CollectionSetupAssessment;
545
+ receipt: CollectionSetupReceipt;
546
+ }
547
+ export interface AssessTypePackInput {
548
+ provision: TypePackProvision;
549
+ installedBy: string;
550
+ adoptResources?: Record<string, string>;
551
+ preserveSeedTargets?: string[];
552
+ targetOverrides?: Record<string, string>;
553
+ contractSetups?: ContractSetupChoice[];
554
+ }
555
+ export interface ApplyTypePackInput extends AssessTypePackInput {
556
+ expectedAssessmentDigest: string;
557
+ allowDowngrade?: boolean;
558
+ }
559
+ export interface AssessCollectionSetupInput {
560
+ applicationId: string;
561
+ declarationDigest: string;
562
+ requirements: ApplicationCollectionSetupRequirements;
563
+ provisions: ApplicationCollectionSetupProvisions;
564
+ contractSetups?: ContractSetupChoice[];
565
+ }
566
+ export interface ApplyCollectionSetupInput extends AssessCollectionSetupInput {
567
+ expectedAssessmentDigest: string;
568
+ expectedCollectionRevision: string;
569
+ expectedProvisionDigest: string;
570
+ allowTypePackDowngrades?: string[];
211
571
  }
212
572
  export interface ChangesInput {
213
573
  after?: number;
@@ -217,6 +577,8 @@ export interface WatchOptions {
217
577
  cursor?: number;
218
578
  pollIntervalMs?: number;
219
579
  signal?: AbortSignal;
580
+ /** Per-poll/reconnect budget. null deliberately disables the SDK default. */
581
+ timeoutMs?: number | null;
220
582
  /** Set to false to surface transient transport failures immediately. */
221
583
  retry?: false | WatchRetryOptions;
222
584
  onStatus?: (status: WatchStatus) => void;
@@ -245,9 +607,37 @@ export type WatchStatus = {
245
607
  state: "reset_required";
246
608
  cursor: number;
247
609
  problem: ConnectProblem<"change_cursor_reset">;
610
+ } | {
611
+ state: "closed";
612
+ cursor?: number;
248
613
  };
614
+ export interface WatchInput {
615
+ cursor?: number;
616
+ pollIntervalMs?: number;
617
+ retry?: false | WatchRetryOptions;
618
+ /** Cancels the subscription lifetime after bounded startup succeeds. */
619
+ lifetimeSignal?: AbortSignal;
620
+ }
621
+ export interface MdbaseWatchSubscription {
622
+ readonly status: WatchStatus;
623
+ readonly problem: ConnectProblem | null;
624
+ subscribe(listener: (change: CollectionChange) => void, onStatus?: (status: WatchStatus) => void, onProblem?: (problem: ConnectProblem) => void): () => void;
625
+ close(): void;
626
+ }
627
+ export interface CollectionChange {
628
+ cursor: number;
629
+ type: string;
630
+ occurredAt: string;
631
+ payload: JsonObject;
632
+ }
633
+ export interface CollectionChangesPage {
634
+ events: CollectionChange[];
635
+ cursor: number;
636
+ hasMore: boolean;
637
+ reset: boolean;
638
+ }
249
639
  /** Provider-neutral operation transport used by the typed collection client. */
250
640
  export interface MdbaseCollectionTransport {
251
- operation<Result>(operation: CollectionOperation, input: unknown, options?: OperationRequestOptions): Promise<Result>;
641
+ operation<Result>(operation: CollectionOperation, input: unknown, options?: ConnectRequestOptions): Promise<Result>;
252
642
  }
253
643
  export {};