@camstack/types 1.2.360 → 1.2.362

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.
@@ -101,6 +101,11 @@ declare const BackupArchiveEntrySchema: z.ZodObject<{
101
101
  scheme: z.ZodString;
102
102
  keyId: z.ZodString;
103
103
  }, z.core.$strip>>;
104
+ databases: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
105
+ events: "events";
106
+ history: "history";
107
+ settings: "settings";
108
+ }>>>>;
104
109
  }, z.core.$strip>;
105
110
  declare const BackupEntrySchema: z.ZodObject<{
106
111
  id: z.ZodString;
@@ -154,7 +159,17 @@ declare const ArchiveManifestSchema: z.ZodObject<{
154
159
  takenAt: z.ZodNumber;
155
160
  livePath: z.ZodString;
156
161
  snapshotPath: z.ZodString;
162
+ databaseId: z.ZodOptional<z.ZodEnum<{
163
+ events: "events";
164
+ history: "history";
165
+ settings: "settings";
166
+ }>>;
157
167
  }, z.core.$strip>>>;
168
+ omittedDatabases: z.ZodOptional<z.ZodArray<z.ZodEnum<{
169
+ events: "events";
170
+ history: "history";
171
+ settings: "settings";
172
+ }>>>;
158
173
  }, z.core.$strip>;
159
174
  declare const LocationStatSchema: z.ZodObject<{
160
175
  name: z.ZodString;
@@ -265,6 +280,11 @@ declare const BackupScheduleSchema: z.ZodObject<{
265
280
  locationIds: z.ZodReadonly<z.ZodArray<z.ZodString>>;
266
281
  retentionCount: z.ZodNumber;
267
282
  dataSources: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
283
+ databases: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
284
+ events: "events";
285
+ history: "history";
286
+ settings: "settings";
287
+ }>>>>;
268
288
  lastAttemptAt: z.ZodOptional<z.ZodNumber>;
269
289
  lastSuccessAt: z.ZodOptional<z.ZodNumber>;
270
290
  lastError: z.ZodOptional<z.ZodString>;
@@ -321,6 +341,11 @@ export declare const backupCapability: {
321
341
  locations: z.ZodOptional<z.ZodArray<z.ZodString>>;
322
342
  label: z.ZodOptional<z.ZodString>;
323
343
  retentionCount: z.ZodOptional<z.ZodNumber>;
344
+ databases: z.ZodOptional<z.ZodArray<z.ZodEnum<{
345
+ events: "events";
346
+ history: "history";
347
+ settings: "settings";
348
+ }>>>;
324
349
  }, z.core.$strip>>, z.ZodObject<{
325
350
  runId: z.ZodString;
326
351
  queued: z.ZodBoolean;
@@ -455,7 +480,17 @@ export declare const backupCapability: {
455
480
  takenAt: z.ZodNumber;
456
481
  livePath: z.ZodString;
457
482
  snapshotPath: z.ZodString;
483
+ databaseId: z.ZodOptional<z.ZodEnum<{
484
+ events: "events";
485
+ history: "history";
486
+ settings: "settings";
487
+ }>>;
458
488
  }, z.core.$strip>>>;
489
+ omittedDatabases: z.ZodOptional<z.ZodArray<z.ZodEnum<{
490
+ events: "events";
491
+ history: "history";
492
+ settings: "settings";
493
+ }>>>;
459
494
  }, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
460
495
  readonly restore: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
461
496
  destinationId: z.ZodString;
@@ -530,6 +565,11 @@ export declare const backupCapability: {
530
565
  scheme: z.ZodString;
531
566
  keyId: z.ZodString;
532
567
  }, z.core.$strip>>;
568
+ databases: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
569
+ events: "events";
570
+ history: "history";
571
+ settings: "settings";
572
+ }>>>>;
533
573
  }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
534
574
  /**
535
575
  * Upsert a per-destination policy row. The `locationId` MUST be
@@ -569,6 +609,11 @@ export declare const backupCapability: {
569
609
  locationIds: z.ZodReadonly<z.ZodArray<z.ZodString>>;
570
610
  retentionCount: z.ZodNumber;
571
611
  dataSources: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
612
+ databases: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
613
+ events: "events";
614
+ history: "history";
615
+ settings: "settings";
616
+ }>>>>;
572
617
  lastAttemptAt: z.ZodOptional<z.ZodNumber>;
573
618
  lastSuccessAt: z.ZodOptional<z.ZodNumber>;
574
619
  lastError: z.ZodOptional<z.ZodString>;
@@ -588,6 +633,11 @@ export declare const backupCapability: {
588
633
  locationIds: z.ZodReadonly<z.ZodArray<z.ZodString>>;
589
634
  retentionCount: z.ZodNumber;
590
635
  dataSources: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
636
+ databases: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
637
+ events: "events";
638
+ history: "history";
639
+ settings: "settings";
640
+ }>>>>;
591
641
  }, z.core.$strip>, z.ZodObject<{
592
642
  id: z.ZodString;
593
643
  label: z.ZodString;
@@ -596,6 +646,11 @@ export declare const backupCapability: {
596
646
  locationIds: z.ZodReadonly<z.ZodArray<z.ZodString>>;
597
647
  retentionCount: z.ZodNumber;
598
648
  dataSources: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
649
+ databases: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
650
+ events: "events";
651
+ history: "history";
652
+ settings: "settings";
653
+ }>>>>;
599
654
  lastAttemptAt: z.ZodOptional<z.ZodNumber>;
600
655
  lastSuccessAt: z.ZodOptional<z.ZodNumber>;
601
656
  lastError: z.ZodOptional<z.ZodString>;
@@ -136,6 +136,18 @@ export declare const dataStoreProviderCapability: {
136
136
  }, z.core.$strip>, z.ZodObject<{
137
137
  id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
138
138
  }, z.core.$strip>, "mutation">;
139
+ /** Upsert many records in ONE transaction; see the door's `upsertMany`. */
140
+ readonly upsertMany: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
141
+ namespace: z.ZodOptional<z.ZodString>;
142
+ collection: z.ZodString;
143
+ conflict: z.ZodReadonly<z.ZodArray<z.ZodString>>;
144
+ records: z.ZodReadonly<z.ZodArray<z.ZodObject<{
145
+ id: z.ZodOptional<z.ZodString>;
146
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
147
+ }, z.core.$strip>>>;
148
+ }, z.core.$strip>, z.ZodObject<{
149
+ upserted: z.ZodNumber;
150
+ }, z.core.$strip>, "mutation">;
139
151
  /** Insert many records in ONE transaction. All or nothing. */
140
152
  readonly insertMany: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
141
153
  namespace: z.ZodOptional<z.ZodString>;
@@ -178,6 +190,14 @@ export declare const dataStoreProviderCapability: {
178
190
  collection: z.ZodString;
179
191
  id: z.ZodString;
180
192
  data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
193
+ }, z.core.$strip>, z.ZodObject<{
194
+ op: z.ZodLiteral<"upsertMany">;
195
+ collection: z.ZodString;
196
+ conflict: z.ZodReadonly<z.ZodArray<z.ZodString>>;
197
+ records: z.ZodReadonly<z.ZodArray<z.ZodObject<{
198
+ id: z.ZodOptional<z.ZodString>;
199
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
200
+ }, z.core.$strip>>>;
181
201
  }, z.core.$strip>], "op">>>;
182
202
  }, z.core.$strip>, z.ZodObject<{
183
203
  applied: z.ZodBoolean;
@@ -336,6 +356,13 @@ export declare const dataStoreProviderCapability: {
336
356
  columns: z.ZodReadonly<z.ZodArray<z.ZodString>>;
337
357
  unique: z.ZodOptional<z.ZodBoolean>;
338
358
  }, z.core.$strip>>>>;
359
+ database: z.ZodOptional<z.ZodEnum<{
360
+ events: "events";
361
+ history: "history";
362
+ settings: "settings";
363
+ }>>;
364
+ primaryKey: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
365
+ withoutRowid: z.ZodOptional<z.ZodBoolean>;
339
366
  }, z.core.$strip>, z.ZodVoid, "mutation">;
340
367
  };
341
368
  };
@@ -29,6 +29,11 @@ export declare const DATABASE_SNAPSHOT_TIMEOUT_MS: number;
29
29
  */
30
30
  export declare const DatabaseSnapshotTargetsSchema: z.ZodObject<{
31
31
  databases: z.ZodArray<z.ZodObject<{
32
+ databaseId: z.ZodEnum<{
33
+ events: "events";
34
+ history: "history";
35
+ settings: "settings";
36
+ }>;
32
37
  livePath: z.ZodString;
33
38
  }, z.core.$strip>>;
34
39
  }, z.core.$strip>;
@@ -60,6 +65,36 @@ export declare const DatabaseSnapshotResultSchema: z.ZodObject<{
60
65
  takenAt: z.ZodNumber;
61
66
  }, z.core.$strip>;
62
67
  export type DatabaseSnapshotResult = z.infer<typeof DatabaseSnapshotResultSchema>;
68
+ /** A snapshot the owner wrote, with the file it belongs to. */
69
+ export declare const DatabaseSnapshotWrittenSchema: z.ZodObject<{
70
+ livePath: z.ZodString;
71
+ snapshotPath: z.ZodString;
72
+ sizeBytes: z.ZodNumber;
73
+ pageCount: z.ZodNumber;
74
+ pageSize: z.ZodNumber;
75
+ tables: z.ZodArray<z.ZodObject<{
76
+ name: z.ZodString;
77
+ rows: z.ZodNumber;
78
+ }, z.core.$strip>>;
79
+ copyMs: z.ZodNumber;
80
+ verifyMs: z.ZodNumber;
81
+ takenAt: z.ZodNumber;
82
+ databaseId: z.ZodEnum<{
83
+ events: "events";
84
+ history: "history";
85
+ settings: "settings";
86
+ }>;
87
+ }, z.core.$strip>;
88
+ export type DatabaseSnapshotWritten = z.infer<typeof DatabaseSnapshotWrittenSchema>;
89
+ /** Which database `writeSnapshot` copies. Required: an unstated ask is not guessed. */
90
+ export declare const DatabaseSnapshotRequestSchema: z.ZodObject<{
91
+ databaseId: z.ZodEnum<{
92
+ events: "events";
93
+ history: "history";
94
+ settings: "settings";
95
+ }>;
96
+ }, z.core.$strip>;
97
+ export type DatabaseSnapshotRequest = z.infer<typeof DatabaseSnapshotRequestSchema>;
63
98
  /**
64
99
  * A snapshot as an ARCHIVE records it (`ArchiveManifest.sqliteSnapshots`):
65
100
  * the same facts, with both paths relative to the archive root (the node's
@@ -78,6 +113,11 @@ export declare const ArchiveSqliteSnapshotSchema: z.ZodObject<{
78
113
  takenAt: z.ZodNumber;
79
114
  livePath: z.ZodString;
80
115
  snapshotPath: z.ZodString;
116
+ databaseId: z.ZodOptional<z.ZodEnum<{
117
+ events: "events";
118
+ history: "history";
119
+ settings: "settings";
120
+ }>>;
81
121
  }, z.core.$strip>;
82
122
  export type ArchiveSqliteSnapshot = z.infer<typeof ArchiveSqliteSnapshotSchema>;
83
123
  /**
@@ -103,21 +143,36 @@ export declare const databaseSnapshotCapability: {
103
143
  readonly internal: true;
104
144
  readonly methods: {
105
145
  /**
106
- * Which databases this owner snapshots. Answered from memory — no file is
107
- * touched — so a backup can ask it before deciding anything.
146
+ * EVERY database file this owner has open, with its id. Answered from
147
+ * memory — no file is touched — so a backup can ask it before deciding
148
+ * anything. A file created at runtime is listed from the moment it opens,
149
+ * so no backup can leave it out (D693).
108
150
  */
109
151
  readonly listDatabases: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
110
152
  databases: z.ZodArray<z.ZodObject<{
153
+ databaseId: z.ZodEnum<{
154
+ events: "events";
155
+ history: "history";
156
+ settings: "settings";
157
+ }>;
111
158
  livePath: z.ZodString;
112
159
  }, z.core.$strip>>;
113
160
  }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
114
161
  /**
115
- * Write `<db>.backup-snapshot` and return what it holds. Throws — and
116
- * leaves no file under the final name — when the copy fails
117
- * `integrity_check` or its row counts differ from the pinned source's.
118
- * A second call while one is running joins it.
162
+ * Write `<db>.backup-snapshot` for ONE database and return what it holds.
163
+ * Throws — and leaves no file under the final name — when the copy fails
164
+ * `integrity_check` or its row counts differ from the pinned source's, or
165
+ * when the database is not open. A second call for the SAME database while
166
+ * one is running joins it; different databases run one after the other
167
+ * (the disk reserve check is per copy).
119
168
  */
120
- readonly writeSnapshot: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
169
+ readonly writeSnapshot: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
170
+ databaseId: z.ZodEnum<{
171
+ events: "events";
172
+ history: "history";
173
+ settings: "settings";
174
+ }>;
175
+ }, z.core.$strip>, z.ZodObject<{
121
176
  livePath: z.ZodString;
122
177
  snapshotPath: z.ZodString;
123
178
  sizeBytes: z.ZodNumber;
@@ -130,6 +185,11 @@ export declare const databaseSnapshotCapability: {
130
185
  copyMs: z.ZodNumber;
131
186
  verifyMs: z.ZodNumber;
132
187
  takenAt: z.ZodNumber;
188
+ databaseId: z.ZodEnum<{
189
+ events: "events";
190
+ history: "history";
191
+ settings: "settings";
192
+ }>;
133
193
  }, z.core.$strip>, "mutation">;
134
194
  };
135
195
  };
@@ -44,7 +44,7 @@ export * from './custom-actions.js';
44
44
  export type { CustomModelDescriptor, ICustomModelRegistryProvider, ImportModelBundleInput, ImportModelBundleResult, ModelBundleFile, } from './custom-model-registry.cap.js';
45
45
  export { CustomModelDescriptorSchema, customModelRegistryCapability, ImportModelBundleInputSchema, ImportModelBundleResultSchema, ModelBundleFileSchema, } from './custom-model-registry.cap.js';
46
46
  export { type DataStoreEngineInfo, dataStoreProviderCapability, EngineInfoSchema as DataStoreEngineInfoSchema, type IDataStoreProvider, } from './data-store-provider.cap.js';
47
- export { type ArchiveSqliteSnapshot, ArchiveSqliteSnapshotSchema, DATABASE_SNAPSHOT_PARTIAL_SUFFIX, DATABASE_SNAPSHOT_SUFFIX, DATABASE_SNAPSHOT_TIMEOUT_MS, type DatabaseSnapshotResult, DatabaseSnapshotResultSchema, type DatabaseSnapshotTable, DatabaseSnapshotTableSchema, type DatabaseSnapshotTargets, DatabaseSnapshotTargetsSchema, databaseSnapshotCapability, type IDatabaseSnapshotProvider, } from './database-snapshot.cap.js';
47
+ export { type ArchiveSqliteSnapshot, ArchiveSqliteSnapshotSchema, DATABASE_SNAPSHOT_PARTIAL_SUFFIX, DATABASE_SNAPSHOT_SUFFIX, DATABASE_SNAPSHOT_TIMEOUT_MS, type DatabaseSnapshotRequest, DatabaseSnapshotRequestSchema, type DatabaseSnapshotResult, DatabaseSnapshotResultSchema, type DatabaseSnapshotTable, DatabaseSnapshotTableSchema, type DatabaseSnapshotTargets, DatabaseSnapshotTargetsSchema, type DatabaseSnapshotWritten, DatabaseSnapshotWrittenSchema, databaseSnapshotCapability, type IDatabaseSnapshotProvider, } from './database-snapshot.cap.js';
48
48
  export { type IKeychainProvider, KEYCHAIN_MAX_REFS_PER_CALL, type KeychainResolveEntry, KeychainResolveEntrySchema, type KeychainResolveResult, KeychainResolveResultSchema, type KeychainSecretMeta, KeychainSecretMetaSchema, type KeychainState, KeychainStateSchema, type KeychainUnavailableReason, KeychainUnavailableReasonSchema, keychainCapability, } from './keychain.cap.js';
49
49
  export { type IKeychainAdminProvider, KEYCHAIN_RESET_CONFIRMATION, type KeychainAdminSecret, KeychainAdminSecretSchema, type KeychainAuditAction, KeychainAuditActionSchema, type KeychainAuditEntry, KeychainAuditEntrySchema, type KeychainKeySource, type KeychainKeySourceKind, KeychainKeySourceKindSchema, KeychainKeySourceSchema, KEYCHAIN_RESET_TRIGGER_ACTOR, type KeychainResetRecord, KeychainResetRecordSchema, type KeychainSecretUsage, KeychainSecretUsageSchema, type KeychainStatus, KeychainStatusSchema, keychainAdminCapability, type SystemHeldSecretName, SystemHeldSecretNameSchema, } from './keychain-admin.cap.js';
50
50
  export type { DecoderHwAccelConfig, HwAccelChoice, IDecoderCapProvider, } from './decoder.cap.js';
@@ -106,7 +106,7 @@ export type { AudioStreamPick, CameraStream, CamProfile, CamStreamKind, DecodedA
106
106
  export { AudioChunkFormatSchema, AudioStreamPickSchema, BrokerStatsSchema, BrokerStatusSchema, CAM_PROFILE_ORDER, CameraStreamSchema, CamProfileSchema, CamStreamKindSchema, CamStreamResolutionSchema, DecodedAudioChunkSchema, FrameHandleSchema, makeProfileBrokerId, makeSourceBrokerId, ProfileRtspEntrySchema, ProfileSlotSchema, ProfileSlotStatusSchema, parseProfileBrokerId, StreamSourceEntrySchema, StreamSourceSchema, SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, selectAssignedProfileSlots, } from './schemas/streaming-shared.js';
107
107
  export { buildEventKindDescriptor, EVENT_KIND_BY_CAP, EVENTFUL_CAP_NAMES, type SensorEventKindDescriptor, } from './sensor-event-kinds.js';
108
108
  export { type ImageContract, ImageContractSchema, type ImageContractState, ImageContractStateSchema, type IServerManagementProvider, type ServerBootMode, ServerBootModeSchema, type ServerPackageStatus, ServerPackageStatusSchema, type ServerRollbackInfo, ServerRollbackInfoSchema, type ServerUpdateActionResult, ServerUpdateActionResultSchema, type ServerUpdateCheckResult, ServerUpdateCheckResultSchema, type ServerUpdateOutcome, ServerUpdateOutcomeSchema, type ServerUpdateState, ServerUpdateStateSchema, serverManagementCapability, type WrapperEvidence, WrapperEvidenceSchema, type WrapperIdentity, WrapperIdentitySchema, type WrapperKind, WrapperKindSchema, } from './server-management.cap.js';
109
- export { type BulkRecord, BulkRecordSchema, type CollectionColumn, CollectionColumnSchema, type CollectionIndex, CollectionIndexSchema, type ISettingsStoreProvider, type MutationFilter, MutationFilterSchema, QueryFilterSchema, SettingsRecordSchema, type SettingsStoreClient, settingsStoreCapability, } from './settings-store.cap.js';
109
+ export { type BulkRecord, BulkRecordSchema, type CollectionColumn, CollectionColumnSchema, type CollectionIndex, CollectionIndexSchema, DATA_STORE_DATABASES, type DataStoreDatabase, DataStoreDatabaseSchema, type DeclareCollectionInput, DeclareCollectionInputSchema, type ISettingsStoreProvider, type MutationFilter, MutationFilterSchema, QueryFilterSchema, SettingsRecordSchema, type SettingsStoreClient, settingsStoreCapability, } from './settings-store.cap.js';
110
110
  export type { ISmtpProvider } from './smtp-provider.cap.js';
111
111
  export { SendEmailInputSchema, SendEmailResultSchema, SmtpStatusSchema, smtpProviderCapability, } from './smtp-provider.cap.js';
112
112
  export { type ISnapshotOrchestrator, SnapshotImageSchema, snapshotCapability, } from './snapshot.cap.js';
@@ -80,9 +80,24 @@ declare const BulkRecordSchema: z.ZodObject<{
80
80
  id: z.ZodOptional<z.ZodString>;
81
81
  data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
82
82
  }, z.core.$strip>;
83
+ /**
84
+ * The database FILES one `sqlite-settings` engine process owns (D851).
85
+ * Closed on purpose: a file is a thing the engine opens, backs up and gives a
86
+ * serving thread, so a new one is a code change, never a string a caller
87
+ * invents. `settings` is `camstack.db` and the default for every collection
88
+ * that names no file.
89
+ */
90
+ declare const DataStoreDatabaseSchema: z.ZodEnum<{
91
+ events: "events";
92
+ history: "history";
93
+ settings: "settings";
94
+ }>;
95
+ /** Every database file, in a stable order (settings first). */
96
+ declare const DATA_STORE_DATABASES: readonly z.infer<typeof DataStoreDatabaseSchema>[];
83
97
  /**
84
98
  * One write inside a {@link settingsStoreCapability.methods.transact} call.
85
- * Only the three that a "replace this set, bump that revision" write needs.
99
+ * The three that a "replace this set, bump that revision" write needs, plus
100
+ * the batched upsert a rollup writer needs.
86
101
  */
87
102
  declare const TransactOpSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
88
103
  op: z.ZodLiteral<"deleteWhere">;
@@ -106,6 +121,14 @@ declare const TransactOpSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
106
121
  collection: z.ZodString;
107
122
  id: z.ZodString;
108
123
  data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
124
+ }, z.core.$strip>, z.ZodObject<{
125
+ op: z.ZodLiteral<"upsertMany">;
126
+ collection: z.ZodString;
127
+ conflict: z.ZodReadonly<z.ZodArray<z.ZodString>>;
128
+ records: z.ZodReadonly<z.ZodArray<z.ZodObject<{
129
+ id: z.ZodOptional<z.ZodString>;
130
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
131
+ }, z.core.$strip>>>;
109
132
  }, z.core.$strip>], "op">;
110
133
  /**
111
134
  * The precondition of a transaction: the row `key` of `collection` must hold
@@ -145,6 +168,51 @@ declare const CollectionIndexSchema: z.ZodObject<{
145
168
  columns: z.ZodReadonly<z.ZodArray<z.ZodString>>;
146
169
  unique: z.ZodOptional<z.ZodBoolean>;
147
170
  }, z.core.$strip>;
171
+ /**
172
+ * The input of `declareCollection` — ONE schema for the door and for the
173
+ * engine behind it, so the two surfaces cannot drift (the dispatcher forwards
174
+ * the payload untouched).
175
+ *
176
+ * - `database` — the file the collection lives in (D851). Absent means
177
+ * `settings`. A declaration naming a file other than the one the table is
178
+ * already in is REFUSED by the engine, never moved.
179
+ * - `primaryKey` — a COMPOSITE key, as column names. A single name is the same
180
+ * as `primaryKey: true` on that column. A composite-keyed collection has no
181
+ * `id`: it is written with `insertMany` / `upsertMany` / `transact` and read
182
+ * with `query` / `count` / `aggregate` / `deleteWhere`; the calls that
183
+ * address one row by id are refused.
184
+ * - `withoutRowid` — emit `WITHOUT ROWID`. Requires a primary key.
185
+ */
186
+ declare const DeclareCollectionInputSchema: z.ZodObject<{
187
+ namespace: z.ZodOptional<z.ZodString>;
188
+ collection: z.ZodString;
189
+ columns: z.ZodReadonly<z.ZodArray<z.ZodObject<{
190
+ name: z.ZodString;
191
+ type: z.ZodEnum<{
192
+ BOOLEAN: "BOOLEAN";
193
+ INTEGER: "INTEGER";
194
+ JSON: "JSON";
195
+ REAL: "REAL";
196
+ TEXT: "TEXT";
197
+ }>;
198
+ primaryKey: z.ZodOptional<z.ZodBoolean>;
199
+ notNull: z.ZodOptional<z.ZodBoolean>;
200
+ unique: z.ZodOptional<z.ZodBoolean>;
201
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
202
+ }, z.core.$strip>>>;
203
+ indexes: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
204
+ name: z.ZodString;
205
+ columns: z.ZodReadonly<z.ZodArray<z.ZodString>>;
206
+ unique: z.ZodOptional<z.ZodBoolean>;
207
+ }, z.core.$strip>>>>;
208
+ database: z.ZodOptional<z.ZodEnum<{
209
+ events: "events";
210
+ history: "history";
211
+ settings: "settings";
212
+ }>>;
213
+ primaryKey: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
214
+ withoutRowid: z.ZodOptional<z.ZodBoolean>;
215
+ }, z.core.$strip>;
148
216
  /**
149
217
  * settings-store — singleton capability for addon-scoped persistence.
150
218
  *
@@ -295,6 +363,31 @@ export declare const settingsStoreCapability: {
295
363
  }, z.core.$strip>, z.ZodObject<{
296
364
  id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
297
365
  }, z.core.$strip>, "mutation">;
366
+ /**
367
+ * {@link upsert} for a BATCH, in ONE transaction on ONE prepared statement.
368
+ *
369
+ * The write-side twin of {@link insertMany} for rows that may already
370
+ * exist: a rollup writer recomputes a bucket and must overwrite it, and
371
+ * N round trips with N COMMITs is the cost {@link insertMany} was added to
372
+ * avoid. `conflict` has the meaning it has on {@link upsert} (declared
373
+ * columns covered by a UNIQUE index or the primary key, never empty).
374
+ *
375
+ * Every record of a batch must carry the SAME set of declared columns and
376
+ * every `conflict` column: one batch is one statement shape, and a record
377
+ * that silently bound NULL over a column it did not mention would erase
378
+ * it. A heterogeneous batch is refused whole. **All or nothing.**
379
+ */
380
+ readonly upsertMany: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
381
+ namespace: z.ZodOptional<z.ZodString>;
382
+ collection: z.ZodString;
383
+ conflict: z.ZodReadonly<z.ZodArray<z.ZodString>>;
384
+ records: z.ZodReadonly<z.ZodArray<z.ZodObject<{
385
+ id: z.ZodOptional<z.ZodString>;
386
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
387
+ }, z.core.$strip>>>;
388
+ }, z.core.$strip>, z.ZodObject<{
389
+ upserted: z.ZodNumber;
390
+ }, z.core.$strip>, "mutation">;
298
391
  /** Insert a new record. */
299
392
  readonly insert: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
300
393
  namespace: z.ZodOptional<z.ZodString>;
@@ -388,6 +481,14 @@ export declare const settingsStoreCapability: {
388
481
  collection: z.ZodString;
389
482
  id: z.ZodString;
390
483
  data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
484
+ }, z.core.$strip>, z.ZodObject<{
485
+ op: z.ZodLiteral<"upsertMany">;
486
+ collection: z.ZodString;
487
+ conflict: z.ZodReadonly<z.ZodArray<z.ZodString>>;
488
+ records: z.ZodReadonly<z.ZodArray<z.ZodObject<{
489
+ id: z.ZodOptional<z.ZodString>;
490
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
491
+ }, z.core.$strip>>>;
391
492
  }, z.core.$strip>], "op">>>;
392
493
  }, z.core.$strip>, z.ZodObject<{
393
494
  applied: z.ZodBoolean;
@@ -594,6 +695,13 @@ export declare const settingsStoreCapability: {
594
695
  columns: z.ZodReadonly<z.ZodArray<z.ZodString>>;
595
696
  unique: z.ZodOptional<z.ZodBoolean>;
596
697
  }, z.core.$strip>>>>;
698
+ database: z.ZodOptional<z.ZodEnum<{
699
+ events: "events";
700
+ history: "history";
701
+ settings: "settings";
702
+ }>>;
703
+ primaryKey: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
704
+ withoutRowid: z.ZodOptional<z.ZodBoolean>;
597
705
  }, z.core.$strip>, z.ZodVoid, "mutation">;
598
706
  };
599
707
  };
@@ -604,10 +712,12 @@ export type ISettingsStoreProvider = InferProvider<typeof settingsStoreCapabilit
604
712
  * Methods are accessed as `client.get.query(input)`, `client.set.mutate(input)`, etc.
605
713
  */
606
714
  export type SettingsStoreClient = import('../generated/addon-api.js').AddonApi['settingsStore'];
607
- export { AggregateFieldSchema, AggregateResultSchema, BulkRecordSchema, CollectionColumnSchema, CollectionIndexSchema, MutationFilterSchema, QueryFilterSchema, SettingsRecordSchema, TransactGuardSchema, TransactOpSchema, };
715
+ export { AggregateFieldSchema, DATA_STORE_DATABASES, DataStoreDatabaseSchema, DeclareCollectionInputSchema, AggregateResultSchema, BulkRecordSchema, CollectionColumnSchema, CollectionIndexSchema, MutationFilterSchema, QueryFilterSchema, SettingsRecordSchema, TransactGuardSchema, TransactOpSchema, };
608
716
  export type BulkRecord = z.infer<typeof BulkRecordSchema>;
609
717
  export type AggregateField = z.infer<typeof AggregateFieldSchema>;
610
718
  export type AggregateResult = z.infer<typeof AggregateResultSchema>;
611
719
  export type MutationFilter = z.infer<typeof MutationFilterSchema>;
612
720
  export type CollectionColumn = z.infer<typeof CollectionColumnSchema>;
613
721
  export type CollectionIndex = z.infer<typeof CollectionIndexSchema>;
722
+ export type DataStoreDatabase = z.infer<typeof DataStoreDatabaseSchema>;
723
+ export type DeclareCollectionInput = z.infer<typeof DeclareCollectionInputSchema>;
package/dist/client.js CHANGED
@@ -7783,6 +7783,7 @@ function createSystemProxy(api) {
7783
7783
  set: (input) => dispatch("settingsStore", "set", "mutation", input),
7784
7784
  query: (input) => dispatch("settingsStore", "query", "query", input),
7785
7785
  upsert: (input) => dispatch("settingsStore", "upsert", "mutation", input),
7786
+ upsertMany: (input) => dispatch("settingsStore", "upsertMany", "mutation", input),
7786
7787
  insert: (input) => dispatch("settingsStore", "insert", "mutation", input),
7787
7788
  insertMany: (input) => dispatch("settingsStore", "insertMany", "mutation", input),
7788
7789
  transact: (input) => dispatch("settingsStore", "transact", "mutation", input),
package/dist/client.mjs CHANGED
@@ -7782,6 +7782,7 @@ function createSystemProxy(api) {
7782
7782
  set: (input) => dispatch("settingsStore", "set", "mutation", input),
7783
7783
  query: (input) => dispatch("settingsStore", "query", "query", input),
7784
7784
  upsert: (input) => dispatch("settingsStore", "upsert", "mutation", input),
7785
+ upsertMany: (input) => dispatch("settingsStore", "upsertMany", "mutation", input),
7785
7786
  insert: (input) => dispatch("settingsStore", "insert", "mutation", input),
7786
7787
  insertMany: (input) => dispatch("settingsStore", "insertMany", "mutation", input),
7787
7788
  transact: (input) => dispatch("settingsStore", "transact", "mutation", input),
@@ -1878,6 +1878,13 @@ export type AppRouter = TrpcCoreRouter<{
1878
1878
  output: z.infer<typeof dataStoreProviderCapability.methods.upsert.output>;
1879
1879
  meta: object;
1880
1880
  }>;
1881
+ upsertMany: TRPCMutationProcedure<{
1882
+ input: {
1883
+ [x: string]: unknown;
1884
+ } & z.input<typeof dataStoreProviderCapability.methods.upsertMany.input>;
1885
+ output: z.infer<typeof dataStoreProviderCapability.methods.upsertMany.output>;
1886
+ meta: object;
1887
+ }>;
1881
1888
  insertMany: TRPCMutationProcedure<{
1882
1889
  input: {
1883
1890
  [x: string]: unknown;
@@ -8153,6 +8160,13 @@ export type AppRouter = TrpcCoreRouter<{
8153
8160
  output: z.infer<typeof settingsStoreCapability.methods.upsert.output>;
8154
8161
  meta: object;
8155
8162
  }>;
8163
+ upsertMany: TRPCMutationProcedure<{
8164
+ input: {
8165
+ [x: string]: unknown;
8166
+ } & z.input<typeof settingsStoreCapability.methods.upsertMany.input>;
8167
+ output: z.infer<typeof settingsStoreCapability.methods.upsertMany.output>;
8168
+ meta: object;
8169
+ }>;
8156
8170
  insert: TRPCMutationProcedure<{
8157
8171
  input: {
8158
8172
  [x: string]: unknown;
@@ -6,7 +6,7 @@
6
6
  * scope+access check inside `protectedProcedure` (see
7
7
  * `server/backend/src/api/trpc/trpc.middleware.ts`).
8
8
  *
9
- * Coverage: 1303 method paths across 170 capabilities.
9
+ * Coverage: 1305 method paths across 170 capabilities.
10
10
  */
11
11
  import type { CapabilityMethodAccess } from '../capabilities/capability-definition.js';
12
12
  export interface MethodAccessRecord {
@@ -99,7 +99,7 @@ export interface SystemProxy {
99
99
  readonly recordingArchive: Pick<InferProvider<typeof recordingArchiveCapability>, 'getAvailabilityBatch' | 'getDaysWithRecordingsBatch' | 'getStorageUsage' | 'listOpsLog' | 'pauseForStorageMigration' | 'resumeForStorageMigration' | 'refreshStorageLocationsForMigration' | 'startStorageMigrationMove' | 'getStorageMigrationMoveStatus' | 'cancelStorageMigrationMove' | 'relocateFootage' | 'listRelocateJobs' | 'getRelocateResidue' | 'reconcileLedgerAgainstDisk' | 'cancelRelocateJob' | 'planStorageRebalance' | 'startStorageRebalance' | 'getPlacement' | 'setDevicePlacement'>;
100
100
  readonly recordingExport: Pick<InferProvider<typeof recordingExportCapability>, 'createExport' | 'getExport' | 'cancelExport' | 'deleteExport' | 'getDownloadUrl' | 'readExportBytes'>;
101
101
  readonly serverManagement: Pick<InferProvider<typeof serverManagementCapability>, 'getServerPackageStatus' | 'checkServerUpdate' | 'applyServerUpdate' | 'rollbackServerUpdate' | 'restartServer'>;
102
- readonly settingsStore: Pick<InferProvider<typeof settingsStoreCapability>, 'get' | 'set' | 'query' | 'upsert' | 'insert' | 'insertMany' | 'transact' | 'update' | 'delete' | 'deleteWhere' | 'updateWhere' | 'count' | 'aggregate' | 'histogram' | 'isEmpty' | 'declareCollection'>;
102
+ readonly settingsStore: Pick<InferProvider<typeof settingsStoreCapability>, 'get' | 'set' | 'query' | 'upsert' | 'upsertMany' | 'insert' | 'insertMany' | 'transact' | 'update' | 'delete' | 'deleteWhere' | 'updateWhere' | 'count' | 'aggregate' | 'histogram' | 'isEmpty' | 'declareCollection'>;
103
103
  readonly storage: Pick<InferProvider<typeof storageCapability>, 'resolve' | 'write' | 'read' | 'exists' | 'list' | 'delete' | 'getAvailableSpace' | 'beginUpload' | 'writeChunk' | 'finalizeUpload' | 'abortUpload' | 'beginDownload' | 'readChunk' | 'endDownload' | 'listLocations' | 'listLocationDeclarations' | 'upsertLocation' | 'deleteLocation' | 'listDrainProgress' | 'testLocation' | 'listProviders' | 'testConfig'>;
104
104
  readonly storageMigration: Pick<InferProvider<typeof storageMigrationCapability>, 'plan' | 'start' | 'status' | 'cancel' | 'movers' | 'residue' | 'drain' | 'cleanupStart' | 'cleanupStatus' | 'cleanupCancel' | 'history'>;
105
105
  readonly streamBroker: Pick<InferProvider<typeof streamBrokerCapability>, 'fetchEventMedia' | 'listAllCameraStreams' | 'listAllProfileSlots' | 'getBrokerStats' | 'probeStream' | 'listClients' | 'getLiveViewerCounts' | 'killClient' | 'getStreamUrl' | 'getStreamWithCodec' | 'releaseStreamWithCodec' | 'acquireEgressTranscode' | 'releaseEgressTranscode' | 'subscribeAudioChunks' | 'pullAudioChunks' | 'unsubscribeAudioChunks' | 'setPreBufferDuration' | 'getPreBufferInfo' | 'getRtspPort' | 'getAllRtspEntries' | 'getRtspEntry' | 'regenerateRtspToken' | 'setRtspEnabled' | 'isRtspEnabled'>;