@lowdefy/operators-js 4.0.0-alpha.9 → 4.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/operators/build/env.js +1 -1
  3. package/dist/operators/client/_index.js +1 -1
  4. package/dist/operators/client/actions.js +1 -1
  5. package/dist/operators/client/base64.js +1 -1
  6. package/dist/operators/client/event.js +1 -1
  7. package/dist/operators/client/event_log.js +1 -1
  8. package/dist/operators/client/global.js +1 -1
  9. package/dist/operators/client/input.js +1 -1
  10. package/dist/operators/client/location.js +19 -19
  11. package/dist/operators/client/media.js +4 -3
  12. package/dist/operators/client/menu.js +1 -1
  13. package/dist/operators/client/request.js +5 -6
  14. package/dist/operators/client/request_details.js +1 -1
  15. package/dist/operators/client/state.js +1 -1
  16. package/dist/operators/client/url_query.js +8 -3
  17. package/dist/operators/server/base64.js +1 -1
  18. package/dist/operators/server/hash.js +1 -1
  19. package/dist/operators/server/payload.js +1 -1
  20. package/dist/operators/server/secret.js +1 -1
  21. package/dist/operators/shared/and.js +2 -3
  22. package/dist/operators/shared/args.js +1 -1
  23. package/dist/operators/shared/array.js +5 -3
  24. package/dist/operators/shared/date.js +405 -10
  25. package/dist/operators/shared/divide.js +1 -1
  26. package/dist/operators/shared/eq.js +1 -1
  27. package/dist/operators/shared/function.js +3 -2
  28. package/dist/operators/shared/get.js +1 -1
  29. package/dist/operators/shared/gt.js +1 -1
  30. package/dist/operators/shared/gte.js +1 -1
  31. package/dist/operators/shared/if.js +1 -1
  32. package/dist/operators/shared/if_none.js +1 -1
  33. package/dist/operators/shared/intl.js +94 -0
  34. package/dist/operators/shared/json.js +1 -1
  35. package/dist/operators/shared/log.js +1 -1
  36. package/dist/operators/shared/lt.js +1 -1
  37. package/dist/operators/shared/lte.js +1 -1
  38. package/dist/operators/shared/math.js +1 -1
  39. package/dist/operators/shared/ne.js +1 -1
  40. package/dist/operators/shared/not.js +1 -1
  41. package/dist/operators/shared/number.js +1 -1
  42. package/dist/operators/shared/object.js +39 -15
  43. package/dist/operators/shared/operator.js +1 -1
  44. package/dist/operators/shared/or.js +2 -3
  45. package/dist/operators/shared/product.js +1 -1
  46. package/dist/operators/shared/random.js +1 -1
  47. package/dist/operators/shared/regex.js +1 -1
  48. package/dist/operators/shared/string.js +14 -9
  49. package/dist/operators/shared/subtract.js +1 -1
  50. package/dist/operators/shared/sum.js +1 -1
  51. package/dist/operators/shared/switch.js +1 -1
  52. package/dist/operators/shared/type.js +1 -1
  53. package/dist/operators/shared/uri.js +1 -1
  54. package/dist/operators/shared/user.js +1 -1
  55. package/dist/operatorsBuild.js +3 -1
  56. package/dist/operatorsClient.js +2 -1
  57. package/dist/operatorsServer.js +2 -1
  58. package/dist/types.js +1 -1
  59. package/package.json +14 -13
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.
@@ -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.
@@ -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.
@@ -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.
@@ -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.
@@ -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,39 +15,39 @@
15
15
  */ import { getFromObject } from '@lowdefy/operators';
16
16
  const validProperties = [
17
17
  'basePath',
18
- 'href',
19
- 'origin',
20
- 'protocol',
18
+ 'hash',
21
19
  'homePageId',
22
20
  'host',
23
21
  'hostname',
24
- 'port',
22
+ 'href',
23
+ 'origin',
25
24
  'pageId',
26
25
  'pathname',
27
- 'search',
28
- 'hash',
26
+ 'port',
27
+ 'protocol',
28
+ 'search'
29
29
  ];
30
- // TODO: Fix with new router and link
31
- function _location({ arrayIndices , context , location , params }) {
32
- if (!window || !window.location) {
30
+ function _location({ arrayIndices , basePath , home , location , pageId , params , globals }) {
31
+ const { window } = globals;
32
+ if (!window?.location) {
33
33
  throw new Error(`Operator Error: Browser window.location not available for _location. Received: ${JSON.stringify(params)} at ${location}.`);
34
34
  }
35
35
  if (!validProperties.includes(params)) {
36
36
  throw new Error(`Operator Error: _location only returns values for ${validProperties.join(', ')}. Received: ${JSON.stringify(params)} at ${location}.`);
37
37
  }
38
38
  const windowLocation = {
39
- basePath: context.lowdefy.basePath,
40
- href: window.location.href,
41
- origin: window.location.origin,
42
- protocol: window.location.protocol,
43
- homePageId: context.lowdefy.homePageId,
39
+ basePath,
40
+ hash: window.location.hash,
41
+ homePageId: home.pageId,
44
42
  host: window.location.host,
45
43
  hostname: window.location.hostname,
46
- port: window.location.port,
47
- pageId: context.lowdefy.pageId,
44
+ href: window.location.href,
45
+ origin: window.location.origin,
46
+ pageId,
48
47
  pathname: window.location.pathname,
49
- search: window.location.search,
50
- hash: window.location.hash
48
+ port: window.location.port,
49
+ protocol: window.location.protocol,
50
+ search: window.location.search
51
51
  };
52
52
  return getFromObject({
53
53
  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.
@@ -20,8 +20,9 @@ const breakpoints = {
20
20
  lg: 1200,
21
21
  xl: 1600
22
22
  };
23
- function _media({ arrayIndices , location , params }) {
24
- if (!window || !window.innerWidth) {
23
+ function _media({ arrayIndices , location , params , globals }) {
24
+ const { window } = globals;
25
+ if (!window?.innerWidth) {
25
26
  throw new Error(`Operator Error: device window width not available for _media. Received: ${JSON.stringify(params)} at ${location}.`);
26
27
  }
27
28
  let size;
@@ -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.
@@ -19,13 +19,12 @@ function _request({ arrayIndices , params , requests , location }) {
19
19
  }
20
20
  const splitKey = params.split('.');
21
21
  const [requestId, ...keyParts] = splitKey;
22
- if (requestId in requests && !requests[requestId].loading) {
22
+ if (requestId in requests && !requests[requestId][0].loading) {
23
23
  if (splitKey.length === 1) {
24
- return serializer.copy(requests[requestId].response);
24
+ return serializer.copy(requests[requestId][0].response);
25
25
  }
26
- const key = keyParts.reduce((acc, value)=>acc === '' ? value : acc.concat('.', value)
27
- , '');
28
- return get(requests[requestId].response, applyArrayIndices(arrayIndices, key), {
26
+ const key = keyParts.reduce((acc, value)=>acc === '' ? value : acc.concat('.', value), '');
27
+ return get(requests[requestId][0].response, applyArrayIndices(arrayIndices, key), {
29
28
  copy: true,
30
29
  default: null
31
30
  });
@@ -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.
@@ -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,11 +13,16 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ import { getFromObject } from '@lowdefy/operators';
16
- function _url_query({ arrayIndices , location , params , urlQuery }) {
16
+ import { urlQuery } from '@lowdefy/helpers';
17
+ function _url_query({ arrayIndices , globals , location , params }) {
18
+ const { window } = globals;
19
+ if (!window?.location) {
20
+ throw new Error(`Operator Error: Browser window.location not available for _url_query. Received: ${JSON.stringify(params)} at ${location}.`);
21
+ }
17
22
  return getFromObject({
18
23
  arrayIndices,
19
24
  location,
20
- object: urlQuery,
25
+ object: urlQuery.parse(window.location.search.slice(1)),
21
26
  operator: '_url_query',
22
27
  params
23
28
  });
@@ -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.
@@ -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.
@@ -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,6 @@ function _and({ params , location }) {
17
17
  if (!type.isArray(params)) {
18
18
  throw new Error(`Operator Error: _and takes an array type. Received: ${JSON.stringify(params)} at ${location}.`);
19
19
  }
20
- return !!params.reduce((acc, el)=>acc && el
21
- , true);
20
+ return !!params.reduce((acc, el)=>acc && el, true);
22
21
  }
23
22
  export default _and;
@@ -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.
@@ -190,7 +190,8 @@ const meta = {
190
190
  reverse: {
191
191
  prep,
192
192
  validTypes: [
193
- 'array'
193
+ 'array',
194
+ 'null'
194
195
  ],
195
196
  singleArg: true
196
197
  },
@@ -242,7 +243,8 @@ const meta = {
242
243
  },
243
244
  length: {
244
245
  validTypes: [
245
- 'array'
246
+ 'array',
247
+ 'null'
246
248
  ],
247
249
  prep,
248
250
  property: true