@syncular/server 0.58.0 → 0.59.0
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/README.md +31 -22
- package/dist/admin.js +8 -4
- package/dist/blob-handlers.d.ts +25 -31
- package/dist/blob-handlers.js +63 -41
- package/dist/blob-store.d.ts +42 -24
- package/dist/blob-store.js +0 -0
- package/dist/bucket-blob-store.d.ts +12 -8
- package/dist/bucket-blob-store.js +54 -45
- package/dist/bucket-segment-store.js +18 -16
- package/dist/content-encoding.d.ts +5 -2
- package/dist/content-encoding.js +42 -13
- package/dist/context.d.ts +16 -0
- package/dist/context.js +21 -1
- package/dist/d1-storage.d.ts +14 -98
- package/dist/d1-storage.js +223 -1111
- package/dist/errors.js +8 -0
- package/dist/events.d.ts +1 -1
- package/dist/handler.js +135 -103
- package/dist/local-authority.d.ts +2 -0
- package/dist/local-authority.js +17 -3
- package/dist/object-bucket.d.ts +2 -0
- package/dist/operations-realtime.js +69 -50
- package/dist/pg-executor-pglite.d.ts +5 -6
- package/dist/pg-executor-pglite.js +22 -14
- package/dist/pg-executor.d.ts +4 -1
- package/dist/postgres-storage.d.ts +1 -1
- package/dist/postgres-storage.js +182 -105
- package/dist/pull.d.ts +28 -20
- package/dist/pull.js +85 -87
- package/dist/push.js +272 -147
- package/dist/realtime.d.ts +68 -28
- package/dist/realtime.js +297 -136
- package/dist/relational-rows.d.ts +27 -15
- package/dist/relational-rows.js +38 -22
- package/dist/s3-blob-store.d.ts +11 -12
- package/dist/s3-blob-store.js +20 -13
- package/dist/s3-object-bucket.d.ts +8 -1
- package/dist/s3-object-bucket.js +16 -3
- package/dist/schema.d.ts +14 -0
- package/dist/schema.js +23 -0
- package/dist/scopes.d.ts +6 -2
- package/dist/scopes.js +22 -4
- package/dist/seed.js +1 -2
- package/dist/segment-download.js +18 -4
- package/dist/signed-url.d.ts +2 -2
- package/dist/signed-url.js +9 -2
- package/dist/sigv4.d.ts +8 -2
- package/dist/sigv4.js +8 -4
- package/dist/sqlite-blob-store.d.ts +1 -1
- package/dist/sqlite-blob-store.js +23 -22
- package/dist/sqlite-dialect.d.ts +150 -47
- package/dist/sqlite-dialect.js +987 -88
- package/dist/sqlite-lease-store.js +13 -18
- package/dist/sqlite-storage.d.ts +9 -62
- package/dist/sqlite-storage.js +293 -1117
- package/dist/storage.d.ts +32 -12
- package/package.json +2 -2
- package/src/admin.ts +16 -2
- package/src/blob-handlers.ts +91 -72
- package/src/blob-store.ts +0 -0
- package/src/bucket-blob-store.ts +75 -48
- package/src/bucket-segment-store.ts +20 -15
- package/src/content-encoding.ts +48 -16
- package/src/context.ts +32 -1
- package/src/d1-storage.ts +326 -1692
- package/src/errors.ts +8 -0
- package/src/events.ts +1 -1
- package/src/handler.ts +178 -127
- package/src/local-authority.ts +17 -3
- package/src/object-bucket.ts +2 -0
- package/src/operations-realtime.ts +85 -61
- package/src/pg-executor-pglite.ts +27 -23
- package/src/pg-executor.ts +5 -1
- package/src/postgres-storage.ts +231 -138
- package/src/pull.ts +133 -147
- package/src/push.ts +356 -205
- package/src/realtime.ts +380 -179
- package/src/relational-rows.ts +54 -27
- package/src/s3-blob-store.ts +23 -13
- package/src/s3-object-bucket.ts +20 -2
- package/src/schema.ts +31 -0
- package/src/scopes.ts +23 -3
- package/src/seed.ts +1 -2
- package/src/segment-download.ts +25 -4
- package/src/signed-url.ts +10 -4
- package/src/sigv4.ts +17 -4
- package/src/sqlite-blob-store.ts +27 -26
- package/src/sqlite-dialect.ts +1607 -114
- package/src/sqlite-lease-store.ts +12 -23
- package/src/sqlite-storage.ts +360 -1811
- package/src/storage.ts +33 -12
package/src/storage.ts
CHANGED
|
@@ -181,11 +181,27 @@ export interface NewChange {
|
|
|
181
181
|
readonly op: 'upsert' | 'delete';
|
|
182
182
|
/** Present for upsert (§2.2). */
|
|
183
183
|
readonly rowVersion?: number;
|
|
184
|
+
/**
|
|
185
|
+
* Present for delete: the deleted row's last `server_version`, recorded on
|
|
186
|
+
* its tombstone (§2.2). Never reaches the wire.
|
|
187
|
+
*/
|
|
188
|
+
readonly deletedVersion?: number;
|
|
184
189
|
readonly scopes: Record<string, string>;
|
|
185
190
|
/** Present for upsert. */
|
|
186
191
|
readonly payload?: Uint8Array;
|
|
187
192
|
}
|
|
188
193
|
|
|
194
|
+
/** §2.2 delete-precedence tombstone of a row deleted within the horizon. */
|
|
195
|
+
export interface Tombstone {
|
|
196
|
+
readonly commitSeq: number;
|
|
197
|
+
/**
|
|
198
|
+
* The deleted row's last `server_version` and stored scopes. Both are
|
|
199
|
+
* absent on a tombstone written before servers recorded them.
|
|
200
|
+
*/
|
|
201
|
+
readonly serverVersion?: number;
|
|
202
|
+
readonly scopes?: Record<string, string>;
|
|
203
|
+
}
|
|
204
|
+
|
|
189
205
|
export interface NewCommit {
|
|
190
206
|
readonly clientId: string;
|
|
191
207
|
readonly clientCommitId: string;
|
|
@@ -590,17 +606,17 @@ export interface StorageTransaction {
|
|
|
590
606
|
}[],
|
|
591
607
|
): Promise<void>;
|
|
592
608
|
/**
|
|
593
|
-
* §5 delete-precedence tombstone read: the
|
|
594
|
-
*
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
*
|
|
609
|
+
* §5 delete-precedence tombstone read: the newest applied delete of this
|
|
610
|
+
* row still within the pruning horizon, or `undefined` when no tombstone
|
|
611
|
+
* exists. Consulted only when an upsert's stored row is absent. Required:
|
|
612
|
+
* in-tree adapters implement it on the transaction's own connection with
|
|
613
|
+
* read-your-own-writes semantics.
|
|
598
614
|
*/
|
|
599
|
-
|
|
615
|
+
getTombstone(table: string, rowId: string): Promise<Tombstone | undefined>;
|
|
600
616
|
/**
|
|
601
|
-
* Remove the row's tombstone because the row
|
|
602
|
-
* transaction
|
|
603
|
-
*
|
|
617
|
+
* Remove the row's tombstone because the row is live again in this
|
|
618
|
+
* transaction: an insert over its tombstone (§6.2) or a §2.2 scope move.
|
|
619
|
+
* A no-op when no tombstone exists.
|
|
604
620
|
*/
|
|
605
621
|
clearTombstone(table: string, rowId: string): Promise<void>;
|
|
606
622
|
/**
|
|
@@ -1080,7 +1096,10 @@ export interface ServerStorage {
|
|
|
1080
1096
|
cursor: number,
|
|
1081
1097
|
updatedAtMs: number,
|
|
1082
1098
|
): Promise<void>;
|
|
1083
|
-
/**
|
|
1099
|
+
/**
|
|
1100
|
+
* Minimum non-negative cursor with updatedAtMs >= cutoff (§4.6); null when
|
|
1101
|
+
* none are active. A bootstrapping client (cursor < 0) holds no cursor.
|
|
1102
|
+
*/
|
|
1084
1103
|
getActiveClientCursorFloor(
|
|
1085
1104
|
partition: string,
|
|
1086
1105
|
cutoffMs: number,
|
|
@@ -1116,9 +1135,11 @@ export interface ServerStorage {
|
|
|
1116
1135
|
* `eraseScopeValueHistory`: under the partition write lock, removes up to
|
|
1117
1136
|
* `limit` upsert change records of `table` at or below `throughSeq` whose
|
|
1118
1137
|
* scopes bind `variable` to `value`, then up to `limit` change scope index
|
|
1119
|
-
* entries of that binding whose commit holds no such change any more
|
|
1138
|
+
* entries of that binding whose commit holds no such change any more,
|
|
1139
|
+
* then strips `serverRow` from up to `limit` stored conflict results of
|
|
1140
|
+
* `table` whose conflict authorization scopes bind `variable` to `value`.
|
|
1120
1141
|
* Delete change records stay: clients behind the erasure still need them.
|
|
1121
|
-
* Returns the number of records removed.
|
|
1142
|
+
* Returns the number of records removed or stripped.
|
|
1122
1143
|
*/
|
|
1123
1144
|
listScopeValueRows?(
|
|
1124
1145
|
partition: string,
|