n8n-nodes-cloudinary 0.0.9 → 0.1.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 +51 -0
- package/dist/credentials/CloudinaryApi.credentials.js +16 -0
- package/dist/credentials/CloudinaryApi.credentials.js.map +1 -1
- package/dist/nodes/Cloudinary/Cloudinary.node.d.ts +0 -1
- package/dist/nodes/Cloudinary/Cloudinary.node.js +26 -707
- package/dist/nodes/Cloudinary/Cloudinary.node.js.map +1 -1
- package/dist/nodes/Cloudinary/Cloudinary.node.json +5 -1
- package/dist/nodes/Cloudinary/cloudinary.utils.d.ts +34 -0
- package/dist/nodes/Cloudinary/cloudinary.utils.js +114 -3
- package/dist/nodes/Cloudinary/cloudinary.utils.js.map +1 -1
- package/dist/nodes/Cloudinary/descriptions/admin/getTags.fields.d.ts +2 -0
- package/dist/nodes/Cloudinary/descriptions/admin/getTags.fields.js +64 -0
- package/dist/nodes/Cloudinary/descriptions/admin/getTags.fields.js.map +1 -0
- package/dist/nodes/Cloudinary/descriptions/admin/search.fields.d.ts +2 -0
- package/dist/nodes/Cloudinary/descriptions/admin/search.fields.js +119 -0
- package/dist/nodes/Cloudinary/descriptions/admin/search.fields.js.map +1 -0
- package/dist/nodes/Cloudinary/descriptions/asset.fields.d.ts +2 -0
- package/dist/nodes/Cloudinary/descriptions/asset.fields.js +357 -0
- package/dist/nodes/Cloudinary/descriptions/asset.fields.js.map +1 -0
- package/dist/nodes/Cloudinary/descriptions/index.d.ts +2 -0
- package/dist/nodes/Cloudinary/descriptions/index.js +22 -0
- package/dist/nodes/Cloudinary/descriptions/index.js.map +1 -0
- package/dist/nodes/Cloudinary/descriptions/resource.d.ts +2 -0
- package/dist/nodes/Cloudinary/descriptions/resource.js +267 -0
- package/dist/nodes/Cloudinary/descriptions/resource.js.map +1 -0
- package/dist/nodes/Cloudinary/descriptions/transform.fields.d.ts +2 -0
- package/dist/nodes/Cloudinary/descriptions/transform.fields.js +742 -0
- package/dist/nodes/Cloudinary/descriptions/transform.fields.js.map +1 -0
- package/dist/nodes/Cloudinary/descriptions/updateAsset.fields.d.ts +2 -0
- package/dist/nodes/Cloudinary/descriptions/updateAsset.fields.js +262 -0
- package/dist/nodes/Cloudinary/descriptions/updateAsset.fields.js.map +1 -0
- package/dist/nodes/Cloudinary/descriptions/upload.fields.d.ts +2 -0
- package/dist/nodes/Cloudinary/descriptions/upload.fields.js +191 -0
- package/dist/nodes/Cloudinary/descriptions/upload.fields.js.map +1 -0
- package/dist/nodes/Cloudinary/descriptions/widget.fields.d.ts +2 -0
- package/dist/nodes/Cloudinary/descriptions/widget.fields.js +268 -0
- package/dist/nodes/Cloudinary/descriptions/widget.fields.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/admin/getMetadataFields.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/admin/getMetadataFields.js +17 -0
- package/dist/nodes/Cloudinary/operations/admin/getMetadataFields.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/admin/getTags.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/admin/getTags.js +28 -0
- package/dist/nodes/Cloudinary/operations/admin/getTags.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/admin/search.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/admin/search.js +92 -0
- package/dist/nodes/Cloudinary/operations/admin/search.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/asset/updateMetadata.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/asset/updateMetadata.js +25 -0
- package/dist/nodes/Cloudinary/operations/asset/updateMetadata.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/asset/updateTags.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/asset/updateTags.js +30 -0
- package/dist/nodes/Cloudinary/operations/asset/updateTags.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/index.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/index.js +50 -0
- package/dist/nodes/Cloudinary/operations/index.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/tagAppend.d.ts +4 -0
- package/dist/nodes/Cloudinary/operations/tagAppend.js +44 -0
- package/dist/nodes/Cloudinary/operations/tagAppend.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/transform/convertImage.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/transform/convertImage.js +23 -0
- package/dist/nodes/Cloudinary/operations/transform/convertImage.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/transform/cropImage.d.ts +3 -0
- package/dist/nodes/Cloudinary/operations/transform/cropImage.js +31 -0
- package/dist/nodes/Cloudinary/operations/transform/cropImage.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/transform/customTransformation.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/transform/customTransformation.js +28 -0
- package/dist/nodes/Cloudinary/operations/transform/customTransformation.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/transform/multiStep.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/transform/multiStep.js +78 -0
- package/dist/nodes/Cloudinary/operations/transform/multiStep.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/transform/optimizeImage.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/transform/optimizeImage.js +22 -0
- package/dist/nodes/Cloudinary/operations/transform/optimizeImage.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/transform/optimizeVideo.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/transform/optimizeVideo.js +22 -0
- package/dist/nodes/Cloudinary/operations/transform/optimizeVideo.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/transform/resizeImage.d.ts +3 -0
- package/dist/nodes/Cloudinary/operations/transform/resizeImage.js +28 -0
- package/dist/nodes/Cloudinary/operations/transform/resizeImage.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/transform/shared.d.ts +47 -0
- package/dist/nodes/Cloudinary/operations/transform/shared.js +179 -0
- package/dist/nodes/Cloudinary/operations/transform/shared.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/transform/trimVideo.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/transform/trimVideo.js +24 -0
- package/dist/nodes/Cloudinary/operations/transform/trimVideo.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/transform/videoThumbnail.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/transform/videoThumbnail.js +34 -0
- package/dist/nodes/Cloudinary/operations/transform/videoThumbnail.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/types.d.ts +10 -0
- package/dist/nodes/Cloudinary/operations/types.js +5 -0
- package/dist/nodes/Cloudinary/operations/types.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/updateAsset/deleteAssets.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/updateAsset/deleteAssets.js +36 -0
- package/dist/nodes/Cloudinary/operations/updateAsset/deleteAssets.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/updateAsset/getAsset.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/updateAsset/getAsset.js +20 -0
- package/dist/nodes/Cloudinary/operations/updateAsset/getAsset.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/updateAsset/updateMetadata.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/updateAsset/updateMetadata.js +27 -0
- package/dist/nodes/Cloudinary/operations/updateAsset/updateMetadata.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/updateAsset/updateTags.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/updateAsset/updateTags.js +32 -0
- package/dist/nodes/Cloudinary/operations/updateAsset/updateTags.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/upload/uploadFile.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/upload/uploadFile.js +44 -0
- package/dist/nodes/Cloudinary/operations/upload/uploadFile.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/upload/uploadUrl.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/upload/uploadUrl.js +34 -0
- package/dist/nodes/Cloudinary/operations/upload/uploadUrl.js.map +1 -0
- package/dist/nodes/Cloudinary/operations/widget/videoPlayer.d.ts +2 -0
- package/dist/nodes/Cloudinary/operations/widget/videoPlayer.js +170 -0
- package/dist/nodes/Cloudinary/operations/widget/videoPlayer.js.map +1 -0
- package/dist/package.json +7 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -3
- package/dist/nodes/Cloudinary/sha1.utils.d.ts +0 -1
- package/dist/nodes/Cloudinary/sha1.utils.js +0 -68
- package/dist/nodes/Cloudinary/sha1.utils.js.map +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertImage = void 0;
|
|
4
|
+
const cloudinary_utils_1 = require("../../cloudinary.utils");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
const convertImage = async (ctx, i, creds) => {
|
|
7
|
+
const { publicId, deliveryType, version, continueFrom } = (0, shared_1.readTransformInput)(ctx, i);
|
|
8
|
+
const format = ctx.getNodeParameter('convertFormat', i, 'webp');
|
|
9
|
+
const components = (0, shared_1.buildComponents)(ctx, i, () => (0, shared_1.convertComponents)(format));
|
|
10
|
+
return [
|
|
11
|
+
(0, shared_1.buildTransformResult)(creds, {
|
|
12
|
+
resourceType: 'image',
|
|
13
|
+
type: deliveryType,
|
|
14
|
+
transformation: (0, cloudinary_utils_1.joinTransformation)(components),
|
|
15
|
+
publicId,
|
|
16
|
+
format,
|
|
17
|
+
version,
|
|
18
|
+
continueFrom,
|
|
19
|
+
}),
|
|
20
|
+
];
|
|
21
|
+
};
|
|
22
|
+
exports.convertImage = convertImage;
|
|
23
|
+
//# sourceMappingURL=convertImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertImage.js","sourceRoot":"","sources":["../../../../../nodes/Cloudinary/operations/transform/convertImage.ts"],"names":[],"mappings":";;;AAAA,6DAA4D;AAE5D,qCAAwG;AAGjG,MAAM,YAAY,GAAqB,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;IACrE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,IAAA,2BAAkB,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrF,MAAM,MAAM,GAAG,GAAG,CAAC,gBAAgB,CAAC,eAAe,EAAE,CAAC,EAAE,MAAM,CAAW,CAAC;IAE1E,MAAM,UAAU,GAAG,IAAA,wBAAe,EAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,IAAA,0BAAiB,EAAC,MAAM,CAAC,CAAC,CAAC;IAE5E,OAAO;QACN,IAAA,6BAAoB,EAAC,KAAK,EAAE;YAC3B,YAAY,EAAE,OAAO;YACrB,IAAI,EAAE,YAAY;YAClB,cAAc,EAAE,IAAA,qCAAkB,EAAC,UAAU,CAAC;YAC9C,QAAQ;YACR,MAAM;YACN,OAAO;YACP,YAAY;SACZ,CAAC;KACF,CAAC;AACH,CAAC,CAAC;AAjBW,QAAA,YAAY,gBAiBvB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cropVideo = exports.cropImage = void 0;
|
|
4
|
+
const cloudinary_utils_1 = require("../../cloudinary.utils");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
const makeCrop = (resourceType) => async (ctx, i, creds) => {
|
|
7
|
+
const { publicId, deliveryType, version, continueFrom } = (0, shared_1.readTransformInput)(ctx, i);
|
|
8
|
+
const cropBy = ctx.getNodeParameter('cropBy', i, 'dimensions');
|
|
9
|
+
const genFill = ctx.getNodeParameter('cropGenerativeFill', i, false);
|
|
10
|
+
const focus = ctx.getNodeParameter('cropFocus', i, 'auto');
|
|
11
|
+
const genFillPrompt = ctx.getNodeParameter('cropGenerativeFillPrompt', i, '');
|
|
12
|
+
const width = cropBy === 'aspectRatio'
|
|
13
|
+
? ctx.getNodeParameter('cropAspectWidth', i, 0)
|
|
14
|
+
: ctx.getNodeParameter('cropWidth', i, 0);
|
|
15
|
+
const height = cropBy === 'aspectRatio' ? 0 : ctx.getNodeParameter('cropHeight', i, 0);
|
|
16
|
+
const aspectRatio = cropBy === 'aspectRatio' ? ctx.getNodeParameter('cropAspectRatio', i, '') : '';
|
|
17
|
+
const components = (0, shared_1.buildComponents)(ctx, i, () => (0, shared_1.cropComponents)({ cropBy, width, height, aspectRatio, focus, genFill, genFillPrompt }));
|
|
18
|
+
return [
|
|
19
|
+
(0, shared_1.buildTransformResult)(creds, {
|
|
20
|
+
resourceType,
|
|
21
|
+
type: deliveryType,
|
|
22
|
+
transformation: (0, cloudinary_utils_1.joinTransformation)(components),
|
|
23
|
+
publicId,
|
|
24
|
+
version,
|
|
25
|
+
continueFrom,
|
|
26
|
+
}),
|
|
27
|
+
];
|
|
28
|
+
};
|
|
29
|
+
exports.cropImage = makeCrop('image');
|
|
30
|
+
exports.cropVideo = makeCrop('video');
|
|
31
|
+
//# sourceMappingURL=cropImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cropImage.js","sourceRoot":"","sources":["../../../../../nodes/Cloudinary/operations/transform/cropImage.ts"],"names":[],"mappings":";;;AAAA,6DAA4D;AAE5D,qCAAqG;AAarG,MAAM,QAAQ,GACb,CAAC,YAA+B,EAAoB,EAAE,CACtD,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;IACvB,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,IAAA,2BAAkB,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrF,MAAM,MAAM,GAAG,GAAG,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,EAAE,YAAY,CAAW,CAAC;IACzE,MAAM,OAAO,GAAG,GAAG,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,CAAC,EAAE,KAAK,CA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,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customTransformation = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
const customTransformation = async (ctx, i, creds) => {
|
|
7
|
+
const { publicId, deliveryType, version } = (0, shared_1.readTransformInput)(ctx, i);
|
|
8
|
+
const resourceType = ctx.getNodeParameter('customResourceType', i, 'image');
|
|
9
|
+
const transformation = ctx.getNodeParameter('customTransformationString', i, '').trim();
|
|
10
|
+
const format = ctx.getNodeParameter('customFormat', i, '').trim();
|
|
11
|
+
if (!transformation) {
|
|
12
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'A transformation string is required', {
|
|
13
|
+
itemIndex: i,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return [
|
|
17
|
+
(0, shared_1.buildTransformResult)(creds, {
|
|
18
|
+
resourceType,
|
|
19
|
+
type: deliveryType,
|
|
20
|
+
transformation,
|
|
21
|
+
publicId,
|
|
22
|
+
format: format || undefined,
|
|
23
|
+
version,
|
|
24
|
+
}),
|
|
25
|
+
];
|
|
26
|
+
};
|
|
27
|
+
exports.customTransformation = customTransformation;
|
|
28
|
+
//# sourceMappingURL=customTransformation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customTransformation.js","sourceRoot":"","sources":["../../../../../nodes/Cloudinary/operations/transform/customTransformation.ts"],"names":[],"mappings":";;;AAAA,+CAAkD;AAElD,qCAAoE;AAO7D,MAAM,oBAAoB,GAAqB,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;IAC7E,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,IAAA,2BAAkB,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACvE,MAAM,YAAY,GAAG,GAAG,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,CAAC,EAAE,OAAO,CAAW,CAAC;IACtF,MAAM,cAAc,GAAI,GAAG,CAAC,gBAAgB,CAAC,4BAA4B,EAAE,CAAC,EAAE,EAAE,CAAY,CAAC,IAAI,EAAE,CAAC;IACpG,MAAM,MAAM,GAAI,GAAG,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,EAAE,EAAE,CAAY,CAAC,IAAI,EAAE,CAAC;IAE9E,IAAI,CAAC,cAAc,EAAE,CAAC;QACrB,MAAM,IAAI,iCAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,qCAAqC,EAAE;YAClF,SAAS,EAAE,CAAC;SACZ,CAAC,CAAC;IACJ,CAAC;IAED,OAAO;QACN,IAAA,6BAAoB,EAAC,KAAK,EAAE;YAC3B,YAAY;YACZ,IAAI,EAAE,YAAY;YAClB,cAAc;YACd,QAAQ;YACR,MAAM,EAAE,MAAM,IAAI,SAAS;YAC3B,OAAO;SACP,CAAC;KACF,CAAC;AACH,CAAC,CAAC;AAtBW,QAAA,oBAAoB,wBAsB/B"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.multiStep = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const cloudinary_utils_1 = require("../../cloudinary.utils");
|
|
6
|
+
const shared_1 = require("./shared");
|
|
7
|
+
const multiStep = async (ctx, i, creds) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const { publicId, deliveryType, version } = (0, shared_1.readTransformInput)(ctx, i);
|
|
10
|
+
const resourceType = ctx.getNodeParameter('multiStepResourceType', i, 'image');
|
|
11
|
+
const stepsData = ctx.getNodeParameter('transformSteps', i, {});
|
|
12
|
+
const steps = (_a = stepsData.step) !== null && _a !== void 0 ? _a : [];
|
|
13
|
+
if (!steps.length) {
|
|
14
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'Add at least one transformation step', {
|
|
15
|
+
itemIndex: i,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const components = [];
|
|
19
|
+
let format;
|
|
20
|
+
steps.forEach((step, idx) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const list = (0, shared_1.buildComponents)(ctx, i, () => stepComponents(step, resourceType), `Step ${idx + 1}: `);
|
|
23
|
+
components.push(...list);
|
|
24
|
+
if (step.stepType === 'convert') {
|
|
25
|
+
format = String((_a = step.format) !== null && _a !== void 0 ? _a : '').trim() || format;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return [
|
|
29
|
+
(0, shared_1.buildTransformResult)(creds, {
|
|
30
|
+
resourceType,
|
|
31
|
+
type: deliveryType,
|
|
32
|
+
transformation: (0, cloudinary_utils_1.joinTransformation)(components),
|
|
33
|
+
publicId,
|
|
34
|
+
format,
|
|
35
|
+
version,
|
|
36
|
+
}),
|
|
37
|
+
];
|
|
38
|
+
};
|
|
39
|
+
exports.multiStep = multiStep;
|
|
40
|
+
const str = (v) => String(v !== null && v !== void 0 ? v : '');
|
|
41
|
+
const num = (v) => Number(v) || 0;
|
|
42
|
+
function stepComponents(step, resourceType) {
|
|
43
|
+
switch (step.stepType) {
|
|
44
|
+
case 'trim':
|
|
45
|
+
return (0, shared_1.trimComponents)({ start: str(step.start), end: str(step.end), duration: str(step.duration) });
|
|
46
|
+
case 'resize':
|
|
47
|
+
return (0, shared_1.resizeComponents)({
|
|
48
|
+
width: num(step.width),
|
|
49
|
+
height: num(step.height),
|
|
50
|
+
fit: str(step.fit) || 'limit',
|
|
51
|
+
background: (0, shared_1.padBackgroundSuffix)(str(step.padBackground), str(step.padBackgroundColor)),
|
|
52
|
+
});
|
|
53
|
+
case 'crop': {
|
|
54
|
+
const cropBy = str(step.cropMode) || 'dimensions';
|
|
55
|
+
return (0, shared_1.cropComponents)({
|
|
56
|
+
cropBy,
|
|
57
|
+
width: cropBy === 'aspectRatio' ? num(step.cropAspectWidth) : num(step.cropWidth),
|
|
58
|
+
height: num(step.cropHeight),
|
|
59
|
+
aspectRatio: str(step.aspectRatio),
|
|
60
|
+
focus: str(step.focus) || 'auto',
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
case 'optimize':
|
|
64
|
+
return (0, shared_1.optimizeComponents)({ quality: str(step.quality) || 'auto', resourceType });
|
|
65
|
+
case 'convert':
|
|
66
|
+
return (0, shared_1.convertComponents)(str(step.format));
|
|
67
|
+
case 'raw': {
|
|
68
|
+
const raw = str(step.raw).trim();
|
|
69
|
+
if (!raw) {
|
|
70
|
+
throw new Error('Raw step requires a transformation component');
|
|
71
|
+
}
|
|
72
|
+
return [raw];
|
|
73
|
+
}
|
|
74
|
+
default:
|
|
75
|
+
throw new Error(`Unknown step type "${step.stepType}"`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=multiStep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiStep.js","sourceRoot":"","sources":["../../../../../nodes/Cloudinary/operations/transform/multiStep.ts"],"names":[],"mappings":";;;AAAA,+CAA+D;AAC/D,6DAA4D;AAE5D,qCAUkB;AAaX,MAAM,SAAS,GAAqB,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;;IAClE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,IAAA,2BAAkB,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACvE,MAAM,YAAY,GAAG,GAAG,CAAC,gBAAgB,CAAC,uBAAuB,EAAE,CAAC,EAAE,OAAO,CAAW,CAAC;IACzF,MAAM,SAAS,GAAG,GAAG,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,CAAC,EAAE,EAAE,CAAgB,CAAC;IAC/E,MAAM,KAAK,GAAG,MAAC,SAAS,CAAC,IAAkC,mCAAI,EAAE,CAAC;IA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AAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;QACnF,KAAK,SAAS;YACb,OAAO,IAAA,0BAAiB,EAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAC5C,KAAK,KAAK,CAAC,CAAC,CAAC;YACZ,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;YACjC,IAAI,CAAC,GAAG,EAAE,CAAC;gBACV,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;YACjE,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,CAAC;QACd,CAAC;QACD;YACC,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC1D,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.optimizeImage = void 0;
|
|
4
|
+
const cloudinary_utils_1 = require("../../cloudinary.utils");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
const optimizeImage = async (ctx, i, creds) => {
|
|
7
|
+
const { publicId, deliveryType, version, continueFrom } = (0, shared_1.readTransformInput)(ctx, i);
|
|
8
|
+
const quality = ctx.getNodeParameter('imageQuality', i, 'auto');
|
|
9
|
+
const transformation = (0, cloudinary_utils_1.joinTransformation)((0, shared_1.optimizeComponents)({ quality, resourceType: 'image' }));
|
|
10
|
+
return [
|
|
11
|
+
(0, shared_1.buildTransformResult)(creds, {
|
|
12
|
+
resourceType: 'image',
|
|
13
|
+
type: deliveryType,
|
|
14
|
+
transformation,
|
|
15
|
+
publicId,
|
|
16
|
+
version,
|
|
17
|
+
continueFrom,
|
|
18
|
+
}),
|
|
19
|
+
];
|
|
20
|
+
};
|
|
21
|
+
exports.optimizeImage = optimizeImage;
|
|
22
|
+
//# sourceMappingURL=optimizeImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimizeImage.js","sourceRoot":"","sources":["../../../../../nodes/Cloudinary/operations/transform/optimizeImage.ts"],"names":[],"mappings":";;;AAAA,6DAA4D;AAE5D,qCAAwF;AAGjF,MAAM,aAAa,GAAqB,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;IACtE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,IAAA,2BAAkB,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrF,MAAM,OAAO,GAAG,GAAG,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,EAAE,MAAM,CAAW,CAAC;IAE1E,MAAM,cAAc,GAAG,IAAA,qCAAkB,EAAC,IAAA,2BAAkB,EAAC,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAElG,OAAO;QACN,IAAA,6BAAoB,EAAC,KAAK,EAAE;YAC3B,YAAY,EAAE,OAAO;YACrB,IAAI,EAAE,YAAY;YAClB,cAAc;YACd,QAAQ;YACR,OAAO;YACP,YAAY;SACZ,CAAC;KACF,CAAC;AACH,CAAC,CAAC;AAhBW,QAAA,aAAa,iBAgBxB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.optimizeVideo = void 0;
|
|
4
|
+
const cloudinary_utils_1 = require("../../cloudinary.utils");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
const optimizeVideo = async (ctx, i, creds) => {
|
|
7
|
+
const { publicId, deliveryType, version, continueFrom } = (0, shared_1.readTransformInput)(ctx, i);
|
|
8
|
+
const quality = ctx.getNodeParameter('videoQuality', i, 'auto');
|
|
9
|
+
const transformation = (0, cloudinary_utils_1.joinTransformation)((0, shared_1.optimizeComponents)({ quality, resourceType: 'video' }));
|
|
10
|
+
return [
|
|
11
|
+
(0, shared_1.buildTransformResult)(creds, {
|
|
12
|
+
resourceType: 'video',
|
|
13
|
+
type: deliveryType,
|
|
14
|
+
transformation,
|
|
15
|
+
publicId,
|
|
16
|
+
version,
|
|
17
|
+
continueFrom,
|
|
18
|
+
}),
|
|
19
|
+
];
|
|
20
|
+
};
|
|
21
|
+
exports.optimizeVideo = optimizeVideo;
|
|
22
|
+
//# sourceMappingURL=optimizeVideo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimizeVideo.js","sourceRoot":"","sources":["../../../../../nodes/Cloudinary/operations/transform/optimizeVideo.ts"],"names":[],"mappings":";;;AAAA,6DAA4D;AAE5D,qCAAwF;AAMjF,MAAM,aAAa,GAAqB,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;IACtE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,IAAA,2BAAkB,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrF,MAAM,OAAO,GAAG,GAAG,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,EAAE,MAAM,CAAW,CAAC;IAE1E,MAAM,cAAc,GAAG,IAAA,qCAAkB,EAAC,IAAA,2BAAkB,EAAC,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAElG,OAAO;QACN,IAAA,6BAAoB,EAAC,KAAK,EAAE;YAC3B,YAAY,EAAE,OAAO;YACrB,IAAI,EAAE,YAAY;YAClB,cAAc;YACd,QAAQ;YACR,OAAO;YACP,YAAY;SACZ,CAAC;KACF,CAAC;AACH,CAAC,CAAC;AAhBW,QAAA,aAAa,iBAgBxB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resizeVideo = exports.resizeImage = void 0;
|
|
4
|
+
const cloudinary_utils_1 = require("../../cloudinary.utils");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
const makeResize = (resourceType) => async (ctx, i, creds) => {
|
|
7
|
+
const { publicId, deliveryType, version, continueFrom } = (0, shared_1.readTransformInput)(ctx, i);
|
|
8
|
+
const width = ctx.getNodeParameter('resizeWidth', i, 0);
|
|
9
|
+
const height = ctx.getNodeParameter('resizeHeight', i, 0);
|
|
10
|
+
const fit = ctx.getNodeParameter('resizeFit', i, 'limit');
|
|
11
|
+
const padBackground = ctx.getNodeParameter('resizePadBackground', i, '');
|
|
12
|
+
const padBackgroundColor = ctx.getNodeParameter('resizePadBackgroundColor', i, '');
|
|
13
|
+
const background = (0, shared_1.padBackgroundSuffix)(padBackground, padBackgroundColor);
|
|
14
|
+
const components = (0, shared_1.buildComponents)(ctx, i, () => (0, shared_1.resizeComponents)({ width, height, fit, background }));
|
|
15
|
+
return [
|
|
16
|
+
(0, shared_1.buildTransformResult)(creds, {
|
|
17
|
+
resourceType,
|
|
18
|
+
type: deliveryType,
|
|
19
|
+
transformation: (0, cloudinary_utils_1.joinTransformation)(components),
|
|
20
|
+
publicId,
|
|
21
|
+
version,
|
|
22
|
+
continueFrom,
|
|
23
|
+
}),
|
|
24
|
+
];
|
|
25
|
+
};
|
|
26
|
+
exports.resizeImage = makeResize('image');
|
|
27
|
+
exports.resizeVideo = makeResize('video');
|
|
28
|
+
//# sourceMappingURL=resizeImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizeImage.js","sourceRoot":"","sources":["../../../../../nodes/Cloudinary/operations/transform/resizeImage.ts"],"names":[],"mappings":";;;AAAA,6DAA4D;AAE5D,qCAMkB;AAQlB,MAAM,UAAU,GACf,CAAC,YAA+B,EAAoB,EAAE,CACtD,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;IACvB,MAAM,EAAE,QAAQ,EAAE,YAAY,EA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ryCredentials } from '../types';
|
|
3
|
+
export interface TransformInput {
|
|
4
|
+
publicId: string;
|
|
5
|
+
deliveryType: string;
|
|
6
|
+
version: string;
|
|
7
|
+
continueFrom: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const readTransformInput: (ctx: IExecuteFunctions, i: number) => TransformInput;
|
|
10
|
+
export declare const buildTransformResult: (creds: CloudinaryCredentials, params: {
|
|
11
|
+
resourceType: string;
|
|
12
|
+
type: string;
|
|
13
|
+
transformation: string;
|
|
14
|
+
publicId: string;
|
|
15
|
+
format?: string;
|
|
16
|
+
version?: string;
|
|
17
|
+
continueFrom?: string;
|
|
18
|
+
}) => IDataObject;
|
|
19
|
+
export declare const qualityQualifier: (quality: string) => string;
|
|
20
|
+
export declare const resizeComponents: (p: {
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
fit: string;
|
|
24
|
+
background?: string;
|
|
25
|
+
}) => string[];
|
|
26
|
+
export declare const padBackgroundSuffix: (mode: string, color: string) => string;
|
|
27
|
+
export declare const cropComponents: (p: {
|
|
28
|
+
cropBy: string;
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
aspectRatio: string;
|
|
32
|
+
focus: string;
|
|
33
|
+
genFill?: boolean;
|
|
34
|
+
genFillPrompt?: string;
|
|
35
|
+
}) => string[];
|
|
36
|
+
export declare const trimComponents: (p: {
|
|
37
|
+
start: string;
|
|
38
|
+
end: string;
|
|
39
|
+
duration: string;
|
|
40
|
+
}) => string[];
|
|
41
|
+
export declare const optimizeComponents: (p: {
|
|
42
|
+
quality: string;
|
|
43
|
+
resourceType: string;
|
|
44
|
+
}) => string[];
|
|
45
|
+
export declare const convertComponents: (format: string) => string[];
|
|
46
|
+
export declare const buildComponents: (ctx: IExecuteFunctions, i: number, build: () => string[], prefix?: string) => string[];
|
|
47
|
+
export declare const trailingMediaFormat: (publicId: string) => string | undefined;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trailingMediaFormat = exports.buildComponents = exports.convertComponents = exports.optimizeComponents = exports.trimComponents = exports.cropComponents = exports.padBackgroundSuffix = exports.resizeComponents = exports.qualityQualifier = exports.buildTransformResult = exports.readTransformInput = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const cloudinary_utils_1 = require("../../cloudinary.utils");
|
|
6
|
+
const readTransformInput = (ctx, i) => {
|
|
7
|
+
const publicId = ctx.getNodeParameter('transformPublicId', i);
|
|
8
|
+
const deliveryType = ctx.getNodeParameter('type', i, 'upload');
|
|
9
|
+
const additional = ctx.getNodeParameter('transformAdditionalOptions', i, {});
|
|
10
|
+
const continueFrom = ctx.getNodeParameter('continueFromTransformation', i, '');
|
|
11
|
+
return {
|
|
12
|
+
publicId,
|
|
13
|
+
deliveryType: deliveryType || 'upload',
|
|
14
|
+
version: additional.version || '',
|
|
15
|
+
continueFrom: continueFrom.trim(),
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
exports.readTransformInput = readTransformInput;
|
|
19
|
+
const buildTransformResult = (creds, params) => {
|
|
20
|
+
const transformation = (0, cloudinary_utils_1.joinTransformation)([
|
|
21
|
+
params.continueFrom || undefined,
|
|
22
|
+
params.transformation,
|
|
23
|
+
]);
|
|
24
|
+
const effectiveFormat = STORED_ASSET_TYPES.has(params.type)
|
|
25
|
+
? params.format || (0, exports.trailingMediaFormat)(params.publicId)
|
|
26
|
+
: undefined;
|
|
27
|
+
const secureUrl = (0, cloudinary_utils_1.buildDeliveryUrl)({
|
|
28
|
+
cloudName: creds.cloudName,
|
|
29
|
+
resourceType: params.resourceType,
|
|
30
|
+
type: params.type,
|
|
31
|
+
transformation,
|
|
32
|
+
publicId: params.publicId,
|
|
33
|
+
format: effectiveFormat || undefined,
|
|
34
|
+
version: params.version || undefined,
|
|
35
|
+
privateCdn: creds.privateCdn,
|
|
36
|
+
secureDistribution: creds.secureDistribution,
|
|
37
|
+
});
|
|
38
|
+
const result = {
|
|
39
|
+
secure_url: secureUrl,
|
|
40
|
+
resource_type: params.resourceType,
|
|
41
|
+
type: params.type,
|
|
42
|
+
public_id: params.publicId,
|
|
43
|
+
transformation,
|
|
44
|
+
};
|
|
45
|
+
if (effectiveFormat) {
|
|
46
|
+
result.format = effectiveFormat;
|
|
47
|
+
}
|
|
48
|
+
if (params.version) {
|
|
49
|
+
result.version = params.version;
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
};
|
|
53
|
+
exports.buildTransformResult = buildTransformResult;
|
|
54
|
+
const qualityQualifier = (quality) => quality === 'auto' ? 'q_auto' : `q_auto:${quality}`;
|
|
55
|
+
exports.qualityQualifier = qualityQualifier;
|
|
56
|
+
const resizeComponents = (p) => {
|
|
57
|
+
var _a;
|
|
58
|
+
if (!p.width && !p.height) {
|
|
59
|
+
throw new Error('Resize requires a width and/or a height');
|
|
60
|
+
}
|
|
61
|
+
const qualifiers = [];
|
|
62
|
+
const background = ((_a = p.background) !== null && _a !== void 0 ? _a : '').trim();
|
|
63
|
+
if (background && PAD_FIT_MODES.has(p.fit))
|
|
64
|
+
qualifiers.push(`b_${background}`);
|
|
65
|
+
qualifiers.push(`c_${p.fit}`);
|
|
66
|
+
if (p.width)
|
|
67
|
+
qualifiers.push(`w_${p.width}`);
|
|
68
|
+
if (p.height)
|
|
69
|
+
qualifiers.push(`h_${p.height}`);
|
|
70
|
+
return [qualifiers.join(',')];
|
|
71
|
+
};
|
|
72
|
+
exports.resizeComponents = resizeComponents;
|
|
73
|
+
const PAD_FIT_MODES = new Set(['pad', 'lpad', 'mpad']);
|
|
74
|
+
const padBackgroundSuffix = (mode, color) => {
|
|
75
|
+
if (mode === 'auto')
|
|
76
|
+
return 'auto';
|
|
77
|
+
if (mode === 'blurred')
|
|
78
|
+
return 'blurred';
|
|
79
|
+
if (mode === 'color') {
|
|
80
|
+
const value = color.trim().replace(/^#/, '');
|
|
81
|
+
if (!value)
|
|
82
|
+
return '';
|
|
83
|
+
return /^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$/.test(value) ? `rgb:${value}` : value;
|
|
84
|
+
}
|
|
85
|
+
return '';
|
|
86
|
+
};
|
|
87
|
+
exports.padBackgroundSuffix = padBackgroundSuffix;
|
|
88
|
+
const cropComponents = (p) => {
|
|
89
|
+
var _a;
|
|
90
|
+
const dimensions = [];
|
|
91
|
+
if (p.cropBy === 'aspectRatio') {
|
|
92
|
+
const aspectRatio = p.aspectRatio.trim();
|
|
93
|
+
if (!aspectRatio) {
|
|
94
|
+
throw new Error('Crop by aspect ratio requires an aspect ratio (e.g. 16:9)');
|
|
95
|
+
}
|
|
96
|
+
dimensions.push(`ar_${aspectRatio}`);
|
|
97
|
+
if (p.width)
|
|
98
|
+
dimensions.push(`w_${p.width}`);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
if (!p.width && !p.height) {
|
|
102
|
+
throw new Error('Crop requires a width and/or a height');
|
|
103
|
+
}
|
|
104
|
+
if (p.width)
|
|
105
|
+
dimensions.push(`w_${p.width}`);
|
|
106
|
+
if (p.height)
|
|
107
|
+
dimensions.push(`h_${p.height}`);
|
|
108
|
+
}
|
|
109
|
+
let mode;
|
|
110
|
+
if (p.genFill) {
|
|
111
|
+
const prompt = ((_a = p.genFillPrompt) !== null && _a !== void 0 ? _a : '').trim();
|
|
112
|
+
const background = prompt ? `b_gen_fill:prompt_${encodeURIComponent(prompt)}` : 'b_gen_fill';
|
|
113
|
+
mode = [background, 'c_pad'];
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
mode = ['c_fill', `g_${p.focus}`];
|
|
117
|
+
}
|
|
118
|
+
return [[...mode, ...dimensions].join(',')];
|
|
119
|
+
};
|
|
120
|
+
exports.cropComponents = cropComponents;
|
|
121
|
+
const trimComponents = (p) => {
|
|
122
|
+
const qualifiers = [];
|
|
123
|
+
const start = p.start.trim();
|
|
124
|
+
const end = p.end.trim();
|
|
125
|
+
const duration = p.duration.trim();
|
|
126
|
+
if (start)
|
|
127
|
+
qualifiers.push(`so_${start}`);
|
|
128
|
+
if (end)
|
|
129
|
+
qualifiers.push(`eo_${end}`);
|
|
130
|
+
if (duration)
|
|
131
|
+
qualifiers.push(`du_${duration}`);
|
|
132
|
+
if (!qualifiers.length) {
|
|
133
|
+
throw new Error('Trim requires at least one of start, end, or duration');
|
|
134
|
+
}
|
|
135
|
+
return [qualifiers.join(',')];
|
|
136
|
+
};
|
|
137
|
+
exports.trimComponents = trimComponents;
|
|
138
|
+
const optimizeComponents = (p) => [
|
|
139
|
+
p.resourceType === 'video' ? 'f_auto:video' : 'f_auto',
|
|
140
|
+
(0, exports.qualityQualifier)(p.quality),
|
|
141
|
+
];
|
|
142
|
+
exports.optimizeComponents = optimizeComponents;
|
|
143
|
+
const convertComponents = (format) => {
|
|
144
|
+
const fmt = format.trim();
|
|
145
|
+
if (!fmt) {
|
|
146
|
+
throw new Error('Convert requires a target format');
|
|
147
|
+
}
|
|
148
|
+
return [`f_${fmt}`];
|
|
149
|
+
};
|
|
150
|
+
exports.convertComponents = convertComponents;
|
|
151
|
+
const buildComponents = (ctx, i, build, prefix = '') => {
|
|
152
|
+
try {
|
|
153
|
+
return build();
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `${prefix}${error.message}`, {
|
|
157
|
+
itemIndex: i,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
exports.buildComponents = buildComponents;
|
|
162
|
+
const MEDIA_FORMAT_EXTENSIONS = new Set([
|
|
163
|
+
'jpg', 'jpeg', 'png', 'gif', 'webp', 'avif', 'bmp', 'tiff', 'tif', 'ico', 'svg', 'heic', 'heif', 'jxl',
|
|
164
|
+
'mp4', 'webm', 'mov', 'avi', 'mkv', 'ogv', 'm4v', '3gp', 'wmv', 'mpeg', 'mpg', 'flv', 'm3u8', 'ts',
|
|
165
|
+
'mp3', 'aac', 'wav', 'ogg', 'flac', 'm4a', 'aiff', 'wma',
|
|
166
|
+
'pdf',
|
|
167
|
+
]);
|
|
168
|
+
const trailingMediaFormat = (publicId) => {
|
|
169
|
+
const lastSegment = publicId.slice(publicId.lastIndexOf('/') + 1);
|
|
170
|
+
const dot = lastSegment.lastIndexOf('.');
|
|
171
|
+
if (dot <= 0 || dot === lastSegment.length - 1) {
|
|
172
|
+
return undefined;
|
|
173
|
+
}
|
|
174
|
+
const ext = lastSegment.slice(dot + 1).toLowerCase();
|
|
175
|
+
return MEDIA_FORMAT_EXTENSIONS.has(ext) ? ext : undefined;
|
|
176
|
+
};
|
|
177
|
+
exports.trailingMediaFormat = trailingMediaFormat;
|
|
178
|
+
const STORED_ASSET_TYPES = new Set(['upload', 'private', 'authenticated']);
|
|
179
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../nodes/Cloudinary/operations/transform/shared.ts"],"names":[],"mappings":";;;AAAA,+CAAkF;AAClF,6DAA8E;AAgBvE,MAAM,kBAAkB,GAAG,CAAC,GAAsB,EAAE,CAAS,EAAkB,EAAE;IACvF,MAAM,QAAQ,GAAG,GAAG,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,CAAC,CAAW,CAAC;IACxE,MAAM,YAAY,GAAG,GAAG,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,QAAQ,CAAW,CAAC;IACzE,MAAM,UAAU,GAAG,GAAG,CAAC,gBAAgB,CAAC,4BAA4B,EAAE,CAAC,EAAE,EAAE,CAAgB,CAAC;IAE5F,MAAM,YAAY,GAAG,GAAG,CAAC,gBAAgB,CAAC,4BAA4B,EAAE,CAAC,EAAE,EAAE,CAAW,CAAC;IACzF,OAAO;QACN,QAAQ;QACR,YAAY,EAAE,YAAY,IAAI,QAAQ;QACtC,OAAO,EAAG,UAAU,CAAC,OAAkB,IAAI,E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ict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trimVideo = void 0;
|
|
4
|
+
const cloudinary_utils_1 = require("../../cloudinary.utils");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
const trimVideo = async (ctx, i, creds) => {
|
|
7
|
+
const { publicId, deliveryType, version, continueFrom } = (0, shared_1.readTransformInput)(ctx, i);
|
|
8
|
+
const start = ctx.getNodeParameter('trimStart', i, '');
|
|
9
|
+
const end = ctx.getNodeParameter('trimEnd', i, '');
|
|
10
|
+
const duration = ctx.getNodeParameter('trimDuration', i, '');
|
|
11
|
+
const components = (0, shared_1.buildComponents)(ctx, i, () => (0, shared_1.trimComponents)({ start, end, duration }));
|
|
12
|
+
return [
|
|
13
|
+
(0, shared_1.buildTransformResult)(creds, {
|
|
14
|
+
resourceType: 'video',
|
|
15
|
+
type: deliveryType,
|
|
16
|
+
transformation: (0, cloudinary_utils_1.joinTransformation)(components),
|
|
17
|
+
publicId,
|
|
18
|
+
version,
|
|
19
|
+
continueFrom,
|
|
20
|
+
}),
|
|
21
|
+
];
|
|
22
|
+
};
|
|
23
|
+
exports.trimVideo = trimVideo;
|
|
24
|
+
//# sourceMappingURL=trimVideo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trimVideo.js","sourceRoot":"","sources":["../../../../../nodes/Cloudinary/operations/transform/trimVideo.ts"],"names":[],"mappings":";;;AAAA,6DAA4D;AAE5D,qCAAqG;AAM9F,MAAM,SAAS,GAAqB,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;IAClE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,IAAA,2BAAkB,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrF,MAAM,KAAK,GAAG,GAAG,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,CAAW,CAAC;IACjE,MAAM,GAAG,GAAG,GAAG,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,CAAW,CAAC;IAC7D,MAAM,QAAQ,GAAG,GAAG,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,EAAE,EAAE,CAAW,CAAC;IAEvE,MAAM,UAAU,GAAG,IAAA,wBAAe,EAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,IAAA,uBAAc,EAAC,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;IAE3F,OAAO;QACN,IAAA,6BAAoB,EAAC,KAAK,EAAE;YAC3B,YAAY,EAAE,OAAO;YACrB,IAAI,EAAE,YAAY;YAClB,cAAc,EAAE,IAAA,qCAAkB,EAAC,UAAU,CAAC;YAC9C,QAAQ;YACR,OAAO;YACP,YAAY;SACZ,CAAC;KACF,CAAC;AACH,CAAC,CAAC;AAlBW,QAAA,SAAS,aAkBpB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.videoThumbnail = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
const videoThumbnail = async (ctx, i, creds) => {
|
|
7
|
+
const { publicId, deliveryType, version, continueFrom } = (0, shared_1.readTransformInput)(ctx, i);
|
|
8
|
+
const frameMode = ctx.getNodeParameter('thumbnailFrameMode', i, 'auto');
|
|
9
|
+
const format = ctx.getNodeParameter('thumbnailFormat', i, 'jpg');
|
|
10
|
+
let frameComponent;
|
|
11
|
+
if (frameMode === 'auto') {
|
|
12
|
+
frameComponent = 'so_auto';
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
const timestamp = ctx.getNodeParameter('thumbnailTimestamp', i, '').trim();
|
|
16
|
+
if (!timestamp) {
|
|
17
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'A timestamp is required when the frame is set to a specific time', { itemIndex: i });
|
|
18
|
+
}
|
|
19
|
+
frameComponent = `so_${timestamp}`;
|
|
20
|
+
}
|
|
21
|
+
return [
|
|
22
|
+
(0, shared_1.buildTransformResult)(creds, {
|
|
23
|
+
resourceType: 'video',
|
|
24
|
+
type: deliveryType,
|
|
25
|
+
transformation: frameComponent,
|
|
26
|
+
publicId,
|
|
27
|
+
format,
|
|
28
|
+
version,
|
|
29
|
+
continueFrom,
|
|
30
|
+
}),
|
|
31
|
+
];
|
|
32
|
+
};
|
|
33
|
+
exports.videoThumbnail = videoThumbnail;
|
|
34
|
+
//# sourceMappingURL=videoThumbnail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"videoThumbnail.js","sourceRoot":"","sources":["../../../../../nodes/Cloudinary/operations/transform/videoThumbnail.ts"],"names":[],"mappings":";;;AAAA,+CAAkD;AAElD,qCAAoE;AAU7D,MAAM,cAAc,GAAqB,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;IACvE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,IAAA,2BAAkB,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrF,MAAM,SAAS,GAAG,GAAG,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,CAAC,EAAE,MAAM,CAAW,CAAC;IAClF,MAAM,MAAM,GAAG,GAAG,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,CAAC,EAAE,KAAK,CAAW,CAAC;IAE3E,IAAI,cAAsB,CAAC;IAC3B,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QAC1B,cAAc,GAAG,SAAS,CAAC;IAC5B,CAAC;SAAM,CAAC;QACP,MAAM,SAAS,GAAI,GAAG,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAY,CAAC,IAAI,EAAE,CAAC;QACvF,IAAI,CAAC,SAAS,EAAE,CAAC;YAChB,MAAM,IAAI,iCAAkB,CAC3B,GAAG,CAAC,OAAO,EAAE,EACb,kEAAkE,EAClE,EAAE,SAAS,EAAE,CAAC,EAAE,CAChB,CAAC;QACH,CAAC;QACD,cAAc,GAAG,MAAM,SAAS,EAAE,CAAC;IACpC,CAAC;IAED,OAAO;QACN,IAAA,6BAAoB,EAAC,KAAK,EAAE;YAC3B,YAAY,EAAE,OAAO;YACrB,IAAI,EAAE,YAAY;YAClB,cAAc,EAAE,cAAc;YAC9B,QAAQ;YACR,MAAM;YACN,OAAO;YACP,YAAY;SACZ,CAAC;KACF,CAAC;AACH,CAAC,CAAC;AA/BW,QAAA,cAAc,kBA+BzB"}
|