@abyss-project/console 1.0.28 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/workflow.api.d.ts +2 -1
- package/dist/api/workflow.api.js +6 -1
- package/dist/expressions/functions/array.d.ts +2 -0
- package/dist/expressions/functions/array.js +252 -0
- package/dist/expressions/functions/crypto.d.ts +2 -0
- package/dist/expressions/functions/crypto.js +101 -0
- package/dist/expressions/functions/datetime.d.ts +2 -0
- package/dist/expressions/functions/datetime.js +256 -0
- package/dist/expressions/functions/index.d.ts +7 -0
- package/dist/expressions/functions/index.js +46 -0
- package/dist/expressions/functions/math.d.ts +2 -0
- package/dist/expressions/functions/math.js +174 -0
- package/dist/expressions/functions/string.d.ts +2 -0
- package/dist/expressions/functions/string.js +301 -0
- package/dist/expressions/functions/utility.d.ts +2 -0
- package/dist/expressions/functions/utility.js +230 -0
- package/dist/expressions/helpers.d.ts +26 -0
- package/dist/expressions/helpers.js +132 -0
- package/dist/expressions/index.d.ts +5 -0
- package/dist/expressions/index.js +16 -0
- package/dist/expressions/mapper.d.ts +9 -0
- package/dist/expressions/mapper.js +88 -0
- package/dist/expressions/parser.d.ts +3 -0
- package/dist/expressions/parser.js +97 -0
- package/dist/expressions/pipes/array-pipes.d.ts +2 -0
- package/dist/expressions/pipes/array-pipes.js +248 -0
- package/dist/expressions/pipes/index.d.ts +8 -0
- package/dist/expressions/pipes/index.js +40 -0
- package/dist/expressions/pipes/object-pipes.d.ts +2 -0
- package/dist/expressions/pipes/object-pipes.js +243 -0
- package/dist/expressions/pipes/string-pipes.d.ts +9 -0
- package/dist/expressions/pipes/string-pipes.js +178 -0
- package/dist/expressions/resolver.d.ts +12 -0
- package/dist/expressions/resolver.js +88 -0
- package/dist/expressions/types.d.ts +36 -0
- package/dist/expressions/types.js +2 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -1
- package/dist/types/interface/api/requests/workflow.request.d.ts +10 -0
- package/dist/types/interface/api/responses/workflow.response.d.ts +4 -0
- package/dist/utils/webhook-trigger.utils.js +10 -6
- package/dist/workflow-expressions/functions/array.d.ts +2 -0
- package/dist/workflow-expressions/functions/array.js +252 -0
- package/dist/workflow-expressions/functions/crypto.d.ts +2 -0
- package/dist/workflow-expressions/functions/crypto.js +101 -0
- package/dist/workflow-expressions/functions/datetime.d.ts +2 -0
- package/dist/workflow-expressions/functions/datetime.js +256 -0
- package/dist/workflow-expressions/functions/index.d.ts +7 -0
- package/dist/workflow-expressions/functions/index.js +46 -0
- package/dist/workflow-expressions/functions/math.d.ts +2 -0
- package/dist/workflow-expressions/functions/math.js +174 -0
- package/dist/workflow-expressions/functions/string.d.ts +2 -0
- package/dist/workflow-expressions/functions/string.js +301 -0
- package/dist/workflow-expressions/functions/utility.d.ts +2 -0
- package/dist/workflow-expressions/functions/utility.js +230 -0
- package/dist/workflow-expressions/helpers.d.ts +26 -0
- package/dist/workflow-expressions/helpers.js +130 -0
- package/dist/workflow-expressions/index.d.ts +15 -0
- package/dist/workflow-expressions/index.js +61 -0
- package/dist/workflow-expressions/parser.d.ts +8 -0
- package/dist/workflow-expressions/parser.js +456 -0
- package/dist/workflow-expressions/pipes/array-pipes.d.ts +2 -0
- package/dist/workflow-expressions/pipes/array-pipes.js +248 -0
- package/dist/workflow-expressions/pipes/index.d.ts +8 -0
- package/dist/workflow-expressions/pipes/index.js +40 -0
- package/dist/workflow-expressions/pipes/object-pipes.d.ts +2 -0
- package/dist/workflow-expressions/pipes/object-pipes.js +243 -0
- package/dist/workflow-expressions/pipes/string-pipes.d.ts +9 -0
- package/dist/workflow-expressions/pipes/string-pipes.js +178 -0
- package/dist/workflow-expressions/resolver.d.ts +8 -0
- package/dist/workflow-expressions/resolver.js +260 -0
- package/dist/workflow-expressions/types.d.ts +141 -0
- package/dist/workflow-expressions/types.js +33 -0
- package/package.json +2 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFunction = exports.hasFunction = exports.getFunctionNames = exports.getFunctionsByCategory = exports.executeFunction = exports.BUILT_IN_FUNCTIONS = void 0;
|
|
4
|
+
const datetime_1 = require("./datetime");
|
|
5
|
+
const string_1 = require("./string");
|
|
6
|
+
const math_1 = require("./math");
|
|
7
|
+
const crypto_1 = require("./crypto");
|
|
8
|
+
const array_1 = require("./array");
|
|
9
|
+
const utility_1 = require("./utility");
|
|
10
|
+
exports.BUILT_IN_FUNCTIONS = {
|
|
11
|
+
...datetime_1.datetimeFunctions,
|
|
12
|
+
...string_1.stringFunctions,
|
|
13
|
+
...math_1.mathFunctions,
|
|
14
|
+
...crypto_1.cryptoFunctions,
|
|
15
|
+
...array_1.arrayFunctions,
|
|
16
|
+
...utility_1.utilityFunctions,
|
|
17
|
+
};
|
|
18
|
+
function executeFunction(name, args) {
|
|
19
|
+
const func = exports.BUILT_IN_FUNCTIONS[name];
|
|
20
|
+
if (!func) {
|
|
21
|
+
throw new Error(`Unknown function: ${name}`);
|
|
22
|
+
}
|
|
23
|
+
return func.execute(...args);
|
|
24
|
+
}
|
|
25
|
+
exports.executeFunction = executeFunction;
|
|
26
|
+
function getFunctionsByCategory(category) {
|
|
27
|
+
return Object.entries(exports.BUILT_IN_FUNCTIONS)
|
|
28
|
+
.filter(([, func]) => func.category === category)
|
|
29
|
+
.reduce((acc, [name, func]) => {
|
|
30
|
+
acc[name] = func;
|
|
31
|
+
return acc;
|
|
32
|
+
}, {});
|
|
33
|
+
}
|
|
34
|
+
exports.getFunctionsByCategory = getFunctionsByCategory;
|
|
35
|
+
function getFunctionNames() {
|
|
36
|
+
return Object.keys(exports.BUILT_IN_FUNCTIONS);
|
|
37
|
+
}
|
|
38
|
+
exports.getFunctionNames = getFunctionNames;
|
|
39
|
+
function hasFunction(name) {
|
|
40
|
+
return name in exports.BUILT_IN_FUNCTIONS;
|
|
41
|
+
}
|
|
42
|
+
exports.hasFunction = hasFunction;
|
|
43
|
+
function getFunction(name) {
|
|
44
|
+
return exports.BUILT_IN_FUNCTIONS[name];
|
|
45
|
+
}
|
|
46
|
+
exports.getFunction = getFunction;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mathFunctions = void 0;
|
|
4
|
+
exports.mathFunctions = {
|
|
5
|
+
abs: {
|
|
6
|
+
name: 'abs',
|
|
7
|
+
description: 'Returns the absolute value of a number',
|
|
8
|
+
category: 'math',
|
|
9
|
+
signature: 'abs(num)',
|
|
10
|
+
args: [
|
|
11
|
+
{
|
|
12
|
+
name: 'num',
|
|
13
|
+
type: 'number',
|
|
14
|
+
required: true,
|
|
15
|
+
description: 'Input number',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
returnType: 'number',
|
|
19
|
+
examples: ['{{fn.abs(-5)}}'],
|
|
20
|
+
execute: (num) => Math.abs(Number(num)),
|
|
21
|
+
},
|
|
22
|
+
ceil: {
|
|
23
|
+
name: 'ceil',
|
|
24
|
+
description: 'Rounds a number up to the nearest integer',
|
|
25
|
+
category: 'math',
|
|
26
|
+
signature: 'ceil(num)',
|
|
27
|
+
args: [
|
|
28
|
+
{
|
|
29
|
+
name: 'num',
|
|
30
|
+
type: 'number',
|
|
31
|
+
required: true,
|
|
32
|
+
description: 'Input number',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
returnType: 'number',
|
|
36
|
+
examples: ['{{fn.ceil(4.3)}}'],
|
|
37
|
+
execute: (num) => Math.ceil(Number(num)),
|
|
38
|
+
},
|
|
39
|
+
floor: {
|
|
40
|
+
name: 'floor',
|
|
41
|
+
description: 'Rounds a number down to the nearest integer',
|
|
42
|
+
category: 'math',
|
|
43
|
+
signature: 'floor(num)',
|
|
44
|
+
args: [
|
|
45
|
+
{
|
|
46
|
+
name: 'num',
|
|
47
|
+
type: 'number',
|
|
48
|
+
required: true,
|
|
49
|
+
description: 'Input number',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
returnType: 'number',
|
|
53
|
+
examples: ['{{fn.floor(4.7)}}'],
|
|
54
|
+
execute: (num) => Math.floor(Number(num)),
|
|
55
|
+
},
|
|
56
|
+
round: {
|
|
57
|
+
name: 'round',
|
|
58
|
+
description: 'Rounds a number to the nearest integer',
|
|
59
|
+
category: 'math',
|
|
60
|
+
signature: 'round(num)',
|
|
61
|
+
args: [
|
|
62
|
+
{
|
|
63
|
+
name: 'num',
|
|
64
|
+
type: 'number',
|
|
65
|
+
required: true,
|
|
66
|
+
description: 'Input number',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
returnType: 'number',
|
|
70
|
+
examples: ['{{fn.round(4.5)}}'],
|
|
71
|
+
execute: (num) => Math.round(Number(num)),
|
|
72
|
+
},
|
|
73
|
+
min: {
|
|
74
|
+
name: 'min',
|
|
75
|
+
description: 'Returns the smallest of the given numbers',
|
|
76
|
+
category: 'math',
|
|
77
|
+
signature: 'min(...nums)',
|
|
78
|
+
args: [
|
|
79
|
+
{
|
|
80
|
+
name: 'numbers',
|
|
81
|
+
type: 'number',
|
|
82
|
+
required: true,
|
|
83
|
+
description: 'Numbers to compare',
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
returnType: 'number',
|
|
87
|
+
examples: ['{{fn.min(5, 10, 2, 8)}}'],
|
|
88
|
+
execute: (...args) => Math.min(...args.map(Number)),
|
|
89
|
+
},
|
|
90
|
+
max: {
|
|
91
|
+
name: 'max',
|
|
92
|
+
description: 'Returns the largest of the given numbers',
|
|
93
|
+
category: 'math',
|
|
94
|
+
signature: 'max(...nums)',
|
|
95
|
+
args: [
|
|
96
|
+
{
|
|
97
|
+
name: 'numbers',
|
|
98
|
+
type: 'number',
|
|
99
|
+
required: true,
|
|
100
|
+
description: 'Numbers to compare',
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
returnType: 'number',
|
|
104
|
+
examples: ['{{fn.max(5, 10, 2, 8)}}'],
|
|
105
|
+
execute: (...args) => Math.max(...args.map(Number)),
|
|
106
|
+
},
|
|
107
|
+
pow: {
|
|
108
|
+
name: 'pow',
|
|
109
|
+
description: 'Returns the base to the exponent power',
|
|
110
|
+
category: 'math',
|
|
111
|
+
signature: 'pow(base, exponent)',
|
|
112
|
+
args: [
|
|
113
|
+
{
|
|
114
|
+
name: 'base',
|
|
115
|
+
type: 'number',
|
|
116
|
+
required: true,
|
|
117
|
+
description: 'Base number',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'exponent',
|
|
121
|
+
type: 'number',
|
|
122
|
+
required: true,
|
|
123
|
+
description: 'Exponent',
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
returnType: 'number',
|
|
127
|
+
examples: ['{{fn.pow(2, 3)}}'],
|
|
128
|
+
execute: (base, exponent) => Math.pow(Number(base), Number(exponent)),
|
|
129
|
+
},
|
|
130
|
+
sqrt: {
|
|
131
|
+
name: 'sqrt',
|
|
132
|
+
description: 'Returns the square root of a number',
|
|
133
|
+
category: 'math',
|
|
134
|
+
signature: 'sqrt(num)',
|
|
135
|
+
args: [
|
|
136
|
+
{
|
|
137
|
+
name: 'num',
|
|
138
|
+
type: 'number',
|
|
139
|
+
required: true,
|
|
140
|
+
description: 'Input number',
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
returnType: 'number',
|
|
144
|
+
examples: ['{{fn.sqrt(16)}}'],
|
|
145
|
+
execute: (num) => Math.sqrt(Number(num)),
|
|
146
|
+
},
|
|
147
|
+
random: {
|
|
148
|
+
name: 'random',
|
|
149
|
+
description: 'Generates a random integer between min and max (inclusive)',
|
|
150
|
+
category: 'math',
|
|
151
|
+
signature: 'random(min, max)',
|
|
152
|
+
args: [
|
|
153
|
+
{
|
|
154
|
+
name: 'min',
|
|
155
|
+
type: 'number',
|
|
156
|
+
required: true,
|
|
157
|
+
description: 'Minimum value',
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: 'max',
|
|
161
|
+
type: 'number',
|
|
162
|
+
required: true,
|
|
163
|
+
description: 'Maximum value',
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
returnType: 'number',
|
|
167
|
+
examples: ['{{fn.random(1, 100)}}'],
|
|
168
|
+
execute: (min, max) => {
|
|
169
|
+
const minNum = Number(min);
|
|
170
|
+
const maxNum = Number(max);
|
|
171
|
+
return Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
};
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringFunctions = void 0;
|
|
4
|
+
exports.stringFunctions = {
|
|
5
|
+
toUpperCase: {
|
|
6
|
+
name: 'toUpperCase',
|
|
7
|
+
description: 'Converts a string to uppercase',
|
|
8
|
+
category: 'string',
|
|
9
|
+
signature: 'toUpperCase(str)',
|
|
10
|
+
args: [
|
|
11
|
+
{
|
|
12
|
+
name: 'str',
|
|
13
|
+
type: 'string',
|
|
14
|
+
required: true,
|
|
15
|
+
description: 'Input string',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
returnType: 'string',
|
|
19
|
+
examples: ['{{fn.toUpperCase(trigger.name)}}'],
|
|
20
|
+
execute: (str) => String(str).toUpperCase(),
|
|
21
|
+
},
|
|
22
|
+
toLowerCase: {
|
|
23
|
+
name: 'toLowerCase',
|
|
24
|
+
description: 'Converts a string to lowercase',
|
|
25
|
+
category: 'string',
|
|
26
|
+
signature: 'toLowerCase(str)',
|
|
27
|
+
args: [
|
|
28
|
+
{
|
|
29
|
+
name: 'str',
|
|
30
|
+
type: 'string',
|
|
31
|
+
required: true,
|
|
32
|
+
description: 'Input string',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
returnType: 'string',
|
|
36
|
+
examples: ['{{fn.toLowerCase(trigger.email)}}'],
|
|
37
|
+
execute: (str) => String(str).toLowerCase(),
|
|
38
|
+
},
|
|
39
|
+
trim: {
|
|
40
|
+
name: 'trim',
|
|
41
|
+
description: 'Removes whitespace from both ends of a string',
|
|
42
|
+
category: 'string',
|
|
43
|
+
signature: 'trim(str)',
|
|
44
|
+
args: [
|
|
45
|
+
{
|
|
46
|
+
name: 'str',
|
|
47
|
+
type: 'string',
|
|
48
|
+
required: true,
|
|
49
|
+
description: 'Input string',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
returnType: 'string',
|
|
53
|
+
examples: ['{{fn.trim(trigger.input)}}'],
|
|
54
|
+
execute: (str) => String(str).trim(),
|
|
55
|
+
},
|
|
56
|
+
substring: {
|
|
57
|
+
name: 'substring',
|
|
58
|
+
description: 'Extracts a portion of a string',
|
|
59
|
+
category: 'string',
|
|
60
|
+
signature: 'substring(str, start, end?)',
|
|
61
|
+
args: [
|
|
62
|
+
{
|
|
63
|
+
name: 'str',
|
|
64
|
+
type: 'string',
|
|
65
|
+
required: true,
|
|
66
|
+
description: 'Input string',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'start',
|
|
70
|
+
type: 'number',
|
|
71
|
+
required: true,
|
|
72
|
+
description: 'Start index',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'end',
|
|
76
|
+
type: 'number',
|
|
77
|
+
required: false,
|
|
78
|
+
description: 'End index',
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
returnType: 'string',
|
|
82
|
+
examples: ['{{fn.substring(trigger.id, 0, 8)}}'],
|
|
83
|
+
execute: (str, start, end) => {
|
|
84
|
+
return String(str).substring(Number(start), end !== undefined ? Number(end) : undefined);
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
replace: {
|
|
88
|
+
name: 'replace',
|
|
89
|
+
description: 'Replaces occurrences of a pattern in a string',
|
|
90
|
+
category: 'string',
|
|
91
|
+
signature: 'replace(str, search, replacement)',
|
|
92
|
+
args: [
|
|
93
|
+
{
|
|
94
|
+
name: 'str',
|
|
95
|
+
type: 'string',
|
|
96
|
+
required: true,
|
|
97
|
+
description: 'Input string',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'search',
|
|
101
|
+
type: 'string',
|
|
102
|
+
required: true,
|
|
103
|
+
description: 'Pattern to search',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'replacement',
|
|
107
|
+
type: 'string',
|
|
108
|
+
required: true,
|
|
109
|
+
description: 'Replacement string',
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
returnType: 'string',
|
|
113
|
+
examples: ['{{fn.replace(trigger.text, "old", "new")}}'],
|
|
114
|
+
execute: (str, search, replacement) => {
|
|
115
|
+
const searchStr = String(search);
|
|
116
|
+
const replaceStr = String(replacement);
|
|
117
|
+
return String(str).replace(new RegExp(searchStr.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), replaceStr);
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
split: {
|
|
121
|
+
name: 'split',
|
|
122
|
+
description: 'Splits a string into an array',
|
|
123
|
+
category: 'string',
|
|
124
|
+
signature: 'split(str, separator)',
|
|
125
|
+
args: [
|
|
126
|
+
{
|
|
127
|
+
name: 'str',
|
|
128
|
+
type: 'string',
|
|
129
|
+
required: true,
|
|
130
|
+
description: 'Input string',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'separator',
|
|
134
|
+
type: 'string',
|
|
135
|
+
required: true,
|
|
136
|
+
description: 'Separator',
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
returnType: 'array',
|
|
140
|
+
examples: ['{{fn.split(trigger.tags, ",")}}'],
|
|
141
|
+
execute: (str, separator) => {
|
|
142
|
+
return String(str).split(String(separator));
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
concat: {
|
|
146
|
+
name: 'concat',
|
|
147
|
+
description: 'Concatenates multiple strings',
|
|
148
|
+
category: 'string',
|
|
149
|
+
signature: 'concat(...strs)',
|
|
150
|
+
args: [
|
|
151
|
+
{
|
|
152
|
+
name: 'strings',
|
|
153
|
+
type: 'string',
|
|
154
|
+
required: true,
|
|
155
|
+
description: 'Strings to concatenate',
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
returnType: 'string',
|
|
159
|
+
examples: ['{{fn.concat("Hello", " ", "World")}}'],
|
|
160
|
+
execute: (...args) => {
|
|
161
|
+
return args.map((arg) => String(arg)).join('');
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
startsWith: {
|
|
165
|
+
name: 'startsWith',
|
|
166
|
+
description: 'Checks if a string starts with a specified value',
|
|
167
|
+
category: 'string',
|
|
168
|
+
signature: 'startsWith(str, search)',
|
|
169
|
+
args: [
|
|
170
|
+
{
|
|
171
|
+
name: 'str',
|
|
172
|
+
type: 'string',
|
|
173
|
+
required: true,
|
|
174
|
+
description: 'Input string',
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: 'search',
|
|
178
|
+
type: 'string',
|
|
179
|
+
required: true,
|
|
180
|
+
description: 'Search value',
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
returnType: 'boolean',
|
|
184
|
+
examples: ['{{fn.startsWith(trigger.url, "https://")}}'],
|
|
185
|
+
execute: (str, search) => {
|
|
186
|
+
return String(str).startsWith(String(search));
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
endsWith: {
|
|
190
|
+
name: 'endsWith',
|
|
191
|
+
description: 'Checks if a string ends with a specified value',
|
|
192
|
+
category: 'string',
|
|
193
|
+
signature: 'endsWith(str, search)',
|
|
194
|
+
args: [
|
|
195
|
+
{
|
|
196
|
+
name: 'str',
|
|
197
|
+
type: 'string',
|
|
198
|
+
required: true,
|
|
199
|
+
description: 'Input string',
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: 'search',
|
|
203
|
+
type: 'string',
|
|
204
|
+
required: true,
|
|
205
|
+
description: 'Search value',
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
returnType: 'boolean',
|
|
209
|
+
examples: ['{{fn.endsWith(trigger.filename, ".pdf")}}'],
|
|
210
|
+
execute: (str, search) => {
|
|
211
|
+
return String(str).endsWith(String(search));
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
includes: {
|
|
215
|
+
name: 'includes',
|
|
216
|
+
description: 'Checks if a string contains a specified value',
|
|
217
|
+
category: 'string',
|
|
218
|
+
signature: 'includes(str, search)',
|
|
219
|
+
args: [
|
|
220
|
+
{
|
|
221
|
+
name: 'str',
|
|
222
|
+
type: 'string',
|
|
223
|
+
required: true,
|
|
224
|
+
description: 'Input string',
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
name: 'search',
|
|
228
|
+
type: 'string',
|
|
229
|
+
required: true,
|
|
230
|
+
description: 'Search value',
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
returnType: 'boolean',
|
|
234
|
+
examples: ['{{fn.includes(trigger.text, "error")}}'],
|
|
235
|
+
execute: (str, search) => {
|
|
236
|
+
return String(str).includes(String(search));
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
padStart: {
|
|
240
|
+
name: 'padStart',
|
|
241
|
+
description: 'Pads a string from the start to a specified length',
|
|
242
|
+
category: 'string',
|
|
243
|
+
signature: 'padStart(str, length, padString?)',
|
|
244
|
+
args: [
|
|
245
|
+
{
|
|
246
|
+
name: 'str',
|
|
247
|
+
type: 'string',
|
|
248
|
+
required: true,
|
|
249
|
+
description: 'Input string',
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: 'length',
|
|
253
|
+
type: 'number',
|
|
254
|
+
required: true,
|
|
255
|
+
description: 'Target length',
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
name: 'padString',
|
|
259
|
+
type: 'string',
|
|
260
|
+
required: false,
|
|
261
|
+
description: 'Padding string (default: space)',
|
|
262
|
+
},
|
|
263
|
+
],
|
|
264
|
+
returnType: 'string',
|
|
265
|
+
examples: ['{{fn.padStart(trigger.id, 10, "0")}}'],
|
|
266
|
+
execute: (str, length, padString) => {
|
|
267
|
+
return String(str).padStart(Number(length), padString !== undefined ? String(padString) : ' ');
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
padEnd: {
|
|
271
|
+
name: 'padEnd',
|
|
272
|
+
description: 'Pads a string from the end to a specified length',
|
|
273
|
+
category: 'string',
|
|
274
|
+
signature: 'padEnd(str, length, padString?)',
|
|
275
|
+
args: [
|
|
276
|
+
{
|
|
277
|
+
name: 'str',
|
|
278
|
+
type: 'string',
|
|
279
|
+
required: true,
|
|
280
|
+
description: 'Input string',
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
name: 'length',
|
|
284
|
+
type: 'number',
|
|
285
|
+
required: true,
|
|
286
|
+
description: 'Target length',
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
name: 'padString',
|
|
290
|
+
type: 'string',
|
|
291
|
+
required: false,
|
|
292
|
+
description: 'Padding string (default: space)',
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
returnType: 'string',
|
|
296
|
+
examples: ['{{fn.padEnd(trigger.code, 5, "X")}}'],
|
|
297
|
+
execute: (str, length, padString) => {
|
|
298
|
+
return String(str).padEnd(Number(length), padString !== undefined ? String(padString) : ' ');
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
};
|