@powersync/service-module-postgres-storage 0.11.2 → 0.13.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/CHANGELOG.md +60 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/migrations/scripts/1771232439485-storage-version.d.ts +3 -0
- package/dist/@types/migrations/scripts/1771424826685-current-data-pending-deletes.d.ts +3 -0
- package/dist/@types/migrations/scripts/1771491856000-sync-plan.d.ts +3 -0
- package/dist/@types/storage/PostgresBucketStorageFactory.d.ts +6 -10
- package/dist/@types/storage/PostgresCompactor.d.ts +10 -3
- package/dist/@types/storage/PostgresSyncRulesStorage.d.ts +5 -3
- package/dist/@types/storage/batch/OperationBatch.d.ts +2 -2
- package/dist/@types/storage/batch/PostgresBucketBatch.d.ts +12 -9
- package/dist/@types/storage/batch/PostgresPersistedBatch.d.ts +17 -5
- package/dist/@types/storage/current-data-store.d.ts +85 -0
- package/dist/@types/storage/current-data-table.d.ts +9 -0
- package/dist/@types/storage/sync-rules/PostgresPersistedSyncRulesContent.d.ts +1 -10
- package/dist/@types/storage/table-id.d.ts +2 -0
- package/dist/@types/types/models/CurrentData.d.ts +18 -3
- package/dist/@types/types/models/SyncRules.d.ts +12 -2
- package/dist/@types/types/models/json.d.ts +11 -0
- package/dist/@types/types/types.d.ts +2 -0
- package/dist/@types/utils/bson.d.ts +1 -1
- package/dist/@types/utils/db.d.ts +9 -0
- package/dist/@types/utils/test-utils.d.ts +1 -1
- package/dist/migrations/scripts/1771232439485-storage-version.js +111 -0
- package/dist/migrations/scripts/1771232439485-storage-version.js.map +1 -0
- package/dist/migrations/scripts/1771424826685-current-data-pending-deletes.js +8 -0
- package/dist/migrations/scripts/1771424826685-current-data-pending-deletes.js.map +1 -0
- package/dist/migrations/scripts/1771491856000-sync-plan.js +91 -0
- package/dist/migrations/scripts/1771491856000-sync-plan.js.map +1 -0
- package/dist/storage/PostgresBucketStorageFactory.js +56 -58
- package/dist/storage/PostgresBucketStorageFactory.js.map +1 -1
- package/dist/storage/PostgresCompactor.js +55 -66
- package/dist/storage/PostgresCompactor.js.map +1 -1
- package/dist/storage/PostgresSyncRulesStorage.js +23 -15
- package/dist/storage/PostgresSyncRulesStorage.js.map +1 -1
- package/dist/storage/batch/OperationBatch.js +2 -1
- package/dist/storage/batch/OperationBatch.js.map +1 -1
- package/dist/storage/batch/PostgresBucketBatch.js +286 -213
- package/dist/storage/batch/PostgresBucketBatch.js.map +1 -1
- package/dist/storage/batch/PostgresPersistedBatch.js +86 -81
- package/dist/storage/batch/PostgresPersistedBatch.js.map +1 -1
- package/dist/storage/current-data-store.js +270 -0
- package/dist/storage/current-data-store.js.map +1 -0
- package/dist/storage/current-data-table.js +22 -0
- package/dist/storage/current-data-table.js.map +1 -0
- package/dist/storage/sync-rules/PostgresPersistedSyncRulesContent.js +14 -30
- package/dist/storage/sync-rules/PostgresPersistedSyncRulesContent.js.map +1 -1
- package/dist/storage/table-id.js +8 -0
- package/dist/storage/table-id.js.map +1 -0
- package/dist/types/models/CurrentData.js +11 -2
- package/dist/types/models/CurrentData.js.map +1 -1
- package/dist/types/models/SyncRules.js +12 -1
- package/dist/types/models/SyncRules.js.map +1 -1
- package/dist/types/models/json.js +21 -0
- package/dist/types/models/json.js.map +1 -0
- package/dist/utils/bson.js.map +1 -1
- package/dist/utils/db.js +41 -0
- package/dist/utils/db.js.map +1 -1
- package/dist/utils/test-utils.js +50 -14
- package/dist/utils/test-utils.js.map +1 -1
- package/package.json +9 -9
- package/src/migrations/scripts/1771232439485-storage-version.ts +44 -0
- package/src/migrations/scripts/1771424826685-current-data-pending-deletes.ts +10 -0
- package/src/migrations/scripts/1771491856000-sync-plan.ts +21 -0
- package/src/storage/PostgresBucketStorageFactory.ts +69 -68
- package/src/storage/PostgresCompactor.ts +63 -72
- package/src/storage/PostgresSyncRulesStorage.ts +30 -17
- package/src/storage/batch/OperationBatch.ts +4 -3
- package/src/storage/batch/PostgresBucketBatch.ts +306 -238
- package/src/storage/batch/PostgresPersistedBatch.ts +92 -84
- package/src/storage/current-data-store.ts +326 -0
- package/src/storage/current-data-table.ts +26 -0
- package/src/storage/sync-rules/PostgresPersistedSyncRulesContent.ts +13 -33
- package/src/storage/table-id.ts +9 -0
- package/src/types/models/CurrentData.ts +17 -4
- package/src/types/models/SyncRules.ts +16 -1
- package/src/types/models/json.ts +26 -0
- package/src/utils/bson.ts +1 -1
- package/src/utils/db.ts +47 -0
- package/src/utils/test-utils.ts +42 -15
- package/test/src/__snapshots__/storage.test.ts.snap +148 -6
- package/test/src/__snapshots__/storage_compacting.test.ts.snap +17 -0
- package/test/src/__snapshots__/storage_sync.test.ts.snap +2211 -21
- package/test/src/migrations.test.ts +9 -2
- package/test/src/storage.test.ts +137 -131
- package/test/src/storage_compacting.test.ts +113 -2
- package/test/src/storage_sync.test.ts +148 -4
- package/test/src/util.ts +5 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { GetIntanceOptions, storage, SyncRulesBucketStorage, UpdateSyncRulesOptions } from '@powersync/service-core';
|
|
1
|
+
import { GetIntanceOptions, storage, SyncRulesBucketStorage } from '@powersync/service-core';
|
|
3
2
|
import * as pg_wire from '@powersync/service-jpgwire';
|
|
4
3
|
import * as lib_postgres from '@powersync/lib-service-postgres';
|
|
5
4
|
import { NormalizedPostgresStorageConfig } from '../types/types.js';
|
|
@@ -8,7 +7,7 @@ export type PostgresBucketStorageOptions = {
|
|
|
8
7
|
config: NormalizedPostgresStorageConfig;
|
|
9
8
|
slot_name_prefix: string;
|
|
10
9
|
};
|
|
11
|
-
export declare class PostgresBucketStorageFactory extends
|
|
10
|
+
export declare class PostgresBucketStorageFactory extends storage.BucketStorageFactory {
|
|
12
11
|
protected options: PostgresBucketStorageOptions;
|
|
13
12
|
readonly db: lib_postgres.DatabaseClient;
|
|
14
13
|
readonly slot_name_prefix: string;
|
|
@@ -20,16 +19,13 @@ export declare class PostgresBucketStorageFactory extends framework.BaseObserver
|
|
|
20
19
|
getStorageMetrics(): Promise<storage.StorageMetrics>;
|
|
21
20
|
getPowerSyncInstanceId(): Promise<string>;
|
|
22
21
|
getSystemIdentifier(): Promise<storage.BucketStorageSystemIdentifier>;
|
|
23
|
-
configureSyncRules(options: UpdateSyncRulesOptions): Promise<{
|
|
24
|
-
updated: boolean;
|
|
25
|
-
persisted_sync_rules?: storage.PersistedSyncRulesContent;
|
|
26
|
-
lock?: storage.ReplicationLock;
|
|
27
|
-
}>;
|
|
28
22
|
updateSyncRules(options: storage.UpdateSyncRulesOptions): Promise<PostgresPersistedSyncRulesContent>;
|
|
23
|
+
/**
|
|
24
|
+
* Lazy-initializes storage-version-specific structures, if needed.
|
|
25
|
+
*/
|
|
26
|
+
private initializeStorageVersion;
|
|
29
27
|
restartReplication(sync_rules_group_id: number): Promise<void>;
|
|
30
|
-
getActiveSyncRules(options: storage.ParseSyncRulesOptions): Promise<storage.PersistedSyncRules | null>;
|
|
31
28
|
getActiveSyncRulesContent(): Promise<storage.PersistedSyncRulesContent | null>;
|
|
32
|
-
getNextSyncRules(options: storage.ParseSyncRulesOptions): Promise<storage.PersistedSyncRules | null>;
|
|
33
29
|
getNextSyncRulesContent(): Promise<storage.PersistedSyncRulesContent | null>;
|
|
34
30
|
getReplicatingSyncRules(): Promise<storage.PersistedSyncRulesContent[]>;
|
|
35
31
|
getStoppedSyncRules(): Promise<storage.PersistedSyncRulesContent[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as lib_postgres from '@powersync/lib-service-postgres';
|
|
2
|
-
import { storage } from '@powersync/service-core';
|
|
2
|
+
import { InternalOpId, storage } from '@powersync/service-core';
|
|
3
3
|
/**
|
|
4
4
|
* Additional options, primarily for testing.
|
|
5
5
|
*/
|
|
@@ -15,15 +15,22 @@ export declare class PostgresCompactor {
|
|
|
15
15
|
private clearBatchLimit;
|
|
16
16
|
private maxOpId;
|
|
17
17
|
private buckets;
|
|
18
|
-
constructor(db: lib_postgres.DatabaseClient, group_id: number, options
|
|
18
|
+
constructor(db: lib_postgres.DatabaseClient, group_id: number, options: PostgresCompactOptions);
|
|
19
19
|
/**
|
|
20
20
|
* Compact buckets by converting operations into MOVE and/or CLEAR operations.
|
|
21
21
|
*
|
|
22
22
|
* See /docs/compacting-operations.md for details.
|
|
23
23
|
*/
|
|
24
24
|
compact(): Promise<void>;
|
|
25
|
-
|
|
25
|
+
private compactAllBuckets;
|
|
26
|
+
private compactSingleBucket;
|
|
26
27
|
private flush;
|
|
28
|
+
/**
|
|
29
|
+
* Expose the internal clearBucket() method to tests.
|
|
30
|
+
*
|
|
31
|
+
* @deprecated Only for tests
|
|
32
|
+
*/
|
|
33
|
+
clearBucketForTests(bucket: string, op: InternalOpId): Promise<void>;
|
|
27
34
|
/**
|
|
28
35
|
* Perform a CLEAR compact for a bucket.
|
|
29
36
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as lib_postgres from '@powersync/lib-service-postgres';
|
|
2
|
-
import { CheckpointChanges, GetCheckpointChangesOptions, InternalOpId, PopulateChecksumCacheOptions, PopulateChecksumCacheResults, ReplicationCheckpoint, storage, utils, WatchWriteCheckpointOptions } from '@powersync/service-core';
|
|
2
|
+
import { CheckpointChanges, GetCheckpointChangesOptions, InternalOpId, PopulateChecksumCacheOptions, PopulateChecksumCacheResults, ReplicationCheckpoint, storage, StorageVersionConfig, utils, WatchWriteCheckpointOptions } from '@powersync/service-core';
|
|
3
3
|
import * as sync_rules from '@powersync/service-sync-rules';
|
|
4
4
|
import { RequiredOperationBatchLimits } from '../types/types.js';
|
|
5
5
|
import * as framework from '@powersync/lib-services-framework';
|
|
@@ -18,9 +18,11 @@ export declare class PostgresSyncRulesStorage extends framework.BaseObserver<sto
|
|
|
18
18
|
readonly sync_rules: storage.PersistedSyncRulesContent;
|
|
19
19
|
readonly slot_name: string;
|
|
20
20
|
readonly factory: PostgresBucketStorageFactory;
|
|
21
|
+
readonly storageConfig: StorageVersionConfig;
|
|
21
22
|
private sharedIterator;
|
|
22
23
|
protected db: lib_postgres.DatabaseClient;
|
|
23
24
|
protected writeCheckpointAPI: PostgresWriteCheckpointAPI;
|
|
25
|
+
private readonly currentDataStore;
|
|
24
26
|
private parsedSyncRulesCache;
|
|
25
27
|
private _checksumCache;
|
|
26
28
|
constructor(options: PostgresSyncRulesStorageOptions);
|
|
@@ -42,8 +44,8 @@ export declare class PostgresSyncRulesStorage extends framework.BaseObserver<sto
|
|
|
42
44
|
resolveTable(options: storage.ResolveTableOptions): Promise<storage.ResolveTableResult>;
|
|
43
45
|
startBatch(options: storage.StartBatchOptions, callback: (batch: storage.BucketStorageBatch) => Promise<void>): Promise<storage.FlushedResult | null>;
|
|
44
46
|
getParameterSets(checkpoint: ReplicationCheckpoint, lookups: sync_rules.ScopedParameterLookup[]): Promise<sync_rules.SqliteJsonRow[]>;
|
|
45
|
-
getBucketDataBatch(checkpoint: InternalOpId, dataBuckets:
|
|
46
|
-
getChecksums(checkpoint: utils.InternalOpId, buckets:
|
|
47
|
+
getBucketDataBatch(checkpoint: InternalOpId, dataBuckets: storage.BucketDataRequest[], options?: storage.BucketDataBatchOptions): AsyncIterable<storage.SyncBucketDataChunk>;
|
|
48
|
+
getChecksums(checkpoint: utils.InternalOpId, buckets: storage.BucketChecksumRequest[]): Promise<utils.ChecksumMap>;
|
|
47
49
|
clearChecksumCache(): void;
|
|
48
50
|
terminate(options?: storage.TerminateOptions): Promise<void>;
|
|
49
51
|
getStatus(): Promise<storage.SyncRuleStatus>;
|
|
@@ -40,8 +40,8 @@ export declare class RecordOperation {
|
|
|
40
40
|
/**
|
|
41
41
|
* In-memory cache key - must not be persisted.
|
|
42
42
|
*/
|
|
43
|
-
export declare function cacheKey(sourceTableId:
|
|
43
|
+
export declare function cacheKey(sourceTableId: storage.SourceTableId, id: storage.ReplicaId): string;
|
|
44
44
|
/**
|
|
45
45
|
* Calculates a cache key for a stored ReplicaId. This is usually stored as a bytea/Buffer.
|
|
46
46
|
*/
|
|
47
|
-
export declare function encodedCacheKey(sourceTableId:
|
|
47
|
+
export declare function encodedCacheKey(sourceTableId: storage.SourceTableId, storedKey: Buffer): string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as lib_postgres from '@powersync/lib-service-postgres';
|
|
2
2
|
import { BaseObserver, Logger } from '@powersync/lib-services-framework';
|
|
3
|
-
import { BucketStorageMarkRecordUnavailable, InternalOpId, storage } from '@powersync/service-core';
|
|
3
|
+
import { BucketStorageMarkRecordUnavailable, CheckpointResult, InternalOpId, storage } from '@powersync/service-core';
|
|
4
4
|
import * as sync_rules from '@powersync/service-sync-rules';
|
|
5
5
|
import * as t from 'ts-codec';
|
|
6
|
-
import {
|
|
6
|
+
import { V3CurrentDataDecoded } from '../../types/models/CurrentData.js';
|
|
7
7
|
import { RequiredOperationBatchLimits } from '../../types/types.js';
|
|
8
8
|
import { OperationBatch, RecordOperation } from './OperationBatch.js';
|
|
9
9
|
import { PostgresPersistedBatch } from './PostgresPersistedBatch.js';
|
|
@@ -14,7 +14,6 @@ export interface PostgresBucketBatchOptions {
|
|
|
14
14
|
group_id: number;
|
|
15
15
|
slot_name: string;
|
|
16
16
|
last_checkpoint_lsn: string | null;
|
|
17
|
-
no_checkpoint_before_lsn: string;
|
|
18
17
|
store_current_data: boolean;
|
|
19
18
|
keep_alive_op?: InternalOpId | null;
|
|
20
19
|
resumeFromLsn: string | null;
|
|
@@ -24,6 +23,7 @@ export interface PostgresBucketBatchOptions {
|
|
|
24
23
|
skip_existing_rows: boolean;
|
|
25
24
|
batch_limits: RequiredOperationBatchLimits;
|
|
26
25
|
markRecordUnavailable: BucketStorageMarkRecordUnavailable | undefined;
|
|
26
|
+
storageConfig: storage.StorageVersionConfig;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Intermediate type which helps for only watching the active sync rules
|
|
@@ -49,7 +49,6 @@ export declare class PostgresBucketBatch extends BaseObserver<storage.BucketBatc
|
|
|
49
49
|
protected db: lib_postgres.DatabaseClient;
|
|
50
50
|
protected group_id: number;
|
|
51
51
|
protected last_checkpoint_lsn: string | null;
|
|
52
|
-
protected no_checkpoint_before_lsn: string;
|
|
53
52
|
protected persisted_op: InternalOpId | null;
|
|
54
53
|
protected write_checkpoint_batch: storage.CustomWriteCheckpointOptions[];
|
|
55
54
|
protected readonly sync_rules: sync_rules.HydratedSyncRules;
|
|
@@ -58,9 +57,10 @@ export declare class PostgresBucketBatch extends BaseObserver<storage.BucketBatc
|
|
|
58
57
|
private markRecordUnavailable;
|
|
59
58
|
private needsActivation;
|
|
60
59
|
private clearedError;
|
|
60
|
+
private readonly storageConfig;
|
|
61
|
+
private readonly currentDataStore;
|
|
61
62
|
constructor(options: PostgresBucketBatchOptions);
|
|
62
63
|
get lastCheckpointLsn(): string | null;
|
|
63
|
-
get noCheckpointBeforeLsn(): string;
|
|
64
64
|
[Symbol.asyncDispose](): Promise<void>;
|
|
65
65
|
save(record: storage.SaveOptions): Promise<storage.FlushedResult | null>;
|
|
66
66
|
truncate(sourceTables: storage.SourceTable[]): Promise<storage.FlushedResult | null>;
|
|
@@ -68,14 +68,16 @@ export declare class PostgresBucketBatch extends BaseObserver<storage.BucketBatc
|
|
|
68
68
|
drop(sourceTables: storage.SourceTable[]): Promise<storage.FlushedResult | null>;
|
|
69
69
|
flush(): Promise<storage.FlushedResult | null>;
|
|
70
70
|
private flushInner;
|
|
71
|
-
commit(lsn: string, options?: storage.BucketBatchCommitOptions): Promise<
|
|
72
|
-
keepalive(lsn: string): Promise<
|
|
71
|
+
commit(lsn: string, options?: storage.BucketBatchCommitOptions): Promise<CheckpointResult>;
|
|
72
|
+
keepalive(lsn: string): Promise<CheckpointResult>;
|
|
73
73
|
setResumeLsn(lsn: string): Promise<void>;
|
|
74
|
-
|
|
74
|
+
markAllSnapshotDone(no_checkpoint_before_lsn: string): Promise<void>;
|
|
75
|
+
markTableSnapshotRequired(table: storage.SourceTable): Promise<void>;
|
|
76
|
+
markTableSnapshotDone(tables: storage.SourceTable[], no_checkpoint_before_lsn?: string): Promise<storage.SourceTable[]>;
|
|
75
77
|
updateTableProgress(table: storage.SourceTable, progress: Partial<storage.TableSnapshotStatus>): Promise<storage.SourceTable>;
|
|
76
78
|
addCustomWriteCheckpoint(checkpoint: storage.BatchedCustomWriteCheckpointOptions): void;
|
|
77
79
|
protected replicateBatch(db: lib_postgres.WrappedConnection, batch: OperationBatch): Promise<OperationBatch | null>;
|
|
78
|
-
protected saveOperation(persistedBatch: PostgresPersistedBatch, operation: RecordOperation, currentData?:
|
|
80
|
+
protected saveOperation(persistedBatch: PostgresPersistedBatch, operation: RecordOperation, currentData?: V3CurrentDataDecoded | null): Promise<{
|
|
79
81
|
group_id: number;
|
|
80
82
|
source_table: string;
|
|
81
83
|
source_key: Buffer<ArrayBuffer>;
|
|
@@ -86,6 +88,7 @@ export declare class PostgresBucketBatch extends BaseObserver<storage.BucketBatc
|
|
|
86
88
|
table: string;
|
|
87
89
|
}[];
|
|
88
90
|
lookups: Buffer<ArrayBuffer>[];
|
|
91
|
+
pending_delete: bigint | null;
|
|
89
92
|
} | null>;
|
|
90
93
|
/**
|
|
91
94
|
* Switch from processing -> active if relevant.
|
|
@@ -18,7 +18,7 @@ export type SaveParameterDataOptions = {
|
|
|
18
18
|
existing_lookups: Buffer[];
|
|
19
19
|
};
|
|
20
20
|
export type DeleteCurrentDataOptions = {
|
|
21
|
-
source_table_id:
|
|
21
|
+
source_table_id: string;
|
|
22
22
|
/**
|
|
23
23
|
* ReplicaID which needs to be serialized in order to be queried
|
|
24
24
|
* or inserted into the DB
|
|
@@ -28,12 +28,19 @@ export type DeleteCurrentDataOptions = {
|
|
|
28
28
|
* Optionally provide the serialized source key directly
|
|
29
29
|
*/
|
|
30
30
|
serialized_source_key?: Buffer;
|
|
31
|
+
/**
|
|
32
|
+
* Streaming replication needs soft deletes, while truncating tables can use a hard delete directly.
|
|
33
|
+
*/
|
|
34
|
+
soft: boolean;
|
|
31
35
|
};
|
|
32
36
|
export type PostgresPersistedBatchOptions = RequiredOperationBatchLimits & {
|
|
33
37
|
group_id: number;
|
|
38
|
+
storageConfig: storage.StorageVersionConfig;
|
|
34
39
|
};
|
|
35
40
|
export declare class PostgresPersistedBatch {
|
|
36
41
|
group_id: number;
|
|
42
|
+
private readonly storageConfig;
|
|
43
|
+
private readonly currentDataStore;
|
|
37
44
|
/**
|
|
38
45
|
* Very rough estimate of current operations size in bytes
|
|
39
46
|
*/
|
|
@@ -45,16 +52,21 @@ export declare class PostgresPersistedBatch {
|
|
|
45
52
|
*/
|
|
46
53
|
protected bucketDataInserts: models.BucketData[];
|
|
47
54
|
protected parameterDataInserts: models.BucketParameters[];
|
|
48
|
-
protected currentDataDeletes: Pick<models.CurrentData, 'group_id' | 'source_key' | 'source_table'>[];
|
|
49
55
|
/**
|
|
50
|
-
* This is stored as a map to avoid multiple inserts (or conflicts) for the same key
|
|
56
|
+
* This is stored as a map to avoid multiple inserts (or conflicts) for the same key.
|
|
57
|
+
*
|
|
58
|
+
* Each key may only occur in one of these two maps.
|
|
51
59
|
*/
|
|
52
|
-
protected currentDataInserts: Map<string, models.
|
|
60
|
+
protected currentDataInserts: Map<string, models.V3CurrentData>;
|
|
61
|
+
protected currentDataDeletes: Map<string, {
|
|
62
|
+
source_key_hex: string;
|
|
63
|
+
source_table: string;
|
|
64
|
+
}>;
|
|
53
65
|
constructor(options: PostgresPersistedBatchOptions);
|
|
54
66
|
saveBucketData(options: SaveBucketDataOptions): void;
|
|
55
67
|
saveParameterData(options: SaveParameterDataOptions): void;
|
|
56
68
|
deleteCurrentData(options: DeleteCurrentDataOptions): void;
|
|
57
|
-
upsertCurrentData(options: models.
|
|
69
|
+
upsertCurrentData(options: models.V3CurrentDataDecoded, serialized_source_key?: Buffer): void;
|
|
58
70
|
shouldFlushTransaction(): boolean;
|
|
59
71
|
flush(db: lib_postgres.WrappedConnection): Promise<{
|
|
60
72
|
flushedAny: boolean;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as lib_postgres from '@powersync/lib-service-postgres';
|
|
2
|
+
import { storage } from '@powersync/service-core';
|
|
3
|
+
import * as t from 'ts-codec';
|
|
4
|
+
import * as models from '../types/models/CurrentData.js';
|
|
5
|
+
type Queryable = Pick<lib_postgres.DatabaseClient, 'sql' | 'streamRows'>;
|
|
6
|
+
declare const TruncateCurrentDataCodec: t.ObjectCodec<Pick<{
|
|
7
|
+
buckets: t.Codec<{
|
|
8
|
+
id: string;
|
|
9
|
+
bucket: string;
|
|
10
|
+
table: string;
|
|
11
|
+
}[], string, string, t.CodecProps>;
|
|
12
|
+
data: t.Codec<Buffer<ArrayBuffer>, string, "hexBuffer", t.CodecProps>;
|
|
13
|
+
group_id: t.Codec<number, number, "pg_number", t.CodecProps>;
|
|
14
|
+
lookups: t.ArrayCodec<t.Codec<Buffer<ArrayBuffer>, string, "hexBuffer", t.CodecProps>>;
|
|
15
|
+
source_key: t.Codec<Buffer<ArrayBuffer>, string, "hexBuffer", t.CodecProps>;
|
|
16
|
+
source_table: t.IdentityCodec<t.CodecType.String>;
|
|
17
|
+
}, "source_key" | "buckets" | "lookups">>;
|
|
18
|
+
declare const LookupKeyCodec: t.ObjectCodec<Pick<{
|
|
19
|
+
buckets: t.Codec<{
|
|
20
|
+
id: string;
|
|
21
|
+
bucket: string;
|
|
22
|
+
table: string;
|
|
23
|
+
}[], string, string, t.CodecProps>;
|
|
24
|
+
data: t.Codec<Buffer<ArrayBuffer>, string, "hexBuffer", t.CodecProps>;
|
|
25
|
+
group_id: t.Codec<number, number, "pg_number", t.CodecProps>;
|
|
26
|
+
lookups: t.ArrayCodec<t.Codec<Buffer<ArrayBuffer>, string, "hexBuffer", t.CodecProps>>;
|
|
27
|
+
source_key: t.Codec<Buffer<ArrayBuffer>, string, "hexBuffer", t.CodecProps>;
|
|
28
|
+
source_table: t.IdentityCodec<t.CodecType.String>;
|
|
29
|
+
}, "source_table" | "source_key">>;
|
|
30
|
+
export type TruncateCurrentDataRow = t.Decoded<typeof TruncateCurrentDataCodec>;
|
|
31
|
+
export type CurrentDataLookupRow = t.Decoded<typeof LookupKeyCodec> | t.Decoded<typeof models.V1CurrentData> | t.Decoded<typeof models.V3CurrentData>;
|
|
32
|
+
export declare const V1_CURRENT_DATA_TABLE = "current_data";
|
|
33
|
+
export declare const V3_CURRENT_DATA_TABLE = "v3_current_data";
|
|
34
|
+
export declare class PostgresCurrentDataStore {
|
|
35
|
+
readonly table: string;
|
|
36
|
+
readonly softDeleteEnabled: boolean;
|
|
37
|
+
constructor(storageConfig: storage.StorageVersionConfig);
|
|
38
|
+
streamTruncateRows(db: Queryable, options: {
|
|
39
|
+
groupId: number;
|
|
40
|
+
sourceTableId: string;
|
|
41
|
+
limit: number;
|
|
42
|
+
}): AsyncIterableIterator<{
|
|
43
|
+
source_key: string;
|
|
44
|
+
buckets: string;
|
|
45
|
+
lookups: string[];
|
|
46
|
+
}[]>;
|
|
47
|
+
decodeTruncateRow(row: t.Encoded<typeof TruncateCurrentDataCodec>): TruncateCurrentDataRow;
|
|
48
|
+
streamSizeRows(db: Queryable, options: {
|
|
49
|
+
groupId: number;
|
|
50
|
+
lookups: {
|
|
51
|
+
source_table: string;
|
|
52
|
+
source_key: string;
|
|
53
|
+
}[];
|
|
54
|
+
}): AsyncIterableIterator<{
|
|
55
|
+
source_table: string;
|
|
56
|
+
source_key: storage.ReplicaId;
|
|
57
|
+
data_size: number;
|
|
58
|
+
}[]>;
|
|
59
|
+
streamLookupRows(db: Queryable, options: {
|
|
60
|
+
groupId: number;
|
|
61
|
+
lookups: {
|
|
62
|
+
source_table: string;
|
|
63
|
+
source_key: string;
|
|
64
|
+
}[];
|
|
65
|
+
skipExistingRows: boolean;
|
|
66
|
+
}): AsyncIterableIterator<any[]>;
|
|
67
|
+
decodeLookupRow(row: any, skipExistingRows: boolean): CurrentDataLookupRow;
|
|
68
|
+
flushUpserts(db: Queryable, updates: models.V3CurrentData[]): Promise<void>;
|
|
69
|
+
flushDeletes(db: Queryable, options: {
|
|
70
|
+
groupId: number;
|
|
71
|
+
deletes: {
|
|
72
|
+
source_key_hex: string;
|
|
73
|
+
source_table: string;
|
|
74
|
+
}[];
|
|
75
|
+
}): Promise<void>;
|
|
76
|
+
cleanupPendingDeletes(db: Queryable, options: {
|
|
77
|
+
groupId: number;
|
|
78
|
+
lastCheckpoint: bigint;
|
|
79
|
+
}): Promise<void>;
|
|
80
|
+
deleteGroupRows(db: Queryable, options: {
|
|
81
|
+
groupId: number;
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
private wherePendingDelete;
|
|
84
|
+
}
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { storage } from '@powersync/service-core';
|
|
2
|
+
export declare const V1_CURRENT_DATA_TABLE = "current_data";
|
|
3
|
+
export declare const V3_CURRENT_DATA_TABLE = "v3_current_data";
|
|
4
|
+
/**
|
|
5
|
+
* The table used by a specific storage version for general current_data access.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getCommonCurrentDataTable(storageConfig: storage.StorageVersionConfig): "current_data" | "v3_current_data";
|
|
8
|
+
export declare function getV1CurrentDataTable(storageConfig: storage.StorageVersionConfig): string;
|
|
9
|
+
export declare function getV3CurrentDataTable(storageConfig: storage.StorageVersionConfig): string;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import * as lib_postgres from '@powersync/lib-service-postgres';
|
|
2
2
|
import { storage } from '@powersync/service-core';
|
|
3
3
|
import { models } from '../../types/types.js';
|
|
4
|
-
export declare class PostgresPersistedSyncRulesContent
|
|
4
|
+
export declare class PostgresPersistedSyncRulesContent extends storage.PersistedSyncRulesContent {
|
|
5
5
|
private db;
|
|
6
|
-
readonly slot_name: string;
|
|
7
|
-
readonly id: number;
|
|
8
|
-
readonly sync_rules_content: string;
|
|
9
|
-
readonly last_checkpoint_lsn: string | null;
|
|
10
|
-
readonly last_fatal_error: string | null;
|
|
11
|
-
readonly last_keepalive_ts: Date | null;
|
|
12
|
-
readonly last_checkpoint_ts: Date | null;
|
|
13
|
-
readonly active: boolean;
|
|
14
6
|
current_lock: storage.ReplicationLock | null;
|
|
15
7
|
constructor(db: lib_postgres.DatabaseClient, row: models.SyncRulesDecoded);
|
|
16
|
-
parsed(options: storage.ParseSyncRulesOptions): storage.PersistedSyncRules;
|
|
17
8
|
lock(): Promise<storage.ReplicationLock>;
|
|
18
9
|
}
|
|
@@ -6,7 +6,7 @@ export declare const CurrentBucket: t.ObjectCodec<{
|
|
|
6
6
|
}>;
|
|
7
7
|
export type CurrentBucket = t.Encoded<typeof CurrentBucket>;
|
|
8
8
|
export type CurrentBucketDecoded = t.Decoded<typeof CurrentBucket>;
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const V1CurrentData: t.ObjectCodec<{
|
|
10
10
|
buckets: t.Codec<{
|
|
11
11
|
id: string;
|
|
12
12
|
bucket: string;
|
|
@@ -18,5 +18,20 @@ export declare const CurrentData: t.ObjectCodec<{
|
|
|
18
18
|
source_key: t.Codec<Buffer<ArrayBuffer>, string, "hexBuffer", t.CodecProps>;
|
|
19
19
|
source_table: t.IdentityCodec<t.CodecType.String>;
|
|
20
20
|
}>;
|
|
21
|
-
export
|
|
22
|
-
|
|
21
|
+
export declare const V3CurrentData: t.ObjectCodec<{
|
|
22
|
+
buckets: t.Codec<{
|
|
23
|
+
id: string;
|
|
24
|
+
bucket: string;
|
|
25
|
+
table: string;
|
|
26
|
+
}[], string, string, t.CodecProps>;
|
|
27
|
+
data: t.Codec<Buffer<ArrayBuffer>, string, "hexBuffer", t.CodecProps>;
|
|
28
|
+
group_id: t.Codec<number, number, "pg_number", t.CodecProps>;
|
|
29
|
+
lookups: t.ArrayCodec<t.Codec<Buffer<ArrayBuffer>, string, "hexBuffer", t.CodecProps>>;
|
|
30
|
+
source_key: t.Codec<Buffer<ArrayBuffer>, string, "hexBuffer", t.CodecProps>;
|
|
31
|
+
source_table: t.IdentityCodec<t.CodecType.String>;
|
|
32
|
+
pending_delete: t.Union<t.Codec<null, null, string, t.CodecProps>, t.Codec<bigint, string | number, string, t.CodecProps>>;
|
|
33
|
+
}>;
|
|
34
|
+
export type V1CurrentData = t.Encoded<typeof V1CurrentData>;
|
|
35
|
+
export type V1CurrentDataDecoded = t.Decoded<typeof V1CurrentData>;
|
|
36
|
+
export type V3CurrentData = t.Encoded<typeof V3CurrentData>;
|
|
37
|
+
export type V3CurrentDataDecoded = t.Decoded<typeof V3CurrentData>;
|
|
@@ -33,19 +33,29 @@ export declare const SyncRules: t.ObjectCodec<{
|
|
|
33
33
|
*
|
|
34
34
|
* This may be old if no data is incoming.
|
|
35
35
|
*/
|
|
36
|
-
last_checkpoint_ts: t.Union<t.Codec<null, null, string, t.CodecProps>, t.Codec<Date, string | import("@powersync/service-sync-rules
|
|
36
|
+
last_checkpoint_ts: t.Union<t.Codec<null, null, string, t.CodecProps>, t.Codec<Date, string | import("@powersync/service-sync-rules").DateTimeValue, string, t.CodecProps>>;
|
|
37
37
|
/**
|
|
38
38
|
* Last time we persisted a checkpoint or keepalive.
|
|
39
39
|
*
|
|
40
40
|
* This should stay fairly current while replicating.
|
|
41
41
|
*/
|
|
42
|
-
last_keepalive_ts: t.Union<t.Codec<null, null, string, t.CodecProps>, t.Codec<Date, string | import("@powersync/service-sync-rules
|
|
42
|
+
last_keepalive_ts: t.Union<t.Codec<null, null, string, t.CodecProps>, t.Codec<Date, string | import("@powersync/service-sync-rules").DateTimeValue, string, t.CodecProps>>;
|
|
43
43
|
/**
|
|
44
44
|
* If an error is stopping replication, it will be stored here.
|
|
45
45
|
*/
|
|
46
46
|
last_fatal_error: t.Union<t.Codec<null, null, string, t.CodecProps>, t.IdentityCodec<t.CodecType.String>>;
|
|
47
47
|
keepalive_op: t.Union<t.Codec<null, null, string, t.CodecProps>, t.Codec<bigint, string | number, string, t.CodecProps>>;
|
|
48
|
+
storage_version: t.OptionalCodec<t.Codec<number | null, number | null, string, t.CodecProps>>;
|
|
48
49
|
content: t.IdentityCodec<t.CodecType.String>;
|
|
50
|
+
sync_plan: t.Union<t.Codec<null, null, string, t.CodecProps>, t.Codec<{
|
|
51
|
+
plan: any;
|
|
52
|
+
compatibility: {
|
|
53
|
+
edition: number;
|
|
54
|
+
overrides: Record<string, boolean>;
|
|
55
|
+
maxTimeValuePrecision?: number | undefined;
|
|
56
|
+
};
|
|
57
|
+
eventDescriptors: Record<string, string[]>;
|
|
58
|
+
}, import("@powersync/service-jsonbig").JsonContainer>>;
|
|
49
59
|
}>;
|
|
50
60
|
export type SyncRules = t.Encoded<typeof SyncRules>;
|
|
51
61
|
export type SyncRulesDecoded = t.Decoded<typeof SyncRules>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { JsonContainer } from '@powersync/service-jsonbig';
|
|
2
|
+
import { Codec } from 'ts-codec';
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a codec to support {@link JsonContainer} values.
|
|
5
|
+
*
|
|
6
|
+
* Because our postgres client implementation wraps JSON objects in a {@link JsonContainer}, this intermediate layer is
|
|
7
|
+
* required to use JSON columns from Postgres in `ts-codec` models.
|
|
8
|
+
*
|
|
9
|
+
* Note that this serializes and deserializes values using {@link JSON}, so bigints are not supported.
|
|
10
|
+
*/
|
|
11
|
+
export declare function jsonContainerObject<I, O>(inner: Codec<I, O>): Codec<I, JsonContainer>;
|
|
@@ -50,6 +50,7 @@ export declare const PostgresStorageConfig: t.Intersection<t.Codec<{
|
|
|
50
50
|
reject_ip_ranges?: string[] | undefined;
|
|
51
51
|
slot_name_prefix?: string | undefined;
|
|
52
52
|
max_pool_size?: number | undefined;
|
|
53
|
+
connect_timeout?: number | undefined;
|
|
53
54
|
}, {
|
|
54
55
|
type: string;
|
|
55
56
|
max_pool_size?: number | undefined;
|
|
@@ -71,6 +72,7 @@ export declare const PostgresStorageConfig: t.Intersection<t.Codec<{
|
|
|
71
72
|
reject_ip_ranges?: string[] | undefined;
|
|
72
73
|
slot_name_prefix?: string | undefined;
|
|
73
74
|
max_pool_size?: number | undefined;
|
|
75
|
+
connect_timeout?: number | undefined;
|
|
74
76
|
}, string, t.CodecProps>, t.ObjectCodec<{
|
|
75
77
|
/**
|
|
76
78
|
* Allow batch operation limits to be configurable.
|
|
@@ -3,4 +3,4 @@ import { storage } from '@powersync/service-core';
|
|
|
3
3
|
* BSON is used to serialize certain documents for storage in BYTEA columns.
|
|
4
4
|
* JSONB columns do not directly support storing binary data which could be required in future.
|
|
5
5
|
*/
|
|
6
|
-
export declare function replicaIdToSubkey(tableId:
|
|
6
|
+
export declare function replicaIdToSubkey(tableId: storage.SourceTableId, id: storage.ReplicaId): string;
|
|
@@ -5,4 +5,13 @@ export declare const NOTIFICATION_CHANNEL = "powersynccheckpoints";
|
|
|
5
5
|
* Re export for prettier to detect the tag better
|
|
6
6
|
*/
|
|
7
7
|
export declare const sql: (strings: TemplateStringsArray, ...params: import("@powersync/service-jpgwire").StatementParam[]) => import("@powersync/service-jpgwire").Statement;
|
|
8
|
+
/**
|
|
9
|
+
* Drop all Postgres storage tables used by the service, including migrations.
|
|
10
|
+
*/
|
|
8
11
|
export declare const dropTables: (client: lib_postgres.DatabaseClient) => Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Clear all Postgres storage tables and reset sequences.
|
|
14
|
+
*
|
|
15
|
+
* Does not clear migration state.
|
|
16
|
+
*/
|
|
17
|
+
export declare const truncateTables: (db: lib_postgres.DatabaseClient) => Promise<void>;
|
|
@@ -15,5 +15,5 @@ export declare function postgresTestSetup(factoryOptions: PostgresTestStorageOpt
|
|
|
15
15
|
reportFactory: (options?: TestStorageOptions) => Promise<PostgresReportStorage>;
|
|
16
16
|
factory: (options?: TestStorageOptions) => Promise<PostgresBucketStorageFactory>;
|
|
17
17
|
migrate: (direction: framework.migrations.Direction) => Promise<void>;
|
|
18
|
+
tableIdStrings: boolean;
|
|
18
19
|
};
|
|
19
|
-
export declare function postgresTestStorageFactoryGenerator(factoryOptions: PostgresTestStorageOptions): (options?: TestStorageOptions) => Promise<PostgresBucketStorageFactory>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
53
|
+
import { storage } from '@powersync/service-core';
|
|
54
|
+
import { openMigrationDB } from '../migration-utils.js';
|
|
55
|
+
export const up = async (context) => {
|
|
56
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
57
|
+
try {
|
|
58
|
+
const { service_context: { configuration } } = context;
|
|
59
|
+
const client = __addDisposableResource(env_1, openMigrationDB(configuration.storage), true);
|
|
60
|
+
await client.transaction(async (db) => {
|
|
61
|
+
await db.sql `
|
|
62
|
+
ALTER TABLE sync_rules
|
|
63
|
+
ADD COLUMN storage_version integer NOT NULL DEFAULT 1
|
|
64
|
+
`.execute();
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
catch (e_1) {
|
|
68
|
+
env_1.error = e_1;
|
|
69
|
+
env_1.hasError = true;
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
const result_1 = __disposeResources(env_1);
|
|
73
|
+
if (result_1)
|
|
74
|
+
await result_1;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
export const down = async (context) => {
|
|
78
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
79
|
+
try {
|
|
80
|
+
const { service_context: { configuration } } = context;
|
|
81
|
+
const client = __addDisposableResource(env_2, openMigrationDB(configuration.storage), true);
|
|
82
|
+
await client.transaction(async (db) => {
|
|
83
|
+
const newRules = await db.sql `
|
|
84
|
+
SELECT
|
|
85
|
+
id,
|
|
86
|
+
storage_version
|
|
87
|
+
FROM
|
|
88
|
+
sync_rules
|
|
89
|
+
WHERE
|
|
90
|
+
storage_version > ${{ type: 'int4', value: storage.LEGACY_STORAGE_VERSION }}
|
|
91
|
+
`.rows();
|
|
92
|
+
if (newRules.length > 0) {
|
|
93
|
+
throw new Error(`Cannot revert migration due to newer storage versions in use: ${newRules.map((r) => `${r.id}: v${r.storage_version}`).join(', ')}`);
|
|
94
|
+
}
|
|
95
|
+
await db.sql `
|
|
96
|
+
ALTER TABLE sync_rules
|
|
97
|
+
DROP COLUMN storage_version
|
|
98
|
+
`.execute();
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
catch (e_2) {
|
|
102
|
+
env_2.error = e_2;
|
|
103
|
+
env_2.hasError = true;
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
const result_2 = __disposeResources(env_2);
|
|
107
|
+
if (result_2)
|
|
108
|
+
await result_2;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=1771232439485-storage-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1771232439485-storage-version.js","sourceRoot":"","sources":["../../../src/migrations/scripts/1771232439485-storage-version.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAc,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,CAAC,MAAM,EAAE,GAA0C,KAAK,EAAE,OAAO,EAAE,EAAE;;;QACzE,MAAM,EACJ,eAAe,EAAE,EAAE,aAAa,EAAE,EACnC,GAAG,OAAO,CAAC;QACZ,MAAY,MAAM,kCAAG,eAAe,CAAC,aAAa,CAAC,OAAO,CAAC,OAAA,CAAC;QAC5D,MAAM,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;YACpC,MAAM,EAAE,CAAC,GAAG,CAAA;;;KAGX,CAAC,OAAO,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;;;;;;;;;;;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAA0C,KAAK,EAAE,OAAO,EAAE,EAAE;;;QAC3E,MAAM,EACJ,eAAe,EAAE,EAAE,aAAa,EAAE,EACnC,GAAG,OAAO,CAAC;QACZ,MAAY,MAAM,kCAAG,eAAe,CAAC,aAAa,CAAC,OAAO,CAAC,OAAA,CAAC;QAC5D,MAAM,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;YACpC,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,GAAG,CAAA;;;;;;;4BAOL,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,sBAAsB,EAAE;KAC9E,CAAC,IAAI,EAA6D,CAAC;YAEpE,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACxB,MAAM,IAAI,KAAK,CACb,iEAAiE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACpI,CAAC;YACJ,CAAC;YAED,MAAM,EAAE,CAAC,GAAG,CAAA;;;KAGX,CAAC,OAAO,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;;;;;;;;;;;CACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const up = async (_context) => {
|
|
2
|
+
// No-op.
|
|
3
|
+
// Pending-delete support is now storage-version specific and initialized when v3 sync rules are deployed.
|
|
4
|
+
};
|
|
5
|
+
export const down = async (_context) => {
|
|
6
|
+
// No-op.
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=1771424826685-current-data-pending-deletes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1771424826685-current-data-pending-deletes.js","sourceRoot":"","sources":["../../../src/migrations/scripts/1771424826685-current-data-pending-deletes.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,EAAE,GAA0C,KAAK,EAAE,QAAQ,EAAE,EAAE;IAC1E,SAAS;IACT,0GAA0G;AAC5G,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAA0C,KAAK,EAAE,QAAQ,EAAE,EAAE;IAC5E,SAAS;AACX,CAAC,CAAC"}
|