@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.
- package/README.md +7 -0
- package/package.json +32 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +45 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/archive-file.d.ts +11 -0
- package/src/lib/actions/archive-file.js +251 -0
- package/src/lib/actions/archive-file.js.map +1 -0
- package/src/lib/actions/capture-website.d.ts +28 -0
- package/src/lib/actions/capture-website.js +347 -0
- package/src/lib/actions/capture-website.js.map +1 -0
- package/src/lib/actions/convert-file.d.ts +14 -0
- package/src/lib/actions/convert-file.js +228 -0
- package/src/lib/actions/convert-file.js.map +1 -0
- package/src/lib/actions/download-file.d.ts +5 -0
- package/src/lib/actions/download-file.js +167 -0
- package/src/lib/actions/download-file.js.map +1 -0
- package/src/lib/actions/merge-pdf.d.ts +10 -0
- package/src/lib/actions/merge-pdf.js +237 -0
- package/src/lib/actions/merge-pdf.js.map +1 -0
- package/src/lib/actions/optimize-file.d.ts +16 -0
- package/src/lib/actions/optimize-file.js +285 -0
- package/src/lib/actions/optimize-file.js.map +1 -0
- package/src/lib/common/auth.d.ts +1 -0
- package/src/lib/common/auth.js +29 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/client.d.ts +99 -0
- package/src/lib/common/client.js +283 -0
- package/src/lib/common/client.js.map +1 -0
- package/src/lib/common/index.d.ts +9 -0
- package/src/lib/common/index.js +33 -0
- package/src/lib/common/index.js.map +1 -0
- package/src/lib/common/properties.d.ts +14 -0
- package/src/lib/common/properties.js +242 -0
- package/src/lib/common/properties.js.map +1 -0
- package/src/lib/common/schemas.d.ts +533 -0
- package/src/lib/common/schemas.js +178 -0
- package/src/lib/common/schemas.js.map +1 -0
- package/src/lib/triggers/job-failed.d.ts +2 -0
- package/src/lib/triggers/job-failed.js +111 -0
- package/src/lib/triggers/job-failed.js.map +1 -0
- package/src/lib/triggers/job-finished.d.ts +2 -0
- package/src/lib/triggers/job-finished.js +150 -0
- package/src/lib/triggers/job-finished.js.map +1 -0
- package/src/lib/triggers/new-job.d.ts +2 -0
- package/src/lib/triggers/new-job.js +124 -0
- package/src/lib/triggers/new-job.js.map +1 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.downloadFile = 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 downloadFileProps = () => ({
|
|
10
|
+
task_id: pieces_framework_2.Property.ShortText({
|
|
11
|
+
displayName: 'Task ID',
|
|
12
|
+
description: 'ID of the CloudConvert task to retrieve',
|
|
13
|
+
required: true,
|
|
14
|
+
}),
|
|
15
|
+
include: pieces_framework_2.Property.MultiSelectDropdown({
|
|
16
|
+
displayName: 'Include Additional Data',
|
|
17
|
+
description: 'Additional data to include in the response',
|
|
18
|
+
required: false,
|
|
19
|
+
refreshers: [],
|
|
20
|
+
options: () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
return ({
|
|
22
|
+
options: [
|
|
23
|
+
{ label: 'Retries', value: 'retries' },
|
|
24
|
+
{ label: 'Depends On Tasks', value: 'depends_on_tasks' },
|
|
25
|
+
{ label: 'Payload', value: 'payload' },
|
|
26
|
+
{ label: 'Job', value: 'job' },
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
})
|
|
30
|
+
}),
|
|
31
|
+
store_file: pieces_framework_2.Property.Checkbox({
|
|
32
|
+
displayName: 'Store File',
|
|
33
|
+
description: 'Download and store the output files in Activepieces',
|
|
34
|
+
required: false,
|
|
35
|
+
defaultValue: true,
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
exports.downloadFile = (0, pieces_framework_1.createAction)({
|
|
39
|
+
name: 'download_file',
|
|
40
|
+
displayName: 'Download a File',
|
|
41
|
+
description: 'Downloads output from a completed task',
|
|
42
|
+
auth: common_1.cloudconvertAuth,
|
|
43
|
+
requireAuth: true,
|
|
44
|
+
props: downloadFileProps(),
|
|
45
|
+
run(context) {
|
|
46
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
var _a;
|
|
48
|
+
yield common_1.downloadFileSchema.parseAsync(context.propsValue);
|
|
49
|
+
const { task_id, include, store_file } = context.propsValue;
|
|
50
|
+
const client = new common_1.CloudConvertClient(context.auth);
|
|
51
|
+
try {
|
|
52
|
+
const queryParams = {};
|
|
53
|
+
if (include && Array.isArray(include) && include.length > 0) {
|
|
54
|
+
queryParams['include'] = include.join(',');
|
|
55
|
+
}
|
|
56
|
+
const task = yield client.getTask(task_id, queryParams);
|
|
57
|
+
if (task.status !== 'finished') {
|
|
58
|
+
throw new Error(`Task is not finished. Current status: ${task.status}. ${task.message || ''}`);
|
|
59
|
+
}
|
|
60
|
+
let downloadTask = task;
|
|
61
|
+
let exportTaskId;
|
|
62
|
+
if (task.operation !== 'export/url' && ((_a = task.result) === null || _a === void 0 ? void 0 : _a.files) && task.result.files.length > 0) {
|
|
63
|
+
const hasDownloadUrls = task.result.files.some((file) => file.url);
|
|
64
|
+
if (!hasDownloadUrls) {
|
|
65
|
+
try {
|
|
66
|
+
const exportTask = yield client.createExportTask(task_id);
|
|
67
|
+
exportTaskId = exportTask.id;
|
|
68
|
+
let attempts = 0;
|
|
69
|
+
const maxAttempts = 60;
|
|
70
|
+
while (attempts < maxAttempts) {
|
|
71
|
+
const exportTaskData = yield client.getTask(exportTask.id);
|
|
72
|
+
if (exportTaskData.status === 'finished') {
|
|
73
|
+
downloadTask = exportTaskData;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
else if (exportTaskData.status === 'error') {
|
|
77
|
+
throw new Error(`Export task failed: ${exportTaskData.message || 'Unknown error'}. Code: ${exportTaskData.code || 'N/A'}`);
|
|
78
|
+
}
|
|
79
|
+
yield new Promise(resolve => setTimeout(resolve, 2000));
|
|
80
|
+
attempts++;
|
|
81
|
+
}
|
|
82
|
+
if (attempts >= maxAttempts) {
|
|
83
|
+
throw new Error('Export task did not complete within the timeout period');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (exportError) {
|
|
87
|
+
// Continue with original task
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const result = Object.assign({ id: task.id, job_id: task.job_id, name: task.name, operation: task.operation, status: task.status, message: task.message, code: task.code, credits: task.credits, created_at: task.created_at, started_at: task.started_at, ended_at: task.ended_at, engine: task.engine, engine_version: task.engine_version }, (exportTaskId && { export_task_id: exportTaskId }));
|
|
92
|
+
if (task.depends_on_tasks) {
|
|
93
|
+
result.depends_on_tasks = task.depends_on_tasks;
|
|
94
|
+
}
|
|
95
|
+
if (task.retry_of_task_id) {
|
|
96
|
+
result.retry_of_task_id = task.retry_of_task_id;
|
|
97
|
+
}
|
|
98
|
+
if (task.retries) {
|
|
99
|
+
result.retries = task.retries;
|
|
100
|
+
}
|
|
101
|
+
if (task.payload) {
|
|
102
|
+
result.payload = task.payload;
|
|
103
|
+
}
|
|
104
|
+
if (downloadTask.result) {
|
|
105
|
+
result.result = downloadTask.result;
|
|
106
|
+
if (downloadTask.result.files && downloadTask.result.files.length > 0) {
|
|
107
|
+
result.download_urls = downloadTask.result.files.map((file) => ({
|
|
108
|
+
filename: file.filename,
|
|
109
|
+
url: file.url,
|
|
110
|
+
size: file.size,
|
|
111
|
+
}));
|
|
112
|
+
if (store_file) {
|
|
113
|
+
result.stored_files = [];
|
|
114
|
+
for (const file of downloadTask.result.files) {
|
|
115
|
+
try {
|
|
116
|
+
if (!file.url || typeof file.url !== 'string') {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
new URL(file.url);
|
|
121
|
+
}
|
|
122
|
+
catch (urlError) {
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
const fileResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
126
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
127
|
+
url: file.url,
|
|
128
|
+
});
|
|
129
|
+
if (fileResponse.status === 200 && fileResponse.body) {
|
|
130
|
+
let fileData;
|
|
131
|
+
if (typeof fileResponse.body === 'string') {
|
|
132
|
+
fileData = Buffer.from(fileResponse.body, 'binary');
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
fileData = Buffer.from(fileResponse.body);
|
|
136
|
+
}
|
|
137
|
+
const storedFileId = yield context.files.write({
|
|
138
|
+
data: fileData,
|
|
139
|
+
fileName: file.filename || `downloaded-file-${Date.now()}`,
|
|
140
|
+
});
|
|
141
|
+
result.stored_files.push({
|
|
142
|
+
filename: file.filename,
|
|
143
|
+
size: file.size,
|
|
144
|
+
stored_file_id: storedFileId,
|
|
145
|
+
original_url: file.url,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
// Continue with next file
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
if (error instanceof Error) {
|
|
160
|
+
throw error;
|
|
161
|
+
}
|
|
162
|
+
throw new Error(`Task retrieval failed: ${String(error)}`);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
//# sourceMappingURL=download-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-file.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/cloudconvert/src/lib/actions/download-file.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAAsF;AACtF,sCA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AE,CAAC;oCACf,0BAA0B;gCAC5B,CAAC;4BACH,CAAC;wBACH,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,OAAO,MAAM,CAAC;YAChB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;oBAC3B,MAAM,KAAK,CAAC;gBACd,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,0BAA0B,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC7D,CAAC;QACD,CAAC;KAAA;CAGJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const mergePdf: 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
|
+
files: import("@activepieces/pieces-framework").ArrayProperty<false> | import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
4
|
+
filename: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
engine: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
6
|
+
engine_version: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
timeout: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
8
|
+
wait_for_completion: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
9
|
+
store_file: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,237 @@
|
|
|
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
|
+
auth: common_1.cloudconvertAuth,
|
|
98
|
+
requireAuth: true,
|
|
99
|
+
props: mergePdfProps(),
|
|
100
|
+
run(context) {
|
|
101
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
103
|
+
yield common_1.mergePdfSchema.parseAsync(context.propsValue);
|
|
104
|
+
const { import_method, files, filename, engine, engine_version, timeout, wait_for_completion, store_file } = context.propsValue;
|
|
105
|
+
if (!files || files.length < 2) {
|
|
106
|
+
throw new Error('At least 2 files are required for merging');
|
|
107
|
+
}
|
|
108
|
+
const client = new common_1.CloudConvertClient(context.auth);
|
|
109
|
+
try {
|
|
110
|
+
const jobTasks = {};
|
|
111
|
+
files.forEach((file, index) => {
|
|
112
|
+
var _a;
|
|
113
|
+
const taskName = `import-file-${index + 1}`;
|
|
114
|
+
if (import_method === 'url') {
|
|
115
|
+
if (!file.url) {
|
|
116
|
+
throw new Error(`File URL is required for file ${index + 1} when using URL import method`);
|
|
117
|
+
}
|
|
118
|
+
jobTasks[taskName] = Object.assign({ operation: 'import/url', url: file.url }, (file.filename && { filename: file.filename }));
|
|
119
|
+
}
|
|
120
|
+
else if (import_method === 'stored_file') {
|
|
121
|
+
if (!file.stored_file_id) {
|
|
122
|
+
throw new Error(`Stored File ID is required for file ${index + 1} when using stored file import method`);
|
|
123
|
+
}
|
|
124
|
+
if (!((_a = context.server) === null || _a === void 0 ? void 0 : _a.apiUrl)) {
|
|
125
|
+
throw new Error('Server API URL is not available. Please check your Activepieces server configuration.');
|
|
126
|
+
}
|
|
127
|
+
const baseUrl = context.server.apiUrl.replace(/\/$/, '');
|
|
128
|
+
const fileUrl = `${baseUrl}/v1/step-files/${file.stored_file_id}`;
|
|
129
|
+
try {
|
|
130
|
+
new URL(fileUrl);
|
|
131
|
+
}
|
|
132
|
+
catch (urlError) {
|
|
133
|
+
throw new Error(`Invalid file URL constructed: ${fileUrl}. URL Error: ${urlError instanceof Error ? urlError.message : String(urlError)}`);
|
|
134
|
+
}
|
|
135
|
+
jobTasks[taskName] = Object.assign({ operation: 'import/url', url: fileUrl }, (file.filename && { filename: file.filename }));
|
|
136
|
+
}
|
|
137
|
+
else if (import_method === 'upload') {
|
|
138
|
+
if (!file.file || !file.file.base64) {
|
|
139
|
+
throw new Error(`Please select a file to upload for file ${index + 1}`);
|
|
140
|
+
}
|
|
141
|
+
throw new Error('Upload method for multiple files is not yet supported with the new job format. Please use URL or stored file methods.');
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
throw new Error('Invalid import method selected');
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
// Collect all import task names
|
|
148
|
+
const importTaskNames = files.map((_, index) => `import-file-${index + 1}`);
|
|
149
|
+
// Merge task
|
|
150
|
+
const mergeOptions = {
|
|
151
|
+
input: importTaskNames.length === 1 ? importTaskNames[0] : importTaskNames,
|
|
152
|
+
output_format: 'pdf',
|
|
153
|
+
};
|
|
154
|
+
if (filename)
|
|
155
|
+
mergeOptions.filename = filename;
|
|
156
|
+
if (engine)
|
|
157
|
+
mergeOptions.engine = engine;
|
|
158
|
+
if (engine_version)
|
|
159
|
+
mergeOptions.engine_version = engine_version;
|
|
160
|
+
if (timeout)
|
|
161
|
+
mergeOptions.timeout = timeout;
|
|
162
|
+
jobTasks['merge-files'] = Object.assign({ operation: 'merge' }, mergeOptions);
|
|
163
|
+
// Export task
|
|
164
|
+
jobTasks['export-file'] = {
|
|
165
|
+
operation: 'export/url',
|
|
166
|
+
input: 'merge-files'
|
|
167
|
+
};
|
|
168
|
+
const job = yield client.createJob(jobTasks, `merge-${Date.now()}`);
|
|
169
|
+
if (wait_for_completion) {
|
|
170
|
+
let attempts = 0;
|
|
171
|
+
const maxAttempts = 60;
|
|
172
|
+
while (attempts < maxAttempts) {
|
|
173
|
+
const currentJob = yield client.getJob(job.id);
|
|
174
|
+
if (currentJob.status === 'finished') {
|
|
175
|
+
// Find the export task by name in the job
|
|
176
|
+
const exportTaskData = (_a = currentJob.tasks) === null || _a === void 0 ? void 0 : _a.find((task) => task.name === 'export-file');
|
|
177
|
+
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;
|
|
178
|
+
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';
|
|
179
|
+
let storedFileId;
|
|
180
|
+
if (store_file && downloadUrl) {
|
|
181
|
+
try {
|
|
182
|
+
const fileResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
183
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
184
|
+
url: downloadUrl,
|
|
185
|
+
});
|
|
186
|
+
if (fileResponse.status === 200 && fileResponse.body) {
|
|
187
|
+
let fileData;
|
|
188
|
+
if (typeof fileResponse.body === 'string') {
|
|
189
|
+
fileData = Buffer.from(fileResponse.body, 'binary');
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
fileData = Buffer.from(fileResponse.body);
|
|
193
|
+
}
|
|
194
|
+
storedFileId = yield context.files.write({
|
|
195
|
+
data: fileData,
|
|
196
|
+
fileName: outputFilename,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
// Continue without throwing
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
job: currentJob,
|
|
206
|
+
download_url: downloadUrl,
|
|
207
|
+
filename: outputFilename,
|
|
208
|
+
stored_file_id: storedFileId,
|
|
209
|
+
file_count: files.length,
|
|
210
|
+
output_format: 'pdf',
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
else if (currentJob.status === 'error') {
|
|
214
|
+
throw new Error(`Merge job failed: ${currentJob.message || 'Unknown error'}`);
|
|
215
|
+
}
|
|
216
|
+
yield new Promise(resolve => setTimeout(resolve, 5000));
|
|
217
|
+
attempts++;
|
|
218
|
+
}
|
|
219
|
+
throw new Error('Merge did not complete within the timeout period');
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
job,
|
|
223
|
+
file_count: files.length,
|
|
224
|
+
output_format: 'pdf',
|
|
225
|
+
status: 'processing',
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
if (error instanceof Error) {
|
|
230
|
+
throw error;
|
|
231
|
+
}
|
|
232
|
+
throw new Error(`Merge failed: ${String(error)}`);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
//# sourceMappingURL=merge-pdf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-pdf.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/cloudconvert/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;QAC5B,WAAW,EAAE,qCAAqC;QAClD,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;KACvB,CAAC;IACF,KAAK,EAAE,2BAAQ,CAAC,KAAK,CAAC;QACpB,WAAW,EAAE,gBAAgB;QAC7B,WAAW,EAAE,0CAA0C;QACvD,QAAQ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,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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}>;
|