@qp-mongosh/service-provider-core 0.0.0-dev.0
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/.eslintignore +2 -0
- package/.eslintrc.js +1 -0
- package/AUTHORS +11 -0
- package/LICENSE +201 -0
- package/lib/admin.d.ts +28 -0
- package/lib/admin.js +3 -0
- package/lib/admin.js.map +1 -0
- package/lib/all-fle-types.d.ts +2 -0
- package/lib/all-fle-types.js +3 -0
- package/lib/all-fle-types.js.map +1 -0
- package/lib/all-transport-types.d.ts +1 -0
- package/lib/all-transport-types.js +3 -0
- package/lib/all-transport-types.js.map +1 -0
- package/lib/cli-options.d.ts +43 -0
- package/lib/cli-options.js +3 -0
- package/lib/cli-options.js.map +1 -0
- package/lib/closable.d.ts +4 -0
- package/lib/closable.js +3 -0
- package/lib/closable.js.map +1 -0
- package/lib/connect-info.d.ts +19 -0
- package/lib/connect-info.js +35 -0
- package/lib/connect-info.js.map +1 -0
- package/lib/index.d.ts +31 -0
- package/lib/index.js +56 -0
- package/lib/index.js.map +1 -0
- package/lib/platform.d.ts +6 -0
- package/lib/platform.js +11 -0
- package/lib/platform.js.map +1 -0
- package/lib/printable-bson.d.ts +3 -0
- package/lib/printable-bson.js +82 -0
- package/lib/printable-bson.js.map +1 -0
- package/lib/readable.d.ts +18 -0
- package/lib/readable.js +3 -0
- package/lib/readable.js.map +1 -0
- package/lib/service-provider.d.ts +11 -0
- package/lib/service-provider.js +19 -0
- package/lib/service-provider.js.map +1 -0
- package/lib/shell-auth-options.d.ts +7 -0
- package/lib/shell-auth-options.js +3 -0
- package/lib/shell-auth-options.js.map +1 -0
- package/lib/textencoder-polyfill.d.ts +2 -0
- package/lib/textencoder-polyfill.js +22 -0
- package/lib/textencoder-polyfill.js.map +1 -0
- package/lib/uri-generator.d.ts +8 -0
- package/lib/uri-generator.js +176 -0
- package/lib/uri-generator.js.map +1 -0
- package/lib/writable.d.ts +22 -0
- package/lib/writable.js +3 -0
- package/lib/writable.js.map +1 -0
- package/package.json +54 -0
- package/src/admin.ts +119 -0
- package/src/all-fle-types.ts +17 -0
- package/src/all-transport-types.ts +80 -0
- package/src/cli-options.ts +49 -0
- package/src/closable.ts +14 -0
- package/src/connect-info.spec.ts +192 -0
- package/src/connect-info.ts +57 -0
- package/src/index.ts +62 -0
- package/src/platform.ts +6 -0
- package/src/printable-bson.spec.ts +75 -0
- package/src/printable-bson.ts +103 -0
- package/src/readable.ts +242 -0
- package/src/service-provider.ts +23 -0
- package/src/shell-auth-options.ts +7 -0
- package/src/textencoder-polyfill.spec.ts +11 -0
- package/src/textencoder-polyfill.ts +30 -0
- package/src/uri-generator.spec.ts +481 -0
- package/src/uri-generator.ts +265 -0
- package/src/writable.ts +367 -0
- package/tsconfig.json +12 -0
- package/tsconfig.lint.json +8 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Document, AggregateOptions, CountOptions, CountDocumentsOptions, DistinctOptions, EstimatedDocumentCountOptions, FindOptions, ListCollectionsOptions, CollStatsOptions, ListIndexesOptions, AggregationCursor, FindCursor, DbOptions, ReadPreferenceFromOptions, ReadPreferenceLike } from './all-transport-types';
|
|
2
|
+
import { ChangeStream, ChangeStreamOptions } from './all-transport-types';
|
|
3
|
+
export default interface Readable {
|
|
4
|
+
aggregate(database: string, collection: string, pipeline: Document[], options?: AggregateOptions, dbOptions?: DbOptions): AggregationCursor;
|
|
5
|
+
aggregateDb(database: string, pipeline: Document[], options?: AggregateOptions, dbOptions?: DbOptions): AggregationCursor;
|
|
6
|
+
count(db: string, coll: string, query?: Document, options?: CountOptions, dbOptions?: DbOptions): Promise<number>;
|
|
7
|
+
countDocuments(database: string, collection: string, filter?: Document, options?: CountDocumentsOptions, dbOptions?: DbOptions): Promise<number>;
|
|
8
|
+
distinct(database: string, collection: string, fieldName: string, filter?: Document, options?: DistinctOptions, dbOptions?: DbOptions): Promise<Document>;
|
|
9
|
+
estimatedDocumentCount(database: string, collection: string, options?: EstimatedDocumentCountOptions, dbOptions?: DbOptions): Promise<number>;
|
|
10
|
+
find(database: string, collection: string, filter?: Document, options?: FindOptions, dbOptions?: DbOptions): FindCursor;
|
|
11
|
+
getTopology(): any;
|
|
12
|
+
isCapped(database: string, collection: string, dbOptions?: DbOptions): Promise<boolean>;
|
|
13
|
+
getIndexes(database: string, collection: string, options: ListIndexesOptions, dbOptions?: DbOptions): Promise<Document[]>;
|
|
14
|
+
listCollections(database: string, filter?: Document, options?: ListCollectionsOptions, dbOptions?: DbOptions): Promise<Document[]>;
|
|
15
|
+
readPreferenceFromOptions(options?: Omit<ReadPreferenceFromOptions, 'session'>): ReadPreferenceLike | undefined;
|
|
16
|
+
stats(database: string, collection: string, options?: CollStatsOptions, dbOptions?: DbOptions): Promise<Document>;
|
|
17
|
+
watch(pipeline: Document[], options: ChangeStreamOptions, dbOptions?: DbOptions, db?: string, coll?: string): ChangeStream<Document>;
|
|
18
|
+
}
|
package/lib/readable.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readable.js","sourceRoot":"","sources":["../src/readable.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Admin from './admin';
|
|
2
|
+
import Closable from './closable';
|
|
3
|
+
import Readable from './readable';
|
|
4
|
+
import Writable from './writable';
|
|
5
|
+
import type { bson as BSON } from './index';
|
|
6
|
+
export default interface ServiceProvider extends Readable, Writable, Closable, Admin {
|
|
7
|
+
}
|
|
8
|
+
export declare class ServiceProviderCore {
|
|
9
|
+
bsonLibrary: typeof BSON;
|
|
10
|
+
constructor(bsonLibrary?: typeof BSON);
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ServiceProviderCore = void 0;
|
|
7
|
+
const errors_1 = require("@qp-mongosh/errors");
|
|
8
|
+
const printable_bson_1 = __importDefault(require("./printable-bson"));
|
|
9
|
+
class ServiceProviderCore {
|
|
10
|
+
constructor(bsonLibrary) {
|
|
11
|
+
if (bsonLibrary === undefined) {
|
|
12
|
+
throw new errors_1.MongoshInternalError('BSON Library is undefined.');
|
|
13
|
+
}
|
|
14
|
+
(0, printable_bson_1.default)(bsonLibrary);
|
|
15
|
+
this.bsonLibrary = bsonLibrary;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.ServiceProviderCore = ServiceProviderCore;
|
|
19
|
+
//# sourceMappingURL=service-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-provider.js","sourceRoot":"","sources":["../src/service-provider.ts"],"names":[],"mappings":";;;;;;AAAA,+CAA0D;AAG1D,sEAAiD;AAUjD,MAAa,mBAAmB;IAE9B,YAAY,WAAyB;QACnC,IAAI,WAAW,KAAK,SAAS,EAAE;YAC7B,MAAM,IAAI,6BAAoB,CAAC,4BAA4B,CAAC,CAAC;SAC9D;QACD,IAAA,wBAAiB,EAAC,WAAW,CAAC,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AATD,kDASC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-auth-options.js","sourceRoot":"","sources":["../src/shell-auth-options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.textEncodingPolyfill = void 0;
|
|
4
|
+
if (typeof TextDecoder !== 'function' || typeof TextEncoder !== 'function') {
|
|
5
|
+
Object.assign(Function('return this')(), textEncodingPolyfill());
|
|
6
|
+
}
|
|
7
|
+
function textEncodingPolyfill() {
|
|
8
|
+
class TextEncoder {
|
|
9
|
+
encode(string) {
|
|
10
|
+
return Buffer.from(string, 'utf8');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
class TextDecoder {
|
|
14
|
+
decode(bytes) {
|
|
15
|
+
const str = Buffer.from(bytes).toString('utf8');
|
|
16
|
+
return str.slice(+str.startsWith('\ufeff'));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return { TextDecoder, TextEncoder };
|
|
20
|
+
}
|
|
21
|
+
exports.textEncodingPolyfill = textEncodingPolyfill;
|
|
22
|
+
//# sourceMappingURL=textencoder-polyfill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textencoder-polyfill.js","sourceRoot":"","sources":["../src/textencoder-polyfill.ts"],"names":[],"mappings":";;;AAIA,IAGE,OAAO,WAAW,KAAK,UAAU,IAAI,OAAO,WAAW,KAAK,UAAU,EACtE;IAEA,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,EAAE,oBAAoB,EAAE,CAAC,CAAC;CAClE;AAGD,SAAS,oBAAoB;IAC3B,MAAM,WAAW;QACf,MAAM,CAAC,MAAc;YACnB,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACrC,CAAC;KACF;IACD,MAAM,WAAW;QACf,MAAM,CAAC,KAAiB;YACtB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAChD,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9C,CAAC;KACF;IACD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AACtC,CAAC;AAEQ,oDAAoB"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Scheme = void 0;
|
|
30
|
+
const errors_1 = require("@qp-mongosh/errors");
|
|
31
|
+
const i18n_1 = __importDefault(require("@qp-mongosh/i18n"));
|
|
32
|
+
const mongodb_connection_string_url_1 = __importStar(require("mongodb-connection-string-url"));
|
|
33
|
+
const index_1 = require("./index");
|
|
34
|
+
var Scheme;
|
|
35
|
+
(function (Scheme) {
|
|
36
|
+
Scheme["Mongo"] = "mongodb://";
|
|
37
|
+
Scheme["MongoSrv"] = "mongodb+srv://";
|
|
38
|
+
})(Scheme || (Scheme = {}));
|
|
39
|
+
exports.Scheme = Scheme;
|
|
40
|
+
const DEFAULT_HOST = '127.0.0.1';
|
|
41
|
+
const DEFAULT_PORT = '27017';
|
|
42
|
+
const CONFLICT = 'cli-repl.uri-generator.no-host-port';
|
|
43
|
+
const INVALID_HOST = 'cli-repl.uri-generator.invalid-host';
|
|
44
|
+
const HOST_LIST_PORT_MISMATCH = 'cli-repl.uri-generator.host-list-port-mismatch';
|
|
45
|
+
const DIVERGING_SERVICE_NAME = 'cli-repl.uri-generator.diverging-service-name';
|
|
46
|
+
const GSSAPI_SERVICE_NAME_UNSUPPORTED = 'cli-repl.uri-generator.gssapi-service-name-unsupported';
|
|
47
|
+
function validateConflicts(options, connectionString) {
|
|
48
|
+
if (options.host || options.port) {
|
|
49
|
+
throw new errors_1.MongoshInvalidInputError(i18n_1.default.__(CONFLICT), errors_1.CommonErrors.InvalidArgument);
|
|
50
|
+
}
|
|
51
|
+
if (options.gssapiServiceName && (connectionString === null || connectionString === void 0 ? void 0 : connectionString.searchParams.has('authMechanismProperties'))) {
|
|
52
|
+
const authProperties = new mongodb_connection_string_url_1.CommaAndColonSeparatedRecord(connectionString.searchParams.get('authMechanismProperties'));
|
|
53
|
+
const serviceName = authProperties.get('SERVICE_NAME');
|
|
54
|
+
if (serviceName !== undefined && options.gssapiServiceName !== serviceName) {
|
|
55
|
+
throw new errors_1.MongoshInvalidInputError(i18n_1.default.__(DIVERGING_SERVICE_NAME), errors_1.CommonErrors.InvalidArgument);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (connectionString === null || connectionString === void 0 ? void 0 : connectionString.searchParams.has('gssapiServiceName')) {
|
|
59
|
+
throw new errors_1.MongoshInvalidInputError(i18n_1.default.__(GSSAPI_SERVICE_NAME_UNSUPPORTED), errors_1.CommonErrors.InvalidArgument);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function validateHost(host) {
|
|
63
|
+
const invalidCharacter = host.match(/[^a-zA-Z0-9.:\[\]_-]/);
|
|
64
|
+
if (invalidCharacter) {
|
|
65
|
+
throw new errors_1.MongoshInvalidInputError(i18n_1.default.__(INVALID_HOST) + ': ' + invalidCharacter[0], errors_1.CommonErrors.InvalidArgument);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function validateHostSeedList(hosts, fixedPort) {
|
|
69
|
+
const trimmedHosts = hosts.split(',').map(h => h.trim()).filter(h => !!h);
|
|
70
|
+
const hostList = [];
|
|
71
|
+
trimmedHosts.forEach(h => {
|
|
72
|
+
const [host, port] = h.split(':');
|
|
73
|
+
if (fixedPort && port !== undefined && port !== fixedPort) {
|
|
74
|
+
throw new errors_1.MongoshInvalidInputError(i18n_1.default.__(HOST_LIST_PORT_MISMATCH), errors_1.CommonErrors.InvalidArgument);
|
|
75
|
+
}
|
|
76
|
+
hostList.push(`${host}${(port || fixedPort) ? ':' + (port || fixedPort) : ''}`);
|
|
77
|
+
});
|
|
78
|
+
return hostList;
|
|
79
|
+
}
|
|
80
|
+
function generateHost(options) {
|
|
81
|
+
if (options.host) {
|
|
82
|
+
validateHost(options.host);
|
|
83
|
+
if (options.host.includes(':')) {
|
|
84
|
+
return options.host.split(':')[0];
|
|
85
|
+
}
|
|
86
|
+
return options.host;
|
|
87
|
+
}
|
|
88
|
+
return DEFAULT_HOST;
|
|
89
|
+
}
|
|
90
|
+
function generatePort(options) {
|
|
91
|
+
if (options.host && options.host.includes(':')) {
|
|
92
|
+
validateHost(options.host);
|
|
93
|
+
const port = options.host.split(':')[1];
|
|
94
|
+
if (!options.port || options.port === port) {
|
|
95
|
+
return port;
|
|
96
|
+
}
|
|
97
|
+
throw new errors_1.MongoshInvalidInputError(i18n_1.default.__(CONFLICT), errors_1.CommonErrors.InvalidArgument);
|
|
98
|
+
}
|
|
99
|
+
return options.port ? options.port : DEFAULT_PORT;
|
|
100
|
+
}
|
|
101
|
+
function generateUri(options) {
|
|
102
|
+
if (options.nodb) {
|
|
103
|
+
return '';
|
|
104
|
+
}
|
|
105
|
+
const connectionString = generateUriNormalized(options);
|
|
106
|
+
if (connectionString.hosts.every(host => ['localhost', '127.0.0.1'].includes(host.split(':')[0]))) {
|
|
107
|
+
const params = connectionString.searchParams;
|
|
108
|
+
if (!params.has('serverSelectionTimeoutMS')) {
|
|
109
|
+
params.set('serverSelectionTimeoutMS', '2000');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return connectionString.toString();
|
|
113
|
+
}
|
|
114
|
+
function generateUriNormalized(options) {
|
|
115
|
+
var _a, _b, _c;
|
|
116
|
+
const uri = options.connectionSpecifier;
|
|
117
|
+
const replSetHostMatch = ((_a = options.host) !== null && _a !== void 0 ? _a : '').match(/^(?<replSetName>[^/]+)\/(?<hosts>([A-Za-z0-9._-]+(:\d+)?,?)+)$/);
|
|
118
|
+
if (replSetHostMatch) {
|
|
119
|
+
const { replSetName, hosts } = replSetHostMatch.groups;
|
|
120
|
+
const connectionString = new mongodb_connection_string_url_1.default(`${Scheme.Mongo}replacemeHost/${encodeURIComponent(uri || '')}`);
|
|
121
|
+
connectionString.hosts = validateHostSeedList(hosts, options.port);
|
|
122
|
+
connectionString.searchParams.set('replicaSet', replSetName);
|
|
123
|
+
return addShellConnectionStringParameters(connectionString);
|
|
124
|
+
}
|
|
125
|
+
const seedList = ((_b = options.host) !== null && _b !== void 0 ? _b : '').match(/^(?<hosts>([A-Za-z0-9._-]+(:\d+)?,?)+)$/);
|
|
126
|
+
if (seedList && ((_c = options.host) === null || _c === void 0 ? void 0 : _c.includes(','))) {
|
|
127
|
+
const { hosts } = seedList.groups;
|
|
128
|
+
const connectionString = new mongodb_connection_string_url_1.default(`${Scheme.Mongo}replacemeHost/${encodeURIComponent(uri || '')}`);
|
|
129
|
+
connectionString.hosts = validateHostSeedList(hosts, options.port);
|
|
130
|
+
return addShellConnectionStringParameters(connectionString);
|
|
131
|
+
}
|
|
132
|
+
if (!uri) {
|
|
133
|
+
return new mongodb_connection_string_url_1.default(`${Scheme.Mongo}${generateHost(options)}:${generatePort(options)}/?directConnection=true`);
|
|
134
|
+
}
|
|
135
|
+
if (uri.startsWith(Scheme.MongoSrv)) {
|
|
136
|
+
const connectionString = new mongodb_connection_string_url_1.default(uri);
|
|
137
|
+
validateConflicts(options, connectionString);
|
|
138
|
+
return connectionString;
|
|
139
|
+
}
|
|
140
|
+
else if (uri.startsWith(Scheme.Mongo)) {
|
|
141
|
+
const connectionString = new mongodb_connection_string_url_1.default(uri);
|
|
142
|
+
validateConflicts(options, connectionString);
|
|
143
|
+
return addShellConnectionStringParameters(connectionString);
|
|
144
|
+
}
|
|
145
|
+
const uriMatch = /^([A-Za-z0-9][A-Za-z0-9._-]+):?(\d+)?(?:\/(\S*))?$/gi;
|
|
146
|
+
let parts = uriMatch.exec(uri);
|
|
147
|
+
if (parts === null) {
|
|
148
|
+
if (/[/\\. "$]/.test(uri)) {
|
|
149
|
+
throw new errors_1.MongoshInvalidInputError(`Invalid URI: ${uri}`, errors_1.CommonErrors.InvalidArgument);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
parts = [uri, uri];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
let host = parts === null || parts === void 0 ? void 0 : parts[1];
|
|
156
|
+
const port = parts === null || parts === void 0 ? void 0 : parts[2];
|
|
157
|
+
let dbAndQueryString = parts === null || parts === void 0 ? void 0 : parts[3];
|
|
158
|
+
if (!port && !dbAndQueryString && host.indexOf('.') < 0) {
|
|
159
|
+
dbAndQueryString = host;
|
|
160
|
+
host = undefined;
|
|
161
|
+
}
|
|
162
|
+
if (host || port) {
|
|
163
|
+
validateConflicts(options);
|
|
164
|
+
}
|
|
165
|
+
return addShellConnectionStringParameters(new mongodb_connection_string_url_1.default(`${Scheme.Mongo}${host || generateHost(options)}:${port || generatePort(options)}/${encodeURIComponent(dbAndQueryString || index_1.DEFAULT_DB)}`));
|
|
166
|
+
}
|
|
167
|
+
function addShellConnectionStringParameters(uri) {
|
|
168
|
+
uri = uri.clone();
|
|
169
|
+
const params = uri.searchParams;
|
|
170
|
+
if (!params.has('replicaSet') && !params.has('directConnection') && !params.has('loadBalanced') && uri.hosts.length === 1) {
|
|
171
|
+
params.set('directConnection', 'true');
|
|
172
|
+
}
|
|
173
|
+
return uri;
|
|
174
|
+
}
|
|
175
|
+
exports.default = generateUri;
|
|
176
|
+
//# sourceMappingURL=uri-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uri-generator.js","sourceRoot":"","sources":["../src/uri-generator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,+CAA4E;AAC5E,4DAAoC;AAEpC,+FAA+F;AAC/F,mCAAqC;AAKrC,IAAK,MAGJ;AAHD,WAAK,MAAM;IACT,8BAAoB,CAAA;IACpB,qCAA2B,CAAA;AAC7B,CAAC,EAHI,MAAM,KAAN,MAAM,QAGV;AA0PQ,wBAAM;AArPf,MAAM,YAAY,GAAG,WAAW,CAAC;AAKjC,MAAM,YAAY,GAAG,OAAO,CAAC;AAK7B,MAAM,QAAQ,GAAG,qCAAqC,CAAC;AAKvD,MAAM,YAAY,GAAG,qCAAqC,CAAC;AAK3D,MAAM,uBAAuB,GAAG,gDAAgD,CAAC;AAKjF,MAAM,sBAAsB,GAAG,+CAA+C,CAAC;AAK/E,MAAM,+BAA+B,GAAG,wDAAwD,CAAC;AAKjG,SAAS,iBAAiB,CAAC,OAAmB,EAAE,gBAAmC;IACjF,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE;QAChC,MAAM,IAAI,iCAAwB,CAAC,cAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,qBAAY,CAAC,eAAe,CAAC,CAAC;KACrF;IAED,IAAI,OAAO,CAAC,iBAAiB,KAAI,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,YAAY,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA,EAAE;QAC9F,MAAM,cAAc,GAAG,IAAI,4DAA4B,CACrD,gBAAgB,C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C,CAAC;AAC/I,CAAC;AAMD,SAAS,kCAAkC,CAAC,GAAqB;IAC/D,GAAG,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC;IAClB,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACzH,MAAM,CAAC,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;KACxC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Document, InsertOneOptions, InsertOneResult, Collection, RenameOptions, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, BulkWriteOptions, AnyBulkWriteOperation, DeleteOptions, DeleteResult, InsertManyResult, ReplaceOptions, UpdateResult, UpdateOptions, DropDatabaseOptions, CreateIndexesOptions, DropCollectionOptions, BulkWriteResult, RunCommandOptions, DbOptions, OrderedBulkOperation, UnorderedBulkOperation } from './all-transport-types';
|
|
2
|
+
export default interface Writable {
|
|
3
|
+
runCommand(db: string, spec: Document, options: RunCommandOptions, dbOptions?: DbOptions): Promise<Document>;
|
|
4
|
+
runCommandWithCheck(db: string, spec: Document, options: RunCommandOptions, dbOptions?: DbOptions): Promise<Document>;
|
|
5
|
+
dropDatabase(database: string, options: DropDatabaseOptions, dbOptions?: DbOptions): Promise<Document>;
|
|
6
|
+
bulkWrite(database: string, collection: string, requests: AnyBulkWriteOperation[], options: BulkWriteOptions, dbOptions?: DbOptions): Promise<BulkWriteResult>;
|
|
7
|
+
deleteMany(database: string, collection: string, filter: Document, options: DeleteOptions, dbOptions?: DbOptions): Promise<DeleteResult>;
|
|
8
|
+
deleteOne(database: string, collection: string, filter: Document, options: DeleteOptions, dbOptions?: DbOptions): Promise<DeleteResult>;
|
|
9
|
+
findOneAndDelete(database: string, collection: string, filter: Document, options: FindOneAndDeleteOptions, dbOptions?: DbOptions): Promise<Document>;
|
|
10
|
+
findOneAndReplace(database: string, collection: string, filter: Document, replacement: Document, options: FindOneAndReplaceOptions, dbOptions?: DbOptions): Promise<Document>;
|
|
11
|
+
findOneAndUpdate(database: string, collection: string, filter: Document, update: Document | Document[], options: FindOneAndUpdateOptions, dbOptions?: DbOptions): Promise<Document>;
|
|
12
|
+
insertMany(database: string, collection: string, docs: Document[], options: BulkWriteOptions, dbOptions?: DbOptions): Promise<InsertManyResult>;
|
|
13
|
+
insertOne(database: string, collection: string, doc: Document, options: InsertOneOptions, dbOptions?: DbOptions): Promise<InsertOneResult>;
|
|
14
|
+
replaceOne(database: string, collection: string, filter: Document, replacement: Document, options?: ReplaceOptions, dbOptions?: DbOptions): Promise<UpdateResult>;
|
|
15
|
+
updateMany(database: string, collection: string, filter: Document, update: Document, options?: UpdateOptions, dbOptions?: DbOptions): Promise<UpdateResult>;
|
|
16
|
+
updateOne(database: string, collection: string, filter: Document, update: Document, options?: UpdateOptions, dbOptions?: DbOptions): Promise<UpdateResult>;
|
|
17
|
+
remove(database: string, collection: string, query: Document, options?: DeleteOptions, dbOptions?: DbOptions): Promise<DeleteResult>;
|
|
18
|
+
createIndexes(database: string, collection: string, indexSpecs: Document[], options?: CreateIndexesOptions, dbOptions?: DbOptions): Promise<string[]>;
|
|
19
|
+
dropCollection(database: string, collection: string, options: DropCollectionOptions, dbOptions?: DbOptions): Promise<boolean>;
|
|
20
|
+
renameCollection(database: string, oldName: string, newName: string, options?: RenameOptions, dbOptions?: DbOptions): Promise<Collection>;
|
|
21
|
+
initializeBulkOp(dbName: string, collName: string, ordered: boolean, options?: BulkWriteOptions, dbOptions?: DbOptions): Promise<OrderedBulkOperation | UnorderedBulkOperation>;
|
|
22
|
+
}
|
package/lib/writable.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writable.js","sourceRoot":"","sources":["../src/writable.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@qp-mongosh/service-provider-core",
|
|
3
|
+
"version": "0.0.0-dev.0",
|
|
4
|
+
"description": "MongoDB Shell Core Service Provider Package",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"config": {
|
|
8
|
+
"unsafe-perm": true
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git://github.com/mongodb-js/mongosh.git"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"compile-ts": "tsc -p tsconfig.json",
|
|
16
|
+
"prepublish": "npm run compile-ts",
|
|
17
|
+
"test": "mocha -r \"../../scripts/import-expansions.js\" --timeout 60000 -r ts-node/register \"./src/**/*.spec.ts\"",
|
|
18
|
+
"test-ci": "node ../../scripts/run-if-package-requested.js npm test",
|
|
19
|
+
"lint": "eslint --report-unused-disable-directives \"./{src,test}/**/*.{js,ts,tsx}\"",
|
|
20
|
+
"check": "npm run lint && depcheck --skip-missing=true"
|
|
21
|
+
},
|
|
22
|
+
"license": "Apache-2.0",
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=12.4.0"
|
|
28
|
+
},
|
|
29
|
+
"mongosh": {
|
|
30
|
+
"unitTestsOnly": true
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@qp-mongosh/errors": "0.0.0-dev.0",
|
|
34
|
+
"@qp-mongosh/i18n": "0.0.0-dev.0",
|
|
35
|
+
"bson": "^4.6.1",
|
|
36
|
+
"qp-mongodb": "0.0.0-dev.1",
|
|
37
|
+
"mongodb-build-info": "^1.2.0",
|
|
38
|
+
"mongodb-connection-string-url": "^2.3.2"
|
|
39
|
+
},
|
|
40
|
+
"optionalDependencies": {
|
|
41
|
+
"mongodb-client-encryption": "^2.0.0"
|
|
42
|
+
},
|
|
43
|
+
"dependency-check": {
|
|
44
|
+
"entries": [
|
|
45
|
+
"src/**/*.js"
|
|
46
|
+
],
|
|
47
|
+
"ignore": [
|
|
48
|
+
"sinon",
|
|
49
|
+
"chai",
|
|
50
|
+
"uuid",
|
|
51
|
+
"encoding"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
package/src/admin.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import ShellAuthOptions from './shell-auth-options';
|
|
2
|
+
import type {
|
|
3
|
+
MongoClientOptions,
|
|
4
|
+
ReadConcern,
|
|
5
|
+
ReadPreference,
|
|
6
|
+
WriteConcern,
|
|
7
|
+
Document,
|
|
8
|
+
CreateCollectionOptions,
|
|
9
|
+
ClientSession,
|
|
10
|
+
DbOptions,
|
|
11
|
+
ClientSessionOptions,
|
|
12
|
+
ListDatabasesOptions,
|
|
13
|
+
AutoEncryptionOptions
|
|
14
|
+
} from './all-transport-types';
|
|
15
|
+
import type { bson as BSON } from './index';
|
|
16
|
+
import { ReplPlatform } from './platform';
|
|
17
|
+
import { FLE } from './all-fle-types';
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export default interface Admin {
|
|
21
|
+
/**
|
|
22
|
+
* What platform (Compass/CLI/Browser)
|
|
23
|
+
*/
|
|
24
|
+
platform: ReplPlatform;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The initial database
|
|
28
|
+
*/
|
|
29
|
+
initialDb: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The BSON package
|
|
33
|
+
*/
|
|
34
|
+
bsonLibrary: typeof BSON;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* list databases.
|
|
38
|
+
*
|
|
39
|
+
* @param {String} database - The database name.
|
|
40
|
+
*
|
|
41
|
+
* @returns {Promise} The promise of command Documents.
|
|
42
|
+
*/
|
|
43
|
+
listDatabases(database: string, options?: ListDatabasesOptions): Promise<Document>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* create a new service provider with a new connection.
|
|
47
|
+
*
|
|
48
|
+
* @param uri
|
|
49
|
+
* @param options
|
|
50
|
+
*/
|
|
51
|
+
getNewConnection(uri: string, options: MongoClientOptions): Promise<any>; // returns the ServiceProvider instance
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Return the URI for the current connection, if this ServiceProvider is connected.
|
|
55
|
+
*/
|
|
56
|
+
getURI(): string | undefined;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Return connection info
|
|
60
|
+
*/
|
|
61
|
+
getConnectionInfo(): Promise<Document>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Authenticate
|
|
65
|
+
*/
|
|
66
|
+
authenticate(authDoc: ShellAuthOptions): Promise<{ ok: number }>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* createCollection
|
|
70
|
+
*/
|
|
71
|
+
createCollection(
|
|
72
|
+
dbName: string,
|
|
73
|
+
collName: string,
|
|
74
|
+
options: CreateCollectionOptions,
|
|
75
|
+
dbOptions?: DbOptions): Promise<{ ok: number }>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Return read preference for connection.
|
|
79
|
+
*/
|
|
80
|
+
getReadPreference(): ReadPreference;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Return read concern for connection.
|
|
84
|
+
*/
|
|
85
|
+
getReadConcern(): ReadConcern | undefined;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Return write concern for connection.
|
|
89
|
+
*/
|
|
90
|
+
getWriteConcern(): WriteConcern | undefined;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Reset the connection to have the option specified.
|
|
94
|
+
*
|
|
95
|
+
* @param options
|
|
96
|
+
*/
|
|
97
|
+
resetConnectionOptions(options: MongoClientOptions): Promise<void>;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Start a session.
|
|
101
|
+
* @param options
|
|
102
|
+
*/
|
|
103
|
+
startSession(options: ClientSessionOptions): ClientSession;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Return the raw client for use in keyVaultClient.
|
|
107
|
+
*/
|
|
108
|
+
getRawClient(): any;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The FLE implementation for access to the client-side encryption API.
|
|
112
|
+
*/
|
|
113
|
+
fle?: FLE | undefined;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The FLE options passed to the client, if any.
|
|
117
|
+
*/
|
|
118
|
+
getFleOptions?: () => AutoEncryptionOptions | undefined;
|
|
119
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
AWSEncryptionKeyOptions,
|
|
3
|
+
AzureEncryptionKeyOptions,
|
|
4
|
+
GCPEncryptionKeyOptions,
|
|
5
|
+
ClientEncryption,
|
|
6
|
+
ClientEncryptionCreateDataKeyCallback,
|
|
7
|
+
ClientEncryptionCreateDataKeyProviderOptions,
|
|
8
|
+
ClientEncryptionDataKeyProvider,
|
|
9
|
+
ClientEncryptionDecryptCallback,
|
|
10
|
+
ClientEncryptionEncryptCallback,
|
|
11
|
+
ClientEncryptionEncryptOptions,
|
|
12
|
+
ClientEncryptionOptions,
|
|
13
|
+
ClientEncryptionTlsOptions,
|
|
14
|
+
KMSProviders
|
|
15
|
+
} from 'mongodb-client-encryption';
|
|
16
|
+
|
|
17
|
+
export type FLE = typeof import('mongodb-client-encryption');
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
AggregateOptions,
|
|
3
|
+
AggregationCursor,
|
|
4
|
+
AnyBulkWriteOperation,
|
|
5
|
+
Batch,
|
|
6
|
+
BulkResult,
|
|
7
|
+
BulkWriteOptions,
|
|
8
|
+
BulkWriteResult,
|
|
9
|
+
ChangeStream,
|
|
10
|
+
ChangeStreamOptions,
|
|
11
|
+
ClientSession,
|
|
12
|
+
CloseOptions,
|
|
13
|
+
CollationOptions,
|
|
14
|
+
CollStatsOptions,
|
|
15
|
+
Collection,
|
|
16
|
+
CommandOperationOptions,
|
|
17
|
+
CountDocumentsOptions,
|
|
18
|
+
CountOptions,
|
|
19
|
+
CreateCollectionOptions,
|
|
20
|
+
CreateIndexesOptions,
|
|
21
|
+
ClientSessionOptions,
|
|
22
|
+
ClusterTime,
|
|
23
|
+
FindCursor,
|
|
24
|
+
CursorFlag,
|
|
25
|
+
Db,
|
|
26
|
+
DbOptions,
|
|
27
|
+
DeleteOptions,
|
|
28
|
+
DeleteResult,
|
|
29
|
+
DistinctOptions,
|
|
30
|
+
Document,
|
|
31
|
+
DropCollectionOptions,
|
|
32
|
+
DropDatabaseOptions,
|
|
33
|
+
EstimatedDocumentCountOptions,
|
|
34
|
+
ExplainOptions,
|
|
35
|
+
ExplainVerbosityLike,
|
|
36
|
+
FindOneAndDeleteOptions,
|
|
37
|
+
FindOneAndUpdateOptions,
|
|
38
|
+
FindOneAndReplaceOptions,
|
|
39
|
+
FindOperators,
|
|
40
|
+
FindOptions,
|
|
41
|
+
HedgeOptions,
|
|
42
|
+
IndexDescription,
|
|
43
|
+
InsertManyResult,
|
|
44
|
+
InsertOneOptions,
|
|
45
|
+
InsertOneResult,
|
|
46
|
+
ListCollectionsOptions,
|
|
47
|
+
ListDatabasesOptions,
|
|
48
|
+
ListIndexesOptions,
|
|
49
|
+
MapReduceOptions,
|
|
50
|
+
MongoClientOptions,
|
|
51
|
+
OrderedBulkOperation,
|
|
52
|
+
ReadConcern,
|
|
53
|
+
ReadConcernLike,
|
|
54
|
+
ReadConcernLevel,
|
|
55
|
+
ReadPreference,
|
|
56
|
+
ReadPreferenceLike,
|
|
57
|
+
ReadPreferenceFromOptions,
|
|
58
|
+
ReadPreferenceMode,
|
|
59
|
+
RenameOptions,
|
|
60
|
+
ReplaceOptions,
|
|
61
|
+
ResumeToken,
|
|
62
|
+
RunCommandOptions,
|
|
63
|
+
ServerSessionId,
|
|
64
|
+
TagSet,
|
|
65
|
+
TransactionOptions,
|
|
66
|
+
UpdateOptions,
|
|
67
|
+
UpdateResult,
|
|
68
|
+
UnorderedBulkOperation,
|
|
69
|
+
WriteConcern,
|
|
70
|
+
ObjectId as ObjectIdType,
|
|
71
|
+
Timestamp as TimestampType,
|
|
72
|
+
Binary as BinaryType,
|
|
73
|
+
TopologyDescription,
|
|
74
|
+
TopologyType,
|
|
75
|
+
ServerType,
|
|
76
|
+
AutoEncryptionOptions,
|
|
77
|
+
ServerApi,
|
|
78
|
+
ServerApiVersion,
|
|
79
|
+
MongoClient // mostly for testing
|
|
80
|
+
} from 'qp-mongodb';
|