@powersync/common 1.53.2 → 1.54.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.
- package/dist/bundle.cjs +548 -345
- package/dist/bundle.cjs.map +1 -1
- package/dist/bundle.mjs +548 -345
- package/dist/bundle.mjs.map +1 -1
- package/dist/bundle.node.cjs +548 -345
- package/dist/bundle.node.cjs.map +1 -1
- package/dist/bundle.node.mjs +548 -345
- package/dist/bundle.node.mjs.map +1 -1
- package/dist/index.d.cts +727 -189
- package/lib/attachments/AttachmentContext.d.ts +7 -6
- package/lib/attachments/AttachmentContext.js +2 -1
- package/lib/attachments/AttachmentContext.js.map +1 -1
- package/lib/attachments/AttachmentErrorHandler.d.ts +6 -6
- package/lib/attachments/AttachmentQueue.d.ts +61 -20
- package/lib/attachments/AttachmentQueue.js +16 -18
- package/lib/attachments/AttachmentQueue.js.map +1 -1
- package/lib/attachments/LocalStorageAdapter.d.ts +14 -8
- package/lib/attachments/LocalStorageAdapter.js +3 -0
- package/lib/attachments/LocalStorageAdapter.js.map +1 -1
- package/lib/attachments/RemoteStorageAdapter.d.ts +4 -4
- package/lib/attachments/Schema.d.ts +12 -4
- package/lib/attachments/Schema.js +8 -3
- package/lib/attachments/Schema.js.map +1 -1
- package/lib/attachments/WatchedAttachmentItem.d.ts +3 -1
- package/lib/client/AbstractPowerSyncDatabase.d.ts +110 -58
- package/lib/client/AbstractPowerSyncDatabase.js +59 -48
- package/lib/client/AbstractPowerSyncDatabase.js.map +1 -1
- package/lib/client/AbstractPowerSyncOpenFactory.d.ts +6 -0
- package/lib/client/AbstractPowerSyncOpenFactory.js +3 -0
- package/lib/client/AbstractPowerSyncOpenFactory.js.map +1 -1
- package/lib/client/ConnectionManager.d.ts +4 -1
- package/lib/client/ConnectionManager.js +1 -1
- package/lib/client/ConnectionManager.js.map +1 -1
- package/lib/client/Query.d.ts +9 -0
- package/lib/client/SQLOpenFactory.d.ts +12 -0
- package/lib/client/SQLOpenFactory.js +6 -0
- package/lib/client/SQLOpenFactory.js.map +1 -1
- package/lib/client/compilableQueryWatch.d.ts +6 -0
- package/lib/client/compilableQueryWatch.js +3 -0
- package/lib/client/compilableQueryWatch.js.map +1 -1
- package/lib/client/connection/PowerSyncBackendConnector.d.ts +3 -0
- package/lib/client/connection/PowerSyncCredentials.d.ts +3 -0
- package/lib/client/constants.d.ts +3 -0
- package/lib/client/constants.js +3 -0
- package/lib/client/constants.js.map +1 -1
- package/lib/client/runOnSchemaChange.d.ts +3 -0
- package/lib/client/runOnSchemaChange.js +3 -0
- package/lib/client/runOnSchemaChange.js.map +1 -1
- package/lib/client/sync/bucket/BucketStorageAdapter.d.ts +12 -0
- package/lib/client/sync/bucket/BucketStorageAdapter.js +6 -0
- package/lib/client/sync/bucket/BucketStorageAdapter.js.map +1 -1
- package/lib/client/sync/bucket/CrudBatch.d.ts +2 -0
- package/lib/client/sync/bucket/CrudBatch.js +2 -0
- package/lib/client/sync/bucket/CrudBatch.js.map +1 -1
- package/lib/client/sync/bucket/CrudEntry.d.ts +9 -0
- package/lib/client/sync/bucket/CrudEntry.js +4 -0
- package/lib/client/sync/bucket/CrudEntry.js.map +1 -1
- package/lib/client/sync/bucket/CrudTransaction.d.ts +3 -0
- package/lib/client/sync/bucket/CrudTransaction.js +3 -0
- package/lib/client/sync/bucket/CrudTransaction.js.map +1 -1
- package/lib/client/sync/bucket/SqliteBucketStorage.d.ts +3 -0
- package/lib/client/sync/bucket/SqliteBucketStorage.js +3 -0
- package/lib/client/sync/bucket/SqliteBucketStorage.js.map +1 -1
- package/lib/client/sync/stream/AbstractRemote.d.ts +30 -1
- package/lib/client/sync/stream/AbstractRemote.js +15 -1
- package/lib/client/sync/stream/AbstractRemote.js.map +1 -1
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.d.ts +55 -5
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js +32 -4
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js.map +1 -1
- package/lib/client/sync/stream/JsonValue.d.ts +3 -0
- package/lib/client/sync/stream/WebsocketClientTransport.js +2 -1
- package/lib/client/sync/stream/WebsocketClientTransport.js.map +1 -1
- package/lib/client/sync/sync-streams.d.ts +22 -7
- package/lib/client/triggers/TriggerManager.d.ts +19 -18
- package/lib/client/triggers/TriggerManager.js +2 -1
- package/lib/client/triggers/TriggerManager.js.map +1 -1
- package/lib/client/triggers/TriggerManagerImpl.d.ts +1 -1
- package/lib/client/triggers/TriggerManagerImpl.js +3 -3
- package/lib/client/triggers/TriggerManagerImpl.js.map +1 -1
- package/lib/client/triggers/sanitizeSQL.d.ts +4 -0
- package/lib/client/triggers/sanitizeSQL.js +4 -0
- package/lib/client/triggers/sanitizeSQL.js.map +1 -1
- package/lib/client/watched/GetAllQuery.d.ts +4 -0
- package/lib/client/watched/GetAllQuery.js +2 -0
- package/lib/client/watched/GetAllQuery.js.map +1 -1
- package/lib/client/watched/WatchedQuery.d.ts +24 -2
- package/lib/client/watched/WatchedQuery.js +9 -0
- package/lib/client/watched/WatchedQuery.js.map +1 -1
- package/lib/client/watched/processors/AbstractQueryProcessor.d.ts +1 -1
- package/lib/client/watched/processors/AbstractQueryProcessor.js.map +1 -1
- package/lib/client/watched/processors/DifferentialQueryProcessor.d.ts +20 -0
- package/lib/client/watched/processors/DifferentialQueryProcessor.js +4 -0
- package/lib/client/watched/processors/DifferentialQueryProcessor.js.map +1 -1
- package/lib/client/watched/processors/OnChangeQueryProcessor.d.ts +4 -0
- package/lib/client/watched/processors/OnChangeQueryProcessor.js.map +1 -1
- package/lib/client/watched/processors/comparators.d.ts +8 -0
- package/lib/client/watched/processors/comparators.js +4 -0
- package/lib/client/watched/processors/comparators.js.map +1 -1
- package/lib/db/ConnectionClosedError.d.ts +2 -0
- package/lib/db/ConnectionClosedError.js +2 -0
- package/lib/db/ConnectionClosedError.js.map +1 -1
- package/lib/db/DBAdapter.d.ts +56 -6
- package/lib/db/DBAdapter.js +15 -3
- package/lib/db/DBAdapter.js.map +1 -1
- package/lib/db/crud/SyncProgress.d.ts +6 -1
- package/lib/db/crud/SyncProgress.js +2 -0
- package/lib/db/crud/SyncProgress.js.map +1 -1
- package/lib/db/crud/SyncStatus.d.ts +36 -38
- package/lib/db/crud/SyncStatus.js +19 -14
- package/lib/db/crud/SyncStatus.js.map +1 -1
- package/lib/db/crud/UploadQueueStatus.d.ts +3 -0
- package/lib/db/crud/UploadQueueStatus.js +3 -0
- package/lib/db/crud/UploadQueueStatus.js.map +1 -1
- package/lib/db/schema/Column.d.ts +28 -0
- package/lib/db/schema/Column.js +16 -3
- package/lib/db/schema/Column.js.map +1 -1
- package/lib/db/schema/Index.d.ts +9 -0
- package/lib/db/schema/Index.js +6 -0
- package/lib/db/schema/Index.js.map +1 -1
- package/lib/db/schema/IndexedColumn.d.ts +9 -0
- package/lib/db/schema/IndexedColumn.js +6 -0
- package/lib/db/schema/IndexedColumn.js.map +1 -1
- package/lib/db/schema/RawTable.d.ts +7 -1
- package/lib/db/schema/Schema.d.ts +6 -1
- package/lib/db/schema/Schema.js +3 -1
- package/lib/db/schema/Schema.js.map +1 -1
- package/lib/db/schema/Table.d.ts +27 -3
- package/lib/db/schema/Table.js +9 -0
- package/lib/db/schema/Table.js.map +1 -1
- package/lib/db/schema/TableV2.d.ts +2 -0
- package/lib/db/schema/TableV2.js +2 -0
- package/lib/db/schema/TableV2.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/types/types.d.ts +6 -0
- package/lib/utils/AbortOperation.d.ts +2 -0
- package/lib/utils/AbortOperation.js +2 -0
- package/lib/utils/AbortOperation.js.map +1 -1
- package/lib/utils/BaseObserver.d.ts +12 -0
- package/lib/utils/BaseObserver.js +3 -0
- package/lib/utils/BaseObserver.js.map +1 -1
- package/lib/utils/ControlledExecutor.d.ts +6 -0
- package/lib/utils/ControlledExecutor.js +3 -0
- package/lib/utils/ControlledExecutor.js.map +1 -1
- package/lib/utils/Logger.d.ts +9 -0
- package/lib/utils/Logger.js +6 -0
- package/lib/utils/Logger.js.map +1 -1
- package/lib/utils/mutex.d.ts +8 -0
- package/lib/utils/mutex.js +3 -0
- package/lib/utils/mutex.js.map +1 -1
- package/lib/utils/parseQuery.d.ts +6 -0
- package/lib/utils/parseQuery.js +3 -0
- package/lib/utils/parseQuery.js.map +1 -1
- package/lib/utils/stream_transform.d.ts +3 -1
- package/lib/utils/stream_transform.js.map +1 -1
- package/package.json +3 -2
- package/src/attachments/AttachmentContext.ts +7 -6
- package/src/attachments/AttachmentErrorHandler.ts +6 -6
- package/src/attachments/AttachmentQueue.ts +71 -23
- package/src/attachments/LocalStorageAdapter.ts +14 -8
- package/src/attachments/README.md +2 -0
- package/src/attachments/RemoteStorageAdapter.ts +4 -4
- package/src/attachments/Schema.ts +12 -4
- package/src/attachments/WatchedAttachmentItem.ts +3 -1
- package/src/client/AbstractPowerSyncDatabase.ts +117 -62
- package/src/client/AbstractPowerSyncOpenFactory.ts +6 -0
- package/src/client/ConnectionManager.ts +4 -1
- package/src/client/Query.ts +9 -0
- package/src/client/SQLOpenFactory.ts +12 -0
- package/src/client/compilableQueryWatch.ts +6 -0
- package/src/client/connection/PowerSyncBackendConnector.ts +3 -0
- package/src/client/connection/PowerSyncCredentials.ts +3 -0
- package/src/client/constants.ts +3 -0
- package/src/client/runOnSchemaChange.ts +3 -0
- package/src/client/sync/bucket/BucketStorageAdapter.ts +12 -0
- package/src/client/sync/bucket/CrudBatch.ts +2 -0
- package/src/client/sync/bucket/CrudEntry.ts +9 -0
- package/src/client/sync/bucket/CrudTransaction.ts +3 -0
- package/src/client/sync/bucket/SqliteBucketStorage.ts +3 -0
- package/src/client/sync/stream/AbstractRemote.ts +30 -1
- package/src/client/sync/stream/AbstractStreamingSyncImplementation.ts +55 -5
- package/src/client/sync/stream/JsonValue.ts +3 -0
- package/src/client/sync/stream/WebsocketClientTransport.ts +3 -1
- package/src/client/sync/sync-streams.ts +22 -9
- package/src/client/triggers/TriggerManager.ts +19 -18
- package/src/client/triggers/TriggerManagerImpl.ts +5 -5
- package/src/client/triggers/sanitizeSQL.ts +5 -0
- package/src/client/watched/GetAllQuery.ts +5 -1
- package/src/client/watched/WatchedQuery.ts +24 -2
- package/src/client/watched/processors/AbstractQueryProcessor.ts +6 -6
- package/src/client/watched/processors/DifferentialQueryProcessor.ts +28 -5
- package/src/client/watched/processors/OnChangeQueryProcessor.ts +9 -3
- package/src/client/watched/processors/comparators.ts +8 -0
- package/src/db/ConnectionClosedError.ts +2 -0
- package/src/db/DBAdapter.ts +58 -6
- package/src/db/crud/SyncProgress.ts +6 -1
- package/src/db/crud/SyncStatus.ts +40 -21
- package/src/db/crud/UploadQueueStatus.ts +3 -0
- package/src/db/schema/Column.ts +28 -3
- package/src/db/schema/Index.ts +9 -0
- package/src/db/schema/IndexedColumn.ts +9 -0
- package/src/db/schema/RawTable.ts +7 -1
- package/src/db/schema/Schema.ts +8 -3
- package/src/db/schema/Table.ts +30 -5
- package/src/db/schema/TableV2.ts +2 -0
- package/src/index.ts +1 -1
- package/src/types/types.ts +6 -0
- package/src/utils/AbortOperation.ts +2 -0
- package/src/utils/BaseObserver.ts +12 -0
- package/src/utils/ControlledExecutor.ts +6 -0
- package/src/utils/Logger.ts +9 -0
- package/src/utils/mutex.ts +12 -0
- package/src/utils/parseQuery.ts +6 -0
- package/src/utils/stream_transform.ts +3 -1
|
@@ -2,6 +2,9 @@ import { BaseListener, BaseObserverInterface, Disposable } from '../../../utils/
|
|
|
2
2
|
import { CrudBatch } from './CrudBatch.js';
|
|
3
3
|
import { CrudEntry } from './CrudEntry.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
5
8
|
export enum PSInternalTable {
|
|
6
9
|
DATA = 'ps_data',
|
|
7
10
|
CRUD = 'ps_crud',
|
|
@@ -10,6 +13,9 @@ export enum PSInternalTable {
|
|
|
10
13
|
UNTYPED = 'ps_untyped'
|
|
11
14
|
}
|
|
12
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
13
19
|
export enum PowerSyncControlCommand {
|
|
14
20
|
PROCESS_TEXT_LINE = 'line_text',
|
|
15
21
|
PROCESS_BSON_LINE = 'line_binary',
|
|
@@ -24,10 +30,16 @@ export enum PowerSyncControlCommand {
|
|
|
24
30
|
CONNECTION_STATE = 'connection'
|
|
25
31
|
}
|
|
26
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
27
36
|
export interface BucketStorageListener extends BaseListener {
|
|
28
37
|
crudUpdate: () => void;
|
|
29
38
|
}
|
|
30
39
|
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
31
43
|
export interface BucketStorageAdapter extends BaseObserverInterface<BucketStorageListener>, Disposable {
|
|
32
44
|
init(): Promise<void>;
|
|
33
45
|
|
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
* 64-bit unsigned integer stored as a string in base-10.
|
|
3
3
|
*
|
|
4
4
|
* Not sortable as a string.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
5
7
|
*/
|
|
6
8
|
export type OpId = string;
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Type of local change.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
10
14
|
*/
|
|
11
15
|
export enum UpdateType {
|
|
12
16
|
/** Insert or replace existing row. All non-null columns are included in the data. Generated by INSERT statements. */
|
|
@@ -17,6 +21,9 @@ export enum UpdateType {
|
|
|
17
21
|
DELETE = 'DELETE'
|
|
18
22
|
}
|
|
19
23
|
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
20
27
|
export type CrudEntryJSON = {
|
|
21
28
|
id: string;
|
|
22
29
|
data: string;
|
|
@@ -48,6 +55,8 @@ type CrudEntryOutputJSON = {
|
|
|
48
55
|
|
|
49
56
|
/**
|
|
50
57
|
* A single client-side change.
|
|
58
|
+
*
|
|
59
|
+
* @public
|
|
51
60
|
*/
|
|
52
61
|
export class CrudEntry {
|
|
53
62
|
/**
|
|
@@ -11,6 +11,9 @@ import {
|
|
|
11
11
|
import { CrudBatch } from './CrudBatch.js';
|
|
12
12
|
import { CrudEntry, CrudEntryJSON } from './CrudEntry.js';
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
14
17
|
export class SqliteBucketStorage extends BaseObserver<BucketStorageListener> implements BucketStorageAdapter {
|
|
15
18
|
public tableNames: Set<string>;
|
|
16
19
|
private updateListener: () => void;
|
|
@@ -14,6 +14,9 @@ import {
|
|
|
14
14
|
import { EventIterator } from 'event-iterator';
|
|
15
15
|
import type { Queue } from 'event-iterator/lib/event-iterator.js';
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
17
20
|
export type RemoteConnector = {
|
|
18
21
|
fetchCredentials: () => Promise<PowerSyncCredentials | null>;
|
|
19
22
|
invalidateCredentials?: () => void;
|
|
@@ -36,8 +39,14 @@ const SOCKET_TIMEOUT_MS = 30_000;
|
|
|
36
39
|
// significantly. Therefore this is longer than the socket timeout.
|
|
37
40
|
const KEEP_ALIVE_LIFETIME_MS = 90_000;
|
|
38
41
|
|
|
42
|
+
/**
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
39
45
|
export const DEFAULT_REMOTE_LOGGER = Logger.get('PowerSyncRemote');
|
|
40
46
|
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
41
50
|
export type SyncStreamOptions = {
|
|
42
51
|
path: string;
|
|
43
52
|
data: unknown;
|
|
@@ -46,6 +55,9 @@ export type SyncStreamOptions = {
|
|
|
46
55
|
fetchOptions?: Request;
|
|
47
56
|
};
|
|
48
57
|
|
|
58
|
+
/**
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
49
61
|
export enum FetchStrategy {
|
|
50
62
|
/**
|
|
51
63
|
* Queues multiple sync events before processing, reducing round-trips.
|
|
@@ -60,10 +72,16 @@ export enum FetchStrategy {
|
|
|
60
72
|
Sequential = 'sequential'
|
|
61
73
|
}
|
|
62
74
|
|
|
75
|
+
/**
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
63
78
|
export type SocketSyncStreamOptions = SyncStreamOptions & {
|
|
64
79
|
fetchStrategy: FetchStrategy;
|
|
65
80
|
};
|
|
66
81
|
|
|
82
|
+
/**
|
|
83
|
+
* @internal
|
|
84
|
+
*/
|
|
67
85
|
export type FetchImplementation = typeof fetch;
|
|
68
86
|
|
|
69
87
|
/**
|
|
@@ -71,6 +89,8 @@ export type FetchImplementation = typeof fetch;
|
|
|
71
89
|
* The class wrapper is used to distinguish the fetchImplementation
|
|
72
90
|
* option in [AbstractRemoteOptions] from the general fetch method
|
|
73
91
|
* which is typeof "function"
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
74
94
|
*/
|
|
75
95
|
export class FetchImplementationProvider {
|
|
76
96
|
getFetch(): FetchImplementation {
|
|
@@ -78,6 +98,9 @@ export class FetchImplementationProvider {
|
|
|
78
98
|
}
|
|
79
99
|
}
|
|
80
100
|
|
|
101
|
+
/**
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
81
104
|
export type AbstractRemoteOptions = {
|
|
82
105
|
/**
|
|
83
106
|
* Transforms the PowerSync base URL which might contain
|
|
@@ -102,6 +125,9 @@ export type AbstractRemoteOptions = {
|
|
|
102
125
|
fetchOptions?: {};
|
|
103
126
|
};
|
|
104
127
|
|
|
128
|
+
/**
|
|
129
|
+
* @internal
|
|
130
|
+
*/
|
|
105
131
|
export const DEFAULT_REMOTE_OPTIONS: AbstractRemoteOptions = {
|
|
106
132
|
socketUrlTransformer: (url) =>
|
|
107
133
|
url.replace(/^https?:\/\//, function (match) {
|
|
@@ -111,6 +137,9 @@ export const DEFAULT_REMOTE_OPTIONS: AbstractRemoteOptions = {
|
|
|
111
137
|
fetchOptions: {}
|
|
112
138
|
};
|
|
113
139
|
|
|
140
|
+
/**
|
|
141
|
+
* @internal
|
|
142
|
+
*/
|
|
114
143
|
export abstract class AbstractRemote {
|
|
115
144
|
protected credentials: PowerSyncCredentials | null = null;
|
|
116
145
|
protected options: AbstractRemoteOptions;
|
|
@@ -589,7 +618,7 @@ export abstract class AbstractRemote {
|
|
|
589
618
|
* Posts a `/sync/stream` request.
|
|
590
619
|
*
|
|
591
620
|
* Depending on the `Content-Type` of the response, this returns strings for sync lines or encoded BSON documents as
|
|
592
|
-
*
|
|
621
|
+
* `Uint8Array`s.
|
|
593
622
|
*/
|
|
594
623
|
async fetchStream(options: SyncStreamOptions): Promise<SimpleAsyncIterator<Uint8Array | string>> {
|
|
595
624
|
const { isBson, stream } = await this.fetchStreamRaw(options);
|
|
@@ -22,16 +22,26 @@ import {
|
|
|
22
22
|
import { asyncNotifier } from '../../../utils/async.js';
|
|
23
23
|
import { StreamingSyncRequestParameterType } from './JsonValue.js';
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
25
28
|
export enum LockType {
|
|
26
29
|
CRUD = 'crud',
|
|
27
30
|
SYNC = 'sync'
|
|
28
31
|
}
|
|
29
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
30
36
|
export enum SyncStreamConnectionMethod {
|
|
31
37
|
HTTP = 'http',
|
|
32
38
|
WEB_SOCKET = 'web-socket'
|
|
33
39
|
}
|
|
34
40
|
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Deprecated since {@link SyncClientImplementation.RUST} is the only option.
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
35
45
|
export enum SyncClientImplementation {
|
|
36
46
|
/**
|
|
37
47
|
* This implementation offloads the sync line decoding and handling into the PowerSync
|
|
@@ -42,8 +52,8 @@ export enum SyncClientImplementation {
|
|
|
42
52
|
* ## Compatibility warning
|
|
43
53
|
*
|
|
44
54
|
* The Rust sync client stores sync data in a format that is slightly different than the one used
|
|
45
|
-
* by the old JavaScript client. When adopting the {@link RUST} client on existing databases,
|
|
46
|
-
* migrate the format automatically.
|
|
55
|
+
* by the old JavaScript client. When adopting the {@link SyncClientImplementation.RUST} client on existing databases,
|
|
56
|
+
* the PowerSync SDK will migrate the format automatically.
|
|
47
57
|
*
|
|
48
58
|
* SDK versions supporting both the JavaScript and the Rust client support both formats with the JavaScript client
|
|
49
59
|
* implementaiton. However, downgrading to an SDK version that only supports the JavaScript client would not be
|
|
@@ -54,11 +64,16 @@ export enum SyncClientImplementation {
|
|
|
54
64
|
|
|
55
65
|
/**
|
|
56
66
|
* The default {@link SyncClientImplementation} to use, {@link SyncClientImplementation.RUST}.
|
|
67
|
+
*
|
|
68
|
+
* @deprecated Deprecated since {@link SyncClientImplementation.RUST} is the only option.
|
|
69
|
+
* @public
|
|
57
70
|
*/
|
|
58
71
|
export const DEFAULT_SYNC_CLIENT_IMPLEMENTATION = SyncClientImplementation.RUST;
|
|
59
72
|
|
|
60
73
|
/**
|
|
61
74
|
* Abstract Lock to be implemented by various JS environments
|
|
75
|
+
*
|
|
76
|
+
* @internal
|
|
62
77
|
*/
|
|
63
78
|
export interface LockOptions<T> {
|
|
64
79
|
callback: () => Promise<T>;
|
|
@@ -66,6 +81,9 @@ export interface LockOptions<T> {
|
|
|
66
81
|
signal?: AbortSignal;
|
|
67
82
|
}
|
|
68
83
|
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
69
87
|
export interface AbstractStreamingSyncImplementationOptions extends RequiredAdditionalConnectionOptions {
|
|
70
88
|
adapter: BucketStorageAdapter;
|
|
71
89
|
subscriptions: SubscribedStream[];
|
|
@@ -79,6 +97,9 @@ export interface AbstractStreamingSyncImplementationOptions extends RequiredAddi
|
|
|
79
97
|
remote: AbstractRemote;
|
|
80
98
|
}
|
|
81
99
|
|
|
100
|
+
/**
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
82
103
|
export interface StreamingSyncImplementationListener extends BaseListener {
|
|
83
104
|
/**
|
|
84
105
|
* Triggered whenever a status update has been attempted to be made or
|
|
@@ -94,12 +115,17 @@ export interface StreamingSyncImplementationListener extends BaseListener {
|
|
|
94
115
|
/**
|
|
95
116
|
* Configurable options to be used when connecting to the PowerSync
|
|
96
117
|
* backend instance.
|
|
118
|
+
*
|
|
119
|
+
* @public
|
|
97
120
|
*/
|
|
98
121
|
export type PowerSyncConnectionOptions = Omit<InternalConnectionOptions, 'serializedSchema'>;
|
|
99
122
|
|
|
123
|
+
/**
|
|
124
|
+
* @internal
|
|
125
|
+
*/
|
|
100
126
|
export interface InternalConnectionOptions extends BaseConnectionOptions, AdditionalConnectionOptions {}
|
|
101
127
|
|
|
102
|
-
/** @
|
|
128
|
+
/** @public */
|
|
103
129
|
export interface BaseConnectionOptions {
|
|
104
130
|
/**
|
|
105
131
|
* A set of metadata to be included in service logs.
|
|
@@ -161,6 +187,9 @@ export interface RequiredAdditionalConnectionOptions extends Required<Additional
|
|
|
161
187
|
subscriptions: SubscribedStream[];
|
|
162
188
|
}
|
|
163
189
|
|
|
190
|
+
/**
|
|
191
|
+
* @internal
|
|
192
|
+
*/
|
|
164
193
|
export interface StreamingSyncImplementation
|
|
165
194
|
extends BaseObserverInterface<StreamingSyncImplementationListener>, Disposable {
|
|
166
195
|
/**
|
|
@@ -183,16 +212,31 @@ export interface StreamingSyncImplementation
|
|
|
183
212
|
markConnectionMayHaveChanged(): void;
|
|
184
213
|
}
|
|
185
214
|
|
|
215
|
+
/**
|
|
216
|
+
* @internal
|
|
217
|
+
*/
|
|
186
218
|
export const DEFAULT_CRUD_UPLOAD_THROTTLE_MS = 1000;
|
|
219
|
+
/**
|
|
220
|
+
* @internal
|
|
221
|
+
*/
|
|
187
222
|
export const DEFAULT_RETRY_DELAY_MS = 5000;
|
|
188
223
|
|
|
224
|
+
/**
|
|
225
|
+
* @internal
|
|
226
|
+
*/
|
|
189
227
|
export const DEFAULT_STREAMING_SYNC_OPTIONS = {
|
|
190
228
|
retryDelayMs: DEFAULT_RETRY_DELAY_MS,
|
|
191
229
|
crudUploadThrottleMs: DEFAULT_CRUD_UPLOAD_THROTTLE_MS
|
|
192
230
|
};
|
|
193
231
|
|
|
232
|
+
/**
|
|
233
|
+
* @internal
|
|
234
|
+
*/
|
|
194
235
|
export type RequiredPowerSyncConnectionOptions = Required<BaseConnectionOptions>;
|
|
195
236
|
|
|
237
|
+
/**
|
|
238
|
+
* @internal
|
|
239
|
+
*/
|
|
196
240
|
export const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptions = {
|
|
197
241
|
appMetadata: {},
|
|
198
242
|
connectionMethod: SyncStreamConnectionMethod.WEB_SOCKET,
|
|
@@ -203,11 +247,17 @@ export const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptio
|
|
|
203
247
|
includeDefaultStreams: true
|
|
204
248
|
};
|
|
205
249
|
|
|
250
|
+
/**
|
|
251
|
+
* @internal
|
|
252
|
+
*/
|
|
206
253
|
export type SubscribedStream = {
|
|
207
254
|
name: string;
|
|
208
255
|
params: Record<string, any> | null;
|
|
209
256
|
};
|
|
210
257
|
|
|
258
|
+
/**
|
|
259
|
+
* @internal
|
|
260
|
+
*/
|
|
211
261
|
export abstract class AbstractStreamingSyncImplementation
|
|
212
262
|
extends BaseObserver<StreamingSyncImplementationListener>
|
|
213
263
|
implements StreamingSyncImplementation
|
|
@@ -570,7 +620,7 @@ The next upload iteration will be delayed.`);
|
|
|
570
620
|
}
|
|
571
621
|
|
|
572
622
|
/**
|
|
573
|
-
* Older versions of the JS SDK used to encode subkeys as JSON in
|
|
623
|
+
* Older versions of the JS SDK used to encode subkeys as JSON in `OplogEntry.toJSON`.
|
|
574
624
|
* Because subkeys are always strings, this leads to quotes being added around them in `ps_oplog`.
|
|
575
625
|
* While this is not a problem as long as it's done consistently, it causes issues when a database
|
|
576
626
|
* created by the JS SDK is used with other SDKs, or (more likely) when the new Rust sync client
|
|
@@ -580,7 +630,7 @@ The next upload iteration will be delayed.`);
|
|
|
580
630
|
* migration is only triggered when necessary (for now). The function returns whether the new format
|
|
581
631
|
* should be used, so that the JS SDK is able to write to updated databases.
|
|
582
632
|
*
|
|
583
|
-
* @param requireFixedKeyFormat Whether we require the new format or also support the old one.
|
|
633
|
+
* @param requireFixedKeyFormat - Whether we require the new format or also support the old one.
|
|
584
634
|
* The Rust client requires the new subkey format.
|
|
585
635
|
* @returns Whether the database is now using the new, fixed subkey format.
|
|
586
636
|
*/
|
|
@@ -42,7 +42,9 @@ export class WebsocketClientTransport implements ClientTransport {
|
|
|
42
42
|
resolve(new WebsocketDuplexConnection(websocket, new Deserializer(), multiplexerDemultiplexerFactory));
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
const errorListener = (
|
|
45
|
+
const errorListener = (event: Event) => {
|
|
46
|
+
const ev = event as ErrorEvent;
|
|
47
|
+
|
|
46
48
|
removeListeners();
|
|
47
49
|
// We add a default error in that case.
|
|
48
50
|
if (ev.error != null) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { AbstractPowerSyncDatabase } from '../AbstractPowerSyncDatabase.js';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
|
-
* A description of a sync stream, consisting of its {@link name} and the
|
|
2
|
+
* A description of a sync stream, consisting of its {@link SyncStreamDescription.name} and the
|
|
3
|
+
* {@link SyncStreamDescription.parameters} used when subscribing.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
5
6
|
*/
|
|
6
7
|
export interface SyncStreamDescription {
|
|
7
8
|
/**
|
|
@@ -21,6 +22,8 @@ export interface SyncStreamDescription {
|
|
|
21
22
|
* Information about a subscribed sync stream.
|
|
22
23
|
*
|
|
23
24
|
* This includes the {@link SyncStreamDescription}, along with information about the current sync status.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
24
27
|
*/
|
|
25
28
|
export interface SyncSubscriptionDescription extends SyncStreamDescription {
|
|
26
29
|
active: boolean;
|
|
@@ -28,15 +31,17 @@ export interface SyncSubscriptionDescription extends SyncStreamDescription {
|
|
|
28
31
|
* Whether this stream subscription is included by default, regardless of whether the stream has explicitly been
|
|
29
32
|
* subscribed to or not.
|
|
30
33
|
*
|
|
31
|
-
* It's possible for both {@link isDefault} and
|
|
32
|
-
*
|
|
34
|
+
* It's possible for both {@link SyncSubscriptionDescription.isDefault} and
|
|
35
|
+
* {@link SyncSubscriptionDescription.hasExplicitSubscription} to be true at the same time - this happens when a
|
|
36
|
+
* default stream was subscribed explicitly.
|
|
33
37
|
*/
|
|
34
38
|
isDefault: boolean;
|
|
35
39
|
/**
|
|
36
40
|
* Whether this stream has been subscribed to explicitly.
|
|
37
41
|
*
|
|
38
|
-
* It's possible for both {@link isDefault} and
|
|
39
|
-
*
|
|
42
|
+
* It's possible for both {@link SyncSubscriptionDescription.isDefault} and
|
|
43
|
+
* {@link SyncSubscriptionDescription.hasExplicitSubscription} to be true at the same time - this happens when a
|
|
44
|
+
* default stream was subscribed explicitly.
|
|
40
45
|
*/
|
|
41
46
|
hasExplicitSubscription: boolean;
|
|
42
47
|
/**
|
|
@@ -49,11 +54,14 @@ export interface SyncSubscriptionDescription extends SyncStreamDescription {
|
|
|
49
54
|
*/
|
|
50
55
|
hasSynced: boolean;
|
|
51
56
|
/**
|
|
52
|
-
* If {@link hasSynced} is true, the last time data from this stream has been synced.
|
|
57
|
+
* If {@link SyncSubscriptionDescription.hasSynced} is true, the last time data from this stream has been synced.
|
|
53
58
|
*/
|
|
54
59
|
lastSyncedAt: Date | null;
|
|
55
60
|
}
|
|
56
61
|
|
|
62
|
+
/**
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
57
65
|
export interface SyncStreamSubscribeOptions {
|
|
58
66
|
/**
|
|
59
67
|
* A "time to live" for this stream subscription, in seconds.
|
|
@@ -74,6 +82,8 @@ export interface SyncStreamSubscribeOptions {
|
|
|
74
82
|
* A handle to a {@link SyncStreamDescription} that allows subscribing to the stream.
|
|
75
83
|
*
|
|
76
84
|
* To obtain an instance of {@link SyncStream}, call {@link AbstractPowerSyncDatabase.syncStream}.
|
|
85
|
+
*
|
|
86
|
+
* @public
|
|
77
87
|
*/
|
|
78
88
|
export interface SyncStream extends SyncStreamDescription {
|
|
79
89
|
/**
|
|
@@ -82,7 +92,7 @@ export interface SyncStream extends SyncStreamDescription {
|
|
|
82
92
|
* You should keep a reference to the returned {@link SyncStreamSubscription} object along as you need data for that
|
|
83
93
|
* stream. As soon as {@link SyncStreamSubscription.unsubscribe} is called for all subscriptions on this stream
|
|
84
94
|
* (including subscriptions created on other tabs), the {@link SyncStreamSubscribeOptions.ttl} starts ticking and will
|
|
85
|
-
* eventually evict the stream (unless {@link subscribe} is called again).
|
|
95
|
+
* eventually evict the stream (unless {@link SyncStream.subscribe} is called again).
|
|
86
96
|
*/
|
|
87
97
|
subscribe(options?: SyncStreamSubscribeOptions): Promise<SyncStreamSubscription>;
|
|
88
98
|
|
|
@@ -94,6 +104,9 @@ export interface SyncStream extends SyncStreamDescription {
|
|
|
94
104
|
unsubscribeAll(): Promise<void>;
|
|
95
105
|
}
|
|
96
106
|
|
|
107
|
+
/**
|
|
108
|
+
* @public
|
|
109
|
+
*/
|
|
97
110
|
export interface SyncStreamSubscription extends SyncStreamDescription {
|
|
98
111
|
/**
|
|
99
112
|
* A promise that resolves once data from in this sync stream has been synced and applied.
|
|
@@ -2,7 +2,8 @@ import { LockContext } from '../../db/DBAdapter.js';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* SQLite operations to track changes for with {@link TriggerManager}
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
|
+
* @experimental @alpha
|
|
6
7
|
*/
|
|
7
8
|
export enum DiffTriggerOperation {
|
|
8
9
|
INSERT = 'INSERT',
|
|
@@ -11,7 +12,7 @@ export enum DiffTriggerOperation {
|
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
|
-
* @experimental
|
|
15
|
+
* @experimental @alpha
|
|
15
16
|
* Diffs created by {@link TriggerManager#createDiffTrigger} are stored in a temporary table.
|
|
16
17
|
* This is the base record structure for all diff records.
|
|
17
18
|
*
|
|
@@ -42,7 +43,7 @@ export interface BaseTriggerDiffRecord<TOperationId extends string | number = nu
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
/**
|
|
45
|
-
* @experimental
|
|
46
|
+
* @experimental @alpha
|
|
46
47
|
* Represents a diff record for a SQLite UPDATE operation.
|
|
47
48
|
* This record contains the new value and optionally the previous value.
|
|
48
49
|
* Values are stored as JSON strings.
|
|
@@ -62,7 +63,7 @@ export interface TriggerDiffUpdateRecord<
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
/**
|
|
65
|
-
* @experimental
|
|
66
|
+
* @experimental @alpha
|
|
66
67
|
* Represents a diff record for a SQLite INSERT operation.
|
|
67
68
|
* This record contains the new value represented as a JSON string.
|
|
68
69
|
*/
|
|
@@ -77,7 +78,7 @@ export interface TriggerDiffInsertRecord<
|
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
/**
|
|
80
|
-
* @experimental
|
|
81
|
+
* @experimental @alpha
|
|
81
82
|
* Represents a diff record for a SQLite DELETE operation.
|
|
82
83
|
* This record contains the new value represented as a JSON string.
|
|
83
84
|
*/
|
|
@@ -92,7 +93,7 @@ export interface TriggerDiffDeleteRecord<
|
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
/**
|
|
95
|
-
* @experimental
|
|
96
|
+
* @experimental @alpha
|
|
96
97
|
* Diffs created by {@link TriggerManager#createDiffTrigger} are stored in a temporary table.
|
|
97
98
|
* This is the record structure for all diff records.
|
|
98
99
|
*
|
|
@@ -121,7 +122,7 @@ export type TriggerDiffRecord<TOperationId extends string | number = number> =
|
|
|
121
122
|
| TriggerDiffDeleteRecord<TOperationId>;
|
|
122
123
|
|
|
123
124
|
/**
|
|
124
|
-
* @experimental
|
|
125
|
+
* @experimental @alpha
|
|
125
126
|
* Querying the DIFF table directly with {@link TriggerDiffHandlerContext#withExtractedDiff} will return records
|
|
126
127
|
* with the tracked columns extracted from the JSON value.
|
|
127
128
|
* This type represents the structure of such records.
|
|
@@ -150,7 +151,7 @@ export type ExtractedTriggerDiffRecord<T, TOperationId extends string | number =
|
|
|
150
151
|
};
|
|
151
152
|
|
|
152
153
|
/**
|
|
153
|
-
* @experimental
|
|
154
|
+
* @experimental @alpha
|
|
154
155
|
* Hooks used in the creation of a table diff trigger.
|
|
155
156
|
*/
|
|
156
157
|
export interface TriggerCreationHooks {
|
|
@@ -213,7 +214,7 @@ interface BaseCreateDiffTriggerOptions {
|
|
|
213
214
|
}
|
|
214
215
|
|
|
215
216
|
/**
|
|
216
|
-
* @experimental
|
|
217
|
+
* @experimental @alpha
|
|
217
218
|
* Options for {@link TriggerManager#createDiffTrigger}.
|
|
218
219
|
*/
|
|
219
220
|
export interface CreateDiffTriggerOptions extends BaseCreateDiffTriggerOptions {
|
|
@@ -232,7 +233,7 @@ export interface CreateDiffTriggerOptions extends BaseCreateDiffTriggerOptions {
|
|
|
232
233
|
}
|
|
233
234
|
|
|
234
235
|
/**
|
|
235
|
-
* @experimental
|
|
236
|
+
* @experimental @alpha
|
|
236
237
|
* Options for {@link TriggerRemoveCallback}.
|
|
237
238
|
*/
|
|
238
239
|
export interface TriggerRemoveCallbackOptions {
|
|
@@ -240,12 +241,12 @@ export interface TriggerRemoveCallbackOptions {
|
|
|
240
241
|
}
|
|
241
242
|
|
|
242
243
|
/**
|
|
243
|
-
* @experimental
|
|
244
|
+
* @experimental @alpha
|
|
244
245
|
* Callback to drop a trigger after it has been created.
|
|
245
246
|
*/
|
|
246
247
|
export type TriggerRemoveCallback = (options?: TriggerRemoveCallbackOptions) => Promise<void>;
|
|
247
248
|
/**
|
|
248
|
-
* @experimental
|
|
249
|
+
* @experimental @alpha
|
|
249
250
|
* Options for {@link TriggerDiffHandlerContext#withDiff}.
|
|
250
251
|
*/
|
|
251
252
|
export interface WithDiffOptions {
|
|
@@ -260,7 +261,7 @@ export interface WithDiffOptions {
|
|
|
260
261
|
}
|
|
261
262
|
|
|
262
263
|
/**
|
|
263
|
-
* @experimental
|
|
264
|
+
* @experimental @alpha
|
|
264
265
|
* Context for the `onChange` handler provided to {@link TriggerManager#trackTableDiff}.
|
|
265
266
|
*/
|
|
266
267
|
export interface TriggerDiffHandlerContext extends LockContext {
|
|
@@ -317,7 +318,7 @@ export interface TriggerDiffHandlerContext extends LockContext {
|
|
|
317
318
|
* Allows querying the database with access to the table containing diff records.
|
|
318
319
|
* The diff table is accessible via the `DIFF` accessor.
|
|
319
320
|
*
|
|
320
|
-
* This is similar to {@link withDiff} but extracts the row columns from the tracked JSON value. The diff operation
|
|
321
|
+
* This is similar to {@link TriggerDiffHandlerContext#withDiff} but extracts the row columns from the tracked JSON value. The diff operation
|
|
321
322
|
* data is aliased as `__` columns to avoid column conflicts.
|
|
322
323
|
*
|
|
323
324
|
* For {@link DiffTriggerOperation#DELETE} operations the previous_value columns are extracted for convenience.
|
|
@@ -349,7 +350,7 @@ export interface TriggerDiffHandlerContext extends LockContext {
|
|
|
349
350
|
}
|
|
350
351
|
|
|
351
352
|
/**
|
|
352
|
-
* @experimental
|
|
353
|
+
* @experimental @alpha
|
|
353
354
|
* Options for tracking changes to a table with {@link TriggerManager#trackTableDiff}.
|
|
354
355
|
*/
|
|
355
356
|
export interface TrackDiffOptions extends BaseCreateDiffTriggerOptions {
|
|
@@ -361,14 +362,14 @@ export interface TrackDiffOptions extends BaseCreateDiffTriggerOptions {
|
|
|
361
362
|
onChange: (context: TriggerDiffHandlerContext) => Promise<void>;
|
|
362
363
|
|
|
363
364
|
/**
|
|
364
|
-
* The minimum interval, in milliseconds, between {@link onChange} invocations.
|
|
365
|
+
* The minimum interval, in milliseconds, between {@link TrackDiffOptions.onChange} invocations.
|
|
365
366
|
* @default {@link DEFAULT_WATCH_THROTTLE_MS}
|
|
366
367
|
*/
|
|
367
368
|
throttleMs?: number;
|
|
368
369
|
}
|
|
369
370
|
|
|
370
371
|
/**
|
|
371
|
-
* @experimental
|
|
372
|
+
* @experimental @alpha
|
|
372
373
|
*/
|
|
373
374
|
export interface TriggerManager {
|
|
374
375
|
/**
|
|
@@ -417,7 +418,7 @@ export interface TriggerManager {
|
|
|
417
418
|
/**
|
|
418
419
|
* @experimental
|
|
419
420
|
* Tracks changes for a table. Triggering a provided handler on changes.
|
|
420
|
-
* Uses {@link createDiffTrigger} internally to create a temporary destination table.
|
|
421
|
+
* Uses {@link TriggerManager.createDiffTrigger} internally to create a temporary destination table.
|
|
421
422
|
*
|
|
422
423
|
* @returns A callback to cleanup the trigger and stop tracking changes.
|
|
423
424
|
*
|
|
@@ -97,8 +97,8 @@ export class TriggerManagerImpl implements TriggerManager {
|
|
|
97
97
|
return this.options.db;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
protected async getUUID() {
|
|
101
|
-
const { id: uuid } = await this.db.get<{ id: string }>(/* sql */ `
|
|
100
|
+
protected async getUUID(ctx?: LockContext) {
|
|
101
|
+
const { id: uuid } = await (ctx ?? this.db).get<{ id: string }>(/* sql */ `
|
|
102
102
|
SELECT
|
|
103
103
|
uuid () as id
|
|
104
104
|
`);
|
|
@@ -237,7 +237,7 @@ export class TriggerManagerImpl implements TriggerManager {
|
|
|
237
237
|
const internalSource = sourceDefinition.internalName;
|
|
238
238
|
const triggerIds: string[] = [];
|
|
239
239
|
|
|
240
|
-
const id = await this.getUUID();
|
|
240
|
+
const id = await this.getUUID(setupContext);
|
|
241
241
|
|
|
242
242
|
const releaseStorageClaim = useStorage ? await this.options.claimManager.obtainClaim(id) : null;
|
|
243
243
|
|
|
@@ -421,7 +421,7 @@ export class TriggerManagerImpl implements TriggerManager {
|
|
|
421
421
|
const callbackResult = await options.onChange({
|
|
422
422
|
...tx,
|
|
423
423
|
destinationTable: destination,
|
|
424
|
-
withDiff: async <T>(query, params, options?: WithDiffOptions) => {
|
|
424
|
+
withDiff: async <T>(query: string, params: any, options?: WithDiffOptions) => {
|
|
425
425
|
// Wrap the query to expose the destination table
|
|
426
426
|
const operationIdSelect = options?.castOperationIdAsText
|
|
427
427
|
? 'id, operation, CAST(operation_id AS TEXT) as operation_id, timestamp, value, previous_value'
|
|
@@ -439,7 +439,7 @@ export class TriggerManagerImpl implements TriggerManager {
|
|
|
439
439
|
`;
|
|
440
440
|
return tx.getAll<T>(wrappedQuery, params);
|
|
441
441
|
},
|
|
442
|
-
withExtractedDiff: async <T>(query, params) => {
|
|
442
|
+
withExtractedDiff: async <T>(query: string, params: any) => {
|
|
443
443
|
// Wrap the query to expose the destination table
|
|
444
444
|
const wrappedQuery = /* sql */ `
|
|
445
445
|
WITH
|