@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/CHANGELOG.md +12 -0
- package/README.md +128 -129
- package/dist/cli.cjs +88 -70
- package/dist/cli.mjs +89 -71
- package/dist/index.cjs +50 -50
- package/dist/index.d.mts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.mjs +50 -50
- package/dist/package.json +1 -1
- package/dist/src/generators/ast-generator.js +4 -8
- package/dist/src/plugins/add/index.js +12 -12
- package/dist/src/plugins/add/schemas.d.ts +2 -2
- package/dist/src/plugins/add/schemas.js +2 -2
- package/dist/src/plugins/buildManifest/index.js +7 -8
- package/dist/src/plugins/buildManifest/schemas.d.ts +6 -6
- package/dist/src/plugins/buildManifest/schemas.js +1 -1
- package/dist/src/plugins/curl/index.js +3 -2
- package/dist/src/plugins/curl/schemas.d.ts +1 -0
- package/dist/src/plugins/curl/schemas.js +6 -1
- package/dist/src/plugins/generateAppTypes/index.js +9 -9
- package/dist/src/plugins/generateAppTypes/schemas.d.ts +7 -7
- package/dist/src/plugins/generateAppTypes/schemas.js +2 -2
- package/dist/src/utils/cli-generator.d.ts +1 -1
- package/dist/src/utils/cli-generator.js +37 -13
- package/dist/src/utils/parameter-resolver.js +4 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -514,10 +514,10 @@ var getLoginConfigPathPlugin = () => {
|
|
|
514
514
|
};
|
|
515
515
|
};
|
|
516
516
|
var AddSchema = z.object({
|
|
517
|
-
|
|
517
|
+
apps: z.array(z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
|
|
518
518
|
"One or more app keys to add (e.g., 'slack', 'github', 'trello')"
|
|
519
519
|
),
|
|
520
|
-
|
|
520
|
+
connections: z.array(z.string()).optional().describe(
|
|
521
521
|
"Connection IDs to use for type generation (e.g., ['123', '456'])"
|
|
522
522
|
),
|
|
523
523
|
configPath: z.string().optional().describe(
|
|
@@ -543,8 +543,8 @@ async function detectTypesOutputDirectory() {
|
|
|
543
543
|
var addPlugin = ({ sdk }) => {
|
|
544
544
|
const add = createFunction(async function add2(options) {
|
|
545
545
|
const {
|
|
546
|
-
appKeys,
|
|
547
|
-
connectionIds,
|
|
546
|
+
apps: appKeys,
|
|
547
|
+
connections: connectionIds,
|
|
548
548
|
configPath,
|
|
549
549
|
typesOutput = await detectTypesOutputDirectory()
|
|
550
550
|
} = options;
|
|
@@ -566,17 +566,17 @@ var addPlugin = ({ sdk }) => {
|
|
|
566
566
|
}
|
|
567
567
|
break;
|
|
568
568
|
case "app_processing_start":
|
|
569
|
-
const appName = event.slug ? `${event.slug} (${event.
|
|
569
|
+
const appName = event.slug ? `${event.slug} (${event.app})` : event.app;
|
|
570
570
|
console.log(`\u{1F4E6} Adding ${appName}...`);
|
|
571
571
|
break;
|
|
572
572
|
case "manifest_updated":
|
|
573
|
-
const appDisplay = appSlugAndKeyMap.get(event.
|
|
573
|
+
const appDisplay = appSlugAndKeyMap.get(event.app) || event.app;
|
|
574
574
|
console.log(
|
|
575
|
-
`\u{1F4DD} Locked ${appDisplay} to ${event.
|
|
575
|
+
`\u{1F4DD} Locked ${appDisplay} to ${event.app}@${event.version} using key '${event.manifestKey}'`
|
|
576
576
|
);
|
|
577
577
|
break;
|
|
578
578
|
case "app_processing_error":
|
|
579
|
-
const errorApp = appSlugAndKeyMap.get(event.
|
|
579
|
+
const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
|
|
580
580
|
console.warn(`\u26A0\uFE0F ${event.error} for ${errorApp}`);
|
|
581
581
|
break;
|
|
582
582
|
}
|
|
@@ -590,13 +590,13 @@ var addPlugin = ({ sdk }) => {
|
|
|
590
590
|
console.log(`\u{1F510} Found ${event.count} connection(s)`);
|
|
591
591
|
break;
|
|
592
592
|
case "connection_matched":
|
|
593
|
-
const appWithConnection = appSlugAndKeyMap.get(event.
|
|
593
|
+
const appWithConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
594
594
|
console.log(
|
|
595
595
|
`\u{1F510} Using connection ${event.connectionId} (${event.connectionTitle}) for ${appWithConnection}`
|
|
596
596
|
);
|
|
597
597
|
break;
|
|
598
598
|
case "connection_not_matched":
|
|
599
|
-
const appWithoutConnection = appSlugAndKeyMap.get(event.
|
|
599
|
+
const appWithoutConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
600
600
|
console.warn(
|
|
601
601
|
`\u26A0\uFE0F No matching connection found for ${appWithoutConnection}`
|
|
602
602
|
);
|
|
@@ -607,20 +607,20 @@ var addPlugin = ({ sdk }) => {
|
|
|
607
607
|
);
|
|
608
608
|
break;
|
|
609
609
|
case "app_processing_error":
|
|
610
|
-
const errorApp = appSlugAndKeyMap.get(event.
|
|
610
|
+
const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
|
|
611
611
|
console.warn(`\u26A0\uFE0F ${event.error} for ${errorApp}`);
|
|
612
612
|
break;
|
|
613
613
|
}
|
|
614
614
|
};
|
|
615
615
|
const manifestResult = await sdk.buildManifest({
|
|
616
|
-
appKeys,
|
|
616
|
+
apps: appKeys,
|
|
617
617
|
skipWrite: false,
|
|
618
618
|
configPath,
|
|
619
619
|
onProgress: handleManifestProgress
|
|
620
620
|
});
|
|
621
621
|
const typesResult = await sdk.generateAppTypes({
|
|
622
|
-
appKeys,
|
|
623
|
-
connectionIds,
|
|
622
|
+
apps: appKeys,
|
|
623
|
+
connections: connectionIds,
|
|
624
624
|
skipWrite: false,
|
|
625
625
|
typesOutputDirectory: resolvedTypesOutput,
|
|
626
626
|
onProgress: handleTypesProgress
|
|
@@ -646,10 +646,10 @@ var addPlugin = ({ sdk }) => {
|
|
|
646
646
|
};
|
|
647
647
|
};
|
|
648
648
|
var GenerateAppTypesSchema = z.object({
|
|
649
|
-
|
|
649
|
+
apps: z.array(z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
|
|
650
650
|
"One or more app keys to generate types for (e.g., 'slack', 'github', 'trello')"
|
|
651
651
|
),
|
|
652
|
-
|
|
652
|
+
connections: z.array(z.string()).optional().describe(
|
|
653
653
|
"Connection IDs to use for type generation (e.g., ['123', '456'])"
|
|
654
654
|
),
|
|
655
655
|
skipWrite: z.boolean().optional().describe(
|
|
@@ -751,10 +751,10 @@ Usage:
|
|
|
751
751
|
|
|
752
752
|
const zapier = createZapierSdk();
|
|
753
753
|
// Types are automatically available:
|
|
754
|
-
await zapier.apps.${preferredKey}.search.user_by_email({
|
|
754
|
+
await zapier.apps.${preferredKey}.search.user_by_email({ connection: 123, inputs: { email } })
|
|
755
755
|
|
|
756
756
|
// Factory usage (pinned connection):
|
|
757
|
-
const ${myVariableName} = zapier.apps.${preferredKey}({
|
|
757
|
+
const ${myVariableName} = zapier.apps.${preferredKey}({ connection: 123 })
|
|
758
758
|
await ${myVariableName}.search.user_by_email({ inputs: { email } })`;
|
|
759
759
|
const statements = [
|
|
760
760
|
// Import the SDK to activate module augmentation
|
|
@@ -764,6 +764,7 @@ Usage:
|
|
|
764
764
|
[
|
|
765
765
|
"ActionExecutionOptions",
|
|
766
766
|
"ActionExecutionResult",
|
|
767
|
+
"AppFactoryInput",
|
|
767
768
|
"ZapierFetchInitOptions"
|
|
768
769
|
],
|
|
769
770
|
"@zapier/zapier-sdk"
|
|
@@ -1089,17 +1090,7 @@ Usage:
|
|
|
1089
1090
|
void 0,
|
|
1090
1091
|
"options",
|
|
1091
1092
|
void 0,
|
|
1092
|
-
this.factory.
|
|
1093
|
-
this.factory.createPropertySignature(
|
|
1094
|
-
void 0,
|
|
1095
|
-
"connectionId",
|
|
1096
|
-
void 0,
|
|
1097
|
-
this.factory.createUnionTypeNode([
|
|
1098
|
-
this.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),
|
|
1099
|
-
this.factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword)
|
|
1100
|
-
])
|
|
1101
|
-
)
|
|
1102
|
-
])
|
|
1093
|
+
this.factory.createTypeReferenceNode("AppFactoryInput")
|
|
1103
1094
|
)
|
|
1104
1095
|
],
|
|
1105
1096
|
this.factory.createTypeReferenceNode(`${appName}AppProxy`)
|
|
@@ -1263,8 +1254,8 @@ function createManifestEntry(app) {
|
|
|
1263
1254
|
var generateAppTypesPlugin = ({ sdk }) => {
|
|
1264
1255
|
const generateAppTypes = createFunction(async function generateAppTypes2(options) {
|
|
1265
1256
|
const {
|
|
1266
|
-
appKeys,
|
|
1267
|
-
connectionIds,
|
|
1257
|
+
apps: appKeys,
|
|
1258
|
+
connections: connectionIds,
|
|
1268
1259
|
skipWrite = false,
|
|
1269
1260
|
typesOutputDirectory = await detectTypesOutputDirectory(),
|
|
1270
1261
|
onProgress
|
|
@@ -1274,7 +1265,7 @@ var generateAppTypesPlugin = ({ sdk }) => {
|
|
|
1274
1265
|
typeDefinitions: {}
|
|
1275
1266
|
};
|
|
1276
1267
|
onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
|
|
1277
|
-
const appsIterable = sdk.listApps({ appKeys }).items();
|
|
1268
|
+
const appsIterable = sdk.listApps({ apps: appKeys }).items();
|
|
1278
1269
|
const apps = [];
|
|
1279
1270
|
for await (const app of appsIterable) {
|
|
1280
1271
|
apps.push(app);
|
|
@@ -1290,7 +1281,7 @@ var generateAppTypesPlugin = ({ sdk }) => {
|
|
|
1290
1281
|
type: "connections_lookup_start",
|
|
1291
1282
|
count: connectionIds.length
|
|
1292
1283
|
});
|
|
1293
|
-
const connectionsIterable = sdk.listConnections({ connectionIds }).items();
|
|
1284
|
+
const connectionsIterable = sdk.listConnections({ connections: connectionIds }).items();
|
|
1294
1285
|
for await (const connection of connectionsIterable) {
|
|
1295
1286
|
connections.push(connection);
|
|
1296
1287
|
}
|
|
@@ -1308,7 +1299,7 @@ var generateAppTypesPlugin = ({ sdk }) => {
|
|
|
1308
1299
|
for (const app of apps) {
|
|
1309
1300
|
onProgress?.({
|
|
1310
1301
|
type: "app_processing_start",
|
|
1311
|
-
|
|
1302
|
+
app: app.key,
|
|
1312
1303
|
slug: app.slug
|
|
1313
1304
|
});
|
|
1314
1305
|
try {
|
|
@@ -1316,7 +1307,7 @@ var generateAppTypesPlugin = ({ sdk }) => {
|
|
|
1316
1307
|
const errorMessage = `Invalid implementation ID format: ${app.implementation_id}. Expected format: <implementationName>@<version>`;
|
|
1317
1308
|
onProgress?.({
|
|
1318
1309
|
type: "app_processing_error",
|
|
1319
|
-
|
|
1310
|
+
app: app.key,
|
|
1320
1311
|
error: errorMessage
|
|
1321
1312
|
});
|
|
1322
1313
|
throw new ZapierValidationError(errorMessage, {
|
|
@@ -1335,14 +1326,14 @@ var generateAppTypesPlugin = ({ sdk }) => {
|
|
|
1335
1326
|
connectionId = matchingConnection.id;
|
|
1336
1327
|
onProgress?.({
|
|
1337
1328
|
type: "connection_matched",
|
|
1338
|
-
|
|
1329
|
+
app: app.key,
|
|
1339
1330
|
connectionId: matchingConnection.id,
|
|
1340
1331
|
connectionTitle: matchingConnection.title || ""
|
|
1341
1332
|
});
|
|
1342
1333
|
} else {
|
|
1343
1334
|
onProgress?.({
|
|
1344
1335
|
type: "connection_not_matched",
|
|
1345
|
-
|
|
1336
|
+
app: app.key
|
|
1346
1337
|
});
|
|
1347
1338
|
}
|
|
1348
1339
|
}
|
|
@@ -1371,13 +1362,13 @@ var generateAppTypesPlugin = ({ sdk }) => {
|
|
|
1371
1362
|
}
|
|
1372
1363
|
onProgress?.({
|
|
1373
1364
|
type: "app_processing_complete",
|
|
1374
|
-
|
|
1365
|
+
app: app.key
|
|
1375
1366
|
});
|
|
1376
1367
|
} catch (error) {
|
|
1377
1368
|
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
1378
1369
|
onProgress?.({
|
|
1379
1370
|
type: "app_processing_error",
|
|
1380
|
-
|
|
1371
|
+
app: app.key,
|
|
1381
1372
|
error: errorMessage
|
|
1382
1373
|
});
|
|
1383
1374
|
if (error instanceof ZapierValidationError) {
|
|
@@ -1405,7 +1396,7 @@ var generateAppTypesPlugin = ({ sdk }) => {
|
|
|
1405
1396
|
};
|
|
1406
1397
|
};
|
|
1407
1398
|
var BuildManifestSchema = z.object({
|
|
1408
|
-
|
|
1399
|
+
apps: z.array(z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
|
|
1409
1400
|
"One or more app keys to build manifest entries for (e.g., 'slack', 'github', 'trello')"
|
|
1410
1401
|
),
|
|
1411
1402
|
skipWrite: z.boolean().optional().describe(
|
|
@@ -1421,9 +1412,14 @@ var BuildManifestSchema = z.object({
|
|
|
1421
1412
|
// src/plugins/buildManifest/index.ts
|
|
1422
1413
|
var buildManifestPlugin = ({ sdk, context }) => {
|
|
1423
1414
|
const buildManifest = createFunction(async function buildManifest2(options) {
|
|
1424
|
-
const {
|
|
1415
|
+
const {
|
|
1416
|
+
apps: appKeys,
|
|
1417
|
+
skipWrite = false,
|
|
1418
|
+
configPath,
|
|
1419
|
+
onProgress
|
|
1420
|
+
} = options;
|
|
1425
1421
|
onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
|
|
1426
|
-
const appsIterable = sdk.listApps({ appKeys }).items();
|
|
1422
|
+
const appsIterable = sdk.listApps({ apps: appKeys }).items();
|
|
1427
1423
|
const apps = [];
|
|
1428
1424
|
for await (const app of appsIterable) {
|
|
1429
1425
|
apps.push(app);
|
|
@@ -1437,14 +1433,14 @@ var buildManifestPlugin = ({ sdk, context }) => {
|
|
|
1437
1433
|
for (const app of apps) {
|
|
1438
1434
|
onProgress?.({
|
|
1439
1435
|
type: "app_processing_start",
|
|
1440
|
-
|
|
1436
|
+
app: app.key,
|
|
1441
1437
|
slug: app.slug
|
|
1442
1438
|
});
|
|
1443
1439
|
try {
|
|
1444
1440
|
const manifestEntry = createManifestEntry(app);
|
|
1445
1441
|
onProgress?.({
|
|
1446
1442
|
type: "manifest_entry_built",
|
|
1447
|
-
|
|
1443
|
+
app: app.key,
|
|
1448
1444
|
manifestKey: manifestEntry.implementationName,
|
|
1449
1445
|
version: manifestEntry.version || ""
|
|
1450
1446
|
});
|
|
@@ -1458,16 +1454,16 @@ var buildManifestPlugin = ({ sdk, context }) => {
|
|
|
1458
1454
|
updatedManifest = manifest;
|
|
1459
1455
|
onProgress?.({
|
|
1460
1456
|
type: "manifest_updated",
|
|
1461
|
-
|
|
1457
|
+
app: app.key,
|
|
1462
1458
|
manifestKey: updatedManifestKey,
|
|
1463
1459
|
version: manifestEntry.version || ""
|
|
1464
1460
|
});
|
|
1465
|
-
onProgress?.({ type: "app_processing_complete",
|
|
1461
|
+
onProgress?.({ type: "app_processing_complete", app: app.key });
|
|
1466
1462
|
} catch (error) {
|
|
1467
1463
|
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
1468
1464
|
onProgress?.({
|
|
1469
1465
|
type: "app_processing_error",
|
|
1470
|
-
|
|
1466
|
+
app: app.key,
|
|
1471
1467
|
error: errorMessage
|
|
1472
1468
|
});
|
|
1473
1469
|
if (error instanceof ZapierValidationError) {
|
|
@@ -1587,7 +1583,9 @@ var CurlSchema = z.object({
|
|
|
1587
1583
|
maxTime: z.number().optional().describe("Maximum time in seconds for the request"),
|
|
1588
1584
|
user: z.string().optional().describe("Basic auth credentials as 'user:password'"),
|
|
1589
1585
|
compressed: z.boolean().optional().describe("Request compressed response (sends Accept-Encoding header)"),
|
|
1590
|
-
|
|
1586
|
+
connection: z.union([z.string(), z.number()]).optional().describe("Zapier connection ID or alias for authentication"),
|
|
1587
|
+
/** @deprecated Use `connection` instead. */
|
|
1588
|
+
connectionId: z.union([z.string(), z.number()]).optional().meta({ deprecated: true })
|
|
1591
1589
|
}).describe("Make HTTP requests through Zapier Relay with curl-like options");
|
|
1592
1590
|
var CurlExitError = class extends Error {
|
|
1593
1591
|
constructor(message, exitCode) {
|
|
@@ -1762,8 +1760,10 @@ var curlPlugin = ({
|
|
|
1762
1760
|
maxTime,
|
|
1763
1761
|
user,
|
|
1764
1762
|
compressed,
|
|
1763
|
+
connection: connectionParam,
|
|
1765
1764
|
connectionId
|
|
1766
1765
|
} = options;
|
|
1766
|
+
const connection = connectionParam ?? connectionId;
|
|
1767
1767
|
const parsedUrl = new URL(rawUrl);
|
|
1768
1768
|
const headers = {};
|
|
1769
1769
|
for (const h of header) {
|
|
@@ -1871,7 +1871,7 @@ var curlPlugin = ({
|
|
|
1871
1871
|
body,
|
|
1872
1872
|
redirect,
|
|
1873
1873
|
signal,
|
|
1874
|
-
|
|
1874
|
+
connection
|
|
1875
1875
|
});
|
|
1876
1876
|
const timeTotalSeconds = (performance.now() - start) / 1e3;
|
|
1877
1877
|
if (verbose && !silent) {
|
|
@@ -2479,7 +2479,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
2479
2479
|
|
|
2480
2480
|
// package.json
|
|
2481
2481
|
var package_default = {
|
|
2482
|
-
version: "0.
|
|
2482
|
+
version: "0.39.0"};
|
|
2483
2483
|
|
|
2484
2484
|
// src/telemetry/builders.ts
|
|
2485
2485
|
function createCliBaseEvent(context = {}) {
|
package/dist/package.json
CHANGED
|
@@ -92,10 +92,10 @@ Usage:
|
|
|
92
92
|
|
|
93
93
|
const zapier = createZapierSdk();
|
|
94
94
|
// Types are automatically available:
|
|
95
|
-
await zapier.apps.${preferredKey}.search.user_by_email({
|
|
95
|
+
await zapier.apps.${preferredKey}.search.user_by_email({ connection: 123, inputs: { email } })
|
|
96
96
|
|
|
97
97
|
// Factory usage (pinned connection):
|
|
98
|
-
const ${myVariableName} = zapier.apps.${preferredKey}({
|
|
98
|
+
const ${myVariableName} = zapier.apps.${preferredKey}({ connection: 123 })
|
|
99
99
|
await ${myVariableName}.search.user_by_email({ inputs: { email } })`;
|
|
100
100
|
const statements = [
|
|
101
101
|
// Import the SDK to activate module augmentation
|
|
@@ -104,6 +104,7 @@ Usage:
|
|
|
104
104
|
this.createTypeImportStatement([
|
|
105
105
|
"ActionExecutionOptions",
|
|
106
106
|
"ActionExecutionResult",
|
|
107
|
+
"AppFactoryInput",
|
|
107
108
|
"ZapierFetchInitOptions",
|
|
108
109
|
], "@zapier/zapier-sdk"),
|
|
109
110
|
];
|
|
@@ -262,12 +263,7 @@ Usage:
|
|
|
262
263
|
}
|
|
263
264
|
createAppFactoryInterface(appName) {
|
|
264
265
|
const callSignature = this.factory.createCallSignature(undefined, [
|
|
265
|
-
this.factory.createParameterDeclaration(undefined, undefined, "options", undefined, this.factory.
|
|
266
|
-
this.factory.createPropertySignature(undefined, "connectionId", undefined, this.factory.createUnionTypeNode([
|
|
267
|
-
this.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),
|
|
268
|
-
this.factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),
|
|
269
|
-
])),
|
|
270
|
-
])),
|
|
266
|
+
this.factory.createParameterDeclaration(undefined, undefined, "options", undefined, this.factory.createTypeReferenceNode("AppFactoryInput")),
|
|
271
267
|
], this.factory.createTypeReferenceNode(`${appName}AppProxy`));
|
|
272
268
|
return this.factory.createInterfaceDeclaration(undefined, `${appName}AppFactory`, undefined, undefined, [callSignature]);
|
|
273
269
|
}
|
|
@@ -4,7 +4,7 @@ import { detectTypesOutputDirectory } from "../../utils/directory-detection";
|
|
|
4
4
|
import { resolve } from "path";
|
|
5
5
|
export const addPlugin = ({ sdk }) => {
|
|
6
6
|
const add = createFunction(async function add(options) {
|
|
7
|
-
const { appKeys, connectionIds, configPath, typesOutput = await detectTypesOutputDirectory(), } = options;
|
|
7
|
+
const { apps: appKeys, connections: connectionIds, configPath, typesOutput = await detectTypesOutputDirectory(), } = options;
|
|
8
8
|
const resolvedTypesOutput = resolve(typesOutput);
|
|
9
9
|
console.log(`📦 Adding ${appKeys.length} app(s)...`);
|
|
10
10
|
// Track app names for better console output
|
|
@@ -29,16 +29,16 @@ export const addPlugin = ({ sdk }) => {
|
|
|
29
29
|
break;
|
|
30
30
|
case "app_processing_start":
|
|
31
31
|
const appName = event.slug
|
|
32
|
-
? `${event.slug} (${event.
|
|
33
|
-
: event.
|
|
32
|
+
? `${event.slug} (${event.app})`
|
|
33
|
+
: event.app;
|
|
34
34
|
console.log(`📦 Adding ${appName}...`);
|
|
35
35
|
break;
|
|
36
36
|
case "manifest_updated":
|
|
37
|
-
const appDisplay = appSlugAndKeyMap.get(event.
|
|
38
|
-
console.log(`📝 Locked ${appDisplay} to ${event.
|
|
37
|
+
const appDisplay = appSlugAndKeyMap.get(event.app) || event.app;
|
|
38
|
+
console.log(`📝 Locked ${appDisplay} to ${event.app}@${event.version} using key '${event.manifestKey}'`);
|
|
39
39
|
break;
|
|
40
40
|
case "app_processing_error":
|
|
41
|
-
const errorApp = appSlugAndKeyMap.get(event.
|
|
41
|
+
const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
|
|
42
42
|
console.warn(`⚠️ ${event.error} for ${errorApp}`);
|
|
43
43
|
break;
|
|
44
44
|
}
|
|
@@ -53,31 +53,31 @@ export const addPlugin = ({ sdk }) => {
|
|
|
53
53
|
console.log(`🔐 Found ${event.count} connection(s)`);
|
|
54
54
|
break;
|
|
55
55
|
case "connection_matched":
|
|
56
|
-
const appWithConnection = appSlugAndKeyMap.get(event.
|
|
56
|
+
const appWithConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
57
57
|
console.log(`🔐 Using connection ${event.connectionId} (${event.connectionTitle}) for ${appWithConnection}`);
|
|
58
58
|
break;
|
|
59
59
|
case "connection_not_matched":
|
|
60
|
-
const appWithoutConnection = appSlugAndKeyMap.get(event.
|
|
60
|
+
const appWithoutConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
61
61
|
console.warn(`⚠️ No matching connection found for ${appWithoutConnection}`);
|
|
62
62
|
break;
|
|
63
63
|
case "file_written":
|
|
64
64
|
console.log(`🔧 Generated types for ${event.manifestKey} at ${event.filePath}`);
|
|
65
65
|
break;
|
|
66
66
|
case "app_processing_error":
|
|
67
|
-
const errorApp = appSlugAndKeyMap.get(event.
|
|
67
|
+
const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
|
|
68
68
|
console.warn(`⚠️ ${event.error} for ${errorApp}`);
|
|
69
69
|
break;
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
const manifestResult = await sdk.buildManifest({
|
|
73
|
-
appKeys,
|
|
73
|
+
apps: appKeys,
|
|
74
74
|
skipWrite: false,
|
|
75
75
|
configPath,
|
|
76
76
|
onProgress: handleManifestProgress,
|
|
77
77
|
});
|
|
78
78
|
const typesResult = await sdk.generateAppTypes({
|
|
79
|
-
appKeys,
|
|
80
|
-
connectionIds,
|
|
79
|
+
apps: appKeys,
|
|
80
|
+
connections: connectionIds,
|
|
81
81
|
skipWrite: false,
|
|
82
82
|
typesOutputDirectory: resolvedTypesOutput,
|
|
83
83
|
onProgress: handleTypesProgress,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const AddSchema: z.ZodObject<{
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
apps: z.ZodArray<z.ZodString>;
|
|
4
|
+
connections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
5
5
|
configPath: z.ZodOptional<z.ZodString>;
|
|
6
6
|
typesOutput: z.ZodOptional<z.ZodString>;
|
|
7
7
|
}, z.core.$strip>;
|
|
@@ -2,11 +2,11 @@ import { z } from "zod";
|
|
|
2
2
|
import { DEFAULT_CONFIG_PATH } from "@zapier/zapier-sdk";
|
|
3
3
|
export const AddSchema = z
|
|
4
4
|
.object({
|
|
5
|
-
|
|
5
|
+
apps: z
|
|
6
6
|
.array(z.string().min(1, "App key cannot be empty"))
|
|
7
7
|
.min(1, "At least one app key is required")
|
|
8
8
|
.describe("One or more app keys to add (e.g., 'slack', 'github', 'trello')"),
|
|
9
|
-
|
|
9
|
+
connections: z
|
|
10
10
|
.array(z.string())
|
|
11
11
|
.optional()
|
|
12
12
|
.describe("Connection IDs to use for type generation (e.g., ['123', '456'])"),
|
|
@@ -3,10 +3,9 @@ import { BuildManifestSchema, } from "./schemas";
|
|
|
3
3
|
import { createManifestEntry } from "../../utils/manifest-helpers";
|
|
4
4
|
export const buildManifestPlugin = ({ sdk, context }) => {
|
|
5
5
|
const buildManifest = createFunction(async function buildManifest(options) {
|
|
6
|
-
const { appKeys, skipWrite = false, configPath, onProgress } = options;
|
|
7
|
-
// Get apps using listApps (which respects existing manifest for version locking)
|
|
6
|
+
const { apps: appKeys, skipWrite = false, configPath, onProgress, } = options;
|
|
8
7
|
onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
|
|
9
|
-
const appsIterable = sdk.listApps({ appKeys }).items();
|
|
8
|
+
const appsIterable = sdk.listApps({ apps: appKeys }).items();
|
|
10
9
|
const apps = [];
|
|
11
10
|
for await (const app of appsIterable) {
|
|
12
11
|
apps.push(app);
|
|
@@ -21,14 +20,14 @@ export const buildManifestPlugin = ({ sdk, context }) => {
|
|
|
21
20
|
for (const app of apps) {
|
|
22
21
|
onProgress?.({
|
|
23
22
|
type: "app_processing_start",
|
|
24
|
-
|
|
23
|
+
app: app.key,
|
|
25
24
|
slug: app.slug,
|
|
26
25
|
});
|
|
27
26
|
try {
|
|
28
27
|
const manifestEntry = createManifestEntry(app);
|
|
29
28
|
onProgress?.({
|
|
30
29
|
type: "manifest_entry_built",
|
|
31
|
-
|
|
30
|
+
app: app.key,
|
|
32
31
|
manifestKey: manifestEntry.implementationName,
|
|
33
32
|
version: manifestEntry.version || "",
|
|
34
33
|
});
|
|
@@ -42,17 +41,17 @@ export const buildManifestPlugin = ({ sdk, context }) => {
|
|
|
42
41
|
updatedManifest = manifest;
|
|
43
42
|
onProgress?.({
|
|
44
43
|
type: "manifest_updated",
|
|
45
|
-
|
|
44
|
+
app: app.key,
|
|
46
45
|
manifestKey: updatedManifestKey,
|
|
47
46
|
version: manifestEntry.version || "",
|
|
48
47
|
});
|
|
49
|
-
onProgress?.({ type: "app_processing_complete",
|
|
48
|
+
onProgress?.({ type: "app_processing_complete", app: app.key });
|
|
50
49
|
}
|
|
51
50
|
catch (error) {
|
|
52
51
|
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
53
52
|
onProgress?.({
|
|
54
53
|
type: "app_processing_error",
|
|
55
|
-
|
|
54
|
+
app: app.key,
|
|
56
55
|
error: errorMessage,
|
|
57
56
|
});
|
|
58
57
|
if (error instanceof ZapierValidationError) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { AppItem, Manifest } from "@zapier/zapier-sdk";
|
|
3
3
|
export declare const BuildManifestSchema: z.ZodObject<{
|
|
4
|
-
|
|
4
|
+
apps: z.ZodArray<z.ZodString>;
|
|
5
5
|
skipWrite: z.ZodOptional<z.ZodBoolean>;
|
|
6
6
|
configPath: z.ZodOptional<z.ZodString>;
|
|
7
7
|
}, z.core.$strip>;
|
|
@@ -19,24 +19,24 @@ export type ManifestBuildProgressEvent = {
|
|
|
19
19
|
count: number;
|
|
20
20
|
} | {
|
|
21
21
|
type: "app_processing_start";
|
|
22
|
-
|
|
22
|
+
app: string;
|
|
23
23
|
slug?: string;
|
|
24
24
|
} | {
|
|
25
25
|
type: "manifest_entry_built";
|
|
26
|
-
|
|
26
|
+
app: string;
|
|
27
27
|
manifestKey: string;
|
|
28
28
|
version: string;
|
|
29
29
|
} | {
|
|
30
30
|
type: "manifest_updated";
|
|
31
|
-
|
|
31
|
+
app: string;
|
|
32
32
|
manifestKey: string;
|
|
33
33
|
version: string;
|
|
34
34
|
} | {
|
|
35
35
|
type: "app_processing_complete";
|
|
36
|
-
|
|
36
|
+
app: string;
|
|
37
37
|
} | {
|
|
38
38
|
type: "app_processing_error";
|
|
39
|
-
|
|
39
|
+
app: string;
|
|
40
40
|
error: string;
|
|
41
41
|
};
|
|
42
42
|
export interface BuildManifestResult {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export const BuildManifestSchema = z
|
|
3
3
|
.object({
|
|
4
|
-
|
|
4
|
+
apps: z
|
|
5
5
|
.array(z.string().min(1, "App key cannot be empty"))
|
|
6
6
|
.min(1, "At least one app key is required")
|
|
7
7
|
.describe("One or more app keys to build manifest entries for (e.g., 'slack', 'github', 'trello')"),
|
|
@@ -5,7 +5,8 @@ import { CurlSchema } from "./schemas";
|
|
|
5
5
|
import { CurlExitError, parseHeaderLine, basicAuthHeader, deriveRemoteFilename, formatWriteOut, appendQueryParams, readAllStdin, resolveDataArgText, resolveDataArgBinary, buildFormData, } from "./utils";
|
|
6
6
|
export const curlPlugin = ({ sdk, }) => {
|
|
7
7
|
async function curl(options) {
|
|
8
|
-
const { url: rawUrl, request, header = [], data = [], dataRaw = [], dataAscii = [], dataBinary = [], dataUrlencode = [], json, form = [], formString = [], get: forceGet, head: forceHead, location, include, output, remoteName, verbose, silent, showError, fail, failWithBody, writeOut, maxTime, user, compressed, connectionId, } = options;
|
|
8
|
+
const { url: rawUrl, request, header = [], data = [], dataRaw = [], dataAscii = [], dataBinary = [], dataUrlencode = [], json, form = [], formString = [], get: forceGet, head: forceHead, location, include, output, remoteName, verbose, silent, showError, fail, failWithBody, writeOut, maxTime, user, compressed, connection: connectionParam, connectionId, } = options;
|
|
9
|
+
const connection = connectionParam ?? connectionId;
|
|
9
10
|
const parsedUrl = new URL(rawUrl);
|
|
10
11
|
const headers = {};
|
|
11
12
|
for (const h of header) {
|
|
@@ -126,7 +127,7 @@ export const curlPlugin = ({ sdk, }) => {
|
|
|
126
127
|
body,
|
|
127
128
|
redirect,
|
|
128
129
|
signal,
|
|
129
|
-
|
|
130
|
+
connection,
|
|
130
131
|
});
|
|
131
132
|
const timeTotalSeconds = (performance.now() - start) / 1000;
|
|
132
133
|
if (verbose && !silent) {
|
|
@@ -34,6 +34,7 @@ export declare const CurlSchema: z.ZodObject<{
|
|
|
34
34
|
maxTime: z.ZodOptional<z.ZodNumber>;
|
|
35
35
|
user: z.ZodOptional<z.ZodString>;
|
|
36
36
|
compressed: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
+
connection: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
37
38
|
connectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
38
39
|
}, z.core.$strip>;
|
|
39
40
|
export type CurlOptions = z.infer<typeof CurlSchema>;
|
|
@@ -93,9 +93,14 @@ export const CurlSchema = z
|
|
|
93
93
|
.boolean()
|
|
94
94
|
.optional()
|
|
95
95
|
.describe("Request compressed response (sends Accept-Encoding header)"),
|
|
96
|
+
connection: z
|
|
97
|
+
.union([z.string(), z.number()])
|
|
98
|
+
.optional()
|
|
99
|
+
.describe("Zapier connection ID or alias for authentication"),
|
|
100
|
+
/** @deprecated Use `connection` instead. */
|
|
96
101
|
connectionId: z
|
|
97
102
|
.union([z.string(), z.number()])
|
|
98
103
|
.optional()
|
|
99
|
-
.
|
|
104
|
+
.meta({ deprecated: true }),
|
|
100
105
|
})
|
|
101
106
|
.describe("Make HTTP requests through Zapier Relay with curl-like options");
|