@lowdefy/operators-js 4.0.0-alpha.29 → 4.0.0-alpha.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/index.js +17 -0
- package/dist/operators/build/env.js +25 -0
- package/dist/operators/client/_index.js +25 -0
- package/dist/operators/client/actions.js +25 -0
- package/dist/operators/client/base64.js +50 -0
- package/dist/operators/client/event.js +25 -0
- package/dist/operators/client/event_log.js +25 -0
- package/dist/operators/client/global.js +25 -0
- package/dist/operators/client/input.js +25 -0
- package/dist/operators/client/location.js +60 -0
- package/dist/operators/client/media.js +62 -0
- package/dist/operators/client/menu.js +25 -0
- package/dist/operators/client/request.js +34 -0
- package/dist/operators/client/request_details.js +25 -0
- package/dist/operators/client/state.js +25 -0
- package/dist/operators/client/url_query.js +30 -0
- package/dist/operators/server/base64.js +52 -0
- package/dist/operators/server/hash.js +84 -0
- package/dist/operators/server/payload.js +24 -0
- package/dist/operators/server/secret.js +32 -0
- package/dist/operators/shared/and.js +22 -0
- package/dist/operators/shared/args.js +25 -0
- package/dist/operators/shared/array.js +263 -0
- package/dist/operators/shared/date.js +54 -0
- package/dist/operators/shared/divide.js +31 -0
- package/dist/operators/shared/eq.js +25 -0
- package/dist/operators/shared/function.js +32 -0
- package/dist/operators/shared/get.js +36 -0
- package/dist/operators/shared/gt.js +25 -0
- package/dist/operators/shared/gte.js +25 -0
- package/dist/operators/shared/if.js +24 -0
- package/dist/operators/shared/if_none.js +28 -0
- package/dist/operators/shared/intl.js +107 -0
- package/dist/operators/shared/json.js +60 -0
- package/dist/operators/shared/log.js +20 -0
- package/dist/operators/shared/lt.js +25 -0
- package/dist/operators/shared/lte.js +25 -0
- package/dist/operators/shared/math.js +271 -0
- package/dist/operators/shared/ne.js +25 -0
- package/dist/operators/shared/not.js +18 -0
- package/dist/operators/shared/number.js +146 -0
- package/dist/operators/shared/object.js +129 -0
- package/dist/operators/shared/operator.js +38 -0
- package/dist/operators/shared/or.js +22 -0
- package/dist/operators/shared/product.js +27 -0
- package/dist/operators/shared/random.js +97 -0
- package/dist/operators/shared/regex.js +42 -0
- package/dist/operators/shared/string.js +286 -0
- package/dist/operators/shared/subtract.js +28 -0
- package/dist/operators/shared/sum.js +27 -0
- package/dist/operators/shared/switch.js +30 -0
- package/dist/operators/shared/type.js +51 -0
- package/dist/operators/shared/uri.js +50 -0
- package/dist/operators/shared/user.js +25 -0
- package/dist/operatorsBuild.js +88 -0
- package/dist/operatorsClient.js +62 -0
- package/dist/operatorsServer.js +52 -0
- package/dist/types.js +22 -0
- package/package.json +4 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import * as operatorsClient from './operatorsClient.js';
|
|
16
|
+
import * as operatorsServer from './operatorsServer.js';
|
|
17
|
+
export { operatorsClient, operatorsServer };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { getFromObject } from '@lowdefy/operators';
|
|
16
|
+
function _env({ arrayIndices , env , location , params }) {
|
|
17
|
+
return getFromObject({
|
|
18
|
+
arrayIndices,
|
|
19
|
+
location,
|
|
20
|
+
object: env,
|
|
21
|
+
operator: '_env',
|
|
22
|
+
params
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export default _env;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { getFromObject } from '@lowdefy/operators';
|
|
16
|
+
function _index({ arrayIndices , location , params }) {
|
|
17
|
+
return getFromObject({
|
|
18
|
+
arrayIndices,
|
|
19
|
+
location,
|
|
20
|
+
object: arrayIndices,
|
|
21
|
+
operator: '_index',
|
|
22
|
+
params
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export default _index;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { getFromObject } from '@lowdefy/operators';
|
|
16
|
+
function _actions({ actions , arrayIndices , location , params }) {
|
|
17
|
+
return getFromObject({
|
|
18
|
+
arrayIndices,
|
|
19
|
+
location,
|
|
20
|
+
object: actions,
|
|
21
|
+
operator: '_actions',
|
|
22
|
+
params
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export default _actions;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { runClass } from '@lowdefy/operators';
|
|
16
|
+
function decode(input) {
|
|
17
|
+
return atob(input);
|
|
18
|
+
}
|
|
19
|
+
function encode(input) {
|
|
20
|
+
return btoa(input);
|
|
21
|
+
}
|
|
22
|
+
const functions = {
|
|
23
|
+
encode,
|
|
24
|
+
decode
|
|
25
|
+
};
|
|
26
|
+
const meta = {
|
|
27
|
+
encode: {
|
|
28
|
+
singleArg: true,
|
|
29
|
+
validTypes: [
|
|
30
|
+
'string'
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
decode: {
|
|
34
|
+
singleArg: true,
|
|
35
|
+
validTypes: [
|
|
36
|
+
'string'
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
function _base64({ params , location , methodName }) {
|
|
41
|
+
return runClass({
|
|
42
|
+
functions,
|
|
43
|
+
location,
|
|
44
|
+
meta,
|
|
45
|
+
methodName,
|
|
46
|
+
operator: '_base64',
|
|
47
|
+
params
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export default _base64;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { getFromObject } from '@lowdefy/operators';
|
|
16
|
+
function _event({ arrayIndices , event , location , params }) {
|
|
17
|
+
return getFromObject({
|
|
18
|
+
arrayIndices,
|
|
19
|
+
location,
|
|
20
|
+
object: event,
|
|
21
|
+
operator: '_event',
|
|
22
|
+
params
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export default _event;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { getFromObject } from '@lowdefy/operators';
|
|
16
|
+
function _event_log({ arrayIndices , eventLog , location , params }) {
|
|
17
|
+
return getFromObject({
|
|
18
|
+
arrayIndices,
|
|
19
|
+
location,
|
|
20
|
+
object: eventLog,
|
|
21
|
+
operator: '_event_log',
|
|
22
|
+
params
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export default _event_log;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { getFromObject } from '@lowdefy/operators';
|
|
16
|
+
function _global({ arrayIndices , location , lowdefyGlobal , params }) {
|
|
17
|
+
return getFromObject({
|
|
18
|
+
arrayIndices,
|
|
19
|
+
location,
|
|
20
|
+
object: lowdefyGlobal,
|
|
21
|
+
operator: '_global',
|
|
22
|
+
params
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export default _global;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { getFromObject } from '@lowdefy/operators';
|
|
16
|
+
function _input({ arrayIndices , input , location , params }) {
|
|
17
|
+
return getFromObject({
|
|
18
|
+
arrayIndices,
|
|
19
|
+
location,
|
|
20
|
+
object: input,
|
|
21
|
+
operator: '_input',
|
|
22
|
+
params
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export default _input;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { getFromObject } from '@lowdefy/operators';
|
|
16
|
+
const validProperties = [
|
|
17
|
+
'basePath',
|
|
18
|
+
'hash',
|
|
19
|
+
'homePageId',
|
|
20
|
+
'host',
|
|
21
|
+
'hostname',
|
|
22
|
+
'href',
|
|
23
|
+
'origin',
|
|
24
|
+
'pageId',
|
|
25
|
+
'pathname',
|
|
26
|
+
'port',
|
|
27
|
+
'protocol',
|
|
28
|
+
'search',
|
|
29
|
+
];
|
|
30
|
+
function _location({ arrayIndices , basePath , home , location , pageId , params , globals }) {
|
|
31
|
+
const { window } = globals;
|
|
32
|
+
if (!window?.location) {
|
|
33
|
+
throw new Error(`Operator Error: Browser window.location not available for _location. Received: ${JSON.stringify(params)} at ${location}.`);
|
|
34
|
+
}
|
|
35
|
+
if (!validProperties.includes(params)) {
|
|
36
|
+
throw new Error(`Operator Error: _location only returns values for ${validProperties.join(', ')}. Received: ${JSON.stringify(params)} at ${location}.`);
|
|
37
|
+
}
|
|
38
|
+
const windowLocation = {
|
|
39
|
+
basePath,
|
|
40
|
+
hash: window.location.hash,
|
|
41
|
+
homePageId: home.pageId,
|
|
42
|
+
host: window.location.host,
|
|
43
|
+
hostname: window.location.hostname,
|
|
44
|
+
href: window.location.href,
|
|
45
|
+
origin: window.location.origin,
|
|
46
|
+
pageId,
|
|
47
|
+
pathname: window.location.pathname,
|
|
48
|
+
port: window.location.port,
|
|
49
|
+
protocol: window.location.protocol,
|
|
50
|
+
search: window.location.search
|
|
51
|
+
};
|
|
52
|
+
return getFromObject({
|
|
53
|
+
arrayIndices,
|
|
54
|
+
location,
|
|
55
|
+
object: windowLocation,
|
|
56
|
+
operator: '_location',
|
|
57
|
+
params
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export default _location;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { getFromObject } from '@lowdefy/operators';
|
|
16
|
+
const breakpoints = {
|
|
17
|
+
xs: 576,
|
|
18
|
+
sm: 768,
|
|
19
|
+
md: 992,
|
|
20
|
+
lg: 1200,
|
|
21
|
+
xl: 1600
|
|
22
|
+
};
|
|
23
|
+
function _media({ arrayIndices , location , params , globals }) {
|
|
24
|
+
const { window } = globals;
|
|
25
|
+
if (!window?.innerWidth) {
|
|
26
|
+
throw new Error(`Operator Error: device window width not available for _media. Received: ${JSON.stringify(params)} at ${location}.`);
|
|
27
|
+
}
|
|
28
|
+
let size;
|
|
29
|
+
switch(true){
|
|
30
|
+
case window.innerWidth < breakpoints.xs:
|
|
31
|
+
size = 'xs';
|
|
32
|
+
break;
|
|
33
|
+
case window.innerWidth < breakpoints.sm:
|
|
34
|
+
size = 'sm';
|
|
35
|
+
break;
|
|
36
|
+
case window.innerWidth < breakpoints.md:
|
|
37
|
+
size = 'md';
|
|
38
|
+
break;
|
|
39
|
+
case window.innerWidth < breakpoints.lg:
|
|
40
|
+
size = 'lg';
|
|
41
|
+
break;
|
|
42
|
+
case window.innerWidth < breakpoints.xl:
|
|
43
|
+
size = 'xl';
|
|
44
|
+
break;
|
|
45
|
+
default:
|
|
46
|
+
size = 'xxl';
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
const media = {
|
|
50
|
+
size,
|
|
51
|
+
width: window.innerWidth,
|
|
52
|
+
height: window.innerHeight
|
|
53
|
+
};
|
|
54
|
+
return getFromObject({
|
|
55
|
+
arrayIndices,
|
|
56
|
+
location,
|
|
57
|
+
object: media,
|
|
58
|
+
operator: '_media',
|
|
59
|
+
params
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export default _media;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { getFromArray } from '@lowdefy/operators';
|
|
16
|
+
function _menu({ params , menus , location }) {
|
|
17
|
+
return getFromArray({
|
|
18
|
+
params,
|
|
19
|
+
array: menus,
|
|
20
|
+
key: 'menuId',
|
|
21
|
+
operator: '_menu',
|
|
22
|
+
location
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export default _menu;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { applyArrayIndices, get, serializer, type } from '@lowdefy/helpers';
|
|
16
|
+
function _request({ arrayIndices , params , requests , location }) {
|
|
17
|
+
if (!type.isString(params)) {
|
|
18
|
+
throw new Error(`Operator Error: _request accepts a string value. Received: ${JSON.stringify(params)} at ${location}.`);
|
|
19
|
+
}
|
|
20
|
+
const splitKey = params.split('.');
|
|
21
|
+
const [requestId, ...keyParts] = splitKey;
|
|
22
|
+
if (requestId in requests && !requests[requestId][0].loading) {
|
|
23
|
+
if (splitKey.length === 1) {
|
|
24
|
+
return serializer.copy(requests[requestId][0].response);
|
|
25
|
+
}
|
|
26
|
+
const key = keyParts.reduce((acc, value)=>acc === '' ? value : acc.concat('.', value), '');
|
|
27
|
+
return get(requests[requestId][0].response, applyArrayIndices(arrayIndices, key), {
|
|
28
|
+
copy: true,
|
|
29
|
+
default: null
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
export default _request;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { getFromObject } from '@lowdefy/operators';
|
|
16
|
+
function _request_details({ params , requests , arrayIndices , location }) {
|
|
17
|
+
return getFromObject({
|
|
18
|
+
arrayIndices,
|
|
19
|
+
location,
|
|
20
|
+
object: requests,
|
|
21
|
+
operator: '_request_details',
|
|
22
|
+
params
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export default _request_details;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { getFromObject } from '@lowdefy/operators';
|
|
16
|
+
function _state({ arrayIndices , location , params , state }) {
|
|
17
|
+
return getFromObject({
|
|
18
|
+
arrayIndices,
|
|
19
|
+
location,
|
|
20
|
+
object: state,
|
|
21
|
+
operator: '_state',
|
|
22
|
+
params
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export default _state;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { getFromObject } from '@lowdefy/operators';
|
|
16
|
+
import { urlQuery } from '@lowdefy/helpers';
|
|
17
|
+
function _url_query({ arrayIndices , globals , location , params }) {
|
|
18
|
+
const { window } = globals;
|
|
19
|
+
if (!window?.location) {
|
|
20
|
+
throw new Error(`Operator Error: Browser window.location not available for _url_query. Received: ${JSON.stringify(params)} at ${location}.`);
|
|
21
|
+
}
|
|
22
|
+
return getFromObject({
|
|
23
|
+
arrayIndices,
|
|
24
|
+
location,
|
|
25
|
+
object: urlQuery.parse(window.location.search.slice(1)),
|
|
26
|
+
operator: '_url_query',
|
|
27
|
+
params
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export default _url_query;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { runClass } from '@lowdefy/operators';
|
|
16
|
+
function decode(input) {
|
|
17
|
+
const buff = Buffer.from(input, 'base64');
|
|
18
|
+
return buff.toString('utf8');
|
|
19
|
+
}
|
|
20
|
+
function encode(input) {
|
|
21
|
+
const buff = Buffer.from(input, 'utf8');
|
|
22
|
+
return buff.toString('base64');
|
|
23
|
+
}
|
|
24
|
+
const functions = {
|
|
25
|
+
encode,
|
|
26
|
+
decode
|
|
27
|
+
};
|
|
28
|
+
const meta = {
|
|
29
|
+
encode: {
|
|
30
|
+
singleArg: true,
|
|
31
|
+
validTypes: [
|
|
32
|
+
'string'
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
decode: {
|
|
36
|
+
singleArg: true,
|
|
37
|
+
validTypes: [
|
|
38
|
+
'string'
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
function _base64({ params , location , methodName }) {
|
|
43
|
+
return runClass({
|
|
44
|
+
functions,
|
|
45
|
+
location,
|
|
46
|
+
meta,
|
|
47
|
+
methodName,
|
|
48
|
+
operator: '_base64',
|
|
49
|
+
params
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export default _base64;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import crypto from 'crypto';
|
|
16
|
+
import { runClass } from '@lowdefy/operators';
|
|
17
|
+
function hash(algorithm, data) {
|
|
18
|
+
return crypto.createHash(algorithm).update(data).digest('hex');
|
|
19
|
+
}
|
|
20
|
+
function md5(data) {
|
|
21
|
+
return hash('md5', data);
|
|
22
|
+
}
|
|
23
|
+
function sha1(data) {
|
|
24
|
+
return hash('sha1', data);
|
|
25
|
+
}
|
|
26
|
+
function sha256(data) {
|
|
27
|
+
return hash('sha256', data);
|
|
28
|
+
}
|
|
29
|
+
function sha512(data) {
|
|
30
|
+
return hash('sha512', data);
|
|
31
|
+
}
|
|
32
|
+
function ripemd160(data) {
|
|
33
|
+
return hash('ripemd160', data);
|
|
34
|
+
}
|
|
35
|
+
const functions = {
|
|
36
|
+
md5,
|
|
37
|
+
sha1,
|
|
38
|
+
sha256,
|
|
39
|
+
sha512,
|
|
40
|
+
ripemd160
|
|
41
|
+
};
|
|
42
|
+
const meta = {
|
|
43
|
+
md5: {
|
|
44
|
+
validTypes: [
|
|
45
|
+
'string'
|
|
46
|
+
],
|
|
47
|
+
singleArg: true
|
|
48
|
+
},
|
|
49
|
+
sha1: {
|
|
50
|
+
validTypes: [
|
|
51
|
+
'string'
|
|
52
|
+
],
|
|
53
|
+
singleArg: true
|
|
54
|
+
},
|
|
55
|
+
sha256: {
|
|
56
|
+
validTypes: [
|
|
57
|
+
'string'
|
|
58
|
+
],
|
|
59
|
+
singleArg: true
|
|
60
|
+
},
|
|
61
|
+
sha512: {
|
|
62
|
+
validTypes: [
|
|
63
|
+
'string'
|
|
64
|
+
],
|
|
65
|
+
singleArg: true
|
|
66
|
+
},
|
|
67
|
+
ripemd160: {
|
|
68
|
+
validTypes: [
|
|
69
|
+
'string'
|
|
70
|
+
],
|
|
71
|
+
singleArg: true
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
function _hash({ params , location , methodName }) {
|
|
75
|
+
return runClass({
|
|
76
|
+
functions,
|
|
77
|
+
location,
|
|
78
|
+
meta,
|
|
79
|
+
methodName,
|
|
80
|
+
operator: '_hash',
|
|
81
|
+
params
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export default _hash;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ import { getFromObject } from '@lowdefy/operators';
|
|
16
|
+
function _payload({ location , params , payload }) {
|
|
17
|
+
return getFromObject({
|
|
18
|
+
location,
|
|
19
|
+
object: payload,
|
|
20
|
+
operator: '_payload',
|
|
21
|
+
params
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export default _payload;
|