@syncular/server 0.34.0 → 0.36.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/dist/blob-handlers.js +10 -3
- package/dist/blob-store.d.ts +9 -1
- package/dist/blob-store.js +0 -0
- package/dist/bucket-blob-store.d.ts +1 -0
- package/dist/bucket-blob-store.js +22 -16
- package/dist/d1-storage.d.ts +3 -1
- package/dist/d1-storage.js +25 -1
- package/dist/erase.d.ts +28 -0
- package/dist/erase.js +122 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/postgres-storage.d.ts +10 -2
- package/dist/postgres-storage.js +153 -67
- package/dist/push.d.ts +8 -2
- package/dist/push.js +1 -1
- package/dist/relational-rows.d.ts +11 -11
- package/dist/relational-rows.js +16 -16
- package/dist/sqlite-blob-store.d.ts +1 -0
- package/dist/sqlite-blob-store.js +14 -2
- package/dist/sqlite-dialect.d.ts +11 -1
- package/dist/sqlite-dialect.js +35 -0
- package/dist/sqlite-storage.d.ts +3 -1
- package/dist/sqlite-storage.js +26 -1
- package/dist/storage-errors.d.ts +1 -1
- package/dist/storage-errors.js +2 -0
- package/dist/storage.d.ts +26 -0
- package/package.json +2 -2
- package/src/blob-handlers.ts +13 -5
- package/src/blob-store.ts +0 -0
- package/src/bucket-blob-store.ts +26 -20
- package/src/d1-storage.ts +45 -0
- package/src/erase.ts +173 -0
- package/src/index.ts +1 -0
- package/src/postgres-storage.ts +203 -96
- package/src/push.ts +1 -1
- package/src/relational-rows.ts +16 -16
- package/src/sqlite-blob-store.ts +17 -1
- package/src/sqlite-dialect.ts +43 -0
- package/src/sqlite-storage.ts +39 -0
- package/src/storage-errors.ts +7 -1
- package/src/storage.ts +35 -0
package/src/storage-errors.ts
CHANGED
|
@@ -34,7 +34,9 @@ export type StorageQueryErrorCode =
|
|
|
34
34
|
| 'sync.storage.stored_layout_mismatch'
|
|
35
35
|
| 'sync.storage.physical_layout_mismatch'
|
|
36
36
|
| 'sync.storage.transaction_query_unsupported'
|
|
37
|
-
| 'sync.storage.query_over_staged_writes'
|
|
37
|
+
| 'sync.storage.query_over_staged_writes'
|
|
38
|
+
| 'sync.storage.erase_unsupported'
|
|
39
|
+
| 'sync.storage.invalid_erase_query';
|
|
38
40
|
|
|
39
41
|
const STORAGE_QUERY_MESSAGES: Readonly<Record<StorageQueryErrorCode, string>> =
|
|
40
42
|
{
|
|
@@ -78,6 +80,10 @@ const STORAGE_QUERY_MESSAGES: Readonly<Record<StorageQueryErrorCode, string>> =
|
|
|
78
80
|
'trusted row lookup requires one exact value per index column',
|
|
79
81
|
'sync.storage.invalid_limit':
|
|
80
82
|
'trusted row lookup limit must be an integer from 1 through 1,000',
|
|
83
|
+
'sync.storage.erase_unsupported':
|
|
84
|
+
'this storage backend cannot erase a scope value',
|
|
85
|
+
'sync.storage.invalid_erase_query':
|
|
86
|
+
'erasure requires a declared scope variable, a non-empty value, and a row budget within the operation cap',
|
|
81
87
|
};
|
|
82
88
|
|
|
83
89
|
/**
|
package/src/storage.ts
CHANGED
|
@@ -957,6 +957,29 @@ export interface ServerStorage {
|
|
|
957
957
|
): Promise<BlobReferencingRow[]>;
|
|
958
958
|
listReferencedBlobIds?(partition: string): Promise<string[]>;
|
|
959
959
|
|
|
960
|
+
/**
|
|
961
|
+
* §4.6.1 scope-value erasure — ADDITIVE, optional; `eraseScopeValue`
|
|
962
|
+
* requires both.
|
|
963
|
+
*
|
|
964
|
+
* `listScopeValueRows`: up to `limit` rowIds of `table` whose stored scope
|
|
965
|
+
* binds `variable` to `value`, ordered by rowId (the row scope index).
|
|
966
|
+
*
|
|
967
|
+
* `eraseScopeValueHistory`: under the partition write lock, removes up to
|
|
968
|
+
* `limit` upsert change records of `table` at or below `throughSeq` whose
|
|
969
|
+
* scopes bind `variable` to `value`, then up to `limit` change scope index
|
|
970
|
+
* entries of that binding whose commit holds no such change any more.
|
|
971
|
+
* Delete change records stay: clients behind the erasure still need them.
|
|
972
|
+
* Returns the number of records removed.
|
|
973
|
+
*/
|
|
974
|
+
listScopeValueRows?(
|
|
975
|
+
partition: string,
|
|
976
|
+
query: ScopeValueQuery,
|
|
977
|
+
): Promise<string[]>;
|
|
978
|
+
eraseScopeValueHistory?(
|
|
979
|
+
partition: string,
|
|
980
|
+
query: ScopeValueHistoryQuery,
|
|
981
|
+
): Promise<number>;
|
|
982
|
+
|
|
960
983
|
/**
|
|
961
984
|
* Admin/console read surface (`SyncularAdmin`): ADDITIVE,
|
|
962
985
|
* optional. All read-only, partition-scoped, and JSON-able. A backend
|
|
@@ -1008,6 +1031,18 @@ export interface ServerStorage {
|
|
|
1008
1031
|
listPartitions(): Promise<string[]>;
|
|
1009
1032
|
}
|
|
1010
1033
|
|
|
1034
|
+
/** One scope binding of one table, budgeted (§4.6.1). */
|
|
1035
|
+
export interface ScopeValueQuery {
|
|
1036
|
+
readonly table: string;
|
|
1037
|
+
readonly variable: string;
|
|
1038
|
+
readonly value: string;
|
|
1039
|
+
readonly limit: number;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
export interface ScopeValueHistoryQuery extends ScopeValueQuery {
|
|
1043
|
+
readonly throughSeq: number;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1011
1046
|
/** A row referencing a blob, with the scopes needed to authorize download. */
|
|
1012
1047
|
export interface BlobReferencingRow {
|
|
1013
1048
|
readonly table: string;
|