@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.
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // packages/fly-node/src/lib/fly.class.ts
2
2
  import { existsSync } from "fs";
3
- import { join } from "path";
3
+ import { dirname, join } from "path";
4
4
  import { cwd } from "process";
5
5
 
6
6
  // packages/core/src/lib/utils/docker-build.ts
@@ -174,11 +174,7 @@ import { z as z4 } from "zod";
174
174
  var AppsCreateTransformedResponseSchema = withCamelCase(
175
175
  z4.object({
176
176
  id: z4.string(),
177
- name: z4.string(),
178
- organization: z4.object({
179
- id: z4.string(),
180
- name: z4.string()
181
- })
177
+ name: z4.string()
182
178
  })
183
179
  );
184
180
 
@@ -280,7 +276,7 @@ var PostgresListTransformedResponseSchema = z11.array(
280
276
  version: z11.number()
281
277
  })
282
278
  )
283
- );
279
+ ).or(z11.string());
284
280
 
285
281
  // packages/fly-node/src/lib/schemas/postgres-users-list.ts
286
282
  import { z as z12 } from "zod";
@@ -301,8 +297,7 @@ import { z as z14 } from "zod";
301
297
  import { z as z13 } from "zod";
302
298
  var SecretsListFlyResponseElementSchema = z13.object({
303
299
  name: z13.string(),
304
- digest: z13.string(),
305
- createdAt: z13.string().datetime()
300
+ digest: z13.string()
306
301
  });
307
302
  var SecretsListTransformedResponseSchema = z13.array(
308
303
  withCamelCase(SecretsListFlyResponseElementSchema)
@@ -383,15 +378,25 @@ var StatusExtendedTransformedResponseSchema = withCamelCase(
383
378
  }
384
379
  );
385
380
 
381
+ // packages/fly-node/src/lib/schemas/version.schema.ts
382
+ import { z as z17 } from "zod";
383
+ var VersionTransformedResponseSchema = withCamelCase(
384
+ z17.object({
385
+ name: z17.string(),
386
+ version: z17.string(),
387
+ commit: z17.string(),
388
+ branchName: z17.string(),
389
+ buildDate: z17.string().datetime(),
390
+ os: z17.string(),
391
+ architecture: z17.string(),
392
+ environment: z17.string()
393
+ })
394
+ );
395
+
386
396
  // packages/fly-node/src/lib/fly.class.ts
387
397
  var Fly = class {
388
398
  /** Use underscore to avoid conflict with public `config` property */
389
399
  _config;
390
- /**
391
- * Whether a user is authenticated via local login.
392
- * In this case a token is not needed, though it can still have been provided.
393
- */
394
- authByLogin = false;
395
400
  initialized = false;
396
401
  logger;
397
402
  /**
@@ -417,10 +422,11 @@ var Fly = class {
417
422
  this.logger = {
418
423
  info: config?.logger?.info || console.log,
419
424
  error: config?.logger?.error || console.error,
420
- traceCLI: config?.logger?.traceCLI || false
425
+ traceCLI: config?.logger?.traceCLI ?? false,
426
+ redactSecrets: config?.logger?.redactSecrets ?? true
421
427
  };
422
- if (!this._config.token) {
423
- this._config.token = process.env["FLY_API_TOKEN"] || "";
428
+ if (this._config.token) {
429
+ process.env["FLY_ACCESS_TOKEN"] = this._config.token;
424
430
  }
425
431
  }
426
432
  /**
@@ -456,7 +462,21 @@ ${error}`);
456
462
  *
457
463
  * @returns `true` if the Fly CLI tool is installed, `false` otherwise
458
464
  */
459
- isInstalled: async () => await this.isInstalled()
465
+ isInstalled: async () => await this.isInstalled(),
466
+ /**
467
+ * Get version information about the installed Fly CLI
468
+ *
469
+ * @returns The installed Fly CLI version information
470
+ * @throws An error if the version cannot be retrieved
471
+ */
472
+ version: async () => {
473
+ try {
474
+ return await this.version();
475
+ } catch (error) {
476
+ throw new Error(`[version] something broke
477
+ ${error}`);
478
+ }
479
+ }
460
480
  };
461
481
  //
462
482
  // External API following the `flyctl` CLI commands structure
@@ -475,9 +495,9 @@ ${error}`);
475
495
  create: async (options) => {
476
496
  try {
477
497
  await this.ensureInitialized();
478
- const { name } = await this.createApp(options);
479
- this.logger.info(`Application '${name}' was created`);
480
- return name;
498
+ const response = await this.createApp(options);
499
+ this.logger.info(`Application '${response.name}' was created`);
500
+ return response;
481
501
  } catch (error) {
482
502
  throw new Error(
483
503
  `[create app] something broke, check your apps
@@ -489,10 +509,9 @@ ${error}`
489
509
  * Destroy an application and make sure it gets detached from any Postgres clusters
490
510
  *
491
511
  * @param app - The name of the app to destroy
492
- * @param options - Options for destroying an application
493
512
  * @throws An error if the app cannot be destroyed
494
513
  */
495
- destroy: async (app, options) => {
514
+ destroy: async (app) => {
496
515
  try {
497
516
  await this.ensureInitialized();
498
517
  const attachedClusters = await this.getAttachedPostgresClusters(app);
@@ -503,7 +522,7 @@ ${error}`
503
522
  const output = await this.detachPostgres(cluster, app);
504
523
  this.logger.info(output);
505
524
  }
506
- await this.destroyApp(app, options?.force);
525
+ await this.destroyApp(app);
507
526
  this.logger.info(`Application '${app}' was destroyed`);
508
527
  } catch (error) {
509
528
  throw new Error(
@@ -595,6 +614,24 @@ ${error}`
595
614
  * Manage an app's configuration
596
615
  */
597
616
  config = {
617
+ /**
618
+ * Save an application's remote configuration locally as TOML file.
619
+ *
620
+ * @param options - Options for saving an application's configuration
621
+ * @throws An error if the configuration cannot be saved
622
+ */
623
+ save: async (options) => {
624
+ try {
625
+ await this.ensureInitialized();
626
+ await this.saveConfig(options);
627
+ this.logger.info(
628
+ `Configuration for '${options.app}' was saved to '${options.config}'`
629
+ );
630
+ } catch (error) {
631
+ throw new Error(`[save config] something broke
632
+ ${error}`);
633
+ }
634
+ },
598
635
  /**
599
636
  * Show an application's configuration.
600
637
  *
@@ -680,7 +717,7 @@ ${error}`
680
717
  }
681
718
  },
682
719
  /**
683
- * List secrets for an application
720
+ * List secrets for an application or all secrets when options is 'all'
684
721
  *
685
722
  * @param options - List secrets for an application or all secrets
686
723
  * @returns A list of secrets
@@ -791,8 +828,9 @@ ${error}`);
791
828
  async deployApp(options) {
792
829
  let appName = "";
793
830
  let appSecrets = [];
831
+ let deployConfig = options?.config || this.instanceConfig;
794
832
  let lookupApp = options?.app || this.instanceApp;
795
- const lookupConfig = options?.config || this.instanceConfig;
833
+ const lookupConfig = deployConfig;
796
834
  if (!lookupConfig) {
797
835
  throw new Error(
798
836
  "Fly config file must be provided to options or class instance, unable to deploy"
@@ -825,6 +863,26 @@ ${error}`);
825
863
  );
826
864
  }
827
865
  }
866
+ if (options?.preferRemoteConfig && appName) {
867
+ const remoteConfigPath = join(
868
+ dirname(lookupConfig),
869
+ `fly.${appName}.toml`
870
+ );
871
+ try {
872
+ await this.saveConfig({
873
+ app: appName,
874
+ config: remoteConfigPath
875
+ });
876
+ deployConfig = remoteConfigPath;
877
+ this.logger.info(
878
+ `Using remote config for existing app '${appName}' (saved to ${remoteConfigPath})`
879
+ );
880
+ } catch (error) {
881
+ this.logger.info(
882
+ `Failed to save remote config, will use local config: ${error}`
883
+ );
884
+ }
885
+ }
828
886
  if (!appName) {
829
887
  this.logger.info("Creating a new application...");
830
888
  const { name } = await this.createApp({
@@ -885,7 +943,7 @@ ${error}`);
885
943
  await this.attachPostgres(options.postgres, appName);
886
944
  }
887
945
  }
888
- const args = ["deploy", "--app", appName, "--config", lookupConfig];
946
+ const args = ["deploy", "--app", appName, "--config", deployConfig];
889
947
  if (options?.region) {
890
948
  args.push("--region", options.region);
891
949
  }
@@ -915,10 +973,8 @@ ${error}`);
915
973
  * @private
916
974
  * @throws An error if the app cannot be destroyed
917
975
  */
918
- async destroyApp(app, force) {
976
+ async destroyApp(app) {
919
977
  const args = ["apps", "destroy", app, "--yes"];
920
- if (force)
921
- args.push("--force");
922
978
  await this.execFly(args);
923
979
  }
924
980
  /**
@@ -1032,7 +1088,11 @@ ${error}`);
1032
1088
  const args = ["postgres", "list", "--json"];
1033
1089
  try {
1034
1090
  const response = await this.execFly(args);
1035
- return PostgresListTransformedResponseSchema.parse(response);
1091
+ const parsed = PostgresListTransformedResponseSchema.safeParse(response);
1092
+ if (parsed.success) {
1093
+ return Array.isArray(parsed.data) ? parsed.data : [];
1094
+ }
1095
+ throw parsed.error;
1036
1096
  } catch (error) {
1037
1097
  if (onError === "throwOnError") {
1038
1098
  throw error;
@@ -1143,11 +1203,29 @@ ${JSON.stringify(response, null, 2)}`);
1143
1203
  return null;
1144
1204
  }
1145
1205
  }
1206
+ /**
1207
+ * @private
1208
+ * Save remote config to a local file
1209
+ *
1210
+ * @throws An error if the config cannot be saved
1211
+ */
1212
+ async saveConfig(options) {
1213
+ const args = [
1214
+ "config",
1215
+ "save",
1216
+ "--app",
1217
+ options.app,
1218
+ "--config",
1219
+ options.config,
1220
+ "--yes"
1221
+ ];
1222
+ await this.execFly(args);
1223
+ }
1146
1224
  /**
1147
1225
  * @private
1148
1226
  * Ensure Fly CLI is installed and authenticated
1149
1227
  *
1150
- * @throws An error if Fly CLI is not installed or authentication fails
1228
+ * @throws An error if Fly CLI is not installed or not authenticated
1151
1229
  */
1152
1230
  async ensureInitialized() {
1153
1231
  if (this.initialized)
@@ -1156,32 +1234,18 @@ ${JSON.stringify(response, null, 2)}`);
1156
1234
  if (!await this.isInstalled()) {
1157
1235
  throw new Error("Fly CLI must be installed to use this library");
1158
1236
  }
1159
- this.logger.info("Authenticating with Fly.io...");
1160
- let user = await this.execFly(
1161
- ["auth", "whoami"],
1162
- void 0,
1163
- "nullOnError",
1164
- true
1165
- // won't use token
1166
- );
1167
- if (user) {
1168
- this.logger.info(`Detected logged in user '${user}'`);
1169
- this.authByLogin = true;
1170
- } else {
1171
- user = await this.execFly(["auth", "whoami"]);
1172
- this.logger.info(`Authenticated by token as '${user}'`);
1173
- }
1237
+ const { version } = await this.version();
1238
+ this.logger.info(`Fly CLI ${version} is installed`);
1239
+ const user = await this.execFly(["auth", "whoami"]);
1240
+ this.logger.info(`Authenticated as '${user}'`);
1174
1241
  this.initialized = true;
1175
1242
  } catch (error) {
1176
1243
  this.logger.error("Failed to initialize Fly");
1177
1244
  throw error;
1178
1245
  }
1179
1246
  }
1180
- async execFly(command, options, onError = "throwOnError", skipToken) {
1247
+ async execFly(command, options, onError = "throwOnError") {
1181
1248
  const args = Array.isArray(command) ? command : command.split(" ");
1182
- if (!skipToken && !this.authByLogin && this._config.token) {
1183
- args.push("--access-token", this._config.token);
1184
- }
1185
1249
  const flyCmd = "flyctl";
1186
1250
  const toLogCmd = `${flyCmd} ${args.join(" ")}`;
1187
1251
  let output = "";
@@ -1285,6 +1349,18 @@ ${errorMsg}`);
1285
1349
  async isInstalled() {
1286
1350
  return await this.execFly("version", void 0, "nullOnError") !== null;
1287
1351
  }
1352
+ /**
1353
+ * @private
1354
+ * Get the installed Fly CLI version
1355
+ *
1356
+ * @returns The installed Fly CLI version information
1357
+ * @throws An error if the version cannot be retrieved
1358
+ */
1359
+ async version() {
1360
+ return VersionTransformedResponseSchema.parse(
1361
+ await this.execFly(["version", "--json"])
1362
+ );
1363
+ }
1288
1364
  /**
1289
1365
  * @private
1290
1366
  * Normalize the options matching `AppOrConfig` type.
@@ -1311,17 +1387,44 @@ ${errorMsg}`);
1311
1387
  safeArg(arg) {
1312
1388
  return arg.replace(/\\/g, "\\\\").replace(/ /g, "\\ ");
1313
1389
  }
1390
+ /**
1391
+ * @private
1392
+ * Redact sensitive values from text.
1393
+ *
1394
+ * Identifies and redacts:
1395
+ * - Secret values provided with `secrets set KEY1=VALUE1 KEY2=VALUE2 ...`
1396
+ *
1397
+ * @param text - The text to redact
1398
+ * @returns The redacted text
1399
+ */
1400
+ redactSensitiveData(text) {
1401
+ const maskValue = (value) => value.length > 10 ? `${value.slice(0, 3)}[REDACTED]${value.slice(-3)}` : "[REDACTED]";
1402
+ const valuePattern = "((?:\\\\ |\\S)+)";
1403
+ return text.replace(
1404
+ new RegExp(
1405
+ `(secrets\\s+set\\s+.*?)([A-Z_][A-Z0-9_]*)=${valuePattern}`,
1406
+ "g"
1407
+ ),
1408
+ (_, prefix, key, value) => `${prefix}${key}=${maskValue(value)}`
1409
+ );
1410
+ }
1314
1411
  /**
1315
1412
  * @private
1316
1413
  * Trace the CLI calls, mocks and results
1317
1414
  *
1415
+ * Redacts sensitive data from CALL messages when enabled in logger config.
1416
+ *
1318
1417
  * @param type - The type of trace
1319
1418
  * @param msg - The message to trace
1320
1419
  */
1321
1420
  traceCLI(type, msg) {
1322
1421
  if (this.logger.traceCLI) {
1323
1422
  const typeLabel = type === "CALL" ? " CALL " : type === "MOCK" ? " MOCK " : "RESULT";
1324
- this.logger.info(`[${typeLabel}] ${msg}`);
1423
+ let message = msg;
1424
+ if (type === "CALL" && this.logger.redactSecrets && msg) {
1425
+ message = this.redactSensitiveData(msg);
1426
+ }
1427
+ this.logger.info(`[${typeLabel}] ${message}`);
1325
1428
  }
1326
1429
  }
1327
1430
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdwr/fly-node",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "The flyctl node wrapper for programmatic deployments to fly.io.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,6 +27,11 @@
27
27
  "dependencies": {
28
28
  "zod": "^3.23.8"
29
29
  },
30
+ "devDependencies": {
31
+ "dotenv": "^16.4.7",
32
+ "dotenv-expand": "^11.0.7",
33
+ "is-ci": "^3.0.1"
34
+ },
30
35
  "exports": {
31
36
  ".": {
32
37
  "types": "./src/index.d.ts",
package/src/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export * from './lib/fly.class';
2
- export type { Config, DeployAppOptions, DeployResponse } from './lib/types';
2
+ export type { Config, DeployAppOptions, DeployResponse, SaveConfigOptions } from './lib/types';
@@ -1,5 +1,5 @@
1
1
  import { SpawnOptions, SpawnPtyOptions } from '@codeware/core/utils';
2
- import type { AppOrConfig, Config, CreateAppOptions, DeployAppOptions, DeployResponse, DestroyAppOptions, ListAppResponse, ListCertForAllResponse, ListCertForAppResponse, ListSecretForAllResponse, ListSecretForAppResponse, SetAppSecretsOptions, ShowConfigOptions, ShowConfigResponse, StatusExtendedResponse, StatusResponse, UnsetAppSecretsOptions } from './types';
2
+ import type { AppOrConfig, Config, CreateAppOptions, CreateAppResponse, DeployAppOptions, DeployResponse, ListAppResponse, ListCertForAllResponse, ListCertForAppResponse, ListSecretForAllResponse, ListSecretForAppResponse, SaveConfigOptions, SetAppSecretsOptions, ShowConfigOptions, ShowConfigResponse, StatusExtendedResponse, StatusResponse, UnsetAppSecretsOptions, VersionResponse } from './types';
3
3
  export type ExecFlyOptions = SpawnOptions & SpawnPtyOptions;
4
4
  /**
5
5
  * Manages deployments to Fly.io using the `flyctl` CLI tool.
@@ -7,11 +7,6 @@ export type ExecFlyOptions = SpawnOptions & SpawnPtyOptions;
7
7
  export declare class Fly {
8
8
  /** Use underscore to avoid conflict with public `config` property */
9
9
  private _config;
10
- /**
11
- * Whether a user is authenticated via local login.
12
- * In this case a token is not needed, though it can still have been provided.
13
- */
14
- private authByLogin;
15
10
  private initialized;
16
11
  private logger;
17
12
  /**
@@ -45,6 +40,13 @@ export declare class Fly {
45
40
  * @returns `true` if the Fly CLI tool is installed, `false` otherwise
46
41
  */
47
42
  isInstalled: () => Promise<boolean>;
43
+ /**
44
+ * Get version information about the installed Fly CLI
45
+ *
46
+ * @returns The installed Fly CLI version information
47
+ * @throws An error if the version cannot be retrieved
48
+ */
49
+ version: () => Promise<VersionResponse>;
48
50
  };
49
51
  /**
50
52
  * Manage apps
@@ -57,22 +59,21 @@ export declare class Fly {
57
59
  * @returns The name of the created application
58
60
  * @throws An error if the application cannot be created
59
61
  */
60
- create: (options?: CreateAppOptions) => Promise<string>;
62
+ create: (options?: CreateAppOptions) => Promise<CreateAppResponse>;
61
63
  /**
62
64
  * Destroy an application and make sure it gets detached from any Postgres clusters
63
65
  *
64
66
  * @param app - The name of the app to destroy
65
- * @param options - Options for destroying an application
66
67
  * @throws An error if the app cannot be destroyed
67
68
  */
68
- destroy: (app: string, options?: DestroyAppOptions) => Promise<void>;
69
+ destroy: (app: string) => Promise<void>;
69
70
  /**
70
71
  * List all applications
71
72
  *
72
73
  * @returns A list of applications
73
74
  * @throws An error if listing applications fails
74
75
  */
75
- list: () => Promise<Array<ListAppResponse>>;
76
+ list: () => Promise<ListAppResponse>;
76
77
  };
77
78
  /**
78
79
  * Manage certificates
@@ -93,7 +94,7 @@ export declare class Fly {
93
94
  * @returns A list of certificates
94
95
  * @throws An error if listing certificates fails
95
96
  */
96
- list: <T extends AppOrConfig | "all">(options?: T) => Promise<T extends "all" ? Array<ListCertForAllResponse> : Array<ListCertForAppResponse>>;
97
+ list: <T extends AppOrConfig | "all">(options?: T) => Promise<T extends "all" ? ListCertForAllResponse : ListCertForAppResponse>;
97
98
  /**
98
99
  * Remove a certificate for a domain from an application
99
100
  *
@@ -107,6 +108,13 @@ export declare class Fly {
107
108
  * Manage an app's configuration
108
109
  */
109
110
  config: {
111
+ /**
112
+ * Save an application's remote configuration locally as TOML file.
113
+ *
114
+ * @param options - Options for saving an application's configuration
115
+ * @throws An error if the configuration cannot be saved
116
+ */
117
+ save: (options: SaveConfigOptions) => Promise<void>;
110
118
  /**
111
119
  * Show an application's configuration.
112
120
  *
@@ -149,13 +157,13 @@ export declare class Fly {
149
157
  */
150
158
  set: (secrets: Record<string, string>, options?: SetAppSecretsOptions) => Promise<void>;
151
159
  /**
152
- * List secrets for an application
160
+ * List secrets for an application or all secrets when options is 'all'
153
161
  *
154
162
  * @param options - List secrets for an application or all secrets
155
163
  * @returns A list of secrets
156
164
  * @throws An error if listing secrets fails
157
165
  */
158
- list: <T extends AppOrConfig | "all">(options?: T) => Promise<T extends "all" ? Array<ListSecretForAllResponse> : Array<ListSecretForAppResponse>>;
166
+ list: <T extends AppOrConfig | "all">(options?: T) => Promise<T extends "all" ? ListSecretForAllResponse : ListSecretForAppResponse>;
159
167
  /**
160
168
  * Unset secrets for an application
161
169
  *
@@ -288,11 +296,18 @@ export declare class Fly {
288
296
  * @throws An error if the config cannot be retrieved and `throwOnError` is used
289
297
  */
290
298
  private showConfig;
299
+ /**
300
+ * @private
301
+ * Save remote config to a local file
302
+ *
303
+ * @throws An error if the config cannot be saved
304
+ */
305
+ private saveConfig;
291
306
  /**
292
307
  * @private
293
308
  * Ensure Fly CLI is installed and authenticated
294
309
  *
295
- * @throws An error if Fly CLI is not installed or authentication fails
310
+ * @throws An error if Fly CLI is not installed or not authenticated
296
311
  */
297
312
  private ensureInitialized;
298
313
  /**
@@ -336,6 +351,14 @@ export declare class Fly {
336
351
  * @returns `true` if the Fly CLI is installed, `false` otherwise
337
352
  */
338
353
  private isInstalled;
354
+ /**
355
+ * @private
356
+ * Get the installed Fly CLI version
357
+ *
358
+ * @returns The installed Fly CLI version information
359
+ * @throws An error if the version cannot be retrieved
360
+ */
361
+ private version;
339
362
  /**
340
363
  * @private
341
364
  * Normalize the options matching `AppOrConfig` type.
@@ -353,10 +376,23 @@ export declare class Fly {
353
376
  * @returns The escaped argument
354
377
  */
355
378
  private safeArg;
379
+ /**
380
+ * @private
381
+ * Redact sensitive values from text.
382
+ *
383
+ * Identifies and redacts:
384
+ * - Secret values provided with `secrets set KEY1=VALUE1 KEY2=VALUE2 ...`
385
+ *
386
+ * @param text - The text to redact
387
+ * @returns The redacted text
388
+ */
389
+ private redactSensitiveData;
356
390
  /**
357
391
  * @private
358
392
  * Trace the CLI calls, mocks and results
359
393
  *
394
+ * Redacts sensitive data from CALL messages when enabled in logger config.
395
+ *
360
396
  * @param type - The type of trace
361
397
  * @param msg - The message to trace
362
398
  */
@@ -30,7 +30,7 @@ export declare const mockDefs: {
30
30
  /**
31
31
  * Mock `fly apps list` response for testing.
32
32
  */
33
- export declare const mockAppsListResponse: Array<ListAppResponse>;
33
+ export declare const mockAppsListResponse: ListAppResponse;
34
34
  /**
35
35
  * Mock `fly apps create` response for testing.
36
36
  *
@@ -40,31 +40,33 @@ export declare const mockCreateAppResponse: (app?: string) => CreateAppResponse;
40
40
  /**
41
41
  * Mock `fly certs list` response for testing.
42
42
  */
43
- export declare const mockListCertForAppResponse: Array<ListCertForAppResponse>;
43
+ export declare const mockListCertForAppResponse: ListCertForAppResponse;
44
44
  /**
45
45
  * Mock `fly certs list` response for all apps for testing.
46
46
  *
47
47
  * All apps from `mockAppsListResponse` gets the same certificates from `mockListCertForAppResponse`
48
48
  */
49
- export declare const mockListCertForAllResponse: Array<ListCertForAllResponse>;
49
+ export declare const mockListCertForAllResponse: ListCertForAllResponse;
50
50
  /**
51
51
  * Mock `fly postgres list` response for testing.
52
+ *
53
+ * TODO: Mock the string response when there are no Postgres clusters.
52
54
  */
53
- export declare const mockListPostgresResponse: Array<ListPostgresResponse>;
55
+ export declare const mockListPostgresResponse: ListPostgresResponse;
54
56
  /**
55
57
  * Mock `fly postgres users list` response for testing.
56
58
  */
57
- export declare const mockListPostgresUsersResponse: Array<ListPostgresUsersResponse>;
59
+ export declare const mockListPostgresUsersResponse: ListPostgresUsersResponse;
58
60
  /**
59
61
  * Mock `fly secrets list` response for testing.
60
62
  */
61
- export declare const mockListSecretForAppResponse: Array<ListSecretForAppResponse>;
63
+ export declare const mockListSecretForAppResponse: ListSecretForAppResponse;
62
64
  /**
63
65
  * Mock `fly secrets list` response for all apps for testing.
64
66
  *
65
67
  * All apps from `mockAppsListResponse` gets the same secrets from `mockListSecretForAppResponse`
66
68
  */
67
- export declare const mockListSecretForAllResponse: Array<ListSecretForAllResponse>;
69
+ export declare const mockListSecretForAllResponse: ListSecretForAllResponse;
68
70
  /**
69
71
  * Mock `fly config show` response for testing.
70
72
  *
@@ -91,3 +93,16 @@ export declare const mockShowConfigResponse: (app?: string) => {
91
93
  * @param app - The app name to use in the response (defaults to `mockDefs.testApp`)
92
94
  */
93
95
  export declare const mockStatusResponse: (app?: string) => StatusResponse;
96
+ /**
97
+ * Mock `fly version` response for testing.
98
+ */
99
+ export declare const mockVersionResponse: {
100
+ Name: string;
101
+ Version: string;
102
+ Commit: string;
103
+ BranchName: string;
104
+ BuildDate: string;
105
+ OS: string;
106
+ Architecture: string;
107
+ Environment: string;
108
+ };
@@ -9,35 +9,13 @@ import { z } from 'zod';
9
9
  export declare const AppsCreateTransformedResponseSchema: z.ZodEffects<z.ZodObject<{
10
10
  id: z.ZodString;
11
11
  name: z.ZodString;
12
- organization: z.ZodObject<{
13
- id: z.ZodString;
14
- name: z.ZodString;
15
- }, "strip", z.ZodTypeAny, {
16
- name: string;
17
- id: string;
18
- }, {
19
- name: string;
20
- id: string;
21
- }>;
22
12
  }, "strip", z.ZodTypeAny, {
23
13
  name: string;
24
14
  id: string;
25
- organization: {
26
- name: string;
27
- id: string;
28
- };
29
15
  }, {
30
16
  name: string;
31
17
  id: string;
32
- organization: {
33
- name: string;
34
- id: string;
35
- };
36
18
  }>, {
37
19
  name: string;
38
20
  id: string;
39
- organization: {
40
- name: string;
41
- id: string;
42
- };
43
21
  }, unknown>;