@powersync/service-core 0.0.0-dev-20260225160713 → 0.0.0-dev-20260511080634
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/CHANGELOG.md +102 -5
- package/dist/api/RouteAPI.d.ts +17 -3
- package/dist/api/api-index.d.ts +1 -1
- package/dist/api/api-index.js +1 -1
- package/dist/api/api-index.js.map +1 -1
- package/dist/api/api-metrics.js.map +1 -1
- package/dist/api/diagnostics.d.ts +1 -1
- package/dist/api/diagnostics.js +32 -14
- package/dist/api/diagnostics.js.map +1 -1
- package/dist/auth/CachedKeyCollector.js +1 -1
- package/dist/auth/CachedKeyCollector.js.map +1 -1
- package/dist/auth/CompoundKeyCollector.js.map +1 -1
- package/dist/auth/KeyStore.js.map +1 -1
- package/dist/auth/RemoteJWKSCollector.js.map +1 -1
- package/dist/auth/StaticKeyCollector.d.ts +1 -1
- package/dist/auth/StaticKeyCollector.js.map +1 -1
- package/dist/auth/StaticSupabaseKeyCollector.d.ts +1 -1
- package/dist/auth/StaticSupabaseKeyCollector.js.map +1 -1
- package/dist/auth/utils.d.ts +2 -1
- package/dist/auth/utils.js +1 -1
- package/dist/auth/utils.js.map +1 -1
- package/dist/entry/commands/compact-action.js +26 -5
- package/dist/entry/commands/compact-action.js.map +1 -1
- package/dist/entry/commands/teardown-action.js +2 -2
- package/dist/entry/commands/teardown-action.js.map +1 -1
- package/dist/entry/entry-index.d.ts +1 -1
- package/dist/entry/entry-index.js +1 -1
- package/dist/entry/entry-index.js.map +1 -1
- package/dist/events/EventsEngine.js +1 -1
- package/dist/events/EventsEngine.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/metrics/MetricsEngine.d.ts +1 -1
- package/dist/metrics/RollingBucketMax.d.ts +28 -0
- package/dist/metrics/RollingBucketMax.js +80 -0
- package/dist/metrics/RollingBucketMax.js.map +1 -0
- package/dist/metrics/metrics-index.d.ts +3 -2
- package/dist/metrics/metrics-index.js +3 -2
- package/dist/metrics/metrics-index.js.map +1 -1
- package/dist/metrics/open-telemetry/util.js +1 -1
- package/dist/metrics/open-telemetry/util.js.map +1 -1
- package/dist/metrics/register-metrics.js +2 -2
- package/dist/metrics/register-metrics.js.map +1 -1
- package/dist/modules/AbstractModule.d.ts +2 -2
- package/dist/modules/AbstractModule.js.map +1 -1
- package/dist/modules/modules-index.d.ts +1 -1
- package/dist/modules/modules-index.js +1 -1
- package/dist/modules/modules-index.js.map +1 -1
- package/dist/replication/AbstractReplicationJob.d.ts +2 -2
- package/dist/replication/AbstractReplicationJob.js +1 -1
- package/dist/replication/AbstractReplicationJob.js.map +1 -1
- package/dist/replication/AbstractReplicator.d.ts +7 -7
- package/dist/replication/AbstractReplicator.js +31 -28
- package/dist/replication/AbstractReplicator.js.map +1 -1
- package/dist/replication/ReplicationLagTracker.d.ts +50 -0
- package/dist/replication/ReplicationLagTracker.js +78 -0
- package/dist/replication/ReplicationLagTracker.js.map +1 -0
- package/dist/replication/replication-index.d.ts +3 -2
- package/dist/replication/replication-index.js +3 -2
- package/dist/replication/replication-index.js.map +1 -1
- package/dist/replication/replication-metrics.js.map +1 -1
- package/dist/routes/configure-fastify.d.ts +59 -32
- package/dist/routes/endpoints/admin.d.ts +108 -54
- package/dist/routes/endpoints/admin.js +8 -3
- package/dist/routes/endpoints/admin.js.map +1 -1
- package/dist/routes/endpoints/checkpointing.js +1 -1
- package/dist/routes/endpoints/checkpointing.js.map +1 -1
- package/dist/routes/endpoints/socket-route.js +1 -1
- package/dist/routes/endpoints/socket-route.js.map +1 -1
- package/dist/routes/endpoints/sync-rules.js +10 -10
- package/dist/routes/endpoints/sync-rules.js.map +1 -1
- package/dist/routes/endpoints/sync-stream.d.ts +10 -10
- package/dist/routes/endpoints/sync-stream.js +8 -3
- package/dist/routes/endpoints/sync-stream.js.map +1 -1
- package/dist/routes/hooks.js +1 -1
- package/dist/routes/hooks.js.map +1 -1
- package/dist/routes/route-register.js.map +1 -1
- package/dist/runner/teardown.js +4 -4
- package/dist/runner/teardown.js.map +1 -1
- package/dist/storage/BucketStorage.d.ts +9 -9
- package/dist/storage/BucketStorage.js +9 -9
- package/dist/storage/BucketStorageBatch.d.ts +30 -9
- package/dist/storage/BucketStorageBatch.js.map +1 -1
- package/dist/storage/BucketStorageFactory.d.ts +32 -20
- package/dist/storage/BucketStorageFactory.js +19 -16
- package/dist/storage/BucketStorageFactory.js.map +1 -1
- package/dist/storage/ChecksumCache.d.ts +5 -2
- package/dist/storage/ChecksumCache.js +8 -4
- package/dist/storage/ChecksumCache.js.map +1 -1
- package/dist/storage/PersistedSyncRulesContent.d.ts +9 -3
- package/dist/storage/PersistedSyncRulesContent.js +25 -5
- package/dist/storage/PersistedSyncRulesContent.js.map +1 -1
- package/dist/storage/ReplicationEventPayload.d.ts +1 -1
- package/dist/storage/SourceTable.d.ts +10 -5
- package/dist/storage/SourceTable.js +3 -3
- package/dist/storage/SourceTable.js.map +1 -1
- package/dist/storage/StorageVersionConfig.d.ts +34 -1
- package/dist/storage/StorageVersionConfig.js +40 -7
- package/dist/storage/StorageVersionConfig.js.map +1 -1
- package/dist/storage/SyncRulesBucketStorage.d.ts +63 -11
- package/dist/storage/SyncRulesBucketStorage.js +14 -0
- package/dist/storage/SyncRulesBucketStorage.js.map +1 -1
- package/dist/storage/WriteCheckpointAPI.d.ts +6 -6
- package/dist/storage/WriteCheckpointAPI.js +1 -1
- package/dist/storage/bson.d.ts +0 -1
- package/dist/storage/bson.js +0 -4
- package/dist/storage/bson.js.map +1 -1
- package/dist/storage/storage-index.d.ts +8 -8
- package/dist/storage/storage-index.js +8 -8
- package/dist/storage/storage-index.js.map +1 -1
- package/dist/storage/storage-metrics.js.map +1 -1
- package/dist/streams/streams-index.d.ts +2 -2
- package/dist/streams/streams-index.js +2 -2
- package/dist/streams/streams-index.js.map +1 -1
- package/dist/sync/BucketChecksumState.d.ts +5 -8
- package/dist/sync/BucketChecksumState.js +118 -116
- package/dist/sync/BucketChecksumState.js.map +1 -1
- package/dist/sync/RequestTracker.js +1 -1
- package/dist/sync/RequestTracker.js.map +1 -1
- package/dist/sync/sync-index.d.ts +2 -2
- package/dist/sync/sync-index.js +2 -2
- package/dist/sync/sync-index.js.map +1 -1
- package/dist/sync/sync.js.map +1 -1
- package/dist/sync/util.d.ts +1 -0
- package/dist/sync/util.js +10 -0
- package/dist/sync/util.js.map +1 -1
- package/dist/system/ServiceContext.d.ts +1 -1
- package/dist/system/ServiceContext.js +1 -1
- package/dist/system/ServiceContext.js.map +1 -1
- package/dist/tracing/PerformanceTracer.d.ts +44 -0
- package/dist/tracing/PerformanceTracer.js +102 -0
- package/dist/tracing/PerformanceTracer.js.map +1 -0
- package/dist/tracing/TraceWriter.d.ts +22 -0
- package/dist/tracing/TraceWriter.js +63 -0
- package/dist/tracing/TraceWriter.js.map +1 -0
- package/dist/util/checkpointing.js +1 -1
- package/dist/util/config/collectors/impl/base64-config-collector.d.ts +1 -1
- package/dist/util/config/collectors/impl/base64-config-collector.js.map +1 -1
- package/dist/util/config/collectors/impl/filesystem-config-collector.d.ts +1 -1
- package/dist/util/config/collectors/impl/filesystem-config-collector.js +1 -1
- package/dist/util/config/collectors/impl/filesystem-config-collector.js.map +1 -1
- package/dist/util/config/compound-config-collector.d.ts +1 -1
- package/dist/util/config/compound-config-collector.js +2 -2
- package/dist/util/config/compound-config-collector.js.map +1 -1
- package/dist/util/config/sync-rules/impl/filesystem-sync-rules-collector.js +1 -1
- package/dist/util/config/sync-rules/impl/filesystem-sync-rules-collector.js.map +1 -1
- package/dist/util/config/sync-rules/sync-rules-provider.js.map +1 -1
- package/dist/util/config.js +1 -1
- package/dist/util/config.js.map +1 -1
- package/dist/util/env.js +1 -1
- package/dist/util/errors.d.ts +3 -0
- package/dist/util/errors.js +15 -0
- package/dist/util/errors.js.map +1 -0
- package/dist/util/protocol-types.d.ts +3 -3
- package/dist/util/protocol-types.js +1 -1
- package/dist/util/util-index.d.ts +1 -1
- package/dist/util/util-index.js +1 -1
- package/dist/util/util-index.js.map +1 -1
- package/dist/util/utils.d.ts +1 -1
- package/package.json +11 -11
- package/src/api/RouteAPI.ts +20 -3
- package/src/api/api-index.ts +1 -1
- package/src/api/api-metrics.ts +1 -1
- package/src/api/diagnostics.ts +42 -20
- package/src/auth/CachedKeyCollector.ts +2 -3
- package/src/auth/CompoundKeyCollector.ts +2 -3
- package/src/auth/KeyStore.ts +1 -1
- package/src/auth/RemoteJWKSCollector.ts +0 -1
- package/src/auth/StaticKeyCollector.ts +1 -1
- package/src/auth/StaticSupabaseKeyCollector.ts +1 -1
- package/src/auth/utils.ts +5 -2
- package/src/entry/commands/compact-action.ts +29 -5
- package/src/entry/commands/teardown-action.ts +2 -2
- package/src/entry/entry-index.ts +1 -1
- package/src/events/EventsEngine.ts +1 -1
- package/src/index.ts +2 -0
- package/src/metrics/MetricsEngine.ts +1 -1
- package/src/metrics/RollingBucketMax.ts +109 -0
- package/src/metrics/metrics-index.ts +3 -2
- package/src/metrics/open-telemetry/util.ts +1 -1
- package/src/metrics/register-metrics.ts +3 -3
- package/src/modules/AbstractModule.ts +2 -2
- package/src/modules/modules-index.ts +1 -1
- package/src/replication/AbstractReplicationJob.ts +3 -3
- package/src/replication/AbstractReplicator.ts +32 -30
- package/src/replication/ReplicationLagTracker.ts +86 -0
- package/src/replication/replication-index.ts +3 -2
- package/src/replication/replication-metrics.ts +1 -1
- package/src/routes/endpoints/admin.ts +8 -3
- package/src/routes/endpoints/checkpointing.ts +1 -1
- package/src/routes/endpoints/socket-route.ts +1 -1
- package/src/routes/endpoints/sync-rules.ts +10 -12
- package/src/routes/endpoints/sync-stream.ts +8 -3
- package/src/routes/hooks.ts +2 -2
- package/src/routes/route-register.ts +2 -10
- package/src/runner/teardown.ts +4 -4
- package/src/storage/BucketStorage.ts +9 -9
- package/src/storage/BucketStorageBatch.ts +34 -10
- package/src/storage/BucketStorageFactory.ts +51 -34
- package/src/storage/ChecksumCache.ts +14 -6
- package/src/storage/PersistedSyncRulesContent.ts +36 -7
- package/src/storage/ReplicationEventPayload.ts +1 -1
- package/src/storage/SourceTable.ts +10 -4
- package/src/storage/StorageVersionConfig.ts +55 -7
- package/src/storage/SyncRulesBucketStorage.ts +77 -11
- package/src/storage/WriteCheckpointAPI.ts +6 -6
- package/src/storage/bson.ts +0 -5
- package/src/storage/storage-index.ts +8 -8
- package/src/storage/storage-metrics.ts +2 -2
- package/src/streams/streams-index.ts +2 -2
- package/src/sync/BucketChecksumState.ts +142 -139
- package/src/sync/RequestTracker.ts +1 -1
- package/src/sync/sync-index.ts +2 -2
- package/src/sync/sync.ts +4 -4
- package/src/sync/util.ts +11 -1
- package/src/system/ServiceContext.ts +1 -1
- package/src/tracing/PerformanceTracer.ts +126 -0
- package/src/tracing/TraceWriter.ts +67 -0
- package/src/util/checkpointing.ts +1 -1
- package/src/util/config/collectors/impl/base64-config-collector.ts +1 -1
- package/src/util/config/collectors/impl/filesystem-config-collector.ts +2 -2
- package/src/util/config/compound-config-collector.ts +3 -3
- package/src/util/config/sync-rules/impl/filesystem-sync-rules-collector.ts +1 -1
- package/src/util/config/sync-rules/sync-rules-provider.ts +1 -1
- package/src/util/config.ts +1 -1
- package/src/util/env.ts +1 -1
- package/src/util/errors.ts +21 -0
- package/src/util/protocol-types.ts +1 -1
- package/src/util/util-index.ts +1 -1
- package/src/util/utils.ts +1 -1
- package/test/src/ReplicationLagTracker.test.ts +53 -0
- package/test/src/RollingBucketMax.test.ts +106 -0
- package/test/src/auth.test.ts +26 -7
- package/test/src/checksum_cache.test.ts +102 -57
- package/test/src/config.test.ts +1 -0
- package/test/src/diagnostics.test.ts +151 -0
- package/test/src/module-loader.test.ts +1 -1
- package/test/src/routes/mocks.ts +1 -1
- package/test/src/routes/stream.test.ts +1 -2
- package/test/src/sync/BucketChecksumState.test.ts +209 -80
- package/test/src/util/protocol_types.test.ts +1 -1
- package/test/src/utils.ts +9 -0
- package/test/tsconfig.json +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/vitest.config.ts +1 -1
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { Logger, ObserverClient } from '@powersync/lib-services-framework';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
BucketDataSource,
|
|
4
|
+
HydratedSyncRules,
|
|
5
|
+
ScopedParameterLookup,
|
|
6
|
+
SqliteJsonRow
|
|
7
|
+
} from '@powersync/service-sync-rules';
|
|
8
|
+
import { PerformanceTracer } from '../tracing/PerformanceTracer.js';
|
|
3
9
|
import * as util from '../util/util-index.js';
|
|
4
10
|
import { BucketStorageBatch, FlushedResult, SaveUpdate } from './BucketStorageBatch.js';
|
|
5
11
|
import { BucketStorageFactory } from './BucketStorageFactory.js';
|
|
@@ -9,7 +15,7 @@ import { SourceTable } from './SourceTable.js';
|
|
|
9
15
|
import { SyncStorageWriteCheckpointAPI } from './WriteCheckpointAPI.js';
|
|
10
16
|
|
|
11
17
|
/**
|
|
12
|
-
* Storage for a specific
|
|
18
|
+
* Storage for a specific replication stream.
|
|
13
19
|
*/
|
|
14
20
|
export interface SyncRulesBucketStorage
|
|
15
21
|
extends ObserverClient<SyncRulesBucketStorageListener>,
|
|
@@ -18,6 +24,7 @@ export interface SyncRulesBucketStorage
|
|
|
18
24
|
readonly slot_name: string;
|
|
19
25
|
|
|
20
26
|
readonly factory: BucketStorageFactory;
|
|
27
|
+
readonly logger: Logger;
|
|
21
28
|
|
|
22
29
|
/**
|
|
23
30
|
* Resolve a table, keeping track of it internally.
|
|
@@ -25,21 +32,28 @@ export interface SyncRulesBucketStorage
|
|
|
25
32
|
resolveTable(options: ResolveTableOptions): Promise<ResolveTableResult>;
|
|
26
33
|
|
|
27
34
|
/**
|
|
28
|
-
*
|
|
35
|
+
* Create a new writer.
|
|
36
|
+
*
|
|
37
|
+
* The writer must be flushed and disposed when done.
|
|
38
|
+
*/
|
|
39
|
+
createWriter(options: CreateWriterOptions): Promise<BucketStorageBatch>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Use `createWriter()` with `await using` instead.
|
|
29
43
|
*/
|
|
30
44
|
startBatch(
|
|
31
|
-
options:
|
|
45
|
+
options: CreateWriterOptions,
|
|
32
46
|
callback: (batch: BucketStorageBatch) => Promise<void>
|
|
33
47
|
): Promise<FlushedResult | null>;
|
|
34
48
|
|
|
35
49
|
getParsedSyncRules(options: ParseSyncRulesOptions): HydratedSyncRules;
|
|
36
50
|
|
|
37
51
|
/**
|
|
38
|
-
* Terminate the
|
|
52
|
+
* Terminate the replication stream.
|
|
39
53
|
*
|
|
40
54
|
* This clears the storage, and sets state to TERMINATED.
|
|
41
55
|
*
|
|
42
|
-
* Must only be called on stopped
|
|
56
|
+
* Must only be called on stopped replication streams.
|
|
43
57
|
*/
|
|
44
58
|
terminate(options?: TerminateOptions): Promise<void>;
|
|
45
59
|
|
|
@@ -86,7 +100,7 @@ export interface SyncRulesBucketStorage
|
|
|
86
100
|
/**
|
|
87
101
|
* Yields the latest user write checkpoint whenever the sync checkpoint updates.
|
|
88
102
|
*
|
|
89
|
-
* The stream stops or errors if this is not the active sync
|
|
103
|
+
* The stream stops or errors if this is not the active sync config (anymore).
|
|
90
104
|
*/
|
|
91
105
|
watchCheckpointChanges(options: WatchWriteCheckpointOptions): AsyncIterable<StorageCheckpointUpdate>;
|
|
92
106
|
|
|
@@ -103,7 +117,7 @@ export interface SyncRulesBucketStorage
|
|
|
103
117
|
*/
|
|
104
118
|
getBucketDataBatch(
|
|
105
119
|
checkpoint: util.InternalOpId,
|
|
106
|
-
dataBuckets:
|
|
120
|
+
dataBuckets: BucketDataRequest[],
|
|
107
121
|
options?: BucketDataBatchOptions
|
|
108
122
|
): AsyncIterable<SyncBucketDataChunk>;
|
|
109
123
|
|
|
@@ -115,7 +129,7 @@ export interface SyncRulesBucketStorage
|
|
|
115
129
|
* This may be slow, depending on the size of the buckets.
|
|
116
130
|
* The checksums are cached internally to compensate for this, but does not cover all cases.
|
|
117
131
|
*/
|
|
118
|
-
getChecksums(checkpoint: util.InternalOpId, buckets:
|
|
132
|
+
getChecksums(checkpoint: util.InternalOpId, buckets: BucketChecksumRequest[]): Promise<util.ChecksumMap>;
|
|
119
133
|
|
|
120
134
|
/**
|
|
121
135
|
* Clear checksum cache. Primarily intended for tests.
|
|
@@ -127,6 +141,16 @@ export interface SyncRulesBucketStorageListener {
|
|
|
127
141
|
batchStarted: (batch: BucketStorageBatch) => void;
|
|
128
142
|
}
|
|
129
143
|
|
|
144
|
+
export interface BucketDataRequest {
|
|
145
|
+
bucket: string;
|
|
146
|
+
start: util.InternalOpId;
|
|
147
|
+
source: BucketDataSource;
|
|
148
|
+
}
|
|
149
|
+
export interface BucketChecksumRequest {
|
|
150
|
+
bucket: string;
|
|
151
|
+
source: BucketDataSource;
|
|
152
|
+
}
|
|
153
|
+
|
|
130
154
|
export interface SyncRuleStatus {
|
|
131
155
|
checkpoint_lsn: string | null;
|
|
132
156
|
active: boolean;
|
|
@@ -147,7 +171,7 @@ export interface ResolveTableResult {
|
|
|
147
171
|
dropTables: SourceTable[];
|
|
148
172
|
}
|
|
149
173
|
|
|
150
|
-
export interface
|
|
174
|
+
export interface CreateWriterOptions extends ParseSyncRulesOptions {
|
|
151
175
|
zeroLSN: string;
|
|
152
176
|
/**
|
|
153
177
|
* Whether or not to store a copy of the current data.
|
|
@@ -174,9 +198,16 @@ export interface StartBatchOptions extends ParseSyncRulesOptions {
|
|
|
174
198
|
*/
|
|
175
199
|
markRecordUnavailable?: BucketStorageMarkRecordUnavailable;
|
|
176
200
|
|
|
201
|
+
tracer?: PerformanceTracer<'storage' | 'evaluate'>;
|
|
202
|
+
|
|
177
203
|
logger?: Logger;
|
|
178
204
|
}
|
|
179
205
|
|
|
206
|
+
/**
|
|
207
|
+
* @deprecated Use `CreateWriterOptions`.
|
|
208
|
+
*/
|
|
209
|
+
export interface StartBatchOptions extends CreateWriterOptions {}
|
|
210
|
+
|
|
180
211
|
export interface CompactOptions {
|
|
181
212
|
/**
|
|
182
213
|
* Heap memory limit for the compact process.
|
|
@@ -238,6 +269,8 @@ export interface CompactOptions {
|
|
|
238
269
|
compactParameterCacheLimit?: number;
|
|
239
270
|
|
|
240
271
|
signal?: AbortSignal;
|
|
272
|
+
|
|
273
|
+
logger?: Logger;
|
|
241
274
|
}
|
|
242
275
|
|
|
243
276
|
export interface PopulateChecksumCacheOptions {
|
|
@@ -293,8 +326,41 @@ export interface ReplicationCheckpoint {
|
|
|
293
326
|
* Used to resolve "dynamic" parameter queries.
|
|
294
327
|
*
|
|
295
328
|
* This gets parameter sets specific to this checkpoint.
|
|
329
|
+
*
|
|
330
|
+
* @throws {@link ParameterSetLimitExceededError}
|
|
331
|
+
* Thrown if resolved lookups in bucket storage exceed the `limit` parameter.
|
|
332
|
+
*/
|
|
333
|
+
getParameterSets(lookups: ScopedParameterLookup[], limit: number): Promise<SqliteJsonRow[]>;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* An exception thrown by {@link ReplicationCheckpoint} implementations if there are too many parameter results.
|
|
338
|
+
*
|
|
339
|
+
* This is not a suitable exception to show to users, `BucketParameterState` adds additional context.
|
|
340
|
+
*/
|
|
341
|
+
export class ParameterSetLimitExceededError extends Error {
|
|
342
|
+
constructor(
|
|
343
|
+
readonly limit: number,
|
|
344
|
+
readonly breakdown?: ParameterQueryInvocationLog[]
|
|
345
|
+
) {
|
|
346
|
+
super(`Too many parameter results (limit was ${limit})`);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export interface ParameterQueryInvocationLog {
|
|
351
|
+
/**
|
|
352
|
+
* The definition for which a parameter query was invoked.
|
|
353
|
+
*
|
|
354
|
+
* The exact format of definition is unspecified, it's shown to users to help them debug this failure.
|
|
355
|
+
*/
|
|
356
|
+
definition: string;
|
|
357
|
+
/**
|
|
358
|
+
* If {@link didExceedLimit} is false, the amount of rows returned by the invocation.
|
|
359
|
+
*
|
|
360
|
+
* Otherwise, the maximum amount of rows this invocation was allowed to return.
|
|
296
361
|
*/
|
|
297
|
-
|
|
362
|
+
resultsOrLimit: number;
|
|
363
|
+
didExceedLimit: boolean;
|
|
298
364
|
}
|
|
299
365
|
|
|
300
366
|
export interface WatchWriteCheckpointOptions {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export enum WriteCheckpointMode {
|
|
2
2
|
/**
|
|
3
3
|
* Raw mappings of `user_id` to `write_checkpoint`s should
|
|
4
|
-
* be supplied for each
|
|
4
|
+
* be supplied for each replication stream.
|
|
5
5
|
*/
|
|
6
6
|
CUSTOM = 'custom',
|
|
7
7
|
/**
|
|
@@ -21,7 +21,7 @@ export interface BaseWriteCheckpointIdentifier {
|
|
|
21
21
|
|
|
22
22
|
export interface CustomWriteCheckpointFilters extends BaseWriteCheckpointIdentifier {
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Replication stream which was active when this checkpoint was created.
|
|
25
25
|
*/
|
|
26
26
|
sync_rules_id: number;
|
|
27
27
|
}
|
|
@@ -35,7 +35,7 @@ export interface BatchedCustomWriteCheckpointOptions extends BaseWriteCheckpoint
|
|
|
35
35
|
|
|
36
36
|
export interface CustomWriteCheckpointOptions extends BatchedCustomWriteCheckpointOptions {
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Replication stream which was active when this checkpoint was created.
|
|
39
39
|
*/
|
|
40
40
|
sync_rules_id: number;
|
|
41
41
|
}
|
|
@@ -63,8 +63,8 @@ export interface BaseWriteCheckpointAPI {
|
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Write Checkpoint API to be used in conjunction with a {@link SyncRulesBucketStorage}.
|
|
66
|
-
* This storage corresponds with a
|
|
67
|
-
*
|
|
66
|
+
* This storage corresponds with a replication stream. These APIs don't require specifying a
|
|
67
|
+
* replication stream id.
|
|
68
68
|
*/
|
|
69
69
|
export interface SyncStorageWriteCheckpointAPI extends BaseWriteCheckpointAPI {
|
|
70
70
|
lastWriteCheckpoint(filters: SyncStorageLastWriteCheckpointFilters): Promise<bigint | null>;
|
|
@@ -72,7 +72,7 @@ export interface SyncStorageWriteCheckpointAPI extends BaseWriteCheckpointAPI {
|
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* Write Checkpoint API which is interfaced directly with the storage layer. This requires
|
|
75
|
-
*
|
|
75
|
+
* replication stream identifiers for custom write checkpoints.
|
|
76
76
|
*/
|
|
77
77
|
export interface WriteCheckpointAPI extends BaseWriteCheckpointAPI {
|
|
78
78
|
lastWriteCheckpoint(filters: LastWriteCheckpointFilters): Promise<bigint | null>;
|
package/src/storage/bson.ts
CHANGED
|
@@ -40,11 +40,6 @@ export const deserializeParameterLookup = (lookup: bson.Binary) => {
|
|
|
40
40
|
return parsed;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
export const getLookupBucketDefinitionName = (lookup: bson.Binary) => {
|
|
44
|
-
const parsed = deserializeParameterLookup(lookup);
|
|
45
|
-
return parsed[0] as string;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
43
|
/**
|
|
49
44
|
* True if this is a bson.UUID.
|
|
50
45
|
*
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export * from './bson.js';
|
|
2
2
|
export * from './BucketStorage.js';
|
|
3
|
+
export * from './BucketStorageBatch.js';
|
|
4
|
+
export * from './BucketStorageFactory.js';
|
|
3
5
|
export * from './ChecksumCache.js';
|
|
6
|
+
export * from './PersistedSyncRulesContent.js';
|
|
4
7
|
export * from './ReplicationEventPayload.js';
|
|
8
|
+
export * from './ReplicationLock.js';
|
|
9
|
+
export * from './ReportStorage.js';
|
|
5
10
|
export * from './SourceEntity.js';
|
|
6
11
|
export * from './SourceTable.js';
|
|
12
|
+
export * from './storage-metrics.js';
|
|
7
13
|
export * from './StorageEngine.js';
|
|
8
14
|
export * from './StorageProvider.js';
|
|
9
|
-
export * from './storage-metrics.js';
|
|
10
|
-
export * from './WriteCheckpointAPI.js';
|
|
11
|
-
export * from './BucketStorageFactory.js';
|
|
12
|
-
export * from './BucketStorageBatch.js';
|
|
13
|
-
export * from './SyncRulesBucketStorage.js';
|
|
14
|
-
export * from './PersistedSyncRulesContent.js';
|
|
15
|
-
export * from './ReplicationLock.js';
|
|
16
|
-
export * from './ReportStorage.js';
|
|
17
15
|
export * from './StorageVersionConfig.js';
|
|
16
|
+
export * from './SyncRulesBucketStorage.js';
|
|
17
|
+
export * from './WriteCheckpointAPI.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MetricsEngine } from '../metrics/MetricsEngine.js';
|
|
2
1
|
import { logger } from '@powersync/lib-services-framework';
|
|
3
|
-
import { BucketStorageFactory, StorageMetrics } from './BucketStorageFactory.js';
|
|
4
2
|
import { StorageMetric } from '@powersync/service-types';
|
|
3
|
+
import { MetricsEngine } from '../metrics/MetricsEngine.js';
|
|
4
|
+
import { BucketStorageFactory, StorageMetrics } from './BucketStorageFactory.js';
|
|
5
5
|
|
|
6
6
|
export function createCoreStorageMetrics(engine: MetricsEngine): void {
|
|
7
7
|
engine.createObservableGauge({
|