@lowdefy/engine 4.0.0-rc.8 → 4.0.0

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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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,17 +184,17 @@ let Actions = class Actions {
184
184
  index,
185
185
  type: action.type
186
186
  };
187
- const { output: parsedMessages , errors: parserErrors1 } = 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,
191
191
  input: action.messages,
192
192
  location: block.blockId
193
193
  });
194
- if (parserErrors1.length > 0) {
194
+ if (parserErrors.length > 0) {
195
195
  // this condition is very unlikely since parser errors usually occur in the first parse.
196
196
  throw {
197
- error: parserErrors1[0],
197
+ error: parserErrors[0],
198
198
  type: action.type,
199
199
  index
200
200
  };
@@ -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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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,
@@ -300,8 +300,8 @@ let Blocks = class Blocks {
300
300
  message: type.isString(block.requiredEval.output) ? block.requiredEval.output : 'This field is required'
301
301
  };
302
302
  const validation = block.requiredEval.output === false ? block.validate : [
303
- requiredValidation,
304
- ...block.validate
303
+ ...block.validate,
304
+ requiredValidation
305
305
  ];
306
306
  block.validationEval = {
307
307
  output: {
@@ -345,7 +345,7 @@ let Blocks = class Blocks {
345
345
  if (validationWarning) {
346
346
  block.validationEval.output.status = 'warning';
347
347
  }
348
- if (validationError) {
348
+ if (validationError && block.showValidation) {
349
349
  block.validationEval.output.status = 'error';
350
350
  }
351
351
  block.styleEval = this.context._internal.parser.parse({
@@ -460,7 +460,8 @@ let Blocks = class Blocks {
460
460
  if (match(block.blockId)) {
461
461
  block.showValidation = true;
462
462
  block.update = true;
463
- if (block.visibleEval.output !== false && block.validationEval.output && block.validationEval.output.status === 'error') {
463
+ if (block.visibleEval.output !== false && block.validationEval.output && block.validationEval.output.errors.length > 0) {
464
+ block.validationEval.output.status = 'error';
464
465
  result.push({
465
466
  blockId: block.blockId,
466
467
  validation: block.validationEval.output
@@ -537,7 +538,7 @@ let Blocks = class Blocks {
537
538
  style: block.styleEval.output,
538
539
  validation: {
539
540
  ...block.validationEval.output || {},
540
- status: block.showValidation ? (block.validationEval.output || {}).status : null
541
+ status: block.showValidation || block.validationEval.output?.status === 'warning' ? block.validationEval.output?.status : null
541
542
  },
542
543
  value: type.isNone(block.value) ? null : block.value,
543
544
  visible: block.visibleEval.output
@@ -551,8 +552,8 @@ let Blocks = class Blocks {
551
552
  });
552
553
  });
553
554
  }
554
- constructor({ arrayIndices =[] , areas , context }){
555
- this.id = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5);
555
+ constructor({ arrayIndices = [], areas, context }){
556
+ this.id = Math.random().toString(36).replace(/[^a-z]+/g, '').substring(0, 5);
556
557
  this.areas = serializer.copy(areas || []);
557
558
  this.arrayIndices = arrayIndices;
558
559
  this.context = context;
package/dist/Events.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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,12 +28,16 @@ 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
+ triggerEvent({ name, event, progress }) {
35
+ this.context._internal.lowdefy.eventCallback?.({
36
+ name,
37
+ blockId: this.block.blockId
38
+ });
35
39
  const eventDescription = this.events[name];
36
- let result = {
40
+ const result = {
37
41
  blockId: this.block.blockId,
38
42
  event,
39
43
  eventName: name,
@@ -105,7 +109,7 @@ let Events = class Events {
105
109
  };
106
110
  });
107
111
  }
108
- constructor({ arrayIndices , block , context }){
112
+ constructor({ arrayIndices, block, context }){
109
113
  this.defaultDebounceMs = 300;
110
114
  this.events = {};
111
115
  this.timeouts = {};
package/dist/Requests.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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,9 +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
- */ function createRequest({ actions , arrayIndices , blockId , context , event }) {
16
- return async function request(params) {
17
- return await context._internal.Requests.callRequests({
15
+ */ function createRequest({ actions, arrayIndices, blockId, context, event }) {
16
+ return function request(params) {
17
+ return context._internal.Requests.callRequests({
18
18
  actions,
19
19
  arrayIndices,
20
20
  blockId,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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]);
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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 createUpdateSession({ context }) {
15
+ */ function createUpdateSession({ context }) {
16
16
  return function updateSession() {
17
17
  return context._internal.lowdefy._internal.auth.updateSession();
18
18
  };
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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);
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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();
@@ -52,7 +52,7 @@ function getContext({ config , lowdefy , resetContext ={
52
52
  lowdefy.inputs[id] = {};
53
53
  }
54
54
  const ctx = {
55
- id: id,
55
+ id,
56
56
  pageId: config.pageId,
57
57
  eventLog: [],
58
58
  requests: {},
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2023 Lowdefy, Inc
2
+ Copyright 2020-2024 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.8",
3
+ "version": "4.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -29,29 +29,27 @@
29
29
  "files": [
30
30
  "dist/*"
31
31
  ],
32
- "scripts": {
33
- "build": "swc src --out-dir dist --config-file ../../.swcrc --delete-dir-on-start",
34
- "clean": "rm -rf dist",
35
- "prepublishOnly": "pnpm build",
36
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
37
- },
38
32
  "dependencies": {
39
- "@lowdefy/helpers": "4.0.0-rc.8",
40
- "@lowdefy/operators": "4.0.0-rc.8"
33
+ "@lowdefy/helpers": "4.0.0",
34
+ "@lowdefy/operators": "4.0.0"
41
35
  },
42
36
  "devDependencies": {
43
- "@jest/globals": "28.1.0",
44
- "@lowdefy/actions-core": "4.0.0-rc.8",
45
- "@lowdefy/build": "4.0.0-rc.8",
46
- "@lowdefy/operators-js": "4.0.0-rc.8",
47
- "@lowdefy/operators-mql": "4.0.0-rc.8",
48
- "@swc/cli": "0.1.59",
49
- "@swc/core": "1.3.24",
50
- "@swc/jest": "0.2.24",
51
- "jest": "28.1.0"
37
+ "@jest/globals": "28.1.3",
38
+ "@lowdefy/actions-core": "4.0.0",
39
+ "@lowdefy/build": "4.0.0",
40
+ "@lowdefy/operators-js": "4.0.0",
41
+ "@lowdefy/operators-mql": "4.0.0",
42
+ "@swc/cli": "0.1.63",
43
+ "@swc/core": "1.3.99",
44
+ "@swc/jest": "0.2.29",
45
+ "jest": "28.1.3"
52
46
  },
53
47
  "publishConfig": {
54
48
  "access": "public"
55
49
  },
56
- "gitHead": "db883daef0443647439b6fe2db845b846ffb6d4e"
57
- }
50
+ "scripts": {
51
+ "build": "swc src --out-dir dist --config-file ../../.swcrc --delete-dir-on-start",
52
+ "clean": "rm -rf dist",
53
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
54
+ }
55
+ }