@burdenoff/fluidgrids-fe-sdk 2026.1111.14 → 2026.1111.15
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/README.md +41 -0
- package/dist/{ExecutionDetailPage-itor_whl.js → ExecutionDetailPage-DO38vZ_F.js} +4 -4
- package/dist/{FluidGridsProvider-B30VcLdX.js → FluidGridsProvider-B9RR_CI_.js} +2 -309
- package/dist/{HistoryPage-DueEld8g.js → HistoryPage-CA42pU85.js} +1 -1
- package/dist/{InsightsPage-DQ7KCR9h.js → InsightsPage-CBoN_Mj9.js} +2 -2
- package/dist/{ManagedAiPolicyAuthority-C0YPTJMS.js → ManagedAiPolicyAuthority-CKihmbJE.js} +2 -2
- package/dist/{MissingNodesInstallModal-Cj31oMDX.js → MissingNodesInstallModal-Dm0nMBXM.js} +1 -1
- package/dist/{TemplateConfigurationModal-BAPCG8y-.js → TemplateConfigurationModal-Bs_V-E4u.js} +1 -1
- package/dist/{TemplateDetailPanel-CZ1uxEQL.js → TemplateDetailPanel-MlT39VLG.js} +1 -1
- package/dist/{TemplatesPage-DWdgZnIH.js → TemplatesPage-CHVpWBuw.js} +5 -4
- package/dist/{WorkflowSearchRedirect-C8vhSZK9.js → WorkflowSearchRedirect-3gyHcYY2.js} +13 -9
- package/dist/{WorkflowShareDialog-DnBQA3V6.js → WorkflowShareDialog-0Ai1HED-.js} +2 -1
- package/dist/{WorkflowsList-74jjJFsJ.js → WorkflowsList-CJ3KmMHX.js} +5 -4
- package/dist/agent-tools.d.ts +3 -0
- package/dist/agent-tools.js +5 -0
- package/dist/{agentTools-D5AW7zHn.js → agentTools-B1IK1JEO.js} +2 -2
- package/dist/{canvasNoteTools-BqQTTCll.js → canvasNoteTools-eewVHVuy.js} +3 -2
- package/dist/executions.js +1 -1
- package/dist/{flow-builder-BR8p5tXG.js → flow-builder-C_3sY3pZ.js} +12 -157
- package/dist/fluidgridsEvents-CNdcrUNN.js +310 -0
- package/dist/history.js +1 -1
- package/dist/index-CHeY7_A1.d.ts +105 -0
- package/dist/{index-CLqh2u28.d.ts → index-DRf25-D3.d.ts} +7 -105
- package/dist/index.d.ts +3 -2
- package/dist/index.js +21 -946
- package/dist/marksStore-DGCXjTmZ.js +151 -0
- package/dist/{node-detail-view-Dnhqdn8C.js → node-detail-view-CAws5qjg.js} +3 -3
- package/dist/observability.d.ts +1 -1
- package/dist/observability.js +1 -1
- package/dist/{quick-config-panel-C4tSpCrt.js → quick-config-panel-DOzNkSVV.js} +2 -2
- package/dist/settings.js +1 -1
- package/dist/templates.js +1 -1
- package/dist/uiMarkTools-nlmzsHQM.js +937 -0
- package/dist/{useExecutions-CNEN1ENQ.js → useExecutions-DkS0FTfw.js} +2 -1
- package/dist/{useObservability-CmFFXmKb.js → useObservability-BkxhHZsX.js} +2 -1
- package/dist/{useRunHistory-DhU_mrzF.js → useRunHistory-DHehG09Z.js} +1 -1
- package/dist/{useWorkflows-D01LC39Y.js → useWorkflows-DyhtoVwp.js} +25 -5
- package/dist/workflow-builder.js +2 -2
- package/dist/workflow-route.d.ts +33 -0
- package/dist/workflow-route.js +4 -0
- package/dist/workflowRouteData-BkfVOc-O.js +169 -0
- package/dist/workflows-list.js +1 -1
- package/package.json +9 -1
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { Jn as TriggerWorkflowDocument, Kn as TerminateExecutionDocument, Li as emitFluidGridsEvent, Oi as getFluidGridsClient, Ri as emitOperationErrorEvent, Rt as PauseExecutionDocument, Ui as throwIfResultError, aa as useExecutionsStore, cn as ResumeExecutionDocument, ln as RetryNodeDocument, lt as ExecutionStatsDocument, st as ExecutionDetailDocument, ut as ExecutionsListDocument, y as CancelExecutionDocument } from "./node-endpoint-configs-DHFGA5MQ.js";
|
|
3
3
|
import { hD as RunGroupBy, yP as VersioningBehavior } from "./graphql-types-XcDLtFwU.js";
|
|
4
4
|
import { c as REPLAY_WORKFLOW_RUN, l as RETRY_WORKFLOW_RUNS } from "./operations-HU-xb78H.js";
|
|
5
|
-
import {
|
|
5
|
+
import { fn as useFluidGridsAnalytics, pn as openRunQuotaUpgradePrompt } from "./FluidGridsProvider-B9RR_CI_.js";
|
|
6
|
+
import { i as emitRunStarted } from "./fluidgridsEvents-CNdcrUNN.js";
|
|
6
7
|
import { r as useTr } from "./TranslationBridge-Da-TPgQm.js";
|
|
7
8
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
8
9
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Bi as describeOperationError, Li as emitFluidGridsEvent, Oi as getFluidGridsClient, Ui as throwIfResultError } from "./node-endpoint-configs-DHFGA5MQ.js";
|
|
3
|
-
import {
|
|
3
|
+
import { fn as useFluidGridsAnalytics, pn as openRunQuotaUpgradePrompt } from "./FluidGridsProvider-B9RR_CI_.js";
|
|
4
4
|
import { r as useTr } from "./TranslationBridge-Da-TPgQm.js";
|
|
5
|
+
import { i as emitRunStarted } from "./fluidgridsEvents-CNdcrUNN.js";
|
|
5
6
|
import { a as OBSERVABILITY_DATA_SINKS, c as REPLAY_WORKFLOW_RUN, d as UPDATE_LOG_STREAM_DESTINATION, i as OBSERVABILITY_DASHBOARD_SUMMARY, l as RETRY_WORKFLOW_RUNS, n as DELETE_LOG_STREAM_DESTINATION, o as OBSERVABILITY_DATA_SINK_DATA, r as LOG_STREAM_DESTINATIONS, s as OBSERVABILITY_FAILED_RUNS, t as CREATE_LOG_STREAM_DESTINATION, u as TEST_LOG_STREAM_DESTINATION } from "./operations-HU-xb78H.js";
|
|
6
7
|
import { useCallback, useEffect, useState } from "react";
|
|
7
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Bi as describeOperationError, Oi as getFluidGridsClient, Pn as SignalWorkflowRunDocument, Qr as WorkflowRunHistoryDocument, Ui as throwIfResultError, hn as RunEventAppendedDocument, ki as getFluidGridsClientSafe, qn as TerminateWorkflowRunDocument, qr as WorkflowRunDeterminismStatusDocument, rt as DurableRunFieldsDocument, ti as WorkflowRunStackTraceDocument } from "./node-endpoint-configs-DHFGA5MQ.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Cn as payloadFromCardValues, Sn as parseRawSignalPayload, Tn as signalPayloadCard } from "./FluidGridsProvider-B9RR_CI_.js";
|
|
4
4
|
import { r as useTr } from "./TranslationBridge-Da-TPgQm.js";
|
|
5
5
|
import { yd as ExecutionKind } from "./graphql-types-XcDLtFwU.js";
|
|
6
6
|
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Ci as WorkflowVersionsDocument, Dr as WorkflowDefinitionDocument, G as DeleteWorkflowDefinitionDocument, Jn as TriggerWorkflowDocument, Jr as WorkflowRunDocument, Li as emitFluidGridsEvent, Oi as getFluidGridsClient, Or as WorkflowDefinitionForBuilderDocument, R as CreateWorkflowVersionDocument, Ri as emitOperationErrorEvent, Ui as throwIfResultError, V as DeactivateWorkflowDefinitionDocument, Vt as PreviewN8nImportDocument, et as DuplicateWorkflowDocument, ii as WorkflowRunsDocument, j as CreateWorkflowDefinitionDocument, kr as WorkflowDefinitionsDocument, qi as getFluidGridsConfig, r as ActivateWorkflowDefinitionDocument, sn as RestoreWorkflowVersionDocument, sr as UpdateWorkflowDefinitionDocument, xt as ImportWorkflowDocument, z as DashboardSummaryDocument } from "./node-endpoint-configs-DHFGA5MQ.js";
|
|
3
|
-
import {
|
|
3
|
+
import { fn as useFluidGridsAnalytics, pn as openRunQuotaUpgradePrompt } from "./FluidGridsProvider-B9RR_CI_.js";
|
|
4
4
|
import { r as useTr } from "./TranslationBridge-Da-TPgQm.js";
|
|
5
|
+
import { d as runTriggerFromMode, i as emitRunStarted, l as emitWorkflowPublished, s as emitWorkflowCreated } from "./fluidgridsEvents-CNdcrUNN.js";
|
|
6
|
+
import { s as takePrefetchedWorkflowForBuilder } from "./workflowRouteData-BkfVOc-O.js";
|
|
5
7
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
6
8
|
|
|
7
9
|
// src/hooks/useWorkflows.ts
|
|
@@ -144,16 +146,33 @@ function useWorkflowDefinition(workflowKey, id) {
|
|
|
144
146
|
refetch: fetchData
|
|
145
147
|
};
|
|
146
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Sends an operation on its own request, at once, in a host whose client
|
|
151
|
+
* batches requests (fe-libs' `SEND_UNBATCHED_CONTEXT_KEY`). Clients that do
|
|
152
|
+
* not batch ignore it.
|
|
153
|
+
*/
|
|
154
|
+
const SEND_UNBATCHED = { sendUnbatched: true };
|
|
147
155
|
function useLazyWorkflowDefinition(options = {}) {
|
|
148
|
-
const { withNodeManifests = false } = options;
|
|
156
|
+
const { withNodeManifests = false, routeCritical = false } = options;
|
|
149
157
|
const [workflow, setWorkflow] = useState(null);
|
|
150
158
|
const [loading, setLoading] = useState(false);
|
|
151
159
|
const [error, setError] = useState(null);
|
|
152
160
|
return {
|
|
153
|
-
getWorkflow: useCallback(async (workflowKey, id, version) => {
|
|
161
|
+
getWorkflow: useCallback(async (workflowKey, id, version, { reusePrefetched = false } = {}) => {
|
|
154
162
|
setLoading(true);
|
|
155
163
|
setError(null);
|
|
156
164
|
try {
|
|
165
|
+
const started = routeCritical && withNodeManifests && reusePrefetched && workflowKey && version && !id ? takePrefetchedWorkflowForBuilder({
|
|
166
|
+
workspaceId: getFluidGridsConfig().workspaceId,
|
|
167
|
+
workflowKey,
|
|
168
|
+
version
|
|
169
|
+
}) : null;
|
|
170
|
+
const prefetched = started ? await started : null;
|
|
171
|
+
if (prefetched) {
|
|
172
|
+
const data = prefetched;
|
|
173
|
+
setWorkflow(data);
|
|
174
|
+
return data;
|
|
175
|
+
}
|
|
157
176
|
const data = (await getFluidGridsClient().query({
|
|
158
177
|
query: withNodeManifests ? WorkflowDefinitionForBuilderDocument : WORKFLOW_DEFINITION,
|
|
159
178
|
variables: {
|
|
@@ -161,7 +180,8 @@ function useLazyWorkflowDefinition(options = {}) {
|
|
|
161
180
|
id,
|
|
162
181
|
...version ? { version } : {}
|
|
163
182
|
},
|
|
164
|
-
fetchPolicy: "network-only"
|
|
183
|
+
fetchPolicy: "network-only",
|
|
184
|
+
...routeCritical ? { context: SEND_UNBATCHED } : {}
|
|
165
185
|
})).data?.workflowDefinition ?? null;
|
|
166
186
|
setWorkflow(data);
|
|
167
187
|
return data;
|
|
@@ -171,7 +191,7 @@ function useLazyWorkflowDefinition(options = {}) {
|
|
|
171
191
|
} finally {
|
|
172
192
|
setLoading(false);
|
|
173
193
|
}
|
|
174
|
-
}, [withNodeManifests]),
|
|
194
|
+
}, [withNodeManifests, routeCritical]),
|
|
175
195
|
workflow,
|
|
176
196
|
loading,
|
|
177
197
|
error
|
package/dist/workflow-builder.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { d as WorkflowBuilder, f as WorkflowBuilderCore, n as WorkflowBuilder$1, t as WorkflowSearchRedirect } from "./WorkflowSearchRedirect-
|
|
2
|
+
import { d as WorkflowBuilder, f as WorkflowBuilderCore, n as WorkflowBuilder$1, t as WorkflowSearchRedirect } from "./WorkflowSearchRedirect-3gyHcYY2.js";
|
|
3
3
|
import { H as useFlowStore } from "./node-operation-selection--oy-yEq_.js";
|
|
4
|
-
import { m as refetchStoreNodes } from "./FluidGridsProvider-
|
|
4
|
+
import { m as refetchStoreNodes } from "./FluidGridsProvider-B9RR_CI_.js";
|
|
5
5
|
|
|
6
6
|
export { WorkflowBuilder, WorkflowBuilderCore, WorkflowBuilder$1 as WorkflowBuilderPage, WorkflowSearchRedirect, refetchStoreNodes, useFlowStore };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
export declare const WORKFLOW_DEFINITION_FOR_BUILDER_QUERY = "\n query WorkflowDefinitionForBuilder($workflowKey: String, $id: ID, $version: String) {\n workflowDefinition(workflowKey: $workflowKey, id: $id, version: $version) {\n id\n workflowKey\n version\n name\n description\n status\n definitionJson\n pinnedNodeData\n alias\n icon\n category\n tags\n context\n projectId\n tenantId\n workspaceId\n createdAt\n updatedAt\n createdById\n revision\n updatedById\n nodeManifests\n }\n }\n";
|
|
3
|
+
export declare const WORKFLOW_DEFINITION_FOR_BUILDER_OPERATION = "WorkflowDefinitionForBuilder";
|
|
4
|
+
export declare const PREFETCHED_WORKFLOW_TTL_MS = 15000;
|
|
5
|
+
interface WorkflowBuilderRoute {
|
|
6
|
+
workflowKey: string;
|
|
7
|
+
version: string;
|
|
8
|
+
}
|
|
9
|
+
interface WorkflowRouteOperation {
|
|
10
|
+
operationName: string;
|
|
11
|
+
query: string;
|
|
12
|
+
variables: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
interface WorkflowRouteResponse {
|
|
15
|
+
data?: unknown;
|
|
16
|
+
errors?: ReadonlyArray<unknown> | null;
|
|
17
|
+
}
|
|
18
|
+
type WorkflowRouteRequest = (operation: WorkflowRouteOperation) => Promise<WorkflowRouteResponse>;
|
|
19
|
+
interface WorkflowRouteTarget extends WorkflowBuilderRoute {
|
|
20
|
+
workspaceId: string;
|
|
21
|
+
}
|
|
22
|
+
interface PrefetchWorkflowForBuilderInput extends WorkflowRouteTarget {
|
|
23
|
+
request: WorkflowRouteRequest;
|
|
24
|
+
}
|
|
25
|
+
interface PrefetchedWorkflowDefinition {
|
|
26
|
+
readonly workflowKey: string;
|
|
27
|
+
readonly version: string;
|
|
28
|
+
readonly [field: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
export declare function matchWorkflowBuilderRoute(pathname: string, basePath?: string): WorkflowBuilderRoute | null;
|
|
31
|
+
export declare function prefetchWorkflowForBuilder({ request, ...target }: PrefetchWorkflowForBuilderInput): boolean;
|
|
32
|
+
export declare function clearPrefetchedWorkflowsForBuilder(): void;
|
|
33
|
+
export type { PrefetchWorkflowForBuilderInput, PrefetchedWorkflowDefinition, WorkflowBuilderRoute, WorkflowRouteOperation, WorkflowRouteRequest, WorkflowRouteResponse, WorkflowRouteTarget };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as matchWorkflowBuilderRoute, i as clearPrefetchedWorkflowsForBuilder, n as WORKFLOW_DEFINITION_FOR_BUILDER_OPERATION, o as prefetchWorkflowForBuilder, r as WORKFLOW_DEFINITION_FOR_BUILDER_QUERY, t as PREFETCHED_WORKFLOW_TTL_MS } from "./workflowRouteData-BkfVOc-O.js";
|
|
3
|
+
|
|
4
|
+
export { PREFETCHED_WORKFLOW_TTL_MS, WORKFLOW_DEFINITION_FOR_BUILDER_OPERATION, WORKFLOW_DEFINITION_FOR_BUILDER_QUERY, clearPrefetchedWorkflowsForBuilder, matchWorkflowBuilderRoute, prefetchWorkflowForBuilder };
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/routing/workflowRouteData.ts
|
|
3
|
+
/**
|
|
4
|
+
* The builder's route data, started by the host before the builder's code has
|
|
5
|
+
* loaded (BOFF-11585).
|
|
6
|
+
*
|
|
7
|
+
* On a cold load of a workflow's builder page the route's code (the host's
|
|
8
|
+
* workflows module, the SDK pages and the canvas) takes a second or more to
|
|
9
|
+
* arrive and run, and only then did the builder ask for the workflow. The host
|
|
10
|
+
* knows the route and the person's workspace token long before that. It starts
|
|
11
|
+
* the builder's one read itself, through its own GraphQL fetch (so the gateway's
|
|
12
|
+
* `@rbac` and the workspace boundary decide exactly as they do for the
|
|
13
|
+
* builder), and the builder takes the answer instead of asking again.
|
|
14
|
+
*
|
|
15
|
+
* The hand-off is deliberately narrow:
|
|
16
|
+
* - a read is kept per workspace, workflow key and version, and is handed over
|
|
17
|
+
* once;
|
|
18
|
+
* - it is handed over only within `PREFETCHED_WORKFLOW_TTL_MS` of its start,
|
|
19
|
+
* and a read still unanswered by then is given up;
|
|
20
|
+
* - a read that failed, came back with errors or answered for another workflow
|
|
21
|
+
* is not handed over: the builder then sends its own read, which reports the
|
|
22
|
+
* problem the way it always has.
|
|
23
|
+
*
|
|
24
|
+
* This module imports nothing, so a host can put it on its entry without the
|
|
25
|
+
* builder.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* The builder's read (BOFF-10387): the workflow with the manifests of the node
|
|
29
|
+
* types it uses. The same selection as
|
|
30
|
+
* `src/operations/workflows/queries/workflowDefinitionForBuilder.graphql`
|
|
31
|
+
* (`workflowRouteData.test.ts` keeps the two equal and checks this one against
|
|
32
|
+
* the composed workspace schema); a plain string, so the hand-off does not
|
|
33
|
+
* pull the SDK's generated documents onto a host's entry.
|
|
34
|
+
*/
|
|
35
|
+
const WORKFLOW_DEFINITION_FOR_BUILDER_QUERY = `
|
|
36
|
+
query WorkflowDefinitionForBuilder($workflowKey: String, $id: ID, $version: String) {
|
|
37
|
+
workflowDefinition(workflowKey: $workflowKey, id: $id, version: $version) {
|
|
38
|
+
id
|
|
39
|
+
workflowKey
|
|
40
|
+
version
|
|
41
|
+
name
|
|
42
|
+
description
|
|
43
|
+
status
|
|
44
|
+
definitionJson
|
|
45
|
+
pinnedNodeData
|
|
46
|
+
alias
|
|
47
|
+
icon
|
|
48
|
+
category
|
|
49
|
+
tags
|
|
50
|
+
context
|
|
51
|
+
projectId
|
|
52
|
+
tenantId
|
|
53
|
+
workspaceId
|
|
54
|
+
createdAt
|
|
55
|
+
updatedAt
|
|
56
|
+
createdById
|
|
57
|
+
revision
|
|
58
|
+
updatedById
|
|
59
|
+
nodeManifests
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
/** The operation name of `WORKFLOW_DEFINITION_FOR_BUILDER_QUERY`. */
|
|
64
|
+
const WORKFLOW_DEFINITION_FOR_BUILDER_OPERATION = "WorkflowDefinitionForBuilder";
|
|
65
|
+
/** How long a started read may be handed to the builder, counted from its start. */
|
|
66
|
+
const PREFETCHED_WORKFLOW_TTL_MS = 15e3;
|
|
67
|
+
const started = /* @__PURE__ */ new Map();
|
|
68
|
+
const keyOf = ({ workspaceId, workflowKey, version }) => JSON.stringify([
|
|
69
|
+
workspaceId,
|
|
70
|
+
workflowKey,
|
|
71
|
+
version
|
|
72
|
+
]);
|
|
73
|
+
/**
|
|
74
|
+
* The workflow a builder path opens, or null for any other path. The builder
|
|
75
|
+
* routes are `<basePath>/workflow/:key/:version` and
|
|
76
|
+
* `<basePath>/builder/:key/:version`; the key and version are decoded the way
|
|
77
|
+
* the router decodes route parameters.
|
|
78
|
+
*/
|
|
79
|
+
function matchWorkflowBuilderRoute(pathname, basePath = "/workflows") {
|
|
80
|
+
const base = basePath.replace(/\/+$/, "");
|
|
81
|
+
if (!pathname.startsWith(`${base}/`)) return null;
|
|
82
|
+
const match = /^(?:workflow|builder)\/([^/]+)\/([^/]+)\/?$/.exec(pathname.slice(base.length + 1));
|
|
83
|
+
if (!match) return null;
|
|
84
|
+
try {
|
|
85
|
+
const workflowKey = decodeURIComponent(match[1] ?? "");
|
|
86
|
+
const version = decodeURIComponent(match[2] ?? "");
|
|
87
|
+
return workflowKey && version ? {
|
|
88
|
+
workflowKey,
|
|
89
|
+
version
|
|
90
|
+
} : null;
|
|
91
|
+
} catch {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function isRecord(value) {
|
|
96
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
97
|
+
}
|
|
98
|
+
/** The requested workflow from a response, or null when it cannot be used. */
|
|
99
|
+
function usableDefinition(response, { workflowKey, version }) {
|
|
100
|
+
if (typeof response !== "object" || response === null) return null;
|
|
101
|
+
if (Array.isArray(response.errors) && response.errors.length > 0) return null;
|
|
102
|
+
const data = response.data;
|
|
103
|
+
if (!isRecord(data)) return null;
|
|
104
|
+
const definition = data.workflowDefinition;
|
|
105
|
+
if (!isRecord(definition) || definition.workflowKey !== workflowKey || definition.version !== version) return null;
|
|
106
|
+
return definition;
|
|
107
|
+
}
|
|
108
|
+
function dropExpired(now) {
|
|
109
|
+
for (const [key, read] of started) if (now - read.startedAt >= 15e3) started.delete(key);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Starts the builder's read for a workflow, to be handed to the builder when
|
|
113
|
+
* it opens that workflow. Returns false, and sends nothing, when the target is
|
|
114
|
+
* incomplete or a read for it is already waiting to be handed over.
|
|
115
|
+
*/
|
|
116
|
+
function prefetchWorkflowForBuilder({ request, ...target }) {
|
|
117
|
+
if (!target.workspaceId || !target.workflowKey || !target.version) return false;
|
|
118
|
+
const now = Date.now();
|
|
119
|
+
dropExpired(now);
|
|
120
|
+
const key = keyOf(target);
|
|
121
|
+
if (started.has(key)) return false;
|
|
122
|
+
let response;
|
|
123
|
+
try {
|
|
124
|
+
response = request({
|
|
125
|
+
operationName: WORKFLOW_DEFINITION_FOR_BUILDER_OPERATION,
|
|
126
|
+
query: WORKFLOW_DEFINITION_FOR_BUILDER_QUERY,
|
|
127
|
+
variables: {
|
|
128
|
+
workflowKey: target.workflowKey,
|
|
129
|
+
version: target.version
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
} catch {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
started.set(key, {
|
|
136
|
+
startedAt: now,
|
|
137
|
+
result: Promise.resolve(response).then((answer) => usableDefinition(answer, target), () => null)
|
|
138
|
+
});
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Takes the read started for this workflow, if there is one: a promise of the
|
|
143
|
+
* workflow, or of null when the read cannot be used (the caller then sends its
|
|
144
|
+
* own). Returns null when nothing was started for it, or it started too long
|
|
145
|
+
* ago. A read is handed over once.
|
|
146
|
+
*/
|
|
147
|
+
function takePrefetchedWorkflowForBuilder(target, { maxAgeMs = PREFETCHED_WORKFLOW_TTL_MS } = {}) {
|
|
148
|
+
const now = Date.now();
|
|
149
|
+
dropExpired(now);
|
|
150
|
+
const key = keyOf(target);
|
|
151
|
+
const read = started.get(key);
|
|
152
|
+
if (!read) return null;
|
|
153
|
+
started.delete(key);
|
|
154
|
+
const remaining = read.startedAt + maxAgeMs - now;
|
|
155
|
+
if (remaining <= 0) return null;
|
|
156
|
+
return new Promise((resolve) => {
|
|
157
|
+
const timer = setTimeout(() => resolve(null), remaining);
|
|
158
|
+
read.result.then((definition) => {
|
|
159
|
+
clearTimeout(timer);
|
|
160
|
+
resolve(definition);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/** Forgets every started read (for a host that signs the person out in place, and tests). */
|
|
165
|
+
function clearPrefetchedWorkflowsForBuilder() {
|
|
166
|
+
started.clear();
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export { matchWorkflowBuilderRoute as a, clearPrefetchedWorkflowsForBuilder as i, WORKFLOW_DEFINITION_FOR_BUILDER_OPERATION as n, prefetchWorkflowForBuilder as o, WORKFLOW_DEFINITION_FOR_BUILDER_QUERY as r, takePrefetchedWorkflowForBuilder as s, PREFETCHED_WORKFLOW_TTL_MS as t };
|
package/dist/workflows-list.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burdenoff/fluidgrids-fe-sdk",
|
|
3
|
-
"version": "2026.1111.
|
|
3
|
+
"version": "2026.1111.15",
|
|
4
4
|
"description": "FluidGrids Workflow Builder SDK - Embeddable visual workflow automation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"imports": {
|
|
@@ -54,6 +54,14 @@
|
|
|
54
54
|
"types": "./dist/workflow-preview.d.ts",
|
|
55
55
|
"import": "./dist/workflow-preview.js"
|
|
56
56
|
},
|
|
57
|
+
"./agent-tools": {
|
|
58
|
+
"types": "./dist/agent-tools.d.ts",
|
|
59
|
+
"import": "./dist/agent-tools.js"
|
|
60
|
+
},
|
|
61
|
+
"./workflow-route": {
|
|
62
|
+
"types": "./dist/workflow-route.d.ts",
|
|
63
|
+
"import": "./dist/workflow-route.js"
|
|
64
|
+
},
|
|
57
65
|
"./styles.css": "./dist/styles.css"
|
|
58
66
|
},
|
|
59
67
|
"files": [
|