@lowdefy/operators-nunjucks 6.0.0 → 7.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.
@@ -38,4 +38,28 @@ function _nunjucks({ params, state, payload, runtime }) {
38
38
  return null;
39
39
  }
40
40
  _nunjucks.dynamic = false;
41
+ // A string template renders against the whole of state, so which paths it reads is not known.
42
+ // The date filter compares with the clock for relative methods (fromNow, isBefore with no
43
+ // argument, ...), and a format held in a variable could name one of them. A missing date
44
+ // renders as '' so it is not clock-dependent.
45
+ const clockRelativeDateFilter = /\bdate\s*\(\s*(?!['"])|\bdate\s*\(\s*['"](fromNow|toNow|from|to|isBefore|isAfter|isSame|isSameOrBefore|isSameOrAfter|diff|isToday|isYesterday|isTomorrow)['"]/;
46
+ _nunjucks.tracking = ({ params })=>{
47
+ const template = type.isString(params) ? params : params?.template;
48
+ if (type.isString(template) && clockRelativeDateFilter.test(template)) {
49
+ return {
50
+ kind: 'volatile'
51
+ };
52
+ }
53
+ if (type.isString(params)) {
54
+ return {
55
+ kind: 'read',
56
+ keys: [
57
+ 'state:*'
58
+ ]
59
+ };
60
+ }
61
+ return {
62
+ kind: 'pure'
63
+ };
64
+ };
41
65
  export default _nunjucks;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/operators-nunjucks",
3
- "version": "6.0.0",
3
+ "version": "7.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -27,6 +27,9 @@
27
27
  "url": "https://github.com/lowdefy/lowdefy.git"
28
28
  },
29
29
  "type": "module",
30
+ "sideEffects": [
31
+ "**/*.css"
32
+ ],
30
33
  "exports": {
31
34
  "./operators/client": "./dist/operatorsClient.js",
32
35
  "./operators/server": "./dist/operatorsServer.js",
@@ -37,12 +40,12 @@
37
40
  "dist/*"
38
41
  ],
39
42
  "dependencies": {
40
- "@lowdefy/helpers": "6.0.0",
41
- "@lowdefy/nunjucks": "6.0.0",
42
- "@lowdefy/operators": "6.0.0"
43
+ "@lowdefy/helpers": "7.0.0",
44
+ "@lowdefy/nunjucks": "7.0.0",
45
+ "@lowdefy/operators": "7.0.0"
43
46
  },
44
47
  "devDependencies": {
45
- "@lowdefy/node-utils": "6.0.0",
48
+ "@lowdefy/node-utils": "7.0.0",
46
49
  "@swc/cli": "0.8.1",
47
50
  "@swc/core": "1.15.32",
48
51
  "@swc/jest": "0.2.39",