First commit
This commit is contained in:
6
node_modules/mongodb-connection-string-url/.esm-wrapper.mjs
generated
vendored
Normal file
6
node_modules/mongodb-connection-string-url/.esm-wrapper.mjs
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import mod from "./lib/index.js";
|
||||
|
||||
export default mod["default"];
|
||||
export const CommaAndColonSeparatedRecord = mod.CommaAndColonSeparatedRecord;
|
||||
export const ConnectionString = mod.ConnectionString;
|
||||
export const redactConnectionString = mod.redactConnectionString;
|
192
node_modules/mongodb-connection-string-url/LICENSE
generated
vendored
Normal file
192
node_modules/mongodb-connection-string-url/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Copyright 2020 MongoDB Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
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.
|
||||
|
25
node_modules/mongodb-connection-string-url/README.md
generated
vendored
Normal file
25
node_modules/mongodb-connection-string-url/README.md
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# mongodb-connection-string-url
|
||||
|
||||
MongoDB connection strings, based on the WhatWG URL API
|
||||
|
||||
```js
|
||||
import ConnectionString from 'mongodb-connection-string-url';
|
||||
|
||||
const cs = new ConnectionString('mongodb://localhost');
|
||||
cs.searchParams.set('readPreference', 'secondary');
|
||||
console.log(cs.href); // 'mongodb://localhost/?readPreference=secondary'
|
||||
```
|
||||
|
||||
## Deviations from the WhatWG URL package
|
||||
|
||||
- URL parameters are case-insensitive
|
||||
- The `.host`, `.hostname` and `.port` properties cannot be set, and reading
|
||||
them does not return meaningful results (and are typed as `never`in TypeScript)
|
||||
- The `.hosts` property contains a list of all hosts in the connection string
|
||||
- The `.href` property cannot be set, only read
|
||||
- There is an additional `.isSRV` property, set to `true` for `mongodb+srv://`
|
||||
- There is an additional `.clone()` utility method on the prototype
|
||||
|
||||
## LICENSE
|
||||
|
||||
Apache-2.0
|
62
node_modules/mongodb-connection-string-url/lib/index.d.ts
generated
vendored
Normal file
62
node_modules/mongodb-connection-string-url/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
import { URL } from 'whatwg-url';
|
||||
import { redactConnectionString, ConnectionStringRedactionOptions } from './redact';
|
||||
export { redactConnectionString, ConnectionStringRedactionOptions };
|
||||
declare class CaseInsensitiveMap<K extends string = string> extends Map<K, string> {
|
||||
delete(name: K): boolean;
|
||||
get(name: K): string | undefined;
|
||||
has(name: K): boolean;
|
||||
set(name: K, value: any): this;
|
||||
_normalizeKey(name: any): K;
|
||||
}
|
||||
declare abstract class URLWithoutHost extends URL {
|
||||
abstract get host(): never;
|
||||
abstract set host(value: never);
|
||||
abstract get hostname(): never;
|
||||
abstract set hostname(value: never);
|
||||
abstract get port(): never;
|
||||
abstract set port(value: never);
|
||||
abstract get href(): string;
|
||||
abstract set href(value: string);
|
||||
}
|
||||
export interface ConnectionStringParsingOptions {
|
||||
looseValidation?: boolean;
|
||||
}
|
||||
export declare class ConnectionString extends URLWithoutHost {
|
||||
_hosts: string[];
|
||||
constructor(uri: string, options?: ConnectionStringParsingOptions);
|
||||
get host(): never;
|
||||
set host(_ignored: never);
|
||||
get hostname(): never;
|
||||
set hostname(_ignored: never);
|
||||
get port(): never;
|
||||
set port(_ignored: never);
|
||||
get href(): string;
|
||||
set href(_ignored: string);
|
||||
get isSRV(): boolean;
|
||||
get hosts(): string[];
|
||||
set hosts(list: string[]);
|
||||
toString(): string;
|
||||
clone(): ConnectionString;
|
||||
redact(options?: ConnectionStringRedactionOptions): ConnectionString;
|
||||
typedSearchParams<T extends {}>(): {
|
||||
append(name: keyof T & string, value: any): void;
|
||||
delete(name: keyof T & string): void;
|
||||
get(name: keyof T & string): string | null;
|
||||
getAll(name: keyof T & string): string[];
|
||||
has(name: keyof T & string): boolean;
|
||||
set(name: keyof T & string, value: any): void;
|
||||
keys(): IterableIterator<keyof T & string>;
|
||||
values(): IterableIterator<string>;
|
||||
entries(): IterableIterator<[keyof T & string, string]>;
|
||||
_normalizeKey(name: keyof T & string): string;
|
||||
[Symbol.iterator](): IterableIterator<[keyof T & string, string]>;
|
||||
sort(): void;
|
||||
forEach<THIS_ARG = void>(callback: (this: THIS_ARG, value: string, name: string, searchParams: any) => void, thisArg?: THIS_ARG | undefined): void;
|
||||
readonly [Symbol.toStringTag]: "URLSearchParams";
|
||||
};
|
||||
}
|
||||
export declare class CommaAndColonSeparatedRecord<K extends {} = Record<string, unknown>> extends CaseInsensitiveMap<keyof K & string> {
|
||||
constructor(from?: string | null);
|
||||
toString(): string;
|
||||
}
|
||||
export default ConnectionString;
|
213
node_modules/mongodb-connection-string-url/lib/index.js
generated
vendored
Normal file
213
node_modules/mongodb-connection-string-url/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,213 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CommaAndColonSeparatedRecord = exports.ConnectionString = exports.redactConnectionString = void 0;
|
||||
const whatwg_url_1 = require("whatwg-url");
|
||||
const redact_1 = require("./redact");
|
||||
Object.defineProperty(exports, "redactConnectionString", { enumerable: true, get: function () { return redact_1.redactConnectionString; } });
|
||||
const DUMMY_HOSTNAME = '__this_is_a_placeholder__';
|
||||
function connectionStringHasValidScheme(connectionString) {
|
||||
return (connectionString.startsWith('mongodb://') ||
|
||||
connectionString.startsWith('mongodb+srv://'));
|
||||
}
|
||||
const HOSTS_REGEX = /^(?<protocol>[^/]+):\/\/(?:(?<username>[^:@]*)(?::(?<password>[^@]*))?@)?(?<hosts>(?!:)[^/?@]*)(?<rest>.*)/;
|
||||
class CaseInsensitiveMap extends Map {
|
||||
delete(name) {
|
||||
return super.delete(this._normalizeKey(name));
|
||||
}
|
||||
get(name) {
|
||||
return super.get(this._normalizeKey(name));
|
||||
}
|
||||
has(name) {
|
||||
return super.has(this._normalizeKey(name));
|
||||
}
|
||||
set(name, value) {
|
||||
return super.set(this._normalizeKey(name), value);
|
||||
}
|
||||
_normalizeKey(name) {
|
||||
name = `${name}`;
|
||||
for (const key of this.keys()) {
|
||||
if (key.toLowerCase() === name.toLowerCase()) {
|
||||
name = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
function caseInsenstiveURLSearchParams(Ctor) {
|
||||
return class CaseInsenstiveURLSearchParams extends Ctor {
|
||||
append(name, value) {
|
||||
return super.append(this._normalizeKey(name), value);
|
||||
}
|
||||
delete(name) {
|
||||
return super.delete(this._normalizeKey(name));
|
||||
}
|
||||
get(name) {
|
||||
return super.get(this._normalizeKey(name));
|
||||
}
|
||||
getAll(name) {
|
||||
return super.getAll(this._normalizeKey(name));
|
||||
}
|
||||
has(name) {
|
||||
return super.has(this._normalizeKey(name));
|
||||
}
|
||||
set(name, value) {
|
||||
return super.set(this._normalizeKey(name), value);
|
||||
}
|
||||
keys() {
|
||||
return super.keys();
|
||||
}
|
||||
values() {
|
||||
return super.values();
|
||||
}
|
||||
entries() {
|
||||
return super.entries();
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return super[Symbol.iterator]();
|
||||
}
|
||||
_normalizeKey(name) {
|
||||
return CaseInsensitiveMap.prototype._normalizeKey.call(this, name);
|
||||
}
|
||||
};
|
||||
}
|
||||
class URLWithoutHost extends whatwg_url_1.URL {
|
||||
}
|
||||
class MongoParseError extends Error {
|
||||
get name() {
|
||||
return 'MongoParseError';
|
||||
}
|
||||
}
|
||||
class ConnectionString extends URLWithoutHost {
|
||||
constructor(uri, options = {}) {
|
||||
var _a;
|
||||
const { looseValidation } = options;
|
||||
if (!looseValidation && !connectionStringHasValidScheme(uri)) {
|
||||
throw new MongoParseError('Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"');
|
||||
}
|
||||
const match = uri.match(HOSTS_REGEX);
|
||||
if (!match) {
|
||||
throw new MongoParseError(`Invalid connection string "${uri}"`);
|
||||
}
|
||||
const { protocol, username, password, hosts, rest } = (_a = match.groups) !== null && _a !== void 0 ? _a : {};
|
||||
if (!looseValidation) {
|
||||
if (!protocol || !hosts) {
|
||||
throw new MongoParseError(`Protocol and host list are required in "${uri}"`);
|
||||
}
|
||||
try {
|
||||
decodeURIComponent(username !== null && username !== void 0 ? username : '');
|
||||
decodeURIComponent(password !== null && password !== void 0 ? password : '');
|
||||
}
|
||||
catch (err) {
|
||||
throw new MongoParseError(err.message);
|
||||
}
|
||||
const illegalCharacters = /[:/?#[\]@]/gi;
|
||||
if (username === null || username === void 0 ? void 0 : username.match(illegalCharacters)) {
|
||||
throw new MongoParseError(`Username contains unescaped characters ${username}`);
|
||||
}
|
||||
if (!username || !password) {
|
||||
const uriWithoutProtocol = uri.replace(`${protocol}://`, '');
|
||||
if (uriWithoutProtocol.startsWith('@') || uriWithoutProtocol.startsWith(':')) {
|
||||
throw new MongoParseError('URI contained empty userinfo section');
|
||||
}
|
||||
}
|
||||
if (password === null || password === void 0 ? void 0 : password.match(illegalCharacters)) {
|
||||
throw new MongoParseError('Password contains unescaped characters');
|
||||
}
|
||||
}
|
||||
let authString = '';
|
||||
if (typeof username === 'string')
|
||||
authString += username;
|
||||
if (typeof password === 'string')
|
||||
authString += `:${password}`;
|
||||
if (authString)
|
||||
authString += '@';
|
||||
try {
|
||||
super(`${protocol.toLowerCase()}://${authString}${DUMMY_HOSTNAME}${rest}`);
|
||||
}
|
||||
catch (err) {
|
||||
if (looseValidation) {
|
||||
new ConnectionString(uri, {
|
||||
...options,
|
||||
looseValidation: false
|
||||
});
|
||||
}
|
||||
if (typeof err.message === 'string') {
|
||||
err.message = err.message.replace(DUMMY_HOSTNAME, hosts);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
this._hosts = hosts.split(',');
|
||||
if (!looseValidation) {
|
||||
if (this.isSRV && this.hosts.length !== 1) {
|
||||
throw new MongoParseError('mongodb+srv URI cannot have multiple service names');
|
||||
}
|
||||
if (this.isSRV && this.hosts.some(host => host.includes(':'))) {
|
||||
throw new MongoParseError('mongodb+srv URI cannot have port number');
|
||||
}
|
||||
}
|
||||
if (!this.pathname) {
|
||||
this.pathname = '/';
|
||||
}
|
||||
Object.setPrototypeOf(this.searchParams, caseInsenstiveURLSearchParams(this.searchParams.constructor).prototype);
|
||||
}
|
||||
get host() { return DUMMY_HOSTNAME; }
|
||||
set host(_ignored) { throw new Error('No single host for connection string'); }
|
||||
get hostname() { return DUMMY_HOSTNAME; }
|
||||
set hostname(_ignored) { throw new Error('No single host for connection string'); }
|
||||
get port() { return ''; }
|
||||
set port(_ignored) { throw new Error('No single host for connection string'); }
|
||||
get href() { return this.toString(); }
|
||||
set href(_ignored) { throw new Error('Cannot set href for connection strings'); }
|
||||
get isSRV() {
|
||||
return this.protocol.includes('srv');
|
||||
}
|
||||
get hosts() {
|
||||
return this._hosts;
|
||||
}
|
||||
set hosts(list) {
|
||||
this._hosts = list;
|
||||
}
|
||||
toString() {
|
||||
return super.toString().replace(DUMMY_HOSTNAME, this.hosts.join(','));
|
||||
}
|
||||
clone() {
|
||||
return new ConnectionString(this.toString(), {
|
||||
looseValidation: true
|
||||
});
|
||||
}
|
||||
redact(options) {
|
||||
return (0, redact_1.redactValidConnectionString)(this, options);
|
||||
}
|
||||
typedSearchParams() {
|
||||
const sametype = false && new (caseInsenstiveURLSearchParams(whatwg_url_1.URLSearchParams))();
|
||||
return this.searchParams;
|
||||
}
|
||||
[Symbol.for('nodejs.util.inspect.custom')]() {
|
||||
const { href, origin, protocol, username, password, hosts, pathname, search, searchParams, hash } = this;
|
||||
return { href, origin, protocol, username, password, hosts, pathname, search, searchParams, hash };
|
||||
}
|
||||
}
|
||||
exports.ConnectionString = ConnectionString;
|
||||
class CommaAndColonSeparatedRecord extends CaseInsensitiveMap {
|
||||
constructor(from) {
|
||||
super();
|
||||
for (const entry of (from !== null && from !== void 0 ? from : '').split(',')) {
|
||||
if (!entry)
|
||||
continue;
|
||||
const colonIndex = entry.indexOf(':');
|
||||
if (colonIndex === -1) {
|
||||
this.set(entry, '');
|
||||
}
|
||||
else {
|
||||
this.set(entry.slice(0, colonIndex), entry.slice(colonIndex + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
toString() {
|
||||
return [...this].map(entry => entry.join(':')).join(',');
|
||||
}
|
||||
}
|
||||
exports.CommaAndColonSeparatedRecord = CommaAndColonSeparatedRecord;
|
||||
exports.default = ConnectionString;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/mongodb-connection-string-url/lib/index.js.map
generated
vendored
Normal file
1
node_modules/mongodb-connection-string-url/lib/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/mongodb-connection-string-url/lib/redact.d.ts
generated
vendored
Normal file
7
node_modules/mongodb-connection-string-url/lib/redact.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import ConnectionString from './index';
|
||||
export interface ConnectionStringRedactionOptions {
|
||||
redactUsernames?: boolean;
|
||||
replacementString?: string;
|
||||
}
|
||||
export declare function redactValidConnectionString(inputUrl: Readonly<ConnectionString>, options?: ConnectionStringRedactionOptions): ConnectionString;
|
||||
export declare function redactConnectionString(uri: string, options?: ConnectionStringRedactionOptions): string;
|
86
node_modules/mongodb-connection-string-url/lib/redact.js
generated
vendored
Normal file
86
node_modules/mongodb-connection-string-url/lib/redact.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.redactConnectionString = exports.redactValidConnectionString = void 0;
|
||||
const index_1 = __importStar(require("./index"));
|
||||
function redactValidConnectionString(inputUrl, options) {
|
||||
var _a, _b;
|
||||
const url = inputUrl.clone();
|
||||
const replacementString = (_a = options === null || options === void 0 ? void 0 : options.replacementString) !== null && _a !== void 0 ? _a : '_credentials_';
|
||||
const redactUsernames = (_b = options === null || options === void 0 ? void 0 : options.redactUsernames) !== null && _b !== void 0 ? _b : true;
|
||||
if ((url.username || url.password) && redactUsernames) {
|
||||
url.username = replacementString;
|
||||
url.password = '';
|
||||
}
|
||||
else if (url.password) {
|
||||
url.password = replacementString;
|
||||
}
|
||||
if (url.searchParams.has('authMechanismProperties')) {
|
||||
const props = new index_1.CommaAndColonSeparatedRecord(url.searchParams.get('authMechanismProperties'));
|
||||
if (props.get('AWS_SESSION_TOKEN')) {
|
||||
props.set('AWS_SESSION_TOKEN', replacementString);
|
||||
url.searchParams.set('authMechanismProperties', props.toString());
|
||||
}
|
||||
}
|
||||
if (url.searchParams.has('tlsCertificateKeyFilePassword')) {
|
||||
url.searchParams.set('tlsCertificateKeyFilePassword', replacementString);
|
||||
}
|
||||
if (url.searchParams.has('proxyUsername') && redactUsernames) {
|
||||
url.searchParams.set('proxyUsername', replacementString);
|
||||
}
|
||||
if (url.searchParams.has('proxyPassword')) {
|
||||
url.searchParams.set('proxyPassword', replacementString);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
exports.redactValidConnectionString = redactValidConnectionString;
|
||||
function redactConnectionString(uri, options) {
|
||||
var _a, _b;
|
||||
const replacementString = (_a = options === null || options === void 0 ? void 0 : options.replacementString) !== null && _a !== void 0 ? _a : '<credentials>';
|
||||
const redactUsernames = (_b = options === null || options === void 0 ? void 0 : options.redactUsernames) !== null && _b !== void 0 ? _b : true;
|
||||
let parsed;
|
||||
try {
|
||||
parsed = new index_1.default(uri);
|
||||
}
|
||||
catch (_c) { }
|
||||
if (parsed) {
|
||||
options = { ...options, replacementString: '___credentials___' };
|
||||
return parsed.redact(options).toString().replace(/___credentials___/g, replacementString);
|
||||
}
|
||||
const R = replacementString;
|
||||
const replacements = [
|
||||
uri => uri.replace(redactUsernames ? /(\/\/)(.*)(@)/g : /(\/\/[^@]*:)(.*)(@)/g, `$1${R}$3`),
|
||||
uri => uri.replace(/(AWS_SESSION_TOKEN(:|%3A))([^,&]+)/gi, `$1${R}`),
|
||||
uri => uri.replace(/(tlsCertificateKeyFilePassword=)([^&]+)/gi, `$1${R}`),
|
||||
uri => redactUsernames ? uri.replace(/(proxyUsername=)([^&]+)/gi, `$1${R}`) : uri,
|
||||
uri => uri.replace(/(proxyPassword=)([^&]+)/gi, `$1${R}`)
|
||||
];
|
||||
for (const replacer of replacements) {
|
||||
uri = replacer(uri);
|
||||
}
|
||||
return uri;
|
||||
}
|
||||
exports.redactConnectionString = redactConnectionString;
|
||||
//# sourceMappingURL=redact.js.map
|
1
node_modules/mongodb-connection-string-url/lib/redact.js.map
generated
vendored
Normal file
1
node_modules/mongodb-connection-string-url/lib/redact.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAyE;AAOzE,SAAgB,2BAA2B,CACzC,QAAoC,EACpC,OAA0C;;IAC1C,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;IAC7B,MAAM,iBAAiB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,iBAAiB,mCAAI,eAAe,CAAC;IACxE,MAAM,eAAe,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAA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IAAI,YAAY,EAAE;QACnC,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;KACrB;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AApCD,wDAoCC"}
|
62
node_modules/mongodb-connection-string-url/package.json
generated
vendored
Normal file
62
node_modules/mongodb-connection-string-url/package.json
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"name": "mongodb-connection-string-url",
|
||||
"version": "2.6.0",
|
||||
"description": "MongoDB connection strings, based on the WhatWG URL API",
|
||||
"keywords": [
|
||||
"password",
|
||||
"prompt",
|
||||
"tty"
|
||||
],
|
||||
"homepage": "https://github.com/mongodb-js/mongodb-connection-string-url",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mongodb-js/mongodb-connection-string-url.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mongodb-js/mongodb-connection-string-url/issues"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"exports": {
|
||||
"require": "./lib/index.js",
|
||||
"import": "./.esm-wrapper.mjs"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"lib",
|
||||
"package.json",
|
||||
"README.md",
|
||||
".esm-wrapper.mjs"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint \"{src,test}/**/*.ts\"",
|
||||
"test": "npm run lint && npm run build && nyc mocha --colors -r ts-node/register test/*.ts",
|
||||
"build": "npm run compile-ts && gen-esm-wrapper . ./.esm-wrapper.mjs",
|
||||
"prepack": "npm run build",
|
||||
"compile-ts": "tsc -p tsconfig.json"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.2.5",
|
||||
"@types/mocha": "^8.0.3",
|
||||
"@types/node": "^14.11.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.2.0",
|
||||
"@typescript-eslint/parser": "^4.2.0",
|
||||
"chai": "^4.2.0",
|
||||
"eslint": "^7.9.0",
|
||||
"eslint-config-semistandard": "^15.0.1",
|
||||
"eslint-config-standard": "^14.1.1",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"eslint-plugin-standard": "^4.0.1",
|
||||
"gen-esm-wrapper": "^1.1.3",
|
||||
"mocha": "^8.1.3",
|
||||
"nyc": "^15.1.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/whatwg-url": "^8.2.1",
|
||||
"whatwg-url": "^11.0.0"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user