@activepieces/piece-cloudconvert 0.0.1

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.
Files changed (47) hide show
  1. package/README.md +7 -0
  2. package/package.json +32 -0
  3. package/src/index.d.ts +1 -0
  4. package/src/index.js +45 -0
  5. package/src/index.js.map +1 -0
  6. package/src/lib/actions/archive-file.d.ts +11 -0
  7. package/src/lib/actions/archive-file.js +251 -0
  8. package/src/lib/actions/archive-file.js.map +1 -0
  9. package/src/lib/actions/capture-website.d.ts +28 -0
  10. package/src/lib/actions/capture-website.js +347 -0
  11. package/src/lib/actions/capture-website.js.map +1 -0
  12. package/src/lib/actions/convert-file.d.ts +14 -0
  13. package/src/lib/actions/convert-file.js +228 -0
  14. package/src/lib/actions/convert-file.js.map +1 -0
  15. package/src/lib/actions/download-file.d.ts +5 -0
  16. package/src/lib/actions/download-file.js +167 -0
  17. package/src/lib/actions/download-file.js.map +1 -0
  18. package/src/lib/actions/merge-pdf.d.ts +10 -0
  19. package/src/lib/actions/merge-pdf.js +237 -0
  20. package/src/lib/actions/merge-pdf.js.map +1 -0
  21. package/src/lib/actions/optimize-file.d.ts +16 -0
  22. package/src/lib/actions/optimize-file.js +285 -0
  23. package/src/lib/actions/optimize-file.js.map +1 -0
  24. package/src/lib/common/auth.d.ts +1 -0
  25. package/src/lib/common/auth.js +29 -0
  26. package/src/lib/common/auth.js.map +1 -0
  27. package/src/lib/common/client.d.ts +99 -0
  28. package/src/lib/common/client.js +283 -0
  29. package/src/lib/common/client.js.map +1 -0
  30. package/src/lib/common/index.d.ts +9 -0
  31. package/src/lib/common/index.js +33 -0
  32. package/src/lib/common/index.js.map +1 -0
  33. package/src/lib/common/properties.d.ts +14 -0
  34. package/src/lib/common/properties.js +242 -0
  35. package/src/lib/common/properties.js.map +1 -0
  36. package/src/lib/common/schemas.d.ts +533 -0
  37. package/src/lib/common/schemas.js +178 -0
  38. package/src/lib/common/schemas.js.map +1 -0
  39. package/src/lib/triggers/job-failed.d.ts +2 -0
  40. package/src/lib/triggers/job-failed.js +111 -0
  41. package/src/lib/triggers/job-failed.js.map +1 -0
  42. package/src/lib/triggers/job-finished.d.ts +2 -0
  43. package/src/lib/triggers/job-finished.js +150 -0
  44. package/src/lib/triggers/job-finished.js.map +1 -0
  45. package/src/lib/triggers/new-job.d.ts +2 -0
  46. package/src/lib/triggers/new-job.js +124 -0
  47. package/src/lib/triggers/new-job.js.map +1 -0
@@ -0,0 +1,285 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.optimizeFile = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const common_1 = require("../common");
8
+ const pieces_framework_2 = require("@activepieces/pieces-framework");
9
+ const optimizeFileProps = () => ({
10
+ import_method: pieces_framework_2.Property.StaticDropdown({
11
+ displayName: 'Import Method',
12
+ description: 'How to import the file for optimization',
13
+ required: true,
14
+ options: {
15
+ options: [
16
+ { label: 'File Upload', value: 'upload' },
17
+ { label: 'File URL', value: 'url' },
18
+ { label: 'Stored File ID', value: 'stored_file' },
19
+ ]
20
+ },
21
+ defaultValue: 'upload'
22
+ }),
23
+ file: pieces_framework_2.Property.File({
24
+ displayName: 'File',
25
+ description: 'File to upload and optimize (PDF, PNG, JPG)',
26
+ required: false,
27
+ }),
28
+ url: pieces_framework_2.Property.ShortText({
29
+ displayName: 'File URL',
30
+ description: 'URL of the file to optimize',
31
+ required: false,
32
+ }),
33
+ stored_file_id: pieces_framework_2.Property.ShortText({
34
+ displayName: 'Stored File ID',
35
+ description: 'ID of a previously stored file in Activepieces to optimize',
36
+ required: false,
37
+ }),
38
+ input_format: pieces_framework_2.Property.StaticDropdown({
39
+ displayName: 'Input Format',
40
+ description: 'The current format of the file. If not set, the extension of the input file is used',
41
+ required: false,
42
+ options: {
43
+ options: [
44
+ { label: 'PDF', value: 'pdf' },
45
+ { label: 'PNG', value: 'png' },
46
+ { label: 'JPG', value: 'jpg' },
47
+ ]
48
+ }
49
+ }),
50
+ profile: pieces_framework_2.Property.StaticDropdown({
51
+ displayName: 'Optimization Profile',
52
+ description: 'Optimization profile for specific target needs',
53
+ required: false,
54
+ defaultValue: 'web',
55
+ options: {
56
+ options: [
57
+ { label: 'Web - Remove redundant data for the web', value: 'web' },
58
+ { label: 'Print - Optimized for printing', value: 'print' },
59
+ { label: 'Archive - Optimized for archiving purposes', value: 'archive' },
60
+ { label: 'MRC - Optimized for scanned images', value: 'mrc' },
61
+ { label: 'Max - Maximal size reduction', value: 'max' },
62
+ ]
63
+ }
64
+ }),
65
+ flatten_signatures: pieces_framework_2.Property.Checkbox({
66
+ displayName: 'Flatten Signatures',
67
+ description: 'Flatten visible signatures and keep them as non-editable graphics',
68
+ required: false,
69
+ defaultValue: false,
70
+ }),
71
+ colorspace: pieces_framework_2.Property.StaticDropdown({
72
+ displayName: 'Color Space',
73
+ description: 'Color space of raster images',
74
+ required: false,
75
+ options: {
76
+ options: [
77
+ { label: 'Unchanged', value: 'unchanged' },
78
+ { label: 'RGB', value: 'rgb' },
79
+ { label: 'CMYK', value: 'cmyk' },
80
+ { label: 'Grayscale', value: 'grayscale' },
81
+ ]
82
+ }
83
+ }),
84
+ filename: pieces_framework_2.Property.ShortText({
85
+ displayName: 'Output Filename',
86
+ description: 'Choose a filename (including extension) for the output file',
87
+ required: false,
88
+ defaultValue: 'optimized-document.pdf'
89
+ }),
90
+ engine: pieces_framework_2.Property.StaticDropdown({
91
+ displayName: 'Engine',
92
+ description: 'Use a specific engine for the optimization',
93
+ required: false,
94
+ options: {
95
+ options: [
96
+ { label: '3-Heights', value: '3heights' },
97
+ { label: 'PDF Tools', value: 'pdftools' },
98
+ ]
99
+ }
100
+ }),
101
+ engine_version: pieces_framework_2.Property.ShortText({
102
+ displayName: 'Engine Version',
103
+ description: 'Use a specific engine version for the optimization',
104
+ required: false,
105
+ }),
106
+ timeout: pieces_framework_2.Property.Number({
107
+ displayName: 'Timeout (seconds)',
108
+ description: 'Timeout in seconds after which the task will be cancelled',
109
+ required: false,
110
+ }),
111
+ wait_for_completion: pieces_framework_2.Property.Checkbox({
112
+ displayName: 'Wait for Completion',
113
+ description: 'Wait for the optimization to complete before returning',
114
+ required: true,
115
+ defaultValue: true,
116
+ }),
117
+ store_file: pieces_framework_2.Property.Checkbox({
118
+ displayName: 'Store File',
119
+ description: 'Download and store the optimized file in Activepieces',
120
+ required: false,
121
+ defaultValue: true,
122
+ }),
123
+ });
124
+ exports.optimizeFile = (0, pieces_framework_1.createAction)({
125
+ name: 'optimize_file',
126
+ displayName: 'Optimize File',
127
+ description: 'Creates a task to optimize and compress a file',
128
+ auth: common_1.cloudconvertAuth,
129
+ requireAuth: true,
130
+ props: optimizeFileProps(),
131
+ run(context) {
132
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
133
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
134
+ yield common_1.optimizeFileSchema.parseAsync(context.propsValue);
135
+ const { import_method, url, file, stored_file_id, input_format, profile, flatten_signatures, colorspace, filename, engine, engine_version, timeout, wait_for_completion, store_file } = context.propsValue;
136
+ const client = new common_1.CloudConvertClient(context.auth);
137
+ try {
138
+ const jobTasks = {};
139
+ // Import task
140
+ if (import_method === 'url') {
141
+ if (!url) {
142
+ throw new Error('File URL is required when using URL import method');
143
+ }
144
+ jobTasks['import-file'] = Object.assign({ operation: 'import/url', url: url }, (filename && { filename }));
145
+ }
146
+ else if (import_method === 'stored_file') {
147
+ if (!stored_file_id) {
148
+ throw new Error('Stored File ID is required when using stored file import method');
149
+ }
150
+ if (!((_a = context.server) === null || _a === void 0 ? void 0 : _a.apiUrl)) {
151
+ throw new Error('Server API URL is not available. Please check your Activepieces server configuration.');
152
+ }
153
+ const baseUrl = context.server.apiUrl.replace(/\/$/, '');
154
+ const fileUrl = `${baseUrl}/v1/step-files/${stored_file_id}`;
155
+ try {
156
+ new URL(fileUrl);
157
+ }
158
+ catch (urlError) {
159
+ throw new Error(`Invalid file URL constructed: ${fileUrl}. URL Error: ${urlError instanceof Error ? urlError.message : String(urlError)}`);
160
+ }
161
+ jobTasks['import-file'] = Object.assign({ operation: 'import/url', url: fileUrl }, (filename && { filename }));
162
+ }
163
+ else if (import_method === 'upload') {
164
+ if (!file || !file.base64) {
165
+ throw new Error('Please select a file to upload from your device');
166
+ }
167
+ const uploadTask = yield client.createUploadTask(file.filename || 'uploaded-file');
168
+ const uploadUrl = uploadTask.result.form.url;
169
+ const uploadForm = uploadTask.result.form.parameters;
170
+ const formData = new FormData();
171
+ Object.entries(uploadForm).forEach(([key, value]) => {
172
+ formData.append(key, value);
173
+ });
174
+ if (file.base64) {
175
+ const buffer = Buffer.from(file.base64, 'base64');
176
+ const blob = new Blob([buffer], { type: file.extension ? `application/${file.extension}` : 'application/octet-stream' });
177
+ formData.append('file', blob, file.filename);
178
+ }
179
+ const uploadResponse = yield pieces_common_1.httpClient.sendRequest({
180
+ method: pieces_common_1.HttpMethod.POST,
181
+ url: uploadUrl,
182
+ body: formData,
183
+ });
184
+ if (uploadResponse.status < 200 || uploadResponse.status >= 300) {
185
+ throw new Error(`Failed to upload file: HTTP ${uploadResponse.status} - ${((_b = uploadResponse.body) === null || _b === void 0 ? void 0 : _b.message) || 'Upload failed'}`);
186
+ }
187
+ jobTasks['import-file'] = Object.assign({ operation: 'import/upload' }, (filename && { filename }));
188
+ }
189
+ else {
190
+ throw new Error('Invalid import method selected');
191
+ }
192
+ const optimizeOptions = {
193
+ input: 'import-file',
194
+ };
195
+ if (input_format)
196
+ optimizeOptions.input_format = input_format;
197
+ if (profile)
198
+ optimizeOptions.profile = profile;
199
+ if (flatten_signatures !== undefined)
200
+ optimizeOptions.flatten_signatures = flatten_signatures;
201
+ if (colorspace)
202
+ optimizeOptions.colorspace = colorspace;
203
+ if (filename)
204
+ optimizeOptions.filename = filename;
205
+ if (engine)
206
+ optimizeOptions.engine = engine;
207
+ if (engine_version)
208
+ optimizeOptions.engine_version = engine_version;
209
+ if (timeout)
210
+ optimizeOptions.timeout = timeout;
211
+ jobTasks['optimize-file'] = Object.assign({ operation: 'optimize' }, optimizeOptions);
212
+ jobTasks['export-file'] = {
213
+ operation: 'export/url',
214
+ input: 'optimize-file'
215
+ };
216
+ const job = yield client.createJob(jobTasks, `optimize-${Date.now()}`);
217
+ if (wait_for_completion) {
218
+ let attempts = 0;
219
+ const maxAttempts = 60;
220
+ while (attempts < maxAttempts) {
221
+ const currentJob = yield client.getJob(job.id);
222
+ if (currentJob.status === 'finished') {
223
+ const exportTaskData = (_c = currentJob.tasks) === null || _c === void 0 ? void 0 : _c.find((task) => task.name === 'export-file');
224
+ const downloadUrl = (_f = (_e = (_d = exportTaskData === null || exportTaskData === void 0 ? void 0 : exportTaskData.result) === null || _d === void 0 ? void 0 : _d.files) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.url;
225
+ const outputFilename = ((_j = (_h = (_g = exportTaskData === null || exportTaskData === void 0 ? void 0 : exportTaskData.result) === null || _g === void 0 ? void 0 : _g.files) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.filename) || `optimized-${input_format || 'file'}`;
226
+ let storedFileId;
227
+ if (store_file && downloadUrl) {
228
+ try {
229
+ const fileResponse = yield pieces_common_1.httpClient.sendRequest({
230
+ method: pieces_common_1.HttpMethod.GET,
231
+ url: downloadUrl,
232
+ });
233
+ if (fileResponse.status === 200 && fileResponse.body) {
234
+ let fileData;
235
+ if (typeof fileResponse.body === 'string') {
236
+ fileData = Buffer.from(fileResponse.body, 'binary');
237
+ }
238
+ else {
239
+ fileData = Buffer.from(fileResponse.body);
240
+ }
241
+ storedFileId = yield context.files.write({
242
+ data: fileData,
243
+ fileName: outputFilename,
244
+ });
245
+ }
246
+ }
247
+ catch (error) {
248
+ // Continue without throwing
249
+ }
250
+ }
251
+ return {
252
+ job: currentJob,
253
+ download_url: downloadUrl,
254
+ filename: outputFilename,
255
+ stored_file_id: storedFileId,
256
+ input_format,
257
+ profile,
258
+ size: ((_m = (_l = (_k = exportTaskData === null || exportTaskData === void 0 ? void 0 : exportTaskData.result) === null || _k === void 0 ? void 0 : _k.files) === null || _l === void 0 ? void 0 : _l[0]) === null || _m === void 0 ? void 0 : _m.size) || 0,
259
+ };
260
+ }
261
+ else if (currentJob.status === 'error') {
262
+ throw new Error(`Optimize job failed: ${currentJob.message || 'Unknown error'}`);
263
+ }
264
+ yield new Promise(resolve => setTimeout(resolve, 5000));
265
+ attempts++;
266
+ }
267
+ throw new Error('Optimization did not complete within the timeout period');
268
+ }
269
+ return {
270
+ job,
271
+ input_format,
272
+ profile,
273
+ status: 'processing',
274
+ };
275
+ }
276
+ catch (error) {
277
+ if (error instanceof Error) {
278
+ throw error;
279
+ }
280
+ throw new Error(`File optimization failed: ${String(error)}`);
281
+ }
282
+ });
283
+ },
284
+ });
285
+ //# sourceMappingURL=optimize-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optimize-file.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/cloudconvert/src/lib/actions/optimize-file.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAAsF;AACtF,sCAAqF;AACrF,qEAA0D;AAE1D,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,CAAC;IAC/B,aAAa,EAAE,2BAAQ,CAAC,cAAc,CAAC;QACrC,WAAW,EAAE,eAAe;QAC5B,WAAW,EAAE,yCAAyC;QACtD,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE;gBACzC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE;gBACnC,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,aAAa,EAAE;aAClD;SACF;QACD,YAAY,EAAE,QAAQ;KACv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,EAAE,CAAC;oBACzB,MAAM,KAAK,CAAC;gBAChB,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,6BAA6B,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAClE,CAAC;QACL,CAAC;KAAA;CAGJ,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const cloudconvertAuth: import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cloudconvertAuth = void 0;
4
+ const shared_1 = require("@activepieces/shared");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ exports.cloudconvertAuth = pieces_framework_1.PieceAuth.OAuth2({
7
+ description: 'Connect your CloudConvert account using OAuth2',
8
+ authUrl: 'https://cloudconvert.com/oauth/authorize',
9
+ tokenUrl: 'https://cloudconvert.com/oauth/token',
10
+ required: true,
11
+ grantType: shared_1.OAuth2GrantType.AUTHORIZATION_CODE,
12
+ scope: ['task.read', 'task.write'],
13
+ props: {
14
+ region: pieces_framework_1.Property.StaticDropdown({
15
+ displayName: 'Region',
16
+ description: 'CloudConvert processing region',
17
+ required: true,
18
+ options: {
19
+ options: [
20
+ { label: 'Auto (Nearest)', value: 'auto' },
21
+ { label: 'EU Central (Germany)', value: 'eu-central' },
22
+ { label: 'US East (Virginia)', value: 'us-east' },
23
+ ]
24
+ },
25
+ defaultValue: 'auto'
26
+ })
27
+ }
28
+ });
29
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/cloudconvert/src/lib/common/auth.ts"],"names":[],"mappings":";;;AAAA,iDAAuD;AACvD,qEAAqE;AAExD,QAAA,gBAAgB,GAAG,4BAAS,CAAC,MAAM,CAAC;IAC7C,WAAW,EAAE,gDAAgD;IAC7D,OAAO,EAAE,0CAA0C;IACnD,QAAQ,EAAE,sCAAsC;IAChD,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,wBAAe,CAAC,kBAAkB;IAC7C,KAAK,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC;IAClC,KAAK,EAAE;QACH,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC5B,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,gCAAgC;YAC7C,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACL,OAAO,EAAE;oBACL,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE;oBAC1C,EAAE,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,YAAY,EAAE;oBACtD,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,SAAS,EAAE;iBACpD;aACJ;YACD,YAAY,EAAE,MAAM;SACvB,CAAC;KACL;CACJ,CAAC,CAAC"}
@@ -0,0 +1,99 @@
1
+ import { HttpMethod } from '@activepieces/pieces-common';
2
+ export declare class CloudConvertClient {
3
+ private readonly auth;
4
+ private readonly baseUrl;
5
+ constructor(auth: any);
6
+ apiCall({ method, resourceUri, body, queryParams, }: {
7
+ method: HttpMethod;
8
+ resourceUri: string;
9
+ body?: any;
10
+ queryParams?: Record<string, string>;
11
+ }): Promise<import("@activepieces/pieces-common").HttpResponse<any>>;
12
+ createImportTask(fileUrl: string, filename?: string): Promise<any>;
13
+ createUploadTask(filename: string): Promise<any>;
14
+ createImportBase64Task(fileContent: string, filename: string): Promise<any>;
15
+ createArchiveTask(input: string | string[], outputFormat: string, options?: {
16
+ filename?: string;
17
+ engine?: string;
18
+ engineVersion?: string;
19
+ timeout?: number;
20
+ }): Promise<any>;
21
+ createCaptureTask(options: {
22
+ url: string;
23
+ output_format: string;
24
+ pages?: string;
25
+ zoom?: number;
26
+ page_width?: number;
27
+ page_height?: number;
28
+ page_format?: string;
29
+ page_orientation?: string;
30
+ margin_top?: number;
31
+ margin_bottom?: number;
32
+ margin_left?: number;
33
+ margin_right?: number;
34
+ print_background?: boolean;
35
+ display_header_footer?: boolean;
36
+ header_template?: string;
37
+ footer_template?: string;
38
+ wait_until?: string;
39
+ wait_for_element?: string;
40
+ wait_time?: number;
41
+ css_media_type?: string;
42
+ filename?: string;
43
+ engine?: string;
44
+ engine_version?: string;
45
+ timeout?: number;
46
+ }): Promise<any>;
47
+ createConvertTask(options: {
48
+ input: string | string[];
49
+ input_format?: string;
50
+ output_format: string;
51
+ filename?: string;
52
+ engine?: string;
53
+ engine_version?: string;
54
+ timeout?: number;
55
+ [key: string]: any;
56
+ }): Promise<any>;
57
+ createMergeTask(options: {
58
+ input: string | string[];
59
+ output_format: string;
60
+ filename?: string;
61
+ engine?: string;
62
+ engine_version?: string;
63
+ timeout?: number;
64
+ [key: string]: any;
65
+ }): Promise<any>;
66
+ createOptimizeTask(options: {
67
+ input: string | string[];
68
+ input_format?: string;
69
+ profile?: string;
70
+ flatten_signatures?: boolean;
71
+ colorspace?: string;
72
+ filename?: string;
73
+ engine?: string;
74
+ engine_version?: string;
75
+ timeout?: number;
76
+ [key: string]: any;
77
+ }): Promise<any>;
78
+ createExportTask(inputTaskId: string): Promise<any>;
79
+ createJob(tasks: Record<string, any>, tag?: string): Promise<any>;
80
+ getJob(jobId: string): Promise<any>;
81
+ getTask(taskId: string, queryParams?: Record<string, string>): Promise<any>;
82
+ getSupportedFormats(options?: {
83
+ inputFormat?: string;
84
+ outputFormat?: string;
85
+ engine?: string;
86
+ include?: string[];
87
+ }): Promise<any>;
88
+ }
89
+ export declare const cloudconvertCommon: {
90
+ baseUrl: (region?: string) => "https://eu-central.api.cloudconvert.com/v2" | "https://us-east.api.cloudconvert.com/v2" | "https://api.cloudconvert.com/v2";
91
+ createClient(auth: any): CloudConvertClient;
92
+ apiCall({ auth, method, resourceUri, body, queryParams, }: {
93
+ auth: any;
94
+ method: HttpMethod;
95
+ resourceUri: string;
96
+ body?: any;
97
+ queryParams?: Record<string, string>;
98
+ }): Promise<import("@activepieces/pieces-common").HttpResponse<any>>;
99
+ };