@qp-mongosh/shell-api 0.0.0-dev.25 → 0.0.0-dev.27
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qp-mongosh/shell-api",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.27",
|
|
4
4
|
"description": "MongoDB Shell API Classes Package",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"build"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@qp-mongosh/errors": "0.0.0-dev.
|
|
38
|
-
"@qp-mongosh/history": "0.0.0-dev.
|
|
39
|
-
"@qp-mongosh/i18n": "0.0.0-dev.
|
|
40
|
-
"@qp-mongosh/service-provider-core": "0.0.0-dev.
|
|
41
|
-
"qp-mongodb": "0.0.0-dev.
|
|
37
|
+
"@qp-mongosh/errors": "0.0.0-dev.27",
|
|
38
|
+
"@qp-mongosh/history": "0.0.0-dev.27",
|
|
39
|
+
"@qp-mongosh/i18n": "0.0.0-dev.27",
|
|
40
|
+
"@qp-mongosh/service-provider-core": "0.0.0-dev.27",
|
|
41
|
+
"qp-mongodb": "0.0.0-dev.27",
|
|
42
42
|
"mongodb-redact": "^0.2.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@qp-mongosh/types": "0.0.0-dev.
|
|
45
|
+
"@qp-mongosh/types": "0.0.0-dev.27"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.printWarning = exports.printDeprecationWarning = void 0;
|
|
4
|
-
const warningShown = new Set();
|
|
5
|
-
function printDeprecationWarning(message, warn = console.warn) {
|
|
6
|
-
if (!warningShown.has(message)) {
|
|
7
|
-
warningShown.add(message);
|
|
8
|
-
warn(`DeprecationWarning: ${message}`);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.printDeprecationWarning = printDeprecationWarning;
|
|
12
|
-
function printWarning(message, warn = console.warn) {
|
|
13
|
-
if (!warningShown.has(message)) {
|
|
14
|
-
warningShown.add(message);
|
|
15
|
-
warn(`Warning: ${message}`);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.printWarning = printWarning;
|
|
19
|
-
//# sourceMappingURL=deprecation-warning.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deprecation-warning.js","sourceRoot":"","sources":["../src/deprecation-warning.ts"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAAgB,IAAI,GAAG,EAAE,CAAC;AAQ5C,SAAgB,uBAAuB,CACrC,OAAe,EACf,IAAI,GAAG,OAAO,CAAC,IAAI;IAEnB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QAC9B,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1B,IAAI,CAAC,uBAAuB,OAAO,EAAE,CAAC,CAAC;KACxC;AACH,CAAC;AARD,0DAQC;AAED,SAAgB,YAAY,CAC1B,OAAe,EACf,IAAI,GAAG,OAAO,CAAC,IAAI;IAEnB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QAC9B,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1B,IAAI,CAAC,YAAY,OAAO,EAAE,CAAC,CAAC;KAC7B;AACH,CAAC;AARD,oCAQC"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { AutoEncryptionOptions, ConnectInfo, ServiceProvider, ServerApi } from '@mongosh/service-provider-core';
|
|
2
|
-
import type { ApiEvent, ConfigProvider, MongoshBus, ShellUserConfig } from '@mongosh/types';
|
|
3
|
-
import ChangeStreamCursor from './change-stream-cursor';
|
|
4
|
-
import { Topologies } from './enums';
|
|
5
|
-
import { AggregationCursor, Cursor, Database, Mongo, ShellApi, ShellResult } from './index';
|
|
6
|
-
import { InterruptFlag } from './interruptor';
|
|
7
|
-
export interface ShellCliOptions {
|
|
8
|
-
nodb?: boolean;
|
|
9
|
-
mongocryptdSpawnPath?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface AutocompleteParameters {
|
|
12
|
-
topology: () => Topologies;
|
|
13
|
-
apiVersionInfo: () => Required<ServerApi> | undefined;
|
|
14
|
-
connectionInfo: () => ConnectInfo | undefined;
|
|
15
|
-
getCollectionCompletionsForCurrentDb: (collName: string) => Promise<string[]>;
|
|
16
|
-
getDatabaseCompletions: (dbName: string) => Promise<string[]>;
|
|
17
|
-
}
|
|
18
|
-
export interface OnLoadResult {
|
|
19
|
-
resolvedFilename: string;
|
|
20
|
-
evaluate(): Promise<void>;
|
|
21
|
-
}
|
|
22
|
-
export interface EvaluationListener extends Partial<ConfigProvider<ShellUserConfig>> {
|
|
23
|
-
onPrint?: (value: ShellResult[]) => Promise<void> | void;
|
|
24
|
-
onPrompt?: (question: string, type: 'password' | 'yesno') => Promise<string> | string;
|
|
25
|
-
onClearCommand?: () => Promise<void> | void;
|
|
26
|
-
onExit?: () => Promise<never>;
|
|
27
|
-
onLoad?: (filename: string) => Promise<OnLoadResult> | OnLoadResult;
|
|
28
|
-
startMongocryptd?: () => Promise<AutoEncryptionOptions['extraOptions']>;
|
|
29
|
-
}
|
|
30
|
-
export interface ShellPlugin {
|
|
31
|
-
transformError?: (err: Error) => Error;
|
|
32
|
-
}
|
|
33
|
-
export default class ShellInternalState {
|
|
34
|
-
currentCursor: Cursor | AggregationCursor | ChangeStreamCursor | null;
|
|
35
|
-
currentDb: Database;
|
|
36
|
-
messageBus: MongoshBus;
|
|
37
|
-
initialServiceProvider: ServiceProvider;
|
|
38
|
-
connectionInfo: any;
|
|
39
|
-
context: any;
|
|
40
|
-
mongos: Mongo[];
|
|
41
|
-
shellApi: ShellApi;
|
|
42
|
-
shellBson: any;
|
|
43
|
-
cliOptions: ShellCliOptions;
|
|
44
|
-
evaluationListener: EvaluationListener;
|
|
45
|
-
mongocryptdSpawnPath: string | null;
|
|
46
|
-
batchSizeFromDBQuery: number | undefined;
|
|
47
|
-
isInteractive: boolean;
|
|
48
|
-
readonly interrupted: InterruptFlag;
|
|
49
|
-
resumeMongosAfterInterrupt: Array<{
|
|
50
|
-
mongo: Mongo;
|
|
51
|
-
resume: (() => Promise<void>) | null;
|
|
52
|
-
}> | undefined;
|
|
53
|
-
private plugins;
|
|
54
|
-
private alreadyTransformedErrors;
|
|
55
|
-
constructor(initialServiceProvider: ServiceProvider, messageBus?: any, cliOptions?: ShellCliOptions);
|
|
56
|
-
fetchConnectionInfo(): Promise<void>;
|
|
57
|
-
close(force: boolean): Promise<void>;
|
|
58
|
-
setDbFunc(newDb: any): Database;
|
|
59
|
-
setCtx(contextObject: any): void;
|
|
60
|
-
get currentServiceProvider(): ServiceProvider;
|
|
61
|
-
emitApiCall(event: ApiEvent): void;
|
|
62
|
-
emitDeprecatedApiCall(event: ApiEvent): void;
|
|
63
|
-
setEvaluationListener(listener: EvaluationListener): void;
|
|
64
|
-
getAutocompleteParameters(): AutocompleteParameters;
|
|
65
|
-
apiVersionInfo(): Required<ServerApi> | undefined;
|
|
66
|
-
onInterruptExecution(): Promise<boolean>;
|
|
67
|
-
onResumeExecution(): Promise<boolean>;
|
|
68
|
-
getDefaultPrompt(): Promise<string>;
|
|
69
|
-
private getDefaultPromptPrefix;
|
|
70
|
-
private getTopologySpecificPrompt;
|
|
71
|
-
private getTopologySinglePrompt;
|
|
72
|
-
registerPlugin(plugin: ShellPlugin): void;
|
|
73
|
-
transformError(err: any): any;
|
|
74
|
-
}
|
|
@@ -1,364 +0,0 @@
|
|
|
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
|
-
const errors_1 = require("@mongosh/errors");
|
|
7
|
-
const service_provider_core_1 = require("@mongosh/service-provider-core");
|
|
8
|
-
const events_1 = require("events");
|
|
9
|
-
const mongodb_redact_1 = __importDefault(require("mongodb-redact"));
|
|
10
|
-
const decorators_1 = require("./decorators");
|
|
11
|
-
const enums_1 = require("./enums");
|
|
12
|
-
const error_codes_1 = require("./error-codes");
|
|
13
|
-
const index_1 = require("./index");
|
|
14
|
-
const interruptor_1 = require("./interruptor");
|
|
15
|
-
const no_db_1 = __importDefault(require("./no-db"));
|
|
16
|
-
const shell_bson_1 = __importDefault(require("./shell-bson"));
|
|
17
|
-
const mongo_errors_1 = require("./mongo-errors");
|
|
18
|
-
class ShellInternalState {
|
|
19
|
-
constructor(initialServiceProvider, messageBus = new events_1.EventEmitter(), cliOptions = {}) {
|
|
20
|
-
var _a;
|
|
21
|
-
this.batchSizeFromDBQuery = undefined;
|
|
22
|
-
this.isInteractive = false;
|
|
23
|
-
this.interrupted = new interruptor_1.InterruptFlag();
|
|
24
|
-
this.plugins = [new mongo_errors_1.TransformMongoErrorPlugin()];
|
|
25
|
-
this.alreadyTransformedErrors = new WeakMap();
|
|
26
|
-
this.initialServiceProvider = initialServiceProvider;
|
|
27
|
-
this.messageBus = messageBus;
|
|
28
|
-
this.shellApi = new index_1.ShellApi(this);
|
|
29
|
-
this.shellBson = shell_bson_1.default(initialServiceProvider.bsonLibrary, (msg) => {
|
|
30
|
-
if (this.context.print) {
|
|
31
|
-
this.context.print(`Warning: ${msg}`);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
this.mongos = [];
|
|
35
|
-
this.connectionInfo = { buildInfo: {} };
|
|
36
|
-
if (!cliOptions.nodb) {
|
|
37
|
-
const mongo = new index_1.Mongo(this, undefined, undefined, undefined, initialServiceProvider);
|
|
38
|
-
this.mongos.push(mongo);
|
|
39
|
-
this.currentDb = mongo.getDB(initialServiceProvider.initialDb || service_provider_core_1.DEFAULT_DB);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
this.currentDb = new no_db_1.default();
|
|
43
|
-
}
|
|
44
|
-
this.currentCursor = null;
|
|
45
|
-
this.context = {};
|
|
46
|
-
this.cliOptions = cliOptions;
|
|
47
|
-
this.evaluationListener = {};
|
|
48
|
-
this.mongocryptdSpawnPath = (_a = cliOptions.mongocryptdSpawnPath) !== null && _a !== void 0 ? _a : null;
|
|
49
|
-
}
|
|
50
|
-
async fetchConnectionInfo() {
|
|
51
|
-
if (!this.cliOptions.nodb) {
|
|
52
|
-
this.connectionInfo = await this.currentServiceProvider.getConnectionInfo();
|
|
53
|
-
const apiVersionInfo = this.apiVersionInfo();
|
|
54
|
-
this.messageBus.emit('mongosh:connect', {
|
|
55
|
-
...this.connectionInfo.extraInfo,
|
|
56
|
-
api_version: apiVersionInfo === null || apiVersionInfo === void 0 ? void 0 : apiVersionInfo.version,
|
|
57
|
-
api_strict: apiVersionInfo === null || apiVersionInfo === void 0 ? void 0 : apiVersionInfo.strict,
|
|
58
|
-
api_deprecation_errors: apiVersionInfo === null || apiVersionInfo === void 0 ? void 0 : apiVersionInfo.deprecationErrors,
|
|
59
|
-
uri: mongodb_redact_1.default(this.connectionInfo.extraInfo.uri)
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
async close(force) {
|
|
64
|
-
for (const mongo of [...this.mongos]) {
|
|
65
|
-
await mongo.close(force);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
setDbFunc(newDb) {
|
|
69
|
-
this.currentDb = newDb;
|
|
70
|
-
this.context.rs = new index_1.ReplicaSet(this.currentDb);
|
|
71
|
-
this.context.sh = new index_1.Shard(this.currentDb);
|
|
72
|
-
this.fetchConnectionInfo().catch(err => this.messageBus.emit('mongosh:error', err));
|
|
73
|
-
this.currentDb._getCollectionNamesForCompletion().catch(err => this.messageBus.emit('mongosh:error', err));
|
|
74
|
-
this.currentDb._mongo._getDatabaseNamesForCompletion().catch(err => this.messageBus.emit('mongosh:error', err));
|
|
75
|
-
return newDb;
|
|
76
|
-
}
|
|
77
|
-
setCtx(contextObject) {
|
|
78
|
-
this.context = contextObject;
|
|
79
|
-
Object.assign(contextObject, this.shellApi);
|
|
80
|
-
for (const name of Object.getOwnPropertyNames(index_1.ShellApi.prototype)) {
|
|
81
|
-
const { shellApi } = this;
|
|
82
|
-
if (decorators_1.toIgnore.concat(['help']).includes(name) ||
|
|
83
|
-
typeof shellApi[name] !== 'function') {
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
contextObject[name] = function (...args) {
|
|
87
|
-
return shellApi[name](...args);
|
|
88
|
-
};
|
|
89
|
-
contextObject[name].help = shellApi[name].help;
|
|
90
|
-
}
|
|
91
|
-
contextObject.help = this.shellApi.help;
|
|
92
|
-
Object.assign(contextObject, this.shellBson);
|
|
93
|
-
if (contextObject.console === undefined) {
|
|
94
|
-
contextObject.console = {};
|
|
95
|
-
}
|
|
96
|
-
for (const key of ['log', 'warn', 'info', 'error']) {
|
|
97
|
-
contextObject.console[key] = async (...args) => {
|
|
98
|
-
return await contextObject.print(...args);
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
contextObject.console.clear = contextObject.cls;
|
|
102
|
-
contextObject.rs = new index_1.ReplicaSet(this.currentDb);
|
|
103
|
-
contextObject.sh = new index_1.Shard(this.currentDb);
|
|
104
|
-
const setFunc = (newDb) => {
|
|
105
|
-
if (index_1.getShellApiType(newDb) !== 'Database') {
|
|
106
|
-
throw new errors_1.MongoshInvalidInputError('Cannot reassign \'db\' to non-Database type', errors_1.CommonErrors.InvalidOperation);
|
|
107
|
-
}
|
|
108
|
-
return this.setDbFunc(newDb);
|
|
109
|
-
};
|
|
110
|
-
if (this.initialServiceProvider.platform === service_provider_core_1.ReplPlatform.JavaShell) {
|
|
111
|
-
contextObject.db = this.setDbFunc(this.currentDb);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
Object.defineProperty(contextObject, 'db', {
|
|
115
|
-
configurable: true,
|
|
116
|
-
set: setFunc,
|
|
117
|
-
get: () => (this.currentDb)
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
this.messageBus.emit('mongosh:setCtx', { method: 'setCtx', arguments: {} });
|
|
121
|
-
}
|
|
122
|
-
get currentServiceProvider() {
|
|
123
|
-
try {
|
|
124
|
-
return this.currentDb._mongo._serviceProvider;
|
|
125
|
-
}
|
|
126
|
-
catch (err) {
|
|
127
|
-
if (err.code === error_codes_1.ShellApiErrors.NotConnected) {
|
|
128
|
-
return this.initialServiceProvider;
|
|
129
|
-
}
|
|
130
|
-
throw err;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
emitApiCall(event) {
|
|
134
|
-
this.messageBus.emit('mongosh:api-call', event);
|
|
135
|
-
}
|
|
136
|
-
emitDeprecatedApiCall(event) {
|
|
137
|
-
this.messageBus.emit('mongosh:deprecated-api-call', event);
|
|
138
|
-
}
|
|
139
|
-
setEvaluationListener(listener) {
|
|
140
|
-
this.evaluationListener = listener;
|
|
141
|
-
}
|
|
142
|
-
getAutocompleteParameters() {
|
|
143
|
-
return {
|
|
144
|
-
topology: () => {
|
|
145
|
-
var _a;
|
|
146
|
-
let topology;
|
|
147
|
-
const topologyDescription = (_a = this.currentServiceProvider.getTopology()) === null || _a === void 0 ? void 0 : _a.description;
|
|
148
|
-
const topologyType = topologyDescription === null || topologyDescription === void 0 ? void 0 : topologyDescription.type;
|
|
149
|
-
switch (topologyType) {
|
|
150
|
-
case 'ReplicaSetNoPrimary':
|
|
151
|
-
case 'ReplicaSetWithPrimary':
|
|
152
|
-
topology = enums_1.Topologies.ReplSet;
|
|
153
|
-
break;
|
|
154
|
-
case 'Sharded':
|
|
155
|
-
topology = enums_1.Topologies.Sharded;
|
|
156
|
-
break;
|
|
157
|
-
default:
|
|
158
|
-
topology = enums_1.Topologies.Standalone;
|
|
159
|
-
if (topologyDescription.servers.size === 1) {
|
|
160
|
-
const [server] = topologyDescription.servers.values();
|
|
161
|
-
switch (server.type) {
|
|
162
|
-
case 'Mongos':
|
|
163
|
-
topology = enums_1.Topologies.Sharded;
|
|
164
|
-
break;
|
|
165
|
-
case 'PossiblePrimary':
|
|
166
|
-
case 'RSPrimary':
|
|
167
|
-
case 'RSSecondary':
|
|
168
|
-
case 'RSArbiter':
|
|
169
|
-
case 'RSOther':
|
|
170
|
-
case 'RSGhost':
|
|
171
|
-
topology = enums_1.Topologies.ReplSet;
|
|
172
|
-
break;
|
|
173
|
-
default:
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
return topology;
|
|
180
|
-
},
|
|
181
|
-
apiVersionInfo: () => {
|
|
182
|
-
return this.apiVersionInfo();
|
|
183
|
-
},
|
|
184
|
-
connectionInfo: () => {
|
|
185
|
-
return this.connectionInfo.extraInfo;
|
|
186
|
-
},
|
|
187
|
-
getCollectionCompletionsForCurrentDb: async (collName) => {
|
|
188
|
-
try {
|
|
189
|
-
const collectionNames = await this.currentDb._getCollectionNamesForCompletion();
|
|
190
|
-
return collectionNames.filter((name) => name.startsWith(collName));
|
|
191
|
-
}
|
|
192
|
-
catch (err) {
|
|
193
|
-
if (err.code === error_codes_1.ShellApiErrors.NotConnected || err.codeName === 'Unauthorized') {
|
|
194
|
-
return [];
|
|
195
|
-
}
|
|
196
|
-
throw err;
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
getDatabaseCompletions: async (dbName) => {
|
|
200
|
-
try {
|
|
201
|
-
const dbNames = await this.currentDb._mongo._getDatabaseNamesForCompletion();
|
|
202
|
-
return dbNames.filter((name) => name.startsWith(dbName));
|
|
203
|
-
}
|
|
204
|
-
catch (err) {
|
|
205
|
-
if (err.code === error_codes_1.ShellApiErrors.NotConnected || err.codeName === 'Unauthorized') {
|
|
206
|
-
return [];
|
|
207
|
-
}
|
|
208
|
-
throw err;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
apiVersionInfo() {
|
|
214
|
-
var _a, _b;
|
|
215
|
-
const { serverApi } = (_b = (_a = this.currentServiceProvider.getRawClient()) === null || _a === void 0 ? void 0 : _a.options) !== null && _b !== void 0 ? _b : {};
|
|
216
|
-
return (serverApi === null || serverApi === void 0 ? void 0 : serverApi.version) ? { strict: false, deprecationErrors: false, ...serverApi } : undefined;
|
|
217
|
-
}
|
|
218
|
-
async onInterruptExecution() {
|
|
219
|
-
this.interrupted.set();
|
|
220
|
-
this.currentCursor = null;
|
|
221
|
-
this.resumeMongosAfterInterrupt = await Promise.all(this.mongos.map(async (m) => {
|
|
222
|
-
try {
|
|
223
|
-
return {
|
|
224
|
-
mongo: m,
|
|
225
|
-
resume: await m._suspend()
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
catch (e) {
|
|
229
|
-
return {
|
|
230
|
-
mongo: m,
|
|
231
|
-
resume: null
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
}));
|
|
235
|
-
return !this.resumeMongosAfterInterrupt.find(r => r.resume === null);
|
|
236
|
-
}
|
|
237
|
-
async onResumeExecution() {
|
|
238
|
-
var _a, _b;
|
|
239
|
-
const promises = (_b = (_a = this.resumeMongosAfterInterrupt) === null || _a === void 0 ? void 0 : _a.map(async (r) => {
|
|
240
|
-
if (!this.mongos.find(m => m === r.mongo)) {
|
|
241
|
-
return true;
|
|
242
|
-
}
|
|
243
|
-
if (r.resume === null) {
|
|
244
|
-
return false;
|
|
245
|
-
}
|
|
246
|
-
try {
|
|
247
|
-
await r.resume();
|
|
248
|
-
return true;
|
|
249
|
-
}
|
|
250
|
-
catch (e) {
|
|
251
|
-
return false;
|
|
252
|
-
}
|
|
253
|
-
})) !== null && _b !== void 0 ? _b : [];
|
|
254
|
-
this.resumeMongosAfterInterrupt = undefined;
|
|
255
|
-
const result = await Promise.all(promises);
|
|
256
|
-
this.interrupted.reset();
|
|
257
|
-
return !result.find(r => r === false);
|
|
258
|
-
}
|
|
259
|
-
async getDefaultPrompt() {
|
|
260
|
-
const prefix = this.getDefaultPromptPrefix();
|
|
261
|
-
const topologyInfo = this.getTopologySpecificPrompt();
|
|
262
|
-
let dbname = '';
|
|
263
|
-
try {
|
|
264
|
-
dbname = this.currentDb.getName();
|
|
265
|
-
}
|
|
266
|
-
catch (_a) { }
|
|
267
|
-
return `${[prefix, topologyInfo, dbname].filter(Boolean).join(' ')}> `;
|
|
268
|
-
}
|
|
269
|
-
getDefaultPromptPrefix() {
|
|
270
|
-
var _a, _b, _c, _d;
|
|
271
|
-
const extraConnectionInfo = (_a = this.connectionInfo) === null || _a === void 0 ? void 0 : _a.extraInfo;
|
|
272
|
-
if (extraConnectionInfo === null || extraConnectionInfo === void 0 ? void 0 : extraConnectionInfo.is_data_lake) {
|
|
273
|
-
return 'AtlasDataLake';
|
|
274
|
-
}
|
|
275
|
-
else if ((extraConnectionInfo === null || extraConnectionInfo === void 0 ? void 0 : extraConnectionInfo.is_enterprise) || ((_d = (_c = (_b = this.connectionInfo) === null || _b === void 0 ? void 0 : _b.buildInfo) === null || _c === void 0 ? void 0 : _c.modules) === null || _d === void 0 ? void 0 : _d.indexOf('enterprise')) >= 0) {
|
|
276
|
-
return 'Enterprise';
|
|
277
|
-
}
|
|
278
|
-
return '';
|
|
279
|
-
}
|
|
280
|
-
getTopologySpecificPrompt() {
|
|
281
|
-
var _a, _b, _c, _d;
|
|
282
|
-
const description = (_a = this.currentServiceProvider.getTopology()) === null || _a === void 0 ? void 0 : _a.description;
|
|
283
|
-
if (!description) {
|
|
284
|
-
return '';
|
|
285
|
-
}
|
|
286
|
-
let replicaSet = description.setName;
|
|
287
|
-
let serverTypePrompt = '';
|
|
288
|
-
switch (description.type) {
|
|
289
|
-
case 'Single':
|
|
290
|
-
const singleDetails = this.getTopologySinglePrompt(description);
|
|
291
|
-
replicaSet = (_b = singleDetails === null || singleDetails === void 0 ? void 0 : singleDetails.replicaSet) !== null && _b !== void 0 ? _b : replicaSet;
|
|
292
|
-
serverTypePrompt = (singleDetails === null || singleDetails === void 0 ? void 0 : singleDetails.serverType) ? `[direct: ${singleDetails.serverType}]` : '';
|
|
293
|
-
break;
|
|
294
|
-
case 'ReplicaSetNoPrimary':
|
|
295
|
-
serverTypePrompt = '[secondary]';
|
|
296
|
-
break;
|
|
297
|
-
case 'ReplicaSetWithPrimary':
|
|
298
|
-
serverTypePrompt = '[primary]';
|
|
299
|
-
break;
|
|
300
|
-
case 'Sharded':
|
|
301
|
-
serverTypePrompt = ((_d = (_c = this.connectionInfo) === null || _c === void 0 ? void 0 : _c.extraInfo) === null || _d === void 0 ? void 0 : _d.atlas_version) ? '' : '[mongos]';
|
|
302
|
-
break;
|
|
303
|
-
default:
|
|
304
|
-
return '';
|
|
305
|
-
}
|
|
306
|
-
const setNamePrefix = replicaSet ? `${replicaSet} ` : '';
|
|
307
|
-
return `${setNamePrefix}${serverTypePrompt}`;
|
|
308
|
-
}
|
|
309
|
-
getTopologySinglePrompt(description) {
|
|
310
|
-
var _a;
|
|
311
|
-
if (((_a = description.servers) === null || _a === void 0 ? void 0 : _a.size) !== 1) {
|
|
312
|
-
return undefined;
|
|
313
|
-
}
|
|
314
|
-
const [server] = description.servers.values();
|
|
315
|
-
let serverType;
|
|
316
|
-
switch (server.type) {
|
|
317
|
-
case 'Mongos':
|
|
318
|
-
serverType = 'mongos';
|
|
319
|
-
break;
|
|
320
|
-
case 'RSPrimary':
|
|
321
|
-
serverType = 'primary';
|
|
322
|
-
break;
|
|
323
|
-
case 'RSSecondary':
|
|
324
|
-
serverType = 'secondary';
|
|
325
|
-
break;
|
|
326
|
-
case 'RSArbiter':
|
|
327
|
-
serverType = 'arbiter';
|
|
328
|
-
break;
|
|
329
|
-
case 'RSOther':
|
|
330
|
-
serverType = 'other';
|
|
331
|
-
break;
|
|
332
|
-
case 'Standalone':
|
|
333
|
-
case 'PossiblePrimary':
|
|
334
|
-
case 'RSGhost':
|
|
335
|
-
case 'Unknown':
|
|
336
|
-
default:
|
|
337
|
-
serverType = '';
|
|
338
|
-
}
|
|
339
|
-
return {
|
|
340
|
-
replicaSet: server.setName,
|
|
341
|
-
serverType
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
registerPlugin(plugin) {
|
|
345
|
-
this.plugins.push(plugin);
|
|
346
|
-
}
|
|
347
|
-
transformError(err) {
|
|
348
|
-
if (Object.prototype.toString.call(err) === '[object Error]') {
|
|
349
|
-
if (this.alreadyTransformedErrors.has(err)) {
|
|
350
|
-
return this.alreadyTransformedErrors.get(err);
|
|
351
|
-
}
|
|
352
|
-
const before = err;
|
|
353
|
-
for (const plugin of this.plugins) {
|
|
354
|
-
if (plugin.transformError) {
|
|
355
|
-
err = plugin.transformError(err);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
this.alreadyTransformedErrors.set(before, err);
|
|
359
|
-
}
|
|
360
|
-
return err;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
exports.default = ShellInternalState;
|
|
364
|
-
//# sourceMappingURL=shell-internal-state.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shell-internal-state.js","sourceRoot":"","sources":["../src/shell-internal-state.ts"],"names":[],"mappings":";;;;;AAAA,4CAAyE;AACzE,0EASwC;AAExC,mCAAsC;AACtC,oEAAwC;AAExC,6CAAwC;AACxC,mCAAqC;AACrC,+CAA+C;AAC/C,mCAUiB;AACjB,+CAA8C;AAC9C,oDAAiC;AACjC,8DAA8C;AAC9C,iDAA2D;AAqE3D,MAAqB,kBAAkB;IAyBrC,YAAY,sBAAuC,EAAE,aAAkB,IAAI,qBAAY,EAAE,EAAE,aAA8B,EAAE;;QAZpH,yBAAoB,GAAuB,SAAS,CAAC;QACrD,kBAAa,GAAG,KAAK,CAAC;QAEb,gBAAW,GAAG,IAAI,2BAAa,EAAE,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