@powerhousedao/pieces-framework 6.2.3-dev.24 → 6.2.3-dev.26
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/UPSTREAM.md +5 -5
- package/dist/{action--RmO83_Y.d.ts → action-BOq8m66H.d.ts} +6116 -6119
- package/dist/{action--RmO83_Y.d.ts.map → action-BOq8m66H.d.ts.map} +1 -1
- package/dist/{authentication-B7brX_It.js → authentication-o-4CdAPR.js} +20 -20
- package/dist/{authentication-B7brX_It.js.map → authentication-o-4CdAPR.js.map} +1 -1
- package/dist/common.d.ts +41 -77
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +64 -66
- package/dist/common.js.map +1 -1
- package/dist/host.d.ts +20 -23
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +32 -27
- package/dist/host.js.map +1 -1
- package/dist/{index-BW6GxXEN.d.ts → index-Ceki0QqC.d.ts} +957 -968
- package/dist/index-Ceki0QqC.d.ts.map +1 -0
- package/dist/index.d.ts +176 -175
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +181 -155
- package/dist/index.js.map +1 -1
- package/dist/{input-COuhC1I-.js → input-BHkj_oP5.js} +45 -32
- package/dist/{input-COuhC1I-.js.map → input-BHkj_oP5.js.map} +1 -1
- package/dist/{markdown-property-Df2l6_y_.js → markdown-property-DMfHjEiL.js} +13 -10
- package/dist/{markdown-property-Df2l6_y_.js.map → markdown-property-DMfHjEiL.js.map} +1 -1
- package/package.json +3 -7
- package/dist/index-BW6GxXEN.d.ts.map +0 -1
package/dist/common.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","names":[],"sources":["../upstream/common/lib/authentication/index.ts","../upstream/common/lib/http/core/http-headers.ts","../upstream/common/lib/http/core/delegating-authentication-converter.ts","../upstream/common/lib/http/core/http-message-body.ts","../upstream/common/lib/http/core/http-method.ts","../upstream/common/lib/http/core/query-params.ts","../upstream/common/lib/http/core/http-request-body.ts","../upstream/common/lib/http/core/http-request.ts","../upstream/common/lib/http/core/http-response.ts","../upstream/common/lib/http/core/http-client.ts","../upstream/common/lib/http/core/base-http-client.ts","../upstream/common/lib/http/core/fetch-http-client.ts","../upstream/common/lib/http/core/http-error.ts","../upstream/common/lib/http/core/http-header.ts","../upstream/common/lib/http/core/media-type.ts","../upstream/common/lib/helpers/index.ts","../upstream/common/lib/polling/index.ts","../upstream/common/lib/stream/index.ts","../upstream/common/lib/validation/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.d.ts","names":[],"sources":["../upstream/common/lib/authentication/index.ts","../upstream/common/lib/http/core/http-headers.ts","../upstream/common/lib/http/core/delegating-authentication-converter.ts","../upstream/common/lib/http/core/http-message-body.ts","../upstream/common/lib/http/core/http-method.ts","../upstream/common/lib/http/core/query-params.ts","../upstream/common/lib/http/core/http-request-body.ts","../upstream/common/lib/http/core/http-request.ts","../upstream/common/lib/http/core/http-response.ts","../upstream/common/lib/http/core/http-client.ts","../upstream/common/lib/http/core/base-http-client.ts","../upstream/common/lib/http/core/fetch-http-client.ts","../upstream/common/lib/http/core/http-error.ts","../upstream/common/lib/http/core/http-header.ts","../upstream/common/lib/http/core/media-type.ts","../upstream/common/lib/helpers/index.ts","../upstream/common/lib/polling/index.ts","../upstream/common/lib/stream/index.ts","../upstream/common/lib/validation/index.ts"],"mappings":";;;;;YAEY,iBAAiB,4BAA4B;oBAE7C;EACV;EACA;;YAGU,mBAAmB,UAAU;EACvC,MAAM;;YAGI,4BACV,mBAAmB,mBAAmB;EACpC;;YAGQ,sBACV,mBAAmB,mBAAmB;EACpC;EACA;;;;KCnBQ,cAAc;;;qBCSb,6CAA6C,wBAAwB;mBAC/D;EAKjB,YACE,uBAAoB,oCACpB,sBAAmB;EAQrB,QAAQ,gBAAgB,gBAAgB,SAAS,cAAc;;cAM3D,8CAA8C,wBAAwB;EAC1E,QACE,gBAAgB,2BAChB,SAAS,cACR;;cAMC,6CAA6C,wBA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ClB,YAAU,SAED,QAAQ,WAAW,aAAW;IAC7B,OAAO;IAAO,MAAM;IAAW,YAAY;MACpD;EAOG,KACJ,kBAAkB,wCAClB,YAAU,SAED,QAAQ,WAAW,eAAW,MAAA,YAAA,OAAA,OAAA;IAQrC,OAAO;IACP,MAAM;IACN,YAAY;IACZ,OAAO;IACP,SAAS;MAEV;;;;iBC/MI,gBAAgB,MAAM,kBAAkB;EAC/C,MAAM;EACN;;iBAQc,aACd,UACA;EAEA,UAAU;EACV;IACE,eAAe;qBAuBN;qBAAA;0BAAA;;;;qBCxCA;EACL,YAAY,UAAU,yBAAuB,OAC1C,GAAC,QACA,QAAQ,aAAa,GAAG,EAAE,KAAK,aACtC"}
|
package/dist/common.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as Property, o as assertNotNullOrUndefined, y as createAction } from "./input-
|
|
2
|
-
import { c as isNil$1, r as tryCatchSync, s as isEmpty } from "./markdown-property-
|
|
1
|
+
import { n as Property, o as assertNotNullOrUndefined, y as createAction } from "./input-BHkj_oP5.js";
|
|
2
|
+
import { c as isNil$1, r as tryCatchSync, s as isEmpty } from "./markdown-property-DMfHjEiL.js";
|
|
3
3
|
import * as z from "zod/mini";
|
|
4
4
|
import { PassThrough, Readable } from "node:stream";
|
|
5
5
|
import fs from "node:fs";
|
|
@@ -33,6 +33,8 @@ let MediaType = /* @__PURE__ */ function(MediaType) {
|
|
|
33
33
|
//#endregion
|
|
34
34
|
//#region upstream/common/lib/http/core/base-http-client.ts
|
|
35
35
|
var BaseHttpClient = class {
|
|
36
|
+
baseUrl;
|
|
37
|
+
authenticationConverter;
|
|
36
38
|
constructor(baseUrl, authenticationConverter) {
|
|
37
39
|
this.baseUrl = baseUrl;
|
|
38
40
|
this.authenticationConverter = authenticationConverter;
|
|
@@ -50,15 +52,13 @@ var BaseHttpClient = class {
|
|
|
50
52
|
};
|
|
51
53
|
}
|
|
52
54
|
getHeaders(request) {
|
|
53
|
-
let requestHeaders = { [
|
|
55
|
+
let requestHeaders = { ["Accept"]: "application/json" };
|
|
54
56
|
if (request.authentication) this.populateAuthentication(request.authentication, requestHeaders);
|
|
55
57
|
if (request.body) switch (request.headers?.["Content-Type"]) {
|
|
56
58
|
case "text/csv":
|
|
57
|
-
requestHeaders[
|
|
58
|
-
break;
|
|
59
|
-
default:
|
|
60
|
-
requestHeaders[HttpHeader.CONTENT_TYPE] = MediaType.APPLICATION_JSON;
|
|
59
|
+
requestHeaders["Content-Type"] = "text/csv";
|
|
61
60
|
break;
|
|
61
|
+
default: requestHeaders["Content-Type"] = "application/json";
|
|
62
62
|
}
|
|
63
63
|
if (request.headers) requestHeaders = {
|
|
64
64
|
...requestHeaders,
|
|
@@ -77,8 +77,8 @@ var DelegatingAuthenticationConverter = class {
|
|
|
77
77
|
converters;
|
|
78
78
|
constructor(bearerTokenConverter = new BearerTokenAuthenticationConverter(), basicTokenConverter = new BasicTokenAuthenticationConverter()) {
|
|
79
79
|
this.converters = {
|
|
80
|
-
[
|
|
81
|
-
[
|
|
80
|
+
["BEARER_TOKEN"]: bearerTokenConverter,
|
|
81
|
+
["BASIC"]: basicTokenConverter
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
convert(authentication, headers) {
|
|
@@ -87,7 +87,7 @@ var DelegatingAuthenticationConverter = class {
|
|
|
87
87
|
};
|
|
88
88
|
var BearerTokenAuthenticationConverter = class {
|
|
89
89
|
convert(authentication, headers) {
|
|
90
|
-
headers[
|
|
90
|
+
headers["Authorization"] = `Bearer ${authentication.token}`;
|
|
91
91
|
return headers;
|
|
92
92
|
}
|
|
93
93
|
};
|
|
@@ -95,7 +95,7 @@ var BasicTokenAuthenticationConverter = class {
|
|
|
95
95
|
convert(authentication, headers) {
|
|
96
96
|
const credentials = `${authentication.username}:${authentication.password}`;
|
|
97
97
|
const encoded = Buffer.from(credentials).toString("base64");
|
|
98
|
-
headers[
|
|
98
|
+
headers["Authorization"] = `Basic ${encoded}`;
|
|
99
99
|
return headers;
|
|
100
100
|
}
|
|
101
101
|
};
|
|
@@ -103,6 +103,7 @@ var BasicTokenAuthenticationConverter = class {
|
|
|
103
103
|
//#endregion
|
|
104
104
|
//#region upstream/common/lib/http/core/http-error.ts
|
|
105
105
|
var HttpError = class extends Error {
|
|
106
|
+
requestBody;
|
|
106
107
|
status;
|
|
107
108
|
responseBody;
|
|
108
109
|
constructor(requestBody, params) {
|
|
@@ -221,7 +222,7 @@ var FetchHttpClient = class extends BaseHttpClient {
|
|
|
221
222
|
}
|
|
222
223
|
};
|
|
223
224
|
function acceptsRequestBody(method) {
|
|
224
|
-
return method !==
|
|
225
|
+
return method !== "GET" && method !== "HEAD";
|
|
225
226
|
}
|
|
226
227
|
function serializeBody(body, headers) {
|
|
227
228
|
if (isNil(body)) return {
|
|
@@ -332,7 +333,7 @@ function isNodeFormData(body) {
|
|
|
332
333
|
function isNil(value) {
|
|
333
334
|
return value === null || value === void 0;
|
|
334
335
|
}
|
|
335
|
-
const MAX_BUFFERED_FORM_DATA_BYTES =
|
|
336
|
+
const MAX_BUFFERED_FORM_DATA_BYTES = 104857600;
|
|
336
337
|
|
|
337
338
|
//#endregion
|
|
338
339
|
//#region upstream/common/lib/http/core/http-client.ts
|
|
@@ -392,7 +393,8 @@ const CONTENT_TYPE_EXTENSIONS = {
|
|
|
392
393
|
"font/otf": "otf"
|
|
393
394
|
};
|
|
394
395
|
function contentTypeToExtension(contentType) {
|
|
395
|
-
|
|
396
|
+
const type = contentType.split(";")[0].trim().toLowerCase();
|
|
397
|
+
return CONTENT_TYPE_EXTENSIONS[type] ?? "";
|
|
396
398
|
}
|
|
397
399
|
const getAccessTokenOrThrow = (auth) => {
|
|
398
400
|
const accessToken = auth?.access_token;
|
|
@@ -440,7 +442,7 @@ function createCustomApiCallAction({ auth, baseUrl, authMapping, description, di
|
|
|
440
442
|
method: Property.StaticDropdown({
|
|
441
443
|
displayName: "Method",
|
|
442
444
|
required: true,
|
|
443
|
-
defaultValue:
|
|
445
|
+
defaultValue: "GET",
|
|
444
446
|
options: { options: Object.values(HttpMethod).map((v) => {
|
|
445
447
|
return {
|
|
446
448
|
label: v,
|
|
@@ -520,40 +522,38 @@ function createCustomApiCallAction({ auth, baseUrl, authMapping, description, di
|
|
|
520
522
|
required: true
|
|
521
523
|
});
|
|
522
524
|
break;
|
|
523
|
-
case "form_data":
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
});
|
|
556
|
-
break;
|
|
525
|
+
case "form_data": fields["data"] = Property.Array({
|
|
526
|
+
displayName: "Form Data",
|
|
527
|
+
required: true,
|
|
528
|
+
properties: {
|
|
529
|
+
fieldName: Property.ShortText({
|
|
530
|
+
displayName: "Field Name",
|
|
531
|
+
required: true
|
|
532
|
+
}),
|
|
533
|
+
fieldType: Property.StaticDropdown({
|
|
534
|
+
displayName: "Field Type",
|
|
535
|
+
required: true,
|
|
536
|
+
options: {
|
|
537
|
+
disabled: false,
|
|
538
|
+
options: [{
|
|
539
|
+
label: "Text",
|
|
540
|
+
value: "text"
|
|
541
|
+
}, {
|
|
542
|
+
label: "File",
|
|
543
|
+
value: "file"
|
|
544
|
+
}]
|
|
545
|
+
}
|
|
546
|
+
}),
|
|
547
|
+
textFieldValue: Property.LongText({
|
|
548
|
+
displayName: "Text Field Value",
|
|
549
|
+
required: false
|
|
550
|
+
}),
|
|
551
|
+
fileFieldValue: Property.File({
|
|
552
|
+
displayName: "File Field Value",
|
|
553
|
+
required: false
|
|
554
|
+
})
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
557
|
}
|
|
558
558
|
return fields;
|
|
559
559
|
}
|
|
@@ -679,7 +679,7 @@ let DedupeStrategy = /* @__PURE__ */ function(DedupeStrategy) {
|
|
|
679
679
|
const pollingHelper = {
|
|
680
680
|
async poll(polling, { store, auth, propsValue, maxItemsToPoll, files, server }) {
|
|
681
681
|
switch (polling.strategy) {
|
|
682
|
-
case
|
|
682
|
+
case 0: {
|
|
683
683
|
const lastEpochMilliSeconds = await store.get("lastPoll");
|
|
684
684
|
if (isNil$1(lastEpochMilliSeconds)) throw new Error("lastPoll doesn't exist in the store.");
|
|
685
685
|
const items = await polling.items({
|
|
@@ -693,7 +693,7 @@ const pollingHelper = {
|
|
|
693
693
|
await store.put("lastPoll", newLastEpochMilliSeconds);
|
|
694
694
|
return items.filter((f) => f.epochMilliSeconds > lastEpochMilliSeconds).map((item) => item.data);
|
|
695
695
|
}
|
|
696
|
-
case
|
|
696
|
+
case 1: {
|
|
697
697
|
const lastItemId = await store.get("lastItem");
|
|
698
698
|
const items = await polling.items({
|
|
699
699
|
store,
|
|
@@ -716,11 +716,11 @@ const pollingHelper = {
|
|
|
716
716
|
},
|
|
717
717
|
async onEnable(polling, { store, auth, propsValue, server, isRepublish }) {
|
|
718
718
|
switch (polling.strategy) {
|
|
719
|
-
case
|
|
719
|
+
case 0:
|
|
720
720
|
if (isRepublish && !isNil$1(await store.get("lastPoll"))) break;
|
|
721
721
|
await store.put("lastPoll", Date.now());
|
|
722
722
|
break;
|
|
723
|
-
case
|
|
723
|
+
case 1: {
|
|
724
724
|
if (isRepublish && !isNil$1(await store.get("lastItem"))) break;
|
|
725
725
|
const lastItemId = (await polling.items({
|
|
726
726
|
store,
|
|
@@ -737,14 +737,14 @@ const pollingHelper = {
|
|
|
737
737
|
},
|
|
738
738
|
async onDisable(polling, params) {
|
|
739
739
|
switch (polling.strategy) {
|
|
740
|
-
case
|
|
741
|
-
case
|
|
740
|
+
case 0:
|
|
741
|
+
case 1: return;
|
|
742
742
|
}
|
|
743
743
|
},
|
|
744
744
|
async test(polling, { auth, propsValue, store, files, server }) {
|
|
745
745
|
let items = [];
|
|
746
746
|
switch (polling.strategy) {
|
|
747
|
-
case
|
|
747
|
+
case 0:
|
|
748
748
|
items = await polling.items({
|
|
749
749
|
store,
|
|
750
750
|
auth,
|
|
@@ -753,16 +753,14 @@ const pollingHelper = {
|
|
|
753
753
|
server
|
|
754
754
|
});
|
|
755
755
|
break;
|
|
756
|
-
case
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
});
|
|
765
|
-
break;
|
|
756
|
+
case 1: items = await polling.items({
|
|
757
|
+
store,
|
|
758
|
+
auth,
|
|
759
|
+
propsValue,
|
|
760
|
+
lastItemId: null,
|
|
761
|
+
files,
|
|
762
|
+
server
|
|
763
|
+
});
|
|
766
764
|
}
|
|
767
765
|
return getFirstFiveOrAll(items.map((item) => item.data));
|
|
768
766
|
}
|
package/dist/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","names":["isNil","FormData","isNil"],"sources":["../upstream/common/lib/authentication/index.ts","../upstream/common/lib/http/core/http-header.ts","../upstream/common/lib/http/core/media-type.ts","../upstream/common/lib/http/core/base-http-client.ts","../upstream/common/lib/http/core/delegating-authentication-converter.ts","../upstream/common/lib/http/core/http-error.ts","../upstream/common/lib/http/core/http-method.ts","../upstream/common/lib/http/core/fetch-http-client.ts","../upstream/common/lib/http/core/http-client.ts","../upstream/common/lib/helpers/index.ts","../upstream/common/lib/polling/index.ts","../upstream/common/lib/stream/index.ts","../upstream/common/lib/validation/index.ts"],"sourcesContent":["// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/authentication/index.ts. MIT; see ../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport type Authentication = BearerTokenAuthentication | BasicAuthentication;\n\nexport enum AuthenticationType {\n BEARER_TOKEN = \"BEARER_TOKEN\",\n BASIC = \"BASIC\",\n}\n\nexport type BaseAuthentication<T extends AuthenticationType> = {\n type: T;\n};\n\nexport type BearerTokenAuthentication =\n BaseAuthentication<AuthenticationType.BEARER_TOKEN> & {\n token: string;\n };\n\nexport type BasicAuthentication =\n BaseAuthentication<AuthenticationType.BASIC> & {\n username: string;\n password: string;\n };\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/http-header.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport enum HttpHeader {\n AUTHORIZATION = \"Authorization\",\n ACCEPT = \"Accept\",\n API_KEY = \"x-api-key\",\n CONTENT_TYPE = \"Content-Type\",\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/media-type.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport enum MediaType {\n APPLICATION_JSON = \"application/json\",\n TEXT_CSV = \"text/csv\",\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/base-http-client.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport type { Authentication } from \"../../authentication/index.js\";\nimport type { DelegatingAuthenticationConverter } from \"./delegating-authentication-converter.js\";\nimport type { HttpClient } from \"./http-client.js\";\nimport { HttpHeader } from \"./http-header.js\";\nimport type { HttpHeaders } from \"./http-headers.js\";\nimport type { HttpMessageBody } from \"./http-message-body.js\";\nimport type { HttpRequest } from \"./http-request.js\";\nimport type { HttpRequestBody } from \"./http-request-body.js\";\nimport type { HttpResponse } from \"./http-response.js\";\nimport { MediaType } from \"./media-type.js\";\n\nexport abstract class BaseHttpClient implements HttpClient {\n constructor(\n private readonly baseUrl: string,\n private readonly authenticationConverter: DelegatingAuthenticationConverter,\n ) {}\n\n abstract sendRequest<\n RequestBody extends HttpMessageBody,\n ResponseBody extends HttpMessageBody,\n >(request: HttpRequest<RequestBody>): Promise<HttpResponse<ResponseBody>>;\n\n protected getUrl<RequestBody extends HttpMessageBody>(\n request: HttpRequest<RequestBody>,\n ): {\n urlWithoutQueryParams: string;\n queryParams: URLSearchParams;\n } {\n const url = new URL(`${this.baseUrl}${request.url}`);\n const urlWithoutQueryParams = `${url.origin}${url.pathname}`;\n const queryParams = new URLSearchParams();\n // Extract query parameters\n url.searchParams.forEach((value, key) => {\n queryParams.append(key, value);\n });\n return {\n urlWithoutQueryParams,\n queryParams,\n };\n }\n\n protected getHeaders<RequestBody extends HttpRequestBody>(\n request: HttpRequest<RequestBody>,\n ): HttpHeaders {\n let requestHeaders: HttpHeaders = {\n [HttpHeader.ACCEPT]: MediaType.APPLICATION_JSON,\n };\n\n if (request.authentication) {\n this.populateAuthentication(request.authentication, requestHeaders);\n }\n\n if (request.body) {\n switch (request.headers?.[\"Content-Type\"]) {\n case \"text/csv\":\n requestHeaders[HttpHeader.CONTENT_TYPE] = MediaType.TEXT_CSV;\n break;\n\n default:\n requestHeaders[HttpHeader.CONTENT_TYPE] = MediaType.APPLICATION_JSON;\n break;\n }\n }\n if (request.headers) {\n requestHeaders = { ...requestHeaders, ...request.headers };\n }\n return requestHeaders;\n }\n\n private populateAuthentication(\n authentication: Authentication,\n headers: HttpHeaders,\n ): void {\n this.authenticationConverter.convert(authentication, headers);\n }\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/delegating-authentication-converter.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport type { HttpHeaders } from \"./http-headers.js\";\nimport { HttpHeader } from \"./http-header.js\";\nimport type {\n Authentication,\n BasicAuthentication,\n BearerTokenAuthentication,\n} from \"../../authentication/index.js\";\nimport { AuthenticationType } from \"../../authentication/index.js\";\n\nexport class DelegatingAuthenticationConverter implements AuthenticationConverter<Authentication> {\n private readonly converters: Record<\n AuthenticationType,\n AuthenticationConverter<any>\n >;\n\n constructor(\n bearerTokenConverter = new BearerTokenAuthenticationConverter(),\n basicTokenConverter = new BasicTokenAuthenticationConverter(),\n ) {\n this.converters = {\n [AuthenticationType.BEARER_TOKEN]: bearerTokenConverter,\n [AuthenticationType.BASIC]: basicTokenConverter,\n };\n }\n\n convert(authentication: Authentication, headers: HttpHeaders): HttpHeaders {\n const converter = this.converters[authentication.type];\n return converter.convert(authentication, headers);\n }\n}\n\nclass BearerTokenAuthenticationConverter implements AuthenticationConverter<BearerTokenAuthentication> {\n convert(\n authentication: BearerTokenAuthentication,\n headers: HttpHeaders,\n ): HttpHeaders {\n headers[HttpHeader.AUTHORIZATION] = `Bearer ${authentication.token}`;\n return headers;\n }\n}\n\nclass BasicTokenAuthenticationConverter implements AuthenticationConverter<BasicAuthentication> {\n convert(\n authentication: BasicAuthentication,\n headers: HttpHeaders,\n ): HttpHeaders {\n const credentials = `${authentication.username}:${authentication.password}`;\n const encoded = Buffer.from(credentials).toString(\"base64\");\n headers[HttpHeader.AUTHORIZATION] = `Basic ${encoded}`;\n return headers;\n }\n}\n\ntype AuthenticationConverter<T extends Authentication> = {\n convert: (authentication: T, headers: HttpHeaders) => HttpHeaders;\n};\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/http-error.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport class HttpError extends Error {\n private readonly status: number;\n private readonly responseBody: unknown;\n\n constructor(\n private readonly requestBody: unknown,\n params: HttpErrorParams,\n ) {\n const status = params.status || 500;\n const responseBody = Buffer.isBuffer(params.responseBody)\n ? params.responseBody.toString()\n : params.responseBody;\n\n super(\n JSON.stringify({\n response: {\n status: status,\n body: responseBody,\n },\n request: {\n body: requestBody,\n },\n }),\n );\n\n this.status = status;\n this.responseBody = responseBody;\n }\n\n public errorMessage() {\n return {\n response: {\n status: this.status,\n body: this.responseBody,\n },\n request: {\n body: this.requestBody,\n },\n };\n }\n\n get response() {\n return {\n status: this.status,\n body: this.responseBody,\n };\n }\n\n get request() {\n return {\n body: this.requestBody,\n };\n }\n}\n\nexport function toFailsafeOutput({ error, requestBody }: FailsafeOutputParams) {\n if (error instanceof HttpError) {\n return error.errorMessage();\n }\n return {\n response: {\n status: 0,\n body: error instanceof Error ? error.message : String(error),\n },\n request: {\n body: requestBody,\n },\n };\n}\n\nexport type HttpErrorParams = {\n status: number;\n responseBody: unknown;\n};\n\nexport type FailsafeOutputParams = {\n error: unknown;\n requestBody: unknown;\n};\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/http-method.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport enum HttpMethod {\n GET = \"GET\",\n POST = \"POST\",\n PATCH = \"PATCH\",\n PUT = \"PUT\",\n DELETE = \"DELETE\",\n HEAD = \"HEAD\",\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/fetch-http-client.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport { PassThrough, Readable } from \"node:stream\";\nimport { tryCatchSync } from \"../../../../core-utils/index.js\";\nimport { BaseHttpClient } from \"./base-http-client.js\";\nimport { DelegatingAuthenticationConverter } from \"./delegating-authentication-converter.js\";\nimport { HttpError } from \"./http-error.js\";\nimport type { HttpHeaders } from \"./http-headers.js\";\nimport type { HttpMessageBody } from \"./http-message-body.js\";\nimport { HttpMethod } from \"./http-method.js\";\nimport type { HttpRequest } from \"./http-request.js\";\nimport type { HttpRequestBody } from \"./http-request-body.js\";\nimport type { HttpResponse } from \"./http-response.js\";\n\n// Native-fetch implementation of HttpClient. SSRF egress is enforced by the engine's\n// in-process dns.lookup / Socket.connect guards (see ssrf-guard.ts) when\n// AP_NETWORK_MODE=STRICT, which cover fetch via net.connect — so there is no egress\n// proxy wiring here. A caller may still pass options.dispatcher for a user-configured\n// per-request proxy (the HTTP piece's \"Use Proxy\" feature).\nexport class FetchHttpClient extends BaseHttpClient {\n constructor(\n baseUrl = \"\",\n authenticationConverter: DelegatingAuthenticationConverter = new DelegatingAuthenticationConverter(),\n ) {\n super(baseUrl, authenticationConverter);\n }\n\n async sendRequest<ResponseBody extends HttpMessageBody = any>(\n request: HttpRequest<HttpRequestBody>,\n options?: SendRequestOptions,\n ): Promise<HttpResponse<ResponseBody>> {\n const { urlWithoutQueryParams, queryParams: urlQueryParams } =\n this.getUrl(request);\n const headers = this.getHeaders(request);\n const queryParams = request.queryParams ?? {};\n for (const [key, value] of Object.entries(queryParams)) {\n urlQueryParams.append(key, value);\n }\n const queryString = urlQueryParams.toString();\n const finalUrl = queryString\n ? `${urlWithoutQueryParams}?${queryString}`\n : urlWithoutQueryParams;\n\n const responseType = request.responseType ?? \"json\";\n const followRedirects = request.followRedirects ?? true;\n const retries = request.retries ?? 0;\n\n const { body, extraHeaders, isStream } = acceptsRequestBody(request.method)\n ? serializeBody(request.body, headers)\n : { body: undefined, extraHeaders: {}, isStream: false };\n const finalHeaders = normalizeHeaders({ ...headers, ...extraHeaders });\n\n const response = await sendWithRetries(\n async () => {\n const controller = new AbortController();\n const timeoutId =\n request.timeout && request.timeout > 0\n ? setTimeout(() => controller.abort(), request.timeout)\n : undefined;\n try {\n const init: FetchInit = {\n method: request.method.toString(),\n headers: finalHeaders,\n body,\n redirect: followRedirects ? \"follow\" : \"manual\",\n signal: controller.signal,\n };\n if (isStream) {\n init.duplex = \"half\";\n }\n // A caller-supplied undici Dispatcher (e.g. a ProxyAgent) for per-request proxying.\n if (options?.dispatcher !== undefined) {\n init.dispatcher = options.dispatcher;\n }\n return await fetch(finalUrl, init);\n } finally {\n if (timeoutId !== undefined) {\n clearTimeout(timeoutId);\n }\n }\n },\n isStream ? 0 : retries,\n );\n\n const successCeiling = followRedirects ? 300 : 400;\n if (response.status < 200 || response.status >= successCeiling) {\n // A stream response can't carry an error message usefully; read the error body as text.\n const errorBody = await parseResponseBody(\n response,\n responseType === \"stream\" ? \"text\" : responseType,\n );\n const httpError = new HttpError(request.body, {\n status: response.status,\n responseBody: errorBody,\n });\n throw httpError;\n }\n\n const responseBody = await parseResponseBody(response, responseType);\n return {\n status: response.status,\n headers: toHttpHeaders(response.headers),\n body: responseBody as ResponseBody,\n };\n }\n}\n\nexport function acceptsRequestBody(method: HttpMethod): boolean {\n return method !== HttpMethod.GET && method !== HttpMethod.HEAD;\n}\n\nfunction serializeBody(\n body: HttpRequestBody | undefined,\n headers: HttpHeaders,\n): {\n body: BodyInit | undefined;\n extraHeaders: Record<string, string>;\n isStream: boolean;\n} {\n if (isNil(body)) {\n return { body: undefined, extraHeaders: {}, isStream: false };\n }\n if (isNodeFormData(body)) {\n // A buffered multipart body lets undici send Content-Length; a streamed one is sent\n // chunked without a length, which strict multipart parsers reject with a 500. Streaming\n // with an explicit content-length header is not an option: undici stalls or throws\n // RequestContentLengthMismatchError on stream bodies that carry one.\n const buffered = bufferFormDataIfSafe(body);\n if (buffered !== null) {\n return {\n body: buffered as unknown as BodyInit,\n extraHeaders: body.getHeaders(),\n isStream: false,\n };\n }\n const stream = new PassThrough();\n body.on(\"error\", (error) => stream.destroy(error));\n body.pipe(stream);\n return {\n body: stream as unknown as BodyInit,\n extraHeaders: body.getHeaders(),\n isStream: true,\n };\n }\n if (body instanceof Readable) {\n return {\n body: body as unknown as BodyInit,\n extraHeaders: {},\n isStream: true,\n };\n }\n // Already a wire-ready body — pass through untouched.\n if (\n typeof body === \"string\" ||\n Buffer.isBuffer(body) ||\n body instanceof URLSearchParams ||\n body instanceof ArrayBuffer ||\n (typeof FormData !== \"undefined\" && body instanceof FormData) ||\n (typeof Blob !== \"undefined\" && body instanceof Blob)\n ) {\n return { body: body as BodyInit, extraHeaders: {}, isStream: false };\n }\n const contentType = headers[\"Content-Type\"] ?? headers[\"content-type\"] ?? \"\";\n if (contentType.includes(\"application/x-www-form-urlencoded\")) {\n return {\n body: new URLSearchParams(body as Record<string, string>).toString(),\n extraHeaders: {},\n isStream: false,\n };\n }\n return { body: JSON.stringify(body), extraHeaders: {}, isStream: false };\n}\n\nasync function parseResponseBody(\n response: Response,\n responseType: ResponseType,\n): Promise<unknown> {\n switch (responseType) {\n case \"arraybuffer\":\n return Buffer.from(await response.arrayBuffer());\n case \"stream\":\n // undici streams a Node web ReadableStream body; the DOM fetch types omit the fromWeb overload\n return isNil(response.body)\n ? Readable.from([])\n : Readable.fromWeb(\n response.body as unknown as Parameters<typeof Readable.fromWeb>[0],\n );\n case \"blob\":\n return await response.blob();\n case \"text\":\n return await response.text();\n case \"json\":\n default: {\n const text = await response.text();\n if (text.length === 0) {\n return undefined;\n }\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n }\n }\n}\n\nasync function sendWithRetries(\n fn: () => Promise<Response>,\n retries: number,\n): Promise<Response> {\n let lastError: unknown;\n for (let attempt = 0; attempt <= retries; attempt++) {\n try {\n const response = await fn();\n if (response.status >= 500 && attempt < retries) {\n await backoff(attempt);\n continue;\n }\n return response;\n } catch (error) {\n lastError = error;\n if (attempt < retries) {\n await backoff(attempt);\n continue;\n }\n throw error;\n }\n }\n throw lastError;\n}\n\nfunction backoff(attempt: number): Promise<void> {\n const delayMs = Math.min(1000 * 2 ** attempt, 30000);\n return new Promise((resolve) => setTimeout(resolve, delayMs));\n}\n\nfunction normalizeHeaders(headers: HttpHeaders): Record<string, string> {\n const entriesByLowerCaseKey = new Map<string, [string, string]>();\n for (const [key, value] of Object.entries(headers)) {\n if (value === undefined) {\n continue;\n }\n entriesByLowerCaseKey.set(key.toLowerCase(), [\n key,\n Array.isArray(value) ? value.join(\", \") : value,\n ]);\n }\n return Object.fromEntries(entriesByLowerCaseKey.values());\n}\n\nfunction toHttpHeaders(headers: Headers): HttpHeaders {\n const result: Record<string, string> = {};\n headers.forEach((value, key) => {\n result[key] = value;\n });\n return result;\n}\n\nfunction bufferFormDataIfSafe(body: NodeFormData): Buffer | null {\n if (\n !body.hasKnownLength() ||\n body.getLengthSync() > MAX_BUFFERED_FORM_DATA_BYTES\n ) {\n return null;\n }\n // getBuffer throws on stream parts appended with an explicit knownLength; fall back to streaming.\n const { data } = tryCatchSync(() => body.getBuffer());\n return data;\n}\n\nfunction isNodeFormData(body: unknown): body is NodeFormData {\n return (\n typeof body === \"object\" &&\n body !== null &&\n typeof (body as NodeFormData).getHeaders === \"function\" &&\n typeof (body as NodeFormData).pipe === \"function\" &&\n typeof (body as NodeFormData).on === \"function\"\n );\n}\n\nfunction isNil(value: unknown): value is null | undefined {\n return value === null || value === undefined;\n}\n\ntype NodeFormData = {\n getHeaders: () => Record<string, string>;\n pipe: (...args: unknown[]) => unknown;\n on: (event: \"error\", listener: (error: Error) => void) => unknown;\n hasKnownLength: () => boolean;\n getLengthSync: () => number;\n getBuffer: () => Buffer;\n};\n\nconst MAX_BUFFERED_FORM_DATA_BYTES = 100 * 1024 * 1024;\n\ntype ResponseType = NonNullable<HttpRequest[\"responseType\"]>;\n\ntype FetchInit = RequestInit & { duplex?: \"half\"; dispatcher?: unknown };\n\nexport type SendRequestOptions = {\n dispatcher?: unknown;\n};\n\nexport { FetchHttpClient as AxiosHttpClient };\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/http-client.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport type { SendRequestOptions } from \"./fetch-http-client.js\";\nimport { FetchHttpClient } from \"./fetch-http-client.js\";\nimport type { HttpMessageBody } from \"./http-message-body.js\";\nimport type { HttpRequest } from \"./http-request.js\";\nimport type { HttpRequestBody } from \"./http-request-body.js\";\nimport type { HttpResponse } from \"./http-response.js\";\n\nexport type HttpClient = {\n sendRequest<\n RequestBody extends HttpRequestBody,\n ResponseBody extends HttpMessageBody,\n >(\n request: HttpRequest<RequestBody>,\n options?: SendRequestOptions,\n ): Promise<HttpResponse<ResponseBody>>;\n};\n\nexport const httpClient = new FetchHttpClient();\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/helpers/index.ts. MIT; see ../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport type {\n ActionClassification,\n OAuth2PropertyValue,\n PieceAuthProperty,\n StaticDropdownProperty,\n StaticPropsValue,\n InputPropertyMap,\n FilesService,\n AppConnectionValueForAuthProperty,\n ExtractPieceAuthPropertyTypeForMethods,\n ApFile,\n} from \"../../../framework/index.js\";\nimport { Property, createAction } from \"../../../framework/index.js\";\nimport type { HttpHeaders, HttpRequest, QueryParams } from \"../http/index.js\";\nimport {\n HttpMethod,\n acceptsRequestBody,\n httpClient,\n toFailsafeOutput,\n} from \"../http/index.js\";\nimport {\n assertNotNullOrUndefined,\n isEmpty,\n isNil,\n} from \"../../../core-utils/index.js\";\nimport fs from \"node:fs\";\n// Self-contained content-type → file-extension lookup, replacing the heavy\n// `mime-types`/`mime-db` dependency (~134 KB inlined into every piece bundle).\n// Covers the common types returned for binary HTTP responses; unknown → ''.\nconst CONTENT_TYPE_EXTENSIONS: Record<string, string> = {\n \"application/json\": \"json\",\n \"application/pdf\": \"pdf\",\n \"application/xml\": \"xml\",\n \"text/xml\": \"xml\",\n \"application/zip\": \"zip\",\n \"application/gzip\": \"gz\",\n \"application/x-tar\": \"tar\",\n \"application/octet-stream\": \"bin\",\n \"application/msword\": \"doc\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\":\n \"docx\",\n \"application/vnd.ms-excel\": \"xls\",\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\": \"xlsx\",\n \"application/vnd.ms-powerpoint\": \"ppt\",\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation\":\n \"pptx\",\n \"application/rtf\": \"rtf\",\n \"application/javascript\": \"js\",\n \"application/x-www-form-urlencoded\": \"bin\",\n \"text/plain\": \"txt\",\n \"text/html\": \"html\",\n \"text/css\": \"css\",\n \"text/csv\": \"csv\",\n \"text/calendar\": \"ics\",\n \"text/markdown\": \"md\",\n \"image/png\": \"png\",\n \"image/jpeg\": \"jpeg\",\n \"image/jpg\": \"jpg\",\n \"image/gif\": \"gif\",\n \"image/webp\": \"webp\",\n \"image/svg+xml\": \"svg\",\n \"image/bmp\": \"bmp\",\n \"image/tiff\": \"tiff\",\n \"image/x-icon\": \"ico\",\n \"image/vnd.microsoft.icon\": \"ico\",\n \"image/heic\": \"heic\",\n \"audio/mpeg\": \"mp3\",\n \"audio/mp4\": \"m4a\",\n \"audio/wav\": \"wav\",\n \"audio/x-wav\": \"wav\",\n \"audio/ogg\": \"ogg\",\n \"audio/webm\": \"weba\",\n \"video/mp4\": \"mp4\",\n \"video/mpeg\": \"mpeg\",\n \"video/webm\": \"webm\",\n \"video/quicktime\": \"mov\",\n \"video/x-msvideo\": \"avi\",\n \"font/woff\": \"woff\",\n \"font/woff2\": \"woff2\",\n \"font/ttf\": \"ttf\",\n \"font/otf\": \"otf\",\n};\n\nfunction contentTypeToExtension(contentType: string): string {\n const type = contentType.split(\";\")[0].trim().toLowerCase();\n return CONTENT_TYPE_EXTENSIONS[type] ?? \"\";\n}\nimport FormData from \"form-data\";\n\nexport const getAccessTokenOrThrow = (\n auth: OAuth2PropertyValue | undefined,\n): string => {\n const accessToken = auth?.access_token;\n\n if (accessToken === undefined) {\n throw new Error(\"Invalid bearer token\");\n }\n\n return accessToken;\n};\nconst joinBaseUrlWithRelativePath = ({\n baseUrl,\n relativePath,\n}: {\n baseUrl: string;\n relativePath: string;\n}) => {\n const baseUrlWithSlash = baseUrl.endsWith(\"/\") ? baseUrl : `${baseUrl}/`;\n const relativePathWithoutSlash = relativePath.startsWith(\"/\")\n ? relativePath.slice(1)\n : relativePath;\n return `${baseUrlWithSlash}${relativePathWithoutSlash}`;\n};\n\nconst getBaseUrlForDescription = <\n PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined,\n>(\n baseUrl: BaseUrlGetter<PieceAuth>,\n auth?: AppConnectionValueForAuthProperty<\n ExtractPieceAuthPropertyTypeForMethods<PieceAuth>\n >,\n) => {\n const exampleBaseUrl = `https://api.example.com`;\n try {\n const baseUrlValue = auth ? baseUrl(auth) : undefined;\n const baseUrlValueWithoutTrailingSlash = baseUrlValue?.endsWith(\"/\")\n ? baseUrlValue.slice(0, -1)\n : baseUrlValue;\n return baseUrlValueWithoutTrailingSlash ?? exampleBaseUrl;\n } catch (error) {\n //If baseUrl fails we stil want to return a valid baseUrl for description\n {\n return exampleBaseUrl;\n }\n }\n};\ntype BaseUrlGetter<\n PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined,\n> = (\n auth?: AppConnectionValueForAuthProperty<\n ExtractPieceAuthPropertyTypeForMethods<PieceAuth>\n >,\n) => string;\nexport function createCustomApiCallAction<\n PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined,\n>({\n auth,\n baseUrl,\n authMapping,\n description,\n displayName,\n name,\n props,\n extraProps,\n authLocation = \"headers\",\n classification = \"WRITE\",\n}: {\n auth?: PieceAuth;\n baseUrl: BaseUrlGetter<PieceAuth>;\n authMapping?: (\n auth: AppConnectionValueForAuthProperty<\n ExtractPieceAuthPropertyTypeForMethods<PieceAuth>\n >,\n propsValue: StaticPropsValue<any>,\n ) => Promise<HttpHeaders | QueryParams>;\n // add description as a parameter that can be null\n description?: string | null;\n displayName?: string | null;\n name?: string | null;\n props?: {\n url?: Partial<ReturnType<typeof Property.ShortText>>;\n method?: Partial<StaticDropdownProperty<HttpMethod, boolean>>;\n headers?: Partial<ReturnType<typeof Property.Object>>;\n queryParams?: Partial<ReturnType<typeof Property.Object>>;\n body?: Partial<ReturnType<typeof Property.Json>>;\n response_is_binary?: Partial<ReturnType<typeof Property.Checkbox>>;\n failsafe?: Partial<ReturnType<typeof Property.Checkbox>>;\n timeout?: Partial<ReturnType<typeof Property.Number>>;\n followRedirects?: Partial<ReturnType<typeof Property.Checkbox>>;\n };\n extraProps?: InputPropertyMap;\n authLocation?: \"headers\" | \"queryParams\";\n // The method is caller-supplied at runtime, so a single tag has to assume mutation.\n classification?: ActionClassification;\n}) {\n return createAction({\n audience: \"human\",\n name: name ? name : \"custom_api_call\",\n classification,\n displayName: displayName ? displayName : \"Custom API Call\",\n description: description\n ? description\n : \"Make a custom API call to a specific endpoint\",\n auth,\n requireAuth: auth ? true : false,\n props: {\n url: Property.DynamicProperties({\n auth,\n displayName: \"\",\n required: true,\n refreshers: [],\n props: async ({ auth }) => {\n return {\n url: Property.ShortText({\n displayName: \"URL\",\n description: `Full URL, or a path relative to ${getBaseUrlForDescription(baseUrl, auth)}`,\n required: true,\n placeholder: \"/resource\",\n defaultValue: auth ? baseUrl(auth) : \"\",\n ...(props?.url ?? {}),\n }),\n };\n },\n }),\n method: Property.StaticDropdown({\n displayName: \"Method\",\n required: true,\n defaultValue: HttpMethod.GET,\n options: {\n options: Object.values(HttpMethod).map((v) => {\n return {\n label: v,\n value: v,\n };\n }),\n },\n ...(props?.method ?? {}),\n }),\n headers: Property.Object({\n displayName: \"Headers\",\n description:\n \"Authorization headers are injected automatically from your connection.\",\n required: false,\n ...(props?.headers ?? {}),\n }),\n queryParams: Property.Object({\n displayName: \"Query Parameters\",\n description: \"Appended to the URL as ?key=value.\",\n required: false,\n ...(props?.queryParams ?? {}),\n }),\n body_type: Property.Dropdown({\n auth,\n displayName: \"Body Type\",\n required: false,\n defaultValue: \"none\",\n refreshers: [\"method\"],\n options: async ({ method }) => {\n if (!acceptsRequestBody(method as HttpMethod)) {\n return {\n disabled: true,\n placeholder: \"Not available for GET or HEAD requests\",\n options: [],\n };\n }\n return {\n disabled: false,\n options: [\n { label: \"None\", value: \"none\" },\n { label: \"JSON\", value: \"json\" },\n { label: \"Form Data\", value: \"form_data\" },\n { label: \"Raw\", value: \"raw\" },\n ],\n };\n },\n }),\n body: Property.DynamicProperties({\n auth,\n displayName: \"Body\",\n refreshers: [\"body_type\", \"method\"],\n required: false,\n props: async ({ body_type, method }) => {\n if (!body_type || !acceptsRequestBody(method as HttpMethod))\n return {};\n\n const bodyTypeInput = body_type as unknown as string;\n\n const fields: InputPropertyMap = {};\n\n switch (bodyTypeInput) {\n case \"none\":\n break;\n case \"json\":\n fields[\"data\"] = Property.Json({\n displayName: \"JSON Body\",\n required: true,\n ...(props?.body ?? {}),\n });\n break;\n case \"raw\":\n fields[\"data\"] = Property.LongText({\n displayName: \"Raw Body\",\n required: true,\n });\n break;\n case \"form_data\":\n fields[\"data\"] = Property.Array({\n displayName: \"Form Data\",\n required: true,\n properties: {\n fieldName: Property.ShortText({\n displayName: \"Field Name\",\n required: true,\n }),\n fieldType: Property.StaticDropdown({\n displayName: \"Field Type\",\n required: true,\n options: {\n disabled: false,\n options: [\n { label: \"Text\", value: \"text\" },\n { label: \"File\", value: \"file\" },\n ],\n },\n }),\n textFieldValue: Property.LongText({\n displayName: \"Text Field Value\",\n required: false,\n }),\n fileFieldValue: Property.File({\n displayName: \"File Field Value\",\n required: false,\n }),\n },\n });\n break;\n }\n return fields;\n },\n }),\n response_is_binary: Property.Checkbox({\n displayName: \"Response is Binary\",\n description: \"Enable for files like PDFs, images, etc.\",\n required: false,\n defaultValue: false,\n advanced: true,\n ...(props?.response_is_binary ?? {}),\n }),\n failsafe: Property.Checkbox({\n displayName: \"Return Error as Output\",\n description:\n \"On a failed request, output the error instead of failing the step.\",\n required: false,\n advanced: true,\n ...(props?.failsafe ?? {}),\n }),\n timeout: Property.Number({\n displayName: \"Timeout\",\n description:\n \"Seconds to wait for a response. Empty: up to the flow limit (10 min).\",\n required: false,\n advanced: true,\n ...(props?.timeout ?? {}),\n }),\n followRedirects: Property.Checkbox({\n displayName: \"Follow redirects\",\n description:\n \"Follow 3xx redirects instead of returning them as the response.\",\n required: false,\n defaultValue: false,\n advanced: true,\n ...(props?.followRedirects ?? {}),\n }),\n ...extraProps,\n },\n\n run: async (context) => {\n const {\n method,\n url,\n headers,\n queryParams,\n body,\n body_type,\n failsafe,\n timeout,\n response_is_binary,\n followRedirects,\n } = context.propsValue;\n assertNotNullOrUndefined(method, \"Method\");\n assertNotNullOrUndefined(url, \"URL\");\n\n const authValue = !isNil(authMapping)\n ? await authMapping(context.auth, context.propsValue)\n : {};\n\n const urlValue = url[\"url\"] as string;\n const fullUrl =\n urlValue.startsWith(\"http://\") || urlValue.startsWith(\"https://\")\n ? urlValue\n : joinBaseUrlWithRelativePath({\n baseUrl: baseUrl(context.auth),\n relativePath: urlValue,\n });\n const request: HttpRequest = {\n method,\n url: fullUrl,\n headers: {\n ...((headers ?? {}) as HttpHeaders),\n ...(authLocation === \"headers\" ? authValue : {}),\n },\n queryParams: {\n ...(authLocation === \"queryParams\" ? (authValue as QueryParams) : {}),\n ...((queryParams as QueryParams) ?? {}),\n },\n timeout: timeout ? timeout * 1000 : 0,\n followRedirects,\n };\n\n // Set response type to arraybuffer if binary response is expected\n if (response_is_binary) {\n request.responseType = \"arraybuffer\";\n }\n\n if (body) {\n if (body_type && body_type !== \"none\") {\n const bodyInput = body[\"data\"];\n if (body_type === \"form_data\") {\n const formBodyInput = bodyInput as Array<{\n fieldName: string;\n fieldType: \"text\" | \"file\";\n textFieldValue?: string;\n fileFieldValue?: ApFile;\n }>;\n\n const formData = new FormData();\n\n for (const {\n fieldName,\n fieldType,\n textFieldValue,\n fileFieldValue,\n } of formBodyInput) {\n if (fieldType === \"text\" && !isEmpty(textFieldValue)) {\n formData.append(fieldName, textFieldValue);\n } else if (fieldType === \"file\" && !isEmpty(fileFieldValue)) {\n formData.append(fieldName, fileFieldValue!.data, {\n filename: fileFieldValue?.filename,\n });\n }\n }\n request.body = formData;\n request.headers = { ...request.headers, ...formData.getHeaders() };\n } else {\n request.body = bodyInput;\n }\n } else if (!body_type) {\n request.body = body;\n }\n }\n\n try {\n const response = await httpClient.sendRequest(request);\n return await handleBinaryResponse(\n context.files,\n response.body,\n response.status,\n response.headers,\n response_is_binary,\n );\n } catch (error) {\n if (failsafe) {\n return toFailsafeOutput({ error, requestBody: request.body });\n }\n throw error;\n }\n },\n });\n}\n\nexport function is_chromium_installed(): boolean {\n const chromiumPath = \"/usr/bin/chromium\";\n return fs.existsSync(chromiumPath);\n}\n\nconst handleBinaryResponse = async (\n files: FilesService,\n bodyContent: string | ArrayBuffer | Buffer,\n status: number,\n headers?: HttpHeaders,\n isBinary?: boolean,\n) => {\n let body;\n\n if (isBinary && isBinaryBody(bodyContent)) {\n const contentTypeValue = Array.isArray(headers?.[\"content-type\"])\n ? headers[\"content-type\"][0]\n : headers?.[\"content-type\"];\n const fileExtension: string =\n contentTypeToExtension(contentTypeValue ?? \"\") || \"txt\";\n\n let bufferData: Buffer;\n if (bodyContent instanceof ArrayBuffer) {\n bufferData = Buffer.from(new Uint8Array(bodyContent));\n } else if (Buffer.isBuffer(bodyContent)) {\n bufferData = bodyContent;\n } else {\n bufferData = Buffer.from(bodyContent);\n }\n\n body = await files.write({\n fileName: `output.${fileExtension}`,\n data: bufferData,\n });\n } else {\n body = bodyContent;\n }\n\n return { status, headers, body };\n};\n\nconst isBinaryBody = (body: string | ArrayBuffer | Buffer) => {\n return body instanceof ArrayBuffer || Buffer.isBuffer(body);\n};\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/polling/index.ts. MIT; see ../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport type {\n AppConnectionValueForAuthProperty,\n FilesService,\n ServerContext,\n Store,\n} from \"../../../framework/index.js\";\nimport { isNil } from \"../../../core-utils/index.js\";\n\ninterface TimebasedPolling<AuthValue, PropsValue> {\n strategy: DedupeStrategy.TIMEBASED;\n items: (params: {\n auth: AuthValue;\n store: Store;\n propsValue: PropsValue;\n lastFetchEpochMS: number;\n server?: ServerContext;\n }) => Promise<\n {\n epochMilliSeconds: number;\n data: unknown;\n }[]\n >;\n}\n\ninterface LastItemPolling<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n> {\n strategy: DedupeStrategy.LAST_ITEM;\n items: (params: {\n auth: AuthValue;\n store: Store;\n files?: FilesService;\n propsValue: PropsValue;\n lastItemId: unknown;\n server?: ServerContext;\n }) => Promise<\n {\n id: unknown;\n data: unknown;\n }[]\n >;\n}\n\nexport enum DedupeStrategy {\n TIMEBASED,\n LAST_ITEM,\n}\n\nexport type Polling<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n> =\n | TimebasedPolling<AuthValue, PropsValue>\n | LastItemPolling<AuthValue, PropsValue>;\n\nexport const pollingHelper = {\n async poll<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n >(\n polling: Polling<AuthValue, PropsValue>,\n {\n store,\n auth,\n propsValue,\n maxItemsToPoll,\n files,\n server,\n }: {\n store: Store;\n auth: AuthValue;\n propsValue: PropsValue;\n files: FilesService;\n maxItemsToPoll?: number;\n server?: ServerContext;\n },\n ): Promise<unknown[]> {\n switch (polling.strategy) {\n case DedupeStrategy.TIMEBASED: {\n const lastEpochMilliSeconds = await store.get<number>(\"lastPoll\");\n if (isNil(lastEpochMilliSeconds)) {\n throw new Error(\"lastPoll doesn't exist in the store.\");\n }\n const items = await polling.items({\n store,\n auth,\n propsValue,\n lastFetchEpochMS: lastEpochMilliSeconds,\n server,\n });\n const newLastEpochMilliSeconds = items.reduce(\n (acc, item) => Math.max(acc, item.epochMilliSeconds),\n lastEpochMilliSeconds,\n );\n await store.put(\"lastPoll\", newLastEpochMilliSeconds);\n return items\n .filter((f) => f.epochMilliSeconds > lastEpochMilliSeconds)\n .map((item) => item.data);\n }\n case DedupeStrategy.LAST_ITEM: {\n const lastItemId = await store.get<unknown>(\"lastItem\");\n const items = await polling.items({\n store,\n auth,\n propsValue,\n lastItemId,\n files,\n server,\n });\n\n const lastItemIndex = items.findIndex((f) => f.id === lastItemId);\n let newItems = [];\n if (isNil(lastItemId) || lastItemIndex == -1) {\n newItems = items ?? [];\n } else {\n newItems = items?.slice(0, lastItemIndex) ?? [];\n }\n // Sorted from newest to oldest\n if (!isNil(maxItemsToPoll)) {\n // Get the last polling.maxItemsToPoll items\n newItems = newItems.slice(-maxItemsToPoll);\n }\n const newLastItem = newItems?.[0]?.id;\n if (!isNil(newLastItem)) {\n await store.put(\"lastItem\", newLastItem);\n }\n return newItems.map((item) => item.data);\n }\n }\n },\n async onEnable<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n >(\n polling: Polling<AuthValue, PropsValue>,\n {\n store,\n auth,\n propsValue,\n server,\n isRepublish,\n }: {\n store: Store;\n auth: AuthValue;\n propsValue: PropsValue;\n server?: ServerContext;\n isRepublish?: boolean;\n },\n ): Promise<void> {\n switch (polling.strategy) {\n case DedupeStrategy.TIMEBASED: {\n if (isRepublish && !isNil(await store.get<number>(\"lastPoll\"))) {\n break;\n }\n await store.put(\"lastPoll\", Date.now());\n break;\n }\n case DedupeStrategy.LAST_ITEM: {\n if (isRepublish && !isNil(await store.get(\"lastItem\"))) {\n break;\n }\n const items = await polling.items({\n store,\n auth,\n propsValue,\n lastItemId: null,\n server,\n });\n const lastItemId = items?.[0]?.id;\n if (!isNil(lastItemId)) {\n await store.put(\"lastItem\", lastItemId);\n } else {\n await store.delete(\"lastItem\");\n }\n break;\n }\n }\n },\n async onDisable<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n >(\n polling: Polling<AuthValue, PropsValue>,\n params: { store: Store; auth: AuthValue; propsValue: PropsValue },\n ): Promise<void> {\n switch (polling.strategy) {\n case DedupeStrategy.TIMEBASED:\n case DedupeStrategy.LAST_ITEM:\n return;\n }\n },\n async test<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n >(\n polling: Polling<AuthValue, PropsValue>,\n {\n auth,\n propsValue,\n store,\n files,\n server,\n }: {\n store: Store;\n auth: AuthValue;\n propsValue: PropsValue;\n files: FilesService;\n server?: ServerContext;\n },\n ): Promise<unknown[]> {\n let items = [];\n switch (polling.strategy) {\n case DedupeStrategy.TIMEBASED: {\n items = await polling.items({\n store,\n auth,\n propsValue,\n lastFetchEpochMS: 0,\n server,\n });\n break;\n }\n case DedupeStrategy.LAST_ITEM: {\n items = await polling.items({\n store,\n auth,\n propsValue,\n lastItemId: null,\n files,\n server,\n });\n break;\n }\n }\n return getFirstFiveOrAll(items.map((item) => item.data));\n },\n};\n\nfunction getFirstFiveOrAll(array: unknown[]) {\n if (array.length <= 5) {\n return array;\n } else {\n return array.slice(0, 5);\n }\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/stream/index.ts. MIT; see ../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport { Readable } from \"node:stream\";\nimport type { ApFile, ApStreamingFile } from \"../../../framework/index.js\";\n\nfunction toStreamingBody(file: ApStreamingFile | ApFile): {\n body: Readable;\n size: number | undefined;\n} {\n if (\"body\" in file) {\n return { body: file.body, size: file.size };\n }\n return { body: Readable.from(file.data), size: file.data.length };\n}\n\nasync function* readChunks({\n readable,\n chunkSize,\n}: {\n readable: Readable;\n chunkSize: number;\n}): AsyncGenerator<Buffer> {\n let pending: Buffer[] = [];\n let pendingLength = 0;\n if (!Number.isInteger(chunkSize) || chunkSize <= 0) {\n throw new Error(\"chunkSize must be a positive integer\");\n }\n for await (const data of readable) {\n pending.push(Buffer.isBuffer(data) ? data : Buffer.from(data));\n pendingLength += pending[pending.length - 1].length;\n while (pendingLength >= chunkSize) {\n const combined =\n pending.length === 1 ? pending[0] : Buffer.concat(pending);\n yield combined.subarray(0, chunkSize);\n const rest = combined.subarray(chunkSize);\n pending = rest.length > 0 ? [rest] : [];\n pendingLength = rest.length;\n }\n }\n if (pendingLength > 0) {\n yield pending.length === 1 ? pending[0] : Buffer.concat(pending);\n }\n}\n\nexport const streamUtils = { readChunks, toStreamingBody };\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/validation/index.ts. MIT; see ../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport * as z from \"zod/mini\";\n\nexport const propsValidation = {\n async validateZod<T extends Record<string, unknown>>(\n props: T,\n schema: Partial<Record<keyof T, z.core.$ZodType>>,\n ): Promise<void> {\n const schemaObj = z.object(\n Object.entries(schema).reduce(\n (acc, [key, value]) => ({\n ...acc,\n [key]: value,\n }),\n {},\n ),\n );\n\n const result = await z.safeParseAsync(schemaObj, props);\n if (!result.success) {\n const errors = result.error.issues.reduce<Record<string, string>>(\n (acc, issue) => ({\n ...acc,\n [issue.path.join(\".\")]: issue.message,\n }),\n {},\n );\n throw new Error(JSON.stringify({ errors }, null, 2));\n }\n },\n};\n"],"mappings":";;;;;;;;AAIA,IAAY,qBAAL;AACL;AACA;;KACD;;;;ACLD,IAAY,aAAL;AACL;AACA;AACA;AACA;;KACD;;;;ACLD,IAAY,YAAL;AACL;AACA;;KACD;;;;ACQD,IAAsB,iBAAtB,MAA2D;CACzD,YACE,AAAiB,SACjB,AAAiB,yBACjB;EAFiB;EACA;;CAQnB,AAAU,OACR,SAIA;EACA,MAAM,MAAM,IAAI,IAAI,GAAG,KAAK,UAAU,QAAQ,MAAM;EACpD,MAAM,wBAAwB,GAAG,IAAI,SAAS,IAAI;EAClD,MAAM,cAAc,IAAI,iBAAiB;AAEzC,MAAI,aAAa,SAAS,OAAO,QAAQ;AACvC,eAAY,OAAO,KAAK,MAAM;IAC9B;AACF,SAAO;GACL;GACA;GACD;;CAGH,AAAU,WACR,SACa;EACb,IAAI,iBAA8B,GAC/B,WAAW,SAAS,UAAU,kBAChC;AAED,MAAI,QAAQ,eACV,MAAK,uBAAuB,QAAQ,gBAAgB,eAAe;AAGrE,MAAI,QAAQ,KACV,SAAQ,QAAQ,UAAU,iBAA1B;GACE,KAAK;AACH,mBAAe,WAAW,gBAAgB,UAAU;AACpD;GAEF;AACE,mBAAe,WAAW,gBAAgB,UAAU;AACpD;;AAGN,MAAI,QAAQ,QACV,kBAAiB;GAAE,GAAG;GAAgB,GAAG,QAAQ;GAAS;AAE5D,SAAO;;CAGT,AAAQ,uBACN,gBACA,SACM;AACN,OAAK,wBAAwB,QAAQ,gBAAgB,QAAQ;;;;;;AChEjE,IAAa,oCAAb,MAAkG;CAChG,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B,KAAI,gBAAgB,EAClB,OAAM,QAAQ,WAAW,IAAI,QAAQ,KAAK,OAAO,OAAO,QAAQ;;AAIpE,MAAa,cAAc;CAAE;CAAY;CAAiB;;;;ACxC1D,MAAa,kBAAkB,EAC7B,MAAM,YACJ,OACA,QACe;CACf,MAAM,YAAY,EAAE,OAClB,OAAO,QAAQ,OAAO,CAAC,QACpB,KAAK,CAAC,KAAK,YAAY;EACtB,GAAG;GACF,MAAM;EACR,GACD,EAAE,CACH,CACF;CAED,MAAM,SAAS,MAAM,EAAE,eAAe,WAAW,MAAM;AACvD,KAAI,CAAC,OAAO,SAAS;EACnB,MAAM,SAAS,OAAO,MAAM,OAAO,QAChC,KAAK,WAAW;GACf,GAAG;IACF,MAAM,KAAK,KAAK,IAAI,GAAG,MAAM;GAC/B,GACD,EAAE,CACH;AACD,QAAM,IAAI,MAAM,KAAK,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;;GAGzD"}
|
|
1
|
+
{"version":3,"file":"common.js","names":["isNil","FormData","isNil"],"sources":["../upstream/common/lib/authentication/index.ts","../upstream/common/lib/http/core/http-header.ts","../upstream/common/lib/http/core/media-type.ts","../upstream/common/lib/http/core/base-http-client.ts","../upstream/common/lib/http/core/delegating-authentication-converter.ts","../upstream/common/lib/http/core/http-error.ts","../upstream/common/lib/http/core/http-method.ts","../upstream/common/lib/http/core/fetch-http-client.ts","../upstream/common/lib/http/core/http-client.ts","../upstream/common/lib/helpers/index.ts","../upstream/common/lib/polling/index.ts","../upstream/common/lib/stream/index.ts","../upstream/common/lib/validation/index.ts"],"sourcesContent":["// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/authentication/index.ts. MIT; see ../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport type Authentication = BearerTokenAuthentication | BasicAuthentication;\n\nexport enum AuthenticationType {\n BEARER_TOKEN = \"BEARER_TOKEN\",\n BASIC = \"BASIC\",\n}\n\nexport type BaseAuthentication<T extends AuthenticationType> = {\n type: T;\n};\n\nexport type BearerTokenAuthentication =\n BaseAuthentication<AuthenticationType.BEARER_TOKEN> & {\n token: string;\n };\n\nexport type BasicAuthentication =\n BaseAuthentication<AuthenticationType.BASIC> & {\n username: string;\n password: string;\n };\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/http-header.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport enum HttpHeader {\n AUTHORIZATION = \"Authorization\",\n ACCEPT = \"Accept\",\n API_KEY = \"x-api-key\",\n CONTENT_TYPE = \"Content-Type\",\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/media-type.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport enum MediaType {\n APPLICATION_JSON = \"application/json\",\n TEXT_CSV = \"text/csv\",\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/base-http-client.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport type { Authentication } from \"../../authentication/index.js\";\nimport type { DelegatingAuthenticationConverter } from \"./delegating-authentication-converter.js\";\nimport type { HttpClient } from \"./http-client.js\";\nimport { HttpHeader } from \"./http-header.js\";\nimport type { HttpHeaders } from \"./http-headers.js\";\nimport type { HttpMessageBody } from \"./http-message-body.js\";\nimport type { HttpRequest } from \"./http-request.js\";\nimport type { HttpRequestBody } from \"./http-request-body.js\";\nimport type { HttpResponse } from \"./http-response.js\";\nimport { MediaType } from \"./media-type.js\";\n\nexport abstract class BaseHttpClient implements HttpClient {\n constructor(\n private readonly baseUrl: string,\n private readonly authenticationConverter: DelegatingAuthenticationConverter,\n ) {}\n\n abstract sendRequest<\n RequestBody extends HttpMessageBody,\n ResponseBody extends HttpMessageBody,\n >(request: HttpRequest<RequestBody>): Promise<HttpResponse<ResponseBody>>;\n\n protected getUrl<RequestBody extends HttpMessageBody>(\n request: HttpRequest<RequestBody>,\n ): {\n urlWithoutQueryParams: string;\n queryParams: URLSearchParams;\n } {\n const url = new URL(`${this.baseUrl}${request.url}`);\n const urlWithoutQueryParams = `${url.origin}${url.pathname}`;\n const queryParams = new URLSearchParams();\n // Extract query parameters\n url.searchParams.forEach((value, key) => {\n queryParams.append(key, value);\n });\n return {\n urlWithoutQueryParams,\n queryParams,\n };\n }\n\n protected getHeaders<RequestBody extends HttpRequestBody>(\n request: HttpRequest<RequestBody>,\n ): HttpHeaders {\n let requestHeaders: HttpHeaders = {\n [HttpHeader.ACCEPT]: MediaType.APPLICATION_JSON,\n };\n\n if (request.authentication) {\n this.populateAuthentication(request.authentication, requestHeaders);\n }\n\n if (request.body) {\n switch (request.headers?.[\"Content-Type\"]) {\n case \"text/csv\":\n requestHeaders[HttpHeader.CONTENT_TYPE] = MediaType.TEXT_CSV;\n break;\n\n default:\n requestHeaders[HttpHeader.CONTENT_TYPE] = MediaType.APPLICATION_JSON;\n break;\n }\n }\n if (request.headers) {\n requestHeaders = { ...requestHeaders, ...request.headers };\n }\n return requestHeaders;\n }\n\n private populateAuthentication(\n authentication: Authentication,\n headers: HttpHeaders,\n ): void {\n this.authenticationConverter.convert(authentication, headers);\n }\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/delegating-authentication-converter.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport type { HttpHeaders } from \"./http-headers.js\";\nimport { HttpHeader } from \"./http-header.js\";\nimport type {\n Authentication,\n BasicAuthentication,\n BearerTokenAuthentication,\n} from \"../../authentication/index.js\";\nimport { AuthenticationType } from \"../../authentication/index.js\";\n\nexport class DelegatingAuthenticationConverter implements AuthenticationConverter<Authentication> {\n private readonly converters: Record<\n AuthenticationType,\n AuthenticationConverter<any>\n >;\n\n constructor(\n bearerTokenConverter = new BearerTokenAuthenticationConverter(),\n basicTokenConverter = new BasicTokenAuthenticationConverter(),\n ) {\n this.converters = {\n [AuthenticationType.BEARER_TOKEN]: bearerTokenConverter,\n [AuthenticationType.BASIC]: basicTokenConverter,\n };\n }\n\n convert(authentication: Authentication, headers: HttpHeaders): HttpHeaders {\n const converter = this.converters[authentication.type];\n return converter.convert(authentication, headers);\n }\n}\n\nclass BearerTokenAuthenticationConverter implements AuthenticationConverter<BearerTokenAuthentication> {\n convert(\n authentication: BearerTokenAuthentication,\n headers: HttpHeaders,\n ): HttpHeaders {\n headers[HttpHeader.AUTHORIZATION] = `Bearer ${authentication.token}`;\n return headers;\n }\n}\n\nclass BasicTokenAuthenticationConverter implements AuthenticationConverter<BasicAuthentication> {\n convert(\n authentication: BasicAuthentication,\n headers: HttpHeaders,\n ): HttpHeaders {\n const credentials = `${authentication.username}:${authentication.password}`;\n const encoded = Buffer.from(credentials).toString(\"base64\");\n headers[HttpHeader.AUTHORIZATION] = `Basic ${encoded}`;\n return headers;\n }\n}\n\ntype AuthenticationConverter<T extends Authentication> = {\n convert: (authentication: T, headers: HttpHeaders) => HttpHeaders;\n};\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/http-error.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport class HttpError extends Error {\n private readonly status: number;\n private readonly responseBody: unknown;\n\n constructor(\n private readonly requestBody: unknown,\n params: HttpErrorParams,\n ) {\n const status = params.status || 500;\n const responseBody = Buffer.isBuffer(params.responseBody)\n ? params.responseBody.toString()\n : params.responseBody;\n\n super(\n JSON.stringify({\n response: {\n status: status,\n body: responseBody,\n },\n request: {\n body: requestBody,\n },\n }),\n );\n\n this.status = status;\n this.responseBody = responseBody;\n }\n\n public errorMessage() {\n return {\n response: {\n status: this.status,\n body: this.responseBody,\n },\n request: {\n body: this.requestBody,\n },\n };\n }\n\n get response() {\n return {\n status: this.status,\n body: this.responseBody,\n };\n }\n\n get request() {\n return {\n body: this.requestBody,\n };\n }\n}\n\nexport function toFailsafeOutput({ error, requestBody }: FailsafeOutputParams) {\n if (error instanceof HttpError) {\n return error.errorMessage();\n }\n return {\n response: {\n status: 0,\n body: error instanceof Error ? error.message : String(error),\n },\n request: {\n body: requestBody,\n },\n };\n}\n\nexport type HttpErrorParams = {\n status: number;\n responseBody: unknown;\n};\n\nexport type FailsafeOutputParams = {\n error: unknown;\n requestBody: unknown;\n};\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/http-method.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport enum HttpMethod {\n GET = \"GET\",\n POST = \"POST\",\n PATCH = \"PATCH\",\n PUT = \"PUT\",\n DELETE = \"DELETE\",\n HEAD = \"HEAD\",\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/fetch-http-client.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport { PassThrough, Readable } from \"node:stream\";\nimport { tryCatchSync } from \"../../../../core-utils/index.js\";\nimport { BaseHttpClient } from \"./base-http-client.js\";\nimport { DelegatingAuthenticationConverter } from \"./delegating-authentication-converter.js\";\nimport { HttpError } from \"./http-error.js\";\nimport type { HttpHeaders } from \"./http-headers.js\";\nimport type { HttpMessageBody } from \"./http-message-body.js\";\nimport { HttpMethod } from \"./http-method.js\";\nimport type { HttpRequest } from \"./http-request.js\";\nimport type { HttpRequestBody } from \"./http-request-body.js\";\nimport type { HttpResponse } from \"./http-response.js\";\n\n// Native-fetch implementation of HttpClient. SSRF egress is enforced by the engine's\n// in-process dns.lookup / Socket.connect guards (see ssrf-guard.ts) when\n// AP_NETWORK_MODE=STRICT, which cover fetch via net.connect — so there is no egress\n// proxy wiring here. A caller may still pass options.dispatcher for a user-configured\n// per-request proxy (the HTTP piece's \"Use Proxy\" feature).\nexport class FetchHttpClient extends BaseHttpClient {\n constructor(\n baseUrl = \"\",\n authenticationConverter: DelegatingAuthenticationConverter = new DelegatingAuthenticationConverter(),\n ) {\n super(baseUrl, authenticationConverter);\n }\n\n async sendRequest<ResponseBody extends HttpMessageBody = any>(\n request: HttpRequest<HttpRequestBody>,\n options?: SendRequestOptions,\n ): Promise<HttpResponse<ResponseBody>> {\n const { urlWithoutQueryParams, queryParams: urlQueryParams } =\n this.getUrl(request);\n const headers = this.getHeaders(request);\n const queryParams = request.queryParams ?? {};\n for (const [key, value] of Object.entries(queryParams)) {\n urlQueryParams.append(key, value);\n }\n const queryString = urlQueryParams.toString();\n const finalUrl = queryString\n ? `${urlWithoutQueryParams}?${queryString}`\n : urlWithoutQueryParams;\n\n const responseType = request.responseType ?? \"json\";\n const followRedirects = request.followRedirects ?? true;\n const retries = request.retries ?? 0;\n\n const { body, extraHeaders, isStream } = acceptsRequestBody(request.method)\n ? serializeBody(request.body, headers)\n : { body: undefined, extraHeaders: {}, isStream: false };\n const finalHeaders = normalizeHeaders({ ...headers, ...extraHeaders });\n\n const response = await sendWithRetries(\n async () => {\n const controller = new AbortController();\n const timeoutId =\n request.timeout && request.timeout > 0\n ? setTimeout(() => controller.abort(), request.timeout)\n : undefined;\n try {\n const init: FetchInit = {\n method: request.method.toString(),\n headers: finalHeaders,\n body,\n redirect: followRedirects ? \"follow\" : \"manual\",\n signal: controller.signal,\n };\n if (isStream) {\n init.duplex = \"half\";\n }\n // A caller-supplied undici Dispatcher (e.g. a ProxyAgent) for per-request proxying.\n if (options?.dispatcher !== undefined) {\n init.dispatcher = options.dispatcher;\n }\n return await fetch(finalUrl, init);\n } finally {\n if (timeoutId !== undefined) {\n clearTimeout(timeoutId);\n }\n }\n },\n isStream ? 0 : retries,\n );\n\n const successCeiling = followRedirects ? 300 : 400;\n if (response.status < 200 || response.status >= successCeiling) {\n // A stream response can't carry an error message usefully; read the error body as text.\n const errorBody = await parseResponseBody(\n response,\n responseType === \"stream\" ? \"text\" : responseType,\n );\n const httpError = new HttpError(request.body, {\n status: response.status,\n responseBody: errorBody,\n });\n throw httpError;\n }\n\n const responseBody = await parseResponseBody(response, responseType);\n return {\n status: response.status,\n headers: toHttpHeaders(response.headers),\n body: responseBody as ResponseBody,\n };\n }\n}\n\nexport function acceptsRequestBody(method: HttpMethod): boolean {\n return method !== HttpMethod.GET && method !== HttpMethod.HEAD;\n}\n\nfunction serializeBody(\n body: HttpRequestBody | undefined,\n headers: HttpHeaders,\n): {\n body: BodyInit | undefined;\n extraHeaders: Record<string, string>;\n isStream: boolean;\n} {\n if (isNil(body)) {\n return { body: undefined, extraHeaders: {}, isStream: false };\n }\n if (isNodeFormData(body)) {\n // A buffered multipart body lets undici send Content-Length; a streamed one is sent\n // chunked without a length, which strict multipart parsers reject with a 500. Streaming\n // with an explicit content-length header is not an option: undici stalls or throws\n // RequestContentLengthMismatchError on stream bodies that carry one.\n const buffered = bufferFormDataIfSafe(body);\n if (buffered !== null) {\n return {\n body: buffered as unknown as BodyInit,\n extraHeaders: body.getHeaders(),\n isStream: false,\n };\n }\n const stream = new PassThrough();\n body.on(\"error\", (error) => stream.destroy(error));\n body.pipe(stream);\n return {\n body: stream as unknown as BodyInit,\n extraHeaders: body.getHeaders(),\n isStream: true,\n };\n }\n if (body instanceof Readable) {\n return {\n body: body as unknown as BodyInit,\n extraHeaders: {},\n isStream: true,\n };\n }\n // Already a wire-ready body — pass through untouched.\n if (\n typeof body === \"string\" ||\n Buffer.isBuffer(body) ||\n body instanceof URLSearchParams ||\n body instanceof ArrayBuffer ||\n (typeof FormData !== \"undefined\" && body instanceof FormData) ||\n (typeof Blob !== \"undefined\" && body instanceof Blob)\n ) {\n return { body: body as BodyInit, extraHeaders: {}, isStream: false };\n }\n const contentType = headers[\"Content-Type\"] ?? headers[\"content-type\"] ?? \"\";\n if (contentType.includes(\"application/x-www-form-urlencoded\")) {\n return {\n body: new URLSearchParams(body as Record<string, string>).toString(),\n extraHeaders: {},\n isStream: false,\n };\n }\n return { body: JSON.stringify(body), extraHeaders: {}, isStream: false };\n}\n\nasync function parseResponseBody(\n response: Response,\n responseType: ResponseType,\n): Promise<unknown> {\n switch (responseType) {\n case \"arraybuffer\":\n return Buffer.from(await response.arrayBuffer());\n case \"stream\":\n // undici streams a Node web ReadableStream body; the DOM fetch types omit the fromWeb overload\n return isNil(response.body)\n ? Readable.from([])\n : Readable.fromWeb(\n response.body as unknown as Parameters<typeof Readable.fromWeb>[0],\n );\n case \"blob\":\n return await response.blob();\n case \"text\":\n return await response.text();\n case \"json\":\n default: {\n const text = await response.text();\n if (text.length === 0) {\n return undefined;\n }\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n }\n }\n}\n\nasync function sendWithRetries(\n fn: () => Promise<Response>,\n retries: number,\n): Promise<Response> {\n let lastError: unknown;\n for (let attempt = 0; attempt <= retries; attempt++) {\n try {\n const response = await fn();\n if (response.status >= 500 && attempt < retries) {\n await backoff(attempt);\n continue;\n }\n return response;\n } catch (error) {\n lastError = error;\n if (attempt < retries) {\n await backoff(attempt);\n continue;\n }\n throw error;\n }\n }\n throw lastError;\n}\n\nfunction backoff(attempt: number): Promise<void> {\n const delayMs = Math.min(1000 * 2 ** attempt, 30000);\n return new Promise((resolve) => setTimeout(resolve, delayMs));\n}\n\nfunction normalizeHeaders(headers: HttpHeaders): Record<string, string> {\n const entriesByLowerCaseKey = new Map<string, [string, string]>();\n for (const [key, value] of Object.entries(headers)) {\n if (value === undefined) {\n continue;\n }\n entriesByLowerCaseKey.set(key.toLowerCase(), [\n key,\n Array.isArray(value) ? value.join(\", \") : value,\n ]);\n }\n return Object.fromEntries(entriesByLowerCaseKey.values());\n}\n\nfunction toHttpHeaders(headers: Headers): HttpHeaders {\n const result: Record<string, string> = {};\n headers.forEach((value, key) => {\n result[key] = value;\n });\n return result;\n}\n\nfunction bufferFormDataIfSafe(body: NodeFormData): Buffer | null {\n if (\n !body.hasKnownLength() ||\n body.getLengthSync() > MAX_BUFFERED_FORM_DATA_BYTES\n ) {\n return null;\n }\n // getBuffer throws on stream parts appended with an explicit knownLength; fall back to streaming.\n const { data } = tryCatchSync(() => body.getBuffer());\n return data;\n}\n\nfunction isNodeFormData(body: unknown): body is NodeFormData {\n return (\n typeof body === \"object\" &&\n body !== null &&\n typeof (body as NodeFormData).getHeaders === \"function\" &&\n typeof (body as NodeFormData).pipe === \"function\" &&\n typeof (body as NodeFormData).on === \"function\"\n );\n}\n\nfunction isNil(value: unknown): value is null | undefined {\n return value === null || value === undefined;\n}\n\ntype NodeFormData = {\n getHeaders: () => Record<string, string>;\n pipe: (...args: unknown[]) => unknown;\n on: (event: \"error\", listener: (error: Error) => void) => unknown;\n hasKnownLength: () => boolean;\n getLengthSync: () => number;\n getBuffer: () => Buffer;\n};\n\nconst MAX_BUFFERED_FORM_DATA_BYTES = 100 * 1024 * 1024;\n\ntype ResponseType = NonNullable<HttpRequest[\"responseType\"]>;\n\ntype FetchInit = RequestInit & { duplex?: \"half\"; dispatcher?: unknown };\n\nexport type SendRequestOptions = {\n dispatcher?: unknown;\n};\n\nexport { FetchHttpClient as AxiosHttpClient };\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/http-client.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport type { SendRequestOptions } from \"./fetch-http-client.js\";\nimport { FetchHttpClient } from \"./fetch-http-client.js\";\nimport type { HttpMessageBody } from \"./http-message-body.js\";\nimport type { HttpRequest } from \"./http-request.js\";\nimport type { HttpRequestBody } from \"./http-request-body.js\";\nimport type { HttpResponse } from \"./http-response.js\";\n\nexport type HttpClient = {\n sendRequest<\n RequestBody extends HttpRequestBody,\n ResponseBody extends HttpMessageBody,\n >(\n request: HttpRequest<RequestBody>,\n options?: SendRequestOptions,\n ): Promise<HttpResponse<ResponseBody>>;\n};\n\nexport const httpClient = new FetchHttpClient();\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/helpers/index.ts. MIT; see ../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport type {\n ActionClassification,\n OAuth2PropertyValue,\n PieceAuthProperty,\n StaticDropdownProperty,\n StaticPropsValue,\n InputPropertyMap,\n FilesService,\n AppConnectionValueForAuthProperty,\n ExtractPieceAuthPropertyTypeForMethods,\n ApFile,\n} from \"../../../framework/index.js\";\nimport { Property, createAction } from \"../../../framework/index.js\";\nimport type { HttpHeaders, HttpRequest, QueryParams } from \"../http/index.js\";\nimport {\n HttpMethod,\n acceptsRequestBody,\n httpClient,\n toFailsafeOutput,\n} from \"../http/index.js\";\nimport {\n assertNotNullOrUndefined,\n isEmpty,\n isNil,\n} from \"../../../core-utils/index.js\";\nimport fs from \"node:fs\";\n// Self-contained content-type → file-extension lookup, replacing the heavy\n// `mime-types`/`mime-db` dependency (~134 KB inlined into every piece bundle).\n// Covers the common types returned for binary HTTP responses; unknown → ''.\nconst CONTENT_TYPE_EXTENSIONS: Record<string, string> = {\n \"application/json\": \"json\",\n \"application/pdf\": \"pdf\",\n \"application/xml\": \"xml\",\n \"text/xml\": \"xml\",\n \"application/zip\": \"zip\",\n \"application/gzip\": \"gz\",\n \"application/x-tar\": \"tar\",\n \"application/octet-stream\": \"bin\",\n \"application/msword\": \"doc\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\":\n \"docx\",\n \"application/vnd.ms-excel\": \"xls\",\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\": \"xlsx\",\n \"application/vnd.ms-powerpoint\": \"ppt\",\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation\":\n \"pptx\",\n \"application/rtf\": \"rtf\",\n \"application/javascript\": \"js\",\n \"application/x-www-form-urlencoded\": \"bin\",\n \"text/plain\": \"txt\",\n \"text/html\": \"html\",\n \"text/css\": \"css\",\n \"text/csv\": \"csv\",\n \"text/calendar\": \"ics\",\n \"text/markdown\": \"md\",\n \"image/png\": \"png\",\n \"image/jpeg\": \"jpeg\",\n \"image/jpg\": \"jpg\",\n \"image/gif\": \"gif\",\n \"image/webp\": \"webp\",\n \"image/svg+xml\": \"svg\",\n \"image/bmp\": \"bmp\",\n \"image/tiff\": \"tiff\",\n \"image/x-icon\": \"ico\",\n \"image/vnd.microsoft.icon\": \"ico\",\n \"image/heic\": \"heic\",\n \"audio/mpeg\": \"mp3\",\n \"audio/mp4\": \"m4a\",\n \"audio/wav\": \"wav\",\n \"audio/x-wav\": \"wav\",\n \"audio/ogg\": \"ogg\",\n \"audio/webm\": \"weba\",\n \"video/mp4\": \"mp4\",\n \"video/mpeg\": \"mpeg\",\n \"video/webm\": \"webm\",\n \"video/quicktime\": \"mov\",\n \"video/x-msvideo\": \"avi\",\n \"font/woff\": \"woff\",\n \"font/woff2\": \"woff2\",\n \"font/ttf\": \"ttf\",\n \"font/otf\": \"otf\",\n};\n\nfunction contentTypeToExtension(contentType: string): string {\n const type = contentType.split(\";\")[0].trim().toLowerCase();\n return CONTENT_TYPE_EXTENSIONS[type] ?? \"\";\n}\nimport FormData from \"form-data\";\n\nexport const getAccessTokenOrThrow = (\n auth: OAuth2PropertyValue | undefined,\n): string => {\n const accessToken = auth?.access_token;\n\n if (accessToken === undefined) {\n throw new Error(\"Invalid bearer token\");\n }\n\n return accessToken;\n};\nconst joinBaseUrlWithRelativePath = ({\n baseUrl,\n relativePath,\n}: {\n baseUrl: string;\n relativePath: string;\n}) => {\n const baseUrlWithSlash = baseUrl.endsWith(\"/\") ? baseUrl : `${baseUrl}/`;\n const relativePathWithoutSlash = relativePath.startsWith(\"/\")\n ? relativePath.slice(1)\n : relativePath;\n return `${baseUrlWithSlash}${relativePathWithoutSlash}`;\n};\n\nconst getBaseUrlForDescription = <\n PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined,\n>(\n baseUrl: BaseUrlGetter<PieceAuth>,\n auth?: AppConnectionValueForAuthProperty<\n ExtractPieceAuthPropertyTypeForMethods<PieceAuth>\n >,\n) => {\n const exampleBaseUrl = `https://api.example.com`;\n try {\n const baseUrlValue = auth ? baseUrl(auth) : undefined;\n const baseUrlValueWithoutTrailingSlash = baseUrlValue?.endsWith(\"/\")\n ? baseUrlValue.slice(0, -1)\n : baseUrlValue;\n return baseUrlValueWithoutTrailingSlash ?? exampleBaseUrl;\n } catch (error) {\n //If baseUrl fails we stil want to return a valid baseUrl for description\n {\n return exampleBaseUrl;\n }\n }\n};\ntype BaseUrlGetter<\n PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined,\n> = (\n auth?: AppConnectionValueForAuthProperty<\n ExtractPieceAuthPropertyTypeForMethods<PieceAuth>\n >,\n) => string;\nexport function createCustomApiCallAction<\n PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined,\n>({\n auth,\n baseUrl,\n authMapping,\n description,\n displayName,\n name,\n props,\n extraProps,\n authLocation = \"headers\",\n classification = \"WRITE\",\n}: {\n auth?: PieceAuth;\n baseUrl: BaseUrlGetter<PieceAuth>;\n authMapping?: (\n auth: AppConnectionValueForAuthProperty<\n ExtractPieceAuthPropertyTypeForMethods<PieceAuth>\n >,\n propsValue: StaticPropsValue<any>,\n ) => Promise<HttpHeaders | QueryParams>;\n // add description as a parameter that can be null\n description?: string | null;\n displayName?: string | null;\n name?: string | null;\n props?: {\n url?: Partial<ReturnType<typeof Property.ShortText>>;\n method?: Partial<StaticDropdownProperty<HttpMethod, boolean>>;\n headers?: Partial<ReturnType<typeof Property.Object>>;\n queryParams?: Partial<ReturnType<typeof Property.Object>>;\n body?: Partial<ReturnType<typeof Property.Json>>;\n response_is_binary?: Partial<ReturnType<typeof Property.Checkbox>>;\n failsafe?: Partial<ReturnType<typeof Property.Checkbox>>;\n timeout?: Partial<ReturnType<typeof Property.Number>>;\n followRedirects?: Partial<ReturnType<typeof Property.Checkbox>>;\n };\n extraProps?: InputPropertyMap;\n authLocation?: \"headers\" | \"queryParams\";\n // The method is caller-supplied at runtime, so a single tag has to assume mutation.\n classification?: ActionClassification;\n}) {\n return createAction({\n audience: \"human\",\n name: name ? name : \"custom_api_call\",\n classification,\n displayName: displayName ? displayName : \"Custom API Call\",\n description: description\n ? description\n : \"Make a custom API call to a specific endpoint\",\n auth,\n requireAuth: auth ? true : false,\n props: {\n url: Property.DynamicProperties({\n auth,\n displayName: \"\",\n required: true,\n refreshers: [],\n props: async ({ auth }) => {\n return {\n url: Property.ShortText({\n displayName: \"URL\",\n description: `Full URL, or a path relative to ${getBaseUrlForDescription(baseUrl, auth)}`,\n required: true,\n placeholder: \"/resource\",\n defaultValue: auth ? baseUrl(auth) : \"\",\n ...(props?.url ?? {}),\n }),\n };\n },\n }),\n method: Property.StaticDropdown({\n displayName: \"Method\",\n required: true,\n defaultValue: HttpMethod.GET,\n options: {\n options: Object.values(HttpMethod).map((v) => {\n return {\n label: v,\n value: v,\n };\n }),\n },\n ...(props?.method ?? {}),\n }),\n headers: Property.Object({\n displayName: \"Headers\",\n description:\n \"Authorization headers are injected automatically from your connection.\",\n required: false,\n ...(props?.headers ?? {}),\n }),\n queryParams: Property.Object({\n displayName: \"Query Parameters\",\n description: \"Appended to the URL as ?key=value.\",\n required: false,\n ...(props?.queryParams ?? {}),\n }),\n body_type: Property.Dropdown({\n auth,\n displayName: \"Body Type\",\n required: false,\n defaultValue: \"none\",\n refreshers: [\"method\"],\n options: async ({ method }) => {\n if (!acceptsRequestBody(method as HttpMethod)) {\n return {\n disabled: true,\n placeholder: \"Not available for GET or HEAD requests\",\n options: [],\n };\n }\n return {\n disabled: false,\n options: [\n { label: \"None\", value: \"none\" },\n { label: \"JSON\", value: \"json\" },\n { label: \"Form Data\", value: \"form_data\" },\n { label: \"Raw\", value: \"raw\" },\n ],\n };\n },\n }),\n body: Property.DynamicProperties({\n auth,\n displayName: \"Body\",\n refreshers: [\"body_type\", \"method\"],\n required: false,\n props: async ({ body_type, method }) => {\n if (!body_type || !acceptsRequestBody(method as HttpMethod))\n return {};\n\n const bodyTypeInput = body_type as unknown as string;\n\n const fields: InputPropertyMap = {};\n\n switch (bodyTypeInput) {\n case \"none\":\n break;\n case \"json\":\n fields[\"data\"] = Property.Json({\n displayName: \"JSON Body\",\n required: true,\n ...(props?.body ?? {}),\n });\n break;\n case \"raw\":\n fields[\"data\"] = Property.LongText({\n displayName: \"Raw Body\",\n required: true,\n });\n break;\n case \"form_data\":\n fields[\"data\"] = Property.Array({\n displayName: \"Form Data\",\n required: true,\n properties: {\n fieldName: Property.ShortText({\n displayName: \"Field Name\",\n required: true,\n }),\n fieldType: Property.StaticDropdown({\n displayName: \"Field Type\",\n required: true,\n options: {\n disabled: false,\n options: [\n { label: \"Text\", value: \"text\" },\n { label: \"File\", value: \"file\" },\n ],\n },\n }),\n textFieldValue: Property.LongText({\n displayName: \"Text Field Value\",\n required: false,\n }),\n fileFieldValue: Property.File({\n displayName: \"File Field Value\",\n required: false,\n }),\n },\n });\n break;\n }\n return fields;\n },\n }),\n response_is_binary: Property.Checkbox({\n displayName: \"Response is Binary\",\n description: \"Enable for files like PDFs, images, etc.\",\n required: false,\n defaultValue: false,\n advanced: true,\n ...(props?.response_is_binary ?? {}),\n }),\n failsafe: Property.Checkbox({\n displayName: \"Return Error as Output\",\n description:\n \"On a failed request, output the error instead of failing the step.\",\n required: false,\n advanced: true,\n ...(props?.failsafe ?? {}),\n }),\n timeout: Property.Number({\n displayName: \"Timeout\",\n description:\n \"Seconds to wait for a response. Empty: up to the flow limit (10 min).\",\n required: false,\n advanced: true,\n ...(props?.timeout ?? {}),\n }),\n followRedirects: Property.Checkbox({\n displayName: \"Follow redirects\",\n description:\n \"Follow 3xx redirects instead of returning them as the response.\",\n required: false,\n defaultValue: false,\n advanced: true,\n ...(props?.followRedirects ?? {}),\n }),\n ...extraProps,\n },\n\n run: async (context) => {\n const {\n method,\n url,\n headers,\n queryParams,\n body,\n body_type,\n failsafe,\n timeout,\n response_is_binary,\n followRedirects,\n } = context.propsValue;\n assertNotNullOrUndefined(method, \"Method\");\n assertNotNullOrUndefined(url, \"URL\");\n\n const authValue = !isNil(authMapping)\n ? await authMapping(context.auth, context.propsValue)\n : {};\n\n const urlValue = url[\"url\"] as string;\n const fullUrl =\n urlValue.startsWith(\"http://\") || urlValue.startsWith(\"https://\")\n ? urlValue\n : joinBaseUrlWithRelativePath({\n baseUrl: baseUrl(context.auth),\n relativePath: urlValue,\n });\n const request: HttpRequest = {\n method,\n url: fullUrl,\n headers: {\n ...((headers ?? {}) as HttpHeaders),\n ...(authLocation === \"headers\" ? authValue : {}),\n },\n queryParams: {\n ...(authLocation === \"queryParams\" ? (authValue as QueryParams) : {}),\n ...((queryParams as QueryParams) ?? {}),\n },\n timeout: timeout ? timeout * 1000 : 0,\n followRedirects,\n };\n\n // Set response type to arraybuffer if binary response is expected\n if (response_is_binary) {\n request.responseType = \"arraybuffer\";\n }\n\n if (body) {\n if (body_type && body_type !== \"none\") {\n const bodyInput = body[\"data\"];\n if (body_type === \"form_data\") {\n const formBodyInput = bodyInput as Array<{\n fieldName: string;\n fieldType: \"text\" | \"file\";\n textFieldValue?: string;\n fileFieldValue?: ApFile;\n }>;\n\n const formData = new FormData();\n\n for (const {\n fieldName,\n fieldType,\n textFieldValue,\n fileFieldValue,\n } of formBodyInput) {\n if (fieldType === \"text\" && !isEmpty(textFieldValue)) {\n formData.append(fieldName, textFieldValue);\n } else if (fieldType === \"file\" && !isEmpty(fileFieldValue)) {\n formData.append(fieldName, fileFieldValue!.data, {\n filename: fileFieldValue?.filename,\n });\n }\n }\n request.body = formData;\n request.headers = { ...request.headers, ...formData.getHeaders() };\n } else {\n request.body = bodyInput;\n }\n } else if (!body_type) {\n request.body = body;\n }\n }\n\n try {\n const response = await httpClient.sendRequest(request);\n return await handleBinaryResponse(\n context.files,\n response.body,\n response.status,\n response.headers,\n response_is_binary,\n );\n } catch (error) {\n if (failsafe) {\n return toFailsafeOutput({ error, requestBody: request.body });\n }\n throw error;\n }\n },\n });\n}\n\nexport function is_chromium_installed(): boolean {\n const chromiumPath = \"/usr/bin/chromium\";\n return fs.existsSync(chromiumPath);\n}\n\nconst handleBinaryResponse = async (\n files: FilesService,\n bodyContent: string | ArrayBuffer | Buffer,\n status: number,\n headers?: HttpHeaders,\n isBinary?: boolean,\n) => {\n let body;\n\n if (isBinary && isBinaryBody(bodyContent)) {\n const contentTypeValue = Array.isArray(headers?.[\"content-type\"])\n ? headers[\"content-type\"][0]\n : headers?.[\"content-type\"];\n const fileExtension: string =\n contentTypeToExtension(contentTypeValue ?? \"\") || \"txt\";\n\n let bufferData: Buffer;\n if (bodyContent instanceof ArrayBuffer) {\n bufferData = Buffer.from(new Uint8Array(bodyContent));\n } else if (Buffer.isBuffer(bodyContent)) {\n bufferData = bodyContent;\n } else {\n bufferData = Buffer.from(bodyContent);\n }\n\n body = await files.write({\n fileName: `output.${fileExtension}`,\n data: bufferData,\n });\n } else {\n body = bodyContent;\n }\n\n return { status, headers, body };\n};\n\nconst isBinaryBody = (body: string | ArrayBuffer | Buffer) => {\n return body instanceof ArrayBuffer || Buffer.isBuffer(body);\n};\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/polling/index.ts. MIT; see ../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport type {\n AppConnectionValueForAuthProperty,\n FilesService,\n ServerContext,\n Store,\n} from \"../../../framework/index.js\";\nimport { isNil } from \"../../../core-utils/index.js\";\n\ninterface TimebasedPolling<AuthValue, PropsValue> {\n strategy: DedupeStrategy.TIMEBASED;\n items: (params: {\n auth: AuthValue;\n store: Store;\n propsValue: PropsValue;\n lastFetchEpochMS: number;\n server?: ServerContext;\n }) => Promise<\n {\n epochMilliSeconds: number;\n data: unknown;\n }[]\n >;\n}\n\ninterface LastItemPolling<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n> {\n strategy: DedupeStrategy.LAST_ITEM;\n items: (params: {\n auth: AuthValue;\n store: Store;\n files?: FilesService;\n propsValue: PropsValue;\n lastItemId: unknown;\n server?: ServerContext;\n }) => Promise<\n {\n id: unknown;\n data: unknown;\n }[]\n >;\n}\n\nexport enum DedupeStrategy {\n TIMEBASED,\n LAST_ITEM,\n}\n\nexport type Polling<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n> =\n | TimebasedPolling<AuthValue, PropsValue>\n | LastItemPolling<AuthValue, PropsValue>;\n\nexport const pollingHelper = {\n async poll<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n >(\n polling: Polling<AuthValue, PropsValue>,\n {\n store,\n auth,\n propsValue,\n maxItemsToPoll,\n files,\n server,\n }: {\n store: Store;\n auth: AuthValue;\n propsValue: PropsValue;\n files: FilesService;\n maxItemsToPoll?: number;\n server?: ServerContext;\n },\n ): Promise<unknown[]> {\n switch (polling.strategy) {\n case DedupeStrategy.TIMEBASED: {\n const lastEpochMilliSeconds = await store.get<number>(\"lastPoll\");\n if (isNil(lastEpochMilliSeconds)) {\n throw new Error(\"lastPoll doesn't exist in the store.\");\n }\n const items = await polling.items({\n store,\n auth,\n propsValue,\n lastFetchEpochMS: lastEpochMilliSeconds,\n server,\n });\n const newLastEpochMilliSeconds = items.reduce(\n (acc, item) => Math.max(acc, item.epochMilliSeconds),\n lastEpochMilliSeconds,\n );\n await store.put(\"lastPoll\", newLastEpochMilliSeconds);\n return items\n .filter((f) => f.epochMilliSeconds > lastEpochMilliSeconds)\n .map((item) => item.data);\n }\n case DedupeStrategy.LAST_ITEM: {\n const lastItemId = await store.get<unknown>(\"lastItem\");\n const items = await polling.items({\n store,\n auth,\n propsValue,\n lastItemId,\n files,\n server,\n });\n\n const lastItemIndex = items.findIndex((f) => f.id === lastItemId);\n let newItems = [];\n if (isNil(lastItemId) || lastItemIndex == -1) {\n newItems = items ?? [];\n } else {\n newItems = items?.slice(0, lastItemIndex) ?? [];\n }\n // Sorted from newest to oldest\n if (!isNil(maxItemsToPoll)) {\n // Get the last polling.maxItemsToPoll items\n newItems = newItems.slice(-maxItemsToPoll);\n }\n const newLastItem = newItems?.[0]?.id;\n if (!isNil(newLastItem)) {\n await store.put(\"lastItem\", newLastItem);\n }\n return newItems.map((item) => item.data);\n }\n }\n },\n async onEnable<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n >(\n polling: Polling<AuthValue, PropsValue>,\n {\n store,\n auth,\n propsValue,\n server,\n isRepublish,\n }: {\n store: Store;\n auth: AuthValue;\n propsValue: PropsValue;\n server?: ServerContext;\n isRepublish?: boolean;\n },\n ): Promise<void> {\n switch (polling.strategy) {\n case DedupeStrategy.TIMEBASED: {\n if (isRepublish && !isNil(await store.get<number>(\"lastPoll\"))) {\n break;\n }\n await store.put(\"lastPoll\", Date.now());\n break;\n }\n case DedupeStrategy.LAST_ITEM: {\n if (isRepublish && !isNil(await store.get(\"lastItem\"))) {\n break;\n }\n const items = await polling.items({\n store,\n auth,\n propsValue,\n lastItemId: null,\n server,\n });\n const lastItemId = items?.[0]?.id;\n if (!isNil(lastItemId)) {\n await store.put(\"lastItem\", lastItemId);\n } else {\n await store.delete(\"lastItem\");\n }\n break;\n }\n }\n },\n async onDisable<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n >(\n polling: Polling<AuthValue, PropsValue>,\n params: { store: Store; auth: AuthValue; propsValue: PropsValue },\n ): Promise<void> {\n switch (polling.strategy) {\n case DedupeStrategy.TIMEBASED:\n case DedupeStrategy.LAST_ITEM:\n return;\n }\n },\n async test<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n >(\n polling: Polling<AuthValue, PropsValue>,\n {\n auth,\n propsValue,\n store,\n files,\n server,\n }: {\n store: Store;\n auth: AuthValue;\n propsValue: PropsValue;\n files: FilesService;\n server?: ServerContext;\n },\n ): Promise<unknown[]> {\n let items = [];\n switch (polling.strategy) {\n case DedupeStrategy.TIMEBASED: {\n items = await polling.items({\n store,\n auth,\n propsValue,\n lastFetchEpochMS: 0,\n server,\n });\n break;\n }\n case DedupeStrategy.LAST_ITEM: {\n items = await polling.items({\n store,\n auth,\n propsValue,\n lastItemId: null,\n files,\n server,\n });\n break;\n }\n }\n return getFirstFiveOrAll(items.map((item) => item.data));\n },\n};\n\nfunction getFirstFiveOrAll(array: unknown[]) {\n if (array.length <= 5) {\n return array;\n } else {\n return array.slice(0, 5);\n }\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/stream/index.ts. MIT; see ../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport { Readable } from \"node:stream\";\nimport type { ApFile, ApStreamingFile } from \"../../../framework/index.js\";\n\nfunction toStreamingBody(file: ApStreamingFile | ApFile): {\n body: Readable;\n size: number | undefined;\n} {\n if (\"body\" in file) {\n return { body: file.body, size: file.size };\n }\n return { body: Readable.from(file.data), size: file.data.length };\n}\n\nasync function* readChunks({\n readable,\n chunkSize,\n}: {\n readable: Readable;\n chunkSize: number;\n}): AsyncGenerator<Buffer> {\n let pending: Buffer[] = [];\n let pendingLength = 0;\n if (!Number.isInteger(chunkSize) || chunkSize <= 0) {\n throw new Error(\"chunkSize must be a positive integer\");\n }\n for await (const data of readable) {\n pending.push(Buffer.isBuffer(data) ? data : Buffer.from(data));\n pendingLength += pending[pending.length - 1].length;\n while (pendingLength >= chunkSize) {\n const combined =\n pending.length === 1 ? pending[0] : Buffer.concat(pending);\n yield combined.subarray(0, chunkSize);\n const rest = combined.subarray(chunkSize);\n pending = rest.length > 0 ? [rest] : [];\n pendingLength = rest.length;\n }\n }\n if (pendingLength > 0) {\n yield pending.length === 1 ? pending[0] : Buffer.concat(pending);\n }\n}\n\nexport const streamUtils = { readChunks, toStreamingBody };\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/validation/index.ts. MIT; see ../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport * as z from \"zod/mini\";\n\nexport const propsValidation = {\n async validateZod<T extends Record<string, unknown>>(\n props: T,\n schema: Partial<Record<keyof T, z.core.$ZodType>>,\n ): Promise<void> {\n const schemaObj = z.object(\n Object.entries(schema).reduce(\n (acc, [key, value]) => ({\n ...acc,\n [key]: value,\n }),\n {},\n ),\n );\n\n const result = await z.safeParseAsync(schemaObj, props);\n if (!result.success) {\n const errors = result.error.issues.reduce<Record<string, string>>(\n (acc, issue) => ({\n ...acc,\n [issue.path.join(\".\")]: issue.message,\n }),\n {},\n );\n throw new Error(JSON.stringify({ errors }, null, 2));\n }\n },\n};\n"],"mappings":";;;;;;;;AAIA,IAAY,qBAAL;CACL;CACA;;AACF;;;;ACLA,IAAY,aAAL;CACL;CACA;CACA;CACA;;AACF;;;;ACLA,IAAY,YAAL;CACL;CACA;;AACF;;;;ACQA,IAAsB,iBAAtB,MAA2D;CAEtC;CACA;CAFnB,YACE,AAAiB,SACjB,AAAiB,yBACjB;EAFiB;EACA;CAChB;CAOH,AAAU,OACR,SAIA;EACA,MAAM,MAAM,IAAI,IAAI,GAAG,KAAK,UAAU,QAAQ,KAAK;EACnD,MAAM,wBAAwB,GAAG,IAAI,SAAS,IAAI;EAClD,MAAM,cAAc,IAAI,gBAAgB;EAExC,IAAI,aAAa,SAAS,OAAO,QAAQ;GACvC,YAAY,OAAO,KAAK,KAAK;EAC/B,CAAC;EACD,OAAO;GACL;GACA;EACF;CACF;CAEA,AAAU,WACR,SACa;EACb,IAAI,iBAA8B,iCAElC;EAEA,IAAI,QAAQ,gBACV,KAAK,uBAAuB,QAAQ,gBAAgB,cAAc;EAGpE,IAAI,QAAQ,MACV,QAAQ,QAAQ,UAAU,iBAA1B;GACE,KAAK;IACH;IACA;GAEF,SACE;EAEJ;EAEF,IAAI,QAAQ,SACV,iBAAiB;GAAE,GAAG;GAAgB,GAAG,QAAQ;EAAQ;EAE3D,OAAO;CACT;CAEA,AAAQ,uBACN,gBACA,SACM;EACN,KAAK,wBAAwB,QAAQ,gBAAgB,OAAO;CAC9D;AACF;;;;AClEA,IAAa,oCAAb,MAAkG;CAChG,AAAiB;CAKjB,YACE,uBAAuB,IAAI,mCAAmC,GAC9D,sBAAsB,IAAI,kCAAkC,GAC5D;EACA,KAAK,aAAa;qBACmB;cACP;EAC9B;CACF;CAEA,QAAQ,gBAAgC,SAAmC;EA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