@powerhousedao/workflow 6.2.3-dev.84 → 6.2.3-dev.85
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/browser/{BlockSelector-CtoMNZ9A.js → BlockSelector-BKAJwJ4Y.js} +74 -6
- package/dist/browser/BlockSelector-BKAJwJ4Y.js.map +1 -0
- package/dist/browser/{PieceMarkdown-U6OUTwRi.js → PieceMarkdown-DSdZd-Jc.js} +34 -8
- package/dist/browser/PieceMarkdown-DSdZd-Jc.js.map +1 -0
- package/dist/browser/{connection-form-_H-tP2Vk.js → connection-form-DltdMa8F.js} +3 -3
- package/dist/browser/{connection-form-_H-tP2Vk.js.map → connection-form-DltdMa8F.js.map} +1 -1
- package/dist/browser/{data-tree-CjWQllC7.js → data-tree-DAw8e0j8.js} +25 -12
- package/dist/browser/data-tree-DAw8e0j8.js.map +1 -0
- package/dist/browser/document-models/index.js +2 -2
- package/dist/browser/document-models/workflow/index.js +2 -2
- package/dist/browser/{document-models-DSK5cn8B.js → document-models-C2SAP1SX.js} +2 -2
- package/dist/browser/{document-models-DSK5cn8B.js.map → document-models-C2SAP1SX.js.map} +1 -1
- package/dist/browser/{editor-B1AzXxaF.js → editor--J61vLSC.js} +435 -51
- package/dist/browser/editor--J61vLSC.js.map +1 -0
- package/dist/browser/{editor-DgdTF2up.js → editor-CZLe6CAF.js} +5 -5
- package/dist/browser/{editor-DgdTF2up.js.map → editor-CZLe6CAF.js.map} +1 -1
- package/dist/browser/{editor-B9069RYZ.js → editor-Dl6lzxkM.js} +26 -18
- package/dist/browser/{editor-B9069RYZ.js.map → editor-Dl6lzxkM.js.map} +1 -1
- package/dist/browser/editors/connection-editor/module.js +1 -1
- package/dist/browser/editors/runtime/index.js +1 -1
- package/dist/browser/editors/workflow-editor/module.js +1 -1
- package/dist/browser/editors/workflow-studio/module.js +1 -1
- package/dist/browser/index.js +3 -3
- package/dist/browser/{module-eOpxJVIl.js → module-mFCt9WHJ.js} +2 -2
- package/dist/browser/module-mFCt9WHJ.js.map +1 -0
- package/dist/browser/reactor/index.js +2 -2
- package/dist/browser/{runtime-queries-LAcyniYz.js → runtime-queries-D81Ghpok.js} +105 -4
- package/dist/browser/runtime-queries-D81Ghpok.js.map +1 -0
- package/dist/browser/{trigger-text-BgpPIXEJ.js → trigger-text-BSVi5oGZ.js} +392 -387
- package/dist/browser/trigger-text-BSVi5oGZ.js.map +1 -0
- package/dist/browser/{upgrade-manifests-CLYUPqBs.js → upgrade-manifests-C2Qa6myy.js} +2 -2
- package/dist/browser/{upgrade-manifests-CLYUPqBs.js.map → upgrade-manifests-C2Qa6myy.js.map} +1 -1
- package/dist/browser/{workflow-Cn1UP-eJ.js → workflow-BFdnSGRD.js} +2 -2
- package/dist/browser/{workflow-Cn1UP-eJ.js.map → workflow-BFdnSGRD.js.map} +1 -1
- package/dist/node/{BlockSelector-CbdgYJfp.mjs → BlockSelector-Bcb5NJ_X.mjs} +74 -6
- package/dist/node/BlockSelector-Bcb5NJ_X.mjs.map +1 -0
- package/dist/node/{PieceMarkdown-DwpCBISY.mjs → PieceMarkdown-CUSdTMH4.mjs} +34 -8
- package/dist/node/{PieceMarkdown-DwpCBISY.mjs.map → PieceMarkdown-CUSdTMH4.mjs.map} +1 -1
- package/dist/node/{connection-form-DPbyrUIm.mjs → connection-form-DF5418sz.mjs} +3 -3
- package/dist/node/{connection-form-DPbyrUIm.mjs.map → connection-form-DF5418sz.mjs.map} +1 -1
- package/dist/node/{data-tree-CXa2kEuD.mjs → data-tree-CebWVI_P.mjs} +25 -12
- package/dist/node/{data-tree-CXa2kEuD.mjs.map → data-tree-CebWVI_P.mjs.map} +1 -1
- package/dist/node/document-models/index.mjs +2 -2
- package/dist/node/document-models/workflow/index.mjs +2 -2
- package/dist/node/{editor-D3MlbYBN.mjs → editor-BmRWQvRs.mjs} +435 -51
- package/dist/node/editor-BmRWQvRs.mjs.map +1 -0
- package/dist/node/{editor-DzxyNgYk.mjs → editor-J0op3mM7.mjs} +5 -5
- package/dist/node/{editor-DzxyNgYk.mjs.map → editor-J0op3mM7.mjs.map} +1 -1
- package/dist/node/{editor-BGz1Ljdk.mjs → editor-UzRtZp-A.mjs} +26 -18
- package/dist/node/{editor-BGz1Ljdk.mjs.map → editor-UzRtZp-A.mjs.map} +1 -1
- package/dist/node/editors/connection-editor/module.mjs +1 -1
- package/dist/node/editors/runtime/index.mjs +1 -1
- package/dist/node/editors/workflow-editor/module.mjs +1 -1
- package/dist/node/editors/workflow-studio/module.mjs +1 -1
- package/dist/node/index.mjs +3 -3
- package/dist/node/{module-D9Zx5Zow.mjs → module-CuTg45ct.mjs} +2 -2
- package/dist/{browser/module-eOpxJVIl.js.map → node/module-CuTg45ct.mjs.map} +1 -1
- package/dist/node/pieces/ai/descriptor.json +1 -1
- package/dist/node/pieces/ai/package.json +1 -1
- package/dist/node/pieces/reactor/descriptor.json +1 -1
- package/dist/node/pieces/reactor/package.json +1 -1
- package/dist/node/{runtime-queries-CatdoDey.mjs → runtime-queries-VXJsWno5.mjs} +110 -5
- package/dist/node/runtime-queries-VXJsWno5.mjs.map +1 -0
- package/dist/node/{trigger-text-yNCaB6pd.mjs → trigger-text-BvEzEani.mjs} +392 -387
- package/dist/node/trigger-text-BvEzEani.mjs.map +1 -0
- package/dist/node/{upgrade-manifests-C4akaA_X.mjs → upgrade-manifests-BA5OaR4H.mjs} +2 -2
- package/dist/node/{upgrade-manifests-C4akaA_X.mjs.map → upgrade-manifests-BA5OaR4H.mjs.map} +1 -1
- package/dist/node/{workflow-DqF9VsBQ.mjs → workflow-BgURVzdc.mjs} +2 -2
- package/dist/node/{workflow-DqF9VsBQ.mjs.map → workflow-BgURVzdc.mjs.map} +1 -1
- package/dist/powerhouse.manifest.json +2 -2
- package/dist/style.css +1 -1
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +1 -1
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts.map +1 -1
- package/dist/types/editors/shared/controls.d.ts.map +1 -1
- package/dist/types/editors/shared/data-tree.d.ts.map +1 -1
- package/dist/types/editors/shared/icons.d.ts +1 -0
- package/dist/types/editors/shared/icons.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-client.d.ts +39 -0
- package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-context.d.ts +10 -1
- package/dist/types/editors/workflow-editor/runtime-context.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-queries.d.ts +21 -1
- package/dist/types/editors/workflow-editor/runtime-queries.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PieceMarkdown.d.ts +2 -1
- package/dist/types/editors/workflow-editor/ui/PieceMarkdown.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +4 -0
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/block-meta.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/blocks.d.ts +4 -0
- package/dist/types/editors/workflow-editor/ui/blocks.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/query-keys.d.ts +9 -0
- package/dist/types/editors/workflow-editor/ui/query-keys.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/RunsTable.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/Sidebar.d.ts +3 -0
- package/dist/types/editors/workflow-studio/components/Sidebar.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/Waitpoints.d.ts +49 -0
- package/dist/types/editors/workflow-studio/components/Waitpoints.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts +3 -0
- package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/run-format.d.ts +2 -1
- package/dist/types/editors/workflow-studio/components/run-format.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/waitpoints-view.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/waitpoints-view.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/waitpoints.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/waitpoints.test.d.ts.map +1 -0
- package/dist/types/test/waitpoint-record.d.ts +3 -0
- package/dist/types/test/waitpoint-record.d.ts.map +1 -0
- package/dist/workflow.css +2 -0
- package/package.json +9 -9
- package/dist/browser/BlockSelector-CtoMNZ9A.js.map +0 -1
- package/dist/browser/PieceMarkdown-U6OUTwRi.js.map +0 -1
- package/dist/browser/data-tree-CjWQllC7.js.map +0 -1
- package/dist/browser/editor-B1AzXxaF.js.map +0 -1
- package/dist/browser/runtime-queries-LAcyniYz.js.map +0 -1
- package/dist/browser/trigger-text-BgpPIXEJ.js.map +0 -1
- package/dist/node/BlockSelector-CbdgYJfp.mjs.map +0 -1
- package/dist/node/editor-D3MlbYBN.mjs.map +0 -1
- package/dist/node/module-D9Zx5Zow.mjs.map +0 -1
- package/dist/node/runtime-queries-CatdoDey.mjs.map +0 -1
- package/dist/node/trigger-text-yNCaB6pd.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { t as Connection } from "../module-BEEASith.mjs";
|
|
2
|
-
import { t as Workflow } from "../module-
|
|
3
|
-
import { t as upgradeManifests } from "../upgrade-manifests-
|
|
2
|
+
import { t as Workflow } from "../module-CuTg45ct.mjs";
|
|
3
|
+
import { t as upgradeManifests } from "../upgrade-manifests-BA5OaR4H.mjs";
|
|
4
4
|
export { Connection as ConnectionV1, Workflow as WorkflowV1, upgradeManifests };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as AddStepPropertySettingInputSchema, A as setTrigger, At as SetWorkflowDescriptionInputSchema, B as setLastRun, Bt as WorkflowManagerSchema, C as setWorkflowName, Ct as SetTriggerConfigInputSchema, D as setVariable, Dt as SetTriggerPieceVersionInputSchema, E as removeVariable, Et as SetTriggerInputSchema, F as creators_exports$4, Ft as UpdateStepInputSchema, G as creators_exports$1, Gt as WorkflowVariableSchema, H as creators_exports$2, Ht as WorkflowStateSchema, I as removeStep, It as UpdateStepPositionInputSchema, J as creators_exports, K as setPolicy, Kt as definedNonNullAnySchema, L as setStepConfig, Lt as UpdateStepRetryPolicyInputSchema, M as setTriggerConnection, Mt as SetWorkflowStatusInputSchema, N as setTriggerPieceVersion, Nt as StepTestRecordSchema, O as clearTrigger, Ot as SetTriggerPropertySettingInputSchema, P as addStep, Pt as TriggerBindingSchema, Q as AddStepPositionInputSchema, R as updateStep, Rt as VariableTypeSchema, S as setWorkflowDescription, St as SetStepConfigPropertySettingInputSchema, T as creators_exports$6, Tt as SetTriggerConnectionInputSchema, U as publishWorkflow, Ut as WorkflowStatusSchema, V as setLastTest, Vt as WorkflowPolicySchema, W as revertToPublished, Wt as WorkflowStepSchema, X as AddEdgeInputSchema, Y as removeEdge, Z as AddStepInputSchema, _ as reducer, _t as SetLastTestInputSchema, at as PointSchema, b as creators_exports$7, bt as SetPolicyRetryPolicyInputSchema, c as WorkflowPHStateSchema, ct as PublishWorkflowInputSchema, d as isWorkflowDocument, dt as RemoveStepInputSchema, et as AddStepRetryPolicyInputSchema, f as isWorkflowState, ft as RemoveVariableInputSchema, g as supportedVersions, gt as SetLastRunInputSchema, h as latestVersion, ht as RunStatusSchema, i as initialLocalState, it as FailureModeSchema, j as setTriggerConfig, jt as SetWorkflowNameInputSchema, k as creators_exports$5, kt as SetVariableInputSchema, l as assertIsWorkflowDocument, lt as PublishedWorkflowSchema, m as workflowUpgradeManifest, mt as RevertToPublishedInputSchema, n as utils, nt as ClearTriggerInputSchema, o as WorkflowDocumentHeaderSchema, ot as PropertyModeSchema, p as workflowDocumentType, pt as RetryPolicySchema, q as addEdge, qt as isDefinedNonNullAny, r as initialGlobalState, rt as ConcurrencyModeSchema, s as WorkflowDocumentSchema, st as PropertySettingSchema, t as Workflow, tt as BackoffKindSchema, u as assertIsWorkflowState, ut as RemoveEdgeInputSchema, v as documentModel, vt as SetManagedByInputSchema, w as setWorkflowStatus, wt as SetTriggerConfigPropertySettingInputSchema, x as setManagedBy, xt as SetStepConfigInputSchema, y as actions, yt as SetPolicyInputSchema, z as creators_exports$3, zt as WorkflowEdgeSchema } from "../../module-
|
|
2
|
-
import { a as createState, c as defaultLocalState, i as useWorkflowDocumentsInSelectedFolder, l as defaultPHState, n as useWorkflowDocumentById, o as createWorkflowDocument, r as useWorkflowDocumentsInSelectedDrive, s as defaultGlobalState, t as useSelectedWorkflowDocument, u as WorkflowController } from "../../workflow-
|
|
1
|
+
import { $ as AddStepPropertySettingInputSchema, A as setTrigger, At as SetWorkflowDescriptionInputSchema, B as setLastRun, Bt as WorkflowManagerSchema, C as setWorkflowName, Ct as SetTriggerConfigInputSchema, D as setVariable, Dt as SetTriggerPieceVersionInputSchema, E as removeVariable, Et as SetTriggerInputSchema, F as creators_exports$4, Ft as UpdateStepInputSchema, G as creators_exports$1, Gt as WorkflowVariableSchema, H as creators_exports$2, Ht as WorkflowStateSchema, I as removeStep, It as UpdateStepPositionInputSchema, J as creators_exports, K as setPolicy, Kt as definedNonNullAnySchema, L as setStepConfig, Lt as UpdateStepRetryPolicyInputSchema, M as setTriggerConnection, Mt as SetWorkflowStatusInputSchema, N as setTriggerPieceVersion, Nt as StepTestRecordSchema, O as clearTrigger, Ot as SetTriggerPropertySettingInputSchema, P as addStep, Pt as TriggerBindingSchema, Q as AddStepPositionInputSchema, R as updateStep, Rt as VariableTypeSchema, S as setWorkflowDescription, St as SetStepConfigPropertySettingInputSchema, T as creators_exports$6, Tt as SetTriggerConnectionInputSchema, U as publishWorkflow, Ut as WorkflowStatusSchema, V as setLastTest, Vt as WorkflowPolicySchema, W as revertToPublished, Wt as WorkflowStepSchema, X as AddEdgeInputSchema, Y as removeEdge, Z as AddStepInputSchema, _ as reducer, _t as SetLastTestInputSchema, at as PointSchema, b as creators_exports$7, bt as SetPolicyRetryPolicyInputSchema, c as WorkflowPHStateSchema, ct as PublishWorkflowInputSchema, d as isWorkflowDocument, dt as RemoveStepInputSchema, et as AddStepRetryPolicyInputSchema, f as isWorkflowState, ft as RemoveVariableInputSchema, g as supportedVersions, gt as SetLastRunInputSchema, h as latestVersion, ht as RunStatusSchema, i as initialLocalState, it as FailureModeSchema, j as setTriggerConfig, jt as SetWorkflowNameInputSchema, k as creators_exports$5, kt as SetVariableInputSchema, l as assertIsWorkflowDocument, lt as PublishedWorkflowSchema, m as workflowUpgradeManifest, mt as RevertToPublishedInputSchema, n as utils, nt as ClearTriggerInputSchema, o as WorkflowDocumentHeaderSchema, ot as PropertyModeSchema, p as workflowDocumentType, pt as RetryPolicySchema, q as addEdge, qt as isDefinedNonNullAny, r as initialGlobalState, rt as ConcurrencyModeSchema, s as WorkflowDocumentSchema, st as PropertySettingSchema, t as Workflow, tt as BackoffKindSchema, u as assertIsWorkflowState, ut as RemoveEdgeInputSchema, v as documentModel, vt as SetManagedByInputSchema, w as setWorkflowStatus, wt as SetTriggerConfigPropertySettingInputSchema, x as setManagedBy, xt as SetStepConfigInputSchema, y as actions, yt as SetPolicyInputSchema, z as creators_exports$3, zt as WorkflowEdgeSchema } from "../../module-CuTg45ct.mjs";
|
|
2
|
+
import { a as createState, c as defaultLocalState, i as useWorkflowDocumentsInSelectedFolder, l as defaultPHState, n as useWorkflowDocumentById, o as createWorkflowDocument, r as useWorkflowDocumentsInSelectedDrive, s as defaultGlobalState, t as useSelectedWorkflowDocument, u as WorkflowController } from "../../workflow-BgURVzdc.mjs";
|
|
3
3
|
export { AddEdgeInputSchema, AddStepInputSchema, AddStepPositionInputSchema, AddStepPropertySettingInputSchema, AddStepRetryPolicyInputSchema, BackoffKindSchema, ClearTriggerInputSchema, ConcurrencyModeSchema, FailureModeSchema, PointSchema, PropertyModeSchema, PropertySettingSchema, PublishWorkflowInputSchema, PublishedWorkflowSchema, RemoveEdgeInputSchema, RemoveStepInputSchema, RemoveVariableInputSchema, RetryPolicySchema, RevertToPublishedInputSchema, RunStatusSchema, SetLastRunInputSchema, SetLastTestInputSchema, SetManagedByInputSchema, SetPolicyInputSchema, SetPolicyRetryPolicyInputSchema, SetStepConfigInputSchema, SetStepConfigPropertySettingInputSchema, SetTriggerConfigInputSchema, SetTriggerConfigPropertySettingInputSchema, SetTriggerConnectionInputSchema, SetTriggerInputSchema, SetTriggerPieceVersionInputSchema, SetTriggerPropertySettingInputSchema, SetVariableInputSchema, SetWorkflowDescriptionInputSchema, SetWorkflowNameInputSchema, SetWorkflowStatusInputSchema, StepTestRecordSchema, TriggerBindingSchema, UpdateStepInputSchema, UpdateStepPositionInputSchema, UpdateStepRetryPolicyInputSchema, VariableTypeSchema, Workflow, WorkflowController, WorkflowDocumentHeaderSchema, WorkflowDocumentSchema, WorkflowEdgeSchema, WorkflowManagerSchema, WorkflowPHStateSchema, WorkflowPolicySchema, WorkflowStateSchema, WorkflowStatusSchema, WorkflowStepSchema, WorkflowVariableSchema, actions, addEdge, addStep, assertIsWorkflowDocument, assertIsWorkflowState, clearTrigger, createState, createWorkflowDocument, defaultGlobalState, defaultLocalState, defaultPHState, definedNonNullAnySchema, documentModel, initialGlobalState, initialLocalState, isDefinedNonNullAny, isWorkflowDocument, isWorkflowState, latestVersion, publishWorkflow, reducer, removeEdge, removeStep, removeVariable, revertToPublished, setLastRun, setLastTest, setManagedBy, setPolicy, setStepConfig, setTrigger, setTriggerConfig, setTriggerConnection, setTriggerPieceVersion, setVariable, setWorkflowDescription, setWorkflowName, setWorkflowStatus, supportedVersions, updateStep, useSelectedWorkflowDocument, useWorkflowDocumentById, useWorkflowDocumentsInSelectedDrive, useWorkflowDocumentsInSelectedFolder, utils, workflowDocumentType, creators_exports as workflowEdgesActions, creators_exports$1 as workflowPolicyActions, creators_exports$2 as workflowPublishingActions, creators_exports$3 as workflowRuntimeActions, creators_exports$4 as workflowStepsActions, creators_exports$5 as workflowTriggerActions, workflowUpgradeManifest, creators_exports$6 as workflowVariablesActions, creators_exports$7 as workflowWorkflowActions };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as
|
|
3
|
-
import { y as actions } from "./module-
|
|
4
|
-
import { r as useWorkflowDocumentsInSelectedDrive } from "./workflow-
|
|
5
|
-
import {
|
|
1
|
+
import { Dt as parseManualInputs, Et as manualDefault, Q as CORE_PIECE, _t as ManualPayloadError, bt as coerceManualPayload, dt as stepBlock, et as MANUAL_TRIGGER, l as runsOfPages, pt as triggerBlock, ut as sameBlock } from "./runtime-queries-VXJsWno5.mjs";
|
|
2
|
+
import { A as formatWhen, Bt as textAreaClass, C as canRerun, D as formatMs, Dt as useSearchParamDraft, E as formatDuration, Et as useSearchParam, F as statusLabel, Ft as Switch, Gt as DocumentLoadError, Ht as Icon, I as toneOf, Kt as errorMessage, L as workflowHealth, M as runStatusLabel, N as runTimeline, O as formatTrigger, Ot as Button, P as runTone, Pt as Select, S as TONE_TEXT, St as useRuntimeActions, T as formatAbsolute, Tt as ITEM_PARAM, Vt as textInputClass, Wt as DocumentErrorBoundary, _ as CONNECTION_TONE, b as STEP_TONE, f as blockMeta, g as usePieceLogos, j as runStats, k as formatUntil, mt as WorkflowRuntimeProvider, t as BlockLogo, v as RUN_STATUSES, vt as useRunPagesQuery, w as durationMs, wt as useWaitingRunsQuery, x as TONE_DOT, y as RUN_TONE, yt as useRunQuery } from "./BlockSelector-Bcb5NJ_X.mjs";
|
|
3
|
+
import { y as actions } from "./module-CuTg45ct.mjs";
|
|
4
|
+
import { r as useWorkflowDocumentsInSelectedDrive } from "./workflow-BgURVzdc.mjs";
|
|
5
|
+
import { a as StepError, b as PropertyForm, f as StatusToggle, i as DataViewer, l as PublishState, r as describeTrigger } from "./trigger-text-BvEzEani.mjs";
|
|
6
6
|
import { addDocument, addFolder, deleteNode, getPHStore, showDeleteNodeModal, useDispatch, useDocumentSafe, useFileNodesInSelectedDrive, useNodesInSelectedDrive, usePHToast, useSearchParams, useSelectedDrive, useSelectedNode, useSetPHAppConfig, useSetSearchParams, useSetSelectedNode } from "@powerhousedao/reactor-browser";
|
|
7
7
|
import { generateId } from "document-model";
|
|
8
|
-
import { Fragment, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
8
|
+
import { Fragment, Suspense, lazy, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
9
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { addFolder as addFolder$1, moveNode, updateNode } from "@powerhousedao/shared/document-drive";
|
|
11
11
|
import { ConnectTooltip, ConnectTooltipProvider, Modal } from "@powerhousedao/design-system/connect";
|
|
@@ -526,6 +526,318 @@ function RunStrip(props) {
|
|
|
526
526
|
}) });
|
|
527
527
|
}
|
|
528
528
|
//#endregion
|
|
529
|
+
//#region editors/workflow-studio/components/Waitpoints.tsx
|
|
530
|
+
const PieceMarkdown = lazy(() => import("./PieceMarkdown-CUSdTMH4.mjs"));
|
|
531
|
+
const WAITING_POLL_MS = 3e4;
|
|
532
|
+
function isOpenApproval(waitpoint) {
|
|
533
|
+
return waitpoint.status === "PENDING" && waitpoint.kind === "approval";
|
|
534
|
+
}
|
|
535
|
+
function waitDescription(waitpoint, stepName) {
|
|
536
|
+
if (waitpoint.kind === "delay") return waitpoint.resumeAt ? `${stepName} is waiting until ${formatAbsolute(waitpoint.resumeAt)}` : `${stepName} is waiting for its delay`;
|
|
537
|
+
return `${stepName} is waiting for a webhook callback${waitpoint.expiresAt ? `, until ${formatAbsolute(waitpoint.expiresAt)}` : ""}`;
|
|
538
|
+
}
|
|
539
|
+
function cancelFailure(result) {
|
|
540
|
+
if (!result) return "The run was not found";
|
|
541
|
+
if (result.status === "CANCELLED") return null;
|
|
542
|
+
return result.error ?? `The run is ${result.status}`;
|
|
543
|
+
}
|
|
544
|
+
function countPendingApprovals(runs, limit) {
|
|
545
|
+
const byWorkflow = /* @__PURE__ */ new Map();
|
|
546
|
+
let total = 0;
|
|
547
|
+
for (const run of runs ?? []) {
|
|
548
|
+
const open = (run.waitpoints ?? []).filter(isOpenApproval).length;
|
|
549
|
+
if (open === 0) continue;
|
|
550
|
+
total += open;
|
|
551
|
+
byWorkflow.set(run.workflowId, (byWorkflow.get(run.workflowId) ?? 0) + open);
|
|
552
|
+
}
|
|
553
|
+
return {
|
|
554
|
+
total,
|
|
555
|
+
byWorkflow,
|
|
556
|
+
capped: (runs?.length ?? 0) >= limit
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
function approvalCountText(count, capped) {
|
|
560
|
+
return capped ? `${count}+` : String(count);
|
|
561
|
+
}
|
|
562
|
+
function approvalCountLabel(count, capped) {
|
|
563
|
+
const noun = count === 1 && !capped ? "approval" : "approvals";
|
|
564
|
+
return `${approvalCountText(count, capped)} ${noun} waiting`;
|
|
565
|
+
}
|
|
566
|
+
function usePendingApprovals(driveId) {
|
|
567
|
+
return countPendingApprovals(useWaitingRunsQuery({
|
|
568
|
+
driveId,
|
|
569
|
+
first: 100
|
|
570
|
+
}, { pollMs: WAITING_POLL_MS }).data, 100);
|
|
571
|
+
}
|
|
572
|
+
function ApprovalBadge(props) {
|
|
573
|
+
if (props.count === 0) return null;
|
|
574
|
+
const label = approvalCountLabel(props.count, props.capped);
|
|
575
|
+
const className = `inline-flex h-5 shrink-0 items-center gap-1 rounded-full bg-wf-warn/12 px-1.5 text-[11px] font-medium tabular-nums text-wf-warn ${props.className ?? ""}`;
|
|
576
|
+
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Icon, {
|
|
577
|
+
name: "clock",
|
|
578
|
+
className: "h-3 w-3"
|
|
579
|
+
}), approvalCountText(props.count, props.capped)] });
|
|
580
|
+
return props.onClick ? /* @__PURE__ */ jsx("button", {
|
|
581
|
+
type: "button",
|
|
582
|
+
title: label,
|
|
583
|
+
"aria-label": label,
|
|
584
|
+
className: `${className} hover:bg-wf-warn/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,
|
|
585
|
+
onClick: (event) => {
|
|
586
|
+
event.stopPropagation();
|
|
587
|
+
props.onClick();
|
|
588
|
+
},
|
|
589
|
+
children: content
|
|
590
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
591
|
+
role: "img",
|
|
592
|
+
title: label,
|
|
593
|
+
"aria-label": label,
|
|
594
|
+
className,
|
|
595
|
+
children: content
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
function reasonRequired(waitpoint, approved) {
|
|
599
|
+
const policy = waitpoint.approval?.reasonRequiredOn ?? "none";
|
|
600
|
+
return policy === "both" || policy === "reject" && !approved;
|
|
601
|
+
}
|
|
602
|
+
function errorText(error) {
|
|
603
|
+
return error instanceof Error ? error.message : String(error);
|
|
604
|
+
}
|
|
605
|
+
function ApprovalCard(props) {
|
|
606
|
+
const { waitpoint } = props;
|
|
607
|
+
const { resolveWaitpoint } = useRuntimeActions();
|
|
608
|
+
const reasonId = useId();
|
|
609
|
+
const [reason, setReason] = useState("");
|
|
610
|
+
const [busy, setBusy] = useState(null);
|
|
611
|
+
const [error, setError] = useState(null);
|
|
612
|
+
const approval = waitpoint.approval;
|
|
613
|
+
const stepName = props.stepName ?? waitpoint.stepKey;
|
|
614
|
+
const policy = approval?.reasonRequiredOn ?? "none";
|
|
615
|
+
const expiresIn = waitpoint.expiresAt ? formatUntil(waitpoint.expiresAt) : null;
|
|
616
|
+
const decide = (approved) => {
|
|
617
|
+
const trimmed = reason.trim();
|
|
618
|
+
if (reasonRequired(waitpoint, approved) && !trimmed) {
|
|
619
|
+
setError(`Give a reason to ${approved ? "approve" : "disapprove"} this request.`);
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
setBusy(approved);
|
|
623
|
+
setError(null);
|
|
624
|
+
resolveWaitpoint(waitpoint, approved, trimmed || void 0).then(() => props.onResolved?.()).catch((resolveError) => setError(errorText(resolveError))).finally(() => setBusy(null));
|
|
625
|
+
};
|
|
626
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
627
|
+
"aria-label": `Approval for ${stepName}`,
|
|
628
|
+
className: "overflow-hidden rounded-xl border border-solid border-foreground/10 bg-card",
|
|
629
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
630
|
+
className: "flex items-start gap-3 px-4 py-3.5",
|
|
631
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
632
|
+
"aria-hidden": true,
|
|
633
|
+
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-wf-warn/12 text-wf-warn",
|
|
634
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
635
|
+
name: "clock",
|
|
636
|
+
className: "h-3.5 w-3.5"
|
|
637
|
+
})
|
|
638
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
639
|
+
className: "min-w-0 grow space-y-3",
|
|
640
|
+
children: [
|
|
641
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
642
|
+
className: "text-[13px] font-semibold text-foreground",
|
|
643
|
+
children: approval?.title || `Waiting at ${stepName}`
|
|
644
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
645
|
+
className: "mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-muted-foreground",
|
|
646
|
+
children: [
|
|
647
|
+
props.meta,
|
|
648
|
+
/* @__PURE__ */ jsxs("span", {
|
|
649
|
+
title: formatAbsolute(waitpoint.createdAt),
|
|
650
|
+
children: ["Asked ", formatWhen(waitpoint.createdAt)]
|
|
651
|
+
}),
|
|
652
|
+
waitpoint.expiresAt ? /* @__PURE__ */ jsx("span", {
|
|
653
|
+
title: formatAbsolute(waitpoint.expiresAt),
|
|
654
|
+
className: expiresIn ? void 0 : "text-wf-warn",
|
|
655
|
+
children: expiresIn ? `Expires ${expiresIn}` : "Expired"
|
|
656
|
+
}) : null
|
|
657
|
+
]
|
|
658
|
+
})] }),
|
|
659
|
+
approval?.body ? /* @__PURE__ */ jsx(Suspense, {
|
|
660
|
+
fallback: /* @__PURE__ */ jsx("p", {
|
|
661
|
+
className: "whitespace-pre-wrap text-[13px] text-foreground",
|
|
662
|
+
children: approval.body
|
|
663
|
+
}),
|
|
664
|
+
children: /* @__PURE__ */ jsx(PieceMarkdown, {
|
|
665
|
+
text: approval.body,
|
|
666
|
+
className: "max-w-prose text-[13px] text-foreground"
|
|
667
|
+
})
|
|
668
|
+
}) : null,
|
|
669
|
+
approval && approval.approvers.length > 0 ? /* @__PURE__ */ jsxs("p", {
|
|
670
|
+
className: "text-xs text-muted-foreground",
|
|
671
|
+
title: approval.approvers.join("\n"),
|
|
672
|
+
children: [
|
|
673
|
+
"Only ",
|
|
674
|
+
approval.approvers.length,
|
|
675
|
+
" listed",
|
|
676
|
+
" ",
|
|
677
|
+
approval.approvers.length === 1 ? "approver" : "approvers",
|
|
678
|
+
" can decide."
|
|
679
|
+
]
|
|
680
|
+
}) : null
|
|
681
|
+
]
|
|
682
|
+
})]
|
|
683
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
684
|
+
className: "border-t border-solid border-border bg-muted/40 px-4 py-3",
|
|
685
|
+
children: [
|
|
686
|
+
/* @__PURE__ */ jsxs("label", {
|
|
687
|
+
htmlFor: reasonId,
|
|
688
|
+
className: "mb-1.5 flex items-baseline gap-1.5 text-[13px] font-medium text-foreground",
|
|
689
|
+
children: ["Reason", /* @__PURE__ */ jsx("span", {
|
|
690
|
+
className: "text-xs font-normal text-muted-foreground",
|
|
691
|
+
children: policy === "none" ? "Optional" : policy === "reject" ? "Required to disapprove" : "Required"
|
|
692
|
+
})]
|
|
693
|
+
}),
|
|
694
|
+
/* @__PURE__ */ jsx("textarea", {
|
|
695
|
+
id: reasonId,
|
|
696
|
+
className: `${textAreaClass} min-h-16 resize-y`,
|
|
697
|
+
rows: 2,
|
|
698
|
+
value: reason,
|
|
699
|
+
onChange: (event) => setReason(event.target.value)
|
|
700
|
+
}),
|
|
701
|
+
/* @__PURE__ */ jsxs("div", {
|
|
702
|
+
className: "mt-3 flex flex-wrap items-center justify-end gap-2",
|
|
703
|
+
children: [
|
|
704
|
+
error ? /* @__PURE__ */ jsx("span", {
|
|
705
|
+
role: "alert",
|
|
706
|
+
className: "mr-auto text-xs text-wf-fail",
|
|
707
|
+
children: error
|
|
708
|
+
}) : null,
|
|
709
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
710
|
+
variant: "destructive",
|
|
711
|
+
disabled: busy !== null,
|
|
712
|
+
onClick: () => decide(false),
|
|
713
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
714
|
+
name: "close",
|
|
715
|
+
className: "h-3.5 w-3.5"
|
|
716
|
+
}), busy === false ? "Disapproving…" : approval?.rejectLabel || "Disapprove"]
|
|
717
|
+
}),
|
|
718
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
719
|
+
variant: "primary",
|
|
720
|
+
disabled: busy !== null,
|
|
721
|
+
onClick: () => decide(true),
|
|
722
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
723
|
+
name: "check",
|
|
724
|
+
className: "h-3.5 w-3.5"
|
|
725
|
+
}), busy === true ? "Approving…" : approval?.approveLabel || "Approve"]
|
|
726
|
+
})
|
|
727
|
+
]
|
|
728
|
+
})
|
|
729
|
+
]
|
|
730
|
+
})]
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
function RunWaitpoints(props) {
|
|
734
|
+
const open = props.waitpoints.filter((waitpoint) => waitpoint.status === "PENDING");
|
|
735
|
+
if (open.length === 0) return null;
|
|
736
|
+
return /* @__PURE__ */ jsx("div", {
|
|
737
|
+
className: "space-y-2",
|
|
738
|
+
children: open.map((waitpoint) => waitpoint.kind === "approval" ? /* @__PURE__ */ jsx(ApprovalCard, {
|
|
739
|
+
waitpoint,
|
|
740
|
+
stepName: props.names.get(waitpoint.stepKey),
|
|
741
|
+
onResolved: props.onChanged
|
|
742
|
+
}, waitpoint.id) : /* @__PURE__ */ jsxs("p", {
|
|
743
|
+
className: "flex items-center gap-2 rounded-md bg-wf-warn/10 px-3 py-2 text-[13px] text-wf-warn",
|
|
744
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
745
|
+
name: "clock",
|
|
746
|
+
className: "h-3.5 w-3.5"
|
|
747
|
+
}), waitDescription(waitpoint, props.names.get(waitpoint.stepKey) ?? waitpoint.stepKey)]
|
|
748
|
+
}, waitpoint.id))
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
function CancelRunButton(props) {
|
|
752
|
+
const { cancelRun } = useRuntimeActions();
|
|
753
|
+
const [cancelling, setCancelling] = useState(false);
|
|
754
|
+
const [error, setError] = useState(null);
|
|
755
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Button, {
|
|
756
|
+
variant: "danger",
|
|
757
|
+
disabled: cancelling,
|
|
758
|
+
onClick: () => {
|
|
759
|
+
setCancelling(true);
|
|
760
|
+
setError(null);
|
|
761
|
+
cancelRun(props.run.id).then((result) => setError(cancelFailure(result))).catch((cancelError) => setError(errorText(cancelError))).finally(() => {
|
|
762
|
+
setCancelling(false);
|
|
763
|
+
props.onChanged();
|
|
764
|
+
});
|
|
765
|
+
},
|
|
766
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
767
|
+
name: "close",
|
|
768
|
+
className: "h-3.5 w-3.5"
|
|
769
|
+
}), cancelling ? "Cancelling…" : "Cancel run"]
|
|
770
|
+
}), error ? /* @__PURE__ */ jsx("span", {
|
|
771
|
+
className: "text-wf-fail",
|
|
772
|
+
children: error
|
|
773
|
+
}) : null] });
|
|
774
|
+
}
|
|
775
|
+
function WaitingApprovals(props) {
|
|
776
|
+
const query = useWaitingRunsQuery({
|
|
777
|
+
driveId: props.driveId,
|
|
778
|
+
workflowId: props.workflowId,
|
|
779
|
+
first: 100
|
|
780
|
+
}, { pollMs: WAITING_POLL_MS });
|
|
781
|
+
const entries = (query.data ?? []).flatMap((run) => (run.waitpoints ?? []).filter(isOpenApproval).map((waitpoint) => ({
|
|
782
|
+
run,
|
|
783
|
+
waitpoint
|
|
784
|
+
})));
|
|
785
|
+
const capped = (query.data?.length ?? 0) >= 100;
|
|
786
|
+
const sectionRef = useRef(null);
|
|
787
|
+
const handled = useRef(0);
|
|
788
|
+
const shown = entries.length > 0;
|
|
789
|
+
useEffect(() => {
|
|
790
|
+
const request = props.focusRequest ?? 0;
|
|
791
|
+
if (!shown || request === handled.current) return;
|
|
792
|
+
handled.current = request;
|
|
793
|
+
sectionRef.current?.scrollIntoView({
|
|
794
|
+
behavior: "smooth",
|
|
795
|
+
block: "start"
|
|
796
|
+
});
|
|
797
|
+
sectionRef.current?.focus({ preventScroll: true });
|
|
798
|
+
}, [props.focusRequest, shown]);
|
|
799
|
+
if (!shown) return null;
|
|
800
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
801
|
+
ref: sectionRef,
|
|
802
|
+
tabIndex: -1,
|
|
803
|
+
"aria-label": "Waiting for approval",
|
|
804
|
+
className: "mb-8 scroll-mt-4 focus:outline-none",
|
|
805
|
+
children: [/* @__PURE__ */ jsxs("h2", {
|
|
806
|
+
className: "mb-4 flex items-center gap-2 text-[15px] font-semibold text-foreground",
|
|
807
|
+
children: ["Waiting for approval", /* @__PURE__ */ jsx(ApprovalBadge, {
|
|
808
|
+
count: entries.length,
|
|
809
|
+
capped
|
|
810
|
+
})]
|
|
811
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
812
|
+
className: "space-y-3",
|
|
813
|
+
children: entries.map(({ run, waitpoint }) => {
|
|
814
|
+
const names = props.stepNames.get(run.workflowId);
|
|
815
|
+
return /* @__PURE__ */ jsx(ApprovalCard, {
|
|
816
|
+
waitpoint,
|
|
817
|
+
stepName: names?.get(waitpoint.stepKey),
|
|
818
|
+
onResolved: props.onChanged,
|
|
819
|
+
meta: /* @__PURE__ */ jsxs(Fragment$1, { children: [props.showWorkflow ? /* @__PURE__ */ jsx("span", {
|
|
820
|
+
className: "font-medium text-foreground",
|
|
821
|
+
children: run.workflowName
|
|
822
|
+
}) : null, /* @__PURE__ */ jsxs("span", {
|
|
823
|
+
title: formatAbsolute(run.startedAt),
|
|
824
|
+
children: [
|
|
825
|
+
"Run ",
|
|
826
|
+
/* @__PURE__ */ jsx("span", {
|
|
827
|
+
className: "font-mono",
|
|
828
|
+
children: run.id.slice(0, 8)
|
|
829
|
+
}),
|
|
830
|
+
" ",
|
|
831
|
+
"started ",
|
|
832
|
+
formatWhen(run.startedAt)
|
|
833
|
+
]
|
|
834
|
+
})] })
|
|
835
|
+
}, waitpoint.id);
|
|
836
|
+
})
|
|
837
|
+
})]
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
//#endregion
|
|
529
841
|
//#region editors/workflow-studio/components/RunsTable.tsx
|
|
530
842
|
const STATUS_FILTERS = ["ALL", ...RUN_STATUSES];
|
|
531
843
|
/** The runs table's query params. */
|
|
@@ -749,6 +1061,11 @@ function RunDetail(props) {
|
|
|
749
1061
|
className: "rounded-md bg-wf-fail/10 px-3 py-2 text-[13px] text-wf-fail",
|
|
750
1062
|
children: describeRunError(run.error, names)
|
|
751
1063
|
}) : null,
|
|
1064
|
+
run.waitpoints ? /* @__PURE__ */ jsx(RunWaitpoints, {
|
|
1065
|
+
waitpoints: run.waitpoints,
|
|
1066
|
+
names,
|
|
1067
|
+
onChanged: props.onChanged
|
|
1068
|
+
}) : null,
|
|
752
1069
|
run.warningNotes.length > 0 ? /* @__PURE__ */ jsx("ul", {
|
|
753
1070
|
"aria-label": "Run warnings",
|
|
754
1071
|
className: "space-y-1 rounded-md bg-wf-warn/10 px-3 py-2 text-[13px] text-wf-warn",
|
|
@@ -785,6 +1102,13 @@ function RunDetail(props) {
|
|
|
785
1102
|
rerunError ? /* @__PURE__ */ jsx("span", {
|
|
786
1103
|
className: "text-wf-fail",
|
|
787
1104
|
children: rerunError
|
|
1105
|
+
}) : null,
|
|
1106
|
+
run.status === "WAITING" ? /* @__PURE__ */ jsx("span", {
|
|
1107
|
+
className: "ml-auto flex items-center gap-2",
|
|
1108
|
+
children: /* @__PURE__ */ jsx(CancelRunButton, {
|
|
1109
|
+
run,
|
|
1110
|
+
onChanged: props.onChanged
|
|
1111
|
+
})
|
|
788
1112
|
}) : null
|
|
789
1113
|
]
|
|
790
1114
|
}),
|
|
@@ -867,6 +1191,7 @@ function RunsTable(props) {
|
|
|
867
1191
|
const counts = useMemo(() => ({
|
|
868
1192
|
ALL: scoped.length,
|
|
869
1193
|
RUNNING: scoped.filter((run) => run.status === "RUNNING").length,
|
|
1194
|
+
WAITING: scoped.filter((run) => run.status === "WAITING").length,
|
|
870
1195
|
SUCCEEDED: scoped.filter((run) => run.status === "SUCCEEDED").length,
|
|
871
1196
|
FAILED: scoped.filter((run) => run.status === "FAILED").length
|
|
872
1197
|
}), [scoped]);
|
|
@@ -1556,24 +1881,33 @@ function NodeRow(props) {
|
|
|
1556
1881
|
keyShortcuts: props.keyShortcuts,
|
|
1557
1882
|
trailing: /* @__PURE__ */ jsxs("span", {
|
|
1558
1883
|
className: "mr-1.5 flex shrink-0 items-center",
|
|
1559
|
-
children: [
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1884
|
+
children: [
|
|
1885
|
+
/* @__PURE__ */ jsx(ApprovalBadge, {
|
|
1886
|
+
count: props.approvals ?? 0,
|
|
1887
|
+
capped: props.approvalsCapped ?? false,
|
|
1888
|
+
onClick: props.onShowApprovals,
|
|
1889
|
+
className: "mr-0.5"
|
|
1890
|
+
}),
|
|
1891
|
+
props.onEdit ? /* @__PURE__ */ jsx("button", {
|
|
1892
|
+
type: "button",
|
|
1893
|
+
title: "Open in editor",
|
|
1894
|
+
"aria-label": `Open ${documentName(document, node.name)} in the editor`,
|
|
1895
|
+
className: ROW_ACTION,
|
|
1896
|
+
onClick: props.onEdit,
|
|
1897
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
1898
|
+
name: "pencil",
|
|
1899
|
+
className: "h-3.5 w-3.5"
|
|
1900
|
+
})
|
|
1901
|
+
}) : null,
|
|
1902
|
+
isWorkflow && document ? /* @__PURE__ */ jsx(WorkflowMenu, {
|
|
1903
|
+
subtle: true,
|
|
1904
|
+
document,
|
|
1905
|
+
nodeName: node.name
|
|
1906
|
+
}) : /* @__PURE__ */ jsx(DeleteButton, {
|
|
1907
|
+
node,
|
|
1908
|
+
label: documentName(document, node.name)
|
|
1568
1909
|
})
|
|
1569
|
-
|
|
1570
|
-
subtle: true,
|
|
1571
|
-
document,
|
|
1572
|
-
nodeName: node.name
|
|
1573
|
-
}) : /* @__PURE__ */ jsx(DeleteButton, {
|
|
1574
|
-
node,
|
|
1575
|
-
label: documentName(document, node.name)
|
|
1576
|
-
})]
|
|
1910
|
+
]
|
|
1577
1911
|
}),
|
|
1578
1912
|
children: [/* @__PURE__ */ jsx("span", {
|
|
1579
1913
|
title: label,
|
|
@@ -1664,6 +1998,9 @@ function Section(props) {
|
|
|
1664
1998
|
/* @__PURE__ */ jsx(NodeRow, {
|
|
1665
1999
|
node,
|
|
1666
2000
|
lastRunStatus: props.lastRuns?.get(node.id),
|
|
2001
|
+
approvals: props.approvals?.byWorkflow.get(node.id),
|
|
2002
|
+
approvalsCapped: props.approvals?.capped,
|
|
2003
|
+
onShowApprovals: props.onShowApprovals ? () => props.onShowApprovals(node) : void 0,
|
|
1667
2004
|
active: props.activeId === node.id,
|
|
1668
2005
|
onOpen: () => props.onOpen(node),
|
|
1669
2006
|
onEdit: props.onEdit ? () => props.onEdit(node) : void 0,
|
|
@@ -1692,6 +2029,12 @@ function Sidebar(props) {
|
|
|
1692
2029
|
/* @__PURE__ */ jsxs(Row, {
|
|
1693
2030
|
active: props.allRunsActive,
|
|
1694
2031
|
onClick: props.onShowAllRuns,
|
|
2032
|
+
trailing: /* @__PURE__ */ jsx(ApprovalBadge, {
|
|
2033
|
+
count: props.approvals.total,
|
|
2034
|
+
capped: props.approvals.capped,
|
|
2035
|
+
onClick: () => props.onShowApprovals(),
|
|
2036
|
+
className: "mr-2"
|
|
2037
|
+
}),
|
|
1695
2038
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1696
2039
|
name: "list",
|
|
1697
2040
|
className: "text-muted-foreground"
|
|
@@ -1703,6 +2046,8 @@ function Sidebar(props) {
|
|
|
1703
2046
|
empty: "No workflows yet.",
|
|
1704
2047
|
nodes: props.workflows,
|
|
1705
2048
|
lastRuns: props.lastRuns,
|
|
2049
|
+
approvals: props.approvals,
|
|
2050
|
+
onShowApprovals: (node) => props.onShowApprovals(node.id),
|
|
1706
2051
|
activeId: props.activeId,
|
|
1707
2052
|
onOpen: props.onOpenWorkflow,
|
|
1708
2053
|
onEdit: props.onEditWorkflow,
|
|
@@ -2312,6 +2657,7 @@ function summary(rows) {
|
|
|
2312
2657
|
return parts.join(", ");
|
|
2313
2658
|
}
|
|
2314
2659
|
function WorkflowBoard(props) {
|
|
2660
|
+
const { approvals, onShowApprovals } = props;
|
|
2315
2661
|
usePieceLogos();
|
|
2316
2662
|
const { isCollapsed, toggle } = useCollapsed();
|
|
2317
2663
|
const documents = useWorkflowDocumentsInSelectedDrive() ?? [];
|
|
@@ -2338,9 +2684,17 @@ function WorkflowBoard(props) {
|
|
|
2338
2684
|
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
|
|
2339
2685
|
className: "text-2xl font-semibold tracking-tight text-foreground",
|
|
2340
2686
|
children: "Workflows"
|
|
2341
|
-
}), /* @__PURE__ */
|
|
2342
|
-
className: "mt-1 text-[13px] text-muted-foreground",
|
|
2343
|
-
children: rows.length === 0 ? "Automations in this drive" : summary(rows)
|
|
2687
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
2688
|
+
className: "mt-1 flex flex-wrap items-center gap-2 text-[13px] text-muted-foreground",
|
|
2689
|
+
children: [rows.length === 0 ? "Automations in this drive" : summary(rows), approvals && approvals.total > 0 ? /* @__PURE__ */ jsxs("button", {
|
|
2690
|
+
type: "button",
|
|
2691
|
+
className: "inline-flex items-center gap-1 rounded-full bg-wf-warn/12 px-2 py-0.5 text-xs font-medium text-wf-warn hover:bg-wf-warn/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2692
|
+
onClick: () => onShowApprovals?.(),
|
|
2693
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
2694
|
+
name: "clock",
|
|
2695
|
+
className: "h-3 w-3"
|
|
2696
|
+
}), approvalCountLabel(approvals.total, approvals.capped)]
|
|
2697
|
+
}) : null]
|
|
2344
2698
|
})] }), /* @__PURE__ */ jsxs(Button, {
|
|
2345
2699
|
variant: "primary",
|
|
2346
2700
|
disabled: props.creating,
|
|
@@ -2446,7 +2800,15 @@ function WorkflowBoard(props) {
|
|
|
2446
2800
|
})]
|
|
2447
2801
|
}), /* @__PURE__ */ jsxs("span", {
|
|
2448
2802
|
className: "mt-4 flex h-6 shrink-0 items-center gap-1 pr-3",
|
|
2449
|
-
children: [
|
|
2803
|
+
children: [
|
|
2804
|
+
/* @__PURE__ */ jsx(ApprovalBadge, {
|
|
2805
|
+
count: approvals?.byWorkflow.get(row.id) ?? 0,
|
|
2806
|
+
capped: approvals?.capped ?? false,
|
|
2807
|
+
onClick: onShowApprovals ? () => onShowApprovals(row.id) : void 0
|
|
2808
|
+
}),
|
|
2809
|
+
/* @__PURE__ */ jsx(RowToggle, { document: row.document }),
|
|
2810
|
+
/* @__PURE__ */ jsx(WorkflowMenu, { document: row.document })
|
|
2811
|
+
]
|
|
2450
2812
|
})]
|
|
2451
2813
|
}), collapsed ? null : /* @__PURE__ */ jsxs("button", {
|
|
2452
2814
|
type: "button",
|
|
@@ -2807,11 +3169,18 @@ function Studio(props) {
|
|
|
2807
3169
|
]);
|
|
2808
3170
|
const focusedWorkflow = liveTarget;
|
|
2809
3171
|
const driveFeed = useRuns({ driveId });
|
|
3172
|
+
const approvals = usePendingApprovals(driveId);
|
|
3173
|
+
const [waitingFocus, setWaitingFocus] = useState(0);
|
|
3174
|
+
const showApprovals = (workflowId) => {
|
|
3175
|
+
go(workflowId);
|
|
3176
|
+
setWaitingFocus((request) => request + 1);
|
|
3177
|
+
};
|
|
2810
3178
|
const workflowFeed = useRuns({ workflowId: focusedWorkflow?.id }, Boolean(focusedWorkflow));
|
|
2811
3179
|
const feed = focusedWorkflow ? workflowFeed : driveFeed;
|
|
2812
3180
|
const { runs, error: runsError, reload: reloadRuns } = feed;
|
|
2813
3181
|
const lastRuns = /* @__PURE__ */ new Map();
|
|
2814
3182
|
for (const run of driveFeed.runs ?? []) if (!lastRuns.has(run.workflowId)) lastRuns.set(run.workflowId, run.status);
|
|
3183
|
+
const stepNames = new Map(workflowDocuments.map((document) => [document.header.id, new Map(document.state.global.steps.map((step) => [step.key, step.name || step.key]))]));
|
|
2815
3184
|
const { data: targetDocument } = useDocumentSafe(liveTarget?.id ?? null);
|
|
2816
3185
|
const targetTrigger = targetDocument?.header.documentType === WORKFLOW_TYPE ? targetDocument.state.global.trigger : null;
|
|
2817
3186
|
const manualTrigger = Boolean(targetTrigger && sameBlock(triggerBlock(targetTrigger), MANUAL_TRIGGER));
|
|
@@ -2824,6 +3193,8 @@ function Studio(props) {
|
|
|
2824
3193
|
workflows,
|
|
2825
3194
|
connections,
|
|
2826
3195
|
lastRuns,
|
|
3196
|
+
approvals,
|
|
3197
|
+
onShowApprovals: showApprovals,
|
|
2827
3198
|
activeId: selectedId,
|
|
2828
3199
|
allRunsActive: !selectedId,
|
|
2829
3200
|
creating,
|
|
@@ -2849,29 +3220,42 @@ function Studio(props) {
|
|
|
2849
3220
|
})
|
|
2850
3221
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
2851
3222
|
className: "mx-auto w-full max-w-6xl px-4 py-6 md:px-8 md:py-10",
|
|
2852
|
-
children: [
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
3223
|
+
children: [
|
|
3224
|
+
liveTarget ? /* @__PURE__ */ jsx(WorkflowHeader, {
|
|
3225
|
+
node: liveTarget,
|
|
3226
|
+
runs,
|
|
3227
|
+
onEdit: () => go(liveTarget.id, liveTarget.id),
|
|
3228
|
+
onDeleted: () => select(void 0, { replace: true })
|
|
3229
|
+
}, liveTarget.id) : /* @__PURE__ */ jsx(WorkflowBoard, {
|
|
3230
|
+
runs,
|
|
3231
|
+
order: workflows.map((node) => node.id),
|
|
3232
|
+
creating,
|
|
3233
|
+
onOpen: (workflowId) => go(workflowId),
|
|
3234
|
+
approvals,
|
|
3235
|
+
onShowApprovals: showApprovals,
|
|
3236
|
+
onCreate: () => create(WORKFLOW_TYPE, "Workflow", workflows.length)
|
|
3237
|
+
}),
|
|
3238
|
+
/* @__PURE__ */ jsx(WaitingApprovals, {
|
|
3239
|
+
driveId: liveTarget ? void 0 : driveId,
|
|
3240
|
+
workflowId: liveTarget?.id,
|
|
3241
|
+
showWorkflow: liveTarget === null,
|
|
3242
|
+
stepNames,
|
|
3243
|
+
onChanged: reloadRuns,
|
|
3244
|
+
focusRequest: waitingFocus
|
|
3245
|
+
}),
|
|
3246
|
+
/* @__PURE__ */ jsx(RunsView, {
|
|
3247
|
+
title: liveTarget ? "Runs" : "Recent runs",
|
|
3248
|
+
runs,
|
|
3249
|
+
error: runsError,
|
|
3250
|
+
reload: reloadRuns,
|
|
3251
|
+
showWorkflow: liveTarget === null,
|
|
3252
|
+
hasMore: feed.hasMore,
|
|
3253
|
+
loadingMore: feed.loadingMore,
|
|
3254
|
+
onLoadMore: feed.loadMore,
|
|
3255
|
+
onFire: liveTarget && manualTrigger ? (payload) => fireWorkflow(liveTarget.id, payload).then((result) => result.error) : void 0,
|
|
3256
|
+
fireInputs
|
|
3257
|
+
})
|
|
3258
|
+
]
|
|
2875
3259
|
})
|
|
2876
3260
|
})]
|
|
2877
3261
|
});
|
|
@@ -2899,4 +3283,4 @@ function Editor(props) {
|
|
|
2899
3283
|
//#endregion
|
|
2900
3284
|
export { Editor as default };
|
|
2901
3285
|
|
|
2902
|
-
//# sourceMappingURL=editor-
|
|
3286
|
+
//# sourceMappingURL=editor-BmRWQvRs.mjs.map
|