@cdwr/fly-node 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdwr/fly-node",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "The flyctl node wrapper for programmatic deployments to fly.io.",
5
5
  "repository": {
6
6
  "type": "git",
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';
package/src/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from './api';
2
2
  export * from './lib/fly.class';
3
- export type { BuildResponse, Config, DeployAppOptions, DeployResponse, MachineOperationOptions, SaveConfigOptions, StatusResponse } from './lib/types';
3
+ export type { AllocateIpOptions, BuildResponse, Config, DeployAppOptions, DeployResponse, ListIpResponse, MachineOperationOptions, SaveConfigOptions, StatusResponse } from './lib/types';
@@ -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
  *
@@ -1,5 +1,5 @@
1
1
  import { SpawnOptions, SpawnPtyOptions } from '@codeware/shared/util/misc';
2
- import type { AppOrConfig, BuildResponse, Config, CreateAppOptions, CreateAppResponse, DeployAppOptions, DeployResponse, ListAppResponse, ListCertForAllResponse, ListCertForAppResponse, ListSecretForAllResponse, ListSecretForAppResponse, SaveConfigOptions, SetAppSecretsOptions, ShowConfigOptions, ShowConfigResponse, StatusExtendedResponse, StatusResponse, UnsetAppSecretsOptions, VersionResponse } from './types';
2
+ import type { AllocateIpOptions, AppOrConfig, BuildResponse, Config, CreateAppOptions, CreateAppResponse, DeployAppOptions, DeployResponse, ListAppResponse, ListCertForAllResponse, ListCertForAppResponse, ListIpResponse, ListSecretForAllResponse, ListSecretForAppResponse, SaveConfigOptions, SetAppSecretsOptions, ShowConfigOptions, ShowConfigResponse, StatusExtendedResponse, StatusResponse, UnsetAppSecretsOptions, VersionResponse } from './types';
3
3
  export type ExecFlyOptions = SpawnOptions & SpawnPtyOptions & {
4
4
  /**
5
5
  * How to assemble the returned output string from the spawned process.
@@ -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.
@@ -159,6 +165,34 @@ export declare class Fly {
159
165
  deploy: <T extends DeployAppOptions>(options?: T) => Promise<T extends {
160
166
  buildOnly: true;
161
167
  } ? BuildResponse : DeployResponse>;
168
+ /**
169
+ * Manage public IP addresses
170
+ */
171
+ ips: {
172
+ /**
173
+ * List the public IP addresses allocated to an application
174
+ *
175
+ * @param options - The application or configuration to list addresses for
176
+ * @returns The allocated addresses, empty when the app has none
177
+ * @throws An error if listing addresses fails
178
+ */
179
+ list: (options?: AppOrConfig) => Promise<ListIpResponse>;
180
+ /**
181
+ * Give an application the public addresses it needs to be reachable.
182
+ *
183
+ * Idempotent by inspection: it allocates only what is missing, so it is
184
+ * safe on every deploy rather than only on create. That matters because
185
+ * `flyctl` allocates addresses only for an app it creates itself — an app
186
+ * that arrives any other way, such as a registry push auto-creating it,
187
+ * deploys green and answers nothing. `deploy` runs it before every
188
+ * deploy that is not build-only.
189
+ *
190
+ * @param options - The application, and which addresses to ensure
191
+ * @returns The addresses the application holds afterwards
192
+ * @throws An error if an address cannot be allocated
193
+ */
194
+ ensure: (options?: AllocateIpOptions) => Promise<ListIpResponse>;
195
+ };
162
196
  /**
163
197
  * Manage machines
164
198
  */
@@ -180,7 +214,11 @@ export declare class Fly {
180
214
  */
181
215
  stop: (app: string, machineId: string) => Promise<void>;
182
216
  /**
183
- * Restart a machine by stopping then starting it
217
+ * Restart a machine by stopping then starting it.
218
+ *
219
+ * Waits until Fly reports the machine stopped (or suspended) before
220
+ * starting it, then until it is started. If the start fails after the
221
+ * stop, the error says the machine was left stopped.
184
222
  *
185
223
  * @param app - The name of the application
186
224
  * @param machineId - The machine ID to restart
@@ -342,6 +380,26 @@ export declare class Fly {
342
380
  * @throws An error if the domain cannot be added
343
381
  */
344
382
  private addAppCertificate;
383
+ /**
384
+ * Allocate one public address.
385
+ *
386
+ * A dedicated v4 is billed, so the v4 path is always `--shared`.
387
+ *
388
+ * The two commands do not take the same flags: `allocate-v4` has `--yes`
389
+ * because a dedicated v4 costs money and prompts, while `allocate-v6` is
390
+ * free, never prompts, and rejects the flag outright with `unknown flag`.
391
+ * The asymmetry is flyctl's, not ours — do not tidy it away.
392
+ *
393
+ * @private
394
+ * @throws An error if the address cannot be allocated
395
+ */
396
+ private allocateIp;
397
+ /**
398
+ * @private
399
+ * @returns The addresses for an app or `null` if they cannot be retrieved and `nullOnError` is used
400
+ * @throws An error if the addresses cannot be retrieved and `throwOnError` is used
401
+ */
402
+ private fetchAppIps;
345
403
  /**
346
404
  * @private
347
405
  * @returns The name of the application
@@ -375,10 +433,20 @@ export declare class Fly {
375
433
  private stopMachine;
376
434
  /**
377
435
  * @private
378
- * Restart a machine by stopping then starting it
379
- * @throws An error if the machine cannot be restarted
436
+ * Restart a machine by stopping then starting it, waiting on the state Fly
437
+ * reports rather than a fixed delay: the start is only issued once the
438
+ * machine is stopped (or suspended), and the restart is done once it is
439
+ * started again.
440
+ * @throws An error saying the machine was left stopped when anything after
441
+ * the stop fails
380
442
  */
381
443
  private restartMachine;
444
+ /**
445
+ * @private
446
+ * Poll the app status until the machine reports one of the given states
447
+ * @throws An error if the machine does not reach a state in time
448
+ */
449
+ private waitForMachineState;
382
450
  /**
383
451
  * @private
384
452
  * Update a machine's per-machine config (env vars, etc.).
@@ -417,6 +485,16 @@ export declare class Fly {
417
485
  * @throws An error if the app cannot be found and `throwOnError` is used
418
486
  */
419
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;
420
498
  /**
421
499
  * @private
422
500
  * @returns The certificates for an app or `null` if the certificates cannot be retrieved and `nullOnError` is used
@@ -474,6 +552,26 @@ export declare class Fly {
474
552
  * @throws An error if the command fails
475
553
  */
476
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;
477
575
  /**
478
576
  * @private
479
577
  * Get the arguments for `AppOrConfig` options
@@ -1,4 +1,4 @@
1
- import type { CreateAppResponse, ListAppResponse, ListCertForAllResponse, ListCertForAppResponse, ListPostgresResponse, ListPostgresUsersResponse, ListSecretForAllResponse, ListSecretForAppResponse, StatusResponse } from './types';
1
+ import type { CreateAppResponse, ListAppResponse, ListCertForAllResponse, ListCertForAppResponse, ListIpResponse, ListPostgresResponse, ListPostgresUsersResponse, ListSecretForAllResponse, ListSecretForAppResponse, StatusResponse } from './types';
2
2
  /**
3
3
  * Mock definitions for the tests which are used in the mock rules and data.
4
4
  */
@@ -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
  */
@@ -106,3 +168,10 @@ export declare const mockVersionResponse: {
106
168
  Architecture: string;
107
169
  Environment: string;
108
170
  };
171
+ /**
172
+ * A production-shaped address pair: free shared v4 plus dedicated v6.
173
+ *
174
+ * The shared v4 carries an empty region and a zero timestamp, which is what
175
+ * Fly actually answers and the reason neither is parsed as a datetime.
176
+ */
177
+ export declare const mockListIpResponse: ListIpResponse;
@@ -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]>;
@@ -0,0 +1,65 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Fly ips list response element schema
4
+ *
5
+ * ```ts
6
+ * fly ips list --app [name] --json
7
+ * ```
8
+ *
9
+ * Fly answers in PascalCase (`ID`, `Address`, …), which `withCamelCase`
10
+ * rewrites before validation — so the keys here are the transformed ones.
11
+ *
12
+ * A shared v4 carries an empty `region` and a zero `createdAt`, so neither can
13
+ * be treated as a datetime.
14
+ */
15
+ export declare const IpsListFlyResponseElementSchema: z.ZodObject<{
16
+ id: z.ZodString;
17
+ address: z.ZodString;
18
+ type: z.ZodUnion<[z.ZodEnum<["v4", "v6", "shared_v4", "private_v6"]>, z.ZodString]>;
19
+ region: z.ZodString;
20
+ createdAt: z.ZodString;
21
+ }, "strip", z.ZodTypeAny, {
22
+ type: string;
23
+ address: string;
24
+ id: string;
25
+ createdAt: string;
26
+ region: string;
27
+ }, {
28
+ type: string;
29
+ address: string;
30
+ id: string;
31
+ createdAt: string;
32
+ region: string;
33
+ }>;
34
+ /**
35
+ * Transformed ips list response schema
36
+ *
37
+ * ```ts
38
+ * fly ips list --app [name] --json
39
+ * ```
40
+ */
41
+ export declare const IpsListTransformedResponseSchema: z.ZodArray<z.ZodEffects<z.ZodObject<{
42
+ id: z.ZodString;
43
+ address: z.ZodString;
44
+ type: z.ZodUnion<[z.ZodEnum<["v4", "v6", "shared_v4", "private_v6"]>, z.ZodString]>;
45
+ region: z.ZodString;
46
+ createdAt: z.ZodString;
47
+ }, "strip", z.ZodTypeAny, {
48
+ type: string;
49
+ address: string;
50
+ id: string;
51
+ createdAt: string;
52
+ region: string;
53
+ }, {
54
+ type: string;
55
+ address: string;
56
+ id: string;
57
+ createdAt: string;
58
+ region: string;
59
+ }>, {
60
+ type: string;
61
+ address: string;
62
+ id: string;
63
+ createdAt: string;
64
+ region: string;
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: {