@cdwr/fly-node 0.2.2 → 0.3.0

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.
@@ -36,12 +36,12 @@ export declare const AppsListTransformedResponseSchema: z.ZodArray<z.ZodEffects<
36
36
  name: string;
37
37
  status: string;
38
38
  id: string;
39
+ deployed: boolean;
40
+ hostname: string;
39
41
  organization: {
40
42
  name: string;
41
43
  slug: string;
42
44
  };
43
- deployed: boolean;
44
- hostname: string;
45
45
  currentRelease: {
46
46
  status: string;
47
47
  createdAt: string;
@@ -50,12 +50,12 @@ export declare const AppsListTransformedResponseSchema: z.ZodArray<z.ZodEffects<
50
50
  name: string;
51
51
  status: string;
52
52
  id: string;
53
+ deployed: boolean;
54
+ hostname: string;
53
55
  organization: {
54
56
  name: string;
55
57
  slug: string;
56
58
  };
57
- deployed: boolean;
58
- hostname: string;
59
59
  currentRelease: {
60
60
  status: string;
61
61
  createdAt: string;
@@ -64,12 +64,12 @@ export declare const AppsListTransformedResponseSchema: z.ZodArray<z.ZodEffects<
64
64
  name: string;
65
65
  status: string;
66
66
  id: string;
67
+ deployed: boolean;
68
+ hostname: string;
67
69
  organization: {
68
70
  name: string;
69
71
  slug: string;
70
72
  };
71
- deployed: boolean;
72
- hostname: string;
73
73
  currentRelease: {
74
74
  status: string;
75
75
  createdAt: string;
@@ -5,8 +5,11 @@ import { z } from 'zod';
5
5
  * ```ts
6
6
  * fly postgres list --json
7
7
  * ```
8
+ *
9
+ * Returns an array of Postgres instances, but when there are no instances,
10
+ * it returns a string e.g. "No postgres clusters found".
8
11
  */
9
- export declare const PostgresListTransformedResponseSchema: z.ZodArray<z.ZodEffects<z.ZodObject<{
12
+ export declare const PostgresListTransformedResponseSchema: z.ZodUnion<[z.ZodArray<z.ZodEffects<z.ZodObject<{
10
13
  deployed: z.ZodBoolean;
11
14
  hostname: z.ZodString;
12
15
  id: z.ZodString;
@@ -27,33 +30,33 @@ export declare const PostgresListTransformedResponseSchema: z.ZodArray<z.ZodEffe
27
30
  name: string;
28
31
  status: string;
29
32
  id: string;
33
+ deployed: boolean;
34
+ hostname: string;
30
35
  organization: {
31
36
  id: string;
32
37
  slug: string;
33
38
  };
34
- deployed: boolean;
35
- hostname: string;
36
39
  version: number;
37
40
  }, {
38
41
  name: string;
39
42
  status: string;
40
43
  id: string;
44
+ deployed: boolean;
45
+ hostname: string;
41
46
  organization: {
42
47
  id: string;
43
48
  slug: string;
44
49
  };
45
- deployed: boolean;
46
- hostname: string;
47
50
  version: number;
48
51
  }>, {
49
52
  name: string;
50
53
  status: string;
51
54
  id: string;
55
+ deployed: boolean;
56
+ hostname: string;
52
57
  organization: {
53
58
  id: string;
54
59
  slug: string;
55
60
  };
56
- deployed: boolean;
57
- hostname: string;
58
61
  version: number;
59
- }, unknown>, "many">;
62
+ }, unknown>, "many">, z.ZodString]>;
@@ -5,22 +5,18 @@ import { z } from 'zod';
5
5
  export declare const SecretsListWithAppTransformedResponseSchema: z.ZodArray<z.ZodEffects<z.ZodObject<{
6
6
  name: z.ZodString;
7
7
  digest: z.ZodString;
8
- createdAt: z.ZodString;
9
8
  } & {
10
9
  app: z.ZodString;
11
10
  }, "strip", z.ZodTypeAny, {
12
11
  name: string;
13
- createdAt: string;
14
12
  app: string;
15
13
  digest: string;
16
14
  }, {
17
15
  name: string;
18
- createdAt: string;
19
16
  app: string;
20
17
  digest: string;
21
18
  }>, {
22
19
  name: string;
23
- createdAt: string;
24
20
  app: string;
25
21
  digest: string;
26
22
  }, unknown>, "many">;
@@ -9,14 +9,11 @@ import { z } from 'zod';
9
9
  export declare const SecretsListFlyResponseElementSchema: z.ZodObject<{
10
10
  name: z.ZodString;
11
11
  digest: z.ZodString;
12
- createdAt: z.ZodString;
13
12
  }, "strip", z.ZodTypeAny, {
14
13
  name: string;
15
- createdAt: string;
16
14
  digest: string;
17
15
  }, {
18
16
  name: string;
19
- createdAt: string;
20
17
  digest: string;
21
18
  }>;
22
19
  /**
@@ -29,17 +26,13 @@ export declare const SecretsListFlyResponseElementSchema: z.ZodObject<{
29
26
  export declare const SecretsListTransformedResponseSchema: z.ZodArray<z.ZodEffects<z.ZodObject<{
30
27
  name: z.ZodString;
31
28
  digest: z.ZodString;
32
- createdAt: z.ZodString;
33
29
  }, "strip", z.ZodTypeAny, {
34
30
  name: string;
35
- createdAt: string;
36
31
  digest: string;
37
32
  }, {
38
33
  name: string;
39
- createdAt: string;
40
34
  digest: string;
41
35
  }>, {
42
36
  name: string;
43
- createdAt: string;
44
37
  digest: string;
45
38
  }, unknown>, "many">;
@@ -132,12 +132,12 @@ export declare const StatusExtendedTransformedResponseSchema: z.ZodEffects<z.Zod
132
132
  name: string;
133
133
  status: string;
134
134
  id: string;
135
+ deployed: boolean;
136
+ hostname: string;
135
137
  organization: {
136
138
  id: string;
137
139
  slug: string;
138
140
  };
139
- deployed: boolean;
140
- hostname: string;
141
141
  version: number;
142
142
  machines: {
143
143
  name: string;
@@ -173,12 +173,12 @@ export declare const StatusExtendedTransformedResponseSchema: z.ZodEffects<z.Zod
173
173
  name: string;
174
174
  status: string;
175
175
  id: string;
176
+ deployed: boolean;
177
+ hostname: string;
176
178
  organization: {
177
179
  id: string;
178
180
  slug: string;
179
181
  };
180
- deployed: boolean;
181
- hostname: string;
182
182
  version: number;
183
183
  machines: {
184
184
  name: string;
@@ -214,12 +214,12 @@ export declare const StatusExtendedTransformedResponseSchema: z.ZodEffects<z.Zod
214
214
  name: string;
215
215
  status: string;
216
216
  id: string;
217
+ deployed: boolean;
218
+ hostname: string;
217
219
  organization: {
218
220
  id: string;
219
221
  slug: string;
220
222
  };
221
- deployed: boolean;
222
- hostname: string;
223
223
  version: number;
224
224
  machines: {
225
225
  name: string;
@@ -121,12 +121,12 @@ export declare const statusFlyResponseSchema: z.ZodObject<{
121
121
  name: string;
122
122
  status: string;
123
123
  id: string;
124
+ deployed: boolean;
125
+ hostname: string;
124
126
  organization: {
125
127
  id: string;
126
128
  slug: string;
127
129
  };
128
- deployed: boolean;
129
- hostname: string;
130
130
  version: number;
131
131
  machines: {
132
132
  name: string;
@@ -156,12 +156,12 @@ export declare const statusFlyResponseSchema: z.ZodObject<{
156
156
  name: string;
157
157
  status: string;
158
158
  id: string;
159
+ deployed: boolean;
160
+ hostname: string;
159
161
  organization: {
160
162
  id: string;
161
163
  slug: string;
162
164
  };
163
- deployed: boolean;
164
- hostname: string;
165
165
  version: number;
166
166
  machines: {
167
167
  name: string;
@@ -310,12 +310,12 @@ export declare const StatusTransformedResponseSchema: z.ZodEffects<z.ZodObject<{
310
310
  name: string;
311
311
  status: string;
312
312
  id: string;
313
+ deployed: boolean;
314
+ hostname: string;
313
315
  organization: {
314
316
  id: string;
315
317
  slug: string;
316
318
  };
317
- deployed: boolean;
318
- hostname: string;
319
319
  version: number;
320
320
  machines: {
321
321
  name: string;
@@ -345,12 +345,12 @@ export declare const StatusTransformedResponseSchema: z.ZodEffects<z.ZodObject<{
345
345
  name: string;
346
346
  status: string;
347
347
  id: string;
348
+ deployed: boolean;
349
+ hostname: string;
348
350
  organization: {
349
351
  id: string;
350
352
  slug: string;
351
353
  };
352
- deployed: boolean;
353
- hostname: string;
354
354
  version: number;
355
355
  machines: {
356
356
  name: string;
@@ -380,12 +380,12 @@ export declare const StatusTransformedResponseSchema: z.ZodEffects<z.ZodObject<{
380
380
  name: string;
381
381
  status: string;
382
382
  id: string;
383
+ deployed: boolean;
384
+ hostname: string;
383
385
  organization: {
384
386
  id: string;
385
387
  slug: string;
386
388
  };
387
- deployed: boolean;
388
- hostname: string;
389
389
  version: number;
390
390
  machines: {
391
391
  name: string;
@@ -0,0 +1,45 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Fly version response schema
4
+ *
5
+ * ```ts
6
+ * fly version --json
7
+ * ```
8
+ */
9
+ export declare const VersionTransformedResponseSchema: z.ZodEffects<z.ZodObject<{
10
+ name: z.ZodString;
11
+ version: z.ZodString;
12
+ commit: z.ZodString;
13
+ branchName: z.ZodString;
14
+ buildDate: z.ZodString;
15
+ os: z.ZodString;
16
+ architecture: z.ZodString;
17
+ environment: z.ZodString;
18
+ }, "strip", z.ZodTypeAny, {
19
+ name: string;
20
+ version: string;
21
+ commit: string;
22
+ branchName: string;
23
+ buildDate: string;
24
+ os: string;
25
+ architecture: string;
26
+ environment: string;
27
+ }, {
28
+ name: string;
29
+ version: string;
30
+ commit: string;
31
+ branchName: string;
32
+ buildDate: string;
33
+ os: string;
34
+ architecture: string;
35
+ environment: string;
36
+ }>, {
37
+ name: string;
38
+ version: string;
39
+ commit: string;
40
+ branchName: string;
41
+ buildDate: string;
42
+ os: string;
43
+ architecture: string;
44
+ environment: string;
45
+ }, unknown>;
@@ -10,38 +10,41 @@ import { PostgresUsersListTransformedResponseSchema } from './schemas/postgres-u
10
10
  import { SecretsListWithAppTransformedResponseSchema } from './schemas/secrets-list-with-app.schema';
11
11
  import { SecretsListTransformedResponseSchema } from './schemas/secrets-list.schema';
12
12
  import { StatusTransformedResponseSchema } from './schemas/status.schema';
13
+ import { VersionTransformedResponseSchema } from './schemas/version.schema';
13
14
  /** List applications */
14
- export type ListAppResponse = z.infer<typeof AppsListTransformedResponseSchema.element>;
15
+ export type ListAppResponse = z.infer<typeof AppsListTransformedResponseSchema>;
15
16
  /** Create an application */
16
17
  export type CreateAppResponse = z.infer<typeof AppsCreateTransformedResponseSchema>;
17
18
  /** Deploy application response */
18
19
  export type DeployResponse = z.infer<typeof DeployResponseSchema>;
19
20
  /** List certificates for an application */
20
- export type ListCertForAppResponse = z.infer<typeof CertsListTransformedResponseSchema.element>;
21
+ export type ListCertForAppResponse = z.infer<typeof CertsListTransformedResponseSchema>;
21
22
  /** List certificates for all applications */
22
- export type ListCertForAllResponse = z.infer<typeof CertsListWithAppTransformedResponseSchema.element>;
23
+ export type ListCertForAllResponse = z.infer<typeof CertsListWithAppTransformedResponseSchema>;
23
24
  /** List secrets for an application */
24
- export type ListSecretForAppResponse = z.infer<typeof SecretsListTransformedResponseSchema.element>;
25
+ export type ListSecretForAppResponse = z.infer<typeof SecretsListTransformedResponseSchema>;
25
26
  /** List secrets for all applications */
26
- export type ListSecretForAllResponse = z.infer<typeof SecretsListWithAppTransformedResponseSchema.element>;
27
+ export type ListSecretForAllResponse = z.infer<typeof SecretsListWithAppTransformedResponseSchema>;
27
28
  /** List postgres databases */
28
- export type ListPostgresResponse = z.infer<typeof PostgresListTransformedResponseSchema.element>;
29
+ export type ListPostgresResponse = z.infer<typeof PostgresListTransformedResponseSchema>;
30
+ /** `ListPostgresResponse` without the string option */
31
+ export type ListPostgresResponseWithoutString = Exclude<ListPostgresResponse, string>;
29
32
  /** List users for a postgres database application */
30
- export type ListPostgresUsersResponse = z.infer<typeof PostgresUsersListTransformedResponseSchema.element>;
33
+ export type ListPostgresUsersResponse = z.infer<typeof PostgresUsersListTransformedResponseSchema>;
31
34
  /** Show application configuration */
32
35
  export type ShowConfigResponse = z.infer<typeof ConfigShowResponseSchema>;
33
36
  /** Get the status of an application */
34
37
  export type StatusResponse = z.infer<typeof StatusTransformedResponseSchema>;
38
+ /** Get the version information of the Fly CLI */
39
+ export type VersionResponse = z.infer<typeof VersionTransformedResponseSchema>;
35
40
  /**
36
41
  * Configuration options for the Fly class.
37
42
  */
38
43
  export type Config = {
39
44
  /**
40
- * Authenticate using a Fly API access token.
45
+ * Authenticate using a Fly token.
41
46
  *
42
- * This token is used unless a currently logged in user is detected.
43
- *
44
- * As alternative to token, the `FLY_API_TOKEN` environment variable is also supported.
47
+ * Fall back to environment variables `FLY_ACCESS_TOKEN` or `FLY_API_TOKEN`.
45
48
  */
46
49
  token?: string;
47
50
  /**
@@ -179,17 +182,19 @@ export type DeployAppOptions = {
179
182
  * Defaults to `false`.
180
183
  */
181
184
  optOutDepotBuilder?: boolean;
182
- };
183
- /**
184
- * Options for destroying an application
185
- */
186
- export type DestroyAppOptions = {
187
185
  /**
188
- * Whether to force the destruction of the application.
186
+ * Whether to prefer remote configuration for existing apps.
187
+ *
188
+ * When enabled and the app already exists on Fly:
189
+ * - Saves the remote configuration locally to `{app-root}/fly.{app-name}.toml`
190
+ * - Uses the remote config for deployment
191
+ *
192
+ * When disabled or the app doesn't exist:
193
+ * - Uses the local config file specified in the `config` option
189
194
  *
190
195
  * Defaults to `false`.
191
196
  */
192
- force?: boolean;
197
+ preferRemoteConfig?: boolean;
193
198
  };
194
199
  /**
195
200
  * Options for showing an application's configuration
@@ -215,6 +220,19 @@ export type ShowConfigOptions = {
215
220
  */
216
221
  local?: boolean;
217
222
  };
223
+ /**
224
+ * Options for saving an application's configuration as TOML file
225
+ */
226
+ export type SaveConfigOptions = {
227
+ /**
228
+ * Name of the application to save the remote configuration for.
229
+ */
230
+ app: string;
231
+ /**
232
+ * Path to save the TOML configuration file to.
233
+ */
234
+ config: string;
235
+ };
218
236
  /**
219
237
  * Options for setting application secrets
220
238
  */
@@ -232,8 +250,8 @@ export type UnsetAppSecretsOptions = SetAppSecretsOptions;
232
250
  * Extended application status
233
251
  */
234
252
  export type StatusExtendedResponse = StatusResponse & {
235
- domains: Array<Pick<ListCertForAppResponse, 'hostname'>>;
236
- secrets: Array<Pick<ListSecretForAppResponse, 'name'>>;
253
+ domains: Array<Pick<ListCertForAppResponse[number], 'hostname'>>;
254
+ secrets: Array<Pick<ListSecretForAppResponse[number], 'name'>>;
237
255
  };
238
256
  /**
239
257
  * Logger interface using the `console` signature
@@ -286,4 +304,40 @@ export type Logger = {
286
304
  * ```
287
305
  */
288
306
  traceCLI: boolean;
307
+ /**
308
+ * Redact sensitive call values in CLI trace logs.
309
+ *
310
+ * When enabled, secrets and tokens are masked:
311
+ * - Values > 10 chars: first 3 + [REDACTED] + last 3 (e.g., "foo[REDACTED]bar")
312
+ * - Values ≤ 10 chars: [REDACTED]
313
+ *
314
+ * Redacts:
315
+ * - `secrets set KEY1=VALUE1 KEY2=VALUE2 ...`
316
+ *
317
+ * Only applies when `traceCLI` is `true`.
318
+ *
319
+ * @default true
320
+ *
321
+ * @example
322
+ *
323
+ * ```ts
324
+ * const fly = new Fly({
325
+ * logger: {
326
+ * traceCLI: true,
327
+ * redactSecrets: true
328
+ * }
329
+ * });
330
+ * ```
331
+ *
332
+ * @example
333
+ *
334
+ * ```sh
335
+ * # Without redaction:
336
+ * [ CALL ] flyctl secrets set API_KEY=secret!
337
+ *
338
+ * # With redaction:
339
+ * [ CALL ] flyctl secrets set API_KEY=[REDACTED]
340
+ * ```
341
+ */
342
+ redactSecrets?: boolean;
289
343
  };