@lowdefy/engine 4.0.0-rc.0 → 4.0.0-rc.10

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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 { type } from '@lowdefy/helpers';
16
16
  import getActionMethods from './actions/getActionMethods.js';
17
17
  let Actions = class Actions {
18
- async callAsyncAction({ action , arrayIndices , block , event , index , responses }) {
18
+ async callAsyncAction({ action, arrayIndices, block, event, index, responses }) {
19
19
  try {
20
20
  const response = await this.callAction({
21
21
  action,
@@ -31,7 +31,7 @@ let Actions = class Actions {
31
31
  console.error(error);
32
32
  }
33
33
  }
34
- async callActionLoop({ actions , arrayIndices , block , event , progress , responses }) {
34
+ async callActionLoop({ actions, arrayIndices, block, event, progress, responses }) {
35
35
  for (const [index, action] of actions.entries()){
36
36
  try {
37
37
  if (action.async === true) {
@@ -65,7 +65,7 @@ let Actions = class Actions {
65
65
  }
66
66
  }
67
67
  }
68
- async callActions({ actions , arrayIndices , block , catchActions , event , eventName , progress }) {
68
+ async callActions({ actions, arrayIndices, block, catchActions, event, eventName, progress }) {
69
69
  const startTimestamp = new Date();
70
70
  const responses = {};
71
71
  try {
@@ -126,7 +126,7 @@ let Actions = class Actions {
126
126
  success: true
127
127
  };
128
128
  }
129
- async callAction({ action , arrayIndices , block , event , index , progress , responses }) {
129
+ async callAction({ action, arrayIndices, block, event, index, progress, responses }) {
130
130
  if (!this.actions[action.type]) {
131
131
  throw {
132
132
  error: new Error(`Invalid action type "${action.type}" at "${block.blockId}".`),
@@ -134,7 +134,7 @@ let Actions = class Actions {
134
134
  index
135
135
  };
136
136
  }
137
- const { output: parsedAction , errors: parserErrors } = this.context._internal.parser.parse({
137
+ const { output: parsedAction, errors: parserErrors } = this.context._internal.parser.parse({
138
138
  actions: responses,
139
139
  event,
140
140
  arrayIndices,
@@ -184,7 +184,7 @@ let Actions = class Actions {
184
184
  index,
185
185
  type: action.type
186
186
  };
187
- const { output: parsedMessages , errors: parserErrors } = this.context._internal.parser.parse({
187
+ const { output: parsedMessages, errors: parserErrors } = this.context._internal.parser.parse({
188
188
  actions: responses,
189
189
  event,
190
190
  arrayIndices,
@@ -225,7 +225,7 @@ let Actions = class Actions {
225
225
  index
226
226
  };
227
227
  }
228
- displayMessage({ defaultMessage , duration , hideExplicitly , message , status }) {
228
+ displayMessage({ defaultMessage, duration, hideExplicitly, message, status }) {
229
229
  let close = ()=>undefined;
230
230
  if (hideExplicitly && message !== false || !hideExplicitly && !type.isNone(message)) {
231
231
  close = this.context._internal.lowdefy._internal.displayMessage({
package/dist/Blocks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-param-reassign */ /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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.
@@ -65,7 +65,7 @@ let Blocks = class Blocks {
65
65
  block.areasLayout = {};
66
66
  Object.keys(block.areas).forEach((key)=>{
67
67
  // eslint-disable-next-line no-unused-vars
68
- const { blocks , ...areaLayout } = block.areas[key];
68
+ const { blocks, ...areaLayout } = block.areas[key];
69
69
  block.areasLayout[key] = {
70
70
  ...areaLayout
71
71
  };
@@ -190,7 +190,7 @@ let Blocks = class Blocks {
190
190
  if (type.isUndefined(blockValue)) {
191
191
  // default null value for block type
192
192
  blockValue = type.isUndefined(block.meta.initValue) ? type.enforceType(block.meta.valueType, null) : block.meta.initValue;
193
- this.context._internal.State.set(block.blockId, block.value);
193
+ this.context._internal.State.set(block.blockId, blockValue);
194
194
  }
195
195
  if (block.meta.category === 'list') {
196
196
  // load list value into list blocks
@@ -232,7 +232,7 @@ let Blocks = class Blocks {
232
232
  }
233
233
  });
234
234
  }
235
- newBlocks({ arrayIndices , block , initState }) {
235
+ newBlocks({ arrayIndices, block, initState }) {
236
236
  const SubBlocks = new Blocks({
237
237
  arrayIndices,
238
238
  areas: block.areas,
@@ -299,7 +299,7 @@ let Blocks = class Blocks {
299
299
  status: 'error',
300
300
  message: type.isString(block.requiredEval.output) ? block.requiredEval.output : 'This field is required'
301
301
  };
302
- const validation = block.required === false ? block.validate : [
302
+ const validation = block.requiredEval.output === false ? block.validate : [
303
303
  requiredValidation,
304
304
  ...block.validate
305
305
  ];
@@ -551,7 +551,7 @@ let Blocks = class Blocks {
551
551
  });
552
552
  });
553
553
  }
554
- constructor({ arrayIndices =[] , areas , context }){
554
+ constructor({ arrayIndices = [], areas, context }){
555
555
  this.id = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5);
556
556
  this.areas = serializer.copy(areas || []);
557
557
  this.arrayIndices = arrayIndices;
package/dist/Events.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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.
@@ -28,10 +28,10 @@ let Events = class Events {
28
28
  this.events[eventName] = this.initEvent(this.block.events[eventName]);
29
29
  });
30
30
  }
31
- registerEvent({ name , actions }) {
31
+ registerEvent({ name, actions }) {
32
32
  this.events[name] = this.initEvent(actions);
33
33
  }
34
- async triggerEvent({ name , event , progress }) {
34
+ async triggerEvent({ name, event, progress }) {
35
35
  const eventDescription = this.events[name];
36
36
  let result = {
37
37
  blockId: this.block.blockId,
@@ -105,7 +105,7 @@ let Events = class Events {
105
105
  };
106
106
  });
107
107
  }
108
- constructor({ arrayIndices , block , context }){
108
+ constructor({ arrayIndices, block, context }){
109
109
  this.defaultDebounceMs = 300;
110
110
  this.events = {};
111
111
  this.timeouts = {};
package/dist/Requests.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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,7 @@
14
14
  limitations under the License.
15
15
  */ import { get, serializer, type } from '@lowdefy/helpers';
16
16
  let Requests = class Requests {
17
- callRequests({ actions , arrayIndices , blockId , event , params } = {}) {
17
+ callRequests({ actions, arrayIndices, blockId, event, params } = {}) {
18
18
  if (type.isObject(params) && params.all === true) {
19
19
  return Promise.all(Object.keys(this.requestConfig).map((requestId)=>this.callRequest({
20
20
  arrayIndices,
@@ -38,7 +38,7 @@ let Requests = class Requests {
38
38
  this.context._internal.update(); // update to render request reset
39
39
  return Promise.all(requests);
40
40
  }
41
- async callRequest({ actions , arrayIndices , blockId , event , requestId }) {
41
+ async callRequest({ actions, arrayIndices, blockId, event, requestId }) {
42
42
  const requestConfig = this.requestConfig[requestId];
43
43
  if (!this.context.requests[requestId]) {
44
44
  this.context.requests[requestId] = [];
@@ -54,7 +54,7 @@ let Requests = class Requests {
54
54
  });
55
55
  throw error;
56
56
  }
57
- const { output: payload , errors: parserErrors } = this.context._internal.parser.parse({
57
+ const { output: payload, errors: parserErrors } = this.context._internal.parser.parse({
58
58
  actions,
59
59
  event,
60
60
  arrayIndices,
package/dist/State.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -13,9 +13,9 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ import { applyArrayIndices, type } from '@lowdefy/helpers';
16
- function createCallMethod({ arrayIndices , context }) {
16
+ function createCallMethod({ arrayIndices, context }) {
17
17
  return function callMethod(params) {
18
- const { blockId , method , args =[] } = params;
18
+ const { blockId, method, args = [] } = params;
19
19
  const blockMethod = context._internal.RootBlocks.map[applyArrayIndices(arrayIndices, blockId)].methods[method];
20
20
  if (!type.isArray(args)) {
21
21
  throw new Error(`Failed to call method "${method}" on block "${blockId}": "args" should be an array. Received "${JSON.stringify(params)}".`);
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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,7 @@
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
- */ function createDisplayMessage({ context }) {
15
+ */ function createDisplayMessage({ context }) {
16
16
  return function displayMessage(params = {}) {
17
17
  context._internal.lowdefy._internal.displayMessage(params);
18
18
  };
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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 getFromObject from './getFromObject.js';
16
- function createGetActions({ actions , arrayIndices , blockId }) {
16
+ function createGetActions({ actions, arrayIndices, blockId }) {
17
17
  return function getActions(params) {
18
18
  return getFromObject({
19
19
  arrayIndices,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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,7 @@
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
- */ function createGetBlockId({ blockId }) {
15
+ */ function createGetBlockId({ blockId }) {
16
16
  return function getBlockId() {
17
17
  return blockId;
18
18
  };
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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 getFromObject from './getFromObject.js';
16
- function createGetEvent({ arrayIndices , blockId , event }) {
16
+ function createGetEvent({ arrayIndices, blockId, event }) {
17
17
  return function getEvent(params) {
18
18
  return getFromObject({
19
19
  arrayIndices,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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 getFromObject from './getFromObject.js';
16
- function createGetGlobal({ arrayIndices , blockId , context }) {
16
+ function createGetGlobal({ arrayIndices, blockId, context }) {
17
17
  return function getGlobal(params) {
18
18
  return getFromObject({
19
19
  arrayIndices,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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 getFromObject from './getFromObject.js';
16
- function createGetInput({ arrayIndices , blockId , context }) {
16
+ function createGetInput({ arrayIndices, blockId, context }) {
17
17
  return function getInput(params) {
18
18
  return getFromObject({
19
19
  arrayIndices,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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,7 @@
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
- */ function createGetPageId({ context }) {
15
+ */ function createGetPageId({ context }) {
16
16
  return function getPageId() {
17
17
  return context.pageId;
18
18
  };
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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 getFromObject from './getFromObject.js';
16
- const createGetRequestDetails = ({ arrayIndices , blockId , context })=>{
16
+ const createGetRequestDetails = ({ arrayIndices, blockId, context })=>{
17
17
  return function getRequestDetails(params) {
18
18
  return getFromObject({
19
19
  arrayIndices,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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 getFromObject from './getFromObject.js';
16
- function createGetState({ arrayIndices , blockId , context }) {
16
+ function createGetState({ arrayIndices, blockId, context }) {
17
17
  return function getState(params) {
18
18
  return getFromObject({
19
19
  arrayIndices,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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,9 +14,9 @@
14
14
  limitations under the License.
15
15
  */ import getFromObject from './getFromObject.js';
16
16
  import { urlQuery } from '@lowdefy/helpers';
17
- function createGetUrlQuery({ arrayIndices , blockId , context }) {
17
+ function createGetUrlQuery({ arrayIndices, blockId, context }) {
18
18
  return function getUrlQuery(params) {
19
- const { window } = context._internal.lowdefy._internal.globals;
19
+ const { window } = context._internal.lowdefy._internal.globals;
20
20
  if (!window?.location) {
21
21
  throw new Error(`Browser window.location not available for getUrlQuery. Received: ${JSON.stringify(params)} on blockId: ${blockId}.`);
22
22
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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 getFromObject from './getFromObject.js';
16
- function createGetUser({ arrayIndices , blockId , context }) {
16
+ function createGetUser({ arrayIndices, blockId, context }) {
17
17
  return function getUser(params) {
18
18
  return getFromObject({
19
19
  arrayIndices,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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,7 @@
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
- */ function createLink({ context }) {
15
+ */ function createLink({ context }) {
16
16
  return function link(params) {
17
17
  context._internal.lowdefy._internal.link(params);
18
18
  };
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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,7 @@
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
- */ function createLogin({ context }) {
15
+ */ function createLogin({ context }) {
16
16
  return function login(params) {
17
17
  return context._internal.lowdefy._internal.auth.login(params);
18
18
  };
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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,7 @@
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
- */ function createLogout({ context }) {
15
+ */ function createLogout({ context }) {
16
16
  return function logout(params) {
17
17
  return context._internal.lowdefy._internal.auth.logout(params);
18
18
  };
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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,7 @@
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
- */ function createRequest({ actions , arrayIndices , blockId , context , event }) {
15
+ */ function createRequest({ actions, arrayIndices, blockId, context, event }) {
16
16
  return async function request(params) {
17
17
  return await context._internal.Requests.callRequests({
18
18
  actions,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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 { serializer } from '@lowdefy/helpers';
16
- function createReset({ context }) {
16
+ function createReset({ context }) {
17
17
  return function reset() {
18
18
  context._internal.State.resetState();
19
19
  context._internal.RootBlocks.reset(serializer.deserializeFromString(context._internal.State.frozenState));
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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 getBlockMatcher from '../getBlockMatcher.js';
16
- function createResetValidation({ context }) {
16
+ function createResetValidation({ context }) {
17
17
  return function resetValidation(params) {
18
18
  context._internal.RootBlocks.resetValidation(getBlockMatcher(params));
19
19
  };
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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 { applyArrayIndices, set } from '@lowdefy/helpers';
16
- const createSetGlobal = ({ arrayIndices , context })=>{
16
+ const createSetGlobal = ({ arrayIndices, context })=>{
17
17
  return function setGlobal(params) {
18
18
  Object.keys(params).forEach((key)=>{
19
19
  set(context._internal.lowdefy.lowdefyGlobal, applyArrayIndices(arrayIndices, key), params[key]);
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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 { applyArrayIndices } from '@lowdefy/helpers';
16
- function createSetState({ arrayIndices , context }) {
16
+ function createSetState({ arrayIndices, context }) {
17
17
  return function setState(params) {
18
18
  Object.keys(params).forEach((key)=>{
19
19
  context._internal.State.set(applyArrayIndices(arrayIndices, key), params[key]);
@@ -0,0 +1,20 @@
1
+ /*
2
+ Copyright 2020-2023 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 createUpdateSession({ context }) {
16
+ return function updateSession() {
17
+ return context._internal.lowdefy._internal.auth.updateSession();
18
+ };
19
+ }
20
+ export default createUpdateSession;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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 getBlockMatcher from '../getBlockMatcher.js';
16
- function createValidate({ context }) {
16
+ function createValidate({ context }) {
17
17
  return function validate(params) {
18
18
  const validationErrors = context._internal.RootBlocks.validate(getBlockMatcher(params));
19
19
  if (validationErrors.length > 0) {
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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.
@@ -32,6 +32,7 @@ import createReset from './createReset.js';
32
32
  import createResetValidation from './createResetValidation.js';
33
33
  import createSetGlobal from './createSetGlobal.js';
34
34
  import createSetState from './createSetState.js';
35
+ import createUpdateSession from './createUpdateSession.js';
35
36
  import createValidate from './createValidate.js';
36
37
  function getActionMethods(props) {
37
38
  return {
@@ -55,6 +56,7 @@ function getActionMethods(props) {
55
56
  resetValidation: createResetValidation(props),
56
57
  setGlobal: createSetGlobal(props),
57
58
  setState: createSetState(props),
59
+ updateSession: createUpdateSession(props),
58
60
  validate: createValidate(props)
59
61
  };
60
62
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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 { applyArrayIndices, get, serializer, type } from '@lowdefy/helpers';
16
- const getFromObject = ({ arrayIndices , location , method , object , params })=>{
16
+ const getFromObject = ({ arrayIndices, location, method, object, params })=>{
17
17
  if (params === true) params = {
18
18
  all: true
19
19
  };
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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, urlQuery as urlQueryFn } from '@lowdefy/helpers';
16
- function createLink({ backLink , disabledLink , lowdefy , newOriginLink , noLink , sameOriginLink }) {
16
+ function createLink({ backLink, disabledLink, lowdefy, newOriginLink, noLink, sameOriginLink }) {
17
17
  function link(props) {
18
18
  if (props.disabled === true) {
19
19
  return disabledLink(props);
@@ -22,9 +22,10 @@ function createLink({ backLink , disabledLink , lowdefy , newOriginLink , noLink
22
22
  !props.pageId,
23
23
  !props.back,
24
24
  !props.home,
25
+ !props.href,
25
26
  !props.url
26
27
  ].filter((v)=>!v).length > 1) {
27
- throw Error(`Invalid Link: To avoid ambiguity, only one of 'back', 'home', 'pageId' or 'url' can be defined.`);
28
+ throw Error(`Invalid Link: To avoid ambiguity, only one of 'back', 'home', 'href', 'pageId' or 'url' can be defined.`);
28
29
  }
29
30
  if (props.back === true) {
30
31
  // Cannot set input or urlQuery on back
@@ -52,6 +53,9 @@ function createLink({ backLink , disabledLink , lowdefy , newOriginLink , noLink
52
53
  }
53
54
  });
54
55
  }
56
+ if (type.isString(props.href)) {
57
+ return newOriginLink(props);
58
+ }
55
59
  if (type.isString(props.url)) {
56
60
  const protocol = props.url.includes(':') ? '' : 'https://';
57
61
  return newOriginLink({
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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.
@@ -17,7 +17,7 @@ import Actions from './Actions.js';
17
17
  import Blocks from './Blocks.js';
18
18
  import Requests from './Requests.js';
19
19
  import State from './State.js';
20
- const blockData = ({ areas , blockId , blocks , events , field , id , layout , pageId , properties , requests , required , style , type , validate , visible , })=>({
20
+ const blockData = ({ areas, blockId, blocks, events, field, id, layout, pageId, properties, requests, required, style, type, validate, visible })=>({
21
21
  areas,
22
22
  blockId,
23
23
  blocks,
@@ -34,14 +34,14 @@ const blockData = ({ areas , blockId , blocks , events , field , id , layout , p
34
34
  validate,
35
35
  visible
36
36
  });
37
- function getContext({ config , lowdefy , resetContext ={
37
+ function getContext({ config, lowdefy, resetContext = {
38
38
  reset: false,
39
39
  setReset: ()=>undefined
40
- } , }) {
40
+ } }) {
41
41
  if (!config) {
42
42
  throw new Error('A page must be provided to get context.');
43
43
  }
44
- const { id } = config;
44
+ const { id } = config;
45
45
  if (lowdefy.contexts[id] && !resetContext.reset) {
46
46
  // memoize context if already created, eg between page transitions, unless the reset flag is raised
47
47
  lowdefy.contexts[id]._internal.update();
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/engine",
3
- "version": "4.0.0-rc.0",
3
+ "version": "4.0.0-rc.10",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -36,22 +36,22 @@
36
36
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
37
37
  },
38
38
  "dependencies": {
39
- "@lowdefy/helpers": "4.0.0-rc.0",
40
- "@lowdefy/operators": "4.0.0-rc.0"
39
+ "@lowdefy/helpers": "4.0.0-rc.10",
40
+ "@lowdefy/operators": "4.0.0-rc.10"
41
41
  },
42
42
  "devDependencies": {
43
- "@jest/globals": "28.1.0",
44
- "@lowdefy/actions-core": "4.0.0-rc.0",
45
- "@lowdefy/build": "4.0.0-rc.0",
46
- "@lowdefy/operators-js": "4.0.0-rc.0",
47
- "@lowdefy/operators-mql": "4.0.0-rc.0",
48
- "@swc/cli": "0.1.57",
49
- "@swc/core": "1.2.194",
50
- "@swc/jest": "0.2.21",
51
- "jest": "28.1.0"
43
+ "@jest/globals": "28.1.3",
44
+ "@lowdefy/actions-core": "4.0.0-rc.10",
45
+ "@lowdefy/build": "4.0.0-rc.10",
46
+ "@lowdefy/operators-js": "4.0.0-rc.10",
47
+ "@lowdefy/operators-mql": "4.0.0-rc.10",
48
+ "@swc/cli": "0.1.62",
49
+ "@swc/core": "1.3.70",
50
+ "@swc/jest": "0.2.27",
51
+ "jest": "28.1.3"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  },
56
- "gitHead": "f6872d7ff6da421710096536fce7b2016ef8f35c"
56
+ "gitHead": "537af074f27770e32da9da8d48490f2eda94b406"
57
57
  }