@powersync/service-core 0.3.0 → 0.4.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 +27 -0
- package/dist/auth/JwtPayload.d.ts +6 -2
- package/dist/auth/KeyStore.js +1 -7
- package/dist/auth/KeyStore.js.map +1 -1
- package/dist/entry/commands/migrate-action.js +12 -4
- package/dist/entry/commands/migrate-action.js.map +1 -1
- package/dist/migrations/migrations.js +8 -0
- package/dist/migrations/migrations.js.map +1 -1
- package/dist/routes/endpoints/socket-route.js +5 -5
- package/dist/routes/endpoints/socket-route.js.map +1 -1
- package/dist/routes/endpoints/sync-stream.d.ts +1 -1
- package/dist/routes/endpoints/sync-stream.js +4 -4
- package/dist/routes/endpoints/sync-stream.js.map +1 -1
- package/dist/routes/route-register.js +1 -0
- package/dist/routes/route-register.js.map +1 -1
- package/dist/sync/sync.d.ts +2 -2
- package/dist/sync/sync.js +2 -2
- package/dist/sync/sync.js.map +1 -1
- package/package.json +4 -4
- package/src/auth/JwtPayload.ts +6 -2
- package/src/auth/KeyStore.ts +1 -7
- package/src/entry/commands/migrate-action.ts +12 -4
- package/src/migrations/migrations.ts +8 -0
- package/src/routes/endpoints/socket-route.ts +6 -9
- package/src/routes/endpoints/sync-stream.ts +4 -7
- package/src/routes/route-register.ts +1 -0
- package/src/sync/sync.ts +5 -5
- package/test/src/data_storage.test.ts +4 -19
- package/test/src/sync.test.ts +6 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/test/src/sql_functions.test.ts +0 -254
- package/test/src/sql_operators.test.ts +0 -132
- package/test/src/sync_rules.test.ts +0 -1053
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SqlSyncRules } from '@powersync/service-sync-rules';
|
|
1
|
+
import { RequestParameters, SqlSyncRules } from '@powersync/service-sync-rules';
|
|
2
2
|
import * as bson from 'bson';
|
|
3
3
|
import { describe, expect, test } from 'vitest';
|
|
4
4
|
import { SourceTable } from '../../src/storage/SourceTable.js';
|
|
@@ -289,12 +289,7 @@ bucket_definitions:
|
|
|
289
289
|
|
|
290
290
|
const checkpoint = result!.flushed_op;
|
|
291
291
|
|
|
292
|
-
const parameters = {
|
|
293
|
-
token_parameters: {
|
|
294
|
-
user_id: 'u1'
|
|
295
|
-
},
|
|
296
|
-
user_parameters: {}
|
|
297
|
-
};
|
|
292
|
+
const parameters = new RequestParameters({ sub: 'u1' }, {});
|
|
298
293
|
|
|
299
294
|
const q1 = sync_rules.bucket_descriptors[0].parameter_queries[0];
|
|
300
295
|
|
|
@@ -358,12 +353,7 @@ bucket_definitions:
|
|
|
358
353
|
|
|
359
354
|
const checkpoint = result!.flushed_op;
|
|
360
355
|
|
|
361
|
-
const parameters = {
|
|
362
|
-
token_parameters: {
|
|
363
|
-
user_id: 'unknown'
|
|
364
|
-
},
|
|
365
|
-
user_parameters: {}
|
|
366
|
-
};
|
|
356
|
+
const parameters = new RequestParameters({ sub: 'unknown' }, {});
|
|
367
357
|
|
|
368
358
|
const q1 = sync_rules.bucket_descriptors[0].parameter_queries[0];
|
|
369
359
|
|
|
@@ -442,12 +432,7 @@ bucket_definitions:
|
|
|
442
432
|
|
|
443
433
|
const checkpoint = result!.flushed_op;
|
|
444
434
|
|
|
445
|
-
const parameters = {
|
|
446
|
-
token_parameters: {
|
|
447
|
-
user_id: 'u1'
|
|
448
|
-
},
|
|
449
|
-
user_parameters: {}
|
|
450
|
-
};
|
|
435
|
+
const parameters = new RequestParameters({ sub: 'u1' }, {});
|
|
451
436
|
|
|
452
437
|
// Test intermediate values - could be moved to sync_rules.test.ts
|
|
453
438
|
const q1 = sync_rules.bucket_descriptors[0].parameter_queries[0];
|
package/test/src/sync.test.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { JSONBig } from '@powersync/service-jsonbig';
|
|
|
8
8
|
import { streamResponse } from '../../src/sync/sync.js';
|
|
9
9
|
import * as timers from 'timers/promises';
|
|
10
10
|
import { lsnMakeComparable } from '@powersync/service-jpgwire';
|
|
11
|
+
import { RequestParameters } from '@powersync/service-sync-rules';
|
|
11
12
|
|
|
12
13
|
describe('sync - mongodb', function () {
|
|
13
14
|
defineTests(MONGO_STORAGE_FACTORY);
|
|
@@ -77,7 +78,7 @@ function defineTests(factory: StorageFactory) {
|
|
|
77
78
|
include_checksum: true,
|
|
78
79
|
raw_data: true
|
|
79
80
|
},
|
|
80
|
-
syncParams: {
|
|
81
|
+
syncParams: new RequestParameters({ sub: '' }, {}),
|
|
81
82
|
token: { exp: Date.now() / 1000 + 10 } as any
|
|
82
83
|
});
|
|
83
84
|
|
|
@@ -117,7 +118,7 @@ function defineTests(factory: StorageFactory) {
|
|
|
117
118
|
include_checksum: true,
|
|
118
119
|
raw_data: false
|
|
119
120
|
},
|
|
120
|
-
syncParams: {
|
|
121
|
+
syncParams: new RequestParameters({ sub: '' }, {}),
|
|
121
122
|
token: { exp: Date.now() / 1000 + 10 } as any
|
|
122
123
|
});
|
|
123
124
|
|
|
@@ -145,7 +146,7 @@ function defineTests(factory: StorageFactory) {
|
|
|
145
146
|
include_checksum: true,
|
|
146
147
|
raw_data: true
|
|
147
148
|
},
|
|
148
|
-
syncParams: {
|
|
149
|
+
syncParams: new RequestParameters({ sub: '' }, {}),
|
|
149
150
|
token: { exp: 0 } as any
|
|
150
151
|
});
|
|
151
152
|
|
|
@@ -171,7 +172,7 @@ function defineTests(factory: StorageFactory) {
|
|
|
171
172
|
include_checksum: true,
|
|
172
173
|
raw_data: true
|
|
173
174
|
},
|
|
174
|
-
syncParams: {
|
|
175
|
+
syncParams: new RequestParameters({ sub: '' }, {}),
|
|
175
176
|
token: { exp: Date.now() / 1000 + 10 } as any
|
|
176
177
|
});
|
|
177
178
|
const iter = stream[Symbol.asyncIterator]();
|
|
@@ -231,7 +232,7 @@ function defineTests(factory: StorageFactory) {
|
|
|
231
232
|
include_checksum: true,
|
|
232
233
|
raw_data: true
|
|
233
234
|
},
|
|
234
|
-
syncParams: {
|
|
235
|
+
syncParams: new RequestParameters({ sub: '' }, {}),
|
|
235
236
|
token: { exp: exp } as any
|
|
236
237
|
});
|
|
237
238
|
const iter = stream[Symbol.asyncIterator]();
|