Skip to content

Commit

Permalink
Return value on the workflow finished
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Candeia <[email protected]>
  • Loading branch information
mcandeia committed Apr 30, 2023
1 parent 1592962 commit ffd9942
Show file tree
Hide file tree
Showing 5 changed files with 216 additions and 16 deletions.
2 changes: 1 addition & 1 deletion import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"imports": {
"deco-sites/fashion/": "./",
"deco-sites/std/": "https://denopkg.com/deco-sites/[email protected]/",
"$live/": "https://denopkg.com/deco-cx/live@a856b6cf6d45f1437dc1fa801c0429c32a3f7db4/",
"$live/": "https://denopkg.com/deco-cx/live@5652f4cd05886f17da58ab5d27bcfa14a8e42276/",
"$fresh/": "https://deno.land/x/[email protected]/",
"preact": "https://esm.sh/[email protected]",
"preact/": "https://esm.sh/[email protected]/",
Expand Down
30 changes: 18 additions & 12 deletions live.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ import * as $live_inspect from "$live/routes/live/inspect/[...block].ts";
import * as $live_meta from "$live/routes/live/_meta.ts";
import * as $live_previews from "$live/routes/live/previews/[...block].tsx";
import * as $live_catchall from "$live/routes/[...catchall].tsx";
import * as i1$0 from "$live/loaders/workflows/get.ts";
import * as i2$$$$$0 from "$live/handlers/devPage.ts";
import * as i2$$$$$1 from "$live/handlers/fresh.ts";
import * as i1$2 from "$live/handlers/redirect.ts";
import * as i1$$2 from "$live/handlers/redirect.ts";
import * as i2$$$$$2 from "$live/handlers/router.ts";
import * as i2$$$$$3 from "$live/handlers/routesSelection.ts";
import * as i1$5 from "$live/handlers/workflowRunner.ts";
import * as i1$$5 from "$live/handlers/workflowRunner.ts";
import * as i2$$$$$$0 from "$live/pages/LivePage.tsx";
import * as i2$$$$0 from "$live/sections/PageInclude.tsx";
import * as i2$$$$1 from "$live/sections/Slot.tsx";
Expand All @@ -60,8 +61,10 @@ import * as i2$$$$$$$5 from "$live/matchers/MatchSite.ts";
import * as i2$$$$$$$6 from "$live/matchers/MatchUserAgent.ts";
import * as i2$$$$$$$$0 from "$live/flags/audience.ts";
import * as i2$$$$$$$$1 from "$live/flags/everyone.ts";
import * as i1$$$$$$0 from "$live/actions/workflows/run.ts";
import * as i1$$$$$$1 from "$live/actions/workflows/start.ts";
import * as i1$$$$$$$0 from "$live/actions/workflows/cancel.ts";
import * as i1$$$$$$$1 from "$live/actions/workflows/run.ts";
import * as i1$$$$$$$2 from "$live/actions/workflows/signal.ts";
import * as i1$$$$$$$3 from "$live/actions/workflows/start.ts";
import * as i2$0 from "deco-sites/std/functions/occProductDetailsPage.ts";
import * as i2$1 from "deco-sites/std/functions/segment.ts";
import * as i2$2 from "deco-sites/std/functions/shopifyProductDetailsPage.ts";
Expand Down Expand Up @@ -156,20 +159,27 @@ const manifest = {
"deco-sites/std/sections/SEOPLP.tsx": i2$$$$11,
},
"actions": {
"$live/actions/workflows/run.ts": i1$$$$$$0,
"$live/actions/workflows/start.ts": i1$$$$$$1,
"$live/actions/workflows/cancel.ts": i1$$$$$$$0,
"$live/actions/workflows/run.ts": i1$$$$$$$1,
"$live/actions/workflows/signal.ts": i1$$$$$$$2,
"$live/actions/workflows/start.ts": i1$$$$$$$3,
"deco-sites/fashion/actions/charge.ts": $$$$$$$$$$$0,
},
"workflows": {
"deco-sites/fashion/workflows/simple.ts": $$$$$$$$$$$$0,
},
"loaders": {
"$live/loaders/workflows/get.ts": i1$0,
"deco-sites/std/loaders/vtexLegacyProductDetailsPage.ts": i2$$$0,
"deco-sites/std/loaders/vtexLegacyRelatedProductsLoader.ts": i2$$$1,
},
"handlers": {
"$live/handlers/devPage.ts": i2$$$$$0,
"$live/handlers/fresh.ts": i2$$$$$1,
"$live/handlers/redirect.ts": i1$2,
"$live/handlers/redirect.ts": i1$$2,
"$live/handlers/router.ts": i2$$$$$2,
"$live/handlers/routesSelection.ts": i2$$$$$3,
"$live/handlers/workflowRunner.ts": i1$5,
"$live/handlers/workflowRunner.ts": i1$$5,
},
"pages": {
"$live/pages/LivePage.tsx": i2$$$$$$0,
Expand Down Expand Up @@ -217,10 +227,6 @@ const manifest = {
"deco-sites/std/accounts/vtex.ts": i2$$3,
"deco-sites/std/accounts/yourViews.ts": i2$$4,
},
"loaders": {
"deco-sites/std/loaders/vtexLegacyProductDetailsPage.ts": i2$$$0,
"deco-sites/std/loaders/vtexLegacyRelatedProductsLoader.ts": i2$$$1,
},
"config": config,
"baseUrl": import.meta.url,
};
Expand Down
1 change: 0 additions & 1 deletion runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ import { withManifest } from "$live/clients/withManifest.ts";
import type { Manifest } from "./live.gen.ts";

export const Runtime = withManifest<Manifest>();

196 changes: 195 additions & 1 deletion schemas.gen.json
Original file line number Diff line number Diff line change
Expand Up @@ -2529,6 +2529,81 @@
],
"title": "deco-sites/std/commerce/yourViews/client.ts@ConfigYourViews"
},
"ZGVjby1jeC9kdXJhYmxlL2JhY2tlbmRzL2JhY2tlbmQudHM=@WorkflowExecution": {
"anyOf": [
{
"$ref": "#/definitions/Resolvable"
},
{
"type": "object",
"properties": {
"id": {
"type": "string",
"title": "Id"
},
"alias": {
"type": "string",
"title": "Alias"
},
"completedAt": {
"title": "Completed At"
},
"status": {
"title": "Status"
},
"metadata": {
"title": "Metadata"
},
"input": {
"title": "Input"
},
"output": {
"title": "Output"
}
},
"required": [
"id",
"alias",
"status"
],
"title": "deco-cx/durable/backends/backend.ts@WorkflowExecution"
},
{
"title": "$live/loaders/workflows/get.ts",
"type": "object",
"allOf": [
{
"$ref": "#/definitions/ZGVjby1jeC9saXZlL2xvYWRlcnMvd29ya2Zsb3dzL2dldC50cw==@Props"
}
],
"required": [
"__resolveType"
],
"properties": {
"__resolveType": {
"type": "string",
"enum": [
"$live/loaders/workflows/get.ts"
],
"default": "$live/loaders/workflows/get.ts"
}
}
}
]
},
"ZGVjby1jeC9saXZlL2xvYWRlcnMvd29ya2Zsb3dzL2dldC50cw==@Props": {
"type": "object",
"properties": {
"id": {
"type": "string",
"title": "Id"
}
},
"required": [
"id"
],
"title": "deco-cx/live/loaders/workflows/get.ts@Props"
},
"ZGVjby1zaXRlcy9zdGQvbG9hZGVycy92dGV4TGVnYWN5UHJvZHVjdERldGFpbHNQYWdlLnRz@Props": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -4767,6 +4842,26 @@
"required": [],
"title": "deco-cx/live/flags/everyone.ts@EveryoneConfig"
},
"ZGVjby1jeC9saXZlL2FjdGlvbnMvd29ya2Zsb3dzL2NhbmNlbC50cw==@Props": {
"type": "object",
"properties": {
"executionId": {
"type": "string",
"title": "Execution Id"
},
"reason": {
"type": [
"string",
"null"
],
"title": "Reason"
}
},
"required": [
"executionId"
],
"title": "deco-cx/live/actions/workflows/cancel.ts@Props"
},
"ZGVjby1jeC9kdXJhYmxlL2hhbmRsZXIudHM=@RunRequest": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -4811,13 +4906,40 @@
],
"title": "deco-cx/live/actions/workflows/run.ts@Props"
},
"ZGVjby1jeC9saXZlL2FjdGlvbnMvd29ya2Zsb3dzL3NpZ25hbC50cw==@Props": {
"type": "object",
"properties": {
"signal": {
"type": "string",
"title": "Signal"
},
"executionId": {
"type": "string",
"title": "Execution Id"
},
"payload": {
"title": "Payload"
}
},
"required": [
"signal",
"executionId"
],
"title": "deco-cx/live/actions/workflows/signal.ts@Props"
},
"ZGVjby1jeC9saXZlL2FjdGlvbnMvd29ya2Zsb3dzL3N0YXJ0LnRz@Props": {
"type": "object",
"properties": {
"workflow": {
"type": "string",
"title": "Workflow"
},
"id": {
"type": [
"string",
"null"
],
"title": "Id"
},
"props": {
"type": [
"object",
Expand Down Expand Up @@ -5375,6 +5497,27 @@
}
}
},
"JGxpdmUvbG9hZGVycy93b3JrZmxvd3MvZ2V0LnRz": {
"title": "$live/loaders/workflows/get.ts",
"type": "object",
"allOf": [
{
"$ref": "#/definitions/ZGVjby1jeC9saXZlL2xvYWRlcnMvd29ya2Zsb3dzL2dldC50cw==@Props"
}
],
"required": [
"__resolveType"
],
"properties": {
"__resolveType": {
"type": "string",
"enum": [
"$live/loaders/workflows/get.ts"
],
"default": "$live/loaders/workflows/get.ts"
}
}
},
"ZGVjby1zaXRlcy9zdGQvbG9hZGVycy92dGV4TGVnYWN5UHJvZHVjdERldGFpbHNQYWdlLnRz": {
"title": "deco-sites/std/loaders/vtexLegacyProductDetailsPage.ts",
"type": "object",
Expand Down Expand Up @@ -6459,6 +6602,27 @@
}
}
},
"JGxpdmUvYWN0aW9ucy93b3JrZmxvd3MvY2FuY2VsLnRz": {
"title": "$live/actions/workflows/cancel.ts",
"type": "object",
"allOf": [
{
"$ref": "#/definitions/ZGVjby1jeC9saXZlL2FjdGlvbnMvd29ya2Zsb3dzL2NhbmNlbC50cw==@Props"
}
],
"required": [
"__resolveType"
],
"properties": {
"__resolveType": {
"type": "string",
"enum": [
"$live/actions/workflows/cancel.ts"
],
"default": "$live/actions/workflows/cancel.ts"
}
}
},
"JGxpdmUvYWN0aW9ucy93b3JrZmxvd3MvcnVuLnRz": {
"title": "$live/actions/workflows/run.ts",
"type": "object",
Expand All @@ -6480,6 +6644,27 @@
}
}
},
"JGxpdmUvYWN0aW9ucy93b3JrZmxvd3Mvc2lnbmFsLnRz": {
"title": "$live/actions/workflows/signal.ts",
"type": "object",
"allOf": [
{
"$ref": "#/definitions/ZGVjby1jeC9saXZlL2FjdGlvbnMvd29ya2Zsb3dzL3NpZ25hbC50cw==@Props"
}
],
"required": [
"__resolveType"
],
"properties": {
"__resolveType": {
"type": "string",
"enum": [
"$live/actions/workflows/signal.ts"
],
"default": "$live/actions/workflows/signal.ts"
}
}
},
"JGxpdmUvYWN0aW9ucy93b3JrZmxvd3Mvc3RhcnQudHM=": {
"title": "$live/actions/workflows/start.ts",
"type": "object",
Expand Down Expand Up @@ -6678,6 +6863,9 @@
{
"$ref": "#/definitions/Resolvable"
},
{
"$ref": "#/definitions/JGxpdmUvbG9hZGVycy93b3JrZmxvd3MvZ2V0LnRz"
},
{
"$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvbG9hZGVycy92dGV4TGVnYWN5UHJvZHVjdERldGFpbHNQYWdlLnRz"
},
Expand Down Expand Up @@ -6896,9 +7084,15 @@
{
"$ref": "#/definitions/Resolvable"
},
{
"$ref": "#/definitions/JGxpdmUvYWN0aW9ucy93b3JrZmxvd3MvY2FuY2VsLnRz"
},
{
"$ref": "#/definitions/JGxpdmUvYWN0aW9ucy93b3JrZmxvd3MvcnVuLnRz"
},
{
"$ref": "#/definitions/JGxpdmUvYWN0aW9ucy93b3JrZmxvd3Mvc2lnbmFsLnRz"
},
{
"$ref": "#/definitions/JGxpdmUvYWN0aW9ucy93b3JrZmxvd3Mvc3RhcnQudHM="
},
Expand Down
3 changes: 2 additions & 1 deletion workflows/simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export default function Simple({ sleepTime }: Props): Workflow {
value: 20,
},
});
const { newValue } = yield _ctx.waitForSignal("my-signal");
console.log("the charged value", chargedValue2);
console.log("TOTAL", chargedValue1.value + chargedValue2.value);
return chargedValue1.value + chargedValue2.value + newValue;
};
}

0 comments on commit ffd9942

Please sign in to comment.