@cardelli/ambit 0.3.1 → 0.3.3
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 +32 -13
- package/esm/cli/commands/list/apps.d.ts +2 -0
- package/esm/cli/commands/list/apps.d.ts.map +1 -0
- package/esm/cli/commands/list/apps.js +72 -0
- package/esm/cli/commands/list/index.d.ts +2 -0
- package/esm/cli/commands/list/index.d.ts.map +1 -0
- package/esm/cli/commands/list/index.js +62 -0
- package/esm/cli/commands/list/networks.d.ts +2 -0
- package/esm/cli/commands/list/networks.d.ts.map +1 -0
- package/esm/cli/commands/{list.js → list/networks.js} +17 -27
- package/esm/cli/commands/status/app.d.ts +2 -0
- package/esm/cli/commands/status/app.d.ts.map +1 -0
- package/esm/cli/commands/status/app.js +141 -0
- package/esm/cli/commands/status/index.d.ts +2 -0
- package/esm/cli/commands/status/index.d.ts.map +1 -0
- package/esm/cli/commands/status/index.js +68 -0
- package/esm/cli/commands/status/network.d.ts +2 -0
- package/esm/cli/commands/status/network.d.ts.map +1 -0
- package/esm/cli/commands/status/network.js +104 -0
- package/esm/cli/commands/status/networks.d.ts +2 -0
- package/esm/cli/commands/status/networks.d.ts.map +1 -0
- package/esm/cli/commands/status/networks.js +62 -0
- package/esm/deno.js +1 -1
- package/esm/lib/cli.d.ts.map +1 -1
- package/esm/lib/cli.js +4 -13
- package/esm/main.d.ts +2 -2
- package/esm/main.d.ts.map +1 -1
- package/esm/main.js +5 -2
- package/esm/schemas/fly.d.ts +84 -4
- package/esm/schemas/fly.d.ts.map +1 -1
- package/esm/schemas/fly.js +34 -2
- package/esm/util/discovery.d.ts +4 -1
- package/esm/util/discovery.d.ts.map +1 -1
- package/esm/util/discovery.js +3 -0
- package/package.json +1 -1
- package/esm/cli/commands/list.d.ts +0 -2
- package/esm/cli/commands/list.d.ts.map +0 -1
- package/esm/cli/commands/status.d.ts +0 -2
- package/esm/cli/commands/status.d.ts.map +0 -1
- package/esm/cli/commands/status.js +0 -334
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Status Networks — Summary Table of All Networks
|
|
3
|
+
// =============================================================================
|
|
4
|
+
import { parseArgs } from "../../../deps/jsr.io/@std/cli/1.0.28/mod.js";
|
|
5
|
+
import { Table } from "../../../deps/jsr.io/@cliffy/table/1.0.0/mod.js";
|
|
6
|
+
import { bold } from "../../../lib/cli.js";
|
|
7
|
+
import { checkArgs } from "../../../lib/args.js";
|
|
8
|
+
import { createOutput } from "../../../lib/output.js";
|
|
9
|
+
import { discoverRouters } from "../../../util/discovery.js";
|
|
10
|
+
import { initSession } from "../../../util/session.js";
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// Status Networks Subcommand
|
|
13
|
+
// =============================================================================
|
|
14
|
+
export const statusNetworks = async (argv) => {
|
|
15
|
+
const opts = { string: ["org"], boolean: ["help", "json"] };
|
|
16
|
+
const args = parseArgs(argv, opts);
|
|
17
|
+
checkArgs(args, opts, "ambit status networks");
|
|
18
|
+
if (args.help) {
|
|
19
|
+
console.log(`
|
|
20
|
+
${bold("ambit status networks")} - Show Status of All Networks
|
|
21
|
+
|
|
22
|
+
${bold("USAGE")}
|
|
23
|
+
ambit status networks [--org <org>] [--json]
|
|
24
|
+
|
|
25
|
+
${bold("OPTIONS")}
|
|
26
|
+
--org <org> Fly.io organization slug
|
|
27
|
+
--json Output as JSON
|
|
28
|
+
`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const out = createOutput(args.json);
|
|
32
|
+
const { fly, tailscale, org } = await initSession(out, {
|
|
33
|
+
json: args.json,
|
|
34
|
+
org: args.org,
|
|
35
|
+
});
|
|
36
|
+
const routers = await discoverRouters(out, fly, tailscale, org);
|
|
37
|
+
if (routers.length === 0) {
|
|
38
|
+
out.blank()
|
|
39
|
+
.text("No Networks Found.")
|
|
40
|
+
.dim(" Create One with: ambit create <network>")
|
|
41
|
+
.blank();
|
|
42
|
+
out.done({ routers: [] });
|
|
43
|
+
out.print();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
out.blank().header("Network Status").blank();
|
|
47
|
+
const rows = routers.map((r) => {
|
|
48
|
+
const tsStatus = r.tailscale
|
|
49
|
+
? (r.tailscale.online ? "online" : "offline")
|
|
50
|
+
: "not found";
|
|
51
|
+
return [r.network, r.appName, r.status, tsStatus];
|
|
52
|
+
});
|
|
53
|
+
const table = new Table()
|
|
54
|
+
.header(["Network", "App", "Status", "Tailscale"])
|
|
55
|
+
.body(rows)
|
|
56
|
+
.indent(2)
|
|
57
|
+
.padding(2);
|
|
58
|
+
out.text(table.toString());
|
|
59
|
+
out.blank();
|
|
60
|
+
out.done({ routers });
|
|
61
|
+
out.print();
|
|
62
|
+
};
|
package/esm/deno.js
CHANGED
package/esm/lib/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/lib/cli.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,KAAG,MAAkC,CAAC;AACvE,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,KAAG,MAAiC,CAAC;AACrE,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,KAAG,MAAiC,CAAC;AACrE,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM,KAAG,MAAmC,CAAC;AACzE,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,KAAG,MAAoC,CAAC;AAC3E,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,KAAG,MAAkC,CAAC;AACvE,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,KAAG,MAAkC,CAAC;AAMvE,eAAO,MAAM,QAAQ,GAAI,SAAS,MAAM,KAAG,IAE1C,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,KAAG,IAE5C,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,SAAS,MAAM,KAAG,IAE3C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|
package/esm/lib/cli.js
CHANGED
|
@@ -107,15 +107,11 @@ export const readSecret = async (message) => {
|
|
|
107
107
|
const encoder = new TextEncoder();
|
|
108
108
|
const decoder = new TextDecoder();
|
|
109
109
|
await dntShim.Deno.stdout.write(encoder.encode(message));
|
|
110
|
+
const { spawnSync } = await import("node:child_process");
|
|
110
111
|
let echoDisabled = false;
|
|
111
112
|
try {
|
|
112
|
-
const sttyOff =
|
|
113
|
-
|
|
114
|
-
stdin: "inherit",
|
|
115
|
-
stdout: "null",
|
|
116
|
-
stderr: "null",
|
|
117
|
-
}).output();
|
|
118
|
-
echoDisabled = sttyOff.success;
|
|
113
|
+
const sttyOff = spawnSync("stty", ["-echo"], { stdio: "inherit" });
|
|
114
|
+
echoDisabled = sttyOff.status === 0;
|
|
119
115
|
const buf = new Uint8Array(1024);
|
|
120
116
|
const n = await dntShim.Deno.stdin.read(buf);
|
|
121
117
|
if (n === null)
|
|
@@ -124,12 +120,7 @@ export const readSecret = async (message) => {
|
|
|
124
120
|
}
|
|
125
121
|
finally {
|
|
126
122
|
if (echoDisabled) {
|
|
127
|
-
|
|
128
|
-
args: ["echo"],
|
|
129
|
-
stdin: "inherit",
|
|
130
|
-
stdout: "null",
|
|
131
|
-
stderr: "null",
|
|
132
|
-
}).output();
|
|
123
|
+
spawnSync("stty", ["echo"], { stdio: "inherit" });
|
|
133
124
|
}
|
|
134
125
|
await dntShim.Deno.stdout.write(encoder.encode("\n"));
|
|
135
126
|
}
|
package/esm/main.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import "./_dnt.polyfills.js";
|
|
|
3
3
|
import "./cli/commands/create/index.js";
|
|
4
4
|
import "./cli/commands/deploy/index.js";
|
|
5
5
|
import "./cli/commands/share.js";
|
|
6
|
-
import "./cli/commands/list.js";
|
|
7
|
-
import "./cli/commands/status.js";
|
|
6
|
+
import "./cli/commands/list/index.js";
|
|
7
|
+
import "./cli/commands/status/index.js";
|
|
8
8
|
import "./cli/commands/destroy/index.js";
|
|
9
9
|
import "./cli/commands/doctor.js";
|
|
10
10
|
//# sourceMappingURL=main.d.ts.map
|
package/esm/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,qBAAqB,CAAC;AAkC7B,OAAO,gCAAgC,CAAC;AACxC,OAAO,gCAAgC,CAAC;AACxC,OAAO,yBAAyB,CAAC;AACjC,OAAO,8BAA8B,CAAC;AACtC,OAAO,gCAAgC,CAAC;AACxC,OAAO,iCAAiC,CAAC;AACzC,OAAO,0BAA0B,CAAC"}
|
package/esm/main.js
CHANGED
|
@@ -19,7 +19,10 @@ import * as dntShim from "./_dnt.shims.js";
|
|
|
19
19
|
//
|
|
20
20
|
// Examples:
|
|
21
21
|
// ambit create browsers
|
|
22
|
+
// ambit list networks
|
|
23
|
+
// ambit list apps browsers
|
|
22
24
|
// ambit status
|
|
25
|
+
// ambit status network browsers
|
|
23
26
|
// ambit destroy network browsers
|
|
24
27
|
// ambit destroy app my-app.browsers
|
|
25
28
|
// ambit doctor
|
|
@@ -30,8 +33,8 @@ import { Spinner, statusErr } from "./lib/cli.js";
|
|
|
30
33
|
import "./cli/commands/create/index.js";
|
|
31
34
|
import "./cli/commands/deploy/index.js";
|
|
32
35
|
import "./cli/commands/share.js";
|
|
33
|
-
import "./cli/commands/list.js";
|
|
34
|
-
import "./cli/commands/status.js";
|
|
36
|
+
import "./cli/commands/list/index.js";
|
|
37
|
+
import "./cli/commands/status/index.js";
|
|
35
38
|
import "./cli/commands/destroy/index.js";
|
|
36
39
|
import "./cli/commands/doctor.js";
|
|
37
40
|
// =============================================================================
|
package/esm/schemas/fly.d.ts
CHANGED
|
@@ -3,6 +3,40 @@ export declare const FlyAuthSchema: z.ZodObject<{
|
|
|
3
3
|
email: z.ZodString;
|
|
4
4
|
}, z.core.$loose>;
|
|
5
5
|
export type FlyAuth = z.infer<typeof FlyAuthSchema>;
|
|
6
|
+
/** App-level status from the Fly GraphQL API / REST API (AppState enum). */
|
|
7
|
+
export declare const FlyAppStatusEnum: z.ZodEnum<{
|
|
8
|
+
deployed: "deployed";
|
|
9
|
+
pending: "pending";
|
|
10
|
+
suspended: "suspended";
|
|
11
|
+
}>;
|
|
12
|
+
export type FlyAppStatus = z.infer<typeof FlyAppStatusEnum>;
|
|
13
|
+
/**
|
|
14
|
+
* Machine-level state from the Fly Machines API.
|
|
15
|
+
* Persistent: created, started, stopped, suspended, failed
|
|
16
|
+
* Transient: creating, starting, stopping, restarting, suspending, destroying,
|
|
17
|
+
* updating, replacing, launch_failed
|
|
18
|
+
* Terminal: destroyed, replaced, migrated
|
|
19
|
+
*/
|
|
20
|
+
export declare const FlyMachineStateEnum: z.ZodEnum<{
|
|
21
|
+
suspended: "suspended";
|
|
22
|
+
created: "created";
|
|
23
|
+
started: "started";
|
|
24
|
+
stopped: "stopped";
|
|
25
|
+
failed: "failed";
|
|
26
|
+
creating: "creating";
|
|
27
|
+
starting: "starting";
|
|
28
|
+
stopping: "stopping";
|
|
29
|
+
restarting: "restarting";
|
|
30
|
+
suspending: "suspending";
|
|
31
|
+
destroying: "destroying";
|
|
32
|
+
updating: "updating";
|
|
33
|
+
replacing: "replacing";
|
|
34
|
+
launch_failed: "launch_failed";
|
|
35
|
+
destroyed: "destroyed";
|
|
36
|
+
replaced: "replaced";
|
|
37
|
+
migrated: "migrated";
|
|
38
|
+
}>;
|
|
39
|
+
export type FlyMachineState = z.infer<typeof FlyMachineStateEnum>;
|
|
6
40
|
export declare const FlyAppSchema: z.ZodObject<{
|
|
7
41
|
Name: z.ZodString;
|
|
8
42
|
Status: z.ZodString;
|
|
@@ -50,7 +84,25 @@ export declare const FlyMachineConfigSchema: z.ZodObject<{
|
|
|
50
84
|
export declare const FlyMachineSchema: z.ZodObject<{
|
|
51
85
|
id: z.ZodString;
|
|
52
86
|
name: z.ZodString;
|
|
53
|
-
state: z.
|
|
87
|
+
state: z.ZodCatch<z.ZodEnum<{
|
|
88
|
+
suspended: "suspended";
|
|
89
|
+
created: "created";
|
|
90
|
+
started: "started";
|
|
91
|
+
stopped: "stopped";
|
|
92
|
+
failed: "failed";
|
|
93
|
+
creating: "creating";
|
|
94
|
+
starting: "starting";
|
|
95
|
+
stopping: "stopping";
|
|
96
|
+
restarting: "restarting";
|
|
97
|
+
suspending: "suspending";
|
|
98
|
+
destroying: "destroying";
|
|
99
|
+
updating: "updating";
|
|
100
|
+
replacing: "replacing";
|
|
101
|
+
launch_failed: "launch_failed";
|
|
102
|
+
destroyed: "destroyed";
|
|
103
|
+
replaced: "replaced";
|
|
104
|
+
migrated: "migrated";
|
|
105
|
+
}>>;
|
|
54
106
|
region: z.ZodString;
|
|
55
107
|
private_ip: z.ZodOptional<z.ZodString>;
|
|
56
108
|
config: z.ZodOptional<z.ZodObject<{
|
|
@@ -77,7 +129,25 @@ export type FlyMachine = z.infer<typeof FlyMachineSchema>;
|
|
|
77
129
|
export declare const FlyMachinesListSchema: z.ZodArray<z.ZodObject<{
|
|
78
130
|
id: z.ZodString;
|
|
79
131
|
name: z.ZodString;
|
|
80
|
-
state: z.
|
|
132
|
+
state: z.ZodCatch<z.ZodEnum<{
|
|
133
|
+
suspended: "suspended";
|
|
134
|
+
created: "created";
|
|
135
|
+
started: "started";
|
|
136
|
+
stopped: "stopped";
|
|
137
|
+
failed: "failed";
|
|
138
|
+
creating: "creating";
|
|
139
|
+
starting: "starting";
|
|
140
|
+
stopping: "stopping";
|
|
141
|
+
restarting: "restarting";
|
|
142
|
+
suspending: "suspending";
|
|
143
|
+
destroying: "destroying";
|
|
144
|
+
updating: "updating";
|
|
145
|
+
replacing: "replacing";
|
|
146
|
+
launch_failed: "launch_failed";
|
|
147
|
+
destroyed: "destroyed";
|
|
148
|
+
replaced: "replaced";
|
|
149
|
+
migrated: "migrated";
|
|
150
|
+
}>>;
|
|
81
151
|
region: z.ZodString;
|
|
82
152
|
private_ip: z.ZodOptional<z.ZodString>;
|
|
83
153
|
config: z.ZodOptional<z.ZodObject<{
|
|
@@ -142,7 +212,12 @@ export declare const FlyIpListSchema: z.ZodArray<z.ZodObject<{
|
|
|
142
212
|
export declare const FlyAppInfoSchema: z.ZodObject<{
|
|
143
213
|
name: z.ZodString;
|
|
144
214
|
network: z.ZodString;
|
|
145
|
-
status: z.
|
|
215
|
+
status: z.ZodCatch<z.ZodEnum<{
|
|
216
|
+
deployed: "deployed";
|
|
217
|
+
pending: "pending";
|
|
218
|
+
suspended: "suspended";
|
|
219
|
+
}>>;
|
|
220
|
+
machine_count: z.ZodOptional<z.ZodNumber>;
|
|
146
221
|
organization: z.ZodOptional<z.ZodObject<{
|
|
147
222
|
slug: z.ZodString;
|
|
148
223
|
}, z.core.$strip>>;
|
|
@@ -153,7 +228,12 @@ export declare const FlyAppInfoListSchema: z.ZodObject<{
|
|
|
153
228
|
apps: z.ZodArray<z.ZodObject<{
|
|
154
229
|
name: z.ZodString;
|
|
155
230
|
network: z.ZodString;
|
|
156
|
-
status: z.
|
|
231
|
+
status: z.ZodCatch<z.ZodEnum<{
|
|
232
|
+
deployed: "deployed";
|
|
233
|
+
pending: "pending";
|
|
234
|
+
suspended: "suspended";
|
|
235
|
+
}>>;
|
|
236
|
+
machine_count: z.ZodOptional<z.ZodNumber>;
|
|
157
237
|
organization: z.ZodOptional<z.ZodObject<{
|
|
158
238
|
slug: z.ZodString;
|
|
159
239
|
}, z.core.$strip>>;
|
package/esm/schemas/fly.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fly.d.ts","sourceRoot":"","sources":["../../src/schemas/fly.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,4CAA4C,CAAC;AAM/D,eAAO,MAAM,aAAa;;iBAEhB,CAAC;AAEX,MAAM,MAAM,OAA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iBAKlB,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAMxD,eAAO,MAAM,qBAAqB;;;;iBAIxB,CAAC;AAEX,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;iBAgBzB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASnB,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAA4B,CAAC;AAM/D,eAAO,MAAM,aAAa,uCAAmC,CAAC;AAM9D,eAAO,MAAM,eAAe;;;iBAGlB,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAMpD,eAAO,MAAM,kBAAkB;;;;;iBAGrB,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;;;;;;;;iBAOd,CAAC;AAEX,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhD,eAAO,MAAM,eAAe;;;;;;;;;;;;kBAAuB,CAAC;AAMpD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;iBAMnB,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;iBAGvB,CAAC"}
|
package/esm/schemas/fly.js
CHANGED
|
@@ -9,6 +9,37 @@ export const FlyAuthSchema = z.object({
|
|
|
9
9
|
email: z.string(),
|
|
10
10
|
}).loose();
|
|
11
11
|
// =============================================================================
|
|
12
|
+
// State Enums
|
|
13
|
+
// =============================================================================
|
|
14
|
+
/** App-level status from the Fly GraphQL API / REST API (AppState enum). */
|
|
15
|
+
export const FlyAppStatusEnum = z.enum(["deployed", "pending", "suspended"]);
|
|
16
|
+
/**
|
|
17
|
+
* Machine-level state from the Fly Machines API.
|
|
18
|
+
* Persistent: created, started, stopped, suspended, failed
|
|
19
|
+
* Transient: creating, starting, stopping, restarting, suspending, destroying,
|
|
20
|
+
* updating, replacing, launch_failed
|
|
21
|
+
* Terminal: destroyed, replaced, migrated
|
|
22
|
+
*/
|
|
23
|
+
export const FlyMachineStateEnum = z.enum([
|
|
24
|
+
"created",
|
|
25
|
+
"started",
|
|
26
|
+
"stopped",
|
|
27
|
+
"suspended",
|
|
28
|
+
"failed",
|
|
29
|
+
"creating",
|
|
30
|
+
"starting",
|
|
31
|
+
"stopping",
|
|
32
|
+
"restarting",
|
|
33
|
+
"suspending",
|
|
34
|
+
"destroying",
|
|
35
|
+
"updating",
|
|
36
|
+
"replacing",
|
|
37
|
+
"launch_failed",
|
|
38
|
+
"destroyed",
|
|
39
|
+
"replaced",
|
|
40
|
+
"migrated",
|
|
41
|
+
]);
|
|
42
|
+
// =============================================================================
|
|
12
43
|
// App Schemas
|
|
13
44
|
// =============================================================================
|
|
14
45
|
export const FlyAppSchema = z.object({
|
|
@@ -52,7 +83,7 @@ export const FlyMachineConfigSchema = z.object({
|
|
|
52
83
|
export const FlyMachineSchema = z.object({
|
|
53
84
|
id: z.string(),
|
|
54
85
|
name: z.string(),
|
|
55
|
-
state:
|
|
86
|
+
state: FlyMachineStateEnum.catch("created"),
|
|
56
87
|
region: z.string(),
|
|
57
88
|
private_ip: z.string().optional(),
|
|
58
89
|
config: FlyMachineConfigSchema.optional(),
|
|
@@ -93,7 +124,8 @@ export const FlyIpListSchema = z.array(FlyIpSchema);
|
|
|
93
124
|
export const FlyAppInfoSchema = z.object({
|
|
94
125
|
name: z.string(),
|
|
95
126
|
network: z.string(),
|
|
96
|
-
status:
|
|
127
|
+
status: FlyAppStatusEnum.catch("pending"),
|
|
128
|
+
machine_count: z.number().optional(),
|
|
97
129
|
organization: z.object({ slug: z.string() }).optional(),
|
|
98
130
|
}).loose();
|
|
99
131
|
export const FlyAppInfoListSchema = z.object({
|
package/esm/util/discovery.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FlyProvider } from "../providers/fly.js";
|
|
2
|
+
import type { FlyAppStatus, FlyMachineState } from "../schemas/fly.js";
|
|
2
3
|
import type { TailscaleProvider } from "../providers/tailscale.js";
|
|
3
4
|
/** A router app discovered from the Fly REST API. */
|
|
4
5
|
export interface RouterApp {
|
|
@@ -6,11 +7,12 @@ export interface RouterApp {
|
|
|
6
7
|
network: string;
|
|
7
8
|
org: string;
|
|
8
9
|
routerId: string;
|
|
10
|
+
status: FlyAppStatus;
|
|
9
11
|
}
|
|
10
12
|
/** Machine state for a router, from the Fly Machines API. */
|
|
11
13
|
export interface RouterMachineInfo {
|
|
12
14
|
region: string;
|
|
13
|
-
state:
|
|
15
|
+
state: FlyMachineState;
|
|
14
16
|
privateIp?: string;
|
|
15
17
|
subnet?: string;
|
|
16
18
|
}
|
|
@@ -30,6 +32,7 @@ export interface WorkloadApp {
|
|
|
30
32
|
appName: string;
|
|
31
33
|
network: string;
|
|
32
34
|
org: string;
|
|
35
|
+
status: FlyAppStatus;
|
|
33
36
|
}
|
|
34
37
|
/** List all non-router apps on a specific custom network in an org. */
|
|
35
38
|
export declare const listWorkloadAppsOnNetwork: (fly: FlyProvider, org: string, network: string) => Promise<WorkloadApp[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/util/discovery.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/util/discovery.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB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AE,CAevB,CAAC;AAEF;;+EAE+E;AAC/E,eAAO,MAAM,eAAe,GAC1B,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,SAAS,MAAM,EACf,UAAU,MAAM,KACf,OAAO,CAAC,WAAW,GAAG,IAAI,CAiC5B,CAAC;AAMF,4EAA4E;AAC5E,eAAO,MAAM,oBAAoB,GAC/B,KAAK,WAAW,EAChB,SAAS,MAAM,KACd,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAclC,CAAC;AAMF,yEAAyE;AACzE,eAAO,MAAM,sBAAsB,GACjC,WAAW,iBAAiB,EAC5B,SAAS,MAAM,KACd,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAcpC,CAAC;AAMF,kEAAkE;AAClE,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IACvC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAClC,SAAS,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACvC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC1B,KAAK;IAAE,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAA;CAAE,EAC7D,KAAK,WAAW,EAChB,WAAW,iBAAiB,EAC5B,KAAK,MAAM,KACV,OAAO,CAAC,cAAc,EAAE,CAa1B,CAAC"}
|
package/esm/util/discovery.js
CHANGED
|
@@ -29,6 +29,7 @@ export const listRouterApps = async (fly, org) => {
|
|
|
29
29
|
network: app.network,
|
|
30
30
|
org: app.organization?.slug ?? org,
|
|
31
31
|
routerId: getRouterSuffix(app.name, app.network),
|
|
32
|
+
status: app.status,
|
|
32
33
|
}));
|
|
33
34
|
};
|
|
34
35
|
/** Find the router app for a specific network. */
|
|
@@ -46,6 +47,7 @@ export const listWorkloadAppsOnNetwork = async (fly, org, network) => {
|
|
|
46
47
|
appName: app.name,
|
|
47
48
|
network: app.network,
|
|
48
49
|
org: app.organization?.slug ?? org,
|
|
50
|
+
status: app.status,
|
|
49
51
|
}));
|
|
50
52
|
};
|
|
51
53
|
/** Find a specific workload app by logical name, optionally scoped to a network.
|
|
@@ -60,6 +62,7 @@ export const findWorkloadApp = async (fly, org, appName, network) => {
|
|
|
60
62
|
appName: app.name,
|
|
61
63
|
network: app.network,
|
|
62
64
|
org: app.organization?.slug ?? org,
|
|
65
|
+
status: app.status,
|
|
63
66
|
}));
|
|
64
67
|
if (network) {
|
|
65
68
|
// Resolve the router's suffix so we can match the suffixed Fly app name
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/list.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/status.ts"],"names":[],"mappings":""}
|