@tearleads/client-sdk 0.1.42 → 0.1.44

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 (224) hide show
  1. package/client/containerDocumentDiscovery.js +71 -29
  2. package/client/containerDocumentDiscovery.js.map +1 -1
  3. package/client/deviceFirst.js +4 -5
  4. package/client/deviceFirst.js.map +1 -1
  5. package/data/blobs/transferPool.js +35 -8
  6. package/data/blobs/transferPool.js.map +1 -1
  7. package/data/containers/shared/projection.js +12 -0
  8. package/data/containers/shared/projection.js.map +1 -1
  9. package/data/documents/blob/shared/types.d.ts +2 -3
  10. package/data/documents/blob/shared/types.js.map +1 -1
  11. package/data/documents/shared/events.js +0 -1
  12. package/data/documents/shared/events.js.map +1 -1
  13. package/data/persistence/container-contents/containerContentsPersistence.js +6 -22
  14. package/data/persistence/container-contents/containerContentsPersistence.js.map +1 -1
  15. package/data/persistence/container-contents/containerMetadataMutationPersistence.js +5 -15
  16. package/data/persistence/container-contents/containerMetadataMutationPersistence.js.map +1 -1
  17. package/data/persistence/container-contents/containerPendingUpdatePersistence.js +6 -15
  18. package/data/persistence/container-contents/containerPendingUpdatePersistence.js.map +1 -1
  19. package/data/persistence/container-contents/containerRecoveryPersistence.js +3 -4
  20. package/data/persistence/container-contents/containerRecoveryPersistence.js.map +1 -1
  21. package/data/persistence/container-contents/containerRemovalWork.js +3 -5
  22. package/data/persistence/container-contents/containerRemovalWork.js.map +1 -1
  23. package/data/persistence/container-contents/dormantContainerMetadata.js +1 -5
  24. package/data/persistence/container-contents/dormantContainerMetadata.js.map +1 -1
  25. package/data/persistence/containers/containerSyncWatermarkPersistence.d.ts +11 -3
  26. package/data/persistence/containers/containerSyncWatermarkPersistence.js +46 -58
  27. package/data/persistence/containers/containerSyncWatermarkPersistence.js.map +1 -1
  28. package/data/persistence/documents/documentsPersistence.js +4 -9
  29. package/data/persistence/documents/documentsPersistence.js.map +1 -1
  30. package/data/persistence/documents/internal/discardDocument.js +1 -2
  31. package/data/persistence/documents/internal/discardDocument.js.map +1 -1
  32. package/data/persistence/documents/internal/documentDeletionPersistence.js +1 -2
  33. package/data/persistence/documents/internal/documentDeletionPersistence.js.map +1 -1
  34. package/data/persistence/documents/internal/documentMutationPersistence.js +17 -25
  35. package/data/persistence/documents/internal/documentMutationPersistence.js.map +1 -1
  36. package/data/persistence/documents/internal/orphanSideRows.js +2 -14
  37. package/data/persistence/documents/internal/orphanSideRows.js.map +1 -1
  38. package/data/persistence/documents/internal/syncQueuePersistence.js +3 -3
  39. package/data/persistence/documents/internal/syncQueuePersistence.js.map +1 -1
  40. package/data/sqlite/documentHistoryPersistence.d.ts +9 -3
  41. package/data/sqlite/documentHistoryPersistence.js +31 -8
  42. package/data/sqlite/documentHistoryPersistence.js.map +1 -1
  43. package/data/sqlite/documentPendingUpdatePersistence.d.ts +58 -11
  44. package/data/sqlite/documentPendingUpdatePersistence.js +137 -63
  45. package/data/sqlite/documentPendingUpdatePersistence.js.map +1 -1
  46. package/data/sqlite/documentPersistence.d.ts +1 -1
  47. package/data/sqlite/documentPersistence.js +1 -1
  48. package/data/sqlite/documentPersistence.js.map +1 -1
  49. package/data/sqlite/documentPersistenceTypes.d.ts +2 -2
  50. package/data/sqlite/documentPersistenceTypes.js.map +1 -1
  51. package/data/sqlite/documentRecordPersistence.js +5 -4
  52. package/data/sqlite/documentRecordPersistence.js.map +1 -1
  53. package/data/sqlite/schema.d.ts +167 -517
  54. package/data/sqlite/schema.js +68 -82
  55. package/data/sqlite/schema.js.map +1 -1
  56. package/internal/api-client/ApiClient.d.ts +18 -41
  57. package/internal/api-client/ApiClient.js +9 -14
  58. package/internal/api-client/ApiClient.js.map +1 -1
  59. package/internal/api-client/apiRequestRuntime.d.ts +2 -0
  60. package/internal/api-client/apiRequestRuntime.js +4 -0
  61. package/internal/api-client/apiRequestRuntime.js.map +1 -1
  62. package/internal/api-client/binaryRequestOperationTransport.d.ts +18 -0
  63. package/internal/api-client/index.d.ts +1 -0
  64. package/internal/api-client/index.js +1 -0
  65. package/internal/api-client/index.js.map +1 -1
  66. package/internal/api-client/operationTransportFactory.d.ts +6 -0
  67. package/internal/api-client/requestInternals.js +7 -7
  68. package/internal/api-client/requestInternals.js.map +1 -1
  69. package/internal/api-client/routes/blobs/get.d.ts +7 -0
  70. package/internal/api-client/routes/blobs/get.js.map +1 -1
  71. package/internal/api-client/routes/blobs/multipart.js +1 -11
  72. package/internal/api-client/routes/blobs/multipart.js.map +1 -1
  73. package/internal/api-client/routes/blobs/multipartUpload.d.ts +14 -0
  74. package/internal/api-client/routes/blobs/multipartUpload.js +94 -43
  75. package/internal/api-client/routes/blobs/multipartUpload.js.map +1 -1
  76. package/internal/api-client/routes/containers/reads.d.ts +13 -7
  77. package/internal/api-client/routes/containers/reads.js +36 -15
  78. package/internal/api-client/routes/containers/reads.js.map +1 -1
  79. package/internal/api-client/types.d.ts +1 -5
  80. package/internal/api-client/types.js.map +1 -1
  81. package/internal/validators/containerReadRefinements.js +15 -5
  82. package/internal/validators/containerReadRefinements.js.map +1 -1
  83. package/internal/validators/containerReadSchemas.d.ts +36 -0
  84. package/internal/validators/containerReadSchemas.js +64 -1
  85. package/internal/validators/containerReadSchemas.js.map +1 -1
  86. package/internal/validators/operation/attachments.d.ts +80 -160
  87. package/internal/validators/operation/auth.d.ts +760 -1664
  88. package/internal/validators/operation/blobDownloads.js +1 -1
  89. package/internal/validators/operation/blobDownloads.js.map +1 -1
  90. package/internal/validators/operation/containerMutations.d.ts +416 -856
  91. package/internal/validators/operation/containerReads.d.ts +118 -182
  92. package/internal/validators/operation/containerReads.js +20 -54
  93. package/internal/validators/operation/containerReads.js.map +1 -1
  94. package/internal/validators/operation/documentMutations.d.ts +120 -264
  95. package/internal/validators/operation/documentSync.d.ts +40 -80
  96. package/internal/validators/operation/index.d.ts +2 -2
  97. package/internal/validators/operation/index.js +2 -2
  98. package/internal/validators/operation/index.js.map +1 -1
  99. package/internal/validators/operation/multipartBlobs.d.ts +70 -190
  100. package/internal/validators/operation/multipartBlobs.js +2 -24
  101. package/internal/validators/operation/multipartBlobs.js.map +1 -1
  102. package/internal/validators/operation/multipartPartUploads.d.ts +5 -5
  103. package/internal/validators/operation/multipartPartUploads.js +6 -20
  104. package/internal/validators/operation/multipartPartUploads.js.map +1 -1
  105. package/internal/validators/operation/organizations.d.ts +882 -1906
  106. package/internal/validators/operation/principals.d.ts +120 -240
  107. package/internal/validators/operation/registry.d.ts +3 -4
  108. package/internal/validators/operation/registry.js +3 -4
  109. package/internal/validators/operation/registry.js.map +1 -1
  110. package/internal/validators/request/blob.d.ts +100 -201
  111. package/internal/validators/request/blob.js +6 -13
  112. package/internal/validators/request/blob.js.map +1 -1
  113. package/internal/validators/request/container.d.ts +136 -272
  114. package/internal/validators/request/container.js +16 -10
  115. package/internal/validators/request/container.js.map +1 -1
  116. package/internal/validators/request/containerDocumentLanes.d.ts +23 -0
  117. package/internal/validators/request/containerDocumentLanes.js +23 -0
  118. package/internal/validators/request/containerDocumentLanes.js.map +1 -0
  119. package/internal/validators/request/containerManifestRef.d.ts +54 -0
  120. package/internal/validators/request/containerManifestRef.js +28 -0
  121. package/internal/validators/request/containerManifestRef.js.map +1 -0
  122. package/internal/validators/request/containerMetadata.d.ts +160 -368
  123. package/internal/validators/request/containerParentLanes.js +5 -35
  124. package/internal/validators/request/containerParentLanes.js.map +1 -1
  125. package/internal/validators/request/document.d.ts +100 -245
  126. package/internal/validators/request/document.js +1 -2
  127. package/internal/validators/request/document.js.map +1 -1
  128. package/internal/validators/request/documentSyncSchema.d.ts +42 -109
  129. package/internal/validators/request/documentSyncSchema.js +8 -25
  130. package/internal/validators/request/documentSyncSchema.js.map +1 -1
  131. package/internal/validators/request/index.d.ts +2 -1
  132. package/internal/validators/request/index.js +2 -1
  133. package/internal/validators/request/index.js.map +1 -1
  134. package/internal/validators/request/organization.d.ts +160 -320
  135. package/internal/validators/request/organizationProvisioning.d.ts +2424 -5312
  136. package/internal/validators/request/principal.d.ts +160 -320
  137. package/internal/validators/request/registration.d.ts +760 -1664
  138. package/internal/validators/response/blob.d.ts +48 -27
  139. package/internal/validators/response/blob.js +3 -10
  140. package/internal/validators/response/blob.js.map +1 -1
  141. package/internal/validators/response/containerDocumentLanes.d.ts +82 -0
  142. package/internal/validators/response/containerDocumentLanes.js +35 -0
  143. package/internal/validators/response/containerDocumentLanes.js.map +1 -0
  144. package/internal/validators/response/containerParentLanes.js +3 -15
  145. package/internal/validators/response/containerParentLanes.js.map +1 -1
  146. package/internal/validators/response/index.d.ts +3 -2
  147. package/internal/validators/response/index.js +2 -2
  148. package/internal/validators/response/index.js.map +1 -1
  149. package/internal/validators/util/blob.d.ts +7 -0
  150. package/internal/validators/util/blob.js +7 -0
  151. package/internal/validators/util/blob.js.map +1 -1
  152. package/internal/validators/util/blobTransferSchemas.d.ts +41 -0
  153. package/internal/validators/util/blobTransferSchemas.js +39 -0
  154. package/internal/validators/util/blobTransferSchemas.js.map +1 -0
  155. package/internal/validators/util/containerLimits.d.ts +7 -0
  156. package/internal/validators/util/containerLimits.js +7 -0
  157. package/internal/validators/util/containerLimits.js.map +1 -1
  158. package/internal/validators/util/index.d.ts +2 -1
  159. package/internal/validators/util/index.js +2 -1
  160. package/internal/validators/util/index.js.map +1 -1
  161. package/package.json +1 -1
  162. package/sync/reconciliation/knownContainerSweep.js +57 -54
  163. package/sync/reconciliation/knownContainerSweep.js.map +1 -1
  164. package/sync/reconciliation/reconcileContainer.js +49 -17
  165. package/sync/reconciliation/reconcileContainer.js.map +1 -1
  166. package/sync/reconciliation/service.js +44 -16
  167. package/sync/reconciliation/service.js.map +1 -1
  168. package/sync/reconciliation/serviceTypes.d.ts +23 -2
  169. package/sync/reconciliation/serviceTypes.js.map +1 -1
  170. package/workflows/blobs/multipartFirstParts.js +82 -0
  171. package/workflows/blobs/multipartFirstParts.js.map +1 -0
  172. package/workflows/blobs/multipartStageResolution.js +83 -0
  173. package/workflows/blobs/multipartStageResolution.js.map +1 -0
  174. package/workflows/blobs/multipartUpload.js +45 -89
  175. package/workflows/blobs/multipartUpload.js.map +1 -1
  176. package/workflows/container-contents/containerDocumentListing.js +92 -38
  177. package/workflows/container-contents/containerDocumentListing.js.map +1 -1
  178. package/workflows/container-contents/containerPersistence.d.ts +8 -2
  179. package/workflows/container-contents/containerPersistence.js +6 -7
  180. package/workflows/container-contents/containerPersistence.js.map +1 -1
  181. package/workflows/container-contents/documentDiscovery.d.ts +3 -3
  182. package/workflows/container-contents/documentDiscovery.js +24 -96
  183. package/workflows/container-contents/documentDiscovery.js.map +1 -1
  184. package/workflows/container-contents/documentDiscoveryApply.js +65 -0
  185. package/workflows/container-contents/documentDiscoveryApply.js.map +1 -0
  186. package/workflows/container-contents/documentDiscoveryLanes.js +53 -0
  187. package/workflows/container-contents/documentDiscoveryLanes.js.map +1 -0
  188. package/workflows/container-contents/documentDiscoveryTypes.d.ts +25 -19
  189. package/workflows/container-contents/documentDiscoveryTypes.js.map +1 -1
  190. package/workflows/container-contents/documentPriming.js +2 -1
  191. package/workflows/container-contents/documentPriming.js.map +1 -1
  192. package/workflows/container-contents/documentQueries/sql.js +4 -4
  193. package/workflows/container-contents/documentQueries/sql.js.map +1 -1
  194. package/workflows/container-contents/pendingWrites/deferredTails.js +6 -3
  195. package/workflows/container-contents/pendingWrites/deferredTails.js.map +1 -1
  196. package/workflows/container-contents/pendingWrites/sources.js +2 -1
  197. package/workflows/container-contents/pendingWrites/sources.js.map +1 -1
  198. package/workflows/container-contents/pendingWrites.js +2 -1
  199. package/workflows/container-contents/pendingWrites.js.map +1 -1
  200. package/workflows/container-contents/remoteHydration/laneFetchMarkers.js +11 -17
  201. package/workflows/container-contents/remoteHydration/laneFetchMarkers.js.map +1 -1
  202. package/workflows/containers/child/create.js +3 -3
  203. package/workflows/containers/child/create.js.map +1 -1
  204. package/workflows/containers/child/move.js +2 -2
  205. package/workflows/containers/child/move.js.map +1 -1
  206. package/workflows/containers/child/mutationRequestCore.js +5 -4
  207. package/workflows/containers/child/mutationRequestCore.js.map +1 -1
  208. package/workflows/containers/child/recitePlan.js +3 -2
  209. package/workflows/containers/child/recitePlan.js.map +1 -1
  210. package/workflows/containers/child/sharePlanCore.js +2 -2
  211. package/workflows/containers/child/sharePlanCore.js.map +1 -1
  212. package/workflows/containers/root/create.js +2 -2
  213. package/workflows/containers/root/create.js.map +1 -1
  214. package/workflows/registration/provisioningBootstrapBuilders.d.ts +20 -46
  215. package/workflows/sync/remoteReset.js +9 -9
  216. package/workflows/sync/remoteReset.js.map +1 -1
  217. package/workflows/sync/remoteResetCursorScope.js +10 -18
  218. package/workflows/sync/remoteResetCursorScope.js.map +1 -1
  219. package/workflows/sync/remoteResetPlans.js +6 -3
  220. package/workflows/sync/remoteResetPlans.js.map +1 -1
  221. package/workflows/sync/remoteResetScope.js +4 -11
  222. package/workflows/sync/remoteResetScope.js.map +1 -1
  223. package/internal/validators/operation/blobTransferSchemas.js +0 -11
  224. package/internal/validators/operation/blobTransferSchemas.js.map +0 -1
@@ -94,48 +94,11 @@ export const documents = sqliteTable("documents", {
94
94
  .on(table.appKind, table.documentId)
95
95
  .where(sql `${table.documentId} IS NOT NULL`),
96
96
  ]);
97
- /**
98
- * Outbound Loro updates waiting to be accepted by sync.
99
- *
100
- * Each row stores one locally produced update for a document scope. The queue is
101
- * replayed in creation order and acknowledged rows are deleted after sync
102
- * writes the corresponding server commit or persisted document state.
103
- *
104
- * Columns:
105
- * - `id`: Client-generated queue id used for acknowledgement deletes.
106
- * - `appKind`: Local document namespace matching `documents.appKind`.
107
- * - `localId`: Local document id matching `documents.localId`.
108
- * - `updateData`: Serialized Loro update payload.
109
- * - `partialStartVersionVector`: Version vector before this partial update.
110
- * - `partialEndVersionVector`: Version vector after this partial update.
111
- * - `sourceVersionVector`: Optional source vector used to avoid re-enqueuing
112
- * updates that came from sync.
113
- * - `createdAt`: Queue insertion timestamp used for deterministic replay.
114
- *
115
- * Indexes:
116
- * - `id` is the primary key for targeted deletes.
117
- * - `(appKind, localId, createdAt)` supports ordered pending-update scans for a
118
- * document scope.
119
- */
120
- export const documentPendingUpdates = sqliteTable("document_pending_updates", {
121
- id: text("id"),
122
- appKind: text("app_kind").notNull(),
123
- localId: text("local_id").notNull(),
124
- updateData: text("update_data").notNull(),
125
- partialStartVersionVector: text("partial_start_version_vector").notNull(),
126
- partialEndVersionVector: text("partial_end_version_vector").notNull(),
127
- sourceVersionVector: text("source_version_vector"),
128
- createdAt: text("created_at").notNull(),
129
- rekeyCount: integer("rekey_count").notNull().default(0),
130
- }, (table) => [
131
- primaryKey({ columns: [table.id] }),
132
- index("document_pending_updates_scope_created_idx").on(table.appKind, table.localId, table.createdAt),
133
- ]);
134
97
  /**
135
98
  * Last terminal sync failure or quarantined incoming update per document scope.
136
99
  *
137
- * The durable write queue (`documentPendingUpdates`) has no status columns — a
138
- * row is either pending or settled-and-deleted. Terminal submissions and
100
+ * The durable write queue (queued rows of `documentHistoryUpdates`) has no
101
+ * status columns — a row is either queued or settled. Terminal submissions and
139
102
  * incoming updates that cannot be decrypted or imported are recorded here so
140
103
  * the write-queue view and footer can surface why the document is blocked.
141
104
  * Rows are upserted per scope and deleted only after a later fully validated
@@ -177,21 +140,56 @@ export const documentHistoryCheckpoints = sqliteTable("document_history_checkpoi
177
140
  revision: text("revision").notNull(),
178
141
  updatedAt: text("updated_at").notNull(),
179
142
  }, (table) => [primaryKey({ columns: [table.appKind, table.localId] })]);
143
+ /**
144
+ * The local update log: one row per Loro update, serving as both the history
145
+ * tail (restore = checkpoint + tail) and the outbound write queue.
146
+ *
147
+ * Every locally authored update is stored once. While it waits for sync it
148
+ * carries an `updateId` (the id submitted to the server) and the version-vector
149
+ * metadata the submission needs; settlement clears them, leaving the row as
150
+ * ordinary tail history until compaction folds it into a checkpoint.
151
+ *
152
+ * Columns:
153
+ * - `id`: Row id; tail compaction deletes by it.
154
+ * - `appKind`, `localId`: Document scope matching `documents`.
155
+ * - `updateData`: Serialized Loro update payload.
156
+ * - `origin`: "local" (authored on this device) or "remote" (decrypted
157
+ * pulled update) for tail rows. Restores use it to advance the
158
+ * outgoing-delta marker across remote rows — their ops are already
159
+ * server-side — while a local row left behind by a crash stays below the
160
+ * marker so the next edit re-derives and sends it. "outbox" marks a queued
161
+ * update with no tail role (container metadata, whose content is its
162
+ * checkpoint, and full-state re-uploads after a remote reset); restores and
163
+ * compaction never see it and settlement deletes it.
164
+ * - `createdAt`: Insertion timestamp; with `rowid`, deterministic replay order.
165
+ * - `updateId`: Present exactly while the row is queued for sync; rekeyed
166
+ * after a lost acknowledgement poisons the submitted id.
167
+ * - `partialStartVersionVector` / `partialEndVersionVector`: Version vectors
168
+ * around a queued partial update.
169
+ * - `sourceVersionVector`: Present on a queued rotation baseline checkpoint.
170
+ * - `rekeyCount`: Durable bound on rekeys of a queued row.
171
+ *
172
+ * Invariant: compaction never deletes a queued row, so a checkpoint can cover
173
+ * a queued update's operations without removing it from the queue.
174
+ */
180
175
  export const documentHistoryUpdates = sqliteTable("document_history_updates", {
181
176
  id: text("id"),
182
177
  appKind: text("app_kind").notNull(),
183
178
  localId: text("local_id").notNull(),
184
179
  updateData: text("update_data").notNull(),
185
- // Provenance: "local" (authored on this device) or "remote" (decrypted
186
- // pulled update). Restores use it to advance the outgoing-delta marker
187
- // across remote rows — their ops are already server-side — while a local
188
- // row left behind by a crash stays below the marker so the next edit
189
- // re-derives and sends it.
190
180
  origin: text("origin").notNull(),
191
181
  createdAt: text("created_at").notNull(),
182
+ updateId: text("update_id"),
183
+ partialStartVersionVector: text("partial_start_version_vector"),
184
+ partialEndVersionVector: text("partial_end_version_vector"),
185
+ sourceVersionVector: text("source_version_vector"),
186
+ rekeyCount: integer("rekey_count").notNull().default(0),
192
187
  }, (table) => [
193
188
  primaryKey({ columns: [table.id] }),
194
189
  index("document_history_updates_scope_created_idx").on(table.appKind, table.localId, table.createdAt),
190
+ uniqueIndex("document_history_updates_update_id_idx")
191
+ .on(table.updateId)
192
+ .where(sql `${table.updateId} IS NOT NULL`),
195
193
  ]);
196
194
  /**
197
195
  * Anti-rollback pin for verified access manifests.
@@ -454,53 +452,39 @@ export const containerMoveIntents = sqliteTable("container_move_intents", {
454
452
  index("container_move_intents_status_created_idx").on(table.syncStatus, table.createdAt),
455
453
  ]);
456
454
  /**
457
- * Per-lane sync cursors for container data.
455
+ * Per-lane sync state for container data: the server cursor and the local
456
+ * freshness marker share one row per lane.
458
457
  *
459
458
  * Container sync is split into lanes, such as a parent-container child lane or
460
- * a container-document membership lane. This table stores the last accepted
461
- * server watermark for each lane so the next sync request can resume without
462
- * replaying the entire tree.
459
+ * a container-document membership lane. The cursor lets the next request
460
+ * resume without replaying the entire tree. The freshness marker records the
461
+ * last fully drained check independently of the cursor: empty server
462
+ * responses do not always carry a new watermark, but startup still needs to
463
+ * know that it recently checked the lane before polling again.
463
464
  *
464
465
  * Columns:
465
466
  * - `laneKind`: Sync lane category, such as `container_parent` or
466
467
  * `container_documents`.
467
468
  * - `laneId`: Lane identity. Root parent sync uses `root`, child sync uses a
468
469
  * parent-prefixed container id, and document lanes use the container id.
469
- * - `watermarkUpdatedAt`: Server `updatedAt` value for the stored watermark.
470
- * - `watermarkId`: Server id tie-breaker for the stored watermark.
470
+ * - `watermarkUpdatedAt`: Server `updatedAt` value for the stored watermark;
471
+ * null until a watermark is saved.
472
+ * - `watermarkId`: Server id tie-breaker for the stored watermark; null
473
+ * exactly when `watermarkUpdatedAt` is.
471
474
  * - `updatedAt`: Local timestamp for when the cursor was saved.
475
+ * - `checkedAt`: Local timestamp for the most recent fully drained lane check;
476
+ * null until one completes.
472
477
  *
473
478
  * Indexes:
474
- * - `(laneKind, laneId)` is the primary key and stores one cursor per lane.
479
+ * - `(laneKind, laneId)` is the primary key and stores one row per lane.
475
480
  */
476
481
  export const containerSyncWatermarks = sqliteTable("container_sync_watermarks", {
477
482
  laneKind: text("lane_kind").notNull(),
478
483
  laneId: text("lane_id").notNull(),
479
- watermarkUpdatedAt: text("watermark_updated_at").notNull(),
480
- watermarkId: text("watermark_id").notNull(),
481
- updatedAt: text("updated_at").notNull(),
482
- }, (table) => [primaryKey({ columns: [table.laneKind, table.laneId] })]);
483
- /**
484
- * Local freshness markers for container sync lanes.
485
- *
486
- * These rows track the last successful API check for a lane independently from
487
- * server watermarks. Empty server responses do not always include a new
488
- * watermark, but the client still needs to remember that it recently checked
489
- * the lane so startup can use cached container state without polling every
490
- * time a container tree opens.
491
- *
492
- * Columns:
493
- * - `laneKind`: Sync lane category matching `containerSyncWatermarks`.
494
- * - `laneId`: Lane identity matching `containerSyncWatermarks`.
495
- * - `checkedAt`: Local timestamp for the most recent successful lane check.
496
- *
497
- * Indexes:
498
- * - `(laneKind, laneId)` is the primary key and stores one marker per lane.
499
- */
500
- export const containerSyncLaneChecks = sqliteTable("container_sync_lane_checks", {
501
- laneKind: text("lane_kind").notNull(),
502
- laneId: text("lane_id").notNull(),
503
- checkedAt: text("checked_at").notNull(),
484
+ watermarkUpdatedAt: text("watermark_updated_at"),
485
+ watermarkId: text("watermark_id"),
486
+ updatedAt: text("updated_at"),
487
+ checkedAt: text("checked_at"),
504
488
  }, (table) => [primaryKey({ columns: [table.laneKind, table.laneId] })]);
505
489
  export const documentTables = [
506
490
  {
@@ -511,10 +495,12 @@ export const documentTables = [
511
495
  "recovery_document_id",
512
496
  ],
513
497
  },
514
- defineSqlTableSchema(documentPendingUpdates),
515
498
  defineSqlTableSchema(documentSyncFailures),
516
499
  defineSqlTableSchema(documentHistoryCheckpoints),
517
- defineSqlTableSchema(documentHistoryUpdates),
500
+ {
501
+ ...defineSqlTableSchema(documentHistoryUpdates),
502
+ requiredColumns: ["update_id"],
503
+ },
518
504
  ];
519
505
  export const principalPolicyTables = [
520
506
  {
@@ -581,8 +567,10 @@ export const containerMoveIntentTables = [
581
567
  defineSqlTableSchema(containerMoveIntents),
582
568
  ];
583
569
  export const containerSyncWatermarkTables = [
584
- defineSqlTableSchema(containerSyncWatermarks),
585
- defineSqlTableSchema(containerSyncLaneChecks),
570
+ {
571
+ ...defineSqlTableSchema(containerSyncWatermarks),
572
+ requiredColumns: ["checked_at"],
573
+ },
586
574
  ];
587
575
  export const clientSqlTables = [
588
576
  ...principalMutationJournalTables,
@@ -616,7 +604,6 @@ export const clientSQLiteSchema = {
616
604
  organizationFounders,
617
605
  principalGrantRetirements,
618
606
  documents,
619
- documentPendingUpdates,
620
607
  documentSyncFailures,
621
608
  principalPolicies,
622
609
  principalPolicyBundleHistory,
@@ -638,7 +625,6 @@ export const clientSQLiteSchema = {
638
625
  documentOrphanBlobReclaims: documentOrphanBlobReclaims,
639
626
  containerCreateIntents,
640
627
  containerMoveIntents,
641
- containerSyncLaneChecks,
642
628
  containerSyncWatermarks,
643
629
  ...organizationReadModelSQLiteSchema,
644
630
  ...organizationDataUsage.organizationDataUsageSQLiteSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EACL,KAAK,EACL,OAAO,EACP,UAAU,EACV,WAAW,EACX,IAAI,EACJ,WAAW,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EACL,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,gCAAgC,EAChC,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,GAC/B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO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GAAG,wBAAwB;IAC3B,GAAG,2BAA2B;IAC9B,GAAG,yBAAyB;IAC5B,GAAG,4BAA4B;IAC/B,GAAG,2BAA2B;IAC9B,GAAG,qBAAqB,CAAC,2BAA2B;IACpD,GAAG,mBAAmB,CAAC,qCAAqC;CAC7D,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,8BAA8B;IAC9B,0BAA0B;IAC1B,2BAA2B;IAC3B,2BAA2B;IAC3B,wBAAwB;IACxB,uBAAuB;IACvB,qBAAqB;IACrB,wBAAwB;IACxB,sBAAsB;IACtB,oBAAoB;IACpB,yBAAyB;IACzB,SAAS;IACT,sBAAsB;IACtB,oBAAoB;IACpB,iBAAiB;IACjB,4BAA4B;IAC5B,+BAA+B;IAC/B,4BAA4B;IAC5B,yBAAyB;IACzB,wBAAwB;IACxB,0BAA0B;IAC1B,6BAA6B;IAC7B,uBAAuB;IACvB,iBAAiB;IACjB,GAAG,qBAAqB;IACxB,2BAA2B;IAC3B,mBAAmB;IACnB,yBAAyB;IACzB,kBAAkB;IAClB,0BAA0B;IAC1B,gCAAgC;IAChC,0BAA0B,EAAE,0BAA0B;IACtD,sBAAsB;IACtB,oBAAoB;IACpB,uBAAuB;IACvB,uBAAuB;IACvB,GAAG,iCAAiC;IACpC,GAAG,qBAAqB,CAAC,iCAAiC;IAC1D,GAAG,mBAAmB,CAAC,2CAA2C;CACnE,CAAC","sourcesContent":["import { sql } from \"drizzle-orm\";\nimport {\n index,\n integer,\n primaryKey,\n sqliteTable,\n text,\n uniqueIndex,\n} from \"drizzle-orm/sqlite-core\";\nimport { containerDocumentTombstoneHolds } from \"./containerDocumentTombstoneHoldSchema\";\nimport {\n containerSQLiteSchema,\n containerTableSchemas,\n} from \"./containerSchema\";\nimport {\n documentAttachmentBlobProjection,\n documentPendingAttachments,\n} from \"./documentAttachmentSchema\";\nimport {\n documentDiscoveryHeads,\n documentDiscoverySequence,\n pendingDocumentDiscoveries,\n} from \"./documentDiscoveryEvidenceSchema\";\nimport {\n documentOrphanBlobReclaims,\n documentOrphanBlobReclaimTable,\n} from \"./documentOrphanBlobReclaims\";\nimport {\n documentIntentLinkTargets,\n documentMoveIntents,\n} from \"./documentPlacementIntentSchema\";\nimport * as organizationDataUsage from \"./organizationDataUsageSchema\";\nimport { organizationFounders } from \"./organizationFounderSchema\";\nimport * as provisioningAttempt from \"./organizationProvisioningAttemptSchema\";\nimport {\n organizationReadModelSQLiteSchema,\n organizationReadModelTables,\n} from \"./organizationReadModelTableRegistry\";\nimport { principalGrantRetirements } from \"./principalGrantRetirementSchema\";\nimport {\n principalHistoryEntries,\n principalHistoryEvidenceTables,\n principalHistoryNodes,\n principalHistoryPrefixes,\n} from \"./principalHistoryEvidenceSchema\";\nimport {\n principalHistoryNodeReferences,\n principalHistoryRootOwners,\n} from \"./principalHistoryNodeRetentionSchema\";\nimport {\n principalHistoryStageScopes,\n principalKeyEnvelopeArchive,\n} from \"./principalHistoryRetentionSchema\";\nimport {\n principalHistoryStages,\n principalHistoryStageTables,\n} from \"./principalHistoryStageSchema\";\nimport {\n principalMutationJournal,\n principalMutationJournalTables,\n} from \"./principalMutationJournalSchema\";\nimport {\n principalPolicies,\n principalPolicyBundleHistory,\n principalPolicyBundleReferences,\n principalPolicyCheckpoints,\n principalPolicyOrganizations,\n} from \"./principalPolicySchema\";\nimport {\n securityIncidents,\n securityIncidentTable,\n} from \"./securityIncidentSchema\";\nimport { defineSqlTableSchema, type SqlTableSchema } from \"./sqlTableSchema\";\nimport {\n verifiedAccessManifestBundles,\n verifiedManifestBundleTables,\n} from \"./verifiedManifestBundleSchema\";\n\nexport {\n containerHydrationTombstones,\n containerProjection,\n containers,\n dormantContainerMetadata,\n dormantMetadataSweepRequests,\n supersededContainerBindings,\n} from \"./containerSchema\";\nexport {\n documentAttachmentBlobProjection,\n documentPendingAttachments,\n} from \"./documentAttachmentSchema\";\nexport { documentMoveIntents } from \"./documentPlacementIntentSchema\";\nexport {\n principalPolicies,\n principalPolicyBundleHistory,\n principalPolicyBundleReferences,\n principalPolicyCheckpoints,\n principalPolicyOrganizations,\n} from \"./principalPolicySchema\";\nexport { securityIncidents } from \"./securityIncidentSchema\";\nexport { containerDocumentTombstoneHolds, organizationReadModelTables };\n\nconst accessLevelColumn = \"effective_access_level\";\n\n/**\n * Durable Loro-backed document records shared by app features.\n *\n * This table stores encrypted document runtime state for multiple app domains.\n * `appKind` namespaces records for documents and container metadata. User-facing\n * list data is projected into feature-specific read models.\n *\n * Columns:\n * - `appKind`: Local domain namespace for the row, such as `documents` or\n * `container-metadata`.\n * - `localId`: Stable local id inside `appKind`. It may be created before a\n * server `documentId` exists.\n * - `documentId`: Server document id once the record is known remotely, or\n * `null` while the document is local-only.\n * - `accessEpoch`: Latest access epoch persisted for the document. Defaults to\n * the initial epoch.\n * - `accessStateHash`: Current document access/manifest state hash returned by\n * sync, when known.\n * - `lastCommitLsn`: Last remote commit cursor applied to this local document.\n * - `documentManifestBundle`: Serialized document manifest bundle used for\n * encrypted document sync.\n * - `contentKeyBundle`: Serialized content-key material needed to open the\n * local document.\n * - `documentKekTargets`: Serialized KEK target state for document key wraps.\n * - `pendingBaseVersion`: Encoded oplog version through which every persisted\n * op is already enqueued or synced. Persisted so a restart restores the\n * outgoing-delta marker instead of re-seeding it past a device-first\n * `deferRemoteSync` write's un-advanced op. `null` when unset.\n * - `snapshotEndVersion`: Encoded end version vector of the persisted content\n * (which lives in the durable-history tables, never on this row), written on\n * every content persist. Lets the pending-write queue's deferred-tail scan\n * compare version coverage without loading content. Empty string when the\n * document has never hydrated content, which readers treat as \"no deferred\n * tail claimable\".\n * - `recoveryGeneration`: Atomic raw-history recovery writer fence.\n * - `recoveryDocumentId`: Former server id for cross-client post-purge recreation.\n * - `pullContinuation`: Durable progress for the next bounded remote pull.\n * - `updatedAt`: Local timestamp for the last persisted runtime-state update.\n *\n * Indexes:\n * - `(appKind, localId)` is the primary key and scopes local document lookups.\n * - `(appKind, documentId) where documentId is not null` supports resolving a\n * server document id back to the local row during discovery and relinking.\n */\nexport const documents = sqliteTable(\n \"documents\",\n {\n appKind: text(\"app_kind\").notNull(),\n localId: text(\"local_id\").notNull(),\n documentId: text(\"document_id\"),\n accessEpoch: integer(\"access_epoch\").notNull().default(1),\n accessStateHash: text(\"access_state_hash\"),\n effectiveAccessLevel: text(accessLevelColumn).notNull().default(\"read\"),\n lastCommitLsn: text(\"last_commit_lsn\"),\n documentManifestBundle: text(\"document_manifest_bundle\"),\n contentKeyBundle: text(\"content_key_bundle\"),\n documentKekTargets: text(\"document_kek_targets\"),\n pendingBaseVersion: text(\"pending_base_version\"),\n pullContinuation: text(\"pull_continuation\"),\n recoveryGeneration: integer(\"recovery_generation\").notNull().default(0),\n recoveryDocumentId: text(\"recovery_document_id\"),\n snapshotEndVersion: text(\"snapshot_end_version\").notNull().default(\"\"),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (table) => [\n primaryKey({ columns: [table.appKind, table.localId] }),\n index(\"documents_app_document_idx\")\n .on(table.appKind, table.documentId)\n .where(sql`${table.documentId} IS NOT NULL`),\n ],\n);\n\n/**\n * Outbound Loro updates waiting to be accepted by sync.\n *\n * Each row stores one locally produced update for a document scope. The queue is\n * replayed in creation order and acknowledged rows are deleted after sync\n * writes the corresponding server commit or persisted document state.\n *\n * Columns:\n * - `id`: Client-generated queue id used for acknowledgement deletes.\n * - `appKind`: Local document namespace matching `documents.appKind`.\n * - `localId`: Local document id matching `documents.localId`.\n * - `updateData`: Serialized Loro update payload.\n * - `partialStartVersionVector`: Version vector before this partial update.\n * - `partialEndVersionVector`: Version vector after this partial update.\n * - `sourceVersionVector`: Optional source vector used to avoid re-enqueuing\n * updates that came from sync.\n * - `createdAt`: Queue insertion timestamp used for deterministic replay.\n *\n * Indexes:\n * - `id` is the primary key for targeted deletes.\n * - `(appKind, localId, createdAt)` supports ordered pending-update scans for a\n * document scope.\n */\nexport const documentPendingUpdates = sqliteTable(\n \"document_pending_updates\",\n {\n id: text(\"id\"),\n appKind: text(\"app_kind\").notNull(),\n localId: text(\"local_id\").notNull(),\n updateData: text(\"update_data\").notNull(),\n partialStartVersionVector: text(\"partial_start_version_vector\").notNull(),\n partialEndVersionVector: text(\"partial_end_version_vector\").notNull(),\n sourceVersionVector: text(\"source_version_vector\"),\n createdAt: text(\"created_at\").notNull(),\n rekeyCount: integer(\"rekey_count\").notNull().default(0),\n },\n (table) => [\n primaryKey({ columns: [table.id] }),\n index(\"document_pending_updates_scope_created_idx\").on(\n table.appKind,\n table.localId,\n table.createdAt,\n ),\n ],\n);\n\n/**\n * Last terminal sync failure or quarantined incoming update per document scope.\n *\n * The durable write queue (`documentPendingUpdates`) has no status columns — a\n * row is either pending or settled-and-deleted. Terminal submissions and\n * incoming updates that cannot be decrypted or imported are recorded here so\n * the write-queue view and footer can surface why the document is blocked.\n * Rows are upserted per scope and deleted only after a later fully validated\n * sync pass succeeds or the scope's local state is torn down.\n *\n * Columns:\n * - `appKind`: Local document namespace matching `documents.appKind`.\n * - `localId`: Local document id matching `documents.localId`.\n * - `status`: HTTP status of the failed submission when known.\n * - `message`: Human-readable failure description for queue display.\n * - `attemptedAt`: Timestamp of the failed attempt.\n *\n * Indexes:\n * - `(appKind, localId)` is the primary key and keeps one failure per scope.\n */\nexport const documentSyncFailures = sqliteTable(\n \"document_sync_failures\",\n {\n appKind: text(\"app_kind\").notNull(),\n localId: text(\"local_id\").notNull(),\n status: integer(\"status\"),\n message: text(\"message\").notNull(),\n attemptedAt: text(\"attempted_at\").notNull(),\n },\n (table) => [primaryKey({ columns: [table.appKind, table.localId] })],\n);\n\n/**\n * Full-history persistence for local documents (checkpoint + tail) — the ONLY\n * durable content source. Record rows in `documents` carry runtime metadata\n * and the content frontier (`snapshotEndVersion`), never content. The\n * checkpoint holds a full-history snapshot refreshed only at compaction, and\n * the tail appends every update (local deltas and decrypted remote updates)\n * written since. Restore = import checkpoint + replay tail; compaction =\n * export full history from the live doc, replace the checkpoint, clear the\n * tail — all bounded and amortized. Container metadata stores its content (an\n * exported-updates blob) as its checkpoint row, with no tail.\n */\nexport const documentHistoryCheckpoints = sqliteTable(\n \"document_history_checkpoints\",\n {\n appKind: text(\"app_kind\").notNull(),\n localId: text(\"local_id\").notNull(),\n snapshot: text(\"snapshot\").notNull(),\n endVersionVector: text(\"end_version_vector\").notNull(),\n revision: text(\"revision\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (table) => [primaryKey({ columns: [table.appKind, table.localId] })],\n);\n\nexport const documentHistoryUpdates = sqliteTable(\n \"document_history_updates\",\n {\n id: text(\"id\"),\n appKind: text(\"app_kind\").notNull(),\n localId: text(\"local_id\").notNull(),\n updateData: text(\"update_data\").notNull(),\n // Provenance: \"local\" (authored on this device) or \"remote\" (decrypted\n // pulled update). Restores use it to advance the outgoing-delta marker\n // across remote rows — their ops are already server-side — while a local\n // row left behind by a crash stays below the marker so the next edit\n // re-derives and sends it.\n origin: text(\"origin\").notNull(),\n createdAt: text(\"created_at\").notNull(),\n },\n (table) => [\n primaryKey({ columns: [table.id] }),\n index(\"document_history_updates_scope_created_idx\").on(\n table.appKind,\n table.localId,\n table.createdAt,\n ),\n ],\n);\n\n/**\n * Anti-rollback pin for verified access manifests.\n *\n * Records the highest access-manifest epoch this client has verified for each\n * object, so a later projection that serves an older epoch (rollback) or a\n * conflicting manifest at the same epoch (equivocation) is detected before any\n * key is unwrapped. Updated monotonically after a projection verifies cleanly.\n *\n * Columns:\n * - `objectKind`: Access object kind (`container`, `document`, ...).\n * - `organizationId`: Organization boundary that owns the object.\n * - `objectId`: Stable object id.\n * - `epoch`: Highest verified manifest epoch.\n * - `manifestHash`: Manifest hash pinned at that epoch.\n * - `updatedAt`: Local timestamp for the pin.\n *\n * Indexes:\n * - `(objectKind, organizationId, objectId)` is the primary key and gives one\n * pin per object.\n */\nexport const accessManifestCheckpoints = sqliteTable(\n \"access_manifest_checkpoints\",\n {\n objectKind: text(\"object_kind\").notNull(),\n organizationId: text(\"organization_id\").notNull(),\n objectId: text(\"object_id\").notNull(),\n epoch: integer(\"epoch\").notNull(),\n manifestHash: text(\"manifest_hash\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (table) => [\n primaryKey({\n columns: [table.objectKind, table.organizationId, table.objectId],\n }),\n ],\n);\n\n/**\n * Durable terminal pins for documents whose signed purge proof was verified.\n * These survive remote-state resets so a dishonest API cannot later replay the\n * pre-purge writer projection and resurrect locally deleted content.\n */\nexport const documentPurgeCheckpoints = sqliteTable(\n \"document_purge_checkpoints\",\n {\n documentId: text(\"document_id\").primaryKey(),\n organizationId: text(\"organization_id\").notNull(),\n documentManifestHash: text(\"document_manifest_hash\").notNull(),\n purgeEventHash: text(\"purge_event_hash\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n);\n\n/**\n * Durable trust-on-first-use pins for remote user identity bundles.\n *\n * The first validated identity observed for a user in a configured API trust\n * domain is inserted once. Later observations must match every suite, public\n * key, and fingerprint exactly; the persistence adapter never updates these\n * rows. `firstSeenAt` records when the local trust decision was made and is\n * likewise immutable.\n *\n * Indexes:\n * - `(identityTrustDomain, userId)` is the primary key and scopes a user pin to\n * the host-configured API authority that supplied it.\n * - `(identityTrustDomain, signingKeyFingerprint)` binds the reverse identity\n * mapping durably, including across session recreation. There is no\n * migration for a table that already violates it. Earlier builds pinned a\n * registration's user id before the server confirmed it, so a device that\n * ran one may hold two users on one key; deployments are greenfield, and\n * such a device clears its local data, which recreates this table empty. A\n * device that used an environment before a reset does the same (see\n * docs/developer/greenfield-reset.md).\n */\nexport const trustedUserIdentityPins = sqliteTable(\n \"trusted_user_identity_pins\",\n {\n identityTrustDomain: text(\"identity_trust_domain\").notNull(),\n userId: text(\"user_id\").notNull(),\n formatVersion: integer(\"format_version\").notNull(),\n signingSuite: text(\"signing_suite\").notNull(),\n signingPublicKey: text(\"signing_public_key\").notNull(),\n signingKeyFingerprint: text(\"signing_key_fingerprint\").notNull(),\n encapsulationSuite: text(\"encapsulation_suite\").notNull(),\n encapsulationPublicKey: text(\"encapsulation_public_key\").notNull(),\n encapsulationKeyFingerprint: text(\n \"encapsulation_key_fingerprint\",\n ).notNull(),\n firstSeenAt: text(\"first_seen_at\").notNull(),\n },\n (table) => [\n primaryKey({\n columns: [table.identityTrustDomain, table.userId],\n }),\n uniqueIndex(\"trusted_user_identity_pins_domain_signing_fingerprint_idx\").on(\n table.identityTrustDomain,\n table.signingKeyFingerprint,\n ),\n ],\n);\n\n/**\n * Local many-to-many projection between documents and containers.\n *\n * The document summary row stores one selected `containerId` for primary list\n * placement, while this table keeps the full set of linked containers returned\n * by container/document sync. Removing a container deletes its links and may\n * repair affected document summary rows to point at another remaining link.\n *\n * Columns:\n * - `documentId`: Server document id whose container links are projected.\n * - `containerId`: Linked container id.\n * - `updatedAt`: Local timestamp for the last replacement of the link set.\n *\n * Indexes:\n * - `(documentId, containerId)` is the primary key and prevents duplicate\n * links for the same document/container pair.\n */\nexport const documentContainerProjection = sqliteTable(\n \"document_container_projection\",\n {\n documentId: text(\"document_id\").notNull(),\n containerId: text(\"container_id\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (table) => [primaryKey({ columns: [table.documentId, table.containerId] })],\n);\n\n/**\n * Queryable document summary and detail projection.\n *\n * The durable Loro state lives in `documents`. This table stores the fields the\n * app needs for document lists, summaries, and fast detail hydration without\n * opening the full Loro snapshot on every read.\n *\n * Columns:\n * - `localId`: Stable local document id. This joins to `documents.localId` for\n * rows where `documents.appKind = documents`.\n * - `documentId`: Server document id when known.\n * - `containerId`: Selected container for primary document placement, or\n * `null` if the document is not currently linked to a visible container.\n * - `organizationId`: Last-known owning organization. Stamped from the\n * container row when the document is detached because its container was\n * removed locally (e.g. access to a shared org was revoked and the container\n * tombstoned), so pending writes keep their org attribution after the\n * `containers` join source disappears. Read as a fallback only — a live\n * container join always wins.\n * - `documentKind`: Stored document kind. Defaults to `note`.\n * - `title`: Plain projected title. Defaults to the note fallback title.\n * - `updatedAt`: Timestamp used for document list ordering.\n *\n * The projected full text lives in `documentProjectionText`, keyed by the same\n * `localId`. Keeping it out of this row keeps list/window scans narrow: the\n * sidebar and summary queries read titles and placement from rows whose size\n * does not grow with document content.\n *\n * Indexes:\n * - `localId` is the primary key for document projection lookups.\n * - `(containerId) where containerId is not null` serves container-scoped\n * window/count scans without walking the whole table.\n * - `(organizationId) where containerId is null` serves the orphan-recovery\n * existence and window scans.\n * - `(documentId) where documentId is not null` serves the linked-placement\n * join from `documentContainerProjection` and server-id lookups.\n */\nexport const documentProjection = sqliteTable(\n \"document_projection\",\n {\n localId: text(\"local_id\"),\n documentId: text(\"document_id\"),\n containerId: text(\"container_id\"),\n organizationId: text(\"organization_id\"),\n documentKind: text(\"document_kind\").notNull().default(\"note\"),\n title: text(\"title\").notNull().default(\"Untitled note\"),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (table) => [\n primaryKey({ columns: [table.localId] }),\n index(\"document_projection_container_idx\")\n .on(table.containerId)\n .where(sql`${table.containerId} IS NOT NULL`),\n index(\"document_projection_orphan_organization_idx\")\n .on(table.organizationId)\n .where(sql`${table.containerId} IS NULL`),\n index(\"document_projection_document_idx\")\n .on(table.documentId)\n .where(sql`${table.documentId} IS NOT NULL`),\n ],\n);\n\n/**\n * Projected document text, split from `documentProjection` so content size\n * never bloats the rows that list/window queries scan. Loaded only by detail\n * reads (`loadDocument`) and the save-timestamp change check.\n *\n * Columns:\n * - `localId`: Stable local document id, matching `documentProjection.localId`.\n * - `text`: Plain projected text used to rebuild summaries/details.\n */\nexport const documentProjectionText = sqliteTable(\n \"document_projection_text\",\n {\n localId: text(\"local_id\"),\n text: text(\"text\").notNull(),\n },\n (table) => [primaryKey({ columns: [table.localId] })],\n);\n\n/**\n * Offline create queue for containers.\n *\n * A user can create a local container before the API has assigned all remote\n * state for the container and its metadata document. This table keeps the sync\n * intent until container-create sync either records the remote ids or stores an\n * error for retry.\n *\n * Columns:\n * - `id`: Client-generated intent id.\n * - `containerId`: Local container id created optimistically.\n * - `parentContainerId`: Parent container id used when the intent is sent.\n * - `intentType`: Intent discriminator, currently `container.create`.\n * - `syncStatus`: Current sync state, currently `pending` or `synced`.\n * - `remoteContainerId`: Remote container id recorded after successful sync.\n * - `remoteMetadataDocumentId`: Remote metadata document id recorded after\n * successful sync.\n * - `remoteMetadataAccessStateHash`: Access state hash for the synced metadata\n * document.\n * - `lastError`: Last sync error message for retry/debug display.\n * - `createdAt`: Intent creation timestamp used for FIFO sync.\n * - `updatedAt`: Local timestamp for the latest status/error change.\n *\n * Indexes:\n * - `id` is the primary key.\n * - `containerId` is unique so each local container has one create intent.\n * - `(syncStatus, createdAt)` supports listing pending intents in creation\n * order.\n */\nexport const containerCreateIntents = sqliteTable(\n \"container_create_intents\",\n {\n id: text(\"id\"),\n containerId: text(\"container_id\").notNull().unique(),\n parentContainerId: text(\"parent_container_id\").notNull(),\n intentType: text(\"intent_type\").notNull(),\n syncStatus: text(\"sync_status\").notNull(),\n remoteContainerId: text(\"remote_container_id\"),\n remoteMetadataDocumentId: text(\"remote_metadata_document_id\"),\n remoteMetadataAccessStateHash: text(\"remote_metadata_access_state_hash\"),\n lastError: text(\"last_error\"),\n lastAttemptedAt: text(\"last_attempted_at\"),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (table) => [\n primaryKey({ columns: [table.id] }),\n index(\"container_create_intents_status_created_idx\").on(\n table.syncStatus,\n table.createdAt,\n ),\n ],\n);\n\n/**\n * Offline move queue for synced containers.\n *\n * A user can move a container whose server identity is already known while the\n * API or writer context is unavailable. This table stores only the desired\n * final parent and replay diagnostics; the signed move request is rebuilt from\n * current writer projections when sync resumes.\n *\n * Columns:\n * - `id`: Client-generated intent id.\n * - `containerId`: Synced container moved optimistically in the local tree.\n * - `parentContainerId`: Desired final parent container id.\n * - `previousParentContainerId`: Parent observed when the move was queued.\n * - `intentType`: Intent discriminator, currently `container.move`.\n * - `syncStatus`: Current sync state, currently `pending` or `blocked`.\n * - `lastError`: Last sync error message for retry/debug display.\n * - `lastAttemptedAt`: Timestamp of the last replay attempt.\n * - `createdAt`: Intent creation timestamp used for FIFO sync.\n * - `updatedAt`: Local timestamp for the latest target/status/error change.\n *\n * Indexes:\n * - `id` is the primary key.\n * - `containerId` is unique so same-container moves coalesce to one intent.\n * - `(syncStatus, createdAt)` supports listing pending intents in queue order.\n */\nexport const containerMoveIntents = sqliteTable(\n \"container_move_intents\",\n {\n id: text(\"id\"),\n containerId: text(\"container_id\").notNull().unique(),\n parentContainerId: text(\"parent_container_id\").notNull(),\n previousParentContainerId: text(\"previous_parent_container_id\"),\n intentType: text(\"intent_type\").notNull(),\n syncStatus: text(\"sync_status\").notNull(),\n lastError: text(\"last_error\"),\n lastAttemptedAt: text(\"last_attempted_at\"),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (table) => [\n primaryKey({ columns: [table.id] }),\n index(\"container_move_intents_status_created_idx\").on(\n table.syncStatus,\n table.createdAt,\n ),\n ],\n);\n\n/**\n * Per-lane sync cursors for container data.\n *\n * Container sync is split into lanes, such as a parent-container child lane or\n * a container-document membership lane. This table stores the last accepted\n * server watermark for each lane so the next sync request can resume without\n * replaying the entire tree.\n *\n * Columns:\n * - `laneKind`: Sync lane category, such as `container_parent` or\n * `container_documents`.\n * - `laneId`: Lane identity. Root parent sync uses `root`, child sync uses a\n * parent-prefixed container id, and document lanes use the container id.\n * - `watermarkUpdatedAt`: Server `updatedAt` value for the stored watermark.\n * - `watermarkId`: Server id tie-breaker for the stored watermark.\n * - `updatedAt`: Local timestamp for when the cursor was saved.\n *\n * Indexes:\n * - `(laneKind, laneId)` is the primary key and stores one cursor per lane.\n */\nexport const containerSyncWatermarks = sqliteTable(\n \"container_sync_watermarks\",\n {\n laneKind: text(\"lane_kind\").notNull(),\n laneId: text(\"lane_id\").notNull(),\n watermarkUpdatedAt: text(\"watermark_updated_at\").notNull(),\n watermarkId: text(\"watermark_id\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (table) => [primaryKey({ columns: [table.laneKind, table.laneId] })],\n);\n\n/**\n * Local freshness markers for container sync lanes.\n *\n * These rows track the last successful API check for a lane independently from\n * server watermarks. Empty server responses do not always include a new\n * watermark, but the client still needs to remember that it recently checked\n * the lane so startup can use cached container state without polling every\n * time a container tree opens.\n *\n * Columns:\n * - `laneKind`: Sync lane category matching `containerSyncWatermarks`.\n * - `laneId`: Lane identity matching `containerSyncWatermarks`.\n * - `checkedAt`: Local timestamp for the most recent successful lane check.\n *\n * Indexes:\n * - `(laneKind, laneId)` is the primary key and stores one marker per lane.\n */\nexport const containerSyncLaneChecks = sqliteTable(\n \"container_sync_lane_checks\",\n {\n laneKind: text(\"lane_kind\").notNull(),\n laneId: text(\"lane_id\").notNull(),\n checkedAt: text(\"checked_at\").notNull(),\n },\n (table) => [primaryKey({ columns: [table.laneKind, table.laneId] })],\n);\n\nexport const documentTables: ReadonlyArray<SqlTableSchema> = [\n {\n ...defineSqlTableSchema(documents),\n requiredColumns: [\n \"pull_continuation\",\n \"recovery_generation\",\n \"recovery_document_id\",\n ],\n },\n defineSqlTableSchema(documentPendingUpdates),\n defineSqlTableSchema(documentSyncFailures),\n defineSqlTableSchema(documentHistoryCheckpoints),\n defineSqlTableSchema(documentHistoryUpdates),\n];\n\nexport const principalPolicyTables: ReadonlyArray<SqlTableSchema> = [\n {\n ...defineSqlTableSchema(principalPolicies),\n requiredColumns: [\"current_grants_json\"],\n },\n {\n ...defineSqlTableSchema(principalPolicyBundleHistory),\n requiredColumns: [\"current_grants_json\"],\n },\n defineSqlTableSchema(principalPolicyBundleReferences),\n defineSqlTableSchema(principalPolicyOrganizations),\n ...principalHistoryStageTables,\n ...principalHistoryEvidenceTables,\n];\n\nexport const keyingCheckpointTables: ReadonlyArray<SqlTableSchema> = [\n defineSqlTableSchema(organizationFounders),\n defineSqlTableSchema(accessManifestCheckpoints),\n defineSqlTableSchema(principalGrantRetirements),\n defineSqlTableSchema(documentPurgeCheckpoints),\n defineSqlTableSchema(principalPolicyCheckpoints),\n];\n\nexport const trustedUserIdentityPinTables: ReadonlyArray<SqlTableSchema> = [\n defineSqlTableSchema(trustedUserIdentityPins),\n];\n\nconst securityIncidentTables: ReadonlyArray<SqlTableSchema> = [\n securityIncidentTable,\n];\n\nexport const containerTables = containerTableSchemas;\n\nexport const documentContainerProjectionTables: ReadonlyArray<SqlTableSchema> =\n [\n defineSqlTableSchema(documentContainerProjection),\n {\n ...defineSqlTableSchema(containerDocumentTombstoneHolds),\n requiredColumns: [\"hidden\"],\n },\n defineSqlTableSchema(pendingDocumentDiscoveries),\n {\n ...defineSqlTableSchema(documentDiscoveryHeads),\n requiredColumns: [\"organization_id\"],\n },\n defineSqlTableSchema(documentDiscoverySequence),\n ];\n\nexport const documentMoveIntentTables: ReadonlyArray<SqlTableSchema> = [\n defineSqlTableSchema(documentMoveIntents),\n defineSqlTableSchema(documentIntentLinkTargets),\n];\n\nexport const documentProjectionTables: ReadonlyArray<SqlTableSchema> = [\n defineSqlTableSchema(documentProjection),\n defineSqlTableSchema(documentProjectionText),\n {\n ...defineSqlTableSchema(documentPendingAttachments),\n requiredColumns: [\"content_sha256\"],\n },\n {\n ...defineSqlTableSchema(documentAttachmentBlobProjection),\n requiredColumns: [\"content_sha256\"],\n },\n documentOrphanBlobReclaimTable,\n];\n\nexport const containerCreateIntentTables: ReadonlyArray<SqlTableSchema> = [\n defineSqlTableSchema(containerCreateIntents),\n];\n\nexport const containerMoveIntentTables: ReadonlyArray<SqlTableSchema> = [\n defineSqlTableSchema(containerMoveIntents),\n];\n\nexport const containerSyncWatermarkTables: ReadonlyArray<SqlTableSchema> = [\n defineSqlTableSchema(containerSyncWatermarks),\n defineSqlTableSchema(containerSyncLaneChecks),\n];\n\nexport const clientSqlTables: ReadonlyArray<SqlTableSchema> = [\n ...principalMutationJournalTables,\n ...documentTables,\n ...principalPolicyTables,\n ...keyingCheckpointTables,\n ...verifiedManifestBundleTables,\n ...trustedUserIdentityPinTables,\n ...securityIncidentTables,\n ...containerTables,\n ...documentContainerProjectionTables,\n ...documentMoveIntentTables,\n ...documentProjectionTables,\n ...containerCreateIntentTables,\n ...containerMoveIntentTables,\n ...containerSyncWatermarkTables,\n ...organizationReadModelTables,\n ...organizationDataUsage.organizationDataUsageTables,\n ...provisioningAttempt.organizationProvisioningAttemptTables,\n];\n\nexport const clientSQLiteSchema = {\n principalHistoryNodeReferences,\n principalHistoryRootOwners,\n principalHistoryStageScopes,\n principalKeyEnvelopeArchive,\n principalMutationJournal,\n principalHistoryEntries,\n principalHistoryNodes,\n principalHistoryPrefixes,\n principalHistoryStages,\n organizationFounders,\n principalGrantRetirements,\n documents,\n documentPendingUpdates,\n documentSyncFailures,\n principalPolicies,\n principalPolicyBundleHistory,\n principalPolicyBundleReferences,\n principalPolicyOrganizations,\n accessManifestCheckpoints,\n documentPurgeCheckpoints,\n principalPolicyCheckpoints,\n verifiedAccessManifestBundles,\n trustedUserIdentityPins,\n securityIncidents,\n ...containerSQLiteSchema,\n documentContainerProjection,\n documentMoveIntents,\n documentIntentLinkTargets,\n documentProjection,\n documentPendingAttachments,\n documentAttachmentBlobProjection,\n documentOrphanBlobReclaims: documentOrphanBlobReclaims,\n containerCreateIntents,\n containerMoveIntents,\n containerSyncLaneChecks,\n containerSyncWatermarks,\n ...organizationReadModelSQLiteSchema,\n ...organizationDataUsage.organizationDataUsageSQLiteSchema,\n ...provisioningAttempt.organizationProvisioningAttemptSQLiteSchema,\n};\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EACL,KAAK,EACL,OAAO,EACP,UAAU,EACV,WAAW,EACX,IAAI,EACJ,WAAW,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EACL,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,mBA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A0B;IAC1B,6BAA6B;IAC7B,uBAAuB;IACvB,iBAAiB;IACjB,GAAG,qBAAqB;IACxB,2BAA2B;IAC3B,mBAAmB;IACnB,yBAAyB;IACzB,kBAAkB;IAClB,0BAA0B;IAC1B,gCAAgC;IAChC,0BAA0B,EAAE,0BAA0B;IACtD,sBAAsB;IACtB,oBAAoB;IACpB,uBAAuB;IACvB,GAAG,iCAAiC;IACpC,GAAG,qBAAqB,CAAC,iCAAiC;IAC1D,GAAG,mBAAmB,CAAC,2CAA2C;CACnE,CAAC","sourcesContent":["import { sql } from \"drizzle-orm\";\nimport {\n index,\n integer,\n primaryKey,\n sqliteTable,\n text,\n uniqueIndex,\n} from \"drizzle-orm/sqlite-core\";\nimport { containerDocumentTombstoneHolds } from \"./containerDocumentTombstoneHoldSchema\";\nimport {\n containerSQLiteSchema,\n containerTableSchemas,\n} from \"./containerSchema\";\nimport {\n documentAttachmentBlobProjection,\n documentPendingAttachments,\n} from \"./documentAttachmentSchema\";\nimport {\n documentDiscoveryHeads,\n documentDiscoverySequence,\n pendingDocumentDiscoveries,\n} from \"./documentDiscoveryEvidenceSchema\";\nimport {\n documentOrphanBlobReclaims,\n documentOrphanBlobReclaimTable,\n} from \"./documentOrphanBlobReclaims\";\nimport {\n documentIntentLinkTargets,\n documentMoveIntents,\n} from \"./documentPlacementIntentSchema\";\nimport * as organizationDataUsage from \"./organizationDataUsageSchema\";\nimport { organizationFounders } from \"./organizationFounderSchema\";\nimport * as provisioningAttempt from \"./organizationProvisioningAttemptSchema\";\nimport {\n organizationReadModelSQLiteSchema,\n organizationReadModelTables,\n} from \"./organizationReadModelTableRegistry\";\nimport { principalGrantRetirements } from \"./principalGrantRetirementSchema\";\nimport {\n principalHistoryEntries,\n principalHistoryEvidenceTables,\n principalHistoryNodes,\n principalHistoryPrefixes,\n} from \"./principalHistoryEvidenceSchema\";\nimport {\n principalHistoryNodeReferences,\n principalHistoryRootOwners,\n} from \"./principalHistoryNodeRetentionSchema\";\nimport {\n principalHistoryStageScopes,\n principalKeyEnvelopeArchive,\n} from \"./principalHistoryRetentionSchema\";\nimport {\n principalHistoryStages,\n principalHistoryStageTables,\n} from \"./principalHistoryStageSchema\";\nimport {\n principalMutationJournal,\n principalMutationJournalTables,\n} from \"./principalMutationJournalSchema\";\nimport {\n principalPolicies,\n principalPolicyBundleHistory,\n principalPolicyBundleReferences,\n principalPolicyCheckpoints,\n principalPolicyOrganizations,\n} from \"./principalPolicySchema\";\nimport {\n securityIncidents,\n securityIncidentTable,\n} from \"./securityIncidentSchema\";\nimport { defineSqlTableSchema, type SqlTableSchema } from \"./sqlTableSchema\";\nimport {\n verifiedAccessManifestBundles,\n verifiedManifestBundleTables,\n} from \"./verifiedManifestBundleSchema\";\n\nexport {\n containerHydrationTombstones,\n containerProjection,\n containers,\n dormantContainerMetadata,\n dormantMetadataSweepRequests,\n supersededContainerBindings,\n} from \"./containerSchema\";\nexport {\n documentAttachmentBlobProjection,\n documentPendingAttachments,\n} from \"./documentAttachmentSchema\";\nexport { documentMoveIntents } from \"./documentPlacementIntentSchema\";\nexport {\n principalPolicies,\n principalPolicyBundleHistory,\n principalPolicyBundleReferences,\n principalPolicyCheckpoints,\n principalPolicyOrganizations,\n} from \"./principalPolicySchema\";\nexport { securityIncidents } from \"./securityIncidentSchema\";\nexport { containerDocumentTombstoneHolds, organizationReadModelTables };\n\nconst accessLevelColumn = \"effective_access_level\";\n\n/**\n * Durable Loro-backed document records shared by app features.\n *\n * This table stores encrypted document runtime state for multiple app domains.\n * `appKind` namespaces records for documents and container metadata. User-facing\n * list data is projected into feature-specific read models.\n *\n * Columns:\n * - `appKind`: Local domain namespace for the row, such as `documents` or\n * `container-metadata`.\n * - `localId`: Stable local id inside `appKind`. It may be created before a\n * server `documentId` exists.\n * - `documentId`: Server document id once the record is known remotely, or\n * `null` while the document is local-only.\n * - `accessEpoch`: Latest access epoch persisted for the document. Defaults to\n * the initial epoch.\n * - `accessStateHash`: Current document access/manifest state hash returned by\n * sync, when known.\n * - `lastCommitLsn`: Last remote commit cursor applied to this local document.\n * - `documentManifestBundle`: Serialized document manifest bundle used for\n * encrypted document sync.\n * - `contentKeyBundle`: Serialized content-key material needed to open the\n * local document.\n * - `documentKekTargets`: Serialized KEK target state for document key wraps.\n * - `pendingBaseVersion`: Encoded oplog version through which every persisted\n * op is already enqueued or synced. Persisted so a restart restores the\n * outgoing-delta marker instead of re-seeding it past a device-first\n * `deferRemoteSync` write's un-advanced op. `null` when unset.\n * - `snapshotEndVersion`: Encoded end version vector of the persisted content\n * (which lives in the durable-history tables, never on this row), written on\n * every content persist. Lets the pending-write queue's deferred-tail scan\n * compare version coverage without loading content. Empty string when the\n * document has never hydrated content, which readers treat as \"no deferred\n * tail claimable\".\n * - `recoveryGeneration`: Atomic raw-history recovery writer fence.\n * - `recoveryDocumentId`: Former server id for cross-client post-purge recreation.\n * - `pullContinuation`: Durable progress for the next bounded remote pull.\n * - `updatedAt`: Local timestamp for the last persisted runtime-state update.\n *\n * Indexes:\n * - `(appKind, localId)` is the primary key and scopes local document lookups.\n * - `(appKind, documentId) where documentId is not null` supports resolving a\n * server document id back to the local row during discovery and relinking.\n */\nexport const documents = sqliteTable(\n \"documents\",\n {\n appKind: text(\"app_kind\").notNull(),\n localId: text(\"local_id\").notNull(),\n documentId: text(\"document_id\"),\n accessEpoch: integer(\"access_epoch\").notNull().default(1),\n accessStateHash: text(\"access_state_hash\"),\n effectiveAccessLevel: text(accessLevelColumn).notNull().default(\"read\"),\n lastCommitLsn: text(\"last_commit_lsn\"),\n documentManifestBundle: text(\"document_manifest_bundle\"),\n contentKeyBundle: text(\"content_key_bundle\"),\n documentKekTargets: text(\"document_kek_targets\"),\n pendingBaseVersion: text(\"pending_base_version\"),\n pullContinuation: text(\"pull_continuation\"),\n recoveryGeneration: integer(\"recovery_generation\").notNull().default(0),\n recoveryDocumentId: text(\"recovery_document_id\"),\n snapshotEndVersion: text(\"snapshot_end_version\").notNull().default(\"\"),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (table) => [\n primaryKey({ columns: [table.appKind, table.localId] }),\n index(\"documents_app_document_idx\")\n .on(table.appKind, table.documentId)\n .where(sql`${table.documentId} IS NOT NULL`),\n ],\n);\n\n/**\n * Last terminal sync failure or quarantined incoming update per document scope.\n *\n * The durable write queue (queued rows of `documentHistoryUpdates`) has no\n * status columns — a row is either queued or settled. Terminal submissions and\n * incoming updates that cannot be decrypted or imported are recorded here so\n * the write-queue view and footer can surface why the document is blocked.\n * Rows are upserted per scope and deleted only after a later fully validated\n * sync pass succeeds or the scope's local state is torn down.\n *\n * Columns:\n * - `appKind`: Local document namespace matching `documents.appKind`.\n * - `localId`: Local document id matching `documents.localId`.\n * - `status`: HTTP status of the failed submission when known.\n * - `message`: Human-readable failure description for queue display.\n * - `attemptedAt`: Timestamp of the failed attempt.\n *\n * Indexes:\n * - `(appKind, localId)` is the primary key and keeps one failure per scope.\n */\nexport const documentSyncFailures = sqliteTable(\n \"document_sync_failures\",\n {\n appKind: text(\"app_kind\").notNull(),\n localId: text(\"local_id\").notNull(),\n status: integer(\"status\"),\n message: text(\"message\").notNull(),\n attemptedAt: text(\"attempted_at\").notNull(),\n },\n (table) => [primaryKey({ columns: [table.appKind, table.localId] })],\n);\n\n/**\n * Full-history persistence for local documents (checkpoint + tail) — the ONLY\n * durable content source. Record rows in `documents` carry runtime metadata\n * and the content frontier (`snapshotEndVersion`), never content. The\n * checkpoint holds a full-history snapshot refreshed only at compaction, and\n * the tail appends every update (local deltas and decrypted remote updates)\n * written since. Restore = import checkpoint + replay tail; compaction =\n * export full history from the live doc, replace the checkpoint, clear the\n * tail — all bounded and amortized. Container metadata stores its content (an\n * exported-updates blob) as its checkpoint row, with no tail.\n */\nexport const documentHistoryCheckpoints = sqliteTable(\n \"document_history_checkpoints\",\n {\n appKind: text(\"app_kind\").notNull(),\n localId: text(\"local_id\").notNull(),\n snapshot: text(\"snapshot\").notNull(),\n endVersionVector: text(\"end_version_vector\").notNull(),\n revision: text(\"revision\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (table) => [primaryKey({ columns: [table.appKind, table.localId] })],\n);\n\n/**\n * The local update log: one row per Loro update, serving as both the history\n * tail (restore = checkpoint + tail) and the outbound write queue.\n *\n * Every locally authored update is stored once. While it waits for sync it\n * carries an `updateId` (the id submitted to the server) and the version-vector\n * metadata the submission needs; settlement clears them, leaving the row as\n * ordinary tail history until compaction folds it into a checkpoint.\n *\n * Columns:\n * - `id`: Row id; tail compaction deletes by it.\n * - `appKind`, `localId`: Document scope matching `documents`.\n * - `updateData`: Serialized Loro update payload.\n * - `origin`: \"local\" (authored on this device) or \"remote\" (decrypted\n * pulled update) for tail rows. Restores use it to advance the\n * outgoing-delta marker across remote rows — their ops are already\n * server-side — while a local row left behind by a crash stays below the\n * marker so the next edit re-derives and sends it. \"outbox\" marks a queued\n * update with no tail role (container metadata, whose content is its\n * checkpoint, and full-state re-uploads after a remote reset); restores and\n * compaction never see it and settlement deletes it.\n * - `createdAt`: Insertion timestamp; with `rowid`, deterministic replay order.\n * - `updateId`: Present exactly while the row is queued for sync; rekeyed\n * after a lost acknowledgement poisons the submitted id.\n * - `partialStartVersionVector` / `partialEndVersionVector`: Version vectors\n * around a queued partial update.\n * - `sourceVersionVector`: Present on a queued rotation baseline checkpoint.\n * - `rekeyCount`: Durable bound on rekeys of a queued row.\n *\n * Invariant: compaction never deletes a queued row, so a checkpoint can cover\n * a queued update's operations without removing it from the queue.\n */\nexport const documentHistoryUpdates = sqliteTable(\n \"document_history_updates\",\n {\n id: text(\"id\"),\n appKind: text(\"app_kind\").notNull(),\n localId: text(\"local_id\").notNull(),\n updateData: text(\"update_data\").notNull(),\n origin: text(\"origin\").notNull(),\n createdAt: text(\"created_at\").notNull(),\n updateId: text(\"update_id\"),\n partialStartVersionVector: text(\"partial_start_version_vector\"),\n partialEndVersionVector: text(\"partial_end_version_vector\"),\n sourceVersionVector: text(\"source_version_vector\"),\n rekeyCount: integer(\"rekey_count\").notNull().default(0),\n },\n (table) => [\n primaryKey({ columns: [table.id] }),\n index(\"document_history_updates_scope_created_idx\").on(\n table.appKind,\n table.localId,\n table.createdAt,\n ),\n uniqueIndex(\"document_history_updates_update_id_idx\")\n .on(table.updateId)\n .where(sql`${table.updateId} IS NOT NULL`),\n ],\n);\n\n/**\n * Anti-rollback pin for verified access manifests.\n *\n * Records the highest access-manifest epoch this client has verified for each\n * object, so a later projection that serves an older epoch (rollback) or a\n * conflicting manifest at the same epoch (equivocation) is detected before any\n * key is unwrapped. Updated monotonically after a projection verifies cleanly.\n *\n * Columns:\n * - `objectKind`: Access object kind (`container`, `document`, ...).\n * - `organizationId`: Organization boundary that owns the object.\n * - `objectId`: Stable object id.\n * - `epoch`: Highest verified manifest epoch.\n * - `manifestHash`: Manifest hash pinned at that epoch.\n * - `updatedAt`: Local timestamp for the pin.\n *\n * Indexes:\n * - `(objectKind, organizationId, objectId)` is the primary key and gives one\n * pin per object.\n */\nexport const accessManifestCheckpoints = sqliteTable(\n \"access_manifest_checkpoints\",\n {\n objectKind: text(\"object_kind\").notNull(),\n organizationId: text(\"organization_id\").notNull(),\n objectId: text(\"object_id\").notNull(),\n epoch: integer(\"epoch\").notNull(),\n manifestHash: text(\"manifest_hash\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (table) => [\n primaryKey({\n columns: [table.objectKind, table.organizationId, table.objectId],\n }),\n ],\n);\n\n/**\n * Durable terminal pins for documents whose signed purge proof was verified.\n * These survive remote-state resets so a dishonest API cannot later replay the\n * pre-purge writer projection and resurrect locally deleted content.\n */\nexport const documentPurgeCheckpoints = sqliteTable(\n \"document_purge_checkpoints\",\n {\n documentId: text(\"document_id\").primaryKey(),\n organizationId: text(\"organization_id\").notNull(),\n documentManifestHash: text(\"document_manifest_hash\").notNull(),\n purgeEventHash: text(\"purge_event_hash\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n);\n\n/**\n * Durable trust-on-first-use pins for remote user identity bundles.\n *\n * The first validated identity observed for a user in a configured API trust\n * domain is inserted once. Later observations must match every suite, public\n * key, and fingerprint exactly; the persistence adapter never updates these\n * rows. `firstSeenAt` records when the local trust decision was made and is\n * likewise immutable.\n *\n * Indexes:\n * - `(identityTrustDomain, userId)` is the primary key and scopes a user pin to\n * the host-configured API authority that supplied it.\n * - `(identityTrustDomain, signingKeyFingerprint)` binds the reverse identity\n * mapping durably, including across session recreation. There is no\n * migration for a table that already violates it. Earlier builds pinned a\n * registration's user id before the server confirmed it, so a device that\n * ran one may hold two users on one key; deployments are greenfield, and\n * such a device clears its local data, which recreates this table empty. A\n * device that used an environment before a reset does the same (see\n * docs/developer/greenfield-reset.md).\n */\nexport const trustedUserIdentityPins = sqliteTable(\n \"trusted_user_identity_pins\",\n {\n identityTrustDomain: text(\"identity_trust_domain\").notNull(),\n userId: text(\"user_id\").notNull(),\n formatVersion: integer(\"format_version\").notNull(),\n signingSuite: text(\"signing_suite\").notNull(),\n signingPublicKey: text(\"signing_public_key\").notNull(),\n signingKeyFingerprint: text(\"signing_key_fingerprint\").notNull(),\n encapsulationSuite: text(\"encapsulation_suite\").notNull(),\n encapsulationPublicKey: text(\"encapsulation_public_key\").notNull(),\n encapsulationKeyFingerprint: text(\n \"encapsulation_key_fingerprint\",\n ).notNull(),\n firstSeenAt: text(\"first_seen_at\").notNull(),\n },\n (table) => [\n primaryKey({\n columns: [table.identityTrustDomain, table.userId],\n }),\n uniqueIndex(\"trusted_user_identity_pins_domain_signing_fingerprint_idx\").on(\n table.identityTrustDomain,\n table.signingKeyFingerprint,\n ),\n ],\n);\n\n/**\n * Local many-to-many projection between documents and containers.\n *\n * The document summary row stores one selected `containerId` for primary list\n * placement, while this table keeps the full set of linked containers returned\n * by container/document sync. Removing a container deletes its links and may\n * repair affected document summary rows to point at another remaining link.\n *\n * Columns:\n * - `documentId`: Server document id whose container links are projected.\n * - `containerId`: Linked container id.\n * - `updatedAt`: Local timestamp for the last replacement of the link set.\n *\n * Indexes:\n * - `(documentId, containerId)` is the primary key and prevents duplicate\n * links for the same document/container pair.\n */\nexport const documentContainerProjection = sqliteTable(\n \"document_container_projection\",\n {\n documentId: text(\"document_id\").notNull(),\n containerId: text(\"container_id\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (table) => [primaryKey({ columns: [table.documentId, table.containerId] })],\n);\n\n/**\n * Queryable document summary and detail projection.\n *\n * The durable Loro state lives in `documents`. This table stores the fields the\n * app needs for document lists, summaries, and fast detail hydration without\n * opening the full Loro snapshot on every read.\n *\n * Columns:\n * - `localId`: Stable local document id. This joins to `documents.localId` for\n * rows where `documents.appKind = documents`.\n * - `documentId`: Server document id when known.\n * - `containerId`: Selected container for primary document placement, or\n * `null` if the document is not currently linked to a visible container.\n * - `organizationId`: Last-known owning organization. Stamped from the\n * container row when the document is detached because its container was\n * removed locally (e.g. access to a shared org was revoked and the container\n * tombstoned), so pending writes keep their org attribution after the\n * `containers` join source disappears. Read as a fallback only — a live\n * container join always wins.\n * - `documentKind`: Stored document kind. Defaults to `note`.\n * - `title`: Plain projected title. Defaults to the note fallback title.\n * - `updatedAt`: Timestamp used for document list ordering.\n *\n * The projected full text lives in `documentProjectionText`, keyed by the same\n * `localId`. Keeping it out of this row keeps list/window scans narrow: the\n * sidebar and summary queries read titles and placement from rows whose size\n * does not grow with document content.\n *\n * Indexes:\n * - `localId` is the primary key for document projection lookups.\n * - `(containerId) where containerId is not null` serves container-scoped\n * window/count scans without walking the whole table.\n * - `(organizationId) where containerId is null` serves the orphan-recovery\n * existence and window scans.\n * - `(documentId) where documentId is not null` serves the linked-placement\n * join from `documentContainerProjection` and server-id lookups.\n */\nexport const documentProjection = sqliteTable(\n \"document_projection\",\n {\n localId: text(\"local_id\"),\n documentId: text(\"document_id\"),\n containerId: text(\"container_id\"),\n organizationId: text(\"organization_id\"),\n documentKind: text(\"document_kind\").notNull().default(\"note\"),\n title: text(\"title\").notNull().default(\"Untitled note\"),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (table) => [\n primaryKey({ columns: [table.localId] }),\n index(\"document_projection_container_idx\")\n .on(table.containerId)\n .where(sql`${table.containerId} IS NOT NULL`),\n index(\"document_projection_orphan_organization_idx\")\n .on(table.organizationId)\n .where(sql`${table.containerId} IS NULL`),\n index(\"document_projection_document_idx\")\n .on(table.documentId)\n .where(sql`${table.documentId} IS NOT NULL`),\n ],\n);\n\n/**\n * Projected document text, split from `documentProjection` so content size\n * never bloats the rows that list/window queries scan. Loaded only by detail\n * reads (`loadDocument`) and the save-timestamp change check.\n *\n * Columns:\n * - `localId`: Stable local document id, matching `documentProjection.localId`.\n * - `text`: Plain projected text used to rebuild summaries/details.\n */\nexport const documentProjectionText = sqliteTable(\n \"document_projection_text\",\n {\n localId: text(\"local_id\"),\n text: text(\"text\").notNull(),\n },\n (table) => [primaryKey({ columns: [table.localId] })],\n);\n\n/**\n * Offline create queue for containers.\n *\n * A user can create a local container before the API has assigned all remote\n * state for the container and its metadata document. This table keeps the sync\n * intent until container-create sync either records the remote ids or stores an\n * error for retry.\n *\n * Columns:\n * - `id`: Client-generated intent id.\n * - `containerId`: Local container id created optimistically.\n * - `parentContainerId`: Parent container id used when the intent is sent.\n * - `intentType`: Intent discriminator, currently `container.create`.\n * - `syncStatus`: Current sync state, currently `pending` or `synced`.\n * - `remoteContainerId`: Remote container id recorded after successful sync.\n * - `remoteMetadataDocumentId`: Remote metadata document id recorded after\n * successful sync.\n * - `remoteMetadataAccessStateHash`: Access state hash for the synced metadata\n * document.\n * - `lastError`: Last sync error message for retry/debug display.\n * - `createdAt`: Intent creation timestamp used for FIFO sync.\n * - `updatedAt`: Local timestamp for the latest status/error change.\n *\n * Indexes:\n * - `id` is the primary key.\n * - `containerId` is unique so each local container has one create intent.\n * - `(syncStatus, createdAt)` supports listing pending intents in creation\n * order.\n */\nexport const containerCreateIntents = sqliteTable(\n \"container_create_intents\",\n {\n id: text(\"id\"),\n containerId: text(\"container_id\").notNull().unique(),\n parentContainerId: text(\"parent_container_id\").notNull(),\n intentType: text(\"intent_type\").notNull(),\n syncStatus: text(\"sync_status\").notNull(),\n remoteContainerId: text(\"remote_container_id\"),\n remoteMetadataDocumentId: text(\"remote_metadata_document_id\"),\n remoteMetadataAccessStateHash: text(\"remote_metadata_access_state_hash\"),\n lastError: text(\"last_error\"),\n lastAttemptedAt: text(\"last_attempted_at\"),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (table) => [\n primaryKey({ columns: [table.id] }),\n index(\"container_create_intents_status_created_idx\").on(\n table.syncStatus,\n table.createdAt,\n ),\n ],\n);\n\n/**\n * Offline move queue for synced containers.\n *\n * A user can move a container whose server identity is already known while the\n * API or writer context is unavailable. This table stores only the desired\n * final parent and replay diagnostics; the signed move request is rebuilt from\n * current writer projections when sync resumes.\n *\n * Columns:\n * - `id`: Client-generated intent id.\n * - `containerId`: Synced container moved optimistically in the local tree.\n * - `parentContainerId`: Desired final parent container id.\n * - `previousParentContainerId`: Parent observed when the move was queued.\n * - `intentType`: Intent discriminator, currently `container.move`.\n * - `syncStatus`: Current sync state, currently `pending` or `blocked`.\n * - `lastError`: Last sync error message for retry/debug display.\n * - `lastAttemptedAt`: Timestamp of the last replay attempt.\n * - `createdAt`: Intent creation timestamp used for FIFO sync.\n * - `updatedAt`: Local timestamp for the latest target/status/error change.\n *\n * Indexes:\n * - `id` is the primary key.\n * - `containerId` is unique so same-container moves coalesce to one intent.\n * - `(syncStatus, createdAt)` supports listing pending intents in queue order.\n */\nexport const containerMoveIntents = sqliteTable(\n \"container_move_intents\",\n {\n id: text(\"id\"),\n containerId: text(\"container_id\").notNull().unique(),\n parentContainerId: text(\"parent_container_id\").notNull(),\n previousParentContainerId: text(\"previous_parent_container_id\"),\n intentType: text(\"intent_type\").notNull(),\n syncStatus: text(\"sync_status\").notNull(),\n lastError: text(\"last_error\"),\n lastAttemptedAt: text(\"last_attempted_at\"),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (table) => [\n primaryKey({ columns: [table.id] }),\n index(\"container_move_intents_status_created_idx\").on(\n table.syncStatus,\n table.createdAt,\n ),\n ],\n);\n\n/**\n * Per-lane sync state for container data: the server cursor and the local\n * freshness marker share one row per lane.\n *\n * Container sync is split into lanes, such as a parent-container child lane or\n * a container-document membership lane. The cursor lets the next request\n * resume without replaying the entire tree. The freshness marker records the\n * last fully drained check independently of the cursor: empty server\n * responses do not always carry a new watermark, but startup still needs to\n * know that it recently checked the lane before polling again.\n *\n * Columns:\n * - `laneKind`: Sync lane category, such as `container_parent` or\n * `container_documents`.\n * - `laneId`: Lane identity. Root parent sync uses `root`, child sync uses a\n * parent-prefixed container id, and document lanes use the container id.\n * - `watermarkUpdatedAt`: Server `updatedAt` value for the stored watermark;\n * null until a watermark is saved.\n * - `watermarkId`: Server id tie-breaker for the stored watermark; null\n * exactly when `watermarkUpdatedAt` is.\n * - `updatedAt`: Local timestamp for when the cursor was saved.\n * - `checkedAt`: Local timestamp for the most recent fully drained lane check;\n * null until one completes.\n *\n * Indexes:\n * - `(laneKind, laneId)` is the primary key and stores one row per lane.\n */\nexport const containerSyncWatermarks = sqliteTable(\n \"container_sync_watermarks\",\n {\n laneKind: text(\"lane_kind\").notNull(),\n laneId: text(\"lane_id\").notNull(),\n watermarkUpdatedAt: text(\"watermark_updated_at\"),\n watermarkId: text(\"watermark_id\"),\n updatedAt: text(\"updated_at\"),\n checkedAt: text(\"checked_at\"),\n },\n (table) => [primaryKey({ columns: [table.laneKind, table.laneId] })],\n);\n\nexport const documentTables: ReadonlyArray<SqlTableSchema> = [\n {\n ...defineSqlTableSchema(documents),\n requiredColumns: [\n \"pull_continuation\",\n \"recovery_generation\",\n \"recovery_document_id\",\n ],\n },\n defineSqlTableSchema(documentSyncFailures),\n defineSqlTableSchema(documentHistoryCheckpoints),\n {\n ...defineSqlTableSchema(documentHistoryUpdates),\n requiredColumns: [\"update_id\"],\n },\n];\n\nexport const principalPolicyTables: ReadonlyArray<SqlTableSchema> = [\n {\n ...defineSqlTableSchema(principalPolicies),\n requiredColumns: [\"current_grants_json\"],\n },\n {\n ...defineSqlTableSchema(principalPolicyBundleHistory),\n requiredColumns: [\"current_grants_json\"],\n },\n defineSqlTableSchema(principalPolicyBundleReferences),\n defineSqlTableSchema(principalPolicyOrganizations),\n ...principalHistoryStageTables,\n ...principalHistoryEvidenceTables,\n];\n\nexport const keyingCheckpointTables: ReadonlyArray<SqlTableSchema> = [\n defineSqlTableSchema(organizationFounders),\n defineSqlTableSchema(accessManifestCheckpoints),\n defineSqlTableSchema(principalGrantRetirements),\n defineSqlTableSchema(documentPurgeCheckpoints),\n defineSqlTableSchema(principalPolicyCheckpoints),\n];\n\nexport const trustedUserIdentityPinTables: ReadonlyArray<SqlTableSchema> = [\n defineSqlTableSchema(trustedUserIdentityPins),\n];\n\nconst securityIncidentTables: ReadonlyArray<SqlTableSchema> = [\n securityIncidentTable,\n];\n\nexport const containerTables = containerTableSchemas;\n\nexport const documentContainerProjectionTables: ReadonlyArray<SqlTableSchema> =\n [\n defineSqlTableSchema(documentContainerProjection),\n {\n ...defineSqlTableSchema(containerDocumentTombstoneHolds),\n requiredColumns: [\"hidden\"],\n },\n defineSqlTableSchema(pendingDocumentDiscoveries),\n {\n ...defineSqlTableSchema(documentDiscoveryHeads),\n requiredColumns: [\"organization_id\"],\n },\n defineSqlTableSchema(documentDiscoverySequence),\n ];\n\nexport const documentMoveIntentTables: ReadonlyArray<SqlTableSchema> = [\n defineSqlTableSchema(documentMoveIntents),\n defineSqlTableSchema(documentIntentLinkTargets),\n];\n\nexport const documentProjectionTables: ReadonlyArray<SqlTableSchema> = [\n defineSqlTableSchema(documentProjection),\n defineSqlTableSchema(documentProjectionText),\n {\n ...defineSqlTableSchema(documentPendingAttachments),\n requiredColumns: [\"content_sha256\"],\n },\n {\n ...defineSqlTableSchema(documentAttachmentBlobProjection),\n requiredColumns: [\"content_sha256\"],\n },\n documentOrphanBlobReclaimTable,\n];\n\nexport const containerCreateIntentTables: ReadonlyArray<SqlTableSchema> = [\n defineSqlTableSchema(containerCreateIntents),\n];\n\nexport const containerMoveIntentTables: ReadonlyArray<SqlTableSchema> = [\n defineSqlTableSchema(containerMoveIntents),\n];\n\nexport const containerSyncWatermarkTables: ReadonlyArray<SqlTableSchema> = [\n {\n ...defineSqlTableSchema(containerSyncWatermarks),\n requiredColumns: [\"checked_at\"],\n },\n];\n\nexport const clientSqlTables: ReadonlyArray<SqlTableSchema> = [\n ...principalMutationJournalTables,\n ...documentTables,\n ...principalPolicyTables,\n ...keyingCheckpointTables,\n ...verifiedManifestBundleTables,\n ...trustedUserIdentityPinTables,\n ...securityIncidentTables,\n ...containerTables,\n ...documentContainerProjectionTables,\n ...documentMoveIntentTables,\n ...documentProjectionTables,\n ...containerCreateIntentTables,\n ...containerMoveIntentTables,\n ...containerSyncWatermarkTables,\n ...organizationReadModelTables,\n ...organizationDataUsage.organizationDataUsageTables,\n ...provisioningAttempt.organizationProvisioningAttemptTables,\n];\n\nexport const clientSQLiteSchema = {\n principalHistoryNodeReferences,\n principalHistoryRootOwners,\n principalHistoryStageScopes,\n principalKeyEnvelopeArchive,\n principalMutationJournal,\n principalHistoryEntries,\n principalHistoryNodes,\n principalHistoryPrefixes,\n principalHistoryStages,\n organizationFounders,\n principalGrantRetirements,\n documents,\n documentSyncFailures,\n principalPolicies,\n principalPolicyBundleHistory,\n principalPolicyBundleReferences,\n principalPolicyOrganizations,\n accessManifestCheckpoints,\n documentPurgeCheckpoints,\n principalPolicyCheckpoints,\n verifiedAccessManifestBundles,\n trustedUserIdentityPins,\n securityIncidents,\n ...containerSQLiteSchema,\n documentContainerProjection,\n documentMoveIntents,\n documentIntentLinkTargets,\n documentProjection,\n documentPendingAttachments,\n documentAttachmentBlobProjection,\n documentOrphanBlobReclaims: documentOrphanBlobReclaims,\n containerCreateIntents,\n containerMoveIntents,\n containerSyncWatermarks,\n ...organizationReadModelSQLiteSchema,\n ...organizationDataUsage.organizationDataUsageSQLiteSchema,\n ...provisioningAttempt.organizationProvisioningAttemptSQLiteSchema,\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { NativeSubscriptionStore } from "../validators/billing.js";
2
2
  import { type RootIdentitiesQuery, type RootOrganizationPageQuery, type RootOrganizationsQuery } from "../validators/operation/index.js";
3
- import type { BlobAttachmentBindRequest, BlobAttachmentDetachRequest, CommitOrganizationGroupPolicyRequest, CompleteMultipartBlobStageRequest, ContainerCreateWithMetadataDocumentRequest, ContainerMutationRequest, ContainerReciteRequest, ContainerRotationRequest, CreateOrganizationRequest, DocumentCreateRequest, DocumentLinkSetMutationRequest, DocumentPurgeRequest, DocumentSyncRequest, InitiateMultipartBlobStageRequest, ListContainerParentLanesRequest, RegistrationRequest, UpdateOrganizationProfileRequest, UpdateOrganizationRosterEntryRequest } from "../validators/request/index.js";
4
- import type { CommitOrganizationGroupPolicyResponse, ContainerCreateWithMetadataDocumentResponse, ContainerDeleteResponse, ContainerMutationResponse, ContainerRotationResponse, ContainerWriterProjectionResponse, DocumentCreateResponse, DocumentSyncResponse, DocumentWriterProjectionResponse, ListContainerDocumentsResponse, OrganizationDataUsageResponse, OrganizationPolicyHistoryResponse, OrganizationReadModelResponse, RootDataUsageReportResponse, RootIdentitiesResponse, RootIdentityDetailResponse, RootIdentityOrganizationsResponse, RootOrganizationDetailResponse, RootOrganizationIdentitiesResponse, RootOrganizationsResponse } from "../validators/response/index.js";
3
+ import type { BlobAttachmentBindRequest, BlobAttachmentDetachRequest, CommitOrganizationGroupPolicyRequest, ContainerCreateWithMetadataDocumentRequest, ContainerMutationRequest, ContainerReciteRequest, ContainerRotationRequest, CreateOrganizationRequest, DocumentCreateRequest, DocumentLinkSetMutationRequest, DocumentPurgeRequest, DocumentSyncRequest, InitiateMultipartBlobStageRequest, ListContainerDocumentLanesRequest, ListContainerParentLanesRequest, RegistrationRequest, UpdateOrganizationProfileRequest, UpdateOrganizationRosterEntryRequest } from "../validators/request/index.js";
4
+ import type { CommitOrganizationGroupPolicyResponse, ContainerCreateWithMetadataDocumentResponse, ContainerDeleteResponse, ContainerMutationResponse, ContainerRotationResponse, ContainerWriterProjectionResponse, DocumentCreateResponse, DocumentSyncResponse, DocumentWriterProjectionResponse, ListContainerDocumentLanesResponse, OrganizationDataUsageResponse, OrganizationPolicyHistoryResponse, OrganizationReadModelResponse, RootDataUsageReportResponse, RootIdentitiesResponse, RootIdentityDetailResponse, RootIdentityOrganizationsResponse, RootOrganizationDetailResponse, RootOrganizationIdentitiesResponse, RootOrganizationsResponse } from "../validators/response/index.js";
5
5
  import type { ApiRequestInstrumentation } from "./apiRequestMetrics.js";
6
6
  import { getOrganizationPolicyHistoryResult as organizationHistory } from "./organizationPolicyHistory.js";
7
7
  import type { PrincipalPolicyPageReadOptions } from "./principalPolicyPages.js";
@@ -9,14 +9,14 @@ import { PrincipalPolicyRequests } from "./principalPolicyRequests.js";
9
9
  import { type UploadMultipartBlobPartBytesRequest } from "./routes/blobs/get.js";
10
10
  import { type ContainerKekLogOptions } from "./routes/containers/reads.js";
11
11
  import { type DocumentPurgeProofOptions } from "./routes/documents/mutations.js";
12
- import type { HttpMethod, ListContainerDocumentsOptions, ListDocumentEditAttributionRangesOptions, RequestResult, RequestResultOptions } from "./types.js";
12
+ import type { HttpMethod, ListDocumentEditAttributionRangesOptions, RequestResult, RequestResultOptions } from "./types.js";
13
13
  import type { VerifiedManifestCitations } from "./verifiedManifestCitations.js";
14
14
  type ExpiredHandler = () => boolean | Promise<boolean>;
15
15
  type PaymentRequiredHandler = (organizationId: string | null) => void;
16
16
  export declare class ApiClient {
17
17
  private readonly requestRuntime;
18
18
  private verifiedManifestCitations;
19
- private readonly containerDocumentListRequestsByKey;
19
+ private readonly containerDocumentLaneRequestsByKey;
20
20
  private readonly containerParentLaneRequestsByKey;
21
21
  private readonly containerWriterProjectionRequestsByContainerId;
22
22
  private readonly documentWriterProjectionRequestsByDocumentId;
@@ -3571,36 +3571,8 @@ export declare class ApiClient {
3571
3571
  };
3572
3572
  }[];
3573
3573
  } | null>;
3574
- listContainerDocuments(containerId: string, options?: ListContainerDocumentsOptions): Promise<{
3575
- hasMore: boolean;
3576
- items: {
3577
- createdAt: string;
3578
- currentAccessEpoch: number;
3579
- currentAccessStateHash: string;
3580
- effectiveAccessLevel: "admin" | "read" | "write";
3581
- id: string;
3582
- linkedContainerIds: string[];
3583
- referencedPrincipals: {
3584
- keyEpoch: number;
3585
- keyFingerprint: string;
3586
- principalId: string;
3587
- principalType: "group" | "organization";
3588
- stateHash: string;
3589
- version: number;
3590
- }[];
3591
- updatedAt: string;
3592
- }[];
3593
- nextWatermark: {
3594
- id: string;
3595
- updatedAt: string;
3596
- } | null;
3597
- tombstones: {
3598
- containerId: string;
3599
- documentId: string;
3600
- updatedAt: string;
3601
- }[];
3602
- } | null>;
3603
- listContainerDocumentsResult(containerId: string, options?: ListContainerDocumentsOptions, requestOptions?: RequestResultOptions): Promise<RequestResult<ListContainerDocumentsResponse>>;
3574
+ /** Batched document listing; see `containerDocumentLanes.settle`. */
3575
+ listContainerDocumentLanes(input: ListContainerDocumentLanesRequest, options?: Pick<RequestResultOptions, "reportErrors">): Promise<ListContainerDocumentLanesResponse | null>;
3604
3576
  unlinkDocument(documentId: string, input: DocumentLinkSetMutationRequest, options?: RequestResultOptions): Promise<{
3605
3577
  accessManifest: {
3606
3578
  event: {
@@ -3948,6 +3920,18 @@ export declare class ApiClient {
3948
3920
  organizationId: string;
3949
3921
  byteLength: number;
3950
3922
  expiresAt: string;
3923
+ partUploads: {
3924
+ byteLength: number;
3925
+ contentMd5: string;
3926
+ partNumber: number;
3927
+ source: {
3928
+ kind: "api";
3929
+ } | {
3930
+ kind: "signed-url";
3931
+ url: string;
3932
+ expiresAt: string;
3933
+ };
3934
+ }[];
3951
3935
  sha256: string;
3952
3936
  stageId: string;
3953
3937
  uploadedParts: {
@@ -3980,13 +3964,6 @@ export declare class ApiClient {
3980
3964
  stageId: string;
3981
3965
  uploadId: string;
3982
3966
  } | null>;
3983
- completeMultipartBlobStage(stageId: string, input: CompleteMultipartBlobStageRequest): Promise<{
3984
- organizationId: string;
3985
- byteLength: number;
3986
- expiresAt: string;
3987
- sha256: string;
3988
- stageId: string;
3989
- } | null>;
3990
3967
  getBlobBytes(blobId: string, options?: RequestResultOptions): Promise<import("./index.js").BlobBytesResponse | null>;
3991
3968
  bindBlobAttachment(blobId: string, input: BlobAttachmentBindRequest, options?: RequestResultOptions): Promise<{
3992
3969
  bindingEvent: {
@@ -1,19 +1,19 @@
1
1
  import { sign } from "../crypto/index.js";
2
- import { bindBlobAttachmentOperation, cancelStripeSubscriptionOperation, challengeOperation, claimNativeOrganizationSubscriptionOperation, completeMultipartBlobStageOperation, createContainerOperation, createContainerWithMetadataDocumentOperation, createDocumentOperation, createOrganizationOperation, createStripeCheckoutOperation, createStripeCheckoutSessionOperation, createStripePortalOperation, deleteContainerOperation, destroySessionOperation, detachBlobAttachmentOperation, documentSyncOperation, getContainerKekLogOperation, getContainerReplacementAuthorizationsOperation, getContainerWriterProjectionOperation, getDocumentWriterProjectionOperation, getHealthOperation, getMultipartBlobStageOperation, getOrganizationBillingHistoryOperation, getOrganizationBillingManagementUrlOperation, getOrganizationBillingOperation, getOrganizationDataUsageOperation, getOrganizationNativePurchaseEligibilityOperation, getOrganizationReadModelOperation, getRootIdentityOperation, getRootOrganizationDataUsageOperation, getRootOrganizationOperation, getStripeCheckoutOptionsOperation, initiateMultipartBlobStageOperation, linkDocumentOperation, listContainerDocumentsOperation, listContainerParentLanesOperation, listDocumentAttachmentsOperation, listOrganizationGroupMembersOperation, listRootDataUsageReportOperation, listRootIdentitiesOperation, listRootIdentityOrganizationsOperation, listRootOrganizationIdentitiesOperation, listRootOrganizationsOperation, listSessionsOperation, logoutOperation, moveContainerOperation, reciteContainerOperation, registerOperation, rekeyContainerOperation, revokeContainerOperation, shareContainerOperation, startOrganizationTrialOperation, unlinkDocumentOperation, updateOrganizationProfileOperation, updateOrganizationRosterEntryOperation, userIdentityOperation, verifyOperation, } from "../validators/operation/index.js";
2
+ import { bindBlobAttachmentOperation, cancelStripeSubscriptionOperation, challengeOperation, claimNativeOrganizationSubscriptionOperation, createContainerOperation, createContainerWithMetadataDocumentOperation, createDocumentOperation, createOrganizationOperation, createStripeCheckoutOperation, createStripeCheckoutSessionOperation, createStripePortalOperation, deleteContainerOperation, destroySessionOperation, detachBlobAttachmentOperation, documentSyncOperation, getContainerKekLogOperation, getContainerReplacementAuthorizationsOperation, getContainerWriterProjectionOperation, getDocumentWriterProjectionOperation, getHealthOperation, getMultipartBlobStageOperation, getOrganizationBillingHistoryOperation, getOrganizationBillingManagementUrlOperation, getOrganizationBillingOperation, getOrganizationDataUsageOperation, getOrganizationNativePurchaseEligibilityOperation, getOrganizationReadModelOperation, getRootIdentityOperation, getRootOrganizationDataUsageOperation, getRootOrganizationOperation, getStripeCheckoutOptionsOperation, initiateMultipartBlobStageOperation, linkDocumentOperation, listContainerDocumentLanesOperation, listContainerParentLanesOperation, listDocumentAttachmentsOperation, listOrganizationGroupMembersOperation, listRootDataUsageReportOperation, listRootIdentitiesOperation, listRootIdentityOrganizationsOperation, listRootOrganizationIdentitiesOperation, listRootOrganizationsOperation, listSessionsOperation, logoutOperation, moveContainerOperation, reciteContainerOperation, registerOperation, rekeyContainerOperation, revokeContainerOperation, shareContainerOperation, startOrganizationTrialOperation, unlinkDocumentOperation, updateOrganizationProfileOperation, updateOrganizationRosterEntryOperation, userIdentityOperation, verifyOperation, } from "../validators/operation/index.js";
3
3
  import { BoundedCache } from "./ApiCache.js";
4
4
  import { ApiRequestRuntime } from "./apiRequestRuntime.js";
5
5
  import { getDocumentPurgeProof as readPurgeProof, purgeDocument as submitDocumentPurge, } from "./documentPurge.js";
6
6
  import { createOperationTransport, } from "./operationTransportFactory.js";
7
7
  import { getOrganizationPolicyHistoryResult as organizationHistory } from "./organizationPolicyHistory.js";
8
8
  import { PrincipalPolicyRequests } from "./principalPolicyRequests.js";
9
- import { bindPrototypeMethods, cachedRequest, dedupedRequest, evictWriterProjectionIfSyncChanged, listContainerDocumentsRequestKey, listContainerParentLanesRequestKey, } from "./requestInternals.js";
9
+ import { bindPrototypeMethods, cachedRequest, dedupedRequest, evictWriterProjectionIfSyncChanged, listContainerDocumentLanesRequestKey, listContainerParentLanesRequestKey, } from "./requestInternals.js";
10
10
  import { destroySession as authDestroySession, listSessions as authListSessions, logout as authLogout, userIdentity as authUserIdentity, } from "./routes/auth/session.js";
11
11
  import { bindBlobAttachment as blobAttachmentBind, detachBlobAttachment as blobAttachmentDetach, } from "./routes/blobs/attachments.js";
12
12
  import { getBlobBytes, } from "./routes/blobs/get.js";
13
- import { completeMultipartBlobStage as multipartComplete, getMultipartBlobStage as multipartGet, initiateMultipartBlobStage as multipartInitiate, } from "./routes/blobs/multipart.js";
13
+ import { getMultipartBlobStage as multipartGet, initiateMultipartBlobStage as multipartInitiate, } from "./routes/blobs/multipart.js";
14
14
  import { uploadMultipartBlobPartBytes } from "./routes/blobs/multipartUpload.js";
15
15
  import { containerCreate, containerCreateWithMetadataDocument, containerDelete, containerMove, containerRecite, containerRekey, containerRevoke, containerShare, } from "./routes/containers/mutations.js";
16
- import { containerDocuments, containerKekLog, containerParentLanes, } from "./routes/containers/reads.js";
16
+ import { containerDocumentLanes, containerKekLog, containerParentLanes, } from "./routes/containers/reads.js";
17
17
  import { listDocumentAttachments as documentAttachmentsList } from "./routes/documents/attachments.js";
18
18
  import { DocumentAttributionRequests } from "./routes/documents/attributionRequests.js";
19
19
  import { documentCreate, documentLink, documentUnlink, } from "./routes/documents/mutations.js";
@@ -37,7 +37,7 @@ const CONTAINER_ROTATIONS = {
37
37
  export class ApiClient {
38
38
  requestRuntime;
39
39
  verifiedManifestCitations = null;
40
- containerDocumentListRequestsByKey = new Map();
40
+ containerDocumentLaneRequestsByKey = new Map();
41
41
  containerParentLaneRequestsByKey = new Map();
42
42
  containerWriterProjectionRequestsByContainerId = new CitingProjectionCache();
43
43
  documentWriterProjectionRequestsByDocumentId = new CitingProjectionCache();
@@ -64,7 +64,7 @@ export class ApiClient {
64
64
  this.webSocketTickets = new WebSocketTickets(this.transport, () => this.getAuthToken());
65
65
  }
66
66
  clearAuthScopedCaches() {
67
- this.containerDocumentListRequestsByKey.clear();
67
+ this.containerDocumentLaneRequestsByKey.clear();
68
68
  this.containerParentLaneRequestsByKey.clear();
69
69
  this.documentAttachmentListRequestsByDocumentId.clear();
70
70
  this.documentAttributionRequests.clear();
@@ -673,11 +673,9 @@ export class ApiClient {
673
673
  listContainerParentLanes(input) {
674
674
  return dedupedRequest(this.containerParentLaneRequestsByKey, listContainerParentLanesRequestKey(input), () => this.request(containerParentLanes.path, (value) => containerParentLanes.isResponseForRequest(input, value), containerParentLanes.method, JSON.stringify(input), undefined, listContainerParentLanesOperation));
675
675
  }
676
- listContainerDocuments(containerId, options) {
677
- return dedupedRequest(this.containerDocumentListRequestsByKey, listContainerDocumentsRequestKey(containerId, options), () => this.request(containerDocuments.path(containerId, options), containerDocuments.isResponse, containerDocuments.method, undefined, undefined, listContainerDocumentsOperation));
678
- }
679
- listContainerDocumentsResult(containerId, options, requestOptions = {}) {
680
- return this.requestResult(containerDocuments.path(containerId, options), containerDocuments.isResponse, containerDocuments.method, undefined, requestOptions, listContainerDocumentsOperation);
676
+ /** Batched document listing; see `containerDocumentLanes.settle`. */
677
+ async listContainerDocumentLanes(input, options = {}) {
678
+ return containerDocumentLanes.settle(await dedupedRequest(this.containerDocumentLaneRequestsByKey, listContainerDocumentLanesRequestKey(input), () => this.requestResult(containerDocumentLanes.path, (value) => containerDocumentLanes.isResponseForRequest(input, value), containerDocumentLanes.method, JSON.stringify(input), { reportErrors: false }, listContainerDocumentLanesOperation)), options.reportErrors ?? true, (message) => this.requestRuntime.reportError(message));
681
679
  }
682
680
  unlinkDocument(documentId, input, options = {}) {
683
681
  this.invalidateDocumentAttribution(documentId);
@@ -769,9 +767,6 @@ export class ApiClient {
769
767
  uploadMultipartBlobPartBytes(stageId, partNumber, input, options = {}) {
770
768
  return uploadMultipartBlobPartBytes(this.transport, stageId, partNumber, input, undefined, options);
771
769
  }
772
- completeMultipartBlobStage(stageId, input) {
773
- return this.request(multipartComplete.path(stageId), multipartComplete.isResponse, multipartComplete.method, JSON.stringify(input), undefined, completeMultipartBlobStageOperation);
774
- }
775
770
  getBlobBytes(blobId, options = {}) {
776
771
  return getBlobBytes(this.transport, blobId, undefined, options);
777
772
  }