n8n-nodes-placid
Version:
n8n node to interact with Placid API for creative generation
127 lines • 6.82 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ResourceType = exports.LayerType = exports.subtitleProperties = exports.ratingProperties = exports.barcodeProperties = exports.browserframeProperties = exports.shapeProperties = exports.pictureProperties = exports.textProperties = exports.generalProperties = void 0;
exports.filterPropertiesByResource = filterPropertiesByResource;
exports.getPropertiesForLayerType = getPropertiesForLayerType;
exports.getGeneralProperties = getGeneralProperties;
exports.getAllLayerTypes = getAllLayerTypes;
exports.getAllPropertiesForLayerType = getAllPropertiesForLayerType;
const generalProperties_1 = require("./generalProperties");
Object.defineProperty(exports, "generalProperties", { enumerable: true, get: function () { return generalProperties_1.generalProperties; } });
const textProperties_1 = require("./textProperties");
Object.defineProperty(exports, "textProperties", { enumerable: true, get: function () { return textProperties_1.textProperties; } });
const pictureProperties_1 = require("./pictureProperties");
Object.defineProperty(exports, "pictureProperties", { enumerable: true, get: function () { return pictureProperties_1.pictureProperties; } });
const shapeProperties_1 = require("./shapeProperties");
Object.defineProperty(exports, "shapeProperties", { enumerable: true, get: function () { return shapeProperties_1.shapeProperties; } });
const browserframeProperties_1 = require("./browserframeProperties");
Object.defineProperty(exports, "browserframeProperties", { enumerable: true, get: function () { return browserframeProperties_1.browserframeProperties; } });
const barcodeProperties_1 = require("./barcodeProperties");
Object.defineProperty(exports, "barcodeProperties", { enumerable: true, get: function () { return barcodeProperties_1.barcodeProperties; } });
const ratingProperties_1 = require("./ratingProperties");
Object.defineProperty(exports, "ratingProperties", { enumerable: true, get: function () { return ratingProperties_1.ratingProperties; } });
const subtitleProperties_1 = require("./subtitleProperties");
Object.defineProperty(exports, "subtitleProperties", { enumerable: true, get: function () { return subtitleProperties_1.subtitleProperties; } });
__exportStar(require("./generalProperties"), exports);
__exportStar(require("./textProperties"), exports);
__exportStar(require("./pictureProperties"), exports);
__exportStar(require("./shapeProperties"), exports);
__exportStar(require("./browserframeProperties"), exports);
__exportStar(require("./barcodeProperties"), exports);
__exportStar(require("./ratingProperties"), exports);
__exportStar(require("./subtitleProperties"), exports);
var LayerType;
(function (LayerType) {
LayerType["TEXT"] = "text";
LayerType["PICTURE"] = "picture";
LayerType["SHAPE"] = "shape";
LayerType["BROWSERFRAME"] = "browserframe";
LayerType["BARCODE"] = "barcode";
LayerType["RATING"] = "rating";
LayerType["SUBTITLE"] = "subtitle";
})(LayerType || (exports.LayerType = LayerType = {}));
var ResourceType;
(function (ResourceType) {
ResourceType["IMAGE"] = "image";
ResourceType["PDF"] = "pdf";
ResourceType["VIDEO"] = "video";
})(ResourceType || (exports.ResourceType = ResourceType = {}));
function filterPropertiesByResource(properties, resourceType) {
return properties.filter(property => property.restrictedTo.length === 0 || property.restrictedTo.includes(resourceType));
}
function getPropertiesForLayerType(layerType, resourceType) {
let properties = [];
switch (layerType) {
case LayerType.TEXT:
case 'text':
properties = textProperties_1.textProperties;
break;
case LayerType.PICTURE:
case 'picture':
properties = pictureProperties_1.pictureProperties;
break;
case LayerType.SHAPE:
case 'shape':
properties = shapeProperties_1.shapeProperties;
break;
case LayerType.BROWSERFRAME:
case 'browserframe':
properties = browserframeProperties_1.browserframeProperties;
break;
case LayerType.BARCODE:
case 'barcode':
properties = barcodeProperties_1.barcodeProperties;
break;
case LayerType.RATING:
case 'rating':
properties = ratingProperties_1.ratingProperties;
break;
case LayerType.SUBTITLE:
case 'subtitle':
properties = subtitleProperties_1.subtitleProperties;
break;
default:
return [];
}
if (resourceType) {
return filterPropertiesByResource(properties, resourceType);
}
return properties;
}
function getGeneralProperties(resourceType) {
if (resourceType) {
return filterPropertiesByResource(generalProperties_1.generalProperties, resourceType);
}
return generalProperties_1.generalProperties;
}
function getAllLayerTypes() {
return [
{ name: 'Text', value: LayerType.TEXT, description: 'Text layer for displaying text content' },
{ name: 'Picture', value: LayerType.PICTURE, description: 'Picture layer for displaying images or videos' },
{ name: 'Shape', value: LayerType.SHAPE, description: 'Shape/Rectangle layer for backgrounds and geometric shapes' },
{ name: 'Browserframe', value: LayerType.BROWSERFRAME, description: 'Browserframe layer for website screenshots with browser UI' },
{ name: 'Barcode', value: LayerType.BARCODE, description: 'Barcode layer for generating barcodes' },
{ name: 'Rating', value: LayerType.RATING, description: 'Rating layer for star ratings and scores' },
{ name: 'Subtitle', value: LayerType.SUBTITLE, description: 'Subtitle layer for video captions and subtitles' },
];
}
function getAllPropertiesForLayerType(layerType, resourceType) {
const layerSpecificProperties = getPropertiesForLayerType(layerType, resourceType);
const generalProps = getGeneralProperties(resourceType);
return [...layerSpecificProperties, ...generalProps];
}
//# sourceMappingURL=index.js.map