@burdenoff/microfe-bigconsole 2026.1004.8 → 2026.1005.1
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/bigconsole/BigConsoleRoutes.d.ts +7 -1
- package/dist/bigconsole/BigConsoleRoutes.d.ts.map +1 -1
- package/dist/bigconsole/BigConsoleRoutes.js +152 -146
- package/dist/bigconsole/BigConsoleRoutes.js.map +1 -1
- package/dist/bigconsole/components/workflow/WorkflowOpenGuard.d.ts +25 -0
- package/dist/bigconsole/components/workflow/WorkflowOpenGuard.d.ts.map +1 -0
- package/dist/bigconsole/components/workflow/WorkflowOpenGuard.js +89 -0
- package/dist/bigconsole/components/workflow/WorkflowOpenGuard.js.map +1 -0
- package/dist/bigconsole/pages/DataSinkViewPage.d.ts.map +1 -1
- package/dist/bigconsole/pages/DataSinkViewPage.js +287 -286
- package/dist/bigconsole/pages/DataSinkViewPage.js.map +1 -1
- package/dist/bigconsole/pages/WorkflowViewPage.js +4 -4
- package/dist/bigconsole/pages/WorkflowsPage.d.ts.map +1 -1
- package/dist/bigconsole/pages/WorkflowsPage.js +61 -60
- package/dist/bigconsole/pages/WorkflowsPage.js.map +1 -1
- package/dist/bigconsole/workflowOpen.d.ts +78 -0
- package/dist/bigconsole/workflowOpen.d.ts.map +1 -0
- package/dist/bigconsole/workflowOpen.js +33 -0
- package/dist/bigconsole/workflowOpen.js.map +1 -0
- package/dist/generated/wspace-operations.d.ts +42 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +10 -2
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/translations/en.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowsPage.js","names":[],"sources":["../../../src/bigconsole/pages/WorkflowsPage.tsx"],"sourcesContent":["/**\n * Workflows Page\n *\n * List and manage FluidGrids Workflows.\n *\n * Section hierarchy (BOFF-5634):\n * - page header strip .............. `bare` — identity + the one create action\n * - \"Filters\" ...................... `standard` — status tabs + search, one labelled group\n * - \"Workflows\" .................... `primary` — the result set this route exists for;\n * loading / empty / no-results / grid all\n * live inside it so the page keeps its shape\n * - load failure ................... `danger` — in-page status section, not a page swap\n */\n\nimport { memo, useState, useMemo, useCallback } from 'react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { AccessDenied, PermissionButton } from '@burdenoff/fe-libs/shared/components';\nimport { BIGCONSOLE_PERMISSIONS } from '../../constants/permissions';\nimport { useAppNavigate } from '../contexts';\nimport { isNative, nativeNotify } from '../../utils/nativeBridge';\nimport { newWorkflowPath } from '../BigConsoleRoutes';\nimport { useWorkflowOperations } from '../hooks/useWorkflowOperations';\nimport { useWorkflowStore } from '../store/workflowStore';\nimport { WorkflowCard } from '../components/workflow/WorkflowCard';\nimport { WorkflowDeleteDialog } from '../components/workflow/WorkflowDeleteDialog';\nimport { Section, SectionStack, SECTION_FOCUS_RING } from '../components/common';\nimport type { FluidGridsWorkflowStatus } from '../types';\n\n// fe-libs UI components\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { Input } from '@burdenoff/fe-libs/ui';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { AuroraBackground, GradientText, IllustratedEmptyState, PagePurpose } from '@burdenoff/fe-libs/ui';\n\n// Lucide icons\nimport { Plus, Search, Workflow, AlertCircle } from 'lucide-react';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\ntype StatusFilter = 'all' | FluidGridsWorkflowStatus;\n\n/** Result of the last manual run triggered from a card. */\ninterface RunOutcome {\n workflowName: string;\n ok: boolean;\n message: string;\n}\n\n// ============================================================================\n// COMPONENT\n// ============================================================================\n\nexport const WorkflowsPage = memo(function WorkflowsPage() {\n const navigate = useAppNavigate();\n const { t } = useI18n();\n\n // RBAC permissions\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canRead = hasPermission(BIGCONSOLE_PERMISSIONS.WORKFLOW_READ);\n const canUpdate = hasPermission(BIGCONSOLE_PERMISSIONS.WORKFLOW_UPDATE);\n const canDelete = hasPermission(BIGCONSOLE_PERMISSIONS.WORKFLOW_DELETE);\n const canExecute = hasPermission(BIGCONSOLE_PERMISSIONS.WORKFLOW_EXECUTE);\n\n // Local state\n const [statusFilter, setStatusFilter] = useState<StatusFilter>('all');\n /** Outcome of the most recent run, shown inline above the grid. */\n const [runOutcome, setRunOutcome] = useState<RunOutcome | null>(null);\n\n // Store state\n const searchQuery = useWorkflowStore((state) => state.searchQuery);\n const setSearchQuery = useWorkflowStore((state) => state.setSearchQuery);\n const deleteDialogOpen = useWorkflowStore((state) => state.deleteDialogOpen);\n const currentWorkflow = useWorkflowStore((state) => state.currentWorkflow);\n const openDeleteDialog = useWorkflowStore((state) => state.openDeleteDialog);\n const closeDeleteDialog = useWorkflowStore((state) => state.closeDeleteDialog);\n\n // Operations\n const { loading, error, workflows, deleteWorkflow, refetch } = useWorkflowOperations();\n\n /**\n * Runs go through a SECOND hook instance on purpose. `useWorkflowOperations`\n * keeps one shared `error` for every operation, and this page swaps the whole\n * result set for a \"Failed to load Workflows\" panel whenever that error is\n * set — so a failed run on one card would wipe the list. A separate instance\n * (fetch skipped) keeps run failures local while still writing through to the\n * shared workflow store, so the card's execution count and last-run time\n * update in place.\n */\n const { executeWorkflow } = useWorkflowOperations({ skipFetch: true });\n\n // Per-card execution flags, maintained by the hook's executeWorkflow.\n const workflowUIStates = useWorkflowStore((state) => state.workflowUIStates);\n\n // Filter workflows\n const filteredWorkflows = useMemo(() => {\n let filtered = [...workflows];\n\n // Apply status filter\n if (statusFilter !== 'all') {\n filtered = filtered.filter((wf) => wf.status === statusFilter);\n }\n\n // Apply search filter\n if (searchQuery.trim()) {\n const query = searchQuery.toLowerCase();\n filtered = filtered.filter(\n (wf) =>\n wf.name.toLowerCase().includes(query) ||\n wf.key.toLowerCase().includes(query) ||\n wf.description?.toLowerCase().includes(query)\n );\n }\n\n // Sort by updatedAt descending\n return filtered.sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime());\n }, [workflows, statusFilter, searchQuery]);\n\n // Handlers\n const handleCreateWorkflow = useCallback(() => {\n navigate(newWorkflowPath());\n }, [navigate]);\n\n const handleViewWorkflow = useCallback(\n (id: string) => {\n navigate(`/workflows/details/${id}`);\n },\n [navigate]\n );\n\n const handleEditWorkflow = useCallback(\n (id: string) => {\n const workflow = workflows.find((item) => item.id === id);\n if (workflow?.key) navigate(`/workflows/workflow/${encodeURIComponent(workflow.key)}/v1`);\n },\n [navigate, workflows]\n );\n\n const handleDeleteClick = useCallback(\n (id: string) => {\n const workflow = workflows.find((wf) => wf.id === id);\n if (workflow) {\n openDeleteDialog(workflow);\n }\n },\n [workflows, openDeleteDialog]\n );\n\n const handleRunWorkflow = useCallback(\n async (id: string) => {\n const workflow = workflows.find((wf) => wf.id === id);\n if (!workflow) return;\n\n setRunOutcome(null);\n // `executeWorkflow` swallows the Apollo error and resolves to null, so a\n // null result IS the failure signal — never treat it as a silent success.\n const result = await executeWorkflow(id);\n\n if (result) {\n if (isNative()) void nativeNotify('success');\n setRunOutcome({\n workflowName: workflow.name,\n ok: true,\n message: t(\n 'bigconsole.workflows.run.triggered',\n 'Run triggered. The execution count and last-run time update as the run progresses.'\n ),\n });\n return;\n }\n\n if (isNative()) void nativeNotify('error');\n setRunOutcome({\n workflowName: workflow.name,\n ok: false,\n message: t('bigconsole.workflows.run.failed', 'The workflow could not be started. Nothing has been changed.'),\n });\n },\n [workflows, executeWorkflow, t]\n );\n\n const handleDeleteConfirm = useCallback(async () => {\n if (currentWorkflow) {\n try {\n await deleteWorkflow(currentWorkflow.id);\n if (isNative()) void nativeNotify('success');\n } catch (err) {\n if (isNative()) void nativeNotify('error');\n throw err;\n }\n closeDeleteDialog();\n }\n }, [currentWorkflow, deleteWorkflow, closeDeleteDialog]);\n\n // Status filter options\n const statusOptions: { value: StatusFilter; label: string }[] = [\n { value: 'all', label: t('bigconsole.workflows.filters.all', 'All') },\n { value: 'draft', label: t('bigconsole.workflows.status.draft', 'Draft') },\n { value: 'active', label: t('bigconsole.workflows.status.active', 'Active') },\n { value: 'paused', label: t('bigconsole.workflows.status.paused', 'Paused') },\n { value: 'error', label: t('bigconsole.workflows.status.error', 'Error') },\n { value: 'archived', label: t('bigconsole.workflows.status.archived', 'Archived') },\n ];\n\n // Page-level read gate — only after permissions have finished loading so we\n // don't flash Access Denied while the permission set is still being fetched.\n if (!permissionsLoading && !canRead) {\n return (\n <AccessDenied\n title={t('bigconsole.workflows.errors.accessDeniedTitle', 'Access Denied')}\n description={t(\n 'bigconsole.workflows.errors.accessDeniedListDescription',\n \"You don't have permission to view workflows.\"\n )}\n />\n );\n }\n\n const isEmpty = !loading && workflows.length === 0;\n const isNoResults = !loading && filteredWorkflows.length === 0 && workflows.length > 0;\n\n return (\n <div data-tour=\"bigconsole-workflows-list\" className=\"min-h-dvh bg-bg-canvas\">\n {/* ------------------------------------------------------------------ *\n * Page header strip — `bare` emphasis: structural only. It carries the\n * page identity and the single create action, and must never out-weigh\n * the result set below it. Rendered as <header> (the page banner) so it\n * stays a landmark without competing with the labelled sections below.\n * The band itself was invisible before: `border-border-seam` and\n * `bg-gloss-card` are unregistered utilities that emit no CSS.\n * ------------------------------------------------------------------ */}\n <header\n data-section-emphasis=\"bare\"\n className=\"relative min-w-0 overflow-hidden border-b border-[var(--color-border-seam)] bg-[image:var(--gradient-gloss-card)]\"\n >\n <AuroraBackground intensity=\"subtle\" />\n <div className=\"relative flex flex-col gap-form-gap p-[var(--space-pagePadding)] sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"flex min-w-0 items-center gap-form-gap\">\n <span\n aria-hidden=\"true\"\n className=\"flex h-control-lg w-[var(--size-controlHeight-lg)] shrink-0 items-center justify-center rounded-card bg-action-primary-bg\"\n >\n <Workflow className=\"h-icon-lg w-icon-lg text-action-primary-text\" />\n </span>\n <div className=\"min-w-0\">\n <h1 className=\"text-2xl font-bold text-text-primary\">\n <GradientText>{t('bigconsole.workflows.list.title', 'Workflows')}</GradientText>\n </h1>\n <p className=\"text-sm text-text-secondary\">\n {t(\n 'bigconsole.workflows.list.subtitle',\n 'Design ETL workflows with FluidGrids and link them to DataSinks'\n )}\n </p>\n </div>\n </div>\n\n <div className=\"flex flex-wrap items-center gap-control-gap\">\n <PermissionButton permission={BIGCONSOLE_PERMISSIONS.WORKFLOW_CREATE} deniedBehavior=\"disable\">\n <Button onClick={handleCreateWorkflow}>\n <Plus className=\"h-icon-sm w-icon-sm\" />\n {t('bigconsole.workflows.actions.designWorkflow', 'Design Workflow')}\n </Button>\n </PermissionButton>\n </div>\n </div>\n </header>\n\n {/* Main Content */}\n <div className=\"p-[var(--space-pagePadding)]\">\n <SectionStack>\n <PagePurpose>\n {t(\n 'bigconsole.workflows.list.purpose',\n 'Workflows are visual ETL jobs built with the FluidGrids builder — they fetch data from external systems, transform it, and load it into your BigConsole DataSinks on a schedule or on demand. Use them to keep dashboards fed with fresh, shaped data without writing glue code.'\n )}\n </PagePurpose>\n\n {error ? (\n /* Load failure reads as a status section inside the page — the\n header band and the create action stay reachable. */\n <Section\n headingLevel={2}\n tone=\"danger\"\n title={t('bigconsole.workflows.errors.loadFailedTitle', 'Failed to load Workflows')}\n description=\"The workflow service did not respond. Nothing has been changed — retry when you are ready.\"\n icon={<AlertCircle className=\"h-icon-md w-icon-md\" />}\n actions={\n <Button size=\"sm\" onClick={() => refetch()}>\n {t('bigconsole.workflows.actions.tryAgain', 'Try Again')}\n </Button>\n }\n data-testid=\"workflows-error\"\n >\n <p className=\"break-words text-sm text-[var(--color-status-error-text)]\">{error.message}</p>\n </Section>\n ) : (\n <>\n {/* Configuration: the two filter controls read as ONE group. */}\n <Section\n headingLevel={2}\n title=\"Filters\"\n description=\"Narrow the list by status, or search by name, key or description.\"\n padding=\"compact\"\n data-testid=\"workflows-filters\"\n >\n <div className=\"flex flex-col gap-form-gap lg:flex-row lg:items-center lg:justify-between\">\n <div\n role=\"group\"\n aria-label=\"Filter workflows by status\"\n className=\"flex flex-wrap items-center gap-1 rounded-card bg-bg-sunken p-1\"\n >\n {statusOptions.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n aria-pressed={statusFilter === option.value}\n onClick={() => setStatusFilter(option.value)}\n className={`min-h-[var(--size-controlHeight-md)] rounded-button px-3 text-sm font-medium motion-safe:transition-colors ${SECTION_FOCUS_RING} ${\n statusFilter === option.value\n ? 'bg-bg-surface text-text-primary shadow-[var(--shadow-elevation-1)]'\n : 'text-text-secondary hover:text-text-primary'\n }`}\n >\n {option.label}\n </button>\n ))}\n </div>\n\n <div className=\"relative w-full lg:max-w-[360px]\">\n <Search\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute left-3 top-1/2 h-icon-sm w-icon-sm -translate-y-1/2 text-text-muted\"\n />\n <Input\n type=\"text\"\n aria-label={t('bigconsole.workflows.filters.searchPlaceholder', 'Search workflows...')}\n placeholder={t('bigconsole.workflows.filters.searchPlaceholder', 'Search workflows...')}\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"h-control-md pl-10\"\n />\n </div>\n </div>\n </Section>\n\n {/* ------------------------------------------------------------ *\n * The result set — the ONE `primary` block on this route.\n * Loading, empty, no-results and the grid all render inside it,\n * so the page keeps the same shape whatever the data does.\n * ------------------------------------------------------------ */}\n <Section\n headingLevel={2}\n emphasis=\"primary\"\n title={t('bigconsole.workflows.list.title', 'Workflows')}\n description=\"Every workflow in this workspace, most recently updated first.\"\n meta={\n <span className=\"rounded-pill bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-secondary\">\n {filteredWorkflows.length}\n {filteredWorkflows.length !== workflows.length ? ` of ${workflows.length}` : ''}\n </span>\n }\n data-testid=\"workflows-results\"\n >\n {loading && workflows.length === 0 && (\n <div className=\"flex min-h-[240px] items-center justify-center\">\n <div className=\"text-center\">\n <Spinner size=\"lg\" className=\"mb-form-gap\" />\n <p className=\"text-sm text-text-muted\">\n {t('bigconsole.workflows.list.loading', 'Loading workflows...')}\n </p>\n </div>\n </div>\n )}\n\n {isEmpty && (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={t('bigconsole.workflows.list.emptyTitle', 'No Workflows yet')}\n description={t(\n 'bigconsole.workflows.list.emptyDescription',\n 'Design ETL workflows with the FluidGrids visual builder to fetch, transform, and deliver data into BigConsole DataSinks.'\n )}\n action={\n <PermissionButton permission={BIGCONSOLE_PERMISSIONS.WORKFLOW_CREATE} deniedBehavior=\"disable\">\n <Button onClick={handleCreateWorkflow}>\n <Plus className=\"h-icon-sm w-icon-sm\" />\n {t('bigconsole.workflows.actions.designWorkflow', 'Design Workflow')}\n </Button>\n </PermissionButton>\n }\n />\n )}\n\n {isNoResults && (\n <IllustratedEmptyState\n illustration=\"empty-search\"\n title={t('bigconsole.workflows.list.noResultsTitle', 'No matching workflows')}\n description={t('bigconsole.workflows.list.noResultsDescription', 'No workflows match your filters')}\n />\n )}\n\n {runOutcome && (\n <div\n role=\"status\"\n aria-live=\"polite\"\n className={`mb-form-gap flex flex-wrap items-center justify-between gap-icon-gap rounded-input border p-3 text-sm ${\n runOutcome.ok\n ? 'border-[var(--color-status-success-border)] bg-[var(--color-status-success-bgSubtle)] text-[var(--color-status-success-text)]'\n : 'border-[var(--color-status-error-border)] bg-[var(--color-status-error-bgSubtle)] text-[var(--color-status-error-text)]'\n }`}\n data-testid=\"workflows-run-outcome\"\n >\n <span className=\"min-w-0\">\n <strong className=\"font-semibold\">{runOutcome.workflowName}</strong> — {runOutcome.message}\n </span>\n <button\n type=\"button\"\n onClick={() => setRunOutcome(null)}\n className={`rounded-button px-2 py-1 text-xs font-medium underline-offset-2 hover:underline ${SECTION_FOCUS_RING}`}\n >\n {t('bigconsole.workflows.run.dismiss', 'Dismiss')}\n </button>\n </div>\n )}\n\n {filteredWorkflows.length > 0 && (\n <div className=\"grid grid-cols-1 gap-form-gap sm:grid-cols-2 xl:grid-cols-3\">\n {filteredWorkflows.map((workflow) => (\n <WorkflowCard\n key={workflow.id}\n workflow={workflow}\n onView={handleViewWorkflow}\n onEdit={canUpdate ? handleEditWorkflow : undefined}\n onDelete={canDelete ? handleDeleteClick : undefined}\n onRun={canExecute ? handleRunWorkflow : undefined}\n isRunning={workflowUIStates.get(workflow.id)?.isExecuting ?? false}\n />\n ))}\n </div>\n )}\n </Section>\n </>\n )}\n </SectionStack>\n </div>\n\n {/* Delete Dialog */}\n {currentWorkflow && (\n <WorkflowDeleteDialog\n workflow={currentWorkflow}\n isOpen={deleteDialogOpen}\n onClose={closeDeleteDialog}\n onConfirm={handleDeleteConfirm}\n />\n )}\n </div>\n );\n});\n\nexport default WorkflowsPage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuDA,IAAa,IAAgB,EAAK,WAAyB;CACzD,IAAM,IAAW,GAAgB,EAC3B,EAAE,SAAM,GAAS,EAGjB,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,IAAU,EAAc,EAAuB,cAAc,EAC7D,IAAY,EAAc,EAAuB,gBAAgB,EACjE,IAAY,EAAc,EAAuB,gBAAgB,EACjE,IAAa,EAAc,EAAuB,iBAAiB,EAGnE,CAAC,GAAc,KAAmB,EAAuB,MAAM,EAE/D,CAAC,GAAY,KAAiB,EAA4B,KAAK,EAG/D,IAAc,GAAkB,MAAU,EAAM,YAAY,EAC5D,IAAiB,GAAkB,MAAU,EAAM,eAAe,EAClE,IAAmB,GAAkB,MAAU,EAAM,iBAAiB,EACtE,IAAkB,GAAkB,MAAU,EAAM,gBAAgB,EACpE,IAAmB,GAAkB,MAAU,EAAM,iBAAiB,EACtE,IAAoB,GAAkB,MAAU,EAAM,kBAAkB,EAGxE,EAAE,YAAS,UAAO,cAAW,mBAAgB,gBAAY,GAAuB,EAWhF,EAAE,uBAAoB,EAAsB,EAAE,WAAW,IAAM,CAAC,EAGhE,KAAmB,GAAkB,MAAU,EAAM,iBAAiB,EAGtE,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ACC,kBAAC,GAAD;OACE,cAAa;OACb,OAAO,EAAE,4CAA4C,wBAAwB;OAC7E,aAAa,EAAE,kDAAkD,kCAAkC;OACnG,CAAA;MAGH,KACC,kBAAC,OAAD;OACE,MAAK;OACL,aAAU;OACV,WAAW,yGACT,EAAW,KACP,kIACA;OAEN,eAAY;iBARd,CAUE,kBAAC,QAAD;QAAM,WAAU;kBAAhB;SACE,kBAAC,UAAD;UAAQ,WAAU;oBAAiB,EAAW;UAAsB,CAAA;;SAAI,EAAW;SAC9E;WACP,kBAAC,UAAD;QACE,MAAK;QACL,eAAe,EAAc,KAAK;QAClC,WAAW;kBAEV,EAAE,oCAAoC,UAAU;QAC1C,CAAA,CACL;;MAGP,EAAkB,SAAS,KAC1B,kBAAC,OAAD;OAAK,WAAU;iBACZ,EAAkB,KAAK,MACtB,kBAAC,GAAD;QAEY;QACV,QAAQ;QACR,QAAQ,IAAY,KAAqB,KAAA;QACzC,UAAU,IAAY,KAAoB,KAAA;QAC1C,OAAO,IAAa,IAAoB,KAAA;QACxC,WAAW,GAAiB,IAAI,EAAS,GAAG,EAAE,eAAe;QAC7D,EAPK,EAAS,GAOd,CACF;OACE,CAAA;MAEA;OACT,EAAA,CAAA,CAEQ,EAAA,CAAA;IACX,CAAA;GAGL,KACC,kBAAC,GAAD;IACE,UAAU;IACV,QAAQ;IACR,SAAS;IACT,WAAW;IACX,CAAA;GAEA;;EAER"}
|
|
1
|
+
{"version":3,"file":"WorkflowsPage.js","names":[],"sources":["../../../src/bigconsole/pages/WorkflowsPage.tsx"],"sourcesContent":["/**\n * Workflows Page\n *\n * List and manage FluidGrids Workflows.\n *\n * Section hierarchy (BOFF-5634):\n * - page header strip .............. `bare` — identity + the one create action\n * - \"Filters\" ...................... `standard` — status tabs + search, one labelled group\n * - \"Workflows\" .................... `primary` — the result set this route exists for;\n * loading / empty / no-results / grid all\n * live inside it so the page keeps its shape\n * - load failure ................... `danger` — in-page status section, not a page swap\n */\n\nimport { memo, useState, useMemo, useCallback } from 'react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { AccessDenied, PermissionButton } from '@burdenoff/fe-libs/shared/components';\nimport { BIGCONSOLE_PERMISSIONS } from '../../constants/permissions';\nimport { useAppNavigate } from '../contexts';\nimport { isNative, nativeNotify } from '../../utils/nativeBridge';\nimport { newWorkflowPath } from '../BigConsoleRoutes';\nimport { NEW_WORKFLOW_NAV } from '../workflowOpen';\nimport { useWorkflowOperations } from '../hooks/useWorkflowOperations';\nimport { useWorkflowStore } from '../store/workflowStore';\nimport { WorkflowCard } from '../components/workflow/WorkflowCard';\nimport { WorkflowDeleteDialog } from '../components/workflow/WorkflowDeleteDialog';\nimport { Section, SectionStack, SECTION_FOCUS_RING } from '../components/common';\nimport type { FluidGridsWorkflowStatus } from '../types';\n\n// fe-libs UI components\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { Input } from '@burdenoff/fe-libs/ui';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { AuroraBackground, GradientText, IllustratedEmptyState, PagePurpose } from '@burdenoff/fe-libs/ui';\n\n// Lucide icons\nimport { Plus, Search, Workflow, AlertCircle } from 'lucide-react';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\ntype StatusFilter = 'all' | FluidGridsWorkflowStatus;\n\n/** Result of the last manual run triggered from a card. */\ninterface RunOutcome {\n workflowName: string;\n ok: boolean;\n message: string;\n}\n\n// ============================================================================\n// COMPONENT\n// ============================================================================\n\nexport const WorkflowsPage = memo(function WorkflowsPage() {\n const navigate = useAppNavigate();\n const { t } = useI18n();\n\n // RBAC permissions\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canRead = hasPermission(BIGCONSOLE_PERMISSIONS.WORKFLOW_READ);\n const canUpdate = hasPermission(BIGCONSOLE_PERMISSIONS.WORKFLOW_UPDATE);\n const canDelete = hasPermission(BIGCONSOLE_PERMISSIONS.WORKFLOW_DELETE);\n const canExecute = hasPermission(BIGCONSOLE_PERMISSIONS.WORKFLOW_EXECUTE);\n\n // Local state\n const [statusFilter, setStatusFilter] = useState<StatusFilter>('all');\n /** Outcome of the most recent run, shown inline above the grid. */\n const [runOutcome, setRunOutcome] = useState<RunOutcome | null>(null);\n\n // Store state\n const searchQuery = useWorkflowStore((state) => state.searchQuery);\n const setSearchQuery = useWorkflowStore((state) => state.setSearchQuery);\n const deleteDialogOpen = useWorkflowStore((state) => state.deleteDialogOpen);\n const currentWorkflow = useWorkflowStore((state) => state.currentWorkflow);\n const openDeleteDialog = useWorkflowStore((state) => state.openDeleteDialog);\n const closeDeleteDialog = useWorkflowStore((state) => state.closeDeleteDialog);\n\n // Operations\n const { loading, error, workflows, deleteWorkflow, refetch } = useWorkflowOperations();\n\n /**\n * Runs go through a SECOND hook instance on purpose. `useWorkflowOperations`\n * keeps one shared `error` for every operation, and this page swaps the whole\n * result set for a \"Failed to load Workflows\" panel whenever that error is\n * set — so a failed run on one card would wipe the list. A separate instance\n * (fetch skipped) keeps run failures local while still writing through to the\n * shared workflow store, so the card's execution count and last-run time\n * update in place.\n */\n const { executeWorkflow } = useWorkflowOperations({ skipFetch: true });\n\n // Per-card execution flags, maintained by the hook's executeWorkflow.\n const workflowUIStates = useWorkflowStore((state) => state.workflowUIStates);\n\n // Filter workflows\n const filteredWorkflows = useMemo(() => {\n let filtered = [...workflows];\n\n // Apply status filter\n if (statusFilter !== 'all') {\n filtered = filtered.filter((wf) => wf.status === statusFilter);\n }\n\n // Apply search filter\n if (searchQuery.trim()) {\n const query = searchQuery.toLowerCase();\n filtered = filtered.filter(\n (wf) =>\n wf.name.toLowerCase().includes(query) ||\n wf.key.toLowerCase().includes(query) ||\n wf.description?.toLowerCase().includes(query)\n );\n }\n\n // Sort by updatedAt descending\n return filtered.sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime());\n }, [workflows, statusFilter, searchQuery]);\n\n // Handlers\n const handleCreateWorkflow = useCallback(() => {\n navigate(newWorkflowPath(), NEW_WORKFLOW_NAV);\n }, [navigate]);\n\n const handleViewWorkflow = useCallback(\n (id: string) => {\n navigate(`/workflows/details/${id}`);\n },\n [navigate]\n );\n\n const handleEditWorkflow = useCallback(\n (id: string) => {\n const workflow = workflows.find((item) => item.id === id);\n if (workflow?.key) navigate(`/workflows/workflow/${encodeURIComponent(workflow.key)}/v1`);\n },\n [navigate, workflows]\n );\n\n const handleDeleteClick = useCallback(\n (id: string) => {\n const workflow = workflows.find((wf) => wf.id === id);\n if (workflow) {\n openDeleteDialog(workflow);\n }\n },\n [workflows, openDeleteDialog]\n );\n\n const handleRunWorkflow = useCallback(\n async (id: string) => {\n const workflow = workflows.find((wf) => wf.id === id);\n if (!workflow) return;\n\n setRunOutcome(null);\n // `executeWorkflow` swallows the Apollo error and resolves to null, so a\n // null result IS the failure signal — never treat it as a silent success.\n const result = await executeWorkflow(id);\n\n if (result) {\n if (isNative()) void nativeNotify('success');\n setRunOutcome({\n workflowName: workflow.name,\n ok: true,\n message: t(\n 'bigconsole.workflows.run.triggered',\n 'Run triggered. The execution count and last-run time update as the run progresses.'\n ),\n });\n return;\n }\n\n if (isNative()) void nativeNotify('error');\n setRunOutcome({\n workflowName: workflow.name,\n ok: false,\n message: t('bigconsole.workflows.run.failed', 'The workflow could not be started. Nothing has been changed.'),\n });\n },\n [workflows, executeWorkflow, t]\n );\n\n const handleDeleteConfirm = useCallback(async () => {\n if (currentWorkflow) {\n try {\n await deleteWorkflow(currentWorkflow.id);\n if (isNative()) void nativeNotify('success');\n } catch (err) {\n if (isNative()) void nativeNotify('error');\n throw err;\n }\n closeDeleteDialog();\n }\n }, [currentWorkflow, deleteWorkflow, closeDeleteDialog]);\n\n // Status filter options\n const statusOptions: { value: StatusFilter; label: string }[] = [\n { value: 'all', label: t('bigconsole.workflows.filters.all', 'All') },\n { value: 'draft', label: t('bigconsole.workflows.status.draft', 'Draft') },\n { value: 'active', label: t('bigconsole.workflows.status.active', 'Active') },\n { value: 'paused', label: t('bigconsole.workflows.status.paused', 'Paused') },\n { value: 'error', label: t('bigconsole.workflows.status.error', 'Error') },\n { value: 'archived', label: t('bigconsole.workflows.status.archived', 'Archived') },\n ];\n\n // Page-level read gate — only after permissions have finished loading so we\n // don't flash Access Denied while the permission set is still being fetched.\n if (!permissionsLoading && !canRead) {\n return (\n <AccessDenied\n title={t('bigconsole.workflows.errors.accessDeniedTitle', 'Access Denied')}\n description={t(\n 'bigconsole.workflows.errors.accessDeniedListDescription',\n \"You don't have permission to view workflows.\"\n )}\n />\n );\n }\n\n const isEmpty = !loading && workflows.length === 0;\n const isNoResults = !loading && filteredWorkflows.length === 0 && workflows.length > 0;\n\n return (\n <div data-tour=\"bigconsole-workflows-list\" className=\"min-h-dvh bg-bg-canvas\">\n {/* ------------------------------------------------------------------ *\n * Page header strip — `bare` emphasis: structural only. It carries the\n * page identity and the single create action, and must never out-weigh\n * the result set below it. Rendered as <header> (the page banner) so it\n * stays a landmark without competing with the labelled sections below.\n * The band itself was invisible before: `border-border-seam` and\n * `bg-gloss-card` are unregistered utilities that emit no CSS.\n * ------------------------------------------------------------------ */}\n <header\n data-section-emphasis=\"bare\"\n className=\"relative min-w-0 overflow-hidden border-b border-[var(--color-border-seam)] bg-[image:var(--gradient-gloss-card)]\"\n >\n <AuroraBackground intensity=\"subtle\" />\n <div className=\"relative flex flex-col gap-form-gap p-[var(--space-pagePadding)] sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"flex min-w-0 items-center gap-form-gap\">\n <span\n aria-hidden=\"true\"\n className=\"flex h-control-lg w-[var(--size-controlHeight-lg)] shrink-0 items-center justify-center rounded-card bg-action-primary-bg\"\n >\n <Workflow className=\"h-icon-lg w-icon-lg text-action-primary-text\" />\n </span>\n <div className=\"min-w-0\">\n <h1 className=\"text-2xl font-bold text-text-primary\">\n <GradientText>{t('bigconsole.workflows.list.title', 'Workflows')}</GradientText>\n </h1>\n <p className=\"text-sm text-text-secondary\">\n {t(\n 'bigconsole.workflows.list.subtitle',\n 'Design ETL workflows with FluidGrids and link them to DataSinks'\n )}\n </p>\n </div>\n </div>\n\n <div className=\"flex flex-wrap items-center gap-control-gap\">\n <PermissionButton permission={BIGCONSOLE_PERMISSIONS.WORKFLOW_CREATE} deniedBehavior=\"disable\">\n <Button onClick={handleCreateWorkflow}>\n <Plus className=\"h-icon-sm w-icon-sm\" />\n {t('bigconsole.workflows.actions.designWorkflow', 'Design Workflow')}\n </Button>\n </PermissionButton>\n </div>\n </div>\n </header>\n\n {/* Main Content */}\n <div className=\"p-[var(--space-pagePadding)]\">\n <SectionStack>\n <PagePurpose>\n {t(\n 'bigconsole.workflows.list.purpose',\n 'Workflows are visual ETL jobs built with the FluidGrids builder — they fetch data from external systems, transform it, and load it into your BigConsole DataSinks on a schedule or on demand. Use them to keep dashboards fed with fresh, shaped data without writing glue code.'\n )}\n </PagePurpose>\n\n {error ? (\n /* Load failure reads as a status section inside the page — the\n header band and the create action stay reachable. */\n <Section\n headingLevel={2}\n tone=\"danger\"\n title={t('bigconsole.workflows.errors.loadFailedTitle', 'Failed to load Workflows')}\n description=\"The workflow service did not respond. Nothing has been changed — retry when you are ready.\"\n icon={<AlertCircle className=\"h-icon-md w-icon-md\" />}\n actions={\n <Button size=\"sm\" onClick={() => refetch()}>\n {t('bigconsole.workflows.actions.tryAgain', 'Try Again')}\n </Button>\n }\n data-testid=\"workflows-error\"\n >\n <p className=\"break-words text-sm text-[var(--color-status-error-text)]\">{error.message}</p>\n </Section>\n ) : (\n <>\n {/* Configuration: the two filter controls read as ONE group. */}\n <Section\n headingLevel={2}\n title=\"Filters\"\n description=\"Narrow the list by status, or search by name, key or description.\"\n padding=\"compact\"\n data-testid=\"workflows-filters\"\n >\n <div className=\"flex flex-col gap-form-gap lg:flex-row lg:items-center lg:justify-between\">\n <div\n role=\"group\"\n aria-label=\"Filter workflows by status\"\n className=\"flex flex-wrap items-center gap-1 rounded-card bg-bg-sunken p-1\"\n >\n {statusOptions.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n aria-pressed={statusFilter === option.value}\n onClick={() => setStatusFilter(option.value)}\n className={`min-h-[var(--size-controlHeight-md)] rounded-button px-3 text-sm font-medium motion-safe:transition-colors ${SECTION_FOCUS_RING} ${\n statusFilter === option.value\n ? 'bg-bg-surface text-text-primary shadow-[var(--shadow-elevation-1)]'\n : 'text-text-secondary hover:text-text-primary'\n }`}\n >\n {option.label}\n </button>\n ))}\n </div>\n\n <div className=\"relative w-full lg:max-w-[360px]\">\n <Search\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute left-3 top-1/2 h-icon-sm w-icon-sm -translate-y-1/2 text-text-muted\"\n />\n <Input\n type=\"text\"\n aria-label={t('bigconsole.workflows.filters.searchPlaceholder', 'Search workflows...')}\n placeholder={t('bigconsole.workflows.filters.searchPlaceholder', 'Search workflows...')}\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"h-control-md pl-10\"\n />\n </div>\n </div>\n </Section>\n\n {/* ------------------------------------------------------------ *\n * The result set — the ONE `primary` block on this route.\n * Loading, empty, no-results and the grid all render inside it,\n * so the page keeps the same shape whatever the data does.\n * ------------------------------------------------------------ */}\n <Section\n headingLevel={2}\n emphasis=\"primary\"\n title={t('bigconsole.workflows.list.title', 'Workflows')}\n description=\"Every workflow in this workspace, most recently updated first.\"\n meta={\n <span className=\"rounded-pill bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-secondary\">\n {filteredWorkflows.length}\n {filteredWorkflows.length !== workflows.length ? ` of ${workflows.length}` : ''}\n </span>\n }\n data-testid=\"workflows-results\"\n >\n {loading && workflows.length === 0 && (\n <div className=\"flex min-h-[240px] items-center justify-center\">\n <div className=\"text-center\">\n <Spinner size=\"lg\" className=\"mb-form-gap\" />\n <p className=\"text-sm text-text-muted\">\n {t('bigconsole.workflows.list.loading', 'Loading workflows...')}\n </p>\n </div>\n </div>\n )}\n\n {isEmpty && (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={t('bigconsole.workflows.list.emptyTitle', 'No Workflows yet')}\n description={t(\n 'bigconsole.workflows.list.emptyDescription',\n 'Design ETL workflows with the FluidGrids visual builder to fetch, transform, and deliver data into BigConsole DataSinks.'\n )}\n action={\n <PermissionButton permission={BIGCONSOLE_PERMISSIONS.WORKFLOW_CREATE} deniedBehavior=\"disable\">\n <Button onClick={handleCreateWorkflow}>\n <Plus className=\"h-icon-sm w-icon-sm\" />\n {t('bigconsole.workflows.actions.designWorkflow', 'Design Workflow')}\n </Button>\n </PermissionButton>\n }\n />\n )}\n\n {isNoResults && (\n <IllustratedEmptyState\n illustration=\"empty-search\"\n title={t('bigconsole.workflows.list.noResultsTitle', 'No matching workflows')}\n description={t('bigconsole.workflows.list.noResultsDescription', 'No workflows match your filters')}\n />\n )}\n\n {runOutcome && (\n <div\n role=\"status\"\n aria-live=\"polite\"\n className={`mb-form-gap flex flex-wrap items-center justify-between gap-icon-gap rounded-input border p-3 text-sm ${\n runOutcome.ok\n ? 'border-[var(--color-status-success-border)] bg-[var(--color-status-success-bgSubtle)] text-[var(--color-status-success-text)]'\n : 'border-[var(--color-status-error-border)] bg-[var(--color-status-error-bgSubtle)] text-[var(--color-status-error-text)]'\n }`}\n data-testid=\"workflows-run-outcome\"\n >\n <span className=\"min-w-0\">\n <strong className=\"font-semibold\">{runOutcome.workflowName}</strong> — {runOutcome.message}\n </span>\n <button\n type=\"button\"\n onClick={() => setRunOutcome(null)}\n className={`rounded-button px-2 py-1 text-xs font-medium underline-offset-2 hover:underline ${SECTION_FOCUS_RING}`}\n >\n {t('bigconsole.workflows.run.dismiss', 'Dismiss')}\n </button>\n </div>\n )}\n\n {filteredWorkflows.length > 0 && (\n <div className=\"grid grid-cols-1 gap-form-gap sm:grid-cols-2 xl:grid-cols-3\">\n {filteredWorkflows.map((workflow) => (\n <WorkflowCard\n key={workflow.id}\n workflow={workflow}\n onView={handleViewWorkflow}\n onEdit={canUpdate ? handleEditWorkflow : undefined}\n onDelete={canDelete ? handleDeleteClick : undefined}\n onRun={canExecute ? handleRunWorkflow : undefined}\n isRunning={workflowUIStates.get(workflow.id)?.isExecuting ?? false}\n />\n ))}\n </div>\n )}\n </Section>\n </>\n )}\n </SectionStack>\n </div>\n\n {/* Delete Dialog */}\n {currentWorkflow && (\n <WorkflowDeleteDialog\n workflow={currentWorkflow}\n isOpen={deleteDialogOpen}\n onClose={closeDeleteDialog}\n onConfirm={handleDeleteConfirm}\n />\n )}\n </div>\n );\n});\n\nexport default WorkflowsPage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwDA,IAAa,IAAgB,EAAK,WAAyB;CACzD,IAAM,IAAW,GAAgB,EAC3B,EAAE,SAAM,GAAS,EAGjB,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,IAAU,EAAc,EAAuB,cAAc,EAC7D,IAAY,EAAc,EAAuB,gBAAgB,EACjE,IAAY,EAAc,EAAuB,gBAAgB,EACjE,IAAa,EAAc,EAAuB,iBAAiB,EAGnE,CAAC,GAAc,KAAmB,EAAuB,MAAM,EAE/D,CAAC,GAAY,KAAiB,EAA4B,KAAK,EAG/D,IAAc,GAAkB,MAAU,EAAM,YAAY,EAC5D,IAAiB,GAAkB,MAAU,EAAM,eAAe,EAClE,IAAmB,GAAkB,MAAU,EAAM,iBAAiB,EACtE,IAAkB,GAAkB,MAAU,EAAM,gBAAgB,EACpE,IAAmB,GAAkB,MAAU,EAAM,iBAAiB,EACtE,IAAoB,GAAkB,MAAU,EAAM,kBAAkB,EAGxE,EAAE,YAAS,UAAO,cAAW,mBAAgB,gBAAY,GAAuB,EAWhF,EAAE,uBAAoB,EAAsB,EAAE,WAAW,IAAM,CAAC,EAGhE,KAAmB,GAAkB,MAAU,EAAM,iBAAiB,EAGtE,IAAoB,QAAc;EACtC,IAAI,IAAW,CAAC,GAAG,EAAU;AAQ7B,MALI,MAAiB,UACnB,IAAW,EAAS,QAAQ,MAAO,EAAG,WAAW,EAAa,GAI5D,EAAY,MAAM,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D;OACE,MAAK;OACL,aAAU;OACV,WAAW,yGACT,EAAW,KACP,kIACA;OAEN,eAAY;iBARd,CAUE,kBAAC,QAAD;QAAM,WAAU;kBAAhB;SACE,kBAAC,UAAD;UAAQ,WAAU;oBAAiB,EAAW;UAAsB,CAAA;;SAAI,EAAW;SAC9E;WACP,kBAAC,UAAD;QACE,MAAK;QACL,eAAe,EAAc,KAAK;QAClC,WAAW;kBAEV,EAAE,oCAAoC,UAAU;QAC1C,CAAA,CACL;;MAGP,EAAkB,SAAS,KAC1B,kBAAC,OAAD;OAAK,WAAU;iBACZ,EAAkB,KAAK,MACtB,kBAAC,GAAD;QAEY;QACV,QAAQ;QACR,QAAQ,IAAY,KAAqB,KAAA;QACzC,UAAU,IAAY,IAAoB,KAAA;QAC1C,OAAO,IAAa,KAAoB,KAAA;QACxC,WAAW,GAAiB,IAAI,EAAS,GAAG,EAAE,eAAe;QAC7D,EAPK,EAAS,GAOd,CACF;OACE,CAAA;MAEA;OACT,EAAA,CAAA,CAEQ,EAAA,CAAA;IACX,CAAA;GAGL,KACC,kBAAC,GAAD;IACE,UAAU;IACV,QAAQ;IACR,SAAS;IACT,WAAW;IACX,CAAA;GAEA;;EAER"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ApolloClient, TypedDocumentNode } from '@apollo/client';
|
|
2
|
+
import { WorkflowDefinitionExistsQuery } from '../generated/wspace-operations';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Router state carried by the explicit "new workflow" navigation. Only a
|
|
6
|
+
* navigation to a freshly minted key may set it.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CREATE_WORKFLOW_STATE: {
|
|
9
|
+
readonly createWorkflow: true;
|
|
10
|
+
};
|
|
11
|
+
/** `NavigateOptions` for the explicit "new workflow" navigation. */
|
|
12
|
+
export declare const NEW_WORKFLOW_NAV: {
|
|
13
|
+
readonly state: {
|
|
14
|
+
readonly createWorkflow: true;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/** True only when router state came from an explicit "new workflow" navigation. */
|
|
18
|
+
export declare function isCreateIntent(state: unknown): boolean;
|
|
19
|
+
export type WorkflowKeyVerdict = 'found' | 'absent' | 'error';
|
|
20
|
+
/** The slice of Apollo's client this module needs (assignable from `ApolloClient`). */
|
|
21
|
+
export interface WorkflowLookupClient {
|
|
22
|
+
query: (options: {
|
|
23
|
+
query: TypedDocumentNode<WorkflowDefinitionExistsQuery, {
|
|
24
|
+
workflowKey: string;
|
|
25
|
+
}>;
|
|
26
|
+
variables: {
|
|
27
|
+
workflowKey: string;
|
|
28
|
+
};
|
|
29
|
+
fetchPolicy: 'network-only';
|
|
30
|
+
}) => Promise<{
|
|
31
|
+
data?: WorkflowDefinitionExistsQuery | undefined;
|
|
32
|
+
error?: unknown;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Narrows Apollo's generic client to the one call this module makes. An adapter,
|
|
37
|
+
* not a cast: the call is type-checked against the real `ApolloClient.query`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function toLookupClient(apollo: ApolloClient): WorkflowLookupClient;
|
|
40
|
+
/** One probe. Never throws: a failure is a verdict, not a "not found". */
|
|
41
|
+
export declare function probeWorkflowKey(client: WorkflowLookupClient, key: string): Promise<WorkflowKeyVerdict>;
|
|
42
|
+
export interface VerifyOptions {
|
|
43
|
+
/** Wait between the two probes. Defaults to the shell bootstrap delay. */
|
|
44
|
+
retryDelayMs?: number;
|
|
45
|
+
/** Injectable for tests. */
|
|
46
|
+
sleep?: (ms: number) => Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Does ANY version of `key` exist in the active workspace?
|
|
50
|
+
*
|
|
51
|
+
* Probes up to twice: on a cold full-page load the workspace token may not be
|
|
52
|
+
* issued when the first probe fires (see `BOOTSTRAP_RETRY_DELAY_MS`), and a
|
|
53
|
+
* wrongly "absent" verdict would show a false not-found for a real workflow.
|
|
54
|
+
* `found` ends it at once; otherwise the SECOND probe's verdict stands.
|
|
55
|
+
* Read-only: only ever issues a query.
|
|
56
|
+
*/
|
|
57
|
+
export declare function verifyWorkflowKey(client: WorkflowLookupClient, key: string, { retryDelayMs, sleep }?: VerifyOptions): Promise<WorkflowKeyVerdict>;
|
|
58
|
+
/** What the open guard shows for the key in the URL. */
|
|
59
|
+
export type WorkflowOpenView = 'builder' | 'not-found' | 'failed' | 'checking';
|
|
60
|
+
export interface WorkflowOpenState {
|
|
61
|
+
/** The key in the URL. */
|
|
62
|
+
key: string;
|
|
63
|
+
/** Router state said "new workflow" (an explicit create). */
|
|
64
|
+
createIntent: boolean;
|
|
65
|
+
/** Keys proven to exist (or explicitly created) in this session. */
|
|
66
|
+
verifiedKey: string | null;
|
|
67
|
+
/** The key the last lookup found nothing for. */
|
|
68
|
+
absentKey: string | null;
|
|
69
|
+
/** The key the last lookup failed for. */
|
|
70
|
+
failedKey: string | null;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The guard's whole decision. The builder (which creates on mount for an unknown
|
|
74
|
+
* key) is reachable ONLY through the first two clauses; every other state, and
|
|
75
|
+
* every state for a key nobody has vouched for, is not the builder.
|
|
76
|
+
*/
|
|
77
|
+
export declare function decideWorkflowOpenView({ key, createIntent, verifiedKey, absentKey, failedKey, }: WorkflowOpenState): WorkflowOpenView;
|
|
78
|
+
//# sourceMappingURL=workflowOpen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflowOpen.d.ts","sourceRoot":"","sources":["../../src/bigconsole/workflowOpen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAoC,KAAK,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAGtH;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;CAAoC,CAAC;AAEvE,oEAAoE;AACp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,GAAG,UAAU,CAAC;AAE/E,MAAM,WAAW,iBAAiB;IAChC,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,6DAA6D;IAC7D,YAAY,EAAE,OAAO,CAAC;IACtB,oEAAoE;IACpE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iDAAiD;IACjD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,0CAA0C;IAC1C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,GAAG,EACH,YAAY,EACZ,WAAW,EACX,SAAS,EACT,SAAS,GACV,EAAE,iBAAiB,GAAG,gBAAgB,CAMtC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { WorkflowDefinitionExistsDocument as e } from "../generated/wspace-operations.js";
|
|
2
|
+
import { BOOTSTRAP_RETRY_DELAY_MS as t } from "./constants.js";
|
|
3
|
+
//#region src/bigconsole/workflowOpen.ts
|
|
4
|
+
var n = { createWorkflow: !0 }, r = { state: n };
|
|
5
|
+
function i(e) {
|
|
6
|
+
return typeof e == "object" && !!e && e.createWorkflow === !0;
|
|
7
|
+
}
|
|
8
|
+
function a(e) {
|
|
9
|
+
return { query: (t) => e.query(t) };
|
|
10
|
+
}
|
|
11
|
+
async function o(t, n) {
|
|
12
|
+
try {
|
|
13
|
+
let r = await t.query({
|
|
14
|
+
query: e,
|
|
15
|
+
variables: { workflowKey: n },
|
|
16
|
+
fetchPolicy: "network-only"
|
|
17
|
+
});
|
|
18
|
+
return r.error ? "error" : r.data?.workflowDefinition ? "found" : "absent";
|
|
19
|
+
} catch {
|
|
20
|
+
return "error";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
var s = (e) => new Promise((t) => setTimeout(t, e));
|
|
24
|
+
async function c(e, n, { retryDelayMs: r = t, sleep: i = s } = {}) {
|
|
25
|
+
return await o(e, n) === "found" ? "found" : (await i(r), o(e, n));
|
|
26
|
+
}
|
|
27
|
+
function l({ key: e, createIntent: t, verifiedKey: n, absentKey: r, failedKey: i }) {
|
|
28
|
+
return t || n === e ? "builder" : r === e ? "not-found" : i === e ? "failed" : "checking";
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { n as CREATE_WORKFLOW_STATE, r as NEW_WORKFLOW_NAV, l as decideWorkflowOpenView, i as isCreateIntent, a as toLookupClient, c as verifyWorkflowKey };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=workflowOpen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflowOpen.js","names":[],"sources":["../../src/bigconsole/workflowOpen.ts"],"sourcesContent":["/**\n * Opening a workflow by its key must be READ-ONLY (BOFF-8060 F2).\n *\n * ★★★ THE DEFECT THIS CLOSES. `/workflows/workflow/:id/:version` renders the\n * FluidGrids SDK builder. On mount the SDK loads the definition for `:id` and,\n * when none exists, CREATES one (`CreateWorkflowDefinition`) so that \"Create\n * Workflow\" can hand out a fresh UUID. So ANY link to an unknown key — a stale\n * bookmark, a mistyped URL, a link the assistant composed — wrote a real row.\n * The prod verification of 2026-10-04 caught it as a refused mutation.\n *\n * ★ THE RULE. A route open never creates. The one legitimate create-on-open is\n * the person pressing \"New workflow\", and THAT navigation says so explicitly\n * with router state (`CREATE_WORKFLOW_STATE`). Everything else must first prove\n * the key exists (`verifyWorkflowKey`) before the builder mounts.\n *\n * ★ Framework-free on purpose: this module has no React so the verdict logic is\n * unit-testable without a DOM (this repo's tests run under `bun test`).\n */\nimport type { ApolloClient, TypedDocumentNode } from '@apollo/client';\n\nimport { WorkflowDefinitionExistsDocument, type WorkflowDefinitionExistsQuery } from '../generated/wspace-operations';\nimport { BOOTSTRAP_RETRY_DELAY_MS } from './constants';\n\n/**\n * Router state carried by the explicit \"new workflow\" navigation. Only a\n * navigation to a freshly minted key may set it.\n */\nexport const CREATE_WORKFLOW_STATE = { createWorkflow: true } as const;\n\n/** `NavigateOptions` for the explicit \"new workflow\" navigation. */\nexport const NEW_WORKFLOW_NAV = { state: CREATE_WORKFLOW_STATE } as const;\n\n/** True only when router state came from an explicit \"new workflow\" navigation. */\nexport function isCreateIntent(state: unknown): boolean {\n return typeof state === 'object' && state !== null && (state as { createWorkflow?: unknown }).createWorkflow === true;\n}\n\nexport type WorkflowKeyVerdict = 'found' | 'absent' | 'error';\n\n/** The slice of Apollo's client this module needs (assignable from `ApolloClient`). */\nexport interface WorkflowLookupClient {\n query: (options: {\n query: TypedDocumentNode<WorkflowDefinitionExistsQuery, { workflowKey: string }>;\n variables: { workflowKey: string };\n fetchPolicy: 'network-only';\n }) => Promise<{ data?: WorkflowDefinitionExistsQuery | undefined; error?: unknown }>;\n}\n\n/**\n * Narrows Apollo's generic client to the one call this module makes. An adapter,\n * not a cast: the call is type-checked against the real `ApolloClient.query`.\n */\nexport function toLookupClient(apollo: ApolloClient): WorkflowLookupClient {\n return { query: (options) => apollo.query(options) };\n}\n\n/** One probe. Never throws: a failure is a verdict, not a \"not found\". */\nexport async function probeWorkflowKey(client: WorkflowLookupClient, key: string): Promise<WorkflowKeyVerdict> {\n try {\n const result = await client.query({\n query: WorkflowDefinitionExistsDocument,\n variables: { workflowKey: key },\n fetchPolicy: 'network-only',\n });\n // fe-libs' Apollo client runs with errorPolicy \"all\": a refused query\n // RESOLVES with `{ error }` instead of rejecting. Read it, or a transient\n // failure would be reported as \"this workflow does not exist\".\n if (result.error) return 'error';\n return result.data?.workflowDefinition ? 'found' : 'absent';\n } catch {\n return 'error';\n }\n}\n\nexport interface VerifyOptions {\n /** Wait between the two probes. Defaults to the shell bootstrap delay. */\n retryDelayMs?: number;\n /** Injectable for tests. */\n sleep?: (ms: number) => Promise<void>;\n}\n\nconst defaultSleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));\n\n/**\n * Does ANY version of `key` exist in the active workspace?\n *\n * Probes up to twice: on a cold full-page load the workspace token may not be\n * issued when the first probe fires (see `BOOTSTRAP_RETRY_DELAY_MS`), and a\n * wrongly \"absent\" verdict would show a false not-found for a real workflow.\n * `found` ends it at once; otherwise the SECOND probe's verdict stands.\n * Read-only: only ever issues a query.\n */\nexport async function verifyWorkflowKey(\n client: WorkflowLookupClient,\n key: string,\n { retryDelayMs = BOOTSTRAP_RETRY_DELAY_MS, sleep = defaultSleep }: VerifyOptions = {}\n): Promise<WorkflowKeyVerdict> {\n const first = await probeWorkflowKey(client, key);\n if (first === 'found') return 'found';\n await sleep(retryDelayMs);\n return probeWorkflowKey(client, key);\n}\n\n/** What the open guard shows for the key in the URL. */\nexport type WorkflowOpenView = 'builder' | 'not-found' | 'failed' | 'checking';\n\nexport interface WorkflowOpenState {\n /** The key in the URL. */\n key: string;\n /** Router state said \"new workflow\" (an explicit create). */\n createIntent: boolean;\n /** Keys proven to exist (or explicitly created) in this session. */\n verifiedKey: string | null;\n /** The key the last lookup found nothing for. */\n absentKey: string | null;\n /** The key the last lookup failed for. */\n failedKey: string | null;\n}\n\n/**\n * The guard's whole decision. The builder (which creates on mount for an unknown\n * key) is reachable ONLY through the first two clauses; every other state, and\n * every state for a key nobody has vouched for, is not the builder.\n */\nexport function decideWorkflowOpenView({\n key,\n createIntent,\n verifiedKey,\n absentKey,\n failedKey,\n}: WorkflowOpenState): WorkflowOpenView {\n if (createIntent) return 'builder';\n if (verifiedKey === key) return 'builder';\n if (absentKey === key) return 'not-found';\n if (failedKey === key) return 'failed';\n return 'checking';\n}\n"],"mappings":";;;AA2BA,IAAa,IAAwB,EAAE,gBAAgB,IAAM,EAGhD,IAAmB,EAAE,OAAO,GAAuB;AAGhE,SAAgB,EAAe,GAAyB;AACtD,QAAO,OAAO,KAAU,cAAY,KAAmB,EAAuC,mBAAmB;;AAkBnH,SAAgB,EAAe,GAA4C;AACzE,QAAO,EAAE,QAAQ,MAAY,EAAO,MAAM,EAAQ,EAAE;;AAItD,eAAsB,EAAiB,GAA8B,GAA0C;AAC7G,KAAI;EACF,IAAM,IAAS,MAAM,EAAO,MAAM;GAChC,OAAO;GACP,WAAW,EAAE,aAAa,GAAK;GAC/B,aAAa;GACd,CAAC;AAKF,SADI,EAAO,QAAc,UAClB,EAAO,MAAM,qBAAqB,UAAU;SAC7C;AACN,SAAO;;;AAWX,IAAM,KAAgB,MAAe,IAAI,SAAe,MAAY,WAAW,GAAS,EAAG,CAAC;AAW5F,eAAsB,EACpB,GACA,GACA,EAAE,kBAAe,GAA0B,WAAQ,MAAgC,EAAE,EACxD;AAI7B,QAHc,MAAM,EAAiB,GAAQ,EAAI,KACnC,UAAgB,WAC9B,MAAM,EAAM,EAAa,EAClB,EAAiB,GAAQ,EAAI;;AAwBtC,SAAgB,EAAuB,EACrC,QACA,iBACA,gBACA,cACA,gBACsC;AAKtC,QAJI,KACA,MAAgB,IAAY,YAC5B,MAAc,IAAY,cAC1B,MAAc,IAAY,WACvB"}
|
|
@@ -6802,6 +6802,18 @@ export type ListWorkflowsQuery = {
|
|
|
6802
6802
|
}>;
|
|
6803
6803
|
}>;
|
|
6804
6804
|
};
|
|
6805
|
+
export type WorkflowDefinitionExistsQueryVariables = Types.Exact<{
|
|
6806
|
+
workflowKey: Types.Scalars['String']['input'];
|
|
6807
|
+
}>;
|
|
6808
|
+
export type WorkflowDefinitionExistsQuery = {
|
|
6809
|
+
__typename?: 'Query';
|
|
6810
|
+
workflowDefinition?: {
|
|
6811
|
+
__typename?: 'WorkflowDefinition';
|
|
6812
|
+
id: string;
|
|
6813
|
+
workflowKey: string;
|
|
6814
|
+
version: string;
|
|
6815
|
+
} | null;
|
|
6816
|
+
};
|
|
6805
6817
|
export declare const EntityCommentFieldsFragmentDoc: Apollo.DocumentNode;
|
|
6806
6818
|
export declare const DashboardCoreFieldsFragmentDoc: Apollo.DocumentNode;
|
|
6807
6819
|
export declare const DashboardEmbedPolicyFieldsFragmentDoc: Apollo.DocumentNode;
|
|
@@ -11110,4 +11122,34 @@ export type ListWorkflowsQueryHookResult = ReturnType<typeof useListWorkflowsQue
|
|
|
11110
11122
|
export type ListWorkflowsLazyQueryHookResult = ReturnType<typeof useListWorkflowsLazyQuery>;
|
|
11111
11123
|
export type ListWorkflowsSuspenseQueryHookResult = ReturnType<typeof useListWorkflowsSuspenseQuery>;
|
|
11112
11124
|
export type ListWorkflowsQueryResult = Apollo.QueryResult<Types.ListWorkflowsQuery, Types.ListWorkflowsQueryVariables>;
|
|
11125
|
+
export declare const WorkflowDefinitionExistsDocument: Apollo.DocumentNode;
|
|
11126
|
+
/**
|
|
11127
|
+
* __useWorkflowDefinitionExistsQuery__
|
|
11128
|
+
*
|
|
11129
|
+
* To run a query within a React component, call `useWorkflowDefinitionExistsQuery` and pass it any options that fit your needs.
|
|
11130
|
+
* When your component renders, `useWorkflowDefinitionExistsQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
|
11131
|
+
* you can use to render your UI.
|
|
11132
|
+
*
|
|
11133
|
+
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
|
11134
|
+
*
|
|
11135
|
+
* @example
|
|
11136
|
+
* const { data, loading, error } = useWorkflowDefinitionExistsQuery({
|
|
11137
|
+
* variables: {
|
|
11138
|
+
* workflowKey: // value for 'workflowKey'
|
|
11139
|
+
* },
|
|
11140
|
+
* });
|
|
11141
|
+
*/
|
|
11142
|
+
export declare function useWorkflowDefinitionExistsQuery(baseOptions: ApolloReactHooks.QueryHookOptions<Types.WorkflowDefinitionExistsQuery, Types.WorkflowDefinitionExistsQueryVariables> & ({
|
|
11143
|
+
variables: Types.WorkflowDefinitionExistsQueryVariables;
|
|
11144
|
+
skip?: boolean;
|
|
11145
|
+
} | {
|
|
11146
|
+
skip: boolean;
|
|
11147
|
+
})): ApolloReactHooks.useQuery.Result<Types.WorkflowDefinitionExistsQuery, Types.WorkflowDefinitionExistsQueryVariables, "empty" | "complete" | "streaming", Types.WorkflowDefinitionExistsQueryVariables>;
|
|
11148
|
+
export declare function useWorkflowDefinitionExistsLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions<Types.WorkflowDefinitionExistsQuery, Types.WorkflowDefinitionExistsQueryVariables>): ApolloReactHooks.useLazyQuery.ResultTuple<Types.WorkflowDefinitionExistsQuery, Types.WorkflowDefinitionExistsQueryVariables, "empty" | "complete" | "streaming">;
|
|
11149
|
+
export declare function useWorkflowDefinitionExistsSuspenseQuery(baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<Types.WorkflowDefinitionExistsQuery, Types.WorkflowDefinitionExistsQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.WorkflowDefinitionExistsQuery, Types.WorkflowDefinitionExistsQueryVariables>;
|
|
11150
|
+
export declare function useWorkflowDefinitionExistsSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.WorkflowDefinitionExistsQuery, Types.WorkflowDefinitionExistsQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.WorkflowDefinitionExistsQuery | undefined, Types.WorkflowDefinitionExistsQueryVariables>;
|
|
11151
|
+
export type WorkflowDefinitionExistsQueryHookResult = ReturnType<typeof useWorkflowDefinitionExistsQuery>;
|
|
11152
|
+
export type WorkflowDefinitionExistsLazyQueryHookResult = ReturnType<typeof useWorkflowDefinitionExistsLazyQuery>;
|
|
11153
|
+
export type WorkflowDefinitionExistsSuspenseQueryHookResult = ReturnType<typeof useWorkflowDefinitionExistsSuspenseQuery>;
|
|
11154
|
+
export type WorkflowDefinitionExistsQueryResult = Apollo.QueryResult<Types.WorkflowDefinitionExistsQuery, Types.WorkflowDefinitionExistsQueryVariables>;
|
|
11113
11155
|
//# sourceMappingURL=wspace-operations.d.ts.map
|