@tearleads/client-sdk 0.1.42 → 0.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/blobs/transferPool.js +35 -8
- package/data/blobs/transferPool.js.map +1 -1
- package/data/containers/shared/projection.js +12 -0
- package/data/containers/shared/projection.js.map +1 -1
- package/data/documents/blob/shared/types.d.ts +2 -3
- package/data/documents/blob/shared/types.js.map +1 -1
- package/data/documents/shared/events.js +0 -1
- package/data/documents/shared/events.js.map +1 -1
- package/data/persistence/container-contents/containerContentsPersistence.js +6 -22
- package/data/persistence/container-contents/containerContentsPersistence.js.map +1 -1
- package/data/persistence/container-contents/containerMetadataMutationPersistence.js +5 -15
- package/data/persistence/container-contents/containerMetadataMutationPersistence.js.map +1 -1
- package/data/persistence/container-contents/containerPendingUpdatePersistence.js +6 -15
- package/data/persistence/container-contents/containerPendingUpdatePersistence.js.map +1 -1
- package/data/persistence/container-contents/containerRecoveryPersistence.js +3 -4
- package/data/persistence/container-contents/containerRecoveryPersistence.js.map +1 -1
- package/data/persistence/container-contents/containerRemovalWork.js +3 -5
- package/data/persistence/container-contents/containerRemovalWork.js.map +1 -1
- package/data/persistence/container-contents/dormantContainerMetadata.js +1 -5
- package/data/persistence/container-contents/dormantContainerMetadata.js.map +1 -1
- package/data/persistence/documents/documentsPersistence.js +4 -9
- package/data/persistence/documents/documentsPersistence.js.map +1 -1
- package/data/persistence/documents/internal/discardDocument.js +1 -2
- package/data/persistence/documents/internal/discardDocument.js.map +1 -1
- package/data/persistence/documents/internal/documentDeletionPersistence.js +1 -2
- package/data/persistence/documents/internal/documentDeletionPersistence.js.map +1 -1
- package/data/persistence/documents/internal/documentMutationPersistence.js +17 -25
- package/data/persistence/documents/internal/documentMutationPersistence.js.map +1 -1
- package/data/persistence/documents/internal/orphanSideRows.js +2 -14
- package/data/persistence/documents/internal/orphanSideRows.js.map +1 -1
- package/data/persistence/documents/internal/syncQueuePersistence.js +3 -3
- package/data/persistence/documents/internal/syncQueuePersistence.js.map +1 -1
- package/data/sqlite/documentHistoryPersistence.d.ts +9 -3
- package/data/sqlite/documentHistoryPersistence.js +31 -8
- package/data/sqlite/documentHistoryPersistence.js.map +1 -1
- package/data/sqlite/documentPendingUpdatePersistence.d.ts +58 -11
- package/data/sqlite/documentPendingUpdatePersistence.js +137 -63
- package/data/sqlite/documentPendingUpdatePersistence.js.map +1 -1
- package/data/sqlite/documentPersistence.d.ts +1 -1
- package/data/sqlite/documentPersistence.js +1 -1
- package/data/sqlite/documentPersistence.js.map +1 -1
- package/data/sqlite/documentPersistenceTypes.d.ts +2 -2
- package/data/sqlite/documentPersistenceTypes.js.map +1 -1
- package/data/sqlite/documentRecordPersistence.js +5 -4
- package/data/sqlite/documentRecordPersistence.js.map +1 -1
- package/data/sqlite/schema.d.ts +127 -377
- package/data/sqlite/schema.js +46 -47
- package/data/sqlite/schema.js.map +1 -1
- package/internal/api-client/ApiClient.d.ts +13 -8
- package/internal/api-client/ApiClient.js +2 -5
- package/internal/api-client/ApiClient.js.map +1 -1
- package/internal/api-client/binaryRequestOperationTransport.d.ts +18 -0
- package/internal/api-client/index.d.ts +1 -0
- package/internal/api-client/index.js +1 -0
- package/internal/api-client/index.js.map +1 -1
- package/internal/api-client/operationTransportFactory.d.ts +6 -0
- package/internal/api-client/routes/blobs/get.d.ts +7 -0
- package/internal/api-client/routes/blobs/get.js.map +1 -1
- package/internal/api-client/routes/blobs/multipart.js +1 -11
- package/internal/api-client/routes/blobs/multipart.js.map +1 -1
- package/internal/api-client/routes/blobs/multipartUpload.d.ts +14 -0
- package/internal/api-client/routes/blobs/multipartUpload.js +94 -43
- package/internal/api-client/routes/blobs/multipartUpload.js.map +1 -1
- package/internal/validators/operation/attachments.d.ts +80 -160
- package/internal/validators/operation/auth.d.ts +760 -1664
- package/internal/validators/operation/blobDownloads.js +1 -1
- package/internal/validators/operation/blobDownloads.js.map +1 -1
- package/internal/validators/operation/containerMutations.d.ts +416 -856
- package/internal/validators/operation/documentMutations.d.ts +120 -264
- package/internal/validators/operation/documentSync.d.ts +40 -80
- package/internal/validators/operation/index.d.ts +1 -1
- package/internal/validators/operation/index.js +1 -1
- package/internal/validators/operation/index.js.map +1 -1
- package/internal/validators/operation/multipartBlobs.d.ts +70 -190
- package/internal/validators/operation/multipartBlobs.js +2 -24
- package/internal/validators/operation/multipartBlobs.js.map +1 -1
- package/internal/validators/operation/multipartPartUploads.d.ts +5 -5
- package/internal/validators/operation/multipartPartUploads.js +6 -20
- package/internal/validators/operation/multipartPartUploads.js.map +1 -1
- package/internal/validators/operation/organizations.d.ts +882 -1906
- package/internal/validators/operation/principals.d.ts +120 -240
- package/internal/validators/operation/registry.d.ts +1 -2
- package/internal/validators/operation/registry.js +1 -2
- package/internal/validators/operation/registry.js.map +1 -1
- package/internal/validators/request/blob.d.ts +100 -201
- package/internal/validators/request/blob.js +6 -13
- package/internal/validators/request/blob.js.map +1 -1
- package/internal/validators/request/container.d.ts +136 -272
- package/internal/validators/request/container.js +16 -10
- package/internal/validators/request/container.js.map +1 -1
- package/internal/validators/request/containerManifestRef.d.ts +54 -0
- package/internal/validators/request/containerManifestRef.js +28 -0
- package/internal/validators/request/containerManifestRef.js.map +1 -0
- package/internal/validators/request/containerMetadata.d.ts +160 -368
- package/internal/validators/request/document.d.ts +100 -245
- package/internal/validators/request/document.js +1 -2
- package/internal/validators/request/document.js.map +1 -1
- package/internal/validators/request/documentSyncSchema.d.ts +42 -109
- package/internal/validators/request/documentSyncSchema.js +8 -25
- package/internal/validators/request/documentSyncSchema.js.map +1 -1
- package/internal/validators/request/index.d.ts +1 -1
- package/internal/validators/request/index.js +1 -1
- package/internal/validators/request/index.js.map +1 -1
- package/internal/validators/request/organization.d.ts +160 -320
- package/internal/validators/request/organizationProvisioning.d.ts +2424 -5312
- package/internal/validators/request/principal.d.ts +160 -320
- package/internal/validators/request/registration.d.ts +760 -1664
- package/internal/validators/response/blob.d.ts +48 -27
- package/internal/validators/response/blob.js +3 -10
- package/internal/validators/response/blob.js.map +1 -1
- package/internal/validators/response/index.d.ts +1 -1
- package/internal/validators/response/index.js +1 -1
- package/internal/validators/response/index.js.map +1 -1
- package/internal/validators/util/blob.d.ts +7 -0
- package/internal/validators/util/blob.js +7 -0
- package/internal/validators/util/blob.js.map +1 -1
- package/internal/validators/util/blobTransferSchemas.d.ts +41 -0
- package/internal/validators/util/blobTransferSchemas.js +39 -0
- package/internal/validators/util/blobTransferSchemas.js.map +1 -0
- package/internal/validators/util/containerLimits.d.ts +7 -0
- package/internal/validators/util/containerLimits.js +7 -0
- package/internal/validators/util/containerLimits.js.map +1 -1
- package/internal/validators/util/index.d.ts +2 -1
- package/internal/validators/util/index.js +2 -1
- package/internal/validators/util/index.js.map +1 -1
- package/package.json +1 -1
- package/workflows/blobs/multipartFirstParts.js +82 -0
- package/workflows/blobs/multipartFirstParts.js.map +1 -0
- package/workflows/blobs/multipartStageResolution.js +83 -0
- package/workflows/blobs/multipartStageResolution.js.map +1 -0
- package/workflows/blobs/multipartUpload.js +45 -89
- package/workflows/blobs/multipartUpload.js.map +1 -1
- package/workflows/container-contents/documentPriming.js +2 -1
- package/workflows/container-contents/documentPriming.js.map +1 -1
- package/workflows/container-contents/documentQueries/sql.js +4 -4
- package/workflows/container-contents/documentQueries/sql.js.map +1 -1
- package/workflows/container-contents/pendingWrites/deferredTails.js +6 -3
- package/workflows/container-contents/pendingWrites/deferredTails.js.map +1 -1
- package/workflows/container-contents/pendingWrites/sources.js +2 -1
- package/workflows/container-contents/pendingWrites/sources.js.map +1 -1
- package/workflows/container-contents/pendingWrites.js +2 -1
- package/workflows/container-contents/pendingWrites.js.map +1 -1
- package/workflows/containers/child/create.js +3 -3
- package/workflows/containers/child/create.js.map +1 -1
- package/workflows/containers/child/move.js +2 -2
- package/workflows/containers/child/move.js.map +1 -1
- package/workflows/containers/child/mutationRequestCore.js +5 -4
- package/workflows/containers/child/mutationRequestCore.js.map +1 -1
- package/workflows/containers/child/recitePlan.js +3 -2
- package/workflows/containers/child/recitePlan.js.map +1 -1
- package/workflows/containers/child/sharePlanCore.js +2 -2
- package/workflows/containers/child/sharePlanCore.js.map +1 -1
- package/workflows/containers/root/create.js +2 -2
- package/workflows/containers/root/create.js.map +1 -1
- package/workflows/registration/provisioningBootstrapBuilders.d.ts +20 -46
- package/workflows/sync/remoteReset.js +9 -9
- package/workflows/sync/remoteReset.js.map +1 -1
- package/workflows/sync/remoteResetPlans.js +6 -3
- package/workflows/sync/remoteResetPlans.js.map +1 -1
- package/internal/validators/operation/blobTransferSchemas.js +0 -11
- package/internal/validators/operation/blobTransferSchemas.js.map +0 -1
package/data/sqlite/schema.d.ts
CHANGED
|
@@ -358,210 +358,11 @@ export declare const documents: import("drizzle-orm/sqlite-core").SQLiteTableWit
|
|
|
358
358
|
};
|
|
359
359
|
dialect: "sqlite";
|
|
360
360
|
}>;
|
|
361
|
-
/**
|
|
362
|
-
* Outbound Loro updates waiting to be accepted by sync.
|
|
363
|
-
*
|
|
364
|
-
* Each row stores one locally produced update for a document scope. The queue is
|
|
365
|
-
* replayed in creation order and acknowledged rows are deleted after sync
|
|
366
|
-
* writes the corresponding server commit or persisted document state.
|
|
367
|
-
*
|
|
368
|
-
* Columns:
|
|
369
|
-
* - `id`: Client-generated queue id used for acknowledgement deletes.
|
|
370
|
-
* - `appKind`: Local document namespace matching `documents.appKind`.
|
|
371
|
-
* - `localId`: Local document id matching `documents.localId`.
|
|
372
|
-
* - `updateData`: Serialized Loro update payload.
|
|
373
|
-
* - `partialStartVersionVector`: Version vector before this partial update.
|
|
374
|
-
* - `partialEndVersionVector`: Version vector after this partial update.
|
|
375
|
-
* - `sourceVersionVector`: Optional source vector used to avoid re-enqueuing
|
|
376
|
-
* updates that came from sync.
|
|
377
|
-
* - `createdAt`: Queue insertion timestamp used for deterministic replay.
|
|
378
|
-
*
|
|
379
|
-
* Indexes:
|
|
380
|
-
* - `id` is the primary key for targeted deletes.
|
|
381
|
-
* - `(appKind, localId, createdAt)` supports ordered pending-update scans for a
|
|
382
|
-
* document scope.
|
|
383
|
-
*/
|
|
384
|
-
export declare const documentPendingUpdates: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
385
|
-
name: "document_pending_updates";
|
|
386
|
-
schema: undefined;
|
|
387
|
-
columns: {
|
|
388
|
-
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
389
|
-
name: "id";
|
|
390
|
-
tableName: "document_pending_updates";
|
|
391
|
-
dataType: "string";
|
|
392
|
-
columnType: "SQLiteText";
|
|
393
|
-
data: string;
|
|
394
|
-
driverParam: string;
|
|
395
|
-
notNull: false;
|
|
396
|
-
hasDefault: false;
|
|
397
|
-
isPrimaryKey: false;
|
|
398
|
-
isAutoincrement: false;
|
|
399
|
-
hasRuntimeDefault: false;
|
|
400
|
-
enumValues: [string, ...string[]];
|
|
401
|
-
baseColumn: never;
|
|
402
|
-
identity: undefined;
|
|
403
|
-
generated: undefined;
|
|
404
|
-
}, {}, {
|
|
405
|
-
length: number | undefined;
|
|
406
|
-
}>;
|
|
407
|
-
appKind: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
408
|
-
name: "app_kind";
|
|
409
|
-
tableName: "document_pending_updates";
|
|
410
|
-
dataType: "string";
|
|
411
|
-
columnType: "SQLiteText";
|
|
412
|
-
data: string;
|
|
413
|
-
driverParam: string;
|
|
414
|
-
notNull: true;
|
|
415
|
-
hasDefault: false;
|
|
416
|
-
isPrimaryKey: false;
|
|
417
|
-
isAutoincrement: false;
|
|
418
|
-
hasRuntimeDefault: false;
|
|
419
|
-
enumValues: [string, ...string[]];
|
|
420
|
-
baseColumn: never;
|
|
421
|
-
identity: undefined;
|
|
422
|
-
generated: undefined;
|
|
423
|
-
}, {}, {
|
|
424
|
-
length: number | undefined;
|
|
425
|
-
}>;
|
|
426
|
-
localId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
427
|
-
name: "local_id";
|
|
428
|
-
tableName: "document_pending_updates";
|
|
429
|
-
dataType: "string";
|
|
430
|
-
columnType: "SQLiteText";
|
|
431
|
-
data: string;
|
|
432
|
-
driverParam: string;
|
|
433
|
-
notNull: true;
|
|
434
|
-
hasDefault: false;
|
|
435
|
-
isPrimaryKey: false;
|
|
436
|
-
isAutoincrement: false;
|
|
437
|
-
hasRuntimeDefault: false;
|
|
438
|
-
enumValues: [string, ...string[]];
|
|
439
|
-
baseColumn: never;
|
|
440
|
-
identity: undefined;
|
|
441
|
-
generated: undefined;
|
|
442
|
-
}, {}, {
|
|
443
|
-
length: number | undefined;
|
|
444
|
-
}>;
|
|
445
|
-
updateData: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
446
|
-
name: "update_data";
|
|
447
|
-
tableName: "document_pending_updates";
|
|
448
|
-
dataType: "string";
|
|
449
|
-
columnType: "SQLiteText";
|
|
450
|
-
data: string;
|
|
451
|
-
driverParam: string;
|
|
452
|
-
notNull: true;
|
|
453
|
-
hasDefault: false;
|
|
454
|
-
isPrimaryKey: false;
|
|
455
|
-
isAutoincrement: false;
|
|
456
|
-
hasRuntimeDefault: false;
|
|
457
|
-
enumValues: [string, ...string[]];
|
|
458
|
-
baseColumn: never;
|
|
459
|
-
identity: undefined;
|
|
460
|
-
generated: undefined;
|
|
461
|
-
}, {}, {
|
|
462
|
-
length: number | undefined;
|
|
463
|
-
}>;
|
|
464
|
-
partialStartVersionVector: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
465
|
-
name: "partial_start_version_vector";
|
|
466
|
-
tableName: "document_pending_updates";
|
|
467
|
-
dataType: "string";
|
|
468
|
-
columnType: "SQLiteText";
|
|
469
|
-
data: string;
|
|
470
|
-
driverParam: string;
|
|
471
|
-
notNull: true;
|
|
472
|
-
hasDefault: false;
|
|
473
|
-
isPrimaryKey: false;
|
|
474
|
-
isAutoincrement: false;
|
|
475
|
-
hasRuntimeDefault: false;
|
|
476
|
-
enumValues: [string, ...string[]];
|
|
477
|
-
baseColumn: never;
|
|
478
|
-
identity: undefined;
|
|
479
|
-
generated: undefined;
|
|
480
|
-
}, {}, {
|
|
481
|
-
length: number | undefined;
|
|
482
|
-
}>;
|
|
483
|
-
partialEndVersionVector: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
484
|
-
name: "partial_end_version_vector";
|
|
485
|
-
tableName: "document_pending_updates";
|
|
486
|
-
dataType: "string";
|
|
487
|
-
columnType: "SQLiteText";
|
|
488
|
-
data: string;
|
|
489
|
-
driverParam: string;
|
|
490
|
-
notNull: true;
|
|
491
|
-
hasDefault: false;
|
|
492
|
-
isPrimaryKey: false;
|
|
493
|
-
isAutoincrement: false;
|
|
494
|
-
hasRuntimeDefault: false;
|
|
495
|
-
enumValues: [string, ...string[]];
|
|
496
|
-
baseColumn: never;
|
|
497
|
-
identity: undefined;
|
|
498
|
-
generated: undefined;
|
|
499
|
-
}, {}, {
|
|
500
|
-
length: number | undefined;
|
|
501
|
-
}>;
|
|
502
|
-
sourceVersionVector: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
503
|
-
name: "source_version_vector";
|
|
504
|
-
tableName: "document_pending_updates";
|
|
505
|
-
dataType: "string";
|
|
506
|
-
columnType: "SQLiteText";
|
|
507
|
-
data: string;
|
|
508
|
-
driverParam: string;
|
|
509
|
-
notNull: false;
|
|
510
|
-
hasDefault: false;
|
|
511
|
-
isPrimaryKey: false;
|
|
512
|
-
isAutoincrement: false;
|
|
513
|
-
hasRuntimeDefault: false;
|
|
514
|
-
enumValues: [string, ...string[]];
|
|
515
|
-
baseColumn: never;
|
|
516
|
-
identity: undefined;
|
|
517
|
-
generated: undefined;
|
|
518
|
-
}, {}, {
|
|
519
|
-
length: number | undefined;
|
|
520
|
-
}>;
|
|
521
|
-
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
522
|
-
name: "created_at";
|
|
523
|
-
tableName: "document_pending_updates";
|
|
524
|
-
dataType: "string";
|
|
525
|
-
columnType: "SQLiteText";
|
|
526
|
-
data: string;
|
|
527
|
-
driverParam: string;
|
|
528
|
-
notNull: true;
|
|
529
|
-
hasDefault: false;
|
|
530
|
-
isPrimaryKey: false;
|
|
531
|
-
isAutoincrement: false;
|
|
532
|
-
hasRuntimeDefault: false;
|
|
533
|
-
enumValues: [string, ...string[]];
|
|
534
|
-
baseColumn: never;
|
|
535
|
-
identity: undefined;
|
|
536
|
-
generated: undefined;
|
|
537
|
-
}, {}, {
|
|
538
|
-
length: number | undefined;
|
|
539
|
-
}>;
|
|
540
|
-
rekeyCount: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
541
|
-
name: "rekey_count";
|
|
542
|
-
tableName: "document_pending_updates";
|
|
543
|
-
dataType: "number";
|
|
544
|
-
columnType: "SQLiteInteger";
|
|
545
|
-
data: number;
|
|
546
|
-
driverParam: number;
|
|
547
|
-
notNull: true;
|
|
548
|
-
hasDefault: true;
|
|
549
|
-
isPrimaryKey: false;
|
|
550
|
-
isAutoincrement: false;
|
|
551
|
-
hasRuntimeDefault: false;
|
|
552
|
-
enumValues: undefined;
|
|
553
|
-
baseColumn: never;
|
|
554
|
-
identity: undefined;
|
|
555
|
-
generated: undefined;
|
|
556
|
-
}, {}, {}>;
|
|
557
|
-
};
|
|
558
|
-
dialect: "sqlite";
|
|
559
|
-
}>;
|
|
560
361
|
/**
|
|
561
362
|
* Last terminal sync failure or quarantined incoming update per document scope.
|
|
562
363
|
*
|
|
563
|
-
* The durable write queue (`
|
|
564
|
-
* row is either
|
|
364
|
+
* The durable write queue (queued rows of `documentHistoryUpdates`) has no
|
|
365
|
+
* status columns — a row is either queued or settled. Terminal submissions and
|
|
565
366
|
* incoming updates that cannot be decrypted or imported are recorded here so
|
|
566
367
|
* the write-queue view and footer can surface why the document is blocked.
|
|
567
368
|
* Rows are upserted per scope and deleted only after a later fully validated
|
|
@@ -809,6 +610,38 @@ export declare const documentHistoryCheckpoints: import("drizzle-orm/sqlite-core
|
|
|
809
610
|
};
|
|
810
611
|
dialect: "sqlite";
|
|
811
612
|
}>;
|
|
613
|
+
/**
|
|
614
|
+
* The local update log: one row per Loro update, serving as both the history
|
|
615
|
+
* tail (restore = checkpoint + tail) and the outbound write queue.
|
|
616
|
+
*
|
|
617
|
+
* Every locally authored update is stored once. While it waits for sync it
|
|
618
|
+
* carries an `updateId` (the id submitted to the server) and the version-vector
|
|
619
|
+
* metadata the submission needs; settlement clears them, leaving the row as
|
|
620
|
+
* ordinary tail history until compaction folds it into a checkpoint.
|
|
621
|
+
*
|
|
622
|
+
* Columns:
|
|
623
|
+
* - `id`: Row id; tail compaction deletes by it.
|
|
624
|
+
* - `appKind`, `localId`: Document scope matching `documents`.
|
|
625
|
+
* - `updateData`: Serialized Loro update payload.
|
|
626
|
+
* - `origin`: "local" (authored on this device) or "remote" (decrypted
|
|
627
|
+
* pulled update) for tail rows. Restores use it to advance the
|
|
628
|
+
* outgoing-delta marker across remote rows — their ops are already
|
|
629
|
+
* server-side — while a local row left behind by a crash stays below the
|
|
630
|
+
* marker so the next edit re-derives and sends it. "outbox" marks a queued
|
|
631
|
+
* update with no tail role (container metadata, whose content is its
|
|
632
|
+
* checkpoint, and full-state re-uploads after a remote reset); restores and
|
|
633
|
+
* compaction never see it and settlement deletes it.
|
|
634
|
+
* - `createdAt`: Insertion timestamp; with `rowid`, deterministic replay order.
|
|
635
|
+
* - `updateId`: Present exactly while the row is queued for sync; rekeyed
|
|
636
|
+
* after a lost acknowledgement poisons the submitted id.
|
|
637
|
+
* - `partialStartVersionVector` / `partialEndVersionVector`: Version vectors
|
|
638
|
+
* around a queued partial update.
|
|
639
|
+
* - `sourceVersionVector`: Present on a queued rotation baseline checkpoint.
|
|
640
|
+
* - `rekeyCount`: Durable bound on rekeys of a queued row.
|
|
641
|
+
*
|
|
642
|
+
* Invariant: compaction never deletes a queued row, so a checkpoint can cover
|
|
643
|
+
* a queued update's operations without removing it from the queue.
|
|
644
|
+
*/
|
|
812
645
|
export declare const documentHistoryUpdates: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
813
646
|
name: "document_history_updates";
|
|
814
647
|
schema: undefined;
|
|
@@ -927,6 +760,99 @@ export declare const documentHistoryUpdates: import("drizzle-orm/sqlite-core").S
|
|
|
927
760
|
}, {}, {
|
|
928
761
|
length: number | undefined;
|
|
929
762
|
}>;
|
|
763
|
+
updateId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
764
|
+
name: "update_id";
|
|
765
|
+
tableName: "document_history_updates";
|
|
766
|
+
dataType: "string";
|
|
767
|
+
columnType: "SQLiteText";
|
|
768
|
+
data: string;
|
|
769
|
+
driverParam: string;
|
|
770
|
+
notNull: false;
|
|
771
|
+
hasDefault: false;
|
|
772
|
+
isPrimaryKey: false;
|
|
773
|
+
isAutoincrement: false;
|
|
774
|
+
hasRuntimeDefault: false;
|
|
775
|
+
enumValues: [string, ...string[]];
|
|
776
|
+
baseColumn: never;
|
|
777
|
+
identity: undefined;
|
|
778
|
+
generated: undefined;
|
|
779
|
+
}, {}, {
|
|
780
|
+
length: number | undefined;
|
|
781
|
+
}>;
|
|
782
|
+
partialStartVersionVector: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
783
|
+
name: "partial_start_version_vector";
|
|
784
|
+
tableName: "document_history_updates";
|
|
785
|
+
dataType: "string";
|
|
786
|
+
columnType: "SQLiteText";
|
|
787
|
+
data: string;
|
|
788
|
+
driverParam: string;
|
|
789
|
+
notNull: false;
|
|
790
|
+
hasDefault: false;
|
|
791
|
+
isPrimaryKey: false;
|
|
792
|
+
isAutoincrement: false;
|
|
793
|
+
hasRuntimeDefault: false;
|
|
794
|
+
enumValues: [string, ...string[]];
|
|
795
|
+
baseColumn: never;
|
|
796
|
+
identity: undefined;
|
|
797
|
+
generated: undefined;
|
|
798
|
+
}, {}, {
|
|
799
|
+
length: number | undefined;
|
|
800
|
+
}>;
|
|
801
|
+
partialEndVersionVector: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
802
|
+
name: "partial_end_version_vector";
|
|
803
|
+
tableName: "document_history_updates";
|
|
804
|
+
dataType: "string";
|
|
805
|
+
columnType: "SQLiteText";
|
|
806
|
+
data: string;
|
|
807
|
+
driverParam: string;
|
|
808
|
+
notNull: false;
|
|
809
|
+
hasDefault: false;
|
|
810
|
+
isPrimaryKey: false;
|
|
811
|
+
isAutoincrement: false;
|
|
812
|
+
hasRuntimeDefault: false;
|
|
813
|
+
enumValues: [string, ...string[]];
|
|
814
|
+
baseColumn: never;
|
|
815
|
+
identity: undefined;
|
|
816
|
+
generated: undefined;
|
|
817
|
+
}, {}, {
|
|
818
|
+
length: number | undefined;
|
|
819
|
+
}>;
|
|
820
|
+
sourceVersionVector: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
821
|
+
name: "source_version_vector";
|
|
822
|
+
tableName: "document_history_updates";
|
|
823
|
+
dataType: "string";
|
|
824
|
+
columnType: "SQLiteText";
|
|
825
|
+
data: string;
|
|
826
|
+
driverParam: string;
|
|
827
|
+
notNull: false;
|
|
828
|
+
hasDefault: false;
|
|
829
|
+
isPrimaryKey: false;
|
|
830
|
+
isAutoincrement: false;
|
|
831
|
+
hasRuntimeDefault: false;
|
|
832
|
+
enumValues: [string, ...string[]];
|
|
833
|
+
baseColumn: never;
|
|
834
|
+
identity: undefined;
|
|
835
|
+
generated: undefined;
|
|
836
|
+
}, {}, {
|
|
837
|
+
length: number | undefined;
|
|
838
|
+
}>;
|
|
839
|
+
rekeyCount: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
840
|
+
name: "rekey_count";
|
|
841
|
+
tableName: "document_history_updates";
|
|
842
|
+
dataType: "number";
|
|
843
|
+
columnType: "SQLiteInteger";
|
|
844
|
+
data: number;
|
|
845
|
+
driverParam: number;
|
|
846
|
+
notNull: true;
|
|
847
|
+
hasDefault: true;
|
|
848
|
+
isPrimaryKey: false;
|
|
849
|
+
isAutoincrement: false;
|
|
850
|
+
hasRuntimeDefault: false;
|
|
851
|
+
enumValues: undefined;
|
|
852
|
+
baseColumn: never;
|
|
853
|
+
identity: undefined;
|
|
854
|
+
generated: undefined;
|
|
855
|
+
}, {}, {}>;
|
|
930
856
|
};
|
|
931
857
|
dialect: "sqlite";
|
|
932
858
|
}>;
|
|
@@ -7793,182 +7719,6 @@ export declare const clientSQLiteSchema: {
|
|
|
7793
7719
|
};
|
|
7794
7720
|
dialect: "sqlite";
|
|
7795
7721
|
}>;
|
|
7796
|
-
documentPendingUpdates: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
7797
|
-
name: "document_pending_updates";
|
|
7798
|
-
schema: undefined;
|
|
7799
|
-
columns: {
|
|
7800
|
-
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
7801
|
-
name: "id";
|
|
7802
|
-
tableName: "document_pending_updates";
|
|
7803
|
-
dataType: "string";
|
|
7804
|
-
columnType: "SQLiteText";
|
|
7805
|
-
data: string;
|
|
7806
|
-
driverParam: string;
|
|
7807
|
-
notNull: false;
|
|
7808
|
-
hasDefault: false;
|
|
7809
|
-
isPrimaryKey: false;
|
|
7810
|
-
isAutoincrement: false;
|
|
7811
|
-
hasRuntimeDefault: false;
|
|
7812
|
-
enumValues: [string, ...string[]];
|
|
7813
|
-
baseColumn: never;
|
|
7814
|
-
identity: undefined;
|
|
7815
|
-
generated: undefined;
|
|
7816
|
-
}, {}, {
|
|
7817
|
-
length: number | undefined;
|
|
7818
|
-
}>;
|
|
7819
|
-
appKind: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
7820
|
-
name: "app_kind";
|
|
7821
|
-
tableName: "document_pending_updates";
|
|
7822
|
-
dataType: "string";
|
|
7823
|
-
columnType: "SQLiteText";
|
|
7824
|
-
data: string;
|
|
7825
|
-
driverParam: string;
|
|
7826
|
-
notNull: true;
|
|
7827
|
-
hasDefault: false;
|
|
7828
|
-
isPrimaryKey: false;
|
|
7829
|
-
isAutoincrement: false;
|
|
7830
|
-
hasRuntimeDefault: false;
|
|
7831
|
-
enumValues: [string, ...string[]];
|
|
7832
|
-
baseColumn: never;
|
|
7833
|
-
identity: undefined;
|
|
7834
|
-
generated: undefined;
|
|
7835
|
-
}, {}, {
|
|
7836
|
-
length: number | undefined;
|
|
7837
|
-
}>;
|
|
7838
|
-
localId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
7839
|
-
name: "local_id";
|
|
7840
|
-
tableName: "document_pending_updates";
|
|
7841
|
-
dataType: "string";
|
|
7842
|
-
columnType: "SQLiteText";
|
|
7843
|
-
data: string;
|
|
7844
|
-
driverParam: string;
|
|
7845
|
-
notNull: true;
|
|
7846
|
-
hasDefault: false;
|
|
7847
|
-
isPrimaryKey: false;
|
|
7848
|
-
isAutoincrement: false;
|
|
7849
|
-
hasRuntimeDefault: false;
|
|
7850
|
-
enumValues: [string, ...string[]];
|
|
7851
|
-
baseColumn: never;
|
|
7852
|
-
identity: undefined;
|
|
7853
|
-
generated: undefined;
|
|
7854
|
-
}, {}, {
|
|
7855
|
-
length: number | undefined;
|
|
7856
|
-
}>;
|
|
7857
|
-
updateData: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
7858
|
-
name: "update_data";
|
|
7859
|
-
tableName: "document_pending_updates";
|
|
7860
|
-
dataType: "string";
|
|
7861
|
-
columnType: "SQLiteText";
|
|
7862
|
-
data: string;
|
|
7863
|
-
driverParam: string;
|
|
7864
|
-
notNull: true;
|
|
7865
|
-
hasDefault: false;
|
|
7866
|
-
isPrimaryKey: false;
|
|
7867
|
-
isAutoincrement: false;
|
|
7868
|
-
hasRuntimeDefault: false;
|
|
7869
|
-
enumValues: [string, ...string[]];
|
|
7870
|
-
baseColumn: never;
|
|
7871
|
-
identity: undefined;
|
|
7872
|
-
generated: undefined;
|
|
7873
|
-
}, {}, {
|
|
7874
|
-
length: number | undefined;
|
|
7875
|
-
}>;
|
|
7876
|
-
partialStartVersionVector: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
7877
|
-
name: "partial_start_version_vector";
|
|
7878
|
-
tableName: "document_pending_updates";
|
|
7879
|
-
dataType: "string";
|
|
7880
|
-
columnType: "SQLiteText";
|
|
7881
|
-
data: string;
|
|
7882
|
-
driverParam: string;
|
|
7883
|
-
notNull: true;
|
|
7884
|
-
hasDefault: false;
|
|
7885
|
-
isPrimaryKey: false;
|
|
7886
|
-
isAutoincrement: false;
|
|
7887
|
-
hasRuntimeDefault: false;
|
|
7888
|
-
enumValues: [string, ...string[]];
|
|
7889
|
-
baseColumn: never;
|
|
7890
|
-
identity: undefined;
|
|
7891
|
-
generated: undefined;
|
|
7892
|
-
}, {}, {
|
|
7893
|
-
length: number | undefined;
|
|
7894
|
-
}>;
|
|
7895
|
-
partialEndVersionVector: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
7896
|
-
name: "partial_end_version_vector";
|
|
7897
|
-
tableName: "document_pending_updates";
|
|
7898
|
-
dataType: "string";
|
|
7899
|
-
columnType: "SQLiteText";
|
|
7900
|
-
data: string;
|
|
7901
|
-
driverParam: string;
|
|
7902
|
-
notNull: true;
|
|
7903
|
-
hasDefault: false;
|
|
7904
|
-
isPrimaryKey: false;
|
|
7905
|
-
isAutoincrement: false;
|
|
7906
|
-
hasRuntimeDefault: false;
|
|
7907
|
-
enumValues: [string, ...string[]];
|
|
7908
|
-
baseColumn: never;
|
|
7909
|
-
identity: undefined;
|
|
7910
|
-
generated: undefined;
|
|
7911
|
-
}, {}, {
|
|
7912
|
-
length: number | undefined;
|
|
7913
|
-
}>;
|
|
7914
|
-
sourceVersionVector: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
7915
|
-
name: "source_version_vector";
|
|
7916
|
-
tableName: "document_pending_updates";
|
|
7917
|
-
dataType: "string";
|
|
7918
|
-
columnType: "SQLiteText";
|
|
7919
|
-
data: string;
|
|
7920
|
-
driverParam: string;
|
|
7921
|
-
notNull: false;
|
|
7922
|
-
hasDefault: false;
|
|
7923
|
-
isPrimaryKey: false;
|
|
7924
|
-
isAutoincrement: false;
|
|
7925
|
-
hasRuntimeDefault: false;
|
|
7926
|
-
enumValues: [string, ...string[]];
|
|
7927
|
-
baseColumn: never;
|
|
7928
|
-
identity: undefined;
|
|
7929
|
-
generated: undefined;
|
|
7930
|
-
}, {}, {
|
|
7931
|
-
length: number | undefined;
|
|
7932
|
-
}>;
|
|
7933
|
-
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
7934
|
-
name: "created_at";
|
|
7935
|
-
tableName: "document_pending_updates";
|
|
7936
|
-
dataType: "string";
|
|
7937
|
-
columnType: "SQLiteText";
|
|
7938
|
-
data: string;
|
|
7939
|
-
driverParam: string;
|
|
7940
|
-
notNull: true;
|
|
7941
|
-
hasDefault: false;
|
|
7942
|
-
isPrimaryKey: false;
|
|
7943
|
-
isAutoincrement: false;
|
|
7944
|
-
hasRuntimeDefault: false;
|
|
7945
|
-
enumValues: [string, ...string[]];
|
|
7946
|
-
baseColumn: never;
|
|
7947
|
-
identity: undefined;
|
|
7948
|
-
generated: undefined;
|
|
7949
|
-
}, {}, {
|
|
7950
|
-
length: number | undefined;
|
|
7951
|
-
}>;
|
|
7952
|
-
rekeyCount: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
7953
|
-
name: "rekey_count";
|
|
7954
|
-
tableName: "document_pending_updates";
|
|
7955
|
-
dataType: "number";
|
|
7956
|
-
columnType: "SQLiteInteger";
|
|
7957
|
-
data: number;
|
|
7958
|
-
driverParam: number;
|
|
7959
|
-
notNull: true;
|
|
7960
|
-
hasDefault: true;
|
|
7961
|
-
isPrimaryKey: false;
|
|
7962
|
-
isAutoincrement: false;
|
|
7963
|
-
hasRuntimeDefault: false;
|
|
7964
|
-
enumValues: undefined;
|
|
7965
|
-
baseColumn: never;
|
|
7966
|
-
identity: undefined;
|
|
7967
|
-
generated: undefined;
|
|
7968
|
-
}, {}, {}>;
|
|
7969
|
-
};
|
|
7970
|
-
dialect: "sqlite";
|
|
7971
|
-
}>;
|
|
7972
7722
|
documentSyncFailures: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
7973
7723
|
name: "document_sync_failures";
|
|
7974
7724
|
schema: undefined;
|
package/data/sqlite/schema.js
CHANGED
|
@@ -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 (`
|
|
138
|
-
* row is either
|
|
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.
|
|
@@ -511,10 +509,12 @@ export const documentTables = [
|
|
|
511
509
|
"recovery_document_id",
|
|
512
510
|
],
|
|
513
511
|
},
|
|
514
|
-
defineSqlTableSchema(documentPendingUpdates),
|
|
515
512
|
defineSqlTableSchema(documentSyncFailures),
|
|
516
513
|
defineSqlTableSchema(documentHistoryCheckpoints),
|
|
517
|
-
|
|
514
|
+
{
|
|
515
|
+
...defineSqlTableSchema(documentHistoryUpdates),
|
|
516
|
+
requiredColumns: ["update_id"],
|
|
517
|
+
},
|
|
518
518
|
];
|
|
519
519
|
export const principalPolicyTables = [
|
|
520
520
|
{
|
|
@@ -616,7 +616,6 @@ export const clientSQLiteSchema = {
|
|
|
616
616
|
organizationFounders,
|
|
617
617
|
principalGrantRetirements,
|
|
618
618
|
documents,
|
|
619
|
-
documentPendingUpdates,
|
|
620
619
|
documentSyncFailures,
|
|
621
620
|
principalPolicies,
|
|
622
621
|
principalPolicyBundleHistory,
|