@powersync/common 0.0.0-dev-20260504100448 → 0.0.0-dev-20260630141119
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/lib/attachments/AttachmentContext.d.ts +9 -8
- package/lib/attachments/AttachmentContext.js +8 -3
- package/lib/attachments/AttachmentContext.js.map +1 -1
- package/lib/attachments/AttachmentErrorHandler.d.ts +6 -6
- package/lib/attachments/AttachmentQueue.d.ts +85 -36
- package/lib/attachments/AttachmentQueue.js +19 -21
- package/lib/attachments/AttachmentQueue.js.map +1 -1
- package/lib/attachments/AttachmentService.d.ts +3 -3
- package/lib/attachments/AttachmentService.js +4 -3
- package/lib/attachments/AttachmentService.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 +14 -6
- package/lib/attachments/Schema.js +8 -3
- package/lib/attachments/Schema.js.map +1 -1
- package/lib/attachments/SyncingService.d.ts +2 -2
- package/lib/attachments/SyncingService.js +8 -3
- package/lib/attachments/SyncingService.js.map +1 -1
- package/lib/attachments/WatchedAttachmentItem.d.ts +3 -1
- package/lib/client/{AbstractPowerSyncDatabase.d.ts → CommonPowerSyncDatabase.d.ts} +112 -238
- package/lib/client/CommonPowerSyncDatabase.js +2 -0
- package/lib/client/CommonPowerSyncDatabase.js.map +1 -0
- package/lib/client/Query.d.ts +9 -0
- package/lib/client/SQLOpenFactory.d.ts +44 -10
- package/lib/client/SQLOpenFactory.js +1 -19
- package/lib/client/SQLOpenFactory.js.map +1 -1
- package/lib/client/compilableQueryWatch.d.ts +8 -2
- package/lib/client/compilableQueryWatch.js +4 -2
- package/lib/client/compilableQueryWatch.js.map +1 -1
- package/lib/client/connection/PowerSyncBackendConnector.d.ts +6 -3
- package/lib/client/connection/PowerSyncCredentials.d.ts +3 -0
- package/lib/client/runOnSchemaChange.d.ts +5 -2
- package/lib/client/runOnSchemaChange.js +3 -0
- package/lib/client/runOnSchemaChange.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 -31
- package/lib/client/sync/bucket/CrudEntry.js +2 -97
- 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/options.d.ts +65 -0
- package/lib/client/sync/options.js +25 -0
- package/lib/client/sync/options.js.map +1 -0
- package/lib/client/sync/stream/JsonValue.d.ts +3 -0
- package/lib/client/sync/sync-streams.d.ts +23 -8
- package/lib/client/triggers/TriggerManager.d.ts +28 -56
- package/lib/client/triggers/TriggerManager.js +2 -1
- package/lib/client/triggers/TriggerManager.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 +7 -3
- package/lib/client/watched/GetAllQuery.js +3 -1
- package/lib/client/watched/GetAllQuery.js.map +1 -1
- package/lib/client/watched/WatchedQuery.d.ts +20 -6
- package/lib/client/watched/WatchedQuery.js +3 -5
- package/lib/client/watched/WatchedQuery.js.map +1 -1
- package/lib/client/watched/processors/DifferentialQueryProcessor.d.ts +15 -45
- package/lib/client/watched/processors/DifferentialQueryProcessor.js +1 -172
- package/lib/client/watched/processors/DifferentialQueryProcessor.js.map +1 -1
- package/lib/client/watched/processors/OnChangeQueryProcessor.d.ts +4 -22
- package/lib/client/watched/processors/OnChangeQueryProcessor.js +1 -82
- 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/DBAdapter.d.ts +90 -113
- package/lib/db/DBAdapter.js +70 -89
- package/lib/db/DBAdapter.js.map +1 -1
- package/lib/db/QueryResult.d.ts +104 -0
- package/lib/db/QueryResult.js +96 -0
- package/lib/db/QueryResult.js.map +1 -0
- package/lib/db/crud/SyncProgress.d.ts +7 -14
- package/lib/db/crud/SyncProgress.js +1 -60
- package/lib/db/crud/SyncProgress.js.map +1 -1
- package/lib/db/crud/SyncStatus.d.ts +54 -91
- package/lib/db/crud/SyncStatus.js +1 -245
- 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 +22 -1
- package/lib/db/schema/Column.js +10 -4
- package/lib/db/schema/Column.js.map +1 -1
- package/lib/db/schema/Index.d.ts +8 -3
- package/lib/db/schema/Index.js +4 -1
- package/lib/db/schema/Index.js.map +1 -1
- package/lib/db/schema/IndexedColumn.d.ts +8 -3
- package/lib/db/schema/IndexedColumn.js +4 -1
- 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 +10 -29
- package/lib/db/schema/Schema.js +3 -1
- package/lib/db/schema/Schema.js.map +1 -1
- package/lib/db/schema/Table.d.ts +69 -91
- package/lib/db/schema/Table.js +88 -87
- package/lib/db/schema/Table.js.map +1 -1
- package/lib/index.d.ts +6 -22
- package/lib/index.js +5 -22
- package/lib/index.js.map +1 -1
- package/lib/types/types.d.ts +6 -0
- 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/Logger.d.ts +60 -22
- package/lib/utils/Logger.js +38 -30
- package/lib/utils/Logger.js.map +1 -1
- package/lib/utils/MetaBaseObserver.d.ts +11 -11
- package/lib/utils/MetaBaseObserver.js +1 -50
- package/lib/utils/MetaBaseObserver.js.map +1 -1
- package/lib/utils/mutex.d.ts +3 -45
- package/lib/utils/mutex.js +1 -153
- package/lib/utils/mutex.js.map +1 -1
- package/package.json +9 -46
- package/src/attachments/AttachmentContext.ts +15 -13
- package/src/attachments/AttachmentErrorHandler.ts +6 -6
- package/src/attachments/AttachmentQueue.ts +99 -42
- package/src/attachments/AttachmentService.ts +7 -6
- 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 +14 -6
- package/src/attachments/SyncingService.ts +10 -6
- package/src/attachments/WatchedAttachmentItem.ts +3 -1
- package/src/client/CommonPowerSyncDatabase.ts +540 -0
- package/src/client/Query.ts +9 -0
- package/src/client/SQLOpenFactory.ts +47 -19
- package/src/client/compilableQueryWatch.ts +9 -4
- package/src/client/connection/PowerSyncBackendConnector.ts +6 -3
- package/src/client/connection/PowerSyncCredentials.ts +3 -0
- package/src/client/runOnSchemaChange.ts +5 -2
- package/src/client/sync/bucket/CrudBatch.ts +2 -0
- package/src/client/sync/bucket/CrudEntry.ts +10 -101
- package/src/client/sync/bucket/CrudTransaction.ts +3 -0
- package/src/client/sync/options.ts +77 -0
- package/src/client/sync/stream/JsonValue.ts +3 -0
- package/src/client/sync/sync-streams.ts +23 -10
- package/src/client/triggers/TriggerManager.ts +29 -59
- package/src/client/triggers/sanitizeSQL.ts +5 -0
- package/src/client/watched/GetAllQuery.ts +8 -4
- package/src/client/watched/WatchedQuery.ts +20 -11
- package/src/client/watched/processors/DifferentialQueryProcessor.ts +19 -219
- package/src/client/watched/processors/OnChangeQueryProcessor.ts +4 -109
- package/src/client/watched/processors/comparators.ts +8 -0
- package/src/db/DBAdapter.ts +160 -175
- package/src/db/QueryResult.ts +195 -0
- package/src/db/crud/SyncProgress.ts +8 -43
- package/src/db/crud/SyncStatus.ts +66 -216
- package/src/db/crud/UploadQueueStatus.ts +3 -0
- package/src/db/schema/Column.ts +22 -5
- package/src/db/schema/Index.ts +9 -3
- package/src/db/schema/IndexedColumn.ts +9 -3
- package/src/db/schema/RawTable.ts +7 -1
- package/src/db/schema/Schema.ts +12 -7
- package/src/db/schema/Table.ts +130 -180
- package/src/index.ts +6 -22
- package/src/types/types.ts +6 -0
- package/src/utils/BaseObserver.ts +12 -0
- package/src/utils/Logger.ts +86 -31
- package/src/utils/MetaBaseObserver.ts +14 -60
- package/src/utils/mutex.ts +4 -189
- package/dist/bundle.cjs +0 -14136
- package/dist/bundle.cjs.map +0 -1
- package/dist/bundle.mjs +0 -14056
- package/dist/bundle.mjs.map +0 -1
- package/dist/bundle.node.cjs +0 -11613
- package/dist/bundle.node.cjs.map +0 -1
- package/dist/bundle.node.mjs +0 -11533
- package/dist/bundle.node.mjs.map +0 -1
- package/dist/index.d.cts +0 -4052
- package/legacy/sync_protocol.d.ts +0 -103
- package/lib/client/AbstractPowerSyncDatabase.js +0 -987
- package/lib/client/AbstractPowerSyncDatabase.js.map +0 -1
- package/lib/client/AbstractPowerSyncOpenFactory.d.ts +0 -22
- package/lib/client/AbstractPowerSyncOpenFactory.js +0 -25
- package/lib/client/AbstractPowerSyncOpenFactory.js.map +0 -1
- package/lib/client/ConnectionManager.d.ts +0 -112
- package/lib/client/ConnectionManager.js +0 -294
- package/lib/client/ConnectionManager.js.map +0 -1
- package/lib/client/CustomQuery.d.ts +0 -22
- package/lib/client/CustomQuery.js +0 -43
- package/lib/client/CustomQuery.js.map +0 -1
- package/lib/client/constants.d.ts +0 -1
- package/lib/client/constants.js +0 -2
- package/lib/client/constants.js.map +0 -1
- package/lib/client/sync/bucket/BucketStorageAdapter.d.ts +0 -40
- package/lib/client/sync/bucket/BucketStorageAdapter.js +0 -19
- package/lib/client/sync/bucket/BucketStorageAdapter.js.map +0 -1
- package/lib/client/sync/bucket/SqliteBucketStorage.d.ts +0 -34
- package/lib/client/sync/bucket/SqliteBucketStorage.js +0 -162
- package/lib/client/sync/bucket/SqliteBucketStorage.js.map +0 -1
- package/lib/client/sync/stream/AbstractRemote.d.ts +0 -151
- package/lib/client/sync/stream/AbstractRemote.js +0 -473
- package/lib/client/sync/stream/AbstractRemote.js.map +0 -1
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.d.ts +0 -218
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js +0 -663
- package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js.map +0 -1
- package/lib/client/sync/stream/WebsocketClientTransport.d.ts +0 -15
- package/lib/client/sync/stream/WebsocketClientTransport.js +0 -61
- package/lib/client/sync/stream/WebsocketClientTransport.js.map +0 -1
- package/lib/client/sync/stream/core-instruction.d.ts +0 -71
- package/lib/client/sync/stream/core-instruction.js +0 -27
- package/lib/client/sync/stream/core-instruction.js.map +0 -1
- package/lib/client/triggers/MemoryTriggerClaimManager.d.ts +0 -6
- package/lib/client/triggers/MemoryTriggerClaimManager.js +0 -21
- package/lib/client/triggers/MemoryTriggerClaimManager.js.map +0 -1
- package/lib/client/triggers/TriggerManagerImpl.d.ts +0 -39
- package/lib/client/triggers/TriggerManagerImpl.js +0 -405
- package/lib/client/triggers/TriggerManagerImpl.js.map +0 -1
- package/lib/client/watched/processors/AbstractQueryProcessor.d.ts +0 -68
- package/lib/client/watched/processors/AbstractQueryProcessor.js +0 -151
- package/lib/client/watched/processors/AbstractQueryProcessor.js.map +0 -1
- package/lib/db/ConnectionClosedError.d.ts +0 -10
- package/lib/db/ConnectionClosedError.js +0 -21
- package/lib/db/ConnectionClosedError.js.map +0 -1
- package/lib/db/schema/TableV2.d.ts +0 -9
- package/lib/db/schema/TableV2.js +0 -9
- package/lib/db/schema/TableV2.js.map +0 -1
- package/lib/utils/AbortOperation.d.ts +0 -9
- package/lib/utils/AbortOperation.js +0 -19
- package/lib/utils/AbortOperation.js.map +0 -1
- package/lib/utils/ControlledExecutor.d.ts +0 -25
- package/lib/utils/ControlledExecutor.js +0 -51
- package/lib/utils/ControlledExecutor.js.map +0 -1
- package/lib/utils/async.d.ts +0 -14
- package/lib/utils/async.js +0 -46
- package/lib/utils/async.js.map +0 -1
- package/lib/utils/parseQuery.d.ts +0 -6
- package/lib/utils/parseQuery.js +0 -17
- package/lib/utils/parseQuery.js.map +0 -1
- package/lib/utils/queue.d.ts +0 -16
- package/lib/utils/queue.js +0 -42
- package/lib/utils/queue.js.map +0 -1
- package/lib/utils/stream_transform.d.ts +0 -39
- package/lib/utils/stream_transform.js +0 -206
- package/lib/utils/stream_transform.js.map +0 -1
- package/src/client/AbstractPowerSyncDatabase.ts +0 -1362
- package/src/client/AbstractPowerSyncOpenFactory.ts +0 -39
- package/src/client/ConnectionManager.ts +0 -402
- package/src/client/CustomQuery.ts +0 -56
- package/src/client/constants.ts +0 -1
- package/src/client/sync/bucket/BucketStorageAdapter.ts +0 -49
- package/src/client/sync/bucket/SqliteBucketStorage.ts +0 -199
- package/src/client/sync/stream/AbstractRemote.ts +0 -602
- package/src/client/sync/stream/AbstractStreamingSyncImplementation.ts +0 -905
- package/src/client/sync/stream/WebsocketClientTransport.ts +0 -80
- package/src/client/sync/stream/core-instruction.ts +0 -98
- package/src/client/triggers/MemoryTriggerClaimManager.ts +0 -25
- package/src/client/triggers/TriggerManagerImpl.ts +0 -496
- package/src/client/watched/processors/AbstractQueryProcessor.ts +0 -226
- package/src/db/ConnectionClosedError.ts +0 -23
- package/src/db/schema/TableV2.ts +0 -9
- package/src/utils/AbortOperation.ts +0 -17
- package/src/utils/ControlledExecutor.ts +0 -72
- package/src/utils/async.ts +0 -50
- package/src/utils/parseQuery.ts +0 -25
- package/src/utils/queue.ts +0 -48
- package/src/utils/stream_transform.ts +0 -252
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { SyncClientImplementation } from '../../client/sync/stream/AbstractStreamingSyncImplementation.js';
|
|
2
|
-
import { CoreStreamSubscription } from '../../client/sync/stream/core-instruction.js';
|
|
3
1
|
import { SyncStreamDescription, SyncSubscriptionDescription } from '../../client/sync/sync-streams.js';
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { ProgressWithOperations, SyncProgress } from './SyncProgress.js';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
* @deprecated All fields are available on {@link SyncStatus} directly.
|
|
6
|
+
*/
|
|
7
|
+
export interface SyncDataFlowStatus {
|
|
6
8
|
downloading: boolean;
|
|
7
9
|
uploading: boolean;
|
|
8
10
|
/**
|
|
@@ -16,94 +18,69 @@ export type SyncDataFlowStatus = Partial<{
|
|
|
16
18
|
* Cleared on the next successful upload.
|
|
17
19
|
*/
|
|
18
20
|
uploadError?: Error;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
*/
|
|
24
|
-
downloadProgress: InternalProgressInformation | null;
|
|
25
|
-
internalStreamSubscriptions: CoreStreamSubscription[] | null;
|
|
26
|
-
}>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
27
25
|
export interface SyncPriorityStatus {
|
|
28
26
|
priority: number;
|
|
29
27
|
lastSyncedAt?: Date;
|
|
30
28
|
hasSynced?: boolean;
|
|
31
29
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
lastSyncedAt?: Date;
|
|
37
|
-
hasSynced?: boolean;
|
|
38
|
-
priorityStatusEntries?: SyncPriorityStatus[];
|
|
39
|
-
clientImplementation?: SyncClientImplementation;
|
|
40
|
-
};
|
|
41
|
-
export declare class SyncStatus {
|
|
42
|
-
protected options: SyncStatusOptions;
|
|
43
|
-
constructor(options: SyncStatusOptions);
|
|
44
|
-
/**
|
|
45
|
-
* Returns the used sync client implementation (either the one implemented in JavaScript or the newer Rust-based
|
|
46
|
-
* implementation).
|
|
47
|
-
*
|
|
48
|
-
* This information is only available after a connection has been requested.
|
|
49
|
-
*/
|
|
50
|
-
get clientImplementation(): SyncClientImplementation | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export interface SyncStatus {
|
|
51
34
|
/**
|
|
52
35
|
* Indicates if the client is currently connected to the PowerSync service.
|
|
53
36
|
*
|
|
54
|
-
* @returns
|
|
37
|
+
* @returns True if connected, false otherwise. Defaults to false if not specified.
|
|
55
38
|
*/
|
|
56
39
|
get connected(): boolean;
|
|
57
40
|
/**
|
|
58
41
|
* Indicates if the client is in the process of establishing a connection to the PowerSync service.
|
|
59
42
|
*
|
|
60
|
-
* @returns
|
|
43
|
+
* @returns True if connecting, false otherwise. Defaults to false if not specified.
|
|
61
44
|
*/
|
|
62
45
|
get connecting(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the PowerSync SDK is currently downloading data from the connected PowerSync service.
|
|
48
|
+
*/
|
|
49
|
+
get downloading(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the PowerSync SDK is currently uploading local mutations through the configured
|
|
52
|
+
* {@link PowerSyncBackendConnector}.
|
|
53
|
+
*/
|
|
54
|
+
get uploading(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* An error that occurred during downloads (including connection establishment errors).
|
|
57
|
+
*
|
|
58
|
+
* A download error will be reported on all sync status entries until the next successful sync.
|
|
59
|
+
*/
|
|
60
|
+
get downloadError(): Error | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Error during uploading.
|
|
63
|
+
* Cleared on the next successful upload.
|
|
64
|
+
*/
|
|
65
|
+
get uploadError(): Error | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated All fields on {@link SyncDataFlowStatus} are available on {@link SyncStatus} directly.
|
|
68
|
+
*/
|
|
69
|
+
get dataFlowStatus(): SyncDataFlowStatus;
|
|
63
70
|
/**
|
|
64
71
|
* Time that a last sync has fully completed, if any.
|
|
65
72
|
* This timestamp is reset to null after a restart of the PowerSync service.
|
|
66
73
|
*
|
|
67
|
-
* @returns
|
|
74
|
+
* @returns The timestamp of the last successful sync, or undefined if no sync has completed.
|
|
68
75
|
*/
|
|
69
76
|
get lastSyncedAt(): Date | undefined;
|
|
70
77
|
/**
|
|
71
78
|
* Indicates whether there has been at least one full sync completed since initialization.
|
|
72
79
|
*
|
|
73
|
-
* @returns
|
|
80
|
+
* @returns True if at least one sync has completed, false if no sync has completed,
|
|
74
81
|
* or undefined when the state is still being loaded from the database.
|
|
75
82
|
*/
|
|
76
83
|
get hasSynced(): boolean | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* Provides the current data flow status regarding uploads and downloads.
|
|
79
|
-
*
|
|
80
|
-
* @returns {SyncDataFlowStatus} An object containing:
|
|
81
|
-
* - downloading: True if actively downloading changes (only when connected is also true)
|
|
82
|
-
* - uploading: True if actively uploading changes
|
|
83
|
-
* Defaults to {downloading: false, uploading: false} if not specified.
|
|
84
|
-
*/
|
|
85
|
-
get dataFlowStatus(): Partial<{
|
|
86
|
-
downloading: boolean;
|
|
87
|
-
uploading: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Error during downloading (including connecting).
|
|
90
|
-
*
|
|
91
|
-
* Cleared on the next successful data download.
|
|
92
|
-
*/
|
|
93
|
-
downloadError?: Error;
|
|
94
|
-
/**
|
|
95
|
-
* Error during uploading.
|
|
96
|
-
* Cleared on the next successful upload.
|
|
97
|
-
*/
|
|
98
|
-
uploadError?: Error;
|
|
99
|
-
/**
|
|
100
|
-
* Internal information about how far we are downloading operations in buckets.
|
|
101
|
-
*
|
|
102
|
-
* Please use the {@link SyncStatus#downloadProgress} property to track sync progress.
|
|
103
|
-
*/
|
|
104
|
-
downloadProgress: InternalProgressInformation | null;
|
|
105
|
-
internalStreamSubscriptions: CoreStreamSubscription[] | null;
|
|
106
|
-
}>;
|
|
107
84
|
/**
|
|
108
85
|
* All sync streams currently being tracked in teh database.
|
|
109
86
|
*
|
|
@@ -112,21 +89,21 @@ export declare class SyncStatus {
|
|
|
112
89
|
*/
|
|
113
90
|
get syncStreams(): SyncStreamStatus[] | undefined;
|
|
114
91
|
/**
|
|
115
|
-
* If the `stream` appears in {@link syncStreams}, returns the current status for that stream.
|
|
92
|
+
* If the `stream` appears in {@link SyncStatus.syncStreams}, returns the current status for that stream.
|
|
116
93
|
*/
|
|
117
94
|
forStream(stream: SyncStreamDescription): SyncStreamStatus | undefined;
|
|
118
95
|
/**
|
|
119
96
|
* Provides sync status information for all bucket priorities, sorted by priority (highest first).
|
|
120
97
|
*
|
|
121
|
-
* @returns
|
|
98
|
+
* @returns An array of status entries for different sync priority levels,
|
|
122
99
|
* sorted with highest priorities (lower numbers) first.
|
|
123
100
|
*/
|
|
124
|
-
get priorityStatusEntries(): SyncPriorityStatus[];
|
|
101
|
+
get priorityStatusEntries(): SyncPriorityStatus[] | undefined;
|
|
125
102
|
/**
|
|
126
103
|
* A realtime progress report on how many operations have been downloaded and
|
|
127
104
|
* how many are necessary in total to complete the next sync iteration.
|
|
128
105
|
*
|
|
129
|
-
* This field is only set when {@link
|
|
106
|
+
* This field is only set when {@link SyncStatus#downloading} is also true.
|
|
130
107
|
*/
|
|
131
108
|
get downloadProgress(): SyncProgress | null;
|
|
132
109
|
/**
|
|
@@ -145,44 +122,30 @@ export declare class SyncStatus {
|
|
|
145
122
|
* For example, if PowerSync just finished synchronizing buckets in priority level 3, calling this method
|
|
146
123
|
* with a priority of 1 may return information for priority level 3.
|
|
147
124
|
*
|
|
148
|
-
* @param
|
|
149
|
-
* @returns
|
|
125
|
+
* @param priority - The bucket priority for which the status should be reported
|
|
126
|
+
* @returns Status information for the requested priority level or the next higher level with available status
|
|
150
127
|
*/
|
|
151
|
-
statusForPriority(priority: number): SyncPriorityStatus;
|
|
128
|
+
statusForPriority(priority: number): SyncPriorityStatus | undefined;
|
|
152
129
|
/**
|
|
153
130
|
* Compares this SyncStatus instance with another to determine if they are equal.
|
|
154
131
|
* Equality is determined by comparing the serialized JSON representation of both instances.
|
|
155
132
|
*
|
|
156
|
-
* @param
|
|
157
|
-
* @returns
|
|
133
|
+
* @param status - The SyncStatus instance to compare against
|
|
134
|
+
* @returns True if the instances are considered equal, false otherwise
|
|
158
135
|
*/
|
|
159
136
|
isEqual(status: SyncStatus): boolean;
|
|
160
137
|
/**
|
|
161
138
|
* Creates a human-readable string representation of the current sync status.
|
|
162
139
|
* Includes information about connection state, sync completion, and data flow.
|
|
163
140
|
*
|
|
164
|
-
* @returns
|
|
141
|
+
* @returns A string representation of the sync status
|
|
165
142
|
*/
|
|
166
143
|
getMessage(): string;
|
|
167
|
-
/**
|
|
168
|
-
* Serializes the SyncStatus instance to a plain object.
|
|
169
|
-
*
|
|
170
|
-
* @returns {SyncStatusOptions} A plain object representation of the sync status
|
|
171
|
-
*/
|
|
172
|
-
toJSON(): SyncStatusOptions;
|
|
173
|
-
/**
|
|
174
|
-
* Not all errors are serializable over a MessagePort. E.g. some `DomExceptions` fail to be passed across workers.
|
|
175
|
-
* This explicitly serializes errors in the SyncStatus.
|
|
176
|
-
*/
|
|
177
|
-
protected serializeError(error?: Error): {
|
|
178
|
-
name: string;
|
|
179
|
-
message: string;
|
|
180
|
-
stack: string | undefined;
|
|
181
|
-
} | undefined;
|
|
182
|
-
private static comparePriorities;
|
|
183
144
|
}
|
|
184
145
|
/**
|
|
185
146
|
* Information about a sync stream subscription.
|
|
147
|
+
*
|
|
148
|
+
* @public
|
|
186
149
|
*/
|
|
187
150
|
export interface SyncStreamStatus {
|
|
188
151
|
progress: ProgressWithOperations | null;
|
|
@@ -1,246 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export class SyncStatus {
|
|
3
|
-
options;
|
|
4
|
-
constructor(options) {
|
|
5
|
-
this.options = options;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Returns the used sync client implementation (either the one implemented in JavaScript or the newer Rust-based
|
|
9
|
-
* implementation).
|
|
10
|
-
*
|
|
11
|
-
* This information is only available after a connection has been requested.
|
|
12
|
-
*/
|
|
13
|
-
get clientImplementation() {
|
|
14
|
-
return this.options.clientImplementation;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Indicates if the client is currently connected to the PowerSync service.
|
|
18
|
-
*
|
|
19
|
-
* @returns {boolean} True if connected, false otherwise. Defaults to false if not specified.
|
|
20
|
-
*/
|
|
21
|
-
get connected() {
|
|
22
|
-
return this.options.connected ?? false;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Indicates if the client is in the process of establishing a connection to the PowerSync service.
|
|
26
|
-
*
|
|
27
|
-
* @returns {boolean} True if connecting, false otherwise. Defaults to false if not specified.
|
|
28
|
-
*/
|
|
29
|
-
get connecting() {
|
|
30
|
-
return this.options.connecting ?? false;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Time that a last sync has fully completed, if any.
|
|
34
|
-
* This timestamp is reset to null after a restart of the PowerSync service.
|
|
35
|
-
*
|
|
36
|
-
* @returns {Date | undefined} The timestamp of the last successful sync, or undefined if no sync has completed.
|
|
37
|
-
*/
|
|
38
|
-
get lastSyncedAt() {
|
|
39
|
-
return this.options.lastSyncedAt;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Indicates whether there has been at least one full sync completed since initialization.
|
|
43
|
-
*
|
|
44
|
-
* @returns {boolean | undefined} True if at least one sync has completed, false if no sync has completed,
|
|
45
|
-
* or undefined when the state is still being loaded from the database.
|
|
46
|
-
*/
|
|
47
|
-
get hasSynced() {
|
|
48
|
-
return this.options.hasSynced;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Provides the current data flow status regarding uploads and downloads.
|
|
52
|
-
*
|
|
53
|
-
* @returns {SyncDataFlowStatus} An object containing:
|
|
54
|
-
* - downloading: True if actively downloading changes (only when connected is also true)
|
|
55
|
-
* - uploading: True if actively uploading changes
|
|
56
|
-
* Defaults to {downloading: false, uploading: false} if not specified.
|
|
57
|
-
*/
|
|
58
|
-
get dataFlowStatus() {
|
|
59
|
-
return (this.options.dataFlow ?? {
|
|
60
|
-
/**
|
|
61
|
-
* true if actively downloading changes.
|
|
62
|
-
* This is only true when {@link connected} is also true.
|
|
63
|
-
*/
|
|
64
|
-
downloading: false,
|
|
65
|
-
/**
|
|
66
|
-
* true if uploading changes.
|
|
67
|
-
*/
|
|
68
|
-
uploading: false
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* All sync streams currently being tracked in teh database.
|
|
73
|
-
*
|
|
74
|
-
* This returns null when the database is currently being opened and we don't have reliable information about all
|
|
75
|
-
* included streams yet.
|
|
76
|
-
*/
|
|
77
|
-
get syncStreams() {
|
|
78
|
-
return this.options.dataFlow?.internalStreamSubscriptions?.map((core) => new SyncStreamStatusView(this, core));
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* If the `stream` appears in {@link syncStreams}, returns the current status for that stream.
|
|
82
|
-
*/
|
|
83
|
-
forStream(stream) {
|
|
84
|
-
const asJson = JSON.stringify(stream.parameters);
|
|
85
|
-
const raw = this.options.dataFlow?.internalStreamSubscriptions?.find((r) => r.name == stream.name && asJson == JSON.stringify(r.parameters));
|
|
86
|
-
return raw && new SyncStreamStatusView(this, raw);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Provides sync status information for all bucket priorities, sorted by priority (highest first).
|
|
90
|
-
*
|
|
91
|
-
* @returns {SyncPriorityStatus[]} An array of status entries for different sync priority levels,
|
|
92
|
-
* sorted with highest priorities (lower numbers) first.
|
|
93
|
-
*/
|
|
94
|
-
get priorityStatusEntries() {
|
|
95
|
-
return (this.options.priorityStatusEntries ?? []).slice().sort(SyncStatus.comparePriorities);
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* A realtime progress report on how many operations have been downloaded and
|
|
99
|
-
* how many are necessary in total to complete the next sync iteration.
|
|
100
|
-
*
|
|
101
|
-
* This field is only set when {@link SyncDataFlowStatus#downloading} is also true.
|
|
102
|
-
*/
|
|
103
|
-
get downloadProgress() {
|
|
104
|
-
const internalProgress = this.options.dataFlow?.downloadProgress;
|
|
105
|
-
if (internalProgress == null) {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
return new SyncProgress(internalProgress);
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Reports the sync status (a pair of {@link SyncStatus#hasSynced} and {@link SyncStatus#lastSyncedAt} fields)
|
|
112
|
-
* for a specific bucket priority level.
|
|
113
|
-
*
|
|
114
|
-
* When buckets with different priorities are declared, PowerSync may choose to synchronize higher-priority
|
|
115
|
-
* buckets first. When a consistent view over all buckets for all priorities up until the given priority is
|
|
116
|
-
* reached, PowerSync makes data from those buckets available before lower-priority buckets have finished
|
|
117
|
-
* syncing.
|
|
118
|
-
*
|
|
119
|
-
* This method returns the status for the requested priority or the next higher priority level that has
|
|
120
|
-
* status information available. This is because when PowerSync makes data for a given priority available,
|
|
121
|
-
* all buckets in higher-priorities are guaranteed to be consistent with that checkpoint.
|
|
122
|
-
*
|
|
123
|
-
* For example, if PowerSync just finished synchronizing buckets in priority level 3, calling this method
|
|
124
|
-
* with a priority of 1 may return information for priority level 3.
|
|
125
|
-
*
|
|
126
|
-
* @param {number} priority The bucket priority for which the status should be reported
|
|
127
|
-
* @returns {SyncPriorityStatus} Status information for the requested priority level or the next higher level with available status
|
|
128
|
-
*/
|
|
129
|
-
statusForPriority(priority) {
|
|
130
|
-
// priorityStatusEntries are sorted by ascending priorities (so higher numbers to lower numbers).
|
|
131
|
-
for (const known of this.priorityStatusEntries) {
|
|
132
|
-
// We look for the first entry that doesn't have a higher priority.
|
|
133
|
-
if (known.priority >= priority) {
|
|
134
|
-
return known;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
// If we have a complete sync, that necessarily includes all priorities.
|
|
138
|
-
return {
|
|
139
|
-
priority,
|
|
140
|
-
lastSyncedAt: this.lastSyncedAt,
|
|
141
|
-
hasSynced: this.hasSynced
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Compares this SyncStatus instance with another to determine if they are equal.
|
|
146
|
-
* Equality is determined by comparing the serialized JSON representation of both instances.
|
|
147
|
-
*
|
|
148
|
-
* @param {SyncStatus} status The SyncStatus instance to compare against
|
|
149
|
-
* @returns {boolean} True if the instances are considered equal, false otherwise
|
|
150
|
-
*/
|
|
151
|
-
isEqual(status) {
|
|
152
|
-
/**
|
|
153
|
-
* By default Error object are serialized to an empty object.
|
|
154
|
-
* This replaces Errors with more useful information before serialization.
|
|
155
|
-
*/
|
|
156
|
-
const replacer = (_, value) => {
|
|
157
|
-
if (value instanceof Error) {
|
|
158
|
-
return {
|
|
159
|
-
name: value.name,
|
|
160
|
-
message: value.message,
|
|
161
|
-
stack: value.stack
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
return value;
|
|
165
|
-
};
|
|
166
|
-
return JSON.stringify(this.options, replacer) == JSON.stringify(status.options, replacer);
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Creates a human-readable string representation of the current sync status.
|
|
170
|
-
* Includes information about connection state, sync completion, and data flow.
|
|
171
|
-
*
|
|
172
|
-
* @returns {string} A string representation of the sync status
|
|
173
|
-
*/
|
|
174
|
-
getMessage() {
|
|
175
|
-
const dataFlow = this.dataFlowStatus;
|
|
176
|
-
return `SyncStatus<connected: ${this.connected} connecting: ${this.connecting} lastSyncedAt: ${this.lastSyncedAt} hasSynced: ${this.hasSynced}. Downloading: ${dataFlow.downloading}. Uploading: ${dataFlow.uploading}. UploadError: ${dataFlow.uploadError}, DownloadError?: ${dataFlow.downloadError}>`;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Serializes the SyncStatus instance to a plain object.
|
|
180
|
-
*
|
|
181
|
-
* @returns {SyncStatusOptions} A plain object representation of the sync status
|
|
182
|
-
*/
|
|
183
|
-
toJSON() {
|
|
184
|
-
return {
|
|
185
|
-
connected: this.connected,
|
|
186
|
-
connecting: this.connecting,
|
|
187
|
-
dataFlow: {
|
|
188
|
-
...this.dataFlowStatus,
|
|
189
|
-
uploadError: this.serializeError(this.dataFlowStatus.uploadError),
|
|
190
|
-
downloadError: this.serializeError(this.dataFlowStatus.downloadError)
|
|
191
|
-
},
|
|
192
|
-
lastSyncedAt: this.lastSyncedAt,
|
|
193
|
-
hasSynced: this.hasSynced,
|
|
194
|
-
priorityStatusEntries: this.priorityStatusEntries
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Not all errors are serializable over a MessagePort. E.g. some `DomExceptions` fail to be passed across workers.
|
|
199
|
-
* This explicitly serializes errors in the SyncStatus.
|
|
200
|
-
*/
|
|
201
|
-
serializeError(error) {
|
|
202
|
-
if (typeof error == 'undefined') {
|
|
203
|
-
return undefined;
|
|
204
|
-
}
|
|
205
|
-
return {
|
|
206
|
-
name: error.name,
|
|
207
|
-
message: error.message,
|
|
208
|
-
stack: error.stack
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
static comparePriorities(a, b) {
|
|
212
|
-
return b.priority - a.priority; // Reverse because higher priorities have lower numbers
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
class SyncStreamStatusView {
|
|
216
|
-
status;
|
|
217
|
-
core;
|
|
218
|
-
subscription;
|
|
219
|
-
constructor(status, core) {
|
|
220
|
-
this.status = status;
|
|
221
|
-
this.core = core;
|
|
222
|
-
this.subscription = {
|
|
223
|
-
name: core.name,
|
|
224
|
-
parameters: core.parameters,
|
|
225
|
-
active: core.active,
|
|
226
|
-
isDefault: core.is_default,
|
|
227
|
-
hasExplicitSubscription: core.has_explicit_subscription,
|
|
228
|
-
expiresAt: core.expires_at != null ? new Date(core.expires_at * 1000) : null,
|
|
229
|
-
hasSynced: core.last_synced_at != null,
|
|
230
|
-
lastSyncedAt: core.last_synced_at != null ? new Date(core.last_synced_at * 1000) : null
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
get progress() {
|
|
234
|
-
if (this.status.dataFlowStatus.downloadProgress == null) {
|
|
235
|
-
// Don't make download progress public if we're not currently downloading.
|
|
236
|
-
return null;
|
|
237
|
-
}
|
|
238
|
-
const { total, downloaded } = this.core.progress;
|
|
239
|
-
const progress = total == 0 ? 0.0 : downloaded / total;
|
|
240
|
-
return { totalOperations: total, downloadedOperations: downloaded, downloadedFraction: progress };
|
|
241
|
-
}
|
|
242
|
-
get priority() {
|
|
243
|
-
return this.core.priority;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
1
|
+
export {};
|
|
246
2
|
//# sourceMappingURL=SyncStatus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SyncStatus.js","sourceRoot":"","sources":["../../../src/db/crud/SyncStatus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SyncStatus.js","sourceRoot":"","sources":["../../../src/db/crud/SyncStatus.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadQueueStatus.js","sourceRoot":"","sources":["../../../src/db/crud/UploadQueueStatus.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,gBAAgB;IAKlB;IAIA;IART;IACE;;OAEG;IACI,KAAa;IACpB;;OAEG;IACI,OAAsB,IAAI;QAJ1B,UAAK,GAAL,KAAK,CAAQ;QAIb,SAAI,GAAJ,IAAI,CAAsB;IAChC,CAAC;IAEJ,QAAQ;QACN,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;YACtB,OAAO,0BAA0B,IAAI,CAAC,KAAK,GAAG,CAAC;QACjD,CAAC;aAAM,CAAC;YACN,OAAO,wCAAwC,IAAI,CAAC,IAAI,GAAG,IAAI,KAAK,CAAC;QACvE,CAAC;IACH,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"UploadQueueStatus.js","sourceRoot":"","sources":["../../../src/db/crud/UploadQueueStatus.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAKlB;IAIA;IART;IACE;;OAEG;IACI,KAAa;IACpB;;OAEG;IACI,OAAsB,IAAI;QAJ1B,UAAK,GAAL,KAAK,CAAQ;QAIb,SAAI,GAAJ,IAAI,CAAsB;IAChC,CAAC;IAEJ,QAAQ;QACN,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;YACtB,OAAO,0BAA0B,IAAI,CAAC,KAAK,GAAG,CAAC;QACjD,CAAC;aAAM,CAAC;YACN,OAAO,wCAAwC,IAAI,CAAC,IAAI,GAAG,IAAI,KAAK,CAAC;QACvE,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,23 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see https://www.sqlite.org/lang_expr.html#castexpr
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
1
5
|
export declare enum ColumnType {
|
|
2
6
|
TEXT = "TEXT",
|
|
3
7
|
INTEGER = "INTEGER",
|
|
4
8
|
REAL = "REAL"
|
|
5
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
6
13
|
export interface ColumnOptions {
|
|
7
14
|
name: string;
|
|
8
15
|
type?: ColumnType;
|
|
9
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
10
20
|
export type BaseColumnType<T extends number | string | null> = {
|
|
11
21
|
type: ColumnType;
|
|
12
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
13
26
|
export type ColumnsType = Record<string, BaseColumnType<any>>;
|
|
27
|
+
/**
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
14
30
|
export type ExtractColumnValueType<T extends BaseColumnType<any>> = T extends BaseColumnType<infer R> ? R : unknown;
|
|
15
|
-
|
|
31
|
+
/**
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
16
34
|
export declare const column: {
|
|
17
35
|
text: BaseColumnType<string | null>;
|
|
18
36
|
integer: BaseColumnType<number | null>;
|
|
19
37
|
real: BaseColumnType<number | null>;
|
|
20
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
21
42
|
export declare class Column {
|
|
22
43
|
protected options: ColumnOptions;
|
|
23
44
|
constructor(options: ColumnOptions);
|
package/lib/db/schema/Column.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @see https://www.sqlite.org/lang_expr.html#castexpr
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
2
5
|
export var ColumnType;
|
|
3
6
|
(function (ColumnType) {
|
|
4
7
|
ColumnType["TEXT"] = "TEXT";
|
|
@@ -14,14 +17,17 @@ const integer = {
|
|
|
14
17
|
const real = {
|
|
15
18
|
type: ColumnType.REAL
|
|
16
19
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
20
23
|
export const column = {
|
|
21
24
|
text,
|
|
22
25
|
integer,
|
|
23
26
|
real
|
|
24
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
25
31
|
export class Column {
|
|
26
32
|
options;
|
|
27
33
|
constructor(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Column.js","sourceRoot":"","sources":["../../../src/db/schema/Column.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Column.js","sourceRoot":"","sources":["../../../src/db/schema/Column.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,2BAAa,CAAA;IACb,iCAAmB,CAAA;IACnB,2BAAa,CAAA;AACf,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AA2BD,MAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,UAAU,CAAC,IAAI;CACtB,CAAC;AAEF,MAAM,OAAO,GAAkC;IAC7C,IAAI,EAAE,UAAU,CAAC,OAAO;CACzB,CAAC;AAEF,MAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,UAAU,CAAC,IAAI;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI;IACJ,OAAO;IACP,IAAI;CACL,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,MAAM;IACK;IAAtB,YAAsB,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;IAAG,CAAC;IAEhD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;CACF"}
|
package/lib/db/schema/Index.d.ts
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { IndexedColumn } from './IndexedColumn.js';
|
|
2
|
-
import {
|
|
2
|
+
import { ResolvedTable } from './Table.js';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
3
6
|
export interface IndexOptions {
|
|
4
7
|
name: string;
|
|
5
8
|
columns?: IndexedColumn[];
|
|
6
9
|
}
|
|
7
|
-
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
8
13
|
export declare class Index {
|
|
9
14
|
protected options: IndexOptions;
|
|
10
15
|
static createAscending(options: IndexOptions, columnNames: string[]): Index;
|
|
11
16
|
constructor(options: IndexOptions);
|
|
12
17
|
get name(): string;
|
|
13
18
|
get columns(): IndexedColumn[];
|
|
14
|
-
toJSON(table:
|
|
19
|
+
toJSON(table: ResolvedTable): {
|
|
15
20
|
name: string;
|
|
16
21
|
columns: {
|
|
17
22
|
name: string;
|
package/lib/db/schema/Index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Index.js","sourceRoot":"","sources":["../../../src/db/schema/Index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"Index.js","sourceRoot":"","sources":["../../../src/db/schema/Index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAWnD,MAAM,qBAAqB,GAA0B;IACnD,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,KAAK;IAQM;IAPtB,MAAM,CAAC,eAAe,CAAC,OAAqB,EAAE,WAAqB;QACjE,OAAO,IAAI,KAAK,CAAC;YACf,GAAG,OAAO;YACV,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;SACxE,CAAC,CAAC;IACL,CAAC;IAED,YAAsB,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;QACzC,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,qBAAqB,EAAE,GAAG,OAAO,EAAE,CAAC;IAC1D,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,KAAoB;QACzB,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SAClD,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { ColumnType } from './Column.js';
|
|
2
|
-
import {
|
|
2
|
+
import { ResolvedTable } from './Table.js';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
3
6
|
export interface IndexColumnOptions {
|
|
4
7
|
name: string;
|
|
5
8
|
ascending?: boolean;
|
|
6
9
|
}
|
|
7
|
-
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
8
13
|
export declare class IndexedColumn {
|
|
9
14
|
protected options: IndexColumnOptions;
|
|
10
15
|
static createAscending(column: string): IndexedColumn;
|
|
11
16
|
constructor(options: IndexColumnOptions);
|
|
12
17
|
get name(): string;
|
|
13
18
|
get ascending(): boolean | undefined;
|
|
14
|
-
toJSON(table:
|
|
19
|
+
toJSON(table: ResolvedTable): {
|
|
15
20
|
name: string;
|
|
16
21
|
ascending: boolean | undefined;
|
|
17
22
|
type: ColumnType;
|