nvent 0.4.3 → 0.4.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.
- package/dist/module.d.mts +3 -184
- package/dist/module.json +3 -3
- package/dist/module.mjs +133 -197
- package/dist/runtime/adapters/builtin/file-queue.d.ts +53 -0
- package/dist/runtime/adapters/builtin/file-queue.js +435 -0
- package/dist/runtime/adapters/builtin/file-store.d.ts +46 -0
- package/dist/runtime/adapters/builtin/file-store.js +225 -0
- package/dist/runtime/adapters/builtin/file-stream.d.ts +39 -0
- package/dist/runtime/adapters/builtin/file-stream.js +56 -0
- package/dist/runtime/adapters/builtin/index.d.ts +10 -0
- package/dist/runtime/adapters/builtin/index.js +5 -0
- package/dist/runtime/adapters/builtin/memory-queue.d.ts +52 -0
- package/dist/runtime/adapters/builtin/memory-queue.js +239 -0
- package/dist/runtime/adapters/builtin/memory-store.d.ts +57 -0
- package/dist/runtime/adapters/builtin/memory-store.js +263 -0
- package/dist/runtime/adapters/builtin/memory-stream.d.ts +21 -0
- package/dist/runtime/adapters/builtin/memory-stream.js +56 -0
- package/dist/runtime/adapters/factory.d.ts +31 -0
- package/dist/runtime/adapters/factory.js +100 -0
- package/dist/runtime/adapters/index.d.ts +8 -0
- package/dist/runtime/adapters/index.js +3 -0
- package/dist/runtime/adapters/interfaces/index.d.ts +11 -0
- package/dist/runtime/adapters/interfaces/index.js +3 -0
- package/dist/runtime/adapters/interfaces/queue.d.ts +150 -0
- package/dist/runtime/adapters/interfaces/store.d.ts +233 -0
- package/dist/runtime/adapters/interfaces/stream.d.ts +62 -0
- package/dist/runtime/adapters/registry.d.ts +85 -0
- package/dist/runtime/adapters/registry.js +161 -0
- package/dist/runtime/config/index.d.ts +29 -0
- package/dist/runtime/config/index.js +167 -0
- package/dist/runtime/config/types.d.ts +367 -0
- package/dist/runtime/config/types.js +0 -0
- package/dist/runtime/events/types.d.ts +116 -0
- package/dist/runtime/events/types.js +0 -0
- package/dist/runtime/events/utils/stallDetector.d.ts +99 -0
- package/dist/runtime/events/utils/stallDetector.js +237 -0
- package/dist/runtime/{server-utils/events → events}/wiring/flowWiring.d.ts +3 -8
- package/dist/runtime/{server-utils/events → events}/wiring/flowWiring.js +119 -36
- package/dist/runtime/events/wiring/registry.d.ts +19 -0
- package/dist/runtime/events/wiring/registry.js +33 -0
- package/dist/runtime/events/wiring/stateWiring.d.ts +37 -0
- package/dist/runtime/events/wiring/stateWiring.js +92 -0
- package/dist/runtime/events/wiring/streamWiring.d.ts +32 -0
- package/dist/runtime/events/wiring/streamWiring.js +79 -0
- package/dist/runtime/server/api/_flows/[name]/clear-history.delete.js +16 -5
- package/dist/runtime/server/api/_flows/[name]/runs/[runId]/cancel.post.js +21 -0
- package/dist/runtime/server/api/_flows/[name]/runs.get.d.ts +12 -2
- package/dist/runtime/server/api/_flows/[name]/runs.get.js +15 -4
- package/dist/runtime/server/api/_flows/[name]/schedule.post.js +11 -2
- package/dist/runtime/server/api/_flows/[name]/schedules/[id].delete.js +21 -16
- package/dist/runtime/server/api/_flows/[name]/schedules.get.js +21 -19
- package/dist/runtime/server/api/_flows/ws.js +43 -22
- package/dist/runtime/server/api/_queues/[name]/job/[id].get.js +8 -3
- package/dist/runtime/server/api/_queues/[name]/job/index.get.js +12 -3
- package/dist/runtime/server/api/_queues/index.get.js +66 -23
- package/dist/runtime/server/api/_queues/ws.js +14 -4
- package/dist/runtime/server/plugins/00.adapters.d.ts +14 -0
- package/dist/runtime/server/plugins/00.adapters.js +69 -0
- package/dist/runtime/server/plugins/02.workers.js +45 -0
- package/dist/runtime/tsconfig.json +8 -0
- package/dist/runtime/utils/adapters.d.ts +66 -0
- package/dist/runtime/utils/adapters.js +51 -0
- package/dist/runtime/utils/defineFunction.d.ts +10 -0
- package/dist/runtime/{server-utils/utils/defineQueueWorker.js → utils/defineFunction.js} +4 -4
- package/dist/runtime/{server-utils/utils/defineQueueConfig.d.ts → utils/defineFunctionConfig.d.ts} +3 -3
- package/dist/runtime/utils/defineFunctionConfig.js +2 -0
- package/dist/runtime/utils/registerAdapter.d.ts +59 -0
- package/dist/runtime/utils/registerAdapter.js +13 -0
- package/dist/runtime/utils/useFlowEngine.d.ts +19 -0
- package/dist/runtime/utils/useFlowEngine.js +108 -0
- package/dist/runtime/{server-utils/utils → utils}/useNventLogger.js +2 -2
- package/dist/runtime/utils/useStreamTopics.d.ts +72 -0
- package/dist/runtime/utils/useStreamTopics.js +47 -0
- package/dist/runtime/{server-utils/worker/runner/node.d.ts → worker/node/runner.d.ts} +18 -2
- package/dist/runtime/{server-utils/worker/runner/node.js → worker/node/runner.js} +44 -17
- package/dist/types.d.mts +2 -2
- package/package.json +14 -44
- package/LICENSE +0 -21
- package/README.md +0 -389
- package/dist/runtime/app/assets/vueflow.css +0 -1
- package/dist/runtime/app/components/ConfirmDialog.d.vue.ts +0 -33
- package/dist/runtime/app/components/ConfirmDialog.vue +0 -121
- package/dist/runtime/app/components/ConfirmDialog.vue.d.ts +0 -33
- package/dist/runtime/app/components/FlowDiagram.d.vue.ts +0 -64
- package/dist/runtime/app/components/FlowDiagram.vue +0 -338
- package/dist/runtime/app/components/FlowDiagram.vue.d.ts +0 -64
- package/dist/runtime/app/components/FlowNodeCard.d.vue.ts +0 -29
- package/dist/runtime/app/components/FlowNodeCard.vue +0 -156
- package/dist/runtime/app/components/FlowNodeCard.vue.d.ts +0 -29
- package/dist/runtime/app/components/FlowRunOverview.d.vue.ts +0 -9
- package/dist/runtime/app/components/FlowRunOverview.vue +0 -291
- package/dist/runtime/app/components/FlowRunOverview.vue.d.ts +0 -9
- package/dist/runtime/app/components/FlowRunStatusBadge.d.vue.ts +0 -14
- package/dist/runtime/app/components/FlowRunStatusBadge.vue +0 -60
- package/dist/runtime/app/components/FlowRunStatusBadge.vue.d.ts +0 -14
- package/dist/runtime/app/components/FlowRunTimeline.d.vue.ts +0 -12
- package/dist/runtime/app/components/FlowRunTimeline.vue +0 -127
- package/dist/runtime/app/components/FlowRunTimeline.vue.d.ts +0 -12
- package/dist/runtime/app/components/FlowScheduleDialog.d.vue.ts +0 -16
- package/dist/runtime/app/components/FlowScheduleDialog.vue +0 -226
- package/dist/runtime/app/components/FlowScheduleDialog.vue.d.ts +0 -16
- package/dist/runtime/app/components/FlowSchedulesList.d.vue.ts +0 -12
- package/dist/runtime/app/components/FlowSchedulesList.vue +0 -99
- package/dist/runtime/app/components/FlowSchedulesList.vue.d.ts +0 -12
- package/dist/runtime/app/components/JobScheduling.d.vue.ts +0 -6
- package/dist/runtime/app/components/JobScheduling.vue +0 -203
- package/dist/runtime/app/components/JobScheduling.vue.d.ts +0 -6
- package/dist/runtime/app/components/ListItem.d.vue.ts +0 -23
- package/dist/runtime/app/components/ListItem.vue +0 -70
- package/dist/runtime/app/components/ListItem.vue.d.ts +0 -23
- package/dist/runtime/app/components/QueueConfigDetails.d.vue.ts +0 -45
- package/dist/runtime/app/components/QueueConfigDetails.vue +0 -412
- package/dist/runtime/app/components/QueueConfigDetails.vue.d.ts +0 -45
- package/dist/runtime/app/components/StatCounter.d.vue.ts +0 -9
- package/dist/runtime/app/components/StatCounter.vue +0 -25
- package/dist/runtime/app/components/StatCounter.vue.d.ts +0 -9
- package/dist/runtime/app/components/TimelineList.d.vue.ts +0 -7
- package/dist/runtime/app/components/TimelineList.vue +0 -210
- package/dist/runtime/app/components/TimelineList.vue.d.ts +0 -7
- package/dist/runtime/app/components/nhealth/component-router.d.vue.ts +0 -46
- package/dist/runtime/app/components/nhealth/component-router.vue +0 -26
- package/dist/runtime/app/components/nhealth/component-router.vue.d.ts +0 -46
- package/dist/runtime/app/components/nhealth/component-shell.d.vue.ts +0 -24
- package/dist/runtime/app/components/nhealth/component-shell.vue +0 -89
- package/dist/runtime/app/components/nhealth/component-shell.vue.d.ts +0 -24
- package/dist/runtime/app/composables/useAnalyzedFlows.d.ts +0 -14
- package/dist/runtime/app/composables/useAnalyzedFlows.js +0 -8
- package/dist/runtime/app/composables/useComponentRouter.d.ts +0 -38
- package/dist/runtime/app/composables/useComponentRouter.js +0 -240
- package/dist/runtime/app/composables/useFlowRunTimeline.d.ts +0 -15
- package/dist/runtime/app/composables/useFlowRunTimeline.js +0 -66
- package/dist/runtime/app/composables/useFlowRuns.d.ts +0 -18
- package/dist/runtime/app/composables/useFlowRuns.js +0 -32
- package/dist/runtime/app/composables/useFlowRunsInfinite.d.ts +0 -24
- package/dist/runtime/app/composables/useFlowRunsInfinite.js +0 -123
- package/dist/runtime/app/composables/useFlowRunsPolling.d.ts +0 -9
- package/dist/runtime/app/composables/useFlowRunsPolling.js +0 -33
- package/dist/runtime/app/composables/useFlowState.d.ts +0 -125
- package/dist/runtime/app/composables/useFlowState.js +0 -211
- package/dist/runtime/app/composables/useFlowWebSocket.d.ts +0 -27
- package/dist/runtime/app/composables/useFlowWebSocket.js +0 -205
- package/dist/runtime/app/composables/useFlowsNavigation.d.ts +0 -10
- package/dist/runtime/app/composables/useFlowsNavigation.js +0 -58
- package/dist/runtime/app/composables/useQueueJobs.d.ts +0 -20
- package/dist/runtime/app/composables/useQueueJobs.js +0 -20
- package/dist/runtime/app/composables/useQueueUpdates.d.ts +0 -26
- package/dist/runtime/app/composables/useQueueUpdates.js +0 -122
- package/dist/runtime/app/composables/useQueues.d.ts +0 -44
- package/dist/runtime/app/composables/useQueues.js +0 -26
- package/dist/runtime/app/composables/useQueuesLive.d.ts +0 -19
- package/dist/runtime/app/composables/useQueuesLive.js +0 -143
- package/dist/runtime/app/pages/flows/index.d.vue.ts +0 -3
- package/dist/runtime/app/pages/flows/index.vue +0 -645
- package/dist/runtime/app/pages/flows/index.vue.d.ts +0 -3
- package/dist/runtime/app/pages/index.d.vue.ts +0 -3
- package/dist/runtime/app/pages/index.vue +0 -34
- package/dist/runtime/app/pages/index.vue.d.ts +0 -3
- package/dist/runtime/app/pages/queues/index.d.vue.ts +0 -3
- package/dist/runtime/app/pages/queues/index.vue +0 -229
- package/dist/runtime/app/pages/queues/index.vue.d.ts +0 -3
- package/dist/runtime/app/pages/queues/job.d.vue.ts +0 -3
- package/dist/runtime/app/pages/queues/job.vue +0 -262
- package/dist/runtime/app/pages/queues/job.vue.d.ts +0 -3
- package/dist/runtime/app/pages/queues/jobs.d.vue.ts +0 -3
- package/dist/runtime/app/pages/queues/jobs.vue +0 -291
- package/dist/runtime/app/pages/queues/jobs.vue.d.ts +0 -3
- package/dist/runtime/app/plugins/vueflow.client.d.ts +0 -2
- package/dist/runtime/app/plugins/vueflow.client.js +0 -11
- package/dist/runtime/constants.d.ts +0 -11
- package/dist/runtime/constants.js +0 -11
- package/dist/runtime/schema.d.ts +0 -37
- package/dist/runtime/schema.js +0 -20
- package/dist/runtime/server/plugins/00.event-store.d.ts +0 -13
- package/dist/runtime/server/plugins/00.event-store.js +0 -16
- package/dist/runtime/server/plugins/flow-management.d.ts +0 -13
- package/dist/runtime/server/plugins/flow-management.js +0 -65
- package/dist/runtime/server/plugins/queue-management.js +0 -27
- package/dist/runtime/server/plugins/state-cleanup.d.ts +0 -11
- package/dist/runtime/server/plugins/state-cleanup.js +0 -93
- package/dist/runtime/server/plugins/worker-management.js +0 -33
- package/dist/runtime/server/tsconfig.json +0 -3
- package/dist/runtime/server-utils/events/adapters/fileAdapter.d.ts +0 -2
- package/dist/runtime/server-utils/events/adapters/fileAdapter.js +0 -382
- package/dist/runtime/server-utils/events/adapters/memoryAdapter.d.ts +0 -2
- package/dist/runtime/server-utils/events/adapters/memoryAdapter.js +0 -171
- package/dist/runtime/server-utils/events/adapters/redis/redisAdapter.d.ts +0 -2
- package/dist/runtime/server-utils/events/adapters/redis/redisAdapter.js +0 -348
- package/dist/runtime/server-utils/events/adapters/redis/redisPubSubGateway.d.ts +0 -30
- package/dist/runtime/server-utils/events/adapters/redis/redisPubSubGateway.js +0 -82
- package/dist/runtime/server-utils/events/eventStoreFactory.d.ts +0 -19
- package/dist/runtime/server-utils/events/eventStoreFactory.js +0 -44
- package/dist/runtime/server-utils/events/streamNames.d.ts +0 -17
- package/dist/runtime/server-utils/events/streamNames.js +0 -17
- package/dist/runtime/server-utils/events/types.d.ts +0 -63
- package/dist/runtime/server-utils/events/wiring/registry.d.ts +0 -10
- package/dist/runtime/server-utils/events/wiring/registry.js +0 -24
- package/dist/runtime/server-utils/queue/adapters/bullmq.d.ts +0 -18
- package/dist/runtime/server-utils/queue/adapters/bullmq.js +0 -164
- package/dist/runtime/server-utils/queue/queueFactory.d.ts +0 -3
- package/dist/runtime/server-utils/queue/queueFactory.js +0 -10
- package/dist/runtime/server-utils/queue/types.d.ts +0 -47
- package/dist/runtime/server-utils/state/adapters/redis.d.ts +0 -2
- package/dist/runtime/server-utils/state/adapters/redis.js +0 -42
- package/dist/runtime/server-utils/state/stateFactory.d.ts +0 -3
- package/dist/runtime/server-utils/state/stateFactory.js +0 -17
- package/dist/runtime/server-utils/state/types.d.ts +0 -23
- package/dist/runtime/server-utils/utils/defineQueueConfig.js +0 -2
- package/dist/runtime/server-utils/utils/defineQueueWorker.d.ts +0 -10
- package/dist/runtime/server-utils/utils/useEventStore.d.ts +0 -20
- package/dist/runtime/server-utils/utils/useEventStore.js +0 -119
- package/dist/runtime/server-utils/utils/useFlowEngine.d.ts +0 -9
- package/dist/runtime/server-utils/utils/useFlowEngine.js +0 -44
- package/dist/runtime/server-utils/utils/useLogs.d.ts +0 -41
- package/dist/runtime/server-utils/utils/useLogs.js +0 -74
- package/dist/runtime/server-utils/utils/useQueue.d.ts +0 -31
- package/dist/runtime/server-utils/utils/useQueue.js +0 -24
- package/dist/runtime/server-utils/worker/adapter.d.ts +0 -4
- package/dist/runtime/server-utils/worker/adapter.js +0 -66
- package/dist/runtime/types.d.ts +0 -132
- /package/dist/runtime/{server-utils/events/types.js → adapters/interfaces/queue.js} +0 -0
- /package/dist/runtime/{server-utils/queue/types.js → adapters/interfaces/store.js} +0 -0
- /package/dist/runtime/{server-utils/state/types.js → adapters/interfaces/stream.js} +0 -0
- /package/dist/runtime/{server-utils/events → events}/eventBus.d.ts +0 -0
- /package/dist/runtime/{server-utils/events → events}/eventBus.js +0 -0
- /package/dist/runtime/server/{plugins/queue-management.d.ts → api/_flows/[name]/runs/[runId]/cancel.post.d.ts} +0 -0
- /package/dist/runtime/server/plugins/{00.ws-lifecycle.d.ts → 01.ws-lifecycle.d.ts} +0 -0
- /package/dist/runtime/server/plugins/{00.ws-lifecycle.js → 01.ws-lifecycle.js} +0 -0
- /package/dist/runtime/server/plugins/{worker-management.d.ts → 02.workers.d.ts} +0 -0
- /package/dist/runtime/{server-utils/utils → utils}/useEventManager.d.ts +0 -0
- /package/dist/runtime/{server-utils/utils → utils}/useEventManager.js +0 -0
- /package/dist/runtime/{server-utils/utils → utils}/useNventLogger.d.ts +0 -0
- /package/dist/runtime/{server-utils/utils → utils}/wsPeerManager.d.ts +0 -0
- /package/dist/runtime/{server-utils/utils → utils}/wsPeerManager.js +0 -0
- /package/dist/runtime/{python → worker/python}/get_config.py +0 -0
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
computed,
|
|
3
|
-
inject,
|
|
4
|
-
provide,
|
|
5
|
-
shallowRef,
|
|
6
|
-
useRoute,
|
|
7
|
-
useRouter,
|
|
8
|
-
watch,
|
|
9
|
-
defineAsyncComponent
|
|
10
|
-
} from "#imports";
|
|
11
|
-
export function useComponentRouter(opts) {
|
|
12
|
-
const CTX_KEY = "component-router";
|
|
13
|
-
if (!opts || !("routes" in opts) || !opts.routes) {
|
|
14
|
-
const key = opts?.provideKey ?? CTX_KEY;
|
|
15
|
-
const ctx = inject(key, null);
|
|
16
|
-
if (!ctx) {
|
|
17
|
-
console.warn(
|
|
18
|
-
"[useComponentRouter] No parent router context found. Ensure a parent uses useComponentRouter with routes or wrap children in <component-router>."
|
|
19
|
-
);
|
|
20
|
-
const emptyRoute = shallowRef({ path: "", params: {}, query: {} });
|
|
21
|
-
const warnNav = async (_p) => console.warn(
|
|
22
|
-
"[useComponentRouter] push/replace called without a parent router context."
|
|
23
|
-
);
|
|
24
|
-
const noopMake = (p, _params) => p;
|
|
25
|
-
const noopHref = (p, _params) => p;
|
|
26
|
-
return {
|
|
27
|
-
route: emptyRoute,
|
|
28
|
-
push: warnNav,
|
|
29
|
-
replace: warnNav,
|
|
30
|
-
makePath: noopMake,
|
|
31
|
-
makeHref: noopHref,
|
|
32
|
-
pushTo: async (p, _params) => warnNav(p),
|
|
33
|
-
replaceTo: async (p, _params) => warnNav(p),
|
|
34
|
-
component: void 0
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
return ctx;
|
|
38
|
-
}
|
|
39
|
-
const props = {
|
|
40
|
-
routes: Array.isArray(opts.routes) ? opts.routes : Object.entries(opts.routes || {}).map(([path, component2]) => ({
|
|
41
|
-
path,
|
|
42
|
-
component: component2
|
|
43
|
-
})),
|
|
44
|
-
base: opts.base ?? "fp",
|
|
45
|
-
mode: opts.mode ?? "query",
|
|
46
|
-
initial: opts.initial,
|
|
47
|
-
provideKey: opts.provideKey ?? CTX_KEY,
|
|
48
|
-
debug: opts.debug === true
|
|
49
|
-
};
|
|
50
|
-
const nuxtRoute = useRoute();
|
|
51
|
-
const nuxtRouter = useRouter();
|
|
52
|
-
const component = shallowRef(null);
|
|
53
|
-
const route = shallowRef({
|
|
54
|
-
path: "",
|
|
55
|
-
params: {},
|
|
56
|
-
query: {}
|
|
57
|
-
});
|
|
58
|
-
const dbg = (...args) => {
|
|
59
|
-
if (props.debug) console.info("[component-router]", ...args);
|
|
60
|
-
};
|
|
61
|
-
function esc(text) {
|
|
62
|
-
return text.replace(/([.+*?=^!${}()[\]|\\])/g, "\\$1");
|
|
63
|
-
}
|
|
64
|
-
function compilePattern(path) {
|
|
65
|
-
const keys = [];
|
|
66
|
-
const dyn = /\/:([^/]+)/g;
|
|
67
|
-
let last = 0;
|
|
68
|
-
let pattern = "";
|
|
69
|
-
let m;
|
|
70
|
-
while (m = dyn.exec(path)) {
|
|
71
|
-
pattern += esc(path.slice(last, m.index));
|
|
72
|
-
keys.push(m[1]);
|
|
73
|
-
pattern += "/([^/]+)";
|
|
74
|
-
last = m.index + m[0].length;
|
|
75
|
-
}
|
|
76
|
-
pattern += esc(path.slice(last));
|
|
77
|
-
const regex = new RegExp("^" + pattern + "$");
|
|
78
|
-
dbg("compiled", { path, pattern, regex, keys });
|
|
79
|
-
return { regex, keys };
|
|
80
|
-
}
|
|
81
|
-
const records = computed(
|
|
82
|
-
() => props.routes.map((r) => {
|
|
83
|
-
const { regex, keys } = compilePattern(r.path);
|
|
84
|
-
return { ...r, regex, keys };
|
|
85
|
-
})
|
|
86
|
-
);
|
|
87
|
-
function matchPath(path) {
|
|
88
|
-
dbg("matchPath", path);
|
|
89
|
-
for (const r of records.value) {
|
|
90
|
-
const m = r.regex.exec(path);
|
|
91
|
-
dbg(" try", r.path, r.regex, !!m);
|
|
92
|
-
if (m) {
|
|
93
|
-
const params = {};
|
|
94
|
-
r.keys.forEach(
|
|
95
|
-
(k, i) => params[k] = decodeURIComponent(m[i + 1] || "")
|
|
96
|
-
);
|
|
97
|
-
return { record: r, params };
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
function setCurrent(path) {
|
|
103
|
-
dbg("setCurrent", path);
|
|
104
|
-
const m = matchPath(path) || matchPath(props.routes[0]?.path || "/");
|
|
105
|
-
if (!m) return;
|
|
106
|
-
component.value = m.record.component;
|
|
107
|
-
const [pathOnly, queryString] = path.split("?");
|
|
108
|
-
const queryParams = {};
|
|
109
|
-
if (queryString) {
|
|
110
|
-
const params = new URLSearchParams(queryString);
|
|
111
|
-
params.forEach((value, key) => {
|
|
112
|
-
queryParams[key] = value;
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
route.value = {
|
|
116
|
-
path: pathOnly || path,
|
|
117
|
-
params: m.params,
|
|
118
|
-
query: queryParams
|
|
119
|
-
// Only use query params from the current path, not from nuxtRoute
|
|
120
|
-
};
|
|
121
|
-
dbg("current", route.value);
|
|
122
|
-
}
|
|
123
|
-
function readFromHost() {
|
|
124
|
-
if (props.mode === "query") {
|
|
125
|
-
const p = nuxtRoute.query?.[props.base];
|
|
126
|
-
dbg("readFromHost(query)", p);
|
|
127
|
-
return typeof p === "string" ? p : null;
|
|
128
|
-
}
|
|
129
|
-
if (props.mode === "hash") {
|
|
130
|
-
const h = (typeof window !== "undefined" ? window.location.hash : "") || "";
|
|
131
|
-
const key = `#${props.base}=`;
|
|
132
|
-
const idx = h.indexOf(key);
|
|
133
|
-
dbg("readFromHost(hash)", h);
|
|
134
|
-
return idx >= 0 ? h.slice(idx + key.length) : null;
|
|
135
|
-
}
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
async function writeToHost(path, replace2 = false) {
|
|
139
|
-
dbg("writeToHost", path, { replace: replace2, mode: props.mode });
|
|
140
|
-
if (props.mode === "query") {
|
|
141
|
-
const [pathOnly, queryString] = path.split("?");
|
|
142
|
-
const pathQuery = {};
|
|
143
|
-
if (queryString) {
|
|
144
|
-
const params = new URLSearchParams(queryString);
|
|
145
|
-
params.forEach((value, key) => {
|
|
146
|
-
pathQuery[key] = value;
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
const nextQuery = { [props.base]: pathOnly, ...pathQuery };
|
|
150
|
-
if (nuxtRoute.query?.[props.base] === pathOnly && !queryString) {
|
|
151
|
-
setCurrent(path);
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
await (replace2 ? nuxtRouter.replace({ query: nextQuery }) : nuxtRouter.push({ query: nextQuery }));
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
if (props.mode === "hash" && typeof window !== "undefined") {
|
|
158
|
-
const key = `#${props.base}=`;
|
|
159
|
-
const nextHash = key + path;
|
|
160
|
-
if (window.location.hash !== nextHash) {
|
|
161
|
-
if (replace2) {
|
|
162
|
-
const url = window.location.href.replace(/#.*/, "") + nextHash;
|
|
163
|
-
window.history.replaceState(null, "", url);
|
|
164
|
-
} else {
|
|
165
|
-
window.location.hash = nextHash;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
setCurrent(path);
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
setCurrent(path);
|
|
172
|
-
}
|
|
173
|
-
async function push(path) {
|
|
174
|
-
await writeToHost(path, false);
|
|
175
|
-
}
|
|
176
|
-
async function replace(path) {
|
|
177
|
-
await writeToHost(path, true);
|
|
178
|
-
}
|
|
179
|
-
function makePath(patternOrPath, params) {
|
|
180
|
-
const hasDyn = /:[^/]+/.test(patternOrPath);
|
|
181
|
-
if (!hasDyn) return patternOrPath;
|
|
182
|
-
const replaced = patternOrPath.replace(/:([^/]+)/g, (_m, key) => {
|
|
183
|
-
const v = params?.[key];
|
|
184
|
-
return encodeURIComponent(v == null ? "" : String(v));
|
|
185
|
-
});
|
|
186
|
-
return replaced.replace(/\/{2,}/g, "/");
|
|
187
|
-
}
|
|
188
|
-
function makeHref(patternOrPath, params) {
|
|
189
|
-
const path = makePath(patternOrPath, params);
|
|
190
|
-
if (props.mode === "query") return `?${props.base}=${path}`;
|
|
191
|
-
if (props.mode === "hash") return `#${props.base}=${path}`;
|
|
192
|
-
return path;
|
|
193
|
-
}
|
|
194
|
-
async function pushTo(patternOrPath, params) {
|
|
195
|
-
const path = makePath(patternOrPath, params);
|
|
196
|
-
await push(path);
|
|
197
|
-
}
|
|
198
|
-
async function replaceTo(patternOrPath, params) {
|
|
199
|
-
const path = makePath(patternOrPath, params);
|
|
200
|
-
await replace(path);
|
|
201
|
-
}
|
|
202
|
-
const exposed = { push, replace, route, makePath, makeHref, pushTo, replaceTo };
|
|
203
|
-
provide(props.provideKey, exposed);
|
|
204
|
-
const initialPath = readFromHost() || props.initial || props.routes[0]?.path || "/";
|
|
205
|
-
dbg("init", { initialPath });
|
|
206
|
-
writeToHost(initialPath, true);
|
|
207
|
-
watch(
|
|
208
|
-
() => ({
|
|
209
|
-
q: nuxtRoute.query?.[props.base],
|
|
210
|
-
h: typeof window !== "undefined" ? window.location.hash : ""
|
|
211
|
-
}),
|
|
212
|
-
() => {
|
|
213
|
-
const path = readFromHost();
|
|
214
|
-
dbg("watch change detected ->", path);
|
|
215
|
-
if (path) setCurrent(path);
|
|
216
|
-
}
|
|
217
|
-
);
|
|
218
|
-
return { component, route, push, replace, makePath, makeHref, pushTo, replaceTo };
|
|
219
|
-
}
|
|
220
|
-
export default useComponentRouter;
|
|
221
|
-
export function createComponentRoutes(glob, options) {
|
|
222
|
-
const base = options?.base || "";
|
|
223
|
-
const toPath = (key) => {
|
|
224
|
-
let p = key.replace(/^\.\//, "/").replace(/\.(vue|tsx?|jsx?)$/, "");
|
|
225
|
-
p = p.replace(/\/index$/, "");
|
|
226
|
-
p = p.replace(/\[(.+?)\]/g, ":$1");
|
|
227
|
-
if (!p.startsWith("/")) p = "/" + p;
|
|
228
|
-
if (base) {
|
|
229
|
-
const b = base.startsWith("/") ? base : "/" + base;
|
|
230
|
-
p = (b + (p === "/" ? "" : p)).replace(/\/+/, "/");
|
|
231
|
-
}
|
|
232
|
-
return p || "/";
|
|
233
|
-
};
|
|
234
|
-
return Object.entries(glob).map(([key, loader]) => ({
|
|
235
|
-
path: toPath(key),
|
|
236
|
-
component: defineAsyncComponent(
|
|
237
|
-
() => loader().then((m) => m.default || m)
|
|
238
|
-
)
|
|
239
|
-
}));
|
|
240
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Composable for managing a single flow run's timeline and state
|
|
3
|
-
*
|
|
4
|
-
* Simple approach: No HMR persistence, rely on component lifecycle + URL state
|
|
5
|
-
* - URL preserves flowId/runId across HMR
|
|
6
|
-
* - Component remounts after HMR with correct state
|
|
7
|
-
* - Fresh WebSocket connection on each mount = clean, predictable behavior
|
|
8
|
-
*/
|
|
9
|
-
export declare function useFlowRunTimeline(flowId: Ref<string>, runId: Ref<string>): {
|
|
10
|
-
flowState: any;
|
|
11
|
-
isConnected: any;
|
|
12
|
-
isReconnecting: any;
|
|
13
|
-
loadRun: () => Promise<void>;
|
|
14
|
-
stopStream: () => void;
|
|
15
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { useFlowWebSocket } from "./useFlowWebSocket.js";
|
|
2
|
-
export function useFlowRunTimeline(flowId, runId) {
|
|
3
|
-
const flowState = useFlowState();
|
|
4
|
-
const flowWs = useFlowWebSocket();
|
|
5
|
-
const startStream = () => {
|
|
6
|
-
if (import.meta.server) return;
|
|
7
|
-
if (!flowId.value || !runId.value) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
flowWs.subscribe({
|
|
11
|
-
flowName: flowId.value,
|
|
12
|
-
runId: runId.value,
|
|
13
|
-
onEvent: (eventData) => {
|
|
14
|
-
if (eventData?.record) {
|
|
15
|
-
flowState.addEvent(eventData.record);
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
onHistory: (events) => {
|
|
19
|
-
for (const eventData of events) {
|
|
20
|
-
if (eventData?.record) {
|
|
21
|
-
flowState.addEvent(eventData.record);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}, {
|
|
26
|
-
autoReconnect: true,
|
|
27
|
-
maxRetries: 5,
|
|
28
|
-
baseDelayMs: 500,
|
|
29
|
-
maxDelayMs: 5e3,
|
|
30
|
-
onError: (err) => {
|
|
31
|
-
console.warn("[FlowRunTimeline] WebSocket error:", err);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
const stopStream = () => {
|
|
36
|
-
if (import.meta.server) return;
|
|
37
|
-
flowWs.stop();
|
|
38
|
-
};
|
|
39
|
-
const loadRun = async () => {
|
|
40
|
-
if (!runId.value) return;
|
|
41
|
-
flowState.reset();
|
|
42
|
-
await nextTick();
|
|
43
|
-
startStream();
|
|
44
|
-
};
|
|
45
|
-
watch(runId, async (newRunId, oldRunId) => {
|
|
46
|
-
if (oldRunId && oldRunId !== newRunId) {
|
|
47
|
-
stopStream();
|
|
48
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
49
|
-
}
|
|
50
|
-
if (newRunId) {
|
|
51
|
-
await loadRun();
|
|
52
|
-
} else {
|
|
53
|
-
stopStream();
|
|
54
|
-
}
|
|
55
|
-
}, { immediate: true });
|
|
56
|
-
onBeforeUnmount(() => {
|
|
57
|
-
stopStream();
|
|
58
|
-
});
|
|
59
|
-
return {
|
|
60
|
-
flowState,
|
|
61
|
-
isConnected: computed(() => flowWs.connected.value),
|
|
62
|
-
isReconnecting: computed(() => flowWs.reconnecting.value),
|
|
63
|
-
loadRun,
|
|
64
|
-
stopStream
|
|
65
|
-
};
|
|
66
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type Ref } from '#imports';
|
|
2
|
-
import type { FetchError } from 'ofetch';
|
|
3
|
-
interface FlowRun {
|
|
4
|
-
id: string;
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Composable for fetching and managing flow runs
|
|
9
|
-
* Simple approach: Fresh fetch on every refresh, no stale cache
|
|
10
|
-
* Client-only to avoid hydration mismatches
|
|
11
|
-
*/
|
|
12
|
-
export declare function useFlowRuns(flowId: Ref<string>): {
|
|
13
|
-
runs: globalThis.Ref<FlowRun[] | null | undefined>;
|
|
14
|
-
refresh: () => Promise<void>;
|
|
15
|
-
status: globalThis.Ref<'idle' | 'pending' | 'success' | 'error'>;
|
|
16
|
-
error: globalThis.Ref<FetchError | null | undefined>;
|
|
17
|
-
};
|
|
18
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ref, watch, useFetch } from "#imports";
|
|
2
|
-
export function useFlowRuns(flowId) {
|
|
3
|
-
const refreshCounter = ref(0);
|
|
4
|
-
const { data: runs, refresh: _refresh, status, error } = useFetch(
|
|
5
|
-
() => `/api/_flows/${encodeURIComponent(flowId.value)}/runs?_t=${refreshCounter.value}`,
|
|
6
|
-
{
|
|
7
|
-
immediate: false,
|
|
8
|
-
watch: false,
|
|
9
|
-
// Disable automatic watch to prevent SSR execution
|
|
10
|
-
server: false
|
|
11
|
-
// Client-only to avoid hydration issues
|
|
12
|
-
// Don't use a key - this prevents Nuxt from caching across calls
|
|
13
|
-
}
|
|
14
|
-
);
|
|
15
|
-
const refresh = async () => {
|
|
16
|
-
refreshCounter.value++;
|
|
17
|
-
await _refresh();
|
|
18
|
-
};
|
|
19
|
-
watch(flowId, (newFlow, oldFlow) => {
|
|
20
|
-
if (import.meta.client && newFlow) {
|
|
21
|
-
if (newFlow !== oldFlow || !runs.value) {
|
|
22
|
-
refresh();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}, { immediate: true });
|
|
26
|
-
return {
|
|
27
|
-
runs,
|
|
28
|
-
refresh,
|
|
29
|
-
status,
|
|
30
|
-
error
|
|
31
|
-
};
|
|
32
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type Ref } from '#imports';
|
|
2
|
-
/**
|
|
3
|
-
* Composable for infinite scroll flow runs with pagination
|
|
4
|
-
*/
|
|
5
|
-
export declare function useFlowRunsInfinite(flowId: Ref<string>): {
|
|
6
|
-
items: import("vue").ComputedRef<{
|
|
7
|
-
id: string;
|
|
8
|
-
flowName: string;
|
|
9
|
-
status: "running" | "completed" | "failed" | "unknown";
|
|
10
|
-
createdAt: string;
|
|
11
|
-
startedAt?: string | undefined;
|
|
12
|
-
completedAt?: string | undefined;
|
|
13
|
-
stepCount: number;
|
|
14
|
-
completedSteps: number;
|
|
15
|
-
}[]>;
|
|
16
|
-
total: import("vue").ComputedRef<number>;
|
|
17
|
-
loading: import("vue").ComputedRef<boolean>;
|
|
18
|
-
hasMore: import("vue").ComputedRef<boolean>;
|
|
19
|
-
error: import("vue").ComputedRef<Error | null>;
|
|
20
|
-
loadMore: () => void;
|
|
21
|
-
refresh: () => Promise<void>;
|
|
22
|
-
checkForNewRuns: () => Promise<void>;
|
|
23
|
-
reset: () => void;
|
|
24
|
-
};
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { ref, computed, watch } from "#imports";
|
|
2
|
-
export function useFlowRunsInfinite(flowId) {
|
|
3
|
-
const items = ref([]);
|
|
4
|
-
const total = ref(0);
|
|
5
|
-
const offset = ref(0);
|
|
6
|
-
const limit = 50;
|
|
7
|
-
const loading = ref(false);
|
|
8
|
-
const hasMore = ref(true);
|
|
9
|
-
const error = ref(null);
|
|
10
|
-
const newestRunId = ref(null);
|
|
11
|
-
const reset = () => {
|
|
12
|
-
items.value = [];
|
|
13
|
-
total.value = 0;
|
|
14
|
-
offset.value = 0;
|
|
15
|
-
hasMore.value = true;
|
|
16
|
-
error.value = null;
|
|
17
|
-
newestRunId.value = null;
|
|
18
|
-
};
|
|
19
|
-
const fetchPage = async (resetData = false) => {
|
|
20
|
-
if (!flowId.value || loading.value) return;
|
|
21
|
-
if (resetData) {
|
|
22
|
-
reset();
|
|
23
|
-
}
|
|
24
|
-
if (!hasMore.value && !resetData) return;
|
|
25
|
-
try {
|
|
26
|
-
loading.value = true;
|
|
27
|
-
error.value = null;
|
|
28
|
-
const response = await $fetch(
|
|
29
|
-
`/api/_flows/${encodeURIComponent(flowId.value)}/runs`,
|
|
30
|
-
{
|
|
31
|
-
query: {
|
|
32
|
-
limit,
|
|
33
|
-
offset: resetData ? 0 : offset.value,
|
|
34
|
-
_t: Date.now()
|
|
35
|
-
// Cache busting
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
if (resetData) {
|
|
40
|
-
items.value = response.items;
|
|
41
|
-
offset.value = response.items.length;
|
|
42
|
-
if (response.items.length > 0) {
|
|
43
|
-
newestRunId.value = response.items[0].id;
|
|
44
|
-
}
|
|
45
|
-
} else {
|
|
46
|
-
items.value.push(...response.items);
|
|
47
|
-
offset.value += response.items.length;
|
|
48
|
-
}
|
|
49
|
-
total.value = response.total;
|
|
50
|
-
hasMore.value = response.hasMore;
|
|
51
|
-
} catch (err) {
|
|
52
|
-
console.error("[useFlowRunsInfinite] fetch error:", err);
|
|
53
|
-
error.value = err instanceof Error ? err : new Error(String(err));
|
|
54
|
-
} finally {
|
|
55
|
-
loading.value = false;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
const loadMore = () => {
|
|
59
|
-
if (!loading.value && hasMore.value) {
|
|
60
|
-
fetchPage(false);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
const refresh = async () => {
|
|
64
|
-
await fetchPage(true);
|
|
65
|
-
};
|
|
66
|
-
const checkForNewRuns = async () => {
|
|
67
|
-
if (!flowId.value || loading.value) return;
|
|
68
|
-
try {
|
|
69
|
-
const response = await $fetch(
|
|
70
|
-
`/api/_flows/${encodeURIComponent(flowId.value)}/runs`,
|
|
71
|
-
{
|
|
72
|
-
query: {
|
|
73
|
-
limit: Math.max(items.value.length, 10),
|
|
74
|
-
// Fetch at least as many as we have loaded
|
|
75
|
-
offset: 0,
|
|
76
|
-
_t: Date.now()
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
if (response.items.length === 0) return;
|
|
81
|
-
const latestRunId = response.items[0].id;
|
|
82
|
-
const updatedItems = [...items.value];
|
|
83
|
-
const newRuns = [];
|
|
84
|
-
for (const freshRun of response.items) {
|
|
85
|
-
const existingIndex = updatedItems.findIndex((r) => r.id === freshRun.id);
|
|
86
|
-
if (existingIndex >= 0) {
|
|
87
|
-
updatedItems[existingIndex] = freshRun;
|
|
88
|
-
} else {
|
|
89
|
-
newRuns.push(freshRun);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
if (newRuns.length > 0) {
|
|
93
|
-
items.value = [...newRuns, ...updatedItems];
|
|
94
|
-
newestRunId.value = latestRunId;
|
|
95
|
-
} else {
|
|
96
|
-
items.value = updatedItems;
|
|
97
|
-
}
|
|
98
|
-
total.value = response.total;
|
|
99
|
-
if (!newestRunId.value) {
|
|
100
|
-
newestRunId.value = latestRunId;
|
|
101
|
-
}
|
|
102
|
-
} catch (err) {
|
|
103
|
-
console.error("[useFlowRunsInfinite] checkForNewRuns error:", err);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
watch(flowId, (newFlow, oldFlow) => {
|
|
107
|
-
if (import.meta.client && newFlow && newFlow !== oldFlow) {
|
|
108
|
-
refresh();
|
|
109
|
-
}
|
|
110
|
-
}, { immediate: true });
|
|
111
|
-
return {
|
|
112
|
-
items: computed(() => items.value),
|
|
113
|
-
total: computed(() => total.value),
|
|
114
|
-
loading: computed(() => loading.value),
|
|
115
|
-
hasMore: computed(() => hasMore.value),
|
|
116
|
-
error: computed(() => error.value),
|
|
117
|
-
loadMore,
|
|
118
|
-
refresh,
|
|
119
|
-
checkForNewRuns,
|
|
120
|
-
// For polling - prepends new runs without resetting
|
|
121
|
-
reset
|
|
122
|
-
};
|
|
123
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type Ref } from '#imports';
|
|
2
|
-
/**
|
|
3
|
-
* Composable for auto-polling flow runs list
|
|
4
|
-
* Polls continuously to keep the list fresh
|
|
5
|
-
*/
|
|
6
|
-
export declare function useFlowRunsPolling(refresh: () => Promise<void>, shouldPoll: Ref<boolean>, intervalMs?: number): {
|
|
7
|
-
pause: () => void;
|
|
8
|
-
resume: () => void;
|
|
9
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { watch, onBeforeUnmount } from "#imports";
|
|
2
|
-
export function useFlowRunsPolling(refresh, shouldPoll, intervalMs = 3e3) {
|
|
3
|
-
let intervalId = null;
|
|
4
|
-
const pause = () => {
|
|
5
|
-
if (intervalId) {
|
|
6
|
-
clearInterval(intervalId);
|
|
7
|
-
intervalId = null;
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
const resume = () => {
|
|
11
|
-
if (!intervalId) {
|
|
12
|
-
intervalId = setInterval(async () => {
|
|
13
|
-
if (shouldPoll.value) {
|
|
14
|
-
await refresh();
|
|
15
|
-
}
|
|
16
|
-
}, intervalMs);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
watch(shouldPoll, (should) => {
|
|
20
|
-
if (should) {
|
|
21
|
-
resume();
|
|
22
|
-
} else {
|
|
23
|
-
pause();
|
|
24
|
-
}
|
|
25
|
-
}, { immediate: true });
|
|
26
|
-
onBeforeUnmount(() => {
|
|
27
|
-
pause();
|
|
28
|
-
});
|
|
29
|
-
return {
|
|
30
|
-
pause,
|
|
31
|
-
resume
|
|
32
|
-
};
|
|
33
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { type Ref } from '#imports';
|
|
2
|
-
/**
|
|
3
|
-
* Client-Side Flow State Reducer
|
|
4
|
-
*
|
|
5
|
-
* Reduces an array of events from the flow timeline into current state.
|
|
6
|
-
*/
|
|
7
|
-
export interface FlowState {
|
|
8
|
-
status: 'running' | 'completed' | 'failed';
|
|
9
|
-
startedAt?: string;
|
|
10
|
-
completedAt?: string;
|
|
11
|
-
steps: Record<string, StepState>;
|
|
12
|
-
logs: LogEntry[];
|
|
13
|
-
meta?: Record<string, any>;
|
|
14
|
-
}
|
|
15
|
-
export interface StepState {
|
|
16
|
-
status: 'pending' | 'running' | 'completed' | 'failed' | 'retrying' | 'waiting' | 'timeout';
|
|
17
|
-
attempt: number;
|
|
18
|
-
startedAt?: string;
|
|
19
|
-
completedAt?: string;
|
|
20
|
-
error?: string;
|
|
21
|
-
awaitType?: 'time' | 'event' | 'trigger';
|
|
22
|
-
awaitData?: any;
|
|
23
|
-
result?: any;
|
|
24
|
-
}
|
|
25
|
-
export interface LogEntry {
|
|
26
|
-
ts: string;
|
|
27
|
-
step?: string;
|
|
28
|
-
level: string;
|
|
29
|
-
msg: string;
|
|
30
|
-
data?: any;
|
|
31
|
-
}
|
|
32
|
-
export interface EventRecord {
|
|
33
|
-
id: string;
|
|
34
|
-
ts: string;
|
|
35
|
-
type: string;
|
|
36
|
-
runId: string;
|
|
37
|
-
flowName?: string;
|
|
38
|
-
stepName?: string;
|
|
39
|
-
stepId?: string;
|
|
40
|
-
attempt?: number;
|
|
41
|
-
data?: any;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Reduce an array of events into current flow state
|
|
45
|
-
*/
|
|
46
|
-
export declare function reduceFlowState(events: EventRecord[]): FlowState;
|
|
47
|
-
/**
|
|
48
|
-
* Composable for managing flow state from event stream
|
|
49
|
-
*
|
|
50
|
-
* Usage:
|
|
51
|
-
* ```typescript
|
|
52
|
-
* const { state, events, addEvent, addEvents, reset } = useFlowState()
|
|
53
|
-
*
|
|
54
|
-
* // Add events as they arrive
|
|
55
|
-
* addEvent(newEvent)
|
|
56
|
-
*
|
|
57
|
-
* // Access computed state
|
|
58
|
-
* console.log(state.value.status) // 'running' | 'completed' | 'failed'
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
export declare function useFlowState(initialEvents?: EventRecord[]): {
|
|
62
|
-
events: Ref<EventRecord[], EventRecord[]>;
|
|
63
|
-
state: import("vue").ComputedRef<FlowState>;
|
|
64
|
-
addEvent: (event: EventRecord) => void;
|
|
65
|
-
addEvents: (newEvents: EventRecord[]) => void;
|
|
66
|
-
reset: (newEvents?: EventRecord[]) => void;
|
|
67
|
-
isRunning: import("vue").ComputedRef<boolean>;
|
|
68
|
-
isCompleted: import("vue").ComputedRef<boolean>;
|
|
69
|
-
isFailed: import("vue").ComputedRef<boolean>;
|
|
70
|
-
stepList: import("vue").ComputedRef<{
|
|
71
|
-
status: "pending" | "running" | "completed" | "failed" | "retrying" | "waiting" | "timeout";
|
|
72
|
-
attempt: number;
|
|
73
|
-
startedAt?: string;
|
|
74
|
-
completedAt?: string;
|
|
75
|
-
error?: string;
|
|
76
|
-
awaitType?: "time" | "event" | "trigger";
|
|
77
|
-
awaitData?: any;
|
|
78
|
-
result?: any;
|
|
79
|
-
key: string;
|
|
80
|
-
}[]>;
|
|
81
|
-
runningSteps: import("vue").ComputedRef<{
|
|
82
|
-
status: "pending" | "running" | "completed" | "failed" | "retrying" | "waiting" | "timeout";
|
|
83
|
-
attempt: number;
|
|
84
|
-
startedAt?: string;
|
|
85
|
-
completedAt?: string;
|
|
86
|
-
error?: string;
|
|
87
|
-
awaitType?: "time" | "event" | "trigger";
|
|
88
|
-
awaitData?: any;
|
|
89
|
-
result?: any;
|
|
90
|
-
key: string;
|
|
91
|
-
}[]>;
|
|
92
|
-
waitingSteps: import("vue").ComputedRef<{
|
|
93
|
-
status: "pending" | "running" | "completed" | "failed" | "retrying" | "waiting" | "timeout";
|
|
94
|
-
attempt: number;
|
|
95
|
-
startedAt?: string;
|
|
96
|
-
completedAt?: string;
|
|
97
|
-
error?: string;
|
|
98
|
-
awaitType?: "time" | "event" | "trigger";
|
|
99
|
-
awaitData?: any;
|
|
100
|
-
result?: any;
|
|
101
|
-
key: string;
|
|
102
|
-
}[]>;
|
|
103
|
-
failedSteps: import("vue").ComputedRef<{
|
|
104
|
-
status: "pending" | "running" | "completed" | "failed" | "retrying" | "waiting" | "timeout";
|
|
105
|
-
attempt: number;
|
|
106
|
-
startedAt?: string;
|
|
107
|
-
completedAt?: string;
|
|
108
|
-
error?: string;
|
|
109
|
-
awaitType?: "time" | "event" | "trigger";
|
|
110
|
-
awaitData?: any;
|
|
111
|
-
result?: any;
|
|
112
|
-
key: string;
|
|
113
|
-
}[]>;
|
|
114
|
-
completedSteps: import("vue").ComputedRef<{
|
|
115
|
-
status: "pending" | "running" | "completed" | "failed" | "retrying" | "waiting" | "timeout";
|
|
116
|
-
attempt: number;
|
|
117
|
-
startedAt?: string;
|
|
118
|
-
completedAt?: string;
|
|
119
|
-
error?: string;
|
|
120
|
-
awaitType?: "time" | "event" | "trigger";
|
|
121
|
-
awaitData?: any;
|
|
122
|
-
result?: any;
|
|
123
|
-
key: string;
|
|
124
|
-
}[]>;
|
|
125
|
-
};
|