@powersync/service-core 0.16.0 → 0.17.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
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @powersync/service-core
|
|
2
2
|
|
|
3
|
+
## 0.17.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 23fb49f: Added the ability to skip creating empty sync checkpoints if no changes were present in a batch.
|
|
8
|
+
|
|
9
|
+
## 0.16.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [5043a82]
|
|
14
|
+
- @powersync/service-sync-rules@0.23.3
|
|
15
|
+
|
|
3
16
|
## 0.16.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -44,6 +44,19 @@ export interface BucketStorageFactoryListener extends DisposableListener {
|
|
|
44
44
|
syncStorageCreated: (storage: SyncRulesBucketStorage) => void;
|
|
45
45
|
replicationEvent: (event: ReplicationEventPayload) => void;
|
|
46
46
|
}
|
|
47
|
+
export interface BucketStorageSystemIdentifier {
|
|
48
|
+
/**
|
|
49
|
+
* A unique identifier for the system used for storage.
|
|
50
|
+
* For Postgres this can be the cluster `system_identifier` and database name.
|
|
51
|
+
* For MongoDB this can be the replica set name.
|
|
52
|
+
*/
|
|
53
|
+
id: string;
|
|
54
|
+
/**
|
|
55
|
+
* A unique type for the storage implementation.
|
|
56
|
+
* e.g. `mongodb`, `postgresql`.
|
|
57
|
+
*/
|
|
58
|
+
type: string;
|
|
59
|
+
}
|
|
47
60
|
export interface BucketStorageFactory extends AsyncDisposableObserverClient<BucketStorageFactoryListener> {
|
|
48
61
|
/**
|
|
49
62
|
* Update sync rules from configuration, if changed.
|
|
@@ -117,6 +130,10 @@ export interface BucketStorageFactory extends AsyncDisposableObserverClient<Buck
|
|
|
117
130
|
* Get the unique identifier for this instance of Powersync
|
|
118
131
|
*/
|
|
119
132
|
getPowerSyncInstanceId(): Promise<string>;
|
|
133
|
+
/**
|
|
134
|
+
* Get a unique identifier for the system used for storage.
|
|
135
|
+
*/
|
|
136
|
+
getSystemIdentifier(): Promise<BucketStorageSystemIdentifier>;
|
|
120
137
|
}
|
|
121
138
|
export interface ReplicationCheckpoint {
|
|
122
139
|
readonly checkpoint: util.OpId;
|
|
@@ -288,6 +305,15 @@ export interface FlushedResult {
|
|
|
288
305
|
export interface BucketBatchStorageListener extends DisposableListener {
|
|
289
306
|
replicationEvent: (payload: ReplicationEventPayload) => void;
|
|
290
307
|
}
|
|
308
|
+
export interface BucketBatchCommitOptions {
|
|
309
|
+
/**
|
|
310
|
+
* Creates a new checkpoint even if there were no persisted operations.
|
|
311
|
+
* Defaults to true.
|
|
312
|
+
*/
|
|
313
|
+
createEmptyCheckpoints?: boolean;
|
|
314
|
+
}
|
|
315
|
+
export type ResolvedBucketBatchCommitOptions = Required<BucketBatchCommitOptions>;
|
|
316
|
+
export declare const DEFAULT_BUCKET_BATCH_COMMIT_OPTIONS: ResolvedBucketBatchCommitOptions;
|
|
291
317
|
export interface BucketStorageBatch extends DisposableObserverClient<BucketBatchStorageListener> {
|
|
292
318
|
/**
|
|
293
319
|
* Save an op, and potentially flush.
|
|
@@ -315,11 +341,11 @@ export interface BucketStorageBatch extends DisposableObserverClient<BucketBatch
|
|
|
315
341
|
*/
|
|
316
342
|
flush(): Promise<FlushedResult | null>;
|
|
317
343
|
/**
|
|
318
|
-
* Flush and commit any saved ops. This creates a new checkpoint.
|
|
344
|
+
* Flush and commit any saved ops. This creates a new checkpoint by default.
|
|
319
345
|
*
|
|
320
346
|
* Only call this after a transaction.
|
|
321
347
|
*/
|
|
322
|
-
commit(lsn: string): Promise<boolean>;
|
|
348
|
+
commit(lsn: string, options?: BucketBatchCommitOptions): Promise<boolean>;
|
|
323
349
|
/**
|
|
324
350
|
* Advance the checkpoint LSN position, without any associated op.
|
|
325
351
|
*
|
|
@@ -26,6 +26,9 @@ export var SyncRuleState;
|
|
|
26
26
|
})(SyncRuleState || (SyncRuleState = {}));
|
|
27
27
|
export const DEFAULT_DOCUMENT_BATCH_LIMIT = 1000;
|
|
28
28
|
export const DEFAULT_DOCUMENT_CHUNK_LIMIT_BYTES = 1 * 1024 * 1024;
|
|
29
|
+
export const DEFAULT_BUCKET_BATCH_COMMIT_OPTIONS = {
|
|
30
|
+
createEmptyCheckpoints: true
|
|
31
|
+
};
|
|
29
32
|
export var SaveOperationTag;
|
|
30
33
|
(function (SaveOperationTag) {
|
|
31
34
|
SaveOperationTag["INSERT"] = "insert";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BucketStorage.js","sourceRoot":"","sources":["../../src/storage/BucketStorage.ts"],"names":[],"mappings":"AA+BA,MAAM,CAAN,IAAY,aAyBX;AAzBD,WAAY,aAAa;IACvB;;;;;OAKG;IACH,0CAAyB,CAAA;IAEzB;;;;OAIG;IACH,kCAAiB,CAAA;IACjB;;;OAGG;IACH,8BAAa,CAAA;IACb;;;OAGG;IACH,0CAAyB,CAAA;AAC3B,CAAC,EAzBW,aAAa,KAAb,aAAa,QAyBxB;
|
|
1
|
+
{"version":3,"file":"BucketStorage.js","sourceRoot":"","sources":["../../src/storage/BucketStorage.ts"],"names":[],"mappings":"AA+BA,MAAM,CAAN,IAAY,aAyBX;AAzBD,WAAY,aAAa;IACvB;;;;;OAKG;IACH,0CAAyB,CAAA;IAEzB;;;;OAIG;IACH,kCAAiB,CAAA;IACjB;;;OAGG;IACH,8BAAa,CAAA;IACb;;;OAGG;IACH,0CAAyB,CAAA;AAC3B,CAAC,EAzBW,aAAa,KAAb,aAAa,QAyBxB;AAyLD,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC;AACjD,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AA4JlE,MAAM,CAAC,MAAM,mCAAmC,GAAqC;IACnF,sBAAsB,EAAE,IAAI;CAC7B,CAAC;AAgFF,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;AACnB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B;AA4CD,MAAM,UAAU,UAAU,CAAC,MAA0B,EAAE,SAA6B;IAClF,MAAM,SAAS,GAAuB,EAAE,CAAC;IACzC,KAAK,IAAI,GAAG,IAAI,MAAM,EAAE,CAAC;QACvB,IAAI,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,WAAW,EAAE,CAAC;YACtC,SAAS,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QAClC,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.
|
|
8
|
+
"version": "0.17.0",
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"license": "FSL-1.1-Apache-2.0",
|
|
11
11
|
"type": "module",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@powersync/lib-services-framework": "0.5.0",
|
|
36
36
|
"@powersync/service-jsonbig": "0.17.10",
|
|
37
37
|
"@powersync/service-rsocket-router": "0.0.17",
|
|
38
|
-
"@powersync/service-sync-rules": "0.23.
|
|
38
|
+
"@powersync/service-sync-rules": "0.23.3",
|
|
39
39
|
"@powersync/service-types": "0.7.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
@@ -60,6 +60,20 @@ export interface BucketStorageFactoryListener extends DisposableListener {
|
|
|
60
60
|
replicationEvent: (event: ReplicationEventPayload) => void;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
export interface BucketStorageSystemIdentifier {
|
|
64
|
+
/**
|
|
65
|
+
* A unique identifier for the system used for storage.
|
|
66
|
+
* For Postgres this can be the cluster `system_identifier` and database name.
|
|
67
|
+
* For MongoDB this can be the replica set name.
|
|
68
|
+
*/
|
|
69
|
+
id: string;
|
|
70
|
+
/**
|
|
71
|
+
* A unique type for the storage implementation.
|
|
72
|
+
* e.g. `mongodb`, `postgresql`.
|
|
73
|
+
*/
|
|
74
|
+
type: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
63
77
|
export interface BucketStorageFactory extends AsyncDisposableObserverClient<BucketStorageFactoryListener> {
|
|
64
78
|
/**
|
|
65
79
|
* Update sync rules from configuration, if changed.
|
|
@@ -143,6 +157,11 @@ export interface BucketStorageFactory extends AsyncDisposableObserverClient<Buck
|
|
|
143
157
|
* Get the unique identifier for this instance of Powersync
|
|
144
158
|
*/
|
|
145
159
|
getPowerSyncInstanceId(): Promise<string>;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Get a unique identifier for the system used for storage.
|
|
163
|
+
*/
|
|
164
|
+
getSystemIdentifier(): Promise<BucketStorageSystemIdentifier>;
|
|
146
165
|
}
|
|
147
166
|
|
|
148
167
|
export interface ReplicationCheckpoint {
|
|
@@ -367,6 +386,20 @@ export interface BucketBatchStorageListener extends DisposableListener {
|
|
|
367
386
|
replicationEvent: (payload: ReplicationEventPayload) => void;
|
|
368
387
|
}
|
|
369
388
|
|
|
389
|
+
export interface BucketBatchCommitOptions {
|
|
390
|
+
/**
|
|
391
|
+
* Creates a new checkpoint even if there were no persisted operations.
|
|
392
|
+
* Defaults to true.
|
|
393
|
+
*/
|
|
394
|
+
createEmptyCheckpoints?: boolean;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export type ResolvedBucketBatchCommitOptions = Required<BucketBatchCommitOptions>;
|
|
398
|
+
|
|
399
|
+
export const DEFAULT_BUCKET_BATCH_COMMIT_OPTIONS: ResolvedBucketBatchCommitOptions = {
|
|
400
|
+
createEmptyCheckpoints: true
|
|
401
|
+
};
|
|
402
|
+
|
|
370
403
|
export interface BucketStorageBatch extends DisposableObserverClient<BucketBatchStorageListener> {
|
|
371
404
|
/**
|
|
372
405
|
* Save an op, and potentially flush.
|
|
@@ -398,11 +431,11 @@ export interface BucketStorageBatch extends DisposableObserverClient<BucketBatch
|
|
|
398
431
|
flush(): Promise<FlushedResult | null>;
|
|
399
432
|
|
|
400
433
|
/**
|
|
401
|
-
* Flush and commit any saved ops. This creates a new checkpoint.
|
|
434
|
+
* Flush and commit any saved ops. This creates a new checkpoint by default.
|
|
402
435
|
*
|
|
403
436
|
* Only call this after a transaction.
|
|
404
437
|
*/
|
|
405
|
-
commit(lsn: string): Promise<boolean>;
|
|
438
|
+
commit(lsn: string, options?: BucketBatchCommitOptions): Promise<boolean>;
|
|
406
439
|
|
|
407
440
|
/**
|
|
408
441
|
* Advance the checkpoint LSN position, without any associated op.
|