@powersync/service-module-mongodb-storage 0.13.2 → 0.14.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 +30 -0
- package/dist/migrations/db/migrations/1770213298299-storage-version.d.ts +3 -0
- package/dist/migrations/db/migrations/1770213298299-storage-version.js +29 -0
- package/dist/migrations/db/migrations/1770213298299-storage-version.js.map +1 -0
- package/dist/storage/MongoBucketStorage.d.ts +7 -15
- package/dist/storage/MongoBucketStorage.js +13 -51
- package/dist/storage/MongoBucketStorage.js.map +1 -1
- package/dist/storage/implementation/MongoChecksums.d.ts +5 -2
- package/dist/storage/implementation/MongoChecksums.js +7 -4
- package/dist/storage/implementation/MongoChecksums.js.map +1 -1
- package/dist/storage/implementation/MongoCompactor.js +42 -17
- package/dist/storage/implementation/MongoCompactor.js.map +1 -1
- package/dist/storage/implementation/MongoPersistedSyncRulesContent.d.ts +2 -12
- package/dist/storage/implementation/MongoPersistedSyncRulesContent.js +24 -24
- package/dist/storage/implementation/MongoPersistedSyncRulesContent.js.map +1 -1
- package/dist/storage/implementation/MongoSyncBucketStorage.d.ts +4 -2
- package/dist/storage/implementation/MongoSyncBucketStorage.js +4 -1
- package/dist/storage/implementation/MongoSyncBucketStorage.js.map +1 -1
- package/dist/storage/implementation/models.d.ts +13 -1
- package/dist/storage/implementation/models.js +9 -1
- package/dist/storage/implementation/models.js.map +1 -1
- package/dist/storage/storage-index.d.ts +0 -1
- package/dist/storage/storage-index.js +0 -1
- package/dist/storage/storage-index.js.map +1 -1
- package/dist/utils/test-utils.d.ts +3 -4
- package/dist/utils/test-utils.js +2 -2
- package/dist/utils/test-utils.js.map +1 -1
- package/package.json +7 -7
- package/src/migrations/db/migrations/1770213298299-storage-version.ts +44 -0
- package/src/storage/MongoBucketStorage.ts +21 -59
- package/src/storage/implementation/MongoChecksums.ts +14 -6
- package/src/storage/implementation/MongoCompactor.ts +49 -19
- package/src/storage/implementation/MongoPersistedSyncRulesContent.ts +26 -32
- package/src/storage/implementation/MongoSyncBucketStorage.ts +16 -5
- package/src/storage/implementation/models.ts +25 -1
- package/src/storage/storage-index.ts +0 -1
- package/src/utils/test-utils.ts +3 -4
- package/test/src/__snapshots__/storage_sync.test.ts.snap +1116 -21
- package/test/src/storage_compacting.test.ts +28 -22
- package/test/src/storage_sync.test.ts +27 -14
- package/test/src/util.ts +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/storage/implementation/MongoPersistedSyncRules.d.ts +0 -10
- package/dist/storage/implementation/MongoPersistedSyncRules.js +0 -17
- package/dist/storage/implementation/MongoPersistedSyncRules.js.map +0 -1
- package/src/storage/implementation/MongoPersistedSyncRules.ts +0 -20
- package/test/src/__snapshots__/storage.test.ts.snap +0 -25
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { SyncConfigWithErrors, HydratedSyncRules } from '@powersync/service-sync-rules';
|
|
2
|
-
import { storage } from '@powersync/service-core';
|
|
3
|
-
export declare class MongoPersistedSyncRules implements storage.PersistedSyncRules {
|
|
4
|
-
readonly id: number;
|
|
5
|
-
readonly sync_rules: SyncConfigWithErrors;
|
|
6
|
-
readonly checkpoint_lsn: string | null;
|
|
7
|
-
readonly slot_name: string;
|
|
8
|
-
constructor(id: number, sync_rules: SyncConfigWithErrors, checkpoint_lsn: string | null, slot_name: string | null);
|
|
9
|
-
hydratedSyncRules(): HydratedSyncRules;
|
|
10
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { versionedHydrationState } from '@powersync/service-sync-rules';
|
|
2
|
-
export class MongoPersistedSyncRules {
|
|
3
|
-
id;
|
|
4
|
-
sync_rules;
|
|
5
|
-
checkpoint_lsn;
|
|
6
|
-
slot_name;
|
|
7
|
-
constructor(id, sync_rules, checkpoint_lsn, slot_name) {
|
|
8
|
-
this.id = id;
|
|
9
|
-
this.sync_rules = sync_rules;
|
|
10
|
-
this.checkpoint_lsn = checkpoint_lsn;
|
|
11
|
-
this.slot_name = slot_name ?? `powersync_${id}`;
|
|
12
|
-
}
|
|
13
|
-
hydratedSyncRules() {
|
|
14
|
-
return this.sync_rules.config.hydrate({ hydrationState: versionedHydrationState(this.id) });
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=MongoPersistedSyncRules.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MongoPersistedSyncRules.js","sourceRoot":"","sources":["../../../src/storage/implementation/MongoPersistedSyncRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAIjH,MAAM,OAAO,uBAAuB;IAIhB;IACA;IACA;IALF,SAAS,CAAS;IAElC,YACkB,EAAU,EACV,UAAgC,EAChC,cAA6B,EAC7C,SAAwB;QAHR,OAAE,GAAF,EAAE,CAAQ;QACV,eAAU,GAAV,UAAU,CAAsB;QAChC,mBAAc,GAAd,cAAc,CAAe;QAG7C,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,aAAa,EAAE,EAAE,CAAC;IAClD,CAAC;IAED,iBAAiB;QACf,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,cAAc,EAAE,uBAAuB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC9F,CAAC;CACF"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { SyncConfigWithErrors, HydratedSyncRules, versionedHydrationState } from '@powersync/service-sync-rules';
|
|
2
|
-
|
|
3
|
-
import { storage } from '@powersync/service-core';
|
|
4
|
-
|
|
5
|
-
export class MongoPersistedSyncRules implements storage.PersistedSyncRules {
|
|
6
|
-
public readonly slot_name: string;
|
|
7
|
-
|
|
8
|
-
constructor(
|
|
9
|
-
public readonly id: number,
|
|
10
|
-
public readonly sync_rules: SyncConfigWithErrors,
|
|
11
|
-
public readonly checkpoint_lsn: string | null,
|
|
12
|
-
slot_name: string | null
|
|
13
|
-
) {
|
|
14
|
-
this.slot_name = slot_name ?? `powersync_${id}`;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
hydratedSyncRules(): HydratedSyncRules {
|
|
18
|
-
return this.sync_rules.config.hydrate({ hydrationState: versionedHydrationState(this.id) });
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
-
|
|
3
|
-
exports[`Mongo Sync Bucket Storage - Data > empty storage metrics 1`] = `
|
|
4
|
-
{
|
|
5
|
-
"operations_size_bytes": 0,
|
|
6
|
-
"parameters_size_bytes": 0,
|
|
7
|
-
"replication_size_bytes": 0,
|
|
8
|
-
}
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
exports[`Mongo Sync Bucket Storage - split buckets > empty storage metrics 1`] = `
|
|
12
|
-
{
|
|
13
|
-
"operations_size_bytes": 0,
|
|
14
|
-
"parameters_size_bytes": 0,
|
|
15
|
-
"replication_size_bytes": 0,
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
exports[`Mongo Sync Bucket Storage - split operations > empty storage metrics 1`] = `
|
|
20
|
-
{
|
|
21
|
-
"operations_size_bytes": 0,
|
|
22
|
-
"parameters_size_bytes": 0,
|
|
23
|
-
"replication_size_bytes": 0,
|
|
24
|
-
}
|
|
25
|
-
`;
|