@powersync/service-module-mongodb 0.0.0-dev-20260909133214 → 0.0.0-dev-20260929095716
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 +38 -6
- package/ci/test-connection.yaml +12 -0
- package/dist/api/MongoRouteAPIAdapter.d.ts +2 -2
- package/dist/api/MongoRouteAPIAdapter.js +73 -143
- package/dist/api/MongoRouteAPIAdapter.js.map +1 -1
- package/dist/api/infer-collection-schema.d.ts +12 -0
- package/dist/api/infer-collection-schema.js +142 -0
- package/dist/api/infer-collection-schema.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/module/MongoModule.d.ts +1 -2
- package/dist/module/MongoModule.js +0 -1
- package/dist/module/MongoModule.js.map +1 -1
- package/dist/replication/ChangeStream.d.ts +10 -2
- package/dist/replication/ChangeStream.js +228 -317
- package/dist/replication/ChangeStream.js.map +1 -1
- package/dist/replication/ChangeStreamReplicationJob.d.ts +4 -1
- package/dist/replication/ChangeStreamReplicationJob.js +4 -1
- package/dist/replication/ChangeStreamReplicationJob.js.map +1 -1
- package/dist/replication/ChangeStreamReplicator.d.ts +3 -0
- package/dist/replication/ChangeStreamReplicator.js +3 -0
- package/dist/replication/ChangeStreamReplicator.js.map +1 -1
- package/dist/replication/MongoRelation.js +5 -2
- package/dist/replication/MongoRelation.js.map +1 -1
- package/dist/replication/MongoReplicationQueryProvider.d.ts +87 -0
- package/dist/replication/MongoReplicationQueryProvider.js +23 -0
- package/dist/replication/MongoReplicationQueryProvider.js.map +1 -0
- package/dist/replication/MongoReplicationStream.d.ts +85 -0
- package/dist/replication/MongoReplicationStream.js +101 -0
- package/dist/replication/MongoReplicationStream.js.map +1 -0
- package/dist/replication/MongoSnapshotQuery.d.ts +2 -0
- package/dist/replication/MongoSnapshotQuery.js +12 -2
- package/dist/replication/MongoSnapshotQuery.js.map +1 -1
- package/dist/replication/MongoSnapshotter.d.ts +7 -2
- package/dist/replication/MongoSnapshotter.js +58 -85
- package/dist/replication/MongoSnapshotter.js.map +1 -1
- package/dist/replication/RawChangeStream.d.ts +1 -1
- package/dist/replication/RawChangeStream.js +1 -1
- package/dist/replication/RawChangeStream.js.map +1 -1
- package/dist/replication/SourceRowConverter.d.ts +1 -0
- package/dist/replication/SourceRowConverter.js +4 -2
- package/dist/replication/SourceRowConverter.js.map +1 -1
- package/dist/replication/bufferToSqlite.d.ts +3 -1
- package/dist/replication/bufferToSqlite.js +35 -23
- package/dist/replication/bufferToSqlite.js.map +1 -1
- package/dist/replication/replication-index.d.ts +6 -0
- package/dist/replication/replication-index.js +6 -0
- package/dist/replication/replication-index.js.map +1 -1
- package/dist/test-utils/ChangeStreamTestContext.d.ts +131 -0
- package/dist/test-utils/ChangeStreamTestContext.js +391 -0
- package/dist/test-utils/ChangeStreamTestContext.js.map +1 -0
- package/dist/test-utils/test-utils-index.d.ts +1 -0
- package/dist/test-utils/test-utils-index.js +2 -0
- package/dist/test-utils/test-utils-index.js.map +1 -0
- package/package.json +8 -8
- package/src/api/MongoRouteAPIAdapter.ts +79 -127
- package/src/api/infer-collection-schema.ts +153 -0
- package/src/index.ts +1 -0
- package/src/module/MongoModule.ts +1 -3
- package/src/replication/ChangeStream.ts +253 -359
- package/src/replication/ChangeStreamReplicationJob.ts +7 -2
- package/src/replication/ChangeStreamReplicator.ts +5 -0
- package/src/replication/MongoRelation.ts +8 -1
- package/src/replication/MongoReplicationQueryProvider.ts +108 -0
- package/src/replication/MongoReplicationStream.ts +201 -0
- package/src/replication/MongoSnapshotQuery.ts +19 -3
- package/src/replication/MongoSnapshotter.ts +70 -92
- package/src/replication/RawChangeStream.ts +2 -2
- package/src/replication/SourceRowConverter.ts +4 -2
- package/src/replication/bufferToSqlite.ts +43 -23
- package/src/replication/replication-index.ts +6 -0
- package/src/test-utils/ChangeStreamTestContext.ts +520 -0
- package/src/test-utils/test-utils-index.ts +1 -0
- package/test/src/buffer_to_sqlite.test.ts +9 -0
- package/test/src/change_stream.test.ts +3 -3
- package/test/src/change_stream_test_setup.ts +38 -0
- package/test/src/chunked_snapshot.test.ts +3 -3
- package/test/src/documentdb_mode.test.ts +3 -3
- package/test/src/replication_stream.test.ts +311 -0
- package/test/src/resume.test.ts +10 -4
- package/test/src/resuming_snapshots.test.ts +3 -3
- package/test/src/schema.test.ts +223 -0
- package/test/src/slow_tests.test.ts +3 -3
- package/test/src/snapshot_query_provider.test.ts +95 -0
- package/test/src/stream_progress.test.ts +312 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/test/src/change_stream_utils.ts +0 -375
|
@@ -3,6 +3,7 @@ import { DatabaseConnectionError, Logger } from '@powersync/lib-services-framewo
|
|
|
3
3
|
import { MetricsEngine, SourceEntityDescriptor, SourceTable, storage } from '@powersync/service-core';
|
|
4
4
|
import { HydratedSyncConfig } from '@powersync/service-sync-rules';
|
|
5
5
|
import { MongoManager } from './MongoManager.js';
|
|
6
|
+
import { MongoReplicationQueryProviderFactory } from './MongoReplicationQueryProvider.js';
|
|
6
7
|
import { MongoSnapshotterHooks } from './MongoSnapshotter.js';
|
|
7
8
|
import { ProjectedChangeStreamDocument } from './RawChangeStream.js';
|
|
8
9
|
export interface ChangeStreamOptions {
|
|
@@ -27,6 +28,10 @@ export interface ChangeStreamOptions {
|
|
|
27
28
|
keepaliveIntervalMs?: number;
|
|
28
29
|
storageHooks?: storage.StorageHooks;
|
|
29
30
|
snapshotHooks?: MongoSnapshotterHooks;
|
|
31
|
+
/**
|
|
32
|
+
* Create one adapter per replication attempt, shared with its snapshotter and source probes.
|
|
33
|
+
*/
|
|
34
|
+
createReplicationQueryProvider?: MongoReplicationQueryProviderFactory;
|
|
30
35
|
logger?: Logger;
|
|
31
36
|
}
|
|
32
37
|
/**
|
|
@@ -65,6 +70,7 @@ export declare class ChangeStream {
|
|
|
65
70
|
private changeStreamTimeout;
|
|
66
71
|
private storageHooks;
|
|
67
72
|
private readonly sourceRowConverter;
|
|
73
|
+
private readonly queryProvider;
|
|
68
74
|
private keepaliveIntervalMs;
|
|
69
75
|
private isDocumentDb;
|
|
70
76
|
private _checkpointImplementation;
|
|
@@ -78,7 +84,9 @@ export declare class ChangeStream {
|
|
|
78
84
|
get stopped(): boolean;
|
|
79
85
|
private get usePostImages();
|
|
80
86
|
private get configurePostImages();
|
|
81
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* The active checkpoint strategy. Only valid after ensureDetected().
|
|
89
|
+
*/
|
|
82
90
|
private get checkpointImplementation();
|
|
83
91
|
/**
|
|
84
92
|
* Detect DocumentDB and select the checkpoint implementation for the streaming
|
|
@@ -100,7 +108,7 @@ export declare class ChangeStream {
|
|
|
100
108
|
private initReplication;
|
|
101
109
|
private cleanupStoppedSyncConfigs;
|
|
102
110
|
private streamChanges;
|
|
103
|
-
private
|
|
111
|
+
private openChangeStream;
|
|
104
112
|
private rawToSqliteRow;
|
|
105
113
|
private createBatchCheckpoint;
|
|
106
114
|
streamChangesInternal(): Promise<void>;
|