Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

fix(pieces): file uploads and form posts in 22 pieces reach the API intact again (#16582)

Kishan Parmar7bc27fd5bfda
diff --git a/bun.lock b/bun.lock
index 73b5fd4e648..e4bbf4f1fd1 100644
--- a/bun.lock
+++ b/bun.lock
@@ -216,7 +216,7 @@
},
"packages/pieces/common": {
"name": "@activepieces/pieces-common",
- "version": "0.15.0",
+ "version": "0.15.1",
"dependencies": {
"@activepieces/core-utils": "workspace:*",
"@activepieces/pieces-framework": "workspace:*",
@@ -2038,7 +2038,7 @@
},
"packages/pieces/community/cloudconvert": {
"name": "@activepieces/piece-cloudconvert",
- "version": "0.2.0",
+ "version": "0.2.1",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -2400,7 +2400,7 @@
},
"packages/pieces/community/customgpt": {
"name": "@activepieces/piece-customgpt",
- "version": "0.1.7",
+ "version": "0.1.8",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -2732,7 +2732,7 @@
},
"packages/pieces/community/documentpro": {
"name": "@activepieces/piece-documentpro",
- "version": "0.2.1",
+ "version": "0.2.2",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -3051,7 +3051,7 @@
},
"packages/pieces/community/extracta-ai": {
"name": "@activepieces/piece-extracta-ai",
- "version": "0.1.6",
+ "version": "0.1.7",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -3256,7 +3256,7 @@
},
"packages/pieces/community/flipando": {
"name": "@activepieces/piece-flipando",
- "version": "0.1.0",
+ "version": "0.1.1",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -3307,7 +3307,7 @@
},
"packages/pieces/community/flow-parser": {
"name": "@activepieces/piece-flow-parser",
- "version": "0.1.7",
+ "version": "0.1.8",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -4122,7 +4122,7 @@
},
"packages/pieces/community/gptzero-detect-ai": {
"name": "@activepieces/piece-gptzero-detect-ai",
- "version": "0.1.7",
+ "version": "0.1.8",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -4242,7 +4242,7 @@
},
"packages/pieces/community/groq": {
"name": "@activepieces/piece-groq",
- "version": "0.4.1",
+ "version": "0.4.2",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -4404,7 +4404,7 @@
},
"packages/pieces/community/housecall-pro": {
"name": "@activepieces/piece-housecall-pro",
- "version": "0.2.0",
+ "version": "0.2.1",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -4791,7 +4791,7 @@
},
"packages/pieces/community/jotform": {
"name": "@activepieces/piece-jotform",
- "version": "0.5.2",
+ "version": "0.5.3",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -5629,7 +5629,7 @@
},
"packages/pieces/community/matomo": {
"name": "@activepieces/piece-matomo",
- "version": "0.2.1",
+ "version": "0.2.2",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -6315,7 +6315,7 @@
},
"packages/pieces/community/murf-api": {
"name": "@activepieces/piece-murf-api",
- "version": "0.2.1",
+ "version": "0.2.2",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -6452,7 +6452,7 @@
},
"packages/pieces/community/ninox": {
"name": "@activepieces/piece-ninox",
- "version": "0.2.0",
+ "version": "0.2.1",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -6819,7 +6819,7 @@
},
"packages/pieces/community/pandadoc": {
"name": "@activepieces/piece-pandadoc",
- "version": "0.2.1",
+ "version": "0.2.2",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -6872,7 +6872,7 @@
},
"packages/pieces/community/parseur": {
"name": "@activepieces/piece-parseur",
- "version": "0.2.1",
+ "version": "0.2.2",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -7023,7 +7023,7 @@
},
"packages/pieces/community/personal-ai": {
"name": "@activepieces/piece-personal-ai",
- "version": "0.1.7",
+ "version": "0.1.8",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -7063,7 +7063,7 @@
},
"packages/pieces/community/photoroom": {
"name": "@activepieces/piece-photoroom",
- "version": "0.1.8",
+ "version": "0.1.9",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -8612,7 +8612,7 @@
},
"packages/pieces/community/smartsheet": {
"name": "@activepieces/piece-smartsheet",
- "version": "0.1.9",
+ "version": "0.1.10",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -9248,7 +9248,7 @@
},
"packages/pieces/community/timelines-ai": {
"name": "@activepieces/piece-timelines-ai",
- "version": "0.2.1",
+ "version": "0.2.2",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -9904,7 +9904,7 @@
},
"packages/pieces/community/wedof": {
"name": "@activepieces/piece-wedof",
- "version": "1.4.7",
+ "version": "1.4.8",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -10299,7 +10299,7 @@
},
"packages/pieces/community/zoho-bookings": {
"name": "@activepieces/piece-zoho-bookings",
- "version": "0.1.7",
+ "version": "0.1.8",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -10398,7 +10398,7 @@
},
"packages/pieces/community/zoo": {
"name": "@activepieces/piece-zoo",
- "version": "0.1.7",
+ "version": "0.1.8",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/common/package.json b/packages/pieces/common/package.json
index 191eb1536a8..8cfeaf96777 100644
--- a/packages/pieces/common/package.json
+++ b/packages/pieces/common/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/pieces-common",
- "version": "0.15.0",
+ "version": "0.15.1",
"type": "commonjs",
"sideEffects": false,
"main": "./dist/src/index.js",
diff --git a/packages/pieces/common/src/lib/http/core/fetch-http-client.ts b/packages/pieces/common/src/lib/http/core/fetch-http-client.ts
index 010ee865c92..28a811ed4ad 100644
--- a/packages/pieces/common/src/lib/http/core/fetch-http-client.ts
+++ b/packages/pieces/common/src/lib/http/core/fetch-http-client.ts
@@ -30,7 +30,8 @@ export class FetchHttpClient extends BaseHttpClient {
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';
const { urlWithoutQueryParams, queryParams: urlQueryParams } = this.getUrl(request);
- const headers = this.getHeaders(request);
+ const requestHeaders = this.getHeaders(request);
+ const headers = isNativeFormData(request.body) ? withoutContentType(requestHeaders) : requestHeaders;
const queryParams = request.queryParams ?? {};
for (const [key, value] of Object.entries(queryParams)) {
urlQueryParams.append(key, value);
@@ -129,7 +130,7 @@ function serializeBody(
Buffer.isBuffer(body) ||
body instanceof URLSearchParams ||
body instanceof ArrayBuffer ||
- (typeof FormData !== 'undefined' && body instanceof FormData) ||
+ isNativeFormData(body) ||
(typeof Blob !== 'undefined' && body instanceof Blob)
) {
return { body: body as BodyInit, extraHeaders: {}, isStream: false };
@@ -232,6 +233,14 @@ function isNodeFormData(body: unknown): body is NodeFormData {
);
}
+function isNativeFormData(body: unknown): body is FormData {
+ return typeof FormData !== 'undefined' && body instanceof FormData;
+}
+
+function withoutContentType(headers: HttpHeaders): HttpHeaders {
+ return Object.fromEntries(Object.entries(headers).filter(([key]) => key.toLowerCase() !== 'content-type'));
+}
+
function isNil(value: unknown): value is null | undefined {
return value === null || value === undefined;
}
diff --git a/packages/pieces/common/test/native-form-data.test.ts b/packages/pieces/common/test/native-form-data.test.ts
new file mode 100644
index 00000000000..43d48a67a20
--- /dev/null
+++ b/packages/pieces/common/test/native-form-data.test.ts
@@ -0,0 +1,68 @@
+/// <reference types="vitest/globals" />
+
+import { createServer, IncomingMessage, Server } from 'node:http';
+import { AddressInfo } from 'node:net';
+import { httpClient, HttpMethod } from '../src';
+
+function startServer(): Promise<{ server: Server; url: string; received: ReceivedRequest[] }> {
+ const received: ReceivedRequest[] = [];
+ const server = createServer((req, res) => {
+ readBody(req).then((body) => {
+ received.push({ contentType: req.headers['content-type'], body });
+ res.setHeader('content-type', 'application/json');
+ res.end('{}');
+ }).catch(() => res.destroy());
+ });
+ return new Promise((resolve) => {
+ server.listen(0, '127.0.0.1', () => {
+ const { port } = server.address() as AddressInfo;
+ resolve({ server, url: `http://127.0.0.1:${port}`, received });
+ });
+ });
+}
+
+async function readBody(req: IncomingMessage): Promise<string> {
+ const chunks: Buffer[] = [];
+ for await (const chunk of req) {
+ chunks.push(Buffer.from(chunk));
+ }
+ return Buffer.concat(chunks).toString('utf-8');
+}
+
+describe('httpClient with a native FormData body', () => {
+ let server: Server;
+ let url: string;
+ let received: ReceivedRequest[];
+
+ beforeEach(async () => {
+ ({ server, url, received } = await startServer());
+ });
+
+ afterEach(() => {
+ server.close();
+ });
+
+ test.each([
+ ['no content-type', undefined],
+ ['Content-Type: multipart/form-data', { 'Content-Type': 'multipart/form-data' }],
+ ['content-type: multipart/form-data', { 'content-type': 'multipart/form-data' }],
+ ['Content-Type: application/json', { 'Content-Type': 'application/json' }],
+ ])('sends a multipart boundary when the caller sets %s', async (_label, headers) => {
+ const form = new FormData();
+ form.append('name', 'report');
+ form.append('file', new Blob([Buffer.from('hello')]), 'hello.txt');
+
+ await httpClient.sendRequest({ method: HttpMethod.POST, url, headers, body: form });
+
+ const boundary = received[0].contentType?.match(/^multipart\/form-data; boundary=(.+)$/)?.[1];
+ expect(boundary).toBeDefined();
+ expect(received[0].body).toContain(`--${boundary}`);
+ expect(received[0].body).toContain('name="file"; filename="hello.txt"');
+ expect(received[0].body).toContain('hello');
+ });
+});
+
+type ReceivedRequest = {
+ contentType: string | undefined;
+ body: string;
+};
diff --git a/packages/pieces/community/cloudconvert/package.json b/packages/pieces/community/cloudconvert/package.json
index 31e5e220981..4a3c457e93e 100644
--- a/packages/pieces/community/cloudconvert/package.json
+++ b/packages/pieces/community/cloudconvert/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-cloudconvert",
- "version": "0.2.0",
+ "version": "0.2.1",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
diff --git a/packages/pieces/community/customgpt/package.json b/packages/pieces/community/customgpt/package.json
index 0156b5a8f7d..f557af35c20 100644
--- a/packages/pieces/community/customgpt/package.json
+++ b/packages/pieces/community/customgpt/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-customgpt",
- "version": "0.1.7",
+ "version": "0.1.8",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
diff --git a/packages/pieces/community/customgpt/src/lib/actions/update-agent.ts b/packages/pieces/community/customgpt/src/lib/actions/update-agent.ts
index 3c9ec029010..d04584b1e85 100644
--- a/packages/pieces/community/customgpt/src/lib/actions/update-agent.ts
+++ b/packages/pieces/community/customgpt/src/lib/actions/update-agent.ts
@@ -1,4 +1,4 @@
-import { createAction, Property } from '@activepieces/pieces-framework';
+import { createAction, isNil, Property } from '@activepieces/pieces-framework';
import { projectId } from '../common/props';
import { BASE_URL } from '../common/client';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
@@ -60,41 +60,23 @@ export const updateAgent = createAction({
}),
},
async run({ auth, propsValue }) {
- const body: any = {};
+ const { project_id, file, ...fields } = propsValue;
+ const formData = new FormData();
- if (propsValue.project_name !== undefined) {
- body.project_name = propsValue.project_name;
- }
- if (propsValue.is_shared !== undefined) {
- body.is_shared = propsValue.is_shared;
- }
- if (propsValue.sitemap_path !== undefined) {
- body.sitemap_path = propsValue.sitemap_path;
- }
- if (propsValue.file_data_retension !== undefined) {
- body.file_data_retension = propsValue.file_data_retension;
- }
- if (propsValue.is_ocr_enabled !== undefined) {
- body.is_ocr_enabled = propsValue.is_ocr_enabled;
- }
- if (propsValue.is_anonymized !== undefined) {
- body.is_anonymized = propsValue.is_anonymized;
- }
- if (propsValue.file !== undefined) {
- body.file = propsValue.file;
- }
- if (propsValue.are_licenses_allowed !== undefined) {
- body.are_licenses_allowed = propsValue.are_licenses_allowed;
+ Object.entries(fields)
+ .filter(([, value]) => !isNil(value))
+ .forEach(([key, value]) => formData.append(key, String(value)));
+ if (!isNil(file)) {
+ formData.append('file', new Blob([new Uint8Array(file.data)]), file.filename);
}
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
- url: `${BASE_URL}/projects/${propsValue.project_id}`,
+ url: `${BASE_URL}/projects/${project_id}`,
headers: {
Authorization: `Bearer ${auth.secret_text}`,
- 'content-type': 'multipart/form-data',
},
- body,
+ body: formData,
});
return response.body;
diff --git a/packages/pieces/community/documentpro/package.json b/packages/pieces/community/documentpro/package.json
index 022051e41cb..d585bff46da 100644
--- a/packages/pieces/community/documentpro/package.json
+++ b/packages/pieces/community/documentpro/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-documentpro",
- "version": "0.2.1",
+ "version": "0.2.2",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
diff --git a/packages/pieces/community/extracta-ai/package.json b/packages/pieces/community/extracta-ai/package.json
index c9a30ab58d7..ccffc5ef537 100644
--- a/packages/pieces/community/extracta-ai/package.json
+++ b/packages/pieces/community/extracta-ai/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-extracta-ai",
- "version": "0.1.6",
+ "version": "0.1.7",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
diff --git a/packages/pieces/community/flipando/package.json b/packages/pieces/community/flipando/package.json
index fd0a3f5055c..664f2da4ef0 100644
--- a/packages/pieces/community/flipando/package.json
+++ b/packages/pieces/community/flipando/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-flipando",
- "version": "0.1.0",
+ "version": "0.1.1",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
diff --git a/packages/pieces/community/flow-parser/package.json b/packages/pieces/community/flow-parser/package.json
index 656e7c75c6d..fb729808b21 100644
--- a/packages/pieces/community/flow-parser/package.json
+++ b/packages/pieces/community/flow-parser/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-flow-parser",
- "version": "0.1.7",
+ "version": "0.1.8",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
diff --git a/packages/pieces/community/gptzero-detect-ai/package.json b/packages/pieces/community/gptzero-detect-ai/package.json
index 226b9a4b716..ef6c3dc08e0 100644
--- a/packages/pieces/community/gptzero-detect-ai/package.json
+++ b/packages/pieces/community/gptzero-detect-ai/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-gptzero-detect-ai",
- "version": "0.1.7",
+ "version": "0.1.8",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
diff --git a/packages/pieces/community/groq/package.json b/packages/pieces/community/groq/package.json
index 389629fe95f..ff48bdd6921 100644
--- a/packages/pieces/community/groq/package.json
+++ b/packages/pieces/community/groq/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-groq",
- "version": "0.4.1",
+ "version": "0.4.2",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/housecall-pro/package.json b/packages/pieces/community/housecall-pro/package.json
index 2efe61be94e..c96405c8f54 100644
--- a/packages/pieces/community/housecall-pro/package.json
+++ b/packages/pieces/community/housecall-pro/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-housecall-pro",
- "version": "0.2.0",
+ "version": "0.2.1",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
diff --git a/packages/pieces/community/jotform/package.json b/packages/pieces/community/jotform/package.json
index 567e2eca39b..8a4dc851c9b 100644
--- a/packages/pieces/community/jotform/package.json
+++ b/packages/pieces/community/jotform/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-jotform",
- "version": "0.5.2",
+ "version": "0.5.3",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/jotform/src/lib/common/index.ts b/packages/pieces/community/jotform/src/lib/common/index.ts
index e0279ef990a..48724301d35 100644
--- a/packages/pieces/community/jotform/src/lib/common/index.ts
+++ b/packages/pieces/community/jotform/src/lib/common/index.ts
@@ -137,7 +137,7 @@ export const jotformCommon = {
)}/form/${formId}/webhooks`,
headers: {
APIKEY: authentication.props.apiKey,
- 'Content-Type': 'multipart/form-data',
+ 'Content-Type': 'application/x-www-form-urlencoded',
},
body: {
webhookURL: webhookUrl,
diff --git a/packages/pieces/community/matomo/package.json b/packages/pieces/community/matomo/package.json
index ca67f6d5250..3effd537b30 100644
--- a/packages/pieces/community/matomo/package.json
+++ b/packages/pieces/community/matomo/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-matomo",
- "version": "0.2.1",
+ "version": "0.2.2",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/murf-api/package.json b/packages/pieces/community/murf-api/package.json
index 1b5ff06d87c..316c7c9ea2c 100644
--- a/packages/pieces/community/murf-api/package.json
+++ b/packages/pieces/community/murf-api/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-murf-api",
- "version": "0.2.1",
+ "version": "0.2.2",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
diff --git a/packages/pieces/community/murf-api/src/lib/actions/voice-change.ts b/packages/pieces/community/murf-api/src/lib/actions/voice-change.ts
index 67fffcad0d2..a8b73dda805 100644
--- a/packages/pieces/community/murf-api/src/lib/actions/voice-change.ts
+++ b/packages/pieces/community/murf-api/src/lib/actions/voice-change.ts
@@ -98,8 +98,7 @@ export const voiceChange = createAction({
if (file) {
try {
const fileBuffer = Buffer.from(file.base64, "base64");
- const blob = new Blob([fileBuffer]);
- formData.append("file", blob, file.filename);
+ formData.append("file", fileBuffer, { filename: file.filename });
} catch (e) {
throw new Error("Failed to process uploaded file. Ensure it's a valid audio file.");
}
diff --git a/packages/pieces/community/ninox/package.json b/packages/pieces/community/ninox/package.json
index 72970765408..590b95e903e 100644
--- a/packages/pieces/community/ninox/package.json
+++ b/packages/pieces/community/ninox/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-ninox",
- "version": "0.2.0",
+ "version": "0.2.1",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/pandadoc/package.json b/packages/pieces/community/pandadoc/package.json
index f92284c4f36..904f56bf0a4 100644
--- a/packages/pieces/community/pandadoc/package.json
+++ b/packages/pieces/community/pandadoc/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-pandadoc",
- "version": "0.2.1",
+ "version": "0.2.2",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/parseur/package.json b/packages/pieces/community/parseur/package.json
index ba276df8102..1ead6f49b22 100644
--- a/packages/pieces/community/parseur/package.json
+++ b/packages/pieces/community/parseur/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-parseur",
- "version": "0.2.1",
+ "version": "0.2.2",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
diff --git a/packages/pieces/community/personal-ai/package.json b/packages/pieces/community/personal-ai/package.json
index ba83a16d22f..b48c630d802 100644
--- a/packages/pieces/community/personal-ai/package.json
+++ b/packages/pieces/community/personal-ai/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-personal-ai",
- "version": "0.1.7",
+ "version": "0.1.8",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/photoroom/package.json b/packages/pieces/community/photoroom/package.json
index d188e094db0..22ae0b49930 100644
--- a/packages/pieces/community/photoroom/package.json
+++ b/packages/pieces/community/photoroom/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-photoroom",
- "version": "0.1.8",
+ "version": "0.1.9",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/smartsheet/package.json b/packages/pieces/community/smartsheet/package.json
index fc008abf838..b23224f75e1 100644
--- a/packages/pieces/community/smartsheet/package.json
+++ b/packages/pieces/community/smartsheet/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-smartsheet",
- "version": "0.1.9",
+ "version": "0.1.10",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/timelines-ai/package.json b/packages/pieces/community/timelines-ai/package.json
index 5dd0d35fbf6..93ad85c496c 100644
--- a/packages/pieces/community/timelines-ai/package.json
+++ b/packages/pieces/community/timelines-ai/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-timelines-ai",
- "version": "0.2.1",
+ "version": "0.2.2",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
diff --git a/packages/pieces/community/wedof/package.json b/packages/pieces/community/wedof/package.json
index 15bc3f41c37..c1e8b130f9a 100644
--- a/packages/pieces/community/wedof/package.json
+++ b/packages/pieces/community/wedof/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-wedof",
- "version": "1.4.7",
+ "version": "1.4.8",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/wedof/src/lib/actions/send-file.ts b/packages/pieces/community/wedof/src/lib/actions/send-file.ts
index 050fc3c8f7f..1dedbe2116f 100644
--- a/packages/pieces/community/wedof/src/lib/actions/send-file.ts
+++ b/packages/pieces/community/wedof/src/lib/actions/send-file.ts
@@ -1,5 +1,5 @@
import { wedofAuth } from '../auth';
-import { createAction, DynamicPropsValue, Property } from '@activepieces/pieces-framework';
+import { createAction, DynamicPropsValue, isNil, Property } from '@activepieces/pieces-framework';
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
import { wedofCommon } from '../common/wedof';
@@ -146,12 +146,21 @@ export const sendFile = createAction({
}),
},
async run(context) {
- const message = {
- title: context.propsValue.title ?? null,
- typeId: String(context.propsValue.typeId['undefined'])?? null,
- file:context.propsValue.files['file'] ?? null,
- fileToDownload: context.propsValue.files['fileToDownload'] ?? null,
- };
+ const { title, typeId, files } = context.propsValue;
+ const file = files['file'];
+ const formData = new FormData();
+ formData.append('typeId', String(typeId['undefined']));
+ if (!isNil(title)) {
+ formData.append('title', title);
+ }
+ if (isUploadedFile(file)) {
+ formData.append('file', new Blob([new Uint8Array(file.data)]), file.filename);
+ } else if (!isNil(file)) {
+ formData.append('file', String(file));
+ }
+ if (!isNil(files['fileToDownload'])) {
+ formData.append('fileToDownload', String(files['fileToDownload']));
+ }
return (
await httpClient.sendRequest({
method: HttpMethod.POST,
@@ -160,12 +169,22 @@ export const sendFile = createAction({
'/' +
context.propsValue.entityClass +
'/'+ context.propsValue.externalId + '/files',
- body: message,
+ body: formData,
headers: {
- 'Content-Type': 'multipart/form-data',
'X-Api-Key': context.auth.secret_text,
},
})
).body;
},
-});
\ No newline at end of file
+});
+
+function isUploadedFile(value: unknown): value is { filename: string; data: Buffer } {
+ return (
+ typeof value === 'object' &&
+ value !== null &&
+ 'filename' in value &&
+ typeof value.filename === 'string' &&
+ 'data' in value &&
+ Buffer.isBuffer(value.data)
+ );
+}
diff --git a/packages/pieces/community/zoho-bookings/package.json b/packages/pieces/community/zoho-bookings/package.json
index 57ef8fe56e0..3c52178324a 100644
--- a/packages/pieces/community/zoho-bookings/package.json
+++ b/packages/pieces/community/zoho-bookings/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-zoho-bookings",
- "version": "0.1.7",
+ "version": "0.1.8",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
diff --git a/packages/pieces/community/zoho-bookings/src/lib/common/index.ts b/packages/pieces/community/zoho-bookings/src/lib/common/index.ts
index 4a3ad219545..7b7a204bdf1 100644
--- a/packages/pieces/community/zoho-bookings/src/lib/common/index.ts
+++ b/packages/pieces/community/zoho-bookings/src/lib/common/index.ts
@@ -169,7 +169,8 @@ export const zohoBookingsCommon = {
});
console.log(JSON.stringify(response.body.response));
- return response.body?.response?.returnvalue?.response || [];
+ const appointments = response.body?.response?.returnvalue?.response;
+ return Array.isArray(appointments) ? appointments : [];
},
// Schemas
diff --git a/packages/pieces/community/zoho-bookings/src/lib/common/schemas.ts b/packages/pieces/community/zoho-bookings/src/lib/common/schemas.ts
index 66931699c00..12b22419c2f 100644
--- a/packages/pieces/community/zoho-bookings/src/lib/common/schemas.ts
+++ b/packages/pieces/community/zoho-bookings/src/lib/common/schemas.ts
@@ -40,5 +40,4 @@ export const getAppointmentDetails = {
export const cancelAppointment = {
booking_id: z.string().check(z.minLength(1)),
- action: z.enum(['cancel', 'completed', 'noshow']),
};
\ No newline at end of file
diff --git a/packages/pieces/community/zoo/package.json b/packages/pieces/community/zoo/package.json
index b8902b84eeb..5cccacb6e8f 100644
--- a/packages/pieces/community/zoo/package.json
+++ b/packages/pieces/community/zoo/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-zoo",
- "version": "0.1.7",
+ "version": "0.1.8",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/zoo/src/i18n/translation.json b/packages/pieces/community/zoo/src/i18n/translation.json
index ba7735935eb..be626d68b08 100644
--- a/packages/pieces/community/zoo/src/i18n/translation.json
+++ b/packages/pieces/community/zoo/src/i18n/translation.json
@@ -333,5 +333,24 @@
"Liters": "Liters",
"Gallons": "Gallons",
"Milliliters": "Milliliters",
- "Fluid Ounces": "Fluid Ounces"
-}
\ No newline at end of file
+ "Fluid Ounces": "Fluid Ounces",
+ "Material Density": "Material Density",
+ "Density of the material the part is made of, in the unit below": "Density of the material the part is made of, in the unit below",
+ "Material Density Unit": "Material Density Unit",
+ "kg/m³": "kg/m³",
+ "lb/ft³": "lb/ft³",
+ "Material Mass": "Material Mass",
+ "Mass of the part, in the unit below": "Mass of the part, in the unit below",
+ "Material Mass Unit": "Material Mass Unit",
+ "g": "g",
+ "kg": "kg",
+ "lb": "lb",
+ "Format of the CAD file. Leave empty to detect it from the file name.": "Format of the CAD file. Leave empty to detect it from the file name.",
+ "ACIS": "ACIS",
+ "CATIA": "CATIA",
+ "CREO": "CREO",
+ "INVENTOR": "INVENTOR",
+ "NX": "NX",
+ "PARASOLID": "PARASOLID",
+ "SLDPRT": "SLDPRT"
+}
diff --git a/packages/pieces/community/zoo/src/lib/actions/file/convert-cad-file.action.ts b/packages/pieces/community/zoo/src/lib/actions/file/convert-cad-file.action.ts
index 3f68aea3c19..7ea19cfbfce 100644
--- a/packages/pieces/community/zoo/src/lib/actions/file/convert-cad-file.action.ts
+++ b/packages/pieces/community/zoo/src/lib/actions/file/convert-cad-file.action.ts
@@ -49,16 +49,14 @@ export const convertCadFileAction = createAction({
}),
},
async run({ auth, propsValue }) {
- const formData = new FormData();
- formData.append('file', new Blob([propsValue.file.data as any]), propsValue.file.filename);
-
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `https://api.zoo.dev/file/conversion/${propsValue.sourceFormat}/${propsValue.outputFormat}`,
headers: {
Authorization: `Bearer ${auth.secret_text}`,
+ 'Content-Type': 'application/octet-stream',
},
- body: formData,
+ body: propsValue.file.data,
});
return response.body;
},
diff --git a/packages/pieces/community/zoo/src/lib/actions/file/get-center-of-mass.action.ts b/packages/pieces/community/zoo/src/lib/actions/file/get-center-of-mass.action.ts
index 26eff198523..6b2724d76c6 100644
--- a/packages/pieces/community/zoo/src/lib/actions/file/get-center-of-mass.action.ts
+++ b/packages/pieces/community/zoo/src/lib/actions/file/get-center-of-mass.action.ts
@@ -1,6 +1,6 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { zooAuth } from '../../auth'
-import { httpClient, HttpMethod } from '@activepieces/pieces-common';
+import { cadFileAnalysis } from '../../common/cad-file-analysis';
export const getCenterOfMassAction = createAction({
name: 'get_center_of_mass',
@@ -17,19 +17,9 @@ export const getCenterOfMassAction = createAction({
required: true,
description: 'The CAD file to analyze',
}),
+ sourceFormat: cadFileAnalysis.sourceFormat,
},
async run({ auth, propsValue }) {
- const formData = new FormData();
- formData.append('file', new Blob([propsValue.file.data as any]), propsValue.file.filename);
-
- const response = await httpClient.sendRequest({
- method: HttpMethod.POST,
- url: 'https://api.zoo.dev/file/center-of-mass',
- headers: {
- Authorization: `Bearer ${auth.secret_text}`,
- },
- body: formData,
- });
- return response.body;
+ return cadFileAnalysis.analyze({ token: auth.secret_text, endpoint: 'center-of-mass', file: propsValue.file, sourceFormat: propsValue.sourceFormat });
},
});
diff --git a/packages/pieces/community/zoo/src/lib/actions/file/get-density.action.ts b/packages/pieces/community/zoo/src/lib/actions/file/get-density.action.ts
index 4fe752041dc..102b18cb212 100644
--- a/packages/pieces/community/zoo/src/lib/actions/file/get-density.action.ts
+++ b/packages/pieces/community/zoo/src/lib/actions/file/get-density.action.ts
@@ -1,6 +1,6 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { zooAuth } from '../../auth'
-import { httpClient, HttpMethod } from '@activepieces/pieces-common';
+import { cadFileAnalysis } from '../../common/cad-file-analysis';
export const getDensityAction = createAction({
name: 'get_density',
@@ -17,19 +17,35 @@ export const getDensityAction = createAction({
required: true,
description: 'The CAD file to analyze',
}),
+ sourceFormat: cadFileAnalysis.sourceFormat,
+ materialMass: Property.Number({
+ displayName: 'Material Mass',
+ description: 'Mass of the part, in the unit below',
+ required: true,
+ }),
+ materialMassUnit: Property.StaticDropdown({
+ displayName: 'Material Mass Unit',
+ required: true,
+ defaultValue: 'kg',
+ options: {
+ options: [
+ { label: 'g', value: 'g' },
+ { label: 'kg', value: 'kg' },
+ { label: 'lb', value: 'lb' },
+ ],
+ },
+ }),
},
async run({ auth, propsValue }) {
- const formData = new FormData();
- formData.append('file', new Blob([propsValue.file.data as any]), propsValue.file.filename);
-
- const response = await httpClient.sendRequest({
- method: HttpMethod.POST,
- url: 'https://api.zoo.dev/file/density',
- headers: {
- Authorization: `Bearer ${auth.secret_text}`,
+ return cadFileAnalysis.analyze({
+ token: auth.secret_text,
+ endpoint: 'density',
+ file: propsValue.file,
+ sourceFormat: propsValue.sourceFormat,
+ queryParams: {
+ material_mass: String(propsValue.materialMass),
+ material_mass_unit: propsValue.materialMassUnit,
},
- body: formData,
});
- return response.body;
},
});
diff --git a/packages/pieces/community/zoo/src/lib/actions/file/get-mass.action.ts b/packages/pieces/community/zoo/src/lib/actions/file/get-mass.action.ts
index f4328df1c48..f66a68321c8 100644
--- a/packages/pieces/community/zoo/src/lib/actions/file/get-mass.action.ts
+++ b/packages/pieces/community/zoo/src/lib/actions/file/get-mass.action.ts
@@ -1,6 +1,6 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { zooAuth } from '../../auth'
-import { httpClient, HttpMethod } from '@activepieces/pieces-common';
+import { cadFileAnalysis } from '../../common/cad-file-analysis';
export const getMassAction = createAction({
name: 'get_mass',
@@ -17,19 +17,34 @@ export const getMassAction = createAction({
required: true,
description: 'The CAD file to analyze',
}),
+ sourceFormat: cadFileAnalysis.sourceFormat,
+ materialDensity: Property.Number({
+ displayName: 'Material Density',
+ description: 'Density of the material the part is made of, in the unit below',
+ required: true,
+ }),
+ materialDensityUnit: Property.StaticDropdown({
+ displayName: 'Material Density Unit',
+ required: true,
+ defaultValue: 'kg:m3',
+ options: {
+ options: [
+ { label: 'kg/m³', value: 'kg:m3' },
+ { label: 'lb/ft³', value: 'lb:ft3' },
+ ],
+ },
+ }),
},
async run({ auth, propsValue }) {
- const formData = new FormData();
- formData.append('file', new Blob([propsValue.file.data as any]), propsValue.file.filename);
-
- const response = await httpClient.sendRequest({
- method: HttpMethod.POST,
- url: 'https://api.zoo.dev/file/mass',
- headers: {
- Authorization: `Bearer ${auth.secret_text}`,
+ return cadFileAnalysis.analyze({
+ token: auth.secret_text,
+ endpoint: 'mass',
+ file: propsValue.file,
+ sourceFormat: propsValue.sourceFormat,
+ queryParams: {
+ material_density: String(propsValue.materialDensity),
+ material_density_unit: propsValue.materialDensityUnit,
},
- body: formData,
});
- return response.body;
},
});
diff --git a/packages/pieces/community/zoo/src/lib/actions/file/get-surface-area.action.ts b/packages/pieces/community/zoo/src/lib/actions/file/get-surface-area.action.ts
index b79b63536e6..9d4e893315b 100644
--- a/packages/pieces/community/zoo/src/lib/actions/file/get-surface-area.action.ts
+++ b/packages/pieces/community/zoo/src/lib/actions/file/get-surface-area.action.ts
@@ -1,6 +1,6 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { zooAuth } from '../../auth'
-import { httpClient, HttpMethod } from '@activepieces/pieces-common';
+import { cadFileAnalysis } from '../../common/cad-file-analysis';
export const getSurfaceAreaAction = createAction({
name: 'get_surface_area',
@@ -17,19 +17,9 @@ export const getSurfaceAreaAction = createAction({
required: true,
description: 'The CAD file to analyze',
}),
+ sourceFormat: cadFileAnalysis.sourceFormat,
},
async run({ auth, propsValue }) {
- const formData = new FormData();
- formData.append('file', new Blob([propsValue.file.data as any]), propsValue.file.filename);
-
- const response = await httpClient.sendRequest({
- method: HttpMethod.POST,
- url: 'https://api.zoo.dev/file/surface-area',
- headers: {
- Authorization: `Bearer ${auth.secret_text}`,
- },
- body: formData,
- });
- return response.body;
+ return cadFileAnalysis.analyze({ token: auth.secret_text, endpoint: 'surface-area', file: propsValue.file, sourceFormat: propsValue.sourceFormat });
},
});
diff --git a/packages/pieces/community/zoo/src/lib/actions/file/get-volume.action.ts b/packages/pieces/community/zoo/src/lib/actions/file/get-volume.action.ts
index 513f3e4c28e..4e353031ec5 100644
--- a/packages/pieces/community/zoo/src/lib/actions/file/get-volume.action.ts
+++ b/packages/pieces/community/zoo/src/lib/actions/file/get-volume.action.ts
@@ -1,6 +1,6 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { zooAuth } from '../../auth'
-import { httpClient, HttpMethod } from '@activepieces/pieces-common';
+import { cadFileAnalysis } from '../../common/cad-file-analysis';
export const getVolumeAction = createAction({
name: 'get_volume',
@@ -17,19 +17,9 @@ export const getVolumeAction = createAction({
required: true,
description: 'The CAD file to analyze',
}),
+ sourceFormat: cadFileAnalysis.sourceFormat,
},
async run({ auth, propsValue }) {
- const formData = new FormData();
- formData.append('file', new Blob([propsValue.file.data as any]), propsValue.file.filename);
-
- const response = await httpClient.sendRequest({
- method: HttpMethod.POST,
- url: 'https://api.zoo.dev/file/volume',
- headers: {
- Authorization: `Bearer ${auth.secret_text}`,
- },
- body: formData,
- });
- return response.body;
+ return cadFileAnalysis.analyze({ token: auth.secret_text, endpoint: 'volume', file: propsValue.file, sourceFormat: propsValue.sourceFormat });
},
});
diff --git a/packages/pieces/community/zoo/src/lib/common/cad-file-analysis.ts b/packages/pieces/community/zoo/src/lib/common/cad-file-analysis.ts
new file mode 100644
index 00000000000..6a313fd6fcd
--- /dev/null
+++ b/packages/pieces/community/zoo/src/lib/common/cad-file-analysis.ts
@@ -0,0 +1,50 @@
+import { ApFile, Property } from '@activepieces/pieces-framework';
+import { httpClient, HttpMethod } from '@activepieces/pieces-common';
+
+async function analyze({ token, endpoint, file, sourceFormat, queryParams = {} }: AnalyzeParams): Promise<unknown> {
+ const response = await httpClient.sendRequest({
+ method: HttpMethod.POST,
+ url: `https://api.zoo.dev/file/${endpoint}`,
+ headers: {
+ Authorization: `Bearer ${token}`,
+ 'Content-Type': 'application/octet-stream',
+ },
+ queryParams: { src_format: sourceFormat || sourceFormatFromName({ file }), ...queryParams },
+ body: file.data,
+ });
+ return response.body;
+}
+
+function sourceFormatFromName({ file }: { file: ApFile }): string {
+ const extension = (file.extension ?? file.filename.split('.').pop() ?? '').replace(/^\./, '').toLowerCase();
+ const format = EXTENSION_ALIASES[extension] ?? extension;
+ if (!IMPORT_FORMATS.includes(format)) {
+ throw new Error(
+ `Could not tell the CAD format from the file name "${file.filename}". Set Source Format, or use a file ending in one of: ${[...IMPORT_FORMATS, ...Object.keys(EXTENSION_ALIASES)].join(', ')}.`
+ );
+ }
+ return format;
+}
+
+const IMPORT_FORMATS = ['acis', 'catia', 'creo', 'fbx', 'gltf', 'inventor', 'nx', 'obj', 'parasolid', 'ply', 'sldprt', 'step', 'stl'];
+
+const EXTENSION_ALIASES: Record<string, string> = { stp: 'step', glb: 'gltf' };
+
+const sourceFormat = Property.StaticDropdown({
+ displayName: 'Source Format',
+ description: 'Format of the CAD file. Leave empty to detect it from the file name.',
+ required: false,
+ options: {
+ options: IMPORT_FORMATS.map((format) => ({ label: format.toUpperCase(), value: format })),
+ },
+});
+
+export const cadFileAnalysis = { analyze, sourceFormat };
+
+type AnalyzeParams = {
+ token: string;
+ endpoint: string;
+ file: ApFile;
+ sourceFormat?: string;
+ queryParams?: Record<string, string>;
+};