@lowdefy/engine 4.0.0-alpha.6 → 4.0.0-alpha.9
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 +29 -17
- package/dist/Blocks.js +29 -27
- package/dist/Events.js +4 -3
- package/dist/Requests.js +2 -5
- package/dist/State.js +1 -1
- package/dist/actions/createCallMethod.js +29 -0
- package/dist/actions/{Request.js → createDisplayMessage.js} +6 -9
- package/dist/actions/createGetActions.js +27 -0
- package/dist/actions/{Logout.js → createGetBlockId.js} +6 -4
- package/dist/actions/createGetEvent.js +27 -0
- package/dist/actions/createGetGlobal.js +27 -0
- package/dist/actions/createGetInput.js +27 -0
- package/dist/actions/{Login.js → createGetPageId.js} +6 -4
- package/dist/actions/createGetRequestDetails.js +27 -0
- package/dist/actions/createGetState.js +27 -0
- package/dist/actions/createGetUrlQuery.js +27 -0
- package/dist/actions/createGetUser.js +27 -0
- package/dist/actions/createLink.js +20 -0
- package/dist/actions/createLogin.js +20 -0
- package/dist/actions/createLogout.js +20 -0
- package/dist/actions/{Message.js → createRequest.js} +11 -9
- package/dist/actions/{Reset.js → createReset.js} +8 -6
- package/dist/actions/{ResetValidation.js → createResetValidation.js} +6 -4
- package/dist/actions/{SetGlobal.js → createSetGlobal.js} +11 -9
- package/dist/actions/{SetState.js → createSetState.js} +10 -8
- package/dist/actions/{Validate.js → createValidate.js} +10 -8
- package/dist/actions/getActionMethods.js +61 -0
- package/dist/actions/getFromObject.js +42 -0
- package/dist/createLink.js +46 -23
- package/dist/getBlockMatcher.js +1 -1
- package/dist/getContext.js +30 -12
- package/dist/index.js +1 -1
- package/package.json +7 -6
- package/dist/actions/CallMethod.js +0 -28
- package/dist/actions/JsAction.js +0 -54
- package/dist/actions/Link.js +0 -27
- package/dist/actions/ScrollTo.js +0 -25
- package/dist/actions/Throw.js +0 -39
- package/dist/actions/Wait.js +0 -22
- package/dist/actions/index.js +0 -46
- package/dist/getFieldValues.js +0 -35
package/dist/Actions.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 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,7 +13,7 @@
|
|
|
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
|
-
import
|
|
16
|
+
import getActionMethods from './actions/getActionMethods.js';
|
|
17
17
|
let Actions = class Actions {
|
|
18
18
|
async callAsyncAction({ action , arrayIndices , block , event , index , responses }) {
|
|
19
19
|
try {
|
|
@@ -31,8 +31,8 @@ let Actions = class Actions {
|
|
|
31
31
|
console.error(error);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
async callActionLoop({ actions
|
|
35
|
-
for (const [index, action] of
|
|
34
|
+
async callActionLoop({ actions , arrayIndices , block , event , progress , responses }) {
|
|
35
|
+
for (const [index, action] of actions.entries()){
|
|
36
36
|
try {
|
|
37
37
|
if (action.async === true) {
|
|
38
38
|
this.callAsyncAction({
|
|
@@ -41,6 +41,7 @@ let Actions = class Actions {
|
|
|
41
41
|
block,
|
|
42
42
|
event,
|
|
43
43
|
index,
|
|
44
|
+
progress,
|
|
44
45
|
responses
|
|
45
46
|
});
|
|
46
47
|
} else {
|
|
@@ -50,6 +51,7 @@ let Actions = class Actions {
|
|
|
50
51
|
block,
|
|
51
52
|
event,
|
|
52
53
|
index,
|
|
54
|
+
progress,
|
|
53
55
|
responses
|
|
54
56
|
});
|
|
55
57
|
responses[action.id] = response;
|
|
@@ -63,16 +65,17 @@ let Actions = class Actions {
|
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
|
-
async callActions({ actions
|
|
68
|
+
async callActions({ actions , arrayIndices , block , catchActions , event , eventName , progress }) {
|
|
67
69
|
const startTimestamp = new Date();
|
|
68
70
|
const responses = {};
|
|
69
71
|
try {
|
|
70
72
|
await this.callActionLoop({
|
|
71
|
-
actions
|
|
73
|
+
actions,
|
|
72
74
|
arrayIndices,
|
|
73
75
|
block,
|
|
74
76
|
event,
|
|
75
|
-
responses
|
|
77
|
+
responses,
|
|
78
|
+
progress
|
|
76
79
|
});
|
|
77
80
|
} catch (error) {
|
|
78
81
|
console.error(error);
|
|
@@ -82,7 +85,8 @@ let Actions = class Actions {
|
|
|
82
85
|
arrayIndices,
|
|
83
86
|
block,
|
|
84
87
|
event,
|
|
85
|
-
responses
|
|
88
|
+
responses,
|
|
89
|
+
progress
|
|
86
90
|
});
|
|
87
91
|
} catch (errorCatch) {
|
|
88
92
|
console.error(errorCatch);
|
|
@@ -122,8 +126,8 @@ let Actions = class Actions {
|
|
|
122
126
|
success: true
|
|
123
127
|
};
|
|
124
128
|
}
|
|
125
|
-
async callAction({ action , arrayIndices , block , event , index , responses }) {
|
|
126
|
-
if (!actions[action.type]) {
|
|
129
|
+
async callAction({ action , arrayIndices , block , event , index , progress , responses }) {
|
|
130
|
+
if (!this.actions[action.type]) {
|
|
127
131
|
throw {
|
|
128
132
|
error: new Error(`Invalid action type "${action.type}" at "${block.blockId}".`),
|
|
129
133
|
type: action.type,
|
|
@@ -160,13 +164,21 @@ let Actions = class Actions {
|
|
|
160
164
|
status: 'loading'
|
|
161
165
|
});
|
|
162
166
|
try {
|
|
163
|
-
response = await actions[action.type]({
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
response = await this.actions[action.type]({
|
|
168
|
+
methods: getActionMethods({
|
|
169
|
+
actions: responses,
|
|
170
|
+
arrayIndices,
|
|
171
|
+
blockId: block.blockId,
|
|
172
|
+
context: this.context,
|
|
173
|
+
event
|
|
174
|
+
}),
|
|
175
|
+
document: this.context._internal.lowdefy._internal.document,
|
|
176
|
+
params: parsedAction.params,
|
|
177
|
+
window: this.context._internal.lowdefy._internal.window
|
|
169
178
|
});
|
|
179
|
+
if (progress) {
|
|
180
|
+
progress();
|
|
181
|
+
}
|
|
170
182
|
} catch (error) {
|
|
171
183
|
responses[action.id] = {
|
|
172
184
|
error,
|
|
@@ -232,7 +244,7 @@ let Actions = class Actions {
|
|
|
232
244
|
this.callActionLoop = this.callActionLoop.bind(this);
|
|
233
245
|
this.callActions = this.callActions.bind(this);
|
|
234
246
|
this.displayMessage = this.displayMessage.bind(this);
|
|
235
|
-
this.actions = actions;
|
|
247
|
+
this.actions = context._internal.lowdefy._internal.actions;
|
|
236
248
|
}
|
|
237
249
|
};
|
|
238
250
|
export default Actions;
|
package/dist/Blocks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */ /*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 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.
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { applyArrayIndices, get, serializer, swap, type } from '@lowdefy/helpers';
|
|
16
16
|
import Events from './Events.js';
|
|
17
|
-
import getFieldValues from './getFieldValues.js';
|
|
18
17
|
let Blocks = class Blocks {
|
|
19
18
|
loopBlocks(fn) {
|
|
20
19
|
if (type.isObject(this.areas)) {
|
|
@@ -34,21 +33,29 @@ let Blocks = class Blocks {
|
|
|
34
33
|
block.blockId = applyArrayIndices(this.arrayIndices, block.blockIdPattern);
|
|
35
34
|
block.field = !type.isNone(block.fieldPattern) ? applyArrayIndices(this.arrayIndices, block.fieldPattern) : block.blockId;
|
|
36
35
|
this.context._internal.RootBlocks.map[block.id] = block;
|
|
37
|
-
block.
|
|
38
|
-
block.
|
|
39
|
-
block.
|
|
36
|
+
block.events = type.isNone(block.events) ? {} : block.events;
|
|
37
|
+
block.layout = type.isNone(block.layout) ? {} : block.layout;
|
|
38
|
+
block.loading = type.isNone(block.loading) ? false : block.loading;
|
|
40
39
|
block.properties = type.isNone(block.properties) ? {} : block.properties;
|
|
40
|
+
block.required = type.isNone(block.required) ? false : block.required;
|
|
41
|
+
block.skeleton = type.isNone(block.skeleton) ? null : block.skeleton;
|
|
41
42
|
block.style = type.isNone(block.style) ? {} : block.style;
|
|
42
|
-
block.
|
|
43
|
-
block.
|
|
43
|
+
block.validate = type.isNone(block.validate) ? [] : block.validate;
|
|
44
|
+
block.visible = type.isNone(block.visible) ? true : block.visible;
|
|
44
45
|
block.areasLayoutEval = {};
|
|
45
46
|
block.layoutEval = {};
|
|
47
|
+
block.loadingEval = {};
|
|
46
48
|
block.propertiesEval = {};
|
|
47
49
|
block.requiredEval = {};
|
|
50
|
+
block.skeletonEval = {};
|
|
48
51
|
block.styleEval = {};
|
|
49
52
|
block.validationEval = {};
|
|
50
53
|
block.visibleEval = {};
|
|
51
|
-
|
|
54
|
+
try {
|
|
55
|
+
block.meta = this.context._internal.lowdefy._internal.blockComponents[block.type].meta;
|
|
56
|
+
} catch (error) {
|
|
57
|
+
throw new Error(`Block type ${block.type} not found at ${block.blockId}. Check your plugins to make sure the block is installed. For more info, see https://docs.lowdefy.com/plugins.`);
|
|
58
|
+
}
|
|
52
59
|
if (!type.isNone(block.areas)) {
|
|
53
60
|
block.areasLayout = {};
|
|
54
61
|
Object.keys(block.areas).forEach((key)=>{
|
|
@@ -61,7 +68,6 @@ let Blocks = class Blocks {
|
|
|
61
68
|
} else {
|
|
62
69
|
block.areasLayout = {};
|
|
63
70
|
}
|
|
64
|
-
block.requestKeys = getFieldValues('_request', block.style, block.properties, block.validate, block.visible, block.required);
|
|
65
71
|
block.methods = {};
|
|
66
72
|
block.registerMethod = (methodName, method)=>{
|
|
67
73
|
block.methods[methodName] = method;
|
|
@@ -236,8 +242,10 @@ let Blocks = class Blocks {
|
|
|
236
242
|
return serializer.serializeToString({
|
|
237
243
|
areasLayoutEval: block.areasLayoutEval,
|
|
238
244
|
layoutEval: block.layoutEval,
|
|
245
|
+
loadingEval: block.loadingEval,
|
|
239
246
|
propertiesEval: block.propertiesEval,
|
|
240
247
|
requiredEval: block.requiredEval,
|
|
248
|
+
skeletonEval: block.skeletonEval,
|
|
241
249
|
styleEval: block.styleEval,
|
|
242
250
|
validationEval: block.validationEval,
|
|
243
251
|
value: block.value,
|
|
@@ -346,6 +354,16 @@ let Blocks = class Blocks {
|
|
|
346
354
|
location: block.blockId,
|
|
347
355
|
arrayIndices: this.arrayIndices
|
|
348
356
|
});
|
|
357
|
+
block.loadingEval = this.context._internal.parser.parse({
|
|
358
|
+
input: block.loading,
|
|
359
|
+
location: block.blockId,
|
|
360
|
+
arrayIndices: this.arrayIndices
|
|
361
|
+
});
|
|
362
|
+
block.skeletonEval = this.context._internal.parser.parse({
|
|
363
|
+
input: block.skeleton,
|
|
364
|
+
location: block.blockId,
|
|
365
|
+
arrayIndices: this.arrayIndices
|
|
366
|
+
});
|
|
349
367
|
block.areasLayoutEval = this.context._internal.parser.parse({
|
|
350
368
|
input: block.areasLayout,
|
|
351
369
|
location: block.blockId,
|
|
@@ -505,12 +523,12 @@ let Blocks = class Blocks {
|
|
|
505
523
|
this.loopBlocks((block)=>{
|
|
506
524
|
if (block.update) {
|
|
507
525
|
block.update = false;
|
|
508
|
-
block.loading = block.requestKeys.reduce((acc, key)=>acc || (this.context.requests[key] ? this.context.requests[key].loading : true)
|
|
509
|
-
, false);
|
|
510
526
|
block.eval = {
|
|
511
527
|
areas: block.areasLayoutEval.output,
|
|
512
528
|
events: type.isNone(block.Events.events) ? null : block.Events.events,
|
|
513
529
|
properties: block.propertiesEval.output,
|
|
530
|
+
loading: block.loadingEval.output,
|
|
531
|
+
skeleton: block.skeletonEval.output,
|
|
514
532
|
required: block.requiredEval.output,
|
|
515
533
|
layout: block.layoutEval.output,
|
|
516
534
|
style: block.styleEval.output,
|
|
@@ -530,21 +548,6 @@ let Blocks = class Blocks {
|
|
|
530
548
|
});
|
|
531
549
|
});
|
|
532
550
|
}
|
|
533
|
-
setBlocksLoadingCache() {
|
|
534
|
-
this.loopBlocks((block)=>{
|
|
535
|
-
block.loading_prev = block.loading;
|
|
536
|
-
block.loading = block.requestKeys.reduce((acc, key)=>acc || (this.context.requests[key] ? this.context.requests[key].loading : true)
|
|
537
|
-
, false);
|
|
538
|
-
if (block.loading_prev !== block.loading) {
|
|
539
|
-
this.context._internal.lowdefy._internal.updateBlock(block.id);
|
|
540
|
-
}
|
|
541
|
-
});
|
|
542
|
-
Object.keys(this.subBlocks).forEach((subKey)=>{
|
|
543
|
-
this.subBlocks[subKey].forEach((subBlock)=>{
|
|
544
|
-
subBlock.setBlocksLoadingCache();
|
|
545
|
-
});
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
551
|
constructor({ arrayIndices , areas , context }){
|
|
549
552
|
this.id = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5);
|
|
550
553
|
this.areas = serializer.copy(areas || []);
|
|
@@ -565,7 +568,6 @@ let Blocks = class Blocks {
|
|
|
565
568
|
this.resetValidation = this.resetValidation.bind(this);
|
|
566
569
|
this.resetValidationRec = this.resetValidationRec.bind(this);
|
|
567
570
|
this.setBlocksCache = this.setBlocksCache.bind(this);
|
|
568
|
-
this.setBlocksLoadingCache = this.setBlocksLoadingCache.bind(this);
|
|
569
571
|
this.update = this.update.bind(this);
|
|
570
572
|
this.updateState = this.updateState.bind(this);
|
|
571
573
|
this.updateStateFromRoot = this.updateStateFromRoot.bind(this);
|
package/dist/Events.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 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.
|
|
@@ -31,7 +31,7 @@ let Events = class Events {
|
|
|
31
31
|
registerEvent({ name , actions }) {
|
|
32
32
|
this.events[name] = this.initEvent(actions);
|
|
33
33
|
}
|
|
34
|
-
async triggerEvent({ name , event }) {
|
|
34
|
+
async triggerEvent({ name , event , progress }) {
|
|
35
35
|
const eventDescription = this.events[name];
|
|
36
36
|
let result = {
|
|
37
37
|
blockId: this.block.blockId,
|
|
@@ -57,7 +57,8 @@ let Events = class Events {
|
|
|
57
57
|
block: this.block,
|
|
58
58
|
catchActions: eventDescription.catchActions,
|
|
59
59
|
event,
|
|
60
|
-
eventName: name
|
|
60
|
+
eventName: name,
|
|
61
|
+
progress
|
|
61
62
|
});
|
|
62
63
|
eventDescription.history.unshift(res);
|
|
63
64
|
this.context.eventLog.unshift(res);
|
package/dist/Requests.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 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,7 +15,7 @@
|
|
|
15
15
|
*/ import { get, serializer, type } from '@lowdefy/helpers';
|
|
16
16
|
let Requests = class Requests {
|
|
17
17
|
callRequests({ actions , arrayIndices , event , params } = {}) {
|
|
18
|
-
if (params.all === true) {
|
|
18
|
+
if (type.isObject(params) && params.all === true) {
|
|
19
19
|
return Promise.all(Object.keys(this.requestConfig).map((requestId)=>this.callRequest({
|
|
20
20
|
requestId,
|
|
21
21
|
event,
|
|
@@ -74,9 +74,6 @@ let Requests = class Requests {
|
|
|
74
74
|
}
|
|
75
75
|
async fetch({ requestId , payload }) {
|
|
76
76
|
this.context.requests[requestId].loading = true;
|
|
77
|
-
if (this.context._internal.RootBlocks) {
|
|
78
|
-
this.context._internal.RootBlocks.setBlocksLoadingCache();
|
|
79
|
-
}
|
|
80
77
|
try {
|
|
81
78
|
const response = await this.context._internal.lowdefy._internal.callRequest({
|
|
82
79
|
pageId: this.context.pageId,
|
package/dist/State.js
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
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, type } from '@lowdefy/helpers';
|
|
16
|
+
function createCallMethod({ arrayIndices , context }) {
|
|
17
|
+
return function callMethod(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)}".`);
|
|
22
|
+
}
|
|
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)}".`);
|
|
25
|
+
}
|
|
26
|
+
return blockMethod(...args);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export default createCallMethod;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 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.
|
|
@@ -12,12 +12,9 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
event,
|
|
20
|
-
params
|
|
21
|
-
});
|
|
15
|
+
*/ function createDisplayMessage({ context }) {
|
|
16
|
+
return function displayMessage(params = {}) {
|
|
17
|
+
context._internal.lowdefy._internal.displayMessage(params);
|
|
18
|
+
};
|
|
22
19
|
}
|
|
23
|
-
export default
|
|
20
|
+
export default createDisplayMessage;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 './getFromObject.js';
|
|
16
|
+
function createGetActions({ actions , arrayIndices , blockId }) {
|
|
17
|
+
return function getActions(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: actions,
|
|
22
|
+
method: 'getActions',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default createGetActions;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 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.
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
return
|
|
15
|
+
*/ function createGetBlockId({ blockId }) {
|
|
16
|
+
return function getBlockId() {
|
|
17
|
+
return blockId;
|
|
18
|
+
};
|
|
17
19
|
}
|
|
18
|
-
export default
|
|
20
|
+
export default createGetBlockId;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 './getFromObject.js';
|
|
16
|
+
function createGetEvent({ arrayIndices , blockId , event }) {
|
|
17
|
+
return function getEvent(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: event,
|
|
22
|
+
method: 'getEvent',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default createGetEvent;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 './getFromObject.js';
|
|
16
|
+
function createGetGlobal({ arrayIndices , blockId , context }) {
|
|
17
|
+
return function getGlobal(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: context._internal.lowdefy.lowdefyGlobal,
|
|
22
|
+
method: 'getGlobal',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default createGetGlobal;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 './getFromObject.js';
|
|
16
|
+
function createGetInput({ arrayIndices , blockId , context }) {
|
|
17
|
+
return function getInput(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: context._internal.lowdefy.inputs[context.id],
|
|
22
|
+
method: 'getInput',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default createGetInput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 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.
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
return
|
|
15
|
+
*/ function createGetPageId({ context }) {
|
|
16
|
+
return function getPageId() {
|
|
17
|
+
return context.pageId;
|
|
18
|
+
};
|
|
17
19
|
}
|
|
18
|
-
export default
|
|
20
|
+
export default createGetPageId;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 './getFromObject.js';
|
|
16
|
+
const createGetRequestDetails = ({ arrayIndices , blockId , context })=>{
|
|
17
|
+
return function getRequestDetails(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: context.requests,
|
|
22
|
+
method: 'getRequestDetails',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export default createGetRequestDetails;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 './getFromObject.js';
|
|
16
|
+
function createGetState({ arrayIndices , blockId , context }) {
|
|
17
|
+
return function getState(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: context.state,
|
|
22
|
+
method: 'getState',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default createGetState;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 './getFromObject.js';
|
|
16
|
+
function createGetUrlQuery({ arrayIndices , blockId , context }) {
|
|
17
|
+
return function getUrlQuery(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: context._internal.lowdefy.urlQuery,
|
|
22
|
+
method: 'getUrlQuery',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default createGetUrlQuery;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 './getFromObject.js';
|
|
16
|
+
function createGetUser({ arrayIndices , blockId , context }) {
|
|
17
|
+
return function getUser(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: context._internal.lowdefy.user,
|
|
22
|
+
method: 'getUser',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default createGetUser;
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
*/ function createLink({ context }) {
|
|
16
|
+
return function link(params) {
|
|
17
|
+
context._internal.lowdefy._internal.link(params);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export default createLink;
|