@burdenoff/microfe-planmagnet 2026.930.19 → 2026.930.21

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.
Files changed (61) hide show
  1. package/dist/index.js +2 -1
  2. package/dist/planmagnet/PlanMagnetRoutes.d.ts.map +1 -1
  3. package/dist/planmagnet/PlanMagnetRoutes.js +17 -5
  4. package/dist/planmagnet/PlanMagnetRoutes.js.map +1 -1
  5. package/dist/planmagnet/automation/AutomationExecutionsPanel.d.ts.map +1 -1
  6. package/dist/planmagnet/automation/AutomationExecutionsPanel.js +43 -39
  7. package/dist/planmagnet/automation/AutomationExecutionsPanel.js.map +1 -1
  8. package/dist/planmagnet/automation/AutomationRuleFields.d.ts +23 -4
  9. package/dist/planmagnet/automation/AutomationRuleFields.d.ts.map +1 -1
  10. package/dist/planmagnet/automation/AutomationRuleFields.js +255 -108
  11. package/dist/planmagnet/automation/AutomationRuleFields.js.map +1 -1
  12. package/dist/planmagnet/automation/automationRuleTypes.d.ts +138 -15
  13. package/dist/planmagnet/automation/automationRuleTypes.d.ts.map +1 -1
  14. package/dist/planmagnet/automation/automationRuleTypes.js +162 -22
  15. package/dist/planmagnet/automation/automationRuleTypes.js.map +1 -1
  16. package/dist/planmagnet/controls/AutomationRuleControls.d.ts.map +1 -1
  17. package/dist/planmagnet/controls/AutomationRuleControls.js +76 -71
  18. package/dist/planmagnet/controls/AutomationRuleControls.js.map +1 -1
  19. package/dist/planmagnet/controls/SyncControls.d.ts +101 -0
  20. package/dist/planmagnet/controls/SyncControls.d.ts.map +1 -0
  21. package/dist/planmagnet/controls/SyncControls.js +616 -0
  22. package/dist/planmagnet/controls/SyncControls.js.map +1 -0
  23. package/dist/planmagnet/index.d.ts +1 -0
  24. package/dist/planmagnet/index.d.ts.map +1 -1
  25. package/dist/planmagnet/index.js +1 -0
  26. package/dist/planmagnet/integrations/routes.d.ts +13 -0
  27. package/dist/planmagnet/integrations/routes.d.ts.map +1 -0
  28. package/dist/planmagnet/integrations/routes.js +9 -0
  29. package/dist/planmagnet/integrations/routes.js.map +1 -0
  30. package/dist/planmagnet/integrations/syncTypes.d.ts +143 -0
  31. package/dist/planmagnet/integrations/syncTypes.d.ts.map +1 -0
  32. package/dist/planmagnet/integrations/syncTypes.js +71 -0
  33. package/dist/planmagnet/integrations/syncTypes.js.map +1 -0
  34. package/dist/planmagnet/integrations/useSyncProviderCapabilities.d.ts +8 -0
  35. package/dist/planmagnet/integrations/useSyncProviderCapabilities.d.ts.map +1 -0
  36. package/dist/planmagnet/integrations/useSyncProviderCapabilities.js +27 -0
  37. package/dist/planmagnet/integrations/useSyncProviderCapabilities.js.map +1 -0
  38. package/dist/planmagnet/pages/AutomationAutomationRuleDetailPagePage.d.ts.map +1 -1
  39. package/dist/planmagnet/pages/AutomationAutomationRuleDetailPagePage.js +85 -76
  40. package/dist/planmagnet/pages/AutomationAutomationRuleDetailPagePage.js.map +1 -1
  41. package/dist/planmagnet/pages/AutomationAutomationRulesPagePage.js +12 -12
  42. package/dist/planmagnet/pages/AutomationAutomationRulesPagePage.js.map +1 -1
  43. package/dist/planmagnet/pages/AutomationCreateAutomationRulePagePage.d.ts.map +1 -1
  44. package/dist/planmagnet/pages/AutomationCreateAutomationRulePagePage.js +48 -44
  45. package/dist/planmagnet/pages/AutomationCreateAutomationRulePagePage.js.map +1 -1
  46. package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.d.ts +2 -0
  47. package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.d.ts.map +1 -0
  48. package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.js +411 -0
  49. package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.js.map +1 -0
  50. package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.d.ts +2 -0
  51. package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.d.ts.map +1 -0
  52. package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.js +593 -0
  53. package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.js.map +1 -0
  54. package/dist/planmagnet/pages/IntegrationsSyncsPagePage.d.ts +2 -0
  55. package/dist/planmagnet/pages/IntegrationsSyncsPagePage.d.ts.map +1 -0
  56. package/dist/planmagnet/pages/IntegrationsSyncsPagePage.js +267 -0
  57. package/dist/planmagnet/pages/IntegrationsSyncsPagePage.js.map +1 -0
  58. package/dist/planmagnet/people/People.d.ts.map +1 -1
  59. package/dist/planmagnet/people/People.js +30 -17
  60. package/dist/planmagnet/people/People.js.map +1 -1
  61. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyncControls.js","names":[],"sources":["../../../src/planmagnet/controls/SyncControls.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport {\n Badge,\n Button,\n Input,\n Textarea,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogTrigger,\n} from '@burdenoff/fe-libs/ui';\nimport {\n AlertTriangle,\n ChevronDown,\n ChevronUp,\n Loader2,\n Pause,\n Pencil,\n Play,\n PlugZap,\n X,\n} from 'lucide-react';\nimport { throwOnError } from '../utils/mutationResult';\nimport { isForbidden, mutationErrorMessage } from '../utils/graphqlErrors';\nimport { ConfirmButton, ErrorLine } from './ConfirmButton';\nimport { enumLabel } from './WorkItemControls';\nimport { useSyncProviderCapabilities } from '../integrations/useSyncProviderCapabilities';\nimport {\n CONFLICT_RESOLUTIONS,\n directionLabel,\n directionSupported,\n GITHUB_FIELD_MAPPING_DEFAULTS,\n isValidGithubOwner,\n isValidGithubRepo,\n parseGithubFieldMapping,\n SYNC_DIRECTIONS,\n type ConflictResolution,\n type RunHealth,\n type SyncConnectionTestResult,\n type SyncDirection,\n type SyncRunResult,\n type SyncStatus,\n} from '../integrations/syncTypes';\n\n/**\n * Shared row/detail controls for External Sync (AUT-09/10/24/40): status badges, health, run/pause/resume/test\n * actions and conflict resolution. Every write here follows the same two rules the rest of this MFE does\n * (`utils/mutationResult.ts`, `utils/graphqlErrors.ts`): a refused mutation is surfaced, never swallowed, and a\n * FORBIDDEN refusal reads as \"your role can view but not change this\" rather than a raw GraphQL error string —\n * this page cannot know ahead of time whether the viewer's role allows a given write, so it always offers the\n * action and reports the refusal if and when it happens, rather than guessing at a client-side role check.\n */\n\nexport const SYNC_LIST_QUERIES = ['SyncsList'];\nexport const SYNC_DETAIL_QUERIES = ['SyncDetail', 'SyncRuns', 'SyncConflicts'];\n\nconst STATUS_VARIANT: Record<\n SyncStatus,\n 'default' | 'success' | 'warning' | 'info' | 'secondary' | 'destructive' | 'outline'\n> = {\n IDLE: 'secondary',\n SYNCING: 'info',\n SUCCESS: 'success',\n FAILED: 'destructive',\n PAUSED: 'warning',\n DISABLED: 'outline',\n};\n\nexport function SyncStatusBadge({ status }: { status: string }) {\n return (\n <Badge variant={STATUS_VARIANT[status as SyncStatus] ?? 'outline'} className=\"text-xs\">\n {enumLabel(status)}\n </Badge>\n );\n}\n\nconst RUN_STATUS_VARIANT: Record<string, 'success' | 'destructive' | 'warning'> = {\n SUCCEEDED: 'success',\n FAILED: 'destructive',\n PARTIAL: 'warning',\n};\n\nexport function SyncRunStatusBadge({ status }: { status: string }) {\n return (\n <Badge variant={RUN_STATUS_VARIANT[status] ?? 'secondary'} className=\"text-xs\">\n {enumLabel(status)}\n </Badge>\n );\n}\n\nexport function ConflictStatusBadge({ status }: { status: string }) {\n return (\n <Badge variant={status === 'OPEN' ? 'warning' : 'secondary'} className=\"text-xs\">\n {enumLabel(status)}\n </Badge>\n );\n}\n\n/** A long string (a sync's `lastSyncError`, an issue body) collapsed to `max` chars with an expand toggle. */\nexport function TruncatedText({\n text,\n max = 140,\n className = 'text-muted-foreground',\n testId,\n}: {\n text: string;\n max?: number;\n className?: string;\n testId?: string;\n}) {\n const [expanded, setExpanded] = useState(false);\n if (text.length <= max) return <span className={className}>{text}</span>;\n return (\n <span data-testid={testId}>\n <span className={className}>{expanded ? text : `${text.slice(0, max)}…`}</span>{' '}\n <button\n type=\"button\"\n className=\"inline-flex items-center gap-0.5 text-xs font-medium text-primary hover:underline\"\n aria-expanded={expanded}\n onClick={() => setExpanded((v) => !v)}\n >\n {expanded ? (\n <>\n Show less <ChevronUp className=\"h-3 w-3\" aria-hidden=\"true\" />\n </>\n ) : (\n <>\n Show more <ChevronDown className=\"h-3 w-3\" aria-hidden=\"true\" />\n </>\n )}\n </button>\n </span>\n );\n}\n\n/**\n * Last run time/status + consecutive-failure streak (AUT-09/22). `consecutiveFailures` is 0 once the latest run\n * did not fail — highlighted only while it is actually nonzero, never merely because the last run failed once\n * and then recovered.\n */\nexport function SyncHealthSummary({ health }: { health: RunHealth }) {\n return (\n <div className=\"flex flex-wrap items-center gap-2 text-xs\" data-testid=\"sync-health\">\n {health.lastRunAt ? (\n <>\n <span className=\"text-muted-foreground\">\n Last run {new Date(health.lastRunAt).toLocaleString()}\n </span>\n {health.lastStatus && <SyncRunStatusBadge status={health.lastStatus} />}\n </>\n ) : (\n <span className=\"text-muted-foreground\">Never run</span>\n )}\n {health.consecutiveFailures > 0 && (\n <span className=\"inline-flex items-center gap-1 font-medium text-status-error-text\">\n <AlertTriangle className=\"h-3 w-3\" aria-hidden=\"true\" />\n {health.consecutiveFailures} run{health.consecutiveFailures === 1 ? '' : 's'} failed in a\n row\n </span>\n )}\n <span className=\"text-muted-foreground\">\n {health.runsLast7Days} run(s) in the last 7 days\n </span>\n </div>\n );\n}\n\nconst START_SYNC = gql`\n mutation SyncControlsStartSync($id: ID!) {\n planmagnetStartSync(id: $id) {\n syncId\n success\n itemsCreated\n itemsUpdated\n itemsSkipped\n errorCount\n errors\n conflictCount\n durationMs\n syncedAt\n }\n }\n`;\n\n/** \"Run now\" (AUT-40): starts a sync in the direction `ExternalSync.direction` already records, and reports the\n * real result — including an honest `NOT_IMPLEMENTED` outcome for a provider with no live connector, never a\n * fabricated success. */\nexport function RunNowButton({\n syncId,\n onResult,\n size = 'sm',\n}: {\n syncId: string;\n onResult?: (result: SyncRunResult) => void;\n size?: 'sm' | 'default';\n}) {\n const [start, state] = useMutation<{ planmagnetStartSync: SyncRunResult }>(START_SYNC, {\n refetchQueries: [...SYNC_LIST_QUERIES, ...SYNC_DETAIL_QUERIES],\n });\n const [error, setError] = useState<string | null>(null);\n\n const run = async () => {\n setError(null);\n try {\n const res = await throwOnError(start({ variables: { id: syncId } }));\n if (res.data) onResult?.(res.data.planmagnetStartSync);\n } catch (e) {\n setError(\n isForbidden(e)\n ? 'Your role can view integrations but not change them.'\n : mutationErrorMessage(e, 'The sync could not be started.')\n );\n }\n };\n\n return (\n <div className=\"flex flex-col items-start gap-1\">\n <Button\n size={size}\n variant=\"outline\"\n disabled={state.loading}\n onClick={() => void run()}\n data-testid=\"sync-run-now\"\n >\n {state.loading ? (\n <Loader2 className=\"mr-1 h-4 w-4 animate-spin\" />\n ) : (\n <PlugZap className=\"mr-1 h-4 w-4\" />\n )}\n Run now\n </Button>\n {error && <ErrorLine message={error} />}\n </div>\n );\n}\n\n/**\n * What `planmagnetStartSync` actually did (AUT-40). A completed run is a normal GraphQL success even when the\n * sync itself failed on every item — bad token, unreachable provider, a refused status transition, … — the\n * service records `success: false` with `errors` populated rather than throwing (see\n * `sync.service.ts`'s `runGithubImport`/`runGithubExport`). This is the one place that outcome is rendered, so\n * every `RunNowButton` call site wires its `onResult` here instead of relying on a delayed list/detail refetch.\n */\nexport function SyncRunResultSummary({ result }: { result: SyncRunResult }) {\n return (\n <div\n role=\"status\"\n className={`space-y-1 rounded-md border p-3 text-sm ${\n result.success\n ? 'border-border bg-muted text-status-success-text'\n : 'border-destructive/40 text-status-error-text'\n }`}\n data-testid=\"sync-run-result\"\n >\n <p className=\"font-medium\">{result.success ? 'Sync run succeeded.' : 'Sync run failed.'}</p>\n <p className=\"text-xs text-muted-foreground\">\n {result.itemsCreated} created · {result.itemsUpdated} updated · {result.itemsSkipped}{' '}\n skipped\n {result.conflictCount > 0\n ? ` · ${result.conflictCount} conflict${result.conflictCount === 1 ? '' : 's'}`\n : ''}\n </p>\n {result.errors && result.errors.length > 0 && (\n <ul className=\"list-disc space-y-0.5 pl-4 text-xs\">\n {result.errors.map((message, i) => (\n <li key={i}>{message}</li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n\nconst PAUSE_SYNC = gql`\n mutation SyncControlsPause($id: ID!) {\n planmagnetPauseExternalSync(id: $id) {\n id\n status\n }\n }\n`;\nconst RESUME_SYNC = gql`\n mutation SyncControlsResume($id: ID!) {\n planmagnetResumeExternalSync(id: $id) {\n id\n status\n }\n }\n`;\n\n/** Pause when active, Resume when PAUSED — the only two states these two mutations move between. */\nexport function PauseResumeButton({ syncId, status }: { syncId: string; status: string }) {\n const [pause, pauseState] = useMutation(PAUSE_SYNC, { refetchQueries: SYNC_LIST_QUERIES });\n const [resume, resumeState] = useMutation(RESUME_SYNC, { refetchQueries: SYNC_LIST_QUERIES });\n const [error, setError] = useState<string | null>(null);\n const loading = pauseState.loading || resumeState.loading;\n const paused = status === 'PAUSED';\n\n const toggle = async () => {\n setError(null);\n try {\n if (paused) {\n await throwOnError(resume({ variables: { id: syncId } }));\n } else {\n await throwOnError(pause({ variables: { id: syncId } }));\n }\n } catch (e) {\n setError(\n isForbidden(e)\n ? 'Your role can view integrations but not change them.'\n : mutationErrorMessage(e, `The sync could not be ${paused ? 'resumed' : 'paused'}.`)\n );\n }\n };\n\n return (\n <div className=\"flex flex-col items-start gap-1\">\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={loading}\n onClick={() => void toggle()}\n data-testid={paused ? 'sync-resume' : 'sync-pause'}\n >\n {loading ? (\n <Loader2 className=\"mr-1 h-4 w-4 animate-spin\" />\n ) : paused ? (\n <Play className=\"mr-1 h-4 w-4\" />\n ) : (\n <Pause className=\"mr-1 h-4 w-4\" />\n )}\n {paused ? 'Resume' : 'Pause'}\n </Button>\n {error && <ErrorLine message={error} />}\n </div>\n );\n}\n\nconst TEST_SYNC = gql`\n mutation SyncControlsTest($id: ID!) {\n planmagnetTestExternalSync(id: $id) {\n ok\n message\n rateLimitRemaining\n }\n }\n`;\n\n/** AUT-23/20 — probes the connection through the real connector, writing nothing. Offered whenever the page can\n * reach it; a provider with no live connector still answers, honestly, with `ok: false`. */\nexport function TestConnectionButton({ syncId }: { syncId: string }) {\n const [test, state] = useMutation<{ planmagnetTestExternalSync: SyncConnectionTestResult }>(\n TEST_SYNC\n );\n const [result, setResult] = useState<SyncConnectionTestResult | null>(null);\n const [error, setError] = useState<string | null>(null);\n\n const run = async () => {\n setError(null);\n setResult(null);\n try {\n const res = await throwOnError(test({ variables: { id: syncId } }));\n if (res.data) setResult(res.data.planmagnetTestExternalSync);\n } catch (e) {\n setError(\n isForbidden(e)\n ? 'Your role can view integrations but not change them.'\n : mutationErrorMessage(e, 'The connection could not be tested.')\n );\n }\n };\n\n return (\n <div className=\"flex flex-col items-start gap-1\">\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={state.loading}\n onClick={() => void run()}\n data-testid=\"sync-test-connection\"\n >\n {state.loading ? <Loader2 className=\"mr-1 h-4 w-4 animate-spin\" /> : null}\n Test connection\n </Button>\n {result && (\n <p\n className={`text-sm ${result.ok ? 'text-status-success-text' : 'text-status-error-text'}`}\n data-testid=\"sync-test-result\"\n >\n {result.ok ? 'Connected: ' : 'Failed: '}\n {result.message}\n {result.rateLimitRemaining !== null && ` (${result.rateLimitRemaining} calls remaining)`}\n </p>\n )}\n {error && <ErrorLine message={error} />}\n </div>\n );\n}\n\nconst DELETE_SYNC = gql`\n mutation SyncControlsDelete($id: ID!) {\n planmagnetDeleteExternalSync(id: $id)\n }\n`;\n\nexport function DeleteSyncButton({\n syncId,\n label,\n /** Passed by the detail page, which leaves for the list afterward — see LEAVES_PAGE_CONTEXT's own doc. */\n onDeleted,\n}: {\n syncId: string;\n label: string;\n onDeleted?: () => void;\n}) {\n const [remove, { loading }] = useMutation(DELETE_SYNC, { refetchQueries: SYNC_LIST_QUERIES });\n const [error, setError] = useState<string | null>(null);\n\n const onDelete = async () => {\n setError(null);\n try {\n await throwOnError(remove({ variables: { id: syncId } }));\n onDeleted?.();\n } catch (e) {\n setError(\n isForbidden(e)\n ? 'Your role can view integrations but not change them.'\n : mutationErrorMessage(e, 'The sync could not be deleted.')\n );\n }\n };\n\n return (\n <div className=\"flex flex-col items-end gap-1\">\n <ConfirmButton\n label=\"Delete\"\n variant=\"outline\"\n icon={<X className=\"mr-1 h-4 w-4\" />}\n title={`Delete \"${label}\"?`}\n description=\"This stops the sync and removes its configuration and run/conflict history. Work items already created from it are kept.\"\n confirmLabel=\"Delete sync\"\n destructive\n disabled={loading}\n onConfirm={() => void onDelete()}\n testId=\"sync-delete\"\n />\n {error && <ErrorLine message={error} />}\n </div>\n );\n}\n\nconst RESOLVE_CONFLICT = gql`\n mutation SyncControlsResolveConflict($id: ID!, $resolution: PlanmagnetSyncConflictResolution!) {\n planmagnetResolveSyncConflict(id: $id, resolution: $resolution) {\n id\n status\n resolution\n resolvedAt\n resolvedBy\n }\n }\n`;\n\n/** AUT-10/24 — SOURCE_WINS/TARGET_WINS actually push/pull the winning side's data; MANUAL just closes the flag.\n * A refused or failed resolution (e.g. the provider call itself fails) throws server-side and leaves the\n * conflict OPEN rather than recording a resolution that never happened — so on error this shows the reason and\n * the conflict stays in the list exactly as it was. */\nexport function ConflictResolveActions({ conflictId }: { conflictId: string }) {\n const [resolve, state] = useMutation(RESOLVE_CONFLICT, { refetchQueries: SYNC_DETAIL_QUERIES });\n const [error, setError] = useState<string | null>(null);\n const [pending, setPending] = useState<ConflictResolution | null>(null);\n\n const act = async (resolution: ConflictResolution) => {\n setError(null);\n setPending(resolution);\n try {\n await throwOnError(resolve({ variables: { id: conflictId, resolution } }));\n } catch (e) {\n setError(\n isForbidden(e)\n ? 'Your role can view integrations but not change them.'\n : mutationErrorMessage(e, 'The conflict could not be resolved.')\n );\n } finally {\n setPending(null);\n }\n };\n\n return (\n <div className=\"flex flex-col items-start gap-1\" data-testid=\"sync-conflict-resolve\">\n <div className=\"flex flex-wrap gap-2\">\n <Button\n size=\"sm\"\n disabled={state.loading}\n onClick={() => void act('SOURCE_WINS')}\n data-testid=\"sync-conflict-keep-local\"\n >\n {pending === 'SOURCE_WINS' && <Loader2 className=\"mr-1 h-4 w-4 animate-spin\" />}\n Keep PlanMagnet\n </Button>\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={state.loading}\n onClick={() => void act('TARGET_WINS')}\n data-testid=\"sync-conflict-take-provider\"\n >\n {pending === 'TARGET_WINS' && <Loader2 className=\"mr-1 h-4 w-4 animate-spin\" />}\n Take provider\n </Button>\n <Button\n size=\"sm\"\n variant=\"ghost\"\n disabled={state.loading}\n onClick={() => void act('MANUAL')}\n data-testid=\"sync-conflict-dismiss\"\n >\n {pending === 'MANUAL' && <Loader2 className=\"mr-1 h-4 w-4 animate-spin\" />}\n Dismiss (manual)\n </Button>\n </div>\n {error && <ErrorLine message={error} />}\n </div>\n );\n}\n\nexport const CONFLICT_STRATEGY_EXPLANATION: Record<ConflictResolution, string> = {\n SOURCE_WINS:\n 'PlanMagnet wins — the local work item overwrites the provider on a detected conflict.',\n TARGET_WINS: 'Provider wins — the external tool overwrites PlanMagnet on a detected conflict.',\n MANUAL: 'Flag and skip — a conflict is recorded and left alone until resolved here.',\n};\n\nconst FIELD = 'mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm';\n\nconst GET_SYNC_CONNECTION = gql`\n query SyncControlsConnection($id: ID!) {\n planmagnetExternalSync(id: $id) {\n id\n connectionConfig\n }\n }\n`;\n\nconst UPDATE_SYNC = gql`\n mutation SyncControlsUpdate($id: ID!, $input: PlanmagnetUpdateExternalSyncInput!) {\n planmagnetUpdateExternalSync(id: $id, input: $input) {\n id\n direction\n conflictStrategy\n fieldMapping\n syncFilters\n externalProjectId\n externalProjectUrl\n }\n }\n`;\n\nexport interface EditableSync {\n id: string;\n provider: string;\n direction: SyncDirection;\n conflictStrategy: ConflictResolution;\n fieldMapping: unknown;\n syncFilters: unknown;\n}\n\n/**\n * The one \"Edit settings\" surface for a sync: direction, conflict strategy, field mapping and sync filters, plus\n * — for GITHUB only, where `connectionConfig`'s shape is real and known (`{ token, owner, repo }`) — an explicit\n * \"Replace connection\" group. The token is never pre-filled (it reads back as `[REDACTED]`, which must never be\n * echoed into the input or resent as if it were real); owner/repo are not secret and DO read back real values, so\n * they pre-fill and stay editable. Because `PlanmagnetUpdateExternalSyncInput.connectionConfig` REPLACES the\n * whole stored config rather than merging, changing owner or repo without also supplying a fresh token would\n * discard the stored token — so the form requires all three together whenever any of the three changed, and\n * sends none of them (keeping the stored connection untouched) when none did.\n */\nexport function EditSyncDialog({ sync }: { sync: EditableSync }) {\n const [open, setOpen] = useState(false);\n const isGithub = sync.provider === 'GITHUB';\n const { capabilities } = useSyncProviderCapabilities();\n const capability = capabilities.find((c) => c.provider === sync.provider);\n const allowedDirections = capability\n ? SYNC_DIRECTIONS.filter((d) => directionSupported(capability, d))\n : SYNC_DIRECTIONS;\n\n const initialMapping = parseGithubFieldMapping(sync.fieldMapping);\n const initialFiltersText = sync.syncFilters ? JSON.stringify(sync.syncFilters, null, 2) : '';\n\n const [direction, setDirection] = useState<SyncDirection>(sync.direction);\n const [conflictStrategy, setConflictStrategy] = useState<ConflictResolution>(\n sync.conflictStrategy\n );\n const [priorityPrefix, setPriorityPrefix] = useState(initialMapping.priority);\n const [dueDatePrefix, setDueDatePrefix] = useState(initialMapping.dueDate);\n const [filtersText, setFiltersText] = useState(initialFiltersText);\n const [filtersError, setFiltersError] = useState<string | null>(null);\n // Raw user edits, '' meaning \"untouched\". `effectiveOwner`/`effectiveRepo` below fall back to the real,\n // non-secret value the query loads — no `useEffect` seeding required (and none of the cascading-render risk\n // it brings): until the user types, the field simply displays the loaded value; the moment they type anything,\n // their edit takes over, even if it round-trips to the same text.\n const [owner, setOwner] = useState('');\n const [repo, setRepo] = useState('');\n const [token, setToken] = useState('');\n const [error, setError] = useState<string | null>(null);\n\n const { data: connectionData } = useQuery<{\n planmagnetExternalSync: { id: string; connectionConfig: Record<string, unknown> } | null;\n }>(GET_SYNC_CONNECTION, { variables: { id: sync.id }, skip: !open || !isGithub });\n\n const config = connectionData?.planmagnetExternalSync?.connectionConfig;\n const loadedOwner = typeof config?.owner === 'string' ? config.owner : '';\n const loadedRepo = typeof config?.repo === 'string' ? config.repo : '';\n const effectiveOwner = owner || loadedOwner;\n const effectiveRepo = repo || loadedRepo;\n\n const resetForm = () => {\n setDirection(sync.direction);\n setConflictStrategy(sync.conflictStrategy);\n setPriorityPrefix(initialMapping.priority);\n setDueDatePrefix(initialMapping.dueDate);\n setFiltersText(initialFiltersText);\n setFiltersError(null);\n setOwner('');\n setRepo('');\n setToken('');\n setError(null);\n };\n\n const [update, state] = useMutation(UPDATE_SYNC, {\n refetchQueries: [...SYNC_LIST_QUERIES, ...SYNC_DETAIL_QUERIES],\n });\n\n const connectionChanged =\n isGithub &&\n !!config &&\n (effectiveOwner !== loadedOwner || effectiveRepo !== loadedRepo || token.trim() !== '');\n const mappingChanged =\n priorityPrefix.trim() !== initialMapping.priority ||\n dueDatePrefix.trim() !== initialMapping.dueDate;\n const filtersChanged = filtersText.trim() !== initialFiltersText.trim();\n\n const save = async () => {\n setError(null);\n setFiltersError(null);\n const input: Record<string, unknown> = {};\n if (direction !== sync.direction) input.direction = direction;\n if (conflictStrategy !== sync.conflictStrategy) input.conflictStrategy = conflictStrategy;\n if (mappingChanged) {\n input.fieldMapping = {\n ...(priorityPrefix.trim() ? { priority: priorityPrefix.trim() } : {}),\n ...(dueDatePrefix.trim() ? { dueDate: dueDatePrefix.trim() } : {}),\n };\n }\n if (filtersChanged) {\n const trimmed = filtersText.trim();\n if (!trimmed) {\n input.syncFilters = null;\n } else {\n try {\n input.syncFilters = JSON.parse(trimmed);\n } catch {\n setFiltersError('Sync filters must be valid JSON.');\n return;\n }\n }\n }\n if (connectionChanged) {\n if (!token.trim() || !effectiveOwner.trim() || !effectiveRepo.trim()) {\n setError('Changing the owner, repo or token requires all three — re-enter the token too.');\n return;\n }\n if (!isValidGithubOwner(effectiveOwner) || !isValidGithubRepo(effectiveRepo)) {\n setError(\n 'Owner and repo must look like real GitHub names (letters, digits, \"-\", \"_\", \".\").'\n );\n return;\n }\n input.connectionConfig = {\n token: token.trim(),\n owner: effectiveOwner.trim(),\n repo: effectiveRepo.trim(),\n };\n }\n if (Object.keys(input).length === 0) {\n setOpen(false);\n return;\n }\n try {\n await throwOnError(update({ variables: { id: sync.id, input } }));\n setOpen(false);\n } catch (e) {\n setError(\n isForbidden(e)\n ? 'Your role can view integrations but not change them.'\n : mutationErrorMessage(e, 'The sync could not be saved.')\n );\n }\n };\n\n return (\n <ResponsiveDialog\n open={open}\n onOpenChange={(next) => {\n setOpen(next);\n if (!next) resetForm();\n }}\n >\n <ResponsiveDialogTrigger asChild>\n <Button size=\"sm\" variant=\"outline\" data-testid=\"sync-edit-settings\">\n <Pencil className=\"mr-1 h-4 w-4\" />\n Edit settings\n </Button>\n </ResponsiveDialogTrigger>\n <ResponsiveDialogContent className=\"max-w-lg max-h-[85vh] overflow-y-auto\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>Edit sync settings</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>Only changed fields are saved.</ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n <div className=\"space-y-4\">\n <div>\n <span className=\"text-sm font-medium\">Direction</span>\n <div className=\"mt-1 flex flex-col gap-1\" role=\"radiogroup\" aria-label=\"Direction\">\n {allowedDirections.map((d) => (\n <label key={d} className=\"flex items-center gap-2 text-sm\">\n <input\n type=\"radio\"\n name=\"sync-edit-direction\"\n checked={direction === d}\n onChange={() => setDirection(d)}\n />\n {directionLabel(d)}\n </label>\n ))}\n </div>\n </div>\n <div>\n <label htmlFor=\"sync-edit-strategy\" className=\"text-sm font-medium\">\n Conflict strategy\n </label>\n <select\n id=\"sync-edit-strategy\"\n className={FIELD}\n value={conflictStrategy}\n onChange={(e) => setConflictStrategy(e.target.value as ConflictResolution)}\n >\n {CONFLICT_RESOLUTIONS.map((r) => (\n <option key={r} value={r}>\n {enumLabel(r)}\n </option>\n ))}\n </select>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {CONFLICT_STRATEGY_EXPLANATION[conflictStrategy]}\n </p>\n </div>\n {isGithub && (\n <div className=\"space-y-2 rounded-md border p-3\">\n <p className=\"text-sm font-medium\">Field mapping (GitHub labels)</p>\n <p className=\"text-xs text-muted-foreground\">\n GitHub issues have no native priority or due-date field — PlanMagnet encodes each as\n a label of the form <code>prefix+value</code> (e.g. <code>priority:HIGH</code>).\n Leave blank to use the built-in prefix.\n </p>\n <div>\n <label\n htmlFor=\"sync-edit-priority-prefix\"\n className=\"text-xs text-muted-foreground\"\n >\n Priority label prefix (default &quot;{GITHUB_FIELD_MAPPING_DEFAULTS.priority}\n &quot;)\n </label>\n <Input\n id=\"sync-edit-priority-prefix\"\n className=\"mt-1\"\n placeholder={GITHUB_FIELD_MAPPING_DEFAULTS.priority}\n value={priorityPrefix}\n onChange={(e) => setPriorityPrefix(e.target.value)}\n />\n </div>\n <div>\n <label htmlFor=\"sync-edit-duedate-prefix\" className=\"text-xs text-muted-foreground\">\n Due-date label prefix (default &quot;{GITHUB_FIELD_MAPPING_DEFAULTS.dueDate}\n &quot;)\n </label>\n <Input\n id=\"sync-edit-duedate-prefix\"\n className=\"mt-1\"\n placeholder={GITHUB_FIELD_MAPPING_DEFAULTS.dueDate}\n value={dueDatePrefix}\n onChange={(e) => setDueDatePrefix(e.target.value)}\n />\n </div>\n </div>\n )}\n <div>\n <label htmlFor=\"sync-edit-filters\" className=\"text-sm font-medium\">\n Sync filters (advanced, JSON)\n </label>\n <p className=\"text-xs text-muted-foreground\">\n Stored on the sync but not yet read by any run — reserved for a future filtering\n feature. Leave blank unless you know you need this.\n </p>\n <Textarea\n id=\"sync-edit-filters\"\n className=\"mt-1 font-mono text-xs min-h-[72px]\"\n value={filtersText}\n onChange={(e) => setFiltersText(e.target.value)}\n />\n {filtersError && <ErrorLine message={filtersError} />}\n </div>\n {isGithub && (\n <div className=\"space-y-2 rounded-md border p-3\">\n <p className=\"text-sm font-medium\">Replace connection</p>\n <p className=\"text-xs text-muted-foreground\">\n The token is never shown once saved. Changing the owner, repo or token requires\n re-entering all three — PlanMagnet cannot resend the stored token for you.\n </p>\n <div>\n <label htmlFor=\"sync-edit-owner\" className=\"text-xs text-muted-foreground\">\n Owner\n </label>\n <Input\n id=\"sync-edit-owner\"\n className=\"mt-1\"\n value={effectiveOwner}\n onChange={(e) => setOwner(e.target.value)}\n />\n </div>\n <div>\n <label htmlFor=\"sync-edit-repo\" className=\"text-xs text-muted-foreground\">\n Repository\n </label>\n <Input\n id=\"sync-edit-repo\"\n className=\"mt-1\"\n value={effectiveRepo}\n onChange={(e) => setRepo(e.target.value)}\n />\n </div>\n <div>\n <label htmlFor=\"sync-edit-token\" className=\"text-xs text-muted-foreground\">\n Replace token\n </label>\n <Input\n id=\"sync-edit-token\"\n type=\"password\"\n autoComplete=\"off\"\n className=\"mt-1\"\n placeholder=\"Leave blank to keep the current token\"\n value={token}\n onChange={(e) => setToken(e.target.value)}\n data-testid=\"sync-edit-token\"\n />\n </div>\n </div>\n )}\n {error && <ErrorLine message={error} />}\n </div>\n <ResponsiveDialogFooter>\n <Button\n variant=\"outline\"\n onClick={() => {\n resetForm();\n setOpen(false);\n }}\n >\n Cancel\n </Button>\n <Button\n onClick={() => void save()}\n disabled={state.loading}\n data-testid=\"sync-edit-submit\"\n >\n {state.loading ? 'Saving…' : 'Save'}\n </Button>\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA0DA,IAAa,IAAoB,CAAC,YAAY,EACjC,IAAsB;CAAC;CAAc;CAAY;CAAgB,EAExE,IAGF;CACF,MAAM;CACN,SAAS;CACT,SAAS;CAC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N,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;SAAO,SAAQ;SAAiB,WAAU;mBAAgC;SAElE,CAAA,EACR,kBAAC,GAAD;SACE,IAAG;SACH,WAAU;SACV,OAAO;SACP,WAAW,MAAM,EAAQ,EAAE,OAAO,MAAM;SACxC,CAAA,CACE,EAAA,CAAA;QACN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;SAAO,SAAQ;SAAkB,WAAU;mBAAgC;SAEnE,CAAA,EACR,kBAAC,GAAD;SACE,IAAG;SACH,MAAK;SACL,cAAa;SACb,WAAU;SACV,aAAY;SACZ,OAAO;SACP,WAAW,MAAM,EAAS,EAAE,OAAO,MAAM;SACzC,eAAY;SACZ,CAAA,CACE,EAAA,CAAA;QACF;;MAEP,KAAS,kBAAC,GAAD,EAAW,SAAS,GAAS,CAAA;MACnC;;IACN,kBAAC,IAAD,EAAA,UAAA,CACE,kBAAC,GAAD;KACE,SAAQ;KACR,eAAe;AAEb,MADA,IAAW,EACX,EAAQ,GAAM;;eAEjB;KAEQ,CAAA,EACT,kBAAC,GAAD;KACE,eAAe,KAAK,IAAM;KAC1B,UAAU,EAAM;KAChB,eAAY;eAEX,EAAM,UAAU,YAAY;KACtB,CAAA,CACc,EAAA,CAAA;IACD;KACT"}
@@ -3,4 +3,5 @@ export { PlanMagnetAdminRoot } from './admin/PlanMagnetAdminRoot';
3
3
  export type { PlanMagnetRootProps, NavItem, FooterItem } from './types';
4
4
  export { usePlanMagnet, usePlanMagnetNavigate } from './providers/PlanMagnetProvider';
5
5
  export { usePlanMagnetStore } from './store/planmagnetStore';
6
+ export { INTEGRATIONS_SYNCS_PATH, INTEGRATIONS_NEW_SYNC_PATH, INTEGRATIONS_SYNC_DETAIL_PATH, integrationsSyncDetailPath, } from './integrations/routes';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/planmagnet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,YAAY,EAAE,mBAAmB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/planmagnet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,YAAY,EAAE,mBAAmB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,uBAAuB,CAAC"}
@@ -2,3 +2,4 @@ import "./providers/PlanMagnetProvider.js";
2
2
  import "./PlanMagnetRoot.js";
3
3
  import "./admin/PlanMagnetAdminRoot.js";
4
4
  import "./store/planmagnetStore.js";
5
+ import "./integrations/routes.js";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Integrations (sync) route targets (AUT-08/40/09/06/10/24), exported so the host shell (`planmagnet-app`, where
3
+ * the "Integrations" sidebar entry itself lives) can build a `NavItem` against real, routed paths instead of a
4
+ * hand-typed string that can drift from `PlanMagnetRoutes.tsx`. Relative, no leading slash — the same form
5
+ * `PlanMagnetRoot.tsx` passes through `joinPath(basePath, ...)` for every other nav entry in this package, and
6
+ * the same form `path="…"` carries in `PlanMagnetRoutes.tsx`.
7
+ */
8
+ export declare const INTEGRATIONS_SYNCS_PATH = "integrations/syncs-page";
9
+ export declare const INTEGRATIONS_NEW_SYNC_PATH = "integrations/new-sync-page";
10
+ export declare const INTEGRATIONS_SYNC_DETAIL_PATH = "integrations/sync-detail-page";
11
+ /** `integrations/sync-detail-page/<id>` for a specific sync, or the bare list path with no id yet. */
12
+ export declare function integrationsSyncDetailPath(id: string | null | undefined): string;
13
+ //# sourceMappingURL=routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/integrations/routes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AACjE,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AACvE,eAAO,MAAM,6BAA6B,kCAAkC,CAAC;AAE7E,sGAAsG;AACtG,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAIhF"}
@@ -0,0 +1,9 @@
1
+ //#region src/planmagnet/integrations/routes.ts
2
+ var e = "integrations/syncs-page", t = "integrations/new-sync-page", n = "integrations/sync-detail-page";
3
+ function r(t) {
4
+ return t ? `${n}/${encodeURIComponent(t)}` : e;
5
+ }
6
+ //#endregion
7
+ export { t as INTEGRATIONS_NEW_SYNC_PATH, e as INTEGRATIONS_SYNCS_PATH, n as INTEGRATIONS_SYNC_DETAIL_PATH, r as integrationsSyncDetailPath };
8
+
9
+ //# sourceMappingURL=routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.js","names":[],"sources":["../../../src/planmagnet/integrations/routes.ts"],"sourcesContent":["/**\n * Integrations (sync) route targets (AUT-08/40/09/06/10/24), exported so the host shell (`planmagnet-app`, where\n * the \"Integrations\" sidebar entry itself lives) can build a `NavItem` against real, routed paths instead of a\n * hand-typed string that can drift from `PlanMagnetRoutes.tsx`. Relative, no leading slash — the same form\n * `PlanMagnetRoot.tsx` passes through `joinPath(basePath, ...)` for every other nav entry in this package, and\n * the same form `path=\"…\"` carries in `PlanMagnetRoutes.tsx`.\n */\nexport const INTEGRATIONS_SYNCS_PATH = 'integrations/syncs-page';\nexport const INTEGRATIONS_NEW_SYNC_PATH = 'integrations/new-sync-page';\nexport const INTEGRATIONS_SYNC_DETAIL_PATH = 'integrations/sync-detail-page';\n\n/** `integrations/sync-detail-page/<id>` for a specific sync, or the bare list path with no id yet. */\nexport function integrationsSyncDetailPath(id: string | null | undefined): string {\n return id\n ? `${INTEGRATIONS_SYNC_DETAIL_PATH}/${encodeURIComponent(id)}`\n : INTEGRATIONS_SYNCS_PATH;\n}\n"],"mappings":";AAOA,IAAa,IAA0B,2BAC1B,IAA6B,8BAC7B,IAAgC;AAG7C,SAAgB,EAA2B,GAAuC;AAChF,QAAO,IACH,GAAG,EAA8B,GAAG,mBAAmB,EAAG,KAC1D"}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Shared shapes and constants for External Sync (AUT-06/08/09/10/20/22/23/24/40) — GraphQL Hive doc comments and
3
+ * `wspace-planmagnet-svc#63` are the source of truth for all of this, not guesswork:
4
+ *
5
+ * - GITHUB is the one provider with a real, live connector today (`github-connector.ts`); every other
6
+ * `PlanmagnetSyncProvider` is accepted by `planmagnetCreateExternalSync` (a customer can configure it ahead of
7
+ * time) but has no live connector, which `planmagnetSupportedSyncProviders` reports honestly (every capability
8
+ * flag false except `supportsFileImport`, which is the unrelated `planmagnetImportExternalIssues` CSV/JSON
9
+ * upload path, not an `ExternalSync` live run). The wizard reads that capability list rather than hard-coding
10
+ * "GitHub only" — if a second connector ships, this UI lights up for it automatically.
11
+ * - `ExternalSync.connectionConfig` for GITHUB is `{ token, owner, repo }` and is REDACTED server-side on every
12
+ * read (`token` -> `[REDACTED]`; `owner`/`repo` are not secret and pass through). It must never be displayed as
13
+ * if it still held the token, and never round-tripped back to the server as if `[REDACTED]` were a real value.
14
+ * - `ExternalSync.fieldMapping` for GITHUB is exactly two optional label-prefix strings —
15
+ * `{ priority?: string; dueDate?: string }` (default `"priority:"` / `"due:"`) — because GitHub Issues have no
16
+ * native priority or due-date column; the connector encodes/decodes them as a label of the form
17
+ * `{prefix}{value}` (e.g. `priority:HIGH`, `due:2026-10-01`). This is the only field-mapping shape the live
18
+ * connector reads; it is NOT the (unrelated) CSV/JSON import's column-name mapping.
19
+ * - `PlanmagnetUpdateExternalSyncInput.connectionConfig` REPLACES the whole stored config — it does not merge —
20
+ * so an edit that changes only the token must resend `owner`/`repo` too (read back from the redacted
21
+ * `connectionConfig`, which is safe since only `token` is masked), and an edit that changes owner/repo without a
22
+ * new token cannot be sent at all (the real token can never be read back to resend it). See
23
+ * `controls/SyncControls.tsx`'s `EditSyncConnectionDialog`.
24
+ */
25
+ export declare const SYNC_PROVIDERS: readonly ["JIRA", "GITHUB", "GITLAB", "AZURE_DEVOPS", "ASANA", "TRELLO", "LINEAR", "SHORTCUT", "CLICKUP", "CUSTOM"];
26
+ export type SyncProvider = (typeof SYNC_PROVIDERS)[number];
27
+ export declare const SYNC_DIRECTIONS: readonly ["INBOUND", "OUTBOUND", "BIDIRECTIONAL"];
28
+ export type SyncDirection = (typeof SYNC_DIRECTIONS)[number];
29
+ export declare const SYNC_STATUSES: readonly ["IDLE", "SYNCING", "SUCCESS", "FAILED", "PAUSED", "DISABLED"];
30
+ export type SyncStatus = (typeof SYNC_STATUSES)[number];
31
+ export declare const CONFLICT_RESOLUTIONS: readonly ["SOURCE_WINS", "TARGET_WINS", "MANUAL"];
32
+ export type ConflictResolution = (typeof CONFLICT_RESOLUTIONS)[number];
33
+ export declare const CONFLICT_STATUSES: readonly ["OPEN", "RESOLVED"];
34
+ export type ConflictStatus = (typeof CONFLICT_STATUSES)[number];
35
+ export declare const SYNC_RUN_STATUSES: readonly ["SUCCEEDED", "FAILED", "PARTIAL"];
36
+ export type SyncRunStatus = (typeof SYNC_RUN_STATUSES)[number];
37
+ /** The two GitHub label-prefix keys `ExternalSync.fieldMapping` actually understands (github-connector.ts). */
38
+ export declare const GITHUB_FIELD_MAPPING_KEYS: readonly ["priority", "dueDate"];
39
+ export type GithubFieldMappingKey = (typeof GITHUB_FIELD_MAPPING_KEYS)[number];
40
+ /** The connector's own built-in defaults, used only as placeholder copy — never assumed server-side. */
41
+ export declare const GITHUB_FIELD_MAPPING_DEFAULTS: Record<GithubFieldMappingKey, string>;
42
+ export interface ProjectRef {
43
+ id: string;
44
+ name: string;
45
+ }
46
+ export interface RunHealth {
47
+ lastRunAt: string | null;
48
+ lastStatus: SyncRunStatus | null;
49
+ consecutiveFailures: number;
50
+ runsLast7Days: number;
51
+ }
52
+ export interface ExternalSyncRow {
53
+ id: string;
54
+ provider: SyncProvider;
55
+ direction: SyncDirection;
56
+ status: SyncStatus;
57
+ projectId: string;
58
+ project: ProjectRef | null;
59
+ externalProjectId: string;
60
+ externalProjectUrl: string | null;
61
+ conflictStrategy: ConflictResolution;
62
+ fieldMapping: unknown;
63
+ /** Stored but not yet read by any run (sync.service.ts) — surfaced honestly in the edit form, not hidden. */
64
+ syncFilters: unknown;
65
+ lastSyncedAt: string | null;
66
+ lastSyncError: string | null;
67
+ totalItemsSynced: number;
68
+ createdAt: string;
69
+ updatedAt: string;
70
+ runHealth: RunHealth;
71
+ }
72
+ export interface SyncProviderCapability {
73
+ provider: SyncProvider;
74
+ supportsImport: boolean;
75
+ supportsExport: boolean;
76
+ supportsBidirectional: boolean;
77
+ supportsFileImport: boolean;
78
+ supportsConnectionTest: boolean;
79
+ }
80
+ export interface SyncRunRow {
81
+ id: string;
82
+ direction: SyncDirection;
83
+ status: SyncRunStatus;
84
+ startedAt: string;
85
+ finishedAt: string;
86
+ itemsCreated: number;
87
+ itemsUpdated: number;
88
+ itemsSkipped: number;
89
+ errorCount: number;
90
+ conflictCount: number;
91
+ errorMessage: string | null;
92
+ triggeredBy: string;
93
+ }
94
+ export interface ExternalMappingRef {
95
+ id: string;
96
+ internalId: string;
97
+ internalType: string;
98
+ externalId: string;
99
+ externalType: string;
100
+ externalUrl: string | null;
101
+ }
102
+ export interface SyncConflictRow {
103
+ id: string;
104
+ createdAt: string;
105
+ fields: string[];
106
+ localUpdatedAt: string;
107
+ remoteUpdatedAt: string;
108
+ resolution: ConflictResolution | null;
109
+ resolvedAt: string | null;
110
+ resolvedBy: string | null;
111
+ status: ConflictStatus;
112
+ mapping: ExternalMappingRef | null;
113
+ mappingId: string;
114
+ }
115
+ /** `PlanmagnetSyncResult` — what `planmagnetStartSync` returns. */
116
+ export interface SyncRunResult {
117
+ syncId: string;
118
+ success: boolean;
119
+ itemsCreated: number;
120
+ itemsUpdated: number;
121
+ itemsSkipped: number;
122
+ errorCount: number;
123
+ errors: string[] | null;
124
+ conflictCount: number;
125
+ durationMs: number | null;
126
+ syncedAt: string;
127
+ }
128
+ /** `PlanmagnetSyncConnectionTestResult` — what `planmagnetTestExternalSync` returns. */
129
+ export interface SyncConnectionTestResult {
130
+ ok: boolean;
131
+ message: string;
132
+ rateLimitRemaining: number | null;
133
+ }
134
+ export declare function providerLabel(provider: string): string;
135
+ export declare function directionLabel(direction: string): string;
136
+ /** Whether a capability supports a given direction at all — the single gate the wizard and the edit form both use. */
137
+ export declare function directionSupported(capability: Pick<SyncProviderCapability, 'supportsImport' | 'supportsExport' | 'supportsBidirectional'>, direction: SyncDirection): boolean;
138
+ /** True once a provider can run at least one live direction — the gate for selecting it in the wizard at all. */
139
+ export declare function providerIsLive(capability: Pick<SyncProviderCapability, 'supportsImport' | 'supportsExport' | 'supportsBidirectional'>): boolean;
140
+ export declare function isValidGithubOwner(value: string): boolean;
141
+ export declare function isValidGithubRepo(value: string): boolean;
142
+ export declare function parseGithubFieldMapping(value: unknown): Record<GithubFieldMappingKey, string>;
143
+ //# sourceMappingURL=syncTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncTypes.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/integrations/syncTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;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AAM,GAAG,MAAM,CAEtD;AAQD,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,sHAAsH;AACtH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,IAAI,CACd,sBAAsB,EACtB,gBAAgB,GAAG,gBAAgB,GAAG,uBAAuB,CAC9D,EACD,SAAS,EAAE,aAAa,GACvB,OAAO,CAIT;AAED,iHAAiH;AACjH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,IAAI,CACd,sBAAsB,EACtB,gBAAgB,GAAG,gBAAgB,GAAG,uBAAuB,CAC9D,GACA,OAAO,CAET;AAYD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEzD;AACD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAQ7F"}
@@ -0,0 +1,71 @@
1
+ //#region src/planmagnet/integrations/syncTypes.ts
2
+ var e = [
3
+ "INBOUND",
4
+ "OUTBOUND",
5
+ "BIDIRECTIONAL"
6
+ ], t = [
7
+ "IDLE",
8
+ "SYNCING",
9
+ "SUCCESS",
10
+ "FAILED",
11
+ "PAUSED",
12
+ "DISABLED"
13
+ ], n = [
14
+ "SOURCE_WINS",
15
+ "TARGET_WINS",
16
+ "MANUAL"
17
+ ], r = ["priority", "dueDate"], i = {
18
+ priority: "priority:",
19
+ dueDate: "due:"
20
+ }, a = {
21
+ JIRA: "Jira",
22
+ GITHUB: "GitHub",
23
+ GITLAB: "GitLab",
24
+ AZURE_DEVOPS: "Azure DevOps",
25
+ ASANA: "Asana",
26
+ TRELLO: "Trello",
27
+ LINEAR: "Linear",
28
+ SHORTCUT: "Shortcut",
29
+ CLICKUP: "ClickUp",
30
+ CUSTOM: "Custom"
31
+ };
32
+ function o(e) {
33
+ return a[e] ?? e;
34
+ }
35
+ var s = {
36
+ INBOUND: "Inbound (provider → PlanMagnet)",
37
+ OUTBOUND: "Outbound (PlanMagnet → provider)",
38
+ BIDIRECTIONAL: "Bidirectional (both ways)"
39
+ };
40
+ function c(e) {
41
+ return s[e] ?? e;
42
+ }
43
+ function l(e, t) {
44
+ return t === "INBOUND" ? e.supportsImport : t === "OUTBOUND" ? e.supportsExport : e.supportsBidirectional;
45
+ }
46
+ function u(e) {
47
+ return e.supportsImport || e.supportsExport || e.supportsBidirectional;
48
+ }
49
+ var d = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/, f = /^[A-Za-z0-9._-]{1,100}$/;
50
+ function p(e) {
51
+ return d.test(e.trim());
52
+ }
53
+ function m(e) {
54
+ return f.test(e.trim());
55
+ }
56
+ function h(e) {
57
+ let t = {
58
+ priority: "",
59
+ dueDate: ""
60
+ };
61
+ if (!e || typeof e != "object" || Array.isArray(e)) return t;
62
+ for (let n of r) {
63
+ let r = e[n];
64
+ typeof r == "string" && r.trim() && (t[n] = r.trim());
65
+ }
66
+ return t;
67
+ }
68
+ //#endregion
69
+ export { n as CONFLICT_RESOLUTIONS, i as GITHUB_FIELD_MAPPING_DEFAULTS, e as SYNC_DIRECTIONS, t as SYNC_STATUSES, c as directionLabel, l as directionSupported, p as isValidGithubOwner, m as isValidGithubRepo, h as parseGithubFieldMapping, u as providerIsLive, o as providerLabel };
70
+
71
+ //# sourceMappingURL=syncTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncTypes.js","names":[],"sources":["../../../src/planmagnet/integrations/syncTypes.ts"],"sourcesContent":["/**\n * Shared shapes and constants for External Sync (AUT-06/08/09/10/20/22/23/24/40) — GraphQL Hive doc comments and\n * `wspace-planmagnet-svc#63` are the source of truth for all of this, not guesswork:\n *\n * - GITHUB is the one provider with a real, live connector today (`github-connector.ts`); every other\n * `PlanmagnetSyncProvider` is accepted by `planmagnetCreateExternalSync` (a customer can configure it ahead of\n * time) but has no live connector, which `planmagnetSupportedSyncProviders` reports honestly (every capability\n * flag false except `supportsFileImport`, which is the unrelated `planmagnetImportExternalIssues` CSV/JSON\n * upload path, not an `ExternalSync` live run). The wizard reads that capability list rather than hard-coding\n * \"GitHub only\" — if a second connector ships, this UI lights up for it automatically.\n * - `ExternalSync.connectionConfig` for GITHUB is `{ token, owner, repo }` and is REDACTED server-side on every\n * read (`token` -> `[REDACTED]`; `owner`/`repo` are not secret and pass through). It must never be displayed as\n * if it still held the token, and never round-tripped back to the server as if `[REDACTED]` were a real value.\n * - `ExternalSync.fieldMapping` for GITHUB is exactly two optional label-prefix strings —\n * `{ priority?: string; dueDate?: string }` (default `\"priority:\"` / `\"due:\"`) — because GitHub Issues have no\n * native priority or due-date column; the connector encodes/decodes them as a label of the form\n * `{prefix}{value}` (e.g. `priority:HIGH`, `due:2026-10-01`). This is the only field-mapping shape the live\n * connector reads; it is NOT the (unrelated) CSV/JSON import's column-name mapping.\n * - `PlanmagnetUpdateExternalSyncInput.connectionConfig` REPLACES the whole stored config — it does not merge —\n * so an edit that changes only the token must resend `owner`/`repo` too (read back from the redacted\n * `connectionConfig`, which is safe since only `token` is masked), and an edit that changes owner/repo without a\n * new token cannot be sent at all (the real token can never be read back to resend it). See\n * `controls/SyncControls.tsx`'s `EditSyncConnectionDialog`.\n */\n\nexport const SYNC_PROVIDERS = [\n 'JIRA',\n 'GITHUB',\n 'GITLAB',\n 'AZURE_DEVOPS',\n 'ASANA',\n 'TRELLO',\n 'LINEAR',\n 'SHORTCUT',\n 'CLICKUP',\n 'CUSTOM',\n] as const;\nexport type SyncProvider = (typeof SYNC_PROVIDERS)[number];\n\nexport const SYNC_DIRECTIONS = ['INBOUND', 'OUTBOUND', 'BIDIRECTIONAL'] as const;\nexport type SyncDirection = (typeof SYNC_DIRECTIONS)[number];\n\nexport const SYNC_STATUSES = [\n 'IDLE',\n 'SYNCING',\n 'SUCCESS',\n 'FAILED',\n 'PAUSED',\n 'DISABLED',\n] as const;\nexport type SyncStatus = (typeof SYNC_STATUSES)[number];\n\nexport const CONFLICT_RESOLUTIONS = ['SOURCE_WINS', 'TARGET_WINS', 'MANUAL'] as const;\nexport type ConflictResolution = (typeof CONFLICT_RESOLUTIONS)[number];\n\nexport const CONFLICT_STATUSES = ['OPEN', 'RESOLVED'] as const;\nexport type ConflictStatus = (typeof CONFLICT_STATUSES)[number];\n\nexport const SYNC_RUN_STATUSES = ['SUCCEEDED', 'FAILED', 'PARTIAL'] as const;\nexport type SyncRunStatus = (typeof SYNC_RUN_STATUSES)[number];\n\n/** The two GitHub label-prefix keys `ExternalSync.fieldMapping` actually understands (github-connector.ts). */\nexport const GITHUB_FIELD_MAPPING_KEYS = ['priority', 'dueDate'] as const;\nexport type GithubFieldMappingKey = (typeof GITHUB_FIELD_MAPPING_KEYS)[number];\n/** The connector's own built-in defaults, used only as placeholder copy — never assumed server-side. */\nexport const GITHUB_FIELD_MAPPING_DEFAULTS: Record<GithubFieldMappingKey, string> = {\n priority: 'priority:',\n dueDate: 'due:',\n};\n\nexport interface ProjectRef {\n id: string;\n name: string;\n}\n\nexport interface RunHealth {\n lastRunAt: string | null;\n lastStatus: SyncRunStatus | null;\n consecutiveFailures: number;\n runsLast7Days: number;\n}\n\nexport interface ExternalSyncRow {\n id: string;\n provider: SyncProvider;\n direction: SyncDirection;\n status: SyncStatus;\n projectId: string;\n project: ProjectRef | null;\n externalProjectId: string;\n externalProjectUrl: string | null;\n conflictStrategy: ConflictResolution;\n fieldMapping: unknown;\n /** Stored but not yet read by any run (sync.service.ts) — surfaced honestly in the edit form, not hidden. */\n syncFilters: unknown;\n lastSyncedAt: string | null;\n lastSyncError: string | null;\n totalItemsSynced: number;\n createdAt: string;\n updatedAt: string;\n runHealth: RunHealth;\n}\n\nexport interface SyncProviderCapability {\n provider: SyncProvider;\n supportsImport: boolean;\n supportsExport: boolean;\n supportsBidirectional: boolean;\n supportsFileImport: boolean;\n supportsConnectionTest: boolean;\n}\n\nexport interface SyncRunRow {\n id: string;\n direction: SyncDirection;\n status: SyncRunStatus;\n startedAt: string;\n finishedAt: string;\n itemsCreated: number;\n itemsUpdated: number;\n itemsSkipped: number;\n errorCount: number;\n conflictCount: number;\n errorMessage: string | null;\n triggeredBy: string;\n}\n\nexport interface ExternalMappingRef {\n id: string;\n internalId: string;\n internalType: string;\n externalId: string;\n externalType: string;\n externalUrl: string | null;\n}\n\nexport interface SyncConflictRow {\n id: string;\n createdAt: string;\n fields: string[];\n localUpdatedAt: string;\n remoteUpdatedAt: string;\n resolution: ConflictResolution | null;\n resolvedAt: string | null;\n resolvedBy: string | null;\n status: ConflictStatus;\n mapping: ExternalMappingRef | null;\n mappingId: string;\n}\n\n/** `PlanmagnetSyncResult` — what `planmagnetStartSync` returns. */\nexport interface SyncRunResult {\n syncId: string;\n success: boolean;\n itemsCreated: number;\n itemsUpdated: number;\n itemsSkipped: number;\n errorCount: number;\n errors: string[] | null;\n conflictCount: number;\n durationMs: number | null;\n syncedAt: string;\n}\n\n/** `PlanmagnetSyncConnectionTestResult` — what `planmagnetTestExternalSync` returns. */\nexport interface SyncConnectionTestResult {\n ok: boolean;\n message: string;\n rateLimitRemaining: number | null;\n}\n\nconst PROVIDER_LABELS: Record<SyncProvider, string> = {\n JIRA: 'Jira',\n GITHUB: 'GitHub',\n GITLAB: 'GitLab',\n AZURE_DEVOPS: 'Azure DevOps',\n ASANA: 'Asana',\n TRELLO: 'Trello',\n LINEAR: 'Linear',\n SHORTCUT: 'Shortcut',\n CLICKUP: 'ClickUp',\n CUSTOM: 'Custom',\n};\n\nexport function providerLabel(provider: string): string {\n return PROVIDER_LABELS[provider as SyncProvider] ?? provider;\n}\n\nconst DIRECTION_LABELS: Record<SyncDirection, string> = {\n INBOUND: 'Inbound (provider → PlanMagnet)',\n OUTBOUND: 'Outbound (PlanMagnet → provider)',\n BIDIRECTIONAL: 'Bidirectional (both ways)',\n};\n\nexport function directionLabel(direction: string): string {\n return DIRECTION_LABELS[direction as SyncDirection] ?? direction;\n}\n\n/** Whether a capability supports a given direction at all — the single gate the wizard and the edit form both use. */\nexport function directionSupported(\n capability: Pick<\n SyncProviderCapability,\n 'supportsImport' | 'supportsExport' | 'supportsBidirectional'\n >,\n direction: SyncDirection\n): boolean {\n if (direction === 'INBOUND') return capability.supportsImport;\n if (direction === 'OUTBOUND') return capability.supportsExport;\n return capability.supportsBidirectional;\n}\n\n/** True once a provider can run at least one live direction — the gate for selecting it in the wizard at all. */\nexport function providerIsLive(\n capability: Pick<\n SyncProviderCapability,\n 'supportsImport' | 'supportsExport' | 'supportsBidirectional'\n >\n): boolean {\n return capability.supportsImport || capability.supportsExport || capability.supportsBidirectional;\n}\n\n/**\n * `ExternalSync.fieldMapping` -> the two GitHub label prefixes, as blank strings when unset (meaning \"the\n * connector's built-in default applies\"), never pre-filled with that default text — so an untouched form saves\n * nothing and a save always reflects a real, deliberate choice.\n */\n/** GitHub org/user name rules: 1-39 chars, alphanumeric or single hyphens, no leading/trailing hyphen. */\nconst GITHUB_OWNER_RE = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/;\n/** GitHub repo name rules: 1-100 chars of letters, digits, `.`, `-`, `_`. */\nconst GITHUB_REPO_RE = /^[A-Za-z0-9._-]{1,100}$/;\n\nexport function isValidGithubOwner(value: string): boolean {\n return GITHUB_OWNER_RE.test(value.trim());\n}\nexport function isValidGithubRepo(value: string): boolean {\n return GITHUB_REPO_RE.test(value.trim());\n}\n\nexport function parseGithubFieldMapping(value: unknown): Record<GithubFieldMappingKey, string> {\n const out: Record<GithubFieldMappingKey, string> = { priority: '', dueDate: '' };\n if (!value || typeof value !== 'object' || Array.isArray(value)) return out;\n for (const key of GITHUB_FIELD_MAPPING_KEYS) {\n const raw = (value as Record<string, unknown>)[key];\n if (typeof raw === 'string' && raw.trim()) out[key] = raw.trim();\n }\n return out;\n}\n"],"mappings":";AAuCA,IAAa,IAAkB;CAAC;CAAW;CAAY;CAAgB,EAG1D,IAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACD,EAGY,IAAuB;CAAC;CAAe;CAAe;CAAS,EAU/D,IAA4B,CAAC,YAAY,UAAU,EAGnD,IAAuE;CAClF,UAAU;CACV,SAAS;CACV,EAuGK,IAAgD;CACpD,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,cAAc;CACd,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,SAAS;CACT,QAAQ;CACT;AAED,SAAgB,EAAc,GAA0B;AACtD,QAAO,EAAgB,MAA6B;;AAGtD,IAAM,IAAkD;CACtD,SAAS;CACT,UAAU;CACV,eAAe;CAChB;AAED,SAAgB,EAAe,GAA2B;AACxD,QAAO,EAAiB,MAA+B;;AAIzD,SAAgB,EACd,GAIA,GACS;AAGT,QAFI,MAAc,YAAkB,EAAW,iBAC3C,MAAc,aAAmB,EAAW,iBACzC,EAAW;;AAIpB,SAAgB,EACd,GAIS;AACT,QAAO,EAAW,kBAAkB,EAAW,kBAAkB,EAAW;;AAS9E,IAAM,IAAkB,mDAElB,IAAiB;AAEvB,SAAgB,EAAmB,GAAwB;AACzD,QAAO,EAAgB,KAAK,EAAM,MAAM,CAAC;;AAE3C,SAAgB,EAAkB,GAAwB;AACxD,QAAO,EAAe,KAAK,EAAM,MAAM,CAAC;;AAG1C,SAAgB,EAAwB,GAAuD;CAC7F,IAAM,IAA6C;EAAE,UAAU;EAAI,SAAS;EAAI;AAChF,KAAI,CAAC,KAAS,OAAO,KAAU,YAAY,MAAM,QAAQ,EAAM,CAAE,QAAO;AACxE,MAAK,IAAM,KAAO,GAA2B;EAC3C,IAAM,IAAO,EAAkC;AAC/C,EAAI,OAAO,KAAQ,YAAY,EAAI,MAAM,KAAE,EAAI,KAAO,EAAI,MAAM;;AAElE,QAAO"}
@@ -0,0 +1,8 @@
1
+ import { SyncProviderCapability } from './syncTypes';
2
+
3
+ export declare function useSyncProviderCapabilities(): {
4
+ capabilities: SyncProviderCapability[];
5
+ loading: boolean;
6
+ error: import('@apollo/client').ErrorLike | undefined;
7
+ };
8
+ //# sourceMappingURL=useSyncProviderCapabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSyncProviderCapabilities.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/integrations/useSyncProviderCapabilities.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAqB1D,wBAAgB,2BAA2B;;;;EAW1C"}
@@ -0,0 +1,27 @@
1
+ import { gql as e } from "@apollo/client";
2
+ import { useQuery as t } from "@apollo/client/react";
3
+ //#region src/planmagnet/integrations/useSyncProviderCapabilities.ts
4
+ var n = e`
5
+ query SupportedSyncProviders {
6
+ planmagnetSupportedSyncProviders {
7
+ provider
8
+ supportsImport
9
+ supportsExport
10
+ supportsBidirectional
11
+ supportsFileImport
12
+ supportsConnectionTest
13
+ }
14
+ }
15
+ `;
16
+ function r() {
17
+ let { data: e, loading: r, error: i } = t(n);
18
+ return {
19
+ capabilities: e?.planmagnetSupportedSyncProviders ?? [],
20
+ loading: r && !e,
21
+ error: i
22
+ };
23
+ }
24
+ //#endregion
25
+ export { r as useSyncProviderCapabilities };
26
+
27
+ //# sourceMappingURL=useSyncProviderCapabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSyncProviderCapabilities.js","names":[],"sources":["../../../src/planmagnet/integrations/useSyncProviderCapabilities.ts"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { useQuery } from '@apollo/client/react';\nimport type { SyncProviderCapability } from './syncTypes';\n\n/**\n * AUT-23/20 — `planmagnetSupportedSyncProviders`: one provider's real capabilities, derived server-side from the\n * connector code itself (`SYNC_PROVIDER_CAPABILITIES` in sync.service.ts), never a hard-coded wish list here.\n * Drives which providers the setup wizard can select, which directions each one offers, and whether \"Test\n * connection\" has anything real to call.\n */\nconst SUPPORTED_SYNC_PROVIDERS = gql`\n query SupportedSyncProviders {\n planmagnetSupportedSyncProviders {\n provider\n supportsImport\n supportsExport\n supportsBidirectional\n supportsFileImport\n supportsConnectionTest\n }\n }\n`;\n\nexport function useSyncProviderCapabilities() {\n const { data, loading, error } = useQuery<{\n planmagnetSupportedSyncProviders: SyncProviderCapability[];\n }>(SUPPORTED_SYNC_PROVIDERS);\n\n return {\n capabilities: data?.planmagnetSupportedSyncProviders ?? [],\n // Only before the first load: a refetch must not read as \"nothing is supported\".\n loading: loading && !data,\n error,\n };\n}\n"],"mappings":";;;AAUA,IAAM,IAA2B,CAAG;;;;;;;;;;;;AAapC,SAAgB,IAA8B;CAC5C,IAAM,EAAE,SAAM,YAAS,aAAU,EAE9B,EAAyB;AAE5B,QAAO;EACL,cAAc,GAAM,oCAAoC,EAAE;EAE1D,SAAS,KAAW,CAAC;EACrB;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"AutomationAutomationRuleDetailPagePage.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/pages/AutomationAutomationRuleDetailPagePage.tsx"],"names":[],"mappings":"AAuFA,wBAAgB,sCAAsC,4CA6IrD"}
1
+ {"version":3,"file":"AutomationAutomationRuleDetailPagePage.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/pages/AutomationAutomationRuleDetailPagePage.tsx"],"names":[],"mappings":"AAwGA,wBAAgB,sCAAsC,4CAkJrD"}