@powersync/common 1.35.0 → 1.36.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.
@@ -201,6 +201,11 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
201
201
  */
202
202
  init(): Promise<void>;
203
203
  resolvedConnectionOptions(options?: PowerSyncConnectionOptions): RequiredAdditionalConnectionOptions;
204
+ /**
205
+ * @deprecated Use {@link AbstractPowerSyncDatabase#close} instead.
206
+ * Clears all listeners registered by {@link AbstractPowerSyncDatabase#registerListener}.
207
+ */
208
+ dispose(): void;
204
209
  /**
205
210
  * Locking mechanism for exclusively running critical portions of connect/disconnect operations.
206
211
  * Locking here is mostly only important on web for multiple tab scenarios.
@@ -286,6 +286,13 @@ export class AbstractPowerSyncDatabase extends BaseObserver {
286
286
  crudUploadThrottleMs: options?.crudUploadThrottleMs ?? this.options.crudUploadThrottleMs ?? DEFAULT_CRUD_UPLOAD_THROTTLE_MS
287
287
  };
288
288
  }
289
+ /**
290
+ * @deprecated Use {@link AbstractPowerSyncDatabase#close} instead.
291
+ * Clears all listeners registered by {@link AbstractPowerSyncDatabase#registerListener}.
292
+ */
293
+ dispose() {
294
+ return super.dispose();
295
+ }
289
296
  /**
290
297
  * Locking mechanism for exclusively running critical portions of connect/disconnect operations.
291
298
  * Locking here is mostly only important on web for multiple tab scenarios.
@@ -852,7 +852,9 @@ The next upload iteration will be delayed.`);
852
852
  }
853
853
  await control(PowerSyncControlCommand.START, JSON.stringify(options));
854
854
  this.notifyCompletedUploads = () => {
855
- controlInvocations?.enqueueData({ command: PowerSyncControlCommand.NOTIFY_CRUD_UPLOAD_COMPLETED });
855
+ if (controlInvocations && !controlInvocations?.closed) {
856
+ controlInvocations.enqueueData({ command: PowerSyncControlCommand.NOTIFY_CRUD_UPLOAD_COMPLETED });
857
+ }
856
858
  };
857
859
  await receivingLines;
858
860
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powersync/common",
3
- "version": "1.35.0",
3
+ "version": "1.36.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -12,10 +12,14 @@
12
12
  "types": "lib/index.d.ts",
13
13
  "exports": {
14
14
  ".": {
15
- "import": "./dist/bundle.mjs",
16
- "require": "./dist/bundle.cjs",
17
- "types": "./lib/index.d.ts",
18
- "default": "./dist/bundle.mjs"
15
+ "import": {
16
+ "types": "./lib/index.d.ts",
17
+ "default": "./dist/bundle.mjs"
18
+ },
19
+ "require": {
20
+ "types": "./dist/index.d.cts",
21
+ "require": "./dist/bundle.cjs"
22
+ }
19
23
  }
20
24
  },
21
25
  "author": "JOURNEYAPPS",
@@ -57,7 +61,8 @@
57
61
  "scripts": {
58
62
  "build": "tsc -b && rollup -c rollup.config.mjs",
59
63
  "build:prod": "tsc -b --sourceMap false && rollup -c rollup.config.mjs --sourceMap false",
60
- "clean": "rm -rf lib dist tsconfig.tsbuildinfo node_modules",
61
- "test": "vitest"
64
+ "clean": "rm -rf lib dist tsconfig.tsbuildinfo",
65
+ "test": "vitest",
66
+ "test:exports": "attw --pack ."
62
67
  }
63
68
  }