@lowdefy/operators-js 5.2.0 → 5.4.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.
@@ -39,6 +39,10 @@ function js(operatorContext) {
39
39
  ...operatorContext,
40
40
  params: p
41
41
  }),
42
+ lowdefyApp: (p)=>operators._app({
43
+ ...operatorContext,
44
+ params: p
45
+ }),
42
46
  lowdefyGlobal: (p)=>operators._global({
43
47
  ...operatorContext,
44
48
  params: p
@@ -23,19 +23,23 @@ function js(operatorContext) {
23
23
  try {
24
24
  return jsMap[hash]({
25
25
  args,
26
- payload: (p)=>operators._payload({
26
+ item: (p)=>operators._item({
27
27
  ...operatorContext,
28
28
  params: p
29
29
  }),
30
- secret: (p)=>operators._secret({
30
+ lowdefyApp: (p)=>operators._app({
31
31
  ...operatorContext,
32
32
  params: p
33
33
  }),
34
- user: (p)=>operators._user({
34
+ payload: (p)=>operators._payload({
35
35
  ...operatorContext,
36
36
  params: p
37
37
  }),
38
- item: (p)=>operators._item({
38
+ secret: (p)=>operators._secret({
39
+ ...operatorContext,
40
+ params: p
41
+ }),
42
+ state: (p)=>operators._state({
39
43
  ...operatorContext,
40
44
  params: p
41
45
  }),
@@ -43,7 +47,7 @@ function js(operatorContext) {
43
47
  ...operatorContext,
44
48
  params: p
45
49
  }),
46
- state: (p)=>operators._state({
50
+ user: (p)=>operators._user({
47
51
  ...operatorContext,
48
52
  params: p
49
53
  })
@@ -0,0 +1,26 @@
1
+ /*
2
+ Copyright 2020-2026 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 '@lowdefy/operators';
16
+ function _app({ arrayIndices, location, lowdefyApp, params }) {
17
+ return getFromObject({
18
+ arrayIndices,
19
+ location,
20
+ object: lowdefyApp,
21
+ operator: '_app',
22
+ params
23
+ });
24
+ }
25
+ _app.dynamic = true;
26
+ export default _app;
@@ -0,0 +1,61 @@
1
+ /*
2
+ Copyright 2020-2026 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
+ */ export default {
16
+ type: 'object',
17
+ params: {
18
+ oneOf: [
19
+ {
20
+ type: 'string',
21
+ description: 'Dot-notation path to value in app metadata.'
22
+ },
23
+ {
24
+ type: 'integer',
25
+ description: 'Index to access in app metadata.'
26
+ },
27
+ {
28
+ type: 'boolean',
29
+ enum: [
30
+ true
31
+ ],
32
+ description: 'Return all app metadata.'
33
+ },
34
+ {
35
+ type: 'object',
36
+ properties: {
37
+ key: {
38
+ oneOf: [
39
+ {
40
+ type: 'string',
41
+ description: 'Dot-notation path to value in app metadata.'
42
+ },
43
+ {
44
+ type: 'integer',
45
+ description: 'Index to access in app metadata.'
46
+ }
47
+ ]
48
+ },
49
+ default: {
50
+ description: 'Default value if key does not exist.'
51
+ },
52
+ all: {
53
+ type: 'boolean',
54
+ description: 'Return all app metadata.'
55
+ }
56
+ },
57
+ additionalProperties: false
58
+ }
59
+ ]
60
+ }
61
+ };
@@ -0,0 +1,19 @@
1
+ /*
2
+ Copyright 2020-2026 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 _boolean({ params }) {
16
+ return !!params;
17
+ }
18
+ _boolean.dynamic = false;
19
+ export default _boolean;
@@ -0,0 +1,20 @@
1
+ /*
2
+ Copyright 2020-2026 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
+ */ export default {
16
+ type: 'object',
17
+ params: {
18
+ description: 'Value to coerce to its boolean truthiness.'
19
+ }
20
+ };
@@ -0,0 +1,32 @@
1
+ /*
2
+ Copyright 2020-2026 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 '@lowdefy/operators';
16
+ function _locale({ arrayIndices, location, params, i18n }) {
17
+ const view = {
18
+ active: i18n?.active,
19
+ default: i18n?.defaultLocale,
20
+ fallback: 'en-US',
21
+ supported: i18n?.locales ?? []
22
+ };
23
+ return getFromObject({
24
+ arrayIndices,
25
+ location,
26
+ object: view,
27
+ operator: '_locale',
28
+ params
29
+ });
30
+ }
31
+ _locale.dynamic = true;
32
+ export default _locale;
@@ -0,0 +1,20 @@
1
+ /*
2
+ Copyright 2020-2026 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
+ */ export default {
16
+ type: 'object',
17
+ params: {
18
+ description: 'Path to read from the locale view object: { active, default, fallback, supported }. Pass true to return the whole object, or a key string for a specific value.'
19
+ }
20
+ };
@@ -0,0 +1,34 @@
1
+ /*
2
+ Copyright 2020-2026 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 { translate, type } from '@lowdefy/helpers';
16
+ function _t({ params, i18n }) {
17
+ if (type.isString(params)) {
18
+ return translate({
19
+ key: params,
20
+ i18n
21
+ });
22
+ }
23
+ if (type.isObject(params)) {
24
+ return translate({
25
+ key: params.key,
26
+ values: params.values,
27
+ locale: params.locale,
28
+ i18n
29
+ });
30
+ }
31
+ throw new Error('_t takes a string key or an object { key, values, locale } — received ' + JSON.stringify(params));
32
+ }
33
+ _t.dynamic = true;
34
+ export default _t;
@@ -0,0 +1,20 @@
1
+ /*
2
+ Copyright 2020-2026 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
+ */ export default {
16
+ type: 'object',
17
+ params: {
18
+ description: 'Translation key or object { key, values, locale }. Resolves the key against the active locale\'s messages with ICU MessageFormat interpolation, falling back to the fallback locale and finally to the key itself.'
19
+ }
20
+ };
@@ -15,6 +15,7 @@
15
15
  */ import _and from './operators/shared/and.js';
16
16
  import _args from './operators/shared/args.js';
17
17
  import _array from './operators/shared/array.js';
18
+ import _boolean from './operators/shared/boolean.js';
18
19
  import _date from './operators/shared/date.js';
19
20
  import _divide from './operators/shared/divide.js';
20
21
  import _eq from './operators/shared/eq.js';
@@ -53,6 +54,7 @@ export default {
53
54
  _args,
54
55
  _array,
55
56
  _base64,
57
+ _boolean,
56
58
  _date,
57
59
  _divide,
58
60
  _env,
@@ -13,8 +13,10 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ export { default as _and } from './operators/shared/and.js';
16
+ export { default as _app } from './operators/shared/app.js';
16
17
  export { default as _args } from './operators/shared/args.js';
17
18
  export { default as _array } from './operators/shared/array.js';
19
+ export { default as _boolean } from './operators/shared/boolean.js';
18
20
  export { default as _date } from './operators/shared/date.js';
19
21
  export { default as _divide } from './operators/shared/divide.js';
20
22
  export { default as _eq } from './operators/shared/eq.js';
@@ -26,6 +28,7 @@ export { default as _if_none } from './operators/shared/if_none.js';
26
28
  export { default as _if } from './operators/shared/if.js';
27
29
  export { default as _intl } from './operators/shared/intl.js';
28
30
  export { default as _json } from './operators/shared/json.js';
31
+ export { default as _locale } from './operators/shared/locale.js';
29
32
  export { default as _log } from './operators/shared/log.js';
30
33
  export { default as _lt } from './operators/shared/lt.js';
31
34
  export { default as _lte } from './operators/shared/lte.js';
@@ -44,6 +47,7 @@ export { default as _string } from './operators/shared/string.js';
44
47
  export { default as _subtract } from './operators/shared/subtract.js';
45
48
  export { default as _sum } from './operators/shared/sum.js';
46
49
  export { default as _switch } from './operators/shared/switch.js';
50
+ export { default as _t } from './operators/shared/t.js';
47
51
  export { default as _type } from './operators/shared/type.js';
48
52
  export { default as _uri } from './operators/shared/uri.js';
49
53
  export { default as _user } from './operators/shared/user.js';
@@ -13,8 +13,10 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ export { default as _and } from './operators/shared/and.js';
16
+ export { default as _app } from './operators/shared/app.js';
16
17
  export { default as _args } from './operators/shared/args.js';
17
18
  export { default as _array } from './operators/shared/array.js';
19
+ export { default as _boolean } from './operators/shared/boolean.js';
18
20
  export { default as _date } from './operators/shared/date.js';
19
21
  export { default as _divide } from './operators/shared/divide.js';
20
22
  export { default as _eq } from './operators/shared/eq.js';
@@ -26,6 +28,7 @@ export { default as _if_none } from './operators/shared/if_none.js';
26
28
  export { default as _if } from './operators/shared/if.js';
27
29
  export { default as _intl } from './operators/shared/intl.js';
28
30
  export { default as _json } from './operators/shared/json.js';
31
+ export { default as _locale } from './operators/shared/locale.js';
29
32
  export { default as _log } from './operators/shared/log.js';
30
33
  export { default as _lt } from './operators/shared/lt.js';
31
34
  export { default as _lte } from './operators/shared/lte.js';
@@ -44,6 +47,7 @@ export { default as _string } from './operators/shared/string.js';
44
47
  export { default as _subtract } from './operators/shared/subtract.js';
45
48
  export { default as _sum } from './operators/shared/sum.js';
46
49
  export { default as _switch } from './operators/shared/switch.js';
50
+ export { default as _t } from './operators/shared/t.js';
47
51
  export { default as _type } from './operators/shared/type.js';
48
52
  export { default as _uri } from './operators/shared/uri.js';
49
53
  export { default as _user } from './operators/shared/user.js';
package/dist/schemas.js CHANGED
@@ -14,8 +14,10 @@
14
14
  limitations under the License.
15
15
  */ // Shared operators
16
16
  export { default as _and } from './operators/shared/and.schema.js';
17
+ export { default as _app } from './operators/shared/app.schema.js';
17
18
  export { default as _args } from './operators/shared/args.schema.js';
18
19
  export { default as _array } from './operators/shared/array.schema.js';
20
+ export { default as _boolean } from './operators/shared/boolean.schema.js';
19
21
  export { default as _date } from './operators/shared/date.schema.js';
20
22
  export { default as _divide } from './operators/shared/divide.schema.js';
21
23
  export { default as _eq } from './operators/shared/eq.schema.js';
@@ -27,6 +29,7 @@ export { default as _if_none } from './operators/shared/if_none.schema.js';
27
29
  export { default as _if } from './operators/shared/if.schema.js';
28
30
  export { default as _intl } from './operators/shared/intl.schema.js';
29
31
  export { default as _json } from './operators/shared/json.schema.js';
32
+ export { default as _locale } from './operators/shared/locale.schema.js';
30
33
  export { default as _log } from './operators/shared/log.schema.js';
31
34
  export { default as _lt } from './operators/shared/lt.schema.js';
32
35
  export { default as _lte } from './operators/shared/lte.schema.js';
@@ -45,6 +48,7 @@ export { default as _string } from './operators/shared/string.schema.js';
45
48
  export { default as _subtract } from './operators/shared/subtract.schema.js';
46
49
  export { default as _sum } from './operators/shared/sum.schema.js';
47
50
  export { default as _switch } from './operators/shared/switch.schema.js';
51
+ export { default as _t } from './operators/shared/t.schema.js';
48
52
  export { default as _type } from './operators/shared/type.schema.js';
49
53
  export { default as _uri } from './operators/shared/uri.schema.js';
50
54
  export { default as _user } from './operators/shared/user.schema.js';
package/dist/types.js CHANGED
@@ -18,9 +18,11 @@
18
18
  '_actions',
19
19
  '_and',
20
20
  '_api',
21
+ '_app',
21
22
  '_args',
22
23
  '_array',
23
24
  '_base64',
25
+ '_boolean',
24
26
  '_date',
25
27
  '_divide',
26
28
  '_eq',
@@ -38,6 +40,7 @@
38
40
  '_intl',
39
41
  '_js',
40
42
  '_json',
43
+ '_locale',
41
44
  '_location',
42
45
  '_log',
43
46
  '_lt',
@@ -61,6 +64,7 @@
61
64
  '_subtract',
62
65
  '_sum',
63
66
  '_switch',
67
+ '_t',
64
68
  '_theme',
65
69
  '_type',
66
70
  '_uri',
@@ -69,9 +73,11 @@
69
73
  ],
70
74
  server: [
71
75
  '_and',
76
+ '_app',
72
77
  '_args',
73
78
  '_array',
74
79
  '_base64',
80
+ '_boolean',
75
81
  '_date',
76
82
  '_divide',
77
83
  '_eq',
@@ -86,6 +92,7 @@
86
92
  '_item',
87
93
  '_js',
88
94
  '_json',
95
+ '_locale',
89
96
  '_log',
90
97
  '_lt',
91
98
  '_lte',
@@ -107,6 +114,7 @@
107
114
  '_subtract',
108
115
  '_sum',
109
116
  '_switch',
117
+ '_t',
110
118
  '_type',
111
119
  '_uri',
112
120
  '_user'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/operators-js",
3
- "version": "5.2.0",
3
+ "version": "5.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -43,12 +43,13 @@
43
43
  "dist/*"
44
44
  ],
45
45
  "dependencies": {
46
- "@lowdefy/helpers": "5.2.0",
47
- "@lowdefy/operators": "5.2.0"
46
+ "@lowdefy/helpers": "5.4.0",
47
+ "@lowdefy/operators": "5.4.0",
48
+ "intl-messageformat": "11.2.7"
48
49
  },
49
50
  "devDependencies": {
50
51
  "@jest/globals": "28.1.3",
51
- "@lowdefy/node-utils": "5.2.0",
52
+ "@lowdefy/node-utils": "5.4.0",
52
53
  "@swc/cli": "0.8.0",
53
54
  "@swc/core": "1.15.18",
54
55
  "@swc/jest": "0.2.39",