@powerhousedao/pieces-framework 6.2.3-dev.88 → 6.2.3-dev.90
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/README.md +1 -1
- package/UPSTREAM.md +10 -10
- package/dist/{action-CmHctrqT.d.ts → action-C-O5Jgbl.d.ts} +122 -2
- package/dist/{action-CmHctrqT.d.ts.map → action-C-O5Jgbl.d.ts.map} +1 -1
- package/dist/{authentication-o-4CdAPR.js → authentication-f4cep7Po.js} +10 -3
- package/dist/authentication-f4cep7Po.js.map +1 -0
- package/dist/common.d.ts +3 -2
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +31 -5
- package/dist/common.js.map +1 -1
- package/dist/host.d.ts +1 -1
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +6 -3
- package/dist/host.js.map +1 -1
- package/dist/{index-DABWPk4W.d.ts → index-DZ0aWCvr.d.ts} +45 -2
- package/dist/index-DZ0aWCvr.d.ts.map +1 -0
- package/dist/index.d.ts +47 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +216 -44
- package/dist/index.js.map +1 -1
- package/dist/input-BHkj_oP5.js.map +1 -1
- package/dist/markdown-property-DMfHjEiL.js.map +1 -1
- package/dist/workflow.d.ts +25 -2
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +64 -1
- package/dist/workflow.js.map +1 -1
- package/package.json +11 -11
- package/dist/authentication-o-4CdAPR.js.map +0 -1
- package/dist/index-DABWPk4W.d.ts.map +0 -1
package/dist/common.js
CHANGED
|
@@ -3,7 +3,6 @@ import { c as isNil$1, r as tryCatchSync, s as isEmpty } from "./markdown-proper
|
|
|
3
3
|
import * as z from "zod/mini";
|
|
4
4
|
import { PassThrough, Readable } from "node:stream";
|
|
5
5
|
import fs from "node:fs";
|
|
6
|
-
import FormData$1 from "form-data";
|
|
7
6
|
|
|
8
7
|
//#region upstream/common/lib/authentication/index.ts
|
|
9
8
|
let AuthenticationType = /* @__PURE__ */ function(AuthenticationType) {
|
|
@@ -170,7 +169,8 @@ var FetchHttpClient = class extends BaseHttpClient {
|
|
|
170
169
|
}
|
|
171
170
|
async sendRequest(request, options) {
|
|
172
171
|
const { urlWithoutQueryParams, queryParams: urlQueryParams } = this.getUrl(request);
|
|
173
|
-
const
|
|
172
|
+
const requestHeaders = this.getHeaders(request);
|
|
173
|
+
const headers = isNativeFormData(request.body) ? withoutContentType(requestHeaders) : requestHeaders;
|
|
174
174
|
const queryParams = request.queryParams ?? {};
|
|
175
175
|
for (const [key, value] of Object.entries(queryParams)) urlQueryParams.append(key, value);
|
|
176
176
|
const queryString = urlQueryParams.toString();
|
|
@@ -208,7 +208,7 @@ var FetchHttpClient = class extends BaseHttpClient {
|
|
|
208
208
|
const successCeiling = followRedirects ? 300 : 400;
|
|
209
209
|
if (response.status < 200 || response.status >= successCeiling) {
|
|
210
210
|
const errorBody = await parseResponseBody(response, responseType === "stream" ? "text" : responseType);
|
|
211
|
-
throw new HttpError(request.body, {
|
|
211
|
+
throw new HttpError(request.redactBodyInErrors === true ? REDACTED_BODY : request.body, {
|
|
212
212
|
status: response.status,
|
|
213
213
|
responseBody: errorBody
|
|
214
214
|
});
|
|
@@ -221,6 +221,7 @@ var FetchHttpClient = class extends BaseHttpClient {
|
|
|
221
221
|
};
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
|
+
const REDACTED_BODY = "[redacted]";
|
|
224
225
|
function acceptsRequestBody(method) {
|
|
225
226
|
return method !== "GET" && method !== "HEAD";
|
|
226
227
|
}
|
|
@@ -251,7 +252,7 @@ function serializeBody(body, headers) {
|
|
|
251
252
|
extraHeaders: {},
|
|
252
253
|
isStream: true
|
|
253
254
|
};
|
|
254
|
-
if (typeof body === "string" || Buffer.isBuffer(body) || body instanceof URLSearchParams || body instanceof ArrayBuffer ||
|
|
255
|
+
if (typeof body === "string" || Buffer.isBuffer(body) || body instanceof URLSearchParams || body instanceof ArrayBuffer || isNativeFormData(body) || typeof Blob !== "undefined" && body instanceof Blob) return {
|
|
255
256
|
body,
|
|
256
257
|
extraHeaders: {},
|
|
257
258
|
isStream: false
|
|
@@ -330,6 +331,12 @@ function bufferFormDataIfSafe(body) {
|
|
|
330
331
|
function isNodeFormData(body) {
|
|
331
332
|
return typeof body === "object" && body !== null && typeof body.getHeaders === "function" && typeof body.pipe === "function" && typeof body.on === "function";
|
|
332
333
|
}
|
|
334
|
+
function isNativeFormData(body) {
|
|
335
|
+
return typeof FormData !== "undefined" && body instanceof FormData;
|
|
336
|
+
}
|
|
337
|
+
function withoutContentType(headers) {
|
|
338
|
+
return Object.fromEntries(Object.entries(headers).filter(([key]) => key.toLowerCase() !== "content-type"));
|
|
339
|
+
}
|
|
333
340
|
function isNil(value) {
|
|
334
341
|
return value === null || value === void 0;
|
|
335
342
|
}
|
|
@@ -590,6 +597,24 @@ function createCustomApiCallAction({ auth, baseUrl, authMapping, description, di
|
|
|
590
597
|
}),
|
|
591
598
|
...extraProps
|
|
592
599
|
},
|
|
600
|
+
propertyGroups: [{
|
|
601
|
+
key: "request",
|
|
602
|
+
display: "section",
|
|
603
|
+
label: "Request",
|
|
604
|
+
icon: "send",
|
|
605
|
+
props: [
|
|
606
|
+
"method",
|
|
607
|
+
"url",
|
|
608
|
+
"headers",
|
|
609
|
+
"queryParams"
|
|
610
|
+
]
|
|
611
|
+
}, {
|
|
612
|
+
key: "payload",
|
|
613
|
+
display: "section",
|
|
614
|
+
label: "Data to send",
|
|
615
|
+
icon: "code",
|
|
616
|
+
props: ["body_type", "body"]
|
|
617
|
+
}],
|
|
593
618
|
run: async (context) => {
|
|
594
619
|
const { method, url, headers, queryParams, body, body_type, failsafe, timeout, response_is_binary, followRedirects } = context.propsValue;
|
|
595
620
|
assertNotNullOrUndefined(method, "Method");
|
|
@@ -619,7 +644,8 @@ function createCustomApiCallAction({ auth, baseUrl, authMapping, description, di
|
|
|
619
644
|
const bodyInput = body["data"];
|
|
620
645
|
if (body_type === "form_data") {
|
|
621
646
|
const formBodyInput = bodyInput;
|
|
622
|
-
const
|
|
647
|
+
const { default: FormData } = await import("form-data");
|
|
648
|
+
const formData = new FormData();
|
|
623
649
|
for (const { fieldName, fieldType, textFieldValue, fileFieldValue } of formBodyInput) if (fieldType === "text" && !isEmpty(textFieldValue)) formData.append(fieldName, textFieldValue);
|
|
624
650
|
else if (fieldType === "file" && !isEmpty(fileFieldValue)) formData.append(fieldName, fileFieldValue.data, { filename: fileFieldValue?.filename });
|
|
625
651
|
request.body = formData;
|
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.92.3 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.92.3 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.92.3 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.92.3 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.92.3 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.92.3 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.92.3 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.92.3 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.92.3 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.92.3 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.92.3 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.92.3 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.92.3 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;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,EAAE,OAClB,OAAO,QAAQ,MAAM,CAAC,CAAC,QACpB,KAAK,CAAC,KAAK,YAAY;EACtB,GAAG;GACF,MAAM;CACT,IACA,CAAC,CACH,CACF;CAEA,MAAM,SAAS,MAAM,EAAE,eAAe,WAAW,KAAK;CACtD,IAAI,CAAC,OAAO,SAAS;EACnB,MAAM,SAAS,OAAO,MAAM,OAAO,QAChC,KAAK,WAAW;GACf,GAAG;IACF,MAAM,KAAK,KAAK,GAAG,IAAI,MAAM;EAChC,IACA,CAAC,CACH;EACA,MAAM,IAAI,MAAM,KAAK,UAAU,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC;CACrD;AACF,EACF"}
|
|
1
|
+
{"version":3,"file":"common.js","names":["isNil","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@d078d47750b53c13b837b2bec86b0402b4bff94f 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@d078d47750b53c13b837b2bec86b0402b4bff94f 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@d078d47750b53c13b837b2bec86b0402b4bff94f 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@d078d47750b53c13b837b2bec86b0402b4bff94f 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@d078d47750b53c13b837b2bec86b0402b4bff94f 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@d078d47750b53c13b837b2bec86b0402b4bff94f 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@d078d47750b53c13b837b2bec86b0402b4bff94f 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@d078d47750b53c13b837b2bec86b0402b4bff94f 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 requestHeaders = this.getHeaders(request);\n const headers = isNativeFormData(request.body)\n ? withoutContentType(requestHeaders)\n : requestHeaders;\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(\n request.redactBodyInErrors === true ? REDACTED_BODY : request.body,\n { status: response.status, 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\nconst REDACTED_BODY = \"[redacted]\";\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 isNativeFormData(body) ||\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 isNativeFormData(body: unknown): body is FormData {\n return typeof FormData !== \"undefined\" && body instanceof FormData;\n}\n\nfunction withoutContentType(headers: HttpHeaders): HttpHeaders {\n return Object.fromEntries(\n Object.entries(headers).filter(\n ([key]) => key.toLowerCase() !== \"content-type\",\n ),\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@d078d47750b53c13b837b2bec86b0402b4bff94f 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@d078d47750b53c13b837b2bec86b0402b4bff94f 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}\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 propertyGroups: [\n {\n key: \"request\",\n display: \"section\",\n label: \"Request\",\n icon: \"send\",\n props: [\"method\", \"url\", \"headers\", \"queryParams\"],\n },\n {\n key: \"payload\",\n display: \"section\",\n label: \"Data to send\",\n icon: \"code\",\n props: [\"body_type\", \"body\"],\n },\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 { default: FormData } = await import(\"form-data\");\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@d078d47750b53c13b837b2bec86b0402b4bff94f 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@d078d47750b53c13b837b2bec86b0402b4bff94f 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@d078d47750b53c13b837b2bec86b0402b4bff94f 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,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,QAAQ,WAAW,IAAI,QAAQ,KAAK,OAAO,OAAO,OAAO;AAEnE;AAEA,MAAa,cAAc;CAAE;CAAY;AAAgB;;;;ACxCzD,MAAa,kBAAkB,EAC7B,MAAM,YACJ,OACA,QACe;CACf,MAAM,YAAY,EAAE,OAClB,OAAO,QAAQ,MAAM,CAAC,CAAC,QACpB,KAAK,CAAC,KAAK,YAAY;EACtB,GAAG;GACF,MAAM;CACT,IACA,CAAC,CACH,CACF;CAEA,MAAM,SAAS,MAAM,EAAE,eAAe,WAAW,KAAK;CACtD,IAAI,CAAC,OAAO,SAAS;EACnB,MAAM,SAAS,OAAO,MAAM,OAAO,QAChC,KAAK,WAAW;GACf,GAAG;IACF,MAAM,KAAK,KAAK,GAAG,IAAI,MAAM;EAChC,IACA,CAAC,CACH;EACA,MAAM,IAAI,MAAM,KAAK,UAAU,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC;CACrD;AACF,EACF"}
|
package/dist/host.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as InputPropertyMap, L as PieceProperty,
|
|
1
|
+
import { F as InputPropertyMap, L as PieceProperty, R as PiecePropertyMap, Rt as PropertyType, lt as PieceAuthProperty, z as StaticPropsValue } from "./index-DZ0aWCvr.js";
|
|
2
2
|
//#region upstream/core-utils/lib/friendly-piece-error.d.ts
|
|
3
3
|
export declare const formatPieceError: (error: unknown, options?: FormatPieceErrorOptions) => FriendlyPieceError;
|
|
4
4
|
export declare const tryParseFriendlyPieceError: (value: unknown) => FriendlyPieceError | null;
|
package/dist/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","names":[],"sources":["../upstream/core-utils/lib/friendly-piece-error.ts","../upstream/core-utils/lib/ssrf-ip-classifier.ts","../upstream/engine/lib/helper/dynamic-prop-keys.ts","../upstream/engine/lib/variables/processors/types.ts","../upstream/engine/lib/variables/processors/array-zipper.ts","../upstream/engine/lib/variables/processors/checkbox.ts","../upstream/engine/lib/variables/processors/date-time.ts","../upstream/engine/lib/variables/processors/file.ts","../upstream/engine/lib/variables/processors/index.ts","../upstream/engine/lib/variables/processors/json.ts","../upstream/engine/lib/variables/processors/multi-select.ts","../upstream/engine/lib/variables/processors/number.ts","../upstream/engine/lib/variables/processors/object.ts","../upstream/engine/lib/variables/processors/text.ts","../src/host/shared-shim.ts","../upstream/engine/lib/variables/props-processor.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"host.d.ts","names":[],"sources":["../upstream/core-utils/lib/friendly-piece-error.ts","../upstream/core-utils/lib/ssrf-ip-classifier.ts","../upstream/engine/lib/helper/dynamic-prop-keys.ts","../upstream/engine/lib/variables/processors/types.ts","../upstream/engine/lib/variables/processors/array-zipper.ts","../upstream/engine/lib/variables/processors/checkbox.ts","../upstream/engine/lib/variables/processors/date-time.ts","../upstream/engine/lib/variables/processors/file.ts","../upstream/engine/lib/variables/processors/index.ts","../upstream/engine/lib/variables/processors/json.ts","../upstream/engine/lib/variables/processors/multi-select.ts","../upstream/engine/lib/variables/processors/number.ts","../upstream/engine/lib/variables/processors/object.ts","../upstream/engine/lib/variables/processors/text.ts","../src/host/shared-shim.ts","../upstream/engine/lib/variables/props-processor.ts"],"mappings":";;qBA4Ya,mBAAgB,gBACb,UACJ,4BACT;qBAgDU,6BAA0B,mBAEpC;KAwBS;EACV;EACA;EACA;EACA;EACA;EACA,kBAAkB;EAClB;EACA;EACA;EACA;EACA;;KAGG;EACH;;;;iBCnbO,cACP,IACA;EAEA;EACA;;qBAYW;sBAAA;;;;iBC7DJ,gBAAgB,OAAO,mBAAmB;iBAM1C,kBAAkB,OAAO,mBAAmB;iBAS5C,kBAAkB,GAAG,OAAO,IAAI;qBAkD5B;;;;;;;KCpED,YAAY,aAAa,iBACnC,UAAU,eACV,OAAO,UACJ;;;qBCiBQ,sBAAsB;;;qBCrBtB,mBAAmB;;;qBCEnB,mBAAmB;;;qBCCnB,eAAe;;;qBCKf,YAAY,QAAQ,OAAO,cAAc;;;qBCRzC,eAAe;;;qBCAf,sBAAsB;;;qBCAtB,iBAAiB;;;qBCAjB,iBAAiB;;;qBCAjB,eAAe;;;cCAf;WACX;WACA;;KAEU,gCACF,oCAAoC;KAIlC;EACV,OAAO;EACP,QAAQ;;;;KCOL;GACF,yBAAyB,uBAAuB;;qBAGtC;EACX,+BAA4B,eACX,iBAAiB,mBAAiB,OAC1C,kBAAgB,MACjB,oBAAoB,iCAA+B,sBACrC,kBACF,eAAe,sBAChC;IACD,gBAAgB,iBAAiB;IACjC,QAAQ;;;qBA0IC,mBAAgB,UACjB,eAAa,gBACT"}
|
package/dist/host.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as PropertyType, b as ApFile, c as isNil, d as parseToJsonIfPossible, l as isString, o as isBase64, r as tryCatchSync, v as DateRangeValue } from "./markdown-property-DMfHjEiL.js";
|
|
2
|
-
import {
|
|
2
|
+
import { _ as AUTHENTICATION_PROPERTY_NAME, h as isObject, i as getAuthPropertyForValue } from "./authentication-f4cep7Po.js";
|
|
3
3
|
import ipaddr from "ipaddr.js";
|
|
4
4
|
import { Readable } from "node:stream";
|
|
5
5
|
import dayjs from "dayjs";
|
|
@@ -156,9 +156,10 @@ const extractResponseHttpDetails = (error) => {
|
|
|
156
156
|
};
|
|
157
157
|
};
|
|
158
158
|
const extractClientHttpDetails = (error) => {
|
|
159
|
-
const
|
|
159
|
+
const thrownAsPlainValue = !(error instanceof Error);
|
|
160
|
+
const status = toHttpStatus(error["status"]) ?? (thrownAsPlainValue ? toHttpStatus(error["statusCode"]) : void 0);
|
|
160
161
|
if (isNil(status)) return null;
|
|
161
|
-
const responseBody = error["error"] ?? error["body"];
|
|
162
|
+
const responseBody = error["error"] ?? error["body"] ?? (thrownAsPlainValue ? error["responseBody"] : void 0);
|
|
162
163
|
const headersValue = error["headers"];
|
|
163
164
|
return {
|
|
164
165
|
status,
|
|
@@ -221,6 +222,8 @@ const readErrorMessage = (error) => {
|
|
|
221
222
|
if (!isNil(messageString)) return messageString;
|
|
222
223
|
const stringified = String(error);
|
|
223
224
|
if (stringified.length > 0 && stringified !== "[object Object]") return stringified;
|
|
225
|
+
const nested = extractApiMessage(error["error"]);
|
|
226
|
+
if (!isNil(nested)) return nested;
|
|
224
227
|
return "Unknown error";
|
|
225
228
|
};
|
|
226
229
|
const pickPlainMessage = ({ httpDetails, rawMessage }) => {
|