@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.
Files changed (263) hide show
  1. package/lib/attachments/AttachmentContext.d.ts +9 -8
  2. package/lib/attachments/AttachmentContext.js +8 -3
  3. package/lib/attachments/AttachmentContext.js.map +1 -1
  4. package/lib/attachments/AttachmentErrorHandler.d.ts +6 -6
  5. package/lib/attachments/AttachmentQueue.d.ts +85 -36
  6. package/lib/attachments/AttachmentQueue.js +19 -21
  7. package/lib/attachments/AttachmentQueue.js.map +1 -1
  8. package/lib/attachments/AttachmentService.d.ts +3 -3
  9. package/lib/attachments/AttachmentService.js +4 -3
  10. package/lib/attachments/AttachmentService.js.map +1 -1
  11. package/lib/attachments/LocalStorageAdapter.d.ts +14 -8
  12. package/lib/attachments/LocalStorageAdapter.js +3 -0
  13. package/lib/attachments/LocalStorageAdapter.js.map +1 -1
  14. package/lib/attachments/RemoteStorageAdapter.d.ts +4 -4
  15. package/lib/attachments/Schema.d.ts +14 -6
  16. package/lib/attachments/Schema.js +8 -3
  17. package/lib/attachments/Schema.js.map +1 -1
  18. package/lib/attachments/SyncingService.d.ts +2 -2
  19. package/lib/attachments/SyncingService.js +8 -3
  20. package/lib/attachments/SyncingService.js.map +1 -1
  21. package/lib/attachments/WatchedAttachmentItem.d.ts +3 -1
  22. package/lib/client/{AbstractPowerSyncDatabase.d.ts → CommonPowerSyncDatabase.d.ts} +112 -238
  23. package/lib/client/CommonPowerSyncDatabase.js +2 -0
  24. package/lib/client/CommonPowerSyncDatabase.js.map +1 -0
  25. package/lib/client/Query.d.ts +9 -0
  26. package/lib/client/SQLOpenFactory.d.ts +44 -10
  27. package/lib/client/SQLOpenFactory.js +1 -19
  28. package/lib/client/SQLOpenFactory.js.map +1 -1
  29. package/lib/client/compilableQueryWatch.d.ts +8 -2
  30. package/lib/client/compilableQueryWatch.js +4 -2
  31. package/lib/client/compilableQueryWatch.js.map +1 -1
  32. package/lib/client/connection/PowerSyncBackendConnector.d.ts +6 -3
  33. package/lib/client/connection/PowerSyncCredentials.d.ts +3 -0
  34. package/lib/client/runOnSchemaChange.d.ts +5 -2
  35. package/lib/client/runOnSchemaChange.js +3 -0
  36. package/lib/client/runOnSchemaChange.js.map +1 -1
  37. package/lib/client/sync/bucket/CrudBatch.d.ts +2 -0
  38. package/lib/client/sync/bucket/CrudBatch.js +2 -0
  39. package/lib/client/sync/bucket/CrudBatch.js.map +1 -1
  40. package/lib/client/sync/bucket/CrudEntry.d.ts +9 -31
  41. package/lib/client/sync/bucket/CrudEntry.js +2 -97
  42. package/lib/client/sync/bucket/CrudEntry.js.map +1 -1
  43. package/lib/client/sync/bucket/CrudTransaction.d.ts +3 -0
  44. package/lib/client/sync/bucket/CrudTransaction.js +3 -0
  45. package/lib/client/sync/bucket/CrudTransaction.js.map +1 -1
  46. package/lib/client/sync/options.d.ts +65 -0
  47. package/lib/client/sync/options.js +25 -0
  48. package/lib/client/sync/options.js.map +1 -0
  49. package/lib/client/sync/stream/JsonValue.d.ts +3 -0
  50. package/lib/client/sync/sync-streams.d.ts +23 -8
  51. package/lib/client/triggers/TriggerManager.d.ts +28 -56
  52. package/lib/client/triggers/TriggerManager.js +2 -1
  53. package/lib/client/triggers/TriggerManager.js.map +1 -1
  54. package/lib/client/triggers/sanitizeSQL.d.ts +4 -0
  55. package/lib/client/triggers/sanitizeSQL.js +4 -0
  56. package/lib/client/triggers/sanitizeSQL.js.map +1 -1
  57. package/lib/client/watched/GetAllQuery.d.ts +7 -3
  58. package/lib/client/watched/GetAllQuery.js +3 -1
  59. package/lib/client/watched/GetAllQuery.js.map +1 -1
  60. package/lib/client/watched/WatchedQuery.d.ts +20 -6
  61. package/lib/client/watched/WatchedQuery.js +3 -5
  62. package/lib/client/watched/WatchedQuery.js.map +1 -1
  63. package/lib/client/watched/processors/DifferentialQueryProcessor.d.ts +15 -45
  64. package/lib/client/watched/processors/DifferentialQueryProcessor.js +1 -172
  65. package/lib/client/watched/processors/DifferentialQueryProcessor.js.map +1 -1
  66. package/lib/client/watched/processors/OnChangeQueryProcessor.d.ts +4 -22
  67. package/lib/client/watched/processors/OnChangeQueryProcessor.js +1 -82
  68. package/lib/client/watched/processors/OnChangeQueryProcessor.js.map +1 -1
  69. package/lib/client/watched/processors/comparators.d.ts +8 -0
  70. package/lib/client/watched/processors/comparators.js +4 -0
  71. package/lib/client/watched/processors/comparators.js.map +1 -1
  72. package/lib/db/DBAdapter.d.ts +90 -113
  73. package/lib/db/DBAdapter.js +70 -89
  74. package/lib/db/DBAdapter.js.map +1 -1
  75. package/lib/db/QueryResult.d.ts +104 -0
  76. package/lib/db/QueryResult.js +96 -0
  77. package/lib/db/QueryResult.js.map +1 -0
  78. package/lib/db/crud/SyncProgress.d.ts +7 -14
  79. package/lib/db/crud/SyncProgress.js +1 -60
  80. package/lib/db/crud/SyncProgress.js.map +1 -1
  81. package/lib/db/crud/SyncStatus.d.ts +54 -91
  82. package/lib/db/crud/SyncStatus.js +1 -245
  83. package/lib/db/crud/SyncStatus.js.map +1 -1
  84. package/lib/db/crud/UploadQueueStatus.d.ts +3 -0
  85. package/lib/db/crud/UploadQueueStatus.js +3 -0
  86. package/lib/db/crud/UploadQueueStatus.js.map +1 -1
  87. package/lib/db/schema/Column.d.ts +22 -1
  88. package/lib/db/schema/Column.js +10 -4
  89. package/lib/db/schema/Column.js.map +1 -1
  90. package/lib/db/schema/Index.d.ts +8 -3
  91. package/lib/db/schema/Index.js +4 -1
  92. package/lib/db/schema/Index.js.map +1 -1
  93. package/lib/db/schema/IndexedColumn.d.ts +8 -3
  94. package/lib/db/schema/IndexedColumn.js +4 -1
  95. package/lib/db/schema/IndexedColumn.js.map +1 -1
  96. package/lib/db/schema/RawTable.d.ts +7 -1
  97. package/lib/db/schema/Schema.d.ts +10 -29
  98. package/lib/db/schema/Schema.js +3 -1
  99. package/lib/db/schema/Schema.js.map +1 -1
  100. package/lib/db/schema/Table.d.ts +69 -91
  101. package/lib/db/schema/Table.js +88 -87
  102. package/lib/db/schema/Table.js.map +1 -1
  103. package/lib/index.d.ts +6 -22
  104. package/lib/index.js +5 -22
  105. package/lib/index.js.map +1 -1
  106. package/lib/types/types.d.ts +6 -0
  107. package/lib/utils/BaseObserver.d.ts +12 -0
  108. package/lib/utils/BaseObserver.js +3 -0
  109. package/lib/utils/BaseObserver.js.map +1 -1
  110. package/lib/utils/Logger.d.ts +60 -22
  111. package/lib/utils/Logger.js +38 -30
  112. package/lib/utils/Logger.js.map +1 -1
  113. package/lib/utils/MetaBaseObserver.d.ts +11 -11
  114. package/lib/utils/MetaBaseObserver.js +1 -50
  115. package/lib/utils/MetaBaseObserver.js.map +1 -1
  116. package/lib/utils/mutex.d.ts +3 -45
  117. package/lib/utils/mutex.js +1 -153
  118. package/lib/utils/mutex.js.map +1 -1
  119. package/package.json +9 -46
  120. package/src/attachments/AttachmentContext.ts +15 -13
  121. package/src/attachments/AttachmentErrorHandler.ts +6 -6
  122. package/src/attachments/AttachmentQueue.ts +99 -42
  123. package/src/attachments/AttachmentService.ts +7 -6
  124. package/src/attachments/LocalStorageAdapter.ts +14 -8
  125. package/src/attachments/README.md +2 -0
  126. package/src/attachments/RemoteStorageAdapter.ts +4 -4
  127. package/src/attachments/Schema.ts +14 -6
  128. package/src/attachments/SyncingService.ts +10 -6
  129. package/src/attachments/WatchedAttachmentItem.ts +3 -1
  130. package/src/client/CommonPowerSyncDatabase.ts +540 -0
  131. package/src/client/Query.ts +9 -0
  132. package/src/client/SQLOpenFactory.ts +47 -19
  133. package/src/client/compilableQueryWatch.ts +9 -4
  134. package/src/client/connection/PowerSyncBackendConnector.ts +6 -3
  135. package/src/client/connection/PowerSyncCredentials.ts +3 -0
  136. package/src/client/runOnSchemaChange.ts +5 -2
  137. package/src/client/sync/bucket/CrudBatch.ts +2 -0
  138. package/src/client/sync/bucket/CrudEntry.ts +10 -101
  139. package/src/client/sync/bucket/CrudTransaction.ts +3 -0
  140. package/src/client/sync/options.ts +77 -0
  141. package/src/client/sync/stream/JsonValue.ts +3 -0
  142. package/src/client/sync/sync-streams.ts +23 -10
  143. package/src/client/triggers/TriggerManager.ts +29 -59
  144. package/src/client/triggers/sanitizeSQL.ts +5 -0
  145. package/src/client/watched/GetAllQuery.ts +8 -4
  146. package/src/client/watched/WatchedQuery.ts +20 -11
  147. package/src/client/watched/processors/DifferentialQueryProcessor.ts +19 -219
  148. package/src/client/watched/processors/OnChangeQueryProcessor.ts +4 -109
  149. package/src/client/watched/processors/comparators.ts +8 -0
  150. package/src/db/DBAdapter.ts +160 -175
  151. package/src/db/QueryResult.ts +195 -0
  152. package/src/db/crud/SyncProgress.ts +8 -43
  153. package/src/db/crud/SyncStatus.ts +66 -216
  154. package/src/db/crud/UploadQueueStatus.ts +3 -0
  155. package/src/db/schema/Column.ts +22 -5
  156. package/src/db/schema/Index.ts +9 -3
  157. package/src/db/schema/IndexedColumn.ts +9 -3
  158. package/src/db/schema/RawTable.ts +7 -1
  159. package/src/db/schema/Schema.ts +12 -7
  160. package/src/db/schema/Table.ts +130 -180
  161. package/src/index.ts +6 -22
  162. package/src/types/types.ts +6 -0
  163. package/src/utils/BaseObserver.ts +12 -0
  164. package/src/utils/Logger.ts +86 -31
  165. package/src/utils/MetaBaseObserver.ts +14 -60
  166. package/src/utils/mutex.ts +4 -189
  167. package/dist/bundle.cjs +0 -14136
  168. package/dist/bundle.cjs.map +0 -1
  169. package/dist/bundle.mjs +0 -14056
  170. package/dist/bundle.mjs.map +0 -1
  171. package/dist/bundle.node.cjs +0 -11613
  172. package/dist/bundle.node.cjs.map +0 -1
  173. package/dist/bundle.node.mjs +0 -11533
  174. package/dist/bundle.node.mjs.map +0 -1
  175. package/dist/index.d.cts +0 -4052
  176. package/legacy/sync_protocol.d.ts +0 -103
  177. package/lib/client/AbstractPowerSyncDatabase.js +0 -987
  178. package/lib/client/AbstractPowerSyncDatabase.js.map +0 -1
  179. package/lib/client/AbstractPowerSyncOpenFactory.d.ts +0 -22
  180. package/lib/client/AbstractPowerSyncOpenFactory.js +0 -25
  181. package/lib/client/AbstractPowerSyncOpenFactory.js.map +0 -1
  182. package/lib/client/ConnectionManager.d.ts +0 -112
  183. package/lib/client/ConnectionManager.js +0 -294
  184. package/lib/client/ConnectionManager.js.map +0 -1
  185. package/lib/client/CustomQuery.d.ts +0 -22
  186. package/lib/client/CustomQuery.js +0 -43
  187. package/lib/client/CustomQuery.js.map +0 -1
  188. package/lib/client/constants.d.ts +0 -1
  189. package/lib/client/constants.js +0 -2
  190. package/lib/client/constants.js.map +0 -1
  191. package/lib/client/sync/bucket/BucketStorageAdapter.d.ts +0 -40
  192. package/lib/client/sync/bucket/BucketStorageAdapter.js +0 -19
  193. package/lib/client/sync/bucket/BucketStorageAdapter.js.map +0 -1
  194. package/lib/client/sync/bucket/SqliteBucketStorage.d.ts +0 -34
  195. package/lib/client/sync/bucket/SqliteBucketStorage.js +0 -162
  196. package/lib/client/sync/bucket/SqliteBucketStorage.js.map +0 -1
  197. package/lib/client/sync/stream/AbstractRemote.d.ts +0 -151
  198. package/lib/client/sync/stream/AbstractRemote.js +0 -473
  199. package/lib/client/sync/stream/AbstractRemote.js.map +0 -1
  200. package/lib/client/sync/stream/AbstractStreamingSyncImplementation.d.ts +0 -218
  201. package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js +0 -663
  202. package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js.map +0 -1
  203. package/lib/client/sync/stream/WebsocketClientTransport.d.ts +0 -15
  204. package/lib/client/sync/stream/WebsocketClientTransport.js +0 -61
  205. package/lib/client/sync/stream/WebsocketClientTransport.js.map +0 -1
  206. package/lib/client/sync/stream/core-instruction.d.ts +0 -71
  207. package/lib/client/sync/stream/core-instruction.js +0 -27
  208. package/lib/client/sync/stream/core-instruction.js.map +0 -1
  209. package/lib/client/triggers/MemoryTriggerClaimManager.d.ts +0 -6
  210. package/lib/client/triggers/MemoryTriggerClaimManager.js +0 -21
  211. package/lib/client/triggers/MemoryTriggerClaimManager.js.map +0 -1
  212. package/lib/client/triggers/TriggerManagerImpl.d.ts +0 -39
  213. package/lib/client/triggers/TriggerManagerImpl.js +0 -405
  214. package/lib/client/triggers/TriggerManagerImpl.js.map +0 -1
  215. package/lib/client/watched/processors/AbstractQueryProcessor.d.ts +0 -68
  216. package/lib/client/watched/processors/AbstractQueryProcessor.js +0 -151
  217. package/lib/client/watched/processors/AbstractQueryProcessor.js.map +0 -1
  218. package/lib/db/ConnectionClosedError.d.ts +0 -10
  219. package/lib/db/ConnectionClosedError.js +0 -21
  220. package/lib/db/ConnectionClosedError.js.map +0 -1
  221. package/lib/db/schema/TableV2.d.ts +0 -9
  222. package/lib/db/schema/TableV2.js +0 -9
  223. package/lib/db/schema/TableV2.js.map +0 -1
  224. package/lib/utils/AbortOperation.d.ts +0 -9
  225. package/lib/utils/AbortOperation.js +0 -19
  226. package/lib/utils/AbortOperation.js.map +0 -1
  227. package/lib/utils/ControlledExecutor.d.ts +0 -25
  228. package/lib/utils/ControlledExecutor.js +0 -51
  229. package/lib/utils/ControlledExecutor.js.map +0 -1
  230. package/lib/utils/async.d.ts +0 -14
  231. package/lib/utils/async.js +0 -46
  232. package/lib/utils/async.js.map +0 -1
  233. package/lib/utils/parseQuery.d.ts +0 -6
  234. package/lib/utils/parseQuery.js +0 -17
  235. package/lib/utils/parseQuery.js.map +0 -1
  236. package/lib/utils/queue.d.ts +0 -16
  237. package/lib/utils/queue.js +0 -42
  238. package/lib/utils/queue.js.map +0 -1
  239. package/lib/utils/stream_transform.d.ts +0 -39
  240. package/lib/utils/stream_transform.js +0 -206
  241. package/lib/utils/stream_transform.js.map +0 -1
  242. package/src/client/AbstractPowerSyncDatabase.ts +0 -1362
  243. package/src/client/AbstractPowerSyncOpenFactory.ts +0 -39
  244. package/src/client/ConnectionManager.ts +0 -402
  245. package/src/client/CustomQuery.ts +0 -56
  246. package/src/client/constants.ts +0 -1
  247. package/src/client/sync/bucket/BucketStorageAdapter.ts +0 -49
  248. package/src/client/sync/bucket/SqliteBucketStorage.ts +0 -199
  249. package/src/client/sync/stream/AbstractRemote.ts +0 -602
  250. package/src/client/sync/stream/AbstractStreamingSyncImplementation.ts +0 -905
  251. package/src/client/sync/stream/WebsocketClientTransport.ts +0 -80
  252. package/src/client/sync/stream/core-instruction.ts +0 -98
  253. package/src/client/triggers/MemoryTriggerClaimManager.ts +0 -25
  254. package/src/client/triggers/TriggerManagerImpl.ts +0 -496
  255. package/src/client/watched/processors/AbstractQueryProcessor.ts +0 -226
  256. package/src/db/ConnectionClosedError.ts +0 -23
  257. package/src/db/schema/TableV2.ts +0 -9
  258. package/src/utils/AbortOperation.ts +0 -17
  259. package/src/utils/ControlledExecutor.ts +0 -72
  260. package/src/utils/async.ts +0 -50
  261. package/src/utils/parseQuery.ts +0 -25
  262. package/src/utils/queue.ts +0 -48
  263. 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 { InternalProgressInformation, ProgressWithOperations, SyncProgress } from './SyncProgress.js';
5
- export type SyncDataFlowStatus = Partial<{
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
- * Internal information about how far we are downloading operations in buckets.
21
- *
22
- * Please use the {@link SyncStatus#downloadProgress} property to track sync progress.
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
- export type SyncStatusOptions = {
33
- connected?: boolean;
34
- connecting?: boolean;
35
- dataFlow?: SyncDataFlowStatus;
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 {boolean} True if connected, false otherwise. Defaults to false if not specified.
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 {boolean} True if connecting, false otherwise. Defaults to false if not specified.
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 {Date | undefined} The timestamp of the last successful sync, or undefined if no sync has completed.
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 {boolean | undefined} True if at least one sync has completed, false if no sync has completed,
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 {SyncPriorityStatus[]} An array of status entries for different sync priority levels,
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 SyncDataFlowStatus#downloading} is also true.
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 {number} priority The bucket priority for which the status should be reported
149
- * @returns {SyncPriorityStatus} Status information for the requested priority level or the next higher level with available status
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 {SyncStatus} status The SyncStatus instance to compare against
157
- * @returns {boolean} True if the instances are considered equal, false otherwise
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 {string} A string representation of the sync status
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
- import { SyncProgress } from './SyncProgress.js';
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":"AAGA,OAAO,EAAuD,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAyCtG,MAAM,OAAO,UAAU;IACC;IAAtB,YAAsB,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;IAAG,CAAC;IAEpD;;;;;OAKG;IACH,IAAI,oBAAoB;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC;IAC1C,CAAC;IAED;;;;;OAKG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;IAChC,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,cAAc;QAChB,OAAO,CACL,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI;YACvB;;;eAGG;YACH,WAAW,EAAE,KAAK;YAClB;;eAEG;YACH,SAAS,EAAE,KAAK;SACjB,CACF,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,IAAI,WAAW;QAC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I,IAAI;YACtC,YAAY,EAAE,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;SACxF,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ;QACV,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,gBAAgB,IAAI,IAAI,EAAE,CAAC;YACxD,0EAA0E;YAC1E,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QACjD,MAAM,QAAQ,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,CAAC;QAEvD,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAQ,EAAE,CAAC;IACpG,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;IAC5B,CAAC;CACF"}
1
+ {"version":3,"file":"SyncStatus.js","sourceRoot":"","sources":["../../../src/db/crud/SyncStatus.ts"],"names":[],"mappings":""}
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @public
3
+ */
1
4
  export declare class UploadQueueStats {
2
5
  /**
3
6
  * Number of records in the upload queue.
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @public
3
+ */
1
4
  export class UploadQueueStats {
2
5
  count;
3
6
  size;
@@ -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
- export declare const MAX_AMOUNT_OF_COLUMNS = 1999;
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);
@@ -1,4 +1,7 @@
1
- // https://www.sqlite.org/lang_expr.html#castexpr
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
- // powersync-sqlite-core limits the number of column per table to 1999, due to internal SQLite limits.
18
- // In earlier versions this was limited to 63.
19
- export const MAX_AMOUNT_OF_COLUMNS = 1999;
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,iDAAiD;AACjD,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,2BAAa,CAAA;IACb,iCAAmB,CAAA;IACnB,2BAAa,CAAA;AACf,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAeD,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,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,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"}
@@ -1,17 +1,22 @@
1
1
  import { IndexedColumn } from './IndexedColumn.js';
2
- import { Table } from './Table.js';
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
- export declare const DEFAULT_INDEX_OPTIONS: Partial<IndexOptions>;
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: Table): {
19
+ toJSON(table: ResolvedTable): {
15
20
  name: string;
16
21
  columns: {
17
22
  name: string;
@@ -1,7 +1,10 @@
1
1
  import { IndexedColumn } from './IndexedColumn.js';
2
- export const DEFAULT_INDEX_OPTIONS = {
2
+ const DEFAULT_INDEX_OPTIONS = {
3
3
  columns: []
4
4
  };
5
+ /**
6
+ * @public
7
+ */
5
8
  export class Index {
6
9
  options;
7
10
  static createAscending(options, columnNames) {
@@ -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;AAQnD,MAAM,CAAC,MAAM,qBAAqB,GAA0B;IAC1D,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,MAAM,OAAO,KAAK;IAQM;IAPtB,MAAM,CAAC,eAAe,CAAC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B;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 { Table } from './Table.js';
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
- export declare const DEFAULT_INDEX_COLUMN_OPTIONS: Partial<IndexColumnOptions>;
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: Table): {
19
+ toJSON(table: ResolvedTable): {
15
20
  name: string;
16
21
  ascending: boolean | undefined;
17
22
  type: ColumnType;