@gadgetinc/ggt 0.1.18 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/bin/dev.js +24 -0
- package/bin/run.js +11 -0
- package/lib/__generated__/graphql.js +6 -9
- package/lib/__generated__/graphql.js.map +1 -1
- package/lib/commands/help.js +21 -36
- package/lib/commands/help.js.map +1 -1
- package/lib/commands/list.js +29 -55
- package/lib/commands/list.js.map +1 -1
- package/lib/commands/login.js +13 -29
- package/lib/commands/login.js.map +1 -1
- package/lib/commands/logout.js +17 -34
- package/lib/commands/logout.js.map +1 -1
- package/lib/commands/sync.js +501 -463
- package/lib/commands/sync.js.map +1 -1
- package/lib/commands/whoami.js +17 -34
- package/lib/commands/whoami.js.map +1 -1
- package/lib/index.js +2 -5
- package/lib/index.js.map +1 -1
- package/lib/utils/base-command.js +105 -146
- package/lib/utils/base-command.js.map +1 -1
- package/lib/utils/client.js +104 -113
- package/lib/utils/client.js.map +1 -1
- package/lib/utils/context.js +63 -119
- package/lib/utils/context.js.map +1 -1
- package/lib/utils/errors.js +161 -242
- package/lib/utils/errors.js.map +1 -1
- package/lib/utils/flags.js +23 -26
- package/lib/utils/flags.js.map +1 -1
- package/lib/utils/fs-utils.js +50 -73
- package/lib/utils/fs-utils.js.map +1 -1
- package/lib/utils/help.js +19 -26
- package/lib/utils/help.js.map +1 -1
- package/lib/utils/promise.js +32 -78
- package/lib/utils/promise.js.map +1 -1
- package/lib/utils/sleep.js +6 -11
- package/lib/utils/sleep.js.map +1 -1
- package/npm-shrinkwrap.json +7848 -7077
- package/oclif.manifest.json +1 -21
- package/package.json +49 -49
- package/bin/dev +0 -20
- package/bin/run +0 -7
- package/lib/__generated__/graphql.d.ts +0 -294
- package/lib/commands/help.d.ts +0 -14
- package/lib/commands/list.d.ts +0 -18
- package/lib/commands/login.d.ts +0 -7
- package/lib/commands/logout.d.ts +0 -7
- package/lib/commands/sync.d.ts +0 -146
- package/lib/commands/whoami.d.ts +0 -7
- package/lib/index.d.ts +0 -1
- package/lib/utils/base-command.d.ts +0 -64
- package/lib/utils/client.d.ts +0 -42
- package/lib/utils/context.d.ts +0 -57
- package/lib/utils/errors.d.ts +0 -100
- package/lib/utils/flags.d.ts +0 -1
- package/lib/utils/fs-utils.d.ts +0 -21
- package/lib/utils/help.d.ts +0 -19
- package/lib/utils/promise.d.ts +0 -35
- package/lib/utils/sleep.d.ts +0 -5
|
@@ -1,85 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const ts_dedent_1 = tslib_1.__importDefault(require("ts-dedent"));
|
|
18
|
-
const context_1 = require("./context");
|
|
19
|
-
const errors_3 = require("./errors");
|
|
1
|
+
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
2
|
+
import { Command, Flags, settings } from "@oclif/core";
|
|
3
|
+
import { CLIError as CLIError2 } from "@oclif/core/lib/errors/index.js";
|
|
4
|
+
import { CLIError, ExitError } from "@oclif/errors";
|
|
5
|
+
import * as Sentry from "@sentry/node";
|
|
6
|
+
import chalkTemplate from "chalk-template";
|
|
7
|
+
import Debug from "debug";
|
|
8
|
+
import getPort from "get-port";
|
|
9
|
+
import inquirer from "inquirer";
|
|
10
|
+
import notifier from "node-notifier";
|
|
11
|
+
import http from "node:http";
|
|
12
|
+
import path from "node:path";
|
|
13
|
+
import open from "open";
|
|
14
|
+
import { dedent } from "ts-dedent";
|
|
15
|
+
import { context } from "./context.js";
|
|
16
|
+
import { BaseError, UnexpectedError } from "./errors.js";
|
|
20
17
|
/**
|
|
21
18
|
* BaseCommand is the base class for all commands in the Gadget CLI.
|
|
22
|
-
*/
|
|
23
|
-
class BaseCommand extends core_1.Command {
|
|
24
|
-
constructor(argv, config) {
|
|
25
|
-
super(argv, config);
|
|
26
|
-
/**
|
|
27
|
-
* Determines whether the command requires the user to be logged in or not.
|
|
28
|
-
*
|
|
29
|
-
* If true and the user is not logged in, the user will be prompted to login before the underlying command is
|
|
30
|
-
* initialized and run.
|
|
31
|
-
*/
|
|
32
|
-
Object.defineProperty(this, "requireUser", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: false
|
|
37
|
-
});
|
|
38
|
-
/**
|
|
39
|
-
* The parsed flags for the command.
|
|
40
|
-
*/
|
|
41
|
-
Object.defineProperty(this, "flags", {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
configurable: true,
|
|
44
|
-
writable: true,
|
|
45
|
-
value: void 0
|
|
46
|
-
});
|
|
47
|
-
/**
|
|
48
|
-
* The parsed arguments for the command.
|
|
49
|
-
*/
|
|
50
|
-
Object.defineProperty(this, "args", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
configurable: true,
|
|
53
|
-
writable: true,
|
|
54
|
-
value: void 0
|
|
55
|
-
});
|
|
56
|
-
// TODO: Remove this once the `@oclif/core` warnIfFlagDeprecated function checks base flags as well.
|
|
57
|
-
// warnIfFlagDeprecated throws a null pointer because it assumes all parsed flags are in the flags object (which is not the case for global flags).
|
|
58
|
-
// https://github.com/oclif/core/blob/11c5752cec838d08bb27cd55f0f1aa2390df3c5e/src/command.ts#L259
|
|
59
|
-
this.ctor.flags = { ...this.ctor.flags, ...BaseCommand.baseFlags };
|
|
60
|
-
}
|
|
19
|
+
*/ export class BaseCommand extends Command {
|
|
61
20
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return !!core_1.settings.debug;
|
|
21
|
+
* Indicates whether the command is being run with the `-D/--debug` flag.
|
|
22
|
+
*/ get debugEnabled() {
|
|
23
|
+
return !!settings.debug;
|
|
66
24
|
}
|
|
67
25
|
async init() {
|
|
68
|
-
|
|
69
|
-
if (
|
|
26
|
+
context.config = this.config;
|
|
27
|
+
if (context.env.productionLike) {
|
|
70
28
|
Sentry.init({
|
|
71
29
|
dsn: "https://0c26e0d8afd94e77a88ee1c3aa9e7065@o250689.ingest.sentry.io/6703266",
|
|
72
|
-
release:
|
|
30
|
+
release: context.config.version
|
|
73
31
|
});
|
|
74
32
|
}
|
|
75
33
|
await super.init();
|
|
76
|
-
if (this.requireUser && !
|
|
34
|
+
if (this.requireUser && !await context.getUser()) {
|
|
77
35
|
// we purposely log the user in before parsing flags in case one of the flags requires the user to be logged in
|
|
78
36
|
// e.g. the `--app` flag verifies that the user has access to the app they are trying to use
|
|
79
|
-
const { login } = await
|
|
37
|
+
const { login } = await inquirer.prompt({
|
|
80
38
|
type: "confirm",
|
|
81
39
|
name: "login",
|
|
82
|
-
message: "You must be logged in to use this command. Would you like to log in?"
|
|
40
|
+
message: "You must be logged in to use this command. Would you like to log in?"
|
|
83
41
|
});
|
|
84
42
|
if (!login) {
|
|
85
43
|
return this.exit(0);
|
|
@@ -90,101 +48,92 @@ class BaseCommand extends core_1.Command {
|
|
|
90
48
|
flags: this.ctor.flags,
|
|
91
49
|
baseFlags: super.ctor.baseFlags,
|
|
92
50
|
args: this.ctor.args,
|
|
93
|
-
strict: this.ctor.strict
|
|
51
|
+
strict: this.ctor.strict
|
|
94
52
|
});
|
|
95
53
|
this.flags = flags;
|
|
96
54
|
this.args = args;
|
|
97
55
|
if (flags.debug) {
|
|
98
|
-
|
|
99
|
-
|
|
56
|
+
settings.debug = true;
|
|
57
|
+
Debug.enable(`${this.config.bin}:*`);
|
|
100
58
|
}
|
|
101
59
|
}
|
|
102
60
|
/**
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
(0, node_notifier_1.notify)({
|
|
61
|
+
* Sends a native OS notification to the user.
|
|
62
|
+
*
|
|
63
|
+
* @see {@link https://www.npmjs.com/package/node-notifier node-notifier}
|
|
64
|
+
*/ notify(notification) {
|
|
65
|
+
notifier.notify({
|
|
109
66
|
title: "Gadget",
|
|
110
|
-
contentImage:
|
|
111
|
-
icon:
|
|
67
|
+
contentImage: path.join(this.config.root, "assets", "favicon-128@4x.png"),
|
|
68
|
+
icon: path.join(this.config.root, "assets", "favicon-128@4x.png"),
|
|
112
69
|
sound: true,
|
|
113
70
|
timeout: false,
|
|
114
|
-
...notification
|
|
115
|
-
}, (error)
|
|
116
|
-
if (error)
|
|
117
|
-
this.warn(error);
|
|
71
|
+
...notification
|
|
72
|
+
}, (error)=>{
|
|
73
|
+
if (error) this.warn(error);
|
|
118
74
|
});
|
|
119
75
|
}
|
|
120
76
|
/**
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
async login() {
|
|
77
|
+
* Opens the Gadget login page in the user's default browser and waits for the user to login.
|
|
78
|
+
*/ async login() {
|
|
124
79
|
let server;
|
|
125
80
|
try {
|
|
126
|
-
const port = await (
|
|
127
|
-
const receiveSession = new Promise((resolve, reject)
|
|
81
|
+
const port = await getPort();
|
|
82
|
+
const receiveSession = new Promise((resolve, reject)=>{
|
|
128
83
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
129
|
-
server =
|
|
130
|
-
const redirectTo = new URL(`https://${
|
|
84
|
+
server = http.createServer(async (req, res)=>{
|
|
85
|
+
const redirectTo = new URL(`https://${context.domains.services}/auth/cli`);
|
|
131
86
|
try {
|
|
132
|
-
if (!req.url)
|
|
133
|
-
throw new Error("missing url");
|
|
87
|
+
if (!req.url) throw new Error("missing url");
|
|
134
88
|
const incomingUrl = new URL(req.url, `http://localhost:${port}`);
|
|
135
89
|
const value = incomingUrl.searchParams.get("session");
|
|
136
|
-
if (!value)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (!user)
|
|
141
|
-
throw new Error("missing current user");
|
|
90
|
+
if (!value) throw new Error("missing session");
|
|
91
|
+
context.session = value;
|
|
92
|
+
const user = await context.getUser();
|
|
93
|
+
if (!user) throw new Error("missing current user");
|
|
142
94
|
if (user.name) {
|
|
143
|
-
this.log(
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
95
|
+
this.log(chalkTemplate`Hello, ${user.name} {gray (${user.email})}`);
|
|
96
|
+
} else {
|
|
146
97
|
this.log(`Hello, ${user.email}`);
|
|
147
98
|
}
|
|
148
99
|
this.log();
|
|
149
100
|
redirectTo.searchParams.set("success", "true");
|
|
150
101
|
resolve();
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
context_1.context.session = undefined;
|
|
102
|
+
} catch (error) {
|
|
103
|
+
context.session = undefined;
|
|
154
104
|
redirectTo.searchParams.set("success", "false");
|
|
155
105
|
reject(error);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
106
|
+
} finally{
|
|
107
|
+
res.writeHead(303, {
|
|
108
|
+
Location: redirectTo.toString()
|
|
109
|
+
});
|
|
159
110
|
res.end();
|
|
160
111
|
}
|
|
161
112
|
});
|
|
162
113
|
server.listen(port);
|
|
163
114
|
});
|
|
164
|
-
const url = new URL(`https://${
|
|
165
|
-
url.searchParams.set("returnTo", `https://${
|
|
166
|
-
await (
|
|
167
|
-
this.log(
|
|
115
|
+
const url = new URL(`https://${context.domains.services}/auth/login`);
|
|
116
|
+
url.searchParams.set("returnTo", `https://${context.domains.services}/auth/cli/callback?port=${port}`);
|
|
117
|
+
await open(url.toString());
|
|
118
|
+
this.log(dedent`
|
|
168
119
|
We've opened Gadget's login page using your default browser.
|
|
169
120
|
|
|
170
121
|
Please log in and then return to this terminal.\n
|
|
171
122
|
`);
|
|
172
123
|
await receiveSession;
|
|
173
|
-
}
|
|
174
|
-
finally {
|
|
124
|
+
} finally{
|
|
175
125
|
server?.close();
|
|
176
126
|
}
|
|
177
127
|
}
|
|
178
128
|
/**
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (cause instanceof errors_1.CLIError || cause instanceof errors_2.CLIError) {
|
|
129
|
+
* Overrides the default `catch` behavior so we can control how errors are printed to the user. This is called
|
|
130
|
+
* automatically by oclif when an error is thrown during the `init` or `run` methods.
|
|
131
|
+
*/ async catch(cause) {
|
|
132
|
+
if (cause instanceof CLIError || cause instanceof CLIError2) {
|
|
184
133
|
// CLIErrors are user errors (invalid flag, arg, etc...) and already print nicely formatted error messages
|
|
185
134
|
throw cause;
|
|
186
135
|
}
|
|
187
|
-
const error = cause instanceof
|
|
136
|
+
const error = cause instanceof BaseError ? cause : new UnexpectedError(cause);
|
|
188
137
|
console.error(error.render());
|
|
189
138
|
await error.capture();
|
|
190
139
|
// The original implementation of `catch` re-throws the error so that it's caught and printed by oclif's `handle`
|
|
@@ -194,36 +143,46 @@ class BaseCommand extends core_1.Command {
|
|
|
194
143
|
//
|
|
195
144
|
// catch: https://github.com/oclif/core/blob/12e31ff2288606e583e03bf774a3244f3136cd10/src/command.ts#L261
|
|
196
145
|
// handle: https://github.com/oclif/core/blob/12e31ff2288606e583e03bf774a3244f3136cd10/src/errors/handle.ts#L15
|
|
197
|
-
throw new
|
|
146
|
+
throw new ExitError(1);
|
|
147
|
+
}
|
|
148
|
+
constructor(argv, config){
|
|
149
|
+
super(argv, config);
|
|
150
|
+
/**
|
|
151
|
+
* Determines whether the command requires the user to be logged in or not.
|
|
152
|
+
*
|
|
153
|
+
* If true and the user is not logged in, the user will be prompted to login before the underlying command is
|
|
154
|
+
* initialized and run.
|
|
155
|
+
*/ _define_property(this, "requireUser", false);
|
|
156
|
+
/**
|
|
157
|
+
* The parsed flags for the command.
|
|
158
|
+
*/ _define_property(this, "flags", void 0);
|
|
159
|
+
/**
|
|
160
|
+
* The parsed arguments for the command.
|
|
161
|
+
*/ _define_property(this, "args", void 0);
|
|
162
|
+
// TODO: Remove this once the `@oclif/core` warnIfFlagDeprecated function checks base flags as well.
|
|
163
|
+
// warnIfFlagDeprecated throws a null pointer because it assumes all parsed flags are in the flags object (which is not the case for global flags).
|
|
164
|
+
// https://github.com/oclif/core/blob/11c5752cec838d08bb27cd55f0f1aa2390df3c5e/src/command.ts#L259
|
|
165
|
+
this.ctor.flags = {
|
|
166
|
+
...this.ctor.flags,
|
|
167
|
+
...BaseCommand.baseFlags
|
|
168
|
+
};
|
|
198
169
|
}
|
|
199
170
|
}
|
|
200
171
|
/**
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
Object.defineProperty(BaseCommand, "priority", {
|
|
205
|
-
enumerable: true,
|
|
206
|
-
configurable: true,
|
|
207
|
-
writable: true,
|
|
208
|
-
value: Infinity
|
|
209
|
-
});
|
|
172
|
+
* Determines how high the command is listed in the README. The lower the number, the higher the command is listed.
|
|
173
|
+
* Equal numbers are sorted alphabetically.
|
|
174
|
+
*/ _define_property(BaseCommand, "priority", Infinity);
|
|
210
175
|
/**
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
char: "D",
|
|
222
|
-
summary: "Whether to output debug information.",
|
|
223
|
-
helpGroup: "global",
|
|
224
|
-
default: false,
|
|
225
|
-
}),
|
|
226
|
-
}
|
|
176
|
+
* Flags that are available to all commands.
|
|
177
|
+
*
|
|
178
|
+
* Short form should be capitalized.
|
|
179
|
+
*/ _define_property(BaseCommand, "baseFlags", {
|
|
180
|
+
debug: Flags.boolean({
|
|
181
|
+
char: "D",
|
|
182
|
+
summary: "Whether to output debug information.",
|
|
183
|
+
helpGroup: "global",
|
|
184
|
+
default: false
|
|
185
|
+
})
|
|
227
186
|
});
|
|
228
|
-
|
|
187
|
+
|
|
229
188
|
//# sourceMappingURL=base-command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-command.js","sourceRoot":"/","sources":["utils/base-command.ts"],"names":[],"mappings":";;;;AACA,sCAAuD;AACvD,0CAAoD;AACpD,mDAA+D;AAC/D,0DAA0B;AAC1B,0DAA0B;AAC1B,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AAC,CAAC;QAC9E,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9B,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QAEtB,iHAAiH;QACjH,kHAAkH;QAClH,oHAAoH;QACpH,QAAQ;QACR,EAAE;QACF,0GAA0G;QAC1G,+GAA+G;QAC/G,MAAM,IAAI,kBAAS,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;;AApND;;;GAGG;AACI;;;;WAAW,QAAQ;EAAX,CAAY;AAE3B;;;;GAIG;AACa;;;;WAAY;QAC1B,KAAK,EAAE,YAAK,CAAC,OAAO,CAAC;YACnB,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,sCAAsC;YAC/C,SAAS,EAAE,QAAQ;YACnB,OAAO,EAAE,KAAK;SACf,CAAC;KACH;EAPwB,CAOvB;AAnBkB,kCAAW","sourcesContent":["import type { Config, Interfaces } from \"@oclif/core\";\nimport { Command, Flags, settings } from \"@oclif/core\";\nimport { CLIError, ExitError } from \"@oclif/errors\";\nimport { CLIError as CLIError2 } from \"@oclif/core/lib/errors\";\nimport chalk from \"chalk\";\nimport Debug from \"debug\";\nimport * as Sentry from \"@sentry/node\";\nimport getPort from \"get-port\";\nimport type { Server } from \"http\";\nimport { createServer } from \"http\";\nimport { prompt } from \"inquirer\";\nimport type { Notification } from \"node-notifier\";\nimport { notify } from \"node-notifier\";\nimport type WindowsBalloon from \"node-notifier/notifiers/balloon\";\nimport type Growl from \"node-notifier/notifiers/growl\";\nimport type NotificationCenter from \"node-notifier/notifiers/notificationcenter\";\nimport type NotifySend from \"node-notifier/notifiers/notifysend\";\nimport type WindowsToaster from \"node-notifier/notifiers/toaster\";\nimport open from \"open\";\nimport path from \"path\";\nimport dedent from \"ts-dedent\";\nimport { context } from \"./context\";\nimport { BaseError, UnexpectedError } from \"./errors\";\n\nexport type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof BaseCommand)[\"baseFlags\"] & T[\"flags\"]>;\nexport type Args<T extends typeof Command> = Interfaces.InferredArgs<T[\"args\"]>;\n\n/**\n * BaseCommand is the base class for all commands in the Gadget CLI.\n */\nexport abstract class BaseCommand<T extends typeof Command> extends Command {\n /**\n * Determines how high the command is listed in the README. The lower the number, the higher the command is listed.\n * Equal numbers are sorted alphabetically.\n */\n static priority = Infinity;\n\n /**\n * Flags that are available to all commands.\n *\n * Short form should be capitalized.\n */\n static override baseFlags = {\n debug: Flags.boolean({\n char: \"D\",\n summary: \"Whether to output debug information.\",\n helpGroup: \"global\",\n default: false,\n }),\n };\n\n /**\n * Determines whether the command requires the user to be logged in or not.\n *\n * If true and the user is not logged in, the user will be prompted to login before the underlying command is\n * initialized and run.\n */\n readonly requireUser: boolean = false;\n\n /**\n * The parsed flags for the command.\n */\n flags!: Flags<T>;\n\n /**\n * The parsed arguments for the command.\n */\n args!: Args<T>;\n\n constructor(argv: string[], config: Config) {\n super(argv, config);\n\n // TODO: Remove this once the `@oclif/core` warnIfFlagDeprecated function checks base flags as well.\n // warnIfFlagDeprecated throws a null pointer because it assumes all parsed flags are in the flags object (which is not the case for global flags).\n // https://github.com/oclif/core/blob/11c5752cec838d08bb27cd55f0f1aa2390df3c5e/src/command.ts#L259\n this.ctor.flags = { ...this.ctor.flags, ...BaseCommand.baseFlags };\n }\n\n /**\n * Indicates whether the command is being run with the `-D/--debug` flag.\n */\n get debugEnabled(): boolean {\n return !!settings.debug;\n }\n\n override async init(): Promise<void> {\n context.config = this.config;\n\n if (context.env.productionLike) {\n Sentry.init({\n dsn: \"https://0c26e0d8afd94e77a88ee1c3aa9e7065@o250689.ingest.sentry.io/6703266\",\n release: context.config.version,\n });\n }\n\n await super.init();\n\n if (this.requireUser && !(await context.getUser())) {\n // we purposely log the user in before parsing flags in case one of the flags requires the user to be logged in\n // e.g. the `--app` flag verifies that the user has access to the app they are trying to use\n const { login } = await prompt<{ login: boolean }>({\n type: \"confirm\",\n name: \"login\",\n message: \"You must be logged in to use this command. Would you like to log in?\",\n });\n\n if (!login) {\n return this.exit(0);\n }\n\n await this.login();\n }\n\n const { flags, args } = await this.parse({\n flags: this.ctor.flags,\n baseFlags: (super.ctor as typeof BaseCommand).baseFlags,\n args: this.ctor.args,\n strict: this.ctor.strict,\n });\n\n this.flags = flags as Flags<T>;\n this.args = args as Args<T>;\n\n if (flags.debug) {\n settings.debug = true;\n Debug.enable(`${this.config.bin}:*`);\n }\n }\n\n /**\n * Sends a native OS notification to the user.\n *\n * @see {@link https://www.npmjs.com/package/node-notifier node-notifier}\n */\n notify(\n notification:\n | Notification\n | NotificationCenter.Notification\n | NotifySend.Notification\n | WindowsToaster.Notification\n | WindowsBalloon.Notification\n | Growl.Notification\n ): void {\n notify(\n {\n title: \"Gadget\",\n contentImage: path.join(this.config.root, \"assets\", \"favicon-128@4x.png\"),\n icon: path.join(this.config.root, \"assets\", \"favicon-128@4x.png\"),\n sound: true,\n timeout: false,\n ...notification,\n },\n (error) => {\n if (error) this.warn(error);\n }\n );\n }\n\n /**\n * Opens the Gadget login page in the user's default browser and waits for the user to login.\n */\n async login(): Promise<void> {\n let server: Server | undefined;\n\n try {\n const port = await getPort();\n const receiveSession = new Promise<void>((resolve, reject) => {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n server = createServer(async (req, res) => {\n const redirectTo = new URL(`https://${context.domains.services}/auth/cli`);\n\n try {\n if (!req.url) throw new Error(\"missing url\");\n const incomingUrl = new URL(req.url, `http://localhost:${port}`);\n\n const value = incomingUrl.searchParams.get(\"session\");\n if (!value) throw new Error(\"missing session\");\n\n context.session = value;\n\n const user = await context.getUser();\n if (!user) throw new Error(\"missing current user\");\n\n if (user.name) {\n this.log(chalk`Hello, ${user.name} {gray (${user.email})}`);\n } else {\n this.log(`Hello, ${user.email}`);\n }\n this.log();\n\n redirectTo.searchParams.set(\"success\", \"true\");\n resolve();\n } catch (error) {\n context.session = undefined;\n redirectTo.searchParams.set(\"success\", \"false\");\n reject(error);\n } finally {\n res.writeHead(303, { Location: redirectTo.toString() });\n res.end();\n }\n });\n\n server.listen(port);\n });\n\n const url = new URL(`https://${context.domains.services}/auth/login`);\n url.searchParams.set(\"returnTo\", `https://${context.domains.services}/auth/cli/callback?port=${port}`);\n await open(url.toString());\n\n this.log(dedent`\n We've opened Gadget's login page using your default browser.\n\n Please log in and then return to this terminal.\\n\n `);\n\n await receiveSession;\n } finally {\n server?.close();\n }\n }\n\n /**\n * Overrides the default `catch` behavior so we can control how errors are printed to the user. This is called\n * automatically by oclif when an error is thrown during the `init` or `run` methods.\n */\n override async catch(cause: Error): Promise<never> {\n if (cause instanceof CLIError || cause instanceof CLIError2) {\n // CLIErrors are user errors (invalid flag, arg, etc...) and already print nicely formatted error messages\n throw cause;\n }\n\n const error = cause instanceof BaseError ? cause : new UnexpectedError(cause);\n console.error(error.render());\n await error.capture();\n\n // The original implementation of `catch` re-throws the error so that it's caught and printed by oclif's `handle`\n // method. We still want to end up in oclif's `handle` method, but we don't want it to print the error again so we\n // throw an ExitError instead. This will cause `handle` to not print the error, but still exit with the correct exit\n // code.\n //\n // catch: https://github.com/oclif/core/blob/12e31ff2288606e583e03bf774a3244f3136cd10/src/command.ts#L261\n // handle: https://github.com/oclif/core/blob/12e31ff2288606e583e03bf774a3244f3136cd10/src/errors/handle.ts#L15\n throw new ExitError(1);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/base-command.ts"],"sourcesContent":["import type { Config, Interfaces } from \"@oclif/core\";\nimport { Command, Flags, settings } from \"@oclif/core\";\nimport { CLIError as CLIError2 } from \"@oclif/core/lib/errors/index.js\";\nimport { CLIError, ExitError } from \"@oclif/errors\";\nimport * as Sentry from \"@sentry/node\";\nimport chalkTemplate from \"chalk-template\";\nimport Debug from \"debug\";\nimport getPort from \"get-port\";\nimport inquirer from \"inquirer\";\nimport type { Notification } from \"node-notifier\";\nimport notifier from \"node-notifier\";\nimport type WindowsBalloon from \"node-notifier/notifiers/balloon.js\";\nimport type Growl from \"node-notifier/notifiers/growl.js\";\nimport type NotificationCenter from \"node-notifier/notifiers/notificationcenter.js\";\nimport type NotifySend from \"node-notifier/notifiers/notifysend.js\";\nimport type WindowsToaster from \"node-notifier/notifiers/toaster.js\";\nimport type { Server } from \"node:http\";\nimport http from \"node:http\";\nimport path from \"node:path\";\nimport open from \"open\";\nimport { dedent } from \"ts-dedent\";\nimport { context } from \"./context.js\";\nimport { BaseError, UnexpectedError } from \"./errors.js\";\n\nexport type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof BaseCommand)[\"baseFlags\"] & T[\"flags\"]>;\nexport type Args<T extends typeof Command> = Interfaces.InferredArgs<T[\"args\"]>;\n\n/**\n * BaseCommand is the base class for all commands in the Gadget CLI.\n */\nexport abstract class BaseCommand<T extends typeof Command> extends Command {\n /**\n * Determines how high the command is listed in the README. The lower the number, the higher the command is listed.\n * Equal numbers are sorted alphabetically.\n */\n static priority = Infinity;\n\n /**\n * Flags that are available to all commands.\n *\n * Short form should be capitalized.\n */\n static override baseFlags = {\n debug: Flags.boolean({\n char: \"D\",\n summary: \"Whether to output debug information.\",\n helpGroup: \"global\",\n default: false,\n }),\n };\n\n /**\n * Determines whether the command requires the user to be logged in or not.\n *\n * If true and the user is not logged in, the user will be prompted to login before the underlying command is\n * initialized and run.\n */\n readonly requireUser: boolean = false;\n\n /**\n * The parsed flags for the command.\n */\n flags!: Flags<T>;\n\n /**\n * The parsed arguments for the command.\n */\n args!: Args<T>;\n\n constructor(argv: string[], config: Config) {\n super(argv, config);\n\n // TODO: Remove this once the `@oclif/core` warnIfFlagDeprecated function checks base flags as well.\n // warnIfFlagDeprecated throws a null pointer because it assumes all parsed flags are in the flags object (which is not the case for global flags).\n // https://github.com/oclif/core/blob/11c5752cec838d08bb27cd55f0f1aa2390df3c5e/src/command.ts#L259\n this.ctor.flags = { ...this.ctor.flags, ...BaseCommand.baseFlags };\n }\n\n /**\n * Indicates whether the command is being run with the `-D/--debug` flag.\n */\n get debugEnabled(): boolean {\n return !!settings.debug;\n }\n\n override async init(): Promise<void> {\n context.config = this.config;\n\n if (context.env.productionLike) {\n Sentry.init({\n dsn: \"https://0c26e0d8afd94e77a88ee1c3aa9e7065@o250689.ingest.sentry.io/6703266\",\n release: context.config.version,\n });\n }\n\n await super.init();\n\n if (this.requireUser && !(await context.getUser())) {\n // we purposely log the user in before parsing flags in case one of the flags requires the user to be logged in\n // e.g. the `--app` flag verifies that the user has access to the app they are trying to use\n const { login } = await inquirer.prompt<{ login: boolean }>({\n type: \"confirm\",\n name: \"login\",\n message: \"You must be logged in to use this command. Would you like to log in?\",\n });\n\n if (!login) {\n return this.exit(0);\n }\n\n await this.login();\n }\n\n const { flags, args } = await this.parse({\n flags: this.ctor.flags,\n baseFlags: (super.ctor as typeof BaseCommand).baseFlags,\n args: this.ctor.args,\n strict: this.ctor.strict,\n });\n\n this.flags = flags as Flags<T>;\n this.args = args as Args<T>;\n\n if (flags.debug) {\n settings.debug = true;\n Debug.enable(`${this.config.bin}:*`);\n }\n }\n\n /**\n * Sends a native OS notification to the user.\n *\n * @see {@link https://www.npmjs.com/package/node-notifier node-notifier}\n */\n notify(\n notification:\n | Notification\n | NotificationCenter.Notification\n | NotifySend.Notification\n | WindowsToaster.Notification\n | WindowsBalloon.Notification\n | Growl.Notification\n ): void {\n notifier.notify(\n {\n title: \"Gadget\",\n contentImage: path.join(this.config.root, \"assets\", \"favicon-128@4x.png\"),\n icon: path.join(this.config.root, \"assets\", \"favicon-128@4x.png\"),\n sound: true,\n timeout: false,\n ...notification,\n },\n (error) => {\n if (error) this.warn(error);\n }\n );\n }\n\n /**\n * Opens the Gadget login page in the user's default browser and waits for the user to login.\n */\n async login(): Promise<void> {\n let server: Server | undefined;\n\n try {\n const port = await getPort();\n const receiveSession = new Promise<void>((resolve, reject) => {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n server = http.createServer(async (req, res) => {\n const redirectTo = new URL(`https://${context.domains.services}/auth/cli`);\n\n try {\n if (!req.url) throw new Error(\"missing url\");\n const incomingUrl = new URL(req.url, `http://localhost:${port}`);\n\n const value = incomingUrl.searchParams.get(\"session\");\n if (!value) throw new Error(\"missing session\");\n\n context.session = value;\n\n const user = await context.getUser();\n if (!user) throw new Error(\"missing current user\");\n\n if (user.name) {\n this.log(chalkTemplate`Hello, ${user.name} {gray (${user.email})}`);\n } else {\n this.log(`Hello, ${user.email}`);\n }\n this.log();\n\n redirectTo.searchParams.set(\"success\", \"true\");\n resolve();\n } catch (error) {\n context.session = undefined;\n redirectTo.searchParams.set(\"success\", \"false\");\n reject(error);\n } finally {\n res.writeHead(303, { Location: redirectTo.toString() });\n res.end();\n }\n });\n\n server.listen(port);\n });\n\n const url = new URL(`https://${context.domains.services}/auth/login`);\n url.searchParams.set(\"returnTo\", `https://${context.domains.services}/auth/cli/callback?port=${port}`);\n await open(url.toString());\n\n this.log(dedent`\n We've opened Gadget's login page using your default browser.\n\n Please log in and then return to this terminal.\\n\n `);\n\n await receiveSession;\n } finally {\n server?.close();\n }\n }\n\n /**\n * Overrides the default `catch` behavior so we can control how errors are printed to the user. This is called\n * automatically by oclif when an error is thrown during the `init` or `run` methods.\n */\n override async catch(cause: Error): Promise<never> {\n if (cause instanceof CLIError || cause instanceof CLIError2) {\n // CLIErrors are user errors (invalid flag, arg, etc...) and already print nicely formatted error messages\n throw cause;\n }\n\n const error = cause instanceof BaseError ? cause : new UnexpectedError(cause);\n console.error(error.render());\n await error.capture();\n\n // The original implementation of `catch` re-throws the error so that it's caught and printed by oclif's `handle`\n // method. We still want to end up in oclif's `handle` method, but we don't want it to print the error again so we\n // throw an ExitError instead. This will cause `handle` to not print the error, but still exit with the correct exit\n // code.\n //\n // catch: https://github.com/oclif/core/blob/12e31ff2288606e583e03bf774a3244f3136cd10/src/command.ts#L261\n // handle: https://github.com/oclif/core/blob/12e31ff2288606e583e03bf774a3244f3136cd10/src/errors/handle.ts#L15\n throw new ExitError(1);\n }\n}\n"],"names":["Command","Flags","settings","CLIError","CLIError2","ExitError","Sentry","chalkTemplate","Debug","getPort","inquirer","notifier","http","path","open","dedent","context","BaseError","UnexpectedError","BaseCommand","debugEnabled","debug","init","config","env","productionLike","dsn","release","version","requireUser","getUser","login","prompt","type","name","message","exit","flags","args","parse","ctor","baseFlags","strict","enable","bin","notify","notification","title","contentImage","join","root","icon","sound","timeout","error","warn","server","port","receiveSession","Promise","resolve","reject","createServer","req","res","redirectTo","URL","domains","services","url","Error","incomingUrl","value","searchParams","get","session","user","log","email","set","undefined","writeHead","Location","toString","end","listen","close","catch","cause","console","render","capture","constructor","argv","priority","Infinity","boolean","char","summary","helpGroup","default"],"mappings":";AACA,SAASA,OAAO,EAAEC,KAAK,EAAEC,QAAQ,QAAQ,cAAc;AACvD,SAASC,YAAYC,SAAS,QAAQ,kCAAkC;AACxE,SAASD,QAAQ,EAAEE,SAAS,QAAQ,gBAAgB;AACpD,YAAYC,YAAY,eAAe;AACvC,OAAOC,mBAAmB,iBAAiB;AAC3C,OAAOC,WAAW,QAAQ;AAC1B,OAAOC,aAAa,WAAW;AAC/B,OAAOC,cAAc,WAAW;AAEhC,OAAOC,cAAc,gBAAgB;AAOrC,OAAOC,UAAU,YAAY;AAC7B,OAAOC,UAAU,YAAY;AAC7B,OAAOC,UAAU,OAAO;AACxB,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,SAAS,EAAEC,eAAe,QAAQ,cAAc;AAKzD;;CAEC,GACD,OAAO,MAAeC,oBAA8CnB;IAgDlE;;GAEC,GACD,IAAIoB,eAAwB;QAC1B,OAAO,CAAC,CAAClB,SAASmB,KAAK;IACzB;IAEA,MAAeC,OAAsB;QACnCN,QAAQO,MAAM,GAAG,IAAI,CAACA,MAAM;QAE5B,IAAIP,QAAQQ,GAAG,CAACC,cAAc,EAAE;YAC9BnB,OAAOgB,IAAI,CAAC;gBACVI,KAAK;gBACLC,SAASX,QAAQO,MAAM,CAACK,OAAO;YACjC;QACF;QAEA,MAAM,KAAK,CAACN;QAEZ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