@abyss-project/console 1.0.41 → 1.0.43
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/constants/abyss-services.d.ts +0 -0
- package/dist/constants/abyss-services.js +1 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1 -3
- package/dist/types/constants/workflow.constants.d.ts +4 -0
- package/dist/types/constants/workflow.constants.js +5 -1
- package/dist/types/dto/workflow.dto.d.ts +5 -1
- package/dist/types/enum/workflow.enum.d.ts +2 -1
- package/dist/types/enum/workflow.enum.js +1 -0
- package/dist/types/interface/models/workflow-webhook.model.d.ts +1 -0
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/index.js +1 -2
- package/dist/utils/webhook-trigger.utils.d.ts +0 -7
- package/dist/utils/webhook-trigger.utils.js +0 -334
- package/dist/workflow-expressions/index.d.ts +5 -17
- package/dist/workflow-expressions/index.js +9 -58
- package/dist/workflow-expressions/resolver.d.ts +2 -6
- package/dist/workflow-expressions/resolver.js +46 -229
- package/dist/workflow-expressions/types.d.ts +25 -142
- package/dist/workflow-expressions/types.js +3 -21
- package/package.json +1 -1
- package/dist/expressions/functions/array.d.ts +0 -2
- package/dist/expressions/functions/array.js +0 -252
- package/dist/expressions/functions/crypto.d.ts +0 -2
- package/dist/expressions/functions/crypto.js +0 -101
- package/dist/expressions/functions/datetime.d.ts +0 -2
- package/dist/expressions/functions/datetime.js +0 -256
- package/dist/expressions/functions/index.d.ts +0 -7
- package/dist/expressions/functions/index.js +0 -46
- package/dist/expressions/functions/math.d.ts +0 -2
- package/dist/expressions/functions/math.js +0 -174
- package/dist/expressions/functions/string.d.ts +0 -2
- package/dist/expressions/functions/string.js +0 -301
- package/dist/expressions/functions/utility.d.ts +0 -2
- package/dist/expressions/functions/utility.js +0 -230
- package/dist/expressions/helpers.d.ts +0 -26
- package/dist/expressions/helpers.js +0 -132
- package/dist/expressions/index.d.ts +0 -5
- package/dist/expressions/index.js +0 -16
- package/dist/expressions/mapper.d.ts +0 -9
- package/dist/expressions/mapper.js +0 -88
- package/dist/expressions/parser.d.ts +0 -3
- package/dist/expressions/parser.js +0 -97
- package/dist/expressions/pipes/array-pipes.d.ts +0 -2
- package/dist/expressions/pipes/array-pipes.js +0 -248
- package/dist/expressions/pipes/index.d.ts +0 -8
- package/dist/expressions/pipes/index.js +0 -40
- package/dist/expressions/pipes/object-pipes.d.ts +0 -2
- package/dist/expressions/pipes/object-pipes.js +0 -243
- package/dist/expressions/pipes/string-pipes.d.ts +0 -9
- package/dist/expressions/pipes/string-pipes.js +0 -178
- package/dist/expressions/resolver.d.ts +0 -12
- package/dist/expressions/resolver.js +0 -88
- package/dist/expressions/types.d.ts +0 -36
- package/dist/expressions/types.js +0 -2
- package/dist/workflow-expressions/functions/array.d.ts +0 -2
- package/dist/workflow-expressions/functions/array.js +0 -252
- package/dist/workflow-expressions/functions/crypto.d.ts +0 -2
- package/dist/workflow-expressions/functions/crypto.js +0 -101
- package/dist/workflow-expressions/functions/datetime.d.ts +0 -2
- package/dist/workflow-expressions/functions/datetime.js +0 -256
- package/dist/workflow-expressions/functions/index.d.ts +0 -7
- package/dist/workflow-expressions/functions/index.js +0 -46
- package/dist/workflow-expressions/functions/math.d.ts +0 -2
- package/dist/workflow-expressions/functions/math.js +0 -174
- package/dist/workflow-expressions/functions/string.d.ts +0 -2
- package/dist/workflow-expressions/functions/string.js +0 -301
- package/dist/workflow-expressions/functions/utility.d.ts +0 -2
- package/dist/workflow-expressions/functions/utility.js +0 -230
- package/dist/workflow-expressions/helpers.d.ts +0 -71
- package/dist/workflow-expressions/helpers.js +0 -262
- package/dist/workflow-expressions/parser.d.ts +0 -8
- package/dist/workflow-expressions/parser.js +0 -456
- package/dist/workflow-expressions/pipes/array-pipes.d.ts +0 -2
- package/dist/workflow-expressions/pipes/array-pipes.js +0 -248
- package/dist/workflow-expressions/pipes/index.d.ts +0 -8
- package/dist/workflow-expressions/pipes/index.js +0 -40
- package/dist/workflow-expressions/pipes/object-pipes.d.ts +0 -2
- package/dist/workflow-expressions/pipes/object-pipes.js +0 -243
- package/dist/workflow-expressions/pipes/string-pipes.d.ts +0 -9
- package/dist/workflow-expressions/pipes/string-pipes.js +0 -178
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.arrayPipes = void 0;
|
|
4
|
-
exports.arrayPipes = {
|
|
5
|
-
first: {
|
|
6
|
-
name: 'first',
|
|
7
|
-
description: 'Gets the first element',
|
|
8
|
-
category: 'array',
|
|
9
|
-
signature: 'first',
|
|
10
|
-
examples: ['{{trigger.items | first}}'],
|
|
11
|
-
execute: (value) => {
|
|
12
|
-
if (Array.isArray(value) && value.length > 0) {
|
|
13
|
-
return value[0];
|
|
14
|
-
}
|
|
15
|
-
return undefined;
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
last: {
|
|
19
|
-
name: 'last',
|
|
20
|
-
description: 'Gets the last element',
|
|
21
|
-
category: 'array',
|
|
22
|
-
signature: 'last',
|
|
23
|
-
examples: ['{{trigger.items | last}}'],
|
|
24
|
-
execute: (value) => {
|
|
25
|
-
if (Array.isArray(value) && value.length > 0) {
|
|
26
|
-
return value[value.length - 1];
|
|
27
|
-
}
|
|
28
|
-
return undefined;
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
length: {
|
|
32
|
-
name: 'length',
|
|
33
|
-
description: 'Returns the length',
|
|
34
|
-
category: 'array',
|
|
35
|
-
signature: 'length',
|
|
36
|
-
examples: ['{{trigger.items | length}}'],
|
|
37
|
-
execute: (value) => {
|
|
38
|
-
if (Array.isArray(value)) {
|
|
39
|
-
return value.length;
|
|
40
|
-
}
|
|
41
|
-
if (typeof value === 'string') {
|
|
42
|
-
return value.length;
|
|
43
|
-
}
|
|
44
|
-
return 0;
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
join: {
|
|
48
|
-
name: 'join',
|
|
49
|
-
description: 'Joins array elements',
|
|
50
|
-
category: 'array',
|
|
51
|
-
signature: 'join(separator?)',
|
|
52
|
-
examples: ['{{trigger.tags | join(", ")}}'],
|
|
53
|
-
execute: (value, separator) => {
|
|
54
|
-
if (!Array.isArray(value)) {
|
|
55
|
-
return '';
|
|
56
|
-
}
|
|
57
|
-
return value.join(separator !== undefined ? String(separator) : ',');
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
slice: {
|
|
61
|
-
name: 'slice',
|
|
62
|
-
description: 'Extracts a section',
|
|
63
|
-
category: 'array',
|
|
64
|
-
signature: 'slice(start, end?)',
|
|
65
|
-
examples: ['{{trigger.items | slice(0, 3)}}'],
|
|
66
|
-
execute: (value, start, end) => {
|
|
67
|
-
if (!Array.isArray(value)) {
|
|
68
|
-
return [];
|
|
69
|
-
}
|
|
70
|
-
return value.slice(Number(start), end !== undefined ? Number(end) : undefined);
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
reverse: {
|
|
74
|
-
name: 'reverse',
|
|
75
|
-
description: 'Reverses the order',
|
|
76
|
-
category: 'array',
|
|
77
|
-
signature: 'reverse',
|
|
78
|
-
examples: ['{{trigger.items | reverse}}'],
|
|
79
|
-
execute: (value) => {
|
|
80
|
-
if (!Array.isArray(value)) {
|
|
81
|
-
return [];
|
|
82
|
-
}
|
|
83
|
-
return [...value].reverse();
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
sort: {
|
|
87
|
-
name: 'sort',
|
|
88
|
-
description: 'Sorts the array',
|
|
89
|
-
category: 'array',
|
|
90
|
-
signature: 'sort',
|
|
91
|
-
examples: ['{{trigger.numbers | sort}}'],
|
|
92
|
-
execute: (value) => {
|
|
93
|
-
if (!Array.isArray(value)) {
|
|
94
|
-
return [];
|
|
95
|
-
}
|
|
96
|
-
return [...value].sort();
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
unique: {
|
|
100
|
-
name: 'unique',
|
|
101
|
-
description: 'Returns unique elements',
|
|
102
|
-
category: 'array',
|
|
103
|
-
signature: 'unique',
|
|
104
|
-
examples: ['{{trigger.tags | unique}}'],
|
|
105
|
-
execute: (value) => {
|
|
106
|
-
if (!Array.isArray(value)) {
|
|
107
|
-
return [];
|
|
108
|
-
}
|
|
109
|
-
return Array.from(new Set(value));
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
flatten: {
|
|
113
|
-
name: 'flatten',
|
|
114
|
-
description: 'Flattens nested arrays',
|
|
115
|
-
category: 'array',
|
|
116
|
-
signature: 'flatten',
|
|
117
|
-
examples: ['{{trigger.nested | flatten}}'],
|
|
118
|
-
execute: (value) => {
|
|
119
|
-
if (!Array.isArray(value)) {
|
|
120
|
-
return [];
|
|
121
|
-
}
|
|
122
|
-
return value.flat();
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
compact: {
|
|
126
|
-
name: 'compact',
|
|
127
|
-
description: 'Removes falsy values',
|
|
128
|
-
category: 'array',
|
|
129
|
-
signature: 'compact',
|
|
130
|
-
examples: ['{{trigger.items | compact}}'],
|
|
131
|
-
execute: (value) => {
|
|
132
|
-
if (!Array.isArray(value)) {
|
|
133
|
-
return [];
|
|
134
|
-
}
|
|
135
|
-
return value.filter(Boolean);
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
sum: {
|
|
139
|
-
name: 'sum',
|
|
140
|
-
description: 'Sums numeric values',
|
|
141
|
-
category: 'array',
|
|
142
|
-
signature: 'sum',
|
|
143
|
-
examples: ['{{trigger.numbers | sum}}'],
|
|
144
|
-
execute: (value) => {
|
|
145
|
-
if (!Array.isArray(value)) {
|
|
146
|
-
return 0;
|
|
147
|
-
}
|
|
148
|
-
return value.reduce((acc, val) => acc + Number(val), 0);
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
avg: {
|
|
152
|
-
name: 'avg',
|
|
153
|
-
description: 'Calculates average',
|
|
154
|
-
category: 'array',
|
|
155
|
-
signature: 'avg',
|
|
156
|
-
examples: ['{{trigger.scores | avg}}'],
|
|
157
|
-
execute: (value) => {
|
|
158
|
-
if (!Array.isArray(value) || value.length === 0) {
|
|
159
|
-
return 0;
|
|
160
|
-
}
|
|
161
|
-
const sum = value.reduce((acc, val) => acc + Number(val), 0);
|
|
162
|
-
return sum / value.length;
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
min: {
|
|
166
|
-
name: 'min',
|
|
167
|
-
description: 'Returns minimum value',
|
|
168
|
-
category: 'array',
|
|
169
|
-
signature: 'min',
|
|
170
|
-
examples: ['{{trigger.numbers | min}}'],
|
|
171
|
-
execute: (value) => {
|
|
172
|
-
if (!Array.isArray(value) || value.length === 0) {
|
|
173
|
-
return undefined;
|
|
174
|
-
}
|
|
175
|
-
return Math.min(...value.map(Number));
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
max: {
|
|
179
|
-
name: 'max',
|
|
180
|
-
description: 'Returns maximum value',
|
|
181
|
-
category: 'array',
|
|
182
|
-
signature: 'max',
|
|
183
|
-
examples: ['{{trigger.numbers | max}}'],
|
|
184
|
-
execute: (value) => {
|
|
185
|
-
if (!Array.isArray(value) || value.length === 0) {
|
|
186
|
-
return undefined;
|
|
187
|
-
}
|
|
188
|
-
return Math.max(...value.map(Number));
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
map: {
|
|
192
|
-
name: 'map',
|
|
193
|
-
description: 'Maps over array elements',
|
|
194
|
-
category: 'array',
|
|
195
|
-
signature: 'map(property)',
|
|
196
|
-
examples: ['{{trigger.users | map("name")}}'],
|
|
197
|
-
execute: (value, property) => {
|
|
198
|
-
if (!Array.isArray(value)) {
|
|
199
|
-
return [];
|
|
200
|
-
}
|
|
201
|
-
const prop = String(property);
|
|
202
|
-
return value.map((item) => {
|
|
203
|
-
if (item && typeof item === 'object') {
|
|
204
|
-
return item[prop];
|
|
205
|
-
}
|
|
206
|
-
return undefined;
|
|
207
|
-
});
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
filter: {
|
|
211
|
-
name: 'filter',
|
|
212
|
-
description: 'Filters array elements by property',
|
|
213
|
-
category: 'array',
|
|
214
|
-
signature: 'filter(property, value)',
|
|
215
|
-
examples: ['{{trigger.users | filter("active", true)}}'],
|
|
216
|
-
execute: (value, property, filterValue) => {
|
|
217
|
-
if (!Array.isArray(value)) {
|
|
218
|
-
return [];
|
|
219
|
-
}
|
|
220
|
-
const prop = String(property);
|
|
221
|
-
return value.filter((item) => {
|
|
222
|
-
if (item && typeof item === 'object') {
|
|
223
|
-
return item[prop] === filterValue;
|
|
224
|
-
}
|
|
225
|
-
return false;
|
|
226
|
-
});
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
pluck: {
|
|
230
|
-
name: 'pluck',
|
|
231
|
-
description: 'Extracts property from each object',
|
|
232
|
-
category: 'array',
|
|
233
|
-
signature: 'pluck(property)',
|
|
234
|
-
examples: ['{{trigger.users | pluck("email")}}'],
|
|
235
|
-
execute: (value, property) => {
|
|
236
|
-
if (!Array.isArray(value)) {
|
|
237
|
-
return [];
|
|
238
|
-
}
|
|
239
|
-
const prop = String(property);
|
|
240
|
-
return value.map((item) => {
|
|
241
|
-
if (item && typeof item === 'object') {
|
|
242
|
-
return item[prop];
|
|
243
|
-
}
|
|
244
|
-
return undefined;
|
|
245
|
-
});
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { PipeDefinition } from './string-pipes';
|
|
2
|
-
import type { OperationCategory } from '../types';
|
|
3
|
-
export declare const PIPE_OPERATIONS: Record<string, PipeDefinition>;
|
|
4
|
-
export declare function executePipeOperation(name: string, value: unknown, args: unknown[]): unknown;
|
|
5
|
-
export declare function getPipesByCategory(category: OperationCategory): Record<string, PipeDefinition>;
|
|
6
|
-
export declare function getPipeNames(): string[];
|
|
7
|
-
export declare function hasPipe(name: string): boolean;
|
|
8
|
-
export declare function getPipe(name: string): PipeDefinition | undefined;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPipe = exports.hasPipe = exports.getPipeNames = exports.getPipesByCategory = exports.executePipeOperation = exports.PIPE_OPERATIONS = void 0;
|
|
4
|
-
const string_pipes_1 = require("./string-pipes");
|
|
5
|
-
const array_pipes_1 = require("./array-pipes");
|
|
6
|
-
const object_pipes_1 = require("./object-pipes");
|
|
7
|
-
exports.PIPE_OPERATIONS = {
|
|
8
|
-
...string_pipes_1.stringPipes,
|
|
9
|
-
...array_pipes_1.arrayPipes,
|
|
10
|
-
...object_pipes_1.objectPipes,
|
|
11
|
-
};
|
|
12
|
-
function executePipeOperation(name, value, args) {
|
|
13
|
-
const pipe = exports.PIPE_OPERATIONS[name];
|
|
14
|
-
if (!pipe) {
|
|
15
|
-
throw new Error(`Unknown pipe operation: ${name}`);
|
|
16
|
-
}
|
|
17
|
-
return pipe.execute(value, ...args);
|
|
18
|
-
}
|
|
19
|
-
exports.executePipeOperation = executePipeOperation;
|
|
20
|
-
function getPipesByCategory(category) {
|
|
21
|
-
return Object.entries(exports.PIPE_OPERATIONS)
|
|
22
|
-
.filter(([, pipe]) => pipe.category === category)
|
|
23
|
-
.reduce((acc, [name, pipe]) => {
|
|
24
|
-
acc[name] = pipe;
|
|
25
|
-
return acc;
|
|
26
|
-
}, {});
|
|
27
|
-
}
|
|
28
|
-
exports.getPipesByCategory = getPipesByCategory;
|
|
29
|
-
function getPipeNames() {
|
|
30
|
-
return Object.keys(exports.PIPE_OPERATIONS);
|
|
31
|
-
}
|
|
32
|
-
exports.getPipeNames = getPipeNames;
|
|
33
|
-
function hasPipe(name) {
|
|
34
|
-
return name in exports.PIPE_OPERATIONS;
|
|
35
|
-
}
|
|
36
|
-
exports.hasPipe = hasPipe;
|
|
37
|
-
function getPipe(name) {
|
|
38
|
-
return exports.PIPE_OPERATIONS[name];
|
|
39
|
-
}
|
|
40
|
-
exports.getPipe = getPipe;
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.objectPipes = void 0;
|
|
4
|
-
exports.objectPipes = {
|
|
5
|
-
keys: {
|
|
6
|
-
name: 'keys',
|
|
7
|
-
description: 'Returns object keys',
|
|
8
|
-
category: 'object',
|
|
9
|
-
signature: 'keys',
|
|
10
|
-
examples: ['{{trigger.data | keys}}'],
|
|
11
|
-
execute: (value) => {
|
|
12
|
-
if (value && typeof value === 'object') {
|
|
13
|
-
return Object.keys(value);
|
|
14
|
-
}
|
|
15
|
-
return [];
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
values: {
|
|
19
|
-
name: 'values',
|
|
20
|
-
description: 'Returns object values',
|
|
21
|
-
category: 'object',
|
|
22
|
-
signature: 'values',
|
|
23
|
-
examples: ['{{trigger.data | values}}'],
|
|
24
|
-
execute: (value) => {
|
|
25
|
-
if (value && typeof value === 'object') {
|
|
26
|
-
return Object.values(value);
|
|
27
|
-
}
|
|
28
|
-
return [];
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
entries: {
|
|
32
|
-
name: 'entries',
|
|
33
|
-
description: 'Returns key-value pairs',
|
|
34
|
-
category: 'object',
|
|
35
|
-
signature: 'entries',
|
|
36
|
-
examples: ['{{trigger.data | entries}}'],
|
|
37
|
-
execute: (value) => {
|
|
38
|
-
if (value && typeof value === 'object') {
|
|
39
|
-
return Object.entries(value);
|
|
40
|
-
}
|
|
41
|
-
return [];
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
get: {
|
|
45
|
-
name: 'get',
|
|
46
|
-
description: 'Gets a property value',
|
|
47
|
-
category: 'object',
|
|
48
|
-
signature: 'get(path)',
|
|
49
|
-
examples: ['{{trigger.data | get("user.name")}}'],
|
|
50
|
-
execute: (value, path) => {
|
|
51
|
-
if (!value || typeof value !== 'object') {
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
const pathStr = String(path);
|
|
55
|
-
const keys = pathStr.split('.');
|
|
56
|
-
let current = value;
|
|
57
|
-
for (const key of keys) {
|
|
58
|
-
if (current === null || current === undefined) {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
if (typeof current !== 'object') {
|
|
62
|
-
return undefined;
|
|
63
|
-
}
|
|
64
|
-
current = current[key];
|
|
65
|
-
}
|
|
66
|
-
return current;
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
has: {
|
|
70
|
-
name: 'has',
|
|
71
|
-
description: 'Checks if property exists',
|
|
72
|
-
category: 'object',
|
|
73
|
-
signature: 'has(key)',
|
|
74
|
-
examples: ['{{trigger.data | has("email")}}'],
|
|
75
|
-
execute: (value, key) => {
|
|
76
|
-
if (!value || typeof value !== 'object') {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
return String(key) in value;
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
omit: {
|
|
83
|
-
name: 'omit',
|
|
84
|
-
description: 'Omits specified keys',
|
|
85
|
-
category: 'object',
|
|
86
|
-
signature: 'omit(...keys)',
|
|
87
|
-
examples: ['{{trigger.data | omit("password", "token")}}'],
|
|
88
|
-
execute: (value, ...keys) => {
|
|
89
|
-
if (!value || typeof value !== 'object') {
|
|
90
|
-
return value;
|
|
91
|
-
}
|
|
92
|
-
const obj = value;
|
|
93
|
-
const keysToOmit = new Set(keys.map(String));
|
|
94
|
-
return Object.entries(obj).reduce((acc, [key, val]) => {
|
|
95
|
-
if (!keysToOmit.has(key)) {
|
|
96
|
-
acc[key] = val;
|
|
97
|
-
}
|
|
98
|
-
return acc;
|
|
99
|
-
}, {});
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
pick: {
|
|
103
|
-
name: 'pick',
|
|
104
|
-
description: 'Picks specified keys',
|
|
105
|
-
category: 'object',
|
|
106
|
-
signature: 'pick(...keys)',
|
|
107
|
-
examples: ['{{trigger.data | pick("id", "name", "email")}}'],
|
|
108
|
-
execute: (value, ...keys) => {
|
|
109
|
-
if (!value || typeof value !== 'object') {
|
|
110
|
-
return {};
|
|
111
|
-
}
|
|
112
|
-
const obj = value;
|
|
113
|
-
const keysToPick = keys.map(String);
|
|
114
|
-
return keysToPick.reduce((acc, key) => {
|
|
115
|
-
if (key in obj) {
|
|
116
|
-
acc[key] = obj[key];
|
|
117
|
-
}
|
|
118
|
-
return acc;
|
|
119
|
-
}, {});
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
merge: {
|
|
123
|
-
name: 'merge',
|
|
124
|
-
description: 'Merges with another object',
|
|
125
|
-
category: 'object',
|
|
126
|
-
signature: 'merge(object)',
|
|
127
|
-
examples: ['{{trigger.data | merge(trigger.defaults)}}'],
|
|
128
|
-
execute: (value, other) => {
|
|
129
|
-
if (!value || typeof value !== 'object') {
|
|
130
|
-
return other || {};
|
|
131
|
-
}
|
|
132
|
-
if (!other || typeof other !== 'object') {
|
|
133
|
-
return value;
|
|
134
|
-
}
|
|
135
|
-
return { ...value, ...other };
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
base64: {
|
|
139
|
-
name: 'base64',
|
|
140
|
-
description: 'Encodes to base64',
|
|
141
|
-
category: 'encoding',
|
|
142
|
-
signature: 'base64',
|
|
143
|
-
examples: ['{{trigger.text | base64}}'],
|
|
144
|
-
execute: (value) => {
|
|
145
|
-
return Buffer.from(String(value)).toString('base64');
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
base64decode: {
|
|
149
|
-
name: 'base64decode',
|
|
150
|
-
description: 'Decodes from base64',
|
|
151
|
-
category: 'encoding',
|
|
152
|
-
signature: 'base64decode',
|
|
153
|
-
examples: ['{{trigger.encoded | base64decode}}'],
|
|
154
|
-
execute: (value) => {
|
|
155
|
-
try {
|
|
156
|
-
return Buffer.from(String(value), 'base64').toString('utf-8');
|
|
157
|
-
}
|
|
158
|
-
catch {
|
|
159
|
-
return value;
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
urlEncode: {
|
|
164
|
-
name: 'urlEncode',
|
|
165
|
-
description: 'URL encodes a string',
|
|
166
|
-
category: 'encoding',
|
|
167
|
-
signature: 'urlEncode',
|
|
168
|
-
examples: ['{{trigger.query | urlEncode}}'],
|
|
169
|
-
execute: (value) => {
|
|
170
|
-
return encodeURIComponent(String(value));
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
urlDecode: {
|
|
174
|
-
name: 'urlDecode',
|
|
175
|
-
description: 'URL decodes a string',
|
|
176
|
-
category: 'encoding',
|
|
177
|
-
signature: 'urlDecode',
|
|
178
|
-
examples: ['{{trigger.encoded | urlDecode}}'],
|
|
179
|
-
execute: (value) => {
|
|
180
|
-
try {
|
|
181
|
-
return decodeURIComponent(String(value));
|
|
182
|
-
}
|
|
183
|
-
catch {
|
|
184
|
-
return value;
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
json: {
|
|
189
|
-
name: 'json',
|
|
190
|
-
description: 'Converts to JSON string',
|
|
191
|
-
category: 'formatting',
|
|
192
|
-
signature: 'json',
|
|
193
|
-
examples: ['{{trigger.data | json}}'],
|
|
194
|
-
execute: (value) => {
|
|
195
|
-
return JSON.stringify(value);
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
jsonPretty: {
|
|
199
|
-
name: 'jsonPretty',
|
|
200
|
-
description: 'Converts to pretty JSON',
|
|
201
|
-
category: 'formatting',
|
|
202
|
-
signature: 'jsonPretty',
|
|
203
|
-
examples: ['{{trigger.data | jsonPretty}}'],
|
|
204
|
-
execute: (value) => {
|
|
205
|
-
return JSON.stringify(value, null, 2);
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
parseJson: {
|
|
209
|
-
name: 'parseJson',
|
|
210
|
-
description: 'Parses JSON string',
|
|
211
|
-
category: 'formatting',
|
|
212
|
-
signature: 'parseJson',
|
|
213
|
-
examples: ['{{trigger.jsonString | parseJson}}'],
|
|
214
|
-
execute: (value) => {
|
|
215
|
-
try {
|
|
216
|
-
return JSON.parse(String(value));
|
|
217
|
-
}
|
|
218
|
-
catch {
|
|
219
|
-
return value;
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
toFixed: {
|
|
224
|
-
name: 'toFixed',
|
|
225
|
-
description: 'Formats number with fixed decimals',
|
|
226
|
-
category: 'number',
|
|
227
|
-
signature: 'toFixed(decimals)',
|
|
228
|
-
examples: ['{{trigger.price | toFixed(2)}}'],
|
|
229
|
-
execute: (value, decimals) => {
|
|
230
|
-
return Number(value).toFixed(Number(decimals));
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
toPrecision: {
|
|
234
|
-
name: 'toPrecision',
|
|
235
|
-
description: 'Formats number with precision',
|
|
236
|
-
category: 'number',
|
|
237
|
-
signature: 'toPrecision(precision)',
|
|
238
|
-
examples: ['{{trigger.value | toPrecision(4)}}'],
|
|
239
|
-
execute: (value, precision) => {
|
|
240
|
-
return Number(value).toPrecision(Number(precision));
|
|
241
|
-
},
|
|
242
|
-
},
|
|
243
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export interface PipeDefinition {
|
|
2
|
-
name: string;
|
|
3
|
-
description: string;
|
|
4
|
-
category: 'string' | 'array' | 'object' | 'number' | 'date' | 'encoding' | 'formatting';
|
|
5
|
-
signature: string;
|
|
6
|
-
examples: string[];
|
|
7
|
-
execute: (value: unknown, ...args: unknown[]) => unknown;
|
|
8
|
-
}
|
|
9
|
-
export declare const stringPipes: Record<string, PipeDefinition>;
|