@zapier/zapier-sdk-cli 0.13.9 → 0.13.10

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,5 +1,11 @@
1
1
  # @zapier/zapier-sdk-cli
2
2
 
3
+ ## 0.13.10
4
+
5
+ ### Patch Changes
6
+
7
+ - f56c6a0: Refactor buildManifest and generateAppTypes to throw proper errors, instead of returning an error property
8
+
3
9
  ## 0.13.9
4
10
 
5
11
  ### Patch Changes
package/dist/cli.cjs CHANGED
@@ -1251,28 +1251,28 @@ var client_default = api;
1251
1251
 
1252
1252
  // src/utils/getCallablePromise.ts
1253
1253
  var getCallablePromise = () => {
1254
- let resolve3 = () => {
1254
+ let resolve4 = () => {
1255
1255
  };
1256
1256
  let reject = () => {
1257
1257
  };
1258
1258
  const promise = new Promise((_resolve, _reject) => {
1259
- resolve3 = _resolve;
1259
+ resolve4 = _resolve;
1260
1260
  reject = _reject;
1261
1261
  });
1262
1262
  return {
1263
1263
  promise,
1264
- resolve: resolve3,
1264
+ resolve: resolve4,
1265
1265
  reject
1266
1266
  };
1267
1267
  };
1268
1268
  var getCallablePromise_default = getCallablePromise;
1269
1269
  var findAvailablePort = () => {
1270
- return new Promise((resolve3, reject) => {
1270
+ return new Promise((resolve4, reject) => {
1271
1271
  let portIndex = 0;
1272
1272
  const tryPort = (port) => {
1273
1273
  const server = express__default.default().listen(port, () => {
1274
1274
  server.close();
1275
- resolve3(port);
1275
+ resolve4(port);
1276
1276
  });
1277
1277
  server.on("error", (err) => {
1278
1278
  if (err.code === "EADDRINUSE") {
@@ -1362,15 +1362,15 @@ var login = async (timeoutMs = LOGIN_TIMEOUT_MS) => {
1362
1362
  } finally {
1363
1363
  process.off("SIGINT", cleanup);
1364
1364
  process.off("SIGTERM", cleanup);
1365
- await new Promise((resolve3) => {
1365
+ await new Promise((resolve4) => {
1366
1366
  const timeout = setTimeout(() => {
1367
1367
  log_default.info("Server close timed out, forcing connection shutdown...");
1368
1368
  connections.forEach((conn) => conn.destroy());
1369
- resolve3();
1369
+ resolve4();
1370
1370
  }, 1e3);
1371
1371
  server.close(() => {
1372
1372
  clearTimeout(timeout);
1373
- resolve3();
1373
+ resolve4();
1374
1374
  });
1375
1375
  });
1376
1376
  }
@@ -1402,7 +1402,7 @@ var LoginSchema = zod.z.object({
1402
1402
 
1403
1403
  // package.json
1404
1404
  var package_default = {
1405
- version: "0.13.9"};
1405
+ version: "0.13.10"};
1406
1406
 
1407
1407
  // src/telemetry/builders.ts
1408
1408
  function createCliBaseEvent(context = {}) {
@@ -1793,14 +1793,6 @@ var addPlugin = ({ sdk: sdk2 }) => {
1793
1793
  if (successfulApps.length > 0) {
1794
1794
  console.log(`\u2705 Added ${successfulApps.length} app(s) to manifest`);
1795
1795
  }
1796
- const allErrors = [...manifestResult.errors, ...typesResult.errors];
1797
- if (allErrors.length > 0) {
1798
- console.warn(`
1799
- \u26A0\uFE0F ${allErrors.length} error(s) occurred:`);
1800
- allErrors.forEach(({ appKey, error }) => {
1801
- console.warn(` - ${appKey}: ${error}`);
1802
- });
1803
- }
1804
1796
  }, AddSchema);
1805
1797
  return {
1806
1798
  add,
@@ -2420,17 +2412,12 @@ var generateAppTypesPlugin = ({ sdk: sdk2 }) => {
2420
2412
  appKeys,
2421
2413
  authenticationIds,
2422
2414
  skipWrite = false,
2423
- typesOutputDirectory,
2415
+ typesOutputDirectory = await detectTypesOutputDirectory(),
2424
2416
  onProgress
2425
2417
  } = options;
2426
- if (!skipWrite && !typesOutputDirectory) {
2427
- throw new Error(
2428
- "typesOutputDirectory is required when skipWrite is false"
2429
- );
2430
- }
2418
+ const resolvedTypesOutput = path.resolve(typesOutputDirectory);
2431
2419
  const result = {
2432
- typeDefinitions: {},
2433
- errors: []
2420
+ typeDefinitions: {}
2434
2421
  };
2435
2422
  onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
2436
2423
  const appsIterator = sdk2.listApps({ appKeys }).items();
@@ -2458,8 +2445,8 @@ var generateAppTypesPlugin = ({ sdk: sdk2 }) => {
2458
2445
  count: authentications.length
2459
2446
  });
2460
2447
  }
2461
- if (!skipWrite && typesOutputDirectory) {
2462
- await promises.mkdir(typesOutputDirectory, { recursive: true });
2448
+ if (!skipWrite && resolvedTypesOutput) {
2449
+ await promises.mkdir(resolvedTypesOutput, { recursive: true });
2463
2450
  }
2464
2451
  if (!skipWrite) {
2465
2452
  result.writtenFiles = {};
@@ -2472,17 +2459,18 @@ var generateAppTypesPlugin = ({ sdk: sdk2 }) => {
2472
2459
  });
2473
2460
  try {
2474
2461
  if (!app.version) {
2475
- const error = `Invalid implementation ID format: ${app.implementation_id}. Expected format: <implementationName>@<version>`;
2476
- result.errors.push({
2477
- appKey: app.key,
2478
- error
2479
- });
2462
+ const errorMessage = `Invalid implementation ID format: ${app.implementation_id}. Expected format: <implementationName>@<version>`;
2480
2463
  onProgress?.({
2481
2464
  type: "app_processing_error",
2482
2465
  appKey: app.key,
2483
- error
2466
+ error: errorMessage
2467
+ });
2468
+ throw new zapierSdk.ZapierValidationError(errorMessage, {
2469
+ details: {
2470
+ appKey: app.key,
2471
+ implementationId: app.implementation_id
2472
+ }
2484
2473
  });
2485
- continue;
2486
2474
  }
2487
2475
  let authenticationId;
2488
2476
  if (authentications.length > 0) {
@@ -2505,56 +2493,47 @@ var generateAppTypesPlugin = ({ sdk: sdk2 }) => {
2505
2493
  }
2506
2494
  }
2507
2495
  const manifestKey = getManifestKey(app);
2508
- try {
2509
- const generator = new AstTypeGenerator();
2510
- const typeDefinitionString = await generator.generateTypes({
2511
- app,
2512
- authenticationId,
2513
- sdk: sdk2
2514
- });
2515
- result.typeDefinitions[manifestKey] = typeDefinitionString;
2496
+ const generator = new AstTypeGenerator();
2497
+ const typeDefinitionString = await generator.generateTypes({
2498
+ app,
2499
+ authenticationId,
2500
+ sdk: sdk2
2501
+ });
2502
+ result.typeDefinitions[manifestKey] = typeDefinitionString;
2503
+ onProgress?.({
2504
+ type: "type_generated",
2505
+ manifestKey,
2506
+ sizeBytes: typeDefinitionString.length
2507
+ });
2508
+ if (!skipWrite && resolvedTypesOutput && result.writtenFiles) {
2509
+ const filePath = path.join(resolvedTypesOutput, `${manifestKey}.d.ts`);
2510
+ await promises.writeFile(filePath, typeDefinitionString, "utf8");
2511
+ result.writtenFiles[manifestKey] = filePath;
2516
2512
  onProgress?.({
2517
- type: "type_generated",
2513
+ type: "file_written",
2518
2514
  manifestKey,
2519
- sizeBytes: typeDefinitionString.length
2520
- });
2521
- if (!skipWrite && typesOutputDirectory && result.writtenFiles) {
2522
- const filePath = path.join(typesOutputDirectory, `${manifestKey}.d.ts`);
2523
- await promises.writeFile(filePath, typeDefinitionString, "utf8");
2524
- result.writtenFiles[manifestKey] = filePath;
2525
- onProgress?.({
2526
- type: "file_written",
2527
- manifestKey,
2528
- filePath
2529
- });
2530
- }
2531
- onProgress?.({
2532
- type: "app_processing_complete",
2533
- appKey: app.key
2534
- });
2535
- } catch (error) {
2536
- const errorMessage = `Failed to generate types: ${error}`;
2537
- result.errors.push({
2538
- appKey: app.key,
2539
- error: errorMessage
2540
- });
2541
- onProgress?.({
2542
- type: "app_processing_error",
2543
- appKey: app.key,
2544
- error: errorMessage
2515
+ filePath
2545
2516
  });
2546
2517
  }
2547
- } catch (error) {
2548
- const errorMessage = `Failed to process app: ${error}`;
2549
- result.errors.push({
2550
- appKey: app.key,
2551
- error: errorMessage
2518
+ onProgress?.({
2519
+ type: "app_processing_complete",
2520
+ appKey: app.key
2552
2521
  });
2522
+ } catch (error) {
2523
+ const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
2553
2524
  onProgress?.({
2554
2525
  type: "app_processing_error",
2555
2526
  appKey: app.key,
2556
2527
  error: errorMessage
2557
2528
  });
2529
+ if (error instanceof zapierSdk.ZapierValidationError) {
2530
+ throw error;
2531
+ } else {
2532
+ throw new zapierSdk.ZapierUnknownError(errorMessage, {
2533
+ cause: error
2534
+ // Works for both Error and non-Error
2535
+ });
2536
+ }
2558
2537
  }
2559
2538
  }
2560
2539
  return result;
@@ -2589,9 +2568,6 @@ var BuildManifestSchema = zod.z.object({
2589
2568
  var buildManifestPlugin = ({ sdk: sdk2, context }) => {
2590
2569
  const buildManifest = zapierSdk.createFunction(async function buildManifest2(options) {
2591
2570
  const { appKeys, skipWrite = false, configPath, onProgress } = options;
2592
- const result = {
2593
- errors: []
2594
- };
2595
2571
  onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
2596
2572
  const appsIterator = sdk2.listApps({ appKeys }).items();
2597
2573
  const apps = [];
@@ -2601,7 +2577,7 @@ var buildManifestPlugin = ({ sdk: sdk2, context }) => {
2601
2577
  }
2602
2578
  onProgress?.({ type: "apps_lookup_complete", count: apps.length });
2603
2579
  if (apps.length === 0) {
2604
- return result;
2580
+ return {};
2605
2581
  }
2606
2582
  let updatedManifest;
2607
2583
  for (const app of apps) {
@@ -2634,20 +2610,23 @@ var buildManifestPlugin = ({ sdk: sdk2, context }) => {
2634
2610
  });
2635
2611
  onProgress?.({ type: "app_processing_complete", appKey: app.key });
2636
2612
  } catch (error) {
2637
- const errorMessage = `Failed to process app: ${error}`;
2638
- result.errors.push({
2639
- appKey: app.key,
2640
- error: errorMessage
2641
- });
2613
+ const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
2642
2614
  onProgress?.({
2643
2615
  type: "app_processing_error",
2644
2616
  appKey: app.key,
2645
2617
  error: errorMessage
2646
2618
  });
2619
+ if (error instanceof zapierSdk.ZapierValidationError) {
2620
+ throw error;
2621
+ } else {
2622
+ throw new zapierSdk.ZapierUnknownError(errorMessage, {
2623
+ cause: error
2624
+ // Works for both Error and non-Error
2625
+ });
2626
+ }
2647
2627
  }
2648
2628
  }
2649
- result.manifest = updatedManifest;
2650
- return result;
2629
+ return { manifest: updatedManifest };
2651
2630
  }, BuildManifestSchema);
2652
2631
  return {
2653
2632
  buildManifest,
@@ -2671,7 +2650,7 @@ function createZapierCliSdk(options = {}) {
2671
2650
 
2672
2651
  // package.json with { type: 'json' }
2673
2652
  var package_default2 = {
2674
- version: "0.13.9"};
2653
+ version: "0.13.10"};
2675
2654
 
2676
2655
  // src/cli.ts
2677
2656
  var program = new commander.Command();
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from 'commander';
3
3
  import { z } from 'zod';
4
- import { createFunction, OutputPropertySchema, DEFAULT_CONFIG_PATH, createZapierSdkWithoutRegistry, registryPlugin, toSnakeCase, ZapierError, formatErrorMessage, getOsInfo, getPlatformVersions, getCiPlatform, isCi, isPositional, getReleaseId, getCurrentTimestamp, generateEventId } from '@zapier/zapier-sdk';
4
+ import { createFunction, OutputPropertySchema, DEFAULT_CONFIG_PATH, createZapierSdkWithoutRegistry, registryPlugin, ZapierValidationError, ZapierUnknownError, toSnakeCase, ZapierError, formatErrorMessage, getOsInfo, getPlatformVersions, getCiPlatform, isCi, isPositional, getReleaseId, getCurrentTimestamp, generateEventId } from '@zapier/zapier-sdk';
5
5
  import inquirer from 'inquirer';
6
6
  import chalk3 from 'chalk';
7
7
  import util from 'util';
@@ -15,7 +15,7 @@ import { startMcpServerAsProcess } from '@zapier/zapier-sdk-mcp';
15
15
  import { buildSync } from 'esbuild';
16
16
  import * as fs from 'fs';
17
17
  import * as path from 'path';
18
- import { join, resolve } from 'path';
18
+ import { resolve, join } from 'path';
19
19
  import { mkdir, writeFile, access } from 'fs/promises';
20
20
  import * as ts from 'typescript';
21
21
 
@@ -1218,28 +1218,28 @@ var client_default = api;
1218
1218
 
1219
1219
  // src/utils/getCallablePromise.ts
1220
1220
  var getCallablePromise = () => {
1221
- let resolve3 = () => {
1221
+ let resolve4 = () => {
1222
1222
  };
1223
1223
  let reject = () => {
1224
1224
  };
1225
1225
  const promise = new Promise((_resolve, _reject) => {
1226
- resolve3 = _resolve;
1226
+ resolve4 = _resolve;
1227
1227
  reject = _reject;
1228
1228
  });
1229
1229
  return {
1230
1230
  promise,
1231
- resolve: resolve3,
1231
+ resolve: resolve4,
1232
1232
  reject
1233
1233
  };
1234
1234
  };
1235
1235
  var getCallablePromise_default = getCallablePromise;
1236
1236
  var findAvailablePort = () => {
1237
- return new Promise((resolve3, reject) => {
1237
+ return new Promise((resolve4, reject) => {
1238
1238
  let portIndex = 0;
1239
1239
  const tryPort = (port) => {
1240
1240
  const server = express().listen(port, () => {
1241
1241
  server.close();
1242
- resolve3(port);
1242
+ resolve4(port);
1243
1243
  });
1244
1244
  server.on("error", (err) => {
1245
1245
  if (err.code === "EADDRINUSE") {
@@ -1329,15 +1329,15 @@ var login = async (timeoutMs = LOGIN_TIMEOUT_MS) => {
1329
1329
  } finally {
1330
1330
  process.off("SIGINT", cleanup);
1331
1331
  process.off("SIGTERM", cleanup);
1332
- await new Promise((resolve3) => {
1332
+ await new Promise((resolve4) => {
1333
1333
  const timeout = setTimeout(() => {
1334
1334
  log_default.info("Server close timed out, forcing connection shutdown...");
1335
1335
  connections.forEach((conn) => conn.destroy());
1336
- resolve3();
1336
+ resolve4();
1337
1337
  }, 1e3);
1338
1338
  server.close(() => {
1339
1339
  clearTimeout(timeout);
1340
- resolve3();
1340
+ resolve4();
1341
1341
  });
1342
1342
  });
1343
1343
  }
@@ -1369,7 +1369,7 @@ var LoginSchema = z.object({
1369
1369
 
1370
1370
  // package.json
1371
1371
  var package_default = {
1372
- version: "0.13.9"};
1372
+ version: "0.13.10"};
1373
1373
 
1374
1374
  // src/telemetry/builders.ts
1375
1375
  function createCliBaseEvent(context = {}) {
@@ -1760,14 +1760,6 @@ var addPlugin = ({ sdk: sdk2 }) => {
1760
1760
  if (successfulApps.length > 0) {
1761
1761
  console.log(`\u2705 Added ${successfulApps.length} app(s) to manifest`);
1762
1762
  }
1763
- const allErrors = [...manifestResult.errors, ...typesResult.errors];
1764
- if (allErrors.length > 0) {
1765
- console.warn(`
1766
- \u26A0\uFE0F ${allErrors.length} error(s) occurred:`);
1767
- allErrors.forEach(({ appKey, error }) => {
1768
- console.warn(` - ${appKey}: ${error}`);
1769
- });
1770
- }
1771
1763
  }, AddSchema);
1772
1764
  return {
1773
1765
  add,
@@ -2387,17 +2379,12 @@ var generateAppTypesPlugin = ({ sdk: sdk2 }) => {
2387
2379
  appKeys,
2388
2380
  authenticationIds,
2389
2381
  skipWrite = false,
2390
- typesOutputDirectory,
2382
+ typesOutputDirectory = await detectTypesOutputDirectory(),
2391
2383
  onProgress
2392
2384
  } = options;
2393
- if (!skipWrite && !typesOutputDirectory) {
2394
- throw new Error(
2395
- "typesOutputDirectory is required when skipWrite is false"
2396
- );
2397
- }
2385
+ const resolvedTypesOutput = resolve(typesOutputDirectory);
2398
2386
  const result = {
2399
- typeDefinitions: {},
2400
- errors: []
2387
+ typeDefinitions: {}
2401
2388
  };
2402
2389
  onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
2403
2390
  const appsIterator = sdk2.listApps({ appKeys }).items();
@@ -2425,8 +2412,8 @@ var generateAppTypesPlugin = ({ sdk: sdk2 }) => {
2425
2412
  count: authentications.length
2426
2413
  });
2427
2414
  }
2428
- if (!skipWrite && typesOutputDirectory) {
2429
- await mkdir(typesOutputDirectory, { recursive: true });
2415
+ if (!skipWrite && resolvedTypesOutput) {
2416
+ await mkdir(resolvedTypesOutput, { recursive: true });
2430
2417
  }
2431
2418
  if (!skipWrite) {
2432
2419
  result.writtenFiles = {};
@@ -2439,17 +2426,18 @@ var generateAppTypesPlugin = ({ sdk: sdk2 }) => {
2439
2426
  });
2440
2427
  try {
2441
2428
  if (!app.version) {
2442
- const error = `Invalid implementation ID format: ${app.implementation_id}. Expected format: <implementationName>@<version>`;
2443
- result.errors.push({
2444
- appKey: app.key,
2445
- error
2446
- });
2429
+ const errorMessage = `Invalid implementation ID format: ${app.implementation_id}. Expected format: <implementationName>@<version>`;
2447
2430
  onProgress?.({
2448
2431
  type: "app_processing_error",
2449
2432
  appKey: app.key,
2450
- error
2433
+ error: errorMessage
2434
+ });
2435
+ throw new ZapierValidationError(errorMessage, {
2436
+ details: {
2437
+ appKey: app.key,
2438
+ implementationId: app.implementation_id
2439
+ }
2451
2440
  });
2452
- continue;
2453
2441
  }
2454
2442
  let authenticationId;
2455
2443
  if (authentications.length > 0) {
@@ -2472,56 +2460,47 @@ var generateAppTypesPlugin = ({ sdk: sdk2 }) => {
2472
2460
  }
2473
2461
  }
2474
2462
  const manifestKey = getManifestKey(app);
2475
- try {
2476
- const generator = new AstTypeGenerator();
2477
- const typeDefinitionString = await generator.generateTypes({
2478
- app,
2479
- authenticationId,
2480
- sdk: sdk2
2481
- });
2482
- result.typeDefinitions[manifestKey] = typeDefinitionString;
2463
+ const generator = new AstTypeGenerator();
2464
+ const typeDefinitionString = await generator.generateTypes({
2465
+ app,
2466
+ authenticationId,
2467
+ sdk: sdk2
2468
+ });
2469
+ result.typeDefinitions[manifestKey] = typeDefinitionString;
2470
+ onProgress?.({
2471
+ type: "type_generated",
2472
+ manifestKey,
2473
+ sizeBytes: typeDefinitionString.length
2474
+ });
2475
+ if (!skipWrite && resolvedTypesOutput && result.writtenFiles) {
2476
+ const filePath = join(resolvedTypesOutput, `${manifestKey}.d.ts`);
2477
+ await writeFile(filePath, typeDefinitionString, "utf8");
2478
+ result.writtenFiles[manifestKey] = filePath;
2483
2479
  onProgress?.({
2484
- type: "type_generated",
2480
+ type: "file_written",
2485
2481
  manifestKey,
2486
- sizeBytes: typeDefinitionString.length
2487
- });
2488
- if (!skipWrite && typesOutputDirectory && result.writtenFiles) {
2489
- const filePath = join(typesOutputDirectory, `${manifestKey}.d.ts`);
2490
- await writeFile(filePath, typeDefinitionString, "utf8");
2491
- result.writtenFiles[manifestKey] = filePath;
2492
- onProgress?.({
2493
- type: "file_written",
2494
- manifestKey,
2495
- filePath
2496
- });
2497
- }
2498
- onProgress?.({
2499
- type: "app_processing_complete",
2500
- appKey: app.key
2501
- });
2502
- } catch (error) {
2503
- const errorMessage = `Failed to generate types: ${error}`;
2504
- result.errors.push({
2505
- appKey: app.key,
2506
- error: errorMessage
2507
- });
2508
- onProgress?.({
2509
- type: "app_processing_error",
2510
- appKey: app.key,
2511
- error: errorMessage
2482
+ filePath
2512
2483
  });
2513
2484
  }
2514
- } catch (error) {
2515
- const errorMessage = `Failed to process app: ${error}`;
2516
- result.errors.push({
2517
- appKey: app.key,
2518
- error: errorMessage
2485
+ onProgress?.({
2486
+ type: "app_processing_complete",
2487
+ appKey: app.key
2519
2488
  });
2489
+ } catch (error) {
2490
+ const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
2520
2491
  onProgress?.({
2521
2492
  type: "app_processing_error",
2522
2493
  appKey: app.key,
2523
2494
  error: errorMessage
2524
2495
  });
2496
+ if (error instanceof ZapierValidationError) {
2497
+ throw error;
2498
+ } else {
2499
+ throw new ZapierUnknownError(errorMessage, {
2500
+ cause: error
2501
+ // Works for both Error and non-Error
2502
+ });
2503
+ }
2525
2504
  }
2526
2505
  }
2527
2506
  return result;
@@ -2556,9 +2535,6 @@ var BuildManifestSchema = z.object({
2556
2535
  var buildManifestPlugin = ({ sdk: sdk2, context }) => {
2557
2536
  const buildManifest = createFunction(async function buildManifest2(options) {
2558
2537
  const { appKeys, skipWrite = false, configPath, onProgress } = options;
2559
- const result = {
2560
- errors: []
2561
- };
2562
2538
  onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
2563
2539
  const appsIterator = sdk2.listApps({ appKeys }).items();
2564
2540
  const apps = [];
@@ -2568,7 +2544,7 @@ var buildManifestPlugin = ({ sdk: sdk2, context }) => {
2568
2544
  }
2569
2545
  onProgress?.({ type: "apps_lookup_complete", count: apps.length });
2570
2546
  if (apps.length === 0) {
2571
- return result;
2547
+ return {};
2572
2548
  }
2573
2549
  let updatedManifest;
2574
2550
  for (const app of apps) {
@@ -2601,20 +2577,23 @@ var buildManifestPlugin = ({ sdk: sdk2, context }) => {
2601
2577
  });
2602
2578
  onProgress?.({ type: "app_processing_complete", appKey: app.key });
2603
2579
  } catch (error) {
2604
- const errorMessage = `Failed to process app: ${error}`;
2605
- result.errors.push({
2606
- appKey: app.key,
2607
- error: errorMessage
2608
- });
2580
+ const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
2609
2581
  onProgress?.({
2610
2582
  type: "app_processing_error",
2611
2583
  appKey: app.key,
2612
2584
  error: errorMessage
2613
2585
  });
2586
+ if (error instanceof ZapierValidationError) {
2587
+ throw error;
2588
+ } else {
2589
+ throw new ZapierUnknownError(errorMessage, {
2590
+ cause: error
2591
+ // Works for both Error and non-Error
2592
+ });
2593
+ }
2614
2594
  }
2615
2595
  }
2616
- result.manifest = updatedManifest;
2617
- return result;
2596
+ return { manifest: updatedManifest };
2618
2597
  }, BuildManifestSchema);
2619
2598
  return {
2620
2599
  buildManifest,
@@ -2638,7 +2617,7 @@ function createZapierCliSdk(options = {}) {
2638
2617
 
2639
2618
  // package.json with { type: 'json' }
2640
2619
  var package_default2 = {
2641
- version: "0.13.9"};
2620
+ version: "0.13.10"};
2642
2621
 
2643
2622
  // src/cli.ts
2644
2623
  var program = new Command();