@cdwr/fly-node 0.3.4 → 0.3.5

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,14 @@
1
+ ## 0.3.5 (2026-11-15)
2
+
3
+ ### 🐞 Bug Fixes
4
+
5
+ - **fly-node:** await parse so nullOnError catches schema errors ([23f2ffb3](https://github.com/codeware-sthlm/cdwr/commit/23f2ffb3))
6
+ - **fly-node:** read certificate status from flyctl 0.5 certs list ([8ea5053f](https://github.com/codeware-sthlm/cdwr/commit/8ea5053f))
7
+
8
+ ### ✅ Tests
9
+
10
+ - **fly-node:** list a real certificate in the cli integration test ([522353c6](https://github.com/codeware-sthlm/cdwr/commit/522353c6))
11
+
1
12
  ## 0.3.4 (2026-11-15)
2
13
 
3
14
  ### 🐞 Bug Fixes
package/index.cjs CHANGED
@@ -823,16 +823,25 @@ var CertsListFlyResponseElementSchema = import_zod17.z.object({
823
823
  hostname: import_zod17.z.string(),
824
824
  clientStatus: import_zod17.z.string()
825
825
  });
826
+ var withClientStatus = (schema) => import_zod17.z.preprocess((data) => {
827
+ if (!data || typeof data !== "object" || Array.isArray(data)) {
828
+ return data;
829
+ }
830
+ const { status, ...rest } = data;
831
+ return status === void 0 ? rest : { ...rest, clientStatus: status };
832
+ }, schema);
826
833
  var CertsListTransformedResponseSchema = import_zod17.z.array(
827
- withCamelCase(CertsListFlyResponseElementSchema)
834
+ withCamelCase(withClientStatus(CertsListFlyResponseElementSchema))
828
835
  );
829
836
 
830
837
  // packages/fly-node/src/lib/schemas/certs-list-with-app.schema.ts
831
838
  var CertsListWithAppTransformedResponseSchema = import_zod19.z.array(
832
839
  withCamelCase(
833
- CertsListFlyResponseElementSchema.extend({
834
- app: import_zod19.z.string()
835
- })
840
+ withClientStatus(
841
+ CertsListFlyResponseElementSchema.extend({
842
+ app: import_zod19.z.string()
843
+ })
844
+ )
836
845
  )
837
846
  );
838
847
 
@@ -1752,7 +1761,7 @@ ${error}`);
1752
1761
  args.push(options?.app || "--generate-name");
1753
1762
  args.push("--org", options?.org || this._config.org || "personal");
1754
1763
  args.push("--json");
1755
- return AppsCreateTransformedResponseSchema.parseAsync(
1764
+ return await AppsCreateTransformedResponseSchema.parseAsync(
1756
1765
  await this.execFly(args)
1757
1766
  );
1758
1767
  }
@@ -2157,7 +2166,7 @@ ${error}`);
2157
2166
  async fetchAllApps(onError) {
2158
2167
  const args = ["apps", "list", "--json"];
2159
2168
  try {
2160
- return AppsListTransformedResponseSchema.parseAsync(
2169
+ return await AppsListTransformedResponseSchema.parseAsync(
2161
2170
  await this.execFly(args)
2162
2171
  );
2163
2172
  } catch (error) {
@@ -2268,7 +2277,7 @@ ${JSON.stringify(response, null, 2)}`);
2268
2277
  args.push(...this.getAppOrConfigArgs(options));
2269
2278
  args.push("--json");
2270
2279
  try {
2271
- return CertsListTransformedResponseSchema.parseAsync(
2280
+ return await CertsListTransformedResponseSchema.parseAsync(
2272
2281
  await this.execFly(args)
2273
2282
  );
2274
2283
  } catch (error) {
@@ -2283,7 +2292,7 @@ ${JSON.stringify(response, null, 2)}`);
2283
2292
  args.push(...this.getAppOrConfigArgs(options));
2284
2293
  args.push("--json");
2285
2294
  try {
2286
- return SecretsListTransformedResponseSchema.parseAsync(
2295
+ return await SecretsListTransformedResponseSchema.parseAsync(
2287
2296
  await this.execFly(args)
2288
2297
  );
2289
2298
  } catch (error) {
package/index.js CHANGED
@@ -779,16 +779,25 @@ var CertsListFlyResponseElementSchema = z14.object({
779
779
  hostname: z14.string(),
780
780
  clientStatus: z14.string()
781
781
  });
782
+ var withClientStatus = (schema) => z14.preprocess((data) => {
783
+ if (!data || typeof data !== "object" || Array.isArray(data)) {
784
+ return data;
785
+ }
786
+ const { status, ...rest } = data;
787
+ return status === void 0 ? rest : { ...rest, clientStatus: status };
788
+ }, schema);
782
789
  var CertsListTransformedResponseSchema = z14.array(
783
- withCamelCase(CertsListFlyResponseElementSchema)
790
+ withCamelCase(withClientStatus(CertsListFlyResponseElementSchema))
784
791
  );
785
792
 
786
793
  // packages/fly-node/src/lib/schemas/certs-list-with-app.schema.ts
787
794
  var CertsListWithAppTransformedResponseSchema = z15.array(
788
795
  withCamelCase(
789
- CertsListFlyResponseElementSchema.extend({
790
- app: z15.string()
791
- })
796
+ withClientStatus(
797
+ CertsListFlyResponseElementSchema.extend({
798
+ app: z15.string()
799
+ })
800
+ )
792
801
  )
793
802
  );
794
803
 
@@ -1708,7 +1717,7 @@ ${error}`);
1708
1717
  args.push(options?.app || "--generate-name");
1709
1718
  args.push("--org", options?.org || this._config.org || "personal");
1710
1719
  args.push("--json");
1711
- return AppsCreateTransformedResponseSchema.parseAsync(
1720
+ return await AppsCreateTransformedResponseSchema.parseAsync(
1712
1721
  await this.execFly(args)
1713
1722
  );
1714
1723
  }
@@ -2113,7 +2122,7 @@ ${error}`);
2113
2122
  async fetchAllApps(onError) {
2114
2123
  const args = ["apps", "list", "--json"];
2115
2124
  try {
2116
- return AppsListTransformedResponseSchema.parseAsync(
2125
+ return await AppsListTransformedResponseSchema.parseAsync(
2117
2126
  await this.execFly(args)
2118
2127
  );
2119
2128
  } catch (error) {
@@ -2224,7 +2233,7 @@ ${JSON.stringify(response, null, 2)}`);
2224
2233
  args.push(...this.getAppOrConfigArgs(options));
2225
2234
  args.push("--json");
2226
2235
  try {
2227
- return CertsListTransformedResponseSchema.parseAsync(
2236
+ return await CertsListTransformedResponseSchema.parseAsync(
2228
2237
  await this.execFly(args)
2229
2238
  );
2230
2239
  } catch (error) {
@@ -2239,7 +2248,7 @@ ${JSON.stringify(response, null, 2)}`);
2239
2248
  args.push(...this.getAppOrConfigArgs(options));
2240
2249
  args.push("--json");
2241
2250
  try {
2242
- return SecretsListTransformedResponseSchema.parseAsync(
2251
+ return await SecretsListTransformedResponseSchema.parseAsync(
2243
2252
  await this.execFly(args)
2244
2253
  );
2245
2254
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdwr/fly-node",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "The flyctl node wrapper for programmatic deployments to fly.io.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -2,9 +2,9 @@ import { z } from 'zod';
2
2
  /**
3
3
  * certs list response extended with application name
4
4
  */
5
- export declare const CertsListWithAppTransformedResponseSchema: z.ZodArray<z.ZodPreprocess<z.ZodObject<{
5
+ export declare const CertsListWithAppTransformedResponseSchema: z.ZodArray<z.ZodPreprocess<z.ZodPreprocess<z.ZodObject<{
6
6
  createdAt: z.ZodString;
7
7
  hostname: z.ZodString;
8
8
  clientStatus: z.ZodString;
9
9
  app: z.ZodString;
10
- }, z.core.$strip>, unknown>>;
10
+ }, z.core.$strip>, unknown>, unknown>>;
@@ -11,6 +11,14 @@ export declare const CertsListFlyResponseElementSchema: z.ZodObject<{
11
11
  hostname: z.ZodString;
12
12
  clientStatus: z.ZodString;
13
13
  }, z.core.$strip>;
14
+ /**
15
+ * A Zod preprocessor which reads the certificate state from `status`
16
+ * (flyctl 0.5 and later) or `clientStatus` (older flyctl),
17
+ * so the schema always gets one `clientStatus`.
18
+ *
19
+ * Expects camelCased keys, so wrap it in `withCamelCase`.
20
+ */
21
+ export declare const withClientStatus: <T extends z.ZodType>(schema: T) => z.ZodPreprocess<T, unknown>;
14
22
  /**
15
23
  * Transformed certs list response schema
16
24
  *
@@ -18,8 +26,8 @@ export declare const CertsListFlyResponseElementSchema: z.ZodObject<{
18
26
  * fly certs list --app [name] --json
19
27
  * ```
20
28
  */
21
- export declare const CertsListTransformedResponseSchema: z.ZodArray<z.ZodPreprocess<z.ZodObject<{
29
+ export declare const CertsListTransformedResponseSchema: z.ZodArray<z.ZodPreprocess<z.ZodPreprocess<z.ZodObject<{
22
30
  createdAt: z.ZodString;
23
31
  hostname: z.ZodString;
24
32
  clientStatus: z.ZodString;
25
- }, z.core.$strip>, unknown>>;
33
+ }, z.core.$strip>, unknown>, unknown>>;