@powersync/service-module-mongodb 0.0.0-dev-20241001150444

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 (62) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE +67 -0
  3. package/README.md +3 -0
  4. package/dist/api/MongoRouteAPIAdapter.d.ts +22 -0
  5. package/dist/api/MongoRouteAPIAdapter.js +64 -0
  6. package/dist/api/MongoRouteAPIAdapter.js.map +1 -0
  7. package/dist/index.d.ts +3 -0
  8. package/dist/index.js +4 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/module/MongoModule.d.ts +13 -0
  11. package/dist/module/MongoModule.js +46 -0
  12. package/dist/module/MongoModule.js.map +1 -0
  13. package/dist/replication/ChangeStream.d.ts +53 -0
  14. package/dist/replication/ChangeStream.js +389 -0
  15. package/dist/replication/ChangeStream.js.map +1 -0
  16. package/dist/replication/ChangeStreamReplicationJob.d.ts +16 -0
  17. package/dist/replication/ChangeStreamReplicationJob.js +90 -0
  18. package/dist/replication/ChangeStreamReplicationJob.js.map +1 -0
  19. package/dist/replication/ChangeStreamReplicator.d.ts +13 -0
  20. package/dist/replication/ChangeStreamReplicator.js +26 -0
  21. package/dist/replication/ChangeStreamReplicator.js.map +1 -0
  22. package/dist/replication/ConnectionManagerFactory.d.ts +9 -0
  23. package/dist/replication/ConnectionManagerFactory.js +21 -0
  24. package/dist/replication/ConnectionManagerFactory.js.map +1 -0
  25. package/dist/replication/MongoErrorRateLimiter.d.ts +11 -0
  26. package/dist/replication/MongoErrorRateLimiter.js +44 -0
  27. package/dist/replication/MongoErrorRateLimiter.js.map +1 -0
  28. package/dist/replication/MongoManager.d.ts +14 -0
  29. package/dist/replication/MongoManager.js +36 -0
  30. package/dist/replication/MongoManager.js.map +1 -0
  31. package/dist/replication/MongoRelation.d.ts +9 -0
  32. package/dist/replication/MongoRelation.js +174 -0
  33. package/dist/replication/MongoRelation.js.map +1 -0
  34. package/dist/replication/replication-index.d.ts +4 -0
  35. package/dist/replication/replication-index.js +5 -0
  36. package/dist/replication/replication-index.js.map +1 -0
  37. package/dist/types/types.d.ts +51 -0
  38. package/dist/types/types.js +37 -0
  39. package/dist/types/types.js.map +1 -0
  40. package/package.json +47 -0
  41. package/src/api/MongoRouteAPIAdapter.ts +86 -0
  42. package/src/index.ts +5 -0
  43. package/src/module/MongoModule.ts +52 -0
  44. package/src/replication/ChangeStream.ts +503 -0
  45. package/src/replication/ChangeStreamReplicationJob.ts +104 -0
  46. package/src/replication/ChangeStreamReplicator.ts +36 -0
  47. package/src/replication/ConnectionManagerFactory.ts +27 -0
  48. package/src/replication/MongoErrorRateLimiter.ts +45 -0
  49. package/src/replication/MongoManager.ts +47 -0
  50. package/src/replication/MongoRelation.ts +156 -0
  51. package/src/replication/replication-index.ts +4 -0
  52. package/src/types/types.ts +65 -0
  53. package/test/src/change_stream.test.ts +306 -0
  54. package/test/src/change_stream_utils.ts +148 -0
  55. package/test/src/env.ts +7 -0
  56. package/test/src/mongo_test.test.ts +219 -0
  57. package/test/src/setup.ts +7 -0
  58. package/test/src/util.ts +52 -0
  59. package/test/tsconfig.json +28 -0
  60. package/tsconfig.json +28 -0
  61. package/tsconfig.tsbuildinfo +1 -0
  62. package/vitest.config.ts +9 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # @powersync/service-module-mongodb
2
+
3
+ ## 0.0.0-dev-20241001150444
4
+
5
+ ### Minor Changes
6
+
7
+ - 6f54a28: Add MongoDB support (Alpha)
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [d51921f]
12
+ - @powersync/service-core@0.0.0-dev-20241001150444
13
+ - @powersync/service-sync-rules@0.0.0-dev-20241001150444
14
+ - @powersync/lib-services-framework@0.0.0-dev-20241001150444
15
+ - @powersync/service-types@0.0.0-dev-20241001150444
package/LICENSE ADDED
@@ -0,0 +1,67 @@
1
+ # Functional Source License, Version 1.1, Apache 2.0 Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-Apache-2.0
6
+
7
+ ## Notice
8
+
9
+ Copyright 2023-2024 Journey Mobile, Inc.
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under these Terms and Conditions, as indicated by our inclusion of these Terms and Conditions with the Software.
20
+
21
+ ### License Grant
22
+
23
+ Subject to your compliance with this License Grant and the Patents, Redistribution and Trademark clauses below, we hereby grant you the right to use, copy, modify, create derivative works, publicly perform, publicly display and redistribute the Software for any Permitted Purpose identified below.
24
+
25
+ ### Permitted Purpose
26
+
27
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use means making the Software available to others in a commercial product or service that:
28
+
29
+ 1. substitutes for the Software;
30
+ 2. substitutes for any other product or service we offer using the Software that exists as of the date we make the Software available; or
31
+ 3. offers the same or substantially similar functionality as the Software.
32
+
33
+ Permitted Purposes specifically include using the Software:
34
+
35
+ 1. for your internal use and access;
36
+ 2. for non-commercial education;
37
+ 3. for non-commercial research; and
38
+ 4. in connection with professional services that you provide to a licensee using the Software in accordance with these Terms and Conditions.
39
+
40
+ ### Patents
41
+
42
+ To the extent your use for a Permitted Purpose would necessarily infringe our patents, the license grant above includes a license under our patents. If you make a claim against any party that the Software infringes or contributes to the infringement of any patent, then your patent license to the Software ends immediately.
43
+
44
+ ### Redistribution
45
+
46
+ The Terms and Conditions apply to all copies, modifications and derivatives of the Software.
47
+ If you redistribute any copies, modifications or derivatives of the Software, you must include a copy of or a link to these Terms and Conditions and not remove any copyright notices provided in or with the Software.
48
+
49
+ ### Disclaimer
50
+
51
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
52
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
53
+
54
+ ### Trademarks
55
+
56
+ Except for displaying the License Details and identifying us as the origin of the Software, you have no right under these Terms and Conditions to use our trademarks, trade names, service marks or product names.
57
+
58
+ ## Grant of Future License
59
+
60
+ We hereby irrevocably grant you an additional license to use the Software under the Apache License, Version 2.0 that is effective on the second anniversary of the date we make the Software available. On or after that date, you may use the Software under the Apache License, Version 2.0, in which case the following will apply:
61
+
62
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
63
+ You may obtain a copy of the License at
64
+
65
+ http://www.apache.org/licenses/LICENSE-2.0
66
+
67
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # PowerSync Service Module MongoDB
2
+
3
+ MongoDB replication module for PowerSync
@@ -0,0 +1,22 @@
1
+ import { api, ParseSyncRulesOptions } from '@powersync/service-core';
2
+ import * as mongo from 'mongodb';
3
+ import * as sync_rules from '@powersync/service-sync-rules';
4
+ import * as service_types from '@powersync/service-types';
5
+ import * as types from '../types/types.js';
6
+ export declare class MongoRouteAPIAdapter implements api.RouteAPI {
7
+ protected config: types.ResolvedConnectionConfig;
8
+ protected client: mongo.MongoClient;
9
+ private db;
10
+ connectionTag: string;
11
+ defaultSchema: string;
12
+ constructor(config: types.ResolvedConnectionConfig);
13
+ getParseSyncRulesOptions(): ParseSyncRulesOptions;
14
+ shutdown(): Promise<void>;
15
+ getSourceConfig(): Promise<service_types.configFile.DataSourceConfig>;
16
+ getConnectionStatus(): Promise<service_types.ConnectionStatusV2>;
17
+ executeQuery(query: string, params: any[]): Promise<service_types.internal_routes.ExecuteSqlResponse>;
18
+ getDebugTablesInfo(tablePatterns: sync_rules.TablePattern[], sqlSyncRules: sync_rules.SqlSyncRules): Promise<api.PatternResult[]>;
19
+ getReplicationLag(syncRulesId: string): Promise<number>;
20
+ getReplicationHead(): Promise<string>;
21
+ getConnectionSchema(): Promise<service_types.DatabaseSchema[]>;
22
+ }
@@ -0,0 +1,64 @@
1
+ import * as sync_rules from '@powersync/service-sync-rules';
2
+ import * as service_types from '@powersync/service-types';
3
+ import * as types from '../types/types.js';
4
+ import { MongoManager } from '../replication/MongoManager.js';
5
+ import { createCheckpoint } from '../replication/MongoRelation.js';
6
+ export class MongoRouteAPIAdapter {
7
+ constructor(config) {
8
+ this.config = config;
9
+ const manager = new MongoManager(config);
10
+ this.client = manager.client;
11
+ this.db = manager.db;
12
+ this.defaultSchema = manager.db.databaseName;
13
+ this.connectionTag = config.tag ?? sync_rules.DEFAULT_TAG;
14
+ }
15
+ getParseSyncRulesOptions() {
16
+ return {
17
+ defaultSchema: this.defaultSchema
18
+ };
19
+ }
20
+ async shutdown() {
21
+ await this.client.close();
22
+ }
23
+ async getSourceConfig() {
24
+ return this.config;
25
+ }
26
+ async getConnectionStatus() {
27
+ // TODO: Implement
28
+ const base = {
29
+ id: this.config.id,
30
+ uri: types.baseUri(this.config)
31
+ };
32
+ return {
33
+ ...base,
34
+ connected: true,
35
+ errors: []
36
+ };
37
+ }
38
+ async executeQuery(query, params) {
39
+ return service_types.internal_routes.ExecuteSqlResponse.encode({
40
+ results: {
41
+ columns: [],
42
+ rows: []
43
+ },
44
+ success: false,
45
+ error: 'SQL querying is not supported for MongoDB'
46
+ });
47
+ }
48
+ async getDebugTablesInfo(tablePatterns, sqlSyncRules) {
49
+ // TODO: Implement
50
+ return [];
51
+ }
52
+ async getReplicationLag(syncRulesId) {
53
+ // TODO: Implement
54
+ return 0;
55
+ }
56
+ async getReplicationHead() {
57
+ return createCheckpoint(this.client, this.db);
58
+ }
59
+ async getConnectionSchema() {
60
+ // TODO: Implement
61
+ return [];
62
+ }
63
+ }
64
+ //# sourceMappingURL=MongoRouteAPIAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MongoRouteAPIAdapter.js","sourceRoot":"","sources":["../../src/api/MongoRouteAPIAdapter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAe,MAAM,iCAAiC,CAAC;AAEhF,MAAM,OAAO,oBAAoB;IAO/B,YAAsB,MAAsC;QAAtC,WAAM,GAAN,MAAM,CAAgC;QAC1D,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;QACrB,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC;QAC7C,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC;IAC5D,CAAC;IAED,wBAAwB;QACtB,OAAO;YACL,aAAa,EAAE,IAAI,CAAC,aAAa;SAClC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,kBAAkB;QAClB,MAAM,IAAI,GAAG;YACX,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;YAClB,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;SAChC,CAAC;QACF,OAAO;YACL,GAAG,IAAI;YACP,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,EAAE;SACX,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,KAAa,EAAE,MAAa;QAC7C,OAAO,aAAa,CAAC,eAAe,CAAC,kBAAkB,CAAC,MAAM,CAAC;YAC7D,OAAO,EAAE;gBACP,OAAO,EAAE,EAAE;gBACX,IAAI,EAAE,EAAE;aACT;YACD,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,2CAA2C;SACnD,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,aAAwC,EACxC,YAAqC;QAErC,kBAAkB;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,WAAmB;QACzC,kBAAkB;QAElB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,OAAO,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,kBAAkB;QAElB,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ import { MongoModule } from './module/MongoModule.js';
2
+ export declare const module: MongoModule;
3
+ export default module;
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { MongoModule } from './module/MongoModule.js';
2
+ export const module = new MongoModule();
3
+ export default module;
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;AAExC,eAAe,MAAM,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { api, replication, system, TearDownOptions } from '@powersync/service-core';
2
+ import * as types from '../types/types.js';
3
+ export declare class MongoModule extends replication.ReplicationModule<types.MongoConnectionConfig> {
4
+ constructor();
5
+ initialize(context: system.ServiceContextContainer): Promise<void>;
6
+ protected createRouteAPIAdapter(): api.RouteAPI;
7
+ protected createReplicator(context: system.ServiceContext): replication.AbstractReplicator;
8
+ /**
9
+ * Combines base config with normalized connection settings
10
+ */
11
+ private resolveConfig;
12
+ teardown(options: TearDownOptions): Promise<void>;
13
+ }
@@ -0,0 +1,46 @@
1
+ import { ConfigurationFileSyncRulesProvider, replication } from '@powersync/service-core';
2
+ import { MongoRouteAPIAdapter } from '../api/MongoRouteAPIAdapter.js';
3
+ import { ConnectionManagerFactory } from '../replication/ConnectionManagerFactory.js';
4
+ import { MongoErrorRateLimiter } from '../replication/MongoErrorRateLimiter.js';
5
+ import { ChangeStreamReplicator } from '../replication/ChangeStreamReplicator.js';
6
+ import * as types from '../types/types.js';
7
+ export class MongoModule extends replication.ReplicationModule {
8
+ constructor() {
9
+ super({
10
+ name: 'MongoDB',
11
+ type: types.MONGO_CONNECTION_TYPE,
12
+ configSchema: types.MongoConnectionConfig
13
+ });
14
+ }
15
+ async initialize(context) {
16
+ await super.initialize(context);
17
+ }
18
+ createRouteAPIAdapter() {
19
+ return new MongoRouteAPIAdapter(this.resolveConfig(this.decodedConfig));
20
+ }
21
+ createReplicator(context) {
22
+ const normalisedConfig = this.resolveConfig(this.decodedConfig);
23
+ const syncRuleProvider = new ConfigurationFileSyncRulesProvider(context.configuration.sync_rules);
24
+ const connectionFactory = new ConnectionManagerFactory(normalisedConfig);
25
+ return new ChangeStreamReplicator({
26
+ id: this.getDefaultId(normalisedConfig.database ?? ''),
27
+ syncRuleProvider: syncRuleProvider,
28
+ storageEngine: context.storageEngine,
29
+ connectionFactory: connectionFactory,
30
+ rateLimiter: new MongoErrorRateLimiter()
31
+ });
32
+ }
33
+ /**
34
+ * Combines base config with normalized connection settings
35
+ */
36
+ resolveConfig(config) {
37
+ return {
38
+ ...config,
39
+ ...types.normalizeConnectionConfig(config)
40
+ };
41
+ }
42
+ async teardown(options) {
43
+ // TODO: Implement?
44
+ }
45
+ }
46
+ //# sourceMappingURL=MongoModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MongoModule.js","sourceRoot":"","sources":["../../src/module/MongoModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,kCAAkC,EAAE,WAAW,EAA2B,MAAM,yBAAyB,CAAC;AACxH,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,MAAM,OAAO,WAAY,SAAQ,WAAW,CAAC,iBAA8C;IACzF;QACE,KAAK,CAAC;YACJ,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,KAAK,CAAC,qBAAqB;YACjC,YAAY,EAAE,KAAK,CAAC,qBAAqB;SAC1C,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAAuC;QACtD,MAAM,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAES,qBAAqB;QAC7B,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,aAAc,CAAC,CAAC,CAAC;IAC3E,CAAC;IAES,gBAAgB,CAAC,OAA8B;QACvD,MAAM,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,aAAc,CAAC,CAAC;QACjE,MAAM,gBAAgB,GAAG,IAAI,kCAAkC,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAClG,MAAM,iBAAiB,GAAG,IAAI,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;QAEzE,OAAO,IAAI,sBAAsB,CAAC;YAChC,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,QAAQ,IAAI,EAAE,CAAC;YACtD,gBAAgB,EAAE,gBAAgB;YAClC,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,iBAAiB,EAAE,iBAAiB;YACpC,WAAW,EAAE,IAAI,qBAAqB,EAAE;SACzC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACK,aAAa,CAAC,MAAmC;QACvD,OAAO;YACL,GAAG,MAAM;YACT,GAAG,KAAK,CAAC,yBAAyB,CAAC,MAAM,CAAC;SAC3C,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAwB;QACrC,mBAAmB;IACrB,CAAC;CACF"}
@@ -0,0 +1,53 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { SourceEntityDescriptor, SourceTable, storage } from '@powersync/service-core';
3
+ import { DatabaseInputRow, SqliteRow, SqlSyncRules, TablePattern } from '@powersync/service-sync-rules';
4
+ import * as mongo from 'mongodb';
5
+ import { MongoManager } from './MongoManager.js';
6
+ export declare const ZERO_LSN = "0000000000000000";
7
+ export interface ChangeStreamOptions {
8
+ connections: MongoManager;
9
+ storage: storage.SyncRulesBucketStorage;
10
+ abort_signal: AbortSignal;
11
+ }
12
+ interface InitResult {
13
+ needsInitialSync: boolean;
14
+ }
15
+ export declare class MissingReplicationSlotError extends Error {
16
+ constructor(message: string);
17
+ }
18
+ export declare class ChangeStream {
19
+ sync_rules: SqlSyncRules;
20
+ group_id: number;
21
+ connection_id: number;
22
+ private readonly storage;
23
+ private connections;
24
+ private readonly client;
25
+ private readonly defaultDb;
26
+ private abort_signal;
27
+ private relation_cache;
28
+ constructor(options: ChangeStreamOptions);
29
+ get stopped(): boolean;
30
+ getQualifiedTableNames(batch: storage.BucketStorageBatch, tablePattern: TablePattern): Promise<storage.SourceTable[]>;
31
+ initSlot(): Promise<InitResult>;
32
+ estimatedCount(table: storage.SourceTable): Promise<string>;
33
+ /**
34
+ * Start initial replication.
35
+ *
36
+ * If (partial) replication was done before on this slot, this clears the state
37
+ * and starts again from scratch.
38
+ */
39
+ startInitialReplication(): Promise<void>;
40
+ initialReplication(): Promise<void>;
41
+ private getSourceNamespaceFilters;
42
+ static getQueryData(results: Iterable<DatabaseInputRow>): Generator<SqliteRow>;
43
+ private snapshotTable;
44
+ private getRelation;
45
+ handleRelation(batch: storage.BucketStorageBatch, descriptor: SourceEntityDescriptor, options: {
46
+ snapshot: boolean;
47
+ }): Promise<SourceTable>;
48
+ writeChange(batch: storage.BucketStorageBatch, table: storage.SourceTable, change: mongo.ChangeStreamDocument): Promise<storage.FlushedResult | null>;
49
+ replicate(): Promise<void>;
50
+ initReplication(): Promise<void>;
51
+ streamChanges(): Promise<void>;
52
+ }
53
+ export {};