@litebackup/sdk 0.3.18 → 0.3.20

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.
@@ -105,7 +105,7 @@ export declare class Litebackup {
105
105
  list(): Promise<ReplicaList>;
106
106
  stop(name: string): Promise<void>;
107
107
  };
108
- /** Local copies set aside because they diverged: list and delete. */
108
+ /** Conflict copies, saved because they diverged from the server: list and delete. */
109
109
  readonly conflicts: {
110
110
  list(): Promise<Conflict[]>;
111
111
  delete(id: string): Promise<void>;
@@ -24,7 +24,7 @@ export class Litebackup {
24
24
  backups;
25
25
  /** Prefix replicas and replicas on this machine. */
26
26
  replicas;
27
- /** Local copies set aside because they diverged: list and delete. */
27
+ /** Conflict copies, saved because they diverged from the server: list and delete. */
28
28
  conflicts;
29
29
  /** @internal */
30
30
  /** Failovers this client follows; close() stops following them. @internal */
@@ -18,8 +18,8 @@ export interface FailoverEvents {
18
18
  origin: [];
19
19
  /** This machine became a replica. */
20
20
  replica: [];
21
- /** This machine lost the origin role while it had writes the new origin never saw; they were moved to this file. */
22
- writesSetAside: [path: string];
21
+ /** Writes the server never got were saved to this conflict copy, as when this machine lost the origin role; `litebackup conflict list` shows it. */
22
+ conflictSaved: [path: string];
23
23
  /** Reading the daemon's events failed; watching retries. Only reported when a listener is registered. */
24
24
  error: [error: Error];
25
25
  }
@@ -48,7 +48,7 @@ export declare class Failover {
48
48
  static start(client: Litebackup, path: string, options: FailoverOptions): Promise<Failover>;
49
49
  /** Whether this machine writes the database now. */
50
50
  get isOrigin(): boolean;
51
- /** Listens for role changes, writes set aside, and watch errors. */
51
+ /** Listens for role changes, saved conflict copies, and watch errors. */
52
52
  on<Name extends keyof FailoverEvents>(event: Name, listener: (...args: FailoverEvents[Name]) => void): this;
53
53
  /** Removes a listener. */
54
54
  off<Name extends keyof FailoverEvents>(event: Name, listener: (...args: FailoverEvents[Name]) => void): this;
@@ -65,7 +65,7 @@ export class Failover {
65
65
  get isOrigin() {
66
66
  return this.role === "origin";
67
67
  }
68
- /** Listens for role changes, writes set aside, and watch errors. */
68
+ /** Listens for role changes, saved conflict copies, and watch errors. */
69
69
  on(event, listener) {
70
70
  let registered = this.listeners.get(event);
71
71
  if (!registered) {
@@ -112,8 +112,8 @@ export class Failover {
112
112
  if (event.type === "role_changed") {
113
113
  this.changeRole((event.role ?? event.message));
114
114
  }
115
- else if (event.type === "writes_set_aside" && !this.stopped) {
116
- this.notify("writesSetAside", event.path || event.message);
115
+ else if (event.type === "conflict_saved" && !this.stopped) {
116
+ this.notify("conflictSaved", event.path || event.message);
117
117
  }
118
118
  }
119
119
  /** Long-polls the daemon's events after cursor until stopped, handing this failover's events to it. */
@@ -114,7 +114,7 @@ export interface paths {
114
114
  };
115
115
  get?: never;
116
116
  put?: never;
117
- /** @description Take the write lock on a database and make the local file the server head, for worker pools that move databases between machines. An existing file becomes the first version when the server has none, is adopted when its hashes match the head, and is fast-forwarded when it is a clean but stale copy. Any other existing file is a conflict and is left untouched. A copy this machine wrote that diverged is set aside as <path>.conflict-<time>.sqlite and the head is written in its place. Without a path, the path this machine already uses is taken, which brings an offloaded database back. */
117
+ /** @description Take the write lock on a database and make the local file the server head, for worker pools that move databases between machines. An existing file becomes the first version when the server has none, is adopted when its hashes match the head, and is fast-forwarded when it is a clean but stale copy. An empty file, as an app leaves after opening a new database without writing, counts as no copy; it becomes a new database when the server has none and is replaced by the head otherwise. Any other existing file is a conflict and is left untouched. A copy this machine wrote that diverged is saved as the conflict copy <path>.conflict-<time>.sqlite and the head is written in its place. Without a path, the path this machine already uses is taken, which brings an offloaded database back. */
118
118
  post: operations["acquireDatabase"];
119
119
  delete?: never;
120
120
  options?: never;
@@ -299,7 +299,7 @@ export interface paths {
299
299
  path?: never;
300
300
  cookie?: never;
301
301
  };
302
- /** @description Local copies set aside because they diverged from the server. */
302
+ /** @description Conflict copies, the local copies saved because they diverged from the server. */
303
303
  get: operations["listConflicts"];
304
304
  put?: never;
305
305
  post?: never;
@@ -318,7 +318,7 @@ export interface paths {
318
318
  };
319
319
  get?: never;
320
320
  put?: never;
321
- /** @description Delete a set-aside copy and its -wal and -shm files. */
321
+ /** @description Delete a conflict copy and its -wal and -shm files. */
322
322
  post: operations["deleteConflict"];
323
323
  delete?: never;
324
324
  options?: never;
@@ -333,7 +333,7 @@ export interface paths {
333
333
  path?: never;
334
334
  cookie?: never;
335
335
  };
336
- /** @description Events after an event ID, oldest first. With wait_millis, the call waits up to that long for the first new event. Failovers report role_changed and writes_set_aside here. */
336
+ /** @description Events after an event ID, oldest first. With wait_millis, the call waits up to that long for the first new event. Failovers report role_changed and conflict_saved here. */
337
337
  get: operations["listEvents"];
338
338
  put?: never;
339
339
  post?: never;
@@ -684,12 +684,12 @@ export interface components {
684
684
  /** Format: date-time */
685
685
  time: string;
686
686
  name?: string;
687
- /** @description such as role_changed (message is origin or replica), writes_set_aside (message names the set-aside file), synced, conflict, downloaded */
687
+ /** @description such as role_changed (message is origin or replica), conflict_saved (path names the conflict copy), synced, downloaded */
688
688
  type: string;
689
689
  message: string;
690
690
  /** @description for role_changed, the new role */
691
691
  role?: string;
692
- /** @description for writes_set_aside, the set-aside copy */
692
+ /** @description for conflict_saved, the conflict copy */
693
693
  path?: string;
694
694
  };
695
695
  EventList: {
@@ -28,7 +28,7 @@ export type LitebackupEvent = Camelize<Schemas["Event"]>;
28
28
  export type EventList = Camelize<Schemas["EventList"]>;
29
29
  export type ShutdownResult = Camelize<Schemas["ShutdownResult"]>;
30
30
  /** The SDK version sent with every call. */
31
- export declare const sdkVersion = "0.3.18";
31
+ export declare const sdkVersion = "0.3.20";
32
32
  /** An error the Litebackup daemon answered with, carrying its code. */
33
33
  export declare class LitebackupError extends Error {
34
34
  /** Such as name_in_use, exists, in_use, not_found, still_open, timeout, or sdk_unsupported. */
package/dist/src/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /** The SDK version sent with every call. */
2
- export const sdkVersion = "0.3.18";
2
+ export const sdkVersion = "0.3.20";
3
3
  /** An error the Litebackup daemon answered with, carrying its code. */
4
4
  export class LitebackupError extends Error {
5
5
  /** Such as name_in_use, exists, in_use, not_found, still_open, timeout, or sdk_unsupported. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litebackup/sdk",
3
- "version": "0.3.18",
3
+ "version": "0.3.20",
4
4
  "description": "Back up, replicate, and restore SQLite databases with Litebackup",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -25,10 +25,10 @@
25
25
  "prepack": "npm run build"
26
26
  },
27
27
  "optionalDependencies": {
28
- "@litebackup/bin-darwin-arm64": "0.3.18",
29
- "@litebackup/bin-darwin-x64": "0.3.18",
30
- "@litebackup/bin-linux-arm64": "0.3.18",
31
- "@litebackup/bin-linux-x64": "0.3.18"
28
+ "@litebackup/bin-darwin-arm64": "0.3.20",
29
+ "@litebackup/bin-darwin-x64": "0.3.20",
30
+ "@litebackup/bin-linux-arm64": "0.3.20",
31
+ "@litebackup/bin-linux-x64": "0.3.20"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "24.19.2",