@lowdefy/operators-js 4.5.2 → 4.7.0
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/index.js +1 -1
- package/dist/operators/build/env.js +2 -1
- package/dist/operators/build/env.schema.js +61 -0
- package/dist/operators/client/_index.js +2 -1
- package/dist/operators/client/actions.js +2 -1
- package/dist/operators/client/actions.schema.js +61 -0
- package/dist/operators/client/api.js +4 -3
- package/dist/operators/client/api.schema.js +21 -0
- package/dist/operators/client/base64.js +2 -1
- package/dist/operators/client/base64.schema.js +21 -0
- package/dist/operators/client/event.js +2 -1
- package/dist/operators/client/event.schema.js +61 -0
- package/dist/operators/client/event_log.js +2 -1
- package/dist/operators/client/event_log.schema.js +61 -0
- package/dist/operators/client/global.js +2 -1
- package/dist/operators/client/global.schema.js +61 -0
- package/dist/operators/client/index.schema.js +22 -0
- package/dist/operators/client/input.js +2 -1
- package/dist/operators/client/input.schema.js +61 -0
- package/dist/operators/client/js.js +9 -3
- package/dist/operators/client/js.schema.js +21 -0
- package/dist/operators/client/location.js +4 -3
- package/dist/operators/client/location.schema.js +35 -0
- package/dist/operators/client/media.js +3 -2
- package/dist/operators/client/media.schema.js +59 -0
- package/dist/operators/client/menu.js +2 -1
- package/dist/operators/client/menu.schema.js +54 -0
- package/dist/operators/client/request.js +4 -3
- package/dist/operators/client/request.schema.js +21 -0
- package/dist/operators/client/request_details.js +2 -1
- package/dist/operators/client/request_details.schema.js +61 -0
- package/dist/operators/client/url_query.js +3 -2
- package/dist/operators/client/url_query.schema.js +61 -0
- package/dist/operators/server/base64.js +2 -1
- package/dist/operators/server/base64.schema.js +21 -0
- package/dist/operators/server/hash.js +2 -1
- package/dist/operators/server/hash.schema.js +21 -0
- package/dist/operators/server/item.js +2 -1
- package/dist/operators/server/item.schema.js +61 -0
- package/dist/operators/server/js.js +8 -2
- package/dist/operators/server/js.schema.js +21 -0
- package/dist/operators/server/payload.js +2 -1
- package/dist/operators/server/payload.schema.js +61 -0
- package/dist/operators/server/secret.js +3 -2
- package/dist/operators/server/secret.schema.js +50 -0
- package/dist/operators/server/step.js +2 -1
- package/dist/operators/server/step.schema.js +61 -0
- package/dist/operators/shared/and.js +4 -3
- package/dist/operators/shared/and.schema.js +21 -0
- package/dist/operators/shared/args.js +2 -1
- package/dist/operators/shared/args.schema.js +61 -0
- package/dist/operators/shared/array.js +2 -1
- package/dist/operators/shared/array.schema.js +20 -0
- package/dist/operators/shared/date.js +59 -28
- package/dist/operators/shared/date.schema.js +20 -0
- package/dist/operators/shared/divide.js +7 -6
- package/dist/operators/shared/divide.schema.js +26 -0
- package/dist/operators/shared/eq.js +5 -4
- package/dist/operators/shared/eq.schema.js +23 -0
- package/dist/operators/shared/function.js +3 -2
- package/dist/operators/shared/function.schema.js +20 -0
- package/dist/operators/shared/get.js +4 -3
- package/dist/operators/shared/get.schema.js +40 -0
- package/dist/operators/shared/gt.js +5 -4
- package/dist/operators/shared/gt.schema.js +23 -0
- package/dist/operators/shared/gte.js +5 -4
- package/dist/operators/shared/gte.schema.js +23 -0
- package/dist/operators/shared/if.js +4 -3
- package/dist/operators/shared/if.schema.js +36 -0
- package/dist/operators/shared/if_none.js +5 -4
- package/dist/operators/shared/if_none.schema.js +23 -0
- package/dist/operators/shared/intl.js +2 -1
- package/dist/operators/shared/intl.schema.js +20 -0
- package/dist/operators/shared/json.js +3 -1
- package/dist/operators/shared/json.schema.js +20 -0
- package/dist/operators/shared/log.js +2 -1
- package/dist/operators/shared/log.schema.js +20 -0
- package/dist/operators/shared/lt.js +5 -4
- package/dist/operators/shared/lt.schema.js +23 -0
- package/dist/operators/shared/lte.js +5 -4
- package/dist/operators/shared/lte.schema.js +23 -0
- package/dist/operators/shared/math.js +5 -2
- package/dist/operators/shared/math.schema.js +20 -0
- package/dist/operators/shared/ne.js +5 -4
- package/dist/operators/shared/ne.schema.js +23 -0
- package/dist/operators/shared/not.js +2 -1
- package/dist/operators/shared/not.schema.js +21 -0
- package/dist/operators/shared/number.js +2 -1
- package/dist/operators/shared/number.schema.js +20 -0
- package/dist/operators/shared/object.js +2 -1
- package/dist/operators/shared/object.schema.js +20 -0
- package/dist/operators/shared/operator.js +6 -5
- package/dist/operators/shared/operator.schema.js +33 -0
- package/dist/operators/shared/or.js +4 -3
- package/dist/operators/shared/or.schema.js +21 -0
- package/dist/operators/shared/product.js +4 -3
- package/dist/operators/shared/product.schema.js +24 -0
- package/dist/operators/shared/random.js +14 -18
- package/dist/operators/shared/random.schema.js +60 -0
- package/dist/operators/shared/regex.js +8 -6
- package/dist/operators/shared/regex.schema.js +50 -0
- package/dist/operators/shared/state.js +2 -1
- package/dist/operators/shared/state.schema.js +61 -0
- package/dist/operators/shared/string.js +2 -1
- package/dist/operators/shared/string.schema.js +20 -0
- package/dist/operators/shared/subtract.js +6 -5
- package/dist/operators/shared/subtract.schema.js +26 -0
- package/dist/operators/shared/sum.js +4 -3
- package/dist/operators/shared/sum.schema.js +24 -0
- package/dist/operators/shared/switch.js +5 -4
- package/dist/operators/shared/switch.schema.js +49 -0
- package/dist/operators/shared/type.js +4 -3
- package/dist/operators/shared/type.schema.js +71 -0
- package/dist/operators/shared/uri.js +2 -1
- package/dist/operators/shared/uri.schema.js +21 -0
- package/dist/operators/shared/user.js +2 -1
- package/dist/operators/shared/user.schema.js +61 -0
- package/dist/operatorsBuild.js +1 -1
- package/dist/operatorsClient.js +1 -1
- package/dist/operatorsServer.js +1 -1
- package/dist/schemas.js +74 -0
- package/dist/types.js +1 -1
- package/package.json +4 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,4 +15,5 @@
|
|
|
15
15
|
*/ function _not({ params }) {
|
|
16
16
|
return !params;
|
|
17
17
|
}
|
|
18
|
+
_not.dynamic = false;
|
|
18
19
|
export default _not;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export default {
|
|
16
|
+
type: 'object',
|
|
17
|
+
params: {
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
description: 'Boolean value to negate.'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -143,4 +143,5 @@ function _number({ params, location, methodName }) {
|
|
|
143
143
|
params
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
+
_number.dynamic = false;
|
|
146
147
|
export default _number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export default {
|
|
16
|
+
type: 'object',
|
|
17
|
+
params: {
|
|
18
|
+
description: 'Number method params. Accepts a single value or array/object with named args depending on method.'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -126,4 +126,5 @@ function _object({ params, location, methodName }) {
|
|
|
126
126
|
params
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
+
_object.dynamic = false;
|
|
129
130
|
export default _object;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export default {
|
|
16
|
+
type: 'object',
|
|
17
|
+
params: {
|
|
18
|
+
description: 'Object method params. Accepts array positional args or object with named args depending on method.'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
function _operator(options) {
|
|
17
17
|
const { operators, params, location } = options;
|
|
18
18
|
if (!type.isString(params.name)) {
|
|
19
|
-
throw new Error(`
|
|
19
|
+
throw new Error(`_operator.name must be a valid operator name as string.`);
|
|
20
20
|
}
|
|
21
21
|
if (params.name === '_operator') {
|
|
22
|
-
throw new Error(`
|
|
22
|
+
throw new Error(`_operator.name cannot be set to _operator to avoid infinite loop reference.`);
|
|
23
23
|
}
|
|
24
24
|
if (params.name.includes('experimental')) {
|
|
25
|
-
throw new Error(`
|
|
25
|
+
throw new Error(`Experimental operators cannot be used with _operator.`);
|
|
26
26
|
}
|
|
27
27
|
const [operator, methodName] = params.name.split('.');
|
|
28
28
|
if (Object.prototype.hasOwnProperty.call(operators, operator)) {
|
|
@@ -33,6 +33,7 @@ function _operator(options) {
|
|
|
33
33
|
methodName
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
throw new Error(`
|
|
36
|
+
throw new Error(`_operator - Invalid operator name.`);
|
|
37
37
|
}
|
|
38
|
+
_operator.dynamic = true;
|
|
38
39
|
export default _operator;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export default {
|
|
16
|
+
type: 'object',
|
|
17
|
+
params: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
required: [
|
|
20
|
+
'name'
|
|
21
|
+
],
|
|
22
|
+
properties: {
|
|
23
|
+
name: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'Name of the operator to call (e.g. "_sum", "_string.concat").'
|
|
26
|
+
},
|
|
27
|
+
params: {
|
|
28
|
+
description: 'Params to pass to the operator.'
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
additionalProperties: false
|
|
32
|
+
}
|
|
33
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
-
function _or({
|
|
16
|
+
function _or({ params }) {
|
|
17
17
|
if (!type.isArray(params)) {
|
|
18
|
-
throw new Error(`
|
|
18
|
+
throw new Error(`_or takes an array type.`);
|
|
19
19
|
}
|
|
20
20
|
return !!params.reduce((acc, el)=>acc || el, false);
|
|
21
21
|
}
|
|
22
|
+
_or.dynamic = false;
|
|
22
23
|
export default _or;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export default {
|
|
16
|
+
type: 'object',
|
|
17
|
+
params: {
|
|
18
|
+
type: 'array',
|
|
19
|
+
description: 'Array of values. Returns true if any value is truthy.'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
-
function _product({ params
|
|
16
|
+
function _product({ params }) {
|
|
17
17
|
if (!type.isArray(params)) {
|
|
18
|
-
throw new Error(`
|
|
18
|
+
throw new Error(`_product takes an array type as input.`);
|
|
19
19
|
}
|
|
20
20
|
return params.reduce((accumulator, value)=>{
|
|
21
21
|
if (type.isNumber(value)) {
|
|
@@ -24,4 +24,5 @@ function _product({ params, location }) {
|
|
|
24
24
|
return accumulator;
|
|
25
25
|
}, 1);
|
|
26
26
|
}
|
|
27
|
+
_product.dynamic = false;
|
|
27
28
|
export default _product;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export default {
|
|
16
|
+
type: 'object',
|
|
17
|
+
params: {
|
|
18
|
+
type: 'array',
|
|
19
|
+
items: {
|
|
20
|
+
type: 'number'
|
|
21
|
+
},
|
|
22
|
+
description: 'Array of numbers to multiply.'
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -30,17 +30,17 @@ function getRandomInt(min, max) {
|
|
|
30
30
|
function getRandomFloat(min, max) {
|
|
31
31
|
return Math.random() * (Math.ceil(max) - Math.floor(min)) + Math.floor(min);
|
|
32
32
|
}
|
|
33
|
-
function evaluateDefaultNumber({ key, defaultValue, params
|
|
33
|
+
function evaluateDefaultNumber({ key, defaultValue, params }) {
|
|
34
34
|
if (type.isUndefined(params[key])) {
|
|
35
35
|
params[key] = defaultValue;
|
|
36
36
|
}
|
|
37
37
|
if (!type.isNumber(params[key])) {
|
|
38
|
-
throw new Error(`
|
|
38
|
+
throw new Error(`_random.${key} takes a number type.`);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
function _random({
|
|
41
|
+
function _random({ params }) {
|
|
42
42
|
if (!type.isString(params) && !type.isObject(params)) {
|
|
43
|
-
throw new Error(`
|
|
43
|
+
throw new Error(`_random takes a string or object type.`);
|
|
44
44
|
}
|
|
45
45
|
if (!type.isObject(params)) {
|
|
46
46
|
params = {
|
|
@@ -48,23 +48,21 @@ function _random({ location, params }) {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
if (!typesEnum.includes(params.type)) {
|
|
51
|
-
throw new Error(`
|
|
51
|
+
throw new Error(`_random type can be either 'string', 'integer' or 'float'.`);
|
|
52
52
|
}
|
|
53
53
|
if (params.type === 'float') {
|
|
54
54
|
evaluateDefaultNumber({
|
|
55
55
|
key: 'min',
|
|
56
56
|
defaultValue: 0,
|
|
57
|
-
params
|
|
58
|
-
location
|
|
57
|
+
params
|
|
59
58
|
});
|
|
60
59
|
evaluateDefaultNumber({
|
|
61
60
|
key: 'max',
|
|
62
61
|
defaultValue: params.min + 1,
|
|
63
|
-
params
|
|
64
|
-
location
|
|
62
|
+
params
|
|
65
63
|
});
|
|
66
64
|
if (params.max < params.min) {
|
|
67
|
-
throw new Error(`
|
|
65
|
+
throw new Error(`_random.min must be less than _random.max.`);
|
|
68
66
|
}
|
|
69
67
|
return getRandomFloat(params.min, params.max);
|
|
70
68
|
}
|
|
@@ -72,26 +70,24 @@ function _random({ location, params }) {
|
|
|
72
70
|
evaluateDefaultNumber({
|
|
73
71
|
key: 'min',
|
|
74
72
|
defaultValue: 0,
|
|
75
|
-
params
|
|
76
|
-
location
|
|
73
|
+
params
|
|
77
74
|
});
|
|
78
75
|
evaluateDefaultNumber({
|
|
79
76
|
key: 'max',
|
|
80
77
|
defaultValue: params.min + 100,
|
|
81
|
-
params
|
|
82
|
-
location
|
|
78
|
+
params
|
|
83
79
|
});
|
|
84
80
|
if (params.max < params.min) {
|
|
85
|
-
throw new Error(`
|
|
81
|
+
throw new Error(`_random.min must be less than _random.max.`);
|
|
86
82
|
}
|
|
87
83
|
return getRandomInt(params.min, params.max);
|
|
88
84
|
}
|
|
89
85
|
evaluateDefaultNumber({
|
|
90
86
|
key: 'length',
|
|
91
87
|
defaultValue: 8,
|
|
92
|
-
params
|
|
93
|
-
location
|
|
88
|
+
params
|
|
94
89
|
});
|
|
95
90
|
return generateRandomString(params.length);
|
|
96
91
|
}
|
|
92
|
+
_random.dynamic = true;
|
|
97
93
|
export default _random;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export default {
|
|
16
|
+
type: 'object',
|
|
17
|
+
params: {
|
|
18
|
+
oneOf: [
|
|
19
|
+
{
|
|
20
|
+
type: 'string',
|
|
21
|
+
enum: [
|
|
22
|
+
'string',
|
|
23
|
+
'integer',
|
|
24
|
+
'float'
|
|
25
|
+
],
|
|
26
|
+
description: 'Type of random value to generate.'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: 'object',
|
|
30
|
+
required: [
|
|
31
|
+
'type'
|
|
32
|
+
],
|
|
33
|
+
properties: {
|
|
34
|
+
type: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
enum: [
|
|
37
|
+
'string',
|
|
38
|
+
'integer',
|
|
39
|
+
'float'
|
|
40
|
+
],
|
|
41
|
+
description: 'Type of random value to generate.'
|
|
42
|
+
},
|
|
43
|
+
length: {
|
|
44
|
+
type: 'number',
|
|
45
|
+
description: 'Length of random string (default 8). Only for type "string".'
|
|
46
|
+
},
|
|
47
|
+
min: {
|
|
48
|
+
type: 'number',
|
|
49
|
+
description: 'Minimum value (inclusive). Only for type "integer" or "float".'
|
|
50
|
+
},
|
|
51
|
+
max: {
|
|
52
|
+
type: 'number',
|
|
53
|
+
description: 'Maximum value (inclusive). Only for type "integer" or "float".'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
additionalProperties: false
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
function _regex({ location, params, state }) {
|
|
17
17
|
const pattern = type.isObject(params) ? params.pattern : params;
|
|
18
18
|
if (!type.isString(pattern)) {
|
|
19
|
-
throw new Error(`
|
|
19
|
+
throw new Error(`_regex.pattern must be a string.`);
|
|
20
20
|
}
|
|
21
21
|
let on = !type.isUndefined(params.on) ? params.on : get(state, location);
|
|
22
22
|
if (!type.isUndefined(params.key)) {
|
|
23
23
|
if (!type.isString(params.key)) {
|
|
24
|
-
throw new Error(`
|
|
24
|
+
throw new Error(`_regex.key must be a string.`);
|
|
25
25
|
}
|
|
26
26
|
on = get(state, params.key);
|
|
27
27
|
}
|
|
@@ -29,14 +29,16 @@ function _regex({ location, params, state }) {
|
|
|
29
29
|
return false;
|
|
30
30
|
}
|
|
31
31
|
if (!type.isString(on)) {
|
|
32
|
-
throw new Error(`
|
|
32
|
+
throw new Error(`_regex.on must be a string.`);
|
|
33
33
|
}
|
|
34
34
|
try {
|
|
35
35
|
const re = new RegExp(pattern, params.flags || 'gm');
|
|
36
36
|
return re.test(on);
|
|
37
37
|
} catch (e) {
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
throw new Error('_regex failed to execute RegExp.test.', {
|
|
39
|
+
cause: e
|
|
40
|
+
});
|
|
40
41
|
}
|
|
41
42
|
}
|
|
43
|
+
_regex.dynamic = true;
|
|
42
44
|
export default _regex;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export default {
|
|
16
|
+
type: 'object',
|
|
17
|
+
params: {
|
|
18
|
+
oneOf: [
|
|
19
|
+
{
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'Regex pattern string to test against the current location value.'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: 'object',
|
|
25
|
+
required: [
|
|
26
|
+
'pattern'
|
|
27
|
+
],
|
|
28
|
+
properties: {
|
|
29
|
+
pattern: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'Regex pattern string.'
|
|
32
|
+
},
|
|
33
|
+
on: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description: 'String to test the pattern against.'
|
|
36
|
+
},
|
|
37
|
+
key: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
description: 'State key path to get the string to test against.'
|
|
40
|
+
},
|
|
41
|
+
flags: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
description: 'Regex flags (default "gm").'
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
additionalProperties: false
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -22,4 +22,5 @@ function _state({ arrayIndices, location, params, state }) {
|
|
|
22
22
|
params
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
+
_state.dynamic = true;
|
|
25
26
|
export default _state;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export default {
|
|
16
|
+
type: 'object',
|
|
17
|
+
params: {
|
|
18
|
+
oneOf: [
|
|
19
|
+
{
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'Dot-notation path to value in state.'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: 'integer',
|
|
25
|
+
description: 'Index to access in state.'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
type: 'boolean',
|
|
29
|
+
enum: [
|
|
30
|
+
true
|
|
31
|
+
],
|
|
32
|
+
description: 'Return all state.'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'object',
|
|
36
|
+
properties: {
|
|
37
|
+
key: {
|
|
38
|
+
oneOf: [
|
|
39
|
+
{
|
|
40
|
+
type: 'string',
|
|
41
|
+
description: 'Dot-notation path to value in state.'
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: 'integer',
|
|
45
|
+
description: 'Index to access in state.'
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
default: {
|
|
50
|
+
description: 'Default value if key does not exist.'
|
|
51
|
+
},
|
|
52
|
+
all: {
|
|
53
|
+
type: 'boolean',
|
|
54
|
+
description: 'Return all state.'
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
additionalProperties: false
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -289,4 +289,5 @@ function _string({ params, location, methodName }) {
|
|
|
289
289
|
instanceType: 'string'
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
|
+
_string.dynamic = false;
|
|
292
293
|
export default _string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export default {
|
|
16
|
+
type: 'object',
|
|
17
|
+
params: {
|
|
18
|
+
description: 'String method params. Accepts array positional args or object with named args depending on method.'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,16 +13,17 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
-
function _subtract({ params
|
|
16
|
+
function _subtract({ params }) {
|
|
17
17
|
if (!type.isArray(params)) {
|
|
18
|
-
throw new Error(`
|
|
18
|
+
throw new Error(`_subtract takes an array type as input.`);
|
|
19
19
|
}
|
|
20
20
|
if (params.length !== 2) {
|
|
21
|
-
throw new Error(`
|
|
21
|
+
throw new Error(`_subtract takes an array of length 2 as input.`);
|
|
22
22
|
}
|
|
23
23
|
if (!type.isNumber(params[0]) || !type.isNumber(params[1])) {
|
|
24
|
-
throw new Error(`
|
|
24
|
+
throw new Error(`_subtract takes an array of 2 numbers.`);
|
|
25
25
|
}
|
|
26
26
|
return params[0] - params[1];
|
|
27
27
|
}
|
|
28
|
+
_subtract.dynamic = false;
|
|
28
29
|
export default _subtract;
|