@powersync/common 0.0.0-dev-20250909205633 → 0.0.0-dev-20250910123823

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/dist/index.d.cts CHANGED
@@ -1886,7 +1886,7 @@ declare abstract class AbstractQueryProcessor<Data = unknown[], Settings extends
1886
1886
  constructor(options: AbstractQueryProcessorOptions<Data, Settings>);
1887
1887
  protected constructInitialState(): WatchedQueryState<Data>;
1888
1888
  protected get reportFetching(): boolean;
1889
- protected updateSettingsInternal(settings: Settings): Promise<void>;
1889
+ protected updateSettingsInternal(settings: Settings, signal: AbortSignal): Promise<void>;
1890
1890
  /**
1891
1891
  * Updates the underlying query.
1892
1892
  */
@@ -40,7 +40,7 @@ export declare abstract class AbstractQueryProcessor<Data = unknown[], Settings
40
40
  constructor(options: AbstractQueryProcessorOptions<Data, Settings>);
41
41
  protected constructInitialState(): WatchedQueryState<Data>;
42
42
  protected get reportFetching(): boolean;
43
- protected updateSettingsInternal(settings: Settings): Promise<void>;
43
+ protected updateSettingsInternal(settings: Settings, signal: AbortSignal): Promise<void>;
44
44
  /**
45
45
  * Updates the underlying query.
46
46
  */
@@ -34,15 +34,9 @@ export class AbstractQueryProcessor extends MetaBaseObserver {
34
34
  get reportFetching() {
35
35
  return this.options.watchOptions.reportFetching ?? true;
36
36
  }
37
- async updateSettingsInternal(settings) {
38
- // Abort any previous requests
39
- this.abortController.abort();
40
- // Keep track of this controller's abort status
41
- const abortController = new AbortController();
42
- // Allow this to be aborted externally
43
- this.abortController = abortController;
37
+ async updateSettingsInternal(settings, signal) {
44
38
  // This may have been aborted while awaiting or if multiple calls to `updateSettings` were made
45
- if (abortController.signal.aborted) {
39
+ if (signal.aborted) {
46
40
  return;
47
41
  }
48
42
  this.options.watchOptions = settings;
@@ -52,7 +46,7 @@ export class AbstractQueryProcessor extends MetaBaseObserver {
52
46
  });
53
47
  }
54
48
  await this.runWithReporting(() => this.linkQuery({
55
- abortSignal: abortController.signal,
49
+ abortSignal: signal,
56
50
  settings
57
51
  }));
58
52
  }
@@ -60,8 +54,14 @@ export class AbstractQueryProcessor extends MetaBaseObserver {
60
54
  * Updates the underlying query.
61
55
  */
62
56
  async updateSettings(settings) {
57
+ // Abort any previous requests
58
+ this.abortController.abort();
59
+ // Keep track of this controller's abort status
60
+ const abortController = new AbortController();
61
+ // Allow this to be aborted externally
62
+ this.abortController = abortController;
63
63
  await this.initialized;
64
- return this.updateSettingsInternal(settings);
64
+ return this.updateSettingsInternal(settings, abortController.signal);
65
65
  }
66
66
  async updateState(update) {
67
67
  if (typeof update.error !== 'undefined') {
@@ -101,7 +101,7 @@ export class AbstractQueryProcessor extends MetaBaseObserver {
101
101
  };
102
102
  // Initial setup
103
103
  await this.runWithReporting(async () => {
104
- await this.updateSettingsInternal(this.options.watchOptions);
104
+ await this.updateSettingsInternal(this.options.watchOptions, this.abortController.signal);
105
105
  });
106
106
  }
107
107
  async close() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powersync/common",
3
- "version": "0.0.0-dev-20250909205633",
3
+ "version": "0.0.0-dev-20250910123823",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"