@mongosh/service-provider-core 1.1.7 → 1.2.1
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/lib/index.d.ts +1 -2
- package/lib/index.js +1 -3
- package/lib/index.js.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +1 -3
- package/lib/fast-failure-connect.d.ts +0 -1
- package/lib/fast-failure-connect.js +0 -15
- package/lib/fast-failure-connect.js.map +0 -1
- package/src/fast-failure-connect.spec.ts +0 -37
- package/src/fast-failure-connect.ts +0 -13
package/lib/index.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ import { bsonStringifiers } from './printable-bson';
|
|
|
10
10
|
import ShellAuthOptions from './shell-auth-options';
|
|
11
11
|
export * from './all-transport-types';
|
|
12
12
|
export * from './all-fle-types';
|
|
13
|
-
import { isFastFailureConnectionError } from './fast-failure-connect';
|
|
14
13
|
declare const bson: {
|
|
15
14
|
ObjectId: typeof ObjectId;
|
|
16
15
|
DBRef: typeof DBRef;
|
|
@@ -29,4 +28,4 @@ declare const bson: {
|
|
|
29
28
|
EJSON: typeof EJSON;
|
|
30
29
|
BSONRegExp: typeof BSONRegExp;
|
|
31
30
|
};
|
|
32
|
-
export { ServiceProvider, ShellAuthOptions, getConnectInfo, ReplPlatform, CliOptions, generateUri, DEFAULT_DB, ServiceProviderCore, bson, bsonStringifiers, ConnectInfo
|
|
31
|
+
export { ServiceProvider, ShellAuthOptions, getConnectInfo, ReplPlatform, CliOptions, generateUri, DEFAULT_DB, ServiceProviderCore, bson, bsonStringifiers, ConnectInfo };
|
package/lib/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.
|
|
16
|
+
exports.bsonStringifiers = exports.bson = exports.ServiceProviderCore = exports.DEFAULT_DB = exports.generateUri = exports.ReplPlatform = exports.getConnectInfo = void 0;
|
|
17
17
|
require("./textencoder-polyfill");
|
|
18
18
|
const service_provider_1 = require("./service-provider");
|
|
19
19
|
Object.defineProperty(exports, "ServiceProviderCore", { enumerable: true, get: function () { return service_provider_1.ServiceProviderCore; } });
|
|
@@ -30,8 +30,6 @@ const printable_bson_1 = require("./printable-bson");
|
|
|
30
30
|
Object.defineProperty(exports, "bsonStringifiers", { enumerable: true, get: function () { return printable_bson_1.bsonStringifiers; } });
|
|
31
31
|
__exportStar(require("./all-transport-types"), exports);
|
|
32
32
|
__exportStar(require("./all-fle-types"), exports);
|
|
33
|
-
const fast_failure_connect_1 = require("./fast-failure-connect");
|
|
34
|
-
Object.defineProperty(exports, "isFastFailureConnectionError", { enumerable: true, get: function () { return fast_failure_connect_1.isFastFailureConnectionError; } });
|
|
35
33
|
const bson = {
|
|
36
34
|
ObjectId: bson_1.ObjectId,
|
|
37
35
|
DBRef: bson_1.DBRef,
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA0E;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA0E;AAwDxE,oGAxDwB,sCAAmB,OAwDxB;AAvDrB,kEAA6D;AAkD3D,yBAlDK,sBAAc,CAkDL;AAjDhB,yCAA0C;AAkDxC,6FAlDO,uBAAY,OAkDP;AAhDd,oEAA0C;AAkDxC,sBAlDK,uBAAW,CAkDL;AAjDb,MAAM,UAAU,GAAG,MAAM,CAAC;AAkDxB,gCAAU;AAjDZ,+BAiBc;AACd,qDAAoD;AAkClD,iGAlCO,iCAAgB,OAkCP;AAhClB,wDAAsC;AACtC,kDAAgC;AAEhC,MAAM,IAAI,GAAG;IACX,QAAQ,EAAR,eAAQ;IACR,KAAK,EAAL,YAAK;IACL,MAAM,EAAN,aAAM;IACN,MAAM,EAAN,aAAM;IACN,SAAS,EAAT,gBAAS;IACT,UAAU,EAAV,iBAAU;IACV,IAAI,EAAJ,WAAI;IACJ,UAAU,EAAV,iBAAU;IACV,KAAK,EAAL,YAAK;IACL,IAAI,EAAJ,WAAI;IACJ,MAAM,EAAN,aAAM;IACN,GAAG,EAAH,UAAG;IACH,mBAAmB,EAAnB,0BAAmB;IACnB,MAAM,EAAN,aAAM;IACN,KAAK,EAAL,YAAK;IACL,UAAU,EAAV,iBAAU;CACX,CAAC;AAWA,oBAAI"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongosh/service-provider-core",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "MongoDB Shell Core Service Provider Package",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"unitTestsOnly": true
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@mongosh/errors": "1.1
|
|
34
|
-
"@mongosh/i18n": "1.1
|
|
35
|
-
"bson": "^4.6.
|
|
36
|
-
"mongodb": "^4.
|
|
33
|
+
"@mongosh/errors": "1.2.1",
|
|
34
|
+
"@mongosh/i18n": "1.2.1",
|
|
35
|
+
"bson": "^4.6.1",
|
|
36
|
+
"mongodb": "^4.4.0",
|
|
37
37
|
"mongodb-build-info": "^1.2.0",
|
|
38
38
|
"mongodb-connection-string-url": "^2.3.2"
|
|
39
39
|
},
|
|
40
40
|
"optionalDependencies": {
|
|
41
|
-
"mongodb-client-encryption": "^2.0.0
|
|
41
|
+
"mongodb-client-encryption": "^2.0.0"
|
|
42
42
|
},
|
|
43
43
|
"dependency-check": {
|
|
44
44
|
"entries": [
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"encoding"
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "62b1dff4ce48f4dd3706d4fd9ccd4582df403ee3"
|
|
55
55
|
}
|
package/src/index.ts
CHANGED
|
@@ -27,7 +27,6 @@ import { bsonStringifiers } from './printable-bson';
|
|
|
27
27
|
import ShellAuthOptions from './shell-auth-options';
|
|
28
28
|
export * from './all-transport-types';
|
|
29
29
|
export * from './all-fle-types';
|
|
30
|
-
import { isFastFailureConnectionError } from './fast-failure-connect';
|
|
31
30
|
|
|
32
31
|
const bson = {
|
|
33
32
|
ObjectId,
|
|
@@ -59,6 +58,5 @@ export {
|
|
|
59
58
|
ServiceProviderCore,
|
|
60
59
|
bson,
|
|
61
60
|
bsonStringifiers,
|
|
62
|
-
ConnectInfo
|
|
63
|
-
isFastFailureConnectionError
|
|
61
|
+
ConnectInfo
|
|
64
62
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isFastFailureConnectionError(error: Error): boolean;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isFastFailureConnectionError = void 0;
|
|
4
|
-
function isFastFailureConnectionError(error) {
|
|
5
|
-
switch (error.name) {
|
|
6
|
-
case 'MongoNetworkError':
|
|
7
|
-
return /\b(ECONNREFUSED|ENOTFOUND|ENETUNREACH)\b/.test(error.message);
|
|
8
|
-
case 'MongoError':
|
|
9
|
-
return /The apiVersion parameter is required/.test(error.message);
|
|
10
|
-
default:
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.isFastFailureConnectionError = isFastFailureConnectionError;
|
|
15
|
-
//# sourceMappingURL=fast-failure-connect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fast-failure-connect.js","sourceRoot":"","sources":["../src/fast-failure-connect.ts"],"names":[],"mappings":";;;AAGA,SAAgB,4BAA4B,CAAC,KAAY;IACvD,QAAQ,KAAK,CAAC,IAAI,EAAE;QAClB,KAAK,mBAAmB;YACtB,OAAO,0CAA0C,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxE,KAAK,YAAY;YACf,OAAO,sCAAsC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACpE;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC;AATD,oEASC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { isFastFailureConnectionError } from './index';
|
|
3
|
-
|
|
4
|
-
class MongoNetworkError extends Error {
|
|
5
|
-
constructor(msg: string) {
|
|
6
|
-
super(msg);
|
|
7
|
-
this.name = this.constructor.name;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
class MongoError extends Error {
|
|
11
|
-
constructor(msg: string) {
|
|
12
|
-
super(msg);
|
|
13
|
-
this.name = this.constructor.name;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
describe('isFastFailureConnectionError', function() {
|
|
18
|
-
it('returns true for ECONNREFUSED', function() {
|
|
19
|
-
expect(isFastFailureConnectionError(new MongoNetworkError('ECONNREFUSED'))).to.equal(true);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('returns true for ENOTFOUND', function() {
|
|
23
|
-
expect(isFastFailureConnectionError(new MongoNetworkError('ENOTFOUND'))).to.equal(true);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('returns true for ENETUNREACH', function() {
|
|
27
|
-
expect(isFastFailureConnectionError(new MongoNetworkError('ENETUNREACH'))).to.equal(true);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('returns true when an API version is reuqired', function() {
|
|
31
|
-
expect(isFastFailureConnectionError(new MongoError('The apiVersion parameter is required'))).to.equal(true);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('returns false for generic errors', function() {
|
|
35
|
-
expect(isFastFailureConnectionError(new Error('could not connect'))).to.equal(false);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// It probably makes sense to put this into its own package/repository once
|
|
2
|
-
// other tools start using it.
|
|
3
|
-
|
|
4
|
-
export function isFastFailureConnectionError(error: Error) {
|
|
5
|
-
switch (error.name) {
|
|
6
|
-
case 'MongoNetworkError':
|
|
7
|
-
return /\b(ECONNREFUSED|ENOTFOUND|ENETUNREACH)\b/.test(error.message);
|
|
8
|
-
case 'MongoError':
|
|
9
|
-
return /The apiVersion parameter is required/.test(error.message);
|
|
10
|
-
default:
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
}
|