@powersync/service-module-mysql 0.0.0-dev-20260203155513 → 0.0.0-dev-20260223082111
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 -7
- package/package.json +8 -8
- package/test/src/BinlogStreamUtils.ts +6 -2
- package/test/src/schema-changes.test.ts +51 -1
- package/test/tsconfig.json +3 -7
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
# @powersync/service-module-mysql
|
|
2
2
|
|
|
3
|
-
## 0.0.0-dev-
|
|
3
|
+
## 0.0.0-dev-20260223082111
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8bd83e8: Introduce storage versions.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [1c45667]
|
|
12
|
+
- Updated dependencies [8a4c34e]
|
|
13
|
+
- Updated dependencies [238fa85]
|
|
14
|
+
- Updated dependencies [8bd83e8]
|
|
15
|
+
- @powersync/service-sync-rules@0.0.0-dev-20260223082111
|
|
16
|
+
- @powersync/service-core@0.0.0-dev-20260223082111
|
|
17
|
+
- @powersync/lib-services-framework@0.0.0-dev-20260223082111
|
|
18
|
+
|
|
19
|
+
## 0.10.2
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [a04252d]
|
|
24
|
+
- @powersync/service-sync-rules@0.31.1
|
|
25
|
+
- @powersync/lib-services-framework@0.8.2
|
|
26
|
+
- @powersync/service-core@1.19.2
|
|
27
|
+
|
|
28
|
+
## 0.10.1
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [0e99ce0]
|
|
33
|
+
- Updated dependencies [479997b]
|
|
34
|
+
- Updated dependencies [d1c2228]
|
|
35
|
+
- Updated dependencies [1a1a4cc]
|
|
36
|
+
- @powersync/service-sync-rules@0.31.0
|
|
37
|
+
- @powersync/service-core@1.19.1
|
|
38
|
+
- @powersync/lib-services-framework@0.8.1
|
|
39
|
+
|
|
40
|
+
## 0.10.0
|
|
4
41
|
|
|
5
42
|
### Minor Changes
|
|
6
43
|
|
|
@@ -13,13 +50,12 @@
|
|
|
13
50
|
- Updated dependencies [781d0e3]
|
|
14
51
|
- Updated dependencies [e578245]
|
|
15
52
|
- Updated dependencies [3040079]
|
|
16
|
-
- Updated dependencies [
|
|
17
|
-
- Updated dependencies [3207fd2]
|
|
53
|
+
- Updated dependencies [3b2c512]
|
|
18
54
|
- Updated dependencies [a02cc58]
|
|
19
|
-
- @powersync/service-core@
|
|
20
|
-
- @powersync/service-sync-rules@0.
|
|
21
|
-
- @powersync/
|
|
22
|
-
- @powersync/
|
|
55
|
+
- @powersync/service-core@1.19.0
|
|
56
|
+
- @powersync/service-sync-rules@0.30.0
|
|
57
|
+
- @powersync/lib-services-framework@0.8.0
|
|
58
|
+
- @powersync/service-types@0.14.0
|
|
23
59
|
|
|
24
60
|
## 0.9.16
|
|
25
61
|
|
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-20260223082111",
|
|
6
6
|
"license": "FSL-1.1-ALv2",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"type": "module",
|
|
@@ -30,18 +30,18 @@
|
|
|
30
30
|
"ts-codec": "^1.3.0",
|
|
31
31
|
"uri-js": "^4.4.1",
|
|
32
32
|
"uuid": "^11.1.0",
|
|
33
|
-
"@powersync/lib-services-framework": "0.0.0-dev-
|
|
34
|
-
"@powersync/service-core": "0.0.0-dev-
|
|
35
|
-
"@powersync/service-sync-rules": "0.0.0-dev-
|
|
36
|
-
"@powersync/service-types": "0.
|
|
33
|
+
"@powersync/lib-services-framework": "0.0.0-dev-20260223082111",
|
|
34
|
+
"@powersync/service-core": "0.0.0-dev-20260223082111",
|
|
35
|
+
"@powersync/service-sync-rules": "0.0.0-dev-20260223082111",
|
|
36
|
+
"@powersync/service-types": "0.14.0",
|
|
37
37
|
"@powersync/service-jsonbig": "0.17.12"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/async": "^3.2.24",
|
|
41
41
|
"@types/semver": "^7.7.1",
|
|
42
|
-
"@powersync/service-core-tests": "0.0.0-dev-
|
|
43
|
-
"@powersync/service-module-mongodb-storage": "0.0.0-dev-
|
|
44
|
-
"@powersync/service-module-postgres-storage": "0.0.0-dev-
|
|
42
|
+
"@powersync/service-core-tests": "0.0.0-dev-20260223082111",
|
|
43
|
+
"@powersync/service-module-mongodb-storage": "0.0.0-dev-20260223082111",
|
|
44
|
+
"@powersync/service-module-postgres-storage": "0.0.0-dev-20260223082111"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsc -b",
|
|
@@ -7,11 +7,13 @@ import {
|
|
|
7
7
|
createCoreReplicationMetrics,
|
|
8
8
|
initializeCoreReplicationMetrics,
|
|
9
9
|
InternalOpId,
|
|
10
|
+
LEGACY_STORAGE_VERSION,
|
|
10
11
|
OplogEntry,
|
|
11
12
|
ProtocolOpId,
|
|
12
13
|
ReplicationCheckpoint,
|
|
13
14
|
storage,
|
|
14
|
-
SyncRulesBucketStorage
|
|
15
|
+
SyncRulesBucketStorage,
|
|
16
|
+
updateSyncRulesFromYaml
|
|
15
17
|
} from '@powersync/service-core';
|
|
16
18
|
import { METRICS_HELPER, test_utils } from '@powersync/service-core-tests';
|
|
17
19
|
import mysqlPromise from 'mysql2/promise';
|
|
@@ -68,7 +70,9 @@ export class BinlogStreamTestContext {
|
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
async updateSyncRules(content: string): Promise<SyncRulesBucketStorage> {
|
|
71
|
-
const syncRules = await this.factory.updateSyncRules(
|
|
73
|
+
const syncRules = await this.factory.updateSyncRules(
|
|
74
|
+
updateSyncRulesFromYaml(content, { validate: true, storageVersion: LEGACY_STORAGE_VERSION })
|
|
75
|
+
);
|
|
72
76
|
this.storage = this.factory.getInstance(syncRules);
|
|
73
77
|
return this.storage!;
|
|
74
78
|
}
|
|
@@ -63,6 +63,9 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
63
63
|
|
|
64
64
|
const data = await context.getBucketData('global[]');
|
|
65
65
|
|
|
66
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
67
|
+
expect(reduced.sort(compareIds)).toMatchObject([PUT_T3]);
|
|
68
|
+
|
|
66
69
|
// Initial inserts
|
|
67
70
|
expect(data.slice(0, 2)).toMatchObject([PUT_T1, PUT_T2]);
|
|
68
71
|
|
|
@@ -92,6 +95,9 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
92
95
|
|
|
93
96
|
const data = await context.getBucketData('global[]');
|
|
94
97
|
|
|
98
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
99
|
+
expect(reduced.sort(compareIds)).toMatchObject([PUT_T1]);
|
|
100
|
+
|
|
95
101
|
expect(data).toMatchObject([PUT_T1, PUT_T1]);
|
|
96
102
|
});
|
|
97
103
|
|
|
@@ -122,6 +128,9 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
122
128
|
|
|
123
129
|
const data = await context.getBucketData('global[]');
|
|
124
130
|
|
|
131
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
132
|
+
expect(reduced.sort(compareIds)).toMatchObject([PUT_T1, PUT_T2, PUT_T3]);
|
|
133
|
+
|
|
125
134
|
// Interestingly, the create with select triggers binlog row write events
|
|
126
135
|
expect(data).toMatchObject([
|
|
127
136
|
// From snapshot
|
|
@@ -172,6 +181,9 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
172
181
|
|
|
173
182
|
const data = await context.getBucketData('global[]');
|
|
174
183
|
|
|
184
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
185
|
+
expect(reduced.sort(compareIds)).toMatchObject([PUT_T1, PUT_T2]);
|
|
186
|
+
|
|
175
187
|
expect(data).toMatchObject([
|
|
176
188
|
// Snapshot insert
|
|
177
189
|
PUT_T1,
|
|
@@ -203,6 +215,12 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
203
215
|
|
|
204
216
|
const data = await context.getBucketData('global[]');
|
|
205
217
|
|
|
218
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
219
|
+
expect(reduced.sort(compareIds)).toMatchObject([
|
|
220
|
+
putOp('test_data2', { id: 't1', description: 'test1' }),
|
|
221
|
+
putOp('test_data2', { id: 't2', description: 'test2' })
|
|
222
|
+
]);
|
|
223
|
+
|
|
206
224
|
expect(data.slice(0, 2)).toMatchObject([
|
|
207
225
|
// Initial replication
|
|
208
226
|
putOp('test_data1', { id: 't1', description: 'test1' }),
|
|
@@ -238,6 +256,9 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
238
256
|
|
|
239
257
|
const data = await context.getBucketData('global[]');
|
|
240
258
|
|
|
259
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
260
|
+
expect(reduced.sort(compareIds)).toMatchObject([]);
|
|
261
|
+
|
|
241
262
|
expect(data).toMatchObject([
|
|
242
263
|
// Initial replication
|
|
243
264
|
PUT_T1,
|
|
@@ -264,6 +285,9 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
264
285
|
|
|
265
286
|
const data = await context.getBucketData('global[]');
|
|
266
287
|
|
|
288
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
289
|
+
expect(reduced.sort(compareIds)).toMatchObject([PUT_T1, PUT_T2]);
|
|
290
|
+
|
|
267
291
|
expect(data.slice(0, 2)).toMatchObject([
|
|
268
292
|
// Initial inserts
|
|
269
293
|
PUT_T1,
|
|
@@ -301,6 +325,12 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
301
325
|
|
|
302
326
|
const data = await context.getBucketData('global[]');
|
|
303
327
|
|
|
328
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
329
|
+
expect(reduced.sort(compareIds)).toMatchObject([
|
|
330
|
+
putOp('test_data', { id: 't1', description: 'test1', new_column: null }),
|
|
331
|
+
putOp('test_data', { id: 't2', description: 'test2', new_column: null })
|
|
332
|
+
]);
|
|
333
|
+
|
|
304
334
|
expect(data.slice(0, 2)).toMatchObject([
|
|
305
335
|
// Initial inserts
|
|
306
336
|
PUT_T1,
|
|
@@ -336,6 +366,8 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
336
366
|
await connectionManager.query(`INSERT INTO test_data(id, description) VALUES('t2','test2')`);
|
|
337
367
|
|
|
338
368
|
const data = await context.getBucketData('global[]');
|
|
369
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
370
|
+
expect(reduced.sort(compareIds)).toMatchObject([PUT_T1, PUT_T2]);
|
|
339
371
|
|
|
340
372
|
expect(data.slice(0, 2)).toMatchObject([
|
|
341
373
|
// Initial inserts
|
|
@@ -371,6 +403,8 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
371
403
|
await connectionManager.query(`INSERT INTO test_data(id, description) VALUES('t2','test2')`);
|
|
372
404
|
|
|
373
405
|
const data = await context.getBucketData('global[]');
|
|
406
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
407
|
+
expect(reduced.sort(compareIds)).toMatchObject([PUT_T1, PUT_T2]);
|
|
374
408
|
|
|
375
409
|
expect(data.slice(0, 2)).toMatchObject([
|
|
376
410
|
// Initial inserts
|
|
@@ -407,6 +441,8 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
407
441
|
await connectionManager.query(`INSERT INTO test_data(id, description) VALUES('t2','test2')`);
|
|
408
442
|
|
|
409
443
|
const data = await context.getBucketData('global[]');
|
|
444
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
445
|
+
expect(reduced.sort(compareIds)).toMatchObject([PUT_T1, PUT_T2]);
|
|
410
446
|
|
|
411
447
|
expect(data.slice(0, 2)).toMatchObject([
|
|
412
448
|
// Initial inserts
|
|
@@ -440,6 +476,8 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
440
476
|
await connectionManager.query(`INSERT INTO test_data(id, description) VALUES('t2','test2')`);
|
|
441
477
|
|
|
442
478
|
const data = await context.getBucketData('global[]');
|
|
479
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
480
|
+
expect(reduced.sort(compareIds)).toMatchObject([PUT_T1, PUT_T2]);
|
|
443
481
|
|
|
444
482
|
expect(data.slice(0, 2)).toMatchObject([
|
|
445
483
|
// Initial inserts
|
|
@@ -479,6 +517,8 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
479
517
|
await connectionManager.query(`INSERT INTO test_data(id, description) VALUES('t3','test3')`);
|
|
480
518
|
|
|
481
519
|
const data = await context.getBucketData('global[]');
|
|
520
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
521
|
+
expect(reduced.sort(compareIds)).toMatchObject([PUT_T1, PUT_T2, PUT_T3]);
|
|
482
522
|
|
|
483
523
|
expect(data.slice(0, 2)).toMatchObject([
|
|
484
524
|
// Initial snapshot
|
|
@@ -521,11 +561,15 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
521
561
|
);
|
|
522
562
|
|
|
523
563
|
const data = await context.getBucketData('global[]');
|
|
564
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
565
|
+
expect(reduced.sort(compareIds)).toMatchObject([
|
|
566
|
+
PUT_T1,
|
|
567
|
+
putOp('test_data', { id: 't2', description: 'test2', new_column: 'new_data' })
|
|
568
|
+
]);
|
|
524
569
|
|
|
525
570
|
expect(data.slice(0, 1)).toMatchObject([PUT_T1]);
|
|
526
571
|
|
|
527
572
|
expect(data.slice(1)).toMatchObject([
|
|
528
|
-
// Snapshot inserts
|
|
529
573
|
putOp('test_data', { id: 't2', description: 'test2', new_column: 'new_data' })
|
|
530
574
|
]);
|
|
531
575
|
});
|
|
@@ -548,6 +592,8 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
548
592
|
await connectionManager.query(`INSERT INTO test_data(id, description) VALUES('t3','test3')`);
|
|
549
593
|
|
|
550
594
|
const data = await context.getBucketData('global[]');
|
|
595
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
596
|
+
expect(reduced.sort(compareIds)).toMatchObject([PUT_T1, PUT_T2, PUT_T3]);
|
|
551
597
|
|
|
552
598
|
expect(data.slice(0, 2)).toMatchObject([
|
|
553
599
|
// Initial snapshot
|
|
@@ -578,6 +624,8 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
578
624
|
await connectionManager.query(`DROP TABLE test_data`);
|
|
579
625
|
|
|
580
626
|
const data = await context.getBucketData('global[]');
|
|
627
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
628
|
+
expect(reduced.sort(compareIds)).toMatchObject([]);
|
|
581
629
|
|
|
582
630
|
expect(data.slice(0, 2)).toMatchObject([
|
|
583
631
|
// Initial inserts
|
|
@@ -617,6 +665,8 @@ function defineTests(factory: storage.TestStorageFactory) {
|
|
|
617
665
|
await connectionManager.query(`DROP TABLE ${testTable}`);
|
|
618
666
|
|
|
619
667
|
const data = await context.getBucketData('multi_schema_test_data[]');
|
|
668
|
+
const reduced = test_utils.reduceBucket(data).slice(1);
|
|
669
|
+
expect(reduced.sort(compareIds)).toMatchObject([]);
|
|
620
670
|
|
|
621
671
|
expect(data.slice(0, 2)).toMatchObject([
|
|
622
672
|
// Initial inserts
|
package/test/tsconfig.json
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../../tsconfig.
|
|
2
|
+
"extends": "../../../tsconfig.tests.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"rootDir": "src",
|
|
5
4
|
"baseUrl": "./",
|
|
6
|
-
"noEmit": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"sourceMap": true,
|
|
10
5
|
"paths": {
|
|
11
6
|
"@/*": ["../../../packages/service-core/src/*"],
|
|
12
7
|
"@module/*": ["../src/*"],
|
|
13
8
|
"@core-tests/*": ["../../../packages/service-core/test/src/*"]
|
|
14
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"rootDir": "src"
|
|
15
11
|
},
|
|
16
12
|
"include": ["src"],
|
|
17
13
|
"references": [
|