@powerhousedao/pieces-framework 6.2.3-dev.11

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","names":["isNil","FormData","isNil"],"sources":["../upstream/common/lib/authentication/index.ts","../upstream/common/lib/http/core/http-header.ts","../upstream/common/lib/http/core/media-type.ts","../upstream/common/lib/http/core/base-http-client.ts","../upstream/common/lib/http/core/delegating-authentication-converter.ts","../upstream/common/lib/http/core/http-error.ts","../upstream/common/lib/http/core/http-method.ts","../upstream/common/lib/http/core/fetch-http-client.ts","../upstream/common/lib/http/core/http-client.ts","../upstream/common/lib/helpers/index.ts","../upstream/common/lib/polling/index.ts","../upstream/common/lib/stream/index.ts","../upstream/common/lib/validation/index.ts"],"sourcesContent":["// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/authentication/index.ts. MIT; see ../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport type Authentication = BearerTokenAuthentication | BasicAuthentication;\n\nexport enum AuthenticationType {\n BEARER_TOKEN = \"BEARER_TOKEN\",\n BASIC = \"BASIC\",\n}\n\nexport type BaseAuthentication<T extends AuthenticationType> = {\n type: T;\n};\n\nexport type BearerTokenAuthentication =\n BaseAuthentication<AuthenticationType.BEARER_TOKEN> & {\n token: string;\n };\n\nexport type BasicAuthentication =\n BaseAuthentication<AuthenticationType.BASIC> & {\n username: string;\n password: string;\n };\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/http-header.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport enum HttpHeader {\n AUTHORIZATION = \"Authorization\",\n ACCEPT = \"Accept\",\n API_KEY = \"x-api-key\",\n CONTENT_TYPE = \"Content-Type\",\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/media-type.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport enum MediaType {\n APPLICATION_JSON = \"application/json\",\n TEXT_CSV = \"text/csv\",\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/base-http-client.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport type { Authentication } from \"../../authentication/index.js\";\nimport type { DelegatingAuthenticationConverter } from \"./delegating-authentication-converter.js\";\nimport type { HttpClient } from \"./http-client.js\";\nimport { HttpHeader } from \"./http-header.js\";\nimport type { HttpHeaders } from \"./http-headers.js\";\nimport type { HttpMessageBody } from \"./http-message-body.js\";\nimport type { HttpRequest } from \"./http-request.js\";\nimport type { HttpRequestBody } from \"./http-request-body.js\";\nimport type { HttpResponse } from \"./http-response.js\";\nimport { MediaType } from \"./media-type.js\";\n\nexport abstract class BaseHttpClient implements HttpClient {\n constructor(\n private readonly baseUrl: string,\n private readonly authenticationConverter: DelegatingAuthenticationConverter,\n ) {}\n\n abstract sendRequest<\n RequestBody extends HttpMessageBody,\n ResponseBody extends HttpMessageBody,\n >(request: HttpRequest<RequestBody>): Promise<HttpResponse<ResponseBody>>;\n\n protected getUrl<RequestBody extends HttpMessageBody>(\n request: HttpRequest<RequestBody>,\n ): {\n urlWithoutQueryParams: string;\n queryParams: URLSearchParams;\n } {\n const url = new URL(`${this.baseUrl}${request.url}`);\n const urlWithoutQueryParams = `${url.origin}${url.pathname}`;\n const queryParams = new URLSearchParams();\n // Extract query parameters\n url.searchParams.forEach((value, key) => {\n queryParams.append(key, value);\n });\n return {\n urlWithoutQueryParams,\n queryParams,\n };\n }\n\n protected getHeaders<RequestBody extends HttpRequestBody>(\n request: HttpRequest<RequestBody>,\n ): HttpHeaders {\n let requestHeaders: HttpHeaders = {\n [HttpHeader.ACCEPT]: MediaType.APPLICATION_JSON,\n };\n\n if (request.authentication) {\n this.populateAuthentication(request.authentication, requestHeaders);\n }\n\n if (request.body) {\n switch (request.headers?.[\"Content-Type\"]) {\n case \"text/csv\":\n requestHeaders[HttpHeader.CONTENT_TYPE] = MediaType.TEXT_CSV;\n break;\n\n default:\n requestHeaders[HttpHeader.CONTENT_TYPE] = MediaType.APPLICATION_JSON;\n break;\n }\n }\n if (request.headers) {\n requestHeaders = { ...requestHeaders, ...request.headers };\n }\n return requestHeaders;\n }\n\n private populateAuthentication(\n authentication: Authentication,\n headers: HttpHeaders,\n ): void {\n this.authenticationConverter.convert(authentication, headers);\n }\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/delegating-authentication-converter.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport type { HttpHeaders } from \"./http-headers.js\";\nimport { HttpHeader } from \"./http-header.js\";\nimport type {\n Authentication,\n BasicAuthentication,\n BearerTokenAuthentication,\n} from \"../../authentication/index.js\";\nimport { AuthenticationType } from \"../../authentication/index.js\";\n\nexport class DelegatingAuthenticationConverter implements AuthenticationConverter<Authentication> {\n private readonly converters: Record<\n AuthenticationType,\n AuthenticationConverter<any>\n >;\n\n constructor(\n bearerTokenConverter = new BearerTokenAuthenticationConverter(),\n basicTokenConverter = new BasicTokenAuthenticationConverter(),\n ) {\n this.converters = {\n [AuthenticationType.BEARER_TOKEN]: bearerTokenConverter,\n [AuthenticationType.BASIC]: basicTokenConverter,\n };\n }\n\n convert(authentication: Authentication, headers: HttpHeaders): HttpHeaders {\n const converter = this.converters[authentication.type];\n return converter.convert(authentication, headers);\n }\n}\n\nclass BearerTokenAuthenticationConverter implements AuthenticationConverter<BearerTokenAuthentication> {\n convert(\n authentication: BearerTokenAuthentication,\n headers: HttpHeaders,\n ): HttpHeaders {\n headers[HttpHeader.AUTHORIZATION] = `Bearer ${authentication.token}`;\n return headers;\n }\n}\n\nclass BasicTokenAuthenticationConverter implements AuthenticationConverter<BasicAuthentication> {\n convert(\n authentication: BasicAuthentication,\n headers: HttpHeaders,\n ): HttpHeaders {\n const credentials = `${authentication.username}:${authentication.password}`;\n const encoded = Buffer.from(credentials).toString(\"base64\");\n headers[HttpHeader.AUTHORIZATION] = `Basic ${encoded}`;\n return headers;\n }\n}\n\ntype AuthenticationConverter<T extends Authentication> = {\n convert: (authentication: T, headers: HttpHeaders) => HttpHeaders;\n};\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/http-error.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport class HttpError extends Error {\n private readonly status: number;\n private readonly responseBody: unknown;\n\n constructor(\n private readonly requestBody: unknown,\n params: HttpErrorParams,\n ) {\n const status = params.status || 500;\n const responseBody = Buffer.isBuffer(params.responseBody)\n ? params.responseBody.toString()\n : params.responseBody;\n\n super(\n JSON.stringify({\n response: {\n status: status,\n body: responseBody,\n },\n request: {\n body: requestBody,\n },\n }),\n );\n\n this.status = status;\n this.responseBody = responseBody;\n }\n\n public errorMessage() {\n return {\n response: {\n status: this.status,\n body: this.responseBody,\n },\n request: {\n body: this.requestBody,\n },\n };\n }\n\n get response() {\n return {\n status: this.status,\n body: this.responseBody,\n };\n }\n\n get request() {\n return {\n body: this.requestBody,\n };\n }\n}\n\nexport function toFailsafeOutput({ error, requestBody }: FailsafeOutputParams) {\n if (error instanceof HttpError) {\n return error.errorMessage();\n }\n return {\n response: {\n status: 0,\n body: error instanceof Error ? error.message : String(error),\n },\n request: {\n body: requestBody,\n },\n };\n}\n\nexport type HttpErrorParams = {\n status: number;\n responseBody: unknown;\n};\n\nexport type FailsafeOutputParams = {\n error: unknown;\n requestBody: unknown;\n};\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/http-method.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nexport enum HttpMethod {\n GET = \"GET\",\n POST = \"POST\",\n PATCH = \"PATCH\",\n PUT = \"PUT\",\n DELETE = \"DELETE\",\n HEAD = \"HEAD\",\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/fetch-http-client.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport { PassThrough, Readable } from \"node:stream\";\nimport { tryCatchSync } from \"../../../../core-utils/index.js\";\nimport { BaseHttpClient } from \"./base-http-client.js\";\nimport { DelegatingAuthenticationConverter } from \"./delegating-authentication-converter.js\";\nimport { HttpError } from \"./http-error.js\";\nimport type { HttpHeaders } from \"./http-headers.js\";\nimport type { HttpMessageBody } from \"./http-message-body.js\";\nimport { HttpMethod } from \"./http-method.js\";\nimport type { HttpRequest } from \"./http-request.js\";\nimport type { HttpRequestBody } from \"./http-request-body.js\";\nimport type { HttpResponse } from \"./http-response.js\";\n\n// Native-fetch implementation of HttpClient. SSRF egress is enforced by the engine's\n// in-process dns.lookup / Socket.connect guards (see ssrf-guard.ts) when\n// AP_NETWORK_MODE=STRICT, which cover fetch via net.connect — so there is no egress\n// proxy wiring here. A caller may still pass options.dispatcher for a user-configured\n// per-request proxy (the HTTP piece's \"Use Proxy\" feature).\nexport class FetchHttpClient extends BaseHttpClient {\n constructor(\n baseUrl = \"\",\n authenticationConverter: DelegatingAuthenticationConverter = new DelegatingAuthenticationConverter(),\n ) {\n super(baseUrl, authenticationConverter);\n }\n\n async sendRequest<ResponseBody extends HttpMessageBody = any>(\n request: HttpRequest<HttpRequestBody>,\n options?: SendRequestOptions,\n ): Promise<HttpResponse<ResponseBody>> {\n const { urlWithoutQueryParams, queryParams: urlQueryParams } =\n this.getUrl(request);\n const headers = this.getHeaders(request);\n const queryParams = request.queryParams ?? {};\n for (const [key, value] of Object.entries(queryParams)) {\n urlQueryParams.append(key, value);\n }\n const queryString = urlQueryParams.toString();\n const finalUrl = queryString\n ? `${urlWithoutQueryParams}?${queryString}`\n : urlWithoutQueryParams;\n\n const responseType = request.responseType ?? \"json\";\n const followRedirects = request.followRedirects ?? true;\n const retries = request.retries ?? 0;\n\n const { body, extraHeaders, isStream } = acceptsRequestBody(request.method)\n ? serializeBody(request.body, headers)\n : { body: undefined, extraHeaders: {}, isStream: false };\n const finalHeaders = normalizeHeaders({ ...headers, ...extraHeaders });\n\n const response = await sendWithRetries(\n async () => {\n const controller = new AbortController();\n const timeoutId =\n request.timeout && request.timeout > 0\n ? setTimeout(() => controller.abort(), request.timeout)\n : undefined;\n try {\n const init: FetchInit = {\n method: request.method.toString(),\n headers: finalHeaders,\n body,\n redirect: followRedirects ? \"follow\" : \"manual\",\n signal: controller.signal,\n };\n if (isStream) {\n init.duplex = \"half\";\n }\n // A caller-supplied undici Dispatcher (e.g. a ProxyAgent) for per-request proxying.\n if (options?.dispatcher !== undefined) {\n init.dispatcher = options.dispatcher;\n }\n return await fetch(finalUrl, init);\n } finally {\n if (timeoutId !== undefined) {\n clearTimeout(timeoutId);\n }\n }\n },\n isStream ? 0 : retries,\n );\n\n const successCeiling = followRedirects ? 300 : 400;\n if (response.status < 200 || response.status >= successCeiling) {\n // A stream response can't carry an error message usefully; read the error body as text.\n const errorBody = await parseResponseBody(\n response,\n responseType === \"stream\" ? \"text\" : responseType,\n );\n const httpError = new HttpError(request.body, {\n status: response.status,\n responseBody: errorBody,\n });\n throw httpError;\n }\n\n const responseBody = await parseResponseBody(response, responseType);\n return {\n status: response.status,\n headers: toHttpHeaders(response.headers),\n body: responseBody as ResponseBody,\n };\n }\n}\n\nexport function acceptsRequestBody(method: HttpMethod): boolean {\n return method !== HttpMethod.GET && method !== HttpMethod.HEAD;\n}\n\nfunction serializeBody(\n body: HttpRequestBody | undefined,\n headers: HttpHeaders,\n): {\n body: BodyInit | undefined;\n extraHeaders: Record<string, string>;\n isStream: boolean;\n} {\n if (isNil(body)) {\n return { body: undefined, extraHeaders: {}, isStream: false };\n }\n if (isNodeFormData(body)) {\n // A buffered multipart body lets undici send Content-Length; a streamed one is sent\n // chunked without a length, which strict multipart parsers reject with a 500. Streaming\n // with an explicit content-length header is not an option: undici stalls or throws\n // RequestContentLengthMismatchError on stream bodies that carry one.\n const buffered = bufferFormDataIfSafe(body);\n if (buffered !== null) {\n return {\n body: buffered as unknown as BodyInit,\n extraHeaders: body.getHeaders(),\n isStream: false,\n };\n }\n const stream = new PassThrough();\n body.on(\"error\", (error) => stream.destroy(error));\n body.pipe(stream);\n return {\n body: stream as unknown as BodyInit,\n extraHeaders: body.getHeaders(),\n isStream: true,\n };\n }\n if (body instanceof Readable) {\n return {\n body: body as unknown as BodyInit,\n extraHeaders: {},\n isStream: true,\n };\n }\n // Already a wire-ready body — pass through untouched.\n if (\n typeof body === \"string\" ||\n Buffer.isBuffer(body) ||\n body instanceof URLSearchParams ||\n body instanceof ArrayBuffer ||\n (typeof FormData !== \"undefined\" && body instanceof FormData) ||\n (typeof Blob !== \"undefined\" && body instanceof Blob)\n ) {\n return { body: body as BodyInit, extraHeaders: {}, isStream: false };\n }\n const contentType = headers[\"Content-Type\"] ?? headers[\"content-type\"] ?? \"\";\n if (contentType.includes(\"application/x-www-form-urlencoded\")) {\n return {\n body: new URLSearchParams(body as Record<string, string>).toString(),\n extraHeaders: {},\n isStream: false,\n };\n }\n return { body: JSON.stringify(body), extraHeaders: {}, isStream: false };\n}\n\nasync function parseResponseBody(\n response: Response,\n responseType: ResponseType,\n): Promise<unknown> {\n switch (responseType) {\n case \"arraybuffer\":\n return Buffer.from(await response.arrayBuffer());\n case \"stream\":\n // undici streams a Node web ReadableStream body; the DOM fetch types omit the fromWeb overload\n return isNil(response.body)\n ? Readable.from([])\n : Readable.fromWeb(\n response.body as unknown as Parameters<typeof Readable.fromWeb>[0],\n );\n case \"blob\":\n return await response.blob();\n case \"text\":\n return await response.text();\n case \"json\":\n default: {\n const text = await response.text();\n if (text.length === 0) {\n return undefined;\n }\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n }\n }\n}\n\nasync function sendWithRetries(\n fn: () => Promise<Response>,\n retries: number,\n): Promise<Response> {\n let lastError: unknown;\n for (let attempt = 0; attempt <= retries; attempt++) {\n try {\n const response = await fn();\n if (response.status >= 500 && attempt < retries) {\n await backoff(attempt);\n continue;\n }\n return response;\n } catch (error) {\n lastError = error;\n if (attempt < retries) {\n await backoff(attempt);\n continue;\n }\n throw error;\n }\n }\n throw lastError;\n}\n\nfunction backoff(attempt: number): Promise<void> {\n const delayMs = Math.min(1000 * 2 ** attempt, 30000);\n return new Promise((resolve) => setTimeout(resolve, delayMs));\n}\n\nfunction normalizeHeaders(headers: HttpHeaders): Record<string, string> {\n const entriesByLowerCaseKey = new Map<string, [string, string]>();\n for (const [key, value] of Object.entries(headers)) {\n if (value === undefined) {\n continue;\n }\n entriesByLowerCaseKey.set(key.toLowerCase(), [\n key,\n Array.isArray(value) ? value.join(\", \") : value,\n ]);\n }\n return Object.fromEntries(entriesByLowerCaseKey.values());\n}\n\nfunction toHttpHeaders(headers: Headers): HttpHeaders {\n const result: Record<string, string> = {};\n headers.forEach((value, key) => {\n result[key] = value;\n });\n return result;\n}\n\nfunction bufferFormDataIfSafe(body: NodeFormData): Buffer | null {\n if (\n !body.hasKnownLength() ||\n body.getLengthSync() > MAX_BUFFERED_FORM_DATA_BYTES\n ) {\n return null;\n }\n // getBuffer throws on stream parts appended with an explicit knownLength; fall back to streaming.\n const { data } = tryCatchSync(() => body.getBuffer());\n return data;\n}\n\nfunction isNodeFormData(body: unknown): body is NodeFormData {\n return (\n typeof body === \"object\" &&\n body !== null &&\n typeof (body as NodeFormData).getHeaders === \"function\" &&\n typeof (body as NodeFormData).pipe === \"function\" &&\n typeof (body as NodeFormData).on === \"function\"\n );\n}\n\nfunction isNil(value: unknown): value is null | undefined {\n return value === null || value === undefined;\n}\n\ntype NodeFormData = {\n getHeaders: () => Record<string, string>;\n pipe: (...args: unknown[]) => unknown;\n on: (event: \"error\", listener: (error: Error) => void) => unknown;\n hasKnownLength: () => boolean;\n getLengthSync: () => number;\n getBuffer: () => Buffer;\n};\n\nconst MAX_BUFFERED_FORM_DATA_BYTES = 100 * 1024 * 1024;\n\ntype ResponseType = NonNullable<HttpRequest[\"responseType\"]>;\n\ntype FetchInit = RequestInit & { duplex?: \"half\"; dispatcher?: unknown };\n\nexport type SendRequestOptions = {\n dispatcher?: unknown;\n};\n\nexport { FetchHttpClient as AxiosHttpClient };\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/http/core/http-client.ts. MIT; see ../../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport type { SendRequestOptions } from \"./fetch-http-client.js\";\nimport { FetchHttpClient } from \"./fetch-http-client.js\";\nimport type { HttpMessageBody } from \"./http-message-body.js\";\nimport type { HttpRequest } from \"./http-request.js\";\nimport type { HttpRequestBody } from \"./http-request-body.js\";\nimport type { HttpResponse } from \"./http-response.js\";\n\nexport type HttpClient = {\n sendRequest<\n RequestBody extends HttpRequestBody,\n ResponseBody extends HttpMessageBody,\n >(\n request: HttpRequest<RequestBody>,\n options?: SendRequestOptions,\n ): Promise<HttpResponse<ResponseBody>>;\n};\n\nexport const httpClient = new FetchHttpClient();\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/helpers/index.ts. MIT; see ../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport type {\n ActionClassification,\n OAuth2PropertyValue,\n PieceAuthProperty,\n StaticDropdownProperty,\n StaticPropsValue,\n InputPropertyMap,\n FilesService,\n AppConnectionValueForAuthProperty,\n ExtractPieceAuthPropertyTypeForMethods,\n ApFile,\n} from \"../../../framework/index.js\";\nimport { Property, createAction } from \"../../../framework/index.js\";\nimport type { HttpHeaders, HttpRequest, QueryParams } from \"../http/index.js\";\nimport {\n HttpMethod,\n acceptsRequestBody,\n httpClient,\n toFailsafeOutput,\n} from \"../http/index.js\";\nimport {\n assertNotNullOrUndefined,\n isEmpty,\n isNil,\n} from \"../../../core-utils/index.js\";\nimport fs from \"node:fs\";\n// Self-contained content-type → file-extension lookup, replacing the heavy\n// `mime-types`/`mime-db` dependency (~134 KB inlined into every piece bundle).\n// Covers the common types returned for binary HTTP responses; unknown → ''.\nconst CONTENT_TYPE_EXTENSIONS: Record<string, string> = {\n \"application/json\": \"json\",\n \"application/pdf\": \"pdf\",\n \"application/xml\": \"xml\",\n \"text/xml\": \"xml\",\n \"application/zip\": \"zip\",\n \"application/gzip\": \"gz\",\n \"application/x-tar\": \"tar\",\n \"application/octet-stream\": \"bin\",\n \"application/msword\": \"doc\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\":\n \"docx\",\n \"application/vnd.ms-excel\": \"xls\",\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\": \"xlsx\",\n \"application/vnd.ms-powerpoint\": \"ppt\",\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation\":\n \"pptx\",\n \"application/rtf\": \"rtf\",\n \"application/javascript\": \"js\",\n \"application/x-www-form-urlencoded\": \"bin\",\n \"text/plain\": \"txt\",\n \"text/html\": \"html\",\n \"text/css\": \"css\",\n \"text/csv\": \"csv\",\n \"text/calendar\": \"ics\",\n \"text/markdown\": \"md\",\n \"image/png\": \"png\",\n \"image/jpeg\": \"jpeg\",\n \"image/jpg\": \"jpg\",\n \"image/gif\": \"gif\",\n \"image/webp\": \"webp\",\n \"image/svg+xml\": \"svg\",\n \"image/bmp\": \"bmp\",\n \"image/tiff\": \"tiff\",\n \"image/x-icon\": \"ico\",\n \"image/vnd.microsoft.icon\": \"ico\",\n \"image/heic\": \"heic\",\n \"audio/mpeg\": \"mp3\",\n \"audio/mp4\": \"m4a\",\n \"audio/wav\": \"wav\",\n \"audio/x-wav\": \"wav\",\n \"audio/ogg\": \"ogg\",\n \"audio/webm\": \"weba\",\n \"video/mp4\": \"mp4\",\n \"video/mpeg\": \"mpeg\",\n \"video/webm\": \"webm\",\n \"video/quicktime\": \"mov\",\n \"video/x-msvideo\": \"avi\",\n \"font/woff\": \"woff\",\n \"font/woff2\": \"woff2\",\n \"font/ttf\": \"ttf\",\n \"font/otf\": \"otf\",\n};\n\nfunction contentTypeToExtension(contentType: string): string {\n const type = contentType.split(\";\")[0].trim().toLowerCase();\n return CONTENT_TYPE_EXTENSIONS[type] ?? \"\";\n}\nimport FormData from \"form-data\";\n\nexport const getAccessTokenOrThrow = (\n auth: OAuth2PropertyValue | undefined,\n): string => {\n const accessToken = auth?.access_token;\n\n if (accessToken === undefined) {\n throw new Error(\"Invalid bearer token\");\n }\n\n return accessToken;\n};\nconst joinBaseUrlWithRelativePath = ({\n baseUrl,\n relativePath,\n}: {\n baseUrl: string;\n relativePath: string;\n}) => {\n const baseUrlWithSlash = baseUrl.endsWith(\"/\") ? baseUrl : `${baseUrl}/`;\n const relativePathWithoutSlash = relativePath.startsWith(\"/\")\n ? relativePath.slice(1)\n : relativePath;\n return `${baseUrlWithSlash}${relativePathWithoutSlash}`;\n};\n\nconst getBaseUrlForDescription = <\n PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined,\n>(\n baseUrl: BaseUrlGetter<PieceAuth>,\n auth?: AppConnectionValueForAuthProperty<\n ExtractPieceAuthPropertyTypeForMethods<PieceAuth>\n >,\n) => {\n const exampleBaseUrl = `https://api.example.com`;\n try {\n const baseUrlValue = auth ? baseUrl(auth) : undefined;\n const baseUrlValueWithoutTrailingSlash = baseUrlValue?.endsWith(\"/\")\n ? baseUrlValue.slice(0, -1)\n : baseUrlValue;\n return baseUrlValueWithoutTrailingSlash ?? exampleBaseUrl;\n } catch (error) {\n //If baseUrl fails we stil want to return a valid baseUrl for description\n {\n return exampleBaseUrl;\n }\n }\n};\ntype BaseUrlGetter<\n PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined,\n> = (\n auth?: AppConnectionValueForAuthProperty<\n ExtractPieceAuthPropertyTypeForMethods<PieceAuth>\n >,\n) => string;\nexport function createCustomApiCallAction<\n PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined,\n>({\n auth,\n baseUrl,\n authMapping,\n description,\n displayName,\n name,\n props,\n extraProps,\n authLocation = \"headers\",\n classification = \"WRITE\",\n}: {\n auth?: PieceAuth;\n baseUrl: BaseUrlGetter<PieceAuth>;\n authMapping?: (\n auth: AppConnectionValueForAuthProperty<\n ExtractPieceAuthPropertyTypeForMethods<PieceAuth>\n >,\n propsValue: StaticPropsValue<any>,\n ) => Promise<HttpHeaders | QueryParams>;\n // add description as a parameter that can be null\n description?: string | null;\n displayName?: string | null;\n name?: string | null;\n props?: {\n url?: Partial<ReturnType<typeof Property.ShortText>>;\n method?: Partial<StaticDropdownProperty<HttpMethod, boolean>>;\n headers?: Partial<ReturnType<typeof Property.Object>>;\n queryParams?: Partial<ReturnType<typeof Property.Object>>;\n body?: Partial<ReturnType<typeof Property.Json>>;\n response_is_binary?: Partial<ReturnType<typeof Property.Checkbox>>;\n failsafe?: Partial<ReturnType<typeof Property.Checkbox>>;\n timeout?: Partial<ReturnType<typeof Property.Number>>;\n followRedirects?: Partial<ReturnType<typeof Property.Checkbox>>;\n };\n extraProps?: InputPropertyMap;\n authLocation?: \"headers\" | \"queryParams\";\n // The method is caller-supplied at runtime, so a single tag has to assume mutation.\n classification?: ActionClassification;\n}) {\n return createAction({\n audience: \"human\",\n name: name ? name : \"custom_api_call\",\n classification,\n displayName: displayName ? displayName : \"Custom API Call\",\n description: description\n ? description\n : \"Make a custom API call to a specific endpoint\",\n auth,\n requireAuth: auth ? true : false,\n props: {\n url: Property.DynamicProperties({\n auth,\n displayName: \"\",\n required: true,\n refreshers: [],\n props: async ({ auth }) => {\n return {\n url: Property.ShortText({\n displayName: \"URL\",\n description: `Full URL, or a path relative to ${getBaseUrlForDescription(baseUrl, auth)}`,\n required: true,\n placeholder: \"/resource\",\n defaultValue: auth ? baseUrl(auth) : \"\",\n ...(props?.url ?? {}),\n }),\n };\n },\n }),\n method: Property.StaticDropdown({\n displayName: \"Method\",\n required: true,\n defaultValue: HttpMethod.GET,\n options: {\n options: Object.values(HttpMethod).map((v) => {\n return {\n label: v,\n value: v,\n };\n }),\n },\n ...(props?.method ?? {}),\n }),\n headers: Property.Object({\n displayName: \"Headers\",\n description:\n \"Authorization headers are injected automatically from your connection.\",\n required: false,\n ...(props?.headers ?? {}),\n }),\n queryParams: Property.Object({\n displayName: \"Query Parameters\",\n description: \"Appended to the URL as ?key=value.\",\n required: false,\n ...(props?.queryParams ?? {}),\n }),\n body_type: Property.Dropdown({\n auth,\n displayName: \"Body Type\",\n required: false,\n defaultValue: \"none\",\n refreshers: [\"method\"],\n options: async ({ method }) => {\n if (!acceptsRequestBody(method as HttpMethod)) {\n return {\n disabled: true,\n placeholder: \"Not available for GET or HEAD requests\",\n options: [],\n };\n }\n return {\n disabled: false,\n options: [\n { label: \"None\", value: \"none\" },\n { label: \"JSON\", value: \"json\" },\n { label: \"Form Data\", value: \"form_data\" },\n { label: \"Raw\", value: \"raw\" },\n ],\n };\n },\n }),\n body: Property.DynamicProperties({\n auth,\n displayName: \"Body\",\n refreshers: [\"body_type\", \"method\"],\n required: false,\n props: async ({ body_type, method }) => {\n if (!body_type || !acceptsRequestBody(method as HttpMethod))\n return {};\n\n const bodyTypeInput = body_type as unknown as string;\n\n const fields: InputPropertyMap = {};\n\n switch (bodyTypeInput) {\n case \"none\":\n break;\n case \"json\":\n fields[\"data\"] = Property.Json({\n displayName: \"JSON Body\",\n required: true,\n ...(props?.body ?? {}),\n });\n break;\n case \"raw\":\n fields[\"data\"] = Property.LongText({\n displayName: \"Raw Body\",\n required: true,\n });\n break;\n case \"form_data\":\n fields[\"data\"] = Property.Array({\n displayName: \"Form Data\",\n required: true,\n properties: {\n fieldName: Property.ShortText({\n displayName: \"Field Name\",\n required: true,\n }),\n fieldType: Property.StaticDropdown({\n displayName: \"Field Type\",\n required: true,\n options: {\n disabled: false,\n options: [\n { label: \"Text\", value: \"text\" },\n { label: \"File\", value: \"file\" },\n ],\n },\n }),\n textFieldValue: Property.LongText({\n displayName: \"Text Field Value\",\n required: false,\n }),\n fileFieldValue: Property.File({\n displayName: \"File Field Value\",\n required: false,\n }),\n },\n });\n break;\n }\n return fields;\n },\n }),\n response_is_binary: Property.Checkbox({\n displayName: \"Response is Binary\",\n description: \"Enable for files like PDFs, images, etc.\",\n required: false,\n defaultValue: false,\n advanced: true,\n ...(props?.response_is_binary ?? {}),\n }),\n failsafe: Property.Checkbox({\n displayName: \"Return Error as Output\",\n description:\n \"On a failed request, output the error instead of failing the step.\",\n required: false,\n advanced: true,\n ...(props?.failsafe ?? {}),\n }),\n timeout: Property.Number({\n displayName: \"Timeout\",\n description:\n \"Seconds to wait for a response. Empty: up to the flow limit (10 min).\",\n required: false,\n advanced: true,\n ...(props?.timeout ?? {}),\n }),\n followRedirects: Property.Checkbox({\n displayName: \"Follow redirects\",\n description:\n \"Follow 3xx redirects instead of returning them as the response.\",\n required: false,\n defaultValue: false,\n advanced: true,\n ...(props?.followRedirects ?? {}),\n }),\n ...extraProps,\n },\n\n run: async (context) => {\n const {\n method,\n url,\n headers,\n queryParams,\n body,\n body_type,\n failsafe,\n timeout,\n response_is_binary,\n followRedirects,\n } = context.propsValue;\n assertNotNullOrUndefined(method, \"Method\");\n assertNotNullOrUndefined(url, \"URL\");\n\n const authValue = !isNil(authMapping)\n ? await authMapping(context.auth, context.propsValue)\n : {};\n\n const urlValue = url[\"url\"] as string;\n const fullUrl =\n urlValue.startsWith(\"http://\") || urlValue.startsWith(\"https://\")\n ? urlValue\n : joinBaseUrlWithRelativePath({\n baseUrl: baseUrl(context.auth),\n relativePath: urlValue,\n });\n const request: HttpRequest = {\n method,\n url: fullUrl,\n headers: {\n ...((headers ?? {}) as HttpHeaders),\n ...(authLocation === \"headers\" ? authValue : {}),\n },\n queryParams: {\n ...(authLocation === \"queryParams\" ? (authValue as QueryParams) : {}),\n ...((queryParams as QueryParams) ?? {}),\n },\n timeout: timeout ? timeout * 1000 : 0,\n followRedirects,\n };\n\n // Set response type to arraybuffer if binary response is expected\n if (response_is_binary) {\n request.responseType = \"arraybuffer\";\n }\n\n if (body) {\n if (body_type && body_type !== \"none\") {\n const bodyInput = body[\"data\"];\n if (body_type === \"form_data\") {\n const formBodyInput = bodyInput as Array<{\n fieldName: string;\n fieldType: \"text\" | \"file\";\n textFieldValue?: string;\n fileFieldValue?: ApFile;\n }>;\n\n const formData = new FormData();\n\n for (const {\n fieldName,\n fieldType,\n textFieldValue,\n fileFieldValue,\n } of formBodyInput) {\n if (fieldType === \"text\" && !isEmpty(textFieldValue)) {\n formData.append(fieldName, textFieldValue);\n } else if (fieldType === \"file\" && !isEmpty(fileFieldValue)) {\n formData.append(fieldName, fileFieldValue!.data, {\n filename: fileFieldValue?.filename,\n });\n }\n }\n request.body = formData;\n request.headers = { ...request.headers, ...formData.getHeaders() };\n } else {\n request.body = bodyInput;\n }\n } else if (!body_type) {\n request.body = body;\n }\n }\n\n try {\n const response = await httpClient.sendRequest(request);\n return await handleBinaryResponse(\n context.files,\n response.body,\n response.status,\n response.headers,\n response_is_binary,\n );\n } catch (error) {\n if (failsafe) {\n return toFailsafeOutput({ error, requestBody: request.body });\n }\n throw error;\n }\n },\n });\n}\n\nexport function is_chromium_installed(): boolean {\n const chromiumPath = \"/usr/bin/chromium\";\n return fs.existsSync(chromiumPath);\n}\n\nconst handleBinaryResponse = async (\n files: FilesService,\n bodyContent: string | ArrayBuffer | Buffer,\n status: number,\n headers?: HttpHeaders,\n isBinary?: boolean,\n) => {\n let body;\n\n if (isBinary && isBinaryBody(bodyContent)) {\n const contentTypeValue = Array.isArray(headers?.[\"content-type\"])\n ? headers[\"content-type\"][0]\n : headers?.[\"content-type\"];\n const fileExtension: string =\n contentTypeToExtension(contentTypeValue ?? \"\") || \"txt\";\n\n let bufferData: Buffer;\n if (bodyContent instanceof ArrayBuffer) {\n bufferData = Buffer.from(new Uint8Array(bodyContent));\n } else if (Buffer.isBuffer(bodyContent)) {\n bufferData = bodyContent;\n } else {\n bufferData = Buffer.from(bodyContent);\n }\n\n body = await files.write({\n fileName: `output.${fileExtension}`,\n data: bufferData,\n });\n } else {\n body = bodyContent;\n }\n\n return { status, headers, body };\n};\n\nconst isBinaryBody = (body: string | ArrayBuffer | Buffer) => {\n return body instanceof ArrayBuffer || Buffer.isBuffer(body);\n};\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/polling/index.ts. MIT; see ../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport type {\n AppConnectionValueForAuthProperty,\n FilesService,\n ServerContext,\n Store,\n} from \"../../../framework/index.js\";\nimport { isNil } from \"../../../core-utils/index.js\";\n\ninterface TimebasedPolling<AuthValue, PropsValue> {\n strategy: DedupeStrategy.TIMEBASED;\n items: (params: {\n auth: AuthValue;\n store: Store;\n propsValue: PropsValue;\n lastFetchEpochMS: number;\n server?: ServerContext;\n }) => Promise<\n {\n epochMilliSeconds: number;\n data: unknown;\n }[]\n >;\n}\n\ninterface LastItemPolling<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n> {\n strategy: DedupeStrategy.LAST_ITEM;\n items: (params: {\n auth: AuthValue;\n store: Store;\n files?: FilesService;\n propsValue: PropsValue;\n lastItemId: unknown;\n server?: ServerContext;\n }) => Promise<\n {\n id: unknown;\n data: unknown;\n }[]\n >;\n}\n\nexport enum DedupeStrategy {\n TIMEBASED,\n LAST_ITEM,\n}\n\nexport type Polling<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n> =\n | TimebasedPolling<AuthValue, PropsValue>\n | LastItemPolling<AuthValue, PropsValue>;\n\nexport const pollingHelper = {\n async poll<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n >(\n polling: Polling<AuthValue, PropsValue>,\n {\n store,\n auth,\n propsValue,\n maxItemsToPoll,\n files,\n server,\n }: {\n store: Store;\n auth: AuthValue;\n propsValue: PropsValue;\n files: FilesService;\n maxItemsToPoll?: number;\n server?: ServerContext;\n },\n ): Promise<unknown[]> {\n switch (polling.strategy) {\n case DedupeStrategy.TIMEBASED: {\n const lastEpochMilliSeconds = await store.get<number>(\"lastPoll\");\n if (isNil(lastEpochMilliSeconds)) {\n throw new Error(\"lastPoll doesn't exist in the store.\");\n }\n const items = await polling.items({\n store,\n auth,\n propsValue,\n lastFetchEpochMS: lastEpochMilliSeconds,\n server,\n });\n const newLastEpochMilliSeconds = items.reduce(\n (acc, item) => Math.max(acc, item.epochMilliSeconds),\n lastEpochMilliSeconds,\n );\n await store.put(\"lastPoll\", newLastEpochMilliSeconds);\n return items\n .filter((f) => f.epochMilliSeconds > lastEpochMilliSeconds)\n .map((item) => item.data);\n }\n case DedupeStrategy.LAST_ITEM: {\n const lastItemId = await store.get<unknown>(\"lastItem\");\n const items = await polling.items({\n store,\n auth,\n propsValue,\n lastItemId,\n files,\n server,\n });\n\n const lastItemIndex = items.findIndex((f) => f.id === lastItemId);\n let newItems = [];\n if (isNil(lastItemId) || lastItemIndex == -1) {\n newItems = items ?? [];\n } else {\n newItems = items?.slice(0, lastItemIndex) ?? [];\n }\n // Sorted from newest to oldest\n if (!isNil(maxItemsToPoll)) {\n // Get the last polling.maxItemsToPoll items\n newItems = newItems.slice(-maxItemsToPoll);\n }\n const newLastItem = newItems?.[0]?.id;\n if (!isNil(newLastItem)) {\n await store.put(\"lastItem\", newLastItem);\n }\n return newItems.map((item) => item.data);\n }\n }\n },\n async onEnable<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n >(\n polling: Polling<AuthValue, PropsValue>,\n {\n store,\n auth,\n propsValue,\n server,\n isRepublish,\n }: {\n store: Store;\n auth: AuthValue;\n propsValue: PropsValue;\n server?: ServerContext;\n isRepublish?: boolean;\n },\n ): Promise<void> {\n switch (polling.strategy) {\n case DedupeStrategy.TIMEBASED: {\n if (isRepublish && !isNil(await store.get<number>(\"lastPoll\"))) {\n break;\n }\n await store.put(\"lastPoll\", Date.now());\n break;\n }\n case DedupeStrategy.LAST_ITEM: {\n if (isRepublish && !isNil(await store.get(\"lastItem\"))) {\n break;\n }\n const items = await polling.items({\n store,\n auth,\n propsValue,\n lastItemId: null,\n server,\n });\n const lastItemId = items?.[0]?.id;\n if (!isNil(lastItemId)) {\n await store.put(\"lastItem\", lastItemId);\n } else {\n await store.delete(\"lastItem\");\n }\n break;\n }\n }\n },\n async onDisable<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n >(\n polling: Polling<AuthValue, PropsValue>,\n params: { store: Store; auth: AuthValue; propsValue: PropsValue },\n ): Promise<void> {\n switch (polling.strategy) {\n case DedupeStrategy.TIMEBASED:\n case DedupeStrategy.LAST_ITEM:\n return;\n }\n },\n async test<\n AuthValue extends AppConnectionValueForAuthProperty<any>,\n PropsValue,\n >(\n polling: Polling<AuthValue, PropsValue>,\n {\n auth,\n propsValue,\n store,\n files,\n server,\n }: {\n store: Store;\n auth: AuthValue;\n propsValue: PropsValue;\n files: FilesService;\n server?: ServerContext;\n },\n ): Promise<unknown[]> {\n let items = [];\n switch (polling.strategy) {\n case DedupeStrategy.TIMEBASED: {\n items = await polling.items({\n store,\n auth,\n propsValue,\n lastFetchEpochMS: 0,\n server,\n });\n break;\n }\n case DedupeStrategy.LAST_ITEM: {\n items = await polling.items({\n store,\n auth,\n propsValue,\n lastItemId: null,\n files,\n server,\n });\n break;\n }\n }\n return getFirstFiveOrAll(items.map((item) => item.data));\n },\n};\n\nfunction getFirstFiveOrAll(array: unknown[]) {\n if (array.length <= 5) {\n return array;\n } else {\n return array.slice(0, 5);\n }\n}\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/stream/index.ts. MIT; see ../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport { Readable } from \"node:stream\";\nimport type { ApFile, ApStreamingFile } from \"../../../framework/index.js\";\n\nfunction toStreamingBody(file: ApStreamingFile | ApFile): {\n body: Readable;\n size: number | undefined;\n} {\n if (\"body\" in file) {\n return { body: file.body, size: file.size };\n }\n return { body: Readable.from(file.data), size: file.data.length };\n}\n\nasync function* readChunks({\n readable,\n chunkSize,\n}: {\n readable: Readable;\n chunkSize: number;\n}): AsyncGenerator<Buffer> {\n let pending: Buffer[] = [];\n let pendingLength = 0;\n if (!Number.isInteger(chunkSize) || chunkSize <= 0) {\n throw new Error(\"chunkSize must be a positive integer\");\n }\n for await (const data of readable) {\n pending.push(Buffer.isBuffer(data) ? data : Buffer.from(data));\n pendingLength += pending[pending.length - 1].length;\n while (pendingLength >= chunkSize) {\n const combined =\n pending.length === 1 ? pending[0] : Buffer.concat(pending);\n yield combined.subarray(0, chunkSize);\n const rest = combined.subarray(chunkSize);\n pending = rest.length > 0 ? [rest] : [];\n pendingLength = rest.length;\n }\n }\n if (pendingLength > 0) {\n yield pending.length === 1 ? pending[0] : Buffer.concat(pending);\n }\n}\n\nexport const streamUtils = { readChunks, toStreamingBody };\n","// Vendored from activepieces/activepieces@0.91.0 packages/pieces/common/src/lib/validation/index.ts. MIT; see ../../../../LICENSE.\n// Generated by scripts/sync-upstream.mts — do not edit by hand.\nimport * as z from \"zod/mini\";\n\nexport const propsValidation = {\n async validateZod<T extends Record<string, unknown>>(\n props: T,\n schema: Partial<Record<keyof T, z.core.$ZodType>>,\n ): Promise<void> {\n const schemaObj = z.object(\n Object.entries(schema).reduce(\n (acc, [key, value]) => ({\n ...acc,\n [key]: value,\n }),\n {},\n ),\n );\n\n const result = await z.safeParseAsync(schemaObj, props);\n if (!result.success) {\n const errors = result.error.issues.reduce<Record<string, string>>(\n (acc, issue) => ({\n ...acc,\n [issue.path.join(\".\")]: issue.message,\n }),\n {},\n );\n throw new Error(JSON.stringify({ errors }, null, 2));\n }\n },\n};\n"],"mappings":";;;;;;;;AAIA,IAAY,qBAAL;AACL;AACA;;KACD;;;;ACLD,IAAY,aAAL;AACL;AACA;AACA;AACA;;KACD;;;;ACLD,IAAY,YAAL;AACL;AACA;;KACD;;;;ACQD,IAAsB,iBAAtB,MAA2D;CACzD,YACE,AAAiB,SACjB,AAAiB,yBACjB;EAFiB;EACA;;CAQnB,AAAU,OACR,SAIA;EACA,MAAM,MAAM,IAAI,IAAI,GAAG,KAAK,UAAU,QAAQ,MAAM;EACpD,MA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AC;;GAGzD"}
package/dist/host.d.ts ADDED
@@ -0,0 +1,95 @@
1
+ import { I as PieceProperty, L as PiecePropertyMap, P as InputPropertyMap, Pt as PropertyType, R as StaticPropsValue, ct as PieceAuthProperty } from "./index-BW6GxXEN.js";
2
+
3
+ //#region upstream/core-utils/lib/friendly-piece-error.d.ts
4
+ declare const formatPieceError: (error: unknown, options?: FormatPieceErrorOptions) => FriendlyPieceError;
5
+ declare const tryParseFriendlyPieceError: (value: unknown) => FriendlyPieceError | null;
6
+ type FriendlyPieceError = {
7
+ __apErrorVersion: 1;
8
+ message: string;
9
+ errorName?: string;
10
+ status?: number;
11
+ responseBody?: unknown;
12
+ responseHeaders?: Record<string, unknown>;
13
+ requestBody?: unknown;
14
+ requestUrl?: string;
15
+ requestMethod?: string;
16
+ apiMessage?: string;
17
+ raw?: string;
18
+ };
19
+ type FormatPieceErrorOptions = {
20
+ raw?: string;
21
+ };
22
+ //#endregion
23
+ //#region upstream/core-utils/lib/ssrf-ip-classifier.d.ts
24
+ declare function isBlockedIp({
25
+ ip,
26
+ allowList
27
+ }: {
28
+ ip: string;
29
+ allowList: string[];
30
+ }): boolean;
31
+ declare const ssrfIpClassifier: {
32
+ isBlockedIp: typeof isBlockedIp;
33
+ };
34
+ //#endregion
35
+ //#region upstream/engine/lib/helper/dynamic-prop-keys.d.ts
36
+ declare function escapePropsKeys(props: InputPropertyMap): InputPropertyMap;
37
+ declare function unescapePropsKeys(props: InputPropertyMap): InputPropertyMap;
38
+ declare function unescapeInputKeys<T>(value: T): T;
39
+ declare const dynamicPropKeys: {
40
+ escapePropsKeys: typeof escapePropsKeys;
41
+ unescapePropsKeys: typeof unescapePropsKeys;
42
+ unescapeInputKeys: typeof unescapeInputKeys;
43
+ };
44
+ //#endregion
45
+ //#region upstream/engine/lib/variables/processors/types.d.ts
46
+ type ProcessorFn<INPUT = any, OUTPUT = any> = (property: PieceProperty, value: INPUT) => OUTPUT;
47
+ //#endregion
48
+ //#region upstream/engine/lib/variables/processors/array-zipper.d.ts
49
+ declare const arrayZipperProcessor: ProcessorFn;
50
+ //#endregion
51
+ //#region upstream/engine/lib/variables/processors/checkbox.d.ts
52
+ declare const checkboxProcessor: ProcessorFn;
53
+ //#endregion
54
+ //#region upstream/engine/lib/variables/processors/date-time.d.ts
55
+ declare const dateTimeProcessor: ProcessorFn;
56
+ //#endregion
57
+ //#region upstream/engine/lib/variables/processors/file.d.ts
58
+ declare const fileProcessor: ProcessorFn;
59
+ //#endregion
60
+ //#region upstream/engine/lib/variables/processors/index.d.ts
61
+ declare const processors: Partial<Record<PropertyType, ProcessorFn>>;
62
+ //#endregion
63
+ //#region upstream/engine/lib/variables/processors/json.d.ts
64
+ declare const jsonProcessor: ProcessorFn;
65
+ //#endregion
66
+ //#region upstream/engine/lib/variables/processors/multi-select.d.ts
67
+ declare const multiSelectProcessor: ProcessorFn;
68
+ //#endregion
69
+ //#region upstream/engine/lib/variables/processors/number.d.ts
70
+ declare const numberProcessor: ProcessorFn;
71
+ //#endregion
72
+ //#region upstream/engine/lib/variables/processors/object.d.ts
73
+ declare const objectProcessor: ProcessorFn;
74
+ //#endregion
75
+ //#region upstream/engine/lib/variables/processors/text.d.ts
76
+ declare const textProcessor: ProcessorFn;
77
+ //#endregion
78
+ //#region src/host/shared-shim.d.ts
79
+ type PropertySettings = {
80
+ schema: InputPropertyMap;
81
+ };
82
+ //#endregion
83
+ //#region upstream/engine/lib/variables/props-processor.d.ts
84
+ type PropsValidationError = {
85
+ [key: string]: string[] | PropsValidationError | PropsValidationError[];
86
+ };
87
+ declare const propsProcessor: {
88
+ applyProcessorsAndValidators: (resolvedInput: StaticPropsValue<PiecePropertyMap>, props: InputPropertyMap, auth: PieceAuthProperty | PieceAuthProperty[] | undefined, requireAuth: boolean, propertySettings: Record<string, PropertySettings>) => Promise<{
89
+ processedInput: StaticPropsValue<PiecePropertyMap>;
90
+ errors: PropsValidationError;
91
+ }>;
92
+ };
93
+ //#endregion
94
+ export { type FriendlyPieceError, type ProcessorFn, type PropertySettings, arrayZipperProcessor, checkboxProcessor, dateTimeProcessor, dynamicPropKeys, fileProcessor, formatPieceError, jsonProcessor, multiSelectProcessor, numberProcessor, objectProcessor, processors, propsProcessor, ssrfIpClassifier, textProcessor, tryParseFriendlyPieceError };
95
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +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":";;;cAkYa,gBAAA,GACX,KAAA,WACA,OAAA,GAAU,uBAAA,KACT,kBAAA;AAAA,cAgDU,0BAAA,GACX,KAAA,cACC,kBAAA;AAAA,KAwBS,kBAAA;EACV,gBAAA;EACA,OAAA;EACA,SAAA;EACA,MAAA;EACA,YAAA;EACA,eAAA,GAAkB,MAAA;EAClB,WAAA;EACA,UAAA;EACA,aAAA;EACA,UAAA;EACA,GAAA;AAAA;AAAA,KAGG,uBAAA;EACH,GAAA;AAAA;;;iBCzaO,WAAA,CAAA;EACP,EAAA;EACA;AAAA;EAEA,EAAA;EACA,SAAA;AAAA;AAAA,cAYW,gBAAA;sBAEZ,WAAA;AAAA;;;iBC/DQ,eAAA,CAAgB,KAAA,EAAO,gBAAA,GAAmB,gBAAA;AAAA,iBAM1C,iBAAA,CAAkB,KAAA,EAAO,gBAAA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