@powersync/service-module-mongodb 0.0.0-dev-20260223082111 → 0.0.0-dev-20260225093637

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @powersync/service-module-mongodb
2
2
 
3
- ## 0.0.0-dev-20260223082111
3
+ ## 0.0.0-dev-20260225093637
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -9,14 +9,24 @@
9
9
 
10
10
  ### Patch Changes
11
11
 
12
+ - 15aea77: Support connection parameters via database URL query string. PostgreSQL supports `connect_timeout`. MongoDB supports `connectTimeoutMS`, `socketTimeoutMS`, `serverSelectionTimeoutMS`, `maxPoolSize`, `maxIdleTimeMS`. MySQL supports `connectTimeout`, `connectionLimit`, `queueLimit`.
13
+ - Updated dependencies [15aea77]
14
+ - Updated dependencies [0998251]
15
+ - Updated dependencies [65f3c89]
12
16
  - Updated dependencies [1c45667]
17
+ - Updated dependencies [8785a3f]
13
18
  - Updated dependencies [8a4c34e]
14
- - Updated dependencies [238fa85]
19
+ - Updated dependencies [b440093]
20
+ - Updated dependencies [d7ff4ad]
21
+ - Updated dependencies [d4ae5b5]
15
22
  - Updated dependencies [8bd83e8]
16
- - @powersync/service-sync-rules@0.0.0-dev-20260223082111
17
- - @powersync/service-core@0.0.0-dev-20260223082111
18
- - @powersync/lib-services-framework@0.0.0-dev-20260223082111
19
- - @powersync/lib-service-mongodb@0.0.0-dev-20260223082111
23
+ - Updated dependencies [79a9729]
24
+ - Updated dependencies [5edd95f]
25
+ - @powersync/lib-service-mongodb@0.0.0-dev-20260225093637
26
+ - @powersync/service-core@0.0.0-dev-20260225093637
27
+ - @powersync/service-types@0.0.0-dev-20260225093637
28
+ - @powersync/service-sync-rules@0.0.0-dev-20260225093637
29
+ - @powersync/lib-services-framework@0.0.0-dev-20260225093637
20
30
 
21
31
  ## 0.13.2
22
32
 
@@ -11,6 +11,7 @@ export class MongoManager extends BaseObserver {
11
11
  constructor(options, overrides) {
12
12
  super();
13
13
  this.options = options;
14
+ const params = options.connectionParams;
14
15
  // The pool is lazy - no connections are opened until a query is performed.
15
16
  this.client = new mongo.MongoClient(options.uri, {
16
17
  auth: {
@@ -18,12 +19,12 @@ export class MongoManager extends BaseObserver {
18
19
  password: options.password
19
20
  },
20
21
  lookup: options.lookup,
21
- // Time for connection to timeout
22
- connectTimeoutMS: 5_000,
23
- // Time for individual requests to timeout
24
- socketTimeoutMS: 60_000,
25
- // How long to wait for new primary selection
26
- serverSelectionTimeoutMS: 30_000,
22
+ // Time for connection to timeout (URL param overrides default)
23
+ connectTimeoutMS: params.connectTimeoutMS ?? 5_000,
24
+ // Time for individual requests to timeout (URL param overrides default)
25
+ socketTimeoutMS: params.socketTimeoutMS ?? 60_000,
26
+ // How long to wait for new primary selection (URL param overrides default)
27
+ serverSelectionTimeoutMS: params.serverSelectionTimeoutMS ?? 30_000,
27
28
  // Identify the client
28
29
  appName: `powersync ${POWERSYNC_VERSION}`,
29
30
  // Deprecated in the driver - in a future release we may have to rely on appName only.
@@ -35,9 +36,9 @@ export class MongoManager extends BaseObserver {
35
36
  // Avoid too many connections:
36
37
  // 1. It can overwhelm the source database.
37
38
  // 2. Processing too many queries in parallel can cause the process to run out of memory.
38
- maxPoolSize: 8,
39
+ maxPoolSize: params.maxPoolSize ?? 8,
39
40
  maxConnecting: 3,
40
- maxIdleTimeMS: 60_000,
41
+ maxIdleTimeMS: params.maxIdleTimeMS ?? 60_000,
41
42
  ...BSON_DESERIALIZE_DATA_OPTIONS,
42
43
  ...overrides
43
44
  });
@@ -1 +1 @@
1
- {"version":3,"file":"MongoManager.js","sourceRoot":"","sources":["../../src/replication/MongoManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAGvD,OAAO,EAAE,6BAA6B,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAE,YAAY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AAyF;YACzF,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,CAAC;YAEpC,aAAa,EAAE,CAAC;YAChB,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,MAAM;YAE7C,GAAG,6BAA6B;YAEhC,GAAG,SAAS;SACb,CAAC,CAAC;QACH,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,GAAG;QACP,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,3 +1,4 @@
1
+ import type { MongoConnectionParams } from '@powersync/lib-service-mongodb/types';
1
2
  import { LookupFunction } from 'node:net';
2
3
  import * as t from 'ts-codec';
3
4
  export declare enum PostImagesOption {
@@ -42,6 +43,7 @@ export interface NormalizedMongoConnectionConfig {
42
43
  password?: string;
43
44
  lookup?: LookupFunction;
44
45
  postImages: PostImagesOption;
46
+ connectionParams: MongoConnectionParams;
45
47
  }
46
48
  export declare const MongoConnectionConfig: t.Intersection<t.Codec<{
47
49
  type: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,sCAAsC,CAAC;AAClE,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAE1D,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAN,IAAY,gBAkCX;AAlCD,WAAY,gBAAgB;IAC1B;;;;;;;OAOG;IACH,+BAAW,CAAA;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B,CAAA;AACzB,CAAC,EAlCW,gBAAgB,KAAhB,gBAAgB,QAkC3B;AAmBD,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAC,UAAU,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,GAAG,CAC/G,CAAC,CAAC,MAAM,CAAC;IACP,gCAAgC;IAChC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE;CACpG,CAAC,CACH,CAAC;AAaF;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAqC;IAC7E,MAAM,IAAI,GAAG,SAAS,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAErD,OAAO;QACL,GAAG,IAAI;QACP,EAAE,EAAE,OAAO,CAAC,EAAE,IAAI,SAAS;QAC3B,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,SAAS;QAC7B,UAAU,EAAG,OAAO,CAAC,WAA4C,IAAI,gBAAgB,CAAC,GAAG;KAC1F,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@powersync/service-module-mongodb",
3
3
  "repository": "https://github.com/powersync-ja/powersync-service",
4
4
  "types": "dist/index.d.ts",
5
- "version": "0.0.0-dev-20260223082111",
5
+ "version": "0.0.0-dev-20260225093637",
6
6
  "main": "dist/index.js",
7
7
  "license": "FSL-1.1-ALv2",
8
8
  "type": "module",
@@ -25,17 +25,17 @@
25
25
  "bson": "^6.10.4",
26
26
  "ts-codec": "^1.3.0",
27
27
  "uuid": "^11.1.0",
28
- "@powersync/lib-service-mongodb": "0.0.0-dev-20260223082111",
29
- "@powersync/lib-services-framework": "0.0.0-dev-20260223082111",
30
- "@powersync/service-core": "0.0.0-dev-20260223082111",
28
+ "@powersync/lib-service-mongodb": "0.0.0-dev-20260225093637",
29
+ "@powersync/lib-services-framework": "0.0.0-dev-20260225093637",
30
+ "@powersync/service-core": "0.0.0-dev-20260225093637",
31
31
  "@powersync/service-jsonbig": "0.17.12",
32
- "@powersync/service-sync-rules": "0.0.0-dev-20260223082111",
33
- "@powersync/service-types": "0.14.0"
32
+ "@powersync/service-sync-rules": "0.0.0-dev-20260225093637",
33
+ "@powersync/service-types": "0.0.0-dev-20260225093637"
34
34
  },
35
35
  "devDependencies": {
36
- "@powersync/service-core-tests": "0.0.0-dev-20260223082111",
37
- "@powersync/service-module-mongodb-storage": "0.0.0-dev-20260223082111",
38
- "@powersync/service-module-postgres-storage": "0.0.0-dev-20260223082111"
36
+ "@powersync/service-core-tests": "0.0.0-dev-20260225093637",
37
+ "@powersync/service-module-mongodb-storage": "0.0.0-dev-20260225093637",
38
+ "@powersync/service-module-postgres-storage": "0.0.0-dev-20260225093637"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "tsc -b",
@@ -20,6 +20,8 @@ export class MongoManager extends BaseObserver<MongoManagerListener> {
20
20
  overrides?: mongo.MongoClientOptions
21
21
  ) {
22
22
  super();
23
+ const params = options.connectionParams;
24
+
23
25
  // The pool is lazy - no connections are opened until a query is performed.
24
26
  this.client = new mongo.MongoClient(options.uri, {
25
27
  auth: {
@@ -28,12 +30,12 @@ export class MongoManager extends BaseObserver<MongoManagerListener> {
28
30
  },
29
31
 
30
32
  lookup: options.lookup,
31
- // Time for connection to timeout
32
- connectTimeoutMS: 5_000,
33
- // Time for individual requests to timeout
34
- socketTimeoutMS: 60_000,
35
- // How long to wait for new primary selection
36
- serverSelectionTimeoutMS: 30_000,
33
+ // Time for connection to timeout (URL param overrides default)
34
+ connectTimeoutMS: params.connectTimeoutMS ?? 5_000,
35
+ // Time for individual requests to timeout (URL param overrides default)
36
+ socketTimeoutMS: params.socketTimeoutMS ?? 60_000,
37
+ // How long to wait for new primary selection (URL param overrides default)
38
+ serverSelectionTimeoutMS: params.serverSelectionTimeoutMS ?? 30_000,
37
39
 
38
40
  // Identify the client
39
41
  appName: `powersync ${POWERSYNC_VERSION}`,
@@ -47,10 +49,10 @@ export class MongoManager extends BaseObserver<MongoManagerListener> {
47
49
  // Avoid too many connections:
48
50
  // 1. It can overwhelm the source database.
49
51
  // 2. Processing too many queries in parallel can cause the process to run out of memory.
50
- maxPoolSize: 8,
52
+ maxPoolSize: params.maxPoolSize ?? 8,
51
53
 
52
54
  maxConnecting: 3,
53
- maxIdleTimeMS: 60_000,
55
+ maxIdleTimeMS: params.maxIdleTimeMS ?? 60_000,
54
56
 
55
57
  ...BSON_DESERIALIZE_DATA_OPTIONS,
56
58
 
@@ -1,4 +1,5 @@
1
1
  import * as lib_mongo from '@powersync/lib-service-mongodb/types';
2
+ import type { MongoConnectionParams } from '@powersync/lib-service-mongodb/types';
2
3
  import * as service_types from '@powersync/service-types';
3
4
  import { LookupFunction } from 'node:net';
4
5
  import * as t from 'ts-codec';
@@ -52,6 +53,8 @@ export interface NormalizedMongoConnectionConfig {
52
53
  lookup?: LookupFunction;
53
54
 
54
55
  postImages: PostImagesOption;
56
+
57
+ connectionParams: MongoConnectionParams;
55
58
  }
56
59
 
57
60
  export const MongoConnectionConfig = service_types.configFile.DataSourceConfig.and(lib_mongo.BaseMongoConfig).and(