@lowdefy/engine 3.23.1 → 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/Actions.js +221 -310
- package/dist/Blocks.js +577 -607
- package/dist/Events.js +120 -162
- package/dist/Requests.js +110 -144
- package/dist/State.js +55 -81
- package/dist/actions/CallMethod.js +20 -39
- package/dist/actions/JsAction.js +50 -72
- package/dist/actions/Link.js +22 -33
- package/dist/actions/Login.js +3 -28
- package/dist/actions/Logout.js +3 -27
- package/dist/actions/Message.js +9 -22
- package/dist/actions/Request.js +21 -63
- package/dist/actions/Reset.js +6 -20
- package/dist/actions/ResetValidation.js +18 -31
- package/dist/actions/ScrollTo.js +8 -34
- package/dist/actions/SetGlobal.js +18 -30
- package/dist/actions/SetState.js +18 -30
- package/dist/actions/Throw.js +25 -52
- package/dist/actions/Validate.js +20 -34
- package/dist/actions/Wait.js +21 -32
- package/dist/actions/index.js +31 -57
- package/dist/createLink.js +29 -59
- package/dist/getBlockMatcher.js +46 -58
- package/dist/getContext.js +100 -142
- package/dist/getFieldValues.js +18 -32
- package/dist/index.js +9 -70
- package/package.json +12 -13
- package/dist/makeContextId.js +0 -44
package/dist/State.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,79 +12,62 @@ 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
|
-
class State {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this.freezeState = this.freezeState.bind(this);
|
|
35
|
-
this.resetState = this.resetState.bind(this);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
resetState() {
|
|
39
|
-
Object.keys(this.context.state).forEach(key => {
|
|
40
|
-
delete this.context.state[key];
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
var frozenCopy = _helpers.serializer.deserializeFromString(this.frozenState);
|
|
44
|
-
|
|
45
|
-
Object.keys(frozenCopy).forEach(key => {
|
|
46
|
-
this.set(key, frozenCopy[key]);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
freezeState() {
|
|
51
|
-
if (!this.initialized) {
|
|
52
|
-
this.frozenState = _helpers.serializer.serializeToString(this.context.state);
|
|
53
|
-
this.initialized = true;
|
|
15
|
+
*/ import { unset, get, serializer, set, swap, type } from '@lowdefy/helpers';
|
|
16
|
+
let State = class State {
|
|
17
|
+
resetState() {
|
|
18
|
+
Object.keys(this.context.state).forEach((key)=>{
|
|
19
|
+
delete this.context.state[key];
|
|
20
|
+
});
|
|
21
|
+
const frozenCopy = serializer.deserializeFromString(this.frozenState);
|
|
22
|
+
Object.keys(frozenCopy).forEach((key)=>{
|
|
23
|
+
this.set(key, frozenCopy[key]);
|
|
24
|
+
});
|
|
54
25
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
del(field) {
|
|
62
|
-
(0, _helpers.unset)(this.context.state, field); // remove all empty objects from state as an effect of deleted values
|
|
63
|
-
|
|
64
|
-
var fields = field.split('.');
|
|
65
|
-
|
|
66
|
-
if (fields.length > 1) {
|
|
67
|
-
var parent = fields.slice(0, fields.length - 1).join('.');
|
|
68
|
-
var parentValue = (0, _helpers.get)(this.context.state, parent);
|
|
69
|
-
|
|
70
|
-
if (_helpers.type.isObject(parentValue) && Object.keys(parentValue).length === 0) {
|
|
71
|
-
this.del(parent);
|
|
72
|
-
}
|
|
26
|
+
freezeState() {
|
|
27
|
+
if (!this.initialized) {
|
|
28
|
+
this.frozenState = serializer.serializeToString(this.context.state);
|
|
29
|
+
this.initialized = true;
|
|
30
|
+
}
|
|
73
31
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
swapItems(field, from, to) {
|
|
77
|
-
var arr = (0, _helpers.get)(this.context.state, field);
|
|
78
|
-
|
|
79
|
-
if (!_helpers.type.isArray(arr) || from < 0 || to < 0 || from >= arr.length || to >= arr.length) {
|
|
80
|
-
return;
|
|
32
|
+
set(field, value) {
|
|
33
|
+
set(this.context.state, field, value);
|
|
81
34
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
35
|
+
del(field1) {
|
|
36
|
+
unset(this.context.state, field1);
|
|
37
|
+
// remove all empty objects from state as an effect of deleted values
|
|
38
|
+
const fields = field1.split('.');
|
|
39
|
+
if (fields.length > 1) {
|
|
40
|
+
const parent = fields.slice(0, fields.length - 1).join('.');
|
|
41
|
+
const parentValue = get(this.context.state, parent);
|
|
42
|
+
if (type.isObject(parentValue) && Object.keys(parentValue).length === 0) {
|
|
43
|
+
this.del(parent);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
91
46
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
47
|
+
swapItems(field2, from, to) {
|
|
48
|
+
const arr = get(this.context.state, field2);
|
|
49
|
+
if (!type.isArray(arr) || from < 0 || to < 0 || from >= arr.length || to >= arr.length) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
swap(arr, from, to);
|
|
53
|
+
}
|
|
54
|
+
removeItem(field3, index) {
|
|
55
|
+
const arr = get(this.context.state, field3);
|
|
56
|
+
if (!type.isArray(arr) || index < 0 || index >= arr.length) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
arr.splice(index, 1);
|
|
60
|
+
}
|
|
61
|
+
constructor(context){
|
|
62
|
+
this.context = context;
|
|
63
|
+
this.frozenState = null;
|
|
64
|
+
this.initialized = false;
|
|
65
|
+
this.set = this.set.bind(this);
|
|
66
|
+
this.del = this.del.bind(this);
|
|
67
|
+
this.swapItems = this.swapItems.bind(this);
|
|
68
|
+
this.removeItem = this.removeItem.bind(this);
|
|
69
|
+
this.freezeState = this.freezeState.bind(this);
|
|
70
|
+
this.resetState = this.resetState.bind(this);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
export default State;
|
|
@@ -1,47 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = void 0;
|
|
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
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
11
|
-
|
|
12
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
13
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, type } from '@lowdefy/helpers';
|
|
14
16
|
// context, event, params
|
|
15
|
-
function CallMethod(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
_CallMethod = _asyncToGenerator(function* (_ref) {
|
|
21
|
-
var {
|
|
22
|
-
arrayIndices,
|
|
23
|
-
context,
|
|
24
|
-
params
|
|
25
|
-
} = _ref;
|
|
26
|
-
var {
|
|
27
|
-
blockId,
|
|
28
|
-
method,
|
|
29
|
-
args = []
|
|
30
|
-
} = params;
|
|
31
|
-
var blockMethod = context.RootBlocks.map[(0, _helpers.applyArrayIndices)(arrayIndices, blockId)].methods[method];
|
|
32
|
-
|
|
33
|
-
if (!_helpers.type.isArray(args)) {
|
|
34
|
-
throw new Error("Failed to call method \"".concat(method, "\" on block \"").concat(blockId, "\": \"args\" should be an array. Received \"").concat(JSON.stringify(params), "\"."));
|
|
17
|
+
async function CallMethod({ arrayIndices , context , params }) {
|
|
18
|
+
const { blockId , method , args =[] } = params;
|
|
19
|
+
const blockMethod = context._internal.RootBlocks.map[applyArrayIndices(arrayIndices, blockId)].methods[method];
|
|
20
|
+
if (!type.isArray(args)) {
|
|
21
|
+
throw new Error(`Failed to call method "${method}" on block "${blockId}": "args" should be an array. Received "${JSON.stringify(params)}".`);
|
|
35
22
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
throw new Error("Failed to call method \"".concat(method, "\" on block \"").concat(blockId, "\". Check if \"").concat(method, "\" is a valid block method for block \"").concat(blockId, "\". Received \"").concat(JSON.stringify(params), "\"."));
|
|
23
|
+
if (!type.isFunction(blockMethod)) {
|
|
24
|
+
throw new Error(`Failed to call method "${method}" on block "${blockId}". Check if "${method}" is a valid block method for block "${blockId}". Received "${JSON.stringify(params)}".`);
|
|
39
25
|
}
|
|
40
|
-
|
|
41
26
|
return blockMethod(...args);
|
|
42
|
-
});
|
|
43
|
-
return _CallMethod.apply(this, arguments);
|
|
44
27
|
}
|
|
45
|
-
|
|
46
|
-
var _default = CallMethod;
|
|
47
|
-
exports.default = _default;
|
|
28
|
+
export default CallMethod;
|
package/dist/actions/JsAction.js
CHANGED
|
@@ -1,77 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
21
|
-
|
|
22
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
23
|
-
|
|
24
|
-
function JsAction(_x) {
|
|
25
|
-
return _JsAction.apply(this, arguments);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _JsAction() {
|
|
29
|
-
_JsAction = _asyncToGenerator(function* (_ref) {
|
|
30
|
-
var {
|
|
31
|
-
context,
|
|
32
|
-
event,
|
|
33
|
-
params,
|
|
34
|
-
arrayIndices,
|
|
35
|
-
blockId
|
|
36
|
-
} = _ref;
|
|
37
|
-
|
|
38
|
-
if (!_helpers.type.isString(params.name)) {
|
|
39
|
-
throw new Error("JsAction requires a string for 'params.name'.");
|
|
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 { type, serializer } from '@lowdefy/helpers';
|
|
16
|
+
import actionFns from './index.js';
|
|
17
|
+
async function JsAction({ context , event , params , arrayIndices , blockId }) {
|
|
18
|
+
if (!type.isString(params.name)) {
|
|
19
|
+
throw new Error(`JsAction requires a string for 'params.name'.`);
|
|
40
20
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
throw new Error("JsAction requires a array for 'params.args'.");
|
|
21
|
+
if (!type.isNone(params.args) && !type.isArray(params.args)) {
|
|
22
|
+
throw new Error(`JsAction requires a array for 'params.args'.`);
|
|
44
23
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
throw new Error("JsAction ".concat(params.name, " is not a function."));
|
|
24
|
+
if (!type.isFunction(context.lowdefy.imports.jsActions[params.name])) {
|
|
25
|
+
throw new Error(`JsAction ${params.name} is not a function.`);
|
|
48
26
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Object.keys(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
27
|
+
const actions = {
|
|
28
|
+
};
|
|
29
|
+
Object.keys(actionFns).forEach((name)=>{
|
|
30
|
+
actions[name] = (actionParams)=>actionFns[name]({
|
|
31
|
+
arrayIndices,
|
|
32
|
+
blockId,
|
|
33
|
+
context,
|
|
34
|
+
event,
|
|
35
|
+
params: actionParams
|
|
36
|
+
})
|
|
37
|
+
;
|
|
59
38
|
});
|
|
60
|
-
return context.lowdefy.imports.jsActions[params.name](
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
39
|
+
return context.lowdefy.imports.jsActions[params.name]({
|
|
40
|
+
...serializer.copy({
|
|
41
|
+
global: context.lowdefy.lowdefyGlobal,
|
|
42
|
+
input: context.lowdefy.inputs[context.id],
|
|
43
|
+
state: context.state,
|
|
44
|
+
urlQuery: context.lowdefy.urlQuery,
|
|
45
|
+
user: context.lowdefy.user
|
|
46
|
+
}),
|
|
47
|
+
actions,
|
|
48
|
+
contextId: context.id,
|
|
49
|
+
pageId: context.pageId,
|
|
50
|
+
requests: {
|
|
51
|
+
...context.requests
|
|
52
|
+
}
|
|
53
|
+
}, ...params.args || []);
|
|
74
54
|
}
|
|
75
|
-
|
|
76
|
-
var _default = JsAction;
|
|
77
|
-
exports.default = _default;
|
|
55
|
+
export default JsAction;
|
package/dist/actions/Link.js
CHANGED
|
@@ -1,38 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_Link = _asyncToGenerator(function* (_ref) {
|
|
20
|
-
var {
|
|
21
|
-
context,
|
|
22
|
-
params
|
|
23
|
-
} = _ref;
|
|
24
|
-
var linkParams = _helpers.type.isString(params) ? {
|
|
25
|
-
pageId: params
|
|
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 { type } from '@lowdefy/helpers';
|
|
16
|
+
async function Link({ context , params }) {
|
|
17
|
+
const linkParams = type.isString(params) ? {
|
|
18
|
+
pageId: params
|
|
26
19
|
} : params;
|
|
27
|
-
|
|
28
20
|
try {
|
|
29
|
-
|
|
21
|
+
context._internal.lowdefy._internal.link(linkParams);
|
|
30
22
|
} catch (error) {
|
|
31
|
-
|
|
23
|
+
console.log(error);
|
|
24
|
+
throw new Error(`Invalid Link, check action params. Received "${JSON.stringify(params)}".`);
|
|
32
25
|
}
|
|
33
|
-
});
|
|
34
|
-
return _Link.apply(this, arguments);
|
|
35
26
|
}
|
|
36
|
-
|
|
37
|
-
var _default = Link;
|
|
38
|
-
exports.default = _default;
|
|
27
|
+
export default Link;
|
package/dist/actions/Login.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
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
-
|
|
10
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
11
|
-
|
|
12
1
|
/*
|
|
13
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
14
3
|
|
|
@@ -23,21 +12,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
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
|
-
return _Login.apply(this, arguments);
|
|
15
|
+
*/ async function Login({ context , params }) {
|
|
16
|
+
return context._internal.lowdefy._internal.auth.login(params);
|
|
29
17
|
}
|
|
30
|
-
|
|
31
|
-
function _Login() {
|
|
32
|
-
_Login = _asyncToGenerator(function* (_ref) {
|
|
33
|
-
var {
|
|
34
|
-
context,
|
|
35
|
-
params
|
|
36
|
-
} = _ref;
|
|
37
|
-
return context.lowdefy.auth.login(params);
|
|
38
|
-
});
|
|
39
|
-
return _Login.apply(this, arguments);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
var _default = Login;
|
|
43
|
-
exports.default = _default;
|
|
18
|
+
export default Login;
|
package/dist/actions/Logout.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
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
-
|
|
10
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
11
|
-
|
|
12
1
|
/*
|
|
13
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
14
3
|
|
|
@@ -23,20 +12,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
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
|
-
return _Logout.apply(this, arguments);
|
|
15
|
+
*/ async function Logout({ context }) {
|
|
16
|
+
return context._internal.lowdefy._internal.auth.logout();
|
|
29
17
|
}
|
|
30
|
-
|
|
31
|
-
function _Logout() {
|
|
32
|
-
_Logout = _asyncToGenerator(function* (_ref) {
|
|
33
|
-
var {
|
|
34
|
-
context
|
|
35
|
-
} = _ref;
|
|
36
|
-
return context.lowdefy.auth.logout();
|
|
37
|
-
});
|
|
38
|
-
return _Logout.apply(this, arguments);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
var _default = Logout;
|
|
42
|
-
exports.default = _default;
|
|
18
|
+
export default Logout;
|
package/dist/actions/Message.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,19 +12,13 @@ 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
|
-
duration: params.duration,
|
|
31
|
-
icon: params.icon,
|
|
32
|
-
status: params.status
|
|
33
|
-
});
|
|
15
|
+
*/ function Message({ context , params ={
|
|
16
|
+
} }) {
|
|
17
|
+
context._internal.lowdefy._internal.displayMessage({
|
|
18
|
+
content: params.content || 'Success',
|
|
19
|
+
duration: params.duration,
|
|
20
|
+
icon: params.icon,
|
|
21
|
+
status: params.status
|
|
22
|
+
});
|
|
34
23
|
}
|
|
35
|
-
|
|
36
|
-
var _default = Message;
|
|
37
|
-
exports.default = _default;
|
|
24
|
+
export default Message;
|
package/dist/actions/Request.js
CHANGED
|
@@ -1,65 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_Request = _asyncToGenerator(function* (_ref) {
|
|
20
|
-
var {
|
|
21
|
-
arrayIndices,
|
|
22
|
-
context,
|
|
23
|
-
event,
|
|
24
|
-
params
|
|
25
|
-
} = _ref;
|
|
26
|
-
|
|
27
|
-
if (_helpers.type.isNone(params)) {
|
|
28
|
-
// Should this resolve or error
|
|
29
|
-
return Promise.resolve();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
var requestIds = [];
|
|
33
|
-
if (params.all === true) requestIds = undefined;
|
|
34
|
-
if (_helpers.type.isString(params)) requestIds = [params];
|
|
35
|
-
if (_helpers.type.isArray(params)) requestIds = params;
|
|
36
|
-
var response;
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
response = yield context.Requests.callRequests({
|
|
40
|
-
requestIds,
|
|
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
|
+
*/ async function Request({ actions , arrayIndices , context , event , params }) {
|
|
16
|
+
return context._internal.Requests.callRequests({
|
|
17
|
+
actions,
|
|
18
|
+
arrayIndices,
|
|
41
19
|
event,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} catch (error) {
|
|
45
|
-
var graphQLMessage;
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
var {
|
|
49
|
-
displayTitle,
|
|
50
|
-
displayMessage
|
|
51
|
-
} = error.graphQLErrors[0].extensions;
|
|
52
|
-
graphQLMessage = "".concat(displayTitle, ": ").concat(displayMessage);
|
|
53
|
-
} catch (e) {// Not a graphQLError, displayTitle, displayMessage do not exist
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
throw new Error(graphQLMessage || error.message);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return response;
|
|
60
|
-
});
|
|
61
|
-
return _Request.apply(this, arguments);
|
|
20
|
+
params
|
|
21
|
+
});
|
|
62
22
|
}
|
|
63
|
-
|
|
64
|
-
var _default = Request;
|
|
65
|
-
exports.default = _default;
|
|
23
|
+
export default Request;
|
package/dist/actions/Reset.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,15 +12,10 @@ 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 Reset(
|
|
26
|
-
|
|
27
|
-
context
|
|
28
|
-
|
|
29
|
-
context.State.resetState();
|
|
30
|
-
context.RootBlocks.reset(_helpers.serializer.deserializeFromString(context.State.frozenState));
|
|
31
|
-
context.update();
|
|
15
|
+
*/ import { serializer } from '@lowdefy/helpers';
|
|
16
|
+
function Reset({ context }) {
|
|
17
|
+
context._internal.State.resetState();
|
|
18
|
+
context._internal.RootBlocks.reset(serializer.deserializeFromString(context._internal.State.frozenState));
|
|
19
|
+
context._internal.update();
|
|
32
20
|
}
|
|
33
|
-
|
|
34
|
-
var _default = Reset;
|
|
35
|
-
exports.default = _default;
|
|
21
|
+
export default Reset;
|