@platforma-sdk/workflow-tengo 1.6.2 → 1.6.3

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.
@@ -89,7 +89,7 @@ _loadPythonRunEnvironment := func(descriptor, softName, softPkg) {
89
89
  }
90
90
 
91
91
  venv := venvBuilder.
92
- cache(7 * 24 * times.hour).
92
+ cacheDays(7).
93
93
  build().
94
94
  venv()
95
95
 
@@ -179,6 +179,7 @@ builder := func() {
179
179
  },
180
180
 
181
181
  /**
182
+ * @deprecated, use cacheMillis, cacheSeconds, cacheMinutes, cacheHours and cacheDays instead.
182
183
  * Sets the cache time.
183
184
  *
184
185
  * @param time: duration - the cache time from 'times' library.
@@ -192,6 +193,61 @@ builder := func() {
192
193
  return self
193
194
  },
194
195
 
196
+ /**
197
+ * Sets the cache time in milliseconds.
198
+ *
199
+ * @param millis: number
200
+ */
201
+ cacheMillis: func(millis) {
202
+ ll.assert(is_int(millis) && millis > 0, "cache time must be a number of milliseconds")
203
+ cache = millis * times.millisecond
204
+ return self
205
+ },
206
+
207
+ /**
208
+ * Sets the cache time in seconds.
209
+ *
210
+ * @param seconds: number
211
+ */
212
+ cacheSeconds: func(seconds) {
213
+ ll.assert(is_int(seconds) && seconds > 0, "cache time must be a number of seconds")
214
+ cache = seconds * times.second
215
+ return self
216
+ },
217
+
218
+ /**
219
+ * Sets the cache time in minutes.
220
+ *
221
+ * @param minutes: number
222
+ */
223
+ cacheMinutes: func(minutes) {
224
+ ll.assert(is_int(minutes) && minutes > 0, "cache time must be a number of minutes")
225
+ cache = minutes * times.minute
226
+ return self
227
+ },
228
+
229
+ /**
230
+ * Sets the cache time in hours.
231
+ *
232
+ * @param hours: number
233
+ */
234
+ cacheHours: func(hours) {
235
+ ll.assert(is_int(hours) && hours > 0, "cache time must be a number of hours")
236
+ cache = hours * times.hour
237
+ return self
238
+ },
239
+
240
+ /**
241
+ * Sets the cache time in days
242
+ *
243
+ * @param days: number
244
+ */
245
+ cacheDays: func(days) {
246
+ ll.assert(is_int(days) && days > 0, "cache time must be a number of days")
247
+ cache = days * times.hour * 24
248
+ return self
249
+ },
250
+
195
251
  /**
196
252
  * Sets the number of error lines to be captured.
197
253
  *
@@ -10,6 +10,7 @@ validation := import("@platforma-sdk/workflow-tengo:validation")
10
10
  pkg := import("@platforma-sdk/workflow-tengo:exec.package")
11
11
  assets := import("@platforma-sdk/workflow-tengo:assets")
12
12
  render := import("@platforma-sdk/workflow-tengo:render")
13
+ times := import("times")
13
14
 
14
15
  _RTYPE_SAVE_RUN_ENV := { Name: "SaveRunEnv/executor", Version: "1" }
15
16
  _INPUT_SETTINGS := "settings"
@@ -167,6 +168,62 @@ pythonVenv := func() {
167
168
  },
168
169
 
169
170
  /**
171
+ * Sets the cache time in milliseconds.
172
+ *
173
+ * @param millis: number
174
+ */
175
+ cacheMillis: func(millis) {
176
+ ll.assert(is_int(millis) && millis > 0, "cache time must be a number of milliseconds")
177
+ cache = millis * times.millisecond
178
+ return self
179
+ },
180
+
181
+ /**
182
+ * Sets the cache time in seconds.
183
+ *
184
+ * @param seconds: number
185
+ */
186
+ cacheSeconds: func(seconds) {
187
+ ll.assert(is_int(seconds) && seconds > 0, "cache time must be a number of seconds")
188
+ cache = seconds * times.second
189
+ return self
190
+ },
191
+
192
+ /**
193
+ * Sets the cache time in minutes.
194
+ *
195
+ * @param minutes: number
196
+ */
197
+ cacheMinutes: func(minutes) {
198
+ ll.assert(is_int(minutes) && minutes > 0, "cache time must be a number of minutes")
199
+ cache = minutes * times.minute
200
+ return self
201
+ },
202
+
203
+ /**
204
+ * Sets the cache time in hours.
205
+ *
206
+ * @param hours: number
207
+ */
208
+ cacheHours: func(hours) {
209
+ ll.assert(is_int(hours) && hours > 0, "cache time must be a number of hours")
210
+ cache = hours * times.hour
211
+ return self
212
+ },
213
+
214
+ /**
215
+ * Sets the cache time in days
216
+ *
217
+ * @param days: number
218
+ */
219
+ cacheDays: func(days) {
220
+ ll.assert(is_int(days) && days > 0, "cache time must be a number of days")
221
+ cache = days * times.hour * 24
222
+ return self
223
+ },
224
+
225
+ /**
226
+ * @deprecated, use cacheMillis, cacheSeconds, cacheMinutes, cacheHours and cacheDays instead.
170
227
  * Sets the cache time.
171
228
  *
172
229
  * @param time: duration - the cache time from 'times' library.
@@ -10,6 +10,7 @@ constants := import("@platforma-sdk/workflow-tengo:constants")
10
10
  oop := import("@platforma-sdk/workflow-tengo:oop")
11
11
  validation := import("@platforma-sdk/workflow-tengo:validation")
12
12
  tx := import("tx")
13
+ times := import("times")
13
14
 
14
15
 
15
16
  _SUBSCRIPTION_FIELD := "subscription"
@@ -61,7 +62,7 @@ createUniversal := func(tpl, isEph, inputs) {
61
62
  out := renderer.getFutureOutputField(tplutil.TEMPLATE_OUTPUT_PREFIX + name)
62
63
  if len(cache) > 0 && cache[0] > 0 {
63
64
  cache = cache[0]
64
- tx.cacheSetToField(out.id, cache)
65
+ tx.cacheSetToField(out.id, cache * times.millisecond)
65
66
  }
66
67
 
67
68
  return out
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/workflow-tengo",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "Tengo SDK library",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -16,8 +16,8 @@
16
16
  "./dist/**/*"
17
17
  ],
18
18
  "dependencies": {
19
- "@milaboratories/software-pframes-conv": "^1.6.2",
20
- "@platforma-open/milaboratories.software-small-binaries": "^1.13.2"
19
+ "@milaboratories/software-pframes-conv": "^1.6.3",
20
+ "@platforma-open/milaboratories.software-small-binaries": "^1.14.4"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@platforma-sdk/tengo-builder": "^1.15.0"