@protobase/workflows 0.71.3 → 0.71.5
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.
|
@@ -52,7 +52,8 @@ const shapesOf = async (plan, type, task) => {
|
|
|
52
52
|
const customValue = (plan, input, task) => {
|
|
53
53
|
if (typeof plan.key !== "function") return input;
|
|
54
54
|
try {
|
|
55
|
-
|
|
55
|
+
const json = JSON.stringify(plan.key(input));
|
|
56
|
+
return json === void 0 ? void 0 : JSON.parse(json) ?? void 0;
|
|
56
57
|
} catch {
|
|
57
58
|
task.log("The step type's cache key failed; the step ran without the cache");
|
|
58
59
|
return;
|
|
@@ -71,8 +72,8 @@ const logHit = (task, entry) => {
|
|
|
71
72
|
/**
|
|
72
73
|
* One call of a step type with its cache on: the result of an earlier call with the same key and identity when the
|
|
73
74
|
* type returns hits, else the step's own run, offered the earlier result when it asks for one, whose fresh result is
|
|
74
|
-
* kept. A failure, a reused result, a result over `limits.cacheValueBytes` and a call that acted as someone
|
|
75
|
-
* does not hold are not kept.
|
|
75
|
+
* kept. A failure, no result, a reused result, a result over `limits.cacheValueBytes` and a call that acted as someone
|
|
76
|
+
* its key does not hold are not kept.
|
|
76
77
|
*/
|
|
77
78
|
const cachedRun = async (plan, type, parts, task, run) => {
|
|
78
79
|
const { cache } = plan;
|
|
@@ -98,7 +99,8 @@ const cachedRun = async (plan, type, parts, task, run) => {
|
|
|
98
99
|
...entry && plan.use === "offer" && { earlier: earlierOf(entry) }
|
|
99
100
|
});
|
|
100
101
|
if (returned instanceof Reused) return returned.output;
|
|
101
|
-
|
|
102
|
+
if (returned === void 0) return;
|
|
103
|
+
const result = JSON.parse(JSON.stringify(returned));
|
|
102
104
|
await keep(cache, task, {
|
|
103
105
|
...call,
|
|
104
106
|
plan,
|
|
@@ -38,6 +38,7 @@ const handler = (id, type, wiring) => {
|
|
|
38
38
|
const plan = cachePlan(id, type, parts.input, task.cache);
|
|
39
39
|
if (plan && "invalidTtl" in plan) log("The step type's cache gave no valid time to live; the step ran without the cache");
|
|
40
40
|
if (!plan || "invalidTtl" in plan) return run(parts);
|
|
41
|
+
if (connection && plan.identity.connection) await connection.accessToken();
|
|
41
42
|
return cachedRun(plan, id, parts, task, run);
|
|
42
43
|
};
|
|
43
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/workflows",
|
|
3
|
-
"version": "0.71.
|
|
3
|
+
"version": "0.71.5",
|
|
4
4
|
"description": "Workflows as state machines with JSONata expressions: their check, a runner that saves every step, and the plugin interface for trigger and step types.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|