@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/CHANGELOG.md CHANGED
@@ -1,3 +1,46 @@
1
+ ## 0.3.3 (2026-11-04)
2
+
3
+ ### ✨ Features
4
+
5
+ - **fly-node:** retry transient errors, allocate ips before deploy ([e0b1040b](https://github.com/codeware-sthlm/cdwr/commit/e0b1040b))
6
+ - **fly-node:** list an app's ip addresses over the api ([bd722141](https://github.com/codeware-sthlm/cdwr/commit/bd722141))
7
+
8
+ ### 🐞 Bug Fixes
9
+
10
+ - **fly-node:** verify against flyctl 0.5.4 ([81b6afd8](https://github.com/codeware-sthlm/cdwr/commit/81b6afd8))
11
+ - **fly-node:** verify against flyctl 0.5.12 ([f526ae95](https://github.com/codeware-sthlm/cdwr/commit/f526ae95))
12
+ - **fly-node:** match only the final error, ensure ips for serving apps ([3ad07c66](https://github.com/codeware-sthlm/cdwr/commit/3ad07c66))
13
+ - **fly-node:** a machine reported mid-update no longer fails a deploy ([e0240e98](https://github.com/codeware-sthlm/cdwr/commit/e0240e98))
14
+ - **repo:** vite configs read path aliases from the base tsconfig only ([41056c7d](https://github.com/codeware-sthlm/cdwr/commit/41056c7d))
15
+ - **fly-node:** a streamed failure's error keeps only a stderr tail ([a9a3b20e](https://github.com/codeware-sthlm/cdwr/commit/a9a3b20e))
16
+ - **fly-node:** ips.list rejects an unknown app, names what it lists ([38eee7e9](https://github.com/codeware-sthlm/cdwr/commit/38eee7e9))
17
+
18
+ ### ⚙️ Miscellaneous Chores
19
+
20
+ - **repo:** replace deprecated nx vite plugins with vite-tsconfig-paths ([a9d2bf38](https://github.com/codeware-sthlm/cdwr/commit/a9d2bf38))
21
+
22
+ ### ✅ Tests
23
+
24
+ - **fly-node:** the full stderr survives both wrappers ([1517d8dd](https://github.com/codeware-sthlm/cdwr/commit/1517d8dd))
25
+ - **fly-node:** ips.list and its fields against the real Fly api ([9133c793](https://github.com/codeware-sthlm/cdwr/commit/9133c793))
26
+
27
+ ## 0.3.2 (2026-10-10)
28
+
29
+ ### ✨ Features
30
+
31
+ - **fly-node:** manage an app's public ip addresses ([21d1813e](https://github.com/codeware-sthlm/cdwr/commit/21d1813e))
32
+
33
+ ### 🐞 Bug Fixes
34
+
35
+ - **fly-node:** machines.restart waits on the machine's state ([07297c53](https://github.com/codeware-sthlm/cdwr/commit/07297c53))
36
+ - **repo:** ship the licence in published tarballs ([aea1f581](https://github.com/codeware-sthlm/cdwr/commit/aea1f581))
37
+ - **fly-node:** stage every secret a deploy is given ([524abc74](https://github.com/codeware-sthlm/cdwr/commit/524abc74))
38
+ - **fly-node:** drop the unsupported confirm flag from ipv6 allocation ([778b3444](https://github.com/codeware-sthlm/cdwr/commit/778b3444))
39
+
40
+ ### ⚙️ Miscellaneous Chores
41
+
42
+ - **repo:** platform under FSL-1.1-MIT, npm packages stay MIT ([ce949b26](https://github.com/codeware-sthlm/cdwr/commit/ce949b26))
43
+
1
44
  ## 0.3.1 (2026-08-25)
2
45
 
3
46
  ### ✨ Features
package/README.md CHANGED
@@ -227,6 +227,10 @@ await fly.apps.destroy('foo-app');
227
227
  >
228
228
  > Without providing the configuration file, the command will throw an error.
229
229
 
230
+ Before the deploy itself, an app whose config has an `http_service` or `services` gets the public addresses it lacks (a shared IPv4 and an IPv6, as `ips.ensure` does), so it is never left unreachable by a deploy that failed. A build-only deploy skips this.
231
+
232
+ The deploy, listing addresses and staging secrets are retried when flyctl ends on a transient Fly error: `no capacity available`, a builder `deadline_exceeded` or `timed out connecting to machine`, and `503 Service Unavailable`. Each is tried 3 times in all, 10 and then 30 seconds apart, and every retry is logged with its cause. Creating an app, allocating an address and attaching Postgres are not retried, since a failure there may already have taken effect.
233
+
230
234
  ```ts
231
235
  // deploy the instance application, if provided
232
236
  const response = await fly.deploy();
@@ -364,10 +368,12 @@ await fly.machines.start('foo-app', 'machine-id-123');
364
368
  // Stop a machine
365
369
  await fly.machines.stop('foo-app', 'machine-id-123');
366
370
 
367
- // Restart a machine (stop then start with delay)
371
+ // Restart a machine (stop, wait until stopped, start, wait until started)
368
372
  await fly.machines.restart('foo-app', 'machine-id-123');
369
373
  ```
370
374
 
375
+ `restart` handles one machine: it waits until Fly reports it stopped (or suspended) before starting it, then until it is `started`. If the start fails after the stop, the error says the machine was left stopped.
376
+
371
377
  ### Configuration & scaling
372
378
 
373
379
  #### Add a custom domain
package/api.cjs CHANGED
@@ -20,6 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // packages/fly-node/src/api.ts
21
21
  var api_exports = {};
22
22
  __export(api_exports, {
23
+ AppIpAddressSchema: () => AppIpAddressSchema,
24
+ AppIpAddressesApiResponseSchema: () => AppIpAddressesApiResponseSchema,
23
25
  CertificateApiResponseSchema: () => CertificateApiResponseSchema,
24
26
  CertificateListApiResponseSchema: () => CertificateListApiResponseSchema,
25
27
  DnsInstructionsSchema: () => DnsInstructionsSchema,
@@ -31,49 +33,66 @@ __export(api_exports, {
31
33
  });
32
34
  module.exports = __toCommonJS(api_exports);
33
35
 
34
- // packages/fly-node/src/lib/schemas/certificate.schema.ts
36
+ // packages/fly-node/src/lib/schemas/app-ip-addresses.schema.ts
37
+ var import_zod2 = require("zod");
38
+
39
+ // packages/fly-node/src/lib/schemas/ip-type.schema.ts
35
40
  var import_zod = require("zod");
36
- var CertificateApiResponseSchema = import_zod.z.object({
37
- hostname: import_zod.z.string(),
41
+ var IpTypeSchema = import_zod.z.enum(["v4", "v6", "shared_v4", "private_v6"]).or(import_zod.z.string());
42
+
43
+ // packages/fly-node/src/lib/schemas/app-ip-addresses.schema.ts
44
+ var AppIpAddressSchema = import_zod2.z.object({
45
+ address: import_zod2.z.string(),
46
+ type: IpTypeSchema
47
+ });
48
+ var AppIpAddressesApiResponseSchema = import_zod2.z.object({
49
+ sharedIpAddress: import_zod2.z.string().nullish(),
50
+ ipAddresses: import_zod2.z.object({ nodes: import_zod2.z.array(AppIpAddressSchema) })
51
+ });
52
+
53
+ // packages/fly-node/src/lib/schemas/certificate.schema.ts
54
+ var import_zod3 = require("zod");
55
+ var CertificateApiResponseSchema = import_zod3.z.object({
56
+ hostname: import_zod3.z.string(),
38
57
  /** Issued and serving. This is what decides whether a domain is usable */
39
- isConfigured: import_zod.z.boolean(),
40
- id: import_zod.z.string().optional(),
58
+ isConfigured: import_zod3.z.boolean(),
59
+ id: import_zod3.z.string().optional(),
41
60
  /** The apex or a subdomain — apex domains cannot use a CNAME */
42
- isApex: import_zod.z.boolean().optional(),
43
- isWildcard: import_zod.z.boolean().optional(),
61
+ isApex: import_zod3.z.boolean().optional(),
62
+ isWildcard: import_zod3.z.boolean().optional(),
44
63
  /** Which ACME challenge has been satisfied, if any */
45
- isAcmeDnsConfigured: import_zod.z.boolean().optional(),
46
- isAcmeAlpnConfigured: import_zod.z.boolean().optional(),
47
- isAcmeHttpConfigured: import_zod.z.boolean().optional(),
48
- certificateAuthority: import_zod.z.string().nullish(),
49
- certificateRequestedAt: import_zod.z.string().nullish(),
50
- createdAt: import_zod.z.string().nullish(),
51
- domain: import_zod.z.string().nullish(),
52
- dnsProvider: import_zod.z.string().nullish(),
64
+ isAcmeDnsConfigured: import_zod3.z.boolean().optional(),
65
+ isAcmeAlpnConfigured: import_zod3.z.boolean().optional(),
66
+ isAcmeHttpConfigured: import_zod3.z.boolean().optional(),
67
+ certificateAuthority: import_zod3.z.string().nullish(),
68
+ certificateRequestedAt: import_zod3.z.string().nullish(),
69
+ createdAt: import_zod3.z.string().nullish(),
70
+ domain: import_zod3.z.string().nullish(),
71
+ dnsProvider: import_zod3.z.string().nullish(),
53
72
  /** Hostname the validation record must be created on */
54
- dnsValidationHostname: import_zod.z.string().nullish(),
73
+ dnsValidationHostname: import_zod3.z.string().nullish(),
55
74
  /** Value that record must contain */
56
- dnsValidationTarget: import_zod.z.string().nullish(),
75
+ dnsValidationTarget: import_zod3.z.string().nullish(),
57
76
  /** Fly's own prose describing the records to create */
58
- dnsValidationInstructions: import_zod.z.string().nullish(),
77
+ dnsValidationInstructions: import_zod3.z.string().nullish(),
59
78
  /** Fly's summary of where issuance has got to */
60
- clientStatus: import_zod.z.string().nullish(),
79
+ clientStatus: import_zod3.z.string().nullish(),
61
80
  /**
62
81
  * Set when Let's Encrypt has rate-limited further attempts for this domain.
63
82
  *
64
83
  * Worth surfacing rather than swallowing: it is the one failure a customer
65
84
  * cannot fix by correcting DNS, and retrying only makes it worse.
66
85
  */
67
- rateLimitedUntil: import_zod.z.string().nullish(),
68
- source: import_zod.z.string().nullish(),
86
+ rateLimitedUntil: import_zod3.z.string().nullish(),
87
+ source: import_zod3.z.string().nullish(),
69
88
  /**
70
89
  * Fly's own prose for a failed issuance attempt — what the dashboard shows,
71
90
  * unlike `HostnameCheck.errors`, which is SCREAMING_SNAKE_CASE codes
72
91
  */
73
- validationErrors: import_zod.z.array(
74
- import_zod.z.object({
75
- message: import_zod.z.string(),
76
- timestamp: import_zod.z.string()
92
+ validationErrors: import_zod3.z.array(
93
+ import_zod3.z.object({
94
+ message: import_zod3.z.string(),
95
+ timestamp: import_zod3.z.string()
77
96
  })
78
97
  ).nullish(),
79
98
  /**
@@ -83,52 +102,52 @@ var CertificateApiResponseSchema = import_zod.z.object({
83
102
  * nodes is the normal count — one RSA and one ECDSA — sharing an expiry,
84
103
  * which is why a caller usually wants the expiry rather than the rows.
85
104
  */
86
- issued: import_zod.z.object({
87
- nodes: import_zod.z.array(
88
- import_zod.z.object({
89
- id: import_zod.z.string().nullish(),
105
+ issued: import_zod3.z.object({
106
+ nodes: import_zod3.z.array(
107
+ import_zod3.z.object({
108
+ id: import_zod3.z.string().nullish(),
90
109
  /** Key type, e.g. `RSA` or `ECDSA` */
91
- type: import_zod.z.string().nullish(),
92
- hostname: import_zod.z.string().nullish(),
93
- expiresAt: import_zod.z.string().nullish()
110
+ type: import_zod3.z.string().nullish(),
111
+ hostname: import_zod3.z.string().nullish(),
112
+ expiresAt: import_zod3.z.string().nullish()
94
113
  })
95
114
  ).nullish()
96
115
  }).nullish()
97
116
  });
98
- var HostnameCheckApiResponseSchema = import_zod.z.object({
99
- aRecords: import_zod.z.array(import_zod.z.string()).nullish(),
100
- aaaaRecords: import_zod.z.array(import_zod.z.string()).nullish(),
101
- cnameRecords: import_zod.z.array(import_zod.z.string()).nullish(),
102
- caaRecords: import_zod.z.array(import_zod.z.string()).nullish(),
103
- soa: import_zod.z.string().nullish(),
104
- dnsProvider: import_zod.z.string().nullish(),
105
- dnsVerificationRecord: import_zod.z.string().nullish(),
106
- dnsConfigured: import_zod.z.boolean().nullish(),
107
- acmeDnsConfigured: import_zod.z.boolean().nullish(),
108
- resolvedAddresses: import_zod.z.array(import_zod.z.string()).nullish(),
109
- isProxied: import_zod.z.boolean().nullish(),
110
- errors: import_zod.z.array(import_zod.z.string()).nullish()
117
+ var HostnameCheckApiResponseSchema = import_zod3.z.object({
118
+ aRecords: import_zod3.z.array(import_zod3.z.string()).nullish(),
119
+ aaaaRecords: import_zod3.z.array(import_zod3.z.string()).nullish(),
120
+ cnameRecords: import_zod3.z.array(import_zod3.z.string()).nullish(),
121
+ caaRecords: import_zod3.z.array(import_zod3.z.string()).nullish(),
122
+ soa: import_zod3.z.string().nullish(),
123
+ dnsProvider: import_zod3.z.string().nullish(),
124
+ dnsVerificationRecord: import_zod3.z.string().nullish(),
125
+ dnsConfigured: import_zod3.z.boolean().nullish(),
126
+ acmeDnsConfigured: import_zod3.z.boolean().nullish(),
127
+ resolvedAddresses: import_zod3.z.array(import_zod3.z.string()).nullish(),
128
+ isProxied: import_zod3.z.boolean().nullish(),
129
+ errors: import_zod3.z.array(import_zod3.z.string()).nullish()
111
130
  });
112
- var DnsInstructionsSchema = import_zod.z.object({
113
- hostname: import_zod.z.string().nullish(),
114
- target: import_zod.z.string().nullish(),
115
- instructions: import_zod.z.string().nullish(),
116
- isApex: import_zod.z.boolean().optional()
131
+ var DnsInstructionsSchema = import_zod3.z.object({
132
+ hostname: import_zod3.z.string().nullish(),
133
+ target: import_zod3.z.string().nullish(),
134
+ instructions: import_zod3.z.string().nullish(),
135
+ isApex: import_zod3.z.boolean().optional()
117
136
  });
118
- var CertificateListApiResponseSchema = import_zod.z.array(
137
+ var CertificateListApiResponseSchema = import_zod3.z.array(
119
138
  CertificateApiResponseSchema
120
139
  );
121
140
 
122
141
  // packages/fly-node/src/lib/schemas/machine.schema.ts
123
- var import_zod2 = require("zod");
124
- var MachineApiResponseSchema = import_zod2.z.object({
125
- id: import_zod2.z.string(),
126
- name: import_zod2.z.string().nullish(),
142
+ var import_zod4 = require("zod");
143
+ var MachineApiResponseSchema = import_zod4.z.object({
144
+ id: import_zod4.z.string(),
145
+ name: import_zod4.z.string().nullish(),
127
146
  /** `started`, `stopped`, `suspended`, … — Fly owns this vocabulary */
128
- state: import_zod2.z.string().nullish(),
129
- region: import_zod2.z.string().nullish()
147
+ state: import_zod4.z.string().nullish(),
148
+ region: import_zod4.z.string().nullish()
130
149
  });
131
- var MachineListApiResponseSchema = import_zod2.z.array(MachineApiResponseSchema);
150
+ var MachineListApiResponseSchema = import_zod4.z.array(MachineApiResponseSchema);
132
151
 
133
152
  // packages/fly-node/src/lib/fly-api.class.ts
134
153
  var FLY_API_URL = "https://api.fly.io/graphql";
@@ -321,6 +340,42 @@ var FlyApi = class {
321
340
  );
322
341
  }
323
342
  };
343
+ /** Read an app's addresses */
344
+ ips = {
345
+ /**
346
+ * The addresses an app answers on: `shared_v4`, `v4`, `v6`, and its
347
+ * `private_v6`.
348
+ *
349
+ * The shared v4 is folded in as a `shared_v4` row, the way `fly ips list`
350
+ * shows it; Fly's API keeps it in a separate field. Egress addresses,
351
+ * which the CLI also lists, are not part of this API and never appear.
352
+ * Pick the public types before pointing DNS at them.
353
+ *
354
+ * Rejects for an unknown app, like `certs.list`: a typo in an app name
355
+ * must not read as "this app has no addresses".
356
+ *
357
+ * @returns The addresses, empty when the app has none
358
+ */
359
+ list: async (app) => {
360
+ const data = await this.request(
361
+ `query AppIpAddresses($appName: String!) {
362
+ app(name: $appName) {
363
+ sharedIpAddress
364
+ ipAddresses { nodes { address type } }
365
+ }
366
+ }`,
367
+ { appName: app }
368
+ );
369
+ if (!data.app) {
370
+ return [];
371
+ }
372
+ const { sharedIpAddress, ipAddresses } = AppIpAddressesApiResponseSchema.parse(data.app);
373
+ return [
374
+ ...sharedIpAddress ? [{ address: sharedIpAddress, type: "shared_v4" }] : [],
375
+ ...ipAddresses.nodes
376
+ ];
377
+ }
378
+ };
324
379
  /**
325
380
  * Operate an app's machines.
326
381
  *
@@ -506,6 +561,8 @@ var HOSTNAME_CHECK_FIELDS = `
506
561
  `;
507
562
  // Annotate the CommonJS export names for ESM import in node:
508
563
  0 && (module.exports = {
564
+ AppIpAddressSchema,
565
+ AppIpAddressesApiResponseSchema,
509
566
  CertificateApiResponseSchema,
510
567
  CertificateListApiResponseSchema,
511
568
  DnsInstructionsSchema,
package/api.js CHANGED
@@ -1,46 +1,63 @@
1
- // packages/fly-node/src/lib/schemas/certificate.schema.ts
1
+ // packages/fly-node/src/lib/schemas/app-ip-addresses.schema.ts
2
+ import { z as z2 } from "zod";
3
+
4
+ // packages/fly-node/src/lib/schemas/ip-type.schema.ts
2
5
  import { z } from "zod";
3
- var CertificateApiResponseSchema = z.object({
4
- hostname: z.string(),
6
+ var IpTypeSchema = z.enum(["v4", "v6", "shared_v4", "private_v6"]).or(z.string());
7
+
8
+ // packages/fly-node/src/lib/schemas/app-ip-addresses.schema.ts
9
+ var AppIpAddressSchema = z2.object({
10
+ address: z2.string(),
11
+ type: IpTypeSchema
12
+ });
13
+ var AppIpAddressesApiResponseSchema = z2.object({
14
+ sharedIpAddress: z2.string().nullish(),
15
+ ipAddresses: z2.object({ nodes: z2.array(AppIpAddressSchema) })
16
+ });
17
+
18
+ // packages/fly-node/src/lib/schemas/certificate.schema.ts
19
+ import { z as z3 } from "zod";
20
+ var CertificateApiResponseSchema = z3.object({
21
+ hostname: z3.string(),
5
22
  /** Issued and serving. This is what decides whether a domain is usable */
6
- isConfigured: z.boolean(),
7
- id: z.string().optional(),
23
+ isConfigured: z3.boolean(),
24
+ id: z3.string().optional(),
8
25
  /** The apex or a subdomain — apex domains cannot use a CNAME */
9
- isApex: z.boolean().optional(),
10
- isWildcard: z.boolean().optional(),
26
+ isApex: z3.boolean().optional(),
27
+ isWildcard: z3.boolean().optional(),
11
28
  /** Which ACME challenge has been satisfied, if any */
12
- isAcmeDnsConfigured: z.boolean().optional(),
13
- isAcmeAlpnConfigured: z.boolean().optional(),
14
- isAcmeHttpConfigured: z.boolean().optional(),
15
- certificateAuthority: z.string().nullish(),
16
- certificateRequestedAt: z.string().nullish(),
17
- createdAt: z.string().nullish(),
18
- domain: z.string().nullish(),
19
- dnsProvider: z.string().nullish(),
29
+ isAcmeDnsConfigured: z3.boolean().optional(),
30
+ isAcmeAlpnConfigured: z3.boolean().optional(),
31
+ isAcmeHttpConfigured: z3.boolean().optional(),
32
+ certificateAuthority: z3.string().nullish(),
33
+ certificateRequestedAt: z3.string().nullish(),
34
+ createdAt: z3.string().nullish(),
35
+ domain: z3.string().nullish(),
36
+ dnsProvider: z3.string().nullish(),
20
37
  /** Hostname the validation record must be created on */
21
- dnsValidationHostname: z.string().nullish(),
38
+ dnsValidationHostname: z3.string().nullish(),
22
39
  /** Value that record must contain */
23
- dnsValidationTarget: z.string().nullish(),
40
+ dnsValidationTarget: z3.string().nullish(),
24
41
  /** Fly's own prose describing the records to create */
25
- dnsValidationInstructions: z.string().nullish(),
42
+ dnsValidationInstructions: z3.string().nullish(),
26
43
  /** Fly's summary of where issuance has got to */
27
- clientStatus: z.string().nullish(),
44
+ clientStatus: z3.string().nullish(),
28
45
  /**
29
46
  * Set when Let's Encrypt has rate-limited further attempts for this domain.
30
47
  *
31
48
  * Worth surfacing rather than swallowing: it is the one failure a customer
32
49
  * cannot fix by correcting DNS, and retrying only makes it worse.
33
50
  */
34
- rateLimitedUntil: z.string().nullish(),
35
- source: z.string().nullish(),
51
+ rateLimitedUntil: z3.string().nullish(),
52
+ source: z3.string().nullish(),
36
53
  /**
37
54
  * Fly's own prose for a failed issuance attempt — what the dashboard shows,
38
55
  * unlike `HostnameCheck.errors`, which is SCREAMING_SNAKE_CASE codes
39
56
  */
40
- validationErrors: z.array(
41
- z.object({
42
- message: z.string(),
43
- timestamp: z.string()
57
+ validationErrors: z3.array(
58
+ z3.object({
59
+ message: z3.string(),
60
+ timestamp: z3.string()
44
61
  })
45
62
  ).nullish(),
46
63
  /**
@@ -50,52 +67,52 @@ var CertificateApiResponseSchema = z.object({
50
67
  * nodes is the normal count — one RSA and one ECDSA — sharing an expiry,
51
68
  * which is why a caller usually wants the expiry rather than the rows.
52
69
  */
53
- issued: z.object({
54
- nodes: z.array(
55
- z.object({
56
- id: z.string().nullish(),
70
+ issued: z3.object({
71
+ nodes: z3.array(
72
+ z3.object({
73
+ id: z3.string().nullish(),
57
74
  /** Key type, e.g. `RSA` or `ECDSA` */
58
- type: z.string().nullish(),
59
- hostname: z.string().nullish(),
60
- expiresAt: z.string().nullish()
75
+ type: z3.string().nullish(),
76
+ hostname: z3.string().nullish(),
77
+ expiresAt: z3.string().nullish()
61
78
  })
62
79
  ).nullish()
63
80
  }).nullish()
64
81
  });
65
- var HostnameCheckApiResponseSchema = z.object({
66
- aRecords: z.array(z.string()).nullish(),
67
- aaaaRecords: z.array(z.string()).nullish(),
68
- cnameRecords: z.array(z.string()).nullish(),
69
- caaRecords: z.array(z.string()).nullish(),
70
- soa: z.string().nullish(),
71
- dnsProvider: z.string().nullish(),
72
- dnsVerificationRecord: z.string().nullish(),
73
- dnsConfigured: z.boolean().nullish(),
74
- acmeDnsConfigured: z.boolean().nullish(),
75
- resolvedAddresses: z.array(z.string()).nullish(),
76
- isProxied: z.boolean().nullish(),
77
- errors: z.array(z.string()).nullish()
82
+ var HostnameCheckApiResponseSchema = z3.object({
83
+ aRecords: z3.array(z3.string()).nullish(),
84
+ aaaaRecords: z3.array(z3.string()).nullish(),
85
+ cnameRecords: z3.array(z3.string()).nullish(),
86
+ caaRecords: z3.array(z3.string()).nullish(),
87
+ soa: z3.string().nullish(),
88
+ dnsProvider: z3.string().nullish(),
89
+ dnsVerificationRecord: z3.string().nullish(),
90
+ dnsConfigured: z3.boolean().nullish(),
91
+ acmeDnsConfigured: z3.boolean().nullish(),
92
+ resolvedAddresses: z3.array(z3.string()).nullish(),
93
+ isProxied: z3.boolean().nullish(),
94
+ errors: z3.array(z3.string()).nullish()
78
95
  });
79
- var DnsInstructionsSchema = z.object({
80
- hostname: z.string().nullish(),
81
- target: z.string().nullish(),
82
- instructions: z.string().nullish(),
83
- isApex: z.boolean().optional()
96
+ var DnsInstructionsSchema = z3.object({
97
+ hostname: z3.string().nullish(),
98
+ target: z3.string().nullish(),
99
+ instructions: z3.string().nullish(),
100
+ isApex: z3.boolean().optional()
84
101
  });
85
- var CertificateListApiResponseSchema = z.array(
102
+ var CertificateListApiResponseSchema = z3.array(
86
103
  CertificateApiResponseSchema
87
104
  );
88
105
 
89
106
  // packages/fly-node/src/lib/schemas/machine.schema.ts
90
- import { z as z2 } from "zod";
91
- var MachineApiResponseSchema = z2.object({
92
- id: z2.string(),
93
- name: z2.string().nullish(),
107
+ import { z as z4 } from "zod";
108
+ var MachineApiResponseSchema = z4.object({
109
+ id: z4.string(),
110
+ name: z4.string().nullish(),
94
111
  /** `started`, `stopped`, `suspended`, … — Fly owns this vocabulary */
95
- state: z2.string().nullish(),
96
- region: z2.string().nullish()
112
+ state: z4.string().nullish(),
113
+ region: z4.string().nullish()
97
114
  });
98
- var MachineListApiResponseSchema = z2.array(MachineApiResponseSchema);
115
+ var MachineListApiResponseSchema = z4.array(MachineApiResponseSchema);
99
116
 
100
117
  // packages/fly-node/src/lib/fly-api.class.ts
101
118
  var FLY_API_URL = "https://api.fly.io/graphql";
@@ -288,6 +305,42 @@ var FlyApi = class {
288
305
  );
289
306
  }
290
307
  };
308
+ /** Read an app's addresses */
309
+ ips = {
310
+ /**
311
+ * The addresses an app answers on: `shared_v4`, `v4`, `v6`, and its
312
+ * `private_v6`.
313
+ *
314
+ * The shared v4 is folded in as a `shared_v4` row, the way `fly ips list`
315
+ * shows it; Fly's API keeps it in a separate field. Egress addresses,
316
+ * which the CLI also lists, are not part of this API and never appear.
317
+ * Pick the public types before pointing DNS at them.
318
+ *
319
+ * Rejects for an unknown app, like `certs.list`: a typo in an app name
320
+ * must not read as "this app has no addresses".
321
+ *
322
+ * @returns The addresses, empty when the app has none
323
+ */
324
+ list: async (app) => {
325
+ const data = await this.request(
326
+ `query AppIpAddresses($appName: String!) {
327
+ app(name: $appName) {
328
+ sharedIpAddress
329
+ ipAddresses { nodes { address type } }
330
+ }
331
+ }`,
332
+ { appName: app }
333
+ );
334
+ if (!data.app) {
335
+ return [];
336
+ }
337
+ const { sharedIpAddress, ipAddresses } = AppIpAddressesApiResponseSchema.parse(data.app);
338
+ return [
339
+ ...sharedIpAddress ? [{ address: sharedIpAddress, type: "shared_v4" }] : [],
340
+ ...ipAddresses.nodes
341
+ ];
342
+ }
343
+ };
291
344
  /**
292
345
  * Operate an app's machines.
293
346
  *
@@ -472,6 +525,8 @@ var HOSTNAME_CHECK_FIELDS = `
472
525
  errors
473
526
  `;
474
527
  export {
528
+ AppIpAddressSchema,
529
+ AppIpAddressesApiResponseSchema,
475
530
  CertificateApiResponseSchema,
476
531
  CertificateListApiResponseSchema,
477
532
  DnsInstructionsSchema,