@powersync/common 0.0.0-dev-20250909203539 → 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,6 +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, signal: AbortSignal): Promise<void>;
|
|
1889
1890
|
/**
|
|
1890
1891
|
* Updates the underlying query.
|
|
1891
1892
|
*/
|
|
@@ -40,6 +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, signal: AbortSignal): Promise<void>;
|
|
43
44
|
/**
|
|
44
45
|
* Updates the underlying query.
|
|
45
46
|
*/
|
|
@@ -34,32 +34,35 @@ export class AbstractQueryProcessor extends MetaBaseObserver {
|
|
|
34
34
|
get reportFetching() {
|
|
35
35
|
return this.options.watchOptions.reportFetching ?? true;
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
* Updates the underlying query.
|
|
39
|
-
*/
|
|
40
|
-
async updateSettings(settings) {
|
|
41
|
-
// Abort any previous requests
|
|
42
|
-
this.abortController.abort();
|
|
43
|
-
this.options.watchOptions = settings;
|
|
44
|
-
// Keep track of this controller's abort status
|
|
45
|
-
const abortController = new AbortController();
|
|
46
|
-
// Allow this to be aborted externally
|
|
47
|
-
this.abortController = abortController;
|
|
48
|
-
await this.initialized;
|
|
37
|
+
async updateSettingsInternal(settings, signal) {
|
|
49
38
|
// This may have been aborted while awaiting or if multiple calls to `updateSettings` were made
|
|
50
|
-
if (
|
|
39
|
+
if (signal.aborted) {
|
|
51
40
|
return;
|
|
52
41
|
}
|
|
42
|
+
this.options.watchOptions = settings;
|
|
53
43
|
if (!this.state.isFetching && this.reportFetching) {
|
|
54
44
|
await this.updateState({
|
|
55
45
|
isFetching: true
|
|
56
46
|
});
|
|
57
47
|
}
|
|
58
48
|
await this.runWithReporting(() => this.linkQuery({
|
|
59
|
-
abortSignal:
|
|
49
|
+
abortSignal: signal,
|
|
60
50
|
settings
|
|
61
51
|
}));
|
|
62
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Updates the underlying query.
|
|
55
|
+
*/
|
|
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
|
+
await this.initialized;
|
|
64
|
+
return this.updateSettingsInternal(settings, abortController.signal);
|
|
65
|
+
}
|
|
63
66
|
async updateState(update) {
|
|
64
67
|
if (typeof update.error !== 'undefined') {
|
|
65
68
|
await this.iterateAsyncListenersWithError(async (l) => l.onError?.(update.error));
|
|
@@ -97,8 +100,8 @@ export class AbstractQueryProcessor extends MetaBaseObserver {
|
|
|
97
100
|
disposeSchemaListener();
|
|
98
101
|
};
|
|
99
102
|
// Initial setup
|
|
100
|
-
this.runWithReporting(async () => {
|
|
101
|
-
await this.
|
|
103
|
+
await this.runWithReporting(async () => {
|
|
104
|
+
await this.updateSettingsInternal(this.options.watchOptions, this.abortController.signal);
|
|
102
105
|
});
|
|
103
106
|
}
|
|
104
107
|
async close() {
|