@project-ajax/sdk 0.0.54 → 0.0.56
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/dist/cli/api/client.d.ts +2 -2
- package/dist/cli/api/client.d.ts.map +1 -1
- package/dist/cli/commands/auth.impl.d.ts.map +1 -1
- package/dist/cli/commands/auth.impl.js +14 -10
- package/dist/cli/commands/bundle.impl.js +2 -2
- package/dist/cli/commands/capabilities.impl.js +4 -4
- package/dist/cli/commands/connect.impl.js +13 -13
- package/dist/cli/commands/deploy.impl.d.ts.map +1 -1
- package/dist/cli/commands/deploy.impl.js +11 -17
- package/dist/cli/commands/env.impl.d.ts.map +1 -1
- package/dist/cli/commands/env.impl.js +7 -10
- package/dist/cli/commands/exec.impl.d.ts.map +1 -1
- package/dist/cli/commands/exec.impl.js +14 -16
- package/dist/cli/commands/runs.impl.js +7 -7
- package/dist/cli/commands/secrets.impl.js +12 -12
- package/dist/cli/commands/utils/testing.d.ts +8 -20
- package/dist/cli/commands/utils/testing.d.ts.map +1 -1
- package/dist/cli/commands/utils/testing.js +25 -18
- package/dist/cli/config.d.ts +13 -6
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +60 -35
- package/dist/cli/context.d.ts +2 -2
- package/dist/cli/context.d.ts.map +1 -1
- package/dist/cli/context.js +3 -3
- package/dist/cli/deploy.js +11 -11
- package/dist/cli/handler.js +2 -2
- package/dist/cli/{writer.d.ts → io.d.ts} +10 -3
- package/dist/cli/io.d.ts.map +1 -0
- package/dist/cli/{writer.js → io.js} +24 -2
- package/package.json +3 -3
- package/src/cli/api/client.ts +3 -3
- package/src/cli/commands/auth.impl.test.ts +66 -46
- package/src/cli/commands/auth.impl.ts +14 -10
- package/src/cli/commands/bundle.impl.test.ts +25 -19
- package/src/cli/commands/bundle.impl.ts +2 -2
- package/src/cli/commands/capabilities.impl.ts +4 -4
- package/src/cli/commands/connect.impl.ts +13 -13
- package/src/cli/commands/deploy.impl.test.ts +78 -63
- package/src/cli/commands/deploy.impl.ts +12 -17
- package/src/cli/commands/env.impl.ts +7 -11
- package/src/cli/commands/exec.impl.ts +14 -16
- package/src/cli/commands/runs.impl.ts +7 -7
- package/src/cli/commands/secrets.impl.ts +12 -12
- package/src/cli/commands/utils/testing.ts +33 -27
- package/src/cli/config.test.ts +45 -95
- package/src/cli/config.ts +69 -42
- package/src/cli/context.ts +3 -3
- package/src/cli/deploy.ts +11 -11
- package/src/cli/handler.ts +2 -2
- package/src/cli/{writer.ts → io.ts} +34 -2
- package/dist/cli/writer.d.ts.map +0 -1
package/src/cli/handler.ts
CHANGED
|
@@ -35,7 +35,7 @@ export function buildHandler<const FLAGS, const ARGS extends BaseArgs = []>(
|
|
|
35
35
|
flags,
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
this.
|
|
38
|
+
this.io.debugEnabled = flags.debug;
|
|
39
39
|
|
|
40
40
|
await handler.call({ ...this, config }, flags, ...args);
|
|
41
41
|
};
|
|
@@ -61,7 +61,7 @@ export function buildAuthedHandler<
|
|
|
61
61
|
environment,
|
|
62
62
|
baseUrl: this.config.baseUrl,
|
|
63
63
|
cellId,
|
|
64
|
-
writer: this.
|
|
64
|
+
writer: this.io,
|
|
65
65
|
});
|
|
66
66
|
return handler.call({ ...this, apiClient: client }, flags, ...args);
|
|
67
67
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as prompts from "@inquirer/prompts";
|
|
1
2
|
import { createTable, type TableCell, type TableItem } from "@visulima/tabular";
|
|
2
3
|
|
|
3
4
|
export interface WriterOptions {
|
|
@@ -10,10 +11,14 @@ export interface TableOptions {
|
|
|
10
11
|
plain: boolean;
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
type WithSafety<T> = T & {
|
|
15
|
+
noTTY: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
13
18
|
/**
|
|
14
|
-
*
|
|
19
|
+
* IO manages safe, consistent, input and output patterns for the CLI.
|
|
15
20
|
*/
|
|
16
|
-
export class
|
|
21
|
+
export class IO {
|
|
17
22
|
debugEnabled: boolean;
|
|
18
23
|
|
|
19
24
|
constructor(options: WriterOptions) {
|
|
@@ -74,6 +79,33 @@ export class Writer {
|
|
|
74
79
|
this.writeErr(content);
|
|
75
80
|
}
|
|
76
81
|
|
|
82
|
+
confirm(config: WithSafety<Parameters<typeof prompts.confirm>[0]>) {
|
|
83
|
+
if (!process.stdin.isTTY) {
|
|
84
|
+
this.writeErr(config.noTTY);
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return prompts.confirm(config).catch(this.#handlePromptExit.bind(this));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
input(config: WithSafety<Parameters<typeof prompts.input>[0]>) {
|
|
92
|
+
if (!process.stdin.isTTY) {
|
|
93
|
+
this.writeErr(config.noTTY);
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return prompts.input(config).catch(this.#handlePromptExit.bind(this));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
#handlePromptExit(err: unknown) {
|
|
101
|
+
if (err instanceof Error && err.name === "ExitPromptError") {
|
|
102
|
+
this.writeErr("👋 Prompt cancelled. Goodbye!");
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
throw err;
|
|
107
|
+
}
|
|
108
|
+
|
|
77
109
|
#buildTable(tableConfig: TableOptions) {
|
|
78
110
|
if (tableConfig.plain) {
|
|
79
111
|
return tableConfig.rows
|
package/dist/cli/writer.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/cli/writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,SAAS,EAAkB,MAAM,mBAAmB,CAAC;AAEhF,MAAM,WAAW,aAAa;IAC7B,YAAY,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC5B,OAAO,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,EAAE,CAAC;IACrC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;CACf;AAED;;GAEG;AACH,qBAAa,MAAM;;IAClB,YAAY,EAAE,OAAO,CAAC;gBAEV,OAAO,EAAE,aAAa;IAIlC;;;;OAIG;IACH,KAAK,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,GAAG,CAAC;IAW7C;;;;OAIG;IACH,QAAQ,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;IAIzD;;;;OAIG;IACH,QAAQ,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;IAIzD;;;;OAIG;IACH,aAAa,CAAC,WAAW,EAAE,YAAY;IAKvC;;;;OAIG;IACH,aAAa,CAAC,WAAW,EAAE,YAAY;CAqBvC"}
|