@zapier/zapier-sdk-cli 0.38.2 → 0.39.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/dist/index.cjs CHANGED
@@ -547,10 +547,10 @@ var getLoginConfigPathPlugin = () => {
547
547
  };
548
548
  };
549
549
  var AddSchema = zod.z.object({
550
- appKeys: zod.z.array(zod.z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
550
+ apps: zod.z.array(zod.z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
551
551
  "One or more app keys to add (e.g., 'slack', 'github', 'trello')"
552
552
  ),
553
- connectionIds: zod.z.array(zod.z.string()).optional().describe(
553
+ connections: zod.z.array(zod.z.string()).optional().describe(
554
554
  "Connection IDs to use for type generation (e.g., ['123', '456'])"
555
555
  ),
556
556
  configPath: zod.z.string().optional().describe(
@@ -576,8 +576,8 @@ async function detectTypesOutputDirectory() {
576
576
  var addPlugin = ({ sdk }) => {
577
577
  const add = zapierSdk.createFunction(async function add2(options) {
578
578
  const {
579
- appKeys,
580
- connectionIds,
579
+ apps: appKeys,
580
+ connections: connectionIds,
581
581
  configPath,
582
582
  typesOutput = await detectTypesOutputDirectory()
583
583
  } = options;
@@ -599,17 +599,17 @@ var addPlugin = ({ sdk }) => {
599
599
  }
600
600
  break;
601
601
  case "app_processing_start":
602
- const appName = event.slug ? `${event.slug} (${event.appKey})` : event.appKey;
602
+ const appName = event.slug ? `${event.slug} (${event.app})` : event.app;
603
603
  console.log(`\u{1F4E6} Adding ${appName}...`);
604
604
  break;
605
605
  case "manifest_updated":
606
- const appDisplay = appSlugAndKeyMap.get(event.appKey) || event.appKey;
606
+ const appDisplay = appSlugAndKeyMap.get(event.app) || event.app;
607
607
  console.log(
608
- `\u{1F4DD} Locked ${appDisplay} to ${event.appKey}@${event.version} using key '${event.manifestKey}'`
608
+ `\u{1F4DD} Locked ${appDisplay} to ${event.app}@${event.version} using key '${event.manifestKey}'`
609
609
  );
610
610
  break;
611
611
  case "app_processing_error":
612
- const errorApp = appSlugAndKeyMap.get(event.appKey) || event.appKey;
612
+ const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
613
613
  console.warn(`\u26A0\uFE0F ${event.error} for ${errorApp}`);
614
614
  break;
615
615
  }
@@ -623,13 +623,13 @@ var addPlugin = ({ sdk }) => {
623
623
  console.log(`\u{1F510} Found ${event.count} connection(s)`);
624
624
  break;
625
625
  case "connection_matched":
626
- const appWithConnection = appSlugAndKeyMap.get(event.appKey) || event.appKey;
626
+ const appWithConnection = appSlugAndKeyMap.get(event.app) || event.app;
627
627
  console.log(
628
628
  `\u{1F510} Using connection ${event.connectionId} (${event.connectionTitle}) for ${appWithConnection}`
629
629
  );
630
630
  break;
631
631
  case "connection_not_matched":
632
- const appWithoutConnection = appSlugAndKeyMap.get(event.appKey) || event.appKey;
632
+ const appWithoutConnection = appSlugAndKeyMap.get(event.app) || event.app;
633
633
  console.warn(
634
634
  `\u26A0\uFE0F No matching connection found for ${appWithoutConnection}`
635
635
  );
@@ -640,20 +640,20 @@ var addPlugin = ({ sdk }) => {
640
640
  );
641
641
  break;
642
642
  case "app_processing_error":
643
- const errorApp = appSlugAndKeyMap.get(event.appKey) || event.appKey;
643
+ const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
644
644
  console.warn(`\u26A0\uFE0F ${event.error} for ${errorApp}`);
645
645
  break;
646
646
  }
647
647
  };
648
648
  const manifestResult = await sdk.buildManifest({
649
- appKeys,
649
+ apps: appKeys,
650
650
  skipWrite: false,
651
651
  configPath,
652
652
  onProgress: handleManifestProgress
653
653
  });
654
654
  const typesResult = await sdk.generateAppTypes({
655
- appKeys,
656
- connectionIds,
655
+ apps: appKeys,
656
+ connections: connectionIds,
657
657
  skipWrite: false,
658
658
  typesOutputDirectory: resolvedTypesOutput,
659
659
  onProgress: handleTypesProgress
@@ -679,10 +679,10 @@ var addPlugin = ({ sdk }) => {
679
679
  };
680
680
  };
681
681
  var GenerateAppTypesSchema = zod.z.object({
682
- appKeys: zod.z.array(zod.z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
682
+ apps: zod.z.array(zod.z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
683
683
  "One or more app keys to generate types for (e.g., 'slack', 'github', 'trello')"
684
684
  ),
685
- connectionIds: zod.z.array(zod.z.string()).optional().describe(
685
+ connections: zod.z.array(zod.z.string()).optional().describe(
686
686
  "Connection IDs to use for type generation (e.g., ['123', '456'])"
687
687
  ),
688
688
  skipWrite: zod.z.boolean().optional().describe(
@@ -784,10 +784,10 @@ Usage:
784
784
 
785
785
  const zapier = createZapierSdk();
786
786
  // Types are automatically available:
787
- await zapier.apps.${preferredKey}.search.user_by_email({ connectionId: 123, inputs: { email } })
787
+ await zapier.apps.${preferredKey}.search.user_by_email({ connection: 123, inputs: { email } })
788
788
 
789
789
  // Factory usage (pinned connection):
790
- const ${myVariableName} = zapier.apps.${preferredKey}({ connectionId: 123 })
790
+ const ${myVariableName} = zapier.apps.${preferredKey}({ connection: 123 })
791
791
  await ${myVariableName}.search.user_by_email({ inputs: { email } })`;
792
792
  const statements = [
793
793
  // Import the SDK to activate module augmentation
@@ -797,6 +797,7 @@ Usage:
797
797
  [
798
798
  "ActionExecutionOptions",
799
799
  "ActionExecutionResult",
800
+ "AppFactoryInput",
800
801
  "ZapierFetchInitOptions"
801
802
  ],
802
803
  "@zapier/zapier-sdk"
@@ -1122,17 +1123,7 @@ Usage:
1122
1123
  void 0,
1123
1124
  "options",
1124
1125
  void 0,
1125
- this.factory.createTypeLiteralNode([
1126
- this.factory.createPropertySignature(
1127
- void 0,
1128
- "connectionId",
1129
- void 0,
1130
- this.factory.createUnionTypeNode([
1131
- this.factory.createKeywordTypeNode(ts__namespace.SyntaxKind.StringKeyword),
1132
- this.factory.createKeywordTypeNode(ts__namespace.SyntaxKind.NumberKeyword)
1133
- ])
1134
- )
1135
- ])
1126
+ this.factory.createTypeReferenceNode("AppFactoryInput")
1136
1127
  )
1137
1128
  ],
1138
1129
  this.factory.createTypeReferenceNode(`${appName}AppProxy`)
@@ -1296,8 +1287,8 @@ function createManifestEntry(app) {
1296
1287
  var generateAppTypesPlugin = ({ sdk }) => {
1297
1288
  const generateAppTypes = zapierSdk.createFunction(async function generateAppTypes2(options) {
1298
1289
  const {
1299
- appKeys,
1300
- connectionIds,
1290
+ apps: appKeys,
1291
+ connections: connectionIds,
1301
1292
  skipWrite = false,
1302
1293
  typesOutputDirectory = await detectTypesOutputDirectory(),
1303
1294
  onProgress
@@ -1307,7 +1298,7 @@ var generateAppTypesPlugin = ({ sdk }) => {
1307
1298
  typeDefinitions: {}
1308
1299
  };
1309
1300
  onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
1310
- const appsIterable = sdk.listApps({ appKeys }).items();
1301
+ const appsIterable = sdk.listApps({ apps: appKeys }).items();
1311
1302
  const apps = [];
1312
1303
  for await (const app of appsIterable) {
1313
1304
  apps.push(app);
@@ -1323,7 +1314,7 @@ var generateAppTypesPlugin = ({ sdk }) => {
1323
1314
  type: "connections_lookup_start",
1324
1315
  count: connectionIds.length
1325
1316
  });
1326
- const connectionsIterable = sdk.listConnections({ connectionIds }).items();
1317
+ const connectionsIterable = sdk.listConnections({ connections: connectionIds }).items();
1327
1318
  for await (const connection of connectionsIterable) {
1328
1319
  connections.push(connection);
1329
1320
  }
@@ -1341,7 +1332,7 @@ var generateAppTypesPlugin = ({ sdk }) => {
1341
1332
  for (const app of apps) {
1342
1333
  onProgress?.({
1343
1334
  type: "app_processing_start",
1344
- appKey: app.key,
1335
+ app: app.key,
1345
1336
  slug: app.slug
1346
1337
  });
1347
1338
  try {
@@ -1349,7 +1340,7 @@ var generateAppTypesPlugin = ({ sdk }) => {
1349
1340
  const errorMessage = `Invalid implementation ID format: ${app.implementation_id}. Expected format: <implementationName>@<version>`;
1350
1341
  onProgress?.({
1351
1342
  type: "app_processing_error",
1352
- appKey: app.key,
1343
+ app: app.key,
1353
1344
  error: errorMessage
1354
1345
  });
1355
1346
  throw new zapierSdk.ZapierValidationError(errorMessage, {
@@ -1368,14 +1359,14 @@ var generateAppTypesPlugin = ({ sdk }) => {
1368
1359
  connectionId = matchingConnection.id;
1369
1360
  onProgress?.({
1370
1361
  type: "connection_matched",
1371
- appKey: app.key,
1362
+ app: app.key,
1372
1363
  connectionId: matchingConnection.id,
1373
1364
  connectionTitle: matchingConnection.title || ""
1374
1365
  });
1375
1366
  } else {
1376
1367
  onProgress?.({
1377
1368
  type: "connection_not_matched",
1378
- appKey: app.key
1369
+ app: app.key
1379
1370
  });
1380
1371
  }
1381
1372
  }
@@ -1404,13 +1395,13 @@ var generateAppTypesPlugin = ({ sdk }) => {
1404
1395
  }
1405
1396
  onProgress?.({
1406
1397
  type: "app_processing_complete",
1407
- appKey: app.key
1398
+ app: app.key
1408
1399
  });
1409
1400
  } catch (error) {
1410
1401
  const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
1411
1402
  onProgress?.({
1412
1403
  type: "app_processing_error",
1413
- appKey: app.key,
1404
+ app: app.key,
1414
1405
  error: errorMessage
1415
1406
  });
1416
1407
  if (error instanceof zapierSdk.ZapierValidationError) {
@@ -1438,7 +1429,7 @@ var generateAppTypesPlugin = ({ sdk }) => {
1438
1429
  };
1439
1430
  };
1440
1431
  var BuildManifestSchema = zod.z.object({
1441
- appKeys: zod.z.array(zod.z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
1432
+ apps: zod.z.array(zod.z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
1442
1433
  "One or more app keys to build manifest entries for (e.g., 'slack', 'github', 'trello')"
1443
1434
  ),
1444
1435
  skipWrite: zod.z.boolean().optional().describe(
@@ -1454,9 +1445,14 @@ var BuildManifestSchema = zod.z.object({
1454
1445
  // src/plugins/buildManifest/index.ts
1455
1446
  var buildManifestPlugin = ({ sdk, context }) => {
1456
1447
  const buildManifest = zapierSdk.createFunction(async function buildManifest2(options) {
1457
- const { appKeys, skipWrite = false, configPath, onProgress } = options;
1448
+ const {
1449
+ apps: appKeys,
1450
+ skipWrite = false,
1451
+ configPath,
1452
+ onProgress
1453
+ } = options;
1458
1454
  onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
1459
- const appsIterable = sdk.listApps({ appKeys }).items();
1455
+ const appsIterable = sdk.listApps({ apps: appKeys }).items();
1460
1456
  const apps = [];
1461
1457
  for await (const app of appsIterable) {
1462
1458
  apps.push(app);
@@ -1470,14 +1466,14 @@ var buildManifestPlugin = ({ sdk, context }) => {
1470
1466
  for (const app of apps) {
1471
1467
  onProgress?.({
1472
1468
  type: "app_processing_start",
1473
- appKey: app.key,
1469
+ app: app.key,
1474
1470
  slug: app.slug
1475
1471
  });
1476
1472
  try {
1477
1473
  const manifestEntry = createManifestEntry(app);
1478
1474
  onProgress?.({
1479
1475
  type: "manifest_entry_built",
1480
- appKey: app.key,
1476
+ app: app.key,
1481
1477
  manifestKey: manifestEntry.implementationName,
1482
1478
  version: manifestEntry.version || ""
1483
1479
  });
@@ -1491,16 +1487,16 @@ var buildManifestPlugin = ({ sdk, context }) => {
1491
1487
  updatedManifest = manifest;
1492
1488
  onProgress?.({
1493
1489
  type: "manifest_updated",
1494
- appKey: app.key,
1490
+ app: app.key,
1495
1491
  manifestKey: updatedManifestKey,
1496
1492
  version: manifestEntry.version || ""
1497
1493
  });
1498
- onProgress?.({ type: "app_processing_complete", appKey: app.key });
1494
+ onProgress?.({ type: "app_processing_complete", app: app.key });
1499
1495
  } catch (error) {
1500
1496
  const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
1501
1497
  onProgress?.({
1502
1498
  type: "app_processing_error",
1503
- appKey: app.key,
1499
+ app: app.key,
1504
1500
  error: errorMessage
1505
1501
  });
1506
1502
  if (error instanceof zapierSdk.ZapierValidationError) {
@@ -1620,7 +1616,9 @@ var CurlSchema = zod.z.object({
1620
1616
  maxTime: zod.z.number().optional().describe("Maximum time in seconds for the request"),
1621
1617
  user: zod.z.string().optional().describe("Basic auth credentials as 'user:password'"),
1622
1618
  compressed: zod.z.boolean().optional().describe("Request compressed response (sends Accept-Encoding header)"),
1623
- connectionId: zod.z.union([zod.z.string(), zod.z.number()]).optional().describe("Zapier connection ID for authentication")
1619
+ connection: zod.z.union([zod.z.string(), zod.z.number()]).optional().describe("Zapier connection ID or alias for authentication"),
1620
+ /** @deprecated Use `connection` instead. */
1621
+ connectionId: zod.z.union([zod.z.string(), zod.z.number()]).optional().meta({ deprecated: true })
1624
1622
  }).describe("Make HTTP requests through Zapier Relay with curl-like options");
1625
1623
  var CurlExitError = class extends Error {
1626
1624
  constructor(message, exitCode) {
@@ -1795,8 +1793,10 @@ var curlPlugin = ({
1795
1793
  maxTime,
1796
1794
  user,
1797
1795
  compressed,
1796
+ connection: connectionParam,
1798
1797
  connectionId
1799
1798
  } = options;
1799
+ const connection = connectionParam ?? connectionId;
1800
1800
  const parsedUrl = new URL(rawUrl);
1801
1801
  const headers = {};
1802
1802
  for (const h of header) {
@@ -1904,7 +1904,7 @@ var curlPlugin = ({
1904
1904
  body,
1905
1905
  redirect,
1906
1906
  signal,
1907
- connectionId
1907
+ connection
1908
1908
  });
1909
1909
  const timeTotalSeconds = (performance.now() - start) / 1e3;
1910
1910
  if (verbose && !silent) {
@@ -2512,7 +2512,7 @@ function createZapierCliSdk(options = {}) {
2512
2512
 
2513
2513
  // package.json
2514
2514
  var package_default = {
2515
- version: "0.38.2"};
2515
+ version: "0.39.0"};
2516
2516
 
2517
2517
  // src/telemetry/builders.ts
2518
2518
  function createCliBaseEvent(context = {}) {
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@ import { AppItem, Manifest, GetSdkType, ZapierSdk, ZapierSdkOptions, BaseEvent }
2
2
  import { z } from 'zod';
3
3
 
4
4
  declare const BuildManifestSchema: z.ZodObject<{
5
- appKeys: z.ZodArray<z.ZodString>;
5
+ apps: z.ZodArray<z.ZodString>;
6
6
  skipWrite: z.ZodOptional<z.ZodBoolean>;
7
7
  configPath: z.ZodOptional<z.ZodString>;
8
8
  }, z.core.$strip>;
@@ -20,24 +20,24 @@ type ManifestBuildProgressEvent = {
20
20
  count: number;
21
21
  } | {
22
22
  type: "app_processing_start";
23
- appKey: string;
23
+ app: string;
24
24
  slug?: string;
25
25
  } | {
26
26
  type: "manifest_entry_built";
27
- appKey: string;
27
+ app: string;
28
28
  manifestKey: string;
29
29
  version: string;
30
30
  } | {
31
31
  type: "manifest_updated";
32
- appKey: string;
32
+ app: string;
33
33
  manifestKey: string;
34
34
  version: string;
35
35
  } | {
36
36
  type: "app_processing_complete";
37
- appKey: string;
37
+ app: string;
38
38
  } | {
39
39
  type: "app_processing_error";
40
- appKey: string;
40
+ app: string;
41
41
  error: string;
42
42
  };
43
43
  interface BuildManifestResult {
@@ -72,8 +72,8 @@ interface FeedbackPluginProvides {
72
72
  }
73
73
 
74
74
  declare const GenerateAppTypesSchema: z.ZodObject<{
75
- appKeys: z.ZodArray<z.ZodString>;
76
- connectionIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
75
+ apps: z.ZodArray<z.ZodString>;
76
+ connections: z.ZodOptional<z.ZodArray<z.ZodString>>;
77
77
  skipWrite: z.ZodOptional<z.ZodBoolean>;
78
78
  typesOutputDirectory: z.ZodOptional<z.ZodString>;
79
79
  }, z.core.$strip>;
@@ -97,16 +97,16 @@ type AppTypesProgressEvent = {
97
97
  count: number;
98
98
  } | {
99
99
  type: "app_processing_start";
100
- appKey: string;
100
+ app: string;
101
101
  slug?: string;
102
102
  } | {
103
103
  type: "connection_matched";
104
- appKey: string;
104
+ app: string;
105
105
  connectionId: string;
106
106
  connectionTitle: string;
107
107
  } | {
108
108
  type: "connection_not_matched";
109
- appKey: string;
109
+ app: string;
110
110
  } | {
111
111
  type: "type_generated";
112
112
  manifestKey: string;
@@ -117,10 +117,10 @@ type AppTypesProgressEvent = {
117
117
  filePath: string;
118
118
  } | {
119
119
  type: "app_processing_complete";
120
- appKey: string;
120
+ app: string;
121
121
  } | {
122
122
  type: "app_processing_error";
123
- appKey: string;
123
+ app: string;
124
124
  error: string;
125
125
  };
126
126
  interface GenerateAppTypesResult {
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { AppItem, Manifest, GetSdkType, ZapierSdk, ZapierSdkOptions, BaseEvent }
2
2
  import { z } from 'zod';
3
3
 
4
4
  declare const BuildManifestSchema: z.ZodObject<{
5
- appKeys: z.ZodArray<z.ZodString>;
5
+ apps: z.ZodArray<z.ZodString>;
6
6
  skipWrite: z.ZodOptional<z.ZodBoolean>;
7
7
  configPath: z.ZodOptional<z.ZodString>;
8
8
  }, z.core.$strip>;
@@ -20,24 +20,24 @@ type ManifestBuildProgressEvent = {
20
20
  count: number;
21
21
  } | {
22
22
  type: "app_processing_start";
23
- appKey: string;
23
+ app: string;
24
24
  slug?: string;
25
25
  } | {
26
26
  type: "manifest_entry_built";
27
- appKey: string;
27
+ app: string;
28
28
  manifestKey: string;
29
29
  version: string;
30
30
  } | {
31
31
  type: "manifest_updated";
32
- appKey: string;
32
+ app: string;
33
33
  manifestKey: string;
34
34
  version: string;
35
35
  } | {
36
36
  type: "app_processing_complete";
37
- appKey: string;
37
+ app: string;
38
38
  } | {
39
39
  type: "app_processing_error";
40
- appKey: string;
40
+ app: string;
41
41
  error: string;
42
42
  };
43
43
  interface BuildManifestResult {
@@ -72,8 +72,8 @@ interface FeedbackPluginProvides {
72
72
  }
73
73
 
74
74
  declare const GenerateAppTypesSchema: z.ZodObject<{
75
- appKeys: z.ZodArray<z.ZodString>;
76
- connectionIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
75
+ apps: z.ZodArray<z.ZodString>;
76
+ connections: z.ZodOptional<z.ZodArray<z.ZodString>>;
77
77
  skipWrite: z.ZodOptional<z.ZodBoolean>;
78
78
  typesOutputDirectory: z.ZodOptional<z.ZodString>;
79
79
  }, z.core.$strip>;
@@ -97,16 +97,16 @@ type AppTypesProgressEvent = {
97
97
  count: number;
98
98
  } | {
99
99
  type: "app_processing_start";
100
- appKey: string;
100
+ app: string;
101
101
  slug?: string;
102
102
  } | {
103
103
  type: "connection_matched";
104
- appKey: string;
104
+ app: string;
105
105
  connectionId: string;
106
106
  connectionTitle: string;
107
107
  } | {
108
108
  type: "connection_not_matched";
109
- appKey: string;
109
+ app: string;
110
110
  } | {
111
111
  type: "type_generated";
112
112
  manifestKey: string;
@@ -117,10 +117,10 @@ type AppTypesProgressEvent = {
117
117
  filePath: string;
118
118
  } | {
119
119
  type: "app_processing_complete";
120
- appKey: string;
120
+ app: string;
121
121
  } | {
122
122
  type: "app_processing_error";
123
- appKey: string;
123
+ app: string;
124
124
  error: string;
125
125
  };
126
126
  interface GenerateAppTypesResult {