@datacamp/learn-vm-scripts 0.0.1-rc.9 → 0.0.2-rc.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/README.md +2 -11
- package/dist/index.cjs +153 -440
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -21,14 +21,6 @@
|
|
|
21
21
|
yarn install
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
### Configuration
|
|
25
|
-
|
|
26
|
-
This project uses environment variables to configure the `executablePath` and `userDataDir` for Puppeteer. The configuration is done using `.env` files.
|
|
27
|
-
|
|
28
|
-
#### Updating .env.development
|
|
29
|
-
|
|
30
|
-
The `.env.development` file should be updated with the values of your local Chrome installation:
|
|
31
|
-
|
|
32
24
|
## Usage
|
|
33
25
|
|
|
34
26
|
This project contains a program that logs in to a cloud provider using Puppeteer.
|
|
@@ -42,7 +34,7 @@ yarn build
|
|
|
42
34
|
To start the file watcher:
|
|
43
35
|
|
|
44
36
|
```sh
|
|
45
|
-
yarn cli -- --inputFilePath <path-to-input-file> --outputFilePath <path-to-output-file>
|
|
37
|
+
yarn cli -- --inputFilePath <path-to-input-file> --outputFilePath <path-to-output-file> --executablePath <path-to-chromium-executable> --userDataDir <path-to-user-data-dir>
|
|
46
38
|
```
|
|
47
39
|
|
|
48
40
|
The program watches the input file for changes.
|
|
@@ -53,6 +45,5 @@ To log in to a cloud provider, write the following JSON object to the input file
|
|
|
53
45
|
```
|
|
54
46
|
|
|
55
47
|
❗️The input has to be written to a single line.
|
|
56
|
-
Each line is parsed individually.
|
|
57
|
-
|
|
58
48
|
When the login process is complete, the program writes a line to the output file.
|
|
49
|
+
After this, the program exits.
|
package/dist/index.cjs
CHANGED
|
@@ -33,344 +33,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// node_modules/dotenv/package.json
|
|
37
|
-
var require_package = __commonJS({
|
|
38
|
-
"node_modules/dotenv/package.json"(exports2, module2) {
|
|
39
|
-
module2.exports = {
|
|
40
|
-
name: "dotenv",
|
|
41
|
-
version: "16.4.5",
|
|
42
|
-
description: "Loads environment variables from .env file",
|
|
43
|
-
main: "lib/main.js",
|
|
44
|
-
types: "lib/main.d.ts",
|
|
45
|
-
exports: {
|
|
46
|
-
".": {
|
|
47
|
-
types: "./lib/main.d.ts",
|
|
48
|
-
require: "./lib/main.js",
|
|
49
|
-
default: "./lib/main.js"
|
|
50
|
-
},
|
|
51
|
-
"./config": "./config.js",
|
|
52
|
-
"./config.js": "./config.js",
|
|
53
|
-
"./lib/env-options": "./lib/env-options.js",
|
|
54
|
-
"./lib/env-options.js": "./lib/env-options.js",
|
|
55
|
-
"./lib/cli-options": "./lib/cli-options.js",
|
|
56
|
-
"./lib/cli-options.js": "./lib/cli-options.js",
|
|
57
|
-
"./package.json": "./package.json"
|
|
58
|
-
},
|
|
59
|
-
scripts: {
|
|
60
|
-
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
61
|
-
lint: "standard",
|
|
62
|
-
"lint-readme": "standard-markdown",
|
|
63
|
-
pretest: "npm run lint && npm run dts-check",
|
|
64
|
-
test: "tap tests/*.js --100 -Rspec",
|
|
65
|
-
"test:coverage": "tap --coverage-report=lcov",
|
|
66
|
-
prerelease: "npm test",
|
|
67
|
-
release: "standard-version"
|
|
68
|
-
},
|
|
69
|
-
repository: {
|
|
70
|
-
type: "git",
|
|
71
|
-
url: "git://github.com/motdotla/dotenv.git"
|
|
72
|
-
},
|
|
73
|
-
funding: "https://dotenvx.com",
|
|
74
|
-
keywords: [
|
|
75
|
-
"dotenv",
|
|
76
|
-
"env",
|
|
77
|
-
".env",
|
|
78
|
-
"environment",
|
|
79
|
-
"variables",
|
|
80
|
-
"config",
|
|
81
|
-
"settings"
|
|
82
|
-
],
|
|
83
|
-
readmeFilename: "README.md",
|
|
84
|
-
license: "BSD-2-Clause",
|
|
85
|
-
devDependencies: {
|
|
86
|
-
"@definitelytyped/dtslint": "^0.0.133",
|
|
87
|
-
"@types/node": "^18.11.3",
|
|
88
|
-
decache: "^4.6.1",
|
|
89
|
-
sinon: "^14.0.1",
|
|
90
|
-
standard: "^17.0.0",
|
|
91
|
-
"standard-markdown": "^7.1.0",
|
|
92
|
-
"standard-version": "^9.5.0",
|
|
93
|
-
tap: "^16.3.0",
|
|
94
|
-
tar: "^6.1.11",
|
|
95
|
-
typescript: "^4.8.4"
|
|
96
|
-
},
|
|
97
|
-
engines: {
|
|
98
|
-
node: ">=12"
|
|
99
|
-
},
|
|
100
|
-
browser: {
|
|
101
|
-
fs: false
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
// node_modules/dotenv/lib/main.js
|
|
108
|
-
var require_main = __commonJS({
|
|
109
|
-
"node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
110
|
-
var fs7 = require("fs");
|
|
111
|
-
var path9 = require("path");
|
|
112
|
-
var os8 = require("os");
|
|
113
|
-
var crypto = require("crypto");
|
|
114
|
-
var packageJson = require_package();
|
|
115
|
-
var version = packageJson.version;
|
|
116
|
-
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
117
|
-
function parse(src) {
|
|
118
|
-
const obj = {};
|
|
119
|
-
let lines = src.toString();
|
|
120
|
-
lines = lines.replace(/\r\n?/mg, "\n");
|
|
121
|
-
let match;
|
|
122
|
-
while ((match = LINE.exec(lines)) != null) {
|
|
123
|
-
const key = match[1];
|
|
124
|
-
let value = match[2] || "";
|
|
125
|
-
value = value.trim();
|
|
126
|
-
const maybeQuote = value[0];
|
|
127
|
-
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
|
|
128
|
-
if (maybeQuote === '"') {
|
|
129
|
-
value = value.replace(/\\n/g, "\n");
|
|
130
|
-
value = value.replace(/\\r/g, "\r");
|
|
131
|
-
}
|
|
132
|
-
obj[key] = value;
|
|
133
|
-
}
|
|
134
|
-
return obj;
|
|
135
|
-
}
|
|
136
|
-
function _parseVault(options) {
|
|
137
|
-
const vaultPath = _vaultPath(options);
|
|
138
|
-
const result = DotenvModule.configDotenv({ path: vaultPath });
|
|
139
|
-
if (!result.parsed) {
|
|
140
|
-
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
141
|
-
err.code = "MISSING_DATA";
|
|
142
|
-
throw err;
|
|
143
|
-
}
|
|
144
|
-
const keys = _dotenvKey(options).split(",");
|
|
145
|
-
const length = keys.length;
|
|
146
|
-
let decrypted;
|
|
147
|
-
for (let i = 0; i < length; i++) {
|
|
148
|
-
try {
|
|
149
|
-
const key = keys[i].trim();
|
|
150
|
-
const attrs = _instructions(result, key);
|
|
151
|
-
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
152
|
-
break;
|
|
153
|
-
} catch (error) {
|
|
154
|
-
if (i + 1 >= length) {
|
|
155
|
-
throw error;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return DotenvModule.parse(decrypted);
|
|
160
|
-
}
|
|
161
|
-
function _log(message) {
|
|
162
|
-
console.log(`[dotenv@${version}][INFO] ${message}`);
|
|
163
|
-
}
|
|
164
|
-
function _warn(message) {
|
|
165
|
-
console.log(`[dotenv@${version}][WARN] ${message}`);
|
|
166
|
-
}
|
|
167
|
-
function _debug(message) {
|
|
168
|
-
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
169
|
-
}
|
|
170
|
-
function _dotenvKey(options) {
|
|
171
|
-
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
172
|
-
return options.DOTENV_KEY;
|
|
173
|
-
}
|
|
174
|
-
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
|
|
175
|
-
return process.env.DOTENV_KEY;
|
|
176
|
-
}
|
|
177
|
-
return "";
|
|
178
|
-
}
|
|
179
|
-
function _instructions(result, dotenvKey) {
|
|
180
|
-
let uri;
|
|
181
|
-
try {
|
|
182
|
-
uri = new URL(dotenvKey);
|
|
183
|
-
} catch (error) {
|
|
184
|
-
if (error.code === "ERR_INVALID_URL") {
|
|
185
|
-
const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
|
|
186
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
187
|
-
throw err;
|
|
188
|
-
}
|
|
189
|
-
throw error;
|
|
190
|
-
}
|
|
191
|
-
const key = uri.password;
|
|
192
|
-
if (!key) {
|
|
193
|
-
const err = new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
194
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
195
|
-
throw err;
|
|
196
|
-
}
|
|
197
|
-
const environment = uri.searchParams.get("environment");
|
|
198
|
-
if (!environment) {
|
|
199
|
-
const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
|
|
200
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
201
|
-
throw err;
|
|
202
|
-
}
|
|
203
|
-
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
|
|
204
|
-
const ciphertext = result.parsed[environmentKey];
|
|
205
|
-
if (!ciphertext) {
|
|
206
|
-
const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
|
|
207
|
-
err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
|
|
208
|
-
throw err;
|
|
209
|
-
}
|
|
210
|
-
return { ciphertext, key };
|
|
211
|
-
}
|
|
212
|
-
function _vaultPath(options) {
|
|
213
|
-
let possibleVaultPath = null;
|
|
214
|
-
if (options && options.path && options.path.length > 0) {
|
|
215
|
-
if (Array.isArray(options.path)) {
|
|
216
|
-
for (const filepath of options.path) {
|
|
217
|
-
if (fs7.existsSync(filepath)) {
|
|
218
|
-
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
} else {
|
|
222
|
-
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
223
|
-
}
|
|
224
|
-
} else {
|
|
225
|
-
possibleVaultPath = path9.resolve(process.cwd(), ".env.vault");
|
|
226
|
-
}
|
|
227
|
-
if (fs7.existsSync(possibleVaultPath)) {
|
|
228
|
-
return possibleVaultPath;
|
|
229
|
-
}
|
|
230
|
-
return null;
|
|
231
|
-
}
|
|
232
|
-
function _resolveHome(envPath) {
|
|
233
|
-
return envPath[0] === "~" ? path9.join(os8.homedir(), envPath.slice(1)) : envPath;
|
|
234
|
-
}
|
|
235
|
-
function _configVault(options) {
|
|
236
|
-
_log("Loading env from encrypted .env.vault");
|
|
237
|
-
const parsed = DotenvModule._parseVault(options);
|
|
238
|
-
let processEnv = process.env;
|
|
239
|
-
if (options && options.processEnv != null) {
|
|
240
|
-
processEnv = options.processEnv;
|
|
241
|
-
}
|
|
242
|
-
DotenvModule.populate(processEnv, parsed, options);
|
|
243
|
-
return { parsed };
|
|
244
|
-
}
|
|
245
|
-
function configDotenv(options) {
|
|
246
|
-
const dotenvPath = path9.resolve(process.cwd(), ".env");
|
|
247
|
-
let encoding = "utf8";
|
|
248
|
-
const debug5 = Boolean(options && options.debug);
|
|
249
|
-
if (options && options.encoding) {
|
|
250
|
-
encoding = options.encoding;
|
|
251
|
-
} else {
|
|
252
|
-
if (debug5) {
|
|
253
|
-
_debug("No encoding is specified. UTF-8 is used by default");
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
let optionPaths = [dotenvPath];
|
|
257
|
-
if (options && options.path) {
|
|
258
|
-
if (!Array.isArray(options.path)) {
|
|
259
|
-
optionPaths = [_resolveHome(options.path)];
|
|
260
|
-
} else {
|
|
261
|
-
optionPaths = [];
|
|
262
|
-
for (const filepath of options.path) {
|
|
263
|
-
optionPaths.push(_resolveHome(filepath));
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
let lastError;
|
|
268
|
-
const parsedAll = {};
|
|
269
|
-
for (const path10 of optionPaths) {
|
|
270
|
-
try {
|
|
271
|
-
const parsed = DotenvModule.parse(fs7.readFileSync(path10, { encoding }));
|
|
272
|
-
DotenvModule.populate(parsedAll, parsed, options);
|
|
273
|
-
} catch (e) {
|
|
274
|
-
if (debug5) {
|
|
275
|
-
_debug(`Failed to load ${path10} ${e.message}`);
|
|
276
|
-
}
|
|
277
|
-
lastError = e;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
let processEnv = process.env;
|
|
281
|
-
if (options && options.processEnv != null) {
|
|
282
|
-
processEnv = options.processEnv;
|
|
283
|
-
}
|
|
284
|
-
DotenvModule.populate(processEnv, parsedAll, options);
|
|
285
|
-
if (lastError) {
|
|
286
|
-
return { parsed: parsedAll, error: lastError };
|
|
287
|
-
} else {
|
|
288
|
-
return { parsed: parsedAll };
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
function config3(options) {
|
|
292
|
-
if (_dotenvKey(options).length === 0) {
|
|
293
|
-
return DotenvModule.configDotenv(options);
|
|
294
|
-
}
|
|
295
|
-
const vaultPath = _vaultPath(options);
|
|
296
|
-
if (!vaultPath) {
|
|
297
|
-
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
298
|
-
return DotenvModule.configDotenv(options);
|
|
299
|
-
}
|
|
300
|
-
return DotenvModule._configVault(options);
|
|
301
|
-
}
|
|
302
|
-
function decrypt(encrypted, keyStr) {
|
|
303
|
-
const key = Buffer.from(keyStr.slice(-64), "hex");
|
|
304
|
-
let ciphertext = Buffer.from(encrypted, "base64");
|
|
305
|
-
const nonce = ciphertext.subarray(0, 12);
|
|
306
|
-
const authTag = ciphertext.subarray(-16);
|
|
307
|
-
ciphertext = ciphertext.subarray(12, -16);
|
|
308
|
-
try {
|
|
309
|
-
const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
|
|
310
|
-
aesgcm.setAuthTag(authTag);
|
|
311
|
-
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
|
|
312
|
-
} catch (error) {
|
|
313
|
-
const isRange = error instanceof RangeError;
|
|
314
|
-
const invalidKeyLength = error.message === "Invalid key length";
|
|
315
|
-
const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
|
|
316
|
-
if (isRange || invalidKeyLength) {
|
|
317
|
-
const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
|
|
318
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
319
|
-
throw err;
|
|
320
|
-
} else if (decryptionFailed) {
|
|
321
|
-
const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
|
|
322
|
-
err.code = "DECRYPTION_FAILED";
|
|
323
|
-
throw err;
|
|
324
|
-
} else {
|
|
325
|
-
throw error;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
function populate(processEnv, parsed, options = {}) {
|
|
330
|
-
const debug5 = Boolean(options && options.debug);
|
|
331
|
-
const override = Boolean(options && options.override);
|
|
332
|
-
if (typeof parsed !== "object") {
|
|
333
|
-
const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
334
|
-
err.code = "OBJECT_REQUIRED";
|
|
335
|
-
throw err;
|
|
336
|
-
}
|
|
337
|
-
for (const key of Object.keys(parsed)) {
|
|
338
|
-
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
339
|
-
if (override === true) {
|
|
340
|
-
processEnv[key] = parsed[key];
|
|
341
|
-
}
|
|
342
|
-
if (debug5) {
|
|
343
|
-
if (override === true) {
|
|
344
|
-
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
345
|
-
} else {
|
|
346
|
-
_debug(`"${key}" is already defined and was NOT overwritten`);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
} else {
|
|
350
|
-
processEnv[key] = parsed[key];
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
var DotenvModule = {
|
|
355
|
-
configDotenv,
|
|
356
|
-
_configVault,
|
|
357
|
-
_parseVault,
|
|
358
|
-
config: config3,
|
|
359
|
-
decrypt,
|
|
360
|
-
parse,
|
|
361
|
-
populate
|
|
362
|
-
};
|
|
363
|
-
module2.exports.configDotenv = DotenvModule.configDotenv;
|
|
364
|
-
module2.exports._configVault = DotenvModule._configVault;
|
|
365
|
-
module2.exports._parseVault = DotenvModule._parseVault;
|
|
366
|
-
module2.exports.config = DotenvModule.config;
|
|
367
|
-
module2.exports.decrypt = DotenvModule.decrypt;
|
|
368
|
-
module2.exports.parse = DotenvModule.parse;
|
|
369
|
-
module2.exports.populate = DotenvModule.populate;
|
|
370
|
-
module2.exports = DotenvModule;
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
|
|
374
36
|
// node_modules/puppeteer-core/lib/esm/third_party/rxjs/rxjs.js
|
|
375
37
|
function __extends(d, b) {
|
|
376
38
|
if (typeof b !== "function" && b !== null)
|
|
@@ -1088,8 +750,8 @@ function of() {
|
|
|
1088
750
|
var scheduler = popScheduler(args);
|
|
1089
751
|
return from(args, scheduler);
|
|
1090
752
|
}
|
|
1091
|
-
function lastValueFrom(source2,
|
|
1092
|
-
var hasConfig = typeof
|
|
753
|
+
function lastValueFrom(source2, config2) {
|
|
754
|
+
var hasConfig = typeof config2 === "object";
|
|
1093
755
|
return new Promise(function(resolve5, reject) {
|
|
1094
756
|
var _hasValue = false;
|
|
1095
757
|
var _value;
|
|
@@ -1103,7 +765,7 @@ function lastValueFrom(source2, config22) {
|
|
|
1103
765
|
if (_hasValue) {
|
|
1104
766
|
resolve5(_value);
|
|
1105
767
|
} else if (hasConfig) {
|
|
1106
|
-
resolve5(
|
|
768
|
+
resolve5(config2.defaultValue);
|
|
1107
769
|
} else {
|
|
1108
770
|
reject(new EmptyError());
|
|
1109
771
|
}
|
|
@@ -1111,8 +773,8 @@ function lastValueFrom(source2, config22) {
|
|
|
1111
773
|
});
|
|
1112
774
|
});
|
|
1113
775
|
}
|
|
1114
|
-
function firstValueFrom(source2,
|
|
1115
|
-
var hasConfig = typeof
|
|
776
|
+
function firstValueFrom(source2, config2) {
|
|
777
|
+
var hasConfig = typeof config2 === "object";
|
|
1116
778
|
return new Promise(function(resolve5, reject) {
|
|
1117
779
|
var subscriber = new SafeSubscriber({
|
|
1118
780
|
next: function(value) {
|
|
@@ -1122,7 +784,7 @@ function firstValueFrom(source2, config22) {
|
|
|
1122
784
|
error: reject,
|
|
1123
785
|
complete: function() {
|
|
1124
786
|
if (hasConfig) {
|
|
1125
|
-
resolve5(
|
|
787
|
+
resolve5(config2.defaultValue);
|
|
1126
788
|
} else {
|
|
1127
789
|
reject(new EmptyError());
|
|
1128
790
|
}
|
|
@@ -1665,15 +1327,15 @@ function retry(configOrCount) {
|
|
|
1665
1327
|
if (configOrCount === void 0) {
|
|
1666
1328
|
configOrCount = Infinity;
|
|
1667
1329
|
}
|
|
1668
|
-
var
|
|
1330
|
+
var config2;
|
|
1669
1331
|
if (configOrCount && typeof configOrCount === "object") {
|
|
1670
|
-
|
|
1332
|
+
config2 = configOrCount;
|
|
1671
1333
|
} else {
|
|
1672
|
-
|
|
1334
|
+
config2 = {
|
|
1673
1335
|
count: configOrCount
|
|
1674
1336
|
};
|
|
1675
1337
|
}
|
|
1676
|
-
var _a4 =
|
|
1338
|
+
var _a4 = config2.count, count = _a4 === void 0 ? Infinity : _a4, delay2 = config2.delay, _b2 = config2.resetOnSuccess, resetOnSuccess = _b2 === void 0 ? false : _b2;
|
|
1677
1339
|
return count <= 0 ? identity : operate(function(source2, subscriber) {
|
|
1678
1340
|
var soFar = 0;
|
|
1679
1341
|
var innerSub;
|
|
@@ -44171,22 +43833,22 @@ var require_transfer = __commonJS({
|
|
|
44171
43833
|
}
|
|
44172
43834
|
}
|
|
44173
43835
|
};
|
|
44174
|
-
function uploadFrom(source2,
|
|
44175
|
-
const resolver = new TransferResolver(
|
|
44176
|
-
const fullCommand = `${
|
|
44177
|
-
return
|
|
43836
|
+
function uploadFrom(source2, config2) {
|
|
43837
|
+
const resolver = new TransferResolver(config2.ftp, config2.tracker);
|
|
43838
|
+
const fullCommand = `${config2.command} ${config2.remotePath}`;
|
|
43839
|
+
return config2.ftp.handle(fullCommand, (res, task) => {
|
|
44178
43840
|
if (res instanceof Error) {
|
|
44179
43841
|
resolver.onError(task, res);
|
|
44180
43842
|
} else if (res.code === 150 || res.code === 125) {
|
|
44181
|
-
const dataSocket =
|
|
43843
|
+
const dataSocket = config2.ftp.dataSocket;
|
|
44182
43844
|
if (!dataSocket) {
|
|
44183
43845
|
resolver.onError(task, new Error("Upload should begin but no data connection is available."));
|
|
44184
43846
|
return;
|
|
44185
43847
|
}
|
|
44186
43848
|
const canUpload = "getCipher" in dataSocket ? dataSocket.getCipher() !== void 0 : true;
|
|
44187
43849
|
onConditionOrEvent(canUpload, dataSocket, "secureConnect", () => {
|
|
44188
|
-
|
|
44189
|
-
resolver.onDataStart(
|
|
43850
|
+
config2.ftp.log(`Uploading to ${(0, netUtils_1.describeAddress)(dataSocket)} (${(0, netUtils_1.describeTLS)(dataSocket)})`);
|
|
43851
|
+
resolver.onDataStart(config2.remotePath, config2.type);
|
|
44190
43852
|
(0, stream_1.pipeline)(source2, dataSocket, (err) => {
|
|
44191
43853
|
if (err) {
|
|
44192
43854
|
resolver.onError(task, err);
|
|
@@ -44203,22 +43865,22 @@ var require_transfer = __commonJS({
|
|
|
44203
43865
|
});
|
|
44204
43866
|
}
|
|
44205
43867
|
exports2.uploadFrom = uploadFrom;
|
|
44206
|
-
function downloadTo(destination,
|
|
44207
|
-
if (!
|
|
43868
|
+
function downloadTo(destination, config2) {
|
|
43869
|
+
if (!config2.ftp.dataSocket) {
|
|
44208
43870
|
throw new Error("Download will be initiated but no data connection is available.");
|
|
44209
43871
|
}
|
|
44210
|
-
const resolver = new TransferResolver(
|
|
44211
|
-
return
|
|
43872
|
+
const resolver = new TransferResolver(config2.ftp, config2.tracker);
|
|
43873
|
+
return config2.ftp.handle(config2.command, (res, task) => {
|
|
44212
43874
|
if (res instanceof Error) {
|
|
44213
43875
|
resolver.onError(task, res);
|
|
44214
43876
|
} else if (res.code === 150 || res.code === 125) {
|
|
44215
|
-
const dataSocket =
|
|
43877
|
+
const dataSocket = config2.ftp.dataSocket;
|
|
44216
43878
|
if (!dataSocket) {
|
|
44217
43879
|
resolver.onError(task, new Error("Download should begin but no data connection is available."));
|
|
44218
43880
|
return;
|
|
44219
43881
|
}
|
|
44220
|
-
|
|
44221
|
-
resolver.onDataStart(
|
|
43882
|
+
config2.ftp.log(`Downloading from ${(0, netUtils_1.describeAddress)(dataSocket)} (${(0, netUtils_1.describeTLS)(dataSocket)})`);
|
|
43883
|
+
resolver.onDataStart(config2.remotePath, config2.type);
|
|
44222
43884
|
(0, stream_1.pipeline)(dataSocket, destination, (err) => {
|
|
44223
43885
|
if (err) {
|
|
44224
43886
|
resolver.onError(task, err);
|
|
@@ -44227,7 +43889,7 @@ var require_transfer = __commonJS({
|
|
|
44227
43889
|
}
|
|
44228
43890
|
});
|
|
44229
43891
|
} else if (res.code === 350) {
|
|
44230
|
-
|
|
43892
|
+
config2.ftp.send("RETR " + config2.remotePath);
|
|
44231
43893
|
} else if ((0, parseControlResponse_1.positiveCompletion)(res.code)) {
|
|
44232
43894
|
resolver.onControlDone(task, res);
|
|
44233
43895
|
} else if ((0, parseControlResponse_1.positiveIntermediate)(res.code)) {
|
|
@@ -48051,7 +47713,7 @@ var require_source_map = __commonJS({
|
|
|
48051
47713
|
});
|
|
48052
47714
|
|
|
48053
47715
|
// node_modules/escodegen/package.json
|
|
48054
|
-
var
|
|
47716
|
+
var require_package = __commonJS({
|
|
48055
47717
|
"node_modules/escodegen/package.json"(exports2, module2) {
|
|
48056
47718
|
module2.exports = {
|
|
48057
47719
|
name: "escodegen",
|
|
@@ -50192,7 +49854,7 @@ var require_escodegen = __commonJS({
|
|
|
50192
49854
|
semicolons: false
|
|
50193
49855
|
};
|
|
50194
49856
|
FORMAT_DEFAULTS = getDefaultOptions().format;
|
|
50195
|
-
exports2.version =
|
|
49857
|
+
exports2.version = require_package().version;
|
|
50196
49858
|
exports2.generate = generate;
|
|
50197
49859
|
exports2.attachComments = estraverse.attachComments;
|
|
50198
49860
|
exports2.Precedence = updateDeeply({}, Precedence);
|
|
@@ -56355,13 +56017,13 @@ var require_esprima = __commonJS({
|
|
|
56355
56017
|
return Reader2;
|
|
56356
56018
|
}();
|
|
56357
56019
|
var Tokenizer = function() {
|
|
56358
|
-
function Tokenizer2(code,
|
|
56020
|
+
function Tokenizer2(code, config2) {
|
|
56359
56021
|
this.errorHandler = new error_handler_1.ErrorHandler();
|
|
56360
|
-
this.errorHandler.tolerant =
|
|
56022
|
+
this.errorHandler.tolerant = config2 ? typeof config2.tolerant === "boolean" && config2.tolerant : false;
|
|
56361
56023
|
this.scanner = new scanner_1.Scanner(code, this.errorHandler);
|
|
56362
|
-
this.scanner.trackComment =
|
|
56363
|
-
this.trackRange =
|
|
56364
|
-
this.trackLoc =
|
|
56024
|
+
this.scanner.trackComment = config2 ? typeof config2.comment === "boolean" && config2.comment : false;
|
|
56025
|
+
this.trackRange = config2 ? typeof config2.range === "boolean" && config2.range : false;
|
|
56026
|
+
this.trackLoc = config2 ? typeof config2.loc === "boolean" && config2.loc : false;
|
|
56365
56027
|
this.buffer = [];
|
|
56366
56028
|
this.reader = new Reader();
|
|
56367
56029
|
}
|
|
@@ -59937,7 +59599,7 @@ var require_namedTypes = __commonJS({
|
|
|
59937
59599
|
});
|
|
59938
59600
|
|
|
59939
59601
|
// node_modules/ast-types/main.js
|
|
59940
|
-
var
|
|
59602
|
+
var require_main = __commonJS({
|
|
59941
59603
|
"node_modules/ast-types/main.js"(exports2) {
|
|
59942
59604
|
"use strict";
|
|
59943
59605
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -60022,7 +59684,7 @@ var require_degenerator = __commonJS({
|
|
|
60022
59684
|
var util_1 = require("util");
|
|
60023
59685
|
var escodegen_1 = require_escodegen();
|
|
60024
59686
|
var esprima_1 = require_esprima();
|
|
60025
|
-
var ast_types_1 =
|
|
59687
|
+
var ast_types_1 = require_main();
|
|
60026
59688
|
function degenerator(code, _names) {
|
|
60027
59689
|
if (!Array.isArray(_names)) {
|
|
60028
59690
|
throw new TypeError('an array of async function "names" is required');
|
|
@@ -69955,23 +69617,23 @@ var require_build3 = __commonJS({
|
|
|
69955
69617
|
const configPath = argv3[configKey] || configLookup[configKey];
|
|
69956
69618
|
if (configPath) {
|
|
69957
69619
|
try {
|
|
69958
|
-
let
|
|
69620
|
+
let config2 = null;
|
|
69959
69621
|
const resolvedConfigPath = mixin3.resolve(mixin3.cwd(), configPath);
|
|
69960
69622
|
const resolveConfig = flags.configs[configKey];
|
|
69961
69623
|
if (typeof resolveConfig === "function") {
|
|
69962
69624
|
try {
|
|
69963
|
-
|
|
69625
|
+
config2 = resolveConfig(resolvedConfigPath);
|
|
69964
69626
|
} catch (e) {
|
|
69965
|
-
|
|
69627
|
+
config2 = e;
|
|
69966
69628
|
}
|
|
69967
|
-
if (
|
|
69968
|
-
error =
|
|
69629
|
+
if (config2 instanceof Error) {
|
|
69630
|
+
error = config2;
|
|
69969
69631
|
return;
|
|
69970
69632
|
}
|
|
69971
69633
|
} else {
|
|
69972
|
-
|
|
69634
|
+
config2 = mixin3.require(resolvedConfigPath);
|
|
69973
69635
|
}
|
|
69974
|
-
setConfigObject(
|
|
69636
|
+
setConfigObject(config2);
|
|
69975
69637
|
} catch (ex) {
|
|
69976
69638
|
if (ex.name === "PermissionDenied")
|
|
69977
69639
|
error = ex;
|
|
@@ -69981,9 +69643,9 @@ var require_build3 = __commonJS({
|
|
|
69981
69643
|
}
|
|
69982
69644
|
});
|
|
69983
69645
|
}
|
|
69984
|
-
function setConfigObject(
|
|
69985
|
-
Object.keys(
|
|
69986
|
-
const value =
|
|
69646
|
+
function setConfigObject(config2, prev) {
|
|
69647
|
+
Object.keys(config2).forEach(function(key) {
|
|
69648
|
+
const value = config2[key];
|
|
69987
69649
|
const fullKey = prev ? prev + "." + key : key;
|
|
69988
69650
|
if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
|
|
69989
69651
|
setConfigObject(value, fullKey);
|
|
@@ -76514,23 +76176,23 @@ var YargsParser = class {
|
|
|
76514
76176
|
const configPath = argv3[configKey] || configLookup[configKey];
|
|
76515
76177
|
if (configPath) {
|
|
76516
76178
|
try {
|
|
76517
|
-
let
|
|
76179
|
+
let config2 = null;
|
|
76518
76180
|
const resolvedConfigPath = mixin2.resolve(mixin2.cwd(), configPath);
|
|
76519
76181
|
const resolveConfig = flags.configs[configKey];
|
|
76520
76182
|
if (typeof resolveConfig === "function") {
|
|
76521
76183
|
try {
|
|
76522
|
-
|
|
76184
|
+
config2 = resolveConfig(resolvedConfigPath);
|
|
76523
76185
|
} catch (e) {
|
|
76524
|
-
|
|
76186
|
+
config2 = e;
|
|
76525
76187
|
}
|
|
76526
|
-
if (
|
|
76527
|
-
error =
|
|
76188
|
+
if (config2 instanceof Error) {
|
|
76189
|
+
error = config2;
|
|
76528
76190
|
return;
|
|
76529
76191
|
}
|
|
76530
76192
|
} else {
|
|
76531
|
-
|
|
76193
|
+
config2 = mixin2.require(resolvedConfigPath);
|
|
76532
76194
|
}
|
|
76533
|
-
setConfigObject(
|
|
76195
|
+
setConfigObject(config2);
|
|
76534
76196
|
} catch (ex) {
|
|
76535
76197
|
if (ex.name === "PermissionDenied")
|
|
76536
76198
|
error = ex;
|
|
@@ -76540,9 +76202,9 @@ var YargsParser = class {
|
|
|
76540
76202
|
}
|
|
76541
76203
|
});
|
|
76542
76204
|
}
|
|
76543
|
-
function setConfigObject(
|
|
76544
|
-
Object.keys(
|
|
76545
|
-
const value =
|
|
76205
|
+
function setConfigObject(config2, prev) {
|
|
76206
|
+
Object.keys(config2).forEach(function(key) {
|
|
76207
|
+
const value = config2[key];
|
|
76546
76208
|
const fullKey = prev ? prev + "." + key : key;
|
|
76547
76209
|
if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
|
|
76548
76210
|
setConfigObject(value, fullKey);
|
|
@@ -77691,11 +77353,11 @@ var CommandInstance = class {
|
|
|
77691
77353
|
});
|
|
77692
77354
|
if (!unparsed.length)
|
|
77693
77355
|
return;
|
|
77694
|
-
const
|
|
77356
|
+
const config2 = Object.assign({}, options.configuration, {
|
|
77695
77357
|
"populate--": false
|
|
77696
77358
|
});
|
|
77697
77359
|
const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
|
|
77698
|
-
configuration:
|
|
77360
|
+
configuration: config2
|
|
77699
77361
|
}));
|
|
77700
77362
|
if (parsed.error) {
|
|
77701
77363
|
yargs.getInternalMethods().getUsageInstance().fail(parsed.error.message, parsed.error);
|
|
@@ -78918,31 +78580,31 @@ ${customMsgs.join("\n")}` : "";
|
|
|
78918
78580
|
// node_modules/yargs/build/lib/utils/apply-extends.js
|
|
78919
78581
|
var previouslyVisitedConfigs = [];
|
|
78920
78582
|
var shim2;
|
|
78921
|
-
function applyExtends(
|
|
78583
|
+
function applyExtends(config2, cwd, mergeExtends, _shim) {
|
|
78922
78584
|
shim2 = _shim;
|
|
78923
78585
|
let defaultConfig = {};
|
|
78924
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
78925
|
-
if (typeof
|
|
78586
|
+
if (Object.prototype.hasOwnProperty.call(config2, "extends")) {
|
|
78587
|
+
if (typeof config2.extends !== "string")
|
|
78926
78588
|
return defaultConfig;
|
|
78927
|
-
const isPath = /\.json|\..*rc$/.test(
|
|
78589
|
+
const isPath = /\.json|\..*rc$/.test(config2.extends);
|
|
78928
78590
|
let pathToDefault = null;
|
|
78929
78591
|
if (!isPath) {
|
|
78930
78592
|
try {
|
|
78931
|
-
pathToDefault = require.resolve(
|
|
78593
|
+
pathToDefault = require.resolve(config2.extends);
|
|
78932
78594
|
} catch (_err) {
|
|
78933
|
-
return
|
|
78595
|
+
return config2;
|
|
78934
78596
|
}
|
|
78935
78597
|
} else {
|
|
78936
|
-
pathToDefault = getPathToDefaultConfig(cwd,
|
|
78598
|
+
pathToDefault = getPathToDefaultConfig(cwd, config2.extends);
|
|
78937
78599
|
}
|
|
78938
78600
|
checkForCircularExtends(pathToDefault);
|
|
78939
78601
|
previouslyVisitedConfigs.push(pathToDefault);
|
|
78940
|
-
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(
|
|
78941
|
-
delete
|
|
78602
|
+
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config2.extends);
|
|
78603
|
+
delete config2.extends;
|
|
78942
78604
|
defaultConfig = applyExtends(defaultConfig, shim2.path.dirname(pathToDefault), mergeExtends, shim2);
|
|
78943
78605
|
}
|
|
78944
78606
|
previouslyVisitedConfigs = [];
|
|
78945
|
-
return mergeExtends ? mergeDeep(defaultConfig,
|
|
78607
|
+
return mergeExtends ? mergeDeep(defaultConfig, config2) : Object.assign({}, defaultConfig, config2);
|
|
78946
78608
|
}
|
|
78947
78609
|
function checkForCircularExtends(cfgPath) {
|
|
78948
78610
|
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
|
|
@@ -78952,17 +78614,17 @@ function checkForCircularExtends(cfgPath) {
|
|
|
78952
78614
|
function getPathToDefaultConfig(cwd, pathToExtend) {
|
|
78953
78615
|
return shim2.path.resolve(cwd, pathToExtend);
|
|
78954
78616
|
}
|
|
78955
|
-
function mergeDeep(config1,
|
|
78617
|
+
function mergeDeep(config1, config2) {
|
|
78956
78618
|
const target = {};
|
|
78957
78619
|
function isObject(obj) {
|
|
78958
78620
|
return obj && typeof obj === "object" && !Array.isArray(obj);
|
|
78959
78621
|
}
|
|
78960
78622
|
Object.assign(target, config1);
|
|
78961
|
-
for (const key of Object.keys(
|
|
78962
|
-
if (isObject(
|
|
78963
|
-
target[key] = mergeDeep(config1[key],
|
|
78623
|
+
for (const key of Object.keys(config2)) {
|
|
78624
|
+
if (isObject(config2[key]) && isObject(target[key])) {
|
|
78625
|
+
target[key] = mergeDeep(config1[key], config2[key]);
|
|
78964
78626
|
} else {
|
|
78965
|
-
target[key] =
|
|
78627
|
+
target[key] = config2[key];
|
|
78966
78628
|
}
|
|
78967
78629
|
}
|
|
78968
78630
|
return target;
|
|
@@ -79718,9 +79380,9 @@ var YargsInstance = class {
|
|
|
79718
79380
|
}
|
|
79719
79381
|
return maybePromise;
|
|
79720
79382
|
}
|
|
79721
|
-
parserConfiguration(
|
|
79722
|
-
argsert("<object>", [
|
|
79723
|
-
__classPrivateFieldSet(this, _YargsInstance_parserConfig,
|
|
79383
|
+
parserConfiguration(config2) {
|
|
79384
|
+
argsert("<object>", [config2], arguments.length);
|
|
79385
|
+
__classPrivateFieldSet(this, _YargsInstance_parserConfig, config2, "f");
|
|
79724
79386
|
return this;
|
|
79725
79387
|
}
|
|
79726
79388
|
pkgConf(key, rootPath) {
|
|
@@ -79892,9 +79554,9 @@ var YargsInstance = class {
|
|
|
79892
79554
|
return this;
|
|
79893
79555
|
}
|
|
79894
79556
|
}
|
|
79895
|
-
usageConfiguration(
|
|
79896
|
-
argsert("<object>", [
|
|
79897
|
-
__classPrivateFieldSet(this, _YargsInstance_usageConfig,
|
|
79557
|
+
usageConfiguration(config2) {
|
|
79558
|
+
argsert("<object>", [config2], arguments.length);
|
|
79559
|
+
__classPrivateFieldSet(this, _YargsInstance_usageConfig, config2, "f");
|
|
79898
79560
|
return this;
|
|
79899
79561
|
}
|
|
79900
79562
|
version(opt, msg, ver) {
|
|
@@ -80300,11 +79962,11 @@ var YargsInstance = class {
|
|
|
80300
79962
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").__ = __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__;
|
|
80301
79963
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration = this[kGetParserConfiguration]();
|
|
80302
79964
|
const populateDoubleDash = !!__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration["populate--"];
|
|
80303
|
-
const
|
|
79965
|
+
const config2 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
|
|
80304
79966
|
"populate--": true
|
|
80305
79967
|
});
|
|
80306
79968
|
const parsed = __classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.detailed(args, Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f"), {
|
|
80307
|
-
configuration: { "parse-positional-numbers": false, ...
|
|
79969
|
+
configuration: { "parse-positional-numbers": false, ...config2 }
|
|
80308
79970
|
}));
|
|
80309
79971
|
const argv2 = Object.assign(parsed.argv, __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"));
|
|
80310
79972
|
let argvPromise = void 0;
|
|
@@ -84229,9 +83891,6 @@ var nullableType = ZodNullable.create;
|
|
|
84229
83891
|
var preprocessType = ZodEffects.createWithPreprocess;
|
|
84230
83892
|
var pipelineType = ZodPipeline.create;
|
|
84231
83893
|
|
|
84232
|
-
// src/setup.ts
|
|
84233
|
-
var dotenv = __toESM(require_main(), 1);
|
|
84234
|
-
|
|
84235
83894
|
// node_modules/puppeteer-core/lib/esm/puppeteer/api/api.js
|
|
84236
83895
|
init_Browser();
|
|
84237
83896
|
init_BrowserContext();
|
|
@@ -93646,8 +93305,8 @@ var import_progress = __toESM(require_progress(), 1);
|
|
|
93646
93305
|
// node_modules/yargs/yargs.mjs
|
|
93647
93306
|
var import_build = __toESM(require_build5(), 1);
|
|
93648
93307
|
var { applyExtends: applyExtends2, cjsPlatformShim, Parser: Parser2, processArgv, Yargs: Yargs2 } = import_build.default;
|
|
93649
|
-
Yargs2.applyExtends = (
|
|
93650
|
-
return applyExtends2(
|
|
93308
|
+
Yargs2.applyExtends = (config2, cwd, mergeExtends) => {
|
|
93309
|
+
return applyExtends2(config2, cwd, mergeExtends, cjsPlatformShim);
|
|
93651
93310
|
};
|
|
93652
93311
|
Yargs2.hideBin = processArgv.hideBin;
|
|
93653
93312
|
Yargs2.Parser = Parser2;
|
|
@@ -94611,16 +94270,17 @@ var {
|
|
|
94611
94270
|
var puppeteer_core_default = puppeteer;
|
|
94612
94271
|
|
|
94613
94272
|
// src/setup.ts
|
|
94614
|
-
|
|
94615
|
-
|
|
94616
|
-
|
|
94273
|
+
async function setupBrowser({
|
|
94274
|
+
executablePath: executablePath2,
|
|
94275
|
+
userDataDir
|
|
94276
|
+
}) {
|
|
94617
94277
|
const browser = await puppeteer_core_default.launch({
|
|
94618
94278
|
args: ["--start-maximized", "--enable-save-password-bubble"],
|
|
94619
|
-
executablePath:
|
|
94279
|
+
executablePath: executablePath2,
|
|
94620
94280
|
headless: false,
|
|
94621
94281
|
defaultViewport: null,
|
|
94622
94282
|
ignoreDefaultArgs: ["--enable-automation"],
|
|
94623
|
-
userDataDir
|
|
94283
|
+
userDataDir
|
|
94624
94284
|
});
|
|
94625
94285
|
const pages = await browser.pages();
|
|
94626
94286
|
if (pages[0] !== void 0) {
|
|
@@ -95718,6 +95378,15 @@ async function loginToDatabricks({
|
|
|
95718
95378
|
spinner.succeed(source_default.green("Logged in to Databricks successfully"));
|
|
95719
95379
|
}
|
|
95720
95380
|
|
|
95381
|
+
// src/resetChrome.ts
|
|
95382
|
+
var import_node_child_process = require("node:child_process");
|
|
95383
|
+
var import_promises3 = require("node:fs/promises");
|
|
95384
|
+
var resetChrome = async ({ userDataDir }) => {
|
|
95385
|
+
const stdout = (0, import_node_child_process.execSync)("taskkill /IM chrome.exe /F");
|
|
95386
|
+
console.log("Result from killing chrome.exe:", stdout.toString());
|
|
95387
|
+
await (0, import_promises3.rm)(userDataDir, { recursive: true, force: true });
|
|
95388
|
+
};
|
|
95389
|
+
|
|
95721
95390
|
// src/startInputWatcher.ts
|
|
95722
95391
|
var Input = objectType({
|
|
95723
95392
|
cloudProvider: enumType(["aws", "azure", "databricks"]),
|
|
@@ -95725,12 +95394,19 @@ var Input = objectType({
|
|
|
95725
95394
|
url: stringType(),
|
|
95726
95395
|
username: stringType()
|
|
95727
95396
|
});
|
|
95728
|
-
var handleInput = async (
|
|
95397
|
+
var handleInput = async ({
|
|
95398
|
+
line,
|
|
95399
|
+
userDataDir,
|
|
95400
|
+
executablePath: executablePath2
|
|
95401
|
+
}) => {
|
|
95729
95402
|
try {
|
|
95730
95403
|
const { cloudProvider, url, password, username } = Input.parse(
|
|
95731
95404
|
JSON.parse(line)
|
|
95732
95405
|
);
|
|
95733
|
-
const { browser, page } = await setupBrowser(
|
|
95406
|
+
const { browser, page } = await setupBrowser({
|
|
95407
|
+
executablePath: executablePath2,
|
|
95408
|
+
userDataDir
|
|
95409
|
+
});
|
|
95734
95410
|
switch (cloudProvider) {
|
|
95735
95411
|
case "azure":
|
|
95736
95412
|
await loginToAzure({ url, username, page, password });
|
|
@@ -95759,33 +95435,70 @@ var handleInput = async (line) => {
|
|
|
95759
95435
|
console.error(source_default.red("Unsupported cloud provider"));
|
|
95760
95436
|
}
|
|
95761
95437
|
} catch (error) {
|
|
95762
|
-
console.error(source_default.red(`Error: ${error.message}`));
|
|
95438
|
+
console.error(source_default.red(`Error: "${error.message}" on input ${line}`));
|
|
95439
|
+
}
|
|
95440
|
+
};
|
|
95441
|
+
var createFileIfNotExists = async (filePath) => {
|
|
95442
|
+
try {
|
|
95443
|
+
await fs6.access(filePath);
|
|
95444
|
+
} catch {
|
|
95445
|
+
const handle = await fs6.open(filePath, "w");
|
|
95446
|
+
await handle.close();
|
|
95763
95447
|
}
|
|
95764
95448
|
};
|
|
95765
95449
|
var startInputWatcher = async ({
|
|
95766
95450
|
inputFilePath,
|
|
95767
|
-
outputFilePath
|
|
95451
|
+
outputFilePath,
|
|
95452
|
+
executablePath: executablePath2,
|
|
95453
|
+
userDataDir
|
|
95768
95454
|
}) => {
|
|
95769
95455
|
const outputFileHandle = await fs6.open(outputFilePath, "a");
|
|
95770
|
-
|
|
95771
|
-
|
|
95772
|
-
|
|
95773
|
-
}
|
|
95456
|
+
let lastInput = void 0;
|
|
95457
|
+
await createFileIfNotExists(inputFilePath);
|
|
95458
|
+
const checkInputFile = async () => {
|
|
95774
95459
|
const fileContent = await fs6.readFile(inputFilePath, { encoding: "utf-8" });
|
|
95775
95460
|
const lines = fileContent.split(/\r?\n/);
|
|
95776
|
-
const
|
|
95777
|
-
if (
|
|
95461
|
+
const newInput = lines[0]?.trim();
|
|
95462
|
+
if (newInput == null || newInput === "") {
|
|
95463
|
+
console.log("No input");
|
|
95464
|
+
return;
|
|
95465
|
+
}
|
|
95466
|
+
if (lastInput != null && newInput === lastInput) {
|
|
95467
|
+
console.log("Input already processed");
|
|
95468
|
+
return;
|
|
95469
|
+
}
|
|
95470
|
+
if (lastInput != null) {
|
|
95471
|
+
console.log("Resetting Chrome");
|
|
95472
|
+
await resetChrome({ userDataDir });
|
|
95473
|
+
}
|
|
95474
|
+
await handleInput({ line: newInput, userDataDir, executablePath: executablePath2 });
|
|
95475
|
+
await outputFileHandle.appendFile(`Done: ${newInput}`);
|
|
95476
|
+
lastInput = newInput;
|
|
95477
|
+
};
|
|
95478
|
+
await checkInputFile();
|
|
95479
|
+
console.log("Waiting for input");
|
|
95480
|
+
for await (const event of fs6.watch(inputFilePath)) {
|
|
95481
|
+
if (event.eventType !== "change") {
|
|
95778
95482
|
continue;
|
|
95779
95483
|
}
|
|
95780
|
-
await
|
|
95781
|
-
await outputFileHandle.appendFile(`Done: ${firstLine}`);
|
|
95484
|
+
await checkInputFile();
|
|
95782
95485
|
}
|
|
95783
95486
|
};
|
|
95784
95487
|
|
|
95785
95488
|
// src/index.ts
|
|
95786
95489
|
var argv = yargs_default(process.argv.slice(2)).options({
|
|
95787
95490
|
inputFilePath: { demandOption: true, type: "string" },
|
|
95788
|
-
outputFilePath: { demandOption: true, type: "string" }
|
|
95491
|
+
outputFilePath: { demandOption: true, type: "string" },
|
|
95492
|
+
userDataDir: {
|
|
95493
|
+
demandOption: true,
|
|
95494
|
+
type: "string",
|
|
95495
|
+
description: "Path to the browser data directory"
|
|
95496
|
+
},
|
|
95497
|
+
executablePath: {
|
|
95498
|
+
demandOption: true,
|
|
95499
|
+
type: "string",
|
|
95500
|
+
description: "Path to the browser executable"
|
|
95501
|
+
}
|
|
95789
95502
|
}).parseSync();
|
|
95790
95503
|
void startInputWatcher(argv);
|
|
95791
95504
|
/*! Bundled license information:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datacamp/learn-vm-scripts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-rc.1",
|
|
4
4
|
"repository": "git@github.com:datacamp-engineering/learn-vm-scripts.git",
|
|
5
5
|
"description": "Scripts used by VMs in learn.",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"lint": "eslint --ext ts .",
|
|
18
18
|
"deduplicate": "yarn-deduplicate",
|
|
19
19
|
"cli": "node dist/index.cjs",
|
|
20
|
-
"test": "vitest"
|
|
20
|
+
"test": "vitest",
|
|
21
|
+
"prepublish": "yarn build"
|
|
21
22
|
},
|
|
22
23
|
"keywords": [],
|
|
23
24
|
"author": "Content Platform <content-platform@datacamp.com>",
|