first commit
This commit is contained in:
23
node_modules/@n8n/tournament/dist/Analysis.d.ts
generated
vendored
Normal file
23
node_modules/@n8n/tournament/dist/Analysis.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { ExpressionAnalysis } from './ExpressionBuilder';
|
||||
interface TmplOrTournament {
|
||||
tmpl: boolean;
|
||||
tournament: boolean;
|
||||
}
|
||||
interface TmplSame {
|
||||
same: true;
|
||||
expression?: SanitizedString;
|
||||
}
|
||||
interface TmplDiff {
|
||||
same: false;
|
||||
expression: SanitizedString | 'UNPARSEABLE';
|
||||
has?: ExpressionAnalysis['has'];
|
||||
parserError?: TmplOrTournament;
|
||||
}
|
||||
export type TmplDifference = TmplSame | TmplDiff;
|
||||
export declare const getTmplDifference: (expr: string, dataNodeName: string) => TmplDifference;
|
||||
export interface SanitizedString {
|
||||
value: string;
|
||||
sanitized: 'ACTUALLY_SANITIZED_DO_NOT_MANUALLY_MAKE_THIS_OBJECT';
|
||||
}
|
||||
export declare const stripIdentifyingInformation: (expr: string) => SanitizedString;
|
||||
export {};
|
||||
134
node_modules/@n8n/tournament/dist/Analysis.js
generated
vendored
Normal file
134
node_modules/@n8n/tournament/dist/Analysis.js
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
"use strict";
|
||||
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stripIdentifyingInformation = exports.getTmplDifference = void 0;
|
||||
const tmpl = __importStar(require("@n8n_io/riot-tmpl"));
|
||||
const recast_1 = require("recast");
|
||||
const Differ_1 = require("./Differ");
|
||||
const ExpressionBuilder_1 = require("./ExpressionBuilder");
|
||||
const ExpressionSplitter_1 = require("./ExpressionSplitter");
|
||||
const getTmplDifference = (expr, dataNodeName) => {
|
||||
if (!expr) {
|
||||
return { same: true };
|
||||
}
|
||||
if (tmpl.brackets.settings.brackets !== '{{ }}') {
|
||||
tmpl.brackets.set('{{ }}');
|
||||
}
|
||||
let tournParsed;
|
||||
let tmplParsed;
|
||||
let analysis;
|
||||
try {
|
||||
[tournParsed, analysis] = (0, ExpressionBuilder_1.getExpressionCode)(expr, dataNodeName, { before: [], after: [] });
|
||||
}
|
||||
catch (e) {
|
||||
tournParsed = null;
|
||||
analysis = null;
|
||||
}
|
||||
try {
|
||||
tmplParsed = tmpl.tmpl.getStr(expr);
|
||||
}
|
||||
catch (e) {
|
||||
tmplParsed = null;
|
||||
}
|
||||
if ((analysis === null || analysis === void 0 ? void 0 : analysis.has.function) || (analysis === null || analysis === void 0 ? void 0 : analysis.has.templateString)) {
|
||||
return {
|
||||
same: false,
|
||||
expression: (0, exports.stripIdentifyingInformation)(expr),
|
||||
has: analysis.has,
|
||||
};
|
||||
}
|
||||
if (tournParsed === null && tmplParsed === null) {
|
||||
return { same: true };
|
||||
}
|
||||
else if (tournParsed === null) {
|
||||
return {
|
||||
same: false,
|
||||
expression: 'UNPARSEABLE',
|
||||
parserError: {
|
||||
tmpl: false,
|
||||
tournament: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
else if (tmplParsed === null) {
|
||||
return {
|
||||
same: false,
|
||||
expression: (0, exports.stripIdentifyingInformation)(expr),
|
||||
parserError: {
|
||||
tmpl: true,
|
||||
tournament: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
const different = (0, Differ_1.isDifferent)(tmplParsed, tournParsed);
|
||||
if (different) {
|
||||
return {
|
||||
same: false,
|
||||
expression: (0, exports.stripIdentifyingInformation)(expr),
|
||||
};
|
||||
}
|
||||
return { same: true, expression: (0, exports.stripIdentifyingInformation)(expr) };
|
||||
};
|
||||
exports.getTmplDifference = getTmplDifference;
|
||||
const CHAR_REPLACE = /\S/gu;
|
||||
const replaceValue = (value) => {
|
||||
return value.replace(CHAR_REPLACE, 'v');
|
||||
};
|
||||
const stripIdentifyingInformation = (expr) => {
|
||||
const chunks = (0, ExpressionBuilder_1.getParsedExpression)(expr);
|
||||
for (const chunk of chunks) {
|
||||
if (chunk.type === 'text') {
|
||||
chunk.text = replaceValue(chunk.text);
|
||||
}
|
||||
else {
|
||||
(0, recast_1.visit)(chunk.parsed, {
|
||||
visitLiteral(path) {
|
||||
this.traverse(path);
|
||||
if (typeof path.node.value === 'string') {
|
||||
path.node.value = replaceValue(path.node.value);
|
||||
}
|
||||
},
|
||||
visitStringLiteral(path) {
|
||||
this.traverse(path);
|
||||
path.node.value = replaceValue(path.node.value);
|
||||
},
|
||||
visitTemplateElement(path) {
|
||||
this.traverse(path);
|
||||
if (path.node.value.cooked !== null) {
|
||||
path.node.value.cooked = replaceValue(path.node.value.cooked);
|
||||
}
|
||||
path.node.value.raw = replaceValue(path.node.value.raw);
|
||||
},
|
||||
});
|
||||
chunk.text = (0, recast_1.print)(chunk.parsed).code;
|
||||
}
|
||||
}
|
||||
return {
|
||||
value: (0, ExpressionSplitter_1.joinExpression)(chunks),
|
||||
sanitized: 'ACTUALLY_SANITIZED_DO_NOT_MANUALLY_MAKE_THIS_OBJECT',
|
||||
};
|
||||
};
|
||||
exports.stripIdentifyingInformation = stripIdentifyingInformation;
|
||||
//# sourceMappingURL=Analysis.js.map
|
||||
1
node_modules/@n8n/tournament/dist/Analysis.js.map
generated
vendored
Normal file
1
node_modules/@n8n/tournament/dist/Analysis.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Analysis.js","sourceRoot":"","sources":["../src/Analysis.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA0C;AAC1C,mCAAsC;AACtC,qCAAuC;AAGvC,2DAA6E;AAC7E,6DAAsD;AAkB/C,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,YAAoB,EAAkB,EAAE;IACvF,IAAI,CAAC,IAAI,EAAE;QACV,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;KACtB;IACD,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,KAAK,OAAO,EAAE;QAChD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;KAC3B;IACD,IAAI,WAA0B,CAAC;IAC/B,IAAI,UAAyB,CAAC;IAC9B,IAAI,QAAmC,CAAC;IACxC,IAAI;QACH,CAAC,WAAW,EAAE,QAAQ,CAAC,GAAG,IAAA,qCAAiB,EAAC,IAAI,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;KAC3F;IAAC,OAAO,CAAC,EAAE;QACX,WAAW,GAAG,IAAI,CAAC;QACnB,QAAQ,GAAG,IAAI,CAAC;KAChB;IACD,IAAI;QACH,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACpC;IAAC,OAAO,CAAC,EAAE;QACX,UAAU,GAAG,IAAI,CAAC;KAClB;IACD,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG,CAAC,Q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CAAC;YACH,KAAK,CAAC,IAAI,GAAG,IAAA,cAAK,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;SACtC;KACD;IAED,OAAO;QACN,KAAK,EAAE,IAAA,mCAAc,EAAC,MAAM,CAAC;QAC7B,SAAS,EAAE,qDAAqD;KAChE,CAAC;AACH,CAAC,CAAC;AAlCW,QAAA,2BAA2B,+BAkCtC"}
|
||||
3
node_modules/@n8n/tournament/dist/Constants.d.ts
generated
vendored
Normal file
3
node_modules/@n8n/tournament/dist/Constants.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { CatchClauseKind, ExpressionKind, PatternKind, PropertyKind, StatementKind, VariableDeclaratorKind } from 'ast-types/lib/gen/kinds';
|
||||
export declare const EXEMPT_IDENTIFIER_LIST: string[];
|
||||
export type ParentKind = ExpressionKind | StatementKind | PropertyKind | PatternKind | VariableDeclaratorKind | CatchClauseKind;
|
||||
13
node_modules/@n8n/tournament/dist/Constants.js
generated
vendored
Normal file
13
node_modules/@n8n/tournament/dist/Constants.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.EXEMPT_IDENTIFIER_LIST = void 0;
|
||||
exports.EXEMPT_IDENTIFIER_LIST = [
|
||||
'isFinite',
|
||||
'isNaN',
|
||||
'NaN',
|
||||
'Date',
|
||||
'RegExp',
|
||||
'Math',
|
||||
'undefined',
|
||||
];
|
||||
//# sourceMappingURL=Constants.js.map
|
||||
1
node_modules/@n8n/tournament/dist/Constants.js.map
generated
vendored
Normal file
1
node_modules/@n8n/tournament/dist/Constants.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../src/Constants.ts"],"names":[],"mappings":";;;AASa,QAAA,sBAAsB,GAAG;IACrC,UAAU;IACV,OAAO;IACP,KAAK;IACL,MAAM;IACN,QAAQ;IACR,MAAM;IACN,WAAW;CACX,CAAC"}
|
||||
1
node_modules/@n8n/tournament/dist/Differ.d.ts
generated
vendored
Normal file
1
node_modules/@n8n/tournament/dist/Differ.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare const isDifferent: (tmpl: string, tourn: string) => boolean;
|
||||
80
node_modules/@n8n/tournament/dist/Differ.js
generated
vendored
Normal file
80
node_modules/@n8n/tournament/dist/Differ.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isDifferent = void 0;
|
||||
const recast_1 = require("recast");
|
||||
const Parser_1 = require("./Parser");
|
||||
const isWrapped = (node) => {
|
||||
var _a;
|
||||
return ((_a = node.program.body[1]) === null || _a === void 0 ? void 0 : _a.type) === 'TryStatement';
|
||||
};
|
||||
const getWrapped = (node) => {
|
||||
var _a;
|
||||
return (_a = node.program.body[1]) === null || _a === void 0 ? void 0 : _a.block.body[0];
|
||||
};
|
||||
const isMultiPartExpression = (node) => {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
||||
return (((_a = node.program.body[1]) === null || _a === void 0 ? void 0 : _a.type) === 'ReturnStatement' &&
|
||||
((_b = node.program.body[1].argument) === null || _b === void 0 ? void 0 : _b.type) === 'CallExpression' &&
|
||||
((_d = (_c = node.program.body[1].argument) === null || _c === void 0 ? void 0 : _c.arguments[0]) === null || _d === void 0 ? void 0 : _d.type) === 'Literal' &&
|
||||
((_f = (_e = node.program.body[1].argument) === null || _e === void 0 ? void 0 : _e.arguments[0]) === null || _f === void 0 ? void 0 : _f.value) === '' &&
|
||||
((_g = node.program.body[1].argument) === null || _g === void 0 ? void 0 : _g.callee.type) === 'MemberExpression' &&
|
||||
((_h = node.program.body[1].argument) === null || _h === void 0 ? void 0 : _h.callee.object.type) === 'ArrayExpression' &&
|
||||
((_j = node.program.body[1].argument) === null || _j === void 0 ? void 0 : _j.callee.property.type) === 'Identifier' &&
|
||||
((_k = node.program.body[1].argument) === null || _k === void 0 ? void 0 : _k.callee.property.name) === 'join');
|
||||
};
|
||||
const getMultiPartExpression = (node) => {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h;
|
||||
if (!(((_a = node.program.body[1]) === null || _a === void 0 ? void 0 : _a.type) === 'ReturnStatement' &&
|
||||
((_b = node.program.body[1].argument) === null || _b === void 0 ? void 0 : _b.type) === 'CallExpression' &&
|
||||
((_d = (_c = node.program.body[1].argument) === null || _c === void 0 ? void 0 : _c.arguments[0]) === null || _d === void 0 ? void 0 : _d.type) === 'Literal' &&
|
||||
((_f = (_e = node.program.body[1].argument) === null || _e === void 0 ? void 0 : _e.arguments[0]) === null || _f === void 0 ? void 0 : _f.value) === '' &&
|
||||
((_g = node.program.body[1].argument) === null || _g === void 0 ? void 0 : _g.callee.type) === 'MemberExpression' &&
|
||||
((_h = node.program.body[1].argument) === null || _h === void 0 ? void 0 : _h.callee.object.type) === 'ArrayExpression')) {
|
||||
return [];
|
||||
}
|
||||
return node.program.body[1].argument.callee.object.elements
|
||||
.map((e) => {
|
||||
if ((e === null || e === void 0 ? void 0 : e.type) !== 'CallExpression' ||
|
||||
e.callee.type !== 'MemberExpression' ||
|
||||
e.callee.object.type !== 'FunctionExpression') {
|
||||
return null;
|
||||
}
|
||||
const maybeExpr = e.callee.object.body.body[0];
|
||||
if (maybeExpr.type !== 'TryStatement') {
|
||||
return maybeExpr;
|
||||
}
|
||||
return maybeExpr.block.body[0];
|
||||
})
|
||||
.filter((e) => e !== null);
|
||||
};
|
||||
const isDifferent = (tmpl, tourn) => {
|
||||
const tmplParsed = (0, recast_1.parse)(tmpl, {
|
||||
parser: { parse: Parser_1.parseWithEsprimaNext },
|
||||
});
|
||||
const tournParsed = (0, recast_1.parse)(tourn, {
|
||||
parser: { parse: Parser_1.parseWithEsprimaNext },
|
||||
});
|
||||
const problemPaths = [];
|
||||
let same = recast_1.types.astNodesAreEquivalent(tmplParsed, tournParsed, problemPaths);
|
||||
if (!same) {
|
||||
if (isWrapped(tournParsed) && !isWrapped(tmplParsed)) {
|
||||
const tournWrapped = getWrapped(tournParsed);
|
||||
same = recast_1.types.astNodesAreEquivalent(tmplParsed.program.body[1], tournWrapped);
|
||||
}
|
||||
else if (isMultiPartExpression(tournParsed) && isMultiPartExpression(tmplParsed)) {
|
||||
const tournExprs = getMultiPartExpression(tournParsed);
|
||||
const tmplExprs = getMultiPartExpression(tmplParsed);
|
||||
if (tournExprs.length === tmplExprs.length) {
|
||||
for (let i = 0; i < tournExprs.length; i++) {
|
||||
same = recast_1.types.astNodesAreEquivalent(tmplExprs[i], tournExprs[i], problemPaths);
|
||||
if (!same) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return !same;
|
||||
};
|
||||
exports.isDifferent = isDifferent;
|
||||
//# sourceMappingURL=Differ.js.map
|
||||
1
node_modules/@n8n/tournament/dist/Differ.js.map
generated
vendored
Normal file
1
node_modules/@n8n/tournament/dist/Differ.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Differ.js","sourceRoot":"","sources":["../src/Differ.ts"],"names":[],"mappings":";;;AACA,mCAAsC;AACtC,qCAAgD;AAEhD,MAAM,SAAS,GAAG,CAAC,IAA2B,EAAW,EAAE;;IAC1D,OAAO,CAAA,MAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,0CAAE,IAAI,MAAK,cAAc,CAAC;AACtD,CAAC,CAAC;AACF,MAAM,UAAU,GAAG,CAAC,IAA2B,EAAE,EAAE;;IAClD,OAAO,MAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAmC,0CAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/E,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,IAA2B,EAAW,EAAE;;IACtE,OAAO,CACN,CAAA,MAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC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AC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;oBAC9E,IAAI,CAAC,IAAI,EAAE;wBACV,MAAM;qBACN;iBACD;aACD;SACD;KACD;IAED,OAAO,CAAC,IAAI,CAAC;AACd,CAAC,CAAC;AAtCW,QAAA,WAAW,eAsCtB"}
|
||||
7
node_modules/@n8n/tournament/dist/Evaluator.d.ts
generated
vendored
Normal file
7
node_modules/@n8n/tournament/dist/Evaluator.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { ReturnValue, Tournament } from '.';
|
||||
export interface ExpressionEvaluator {
|
||||
evaluate(code: string, data: unknown): ReturnValue;
|
||||
}
|
||||
export interface ExpressionEvaluatorClass {
|
||||
new (instance: Tournament): ExpressionEvaluator;
|
||||
}
|
||||
3
node_modules/@n8n/tournament/dist/Evaluator.js
generated
vendored
Normal file
3
node_modules/@n8n/tournament/dist/Evaluator.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=Evaluator.js.map
|
||||
1
node_modules/@n8n/tournament/dist/Evaluator.js.map
generated
vendored
Normal file
1
node_modules/@n8n/tournament/dist/Evaluator.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Evaluator.js","sourceRoot":"","sources":["../src/Evaluator.ts"],"names":[],"mappings":""}
|
||||
15
node_modules/@n8n/tournament/dist/ExpressionBuilder.d.ts
generated
vendored
Normal file
15
node_modules/@n8n/tournament/dist/ExpressionBuilder.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { types } from 'recast';
|
||||
import type { ExpressionCode, ExpressionText } from './ExpressionSplitter';
|
||||
import type { TournamentHooks } from './ast';
|
||||
export interface ExpressionAnalysis {
|
||||
has: {
|
||||
function: boolean;
|
||||
templateString: boolean;
|
||||
};
|
||||
}
|
||||
type ParsedCode = ExpressionCode & {
|
||||
parsed: types.namedTypes.File;
|
||||
};
|
||||
export declare const getParsedExpression: (expr: string) => Array<ExpressionText | ParsedCode>;
|
||||
export declare const getExpressionCode: (expr: string, dataNodeName: string, hooks: TournamentHooks) => [string, ExpressionAnalysis];
|
||||
export {};
|
||||
186
node_modules/@n8n/tournament/dist/ExpressionBuilder.js
generated
vendored
Normal file
186
node_modules/@n8n/tournament/dist/ExpressionBuilder.js
generated
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getExpressionCode = exports.getParsedExpression = void 0;
|
||||
const recast_1 = require("recast");
|
||||
const ast_types_1 = require("ast-types");
|
||||
const VariablePolyfill_1 = require("./VariablePolyfill");
|
||||
const ExpressionSplitter_1 = require("./ExpressionSplitter");
|
||||
const Parser_1 = require("./Parser");
|
||||
const v = ast_types_1.builders.identifier('v');
|
||||
const shouldAlwaysWrapList = ['window', 'global', 'this'];
|
||||
const shouldWrapInTry = (node) => {
|
||||
let shouldWrap = false;
|
||||
(0, recast_1.visit)(node, {
|
||||
visitMemberExpression() {
|
||||
shouldWrap = true;
|
||||
return false;
|
||||
},
|
||||
visitCallExpression() {
|
||||
shouldWrap = true;
|
||||
return false;
|
||||
},
|
||||
visitIdentifier(path) {
|
||||
if (shouldAlwaysWrapList.includes(path.node.name)) {
|
||||
shouldWrap = true;
|
||||
return false;
|
||||
}
|
||||
this.traverse(path);
|
||||
return;
|
||||
},
|
||||
});
|
||||
return shouldWrap;
|
||||
};
|
||||
const hasFunction = (node) => {
|
||||
let hasFn = false;
|
||||
(0, recast_1.visit)(node, {
|
||||
visitFunctionExpression() {
|
||||
hasFn = true;
|
||||
return false;
|
||||
},
|
||||
visitFunctionDeclaration() {
|
||||
hasFn = true;
|
||||
return false;
|
||||
},
|
||||
visitArrowFunctionExpression() {
|
||||
hasFn = true;
|
||||
return false;
|
||||
},
|
||||
});
|
||||
return hasFn;
|
||||
};
|
||||
const hasTemplateString = (node) => {
|
||||
let hasTemp = false;
|
||||
(0, recast_1.visit)(node, {
|
||||
visitTemplateLiteral(path) {
|
||||
if (path.node.expressions.length) {
|
||||
hasTemp = true;
|
||||
return false;
|
||||
}
|
||||
this.traverse(path);
|
||||
return;
|
||||
},
|
||||
});
|
||||
return hasTemp;
|
||||
};
|
||||
const wrapInErrorHandler = (node) => {
|
||||
return ast_types_1.builders.tryStatement(ast_types_1.builders.blockStatement([node]), ast_types_1.builders.catchClause(ast_types_1.builders.identifier('e'), null, ast_types_1.builders.blockStatement([
|
||||
ast_types_1.builders.expressionStatement(ast_types_1.builders.callExpression(ast_types_1.builders.identifier('E'), [ast_types_1.builders.identifier('e'), ast_types_1.builders.thisExpression()])),
|
||||
])));
|
||||
};
|
||||
const maybeWrapExpr = (expr) => {
|
||||
if (expr.trimStart()[0] === '{') {
|
||||
return '(' + expr + ')';
|
||||
}
|
||||
return expr;
|
||||
};
|
||||
const buildFunctionBody = (expr) => {
|
||||
return ast_types_1.builders.blockStatement([
|
||||
ast_types_1.builders.expressionStatement(ast_types_1.builders.assignmentExpression('=', v, expr)),
|
||||
ast_types_1.builders.returnStatement(ast_types_1.builders.conditionalExpression(ast_types_1.builders.logicalExpression('||', ast_types_1.builders.logicalExpression('||', v, ast_types_1.builders.binaryExpression('===', v, ast_types_1.builders.literal(0))), ast_types_1.builders.binaryExpression('===', v, ast_types_1.builders.literal(false))), v, ast_types_1.builders.literal(''))),
|
||||
]);
|
||||
};
|
||||
const fixStringNewLines = (node) => {
|
||||
const replace = (str) => {
|
||||
return str.replace(/\n/g, '\\n');
|
||||
};
|
||||
(0, recast_1.visit)(node, {
|
||||
visitTemplateElement(path) {
|
||||
this.traverse(path);
|
||||
const el = ast_types_1.builders.templateElement({
|
||||
cooked: path.node.value.cooked === null ? null : replace(path.node.value.cooked),
|
||||
raw: replace(path.node.value.raw),
|
||||
}, path.node.tail);
|
||||
path.replace(el);
|
||||
},
|
||||
});
|
||||
return node;
|
||||
};
|
||||
const getParsedExpression = (expr) => {
|
||||
return (0, ExpressionSplitter_1.splitExpression)(expr).map((chunk) => {
|
||||
if (chunk.type === 'code') {
|
||||
const code = maybeWrapExpr(chunk.text);
|
||||
const node = (0, recast_1.parse)(code, {
|
||||
parser: { parse: Parser_1.parseWithEsprimaNext },
|
||||
});
|
||||
return { ...chunk, parsed: node };
|
||||
}
|
||||
return chunk;
|
||||
});
|
||||
};
|
||||
exports.getParsedExpression = getParsedExpression;
|
||||
const getExpressionCode = (expr, dataNodeName, hooks) => {
|
||||
var _a, _b;
|
||||
const chunks = (0, exports.getParsedExpression)(expr);
|
||||
const newProg = ast_types_1.builders.program([
|
||||
ast_types_1.builders.variableDeclaration('var', [ast_types_1.builders.variableDeclarator(VariablePolyfill_1.globalIdentifier, ast_types_1.builders.objectExpression([]))]),
|
||||
]);
|
||||
let dataNode = ast_types_1.builders.thisExpression();
|
||||
const hasFn = chunks.filter((c) => c.type === 'code').some((c) => hasFunction(c.parsed));
|
||||
if (hasFn) {
|
||||
dataNode = ast_types_1.builders.identifier(dataNodeName);
|
||||
newProg.body.push(ast_types_1.builders.variableDeclaration('var', [ast_types_1.builders.variableDeclarator(dataNode, ast_types_1.builders.thisExpression())]));
|
||||
}
|
||||
const hasTempString = chunks.filter((c) => c.type === 'code').some((c) => hasTemplateString(c.parsed));
|
||||
if (chunks.length > 2 ||
|
||||
chunks[0].text !== '' ||
|
||||
(chunks[0].text === '' && chunks.length === 1)) {
|
||||
let parts = [];
|
||||
for (const chunk of chunks) {
|
||||
if (chunk.type === 'text') {
|
||||
parts.push(ast_types_1.builders.literal(chunk.text));
|
||||
}
|
||||
else {
|
||||
const fixed = fixStringNewLines(chunk.parsed);
|
||||
for (const hook of hooks.before) {
|
||||
hook(fixed, dataNode);
|
||||
}
|
||||
const parsed = (_a = (0, VariablePolyfill_1.jsVariablePolyfill)(fixed, dataNode)) === null || _a === void 0 ? void 0 : _a[0];
|
||||
if (!parsed || parsed.type !== 'ExpressionStatement') {
|
||||
throw new SyntaxError('Not a expression statement');
|
||||
}
|
||||
for (const hook of hooks.after) {
|
||||
hook(parsed, dataNode);
|
||||
}
|
||||
const functionBody = buildFunctionBody(parsed.expression);
|
||||
if (shouldWrapInTry(parsed)) {
|
||||
functionBody.body = [
|
||||
wrapInErrorHandler(functionBody.body[0]),
|
||||
ast_types_1.builders.expressionStatement(ast_types_1.builders.identifier('')),
|
||||
functionBody.body[1],
|
||||
];
|
||||
}
|
||||
parts.push(ast_types_1.builders.callExpression(ast_types_1.builders.memberExpression(ast_types_1.builders.functionExpression(null, [v], functionBody), ast_types_1.builders.identifier('call')), [ast_types_1.builders.thisExpression()]));
|
||||
}
|
||||
}
|
||||
if (chunks.length < 2) {
|
||||
newProg.body.push(ast_types_1.builders.returnStatement(parts[0]));
|
||||
}
|
||||
else {
|
||||
parts = parts.filter((i) => !(i.type === 'Literal' && i.value === ''));
|
||||
newProg.body.push(ast_types_1.builders.returnStatement(ast_types_1.builders.callExpression(ast_types_1.builders.memberExpression(ast_types_1.builders.arrayExpression(parts), ast_types_1.builders.identifier('join')), [
|
||||
ast_types_1.builders.literal(''),
|
||||
])));
|
||||
}
|
||||
}
|
||||
else {
|
||||
const fixed = fixStringNewLines(chunks[1].parsed);
|
||||
for (const hook of hooks.before) {
|
||||
hook(fixed, dataNode);
|
||||
}
|
||||
const parsed = (_b = (0, VariablePolyfill_1.jsVariablePolyfill)(fixed, dataNode)) === null || _b === void 0 ? void 0 : _b[0];
|
||||
if (!parsed || parsed.type !== 'ExpressionStatement') {
|
||||
throw new SyntaxError('Not a expression statement');
|
||||
}
|
||||
for (const hook of hooks.after) {
|
||||
hook(parsed, dataNode);
|
||||
}
|
||||
let retData = ast_types_1.builders.returnStatement(parsed.expression);
|
||||
if (shouldWrapInTry(parsed)) {
|
||||
retData = wrapInErrorHandler(retData);
|
||||
}
|
||||
newProg.body.push(retData);
|
||||
}
|
||||
return [(0, recast_1.print)(newProg).code, { has: { function: hasFn, templateString: hasTempString } }];
|
||||
};
|
||||
exports.getExpressionCode = getExpressionCode;
|
||||
//# sourceMappingURL=ExpressionBuilder.js.map
|
||||
1
node_modules/@n8n/tournament/dist/ExpressionBuilder.js.map
generated
vendored
Normal file
1
node_modules/@n8n/tournament/dist/ExpressionBuilder.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
13
node_modules/@n8n/tournament/dist/ExpressionSplitter.d.ts
generated
vendored
Normal file
13
node_modules/@n8n/tournament/dist/ExpressionSplitter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
export interface ExpressionText {
|
||||
type: 'text';
|
||||
text: string;
|
||||
}
|
||||
export interface ExpressionCode {
|
||||
type: 'code';
|
||||
text: string;
|
||||
hasClosingBrackets: boolean;
|
||||
}
|
||||
export type ExpressionChunk = ExpressionCode | ExpressionText;
|
||||
export declare const escapeCode: (text: string) => string;
|
||||
export declare const splitExpression: (expression: string) => ExpressionChunk[];
|
||||
export declare const joinExpression: (parts: ExpressionChunk[]) => string;
|
||||
87
node_modules/@n8n/tournament/dist/ExpressionSplitter.js
generated
vendored
Normal file
87
node_modules/@n8n/tournament/dist/ExpressionSplitter.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.joinExpression = exports.splitExpression = exports.escapeCode = void 0;
|
||||
const OPEN_BRACKET = /(?<brackets>\{\{)/;
|
||||
const CLOSE_BRACKET = /(?<brackets>\}\})/;
|
||||
const escapeCode = (text) => {
|
||||
return text.replace('\\}}', '}}');
|
||||
};
|
||||
exports.escapeCode = escapeCode;
|
||||
const normalizeBackslashes = (text) => {
|
||||
return text.replace(/\\\\/g, '\\');
|
||||
};
|
||||
const splitExpression = (expression) => {
|
||||
var _a, _b, _c;
|
||||
const chunks = [];
|
||||
let searchingFor = 'open';
|
||||
let activeRegex = OPEN_BRACKET;
|
||||
let buffer = '';
|
||||
let index = 0;
|
||||
while (index < expression.length) {
|
||||
const expr = expression.slice(index);
|
||||
const res = activeRegex.exec(expr);
|
||||
if (!(res === null || res === void 0 ? void 0 : res.groups)) {
|
||||
buffer += expr;
|
||||
if (searchingFor === 'open') {
|
||||
chunks.push({
|
||||
type: 'text',
|
||||
text: buffer,
|
||||
});
|
||||
}
|
||||
else {
|
||||
chunks.push({
|
||||
type: 'code',
|
||||
text: (0, exports.escapeCode)(buffer),
|
||||
hasClosingBrackets: false,
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
const beforeMatch = expr.slice(0, res.index);
|
||||
const backslashCount = (_c = (_b = (_a = beforeMatch.match(/\\*$/)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
|
||||
const isEscaped = backslashCount % 2 === 1;
|
||||
if (isEscaped) {
|
||||
buffer += expr.slice(0, res.index + '{{'.length);
|
||||
index += res.index + '{{'.length;
|
||||
}
|
||||
else {
|
||||
buffer += expr.slice(0, res.index);
|
||||
if (searchingFor === 'open') {
|
||||
chunks.push({
|
||||
type: 'text',
|
||||
text: normalizeBackslashes(buffer),
|
||||
});
|
||||
searchingFor = 'close';
|
||||
activeRegex = CLOSE_BRACKET;
|
||||
}
|
||||
else {
|
||||
chunks.push({
|
||||
type: 'code',
|
||||
text: (0, exports.escapeCode)(buffer),
|
||||
hasClosingBrackets: true,
|
||||
});
|
||||
searchingFor = 'open';
|
||||
activeRegex = OPEN_BRACKET;
|
||||
}
|
||||
index += res.index + 2;
|
||||
buffer = '';
|
||||
}
|
||||
}
|
||||
return chunks;
|
||||
};
|
||||
exports.splitExpression = splitExpression;
|
||||
const escapeTmplExpression = (part) => {
|
||||
return part.replace('}}', '\\}}');
|
||||
};
|
||||
const joinExpression = (parts) => {
|
||||
return parts
|
||||
.map((chunk) => {
|
||||
if (chunk.type === 'code') {
|
||||
return `{{${escapeTmplExpression(chunk.text)}${chunk.hasClosingBrackets ? '}}' : ''}`;
|
||||
}
|
||||
return chunk.text;
|
||||
})
|
||||
.join('');
|
||||
};
|
||||
exports.joinExpression = joinExpression;
|
||||
//# sourceMappingURL=ExpressionSplitter.js.map
|
||||
1
node_modules/@n8n/tournament/dist/ExpressionSplitter.js.map
generated
vendored
Normal file
1
node_modules/@n8n/tournament/dist/ExpressionSplitter.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ExpressionSplitter.js","sourceRoot":"","sources":["../src/ExpressionSplitter.ts"],"names":[],"mappings":";;;AAeA,MAAM,YAAY,GAAG,mBAAmB,CAAC;AACzC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAEnC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE;IAClD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACnC,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEF,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAU,EAAE;IACrD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC,CAAC;AAEK,MAAM,eAAe,GAAG,CAAC,UAAkB,EAAqB,EAAE;;IACxE,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,IAAI,YAAY,GAAqB,MAAM,CAAC;IAC5C,IAAI,WAAW,GAAG,YAAY,CAAC;IAE/B,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,KAAK,GAAG,UAAU,CAAC,MAAM,EAAE;QACjC,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrC,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAInC,IAAI,CAAC,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,CAAA,EAAE;YACjB,MAAM,IAAI,IAAI,CAAC;YACf,IAAI,YAAY,KAAK,MAAM,EAAE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B,CAAC,CAAC;gBACH,YAAY,GAAG,MAAM,CAAC;gBACtB,WAAW,GAAG,YAAY,CAAC;aAC3B;YAED,KAAK,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;YACvB,MAAM,GAAG,EAAE,CAAC;SACZ;KACD;IAED,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AAjEW,QAAA,eAAe,mBAiE1B;AAGF,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAE,EAAE;IAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACnC,CAAC,CAAC;AAEK,MAAM,cAAc,GAAG,CAAC,KAAwB,EAAU,EAAE;IAClE,OAAO,KAAK;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACd,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE;YAC1B,OAAO,KAAK,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;SACtF;QACD,OAAO,KAAK,CAAC,IAAI,CAAC;IACnB,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,CAAC,CAAC;AACZ,CAAC,CAAC;AATW,QAAA,cAAc,kBASzB"}
|
||||
8
node_modules/@n8n/tournament/dist/FunctionEvaluator.d.ts
generated
vendored
Normal file
8
node_modules/@n8n/tournament/dist/FunctionEvaluator.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { ExpressionEvaluator, ReturnValue, Tournament } from '.';
|
||||
export declare class FunctionEvaluator implements ExpressionEvaluator {
|
||||
private instance;
|
||||
private _codeCache;
|
||||
constructor(instance: Tournament);
|
||||
private getFunction;
|
||||
evaluate(expr: string, data: unknown): ReturnValue;
|
||||
}
|
||||
24
node_modules/@n8n/tournament/dist/FunctionEvaluator.js
generated
vendored
Normal file
24
node_modules/@n8n/tournament/dist/FunctionEvaluator.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FunctionEvaluator = void 0;
|
||||
class FunctionEvaluator {
|
||||
constructor(instance) {
|
||||
this.instance = instance;
|
||||
this._codeCache = {};
|
||||
}
|
||||
getFunction(expr) {
|
||||
if (expr in this._codeCache) {
|
||||
return this._codeCache[expr];
|
||||
}
|
||||
const [code] = this.instance.getExpressionCode(expr);
|
||||
const func = new Function('E', code + ';');
|
||||
this._codeCache[expr] = func;
|
||||
return func;
|
||||
}
|
||||
evaluate(expr, data) {
|
||||
const fn = this.getFunction(expr);
|
||||
return fn.call(data, this.instance.errorHandler);
|
||||
}
|
||||
}
|
||||
exports.FunctionEvaluator = FunctionEvaluator;
|
||||
//# sourceMappingURL=FunctionEvaluator.js.map
|
||||
1
node_modules/@n8n/tournament/dist/FunctionEvaluator.js.map
generated
vendored
Normal file
1
node_modules/@n8n/tournament/dist/FunctionEvaluator.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"FunctionEvaluator.js","sourceRoot":"","sources":["../src/FunctionEvaluator.ts"],"names":[],"mappings":";;;AAEA,MAAa,iBAAiB;IAG7B,YAAoB,QAAoB;QAApB,aAAQ,GAAR,QAAQ,CAAY;QAFhC,eAAU,GAA6B,EAAE,CAAC;IAEP,CAAC;IAEpC,WAAW,CAAC,IAAY;QAC/B,IAAI,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;YAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SAC7B;QACD,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACrD,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,GAAG,EAAE,IAAI,GAAG,GAAG,CAAC,CAAC;QAC3C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAC7B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,QAAQ,CAAC,IAAY,EAAE,IAAa;QACnC,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAClC,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAClD,CAAC;CACD;AAnBD,8CAmBC"}
|
||||
1
node_modules/@n8n/tournament/dist/Parser.d.ts
generated
vendored
Normal file
1
node_modules/@n8n/tournament/dist/Parser.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function parseWithEsprimaNext(source: string, options?: any): any;
|
||||
27
node_modules/@n8n/tournament/dist/Parser.js
generated
vendored
Normal file
27
node_modules/@n8n/tournament/dist/Parser.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseWithEsprimaNext = void 0;
|
||||
const esprima_next_1 = require("esprima-next");
|
||||
const util_1 = require("recast/lib/util");
|
||||
function parseWithEsprimaNext(source, options) {
|
||||
try {
|
||||
const ast = (0, esprima_next_1.parse)(source, {
|
||||
loc: true,
|
||||
locations: true,
|
||||
comment: true,
|
||||
range: (0, util_1.getOption)(options, 'range', false),
|
||||
tolerant: (0, util_1.getOption)(options, 'tolerant', true),
|
||||
tokens: true,
|
||||
jsx: (0, util_1.getOption)(options, 'jsx', false),
|
||||
sourceType: (0, util_1.getOption)(options, 'sourceType', 'module'),
|
||||
});
|
||||
return ast;
|
||||
}
|
||||
catch (error) {
|
||||
if (error instanceof Error)
|
||||
throw new SyntaxError(error.message);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
exports.parseWithEsprimaNext = parseWithEsprimaNext;
|
||||
//# sourceMappingURL=Parser.js.map
|
||||
1
node_modules/@n8n/tournament/dist/Parser.js.map
generated
vendored
Normal file
1
node_modules/@n8n/tournament/dist/Parser.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Parser.js","sourceRoot":"","sources":["../src/Parser.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AAErD,0CAA4C;AAE5C,SAAgB,oBAAoB,CAAC,MAAc,EAAE,OAAa;IACjE,IAAI;QACH,MAAM,GAAG,GAAG,IAAA,oBAAY,EAAC,MAAM,EAAE;YAChC,GAAG,EAAE,IAAI;YACT,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,IAAA,gBAAS,EAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAY;YACpD,QAAQ,EAAE,IAAA,gBAAS,EAAC,OAAO,EAAE,UAAU,EAAE,IAAI,CAAY;YACzD,MAAM,EAAE,IAAI;YACZ,GAAG,EAAE,IAAA,gBAAS,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAY;YAChD,UAAU,EAAE,IAAA,gBAAS,EAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,CAAW;SAC/C,CAAC,CAAC;QAEpB,OAAO,GAAG,CAAC;KACX;IAAC,OAAO,KAAK,EAAE;QACf,IAAI,KAAK,YAAY,KAAK;YAAE,MAAM,IAAI,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACjE,MAAM,KAAK,CAAC;KACZ;AACF,CAAC;AAlBD,oDAkBC"}
|
||||
6
node_modules/@n8n/tournament/dist/VariablePolyfill.d.ts
generated
vendored
Normal file
6
node_modules/@n8n/tournament/dist/VariablePolyfill.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { types } from 'recast';
|
||||
import type { StatementKind } from 'ast-types/lib/gen/kinds';
|
||||
import type { namedTypes } from 'ast-types';
|
||||
export declare const globalIdentifier: namedTypes.Identifier;
|
||||
export type DataNode = namedTypes.ThisExpression | namedTypes.Identifier;
|
||||
export declare const jsVariablePolyfill: (ast: types.namedTypes.File, dataNode: DataNode) => StatementKind[] | undefined;
|
||||
253
node_modules/@n8n/tournament/dist/VariablePolyfill.js
generated
vendored
Normal file
253
node_modules/@n8n/tournament/dist/VariablePolyfill.js
generated
vendored
Normal file
@@ -0,0 +1,253 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.jsVariablePolyfill = exports.globalIdentifier = void 0;
|
||||
const recast_1 = require("recast");
|
||||
const ast_types_1 = require("ast-types");
|
||||
const Constants_1 = require("./Constants");
|
||||
function assertNever(value) {
|
||||
return true;
|
||||
}
|
||||
exports.globalIdentifier = ast_types_1.builders.identifier(typeof window !== 'object' ? 'global' : 'window');
|
||||
const buildGlobalSwitch = (node, dataNode) => {
|
||||
return ast_types_1.builders.memberExpression(ast_types_1.builders.conditionalExpression(ast_types_1.builders.binaryExpression('in', ast_types_1.builders.literal(node.name), dataNode), dataNode, exports.globalIdentifier), ast_types_1.builders.identifier(node.name));
|
||||
};
|
||||
const isInScope = (path) => {
|
||||
let scope = path.scope;
|
||||
while (scope !== null) {
|
||||
if (scope.declares(path.node.name)) {
|
||||
return true;
|
||||
}
|
||||
scope = scope.parent;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const polyfillExceptions = ['this', 'window', 'global'];
|
||||
const polyfillVar = (path, dataNode, force = false) => {
|
||||
if (!force) {
|
||||
if (isInScope(path)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (polyfillExceptions.includes(path.node.name)) {
|
||||
return;
|
||||
}
|
||||
path.replace(buildGlobalSwitch(path.node, dataNode));
|
||||
};
|
||||
const customPatches = {
|
||||
MemberExpression(path, parent, dataNode) {
|
||||
if (parent.object === path.node || parent.computed) {
|
||||
polyfillVar(path, dataNode);
|
||||
}
|
||||
},
|
||||
OptionalMemberExpression(path, parent, dataNode) {
|
||||
if (parent.object === path.node) {
|
||||
polyfillVar(path, dataNode);
|
||||
}
|
||||
},
|
||||
Property(path, parent, dataNode) {
|
||||
var _a, _b, _c;
|
||||
if (path.node !== parent.value) {
|
||||
return;
|
||||
}
|
||||
const objPattern = (_b = (_a = path.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.node;
|
||||
if (!objPattern) {
|
||||
return;
|
||||
}
|
||||
const objParent = (_c = path.parent.parent.parent) === null || _c === void 0 ? void 0 : _c.node;
|
||||
if (!objParent) {
|
||||
return;
|
||||
}
|
||||
if (objParent.type === 'VariableDeclarator' && objParent.id === objPattern) {
|
||||
return;
|
||||
}
|
||||
parent.shorthand = false;
|
||||
polyfillVar(path, dataNode);
|
||||
},
|
||||
AssignmentPattern(path, parent, dataNode) {
|
||||
if (parent.right === path.node) {
|
||||
polyfillVar(path, dataNode);
|
||||
}
|
||||
},
|
||||
VariableDeclarator(path, parent, dataNode) {
|
||||
if (parent.init === path.node) {
|
||||
polyfillVar(path, dataNode);
|
||||
}
|
||||
},
|
||||
};
|
||||
const jsVariablePolyfill = (ast, dataNode) => {
|
||||
(0, recast_1.visit)(ast, {
|
||||
visitImportExpression(_path) {
|
||||
throw new Error('Imports are not supported');
|
||||
},
|
||||
visitIdentifier(path) {
|
||||
this.traverse(path);
|
||||
const parent = path.parent.node;
|
||||
if (Constants_1.EXEMPT_IDENTIFIER_LIST.includes(path.node.name)) {
|
||||
return;
|
||||
}
|
||||
switch (parent.type) {
|
||||
case 'AssignmentPattern':
|
||||
case 'Property':
|
||||
case 'MemberExpression':
|
||||
case 'OptionalMemberExpression':
|
||||
case 'VariableDeclarator':
|
||||
if (!customPatches[parent.type]) {
|
||||
throw new Error(`Couldn\'t find custom patcher for parent type: ${parent.type}`);
|
||||
}
|
||||
customPatches[parent.type](path, parent, dataNode);
|
||||
break;
|
||||
case 'BinaryExpression':
|
||||
case 'UnaryExpression':
|
||||
case 'ArrayExpression':
|
||||
case 'AssignmentExpression':
|
||||
case 'SequenceExpression':
|
||||
case 'YieldExpression':
|
||||
case 'UpdateExpression':
|
||||
case 'LogicalExpression':
|
||||
case 'ConditionalExpression':
|
||||
case 'NewExpression':
|
||||
case 'CallExpression':
|
||||
case 'OptionalCallExpression':
|
||||
case 'TaggedTemplateExpression':
|
||||
case 'TemplateLiteral':
|
||||
case 'AwaitExpression':
|
||||
case 'ImportExpression':
|
||||
case 'ForStatement':
|
||||
case 'IfStatement':
|
||||
case 'WhileStatement':
|
||||
case 'ForInStatement':
|
||||
case 'ForOfStatement':
|
||||
case 'SwitchStatement':
|
||||
case 'ReturnStatement':
|
||||
case 'DoWhileStatement':
|
||||
case 'ExpressionStatement':
|
||||
case 'ForAwaitStatement':
|
||||
case 'ThrowStatement':
|
||||
case 'WithStatement':
|
||||
case 'TupleExpression':
|
||||
polyfillVar(path, dataNode);
|
||||
break;
|
||||
case 'Super':
|
||||
case 'Identifier':
|
||||
case 'ArrowFunctionExpression':
|
||||
case 'FunctionDeclaration':
|
||||
case 'FunctionExpression':
|
||||
case 'ThisExpression':
|
||||
case 'ObjectExpression':
|
||||
case 'MetaProperty':
|
||||
case 'ChainExpression':
|
||||
case 'PrivateName':
|
||||
case 'ParenthesizedExpression':
|
||||
case 'Import':
|
||||
case 'VariableDeclaration':
|
||||
case 'CatchClause':
|
||||
case 'BlockStatement':
|
||||
case 'TryStatement':
|
||||
case 'EmptyStatement':
|
||||
case 'LabeledStatement':
|
||||
case 'BreakStatement':
|
||||
case 'ContinueStatement':
|
||||
case 'DebuggerStatement':
|
||||
case 'ImportDeclaration':
|
||||
case 'ExportDeclaration':
|
||||
case 'ExportAllDeclaration':
|
||||
case 'ExportDefaultDeclaration':
|
||||
case 'Noop':
|
||||
case 'ClassMethod':
|
||||
case 'ClassPrivateMethod':
|
||||
case 'RestElement':
|
||||
case 'ArrayPattern':
|
||||
case 'ObjectPattern':
|
||||
case 'ClassExpression':
|
||||
case 'RecordExpression':
|
||||
case 'V8IntrinsicIdentifier':
|
||||
case 'TopicReference':
|
||||
case 'MethodDefinition':
|
||||
case 'ClassDeclaration':
|
||||
case 'ClassProperty':
|
||||
case 'StaticBlock':
|
||||
case 'ClassBody':
|
||||
case 'ExportNamedDeclaration':
|
||||
case 'ClassPrivateProperty':
|
||||
case 'ClassAccessorProperty':
|
||||
case 'PropertyPattern':
|
||||
break;
|
||||
case 'SpreadElementPattern':
|
||||
case 'SpreadPropertyPattern':
|
||||
case 'ClassPropertyDefinition':
|
||||
break;
|
||||
case 'DeclareClass':
|
||||
case 'DeclareModule':
|
||||
case 'DeclareVariable':
|
||||
case 'DeclareFunction':
|
||||
case 'DeclareInterface':
|
||||
case 'DeclareTypeAlias':
|
||||
case 'DeclareOpaqueType':
|
||||
case 'DeclareModuleExports':
|
||||
case 'DeclareExportDeclaration':
|
||||
case 'DeclareExportAllDeclaration':
|
||||
case 'InterfaceDeclaration':
|
||||
case 'TypeAlias':
|
||||
case 'OpaqueType':
|
||||
case 'EnumDeclaration':
|
||||
case 'TypeCastExpression':
|
||||
break;
|
||||
case 'TSAsExpression':
|
||||
case 'TSTypeParameter':
|
||||
case 'TSTypeAssertion':
|
||||
case 'TSDeclareMethod':
|
||||
case 'TSIndexSignature':
|
||||
case 'TSDeclareFunction':
|
||||
case 'TSMethodSignature':
|
||||
case 'TSEnumDeclaration':
|
||||
case 'TSExportAssignment':
|
||||
case 'TSNonNullExpression':
|
||||
case 'TSPropertySignature':
|
||||
case 'TSModuleDeclaration':
|
||||
case 'TSParameterProperty':
|
||||
case 'TSTypeCastExpression':
|
||||
case 'TSSatisfiesExpression':
|
||||
case 'TSTypeAliasDeclaration':
|
||||
case 'TSInterfaceDeclaration':
|
||||
case 'TSImportEqualsDeclaration':
|
||||
case 'TSExternalModuleReference':
|
||||
case 'TSInstantiationExpression':
|
||||
case 'TSTypeParameterDeclaration':
|
||||
case 'TSCallSignatureDeclaration':
|
||||
case 'TSNamespaceExportDeclaration':
|
||||
case 'TSConstructSignatureDeclaration':
|
||||
break;
|
||||
case 'DirectiveLiteral':
|
||||
case 'StringLiteral':
|
||||
case 'NumericLiteral':
|
||||
case 'BigIntLiteral':
|
||||
case 'NullLiteral':
|
||||
case 'Literal':
|
||||
case 'RegExpLiteral':
|
||||
case 'BooleanLiteral':
|
||||
case 'DecimalLiteral':
|
||||
break;
|
||||
case 'DoExpression':
|
||||
case 'BindExpression':
|
||||
break;
|
||||
case 'JSXIdentifier':
|
||||
case 'JSXText':
|
||||
case 'JSXElement':
|
||||
case 'JSXFragment':
|
||||
case 'JSXMemberExpression':
|
||||
case 'JSXExpressionContainer':
|
||||
break;
|
||||
case 'ComprehensionExpression':
|
||||
case 'GeneratorExpression':
|
||||
polyfillVar(path, dataNode);
|
||||
break;
|
||||
default:
|
||||
assertNever(parent);
|
||||
break;
|
||||
}
|
||||
},
|
||||
});
|
||||
return ast.program.body;
|
||||
};
|
||||
exports.jsVariablePolyfill = jsVariablePolyfill;
|
||||
//# sourceMappingURL=VariablePolyfill.js.map
|
||||
1
node_modules/@n8n/tournament/dist/VariablePolyfill.js.map
generated
vendored
Normal file
1
node_modules/@n8n/tournament/dist/VariablePolyfill.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
11
node_modules/@n8n/tournament/dist/ast.d.ts
generated
vendored
Normal file
11
node_modules/@n8n/tournament/dist/ast.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
export type { types as astTypes } from 'recast';
|
||||
export { visit as astVisit } from 'recast';
|
||||
export { builders as astBuilders, type namedTypes as astNamedTypes } from 'ast-types';
|
||||
import type { types } from 'recast';
|
||||
import type { namedTypes } from 'ast-types';
|
||||
export interface TournamentHooks {
|
||||
before: ASTBeforeHook[];
|
||||
after: ASTAfterHook[];
|
||||
}
|
||||
export type ASTAfterHook = (ast: namedTypes.ExpressionStatement, dataNode: namedTypes.ThisExpression | namedTypes.Identifier) => void;
|
||||
export type ASTBeforeHook = (ast: types.namedTypes.File, dataNode: namedTypes.ThisExpression | namedTypes.Identifier) => void;
|
||||
8
node_modules/@n8n/tournament/dist/ast.js
generated
vendored
Normal file
8
node_modules/@n8n/tournament/dist/ast.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.astBuilders = exports.astVisit = void 0;
|
||||
var recast_1 = require("recast");
|
||||
Object.defineProperty(exports, "astVisit", { enumerable: true, get: function () { return recast_1.visit; } });
|
||||
var ast_types_1 = require("ast-types");
|
||||
Object.defineProperty(exports, "astBuilders", { enumerable: true, get: function () { return ast_types_1.builders; } });
|
||||
//# sourceMappingURL=ast.js.map
|
||||
1
node_modules/@n8n/tournament/dist/ast.js.map
generated
vendored
Normal file
1
node_modules/@n8n/tournament/dist/ast.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ast.js","sourceRoot":"","sources":["../src/ast.ts"],"names":[],"mappings":";;;AACA,iCAA2C;AAAlC,kGAAA,KAAK,OAAY;AAC1B,uCAAsF;AAA7E,wGAAA,QAAQ,OAAe"}
|
||||
1
node_modules/@n8n/tournament/dist/build.tsbuildinfo
generated
vendored
Normal file
1
node_modules/@n8n/tournament/dist/build.tsbuildinfo
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
18
node_modules/@n8n/tournament/dist/index.d.ts
generated
vendored
Normal file
18
node_modules/@n8n/tournament/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { ExpressionAnalysis } from './ExpressionBuilder';
|
||||
import type { ExpressionEvaluatorClass } from './Evaluator';
|
||||
import type { TournamentHooks } from './ast';
|
||||
export type { TmplDifference } from './Analysis';
|
||||
export type { ExpressionEvaluator, ExpressionEvaluatorClass } from './Evaluator';
|
||||
export * from './ast';
|
||||
export type ReturnValue = string | null | (() => unknown);
|
||||
export declare class Tournament {
|
||||
errorHandler: (error: Error) => void;
|
||||
private _dataNodeName;
|
||||
private readonly astHooks;
|
||||
private evaluator;
|
||||
constructor(errorHandler?: (error: Error) => void, _dataNodeName?: string, Evaluator?: ExpressionEvaluatorClass, astHooks?: TournamentHooks);
|
||||
setEvaluator(Evaluator: ExpressionEvaluatorClass): void;
|
||||
getExpressionCode(expr: string): [string, ExpressionAnalysis];
|
||||
tmplDiff(expr: string): import("./Analysis").TmplDifference;
|
||||
execute(expr: string, data: unknown): ReturnValue;
|
||||
}
|
||||
47
node_modules/@n8n/tournament/dist/index.js
generated
vendored
Normal file
47
node_modules/@n8n/tournament/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
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.Tournament = void 0;
|
||||
const ExpressionBuilder_1 = require("./ExpressionBuilder");
|
||||
const Analysis_1 = require("./Analysis");
|
||||
const FunctionEvaluator_1 = require("./FunctionEvaluator");
|
||||
__exportStar(require("./ast"), exports);
|
||||
const DATA_NODE_NAME = '___n8n_data';
|
||||
class Tournament {
|
||||
constructor(errorHandler = () => { }, _dataNodeName = DATA_NODE_NAME, Evaluator = FunctionEvaluator_1.FunctionEvaluator, astHooks = { before: [], after: [] }) {
|
||||
this.errorHandler = errorHandler;
|
||||
this._dataNodeName = _dataNodeName;
|
||||
this.astHooks = astHooks;
|
||||
this.setEvaluator(Evaluator);
|
||||
}
|
||||
setEvaluator(Evaluator) {
|
||||
this.evaluator = new Evaluator(this);
|
||||
}
|
||||
getExpressionCode(expr) {
|
||||
return (0, ExpressionBuilder_1.getExpressionCode)(expr, this._dataNodeName, this.astHooks);
|
||||
}
|
||||
tmplDiff(expr) {
|
||||
return (0, Analysis_1.getTmplDifference)(expr, this._dataNodeName);
|
||||
}
|
||||
execute(expr, data) {
|
||||
if (!expr) {
|
||||
return expr;
|
||||
}
|
||||
return this.evaluator.evaluate(expr, data);
|
||||
}
|
||||
}
|
||||
exports.Tournament = Tournament;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@n8n/tournament/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@n8n/tournament/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2DAAwD;AAExD,yCAA+C;AAE/C,2DAAwD;AAKxD,wCAAsB;AAEtB,MAAM,cAAc,GAAG,aAAa,CAAC;AAGrC,MAAa,UAAU;IAGtB,YACQ,eAAuC,GAAG,EAAE,GAAE,CAAC,EAC9C,gBAAwB,cAAc,EAC9C,YAAsC,qCAAiB,EACtC,WAA4B,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QAH/D,iBAAY,GAAZ,YAAY,CAAmC;QAC9C,kBAAa,GAAb,aAAa,CAAyB;QAE7B,aAAQ,GAAR,QAAQ,CAA6C;QAEtE,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;IAED,YAAY,CAAC,SAAmC;QAC/C,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,iBAAiB,CAAC,IAAY;QAC7B,OAAO,IAAA,qCAAiB,EAAC,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnE,CAAC;IAED,QAAQ,CAAC,IAAY;QACpB,OAAO,IAAA,4BAAiB,EAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,CAAC,IAAY,EAAE,IAAa;QAGlC,IAAI,CAAC,IAAI,EAAE;YACV,OAAO,IAAI,CAAC;SACZ;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5C,CAAC;CACD;AAhCD,gCAgCC"}
|
||||
Reference in New Issue
Block a user