@zapier/zapier-sdk 0.23.2 → 0.25.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 +15 -0
- package/README.md +29 -56
- package/dist/api/polling.d.ts +7 -0
- package/dist/api/polling.d.ts.map +1 -1
- package/dist/api/polling.js +21 -19
- package/dist/api/polling.test.js +43 -1
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/index.cjs +162 -128
- package/dist/index.d.mts +59 -31
- package/dist/index.mjs +161 -129
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/apps/index.js +2 -1
- package/dist/plugins/apps/schemas.d.ts +1 -0
- package/dist/plugins/apps/schemas.d.ts.map +1 -1
- package/dist/plugins/apps/schemas.js +2 -1
- package/dist/plugins/fetch/index.d.ts +13 -5
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/index.js +85 -33
- package/dist/plugins/fetch/index.test.d.ts +2 -0
- package/dist/plugins/fetch/index.test.d.ts.map +1 -0
- package/dist/plugins/fetch/index.test.js +296 -0
- package/dist/plugins/fetch/schemas.d.ts.map +1 -1
- package/dist/plugins/fetch/schemas.js +10 -5
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +1 -0
- package/dist/plugins/request/index.d.ts +8 -7
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +15 -55
- package/dist/plugins/request/index.test.js +106 -2
- package/dist/plugins/request/schemas.d.ts +0 -2
- package/dist/plugins/request/schemas.d.ts.map +1 -1
- package/dist/plugins/request/schemas.js +0 -3
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +5 -3
- package/dist/plugins/runAction/index.test.js +16 -0
- package/dist/plugins/runAction/schemas.d.ts +1 -0
- package/dist/plugins/runAction/schemas.d.ts.map +1 -1
- package/dist/plugins/runAction/schemas.js +2 -1
- package/dist/schemas/Action.d.ts +1 -1
- package/dist/sdk.d.ts +8 -7
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +2 -2
- package/dist/types/plugin.d.ts +6 -0
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/properties.d.ts +2 -0
- package/dist/types/properties.d.ts.map +1 -1
- package/dist/types/properties.js +6 -1
- package/dist/types/sdk.d.ts +6 -0
- package/dist/types/sdk.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -37,6 +37,7 @@ function isPositional(schema) {
|
|
|
37
37
|
// src/constants.ts
|
|
38
38
|
var ZAPIER_BASE_URL = process.env.ZAPIER_BASE_URL || "https://zapier.com";
|
|
39
39
|
var MAX_PAGE_LIMIT = 1e4;
|
|
40
|
+
var DEFAULT_ACTION_TIMEOUT_MS = 18e4;
|
|
40
41
|
var ZAPIER_CREDENTIALS = process.env.ZAPIER_CREDENTIALS;
|
|
41
42
|
var ZAPIER_CREDENTIALS_CLIENT_ID = process.env.ZAPIER_CREDENTIALS_CLIENT_ID;
|
|
42
43
|
var ZAPIER_CREDENTIALS_CLIENT_SECRET = process.env.ZAPIER_CREDENTIALS_CLIENT_SECRET;
|
|
@@ -68,6 +69,9 @@ var OffsetPropertySchema = z.number().int().min(0).default(0).describe("Number o
|
|
|
68
69
|
var OutputPropertySchema = z.string().describe("Output file path");
|
|
69
70
|
var DebugPropertySchema = z.boolean().default(false).describe("Enable debug logging");
|
|
70
71
|
var ParamsPropertySchema = z.record(z.string(), z.unknown()).describe("Additional parameters");
|
|
72
|
+
var ActionTimeoutMsPropertySchema = z.number().min(1e3).optional().describe(
|
|
73
|
+
`Maximum time to wait for action completion in milliseconds (default: ${DEFAULT_ACTION_TIMEOUT_MS})`
|
|
74
|
+
);
|
|
71
75
|
|
|
72
76
|
// src/types/errors.ts
|
|
73
77
|
var ZapierError = class extends Error {
|
|
@@ -205,7 +209,8 @@ HTTP Status: ${error.statusCode}`;
|
|
|
205
209
|
}
|
|
206
210
|
var ActionExecutionInputSchema = z.object({
|
|
207
211
|
inputs: z.record(z.string(), z.unknown()).optional(),
|
|
208
|
-
authenticationId: AuthenticationIdPropertySchema.optional()
|
|
212
|
+
authenticationId: AuthenticationIdPropertySchema.optional(),
|
|
213
|
+
timeoutMs: ActionTimeoutMsPropertySchema
|
|
209
214
|
}).describe(
|
|
210
215
|
"Execute an action with the given inputs for the bound app, as an alternative to runAction"
|
|
211
216
|
);
|
|
@@ -242,7 +247,11 @@ var ActionResultItemSchema = withFormatter(
|
|
|
242
247
|
function createActionFunction(appKey, actionType, actionKey, options, pinnedAuthId) {
|
|
243
248
|
return (actionOptions = {}) => {
|
|
244
249
|
const { sdk } = options;
|
|
245
|
-
const {
|
|
250
|
+
const {
|
|
251
|
+
inputs,
|
|
252
|
+
authenticationId: providedAuthenticationId,
|
|
253
|
+
timeoutMs
|
|
254
|
+
} = actionOptions;
|
|
246
255
|
const authenticationId = pinnedAuthId ?? providedAuthenticationId;
|
|
247
256
|
if (!authenticationId) {
|
|
248
257
|
throw new ZapierValidationError(
|
|
@@ -254,7 +263,8 @@ function createActionFunction(appKey, actionType, actionKey, options, pinnedAuth
|
|
|
254
263
|
actionType,
|
|
255
264
|
actionKey,
|
|
256
265
|
inputs,
|
|
257
|
-
authenticationId
|
|
266
|
+
authenticationId,
|
|
267
|
+
timeoutMs
|
|
258
268
|
});
|
|
259
269
|
};
|
|
260
270
|
}
|
|
@@ -362,71 +372,136 @@ var appsPlugin = ({ sdk }) => {
|
|
|
362
372
|
}
|
|
363
373
|
};
|
|
364
374
|
};
|
|
365
|
-
var FetchUrlSchema = z.union([z.string(), z.instanceof(URL)]).describe(
|
|
375
|
+
var FetchUrlSchema = z.union([z.string(), z.instanceof(URL)]).describe(
|
|
376
|
+
"The full URL of the API endpoint to call (proxied through Zapier's Relay service)"
|
|
377
|
+
);
|
|
366
378
|
var FetchInitSchema = z.object({
|
|
367
|
-
method: z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]).optional(),
|
|
368
|
-
headers: z.record(z.string(), z.string()).optional(),
|
|
379
|
+
method: z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]).optional().describe("HTTP method for the request (defaults to GET)"),
|
|
380
|
+
headers: z.record(z.string(), z.string()).optional().describe("HTTP headers to include in the request"),
|
|
369
381
|
body: z.union([
|
|
370
382
|
z.string(),
|
|
371
383
|
z.instanceof(FormData),
|
|
372
384
|
z.instanceof(URLSearchParams)
|
|
373
|
-
]).optional()
|
|
385
|
+
]).optional().describe(
|
|
386
|
+
"Request body \u2014 JSON strings are auto-detected and Content-Type is set accordingly"
|
|
387
|
+
),
|
|
374
388
|
authenticationId: AuthenticationIdPropertySchema.optional(),
|
|
375
389
|
callbackUrl: z.string().optional().describe("URL to send async response to (makes request async)"),
|
|
376
390
|
authenticationTemplate: z.string().optional().describe(
|
|
377
391
|
"Optional JSON string authentication template to bypass Notary lookup"
|
|
378
392
|
)
|
|
379
|
-
}).optional().describe(
|
|
393
|
+
}).optional().describe(
|
|
394
|
+
"Request options including method, headers, body, and authentication"
|
|
395
|
+
);
|
|
396
|
+
|
|
397
|
+
// src/utils/id-utils.ts
|
|
398
|
+
function coerceToNumericId(fieldName, value) {
|
|
399
|
+
if (value === "") {
|
|
400
|
+
throw new ZapierValidationError(`The ${fieldName} cannot be empty`);
|
|
401
|
+
}
|
|
402
|
+
const numericValue = typeof value === "number" ? value : Number(value);
|
|
403
|
+
if (!Number.isFinite(numericValue)) {
|
|
404
|
+
throw new ZapierValidationError(
|
|
405
|
+
`The ${fieldName} "${value}" could not be converted to a number`
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
return numericValue;
|
|
409
|
+
}
|
|
380
410
|
|
|
381
411
|
// src/plugins/fetch/index.ts
|
|
382
|
-
|
|
412
|
+
function transformUrlToRelayPath(url) {
|
|
413
|
+
const targetUrl = new URL(url);
|
|
414
|
+
return `/relay/${targetUrl.host}${targetUrl.pathname}${targetUrl.search}${targetUrl.hash}`;
|
|
415
|
+
}
|
|
416
|
+
function normalizeHeaders(optionsHeaders) {
|
|
417
|
+
const headers = {};
|
|
418
|
+
if (!optionsHeaders) {
|
|
419
|
+
return headers;
|
|
420
|
+
}
|
|
421
|
+
const headerEntries = optionsHeaders instanceof Headers ? Array.from(optionsHeaders.entries()) : Array.isArray(optionsHeaders) ? optionsHeaders : Object.entries(optionsHeaders);
|
|
422
|
+
for (const [key, value] of headerEntries) {
|
|
423
|
+
headers[key] = value;
|
|
424
|
+
}
|
|
425
|
+
return headers;
|
|
426
|
+
}
|
|
427
|
+
var fetchPlugin = ({ context }) => {
|
|
383
428
|
return {
|
|
384
429
|
fetch: async function fetch2(url, init) {
|
|
430
|
+
const { api } = context;
|
|
385
431
|
const startTime = Date.now();
|
|
432
|
+
const isNested = init?._telemetry?.isNested === true;
|
|
386
433
|
try {
|
|
387
434
|
const {
|
|
388
435
|
authenticationId,
|
|
389
436
|
callbackUrl,
|
|
390
437
|
authenticationTemplate,
|
|
438
|
+
_telemetry,
|
|
391
439
|
...fetchInit
|
|
392
440
|
} = init || {};
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
|
|
441
|
+
const relayPath = transformUrlToRelayPath(url);
|
|
442
|
+
const headers = normalizeHeaders(
|
|
443
|
+
fetchInit.headers
|
|
444
|
+
);
|
|
445
|
+
const hasContentType = Object.keys(headers).some(
|
|
446
|
+
(k) => k.toLowerCase() === "content-type"
|
|
447
|
+
);
|
|
448
|
+
if (fetchInit.body && !hasContentType) {
|
|
449
|
+
const bodyStr = typeof fetchInit.body === "string" ? fetchInit.body : JSON.stringify(fetchInit.body);
|
|
450
|
+
const trimmed = bodyStr.trimStart();
|
|
451
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
452
|
+
headers["Content-Type"] = "application/json; charset=utf-8";
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if (authenticationId) {
|
|
456
|
+
headers["X-Relay-Authentication-Id"] = coerceToNumericId(
|
|
457
|
+
"authenticationId",
|
|
458
|
+
authenticationId
|
|
459
|
+
).toString();
|
|
460
|
+
}
|
|
461
|
+
if (callbackUrl) {
|
|
462
|
+
headers["X-Relay-Callback-Url"] = callbackUrl;
|
|
463
|
+
}
|
|
464
|
+
if (authenticationTemplate) {
|
|
465
|
+
headers["X-Authentication-Template"] = authenticationTemplate;
|
|
466
|
+
}
|
|
467
|
+
const result = await api.fetch(relayPath, {
|
|
468
|
+
method: fetchInit.method ?? "GET",
|
|
396
469
|
body: fetchInit.body,
|
|
397
|
-
headers
|
|
398
|
-
|
|
399
|
-
callbackUrl,
|
|
400
|
-
authenticationTemplate,
|
|
401
|
-
_telemetry: { isNested: true }
|
|
402
|
-
});
|
|
403
|
-
context.eventEmission.emitMethodCalled({
|
|
404
|
-
method_name: "fetch",
|
|
405
|
-
execution_duration_ms: Date.now() - startTime,
|
|
406
|
-
success_flag: true,
|
|
407
|
-
error_message: null,
|
|
408
|
-
error_type: null,
|
|
409
|
-
argument_count: init ? 2 : 1,
|
|
410
|
-
is_paginated: false
|
|
470
|
+
headers,
|
|
471
|
+
authRequired: true
|
|
411
472
|
});
|
|
473
|
+
if (!isNested) {
|
|
474
|
+
context.eventEmission.emitMethodCalled({
|
|
475
|
+
method_name: "fetch",
|
|
476
|
+
execution_duration_ms: Date.now() - startTime,
|
|
477
|
+
success_flag: true,
|
|
478
|
+
error_message: null,
|
|
479
|
+
error_type: null,
|
|
480
|
+
argument_count: init ? 2 : 1,
|
|
481
|
+
is_paginated: false
|
|
482
|
+
});
|
|
483
|
+
}
|
|
412
484
|
return result;
|
|
413
485
|
} catch (error) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
486
|
+
if (!isNested) {
|
|
487
|
+
context.eventEmission.emitMethodCalled({
|
|
488
|
+
method_name: "fetch",
|
|
489
|
+
execution_duration_ms: Date.now() - startTime,
|
|
490
|
+
success_flag: false,
|
|
491
|
+
error_message: error instanceof Error ? error.message : String(error),
|
|
492
|
+
error_type: error instanceof Error ? error.constructor.name : "Unknown",
|
|
493
|
+
argument_count: init ? 2 : 1,
|
|
494
|
+
is_paginated: false
|
|
495
|
+
});
|
|
496
|
+
}
|
|
423
497
|
throw error;
|
|
424
498
|
}
|
|
425
499
|
},
|
|
426
500
|
context: {
|
|
427
501
|
meta: {
|
|
428
502
|
fetch: {
|
|
429
|
-
|
|
503
|
+
description: "Make authenticated HTTP requests to any API through Zapier's Relay service. Pass an authenticationId to automatically inject the user's stored credentials (OAuth tokens, API keys, etc.) into the outgoing request. Mirrors the native fetch(url, init?) signature with additional Zapier-specific options.",
|
|
504
|
+
packages: ["sdk", "cli", "mcp"],
|
|
430
505
|
categories: ["http"],
|
|
431
506
|
returnType: "Response",
|
|
432
507
|
inputParameters: [
|
|
@@ -1805,20 +1880,6 @@ var RootFieldItemSchema = z.union([
|
|
|
1805
1880
|
FieldsetItemSchema
|
|
1806
1881
|
]);
|
|
1807
1882
|
|
|
1808
|
-
// src/utils/id-utils.ts
|
|
1809
|
-
function coerceToNumericId(fieldName, value) {
|
|
1810
|
-
if (value === "") {
|
|
1811
|
-
throw new ZapierValidationError(`The ${fieldName} cannot be empty`);
|
|
1812
|
-
}
|
|
1813
|
-
const numericValue = typeof value === "number" ? value : Number(value);
|
|
1814
|
-
if (!Number.isFinite(numericValue)) {
|
|
1815
|
-
throw new ZapierValidationError(
|
|
1816
|
-
`The ${fieldName} "${value}" could not be converted to a number`
|
|
1817
|
-
);
|
|
1818
|
-
}
|
|
1819
|
-
return numericValue;
|
|
1820
|
-
}
|
|
1821
|
-
|
|
1822
1883
|
// src/services/implementations.ts
|
|
1823
1884
|
async function fetchImplementationNeeds({
|
|
1824
1885
|
api,
|
|
@@ -2658,6 +2719,7 @@ var RunActionSchema = z.object({
|
|
|
2658
2719
|
inputs: InputsPropertySchema.optional().describe(
|
|
2659
2720
|
"Input parameters for the action"
|
|
2660
2721
|
),
|
|
2722
|
+
timeoutMs: ActionTimeoutMsPropertySchema,
|
|
2661
2723
|
pageSize: z.number().min(1).optional().describe("Number of results per page"),
|
|
2662
2724
|
maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
2663
2725
|
cursor: z.string().optional().describe("Cursor to start from")
|
|
@@ -2673,7 +2735,8 @@ async function executeAction(actionOptions) {
|
|
|
2673
2735
|
actionKey,
|
|
2674
2736
|
actionType,
|
|
2675
2737
|
executionOptions,
|
|
2676
|
-
authenticationId
|
|
2738
|
+
authenticationId,
|
|
2739
|
+
timeoutMs
|
|
2677
2740
|
} = actionOptions;
|
|
2678
2741
|
const selectedApi = await context.getVersionedImplementationId(appKey);
|
|
2679
2742
|
if (!selectedApi) {
|
|
@@ -2703,6 +2766,7 @@ async function executeAction(actionOptions) {
|
|
|
2703
2766
|
return await api.poll(`/zapier/api/actions/v1/runs/${runId}`, {
|
|
2704
2767
|
successStatus: 200,
|
|
2705
2768
|
pendingStatus: 202,
|
|
2769
|
+
timeoutMs: timeoutMs ?? DEFAULT_ACTION_TIMEOUT_MS,
|
|
2706
2770
|
isPending: (result) => {
|
|
2707
2771
|
const data = result?.data;
|
|
2708
2772
|
return data?.status === "waiting";
|
|
@@ -2718,7 +2782,8 @@ var runActionPlugin = ({ sdk, context }) => {
|
|
|
2718
2782
|
actionKey,
|
|
2719
2783
|
actionType,
|
|
2720
2784
|
authenticationId,
|
|
2721
|
-
inputs = {}
|
|
2785
|
+
inputs = {},
|
|
2786
|
+
timeoutMs
|
|
2722
2787
|
} = options;
|
|
2723
2788
|
const actionData = await sdk.getAction({
|
|
2724
2789
|
appKey,
|
|
@@ -2742,7 +2807,9 @@ var runActionPlugin = ({ sdk, context }) => {
|
|
|
2742
2807
|
actionKey,
|
|
2743
2808
|
actionType,
|
|
2744
2809
|
executionOptions: { inputs },
|
|
2745
|
-
authenticationId
|
|
2810
|
+
authenticationId,
|
|
2811
|
+
timeoutMs
|
|
2812
|
+
});
|
|
2746
2813
|
if (result.errors && result.errors.length > 0) {
|
|
2747
2814
|
const errorMessage = result.errors.map(
|
|
2748
2815
|
(error) => error.detail || error.title || "Unknown error"
|
|
@@ -2801,64 +2868,41 @@ var RelayRequestSchema = z.object({
|
|
|
2801
2868
|
z.instanceof(Headers),
|
|
2802
2869
|
z.array(z.tuple([z.string(), z.string()]))
|
|
2803
2870
|
]).optional().describe("Request headers")
|
|
2804
|
-
}).extend({
|
|
2805
|
-
relayBaseUrl: z.string().optional().describe("Base URL for Relay service")
|
|
2806
2871
|
}).merge(TelemetryMarkerSchema).describe("Make authenticated HTTP requests through Zapier's Relay service");
|
|
2807
2872
|
var RelayFetchSchema = RelayRequestSchema;
|
|
2808
2873
|
|
|
2809
|
-
// src/
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2874
|
+
// src/utils/logging.ts
|
|
2875
|
+
var loggedDeprecations = /* @__PURE__ */ new Set();
|
|
2876
|
+
function logDeprecation(message) {
|
|
2877
|
+
if (loggedDeprecations.has(message)) return;
|
|
2878
|
+
loggedDeprecations.add(message);
|
|
2879
|
+
console.warn(`[zapier-sdk] Deprecation: ${message}`);
|
|
2880
|
+
}
|
|
2881
|
+
function resetDeprecationWarnings() {
|
|
2882
|
+
loggedDeprecations.clear();
|
|
2814
2883
|
}
|
|
2815
|
-
|
|
2884
|
+
|
|
2885
|
+
// src/plugins/request/index.ts
|
|
2886
|
+
var requestPlugin = ({ sdk, context }) => {
|
|
2816
2887
|
async function request(options) {
|
|
2817
|
-
|
|
2888
|
+
logDeprecation("request() is deprecated. Use fetch() instead.");
|
|
2818
2889
|
const {
|
|
2819
2890
|
url,
|
|
2820
|
-
method
|
|
2891
|
+
method,
|
|
2821
2892
|
body,
|
|
2822
|
-
headers
|
|
2893
|
+
headers,
|
|
2823
2894
|
authenticationId,
|
|
2824
2895
|
callbackUrl,
|
|
2825
2896
|
authenticationTemplate
|
|
2826
2897
|
} = options;
|
|
2827
|
-
|
|
2828
|
-
const headers = {};
|
|
2829
|
-
if (optionsHeaders) {
|
|
2830
|
-
const headerEntries = optionsHeaders instanceof Headers ? Array.from(optionsHeaders.entries()) : Array.isArray(optionsHeaders) ? optionsHeaders : Object.entries(optionsHeaders);
|
|
2831
|
-
for (const [key, value] of headerEntries) {
|
|
2832
|
-
headers[key] = value;
|
|
2833
|
-
}
|
|
2834
|
-
}
|
|
2835
|
-
const hasContentType = Object.keys(headers).some(
|
|
2836
|
-
(k) => k.toLowerCase() === "content-type"
|
|
2837
|
-
);
|
|
2838
|
-
if (body && !hasContentType) {
|
|
2839
|
-
const bodyStr = typeof body === "string" ? body : JSON.stringify(body);
|
|
2840
|
-
const trimmed = bodyStr.trimStart();
|
|
2841
|
-
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
2842
|
-
headers["Content-Type"] = "application/json; charset=utf-8";
|
|
2843
|
-
}
|
|
2844
|
-
}
|
|
2845
|
-
if (authenticationId) {
|
|
2846
|
-
headers["X-Relay-Authentication-Id"] = coerceToNumericId(
|
|
2847
|
-
"authenticationId",
|
|
2848
|
-
authenticationId
|
|
2849
|
-
).toString();
|
|
2850
|
-
}
|
|
2851
|
-
if (callbackUrl) {
|
|
2852
|
-
headers["X-Relay-Callback-Url"] = callbackUrl;
|
|
2853
|
-
}
|
|
2854
|
-
if (authenticationTemplate) {
|
|
2855
|
-
headers["X-Authentication-Template"] = authenticationTemplate;
|
|
2856
|
-
}
|
|
2857
|
-
return await api.fetch(relayPath, {
|
|
2898
|
+
return sdk.fetch(url, {
|
|
2858
2899
|
method,
|
|
2859
2900
|
body,
|
|
2860
2901
|
headers,
|
|
2861
|
-
|
|
2902
|
+
authenticationId,
|
|
2903
|
+
callbackUrl,
|
|
2904
|
+
authenticationTemplate,
|
|
2905
|
+
_telemetry: { isNested: true }
|
|
2862
2906
|
});
|
|
2863
2907
|
}
|
|
2864
2908
|
const requestDefinition = createFunction(
|
|
@@ -2874,7 +2918,8 @@ var requestPlugin = ({ context }) => {
|
|
|
2874
2918
|
context: {
|
|
2875
2919
|
meta: {
|
|
2876
2920
|
request: {
|
|
2877
|
-
|
|
2921
|
+
packages: ["cli", "mcp"],
|
|
2922
|
+
categories: ["http", "deprecated"],
|
|
2878
2923
|
returnType: "Response",
|
|
2879
2924
|
inputSchema: RelayRequestSchema
|
|
2880
2925
|
}
|
|
@@ -3583,9 +3628,8 @@ var DEFAULT_TIMEOUT_MS = 18e4;
|
|
|
3583
3628
|
var DEFAULT_SUCCESS_STATUS = 200;
|
|
3584
3629
|
var DEFAULT_PENDING_STATUS = 202;
|
|
3585
3630
|
var DEFAULT_INITIAL_DELAY_MS = 50;
|
|
3586
|
-
var DEFAULT_MAX_POLLING_INTERVAL_MS =
|
|
3587
|
-
var
|
|
3588
|
-
var DEFAULT_POLLING_STAGES = [
|
|
3631
|
+
var DEFAULT_MAX_POLLING_INTERVAL_MS = 6e4;
|
|
3632
|
+
var POLLING_STAGES = [
|
|
3589
3633
|
[125, 125],
|
|
3590
3634
|
// Up to 125ms: poll every 125ms
|
|
3591
3635
|
[375, 250],
|
|
@@ -3596,9 +3640,16 @@ var DEFAULT_POLLING_STAGES = [
|
|
|
3596
3640
|
// Up to 10s: poll every 1s
|
|
3597
3641
|
[3e4, 2500],
|
|
3598
3642
|
// Up to 30s: poll every 2.5s
|
|
3599
|
-
[6e4, 5e3]
|
|
3643
|
+
[6e4, 5e3],
|
|
3600
3644
|
// Up to 60s: poll every 5s
|
|
3645
|
+
[18e4, 1e4]
|
|
3646
|
+
// Up to 3min: poll every 10s
|
|
3647
|
+
// Beyond 3min: use DEFAULT_MAX_POLLING_INTERVAL_MS (60s)
|
|
3601
3648
|
];
|
|
3649
|
+
function getPollingInterval(elapsedMs) {
|
|
3650
|
+
const stage = POLLING_STAGES.find(([threshold]) => elapsedMs < threshold);
|
|
3651
|
+
return stage ? stage[1] : DEFAULT_MAX_POLLING_INTERVAL_MS;
|
|
3652
|
+
}
|
|
3602
3653
|
var processResponse = async (response, successStatus, pendingStatus, isPending, resultExtractor, errorCount) => {
|
|
3603
3654
|
if (!response.ok) {
|
|
3604
3655
|
return {
|
|
@@ -3667,23 +3718,12 @@ async function pollUntilComplete(options) {
|
|
|
3667
3718
|
const startTime = Date.now();
|
|
3668
3719
|
let attempts = 0;
|
|
3669
3720
|
let errorCount = 0;
|
|
3670
|
-
const pollingStages = [
|
|
3671
|
-
...DEFAULT_POLLING_STAGES,
|
|
3672
|
-
[timeoutMs + MAX_TIMEOUT_BUFFER_MS, DEFAULT_MAX_POLLING_INTERVAL_MS]
|
|
3673
|
-
// Up to timeout + 10s: poll every 10s
|
|
3674
|
-
];
|
|
3675
3721
|
if (initialDelay > 0) {
|
|
3676
3722
|
await setTimeout$1(initialDelay);
|
|
3677
3723
|
}
|
|
3678
3724
|
while (true) {
|
|
3679
|
-
attempts++;
|
|
3680
3725
|
const elapsedTime = Date.now() - startTime;
|
|
3681
|
-
|
|
3682
|
-
([maxTimeForStage, _interval]) => {
|
|
3683
|
-
return elapsedTime < maxTimeForStage;
|
|
3684
|
-
}
|
|
3685
|
-
);
|
|
3686
|
-
if (!pollingInterval) {
|
|
3726
|
+
if (elapsedTime >= timeoutMs) {
|
|
3687
3727
|
throw new ZapierTimeoutError(
|
|
3688
3728
|
`Operation timed out after ${Math.floor(elapsedTime / 1e3)}s (${attempts} attempts)`,
|
|
3689
3729
|
{
|
|
@@ -3691,10 +3731,12 @@ async function pollUntilComplete(options) {
|
|
|
3691
3731
|
}
|
|
3692
3732
|
);
|
|
3693
3733
|
}
|
|
3694
|
-
if (attempts >
|
|
3695
|
-
const
|
|
3734
|
+
if (attempts > 0) {
|
|
3735
|
+
const interval = getPollingInterval(elapsedTime);
|
|
3736
|
+
const waitTime = calculateWaitTime(interval, errorCount);
|
|
3696
3737
|
await setTimeout$1(waitTime);
|
|
3697
3738
|
}
|
|
3739
|
+
attempts++;
|
|
3698
3740
|
try {
|
|
3699
3741
|
const response = await fetchPoll();
|
|
3700
3742
|
const {
|
|
@@ -3747,17 +3789,6 @@ function isCredentialsFunction(credentials) {
|
|
|
3747
3789
|
return typeof credentials === "function";
|
|
3748
3790
|
}
|
|
3749
3791
|
|
|
3750
|
-
// src/utils/logging.ts
|
|
3751
|
-
var loggedDeprecations = /* @__PURE__ */ new Set();
|
|
3752
|
-
function logDeprecation(message) {
|
|
3753
|
-
if (loggedDeprecations.has(message)) return;
|
|
3754
|
-
loggedDeprecations.add(message);
|
|
3755
|
-
console.warn(`[zapier-sdk] Deprecation: ${message}`);
|
|
3756
|
-
}
|
|
3757
|
-
function resetDeprecationWarnings() {
|
|
3758
|
-
loggedDeprecations.clear();
|
|
3759
|
-
}
|
|
3760
|
-
|
|
3761
3792
|
// src/utils/url-utils.ts
|
|
3762
3793
|
function getZapierBaseUrl(baseUrl) {
|
|
3763
3794
|
if (!baseUrl) {
|
|
@@ -4615,6 +4646,7 @@ var registryPlugin = ({ sdk, context }) => {
|
|
|
4615
4646
|
const meta = context.meta[key];
|
|
4616
4647
|
return {
|
|
4617
4648
|
name: key,
|
|
4649
|
+
description: meta.description,
|
|
4618
4650
|
type: meta.type,
|
|
4619
4651
|
itemType: meta.itemType,
|
|
4620
4652
|
returnType: meta.returnType,
|
|
@@ -5075,7 +5107,7 @@ function getCpuTime() {
|
|
|
5075
5107
|
|
|
5076
5108
|
// package.json
|
|
5077
5109
|
var package_default = {
|
|
5078
|
-
version: "0.
|
|
5110
|
+
version: "0.25.0"};
|
|
5079
5111
|
|
|
5080
5112
|
// src/plugins/eventEmission/builders.ts
|
|
5081
5113
|
function createBaseEvent(context = {}) {
|
|
@@ -5529,10 +5561,10 @@ function createSdk(options = {}, initialSdk = {}, initialContext = { meta: {} })
|
|
|
5529
5561
|
};
|
|
5530
5562
|
}
|
|
5531
5563
|
function createZapierSdkWithoutRegistry(options = {}) {
|
|
5532
|
-
return createSdk(options).addPlugin(eventEmissionPlugin).addPlugin(apiPlugin).addPlugin(manifestPlugin).addPlugin(listAppsPlugin).addPlugin(getAppPlugin).addPlugin(listActionsPlugin).addPlugin(getActionPlugin).addPlugin(listInputFieldsPlugin).addPlugin(getInputFieldsSchemaPlugin).addPlugin(listInputFieldChoicesPlugin).addPlugin(runActionPlugin).addPlugin(listAuthenticationsPlugin).addPlugin(getAuthenticationPlugin).addPlugin(findFirstAuthenticationPlugin).addPlugin(findUniqueAuthenticationPlugin).addPlugin(listClientCredentialsPlugin).addPlugin(createClientCredentialsPlugin).addPlugin(deleteClientCredentialsPlugin).addPlugin(
|
|
5564
|
+
return createSdk(options).addPlugin(eventEmissionPlugin).addPlugin(apiPlugin).addPlugin(manifestPlugin).addPlugin(listAppsPlugin).addPlugin(getAppPlugin).addPlugin(listActionsPlugin).addPlugin(getActionPlugin).addPlugin(listInputFieldsPlugin).addPlugin(getInputFieldsSchemaPlugin).addPlugin(listInputFieldChoicesPlugin).addPlugin(runActionPlugin).addPlugin(listAuthenticationsPlugin).addPlugin(getAuthenticationPlugin).addPlugin(findFirstAuthenticationPlugin).addPlugin(findUniqueAuthenticationPlugin).addPlugin(listClientCredentialsPlugin).addPlugin(createClientCredentialsPlugin).addPlugin(deleteClientCredentialsPlugin).addPlugin(fetchPlugin).addPlugin(requestPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
|
|
5533
5565
|
}
|
|
5534
5566
|
function createZapierSdk(options = {}) {
|
|
5535
5567
|
return createZapierSdkWithoutRegistry(options).addPlugin(registryPlugin);
|
|
5536
5568
|
}
|
|
5537
5569
|
|
|
5538
|
-
export { ActionKeyPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AuthenticationIdPropertySchema, DEFAULT_CONFIG_PATH, DebugPropertySchema, InputsPropertySchema, LimitPropertySchema, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, RelayFetchSchema, RelayRequestSchema, ZAPIER_AUTH_BASE_URL, ZAPIER_AUTH_CLIENT_ID, ZAPIER_BASE_URL, ZAPIER_CREDENTIALS, ZAPIER_CREDENTIALS_BASE_URL, ZAPIER_CREDENTIALS_CLIENT_ID, ZAPIER_CREDENTIALS_CLIENT_SECRET, ZAPIER_CREDENTIALS_SCOPE, ZAPIER_TOKEN, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, ZapierNotFoundError, ZapierResourceNotFoundError, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, authenticationIdGenericResolver, authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, createBaseEvent, createClientCredentialsPlugin, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, fetchPlugin, findFirstAuthenticationPlugin, findManifestEntry, findUniqueAuthenticationPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getAuthenticationPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTokenFromCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listAuthenticationsPlugin, listClientCredentialsPlugin, listInputFieldsPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, toSnakeCase, toTitleCase };
|
|
5570
|
+
export { ActionKeyPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AuthenticationIdPropertySchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DebugPropertySchema, InputsPropertySchema, LimitPropertySchema, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, RelayFetchSchema, RelayRequestSchema, ZAPIER_AUTH_BASE_URL, ZAPIER_AUTH_CLIENT_ID, ZAPIER_BASE_URL, ZAPIER_CREDENTIALS, ZAPIER_CREDENTIALS_BASE_URL, ZAPIER_CREDENTIALS_CLIENT_ID, ZAPIER_CREDENTIALS_CLIENT_SECRET, ZAPIER_CREDENTIALS_SCOPE, ZAPIER_TOKEN, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, ZapierNotFoundError, ZapierResourceNotFoundError, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, authenticationIdGenericResolver, authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, createBaseEvent, createClientCredentialsPlugin, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, fetchPlugin, findFirstAuthenticationPlugin, findManifestEntry, findUniqueAuthenticationPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getAuthenticationPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTokenFromCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listAuthenticationsPlugin, listClientCredentialsPlugin, listInputFieldsPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, toSnakeCase, toTitleCase };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EAEZ,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGlE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EAEZ,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGlE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,CAAC;CACnB;AA4JD,eAAO,MAAM,UAAU,EAAE,MAAM,CAC7B,UAAU,CAAC,mBAAmB,GAAG,uBAAuB,CAAC,EAAE,oCAAoC;AAC/F,EAAE,EAAE,0BAA0B;AAC9B,kBAAkB,CAyBnB,CAAC;AAGF,YAAY,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACxD,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAI7D,MAAM,WAAW,aAAa;CAAG"}
|
|
@@ -4,7 +4,7 @@ import { ActionResultItemSchema } from "../../schemas/Run";
|
|
|
4
4
|
function createActionFunction(appKey, actionType, actionKey, options, pinnedAuthId) {
|
|
5
5
|
return (actionOptions = {}) => {
|
|
6
6
|
const { sdk } = options;
|
|
7
|
-
const { inputs, authenticationId: providedAuthenticationId } = actionOptions;
|
|
7
|
+
const { inputs, authenticationId: providedAuthenticationId, timeoutMs, } = actionOptions;
|
|
8
8
|
// Use pinned auth ID first, then provided auth ID
|
|
9
9
|
const authenticationId = pinnedAuthId ?? providedAuthenticationId;
|
|
10
10
|
if (!authenticationId) {
|
|
@@ -17,6 +17,7 @@ function createActionFunction(appKey, actionType, actionKey, options, pinnedAuth
|
|
|
17
17
|
actionKey,
|
|
18
18
|
inputs,
|
|
19
19
|
authenticationId,
|
|
20
|
+
timeoutMs,
|
|
20
21
|
});
|
|
21
22
|
};
|
|
22
23
|
}
|
|
@@ -3,6 +3,7 @@ import { type AuthenticationIdProperty } from "../../types/properties";
|
|
|
3
3
|
export declare const ActionExecutionInputSchema: z.ZodObject<{
|
|
4
4
|
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5
5
|
authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
6
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
6
7
|
}, z.core.$strip>;
|
|
7
8
|
export type ActionExecutionOptions = z.infer<typeof ActionExecutionInputSchema>;
|
|
8
9
|
export declare const AppFactoryInputSchema: z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,0BAA0B;;;;iBAQpC,CAAC;AAGJ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEhF,eAAO,MAAM,qBAAqB;;iBAIgB,CAAC;AAEnD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,UAAU,mBAAmB;IAC3B,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC;QAC9D,IAAI,EAAE,GAAG,EAAE,CAAC;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACpD,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;KAC7B,CAAC;CACL;AAGD,UAAU,eAAe;IACvB,KAAK,EAAE,CACL,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,CAAC,EAAE,WAAW,GAAG;QACnB,gBAAgB,CAAC,EAAE,wBAAwB,CAAC;QAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,sBAAsB,CAAC,EAAE,MAAM,CAAC;KACjC,KACE,OAAO,CAAC,QAAQ,CAAC,CAAC;CACxB;AAGD,KAAK,eAAe,GAAG,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAEtE,UAAU,QAAQ;IAChB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;CACjC;AAED,UAAU,UAAU;IAClB,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAAC;CACtC;AAGD,KAAK,mBAAmB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEjD,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAAC;CACpC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { AuthenticationIdPropertySchema, } from "../../types/properties";
|
|
2
|
+
import { AuthenticationIdPropertySchema, ActionTimeoutMsPropertySchema, } from "../../types/properties";
|
|
3
3
|
export const ActionExecutionInputSchema = z
|
|
4
4
|
.object({
|
|
5
5
|
inputs: z.record(z.string(), z.unknown()).optional(),
|
|
6
6
|
authenticationId: AuthenticationIdPropertySchema.optional(),
|
|
7
|
+
timeoutMs: ActionTimeoutMsPropertySchema,
|
|
7
8
|
})
|
|
8
9
|
.describe("Execute an action with the given inputs for the bound app, as an alternative to runAction");
|
|
9
10
|
export const AppFactoryInputSchema = z
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Plugin
|
|
2
|
-
import type {
|
|
1
|
+
import type { Plugin } from "../../types/plugin";
|
|
2
|
+
import type { ApiClient } from "../../api";
|
|
3
3
|
import type { z } from "zod";
|
|
4
4
|
import type { EventEmissionContext } from "../eventEmission";
|
|
5
5
|
export interface FetchPluginProvides {
|
|
@@ -7,10 +7,14 @@ export interface FetchPluginProvides {
|
|
|
7
7
|
authenticationId?: string | number;
|
|
8
8
|
callbackUrl?: string;
|
|
9
9
|
authenticationTemplate?: string;
|
|
10
|
+
_telemetry?: {
|
|
11
|
+
isNested?: boolean;
|
|
12
|
+
};
|
|
10
13
|
}) => Promise<Response>;
|
|
11
14
|
context: {
|
|
12
15
|
meta: {
|
|
13
16
|
fetch: {
|
|
17
|
+
description: string;
|
|
14
18
|
packages: string[];
|
|
15
19
|
categories: string[];
|
|
16
20
|
returnType: string;
|
|
@@ -23,10 +27,14 @@ export interface FetchPluginProvides {
|
|
|
23
27
|
};
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
26
|
-
*
|
|
30
|
+
* Fetch plugin — the primary way to make authenticated HTTP requests through Zapier's Relay service.
|
|
31
|
+
* Mirrors the native fetch(url, init?) signature with additional Zapier-specific options.
|
|
27
32
|
*/
|
|
28
|
-
export declare const fetchPlugin: Plugin<
|
|
29
|
-
|
|
33
|
+
export declare const fetchPlugin: Plugin<{}, // no SDK dependencies
|
|
34
|
+
// no SDK dependencies
|
|
35
|
+
{
|
|
36
|
+
api: ApiClient;
|
|
37
|
+
} & EventEmissionContext, // requires api + eventEmission in context
|
|
30
38
|
FetchPluginProvides>;
|
|
31
39
|
export type ZapierFetchInitOptions = RequestInit & {
|
|
32
40
|
authenticationId?: string | number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAoC7D,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,CACL,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,CAAC,EAAE,WAAW,GAAG;QACnB,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACnC,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,sBAAsB,CAAC,EAAE,MAAM,CAAC;QAChC,UAAU,CAAC,EAAE;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;KACrC,KACE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvB,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,KAAK,EAAE;gBACL,WAAW,EAAE,MAAM,CAAC;gBACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;gBACnB,UAAU,EAAE,MAAM,EAAE,CAAC;gBACrB,UAAU,EAAE,MAAM,CAAC;gBACnB,eAAe,EAAE,KAAK,CAAC;oBAAE,IAAI,EAAE,MAAM,CAAC;oBAAC,MAAM,EAAE,CAAC,CAAC,SAAS,CAAA;iBAAE,CAAC,CAAC;aAC/D,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAC9B,EAAE,EAAE,sBAAsB;AAC1B,AADI,sBAAsB;AAC1B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EAAE,0CAA0C;AACrF,mBAAmB,CAsHpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,WAAW,GAAG;IACjD,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC"}
|