@cdwr/fly-node 0.3.2 → 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/CHANGELOG.md +26 -0
- package/README.md +4 -0
- package/api.cjs +115 -58
- package/api.js +113 -58
- package/index.cjs +482 -277
- package/index.js +478 -275
- package/package.json +1 -1
- package/src/api.d.ts +1 -0
- package/src/lib/fly-api.class.d.ts +21 -1
- package/src/lib/fly.class.d.ts +38 -1
- package/src/lib/mocks.d.ts +62 -0
- package/src/lib/schemas/app-ip-addresses.schema.d.ts +66 -0
- package/src/lib/schemas/apps-list.schema.d.ts +8 -8
- package/src/lib/schemas/certificate.schema.d.ts +12 -12
- package/src/lib/schemas/ip-type.schema.d.ts +14 -0
- package/src/lib/schemas/ips-list.schema.d.ts +10 -20
- package/src/lib/schemas/postgres-list.d.ts +3 -3
- package/src/lib/schemas/status-extended.schema.d.ts +3 -3
- package/src/lib/schemas/status.schema.d.ts +68 -5
package/package.json
CHANGED
package/src/api.d.ts
CHANGED
|
@@ -11,5 +11,6 @@
|
|
|
11
11
|
* `fetch` does.
|
|
12
12
|
*/
|
|
13
13
|
export { FlyApi, FlyApiError, type FlyApiConfig } from './lib/fly-api.class';
|
|
14
|
+
export { type AppIpAddress, AppIpAddressesApiResponseSchema, AppIpAddressSchema } from './lib/schemas/app-ip-addresses.schema';
|
|
14
15
|
export { type Certificate, CertificateApiResponseSchema, CertificateListApiResponseSchema, type DnsInstructions, DnsInstructionsSchema, type HostnameCheck, HostnameCheckApiResponseSchema } from './lib/schemas/certificate.schema';
|
|
15
16
|
export { type Machine, MachineApiResponseSchema, MachineListApiResponseSchema } from './lib/schemas/machine.schema';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type AppIpAddress } from './schemas/app-ip-addresses.schema';
|
|
1
2
|
import { type Certificate, type DnsInstructions, type HostnameCheck } from './schemas/certificate.schema';
|
|
2
3
|
import { type Machine } from './schemas/machine.schema';
|
|
3
4
|
export type FlyApiConfig = {
|
|
@@ -51,7 +52,8 @@ export declare class FlyApiError extends Error {
|
|
|
51
52
|
* itself at runtime. It is deliberately a small subset rather than a second
|
|
52
53
|
* implementation of the whole CLI: certificates, because a custom domain has to
|
|
53
54
|
* be requested, checked and shown to a customer while they wait, and machine
|
|
54
|
-
* restarts, because a setting read at boot needs a boot to take effect.
|
|
55
|
+
* restarts, because a setting read at boot needs a boot to take effect. And
|
|
56
|
+
* addresses, because an apex domain points A and AAAA records at them.
|
|
55
57
|
*
|
|
56
58
|
* Fly splits those across two APIs and so does this class — certificates over
|
|
57
59
|
* GraphQL, machines over the REST Machines API. One token authenticates both.
|
|
@@ -135,6 +137,24 @@ export declare class FlyApi {
|
|
|
135
137
|
*/
|
|
136
138
|
remove: (app: string, hostname: string) => Promise<void>;
|
|
137
139
|
};
|
|
140
|
+
/** Read an app's addresses */
|
|
141
|
+
ips: {
|
|
142
|
+
/**
|
|
143
|
+
* The addresses an app answers on: `shared_v4`, `v4`, `v6`, and its
|
|
144
|
+
* `private_v6`.
|
|
145
|
+
*
|
|
146
|
+
* The shared v4 is folded in as a `shared_v4` row, the way `fly ips list`
|
|
147
|
+
* shows it; Fly's API keeps it in a separate field. Egress addresses,
|
|
148
|
+
* which the CLI also lists, are not part of this API and never appear.
|
|
149
|
+
* Pick the public types before pointing DNS at them.
|
|
150
|
+
*
|
|
151
|
+
* Rejects for an unknown app, like `certs.list`: a typo in an app name
|
|
152
|
+
* must not read as "this app has no addresses".
|
|
153
|
+
*
|
|
154
|
+
* @returns The addresses, empty when the app has none
|
|
155
|
+
*/
|
|
156
|
+
list: (app: string) => Promise<Array<AppIpAddress>>;
|
|
157
|
+
};
|
|
138
158
|
/**
|
|
139
159
|
* Operate an app's machines.
|
|
140
160
|
*
|
package/src/lib/fly.class.d.ts
CHANGED
|
@@ -9,6 +9,12 @@ export type ExecFlyOptions = SpawnOptions & SpawnPtyOptions & {
|
|
|
9
9
|
* may appear in either stream (e.g. `fly deploy --build-only`)
|
|
10
10
|
*/
|
|
11
11
|
streamStrategy?: 'stdout' | 'stderr' | 'combined';
|
|
12
|
+
/**
|
|
13
|
+
* Run the command again when it fails on a transient Fly error
|
|
14
|
+
* (see `TRANSIENT_FLY_ERRORS`). Only for commands that are safe to repeat:
|
|
15
|
+
* a command that may have taken effect before it failed must not set this.
|
|
16
|
+
*/
|
|
17
|
+
retry?: boolean;
|
|
12
18
|
};
|
|
13
19
|
/**
|
|
14
20
|
* Manages deployments to Fly.io using the `flyctl` CLI tool.
|
|
@@ -178,7 +184,8 @@ export declare class Fly {
|
|
|
178
184
|
* safe on every deploy rather than only on create. That matters because
|
|
179
185
|
* `flyctl` allocates addresses only for an app it creates itself — an app
|
|
180
186
|
* that arrives any other way, such as a registry push auto-creating it,
|
|
181
|
-
* deploys green and answers nothing.
|
|
187
|
+
* deploys green and answers nothing. `deploy` runs it before every
|
|
188
|
+
* deploy that is not build-only.
|
|
182
189
|
*
|
|
183
190
|
* @param options - The application, and which addresses to ensure
|
|
184
191
|
* @returns The addresses the application holds afterwards
|
|
@@ -478,6 +485,16 @@ export declare class Fly {
|
|
|
478
485
|
* @throws An error if the app cannot be found and `throwOnError` is used
|
|
479
486
|
*/
|
|
480
487
|
private fetchAppStatus;
|
|
488
|
+
/**
|
|
489
|
+
* @private
|
|
490
|
+
* Like `fetchAppStatus`, but only requires what a lookup needs (name,
|
|
491
|
+
* hostname and each machine's id and state), so a machine Fly reports
|
|
492
|
+
* mid-update does not fail it.
|
|
493
|
+
*
|
|
494
|
+
* @returns The app lookup or `null` if the app cannot be found and `nullOnError` is used
|
|
495
|
+
* @throws An error if the app cannot be found and `throwOnError` is used
|
|
496
|
+
*/
|
|
497
|
+
private fetchAppLookup;
|
|
481
498
|
/**
|
|
482
499
|
* @private
|
|
483
500
|
* @returns The certificates for an app or `null` if the certificates cannot be retrieved and `nullOnError` is used
|
|
@@ -535,6 +552,26 @@ export declare class Fly {
|
|
|
535
552
|
* @throws An error if the command fails
|
|
536
553
|
*/
|
|
537
554
|
private execFly;
|
|
555
|
+
/**
|
|
556
|
+
* @private
|
|
557
|
+
* Run one fly command and assemble its output
|
|
558
|
+
*
|
|
559
|
+
* @returns The output selected by `streamStrategy`
|
|
560
|
+
* @throws An error if the command fails
|
|
561
|
+
*/
|
|
562
|
+
private spawnFly;
|
|
563
|
+
/**
|
|
564
|
+
* @private
|
|
565
|
+
* Name the transient Fly error behind a failed command, if it was one.
|
|
566
|
+
*
|
|
567
|
+
* Only the error flyctl ended with counts: from its last `Error` line to
|
|
568
|
+
* the end of stderr, or the last few lines when there is none. A deploy
|
|
569
|
+
* streams the app's own output and errors flyctl recovered from, and
|
|
570
|
+
* matching those would repeat a deploy that failed for a real reason.
|
|
571
|
+
*
|
|
572
|
+
* @returns The cause, or `null` when the failure is not a known transient one
|
|
573
|
+
*/
|
|
574
|
+
private transientCause;
|
|
538
575
|
/**
|
|
539
576
|
* @private
|
|
540
577
|
* Get the arguments for `AppOrConfig` options
|
package/src/lib/mocks.d.ts
CHANGED
|
@@ -93,6 +93,68 @@ export declare const mockShowConfigResponse: (app?: string) => {
|
|
|
93
93
|
* @param app - The app name to use in the response (defaults to `mockDefs.testApp`)
|
|
94
94
|
*/
|
|
95
95
|
export declare const mockStatusResponse: (app?: string) => StatusResponse;
|
|
96
|
+
/**
|
|
97
|
+
* Mock `fly status --json` response where one of two machines is reported
|
|
98
|
+
* mid-update, without `image_ref`, `config` and `events`.
|
|
99
|
+
*
|
|
100
|
+
* @param app - The app name to use in the response (defaults to `mockDefs.testApp`)
|
|
101
|
+
*/
|
|
102
|
+
export declare const mockPartialStatusResponse: (app?: string) => {
|
|
103
|
+
hostname: string;
|
|
104
|
+
id: string;
|
|
105
|
+
name: string;
|
|
106
|
+
machines: ({
|
|
107
|
+
id: string;
|
|
108
|
+
createdAt: string;
|
|
109
|
+
name: string;
|
|
110
|
+
state: string;
|
|
111
|
+
region: string;
|
|
112
|
+
imageRef: {
|
|
113
|
+
tag: string;
|
|
114
|
+
digest: string;
|
|
115
|
+
registry: string;
|
|
116
|
+
repository: string;
|
|
117
|
+
labels?: Record<string, string> | undefined;
|
|
118
|
+
};
|
|
119
|
+
updatedAt: string;
|
|
120
|
+
config: {
|
|
121
|
+
env: Record<string, string>;
|
|
122
|
+
metadata: Record<string, string>;
|
|
123
|
+
guest?: {
|
|
124
|
+
cpu_kind?: string | undefined;
|
|
125
|
+
cpus?: number | undefined;
|
|
126
|
+
memory_mb?: number | undefined;
|
|
127
|
+
} | undefined;
|
|
128
|
+
};
|
|
129
|
+
events: {
|
|
130
|
+
type: string;
|
|
131
|
+
status: string;
|
|
132
|
+
timestamp: number;
|
|
133
|
+
}[];
|
|
134
|
+
hostStatus: string;
|
|
135
|
+
checks?: {
|
|
136
|
+
status: string;
|
|
137
|
+
name: string;
|
|
138
|
+
updatedAt: string;
|
|
139
|
+
output: string;
|
|
140
|
+
}[] | undefined;
|
|
141
|
+
} | {
|
|
142
|
+
id: string;
|
|
143
|
+
name: string;
|
|
144
|
+
state: string;
|
|
145
|
+
region: string;
|
|
146
|
+
createdAt: string;
|
|
147
|
+
updatedAt: string;
|
|
148
|
+
hostStatus: string;
|
|
149
|
+
})[];
|
|
150
|
+
status: string;
|
|
151
|
+
deployed: boolean;
|
|
152
|
+
organization: {
|
|
153
|
+
id: string;
|
|
154
|
+
slug: string;
|
|
155
|
+
};
|
|
156
|
+
version: number;
|
|
157
|
+
};
|
|
96
158
|
/**
|
|
97
159
|
* Mock `fly version` response for testing.
|
|
98
160
|
*/
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* One address an app holds, in the shape `fly ips list` reports it.
|
|
4
|
+
*
|
|
5
|
+
* Only `address` and `type`: a shared v4 carries no id, region or creation
|
|
6
|
+
* time, and a caller pointing DNS at an app needs nothing else.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AppIpAddressSchema: z.ZodObject<{
|
|
9
|
+
address: z.ZodString;
|
|
10
|
+
type: z.ZodUnion<[z.ZodEnum<["v4", "v6", "shared_v4", "private_v6"]>, z.ZodString]>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
type: string;
|
|
13
|
+
address: string;
|
|
14
|
+
}, {
|
|
15
|
+
type: string;
|
|
16
|
+
address: string;
|
|
17
|
+
}>;
|
|
18
|
+
export type AppIpAddress = z.infer<typeof AppIpAddressSchema>;
|
|
19
|
+
/**
|
|
20
|
+
* An app's addresses as the Fly GraphQL API returns them.
|
|
21
|
+
*
|
|
22
|
+
* Fly keeps the shared v4 apart from the rest: `sharedIpAddress` is a plain
|
|
23
|
+
* string, null when the app has none, and never appears in `ipAddresses`.
|
|
24
|
+
* A dedicated v4 does appear there, with type `v4`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const AppIpAddressesApiResponseSchema: z.ZodObject<{
|
|
27
|
+
sharedIpAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
+
ipAddresses: z.ZodObject<{
|
|
29
|
+
nodes: z.ZodArray<z.ZodObject<{
|
|
30
|
+
address: z.ZodString;
|
|
31
|
+
type: z.ZodUnion<[z.ZodEnum<["v4", "v6", "shared_v4", "private_v6"]>, z.ZodString]>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
type: string;
|
|
34
|
+
address: string;
|
|
35
|
+
}, {
|
|
36
|
+
type: string;
|
|
37
|
+
address: string;
|
|
38
|
+
}>, "many">;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
nodes: {
|
|
41
|
+
type: string;
|
|
42
|
+
address: string;
|
|
43
|
+
}[];
|
|
44
|
+
}, {
|
|
45
|
+
nodes: {
|
|
46
|
+
type: string;
|
|
47
|
+
address: string;
|
|
48
|
+
}[];
|
|
49
|
+
}>;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
ipAddresses: {
|
|
52
|
+
nodes: {
|
|
53
|
+
type: string;
|
|
54
|
+
address: string;
|
|
55
|
+
}[];
|
|
56
|
+
};
|
|
57
|
+
sharedIpAddress?: string | null | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
ipAddresses: {
|
|
60
|
+
nodes: {
|
|
61
|
+
type: string;
|
|
62
|
+
address: string;
|
|
63
|
+
}[];
|
|
64
|
+
};
|
|
65
|
+
sharedIpAddress?: string | null | undefined;
|
|
66
|
+
}>;
|
|
@@ -26,16 +26,16 @@ export declare const AppsListTransformedResponseSchema: z.ZodArray<z.ZodEffects<
|
|
|
26
26
|
status: z.ZodString;
|
|
27
27
|
createdAt: z.ZodString;
|
|
28
28
|
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
createdAt: string;
|
|
30
29
|
status: string;
|
|
31
|
-
}, {
|
|
32
30
|
createdAt: string;
|
|
31
|
+
}, {
|
|
33
32
|
status: string;
|
|
33
|
+
createdAt: string;
|
|
34
34
|
}>>;
|
|
35
35
|
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
status: string;
|
|
36
37
|
hostname: string;
|
|
37
38
|
id: string;
|
|
38
|
-
status: string;
|
|
39
39
|
name: string;
|
|
40
40
|
deployed: boolean;
|
|
41
41
|
organization: {
|
|
@@ -43,13 +43,13 @@ export declare const AppsListTransformedResponseSchema: z.ZodArray<z.ZodEffects<
|
|
|
43
43
|
slug: string;
|
|
44
44
|
};
|
|
45
45
|
currentRelease: {
|
|
46
|
-
createdAt: string;
|
|
47
46
|
status: string;
|
|
47
|
+
createdAt: string;
|
|
48
48
|
} | null;
|
|
49
49
|
}, {
|
|
50
|
+
status: string;
|
|
50
51
|
hostname: string;
|
|
51
52
|
id: string;
|
|
52
|
-
status: string;
|
|
53
53
|
name: string;
|
|
54
54
|
deployed: boolean;
|
|
55
55
|
organization: {
|
|
@@ -57,13 +57,13 @@ export declare const AppsListTransformedResponseSchema: z.ZodArray<z.ZodEffects<
|
|
|
57
57
|
slug: string;
|
|
58
58
|
};
|
|
59
59
|
currentRelease: {
|
|
60
|
-
createdAt: string;
|
|
61
60
|
status: string;
|
|
61
|
+
createdAt: string;
|
|
62
62
|
} | null;
|
|
63
63
|
}>, {
|
|
64
|
+
status: string;
|
|
64
65
|
hostname: string;
|
|
65
66
|
id: string;
|
|
66
|
-
status: string;
|
|
67
67
|
name: string;
|
|
68
68
|
deployed: boolean;
|
|
69
69
|
organization: {
|
|
@@ -71,7 +71,7 @@ export declare const AppsListTransformedResponseSchema: z.ZodArray<z.ZodEffects<
|
|
|
71
71
|
slug: string;
|
|
72
72
|
};
|
|
73
73
|
currentRelease: {
|
|
74
|
-
createdAt: string;
|
|
75
74
|
status: string;
|
|
75
|
+
createdAt: string;
|
|
76
76
|
} | null;
|
|
77
77
|
}, unknown>, "many">;
|
|
@@ -74,28 +74,28 @@ export declare const CertificateApiResponseSchema: z.ZodObject<{
|
|
|
74
74
|
hostname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
75
|
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
76
76
|
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
type?: string | null | undefined;
|
|
77
78
|
hostname?: string | null | undefined;
|
|
78
79
|
id?: string | null | undefined;
|
|
79
|
-
type?: string | null | undefined;
|
|
80
80
|
expiresAt?: string | null | undefined;
|
|
81
81
|
}, {
|
|
82
|
+
type?: string | null | undefined;
|
|
82
83
|
hostname?: string | null | undefined;
|
|
83
84
|
id?: string | null | undefined;
|
|
84
|
-
type?: string | null | undefined;
|
|
85
85
|
expiresAt?: string | null | undefined;
|
|
86
86
|
}>, "many">>>;
|
|
87
87
|
}, "strip", z.ZodTypeAny, {
|
|
88
88
|
nodes?: {
|
|
89
|
+
type?: string | null | undefined;
|
|
89
90
|
hostname?: string | null | undefined;
|
|
90
91
|
id?: string | null | undefined;
|
|
91
|
-
type?: string | null | undefined;
|
|
92
92
|
expiresAt?: string | null | undefined;
|
|
93
93
|
}[] | null | undefined;
|
|
94
94
|
}, {
|
|
95
95
|
nodes?: {
|
|
96
|
+
type?: string | null | undefined;
|
|
96
97
|
hostname?: string | null | undefined;
|
|
97
98
|
id?: string | null | undefined;
|
|
98
|
-
type?: string | null | undefined;
|
|
99
99
|
expiresAt?: string | null | undefined;
|
|
100
100
|
}[] | null | undefined;
|
|
101
101
|
}>>>;
|
|
@@ -125,9 +125,9 @@ export declare const CertificateApiResponseSchema: z.ZodObject<{
|
|
|
125
125
|
}[] | null | undefined;
|
|
126
126
|
issued?: {
|
|
127
127
|
nodes?: {
|
|
128
|
+
type?: string | null | undefined;
|
|
128
129
|
hostname?: string | null | undefined;
|
|
129
130
|
id?: string | null | undefined;
|
|
130
|
-
type?: string | null | undefined;
|
|
131
131
|
expiresAt?: string | null | undefined;
|
|
132
132
|
}[] | null | undefined;
|
|
133
133
|
} | null | undefined;
|
|
@@ -157,9 +157,9 @@ export declare const CertificateApiResponseSchema: z.ZodObject<{
|
|
|
157
157
|
}[] | null | undefined;
|
|
158
158
|
issued?: {
|
|
159
159
|
nodes?: {
|
|
160
|
+
type?: string | null | undefined;
|
|
160
161
|
hostname?: string | null | undefined;
|
|
161
162
|
id?: string | null | undefined;
|
|
162
|
-
type?: string | null | undefined;
|
|
163
163
|
expiresAt?: string | null | undefined;
|
|
164
164
|
}[] | null | undefined;
|
|
165
165
|
} | null | undefined;
|
|
@@ -300,28 +300,28 @@ export declare const CertificateListApiResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
300
300
|
hostname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
301
301
|
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
302
302
|
}, "strip", z.ZodTypeAny, {
|
|
303
|
+
type?: string | null | undefined;
|
|
303
304
|
hostname?: string | null | undefined;
|
|
304
305
|
id?: string | null | undefined;
|
|
305
|
-
type?: string | null | undefined;
|
|
306
306
|
expiresAt?: string | null | undefined;
|
|
307
307
|
}, {
|
|
308
|
+
type?: string | null | undefined;
|
|
308
309
|
hostname?: string | null | undefined;
|
|
309
310
|
id?: string | null | undefined;
|
|
310
|
-
type?: string | null | undefined;
|
|
311
311
|
expiresAt?: string | null | undefined;
|
|
312
312
|
}>, "many">>>;
|
|
313
313
|
}, "strip", z.ZodTypeAny, {
|
|
314
314
|
nodes?: {
|
|
315
|
+
type?: string | null | undefined;
|
|
315
316
|
hostname?: string | null | undefined;
|
|
316
317
|
id?: string | null | undefined;
|
|
317
|
-
type?: string | null | undefined;
|
|
318
318
|
expiresAt?: string | null | undefined;
|
|
319
319
|
}[] | null | undefined;
|
|
320
320
|
}, {
|
|
321
321
|
nodes?: {
|
|
322
|
+
type?: string | null | undefined;
|
|
322
323
|
hostname?: string | null | undefined;
|
|
323
324
|
id?: string | null | undefined;
|
|
324
|
-
type?: string | null | undefined;
|
|
325
325
|
expiresAt?: string | null | undefined;
|
|
326
326
|
}[] | null | undefined;
|
|
327
327
|
}>>>;
|
|
@@ -351,9 +351,9 @@ export declare const CertificateListApiResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
351
351
|
}[] | null | undefined;
|
|
352
352
|
issued?: {
|
|
353
353
|
nodes?: {
|
|
354
|
+
type?: string | null | undefined;
|
|
354
355
|
hostname?: string | null | undefined;
|
|
355
356
|
id?: string | null | undefined;
|
|
356
|
-
type?: string | null | undefined;
|
|
357
357
|
expiresAt?: string | null | undefined;
|
|
358
358
|
}[] | null | undefined;
|
|
359
359
|
} | null | undefined;
|
|
@@ -383,9 +383,9 @@ export declare const CertificateListApiResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
383
383
|
}[] | null | undefined;
|
|
384
384
|
issued?: {
|
|
385
385
|
nodes?: {
|
|
386
|
+
type?: string | null | undefined;
|
|
386
387
|
hostname?: string | null | undefined;
|
|
387
388
|
id?: string | null | undefined;
|
|
388
|
-
type?: string | null | undefined;
|
|
389
389
|
expiresAt?: string | null | undefined;
|
|
390
390
|
}[] | null | undefined;
|
|
391
391
|
} | null | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The kinds of public address an app can hold.
|
|
4
|
+
*
|
|
5
|
+
* `shared_v4` is the free one every app with an `http_service` needs; a
|
|
6
|
+
* dedicated `v4` is billed. `v6` is dedicated and free.
|
|
7
|
+
*
|
|
8
|
+
* Kept open with a string union so an address type added upstream reads as
|
|
9
|
+
* itself rather than failing the whole list.
|
|
10
|
+
*
|
|
11
|
+
* Its own module, free of the CLI's case transforms, so the API entry point
|
|
12
|
+
* can share it without pulling them in.
|
|
13
|
+
*/
|
|
14
|
+
export declare const IpTypeSchema: z.ZodUnion<[z.ZodEnum<["v4", "v6", "shared_v4", "private_v6"]>, z.ZodString]>;
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* The kinds of public address an app can hold.
|
|
4
|
-
*
|
|
5
|
-
* `shared_v4` is the free one every app with an `http_service` needs; a
|
|
6
|
-
* dedicated `v4` is billed. `v6` is dedicated and free.
|
|
7
|
-
*
|
|
8
|
-
* Kept open with a string union so an address type added upstream reads as
|
|
9
|
-
* itself rather than failing the whole list.
|
|
10
|
-
*/
|
|
11
|
-
export declare const IpTypeSchema: z.ZodUnion<[z.ZodEnum<["v4", "v6", "shared_v4", "private_v6"]>, z.ZodString]>;
|
|
12
2
|
/**
|
|
13
3
|
* Fly ips list response element schema
|
|
14
4
|
*
|
|
@@ -29,17 +19,17 @@ export declare const IpsListFlyResponseElementSchema: z.ZodObject<{
|
|
|
29
19
|
region: z.ZodString;
|
|
30
20
|
createdAt: z.ZodString;
|
|
31
21
|
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
type: string;
|
|
23
|
+
address: string;
|
|
32
24
|
id: string;
|
|
33
25
|
createdAt: string;
|
|
34
|
-
type: string;
|
|
35
26
|
region: string;
|
|
36
|
-
address: string;
|
|
37
27
|
}, {
|
|
28
|
+
type: string;
|
|
29
|
+
address: string;
|
|
38
30
|
id: string;
|
|
39
31
|
createdAt: string;
|
|
40
|
-
type: string;
|
|
41
32
|
region: string;
|
|
42
|
-
address: string;
|
|
43
33
|
}>;
|
|
44
34
|
/**
|
|
45
35
|
* Transformed ips list response schema
|
|
@@ -55,21 +45,21 @@ export declare const IpsListTransformedResponseSchema: z.ZodArray<z.ZodEffects<z
|
|
|
55
45
|
region: z.ZodString;
|
|
56
46
|
createdAt: z.ZodString;
|
|
57
47
|
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
type: string;
|
|
49
|
+
address: string;
|
|
58
50
|
id: string;
|
|
59
51
|
createdAt: string;
|
|
60
|
-
type: string;
|
|
61
52
|
region: string;
|
|
62
|
-
address: string;
|
|
63
53
|
}, {
|
|
54
|
+
type: string;
|
|
55
|
+
address: string;
|
|
64
56
|
id: string;
|
|
65
57
|
createdAt: string;
|
|
66
|
-
type: string;
|
|
67
58
|
region: string;
|
|
68
|
-
address: string;
|
|
69
59
|
}>, {
|
|
60
|
+
type: string;
|
|
61
|
+
address: string;
|
|
70
62
|
id: string;
|
|
71
63
|
createdAt: string;
|
|
72
|
-
type: string;
|
|
73
64
|
region: string;
|
|
74
|
-
address: string;
|
|
75
65
|
}, unknown>, "many">;
|
|
@@ -27,9 +27,9 @@ export declare const PostgresListTransformedResponseSchema: z.ZodUnion<[z.ZodArr
|
|
|
27
27
|
status: z.ZodString;
|
|
28
28
|
version: z.ZodNumber;
|
|
29
29
|
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
status: string;
|
|
30
31
|
hostname: string;
|
|
31
32
|
id: string;
|
|
32
|
-
status: string;
|
|
33
33
|
name: string;
|
|
34
34
|
deployed: boolean;
|
|
35
35
|
organization: {
|
|
@@ -38,9 +38,9 @@ export declare const PostgresListTransformedResponseSchema: z.ZodUnion<[z.ZodArr
|
|
|
38
38
|
};
|
|
39
39
|
version: number;
|
|
40
40
|
}, {
|
|
41
|
+
status: string;
|
|
41
42
|
hostname: string;
|
|
42
43
|
id: string;
|
|
43
|
-
status: string;
|
|
44
44
|
name: string;
|
|
45
45
|
deployed: boolean;
|
|
46
46
|
organization: {
|
|
@@ -49,9 +49,9 @@ export declare const PostgresListTransformedResponseSchema: z.ZodUnion<[z.ZodArr
|
|
|
49
49
|
};
|
|
50
50
|
version: number;
|
|
51
51
|
}>, {
|
|
52
|
+
status: string;
|
|
52
53
|
hostname: string;
|
|
53
54
|
id: string;
|
|
54
|
-
status: string;
|
|
55
55
|
name: string;
|
|
56
56
|
deployed: boolean;
|
|
57
57
|
organization: {
|
|
@@ -195,9 +195,9 @@ export declare const StatusExtendedTransformedResponseSchema: z.ZodEffects<z.Zod
|
|
|
195
195
|
name: string;
|
|
196
196
|
}>, "many">;
|
|
197
197
|
}, "strip", z.ZodTypeAny, {
|
|
198
|
+
status: string;
|
|
198
199
|
hostname: string;
|
|
199
200
|
id: string;
|
|
200
|
-
status: string;
|
|
201
201
|
name: string;
|
|
202
202
|
deployed: boolean;
|
|
203
203
|
organization: {
|
|
@@ -248,9 +248,9 @@ export declare const StatusExtendedTransformedResponseSchema: z.ZodEffects<z.Zod
|
|
|
248
248
|
name: string;
|
|
249
249
|
}[];
|
|
250
250
|
}, {
|
|
251
|
+
status: string;
|
|
251
252
|
hostname: string;
|
|
252
253
|
id: string;
|
|
253
|
-
status: string;
|
|
254
254
|
name: string;
|
|
255
255
|
deployed: boolean;
|
|
256
256
|
organization: {
|
|
@@ -301,9 +301,9 @@ export declare const StatusExtendedTransformedResponseSchema: z.ZodEffects<z.Zod
|
|
|
301
301
|
name: string;
|
|
302
302
|
}[];
|
|
303
303
|
}>, {
|
|
304
|
+
status: string;
|
|
304
305
|
hostname: string;
|
|
305
306
|
id: string;
|
|
306
|
-
status: string;
|
|
307
307
|
name: string;
|
|
308
308
|
deployed: boolean;
|
|
309
309
|
organization: {
|
|
@@ -184,9 +184,9 @@ export declare const statusFlyResponseSchema: z.ZodObject<{
|
|
|
184
184
|
status: z.ZodString;
|
|
185
185
|
version: z.ZodNumber;
|
|
186
186
|
}, "strip", z.ZodTypeAny, {
|
|
187
|
+
status: string;
|
|
187
188
|
hostname: string;
|
|
188
189
|
id: string;
|
|
189
|
-
status: string;
|
|
190
190
|
name: string;
|
|
191
191
|
deployed: boolean;
|
|
192
192
|
organization: {
|
|
@@ -231,9 +231,9 @@ export declare const statusFlyResponseSchema: z.ZodObject<{
|
|
|
231
231
|
}[] | undefined;
|
|
232
232
|
}[];
|
|
233
233
|
}, {
|
|
234
|
+
status: string;
|
|
234
235
|
hostname: string;
|
|
235
236
|
id: string;
|
|
236
|
-
status: string;
|
|
237
237
|
name: string;
|
|
238
238
|
deployed: boolean;
|
|
239
239
|
organization: {
|
|
@@ -463,9 +463,9 @@ export declare const StatusTransformedResponseSchema: z.ZodEffects<z.ZodObject<{
|
|
|
463
463
|
status: z.ZodString;
|
|
464
464
|
version: z.ZodNumber;
|
|
465
465
|
}, "strip", z.ZodTypeAny, {
|
|
466
|
+
status: string;
|
|
466
467
|
hostname: string;
|
|
467
468
|
id: string;
|
|
468
|
-
status: string;
|
|
469
469
|
name: string;
|
|
470
470
|
deployed: boolean;
|
|
471
471
|
organization: {
|
|
@@ -510,9 +510,9 @@ export declare const StatusTransformedResponseSchema: z.ZodEffects<z.ZodObject<{
|
|
|
510
510
|
}[] | undefined;
|
|
511
511
|
}[];
|
|
512
512
|
}, {
|
|
513
|
+
status: string;
|
|
513
514
|
hostname: string;
|
|
514
515
|
id: string;
|
|
515
|
-
status: string;
|
|
516
516
|
name: string;
|
|
517
517
|
deployed: boolean;
|
|
518
518
|
organization: {
|
|
@@ -557,9 +557,9 @@ export declare const StatusTransformedResponseSchema: z.ZodEffects<z.ZodObject<{
|
|
|
557
557
|
}[] | undefined;
|
|
558
558
|
}[];
|
|
559
559
|
}>, {
|
|
560
|
+
status: string;
|
|
560
561
|
hostname: string;
|
|
561
562
|
id: string;
|
|
562
|
-
status: string;
|
|
563
563
|
name: string;
|
|
564
564
|
deployed: boolean;
|
|
565
565
|
organization: {
|
|
@@ -604,3 +604,66 @@ export declare const StatusTransformedResponseSchema: z.ZodEffects<z.ZodObject<{
|
|
|
604
604
|
}[] | undefined;
|
|
605
605
|
}[];
|
|
606
606
|
}, unknown>;
|
|
607
|
+
/**
|
|
608
|
+
* Lenient status response schema for internal lookups
|
|
609
|
+
*
|
|
610
|
+
* Fly briefly reports a machine mid-update without `imageRef`, `config` and
|
|
611
|
+
* `events`. A lookup only needs the app name, hostname and each machine's
|
|
612
|
+
* id and state, so everything else is let through unchecked.
|
|
613
|
+
*
|
|
614
|
+
* Internal, not part of the public API.
|
|
615
|
+
*/
|
|
616
|
+
export declare const statusLookupSchema: z.ZodEffects<z.ZodObject<{
|
|
617
|
+
name: z.ZodString;
|
|
618
|
+
hostname: z.ZodString;
|
|
619
|
+
machines: z.ZodArray<z.ZodObject<{
|
|
620
|
+
id: z.ZodString;
|
|
621
|
+
state: z.ZodString;
|
|
622
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
623
|
+
id: z.ZodString;
|
|
624
|
+
state: z.ZodString;
|
|
625
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
626
|
+
id: z.ZodString;
|
|
627
|
+
state: z.ZodString;
|
|
628
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
629
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
630
|
+
name: z.ZodString;
|
|
631
|
+
hostname: z.ZodString;
|
|
632
|
+
machines: z.ZodArray<z.ZodObject<{
|
|
633
|
+
id: z.ZodString;
|
|
634
|
+
state: z.ZodString;
|
|
635
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
636
|
+
id: z.ZodString;
|
|
637
|
+
state: z.ZodString;
|
|
638
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
639
|
+
id: z.ZodString;
|
|
640
|
+
state: z.ZodString;
|
|
641
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
642
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
643
|
+
name: z.ZodString;
|
|
644
|
+
hostname: z.ZodString;
|
|
645
|
+
machines: z.ZodArray<z.ZodObject<{
|
|
646
|
+
id: z.ZodString;
|
|
647
|
+
state: z.ZodString;
|
|
648
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
649
|
+
id: z.ZodString;
|
|
650
|
+
state: z.ZodString;
|
|
651
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
652
|
+
id: z.ZodString;
|
|
653
|
+
state: z.ZodString;
|
|
654
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
655
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
656
|
+
name: z.ZodString;
|
|
657
|
+
hostname: z.ZodString;
|
|
658
|
+
machines: z.ZodArray<z.ZodObject<{
|
|
659
|
+
id: z.ZodString;
|
|
660
|
+
state: z.ZodString;
|
|
661
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
662
|
+
id: z.ZodString;
|
|
663
|
+
state: z.ZodString;
|
|
664
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
665
|
+
id: z.ZodString;
|
|
666
|
+
state: z.ZodString;
|
|
667
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
668
|
+
}, z.ZodTypeAny, "passthrough">, unknown>;
|
|
669
|
+
export type StatusLookup = z.infer<typeof statusLookupSchema>;
|