@powersync/service-module-mysql 0.0.0-dev-20250102111825 → 0.0.0-dev-20250108073049
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 +6 -5
- package/package.json +7 -7
- package/test/src/BinLogStream.test.ts +3 -3
- package/test/src/BinlogStreamUtils.ts +3 -2
- package/test/src/setup.ts +3 -1
- package/test/src/util.ts +4 -37
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
# @powersync/service-module-mysql
|
|
2
2
|
|
|
3
|
-
## 0.0.0-dev-
|
|
3
|
+
## 0.0.0-dev-20250108073049
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- Updated dependencies [697d44b]
|
|
8
8
|
- Updated dependencies [697d44b]
|
|
9
|
+
- Updated dependencies [48320b5]
|
|
9
10
|
- Updated dependencies [697d44b]
|
|
10
|
-
- @powersync/service-core@0.0.0-dev-
|
|
11
|
-
- @powersync/lib-services-framework@0.0.0-dev-
|
|
12
|
-
- @powersync/service-sync-rules@0.0.0-dev-
|
|
13
|
-
- @powersync/service-types@0.0.0-dev-
|
|
11
|
+
- @powersync/service-core@0.0.0-dev-20250108073049
|
|
12
|
+
- @powersync/lib-services-framework@0.0.0-dev-20250108073049
|
|
13
|
+
- @powersync/service-sync-rules@0.0.0-dev-20250108073049
|
|
14
|
+
- @powersync/service-types@0.0.0-dev-20250108073049
|
|
14
15
|
|
|
15
16
|
## 0.1.7
|
|
16
17
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@powersync/service-module-mysql",
|
|
3
3
|
"repository": "https://github.com/powersync-ja/powersync-service",
|
|
4
4
|
"types": "dist/index.d.ts",
|
|
5
|
-
"version": "0.0.0-dev-
|
|
5
|
+
"version": "0.0.0-dev-20250108073049",
|
|
6
6
|
"license": "FSL-1.1-Apache-2.0",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"type": "module",
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"ts-codec": "^1.3.0",
|
|
30
30
|
"uri-js": "^4.4.1",
|
|
31
31
|
"uuid": "^9.0.1",
|
|
32
|
-
"@powersync/lib-services-framework": "0.0.0-dev-
|
|
33
|
-
"@powersync/service-core": "0.0.0-dev-
|
|
34
|
-
"@powersync/service-sync-rules": "0.0.0-dev-
|
|
35
|
-
"@powersync/service-types": "0.0.0-dev-
|
|
32
|
+
"@powersync/lib-services-framework": "0.0.0-dev-20250108073049",
|
|
33
|
+
"@powersync/service-core": "0.0.0-dev-20250108073049",
|
|
34
|
+
"@powersync/service-sync-rules": "0.0.0-dev-20250108073049",
|
|
35
|
+
"@powersync/service-types": "0.0.0-dev-20250108073049",
|
|
36
36
|
"@powersync/service-jsonbig": "0.17.10"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/semver": "^7.5.4",
|
|
40
40
|
"@types/async": "^3.2.24",
|
|
41
41
|
"@types/uuid": "^9.0.4",
|
|
42
|
-
"@powersync/service-core-tests": "0.0.0-dev-
|
|
43
|
-
"@powersync/service-module-mongodb": "0.0.0-dev-
|
|
42
|
+
"@powersync/service-core-tests": "0.0.0-dev-20250108073049",
|
|
43
|
+
"@powersync/service-module-mongodb-storage": "0.0.0-dev-20250108073049"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "tsc -b",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Metrics } from '@powersync/service-core';
|
|
2
|
-
import { putOp, removeOp
|
|
1
|
+
import { Metrics, storage } from '@powersync/service-core';
|
|
2
|
+
import { putOp, removeOp } from '@powersync/service-core-tests';
|
|
3
3
|
import { v4 as uuid } from 'uuid';
|
|
4
4
|
import { describe, expect, test } from 'vitest';
|
|
5
5
|
import { BinlogStreamTestContext } from './BinlogStreamUtils.js';
|
|
@@ -20,7 +20,7 @@ describe(
|
|
|
20
20
|
{ timeout: 20_000 }
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
function defineBinlogStreamTests(factory:
|
|
23
|
+
function defineBinlogStreamTests(factory: storage.TestStorageFactory) {
|
|
24
24
|
test('Replicate basic values', async () => {
|
|
25
25
|
await using context = await BinlogStreamTestContext.open(factory);
|
|
26
26
|
const { connectionManager } = context;
|
|
@@ -7,9 +7,10 @@ import {
|
|
|
7
7
|
BucketStorageFactory,
|
|
8
8
|
OpId,
|
|
9
9
|
OplogEntry,
|
|
10
|
+
storage,
|
|
10
11
|
SyncRulesBucketStorage
|
|
11
12
|
} from '@powersync/service-core';
|
|
12
|
-
import {
|
|
13
|
+
import { test_utils } from '@powersync/service-core-tests';
|
|
13
14
|
import mysqlPromise from 'mysql2/promise';
|
|
14
15
|
import { clearTestDb, TEST_CONNECTION_OPTIONS } from './util.js';
|
|
15
16
|
|
|
@@ -27,7 +28,7 @@ export class BinlogStreamTestContext {
|
|
|
27
28
|
public storage?: SyncRulesBucketStorage;
|
|
28
29
|
private replicationDone = false;
|
|
29
30
|
|
|
30
|
-
static async open(factory:
|
|
31
|
+
static async open(factory: storage.TestStorageFactory, options?: { doNotClear?: boolean }) {
|
|
31
32
|
const f = await factory({ doNotClear: options?.doNotClear });
|
|
32
33
|
const connectionManager = new MySQLConnectionManager(TEST_CONNECTION_OPTIONS, {});
|
|
33
34
|
|
package/test/src/setup.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { container } from '@powersync/lib-services-framework';
|
|
2
|
+
import { test_utils } from '@powersync/service-core-tests';
|
|
2
3
|
import { beforeAll } from 'vitest';
|
|
3
4
|
|
|
4
|
-
beforeAll(() => {
|
|
5
|
+
beforeAll(async () => {
|
|
5
6
|
// Executes for every test file
|
|
6
7
|
container.registerDefaults();
|
|
8
|
+
await test_utils.initMetrics();
|
|
7
9
|
});
|
package/test/src/util.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as types from '@module/types/types.js';
|
|
2
2
|
import { getMySQLVersion, isVersionAtLeast } from '@module/utils/mysql-utils.js';
|
|
3
|
-
import
|
|
4
|
-
import { test_utils } from '@powersync/service-core-tests';
|
|
5
|
-
import * as mongo_module from '@powersync/service-module-mongodb';
|
|
3
|
+
import * as mongo_storage from '@powersync/service-module-mongodb-storage';
|
|
6
4
|
import mysqlPromise from 'mysql2/promise';
|
|
7
5
|
import { env } from './env.js';
|
|
8
6
|
|
|
@@ -13,41 +11,10 @@ export const TEST_CONNECTION_OPTIONS = types.normalizeConnectionConfig({
|
|
|
13
11
|
uri: TEST_URI
|
|
14
12
|
});
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
powersync_instance_id: 'test',
|
|
20
|
-
internal_metrics_endpoint: 'unused.for.tests.com'
|
|
14
|
+
export const INITIALIZED_MONGO_STORAGE_FACTORY = mongo_storage.MongoTestStorageFactoryGenerator({
|
|
15
|
+
url: env.MONGO_TEST_URL,
|
|
16
|
+
isCI: env.CI
|
|
21
17
|
});
|
|
22
|
-
Metrics.getInstance().resetCounters();
|
|
23
|
-
|
|
24
|
-
export type StorageFactory = () => Promise<BucketStorageFactory>;
|
|
25
|
-
|
|
26
|
-
export const INITIALIZED_MONGO_STORAGE_FACTORY: StorageFactory = async (options?: test_utils.StorageOptions) => {
|
|
27
|
-
const db = await connectMongo();
|
|
28
|
-
|
|
29
|
-
// None of the tests insert data into this collection, so it was never created
|
|
30
|
-
if (!(await db.db.listCollections({ name: db.bucket_parameters.collectionName }).hasNext())) {
|
|
31
|
-
await db.db.createCollection('bucket_parameters');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (!options?.doNotClear) {
|
|
35
|
-
await db.clear();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return new mongo_module.storage.MongoBucketStorage(db, { slot_name_prefix: 'test_' });
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export async function connectMongo() {
|
|
42
|
-
// Short timeout for tests, to fail fast when the server is not available.
|
|
43
|
-
// Slightly longer timeouts for CI, to avoid arbitrary test failures
|
|
44
|
-
const client = mongo_module.storage.createMongoClient(env.MONGO_TEST_URL, {
|
|
45
|
-
connectTimeoutMS: env.CI ? 15_000 : 5_000,
|
|
46
|
-
socketTimeoutMS: env.CI ? 15_000 : 5_000,
|
|
47
|
-
serverSelectionTimeoutMS: env.CI ? 15_000 : 2_500
|
|
48
|
-
});
|
|
49
|
-
return new mongo_module.storage.PowerSyncMongo(client);
|
|
50
|
-
}
|
|
51
18
|
|
|
52
19
|
export async function clearTestDb(connection: mysqlPromise.Connection) {
|
|
53
20
|
const version = await getMySQLVersion(connection);
|