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,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 common_identifiers_exports = {};
__export(common_identifiers_exports, {
hasValue: () => hasValue,
isArgument: () => isArgument,
isArrayExpression: () => isArrayExpression,
isArrayPropertyNamed: () => isArrayPropertyNamed,
isBooleanPropertyNamed: () => isBooleanPropertyNamed,
isCredentialClass: () => isCredentialClass,
isIdentifierPropertyNamed: () => isIdentifierPropertyNamed,
isLiteral: () => isLiteral,
isMemberExpression: () => isMemberExpression,
isNumericPropertyNamed: () => isNumericPropertyNamed,
isObjectPropertyNamed: () => isObjectPropertyNamed,
isReturnValue: () => isReturnValue,
isStringPropertyNamed: () => isStringPropertyNamed,
isWeakDescription: () => isWeakDescription
});
module.exports = __toCommonJS(common_identifiers_exports);
var import_utils = require("@typescript-eslint/utils");
var import_constants = require("../../constants");
function isTargetProperty({
keyName,
valueType
}, property) {
if (property.type !== import_utils.AST_NODE_TYPES.Property || property.computed !== false || property.key.type !== import_utils.AST_NODE_TYPES.Identifier || property.key.name !== keyName) {
return false;
}
if (valueType === "object") {
return property.value.type === import_utils.AST_NODE_TYPES.ObjectExpression;
}
if (valueType === "array") {
return property.value.type === import_utils.AST_NODE_TYPES.ArrayExpression;
}
return property.value.type === import_utils.AST_NODE_TYPES.Literal && typeof property.value.value === valueType;
}
function isStringPropertyNamed(keyName, property) {
return isTargetProperty({ keyName, valueType: "string" }, property);
}
function isNumericPropertyNamed(keyName, property) {
return isTargetProperty({ keyName, valueType: "number" }, property);
}
function isBooleanPropertyNamed(keyName, property) {
return isTargetProperty({ keyName, valueType: "boolean" }, property);
}
function isObjectPropertyNamed(keyName, property) {
return isTargetProperty({ keyName, valueType: "object" }, property);
}
function isArrayPropertyNamed(keyName, property) {
return isTargetProperty({ keyName, valueType: "array" }, property);
}
function isIdentifierPropertyNamed(keyName, property) {
return property.type === import_utils.AST_NODE_TYPES.Property && property.computed === false && property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.key.name === keyName && property.value.type === import_utils.AST_NODE_TYPES.Identifier;
}
function isCredentialClass(node) {
return node.implements?.length === 1 && node.implements[0].type === import_utils.AST_NODE_TYPES.TSClassImplements && node.implements[0].expression.type === import_utils.AST_NODE_TYPES.Identifier && node.implements[0].expression.name === "ICredentialType";
}
function hasValue(value, nodeParam) {
for (const property of nodeParam.properties) {
if (property.type === import_utils.AST_NODE_TYPES.Property && property.computed === false && property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.value.type === import_utils.AST_NODE_TYPES.Literal && property.value.value === value && typeof property.value.value === "string") {
return true;
}
}
return false;
}
function isReturnValue(node) {
return node.parent?.type === import_utils.AST_NODE_TYPES.ReturnStatement;
}
function isArgument(node) {
return node.parent?.type === import_utils.AST_NODE_TYPES.TSAsExpression || node.parent?.type === import_utils.AST_NODE_TYPES.CallExpression;
}
function isWeakDescription({ value }) {
return import_constants.WEAK_DESCRIPTIONS.some(
(wd) => value.toLowerCase().includes(wd.toLowerCase())
);
}
const isLiteral = (property) => {
return property.type === import_utils.AST_NODE_TYPES.Property && property.computed === false && property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.value.type === import_utils.AST_NODE_TYPES.Literal;
};
const isArrayExpression = (property) => {
return property.type === import_utils.AST_NODE_TYPES.Property && property.computed === false && property.key.type === import_utils.AST_NODE_TYPES.Identifier && typeof property.key.name === "string" && property.value.type === import_utils.AST_NODE_TYPES.ArrayExpression;
};
const isMemberExpression = (property) => {
return property.type === import_utils.AST_NODE_TYPES.Property && property.computed === false && property.key.type === import_utils.AST_NODE_TYPES.Identifier && typeof property.key.name === "string" && property.value.type === import_utils.AST_NODE_TYPES.MemberExpression;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
hasValue,
isArgument,
isArrayExpression,
isArrayPropertyNamed,
isBooleanPropertyNamed,
isCredentialClass,
isIdentifierPropertyNamed,
isLiteral,
isMemberExpression,
isNumericPropertyNamed,
isObjectPropertyNamed,
isReturnValue,
isStringPropertyNamed,
isWeakDescription
});

View File

@@ -0,0 +1,72 @@
"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_identifiers_exports = {};
__export(communityPackageJson_identifiers_exports, {
hasEmailLiteral: () => hasEmailLiteral,
hasNameLiteral: () => hasNameLiteral,
hasNodesApiVersion: () => hasNodesApiVersion,
hasNodesLiteral: () => hasNodesLiteral,
hasUrlLiteral: () => hasUrlLiteral,
isCommunityPackageJson: () => isCommunityPackageJson,
prod: () => prod,
test: () => test
});
module.exports = __toCommonJS(communityPackageJson_identifiers_exports);
var import_utils = require("@typescript-eslint/utils");
var import_identifiers = require("../identifiers");
const isTestRun = process.env.NODE_ENV === "test";
const isProdRun = !isTestRun;
function isCommunityPackageJson(filename, node) {
if (isProdRun && !filename.includes("package.json"))
return false;
if (isProdRun && !import_identifiers.id.prod.isTopLevelObjectExpression(node))
return false;
if (isTestRun && !import_identifiers.id.test.isTopLevelObjectExpression(node))
return false;
return true;
}
const prod = {
isTopLevelObjectExpression(node) {
return node.parent?.parent?.type === import_utils.AST_NODE_TYPES.Program;
}
};
const test = {
isTopLevelObjectExpression(node) {
return node.parent?.parent?.type === import_utils.AST_NODE_TYPES.VariableDeclaration;
}
};
const hasLiteral = (keyName) => (property) => {
return property.type === import_utils.AST_NODE_TYPES.Property && property.key.type === import_utils.AST_NODE_TYPES.Literal && property.key.value === keyName;
};
const hasNameLiteral = hasLiteral("name");
const hasEmailLiteral = hasLiteral("email");
const hasNodesLiteral = hasLiteral("nodes");
const hasNodesApiVersion = hasLiteral("n8nNodesApiVersion");
const hasUrlLiteral = hasLiteral("url");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
hasEmailLiteral,
hasNameLiteral,
hasNodesApiVersion,
hasNodesLiteral,
hasUrlLiteral,
isCommunityPackageJson,
prod,
test
});

View File

@@ -0,0 +1,61 @@
"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_identifiers_exports = {};
__export(credentialClassBody_identifiers_exports, {
isDisplayName: () => isDisplayName,
isDocumentationUrl: () => isDocumentationUrl,
isFieldExtends: () => isFieldExtends,
isName: () => isName,
isPlaceholder: () => isPlaceholder
});
module.exports = __toCommonJS(credentialClassBody_identifiers_exports);
var import_utils = require("@typescript-eslint/utils");
function isStringField(fieldName, property) {
return "key" in property && "type" in property.key && // property.type === AST_NODE_TYPES.PropertyDefinition &&
// property.computed === false &&
property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.key.name === fieldName && property.value !== null && property.value.type === import_utils.AST_NODE_TYPES.Literal && typeof property.value.value === "string";
}
function isName(property) {
return isStringField("name", property);
}
function isDisplayName(property) {
return isStringField("displayName", property);
}
function isDocumentationUrl(property) {
return isStringField("documentationUrl", property);
}
function isPlaceholder(property) {
return isStringField("placeholder", property);
}
function isArrayField(fieldName, property) {
return "key" in property && "type" in property.key && // property.type === AST_NODE_TYPES.PropertyDefinition &&
// property.computed === false &&
property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.key.name === fieldName && property.value !== null && property.value.type === import_utils.AST_NODE_TYPES.ArrayExpression;
}
function isFieldExtends(property) {
return isArrayField("extends", property);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
isDisplayName,
isDocumentationUrl,
isFieldExtends,
isName,
isPlaceholder
});

View File

@@ -0,0 +1,53 @@
"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 identifiers_exports = {};
__export(identifiers_exports, {
id: () => id
});
module.exports = __toCommonJS(identifiers_exports);
var communityPackageJson = __toESM(require("./communityPackageJson.identifiers"));
var nodeParam = __toESM(require("./nodeParameter.identifiers"));
var nodeClassDescription = __toESM(require("./nodeClassDescription.identifiers"));
var credClassBody = __toESM(require("./credentialClassBody.identifiers"));
var nodeExecuteBlock = __toESM(require("./nodeExecuteBlock.identifiers"));
var lintableSections = __toESM(require("./lintable.identifiers"));
var common = __toESM(require("./common.identifiers"));
const id = {
nodeParam,
credClassBody,
nodeClassDescription,
nodeExecuteBlock,
...communityPackageJson,
...lintableSections,
...common
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
id
});

View File

@@ -0,0 +1,66 @@
"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 lintable_identifiers_exports = {};
__export(lintable_identifiers_exports, {
IDENTIFIER_KEYS: () => IDENTIFIER_KEYS,
isFixedCollectionSection: () => isFixedCollectionSection,
isNodeClassDescription: () => isNodeClassDescription,
isNodeParameter: () => isNodeParameter,
isOption: () => isOption
});
module.exports = __toCommonJS(lintable_identifiers_exports);
var import_utils = require("@typescript-eslint/utils");
const IDENTIFIER_KEYS = {
nodeParam: ["displayName", "name", "type", "default"],
option: ["name", "value"],
// in options-type or multi-options-type node param
fixedCollectionSection: ["displayName", "name", "values"],
nodeClassDescription: ["displayName", "name", "group"]
};
function isLintableSection(section, node, options) {
const requiredKeys = IDENTIFIER_KEYS[section];
const keysToCheck = options ? requiredKeys.filter((key) => !options.skipKeys.includes(key)) : requiredKeys;
const totalFound = node.properties.reduce((acc, property) => {
if (property.type === import_utils.AST_NODE_TYPES.Property && property.key.type === import_utils.AST_NODE_TYPES.Identifier && keysToCheck.includes(property.key.name)) {
acc++;
}
return acc;
}, 0);
return totalFound === keysToCheck.length;
}
function isNodeParameter(node, options) {
return isLintableSection("nodeParam", node, options);
}
function isOption(node) {
return isLintableSection("option", node);
}
function isFixedCollectionSection(node) {
return isLintableSection("fixedCollectionSection", node);
}
function isNodeClassDescription(node) {
return isLintableSection("nodeClassDescription", node);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
IDENTIFIER_KEYS,
isFixedCollectionSection,
isNodeClassDescription,
isNodeParameter,
isOption
});

View File

@@ -0,0 +1,76 @@
"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_identifiers_exports = {};
__export(nodeClassDescription_identifiers_exports, {
isCredentials: () => isCredentials,
isDefaultVersion: () => isDefaultVersion,
isDefaults: () => isDefaults,
isIcon: () => isIcon,
isInputs: () => isInputs,
isName: () => isName,
isOutputs: () => isOutputs,
isProperties: () => isProperties,
isSubtitle: () => isSubtitle,
isVersion: () => isVersion
});
module.exports = __toCommonJS(nodeClassDescription_identifiers_exports);
var import_common = require("./common.identifiers");
function isName(property) {
return (0, import_common.isStringPropertyNamed)("name", property);
}
function isIcon(property) {
return (0, import_common.isStringPropertyNamed)("icon", property);
}
function isVersion(property) {
return (0, import_common.isNumericPropertyNamed)("version", property);
}
function isSubtitle(property) {
return (0, import_common.isStringPropertyNamed)("subtitle", property);
}
function isDefaultVersion(property) {
return (0, import_common.isNumericPropertyNamed)("defaultVersion", property);
}
function isInputs(property) {
return (0, import_common.isArrayPropertyNamed)("inputs", property);
}
function isOutputs(property) {
return (0, import_common.isArrayPropertyNamed)("outputs", property);
}
function isCredentials(property) {
return (0, import_common.isArrayPropertyNamed)("credentials", property);
}
function isProperties(property) {
return (0, import_common.isArrayPropertyNamed)("properties", property);
}
function isDefaults(property) {
return (0, import_common.isObjectPropertyNamed)("defaults", property);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
isCredentials,
isDefaultVersion,
isDefaults,
isIcon,
isInputs,
isName,
isOutputs,
isProperties,
isSubtitle,
isVersion
});

View File

@@ -0,0 +1,129 @@
"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_identifiers_exports = {};
__export(nodeExecuteBlock_identifiers_exports, {
hasValidPluralPairingArgument: () => hasValidPluralPairingArgument,
hasValidSingularPairingArgument: () => hasValidSingularPairingArgument,
isForLoop: () => isForLoop,
isPluralPairingStatement: () => isPluralPairingStatement,
isResourceChecksRoot: () => isResourceChecksRoot,
isSingularPairingStatement: () => isSingularPairingStatement,
isTryCatch: () => isTryCatch
});
module.exports = __toCommonJS(nodeExecuteBlock_identifiers_exports);
var import_utils = require("@typescript-eslint/utils");
var import_getters = require("../getters");
const isForLoop = (node) => node.type === import_utils.AST_NODE_TYPES.ForStatement;
const isTryCatch = (node) => node.type === import_utils.AST_NODE_TYPES.TryStatement;
const isResourceChecksRoot = (node) => node.type === import_utils.AST_NODE_TYPES.IfStatement && node.test.type === import_utils.AST_NODE_TYPES.BinaryExpression && node.test.operator === "===" && node.test.left.type === import_utils.AST_NODE_TYPES.Identifier && node.test.left.name === "resource";
function isPluralPairingStatement(lastStatement, returnDataArrayName) {
return lastStatement.type === import_utils.AST_NODE_TYPES.ExpressionStatement && isReturnDataPush(lastStatement, returnDataArrayName) && hasSpreadArgument(lastStatement);
}
const hasSpreadArgument = (statement) => statement.expression.arguments.length === 1 && statement.expression.arguments[0].type === import_utils.AST_NODE_TYPES.SpreadElement;
function isSingularPairingStatement(lastStatement, returnDataArrayName) {
return lastStatement.type === import_utils.AST_NODE_TYPES.ExpressionStatement && isReturnDataPush(lastStatement, returnDataArrayName) && hasSingleArgument(lastStatement);
}
const isReturnDataPush = (node, returnDataArrayName) => {
return node.expression.type === import_utils.AST_NODE_TYPES.CallExpression && node.expression.callee.type === import_utils.AST_NODE_TYPES.MemberExpression && node.expression.callee.object.type === import_utils.AST_NODE_TYPES.Identifier && node.expression.callee.object.name === returnDataArrayName && node.expression.callee.property.type === import_utils.AST_NODE_TYPES.Identifier && node.expression.callee.property.name === "push";
};
const hasSingleArgument = (statement) => statement.expression.arguments.length === 1;
function hasValidSingularPairingArgument(lastStatement, inputItemsIndexName) {
const [argument] = lastStatement.expression.arguments;
if (argument.type !== import_utils.AST_NODE_TYPES.ObjectExpression)
return false;
const hasJsonKey = argument.properties.some(
(property) => property.type === import_utils.AST_NODE_TYPES.Property && property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.key.name === "json"
);
if (!hasJsonKey)
return false;
const hasResponseDataValue = argument.properties.some(
(property) => property.type === import_utils.AST_NODE_TYPES.Property && property.value.type === import_utils.AST_NODE_TYPES.Identifier && property.value.name === "responseData"
);
if (!hasResponseDataValue)
return false;
const hasPairedItemKey = argument.properties.some(
(property) => property.type === import_utils.AST_NODE_TYPES.Property && property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.key.name === "pairedItem"
);
if (!hasPairedItemKey)
return false;
const pairedItemValue = import_getters.getters.nodeExecuteBlock.getPairedItemValue(
argument.properties
);
if (!pairedItemValue)
return false;
const hasPairedItemValueContent = pairedItemValue.properties.find(
(property) => {
return property.type === import_utils.AST_NODE_TYPES.Property && property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.key.name === "item" && property.value.type === import_utils.AST_NODE_TYPES.Identifier && property.value.name === inputItemsIndexName;
}
);
if (!hasPairedItemValueContent)
return false;
return true;
}
function hasValidPluralPairingArgument(lastStatement, inputItemsIndexName) {
const [argument] = lastStatement.expression.arguments;
if (argument.type !== import_utils.AST_NODE_TYPES.SpreadElement)
return false;
if (argument.argument.type !== import_utils.AST_NODE_TYPES.CallExpression)
return false;
const hasResponseDataMap = argument.argument.callee.type === import_utils.AST_NODE_TYPES.MemberExpression && argument.argument.callee.object.type === import_utils.AST_NODE_TYPES.Identifier && argument.argument.callee.object.name === "responseData" && argument.argument.callee.property.type === import_utils.AST_NODE_TYPES.Identifier && argument.argument.callee.property.name === "map";
if (!hasResponseDataMap)
return false;
if (argument.argument.arguments.length !== 1)
return false;
const [arrowFunction] = argument.argument.arguments;
const hasArrowFunctionWithJsonArg = arrowFunction.type === import_utils.AST_NODE_TYPES.ArrowFunctionExpression && arrowFunction.params.length === 1 && arrowFunction.params[0].type === import_utils.AST_NODE_TYPES.Identifier && arrowFunction.params[0].name === "json";
if (!hasArrowFunctionWithJsonArg)
return false;
const returnsObject = arrowFunction.body.type === import_utils.AST_NODE_TYPES.BlockStatement && arrowFunction.body.body.length === 1 && arrowFunction.body.body[0].type === import_utils.AST_NODE_TYPES.ReturnStatement && arrowFunction.body.body[0].argument !== null && arrowFunction.body.body[0].argument.type === import_utils.AST_NODE_TYPES.ObjectExpression;
if (!returnsObject)
return false;
const { properties } = arrowFunction.body.body[0].argument;
const returnedObjectHasJson = properties.some(
(property) => property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.key.name === "json" && property.value.type === import_utils.AST_NODE_TYPES.Identifier && property.value.name === "json"
);
if (!returnedObjectHasJson)
return false;
const returnedObjectHasPairedItem = properties.find(
(property) => property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.key.name === "pairedItem" && property.value.type === import_utils.AST_NODE_TYPES.ObjectExpression && property.value.properties.length === 1
);
if (!returnedObjectHasPairedItem)
return false;
const pairedItemValue = import_getters.getters.nodeExecuteBlock.getPairedItemValue(properties);
if (!pairedItemValue)
return false;
const hasPairedItemValueContent = pairedItemValue.properties.find(
(property) => {
return property.type === import_utils.AST_NODE_TYPES.Property && property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.key.name === "item" && property.value.type === import_utils.AST_NODE_TYPES.Identifier && property.value.name === inputItemsIndexName;
}
);
if (!hasPairedItemValueContent)
return false;
return true;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
hasValidPluralPairingArgument,
hasValidSingularPairingArgument,
isForLoop,
isPluralPairingStatement,
isResourceChecksRoot,
isSingularPairingStatement,
isTryCatch
});

View File

@@ -0,0 +1,250 @@
"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_identifiers_exports = {};
__export(nodeParameter_identifiers_exports, {
hasName: () => hasName,
isAction: () => isAction,
isArrayDefault: () => isArrayDefault,
isBooleanType: () => isBooleanType,
isCollectionType: () => isCollectionType,
isDescription: () => isDescription,
isDisplayName: () => isDisplayName,
isDisplayOptions: () => isDisplayOptions,
isDisplayOptionsShow: () => isDisplayOptionsShow,
isEmail: () => isEmail,
isFixedCollectionType: () => isFixedCollectionType,
isFixedCollectionValues: () => isFixedCollectionValues,
isGetAllOptionProperty: () => isGetAllOptionProperty,
isHint: () => isHint,
isIgnoreSslIssues: () => isIgnoreSslIssues,
isLimit: () => isLimit,
isLoadOptionsMethod: () => isLoadOptionsMethod,
isMaxValue: () => isMaxValue,
isMinValue: () => isMinValue,
isMultiOptionsType: () => isMultiOptionsType,
isName: () => isName,
isNoDataExpression: () => isNoDataExpression,
isNumericType: () => isNumericType,
isObjectDefault: () => isObjectDefault,
isOperation: () => isOperation,
isOptions: () => isOptions,
isOptionsType: () => isOptionsType,
isPlaceholder: () => isPlaceholder,
isPrimitiveDefault: () => isPrimitiveDefault,
isRequired: () => isRequired,
isResource: () => isResource,
isReturnAll: () => isReturnAll,
isShowSetting: () => isShowSetting,
isSimplify: () => isSimplify,
isStringType: () => isStringType,
isTemplateDescription: () => isTemplateDescription,
isTemplateLiteralDefault: () => isTemplateLiteralDefault,
isType: () => isType,
isTypeOptions: () => isTypeOptions,
isUnaryExpression: () => isUnaryExpression,
isUpdateFields: () => isUpdateFields,
isValue: () => isValue
});
module.exports = __toCommonJS(nodeParameter_identifiers_exports);
var import_utils = require("@typescript-eslint/utils");
var import_common = require("./common.identifiers");
function isParamOfType(type, nodeParam) {
const found = nodeParam.properties.find((property) => {
return property.type === import_utils.AST_NODE_TYPES.Property && property.computed === false && property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.key.name === "type" && property.value.type === import_utils.AST_NODE_TYPES.Literal && property.value.value === type;
});
return Boolean(found);
}
function isStringType(nodeParam) {
return isParamOfType("string", nodeParam);
}
function isNumericType(nodeParam) {
return isParamOfType("number", nodeParam);
}
function isBooleanType(nodeParam) {
return isParamOfType("boolean", nodeParam);
}
function isOptionsType(nodeParam) {
return isParamOfType("options", nodeParam);
}
function isMultiOptionsType(nodeParam) {
return isParamOfType("multiOptions", nodeParam);
}
function isCollectionType(nodeParam) {
return isParamOfType("collection", nodeParam);
}
function isFixedCollectionType(nodeParam) {
return isParamOfType("fixedCollection", nodeParam);
}
function hasName(name, nodeParam) {
let check = (value) => value === name;
if (name === "update")
check = (value) => /update/.test(value);
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 === "name" && property.value.type === import_utils.AST_NODE_TYPES.Literal && typeof property.value.value === "string" && check(property.value.value)) {
return true;
}
}
return false;
}
function isEmail(nodeParam) {
return isStringType(nodeParam) && hasName("email", nodeParam);
}
function isSimplify(nodeParam) {
return isBooleanType(nodeParam) && hasName("simple", nodeParam);
}
function isLimit(nodeParam) {
return isNumericType(nodeParam) && hasName("limit", nodeParam);
}
function isReturnAll(nodeParam) {
return isBooleanType(nodeParam) && hasName("returnAll", nodeParam);
}
function isIgnoreSslIssues(nodeParam) {
return isBooleanType(nodeParam) && hasName("allowUnauthorizedCerts", nodeParam);
}
function isUpdateFields(nodeParam) {
return isCollectionType(nodeParam) && hasName("update", nodeParam);
}
function isResource(nodeParam) {
return isOptionsType(nodeParam) && hasName("resource", nodeParam);
}
function isOperation(nodeParam) {
return isOptionsType(nodeParam) && hasName("operation", nodeParam);
}
function isAction(nodeParam) {
return isOptionsType(nodeParam) && hasName("action", nodeParam);
}
function isRequired(property) {
return (0, import_common.isBooleanPropertyNamed)("required", property);
}
function isNoDataExpression(property) {
return (0, import_common.isBooleanPropertyNamed)("noDataExpression", property);
}
function isDisplayName(property) {
return (0, import_common.isStringPropertyNamed)("displayName", property);
}
function isPlaceholder(property) {
return (0, import_common.isStringPropertyNamed)("placeholder", property);
}
function isType(property) {
return (0, import_common.isStringPropertyNamed)("type", property);
}
function isName(property) {
return (0, import_common.isStringPropertyNamed)("name", property);
}
function isHint(property) {
return (0, import_common.isStringPropertyNamed)("hint", property);
}
function isValue(property) {
return (0, import_common.isStringPropertyNamed)("value", property);
}
function isDisplayOptions(property) {
return (0, import_common.isObjectPropertyNamed)("displayOptions", property);
}
const isUnaryExpression = (property) => {
return property.type === import_utils.AST_NODE_TYPES.Property && property.computed === false && property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.value.type === import_utils.AST_NODE_TYPES.UnaryExpression;
};
function isPrimitiveDefault(property) {
return property.type === import_utils.AST_NODE_TYPES.Property && property.computed === false && property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.key.name === "default" && property.value.type === import_utils.AST_NODE_TYPES.Literal;
}
function isTemplateLiteralDefault(property) {
return property.type === import_utils.AST_NODE_TYPES.Property && property.computed === false && property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.key.name === "default" && property.value.type === import_utils.AST_NODE_TYPES.TemplateLiteral && property.value.quasis.length > 0;
}
function isObjectDefault(property) {
return (0, import_common.isObjectPropertyNamed)("default", property);
}
function isArrayDefault(property) {
return (0, import_common.isArrayPropertyNamed)("default", property);
}
function isOptions(property) {
return (0, import_common.isArrayPropertyNamed)("options", property) || (0, import_common.isIdentifierPropertyNamed)("options", property);
}
function isTypeOptions(property) {
return (0, import_common.isObjectPropertyNamed)("typeOptions", property);
}
function isTypeOptionsValue(property, keyName, valueType) {
return property.type === import_utils.AST_NODE_TYPES.Property && property.computed === false && property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.value.type === import_utils.AST_NODE_TYPES.Literal && property.key.name === keyName && typeof property.value.value === valueType;
}
const isMinValue = (property) => isTypeOptionsValue(property, "minValue", "number");
const isMaxValue = (property) => isTypeOptionsValue(property, "maxValue", "number");
function isLoadOptionsMethod(property) {
return (0, import_common.isStringPropertyNamed)("loadOptionsMethod", property);
}
function isDescription(property) {
return (0, import_common.isStringPropertyNamed)("description", property);
}
function isTemplateDescription(property) {
return property.type === import_utils.AST_NODE_TYPES.Property && property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.key.name === "description" && property.value.type === import_utils.AST_NODE_TYPES.TemplateLiteral && property.value.quasis.length > 0;
}
function isFixedCollectionValues(property) {
return (0, import_common.isArrayPropertyNamed)("values", property);
}
function isDisplayOptionsShow(property) {
return (0, import_common.isObjectPropertyNamed)("show", property);
}
function isShowSetting(showSettingKey, property) {
return (0, import_common.isArrayPropertyNamed)(showSettingKey, property);
}
function isGetAllOptionProperty(property) {
return property.type === import_utils.AST_NODE_TYPES.Property && property.computed === false && property.key.type === import_utils.AST_NODE_TYPES.Identifier && property.key.name === "value" && property.value.type === import_utils.AST_NODE_TYPES.Literal && typeof property.value.value === "string" && property.value.value === "getAll";
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
hasName,
isAction,
isArrayDefault,
isBooleanType,
isCollectionType,
isDescription,
isDisplayName,
isDisplayOptions,
isDisplayOptionsShow,
isEmail,
isFixedCollectionType,
isFixedCollectionValues,
isGetAllOptionProperty,
isHint,
isIgnoreSslIssues,
isLimit,
isLoadOptionsMethod,
isMaxValue,
isMinValue,
isMultiOptionsType,
isName,
isNoDataExpression,
isNumericType,
isObjectDefault,
isOperation,
isOptions,
isOptionsType,
isPlaceholder,
isPrimitiveDefault,
isRequired,
isResource,
isReturnAll,
isShowSetting,
isSimplify,
isStringType,
isTemplateDescription,
isTemplateLiteralDefault,
isType,
isTypeOptions,
isUnaryExpression,
isUpdateFields,
isValue
});