@lowdefy/operators-nunjucks 4.5.2 → 4.6.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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2024 Lowdefy, Inc
2
+ Copyright 2020-2026 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 { type } from '@lowdefy/helpers';
16
16
  import { nunjucksFunction } from '@lowdefy/nunjucks';
17
- function _nunjucks({ location, params, state, payload, runtime }) {
17
+ function _nunjucks({ params, state, payload, runtime }) {
18
18
  let templateString;
19
19
  let on;
20
20
  if (type.isObject(params) && type.isString(params.template)) {
@@ -30,10 +30,12 @@ function _nunjucks({ location, params, state, payload, runtime }) {
30
30
  const template = nunjucksFunction(templateString);
31
31
  return template(on);
32
32
  } catch (e) {
33
- // log e to LowdefyError
34
- throw new Error(`Operator Error: _nunjucks failed to parse nunjucks template. Received: ${JSON.stringify(params)} at ${location}.`);
33
+ throw new Error('_nunjucks failed to parse nunjucks template.', {
34
+ cause: e
35
+ });
35
36
  }
36
37
  }
37
38
  return null;
38
39
  }
40
+ _nunjucks.dynamic = false;
39
41
  export default _nunjucks;
@@ -0,0 +1,42 @@
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: 'Nunjucks template string. Uses state/payload as context.'
22
+ },
23
+ {
24
+ type: 'object',
25
+ required: [
26
+ 'template'
27
+ ],
28
+ properties: {
29
+ template: {
30
+ type: 'string',
31
+ description: 'Nunjucks template string.'
32
+ },
33
+ on: {
34
+ type: 'object',
35
+ description: 'Object to use as template context.'
36
+ }
37
+ },
38
+ additionalProperties: false
39
+ }
40
+ ]
41
+ }
42
+ };
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2024 Lowdefy, Inc
2
+ Copyright 2020-2026 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-2024 Lowdefy, Inc
2
+ Copyright 2020-2026 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.
@@ -0,0 +1,15 @@
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 as _nunjucks } from './operators/shared/nunjucks.schema.js';
package/dist/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2024 Lowdefy, Inc
2
+ Copyright 2020-2026 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/operators-nunjucks",
3
- "version": "4.5.2",
3
+ "version": "4.6.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -30,15 +30,16 @@
30
30
  "exports": {
31
31
  "./operators/client": "./dist/operatorsClient.js",
32
32
  "./operators/server": "./dist/operatorsServer.js",
33
+ "./schemas": "./dist/schemas.js",
33
34
  "./types": "./dist/types.js"
34
35
  },
35
36
  "files": [
36
37
  "dist/*"
37
38
  ],
38
39
  "dependencies": {
39
- "@lowdefy/helpers": "4.5.2",
40
- "@lowdefy/nunjucks": "4.5.2",
41
- "@lowdefy/operators": "4.5.2"
40
+ "@lowdefy/helpers": "4.6.0",
41
+ "@lowdefy/nunjucks": "4.6.0",
42
+ "@lowdefy/operators": "4.6.0"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@swc/cli": "0.1.63",