@zapier/zapier-sdk 0.25.3 → 0.26.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 +6 -0
- package/README.md +9 -10
- package/dist/index.cjs +4 -28
- package/dist/index.d.mts +0 -5
- package/dist/index.mjs +4 -28
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/apps/schemas.d.ts +0 -1
- package/dist/plugins/apps/schemas.d.ts.map +1 -1
- package/dist/plugins/fetch/index.d.ts +0 -2
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/index.js +1 -4
- package/dist/plugins/fetch/index.test.js +0 -2
- package/dist/plugins/fetch/schemas.d.ts +0 -1
- package/dist/plugins/fetch/schemas.d.ts.map +1 -1
- package/dist/plugins/fetch/schemas.js +0 -4
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +1 -2
- package/dist/plugins/request/index.test.js +0 -5
- 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 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -877,16 +877,15 @@ Make authenticated HTTP requests to any API through Zapier's Relay service. Pass
|
|
|
877
877
|
|
|
878
878
|
**Parameters:**
|
|
879
879
|
|
|
880
|
-
| Name
|
|
881
|
-
|
|
|
882
|
-
| `url`
|
|
883
|
-
| `init`
|
|
884
|
-
| ↳ `method`
|
|
885
|
-
| ↳ `headers`
|
|
886
|
-
| ↳ `body`
|
|
887
|
-
| ↳ `authenticationId`
|
|
888
|
-
| ↳ `callbackUrl`
|
|
889
|
-
| ↳ `authenticationTemplate` | `string` | ❌ | — | — | Optional JSON string authentication template to bypass Notary lookup |
|
|
880
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
881
|
+
| -------------------- | -------------------------------- | -------- | ------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
|
882
|
+
| `url` | `string, custom` | ✅ | — | — | The full URL of the API endpoint to call (proxied through Zapier's Relay service) |
|
|
883
|
+
| `init` | `object` | ❌ | — | — | Request options including method, headers, body, and authentication |
|
|
884
|
+
| ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method for the request (defaults to GET) |
|
|
885
|
+
| ↳ `headers` | `object` | ❌ | — | — | HTTP headers to include in the request |
|
|
886
|
+
| ↳ `body` | `string, custom, custom, record` | ❌ | — | — | Request body — plain objects and JSON strings are auto-detected and Content-Type is set accordingly |
|
|
887
|
+
| ↳ `authenticationId` | `string, number` | ❌ | — | — | Authentication ID to use for this action |
|
|
888
|
+
| ↳ `callbackUrl` | `string` | ❌ | — | — | URL to send async response to (makes request async) |
|
|
890
889
|
|
|
891
890
|
**Returns:** `Promise<Response>`
|
|
892
891
|
|
package/dist/index.cjs
CHANGED
|
@@ -409,10 +409,7 @@ var FetchInitSchema = zod.z.object({
|
|
|
409
409
|
"Request body \u2014 plain objects and JSON strings are auto-detected and Content-Type is set accordingly"
|
|
410
410
|
),
|
|
411
411
|
authenticationId: AuthenticationIdPropertySchema.optional(),
|
|
412
|
-
callbackUrl: zod.z.string().optional().describe("URL to send async response to (makes request async)")
|
|
413
|
-
authenticationTemplate: zod.z.string().optional().describe(
|
|
414
|
-
"Optional JSON string authentication template to bypass Notary lookup"
|
|
415
|
-
)
|
|
412
|
+
callbackUrl: zod.z.string().optional().describe("URL to send async response to (makes request async)")
|
|
416
413
|
}).optional().describe(
|
|
417
414
|
"Request options including method, headers, body, and authentication"
|
|
418
415
|
);
|
|
@@ -482,13 +479,7 @@ var fetchPlugin = ({ context }) => {
|
|
|
482
479
|
const startTime = Date.now();
|
|
483
480
|
const isNested = init?._telemetry?.isNested === true;
|
|
484
481
|
try {
|
|
485
|
-
const {
|
|
486
|
-
authenticationId,
|
|
487
|
-
callbackUrl,
|
|
488
|
-
authenticationTemplate,
|
|
489
|
-
_telemetry,
|
|
490
|
-
...fetchInit
|
|
491
|
-
} = init || {};
|
|
482
|
+
const { authenticationId, callbackUrl, _telemetry, ...fetchInit } = init || {};
|
|
492
483
|
const relayPath = transformUrlToRelayPath(url);
|
|
493
484
|
const headers = normalizeHeaders(
|
|
494
485
|
fetchInit.headers
|
|
@@ -513,9 +504,6 @@ var fetchPlugin = ({ context }) => {
|
|
|
513
504
|
if (callbackUrl) {
|
|
514
505
|
headers["X-Relay-Callback-Url"] = callbackUrl;
|
|
515
506
|
}
|
|
516
|
-
if (authenticationTemplate) {
|
|
517
|
-
headers["X-Authentication-Template"] = authenticationTemplate;
|
|
518
|
-
}
|
|
519
507
|
const result = await api.fetch(relayPath, {
|
|
520
508
|
method: fetchInit.method ?? "GET",
|
|
521
509
|
body: fetchInit.body,
|
|
@@ -2912,9 +2900,6 @@ var RelayRequestSchema = zod.z.object({
|
|
|
2912
2900
|
body: zod.z.any().optional().describe("Request body as a string"),
|
|
2913
2901
|
authenticationId: AuthenticationIdPropertySchema.optional(),
|
|
2914
2902
|
callbackUrl: zod.z.string().url().optional().describe("URL to send async response to (makes request async)"),
|
|
2915
|
-
authenticationTemplate: zod.z.string().optional().describe(
|
|
2916
|
-
"Optional JSON string authentication template to bypass Notary lookup"
|
|
2917
|
-
),
|
|
2918
2903
|
headers: zod.z.union([
|
|
2919
2904
|
zod.z.record(zod.z.string(), zod.z.string()),
|
|
2920
2905
|
zod.z.instanceof(Headers),
|
|
@@ -2938,22 +2923,13 @@ function resetDeprecationWarnings() {
|
|
|
2938
2923
|
var requestPlugin = ({ sdk, context }) => {
|
|
2939
2924
|
async function request(options) {
|
|
2940
2925
|
logDeprecation("request() is deprecated. Use fetch() instead.");
|
|
2941
|
-
const {
|
|
2942
|
-
url,
|
|
2943
|
-
method,
|
|
2944
|
-
body,
|
|
2945
|
-
headers,
|
|
2946
|
-
authenticationId,
|
|
2947
|
-
callbackUrl,
|
|
2948
|
-
authenticationTemplate
|
|
2949
|
-
} = options;
|
|
2926
|
+
const { url, method, body, headers, authenticationId, callbackUrl } = options;
|
|
2950
2927
|
return sdk.fetch(url, {
|
|
2951
2928
|
method,
|
|
2952
2929
|
body,
|
|
2953
2930
|
headers,
|
|
2954
2931
|
authenticationId,
|
|
2955
2932
|
callbackUrl,
|
|
2956
|
-
authenticationTemplate,
|
|
2957
2933
|
_telemetry: { isNested: true }
|
|
2958
2934
|
});
|
|
2959
2935
|
}
|
|
@@ -5155,7 +5131,7 @@ function getCpuTime() {
|
|
|
5155
5131
|
|
|
5156
5132
|
// package.json
|
|
5157
5133
|
var package_default = {
|
|
5158
|
-
version: "0.
|
|
5134
|
+
version: "0.26.0"};
|
|
5159
5135
|
|
|
5160
5136
|
// src/plugins/eventEmission/builders.ts
|
|
5161
5137
|
function createBaseEvent(context = {}) {
|
package/dist/index.d.mts
CHANGED
|
@@ -1132,7 +1132,6 @@ declare const RelayRequestSchema: z.ZodObject<{
|
|
|
1132
1132
|
body: z.ZodOptional<z.ZodAny>;
|
|
1133
1133
|
authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
1134
1134
|
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
1135
|
-
authenticationTemplate: z.ZodOptional<z.ZodString>;
|
|
1136
1135
|
headers: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodCustom<Headers, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>]>>;
|
|
1137
1136
|
_telemetry: z.ZodOptional<z.ZodObject<{
|
|
1138
1137
|
isNested: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1153,7 +1152,6 @@ declare const RelayFetchSchema: z.ZodObject<{
|
|
|
1153
1152
|
body: z.ZodOptional<z.ZodAny>;
|
|
1154
1153
|
authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
1155
1154
|
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
1156
|
-
authenticationTemplate: z.ZodOptional<z.ZodString>;
|
|
1157
1155
|
headers: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodCustom<Headers, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>]>>;
|
|
1158
1156
|
_telemetry: z.ZodOptional<z.ZodObject<{
|
|
1159
1157
|
isNested: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1268,7 +1266,6 @@ interface FetchActionType {
|
|
|
1268
1266
|
fetch: (url: string | URL, init?: RequestInit & {
|
|
1269
1267
|
authenticationId?: AuthenticationIdProperty;
|
|
1270
1268
|
callbackUrl?: string;
|
|
1271
|
-
authenticationTemplate?: string;
|
|
1272
1269
|
}) => Promise<Response>;
|
|
1273
1270
|
}
|
|
1274
1271
|
type ActionTypeProxy = BaseActionTypeProxy & Partial<FetchActionType>;
|
|
@@ -1287,7 +1284,6 @@ interface FetchPluginProvides {
|
|
|
1287
1284
|
fetch: (url: string | URL, init?: RequestInit & {
|
|
1288
1285
|
authenticationId?: string | number;
|
|
1289
1286
|
callbackUrl?: string;
|
|
1290
|
-
authenticationTemplate?: string;
|
|
1291
1287
|
_telemetry?: {
|
|
1292
1288
|
isNested?: boolean;
|
|
1293
1289
|
};
|
|
@@ -1320,7 +1316,6 @@ FetchPluginProvides>;
|
|
|
1320
1316
|
type ZapierFetchInitOptions = RequestInit & {
|
|
1321
1317
|
authenticationId?: string | number;
|
|
1322
1318
|
callbackUrl?: string;
|
|
1323
|
-
authenticationTemplate?: string;
|
|
1324
1319
|
};
|
|
1325
1320
|
|
|
1326
1321
|
declare const RunActionSchema: z.ZodObject<{
|
package/dist/index.mjs
CHANGED
|
@@ -387,10 +387,7 @@ var FetchInitSchema = z.object({
|
|
|
387
387
|
"Request body \u2014 plain objects and JSON strings are auto-detected and Content-Type is set accordingly"
|
|
388
388
|
),
|
|
389
389
|
authenticationId: AuthenticationIdPropertySchema.optional(),
|
|
390
|
-
callbackUrl: z.string().optional().describe("URL to send async response to (makes request async)")
|
|
391
|
-
authenticationTemplate: z.string().optional().describe(
|
|
392
|
-
"Optional JSON string authentication template to bypass Notary lookup"
|
|
393
|
-
)
|
|
390
|
+
callbackUrl: z.string().optional().describe("URL to send async response to (makes request async)")
|
|
394
391
|
}).optional().describe(
|
|
395
392
|
"Request options including method, headers, body, and authentication"
|
|
396
393
|
);
|
|
@@ -460,13 +457,7 @@ var fetchPlugin = ({ context }) => {
|
|
|
460
457
|
const startTime = Date.now();
|
|
461
458
|
const isNested = init?._telemetry?.isNested === true;
|
|
462
459
|
try {
|
|
463
|
-
const {
|
|
464
|
-
authenticationId,
|
|
465
|
-
callbackUrl,
|
|
466
|
-
authenticationTemplate,
|
|
467
|
-
_telemetry,
|
|
468
|
-
...fetchInit
|
|
469
|
-
} = init || {};
|
|
460
|
+
const { authenticationId, callbackUrl, _telemetry, ...fetchInit } = init || {};
|
|
470
461
|
const relayPath = transformUrlToRelayPath(url);
|
|
471
462
|
const headers = normalizeHeaders(
|
|
472
463
|
fetchInit.headers
|
|
@@ -491,9 +482,6 @@ var fetchPlugin = ({ context }) => {
|
|
|
491
482
|
if (callbackUrl) {
|
|
492
483
|
headers["X-Relay-Callback-Url"] = callbackUrl;
|
|
493
484
|
}
|
|
494
|
-
if (authenticationTemplate) {
|
|
495
|
-
headers["X-Authentication-Template"] = authenticationTemplate;
|
|
496
|
-
}
|
|
497
485
|
const result = await api.fetch(relayPath, {
|
|
498
486
|
method: fetchInit.method ?? "GET",
|
|
499
487
|
body: fetchInit.body,
|
|
@@ -2890,9 +2878,6 @@ var RelayRequestSchema = z.object({
|
|
|
2890
2878
|
body: z.any().optional().describe("Request body as a string"),
|
|
2891
2879
|
authenticationId: AuthenticationIdPropertySchema.optional(),
|
|
2892
2880
|
callbackUrl: z.string().url().optional().describe("URL to send async response to (makes request async)"),
|
|
2893
|
-
authenticationTemplate: z.string().optional().describe(
|
|
2894
|
-
"Optional JSON string authentication template to bypass Notary lookup"
|
|
2895
|
-
),
|
|
2896
2881
|
headers: z.union([
|
|
2897
2882
|
z.record(z.string(), z.string()),
|
|
2898
2883
|
z.instanceof(Headers),
|
|
@@ -2916,22 +2901,13 @@ function resetDeprecationWarnings() {
|
|
|
2916
2901
|
var requestPlugin = ({ sdk, context }) => {
|
|
2917
2902
|
async function request(options) {
|
|
2918
2903
|
logDeprecation("request() is deprecated. Use fetch() instead.");
|
|
2919
|
-
const {
|
|
2920
|
-
url,
|
|
2921
|
-
method,
|
|
2922
|
-
body,
|
|
2923
|
-
headers,
|
|
2924
|
-
authenticationId,
|
|
2925
|
-
callbackUrl,
|
|
2926
|
-
authenticationTemplate
|
|
2927
|
-
} = options;
|
|
2904
|
+
const { url, method, body, headers, authenticationId, callbackUrl } = options;
|
|
2928
2905
|
return sdk.fetch(url, {
|
|
2929
2906
|
method,
|
|
2930
2907
|
body,
|
|
2931
2908
|
headers,
|
|
2932
2909
|
authenticationId,
|
|
2933
2910
|
callbackUrl,
|
|
2934
|
-
authenticationTemplate,
|
|
2935
2911
|
_telemetry: { isNested: true }
|
|
2936
2912
|
});
|
|
2937
2913
|
}
|
|
@@ -5133,7 +5109,7 @@ function getCpuTime() {
|
|
|
5133
5109
|
|
|
5134
5110
|
// package.json
|
|
5135
5111
|
var package_default = {
|
|
5136
|
-
version: "0.
|
|
5112
|
+
version: "0.26.0"};
|
|
5137
5113
|
|
|
5138
5114
|
// src/plugins/eventEmission/builders.ts
|
|
5139
5115
|
function createBaseEvent(context = {}) {
|
|
@@ -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;AA2JD,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"}
|
|
@@ -25,7 +25,6 @@ interface FetchActionType {
|
|
|
25
25
|
fetch: (url: string | URL, init?: RequestInit & {
|
|
26
26
|
authenticationId?: AuthenticationIdProperty;
|
|
27
27
|
callbackUrl?: string;
|
|
28
|
-
authenticationTemplate?: string;
|
|
29
28
|
}) => Promise<Response>;
|
|
30
29
|
}
|
|
31
30
|
type ActionTypeProxy = BaseActionTypeProxy & Partial<FetchActionType>;
|
|
@@ -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,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;
|
|
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;KACtB,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"}
|
|
@@ -6,7 +6,6 @@ export interface FetchPluginProvides {
|
|
|
6
6
|
fetch: (url: string | URL, init?: RequestInit & {
|
|
7
7
|
authenticationId?: string | number;
|
|
8
8
|
callbackUrl?: string;
|
|
9
|
-
authenticationTemplate?: string;
|
|
10
9
|
_telemetry?: {
|
|
11
10
|
isNested?: boolean;
|
|
12
11
|
};
|
|
@@ -39,6 +38,5 @@ FetchPluginProvides>;
|
|
|
39
38
|
export type ZapierFetchInitOptions = RequestInit & {
|
|
40
39
|
authenticationId?: string | number;
|
|
41
40
|
callbackUrl?: string;
|
|
42
|
-
authenticationTemplate?: string;
|
|
43
41
|
};
|
|
44
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;AA6D7D,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,
|
|
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;AA6D7D,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,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,CAyGpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,WAAW,GAAG;IACjD,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -59,7 +59,7 @@ export const fetchPlugin = ({ context }) => {
|
|
|
59
59
|
const startTime = Date.now();
|
|
60
60
|
const isNested = init?._telemetry?.isNested === true;
|
|
61
61
|
try {
|
|
62
|
-
const { authenticationId, callbackUrl,
|
|
62
|
+
const { authenticationId, callbackUrl, _telemetry, ...fetchInit } = init || {};
|
|
63
63
|
const relayPath = transformUrlToRelayPath(url);
|
|
64
64
|
const headers = normalizeHeaders(fetchInit.headers);
|
|
65
65
|
const hasContentType = Object.keys(headers).some((k) => k.toLowerCase() === "content-type");
|
|
@@ -75,9 +75,6 @@ export const fetchPlugin = ({ context }) => {
|
|
|
75
75
|
if (callbackUrl) {
|
|
76
76
|
headers["X-Relay-Callback-Url"] = callbackUrl;
|
|
77
77
|
}
|
|
78
|
-
if (authenticationTemplate) {
|
|
79
|
-
headers["X-Authentication-Template"] = authenticationTemplate;
|
|
80
|
-
}
|
|
81
78
|
const result = await api.fetch(relayPath, {
|
|
82
79
|
method: fetchInit.method ?? "GET",
|
|
83
80
|
body: fetchInit.body,
|
|
@@ -80,7 +80,6 @@ describe("fetch plugin", () => {
|
|
|
80
80
|
method: "POST",
|
|
81
81
|
authenticationId: 123,
|
|
82
82
|
callbackUrl: "https://webhook.example.com/callback",
|
|
83
|
-
authenticationTemplate: '{"token": "{{auth.token}}"}',
|
|
84
83
|
});
|
|
85
84
|
expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/data", {
|
|
86
85
|
method: "POST",
|
|
@@ -88,7 +87,6 @@ describe("fetch plugin", () => {
|
|
|
88
87
|
headers: {
|
|
89
88
|
"X-Relay-Authentication-Id": "123",
|
|
90
89
|
"X-Relay-Callback-Url": "https://webhook.example.com/callback",
|
|
91
|
-
"X-Authentication-Template": '{"token": "{{auth.token}}"}',
|
|
92
90
|
},
|
|
93
91
|
authRequired: true,
|
|
94
92
|
});
|
|
@@ -14,6 +14,5 @@ export declare const FetchInitSchema: z.ZodOptional<z.ZodObject<{
|
|
|
14
14
|
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<FormData, FormData>, z.ZodCustom<URLSearchParams, URLSearchParams>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
15
15
|
authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
16
16
|
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
17
|
-
authenticationTemplate: z.ZodOptional<z.ZodString>;
|
|
18
17
|
}, z.core.$strip>>;
|
|
19
18
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,cAAc,2DAIxB,CAAC;AAEJ,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,cAAc,2DAIxB,CAAC;AAEJ,eAAO,MAAM,eAAe;;;;;;;;;;;;;;kBA8BzB,CAAC"}
|
|
@@ -28,10 +28,6 @@ export const FetchInitSchema = z
|
|
|
28
28
|
.string()
|
|
29
29
|
.optional()
|
|
30
30
|
.describe("URL to send async response to (makes request async)"),
|
|
31
|
-
authenticationTemplate: z
|
|
32
|
-
.string()
|
|
33
|
-
.optional()
|
|
34
|
-
.describe("Optional JSON string authentication template to bypass Notary lookup"),
|
|
35
31
|
})
|
|
36
32
|
.optional()
|
|
37
33
|
.describe("Request options including method, headers, body, and authentication");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/request/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGpD,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7D,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,OAAO,EAAE;gBACP,WAAW,EAAE,OAAO,kBAAkB,CAAC;aACxC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAChC,UAAU,CAAC,mBAAmB,CAAC,EAAE,wBAAwB;AACzD,oBAAoB,EAAE,+CAA+C;AACrE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/request/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGpD,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7D,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,OAAO,EAAE;gBACP,WAAW,EAAE,OAAO,kBAAkB,CAAC;aACxC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAChC,UAAU,CAAC,mBAAmB,CAAC,EAAE,wBAAwB;AACzD,oBAAoB,EAAE,+CAA+C;AACrE,qBAAqB,CAwCtB,CAAC"}
|
|
@@ -9,14 +9,13 @@ import { logDeprecation } from "../../utils/logging";
|
|
|
9
9
|
export const requestPlugin = ({ sdk, context }) => {
|
|
10
10
|
async function request(options) {
|
|
11
11
|
logDeprecation("request() is deprecated. Use fetch() instead.");
|
|
12
|
-
const { url, method, body, headers, authenticationId, callbackUrl
|
|
12
|
+
const { url, method, body, headers, authenticationId, callbackUrl } = options;
|
|
13
13
|
return sdk.fetch(url, {
|
|
14
14
|
method,
|
|
15
15
|
body: body,
|
|
16
16
|
headers: headers,
|
|
17
17
|
authenticationId,
|
|
18
18
|
callbackUrl,
|
|
19
|
-
authenticationTemplate,
|
|
20
19
|
_telemetry: { isNested: true },
|
|
21
20
|
});
|
|
22
21
|
}
|
|
@@ -79,7 +79,6 @@ describe("request plugin", () => {
|
|
|
79
79
|
headers: { "Content-Type": "application/json" },
|
|
80
80
|
authenticationId: 123,
|
|
81
81
|
callbackUrl: "https://webhook.example.com/callback",
|
|
82
|
-
authenticationTemplate: '{"token": "{{auth.token}}"}',
|
|
83
82
|
});
|
|
84
83
|
expect(mockFetch).toHaveBeenCalled();
|
|
85
84
|
});
|
|
@@ -139,7 +138,6 @@ describe("request plugin", () => {
|
|
|
139
138
|
method: "POST",
|
|
140
139
|
authenticationId: 123,
|
|
141
140
|
callbackUrl: "https://webhook.example.com/callback",
|
|
142
|
-
authenticationTemplate: '{"token": "{{auth.token}}"}',
|
|
143
141
|
});
|
|
144
142
|
expect(mockFetch).toHaveBeenCalledWith("/relay/api.example.com/data", {
|
|
145
143
|
method: "POST",
|
|
@@ -147,7 +145,6 @@ describe("request plugin", () => {
|
|
|
147
145
|
headers: {
|
|
148
146
|
"X-Relay-Authentication-Id": "123",
|
|
149
147
|
"X-Relay-Callback-Url": "https://webhook.example.com/callback",
|
|
150
|
-
"X-Authentication-Template": '{"token": "{{auth.token}}"}',
|
|
151
148
|
},
|
|
152
149
|
authRequired: true,
|
|
153
150
|
});
|
|
@@ -411,7 +408,6 @@ describe("request plugin", () => {
|
|
|
411
408
|
headers: { "X-Custom": "header" },
|
|
412
409
|
authenticationId: 456,
|
|
413
410
|
callbackUrl: "https://callback.example.com/hook",
|
|
414
|
-
authenticationTemplate: '{"tok": "{{auth.tok}}"}',
|
|
415
411
|
});
|
|
416
412
|
const requestCall = mockFetch.mock.calls[0];
|
|
417
413
|
mockFetch.mockClear();
|
|
@@ -421,7 +417,6 @@ describe("request plugin", () => {
|
|
|
421
417
|
headers: { "X-Custom": "header" },
|
|
422
418
|
authenticationId: 456,
|
|
423
419
|
callbackUrl: "https://callback.example.com/hook",
|
|
424
|
-
authenticationTemplate: '{"tok": "{{auth.tok}}"}',
|
|
425
420
|
});
|
|
426
421
|
const fetchCall = mockFetch.mock.calls[0];
|
|
427
422
|
expect(requestCall).toEqual(fetchCall);
|
|
@@ -14,7 +14,6 @@ export declare const RelayRequestSchema: z.ZodObject<{
|
|
|
14
14
|
body: z.ZodOptional<z.ZodAny>;
|
|
15
15
|
authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
16
16
|
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
17
|
-
authenticationTemplate: z.ZodOptional<z.ZodString>;
|
|
18
17
|
headers: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodCustom<Headers, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>]>>;
|
|
19
18
|
_telemetry: z.ZodOptional<z.ZodObject<{
|
|
20
19
|
isNested: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -39,7 +38,6 @@ export declare const RelayFetchSchema: z.ZodObject<{
|
|
|
39
38
|
body: z.ZodOptional<z.ZodAny>;
|
|
40
39
|
authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
41
40
|
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
42
|
-
authenticationTemplate: z.ZodOptional<z.ZodString>;
|
|
43
41
|
headers: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodCustom<Headers, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>]>>;
|
|
44
42
|
_telemetry: z.ZodOptional<z.ZodObject<{
|
|
45
43
|
isNested: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/request/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAK5B,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/request/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAK5B,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;iBA2B+C,CAAC;AAG/E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAGrE,MAAM,MAAM,iBAAiB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9D;AAGD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;iBAAqB,CAAC;AACnD,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AACpD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC1D"}
|
|
@@ -19,10 +19,6 @@ export const RelayRequestSchema = z
|
|
|
19
19
|
.url()
|
|
20
20
|
.optional()
|
|
21
21
|
.describe("URL to send async response to (makes request async)"),
|
|
22
|
-
authenticationTemplate: z
|
|
23
|
-
.string()
|
|
24
|
-
.optional()
|
|
25
|
-
.describe("Optional JSON string authentication template to bypass Notary lookup"),
|
|
26
22
|
headers: z
|
|
27
23
|
.union([
|
|
28
24
|
z.record(z.string(), z.string()),
|