@powersync/common 0.0.0-dev-20250909205633 → 0.0.0-dev-20250915110424
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/bundle.cjs +1 -1
- package/dist/bundle.mjs +5 -5
- package/dist/index.d.cts +1 -1
- package/lib/client/watched/processors/AbstractQueryProcessor.d.ts +1 -1
- package/lib/client/watched/processors/AbstractQueryProcessor.js +11 -11
- package/lib/client/watched/processors/DifferentialQueryProcessor.js +3 -0
- package/lib/client/watched/processors/OnChangeQueryProcessor.js +3 -0
- package/package.json +1 -1
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 (
|
|
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:
|
|
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() {
|
|
@@ -148,6 +148,9 @@ export class DifferentialQueryProcessor extends AbstractQueryProcessor {
|
|
|
148
148
|
data: diff.all
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
+
if (this.state.error) {
|
|
152
|
+
partialStateUpdate.error = null;
|
|
153
|
+
}
|
|
151
154
|
if (Object.keys(partialStateUpdate).length > 0) {
|
|
152
155
|
await this.updateState(partialStateUpdate);
|
|
153
156
|
}
|
|
@@ -58,6 +58,9 @@ export class OnChangeQueryProcessor extends AbstractQueryProcessor {
|
|
|
58
58
|
data: result
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
+
if (this.state.error) {
|
|
62
|
+
partialStateUpdate.error = null;
|
|
63
|
+
}
|
|
61
64
|
if (Object.keys(partialStateUpdate).length > 0) {
|
|
62
65
|
await this.updateState(partialStateUpdate);
|
|
63
66
|
}
|