@lowdefy/operators 3.22.0 → 4.0.0-alpha.1
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/common/and.js +8 -24
- package/dist/common/args.js +10 -31
- package/dist/common/array.js +244 -153
- package/dist/common/change_case.js +114 -160
- package/dist/common/date.js +33 -54
- package/dist/common/divide.js +16 -36
- package/dist/common/eq.js +10 -28
- package/dist/common/function.js +27 -59
- package/dist/common/get.js +21 -46
- package/dist/common/gt.js +10 -28
- package/dist/common/gte.js +10 -28
- package/dist/common/if.js +9 -26
- package/dist/common/if_none.js +13 -32
- package/dist/common/index.js +39 -53
- package/dist/common/json.js +53 -57
- package/dist/common/log.js +5 -18
- package/dist/common/lt.js +10 -28
- package/dist/common/lte.js +10 -28
- package/dist/common/math.js +255 -194
- package/dist/common/mql.js +93 -102
- package/dist/common/ne.js +10 -28
- package/dist/common/not.js +3 -16
- package/dist/common/number.js +130 -108
- package/dist/common/nunjucks.js +24 -44
- package/dist/common/object.js +89 -98
- package/dist/common/operator.js +33 -44
- package/dist/common/or.js +8 -24
- package/dist/common/product.js +11 -29
- package/dist/common/random.js +74 -109
- package/dist/common/regex.js +26 -49
- package/dist/common/string.js +270 -171
- package/dist/common/subtract.js +13 -32
- package/dist/common/sum.js +11 -29
- package/dist/common/switch.js +30 -0
- package/dist/common/type.js +36 -67
- package/dist/common/uri.js +29 -46
- package/dist/common/user.js +10 -35
- package/dist/common/uuid.js +48 -59
- package/dist/common/yaml.js +56 -63
- package/dist/getFromArray.js +22 -44
- package/dist/getFromObject.js +25 -70
- package/dist/index.js +14 -20
- package/dist/node/base64.js +31 -48
- package/dist/node/diff.js +30 -47
- package/dist/node/hash.js +55 -71
- package/dist/node/index.js +6 -14
- package/dist/{web/list_contexts.js → node/payload.js} +9 -16
- package/dist/node/secret.js +32 -53
- package/dist/nodeParser.js +95 -146
- package/dist/runClass.js +57 -82
- package/dist/runInstance.js +60 -84
- package/dist/web/_index.js +25 -0
- package/dist/web/actions.js +10 -31
- package/dist/web/base64.js +29 -46
- package/dist/{common/_index.js → web/event.js} +10 -30
- package/dist/web/event_log.js +10 -35
- package/dist/web/format.js +15 -37
- package/dist/web/global.js +25 -0
- package/dist/web/index.js +17 -21
- package/dist/{common/event.js → web/input.js} +10 -31
- package/dist/web/js.js +10 -30
- package/dist/web/location.js +44 -59
- package/dist/web/media.js +46 -75
- package/dist/web/menu.js +10 -28
- package/dist/web/request.js +19 -40
- package/dist/web/request_details.js +10 -35
- package/dist/web/state.js +25 -0
- package/dist/web/url_query.js +25 -0
- package/dist/webParser.js +115 -157
- package/package.json +16 -15
- package/dist/common/global.js +0 -50
- package/dist/common/input.js +0 -50
- package/dist/common/state.js +0 -50
- package/dist/common/url_query.js +0 -50
- package/dist/getFromOtherContext.js +0 -96
package/dist/web/base64.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _runClass = _interopRequireDefault(require("../runClass"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
1
|
/*
|
|
13
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
14
3
|
|
|
@@ -23,45 +12,39 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
23
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
24
13
|
See the License for the specific language governing permissions and
|
|
25
14
|
limitations under the License.
|
|
26
|
-
*/
|
|
15
|
+
*/ import runClass from '../runClass.js';
|
|
27
16
|
function decode(input) {
|
|
28
|
-
|
|
17
|
+
return atob(input);
|
|
29
18
|
}
|
|
30
|
-
|
|
31
19
|
function encode(input) {
|
|
32
|
-
|
|
20
|
+
return btoa(input);
|
|
33
21
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
decode
|
|
22
|
+
const functions = {
|
|
23
|
+
encode,
|
|
24
|
+
decode
|
|
38
25
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
+
}
|
|
48
39
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
location,
|
|
59
|
-
meta,
|
|
60
|
-
methodName,
|
|
61
|
-
operator: '_base64',
|
|
62
|
-
params
|
|
63
|
-
});
|
|
40
|
+
function _base64({ params , location , methodName }) {
|
|
41
|
+
return runClass({
|
|
42
|
+
functions,
|
|
43
|
+
location,
|
|
44
|
+
meta,
|
|
45
|
+
methodName,
|
|
46
|
+
operator: '_base64',
|
|
47
|
+
params
|
|
48
|
+
});
|
|
64
49
|
}
|
|
65
|
-
|
|
66
|
-
var _default = _base64;
|
|
67
|
-
exports.default = _default;
|
|
50
|
+
export default _base64;
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _getFromObject = _interopRequireDefault(require("../getFromObject"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
1
|
/*
|
|
13
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
14
3
|
|
|
@@ -23,23 +12,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
23
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
24
13
|
See the License for the specific language governing permissions and
|
|
25
14
|
limitations under the License.
|
|
26
|
-
*/
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
arrayIndices,
|
|
36
|
-
env,
|
|
37
|
-
location,
|
|
38
|
-
object: arrayIndices,
|
|
39
|
-
operator: '_index',
|
|
40
|
-
params
|
|
41
|
-
});
|
|
15
|
+
*/ import getFromObject from '../getFromObject.js';
|
|
16
|
+
function _event({ arrayIndices , event , location , params }) {
|
|
17
|
+
return getFromObject({
|
|
18
|
+
arrayIndices,
|
|
19
|
+
location,
|
|
20
|
+
object: event,
|
|
21
|
+
operator: '_event',
|
|
22
|
+
params
|
|
23
|
+
});
|
|
42
24
|
}
|
|
43
|
-
|
|
44
|
-
var _default = _index;
|
|
45
|
-
exports.default = _default;
|
|
25
|
+
export default _event;
|
package/dist/web/event_log.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _getFromObject = _interopRequireDefault(require("../getFromObject"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
1
|
/*
|
|
13
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
14
3
|
|
|
@@ -23,28 +12,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
23
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
24
13
|
See the License for the specific language governing permissions and
|
|
25
14
|
limitations under the License.
|
|
26
|
-
*/
|
|
27
|
-
function _event_log(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
env
|
|
36
|
-
} = _ref;
|
|
37
|
-
return (0, _getFromObject.default)({
|
|
38
|
-
arrayIndices,
|
|
39
|
-
context,
|
|
40
|
-
contexts,
|
|
41
|
-
env,
|
|
42
|
-
location,
|
|
43
|
-
object: eventLog,
|
|
44
|
-
operator: '_event_log',
|
|
45
|
-
params
|
|
46
|
-
});
|
|
15
|
+
*/ import getFromObject from '../getFromObject.js';
|
|
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
|
+
});
|
|
47
24
|
}
|
|
48
|
-
|
|
49
|
-
var _default = _event_log;
|
|
50
|
-
exports.default = _default;
|
|
25
|
+
export default _event_log;
|
package/dist/web/format.js
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _helpers = require("@lowdefy/helpers");
|
|
9
|
-
|
|
10
|
-
var _format2 = _interopRequireDefault(require("@lowdefy/format"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
1
|
/*
|
|
15
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
16
3
|
|
|
@@ -25,28 +12,19 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
25
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
13
|
See the License for the specific language governing permissions and
|
|
27
14
|
limitations under the License.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (!_helpers.type.isObject(params.params) && !_helpers.type.isUndefined(params.params)) {
|
|
45
|
-
throw new Error("Operator Error: _format params argument should be an object or undefined. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return _format2.default[methodName](params.params)(params.on);
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
import formatters from '@lowdefy/format';
|
|
17
|
+
function _format({ location , methodName , params }) {
|
|
18
|
+
if (!formatters[methodName]) {
|
|
19
|
+
throw new Error(`Operator Error: $_format.${methodName} is not supported, use one of the following: ${Object.keys(formatters).join(', ')}.
|
|
20
|
+
Received: {"_format.${methodName}":${JSON.stringify(params)}} at ${location}.`);
|
|
21
|
+
}
|
|
22
|
+
if (!type.isObject(params)) {
|
|
23
|
+
throw new Error(`Operator Error: _format takes an object as arguments. Received: ${JSON.stringify(params)} at ${location}.`);
|
|
24
|
+
}
|
|
25
|
+
if (!type.isObject(params.params) && !type.isUndefined(params.params)) {
|
|
26
|
+
throw new Error(`Operator Error: _format params argument should be an object or undefined. Received: ${JSON.stringify(params)} at ${location}.`);
|
|
27
|
+
}
|
|
28
|
+
return formatters[methodName](params.params)(params.on);
|
|
49
29
|
}
|
|
50
|
-
|
|
51
|
-
var _default = _format;
|
|
52
|
-
exports.default = _default;
|
|
30
|
+
export default _format;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 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 '../getFromObject.js';
|
|
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;
|
package/dist/web/index.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
1
|
/*
|
|
9
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
10
3
|
|
|
@@ -19,18 +12,21 @@ exports.default = void 0;
|
|
|
19
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
13
|
See the License for the specific language governing permissions and
|
|
21
14
|
limitations under the License.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
15
|
+
*/ export default {
|
|
16
|
+
_actions: 'web/actions',
|
|
17
|
+
_base64: 'web/base64',
|
|
18
|
+
_event_log: 'web/event_log',
|
|
19
|
+
_event: 'web/event',
|
|
20
|
+
_format: 'web/format',
|
|
21
|
+
_global: 'web/global',
|
|
22
|
+
_index: 'web/_index',
|
|
23
|
+
_input: 'web/input',
|
|
24
|
+
_js: 'web/js',
|
|
25
|
+
_location: 'web/location',
|
|
26
|
+
_media: 'web/media',
|
|
27
|
+
_menu: 'web/menu',
|
|
28
|
+
_request_details: 'web/request_details',
|
|
29
|
+
_request: 'web/request',
|
|
30
|
+
_state: 'web/state',
|
|
31
|
+
_url_query: 'web/url_query'
|
|
35
32
|
};
|
|
36
|
-
exports.default = _default;
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _getFromObject = _interopRequireDefault(require("../getFromObject"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
1
|
/*
|
|
13
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
14
3
|
|
|
@@ -23,24 +12,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
23
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
24
13
|
See the License for the specific language governing permissions and
|
|
25
14
|
limitations under the License.
|
|
26
|
-
*/
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return (0, _getFromObject.default)({
|
|
36
|
-
arrayIndices,
|
|
37
|
-
env,
|
|
38
|
-
location,
|
|
39
|
-
object: event,
|
|
40
|
-
operator: '_event',
|
|
41
|
-
params
|
|
42
|
-
});
|
|
15
|
+
*/ import getFromObject from '../getFromObject.js';
|
|
16
|
+
function _input({ arrayIndices , input , location , params }) {
|
|
17
|
+
return getFromObject({
|
|
18
|
+
arrayIndices,
|
|
19
|
+
location,
|
|
20
|
+
object: input,
|
|
21
|
+
operator: '_input',
|
|
22
|
+
params
|
|
23
|
+
});
|
|
43
24
|
}
|
|
44
|
-
|
|
45
|
-
var _default = _event;
|
|
46
|
-
exports.default = _default;
|
|
25
|
+
export default _input;
|
package/dist/web/js.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _helpers = require("@lowdefy/helpers");
|
|
9
|
-
|
|
10
1
|
/*
|
|
11
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
12
3
|
|
|
@@ -21,25 +12,14 @@ var _helpers = require("@lowdefy/helpers");
|
|
|
21
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
13
|
See the License for the specific language governing permissions and
|
|
23
14
|
limitations under the License.
|
|
24
|
-
*/
|
|
25
|
-
function _js(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (!_helpers.type.isFunction(context.lowdefy.imports.jsOperators[methodName])) {
|
|
34
|
-
throw new Error("Operator Error: _js.".concat(methodName, " is not a function."));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (!_helpers.type.isNone(params) && !_helpers.type.isArray(params)) {
|
|
38
|
-
throw new Error("Operator Error: _js.".concat(methodName, " takes an array as input at ").concat(location, "."));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return context.lowdefy.imports.jsOperators[methodName](...(params || []));
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
function _js({ context , params , location , methodName }) {
|
|
17
|
+
if (!type.isFunction(context.lowdefy.imports.jsOperators[methodName])) {
|
|
18
|
+
throw new Error(`Operator Error: _js.${methodName} is not a function.`);
|
|
19
|
+
}
|
|
20
|
+
if (!type.isNone(params) && !type.isArray(params)) {
|
|
21
|
+
throw new Error(`Operator Error: _js.${methodName} takes an array as input at ${location}.`);
|
|
22
|
+
}
|
|
23
|
+
return context.lowdefy.imports.jsOperators[methodName](...params || []);
|
|
42
24
|
}
|
|
43
|
-
|
|
44
|
-
var _default = _js;
|
|
45
|
-
exports.default = _default;
|
|
25
|
+
export default _js;
|
package/dist/web/location.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _getFromObject = _interopRequireDefault(require("../getFromObject"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
1
|
/*
|
|
13
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
14
3
|
|
|
@@ -23,52 +12,48 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
23
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
24
13
|
See the License for the specific language governing permissions and
|
|
25
14
|
limitations under the License.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
params
|
|
70
|
-
});
|
|
15
|
+
*/ import getFromObject from '../getFromObject.js';
|
|
16
|
+
const validProperties = [
|
|
17
|
+
'basePath',
|
|
18
|
+
'href',
|
|
19
|
+
'origin',
|
|
20
|
+
'protocol',
|
|
21
|
+
'homePageId',
|
|
22
|
+
'host',
|
|
23
|
+
'hostname',
|
|
24
|
+
'port',
|
|
25
|
+
'pageId',
|
|
26
|
+
'pathname',
|
|
27
|
+
'search',
|
|
28
|
+
'hash',
|
|
29
|
+
];
|
|
30
|
+
function _location({ arrayIndices , context , location , params }) {
|
|
31
|
+
if (!window || !window.location) {
|
|
32
|
+
throw new Error(`Operator Error: Browser window.location not available for _location. Received: ${JSON.stringify(params)} at ${location}.`);
|
|
33
|
+
}
|
|
34
|
+
if (!validProperties.includes(params)) {
|
|
35
|
+
throw new Error(`Operator Error: _location only returns values for ${validProperties.join(', ')}. Received: ${JSON.stringify(params)} at ${location}.`);
|
|
36
|
+
}
|
|
37
|
+
const windowLocation = {
|
|
38
|
+
basePath: context.lowdefy.basePath,
|
|
39
|
+
href: window.location.href,
|
|
40
|
+
origin: window.location.origin,
|
|
41
|
+
protocol: window.location.protocol,
|
|
42
|
+
homePageId: context.lowdefy.homePageId,
|
|
43
|
+
host: window.location.host,
|
|
44
|
+
hostname: window.location.hostname,
|
|
45
|
+
port: window.location.port,
|
|
46
|
+
pageId: context.lowdefy.pageId,
|
|
47
|
+
pathname: window.location.pathname,
|
|
48
|
+
search: window.location.search,
|
|
49
|
+
hash: window.location.hash
|
|
50
|
+
};
|
|
51
|
+
return getFromObject({
|
|
52
|
+
arrayIndices,
|
|
53
|
+
location,
|
|
54
|
+
object: windowLocation,
|
|
55
|
+
operator: '_location',
|
|
56
|
+
params
|
|
57
|
+
});
|
|
71
58
|
}
|
|
72
|
-
|
|
73
|
-
var _default = _location;
|
|
74
|
-
exports.default = _default;
|
|
59
|
+
export default _location;
|
package/dist/web/media.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.breakpoints = void 0;
|
|
7
|
-
|
|
8
|
-
var _getFromObject = _interopRequireDefault(require("../getFromObject"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
1
|
/*
|
|
13
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
14
3
|
|
|
@@ -23,68 +12,50 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
23
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
24
13
|
See the License for the specific language governing permissions and
|
|
25
14
|
limitations under the License.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var media = {
|
|
73
|
-
size,
|
|
74
|
-
width: window.innerWidth,
|
|
75
|
-
height: window.innerHeight
|
|
76
|
-
};
|
|
77
|
-
return (0, _getFromObject.default)({
|
|
78
|
-
arrayIndices,
|
|
79
|
-
context,
|
|
80
|
-
contexts,
|
|
81
|
-
env,
|
|
82
|
-
location,
|
|
83
|
-
object: media,
|
|
84
|
-
operator: '_media',
|
|
85
|
-
params
|
|
86
|
-
});
|
|
15
|
+
*/ import getFromObject from '../getFromObject.js';
|
|
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 }) {
|
|
24
|
+
if (!window || !window.innerWidth) {
|
|
25
|
+
throw new Error(`Operator Error: device window width not available for _media. Received: ${JSON.stringify(params)} at ${location}.`);
|
|
26
|
+
}
|
|
27
|
+
let size;
|
|
28
|
+
switch(true){
|
|
29
|
+
case window.innerWidth < breakpoints.xs:
|
|
30
|
+
size = 'xs';
|
|
31
|
+
break;
|
|
32
|
+
case window.innerWidth < breakpoints.sm:
|
|
33
|
+
size = 'sm';
|
|
34
|
+
break;
|
|
35
|
+
case window.innerWidth < breakpoints.md:
|
|
36
|
+
size = 'md';
|
|
37
|
+
break;
|
|
38
|
+
case window.innerWidth < breakpoints.lg:
|
|
39
|
+
size = 'lg';
|
|
40
|
+
break;
|
|
41
|
+
case window.innerWidth < breakpoints.xl:
|
|
42
|
+
size = 'xl';
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
size = 'xxl';
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
const media = {
|
|
49
|
+
size,
|
|
50
|
+
width: window.innerWidth,
|
|
51
|
+
height: window.innerHeight
|
|
52
|
+
};
|
|
53
|
+
return getFromObject({
|
|
54
|
+
arrayIndices,
|
|
55
|
+
location,
|
|
56
|
+
object: media,
|
|
57
|
+
operator: '_media',
|
|
58
|
+
params
|
|
59
|
+
});
|
|
87
60
|
}
|
|
88
|
-
|
|
89
|
-
var _default = _media;
|
|
90
|
-
exports.default = _default;
|
|
61
|
+
export default _media;
|