first commit

This commit is contained in:
2025-10-26 23:10:15 +08:00
commit 8f0345b7be
14961 changed files with 2356381 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var common_getters_exports = {};
__export(common_getters_exports, {
getClassName: () => getClassName
});
module.exports = __toCommonJS(common_getters_exports);
function getClassName(classDeclaration) {
if (!classDeclaration.id)
return null;
return {
ast: classDeclaration.id,
value: classDeclaration.id.name
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getClassName
});

View File

@@ -0,0 +1,64 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var communityPackageJson_getters_exports = {};
__export(communityPackageJson_getters_exports, {
getAuthor: () => getAuthor,
getDescription: () => getDescription,
getKeywords: () => getKeywords,
getLicense: () => getLicense,
getN8n: () => getN8n,
getName: () => getName,
getRepository: () => getRepository,
getVersion: () => getVersion
});
module.exports = __toCommonJS(communityPackageJson_getters_exports);
var import_utils = require("@typescript-eslint/utils");
const getPackageJsonProperty = (keyName) => (node) => {
const found = node.properties.find((property) => {
return property.type === import_utils.AST_NODE_TYPES.Property && property.key.type === import_utils.AST_NODE_TYPES.Literal && property.key.value === keyName;
});
if (!found)
return null;
return {
ast: found,
// @ts-ignore
value: found.value.value ?? "TODO restored object"
// TODO: Restoring nested object unneeded for now
// 'Literal' (found.value.value) or 'ObjectExpression' (nested object)
};
};
const getName = getPackageJsonProperty("name");
const getKeywords = getPackageJsonProperty("keywords");
const getDescription = getPackageJsonProperty("description");
const getVersion = getPackageJsonProperty("version");
const getN8n = getPackageJsonProperty("n8n");
const getAuthor = getPackageJsonProperty("author");
const getLicense = getPackageJsonProperty("license");
const getRepository = getPackageJsonProperty("repository");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getAuthor,
getDescription,
getKeywords,
getLicense,
getN8n,
getName,
getRepository,
getVersion
});

View File

@@ -0,0 +1,65 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var credentialClassBody_getters_exports = {};
__export(credentialClassBody_getters_exports, {
getDisplayName: () => getDisplayName,
getDocumentationUrl: () => getDocumentationUrl,
getExtendsValue: () => getExtendsValue,
getName: () => getName,
getPlaceholder: () => getPlaceholder
});
module.exports = __toCommonJS(credentialClassBody_getters_exports);
var import_identifiers = require("../identifiers");
var import_restoreValue = require("../utils/restoreValue");
function getStringClassField(identifier, nodeParam) {
const found = nodeParam.body.find(identifier);
if (!found)
return null;
return {
ast: found,
value: found.value.value
};
}
function getName(classBody) {
return getStringClassField(import_identifiers.id.credClassBody.isName, classBody);
}
function getDisplayName(classBody) {
return getStringClassField(import_identifiers.id.credClassBody.isDisplayName, classBody);
}
function getDocumentationUrl(classBody) {
return getStringClassField(import_identifiers.id.credClassBody.isDocumentationUrl, classBody);
}
function getPlaceholder(classBody) {
return getStringClassField(import_identifiers.id.credClassBody.isPlaceholder, classBody);
}
function getExtendsValue(classBody, context) {
const extendsNode = classBody.body.find(import_identifiers.id.credClassBody.isFieldExtends);
if (!extendsNode)
return null;
const extendsSource = context.getSourceCode().getText(extendsNode.value);
return (0, import_restoreValue.restoreValue)(extendsSource) ?? null;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getDisplayName,
getDocumentationUrl,
getExtendsValue,
getName,
getPlaceholder
});

View File

@@ -0,0 +1,51 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var getters_exports = {};
__export(getters_exports, {
getters: () => getters
});
module.exports = __toCommonJS(getters_exports);
var nodeParam = __toESM(require("./nodeParameter.getters"));
var nodeClassDescription = __toESM(require("./nodeClassDescription.getters"));
var credClassBody = __toESM(require("./credentialClassBody.getters"));
var communityPackageJson = __toESM(require("./communityPackageJson.getters"));
var nodeExecuteBlock = __toESM(require("./nodeExecuteBlock.getters"));
var common = __toESM(require("./common.getters"));
const getters = {
nodeParam,
nodeClassDescription,
credClassBody,
communityPackageJson,
nodeExecuteBlock,
...common
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getters
});

View File

@@ -0,0 +1,111 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var nodeClassDescription_getters_exports = {};
__export(nodeClassDescription_getters_exports, {
getCredOptions: () => getCredOptions,
getDefaultVersion: () => getDefaultVersion,
getDefaults: () => getDefaults,
getDescription: () => getDescription,
getDisplayName: () => getDisplayName,
getIcon: () => getIcon,
getInputs: () => getInputs,
getName: () => getName,
getOutputs: () => getOutputs,
getSubtitle: () => getSubtitle,
getVersion: () => getVersion
});
module.exports = __toCommonJS(nodeClassDescription_getters_exports);
var import_identifiers = require("../identifiers");
var import_restorers = require("../restorers");
var import_nodeParameter = require("./nodeParameter.getters");
function getCredOptions(nodeParam) {
const found = nodeParam.properties.find(
import_identifiers.id.nodeClassDescription.isCredentials
);
if (!found)
return null;
return {
ast: found,
value: (0, import_restorers.restoreClassDescriptionOptions)(found.value.elements)
};
}
function getInputs(nodeParam) {
const found = nodeParam.properties.find(import_identifiers.id.nodeClassDescription.isInputs);
if (!found)
return null;
return {
ast: found,
// @ts-ignore @TODO
value: (0, import_restorers.restoreArray)(found.value.elements)
};
}
function getOutputs(nodeParam) {
const found = nodeParam.properties.find(import_identifiers.id.nodeClassDescription.isOutputs);
if (!found)
return null;
return {
ast: found,
// @ts-ignore @TODO
value: (0, import_restorers.restoreArray)(found.value.elements)
};
}
function getSubtitle(nodeParam) {
const found = nodeParam.properties.find(import_identifiers.id.nodeClassDescription.isSubtitle);
if (!found)
return null;
return {
ast: found,
value: found.value.value
};
}
const getName = import_nodeParameter.getName;
const getDisplayName = import_nodeParameter.getDisplayName;
const getDescription = import_nodeParameter.getDescription;
function getVersion(nodeParam) {
return (0, import_nodeParameter.getNumberProperty)(import_identifiers.id.nodeClassDescription.isVersion, nodeParam);
}
function getDefaultVersion(nodeParam) {
return (0, import_nodeParameter.getNumberProperty)(import_identifiers.id.nodeClassDescription.isDefaultVersion, nodeParam);
}
function getIcon(nodeParam) {
return (0, import_nodeParameter.getStringProperty)(import_identifiers.id.nodeClassDescription.isIcon, nodeParam);
}
function getDefaults(nodeParam) {
const found = nodeParam.properties.find(import_identifiers.id.nodeClassDescription.isDefaults);
if (!found)
return null;
return {
ast: found,
value: (0, import_restorers.restoreObject)(found.value)
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getCredOptions,
getDefaultVersion,
getDefaults,
getDescription,
getDisplayName,
getIcon,
getInputs,
getName,
getOutputs,
getSubtitle,
getVersion
});

View File

@@ -0,0 +1,119 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var nodeExecuteBlock_getters_exports = {};
__export(nodeExecuteBlock_getters_exports, {
collectConsequents: () => collectConsequents,
getExecuteContent: () => getExecuteContent,
getInputItemsIndexName: () => getInputItemsIndexName,
getMarkedNodeFromConsequent: () => getMarkedNodeFromConsequent,
getOperationConsequents: () => getOperationConsequents,
getPairedItemValue: () => getPairedItemValue
});
module.exports = __toCommonJS(nodeExecuteBlock_getters_exports);
var import_utils = require("@typescript-eslint/utils");
var import_identifiers = require("../identifiers");
function getOperationConsequents(node, { filter }) {
const executeMethod = getExecuteContent(node);
if (!executeMethod)
return;
const returnDataArrayName = getReturnDataArrayName(executeMethod);
if (!returnDataArrayName)
return;
const forLoop = executeMethod.body.find(import_identifiers.id.nodeExecuteBlock.isForLoop);
if (!forLoop)
return;
const inputItemsIndexName = getInputItemsIndexName(forLoop);
if (!inputItemsIndexName)
return;
const tryCatch = forLoop.body.body.find(import_identifiers.id.nodeExecuteBlock.isTryCatch);
if (!tryCatch)
return;
const resourcesRoot = tryCatch.block.body.find(
import_identifiers.id.nodeExecuteBlock.isResourceChecksRoot
);
if (!resourcesRoot)
return;
const operationConsequents = collectConsequents(resourcesRoot).reduce((acc, resourceConsequent) => {
if (resourceConsequent.body.length !== 1)
return acc;
const [operationsRoot] = resourceConsequent.body;
const opConsequentsPerResource = filter === "all" ? collectConsequents(operationsRoot) : collectConsequents(operationsRoot).filter(
(consequent) => filter === "plural" ? isGetAll(consequent) : !isGetAll(consequent)
);
return [...acc, ...opConsequentsPerResource];
}, []);
return {
operationConsequents,
inputItemsIndexName,
returnDataArrayName
};
}
function getExecuteContent({ key, value }) {
if (key.type === import_utils.AST_NODE_TYPES.Identifier && key.name === "execute" && value.type === import_utils.AST_NODE_TYPES.FunctionExpression && value.body.type === import_utils.AST_NODE_TYPES.BlockStatement) {
return value.body;
}
}
function getReturnDataArrayName(executeMethod) {
for (const node of executeMethod.body) {
if (node.type === import_utils.AST_NODE_TYPES.VariableDeclaration && node.declarations.length === 1 && node.declarations[0].id.type === import_utils.AST_NODE_TYPES.Identifier && node.declarations[0].init !== null && node.declarations[0].init.type === import_utils.AST_NODE_TYPES.ArrayExpression && node.declarations[0].init.elements.length === 0 && node.declarations[0].id.typeAnnotation !== void 0 && node.declarations[0].id.typeAnnotation.typeAnnotation.type === import_utils.AST_NODE_TYPES.TSArrayType && node.declarations[0].id.typeAnnotation.typeAnnotation.elementType.type === import_utils.AST_NODE_TYPES.TSTypeReference && node.declarations[0].id.typeAnnotation.typeAnnotation.elementType.typeName.type === import_utils.AST_NODE_TYPES.Identifier && ["IDataObject", "INodeExecutionData"].includes(
node.declarations[0].id.typeAnnotation.typeAnnotation.elementType.typeName.name
)) {
return node.declarations[0].id.name;
}
}
return null;
}
function getInputItemsIndexName(forLoop) {
if (forLoop.init !== null && forLoop.init.type === import_utils.AST_NODE_TYPES.VariableDeclaration && forLoop.init.declarations.length > 0 && forLoop.init.declarations[0].type === import_utils.AST_NODE_TYPES.VariableDeclarator && forLoop.init.declarations[0].id.type === import_utils.AST_NODE_TYPES.Identifier) {
return forLoop.init.declarations[0].id.name;
}
return null;
}
function collectConsequents(node, collection = []) {
if (node.type === import_utils.AST_NODE_TYPES.IfStatement && node.consequent.type === import_utils.AST_NODE_TYPES.BlockStatement) {
collection.push(node.consequent);
}
if (node.type === import_utils.AST_NODE_TYPES.IfStatement && node.alternate !== null && node.alternate.type === import_utils.AST_NODE_TYPES.IfStatement) {
collectConsequents(node.alternate, collection);
}
return collection;
}
function getPairedItemValue(properties) {
const found = properties.find(
(property) => property.type === import_utils.AST_NODE_TYPES.Property && property.value.type === import_utils.AST_NODE_TYPES.ObjectExpression
);
return found ? found.value : null;
}
function getMarkedNodeFromConsequent(consequent) {
if (consequent.parent?.type === import_utils.AST_NODE_TYPES.IfStatement && consequent.parent?.test.type === import_utils.AST_NODE_TYPES.BinaryExpression && consequent.parent?.test.operator === "===" && consequent.parent?.test.left.type === import_utils.AST_NODE_TYPES.Identifier && consequent.parent?.test.left.name === "operation") {
return consequent.parent?.test.right;
}
}
function isGetAll(consequent) {
return consequent.parent !== void 0 && consequent.parent.type === import_utils.AST_NODE_TYPES.IfStatement && consequent.parent.test.type === import_utils.AST_NODE_TYPES.BinaryExpression && consequent.parent.test.operator === "===" && consequent.parent.test.left.type === import_utils.AST_NODE_TYPES.Identifier && consequent.parent.test.left.name === "operation" && consequent.parent.test.right.type === import_utils.AST_NODE_TYPES.Literal && consequent.parent.test.right.value === "getAll";
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
collectConsequents,
getExecuteContent,
getInputItemsIndexName,
getMarkedNodeFromConsequent,
getOperationConsequents,
getPairedItemValue
});

View File

@@ -0,0 +1,316 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var nodeParameter_getters_exports = {};
__export(nodeParameter_getters_exports, {
getCollectionOptions: () => getCollectionOptions,
getDefault: () => getDefault,
getDescription: () => getDescription,
getDisplayName: () => getDisplayName,
getFixedCollectionValues: () => getFixedCollectionValues,
getGetAllOption: () => getGetAllOption,
getHint: () => getHint,
getLoadOptionsMethod: () => getLoadOptionsMethod,
getMaxValue: () => getMaxValue,
getMinValue: () => getMinValue,
getName: () => getName,
getNoDataExpression: () => getNoDataExpression,
getNumberProperty: () => getNumberProperty,
getOptions: () => getOptions,
getPlaceholder: () => getPlaceholder,
getRequired: () => getRequired,
getStringProperty: () => getStringProperty,
getType: () => getType,
getTypeOptions: () => getTypeOptions
});
module.exports = __toCommonJS(nodeParameter_getters_exports);
var import_utils = require("@typescript-eslint/utils");
var import_identifiers = require("../identifiers");
var import_restorers = require("../restorers");
var import_common = require("../identifiers/common.identifiers");
function getStringProperty(identifier, nodeParam) {
const found = nodeParam.properties.find(identifier);
if (!found)
return null;
return {
ast: found,
value: found.value.value
};
}
function getDisplayName(nodeParam) {
return getStringProperty(import_identifiers.id.nodeParam.isDisplayName, nodeParam);
}
function getPlaceholder(nodeParam) {
return getStringProperty(import_identifiers.id.nodeParam.isPlaceholder, nodeParam);
}
function getName(nodeParam) {
return getStringProperty(import_identifiers.id.nodeParam.isName, nodeParam);
}
function getHint(nodeParam) {
return getStringProperty(import_identifiers.id.nodeParam.isHint, nodeParam);
}
function getType(nodeParam) {
return getStringProperty(import_identifiers.id.nodeParam.isType, nodeParam);
}
function getBooleanProperty(identifier, nodeParam) {
const found = nodeParam.properties.find(identifier);
if (!found)
return null;
return {
ast: found,
value: found.value.value
};
}
function getNoDataExpression(nodeParam) {
return getBooleanProperty(import_identifiers.id.nodeParam.isNoDataExpression, nodeParam);
}
function getRequired(nodeParam) {
return getBooleanProperty(import_identifiers.id.nodeParam.isRequired, nodeParam);
}
function getNumberProperty(identifier, nodeParam) {
const found = nodeParam.properties.find(identifier);
if (!found)
return null;
return {
ast: found,
value: found.value.value
};
}
function getGetAllOption(nodeParam) {
const found = nodeParam.properties.find(import_identifiers.id.nodeParam.isGetAllOptionProperty);
if (!found)
return null;
return {
ast: found,
value: ""
// TODO
};
}
function getTypeOptions(nodeParam) {
const found = nodeParam.properties.find(import_identifiers.id.nodeParam.isTypeOptions);
if (!found)
return null;
return {
ast: found,
value: (0, import_restorers.restoreObject)(found.value)
};
}
function getOptions(nodeParam) {
const found = nodeParam.properties.find(import_identifiers.id.nodeParam.isOptions);
if (!found)
return null;
if (!found.value.elements) {
return {
ast: found,
value: [{ name: "", value: "", description: "", action: "" }],
// unused placeholder
hasPropertyPointingToIdentifier: true
};
}
const elements = found.value.elements.filter(
(i) => i.type === "ObjectExpression"
);
if (!elements.length)
return null;
if (hasMemberExpression(elements)) {
return {
ast: found,
value: (0, import_restorers.restoreNodeParamOptions)(elements),
hasPropertyPointingToMemberExpression: true
};
}
return {
ast: found,
value: (0, import_restorers.restoreNodeParamOptions)(elements)
};
}
function getCollectionOptions(nodeParam) {
const found = nodeParam.properties.find(import_identifiers.id.nodeParam.isOptions);
if (!found)
return null;
if (!found.value.elements) {
return {
ast: found,
value: [{ displayName: "" }],
// unused placeholder
hasPropertyPointingToIdentifier: true
};
}
const elements = found.value.elements.filter(
(i) => i.type === "ObjectExpression"
);
if (!elements.length)
return null;
if (hasMemberExpression(elements)) {
return {
ast: found,
value: (0, import_restorers.restoreNodeParamCollectionOptions)(elements),
hasPropertyPointingToMemberExpression: true
};
}
return {
ast: found,
value: (0, import_restorers.restoreNodeParamCollectionOptions)(elements),
hasPropertyPointingToIdentifier: false
};
}
function hasMemberExpression(elements) {
return elements.find(
(element) => element.properties.find(import_common.isMemberExpression)
);
}
function getFixedCollectionValues(nodeParam) {
const found = nodeParam.properties.find(import_identifiers.id.nodeParam.isFixedCollectionValues);
if (!found)
return null;
const elements = found.value.elements.filter(
(i) => i.type === "ObjectExpression"
);
if (!elements.length)
return null;
return {
ast: found,
value: (0, import_restorers.restoreFixedCollectionValues)(elements)
};
}
function getTypeOptionsValue(nodeParam, identifier) {
const typeOptions = getTypeOptions(nodeParam);
if (!typeOptions)
return null;
const { properties } = typeOptions.ast.value;
const found = properties.find(identifier);
if (!found)
return null;
return {
ast: found,
value: found.value.value
};
}
const getMinValue = (nodeParam) => getTypeOptionsValue(nodeParam, import_identifiers.id.nodeParam.isMinValue);
const getMaxValue = (nodeParam) => getTypeOptionsValue(nodeParam, import_identifiers.id.nodeParam.isMaxValue);
function getLoadOptionsMethod(nodeParam) {
const typeOptions = getTypeOptions(nodeParam);
if (!typeOptions)
return null;
const { properties } = typeOptions.ast.value;
const found = properties.find(import_identifiers.id.nodeParam.isLoadOptionsMethod);
if (!found)
return null;
return {
ast: found,
value: found.value.value
};
}
function getDescription(nodeParam) {
for (const property of nodeParam.properties) {
if (import_identifiers.id.nodeParam.isDescription(property)) {
return {
ast: property,
value: property.value.value
};
}
if (import_identifiers.id.nodeParam.isTemplateDescription(property)) {
if (property.value.quasis.length > 1) {
const consolidated = property.value.quasis.map((templateElement2) => templateElement2.value.cooked).join();
return {
ast: property,
value: consolidated,
hasUnneededBackticks: false
};
}
const [templateElement] = property.value.quasis;
const { value: content } = templateElement;
const escapedRawContent = content.raw.replace(/\\/g, "");
return {
ast: property,
value: content.raw,
hasUnneededBackticks: escapedRawContent === content.cooked
};
}
}
return null;
}
function getDefault(nodeParam) {
const isUnparseable = (type) => [import_utils.AST_NODE_TYPES.CallExpression, import_utils.AST_NODE_TYPES.Identifier].includes(type);
for (const property of nodeParam.properties) {
if (property.type === import_utils.AST_NODE_TYPES.Property && property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.key.name === "default" && isUnparseable(property.value.type)) {
return {
ast: property,
isUnparseable: true
// `default: myVar.join(',')` or `default: myVar`
};
}
if (import_identifiers.id.nodeParam.isTemplateLiteralDefault(property)) {
const consolidated = property.value.quasis.map((templateElement) => templateElement.value.cooked).join();
return {
ast: property,
value: consolidated
};
}
if (import_identifiers.id.nodeParam.isUnaryExpression(property)) {
return {
ast: property,
value: parseInt(
property.value.operator + property.value.argument.raw
// e.g. -1
)
};
}
if (import_identifiers.id.nodeParam.isPrimitiveDefault(property)) {
return {
ast: property,
value: property.value.value
};
}
if (import_identifiers.id.nodeParam.isObjectDefault(property)) {
return {
ast: property,
value: (0, import_restorers.restoreObject)(property.value)
};
}
if (import_identifiers.id.nodeParam.isArrayDefault(property)) {
return {
ast: property,
value: property.value.elements
};
}
}
return null;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getCollectionOptions,
getDefault,
getDescription,
getDisplayName,
getFixedCollectionValues,
getGetAllOption,
getHint,
getLoadOptionsMethod,
getMaxValue,
getMinValue,
getName,
getNoDataExpression,
getNumberProperty,
getOptions,
getPlaceholder,
getRequired,
getStringProperty,
getType,
getTypeOptions
});