@powersync/service-core 0.0.0-dev-20250724093011 → 0.0.0-dev-20250724111728

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,10 +1,11 @@
1
1
  # @powersync/service-core
2
2
 
3
- ## 0.0.0-dev-20250724093011
3
+ ## 0.0.0-dev-20250724111728
4
4
 
5
5
  ### Minor Changes
6
6
 
7
7
  - 4ebc3bf: Report lack of commits or keepalives as issues in the diagnostics api.
8
+ - d56eeb9: Delay switching over to new sync rules until we have a consistent checkpoint.
8
9
 
9
10
  ### Patch Changes
10
11
 
@@ -13,9 +14,9 @@
13
14
  - a700ec9: Reporting mongo storage added to storage engine.
14
15
  - Updated dependencies [f1d187b]
15
16
  - Updated dependencies [a700ec9]
16
- - @powersync/service-types@0.0.0-dev-20250724093011
17
- - @powersync/lib-services-framework@0.0.0-dev-20250724093011
18
- - @powersync/service-rsocket-router@0.0.0-dev-20250724093011
17
+ - @powersync/service-types@0.0.0-dev-20250724111728
18
+ - @powersync/lib-services-framework@0.0.0-dev-20250724111728
19
+ - @powersync/service-rsocket-router@0.0.0-dev-20250724111728
19
20
 
20
21
  ## 1.13.4
21
22
 
@@ -49,16 +49,26 @@ export interface BucketStorageBatch extends ObserverClient<BucketBatchStorageLis
49
49
  */
50
50
  keepalive(lsn: string): Promise<boolean>;
51
51
  /**
52
- * Set the LSN for a snapshot, before starting replication.
52
+ * Set the LSN that replication should resume from.
53
+ *
54
+ * This can be used for:
55
+ * 1. Setting the LSN for a snapshot, before starting replication.
56
+ * 2. Setting the LSN to resume from after a replication restart, without advancing the checkpoint LSN via a commit.
53
57
  *
54
58
  * Not required if the source database keeps track of this, for example with
55
59
  * PostgreSQL logical replication slots.
56
60
  */
57
- setSnapshotLsn(lsn: string): Promise<void>;
61
+ setResumeLsn(lsn: string): Promise<void>;
58
62
  /**
59
63
  * Get the last checkpoint LSN, from either commit or keepalive.
60
64
  */
61
65
  lastCheckpointLsn: string | null;
66
+ /**
67
+ * LSN to resume from.
68
+ *
69
+ * Not relevant for streams where the source keeps track of replication progress, such as Postgres.
70
+ */
71
+ resumeFromLsn: string | null;
62
72
  markSnapshotDone(tables: SourceTable[], no_checkpoint_before_lsn: string): Promise<SourceTable[]>;
63
73
  updateTableProgress(table: SourceTable, progress: Partial<TableSnapshotStatus>): Promise<SourceTable>;
64
74
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"BucketStorageBatch.js","sourceRoot":"","sources":["../../src/storage/BucketStorageBatch.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,mCAAmC,GAAqC;IACnF,sBAAsB,EAAE,IAAI;IAC5B,uBAAuB,EAAE,IAAI;CAC9B,CAAC;AAqGF,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;AACnB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B"}
1
+ {"version":3,"file":"BucketStorageBatch.js","sourceRoot":"","sources":["../../src/storage/BucketStorageBatch.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,mCAAmC,GAAqC;IACnF,sBAAsB,EAAE,IAAI;IAC5B,uBAAuB,EAAE,IAAI;CAC9B,CAAC;AAgHF,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;AACnB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B"}
@@ -36,7 +36,6 @@ export interface SyncRulesBucketStorage extends ObserverClient<SyncRulesBucketSt
36
36
  * Clear the storage, without changing state.
37
37
  */
38
38
  clear(options?: ClearStorageOptions): Promise<void>;
39
- autoActivate(): Promise<void>;
40
39
  /**
41
40
  * Record a replication error.
42
41
  *
@@ -1 +1 @@
1
- {"version":3,"file":"SyncRulesBucketStorage.js","sourceRoot":"","sources":["../../src/storage/SyncRulesBucketStorage.ts"],"names":[],"mappings":"AA4RA,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D,kBAAkB,EAAE,IAAI,GAAG,EAAU;IACrC,qBAAqB,EAAE,IAAI;IAC3B,uBAAuB,EAAE,IAAI,GAAG,EAAU;IAC1C,0BAA0B,EAAE,IAAI;CACjC,CAAC"}
1
+ {"version":3,"file":"SyncRulesBucketStorage.js","sourceRoot":"","sources":["../../src/storage/SyncRulesBucketStorage.ts"],"names":[],"mappings":"AA0RA,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D,kBAAkB,EAAE,IAAI,GAAG,EAAU;IACrC,qBAAqB,EAAE,IAAI;IAC3B,uBAAuB,EAAE,IAAI,GAAG,EAAU;IAC1C,0BAA0B,EAAE,IAAI;CACjC,CAAC"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Return the larger of two LSNs.
3
+ */
4
+ export declare function maxLsn(a: string | null | undefined, b: string | null | undefined): string | null;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Return the larger of two LSNs.
3
+ */
4
+ export function maxLsn(a, b) {
5
+ if (a == null)
6
+ return b ?? null;
7
+ if (b == null)
8
+ return a;
9
+ return a > b ? a : b;
10
+ }
11
+ //# sourceMappingURL=lsn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lsn.js","sourceRoot":"","sources":["../../src/util/lsn.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,CAA4B,EAAE,CAA4B;IAC/E,IAAI,CAAC,IAAI,IAAI;QAAE,OAAO,CAAC,IAAI,IAAI,CAAC;IAChC,IAAI,CAAC,IAAI,IAAI;QAAE,OAAO,CAAC,CAAC;IACxB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export * from './alerting.js';
2
2
  export * from './env.js';
3
+ export * from './lsn.js';
3
4
  export * from './memory-tracking.js';
4
5
  export * from './Mutex.js';
5
6
  export * from './protocol-types.js';
@@ -1,5 +1,6 @@
1
1
  export * from './alerting.js';
2
2
  export * from './env.js';
3
+ export * from './lsn.js';
3
4
  export * from './memory-tracking.js';
4
5
  export * from './Mutex.js';
5
6
  export * from './protocol-types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"util-index.js","sourceRoot":"","sources":["../../src/util/util-index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAE7B,cAAc,aAAa,CAAC;AAC5B,cAAc,uCAAuC,CAAC;AACtD,cAAc,mBAAmB,CAAC;AAElC,cAAc,yCAAyC,CAAC;AACxD,cAAc,qDAAqD,CAAC;AACpE,cAAc,uDAAuD,CAAC;AACtE,cAAc,yDAAyD,CAAC;AAExE,cAAc,yDAAyD,CAAC;AACxE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,yDAAyD,CAAC;AACxE,cAAc,uCAAuC,CAAC;AACtD,cAAc,4CAA4C,CAAC"}
1
+ {"version":3,"file":"util-index.js","sourceRoot":"","sources":["../../src/util/util-index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAE7B,cAAc,aAAa,CAAC;AAC5B,cAAc,uCAAuC,CAAC;AACtD,cAAc,mBAAmB,CAAC;AAElC,cAAc,yCAAyC,CAAC;AACxD,cAAc,qDAAqD,CAAC;AACpE,cAAc,uDAAuD,CAAC;AACtE,cAAc,yDAAyD,CAAC;AAExE,cAAc,yDAAyD,CAAC;AACxE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,yDAAyD,CAAC;AACxE,cAAc,uCAAuC,CAAC;AACtD,cAAc,4CAA4C,CAAC"}
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
- "version": "0.0.0-dev-20250724093011",
8
+ "version": "0.0.0-dev-20250724111728",
9
9
  "main": "dist/index.js",
10
10
  "license": "FSL-1.1-Apache-2.0",
11
11
  "type": "module",
@@ -32,11 +32,11 @@
32
32
  "uuid": "^11.1.0",
33
33
  "winston": "^3.13.0",
34
34
  "yaml": "^2.3.2",
35
- "@powersync/lib-services-framework": "0.0.0-dev-20250724093011",
36
35
  "@powersync/service-jsonbig": "0.17.10",
37
- "@powersync/service-rsocket-router": "0.0.0-dev-20250724093011",
36
+ "@powersync/lib-services-framework": "0.0.0-dev-20250724111728",
37
+ "@powersync/service-rsocket-router": "0.0.0-dev-20250724111728",
38
38
  "@powersync/service-sync-rules": "0.27.0",
39
- "@powersync/service-types": "0.0.0-dev-20250724093011"
39
+ "@powersync/service-types": "0.0.0-dev-20250724111728"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/async": "^3.2.24",
@@ -60,18 +60,29 @@ export interface BucketStorageBatch extends ObserverClient<BucketBatchStorageLis
60
60
  keepalive(lsn: string): Promise<boolean>;
61
61
 
62
62
  /**
63
- * Set the LSN for a snapshot, before starting replication.
63
+ * Set the LSN that replication should resume from.
64
+ *
65
+ * This can be used for:
66
+ * 1. Setting the LSN for a snapshot, before starting replication.
67
+ * 2. Setting the LSN to resume from after a replication restart, without advancing the checkpoint LSN via a commit.
64
68
  *
65
69
  * Not required if the source database keeps track of this, for example with
66
70
  * PostgreSQL logical replication slots.
67
71
  */
68
- setSnapshotLsn(lsn: string): Promise<void>;
72
+ setResumeLsn(lsn: string): Promise<void>;
69
73
 
70
74
  /**
71
75
  * Get the last checkpoint LSN, from either commit or keepalive.
72
76
  */
73
77
  lastCheckpointLsn: string | null;
74
78
 
79
+ /**
80
+ * LSN to resume from.
81
+ *
82
+ * Not relevant for streams where the source keeps track of replication progress, such as Postgres.
83
+ */
84
+ resumeFromLsn: string | null;
85
+
75
86
  markSnapshotDone(tables: SourceTable[], no_checkpoint_before_lsn: string): Promise<SourceTable[]>;
76
87
 
77
88
  updateTableProgress(table: SourceTable, progress: Partial<TableSnapshotStatus>): Promise<SourceTable>;
@@ -50,8 +50,6 @@ export interface SyncRulesBucketStorage
50
50
  */
51
51
  clear(options?: ClearStorageOptions): Promise<void>;
52
52
 
53
- autoActivate(): Promise<void>;
54
-
55
53
  /**
56
54
  * Record a replication error.
57
55
  *
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Return the larger of two LSNs.
3
+ */
4
+ export function maxLsn(a: string | null | undefined, b: string | null | undefined): string | null {
5
+ if (a == null) return b ?? null;
6
+ if (b == null) return a;
7
+ return a > b ? a : b;
8
+ }
@@ -1,5 +1,6 @@
1
1
  export * from './alerting.js';
2
2
  export * from './env.js';
3
+ export * from './lsn.js';
3
4
  export * from './memory-tracking.js';
4
5
  export * from './Mutex.js';
5
6
  export * from './protocol-types.js';