@activepieces/piece-cloudconvert 0.1.5 → 0.1.6

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 (61) hide show
  1. package/package.json +7 -13
  2. package/src/index.js +25 -45
  3. package/src/index.d.ts +0 -2
  4. package/src/index.d.ts.map +0 -1
  5. package/src/index.js.map +0 -1
  6. package/src/lib/actions/archive-file.d.ts +0 -12
  7. package/src/lib/actions/archive-file.d.ts.map +0 -1
  8. package/src/lib/actions/archive-file.js +0 -253
  9. package/src/lib/actions/archive-file.js.map +0 -1
  10. package/src/lib/actions/capture-website.d.ts +0 -29
  11. package/src/lib/actions/capture-website.d.ts.map +0 -1
  12. package/src/lib/actions/capture-website.js +0 -349
  13. package/src/lib/actions/capture-website.js.map +0 -1
  14. package/src/lib/actions/convert-file.d.ts +0 -15
  15. package/src/lib/actions/convert-file.d.ts.map +0 -1
  16. package/src/lib/actions/convert-file.js +0 -230
  17. package/src/lib/actions/convert-file.js.map +0 -1
  18. package/src/lib/actions/download-file.d.ts +0 -6
  19. package/src/lib/actions/download-file.d.ts.map +0 -1
  20. package/src/lib/actions/download-file.js +0 -170
  21. package/src/lib/actions/download-file.js.map +0 -1
  22. package/src/lib/actions/merge-pdf.d.ts +0 -11
  23. package/src/lib/actions/merge-pdf.d.ts.map +0 -1
  24. package/src/lib/actions/merge-pdf.js +0 -239
  25. package/src/lib/actions/merge-pdf.js.map +0 -1
  26. package/src/lib/actions/optimize-file.d.ts +0 -17
  27. package/src/lib/actions/optimize-file.d.ts.map +0 -1
  28. package/src/lib/actions/optimize-file.js +0 -287
  29. package/src/lib/actions/optimize-file.js.map +0 -1
  30. package/src/lib/common/auth.d.ts +0 -2
  31. package/src/lib/common/auth.d.ts.map +0 -1
  32. package/src/lib/common/auth.js +0 -29
  33. package/src/lib/common/auth.js.map +0 -1
  34. package/src/lib/common/client.d.ts +0 -100
  35. package/src/lib/common/client.d.ts.map +0 -1
  36. package/src/lib/common/client.js +0 -283
  37. package/src/lib/common/client.js.map +0 -1
  38. package/src/lib/common/index.d.ts +0 -10
  39. package/src/lib/common/index.d.ts.map +0 -1
  40. package/src/lib/common/index.js +0 -33
  41. package/src/lib/common/index.js.map +0 -1
  42. package/src/lib/common/properties.d.ts +0 -15
  43. package/src/lib/common/properties.d.ts.map +0 -1
  44. package/src/lib/common/properties.js +0 -191
  45. package/src/lib/common/properties.js.map +0 -1
  46. package/src/lib/common/schemas.d.ts +0 -128
  47. package/src/lib/common/schemas.d.ts.map +0 -1
  48. package/src/lib/common/schemas.js +0 -178
  49. package/src/lib/common/schemas.js.map +0 -1
  50. package/src/lib/triggers/job-failed.d.ts +0 -3
  51. package/src/lib/triggers/job-failed.d.ts.map +0 -1
  52. package/src/lib/triggers/job-failed.js +0 -116
  53. package/src/lib/triggers/job-failed.js.map +0 -1
  54. package/src/lib/triggers/job-finished.d.ts +0 -3
  55. package/src/lib/triggers/job-finished.d.ts.map +0 -1
  56. package/src/lib/triggers/job-finished.js +0 -154
  57. package/src/lib/triggers/job-finished.js.map +0 -1
  58. package/src/lib/triggers/new-job.d.ts +0 -3
  59. package/src/lib/triggers/new-job.d.ts.map +0 -1
  60. package/src/lib/triggers/new-job.js +0 -128
  61. package/src/lib/triggers/new-job.js.map +0 -1
@@ -1,239 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergePdf = 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 mergePdfProps = () => ({
10
- import_method: pieces_framework_2.Property.StaticDropdown({
11
- displayName: 'Import Method',
12
- description: 'How to import the files for merging',
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
- files: pieces_framework_2.Property.Array({
24
- displayName: 'Files to Merge',
25
- description: 'List of files to merge into a single PDF',
26
- required: true,
27
- properties: {
28
- url: pieces_framework_2.Property.ShortText({
29
- displayName: 'File URL',
30
- description: 'URL of the file to merge',
31
- required: false,
32
- }),
33
- file: pieces_framework_2.Property.File({
34
- displayName: 'File',
35
- description: 'File to upload and merge',
36
- required: false,
37
- }),
38
- stored_file_id: pieces_framework_2.Property.ShortText({
39
- displayName: 'Stored File ID',
40
- description: 'ID of a previously stored file in Activepieces to merge',
41
- required: false,
42
- }),
43
- filename: pieces_framework_2.Property.ShortText({
44
- displayName: 'Filename in PDF',
45
- description: 'Optional filename for this file within the PDF',
46
- required: false,
47
- })
48
- }
49
- }),
50
- filename: pieces_framework_2.Property.ShortText({
51
- displayName: 'Output Filename',
52
- description: 'Choose a filename (including extension) for the output file',
53
- required: false,
54
- defaultValue: 'merged-document.pdf'
55
- }),
56
- engine: pieces_framework_2.Property.StaticDropdown({
57
- displayName: 'Engine',
58
- description: 'Use a specific engine for the conversion',
59
- required: false,
60
- options: {
61
- options: [
62
- { label: '3-Heights (Default)', value: '3heights' },
63
- { label: 'PDFTron', value: 'pdftron' },
64
- { label: 'MuPDF', value: 'mupdf' },
65
- { label: 'Poppler', value: 'poppler' },
66
- { label: 'LibreOffice', value: 'libreoffice' },
67
- ]
68
- }
69
- }),
70
- engine_version: pieces_framework_2.Property.ShortText({
71
- displayName: 'Engine Version',
72
- description: 'Use a specific engine version for the conversion',
73
- required: false,
74
- }),
75
- timeout: pieces_framework_2.Property.Number({
76
- displayName: 'Timeout (seconds)',
77
- description: 'Timeout in seconds after which the task will be cancelled',
78
- required: false,
79
- }),
80
- wait_for_completion: pieces_framework_2.Property.Checkbox({
81
- displayName: 'Wait for Completion',
82
- description: 'Wait for the merge to complete before returning',
83
- required: true,
84
- defaultValue: true,
85
- }),
86
- store_file: pieces_framework_2.Property.Checkbox({
87
- displayName: 'Store File',
88
- description: 'Download and store the merged PDF in Activepieces',
89
- required: false,
90
- defaultValue: true,
91
- }),
92
- });
93
- exports.mergePdf = (0, pieces_framework_1.createAction)({
94
- name: 'merge_pdf',
95
- displayName: 'Merge Files to PDF',
96
- description: 'Combine multiple documents/images into a single PDF',
97
- audience: 'both',
98
- aiMetadata: { description: 'Merges two or more files into a single PDF via CloudConvert. Choose this to combine separate documents or images into one PDF. Requires at least two input files supplied via the selected import method (file URL or previously stored Activepieces file ID; multi-file uploads are not supported). Each call creates a new merge job, so it is not idempotent.', idempotent: false },
99
- auth: common_1.cloudconvertAuth,
100
- requireAuth: true,
101
- props: mergePdfProps(),
102
- run(context) {
103
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
104
- var _a, _b, _c, _d, _e, _f, _g;
105
- yield common_1.mergePdfSchema.parseAsync(context.propsValue);
106
- const { import_method, files, filename, engine, engine_version, timeout, wait_for_completion, store_file } = context.propsValue;
107
- if (!files || files.length < 2) {
108
- throw new Error('At least 2 files are required for merging');
109
- }
110
- const client = new common_1.CloudConvertClient(context.auth);
111
- try {
112
- const jobTasks = {};
113
- files.forEach((file, index) => {
114
- var _a;
115
- const taskName = `import-file-${index + 1}`;
116
- if (import_method === 'url') {
117
- if (!file.url) {
118
- throw new Error(`File URL is required for file ${index + 1} when using URL import method`);
119
- }
120
- jobTasks[taskName] = Object.assign({ operation: 'import/url', url: file.url }, (file.filename && { filename: file.filename }));
121
- }
122
- else if (import_method === 'stored_file') {
123
- if (!file.stored_file_id) {
124
- throw new Error(`Stored File ID is required for file ${index + 1} when using stored file import method`);
125
- }
126
- if (!((_a = context.server) === null || _a === void 0 ? void 0 : _a.apiUrl)) {
127
- throw new Error('Server API URL is not available. Please check your Activepieces server configuration.');
128
- }
129
- const baseUrl = context.server.apiUrl.replace(/\/$/, '');
130
- const fileUrl = `${baseUrl}/v1/step-files/${file.stored_file_id}`;
131
- try {
132
- new URL(fileUrl);
133
- }
134
- catch (urlError) {
135
- throw new Error(`Invalid file URL constructed: ${fileUrl}. URL Error: ${urlError instanceof Error ? urlError.message : String(urlError)}`);
136
- }
137
- jobTasks[taskName] = Object.assign({ operation: 'import/url', url: fileUrl }, (file.filename && { filename: file.filename }));
138
- }
139
- else if (import_method === 'upload') {
140
- if (!file.file || !file.file.base64) {
141
- throw new Error(`Please select a file to upload for file ${index + 1}`);
142
- }
143
- throw new Error('Upload method for multiple files is not yet supported with the new job format. Please use URL or stored file methods.');
144
- }
145
- else {
146
- throw new Error('Invalid import method selected');
147
- }
148
- });
149
- // Collect all import task names
150
- const importTaskNames = files.map((_, index) => `import-file-${index + 1}`);
151
- // Merge task
152
- const mergeOptions = {
153
- input: importTaskNames.length === 1 ? importTaskNames[0] : importTaskNames,
154
- output_format: 'pdf',
155
- };
156
- if (filename)
157
- mergeOptions.filename = filename;
158
- if (engine)
159
- mergeOptions.engine = engine;
160
- if (engine_version)
161
- mergeOptions.engine_version = engine_version;
162
- if (timeout)
163
- mergeOptions.timeout = timeout;
164
- jobTasks['merge-files'] = Object.assign({ operation: 'merge' }, mergeOptions);
165
- // Export task
166
- jobTasks['export-file'] = {
167
- operation: 'export/url',
168
- input: 'merge-files'
169
- };
170
- const job = yield client.createJob(jobTasks, `merge-${Date.now()}`);
171
- if (wait_for_completion) {
172
- let attempts = 0;
173
- const maxAttempts = 60;
174
- while (attempts < maxAttempts) {
175
- const currentJob = yield client.getJob(job.id);
176
- if (currentJob.status === 'finished') {
177
- // Find the export task by name in the job
178
- const exportTaskData = (_a = currentJob.tasks) === null || _a === void 0 ? void 0 : _a.find((task) => task.name === 'export-file');
179
- const downloadUrl = (_d = (_c = (_b = exportTaskData === null || exportTaskData === void 0 ? void 0 : exportTaskData.result) === null || _b === void 0 ? void 0 : _b.files) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.url;
180
- const outputFilename = ((_g = (_f = (_e = exportTaskData === null || exportTaskData === void 0 ? void 0 : exportTaskData.result) === null || _e === void 0 ? void 0 : _e.files) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.filename) || 'merged-document.pdf';
181
- let storedFileId;
182
- if (store_file && downloadUrl) {
183
- try {
184
- const fileResponse = yield pieces_common_1.httpClient.sendRequest({
185
- method: pieces_common_1.HttpMethod.GET,
186
- url: downloadUrl,
187
- });
188
- if (fileResponse.status === 200 && fileResponse.body) {
189
- let fileData;
190
- if (typeof fileResponse.body === 'string') {
191
- fileData = Buffer.from(fileResponse.body, 'binary');
192
- }
193
- else {
194
- fileData = Buffer.from(fileResponse.body);
195
- }
196
- storedFileId = yield context.files.write({
197
- data: fileData,
198
- fileName: outputFilename,
199
- });
200
- }
201
- }
202
- catch (error) {
203
- // Continue without throwing
204
- }
205
- }
206
- return {
207
- job: currentJob,
208
- download_url: downloadUrl,
209
- filename: outputFilename,
210
- stored_file_id: storedFileId,
211
- file_count: files.length,
212
- output_format: 'pdf',
213
- };
214
- }
215
- else if (currentJob.status === 'error') {
216
- throw new Error(`Merge job failed: ${currentJob.message || 'Unknown error'}`);
217
- }
218
- yield new Promise(resolve => setTimeout(resolve, 5000));
219
- attempts++;
220
- }
221
- throw new Error('Merge did not complete within the timeout period');
222
- }
223
- return {
224
- job,
225
- file_count: files.length,
226
- output_format: 'pdf',
227
- status: 'processing',
228
- };
229
- }
230
- catch (error) {
231
- if (error instanceof Error) {
232
- throw error;
233
- }
234
- throw new Error(`Merge failed: ${String(error)}`);
235
- }
236
- });
237
- },
238
- });
239
- //# sourceMappingURL=merge-pdf.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"merge-pdf.js","sourceRoot":"","sources":["../../../../src/lib/actions/merge-pdf.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAAsF;AACtF,sCAAiF;AACjF,qEAA0D;AAE1D,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,CAAC;IAC3B,aAAa,EAAE,2BAAQ,CAAC,cAAc,CAAC;QACrC,WAAW,EAAE,eAAe;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AC3B,CAAC,CAAC;oCACP,CAAC;gCACL,CAAC;gCAAC,OAAO,KAAK,EAAE,CAAC;oCACb,4BAA4B;gCAChC,CAAC;4BACL,CAAC;4BAED,OAAO;gCACH,GAAG,EAAE,UAAU;gCACf,YAAY,EAAE,WAAW;gCACzB,QAAQ,EAAE,cAAc;gCACxB,cAAc,EAAE,YAAY;gCAC5B,UAAU,EAAE,KAAK,CAAC,MAAM;gCACxB,aAAa,EAAE,KAAK;6BACvB,CAAC;wBACN,CAAC;6BAAM,IAAI,UAAU,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;4BACvC,MAAM,IAAI,KAAK,CAAC,qBAAqB,UAAU,CAAC,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC;wBAClF,CAAC;wBAED,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;wBACxD,QAAQ,EAAE,CAAC;oBACf,CAAC;oBAED,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;gBACxE,CAAC;gBAED,OAAO;oBACH,GAAG;oBACH,UAAU,EAAE,KAAK,CAAC,MAAM;oBACxB,aAAa,EAAE,KAAK;oBACpB,MAAM,EAAE,YAAY;iBACvB,CAAC;YACN,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;oBACzB,MAAM,KAAK,CAAC;gBAChB,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,iBAAiB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACtD,CAAC;QACL,CAAC;KAAA;CAGJ,CAAC,CAAC"}
@@ -1,17 +0,0 @@
1
- export declare const optimizeFile: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- import_method: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
3
- file: import("@activepieces/pieces-framework").FileProperty<false>;
4
- url: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
- stored_file_id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
- input_format: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
7
- profile: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
8
- flatten_signatures: import("@activepieces/pieces-framework").CheckboxProperty<false>;
9
- colorspace: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
10
- filename: import("@activepieces/pieces-framework").ShortTextProperty<false>;
11
- engine: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
12
- engine_version: import("@activepieces/pieces-framework").ShortTextProperty<false>;
13
- timeout: import("@activepieces/pieces-framework").NumberProperty<false>;
14
- wait_for_completion: import("@activepieces/pieces-framework").CheckboxProperty<true>;
15
- store_file: import("@activepieces/pieces-framework").CheckboxProperty<false>;
16
- }>;
17
- //# sourceMappingURL=optimize-file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"optimize-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/optimize-file.ts"],"names":[],"mappings":"AAyHA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;EAwLvB,CAAC"}
@@ -1,287 +0,0 @@
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
- audience: 'both',
129
- aiMetadata: { description: 'Compresses and optimizes a PDF or image (PNG/JPG) to reduce file size via CloudConvert, targeting a profile such as web, print, archive, MRC, or max. Choose this to shrink a file without changing its format. Supply the input via one of three import methods — a public URL, an uploaded file, or a previously stored Activepieces file ID. Each call creates a new optimize job, so it is not idempotent.', idempotent: false },
130
- auth: common_1.cloudconvertAuth,
131
- requireAuth: true,
132
- props: optimizeFileProps(),
133
- run(context) {
134
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
135
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
136
- yield common_1.optimizeFileSchema.parseAsync(context.propsValue);
137
- 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;
138
- const client = new common_1.CloudConvertClient(context.auth);
139
- try {
140
- const jobTasks = {};
141
- // Import task
142
- if (import_method === 'url') {
143
- if (!url) {
144
- throw new Error('File URL is required when using URL import method');
145
- }
146
- jobTasks['import-file'] = Object.assign({ operation: 'import/url', url: url }, (filename && { filename }));
147
- }
148
- else if (import_method === 'stored_file') {
149
- if (!stored_file_id) {
150
- throw new Error('Stored File ID is required when using stored file import method');
151
- }
152
- if (!((_a = context.server) === null || _a === void 0 ? void 0 : _a.apiUrl)) {
153
- throw new Error('Server API URL is not available. Please check your Activepieces server configuration.');
154
- }
155
- const baseUrl = context.server.apiUrl.replace(/\/$/, '');
156
- const fileUrl = `${baseUrl}/v1/step-files/${stored_file_id}`;
157
- try {
158
- new URL(fileUrl);
159
- }
160
- catch (urlError) {
161
- throw new Error(`Invalid file URL constructed: ${fileUrl}. URL Error: ${urlError instanceof Error ? urlError.message : String(urlError)}`);
162
- }
163
- jobTasks['import-file'] = Object.assign({ operation: 'import/url', url: fileUrl }, (filename && { filename }));
164
- }
165
- else if (import_method === 'upload') {
166
- if (!file || !file.base64) {
167
- throw new Error('Please select a file to upload from your device');
168
- }
169
- const uploadTask = yield client.createUploadTask(file.filename || 'uploaded-file');
170
- const uploadUrl = uploadTask.result.form.url;
171
- const uploadForm = uploadTask.result.form.parameters;
172
- const formData = new FormData();
173
- Object.entries(uploadForm).forEach(([key, value]) => {
174
- formData.append(key, value);
175
- });
176
- if (file.base64) {
177
- const buffer = Buffer.from(file.base64, 'base64');
178
- const blob = new Blob([buffer], { type: file.extension ? `application/${file.extension}` : 'application/octet-stream' });
179
- formData.append('file', blob, file.filename);
180
- }
181
- const uploadResponse = yield pieces_common_1.httpClient.sendRequest({
182
- method: pieces_common_1.HttpMethod.POST,
183
- url: uploadUrl,
184
- body: formData,
185
- });
186
- if (uploadResponse.status < 200 || uploadResponse.status >= 300) {
187
- throw new Error(`Failed to upload file: HTTP ${uploadResponse.status} - ${((_b = uploadResponse.body) === null || _b === void 0 ? void 0 : _b.message) || 'Upload failed'}`);
188
- }
189
- jobTasks['import-file'] = Object.assign({ operation: 'import/upload' }, (filename && { filename }));
190
- }
191
- else {
192
- throw new Error('Invalid import method selected');
193
- }
194
- const optimizeOptions = {
195
- input: 'import-file',
196
- };
197
- if (input_format)
198
- optimizeOptions.input_format = input_format;
199
- if (profile)
200
- optimizeOptions.profile = profile;
201
- if (flatten_signatures !== undefined)
202
- optimizeOptions.flatten_signatures = flatten_signatures;
203
- if (colorspace)
204
- optimizeOptions.colorspace = colorspace;
205
- if (filename)
206
- optimizeOptions.filename = filename;
207
- if (engine)
208
- optimizeOptions.engine = engine;
209
- if (engine_version)
210
- optimizeOptions.engine_version = engine_version;
211
- if (timeout)
212
- optimizeOptions.timeout = timeout;
213
- jobTasks['optimize-file'] = Object.assign({ operation: 'optimize' }, optimizeOptions);
214
- jobTasks['export-file'] = {
215
- operation: 'export/url',
216
- input: 'optimize-file'
217
- };
218
- const job = yield client.createJob(jobTasks, `optimize-${Date.now()}`);
219
- if (wait_for_completion) {
220
- let attempts = 0;
221
- const maxAttempts = 60;
222
- while (attempts < maxAttempts) {
223
- const currentJob = yield client.getJob(job.id);
224
- if (currentJob.status === 'finished') {
225
- const exportTaskData = (_c = currentJob.tasks) === null || _c === void 0 ? void 0 : _c.find((task) => task.name === 'export-file');
226
- 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;
227
- 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'}`;
228
- let storedFileId;
229
- if (store_file && downloadUrl) {
230
- try {
231
- const fileResponse = yield pieces_common_1.httpClient.sendRequest({
232
- method: pieces_common_1.HttpMethod.GET,
233
- url: downloadUrl,
234
- });
235
- if (fileResponse.status === 200 && fileResponse.body) {
236
- let fileData;
237
- if (typeof fileResponse.body === 'string') {
238
- fileData = Buffer.from(fileResponse.body, 'binary');
239
- }
240
- else {
241
- fileData = Buffer.from(fileResponse.body);
242
- }
243
- storedFileId = yield context.files.write({
244
- data: fileData,
245
- fileName: outputFilename,
246
- });
247
- }
248
- }
249
- catch (error) {
250
- // Continue without throwing
251
- }
252
- }
253
- return {
254
- job: currentJob,
255
- download_url: downloadUrl,
256
- filename: outputFilename,
257
- stored_file_id: storedFileId,
258
- input_format,
259
- profile,
260
- 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,
261
- };
262
- }
263
- else if (currentJob.status === 'error') {
264
- throw new Error(`Optimize job failed: ${currentJob.message || 'Unknown error'}`);
265
- }
266
- yield new Promise(resolve => setTimeout(resolve, 5000));
267
- attempts++;
268
- }
269
- throw new Error('Optimization did not complete within the timeout period');
270
- }
271
- return {
272
- job,
273
- input_format,
274
- profile,
275
- status: 'processing',
276
- };
277
- }
278
- catch (error) {
279
- if (error instanceof Error) {
280
- throw error;
281
- }
282
- throw new Error(`File optimization failed: ${String(error)}`);
283
- }
284
- });
285
- },
286
- });
287
- //# sourceMappingURL=optimize-file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"optimize-file.js","sourceRoot":"","sources":["../../../../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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,eAAe,EAAE,CAAC,CAAC;wBACrF,CAAC;wBAED,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;wBACxD,QAAQ,EAAE,CAAC;oBACf,CAAC;oBAED,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;gBAC/E,CAAC;gBAED,OAAO;oBACH,GAAG;oBACH,YAAY;oBACZ,OAAO;oBACP,MAAM,EAAE,YAAY;iBACvB,CAAC;YACN,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,KAAK,YAAY,KAAK,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"}
@@ -1,2 +0,0 @@
1
- export declare const cloudconvertAuth: import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>;
2
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/auth.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,+GAsB3B,CAAC"}
@@ -1,29 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../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"}