@powersync/service-module-mongodb 0.14.0 → 0.15.1
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 +43 -0
- package/dist/api/MongoRouteAPIAdapter.js +2 -2
- package/dist/api/MongoRouteAPIAdapter.js.map +1 -1
- package/dist/replication/ChangeStream.js +13 -8
- package/dist/replication/ChangeStream.js.map +1 -1
- package/package.json +8 -8
- package/src/api/MongoRouteAPIAdapter.ts +2 -2
- package/src/replication/ChangeStream.ts +14 -8
- package/test/src/change_stream_utils.ts +36 -27
- package/test/src/env.ts +1 -1
- package/test/src/resume.test.ts +3 -2
- package/test/src/util.ts +6 -6
- package/tsconfig.tsbuildinfo +1 -1
package/test/src/resume.test.ts
CHANGED
|
@@ -61,8 +61,9 @@ function defineResumeTest({ factory: factoryGenerator, storageVersion }: Storage
|
|
|
61
61
|
context2.storage = factory.getInstance(activeContent!);
|
|
62
62
|
|
|
63
63
|
// If this test times out, it likely didn't throw the expected error here.
|
|
64
|
-
const
|
|
64
|
+
const result = await context2.startStreaming();
|
|
65
65
|
// The ChangeStreamReplicationJob will detect this and throw a ChangeStreamInvalidatedError
|
|
66
|
-
expect(
|
|
66
|
+
expect(result.status).toEqual('rejected');
|
|
67
|
+
expect((result as PromiseRejectedResult).reason).toBeInstanceOf(ChangeStreamInvalidatedError);
|
|
67
68
|
});
|
|
68
69
|
}
|
package/test/src/util.ts
CHANGED
|
@@ -5,8 +5,8 @@ import * as postgres_storage from '@powersync/service-module-postgres-storage';
|
|
|
5
5
|
import * as types from '@module/types/types.js';
|
|
6
6
|
import {
|
|
7
7
|
BSON_DESERIALIZE_DATA_OPTIONS,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
SUPPORTED_STORAGE_VERSIONS,
|
|
9
|
+
TestStorageConfig,
|
|
10
10
|
TestStorageFactory
|
|
11
11
|
} from '@powersync/service-core';
|
|
12
12
|
import { describe, TestOptions } from 'vitest';
|
|
@@ -24,11 +24,11 @@ export const INITIALIZED_MONGO_STORAGE_FACTORY = mongo_storage.test_utils.mongoT
|
|
|
24
24
|
isCI: env.CI
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
export const INITIALIZED_POSTGRES_STORAGE_FACTORY = postgres_storage.test_utils.
|
|
27
|
+
export const INITIALIZED_POSTGRES_STORAGE_FACTORY = postgres_storage.test_utils.postgresTestSetup({
|
|
28
28
|
url: env.PG_STORAGE_TEST_URL
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
const TEST_STORAGE_VERSIONS =
|
|
31
|
+
export const TEST_STORAGE_VERSIONS = SUPPORTED_STORAGE_VERSIONS;
|
|
32
32
|
|
|
33
33
|
export interface StorageVersionTestContext {
|
|
34
34
|
factory: TestStorageFactory;
|
|
@@ -36,12 +36,12 @@ export interface StorageVersionTestContext {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export function describeWithStorage(options: TestOptions, fn: (context: StorageVersionTestContext) => void) {
|
|
39
|
-
const describeFactory = (storageName: string,
|
|
39
|
+
const describeFactory = (storageName: string, config: TestStorageConfig) => {
|
|
40
40
|
describe(`${storageName} storage`, options, function () {
|
|
41
41
|
for (const storageVersion of TEST_STORAGE_VERSIONS) {
|
|
42
42
|
describe(`storage v${storageVersion}`, function () {
|
|
43
43
|
fn({
|
|
44
|
-
factory,
|
|
44
|
+
factory: config.factory,
|
|
45
45
|
storageVersion
|
|
46
46
|
});
|
|
47
47
|
});
|