@cloudconvert/n8n-nodes-cloudconvert 1.0.0
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/LICENSE.md +19 -0
- package/README.md +68 -0
- package/dist/credentials/CloudConvertApi.credentials.d.ts +9 -0
- package/dist/credentials/CloudConvertApi.credentials.js +36 -0
- package/dist/credentials/CloudConvertApi.credentials.js.map +1 -0
- package/dist/credentials/CloudConvertOAuth2Api.credentials.d.ts +8 -0
- package/dist/credentials/CloudConvertOAuth2Api.credentials.js +52 -0
- package/dist/credentials/CloudConvertOAuth2Api.credentials.js.map +1 -0
- package/dist/credentials/ExampleCredentialsApi.credentials.d.ts +8 -0
- package/dist/credentials/ExampleCredentialsApi.credentials.js +46 -0
- package/dist/credentials/ExampleCredentialsApi.credentials.js.map +1 -0
- package/dist/credentials/HttpBinApi.credentials.d.ts +9 -0
- package/dist/credentials/HttpBinApi.credentials.js +40 -0
- package/dist/credentials/HttpBinApi.credentials.js.map +1 -0
- package/dist/nodes/CloudConvert/CloudConvert.node.d.ts +11 -0
- package/dist/nodes/CloudConvert/CloudConvert.node.js +315 -0
- package/dist/nodes/CloudConvert/CloudConvert.node.js.map +1 -0
- package/dist/nodes/CloudConvert/CloudConvert.node.json +22 -0
- package/dist/nodes/CloudConvert/Interfaces.d.ts +37 -0
- package/dist/nodes/CloudConvert/Interfaces.js +3 -0
- package/dist/nodes/CloudConvert/Interfaces.js.map +1 -0
- package/dist/nodes/CloudConvert/Utils.d.ts +9 -0
- package/dist/nodes/CloudConvert/Utils.js +117 -0
- package/dist/nodes/CloudConvert/Utils.js.map +1 -0
- package/dist/nodes/CloudConvert/cloudconvert.png +0 -0
- package/dist/nodes/CloudConvert/convert/execute.d.ts +2 -0
- package/dist/nodes/CloudConvert/convert/execute.js +64 -0
- package/dist/nodes/CloudConvert/convert/execute.js.map +1 -0
- package/dist/nodes/CloudConvert/operations/archive/execute.d.ts +2 -0
- package/dist/nodes/CloudConvert/operations/archive/execute.js +41 -0
- package/dist/nodes/CloudConvert/operations/archive/execute.js.map +1 -0
- package/dist/nodes/CloudConvert/operations/capture-website/execute.d.ts +2 -0
- package/dist/nodes/CloudConvert/operations/capture-website/execute.js +53 -0
- package/dist/nodes/CloudConvert/operations/capture-website/execute.js.map +1 -0
- package/dist/nodes/CloudConvert/operations/capture-website/fields.d.ts +2 -0
- package/dist/nodes/CloudConvert/operations/capture-website/fields.js +19 -0
- package/dist/nodes/CloudConvert/operations/capture-website/fields.js.map +1 -0
- package/dist/nodes/CloudConvert/operations/convert/execute.d.ts +2 -0
- package/dist/nodes/CloudConvert/operations/convert/execute.js +60 -0
- package/dist/nodes/CloudConvert/operations/convert/execute.js.map +1 -0
- package/dist/nodes/CloudConvert/operations/execute.d.ts +2 -0
- package/dist/nodes/CloudConvert/operations/execute.js +7 -0
- package/dist/nodes/CloudConvert/operations/execute.js.map +1 -0
- package/dist/nodes/CloudConvert/operations/merge/execute.d.ts +2 -0
- package/dist/nodes/CloudConvert/operations/merge/execute.js +41 -0
- package/dist/nodes/CloudConvert/operations/merge/execute.js.map +1 -0
- package/dist/nodes/CloudConvert/operations/metadata/execute.d.ts +2 -0
- package/dist/nodes/CloudConvert/operations/metadata/execute.js +36 -0
- package/dist/nodes/CloudConvert/operations/metadata/execute.js.map +1 -0
- package/dist/nodes/CloudConvert/operations/optimize/execute.d.ts +2 -0
- package/dist/nodes/CloudConvert/operations/optimize/execute.js +59 -0
- package/dist/nodes/CloudConvert/operations/optimize/execute.js.map +1 -0
- package/dist/nodes/CloudConvert/operations/thumbnail/description.d.ts +2 -0
- package/dist/nodes/CloudConvert/operations/thumbnail/description.js +58 -0
- package/dist/nodes/CloudConvert/operations/thumbnail/description.js.map +1 -0
- package/dist/nodes/CloudConvert/operations/thumbnail/execute.d.ts +2 -0
- package/dist/nodes/CloudConvert/operations/thumbnail/execute.js +65 -0
- package/dist/nodes/CloudConvert/operations/thumbnail/execute.js.map +1 -0
- package/dist/nodes/CloudConvert/operations/thumbnail/fields.d.ts +2 -0
- package/dist/nodes/CloudConvert/operations/thumbnail/fields.js +58 -0
- package/dist/nodes/CloudConvert/operations/thumbnail/fields.js.map +1 -0
- package/dist/nodes/CloudConvert/operations/watermark/execute.d.ts +2 -0
- package/dist/nodes/CloudConvert/operations/watermark/execute.js +80 -0
- package/dist/nodes/CloudConvert/operations/watermark/execute.js.map +1 -0
- package/dist/nodes/CloudConvert/operations/watermark/fields.d.ts +2 -0
- package/dist/nodes/CloudConvert/operations/watermark/fields.js +164 -0
- package/dist/nodes/CloudConvert/operations/watermark/fields.js.map +1 -0
- package/dist/nodes/CloudConvert/test/CloudConvert.node.test.d.ts +1 -0
- package/dist/nodes/CloudConvert/test/CloudConvert.node.test.js +103 -0
- package/dist/nodes/CloudConvert/test/CloudConvert.node.test.js.map +1 -0
- package/dist/nodes/CloudConvert/test/CloudConvert.workflow.test.json +354 -0
- package/dist/nodes/CloudConvert/test/ExecuteWorkflow.d.ts +7 -0
- package/dist/nodes/CloudConvert/test/ExecuteWorkflow.js +48 -0
- package/dist/nodes/CloudConvert/test/ExecuteWorkflow.js.map +1 -0
- package/dist/nodes/CloudConvert/test/FakeCredentialsMap.d.ts +8 -0
- package/dist/nodes/CloudConvert/test/FakeCredentialsMap.js +12 -0
- package/dist/nodes/CloudConvert/test/FakeCredentialsMap.js.map +1 -0
- package/dist/nodes/CloudConvert/test/Helpers.d.ts +32 -0
- package/dist/nodes/CloudConvert/test/Helpers.js +240 -0
- package/dist/nodes/CloudConvert/test/Helpers.js.map +1 -0
- package/dist/nodes/CloudConvert/test/types.d.ts +16 -0
- package/dist/nodes/CloudConvert/test/types.js +3 -0
- package/dist/nodes/CloudConvert/test/types.js.map +1 -0
- package/dist/package.json +67 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/index.js +0 -0
- package/package.json +67 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.executeOptimize = void 0;
|
|
7
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
9
|
+
const Utils_1 = require("../../Utils");
|
|
10
|
+
async function executeOptimize() {
|
|
11
|
+
const items = this.getInputData();
|
|
12
|
+
const returnData = [];
|
|
13
|
+
for (let i = 0; i < items.length; i++) {
|
|
14
|
+
const tasks = {
|
|
15
|
+
'n8n-upload': {
|
|
16
|
+
operation: 'import/upload',
|
|
17
|
+
},
|
|
18
|
+
'n8n-process': {
|
|
19
|
+
input: 'n8n-upload',
|
|
20
|
+
operation: 'optimize',
|
|
21
|
+
},
|
|
22
|
+
'n8n-export': {
|
|
23
|
+
input: 'n8n-process',
|
|
24
|
+
operation: 'export/url',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
if (this.getNodeParameter('additionalOptions', i, null)) {
|
|
28
|
+
let additionalOptions = this.getNodeParameter('additionalOptions', i);
|
|
29
|
+
try {
|
|
30
|
+
additionalOptions = JSON.parse(additionalOptions);
|
|
31
|
+
}
|
|
32
|
+
catch (exception) {
|
|
33
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Additional Options must be a valid JSON');
|
|
34
|
+
}
|
|
35
|
+
tasks['n8n-process'] = (0, lodash_merge_1.default)(tasks['n8n-process'], additionalOptions);
|
|
36
|
+
}
|
|
37
|
+
const createdJob = await Utils_1.createJob.call(this, tasks);
|
|
38
|
+
const uploadTask = (0, Utils_1.getJobUploadTask)(createdJob);
|
|
39
|
+
if (uploadTask) {
|
|
40
|
+
await Utils_1.uploadInputFile.call(this, uploadTask, i);
|
|
41
|
+
}
|
|
42
|
+
const completedJob = await Utils_1.waitForJob.call(this, createdJob.id);
|
|
43
|
+
const exportUrls = (0, Utils_1.getJobExportUrls)(completedJob);
|
|
44
|
+
for (const exportUrl of exportUrls) {
|
|
45
|
+
returnData.push({
|
|
46
|
+
json: {},
|
|
47
|
+
binary: {
|
|
48
|
+
data: await Utils_1.downloadOutputFile.call(this, exportUrl),
|
|
49
|
+
},
|
|
50
|
+
pairedItem: {
|
|
51
|
+
item: i,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return this.prepareOutputData(returnData);
|
|
57
|
+
}
|
|
58
|
+
exports.executeOptimize = executeOptimize;
|
|
59
|
+
//# sourceMappingURL=execute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../../nodes/CloudConvert/operations/optimize/execute.ts"],"names":[],"mappings":";;;;;;AACA,+CAAkD;AAElD,gEAAiC;AACjC,uCAOqB;AAEd,KAAK,UAAU,eAAe;IACpC,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IAClC,MAAM,UAAU,GAAG,EAAE,CAAC;IAEtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,MAAM,KAAK,GAAuB;YACjC,YAAY,EAAE;gBACb,SAAS,EAAE,eAAe;aAC1B;YACD,aAAa,EAAE;gBACd,KAAK,EAAE,YAAY;gBACnB,SAAS,EAAE,UAAU;aACrB;YACD,YAAY,EAAE;gBACb,KAAK,EAAE,aAAa;gBACpB,SAAS,EAAE,YAAY;aACvB;SACD,CAAC;QAEF,IAAI,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE;YACxD,IAAI,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,CAAC,CAAW,CAAC;YAChF,IAAI;gBACH,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;aAClD;YAAC,OAAO,SAAS,EAAE;gBACnB,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,yCAAyC,CAAC,CAAC;aACxF;YACD,KAAK,CAAC,aAAa,CAAC,GAAG,IAAA,sBAAK,EAAC,KAAK,CAAC,aAAa,CAAC,EAAE,iBAAiB,CAAC,CAAC;SACtE;QAED,MAAM,UAAU,GAAG,MAAM,iBAAS,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAErD,MAAM,UAAU,GAAG,IAAA,wBAAgB,EAAC,UAAU,CAAC,CAAC;QAEhD,IAAI,UAAU,EAAE;YACf,MAAM,uBAAe,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;SAChD;QAED,MAAM,YAAY,GAAG,MAAM,kBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;QAEhE,MAAM,UAAU,GAAG,IAAA,wBAAgB,EAAC,YAAY,CAAC,CAAC;QAElD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YACnC,UAAU,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE,EAAE;gBACR,MAAM,EAAE;oBACP,IAAI,EAAE,MAAM,0BAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC;iBACpD;gBACD,UAAU,EAAE;oBACX,IAAI,EAAE,CAAC;iBACP;aACD,CAAC,CAAC;SACH;KACD;IAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC;AAvDD,0CAuDC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.thumbnailFields = void 0;
|
|
4
|
+
exports.thumbnailFields = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Width',
|
|
7
|
+
name: 'width',
|
|
8
|
+
type: 'number',
|
|
9
|
+
default: '',
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
operation: ['thumbnail'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
placeholder: '',
|
|
16
|
+
description: 'Thumbnail width in pixels',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
displayName: 'Height',
|
|
20
|
+
name: 'height',
|
|
21
|
+
type: 'number',
|
|
22
|
+
default: '',
|
|
23
|
+
displayOptions: {
|
|
24
|
+
show: {
|
|
25
|
+
operation: ['thumbnail'],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
placeholder: '',
|
|
29
|
+
description: 'Thumbnail height in pixels',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
displayName: 'Fit',
|
|
33
|
+
name: 'fit',
|
|
34
|
+
type: 'options',
|
|
35
|
+
default: 'max',
|
|
36
|
+
options: [
|
|
37
|
+
{
|
|
38
|
+
name: 'Max',
|
|
39
|
+
value: 'max',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Crop',
|
|
43
|
+
value: 'crop',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'Scale',
|
|
47
|
+
value: 'scale',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
displayOptions: {
|
|
51
|
+
show: {
|
|
52
|
+
operation: ['thumbnail'],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
description: 'Sets the mode of resizing the image. "Max" resizes the image to fit within the width and height, but will not increase the size of the image if it is smaller than width or height. "Crop" resizes the image to fill the width and height dimensions and crops any excess image data. "Scale" enforces the image width and height by scaling.',
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
//# sourceMappingURL=description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description.js","sourceRoot":"","sources":["../../../../../nodes/CloudConvert/operations/thumbnail/description.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAsB;IACjD;QACC,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,SAAS,EAAE,CAAC,WAAW,CAAC;aACxB;SACD;QACD,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,2BAA2B;KACxC;IACD;QACC,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,SAAS,EAAE,CAAC,WAAW,CAAC;aACxB;SACD;QACD,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,4BAA4B;KACzC;IACD;QACC,WAAW,EAAE,KAAK;QAClB,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;QACd,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;aACZ;YACD;gBACC,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,MAAM;aACb;YACD;gBACC,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,OAAO;aACd;SACD;QACD,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,SAAS,EAAE,CAAC,WAAW,CAAC;aACxB;SACD;QACD,WAAW,EACV,+UAA+U;KAChV;CACD,CAAA"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.executeThumbnail = void 0;
|
|
7
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
9
|
+
const Utils_1 = require("../../Utils");
|
|
10
|
+
async function executeThumbnail() {
|
|
11
|
+
const items = this.getInputData();
|
|
12
|
+
const returnData = [];
|
|
13
|
+
for (let i = 0; i < items.length; i++) {
|
|
14
|
+
const tasks = {
|
|
15
|
+
'n8n-upload': {
|
|
16
|
+
operation: 'import/upload',
|
|
17
|
+
},
|
|
18
|
+
'n8n-process': {
|
|
19
|
+
input: 'n8n-upload',
|
|
20
|
+
operation: 'thumbnail',
|
|
21
|
+
output_format: this.getNodeParameter('outputFormat', i),
|
|
22
|
+
},
|
|
23
|
+
'n8n-export': {
|
|
24
|
+
input: 'n8n-process',
|
|
25
|
+
operation: 'export/url',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
for (const option of ['width', 'height', 'fit']) {
|
|
29
|
+
if (this.getNodeParameter(option, i, null)) {
|
|
30
|
+
tasks['n8n-process'][option] = this.getNodeParameter(option, i);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (this.getNodeParameter('additionalOptions', i, null)) {
|
|
34
|
+
let additionalOptions = this.getNodeParameter('additionalOptions', i);
|
|
35
|
+
try {
|
|
36
|
+
additionalOptions = JSON.parse(additionalOptions);
|
|
37
|
+
}
|
|
38
|
+
catch (exception) {
|
|
39
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Additional Options must be a valid JSON');
|
|
40
|
+
}
|
|
41
|
+
tasks['n8n-process'] = (0, lodash_merge_1.default)(tasks['n8n-process'], additionalOptions);
|
|
42
|
+
}
|
|
43
|
+
const createdJob = await Utils_1.createJob.call(this, tasks);
|
|
44
|
+
const uploadTask = (0, Utils_1.getJobUploadTask)(createdJob);
|
|
45
|
+
if (uploadTask) {
|
|
46
|
+
await Utils_1.uploadInputFile.call(this, uploadTask, i);
|
|
47
|
+
}
|
|
48
|
+
const completedJob = await Utils_1.waitForJob.call(this, createdJob.id);
|
|
49
|
+
const exportUrls = (0, Utils_1.getJobExportUrls)(completedJob);
|
|
50
|
+
for (const exportUrl of exportUrls) {
|
|
51
|
+
returnData.push({
|
|
52
|
+
json: {},
|
|
53
|
+
binary: {
|
|
54
|
+
data: await Utils_1.downloadOutputFile.call(this, exportUrl),
|
|
55
|
+
},
|
|
56
|
+
pairedItem: {
|
|
57
|
+
item: i,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return this.prepareOutputData(returnData);
|
|
63
|
+
}
|
|
64
|
+
exports.executeThumbnail = executeThumbnail;
|
|
65
|
+
//# sourceMappingURL=execute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../../nodes/CloudConvert/operations/thumbnail/execute.ts"],"names":[],"mappings":";;;;;;AACA,+CAAkD;AAElD,gEAAiC;AACjC,uCAOqB;AAEd,KAAK,UAAU,gBAAgB;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IAClC,MAAM,UAAU,GAAG,EAAE,CAAC;IAEtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,MAAM,KAAK,GAAuB;YACjC,YAAY,EAAE;gBACb,SAAS,EAAE,eAAe;aAC1B;YACD,aAAa,EAAE;gBACd,KAAK,EAAE,YAAY;gBACnB,SAAS,EAAE,WAAW;gBACtB,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAC;aACvD;YACD,YAAY,EAAE;gBACb,KAAK,EAAE,aAAa;gBACpB,SAAS,EAAE,YAAY;aACvB;SACD,CAAC;QAEF,KAAK,MAAM,MAAM,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE;YAChD,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE;gBAC3C,KAAK,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,CA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IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC;AAhED,4CAgEC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.thumbnailFields = void 0;
|
|
4
|
+
exports.thumbnailFields = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Width',
|
|
7
|
+
name: 'width',
|
|
8
|
+
type: 'number',
|
|
9
|
+
default: '',
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
operation: ['thumbnail'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
placeholder: '',
|
|
16
|
+
description: 'Thumbnail width in pixels',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
displayName: 'Height',
|
|
20
|
+
name: 'height',
|
|
21
|
+
type: 'number',
|
|
22
|
+
default: '',
|
|
23
|
+
displayOptions: {
|
|
24
|
+
show: {
|
|
25
|
+
operation: ['thumbnail'],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
placeholder: '',
|
|
29
|
+
description: 'Thumbnail height in pixels',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
displayName: 'Fit',
|
|
33
|
+
name: 'fit',
|
|
34
|
+
type: 'options',
|
|
35
|
+
default: 'max',
|
|
36
|
+
options: [
|
|
37
|
+
{
|
|
38
|
+
name: 'Max',
|
|
39
|
+
value: 'max',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Crop',
|
|
43
|
+
value: 'crop',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'Scale',
|
|
47
|
+
value: 'scale',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
displayOptions: {
|
|
51
|
+
show: {
|
|
52
|
+
operation: ['thumbnail'],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
description: 'Sets the mode of resizing the image. "Max" resizes the image to fit within the width and height, but will not increase the size of the image if it is smaller than width or height. "Crop" resizes the image to fill the width and height dimensions and crops any excess image data. "Scale" enforces the image width and height by scaling.',
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../nodes/CloudConvert/operations/thumbnail/fields.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAsB;IACjD;QACC,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,SAAS,EAAE,CAAC,WAAW,CAAC;aACxB;SACD;QACD,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,2BAA2B;KACxC;IACD;QACC,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,SAAS,EAAE,CAAC,WAAW,CAAC;aACxB;SACD;QACD,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,4BAA4B;KACzC;IACD;QACC,WAAW,EAAE,KAAK;QAClB,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;QACd,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;aACZ;YACD;gBACC,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,MAAM;aACb;YACD;gBACC,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,OAAO;aACd;SACD;QACD,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,SAAS,EAAE,CAAC,WAAW,CAAC;aACxB;SACD;QACD,WAAW,EACV,+UAA+U;KAChV;CACD,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.executeWatermark = void 0;
|
|
7
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
9
|
+
const Utils_1 = require("../../Utils");
|
|
10
|
+
async function executeWatermark() {
|
|
11
|
+
const items = this.getInputData();
|
|
12
|
+
const returnData = [];
|
|
13
|
+
for (let i = 0; i < items.length; i++) {
|
|
14
|
+
const tasks = {
|
|
15
|
+
'n8n-upload': {
|
|
16
|
+
operation: 'import/upload',
|
|
17
|
+
},
|
|
18
|
+
'n8n-process': {
|
|
19
|
+
input: 'n8n-upload',
|
|
20
|
+
operation: 'watermark',
|
|
21
|
+
},
|
|
22
|
+
'n8n-export': {
|
|
23
|
+
input: 'n8n-process',
|
|
24
|
+
operation: 'export/url',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
if (this.getNodeParameter('useWatermarkImage', i, false)) {
|
|
28
|
+
tasks['n8n-watermark-image'] = {
|
|
29
|
+
operation: 'import/url',
|
|
30
|
+
url: this.getNodeParameter('imageUrl', i),
|
|
31
|
+
};
|
|
32
|
+
tasks['n8n-process'].image = 'n8n-watermark-image';
|
|
33
|
+
}
|
|
34
|
+
for (const option of [
|
|
35
|
+
'text',
|
|
36
|
+
'font_size',
|
|
37
|
+
'font_color',
|
|
38
|
+
'position_vertical',
|
|
39
|
+
'position_horizontal',
|
|
40
|
+
'margin_vertical',
|
|
41
|
+
'margin_horizontal',
|
|
42
|
+
'opacity',
|
|
43
|
+
]) {
|
|
44
|
+
if (this.getNodeParameter(option, i, null)) {
|
|
45
|
+
tasks['n8n-process'][option] = this.getNodeParameter(option, i);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (this.getNodeParameter('additionalOptions', i, null)) {
|
|
49
|
+
let additionalOptions = this.getNodeParameter('additionalOptions', i);
|
|
50
|
+
try {
|
|
51
|
+
additionalOptions = JSON.parse(additionalOptions);
|
|
52
|
+
}
|
|
53
|
+
catch (exception) {
|
|
54
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Additional Options must be a valid JSON');
|
|
55
|
+
}
|
|
56
|
+
tasks['n8n-process'] = (0, lodash_merge_1.default)(tasks['n8n-process'], additionalOptions);
|
|
57
|
+
}
|
|
58
|
+
const createdJob = await Utils_1.createJob.call(this, tasks);
|
|
59
|
+
const uploadTask = (0, Utils_1.getJobUploadTask)(createdJob);
|
|
60
|
+
if (uploadTask) {
|
|
61
|
+
await Utils_1.uploadInputFile.call(this, uploadTask, i);
|
|
62
|
+
}
|
|
63
|
+
const completedJob = await Utils_1.waitForJob.call(this, createdJob.id);
|
|
64
|
+
const exportUrls = (0, Utils_1.getJobExportUrls)(completedJob);
|
|
65
|
+
for (const exportUrl of exportUrls) {
|
|
66
|
+
returnData.push({
|
|
67
|
+
json: {},
|
|
68
|
+
binary: {
|
|
69
|
+
data: await Utils_1.downloadOutputFile.call(this, exportUrl),
|
|
70
|
+
},
|
|
71
|
+
pairedItem: {
|
|
72
|
+
item: i,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return this.prepareOutputData(returnData);
|
|
78
|
+
}
|
|
79
|
+
exports.executeWatermark = executeWatermark;
|
|
80
|
+
//# sourceMappingURL=execute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../../nodes/CloudConvert/operations/watermark/execute.ts"],"names":[],"mappings":";;;;;;AACA,+CAAkD;AAElD,gEAAiC;AACjC,uCAOqB;AAEd,KAAK,UAAU,gBAAgB;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IAClC,MAAM,UAAU,GAAG,E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YAAC,OAAO,SAAS,EAAE;gBACnB,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,yCAAyC,CAAC,CAAC;aACxF;YACD,KAAK,CAAC,aAAa,CAAC,GAAG,IAAA,sBAAK,EAAC,KAAK,CAAC,aAAa,CAAC,EAAE,iBAAiB,CAAC,CAAC;SACtE;QAED,MAAM,UAAU,GAAG,MAAM,iBAAS,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAErD,MAAM,UAAU,GAAG,IAAA,wBAAgB,EAAC,UAAU,CAAC,CAAC;QAEhD,IAAI,UAAU,EAAE;YACf,MAAM,uBAAe,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;SAChD;QAED,MAAM,YAAY,GAAG,MAAM,kBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;QAIhE,MAAM,UAAU,GAAG,IAAA,wBAAgB,EAAC,YAAY,CAAC,CAAC;QAElD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YACnC,UAAU,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE,EAAE;gBACR,MAAM,EAAE;oBACP,IAAI,EAAE,MAAM,0BAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC;iBACpD;gBACD,UAAU,EAAE;oBACX,IAAI,EAAE,CAAC;iBACP;aACD,CAAC,CAAC;SACH;KACD;IAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC;AA/ED,4CA+EC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.watermarkFields = void 0;
|
|
4
|
+
exports.watermarkFields = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Watermark Image',
|
|
7
|
+
name: 'useWatermarkImage',
|
|
8
|
+
type: 'boolean',
|
|
9
|
+
default: false,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
operation: ['watermark'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
description: 'Whether the watermark should be an image',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
displayName: 'Image URL',
|
|
19
|
+
name: 'imageUrl',
|
|
20
|
+
type: 'string',
|
|
21
|
+
default: '',
|
|
22
|
+
required: true,
|
|
23
|
+
displayOptions: {
|
|
24
|
+
show: {
|
|
25
|
+
operation: ['watermark'],
|
|
26
|
+
useWatermarkImage: [true],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
placeholder: 'https://...',
|
|
30
|
+
description: 'The URL to the image (PNG, JPG, SVG) which should be added as watermark',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
displayName: 'Text',
|
|
34
|
+
name: 'text',
|
|
35
|
+
type: 'string',
|
|
36
|
+
default: '',
|
|
37
|
+
required: true,
|
|
38
|
+
displayOptions: {
|
|
39
|
+
show: {
|
|
40
|
+
operation: ['watermark'],
|
|
41
|
+
useWatermarkImage: [false],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
placeholder: '',
|
|
45
|
+
description: 'Sets the text to use as watermark',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
displayName: 'Font Size',
|
|
49
|
+
name: 'font_size',
|
|
50
|
+
type: 'number',
|
|
51
|
+
default: 40,
|
|
52
|
+
required: true,
|
|
53
|
+
displayOptions: {
|
|
54
|
+
show: {
|
|
55
|
+
operation: ['watermark'],
|
|
56
|
+
useWatermarkImage: [false],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
placeholder: '',
|
|
60
|
+
description: 'Watermark font size',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Font Color',
|
|
64
|
+
name: 'font_color',
|
|
65
|
+
type: 'color',
|
|
66
|
+
default: '#000000',
|
|
67
|
+
displayOptions: {
|
|
68
|
+
show: {
|
|
69
|
+
operation: ['watermark'],
|
|
70
|
+
useWatermarkImage: [false],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
placeholder: '',
|
|
74
|
+
description: 'Watermark font size',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
displayName: 'Vertical Position',
|
|
78
|
+
name: 'position_vertical',
|
|
79
|
+
type: 'options',
|
|
80
|
+
default: 'center',
|
|
81
|
+
options: [
|
|
82
|
+
{
|
|
83
|
+
name: 'Top',
|
|
84
|
+
value: 'top',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'Center',
|
|
88
|
+
value: 'center',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'Bottom',
|
|
92
|
+
value: 'bottom',
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
displayOptions: {
|
|
96
|
+
show: { operation: ['watermark'] },
|
|
97
|
+
},
|
|
98
|
+
description: 'Vertical position of the watermark',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
displayName: 'Horizontal Position',
|
|
102
|
+
name: 'position_horizontal',
|
|
103
|
+
type: 'options',
|
|
104
|
+
default: 'center',
|
|
105
|
+
options: [
|
|
106
|
+
{
|
|
107
|
+
name: 'Left',
|
|
108
|
+
value: 'left',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'Center',
|
|
112
|
+
value: 'center',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: 'Right',
|
|
116
|
+
value: 'right',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
displayOptions: {
|
|
120
|
+
show: { operation: ['watermark'] },
|
|
121
|
+
},
|
|
122
|
+
description: 'Horizontal position of the watermark',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
displayName: 'Vertical Margin',
|
|
126
|
+
name: 'margin_vertical',
|
|
127
|
+
type: 'number',
|
|
128
|
+
default: 25,
|
|
129
|
+
displayOptions: {
|
|
130
|
+
show: {
|
|
131
|
+
operation: ['watermark'],
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
placeholder: '',
|
|
135
|
+
description: 'Spacing to the left and to the right of the watermark',
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
displayName: 'Horizontal Margin',
|
|
139
|
+
name: 'margin_horizontal',
|
|
140
|
+
type: 'number',
|
|
141
|
+
default: 25,
|
|
142
|
+
displayOptions: {
|
|
143
|
+
show: {
|
|
144
|
+
operation: ['watermark'],
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
placeholder: '',
|
|
148
|
+
description: 'Spacing to the top and to the bottom of the watermark',
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
displayName: 'Opacity',
|
|
152
|
+
name: 'opacity',
|
|
153
|
+
type: 'number',
|
|
154
|
+
default: 100,
|
|
155
|
+
displayOptions: {
|
|
156
|
+
show: {
|
|
157
|
+
operation: ['watermark'],
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
placeholder: '',
|
|
161
|
+
description: 'Opacity in % to make the watermark transparent. A value of 100 means it is fully visible.',
|
|
162
|
+
},
|
|
163
|
+
];
|
|
164
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../nodes/CloudConvert/operations/watermark/fields.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAsB;IACjD;QACC,WAAW,EAAE,iBAAiB;QAC9B,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;QACd,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,SAAS,EAAE,CAAC,WAAW,CAAC;aACxB;SACD;QACD,WAAW,EAAE,0CAA0C;KACvD;IACD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;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AAQ;QACd,OAAO,EAAE,GAAG;QACZ,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,SAAS,EAAE,CAAC,WAAW,CAAC;aACxB;SACD;QACD,WAAW,EAAE,EAAE;QACf,WAAW,EACV,2FAA2F;KAC5F;CACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const nock_1 = __importDefault(require("nock"));
|
|
7
|
+
const Helpers_1 = require("./Helpers");
|
|
8
|
+
const FakeCredentialsMap_1 = require("./FakeCredentialsMap");
|
|
9
|
+
describe('Test CloudConvert Node', () => {
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
await (0, Helpers_1.initBinaryDataManager)();
|
|
12
|
+
});
|
|
13
|
+
beforeAll(() => {
|
|
14
|
+
nock_1.default.disableNetConnect();
|
|
15
|
+
const { apiUrl, syncApiUrl, storageUrl } = FakeCredentialsMap_1.FAKE_CREDENTIALS_DATA.cloudConvertApi;
|
|
16
|
+
(0, nock_1.default)(apiUrl)
|
|
17
|
+
.persist(true)
|
|
18
|
+
.post('/v2/jobs')
|
|
19
|
+
.reply(200, {
|
|
20
|
+
data: {
|
|
21
|
+
id: 'fake-id',
|
|
22
|
+
status: 'waiting',
|
|
23
|
+
tasks: [
|
|
24
|
+
{
|
|
25
|
+
operation: 'import/upload',
|
|
26
|
+
status: 'waiting',
|
|
27
|
+
result: {
|
|
28
|
+
form: {
|
|
29
|
+
url: storageUrl + '/upload',
|
|
30
|
+
parameters: {
|
|
31
|
+
some: 'value',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
operation: 'convert',
|
|
38
|
+
status: 'waiting',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
operation: 'export/url',
|
|
42
|
+
status: 'waiting',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
(0, nock_1.default)(syncApiUrl)
|
|
48
|
+
.persist()
|
|
49
|
+
.get('/v2/jobs/fake-id')
|
|
50
|
+
.reply(200, {
|
|
51
|
+
data: {
|
|
52
|
+
id: 'fake-id',
|
|
53
|
+
status: 'finished',
|
|
54
|
+
tasks: [
|
|
55
|
+
{
|
|
56
|
+
operation: 'import/upload',
|
|
57
|
+
status: 'finished',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
operation: 'convert',
|
|
61
|
+
status: 'finished',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
operation: 'export/url',
|
|
65
|
+
status: 'finished',
|
|
66
|
+
result: {
|
|
67
|
+
files: [
|
|
68
|
+
{
|
|
69
|
+
filename: 'output.txt',
|
|
70
|
+
url: storageUrl + '/files/fake-id/output.txt',
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
operation: 'metadata',
|
|
77
|
+
status: 'finished',
|
|
78
|
+
result: {
|
|
79
|
+
metadata: {
|
|
80
|
+
some: 'metadata',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
const storageMock = (0, nock_1.default)(storageUrl);
|
|
88
|
+
storageMock.persist().post('/upload').reply(200, {
|
|
89
|
+
data: '',
|
|
90
|
+
});
|
|
91
|
+
storageMock.persist().get('/files/fake-id/output.txt').reply(200, {
|
|
92
|
+
data: 'output',
|
|
93
|
+
}, {
|
|
94
|
+
'Content-Type': 'text/plain',
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
afterAll(() => {
|
|
98
|
+
nock_1.default.restore();
|
|
99
|
+
});
|
|
100
|
+
const workflows = (0, Helpers_1.getWorkflowFilenames)(__dirname);
|
|
101
|
+
(0, Helpers_1.testWorkflows)(workflows);
|
|
102
|
+
});
|
|
103
|
+
//# sourceMappingURL=CloudConvert.node.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloudConvert.node.test.js","sourceRoot":"","sources":["../../../../nodes/CloudConvert/test/CloudConvert.node.test.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,uCAAuF;AACvF,6DAA6D;AAE7D,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACvC,UAAU,CAAC,KAAK,IAAI,EAAE;QACrB,MAAM,IAAA,+BAAqB,GAAE,CAAC;IAC/B,CAAC,CAAC,CAAC;IACH,SAAS,CAAC,GAAG,EAAE;QACd,cAAI,CAAC,iBAAiB,EAAE,CAAC;QAEzB,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,0CAAqB,CAAC,eAAe,CAAC;QAEjF,IAAA,cAAI,EAAC,MAAM,CAAC;aACV,OAAO,CAAC,IAAI,CAAC;aACb,IAAI,CAAC,UAAU,CAAC;aAChB,KAAK,CAAC,GAAG,EAAE;YACX,IAAI,EAAE;gBACL,EAAE,EAAE,SAAS;gBACb,MAAM,EAAE,SAAS;gBACjB,KAAK,EAAE;oBACN;wBACC,SAAS,EAAE,eAAe;wBAC1B,MAAM,EAAE,SAAS;wBACjB,MAAM,EAAE;4BACP,IAAI,EAAE;gCACL,GAAG,EAAE,UAAU,GAAG,SAAS;gCAC3B,UAAU,EAAE;oCACX,IAAI,EAAE,OAAO;iCACb;6BACD;yBACD;qBACD;oBACD;wBACC,SAAS,EAAE,SAAS;wBACpB,MAAM,EAAE,SAAS;qBACjB;oBACD;wBACC,SAAS,EAAE,YAAY;wBACvB,MAAM,EAAE,SAAS;qBACjB;iBACD;aACD;SACD,CAAC,CAAC;QAEJ,IAAA,cAAI,EAAC,UAA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