@fluidgrids/fe-sdk 0.0.0-stage → 2026.1203.7
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 +564 -2
- package/dist/ActivityOptionsFields-C2u-hY2U.js +142 -0
- package/dist/AiStudioPage-B_hNTj-_.js +1137 -0
- package/dist/ApprovalInboxPage-ClITra3n.js +1312 -0
- package/dist/ChoiceSelect-LkK-uS9J.js +65 -0
- package/dist/ConfirmActionDialog-DHWTDRbp.js +31 -0
- package/dist/ConnectionFormDialog-C0kDgcrZ.js +153 -0
- package/dist/CreateFluidgridsTagDocument-Dtp9KPLJ.js +1055 -0
- package/dist/DataSinkDashboardPage-b4ezeqa6.js +278 -0
- package/dist/DataTablesPage-C1d9YGHz.js +5575 -0
- package/dist/DateTimeField-B1qR4ruo.js +51 -0
- package/dist/Disclosure-BNKij7-v.js +45 -0
- package/dist/ElementLibraryPage-8jNO6YmE.js +2256 -0
- package/dist/ElementLibrarySequenceDocument-B-W8SPzn.js +3979 -0
- package/dist/EnsureThemeProvider-BvlNjAd0.js +24 -0
- package/dist/EntityTagBadge-1OlP6p0c.js +25 -0
- package/dist/EntityTagPicker-BBrU5cE0.js +137 -0
- package/dist/ExecuteStepDocument-B4j1mdRT.js +189 -0
- package/dist/ExecutionDetailDocument-D6QuM-kp.js +875 -0
- package/dist/ExecutionDetailPage-D4CBtFdo.js +12217 -0
- package/dist/ExecutionDetailPage-DvQ667OE.d.ts +10 -0
- package/dist/ExecutionStatusBadge-BsDVor9t.js +221 -0
- package/dist/ExecutionsListDocument-Dan7ZiqB.js +459 -0
- package/dist/ExecutionsListPage-B3XT8ITL.js +4307 -0
- package/dist/FailureTriagePanel-DOJMaJ0n.js +1285 -0
- package/dist/FileDownloadUrlDocument-CVOYKcL5.js +92 -0
- package/dist/FluidGridsDocsLink-bX0Hnhxr.js +66 -0
- package/dist/FluidGridsMark-CE2blT7K.js +74 -0
- package/dist/HeldLoadRegion-BtTxbvOW.js +34 -0
- package/dist/HistoryPage-BLoRpJ1R.d.ts +6 -0
- package/dist/HistoryPage-BSBISXoj.js +2835 -0
- package/dist/Icon-BtQ0HXLh.js +160 -0
- package/dist/InsightsPage-D7ybj8N9.js +11245 -0
- package/dist/IsolationSetting-vy911E8b.js +1153 -0
- package/dist/LibraryParts-DOeNgR8A.js +413 -0
- package/dist/ManagedAiPolicyAuthority-BxwJ3ptd.js +40 -0
- package/dist/ManagedAiPolicyAuthority-DM3t3wNr.d.ts +18 -0
- package/dist/ManagedAiPolicyAuthorityContext-CNkxIOZ1.js +10 -0
- package/dist/McpTriggerServers-BCPCAOWB.js +459 -0
- package/dist/MissingNodesInstallModal-rO_SEDrC.js +224 -0
- package/dist/NavigationV2Provider-DCDt35eG.js +17 -0
- package/dist/NodeSchemaIntrospectionDocument-C1vAIcHd.js +95 -0
- package/dist/NodesPage-DEbnz9iU.d.ts +6 -0
- package/dist/NodesPage-O7KeeKtd.js +653 -0
- package/dist/OfflineIcon-TwMKYWjA.js +207 -0
- package/dist/OpenTemplateAsCodeButton-BhWJWIF3.js +94 -0
- package/dist/PaidTemplateConfirm-_G3ag6S4.js +28 -0
- package/dist/PublishCustomNodeAction-CIySbK4c.js +134 -0
- package/dist/RecordTaskDialog-BkpCDvhR.js +2078 -0
- package/dist/RunActionsMenu-DodOgIQm.js +59 -0
- package/dist/RunnerStatusPill-C1v967iq.js +24 -0
- package/dist/RunnersPage-dB0RSdY_.js +1929 -0
- package/dist/SandboxRuntimeExhaustedNotice-BFOIF93C.js +120 -0
- package/dist/SchedulesPage-DPWr1yvf.js +1607 -0
- package/dist/SearchBox-BGtYjvfs.js +49 -0
- package/dist/SequenceEditor-CFiHeHkR.js +497 -0
- package/dist/SettingsPage-0CQBNPZV.js +8695 -0
- package/dist/StewardPages-DAJhepen.js +47 -0
- package/dist/StewardRunImportPanel-Kva2DO0u.js +2844 -0
- package/dist/StoreTemplateCardCompact-CHn5kP7A.js +2166 -0
- package/dist/TagFilterSelect-CyA8QrS7.js +42 -0
- package/dist/TaskQueuesPage-DdnDCyat.js +3571 -0
- package/dist/TechnicalDetails-B0Oi4aZw.js +19 -0
- package/dist/TemplateConfigurationModal-CdvCYJLM.js +332 -0
- package/dist/TemplateDetailPanel-CbiKciuB.js +222 -0
- package/dist/TemplatePreview-cx7-NOeG.js +868 -0
- package/dist/TemplatesPage-BG3H-6v6.d.ts +10 -0
- package/dist/TemplatesPage-BVQpGYIV.js +3251 -0
- package/dist/TerminateExecutionDocument-B_HKNVrN.js +581 -0
- package/dist/TranslationBridge-Bd4aJKMs.d.ts +11 -0
- package/dist/TranslationBridge-Da-TPgQm.js +68 -0
- package/dist/TriggerWorkflowDocument-D9Km2Vv2.js +460 -0
- package/dist/UiSequencePickerSequenceDocument-BSYnSDV7.js +607 -0
- package/dist/UiStepScreenshot-Qh4QMyUp.js +146 -0
- package/dist/UsageTimeSeriesDocument-DcInx9-z.js +177 -0
- package/dist/VariablesPage-ChfGuW22.js +2243 -0
- package/dist/VersionDiffDialog-Bd2AeUwf.js +1702 -0
- package/dist/VersionLifecycleBar-BBeWVtz-.js +143 -0
- package/dist/WebhookDeliveriesPage-D66bua0j.js +1563 -0
- package/dist/WorkflowBuilder-B6wQD1TK.js +539 -0
- package/dist/WorkflowBuilder-DR4ku8Tr.js +1611 -0
- package/dist/WorkflowDefinitionDocument-DZLbTPUZ.js +321 -0
- package/dist/WorkflowEmbed-BXfFGy0i.js +708 -0
- package/dist/WorkflowEmbed-Cbqe1s1z.d.ts +6 -0
- package/dist/WorkflowPinnedDataDocument-BODT5omd.js +782 -0
- package/dist/WorkflowProposalCard-BruukdeF.js +96 -0
- package/dist/WorkflowProposalDocument-BdUbsrd0.js +620 -0
- package/dist/WorkflowSearchRedirect-C7zJ2MKH.js +40 -0
- package/dist/WorkflowSettingsDrawer-MVU1BKfY.d.ts +18 -0
- package/dist/WorkflowSettingsDrawer-gazs97WR.js +196 -0
- package/dist/WorkflowShareDialog-e8jJtLjU.js +469 -0
- package/dist/WorkflowVersionsDocument-DRVOp8Uj.js +3213 -0
- package/dist/WorkflowsList--hR2_8gf.js +4593 -0
- package/dist/WorkflowsList-CcNDQge5.d.ts +6 -0
- package/dist/WorkflowsListPageDocument-CnzcQm_o.js +934 -0
- package/dist/addonCatalog-CbZS4deh.js +58 -0
- package/dist/addonCatalog-sjlonAmR.d.ts +15 -0
- package/dist/addons.d.ts +3 -0
- package/dist/addons.js +4 -0
- package/dist/agent-form-Bfvm32j1.js +83 -0
- package/dist/agent-tools.d.ts +3 -0
- package/dist/agent-tools.js +5 -0
- package/dist/agentTools-CyL7DLOF.js +320 -0
- package/dist/ai-usage-BrxDgvdR.js +240 -0
- package/dist/aiCreditsBridge-BuE92tKo.js +49 -0
- package/dist/api-BKq-nIOZ.js +2286 -0
- package/dist/api-Ol7I8NxE.js +8289 -0
- package/dist/apollo-type-policies.d.ts +11 -0
- package/dist/apollo-type-policies.js +64 -0
- package/dist/askAboutBridge-ByYsQams.js +106 -0
- package/dist/askQuestions-Cmx7VnMm.js +742 -0
- package/dist/assert-rules-lfYEMc99.js +318 -0
- package/dist/assistant.d.ts +94 -0
- package/dist/assistant.js +99 -0
- package/dist/attach-node-helpers-HDKQOtrD.js +32 -0
- package/dist/badge-CXfPhoMH.js +26 -0
- package/dist/basil.generated-BK-EHbwN.js +10 -0
- package/dist/browser-steps-DMpS5TyB.js +533 -0
- package/dist/builderTimings-pvGnK1m-.js +510 -0
- package/dist/button-DG7y_FVJ.js +48 -0
- package/dist/canvasNoteTools-BxuP_AYO.js +137 -0
- package/dist/card-Bomy_1UG.js +44 -0
- package/dist/catalogGrid-BOrfMgi-.js +41 -0
- package/dist/channel-CPyQ1NR1.js +212 -0
- package/dist/chips-CvNrYJZa.js +27 -0
- package/dist/client-holder-C0M5Cfwl.js +68 -0
- package/dist/cn-QqidFIgr.js +10 -0
- package/dist/code-editor-diagnostics-Zr0cIcx1.js +46 -0
- package/dist/code-editor-field-x_JrY8KR.js +113 -0
- package/dist/codec-client-DPuD6mw7.js +515 -0
- package/dist/conditionBuilder-DwfEF0Q-.js +1144 -0
- package/dist/config-DO68jw5k.js +322 -0
- package/dist/constants-DgbVc24O.d.ts +296 -0
- package/dist/constants-DlRnHBfQ.js +217 -0
- package/dist/convert-browser-action-pfecelF7.js +347 -0
- package/dist/convert-dialog-B_o22NiJ.js +382 -0
- package/dist/create-workflow-first-Azg3JUdX.js +120 -0
- package/dist/definition-canvas-Bsda-rDT.js +31 -0
- package/dist/dialog-BVd152GS.js +94 -0
- package/dist/durable-nodes-BXyYCLxT.js +91 -0
- package/dist/duration-CDb7-mT_.js +33 -0
- package/dist/edge-mapper-wEAdGVU2.js +4477 -0
- package/dist/element-library-DkSlg_VE.js +727 -0
- package/dist/entities-I_0kio3q.js +38 -0
- package/dist/error-advice-QLr5NCm7.js +65 -0
- package/dist/errors-ClKb5sEt.js +188 -0
- package/dist/executions.d.ts +3 -0
- package/dist/executions.js +5 -0
- package/dist/feature-flags-B2qetXKd.js +385 -0
- package/dist/field-label-DPZRmE_B.js +153 -0
- package/dist/firstWorkflow-C_h0KMB2.js +133 -0
- package/dist/flags.d.ts +3 -0
- package/dist/flags.js +4 -0
- package/dist/flow-builder-DIvLOhz0.js +28038 -0
- package/dist/flow-store-holder-CUN7Terz.js +52 -0
- package/dist/fluent.generated-CA_e6-4l.js +14 -0
- package/dist/fluidgridsEvents-bbEQbwU6.js +175 -0
- package/dist/fluidgridsTheme-DUhvOgoy.js +297 -0
- package/dist/global-client-BQPuFrFa.js +433 -0
- package/dist/global-operations-BG6YgxrM.js +136 -0
- package/dist/graphql-types-UTYtujY9.js +21358 -0
- package/dist/history.d.ts +3 -0
- package/dist/history.js +4 -0
- package/dist/index-AoJAa5vU.d.ts +164958 -0
- package/dist/index-DEMT3iAM.d.ts +120 -0
- package/dist/index-ROZzNGyY.d.ts +76 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +8123 -0
- package/dist/ion.generated-mbajjcAg.js +10 -0
- package/dist/label-Lzb8ZXf_.js +29 -0
- package/dist/labels-rXd9gYQz.js +1236 -0
- package/dist/liveCanvas-D5ytXDp8.js +103 -0
- package/dist/logos.generated-X6_0kjVR.js +21 -0
- package/dist/logs-panel-Cw0DkG0l.js +468 -0
- package/dist/lucide.generated-B6NVd3GT.js +29 -0
- package/dist/marksStore-a9oIMMot.js +175 -0
- package/dist/mcp-trigger-D0nRdvq5.js +307 -0
- package/dist/mdi.generated-D1BV74d6.js +292 -0
- package/dist/menus-CU3hDGYl.js +160 -0
- package/dist/mynaui.generated-DMWr5cXz.js +66 -0
- package/dist/navigation-v2.d.ts +3 -0
- package/dist/navigation-v2.js +5 -0
- package/dist/node-detail-view-Cgm5H1P-.js +1372 -0
- package/dist/node-editor-tab-body-CZ0fVuVP.js +187 -0
- package/dist/node-operation-selection-CdV3KI_V.js +3534 -0
- package/dist/node-registry-refresh-s3okf83X.js +27 -0
- package/dist/node-role-TMbnkmeP.js +132 -0
- package/dist/node-type-icon-BZa8n4iG.js +33 -0
- package/dist/nodes.d.ts +3 -0
- package/dist/nodes.js +4 -0
- package/dist/notesKey-5EaREBGA.js +12 -0
- package/dist/observability.d.ts +3 -0
- package/dist/observability.js +5 -0
- package/dist/offset-pages-zghoClB3.js +55 -0
- package/dist/operations-BBmT9ToP.js +663 -0
- package/dist/operations-WxRJWeqO.js +3133 -0
- package/dist/output-files-Ba8bu5lv.js +196 -0
- package/dist/page-operation-DrWuhd6Y.js +129 -0
- package/dist/page-twins.d.ts +13 -0
- package/dist/page-twins.js +186 -0
- package/dist/pageControlSpecs-DZJ9K37m.js +134 -0
- package/dist/pageControlsBridge-0pX9s-3k.js +54 -0
- package/dist/pageControlsBridge-DAuT3w7L.d.ts +36 -0
- package/dist/panels-PfBBAToE.js +346 -0
- package/dist/parts-B7fBcw-B.js +346 -0
- package/dist/popover-Dms9Vz3j.js +3389 -0
- package/dist/preloadable-lazy-Pp47mqQ9.js +65 -0
- package/dist/proactive.d.ts +66 -0
- package/dist/proactive.js +237 -0
- package/dist/quick-config-panel-DFd77xho.js +451 -0
- package/dist/quota-DeA_CJ2e.js +175 -0
- package/dist/quota.d.ts +3 -0
- package/dist/quota.js +4 -0
- package/dist/read-only-context-Dt9N9SIG.js +18 -0
- package/dist/relative-time-Dxt8ZIIu.js +55 -0
- package/dist/results-CwK_yDxK.js +325 -0
- package/dist/rolldown-runtime-hDbaFkMy.js +18 -0
- package/dist/route-data.d.ts +12 -0
- package/dist/route-data.js +69 -0
- package/dist/route-match-C-0_EnAt.d.ts +5 -0
- package/dist/route-match-DMkUICYV.js +41 -0
- package/dist/route-preload-C4DlGoCd.js +120 -0
- package/dist/run-display-UjLAoYqQ.js +81 -0
- package/dist/run-history-arGiHzGU.js +285 -0
- package/dist/run-list-links-DJn4Mf1T.js +98 -0
- package/dist/run-mode-USmM0-Uo.js +82 -0
- package/dist/run-parity-CWXqEJqM.js +144 -0
- package/dist/runsQuota-B6SyTbne.js +100 -0
- package/dist/runsQuota-DsniKiSg.d.ts +20 -0
- package/dist/safe-expression-Cw7-SCsm.js +1251 -0
- package/dist/save-status-store-C7nEYpfb.js +631 -0
- package/dist/schedule-panel-B4GYXzXQ.js +13774 -0
- package/dist/schedule-rules-ggVKRkBH.js +358 -0
- package/dist/secrets-Re_wSiE3.js +153 -0
- package/dist/settings.d.ts +4 -0
- package/dist/settings.js +6 -0
- package/dist/shared-DAWGGMSM.js +177 -0
- package/dist/sidebar-node-editor-6eSSgCzc.js +178 -0
- package/dist/solar.generated-CGYuUQAC.js +10 -0
- package/dist/stableTabbedDialog-BBhrfXGe.js +20 -0
- package/dist/start-url-CT6Yz96K.js +24 -0
- package/dist/status-CessxGpm.js +55 -0
- package/dist/store-icon-OctYp5zP.js +155 -0
- package/dist/styles-WGmTnZ2n.js +26 -0
- package/dist/styles.css +139 -0
- package/dist/svg-spinners.generated-CIPT7IhM.js +10 -0
- package/dist/template-code-CzN6JWNV.js +191 -0
- package/dist/template-graph-DLF9dygU.js +20 -0
- package/dist/template-preview-DcIIKOOL.js +32 -0
- package/dist/template-price-CdUHZRMF.js +40 -0
- package/dist/templates.d.ts +3 -0
- package/dist/templates.js +5 -0
- package/dist/theme-provider-CntfC4_i.js +23 -0
- package/dist/transient-DgZfhDfN.js +57 -0
- package/dist/typed-calls-C5tO03wq.js +26 -0
- package/dist/ui-script-By74Guk3.js +1094 -0
- package/dist/ui-script-editor-CqPu2bCN.js +2447 -0
- package/dist/ui-step-fix-8uM2_Hft.js +67 -0
- package/dist/ui-step-fix-store-CcO1FdRx.js +19 -0
- package/dist/ui-step-run-context-o7bLE6KP.js +46 -0
- package/dist/ui-target-editor-D2JhB_lD.js +673 -0
- package/dist/uiMarkTools-CSznnO1i.js +1054 -0
- package/dist/upgradePrompt-BAFBKKW5.js +72 -0
- package/dist/use-bare-node-registry-O6mKJO_n.js +11498 -0
- package/dist/use-browser-available-hj8wc3Kb.js +241 -0
- package/dist/use-edge-mapper-schemas-Bonofxow.js +496 -0
- package/dist/use-extension-bridge-B9ZreOkQ.js +608 -0
- package/dist/use-mobile-BTqCUjzS.js +27 -0
- package/dist/use-sdk-query-C697xZVv.js +116 -0
- package/dist/use-workflow-code-editor-CFoRFrZ5.js +753 -0
- package/dist/useActionParam-B2tU2BlY.js +85 -0
- package/dist/useAgentTokenStream-Bko_J0d0.js +4217 -0
- package/dist/useBrowserClients-3v95-gSh.js +103 -0
- package/dist/useCodeWorkflowInsights-w0tz9Ap_.js +600 -0
- package/dist/useConnections-DsgEJs05.js +439 -0
- package/dist/useDebouncedValue-BFekcv6n.js +18 -0
- package/dist/useDurableParity-8fnMZmBc.js +1787 -0
- package/dist/useEntityTags-D0spL6Ut.js +460 -0
- package/dist/useExecutions-2u5nGJJk.js +681 -0
- package/dist/useFluidGridsAnalytics-VM8lAi2x.js +238 -0
- package/dist/useGlobalStoreClient-BTdhkA2I.js +24 -0
- package/dist/useHumanRequests-zlYDp3l1.js +221 -0
- package/dist/useNavigationV2-C2WeqN7d.js +29 -0
- package/dist/useNavigationV2-DANUmg12.d.ts +9 -0
- package/dist/useObservability-BRlQ0tOA.js +285 -0
- package/dist/useRequestedProposal-B7uPXfZB.js +51 -0
- package/dist/useRunHistory-CXCMUPyf.js +2759 -0
- package/dist/useRunLive-D0JvVZT2.js +1060 -0
- package/dist/useRunnerList-Dbi59i1K.js +446 -0
- package/dist/useRunners-URUc5quU.js +173 -0
- package/dist/useRunsPage-DG656UCK.js +2709 -0
- package/dist/useVariables-BIelxcWr.js +463 -0
- package/dist/useVersionHistoryData-CTjqVw7l.js +292 -0
- package/dist/useWorkflowCodeExport-pqxyLHD1.js +522 -0
- package/dist/useWorkflowListExport-hcZNvTaB.js +232 -0
- package/dist/useWorkflowOrganization-CpBbOrs7.js +1772 -0
- package/dist/useWorkflowProposal-BH0VdNMA.js +3280 -0
- package/dist/useWorkflows-Cvg-Z_IE.js +1606 -0
- package/dist/utils-fvBb5qOD.js +89 -0
- package/dist/webhook-deliveries-AvQujaZy.js +99 -0
- package/dist/workflow-builder-CJygVkVv.d.ts +2 -0
- package/dist/workflow-builder.d.ts +3 -0
- package/dist/workflow-builder.js +8 -0
- package/dist/workflow-code-transfer-Bsy0JKAZ.js +323 -0
- package/dist/workflow-embed.d.ts +3 -0
- package/dist/workflow-embed.js +4 -0
- package/dist/workflow-git-sync--K9ZsPDC.js +263 -0
- package/dist/workflow-host.d.ts +6 -0
- package/dist/workflow-host.js +11 -0
- package/dist/workflow-pages-D-7ByLTB.d.ts +68 -0
- package/dist/workflow-pages.d.ts +3 -0
- package/dist/workflow-pages.js +115 -0
- package/dist/workflow-preview-canvas-CO8yzdE3.js +848 -0
- package/dist/workflow-preview.d.ts +65 -0
- package/dist/workflow-preview.js +4 -0
- package/dist/workflow-route.d.ts +33 -0
- package/dist/workflow-route.js +4 -0
- package/dist/workflow-save-state-D0l-DkLf.js +767 -0
- package/dist/workflow-transfer-CQnQC-ke.js +104 -0
- package/dist/workflowRouteData-BkfVOc-O.js +169 -0
- package/dist/workflows-list.d.ts +10 -0
- package/dist/workflows-list.js +5 -0
- package/package.json +320 -4
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/modules/observability/utils.ts
|
|
3
|
+
function percentage(value, total) {
|
|
4
|
+
if (total <= 0) return 0;
|
|
5
|
+
return Math.round(value / total * 1e3) / 10;
|
|
6
|
+
}
|
|
7
|
+
function getFailureBreakdown(runs) {
|
|
8
|
+
const counts = /* @__PURE__ */ new Map();
|
|
9
|
+
for (const run of runs) {
|
|
10
|
+
const key = run.errorType || "UNKNOWN";
|
|
11
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
12
|
+
}
|
|
13
|
+
return [...counts.entries()].map(([key, count]) => ({
|
|
14
|
+
key,
|
|
15
|
+
count
|
|
16
|
+
})).sort((a, b) => b.count - a.count || a.key.localeCompare(b.key));
|
|
17
|
+
}
|
|
18
|
+
function getTopFailingWorkflows(runs) {
|
|
19
|
+
const counts = /* @__PURE__ */ new Map();
|
|
20
|
+
for (const run of runs) {
|
|
21
|
+
const current = counts.get(run.workflowKey);
|
|
22
|
+
if (current) current.count += 1;
|
|
23
|
+
else counts.set(run.workflowKey, {
|
|
24
|
+
workflowKey: run.workflowKey,
|
|
25
|
+
label: run.workflow?.name || run.workflowKey,
|
|
26
|
+
count: 1
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return [...counts.values()].sort((a, b) => b.count - a.count || a.label.localeCompare(b.label));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The success rate of a summary in percent: completed out of finished runs,
|
|
33
|
+
* the same sum the server makes for `workflowSuccessRate` (already a percent).
|
|
34
|
+
* Reading that field as "0..1 or 0..100" showed 0.7% as 70%; the counts are
|
|
35
|
+
* always there, so the rate comes from them.
|
|
36
|
+
*/
|
|
37
|
+
function summarySuccessRate(summary) {
|
|
38
|
+
const finished = summary.runsCompletedCount + summary.runsFailedCount;
|
|
39
|
+
return percentage(summary.runsCompletedCount, finished);
|
|
40
|
+
}
|
|
41
|
+
function getTopFailingNodes(nodeUsageStats) {
|
|
42
|
+
return [...nodeUsageStats].filter((stat) => stat.failureCount > 0).sort((a, b) => b.failureCount - a.failureCount || a.nodeType.localeCompare(b.nodeType));
|
|
43
|
+
}
|
|
44
|
+
function formatDuration(seconds) {
|
|
45
|
+
if (seconds === null || seconds === void 0 || !Number.isFinite(seconds)) return "—";
|
|
46
|
+
if (seconds < 1) return `${Math.round(seconds * 1e3)}ms`;
|
|
47
|
+
if (seconds < 60) return `${seconds.toFixed(1)}s`;
|
|
48
|
+
return `${Math.floor(seconds / 60)}m ${Math.round(seconds % 60)}s`;
|
|
49
|
+
}
|
|
50
|
+
/** Milliseconds as the run pages show durations ("—" when unknown). */
|
|
51
|
+
function formatMs(ms) {
|
|
52
|
+
if (ms === null || ms === void 0 || !Number.isFinite(ms)) return "—";
|
|
53
|
+
return formatDuration(ms / 1e3);
|
|
54
|
+
}
|
|
55
|
+
function formatBytes(bytes) {
|
|
56
|
+
if (!Number.isFinite(bytes) || bytes < 0) return "—";
|
|
57
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
58
|
+
const units = [
|
|
59
|
+
"KB",
|
|
60
|
+
"MB",
|
|
61
|
+
"GB",
|
|
62
|
+
"TB"
|
|
63
|
+
];
|
|
64
|
+
let value = bytes / 1024;
|
|
65
|
+
let unit = units[0];
|
|
66
|
+
for (let i = 1; i < units.length && value >= 1024; i += 1) {
|
|
67
|
+
value /= 1024;
|
|
68
|
+
unit = units[i];
|
|
69
|
+
}
|
|
70
|
+
return `${value.toFixed(value >= 10 ? 0 : 1)} ${unit}`;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A timestamp for display ("Updated …"), or null when the server sent none or
|
|
74
|
+
* something that is not a date, so the page never shows "Invalid Date".
|
|
75
|
+
*/
|
|
76
|
+
function formatTimestamp(value) {
|
|
77
|
+
if (!value) return null;
|
|
78
|
+
const date = new Date(value);
|
|
79
|
+
return Number.isNaN(date.getTime()) ? null : date.toLocaleString();
|
|
80
|
+
}
|
|
81
|
+
function prettyJson(value) {
|
|
82
|
+
try {
|
|
83
|
+
return JSON.stringify(value, null, 2) ?? "null";
|
|
84
|
+
} catch {
|
|
85
|
+
return String(value);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { getFailureBreakdown as a, percentage as c, formatTimestamp as i, prettyJson as l, formatDuration as n, getTopFailingNodes as o, formatMs as r, getTopFailingWorkflows as s, formatBytes as t, summarySuccessRate as u };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/modules/webhook-deliveries/lib/webhook-deliveries.ts
|
|
3
|
+
const VALIDATION_FILTERS = [
|
|
4
|
+
"all",
|
|
5
|
+
"passed",
|
|
6
|
+
"failed"
|
|
7
|
+
];
|
|
8
|
+
function parseValidationFilter(value) {
|
|
9
|
+
return value === "passed" || value === "failed" ? value : "all";
|
|
10
|
+
}
|
|
11
|
+
/** The `validationPassed` argument for a filter (undefined = both). */
|
|
12
|
+
function validationPassedArg(filter) {
|
|
13
|
+
if (filter === "passed") return true;
|
|
14
|
+
if (filter === "failed") return false;
|
|
15
|
+
}
|
|
16
|
+
const FILTER_BLOCKED_PREFIX = "Blocked by filter:";
|
|
17
|
+
function deliveryOutcome(delivery) {
|
|
18
|
+
if (delivery.executionStarted || delivery.workflowRunId) return "STARTED";
|
|
19
|
+
if (!delivery.validationPassed) return delivery.validationError || delivery.processedAt ? "VALIDATION_FAILED" : "PENDING";
|
|
20
|
+
if (delivery.executionError?.startsWith(FILTER_BLOCKED_PREFIX)) return "FILTERED";
|
|
21
|
+
if (delivery.executionError) return "FAILED";
|
|
22
|
+
return "PENDING";
|
|
23
|
+
}
|
|
24
|
+
/** The status token classes for an outcome badge (semantic tokens only). */
|
|
25
|
+
function outcomeTone(outcome) {
|
|
26
|
+
switch (outcome) {
|
|
27
|
+
case "STARTED": return "border-status-success-border bg-status-success-bg-subtle text-status-success-text";
|
|
28
|
+
case "VALIDATION_FAILED":
|
|
29
|
+
case "FAILED": return "border-status-error-border bg-status-error-bg-subtle text-status-error-text";
|
|
30
|
+
case "FILTERED": return "border-status-warning-border bg-status-warning-bg-subtle text-status-warning-text";
|
|
31
|
+
default: return "border-border bg-muted text-text-secondary";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** The status token class for the HTTP status the sender received. */
|
|
35
|
+
function httpStatusTone(status) {
|
|
36
|
+
if (status === null || status === void 0) return "text-text-secondary";
|
|
37
|
+
if (status >= 200 && status < 300) return "text-status-success-text";
|
|
38
|
+
if (status >= 400 && status < 500) return "text-status-warning-text";
|
|
39
|
+
return "text-status-error-text";
|
|
40
|
+
}
|
|
41
|
+
/** The stored body as text: the handler stores the raw body string. */
|
|
42
|
+
function payloadText(value) {
|
|
43
|
+
if (value === null || value === void 0) return "";
|
|
44
|
+
return typeof value === "string" ? value : JSON.stringify(value);
|
|
45
|
+
}
|
|
46
|
+
/** Size of the request body in bytes (UTF-8), or null with no body. */
|
|
47
|
+
function payloadBytes(value) {
|
|
48
|
+
const text = payloadText(value);
|
|
49
|
+
return text ? new TextEncoder().encode(text).length : null;
|
|
50
|
+
}
|
|
51
|
+
function formatBytes(bytes) {
|
|
52
|
+
if (bytes === null || bytes === void 0) return "—";
|
|
53
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
54
|
+
if (bytes < 1048576) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
55
|
+
return `${(bytes / 1048576).toFixed(1)} MB`;
|
|
56
|
+
}
|
|
57
|
+
function formatDuration(ms) {
|
|
58
|
+
if (ms === null || ms === void 0) return "—";
|
|
59
|
+
if (ms < 1e3) return `${Math.round(ms)} ms`;
|
|
60
|
+
return `${(ms / 1e3).toFixed(2)} s`;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A payload for display: JSON is pretty-printed (including a body stored as
|
|
64
|
+
* JSON text); anything else (form data, XML, plain text) is shown as sent.
|
|
65
|
+
*/
|
|
66
|
+
function prettyPayload(value) {
|
|
67
|
+
if (value === null || value === void 0) return "";
|
|
68
|
+
if (typeof value === "string") try {
|
|
69
|
+
return JSON.stringify(JSON.parse(value), null, 2);
|
|
70
|
+
} catch {
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
return JSON.stringify(value, null, 2);
|
|
74
|
+
}
|
|
75
|
+
/** Request headers as sorted [name, value] pairs (credentials arrive redacted). */
|
|
76
|
+
function headerEntries(headers) {
|
|
77
|
+
if (!headers || typeof headers !== "object" || Array.isArray(headers)) return [];
|
|
78
|
+
return Object.entries(headers).map(([name, value]) => [name, typeof value === "string" ? value : JSON.stringify(value)]).sort(([a], [b]) => a.localeCompare(b));
|
|
79
|
+
}
|
|
80
|
+
/** A trigger's display name: its name, else "source / type". */
|
|
81
|
+
function registrationLabel(registration) {
|
|
82
|
+
if (!registration) return "—";
|
|
83
|
+
return registration.name?.trim() || `${registration.eventSource} / ${registration.eventType}`;
|
|
84
|
+
}
|
|
85
|
+
/** A delivery timestamp in the viewer's locale. */
|
|
86
|
+
function formatReceivedAt(iso) {
|
|
87
|
+
if (!iso) return "—";
|
|
88
|
+
const date = new Date(iso);
|
|
89
|
+
return Number.isNaN(date.getTime()) ? "—" : date.toLocaleString();
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The deliveries page filtered to one trigger, relative to a page mounted
|
|
93
|
+
* directly under the workflows routes (the builder, the runs list).
|
|
94
|
+
*/
|
|
95
|
+
function webhookDeliveriesPath(registrationId) {
|
|
96
|
+
return registrationId ? `../webhooks?registration=${encodeURIComponent(registrationId)}` : "../webhooks";
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { formatReceivedAt as a, outcomeTone as c, prettyPayload as d, registrationLabel as f, formatDuration as i, parseValidationFilter as l, webhookDeliveriesPath as m, deliveryOutcome as n, headerEntries as o, validationPassedArg as p, formatBytes as r, httpStatusTone as s, VALIDATION_FILTERS as t, payloadBytes as u };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { $Oo as WorkflowSearchRedirect, ako as WorkflowBuilderCoreProps, cr as useFlowStore, iko as WorkflowBuilderCore, nko as WorkflowBuilder, or as refetchStoreNodes, rko as WorkflowBuilderProps, sr as IFlowState, tko as WorkflowBuilder$1 } from "./index-AoJAa5vU.js";
|
|
3
|
+
export { type IFlowState, WorkflowBuilder, WorkflowBuilderCore, type WorkflowBuilderCoreProps, WorkflowBuilder$1 as WorkflowBuilderPage, type WorkflowBuilderProps, WorkflowSearchRedirect, refetchStoreNodes, useFlowStore };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { n as WorkflowBuilderCore, t as WorkflowBuilder } from "./WorkflowBuilder-B6wQD1TK.js";
|
|
3
|
+
import { t as WorkflowBuilder$1 } from "./WorkflowBuilder-DR4ku8Tr.js";
|
|
4
|
+
import { U as useFlowStore } from "./node-operation-selection-CdV3KI_V.js";
|
|
5
|
+
import { _ as refetchStoreNodes } from "./use-bare-node-registry-O6mKJO_n.js";
|
|
6
|
+
import { t as WorkflowSearchRedirect } from "./WorkflowSearchRedirect-C7zJ2MKH.js";
|
|
7
|
+
|
|
8
|
+
export { WorkflowBuilder, WorkflowBuilderCore, WorkflowBuilder$1 as WorkflowBuilderPage, WorkflowSearchRedirect, refetchStoreNodes, useFlowStore };
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Eg as FidelityLevel, YH as WorkflowExportFormat } from "./graphql-types-UTYtujY9.js";
|
|
3
|
+
|
|
4
|
+
// src/utils/workflow-code-transfer.ts
|
|
5
|
+
const CODE_EXPORT_FORMATS = [
|
|
6
|
+
"TYPESCRIPT",
|
|
7
|
+
"PYTHON",
|
|
8
|
+
"JSON"
|
|
9
|
+
];
|
|
10
|
+
/**
|
|
11
|
+
* Item kinds that make a report lossy, as `@fluidgrids/workflows` defines them
|
|
12
|
+
* (`roundtrip/fidelity.ts`). Every other kind is informational: the code still
|
|
13
|
+
* lowers back to the same IR. The service sets `level` itself; this list only
|
|
14
|
+
* decides how one item is labelled.
|
|
15
|
+
*/
|
|
16
|
+
const LOSSY_ITEM_KINDS = /* @__PURE__ */ new Set([
|
|
17
|
+
"layout-omitted",
|
|
18
|
+
"pinned-data-omitted",
|
|
19
|
+
"roundtrip-mismatch",
|
|
20
|
+
"lowering-failed",
|
|
21
|
+
"foreign-setting-dropped",
|
|
22
|
+
"foreign-expression-verbatim",
|
|
23
|
+
"foreign-unmapped-node",
|
|
24
|
+
"foreign-credential"
|
|
25
|
+
]);
|
|
26
|
+
function isLossyFidelityItem(item) {
|
|
27
|
+
return LOSSY_ITEM_KINDS.has(item.kind);
|
|
28
|
+
}
|
|
29
|
+
function isLosslessReport(fidelity) {
|
|
30
|
+
return fidelity.level === "LOSSLESS";
|
|
31
|
+
}
|
|
32
|
+
/** Lossy items first, then by node id, so the problems lead the list. */
|
|
33
|
+
function sortFidelityItems(items) {
|
|
34
|
+
return items.map((item, index) => ({
|
|
35
|
+
item,
|
|
36
|
+
index
|
|
37
|
+
})).sort((a, b) => {
|
|
38
|
+
const lossy = Number(isLossyFidelityItem(b.item)) - Number(isLossyFidelityItem(a.item));
|
|
39
|
+
if (lossy !== 0) return lossy;
|
|
40
|
+
return a.index - b.index;
|
|
41
|
+
}).map(({ item }) => item);
|
|
42
|
+
}
|
|
43
|
+
const EXTENSION_OF = {
|
|
44
|
+
["TYPESCRIPT"]: ".ts",
|
|
45
|
+
["PYTHON"]: ".py",
|
|
46
|
+
["JSON"]: ".json"
|
|
47
|
+
};
|
|
48
|
+
/** Generated node clients live under `.fluidgrids/`; they are not the workflow. */
|
|
49
|
+
function isGeneratedClient(path) {
|
|
50
|
+
return path.startsWith(".fluidgrids/");
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The file that holds the workflow itself: `workflows/<key>.ts` for
|
|
54
|
+
* TypeScript, `workflows/<key>.py` for Python, the envelope for JSON. Sidecars
|
|
55
|
+
* (`.layout.json`, `.pinned.json`) and generated clients are shown as extra
|
|
56
|
+
* tabs, never first.
|
|
57
|
+
*/
|
|
58
|
+
function primaryExportFile(files, format) {
|
|
59
|
+
const extension = EXTENSION_OF[format];
|
|
60
|
+
const sidecar = /\.(layout|pinned)\.json$/;
|
|
61
|
+
return files.find((file) => !isGeneratedClient(file.path) && file.path.endsWith(extension) && !sidecar.test(file.path)) ?? files[0] ?? null;
|
|
62
|
+
}
|
|
63
|
+
/** Files in display order: the workflow first, then the rest as listed. */
|
|
64
|
+
function orderedExportFiles(files, format) {
|
|
65
|
+
const primary = primaryExportFile(files, format);
|
|
66
|
+
if (!primary) return [];
|
|
67
|
+
return [primary, ...files.filter((file) => file !== primary)];
|
|
68
|
+
}
|
|
69
|
+
function fileBaseName(path) {
|
|
70
|
+
const parts = path.split("/").filter(Boolean);
|
|
71
|
+
return parts[parts.length - 1] ?? path;
|
|
72
|
+
}
|
|
73
|
+
/** A file name segment that is safe on every OS (keys and versions are slugs). */
|
|
74
|
+
function safeSegment(value) {
|
|
75
|
+
return value.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
76
|
+
}
|
|
77
|
+
const ARCHIVE_SUFFIX = {
|
|
78
|
+
["TYPESCRIPT"]: "typescript",
|
|
79
|
+
["PYTHON"]: "python",
|
|
80
|
+
["JSON"]: "json"
|
|
81
|
+
};
|
|
82
|
+
function exportArchiveName(workflowKey, version, format) {
|
|
83
|
+
return `${[safeSegment(workflowKey), safeSegment(version)].filter(Boolean).join("-") || "workflow"}.${ARCHIVE_SUFFIX[format]}.zip`;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A file's content. The service returns every exported file inline; a file
|
|
87
|
+
* without content is a broken export, never something to download empty.
|
|
88
|
+
*/
|
|
89
|
+
function exportFileContent(file) {
|
|
90
|
+
if (typeof file.content === "string") return file.content;
|
|
91
|
+
throw new Error(`The export of ${file.path} has no content`);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* One file downloads as itself. Several (the workflow plus its layout sidecar
|
|
95
|
+
* and generated node clients) download as one zip that keeps the project
|
|
96
|
+
* paths, so unpacking it into a project reproduces the CLI's `pull` layout.
|
|
97
|
+
*/
|
|
98
|
+
async function buildExportDownload(result, format) {
|
|
99
|
+
const files = orderedExportFiles(result.files, format);
|
|
100
|
+
if (files.length === 0) throw new Error("The export returned no files");
|
|
101
|
+
const contents = files.map((file) => ({
|
|
102
|
+
file,
|
|
103
|
+
content: exportFileContent(file)
|
|
104
|
+
}));
|
|
105
|
+
if (contents.length === 1) {
|
|
106
|
+
const [{ file, content }] = contents;
|
|
107
|
+
return {
|
|
108
|
+
filename: fileBaseName(file.path),
|
|
109
|
+
blob: new Blob([content], { type: file.contentType || "text/plain" })
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const { default: JSZipCtor } = await import("jszip");
|
|
113
|
+
const zip = new JSZipCtor();
|
|
114
|
+
for (const { file, content } of contents) zip.file(file.path, content);
|
|
115
|
+
return {
|
|
116
|
+
filename: exportArchiveName(result.workflowKey, result.version, format),
|
|
117
|
+
blob: await zip.generateAsync({
|
|
118
|
+
type: "blob",
|
|
119
|
+
mimeType: "application/zip"
|
|
120
|
+
})
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/** Classifies an import by file name or URL path; null when unsupported. */
|
|
124
|
+
function importFileKind(name) {
|
|
125
|
+
const path = name.split(/[?#]/, 1)[0].toLowerCase();
|
|
126
|
+
if (path.endsWith(".json")) return "json";
|
|
127
|
+
if (path.endsWith(".ts") && !path.endsWith(".d.ts")) return "typescript";
|
|
128
|
+
if (path.endsWith(".zip")) return "archive";
|
|
129
|
+
if (path.endsWith(".py")) return "python";
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
/** The `accept` attribute of the import file input. */
|
|
133
|
+
function importAcceptAttribute(codeFirst) {
|
|
134
|
+
return codeFirst ? "application/json,.json,.ts,text/typescript,.zip,application/zip" : "application/json,.json";
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Size limit of the sources in one import: the service's default
|
|
138
|
+
* `CODE_TOOLCHAIN_MAX_SOURCE_BYTES` (1 MiB), counted over every file sent.
|
|
139
|
+
* Checking it here turns an oversized pick into a clear message instead of a
|
|
140
|
+
* large upload the service refuses.
|
|
141
|
+
*/
|
|
142
|
+
const MAX_IMPORT_SOURCE_BYTES = 1048576;
|
|
143
|
+
/** At most this many source files in one import (the service's limit). */
|
|
144
|
+
const MAX_IMPORT_SOURCE_FILES = 200;
|
|
145
|
+
/**
|
|
146
|
+
* Largest project archive the dialog opens. The builder's own exports are
|
|
147
|
+
* stored uncompressed, so an archive within the source limit stays well under
|
|
148
|
+
* this; anything bigger cannot fit the source limit once unpacked.
|
|
149
|
+
*/
|
|
150
|
+
const MAX_IMPORT_ARCHIVE_BYTES = 2 * MAX_IMPORT_SOURCE_BYTES;
|
|
151
|
+
/** Entries an archive may list before it is refused without being unpacked. */
|
|
152
|
+
const MAX_ARCHIVE_ENTRIES = 1e3;
|
|
153
|
+
/** Where `fluidgrids codegen` and every TypeScript export put the node clients. */
|
|
154
|
+
const NODE_CLIENTS_PATH = ".fluidgrids/nodes.ts";
|
|
155
|
+
/** An import of the generated node clients, as wspace-workflow-svc detects it. */
|
|
156
|
+
const NODE_CLIENTS_IMPORT = /\bfrom\s*['"][./]*\.fluidgrids\/nodes(?:\.[cm]?[jt]s)?['"]/;
|
|
157
|
+
/** A path segment as the service accepts it: letters, digits, `.`, `_`, `-`. */
|
|
158
|
+
const SEGMENT = "[A-Za-z0-9_][A-Za-z0-9._-]*";
|
|
159
|
+
/**
|
|
160
|
+
* The project files a TypeScript import sends, the same set `fluidgrids push`
|
|
161
|
+
* lowers: every `.ts` file under `workflows/`, `activities/` and
|
|
162
|
+
* `.fluidgrids/`, plus the layout and pinned-data sidecars of the workflows.
|
|
163
|
+
* Everything else in an archive is left out.
|
|
164
|
+
*/
|
|
165
|
+
const PROJECT_SOURCE_PATH = new RegExp(`^(?:(?:workflows|activities|\\.fluidgrids)/(?:${SEGMENT}/)*${SEGMENT}\\.ts|workflows/(?:${SEGMENT}/)*${SEGMENT}\\.(?:layout|pinned)\\.json)$`);
|
|
166
|
+
const PYTHON_MODULE_PATH = new RegExp(`^workflows/(?:${SEGMENT}/)*${SEGMENT}\\.py$`);
|
|
167
|
+
var ImportSourceError = class extends Error {
|
|
168
|
+
problem;
|
|
169
|
+
constructor(problem) {
|
|
170
|
+
super(`Import source refused: ${problem.code}`);
|
|
171
|
+
this.problem = problem;
|
|
172
|
+
this.name = "ImportSourceError";
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const encoder = new TextEncoder();
|
|
176
|
+
function utf8Length(value) {
|
|
177
|
+
return encoder.encode(value).length;
|
|
178
|
+
}
|
|
179
|
+
/** A module that may define workflows: `workflows/**.ts`, not a declaration or a test. */
|
|
180
|
+
function isTypeScriptModule(path) {
|
|
181
|
+
return path.startsWith("workflows/") && path.endsWith(".ts") && !path.endsWith(".d.ts") && !/\.(test|spec)\.ts$/.test(path);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Refuses, with the reason, a byte size that cannot fit the source limit, so
|
|
185
|
+
* the dialog stops before reading or downloading a file that large.
|
|
186
|
+
*/
|
|
187
|
+
function assertImportByteSize(bytes, limitBytes) {
|
|
188
|
+
if (bytes > limitBytes) throw new ImportSourceError({
|
|
189
|
+
code: "too-large",
|
|
190
|
+
limitBytes
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* One TypeScript module picked on its own, under `workflows/` as in a
|
|
195
|
+
* project, so its imports of `../.fluidgrids/nodes` resolve the way they do
|
|
196
|
+
* for `fluidgrids push`. The extension is written in lower case because the
|
|
197
|
+
* service recognises modules by `.ts`.
|
|
198
|
+
*/
|
|
199
|
+
function typeScriptModuleFile(fileName, content) {
|
|
200
|
+
return {
|
|
201
|
+
path: `workflows/${safeSegment(fileBaseName(fileName).replace(/\.ts$/i, "")) || "workflow"}.ts`,
|
|
202
|
+
content
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Checks the files of a TypeScript import the way the service will, so the
|
|
207
|
+
* common mistakes are explained in the dialog: no module at all, Python
|
|
208
|
+
* sources (lowered by the CLI only), too many or too large files, and a module
|
|
209
|
+
* that imports the generated node clients without them.
|
|
210
|
+
*/
|
|
211
|
+
function checkTypeScriptImport(files) {
|
|
212
|
+
if (files.length > 200) throw new ImportSourceError({
|
|
213
|
+
code: "too-many-files",
|
|
214
|
+
limit: 200
|
|
215
|
+
});
|
|
216
|
+
assertImportByteSize(files.reduce((sum, file) => sum + utf8Length(file.content), 0), MAX_IMPORT_SOURCE_BYTES);
|
|
217
|
+
if (files.filter((file) => isTypeScriptModule(file.path)).length === 0) throw new ImportSourceError({ code: "no-module" });
|
|
218
|
+
if (!files.some((file) => file.path === ".fluidgrids/nodes.ts")) {
|
|
219
|
+
const importer = files.find((file) => file.path.endsWith(".ts") && NODE_CLIENTS_IMPORT.test(file.content));
|
|
220
|
+
if (importer) throw new ImportSourceError({
|
|
221
|
+
code: "needs-node-clients",
|
|
222
|
+
path: importer.path
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
return [...files];
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* The project files of an archive: the `.zip` that *Export as TypeScript*
|
|
229
|
+
* downloads, or a zipped project folder (one top-level folder is stripped).
|
|
230
|
+
* Only workflow modules, their layout and pinned-data sidecars and the
|
|
231
|
+
* generated node clients are kept; paths outside that set (including any
|
|
232
|
+
* `..` segment) are left out, so nothing else in the archive is uploaded.
|
|
233
|
+
*/
|
|
234
|
+
async function readProjectArchive(data) {
|
|
235
|
+
assertImportByteSize(data.byteLength, MAX_IMPORT_ARCHIVE_BYTES);
|
|
236
|
+
const { default: JSZipLoader } = await import("jszip");
|
|
237
|
+
let zip;
|
|
238
|
+
try {
|
|
239
|
+
zip = await JSZipLoader.loadAsync(data);
|
|
240
|
+
} catch {
|
|
241
|
+
throw new ImportSourceError({ code: "invalid-archive" });
|
|
242
|
+
}
|
|
243
|
+
const entries = Object.values(zip.files).filter((entry) => !entry.dir);
|
|
244
|
+
if (entries.length > MAX_ARCHIVE_ENTRIES) throw new ImportSourceError({
|
|
245
|
+
code: "too-many-files",
|
|
246
|
+
limit: 200
|
|
247
|
+
});
|
|
248
|
+
const root = commonRootFolder(entries.map((entry) => entry.name));
|
|
249
|
+
const selected = entries.map((entry) => ({
|
|
250
|
+
entry,
|
|
251
|
+
path: entry.name.slice(root.length)
|
|
252
|
+
})).filter(({ path }) => PROJECT_SOURCE_PATH.test(path)).sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
253
|
+
if (selected.length > 200) throw new ImportSourceError({
|
|
254
|
+
code: "too-many-files",
|
|
255
|
+
limit: 200
|
|
256
|
+
});
|
|
257
|
+
if (!selected.some(({ path }) => isTypeScriptModule(path))) {
|
|
258
|
+
const python = entries.some((entry) => PYTHON_MODULE_PATH.test(entry.name.slice(root.length)));
|
|
259
|
+
throw new ImportSourceError({ code: python ? "python-needs-cli" : "no-module" });
|
|
260
|
+
}
|
|
261
|
+
const files = [];
|
|
262
|
+
let bytes = 0;
|
|
263
|
+
for (const { entry, path } of selected) {
|
|
264
|
+
const content = await entry.async("string");
|
|
265
|
+
bytes += utf8Length(content);
|
|
266
|
+
assertImportByteSize(bytes, MAX_IMPORT_SOURCE_BYTES);
|
|
267
|
+
files.push({
|
|
268
|
+
path,
|
|
269
|
+
content
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
return files;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* `name/` when every entry sits in one folder that is not itself a project
|
|
276
|
+
* folder (a zipped project directory), else the empty string.
|
|
277
|
+
*/
|
|
278
|
+
function commonRootFolder(names) {
|
|
279
|
+
const first = names[0];
|
|
280
|
+
if (!first) return "";
|
|
281
|
+
const head = first.split("/", 1)[0];
|
|
282
|
+
if (head === first || head === "workflows" || head === ".fluidgrids") return "";
|
|
283
|
+
const prefix = `${head}/`;
|
|
284
|
+
return names.every((name) => name.startsWith(prefix)) ? prefix : "";
|
|
285
|
+
}
|
|
286
|
+
/** `importWorkflow` source for the files of a TypeScript import. */
|
|
287
|
+
function typeScriptImportSource(files) {
|
|
288
|
+
return {
|
|
289
|
+
format: "TYPESCRIPT",
|
|
290
|
+
files: files.map((file) => ({
|
|
291
|
+
path: file.path,
|
|
292
|
+
content: file.content
|
|
293
|
+
}))
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
/** The workflow module a default name is taken from: the first one by path. */
|
|
297
|
+
function primaryImportModule(files) {
|
|
298
|
+
return files.find((file) => isTypeScriptModule(file.path)) ?? null;
|
|
299
|
+
}
|
|
300
|
+
/** A readable default name from a file name: `lead-enrichment.ts` → "Lead enrichment". */
|
|
301
|
+
function workflowNameFromFile(fileName) {
|
|
302
|
+
const stem = fileBaseName(fileName).replace(/\.(ts|zip)$/i, "").replace(/[-_.]+/g, " ").trim();
|
|
303
|
+
if (!stem) return "Imported workflow";
|
|
304
|
+
return stem.charAt(0).toUpperCase() + stem.slice(1);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Where the workflow body starts: the lifted module's `(wf) => {` in
|
|
308
|
+
* TypeScript or `def <name>(wf):` in Python. Workflow-level options above it
|
|
309
|
+
* (`extra.data.id`, for example) can repeat a node's id, so node lookups
|
|
310
|
+
* start here.
|
|
311
|
+
*/
|
|
312
|
+
const WORKFLOW_BODY_START = /\(wf\)\s*=>\s*\{|^\s*def\s+\w+\(wf\)\s*:/;
|
|
313
|
+
/** The line (1-based) where a node's `id: '<nodeId>'` appears, if it does. */
|
|
314
|
+
function lineOfNode(source, nodeId) {
|
|
315
|
+
const escaped = nodeId.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
316
|
+
const pattern = new RegExp(`\\bid\\s*[:=]\\s*["']${escaped}["']`);
|
|
317
|
+
const lines = source.split("\n");
|
|
318
|
+
const bodyStart = Math.max(0, lines.findIndex((line) => WORKFLOW_BODY_START.test(line)));
|
|
319
|
+
for (let index = bodyStart; index < lines.length; index += 1) if (pattern.test(lines[index])) return index + 1;
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export { sortFidelityItems as _, assertImportByteSize as a, utf8Length as b, fileBaseName as c, isLosslessReport as d, isLossyFidelityItem as f, readProjectArchive as g, primaryImportModule as h, MAX_IMPORT_SOURCE_BYTES as i, importAcceptAttribute as l, orderedExportFiles as m, ImportSourceError as n, buildExportDownload as o, lineOfNode as p, MAX_IMPORT_ARCHIVE_BYTES as r, checkTypeScriptImport as s, CODE_EXPORT_FORMATS as t, importFileKind as u, typeScriptImportSource as v, workflowNameFromFile as x, typeScriptModuleFile as y };
|