@ssiriuss/connectors 0.0.0-stage → 0.0.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.
Files changed (172) hide show
  1. package/README.md +65 -2
  2. package/dist/boxes/connectors.d.ts +2 -0
  3. package/dist/boxes/connectors.js +1 -0
  4. package/dist/features/integration-studio/README.md +24 -0
  5. package/dist/features/integration-studio/assets/connectors/api.svg +5 -0
  6. package/dist/features/integration-studio/assets/connectors/arity.png +0 -0
  7. package/dist/features/integration-studio/assets/connectors/axle.png +0 -0
  8. package/dist/features/integration-studio/assets/connectors/canopy.png +0 -0
  9. package/dist/features/integration-studio/assets/connectors/ccc.png +0 -0
  10. package/dist/features/integration-studio/assets/connectors/cmt.png +0 -0
  11. package/dist/features/integration-studio/assets/connectors/cotality.png +0 -0
  12. package/dist/features/integration-studio/assets/connectors/csv.svg +5 -0
  13. package/dist/features/integration-studio/assets/connectors/dnb.png +0 -0
  14. package/dist/features/integration-studio/assets/connectors/eagleview.png +0 -0
  15. package/dist/features/integration-studio/assets/connectors/email.svg +4 -0
  16. package/dist/features/integration-studio/assets/connectors/equifax.png +0 -0
  17. package/dist/features/integration-studio/assets/connectors/esri.svg +19 -0
  18. package/dist/features/integration-studio/assets/connectors/examone.png +0 -0
  19. package/dist/features/integration-studio/assets/connectors/experian.svg +26 -0
  20. package/dist/features/integration-studio/assets/connectors/fema.png +0 -0
  21. package/dist/features/integration-studio/assets/connectors/file.svg +4 -0
  22. package/dist/features/integration-studio/assets/connectors/fmcsa.png +0 -0
  23. package/dist/features/integration-studio/assets/connectors/ftp.svg +5 -0
  24. package/dist/features/integration-studio/assets/connectors/google-maps.png +0 -0
  25. package/dist/features/integration-studio/assets/connectors/graphql.png +0 -0
  26. package/dist/features/integration-studio/assets/connectors/grpc.png +0 -0
  27. package/dist/features/integration-studio/assets/connectors/http.svg +5 -0
  28. package/dist/features/integration-studio/assets/connectors/jdpower.png +0 -0
  29. package/dist/features/integration-studio/assets/connectors/json.svg +5 -0
  30. package/dist/features/integration-studio/assets/connectors/kafka.png +0 -0
  31. package/dist/features/integration-studio/assets/connectors/lexisnexis.png +0 -0
  32. package/dist/features/integration-studio/assets/connectors/mcp.svg +5 -0
  33. package/dist/features/integration-studio/assets/connectors/melissa.png +0 -0
  34. package/dist/features/integration-studio/assets/connectors/mib.png +0 -0
  35. package/dist/features/integration-studio/assets/connectors/milliman.png +0 -0
  36. package/dist/features/integration-studio/assets/connectors/mitchell.png +0 -0
  37. package/dist/features/integration-studio/assets/connectors/moodys.png +0 -0
  38. package/dist/features/integration-studio/assets/connectors/ncci.png +0 -0
  39. package/dist/features/integration-studio/assets/connectors/nearmap.png +0 -0
  40. package/dist/features/integration-studio/assets/connectors/nhtsa.png +0 -0
  41. package/dist/features/integration-studio/assets/connectors/nicb.png +0 -0
  42. package/dist/features/integration-studio/assets/connectors/noaa.png +0 -0
  43. package/dist/features/integration-studio/assets/connectors/ofac.png +0 -0
  44. package/dist/features/integration-studio/assets/connectors/openai.svg +31 -0
  45. package/dist/features/integration-studio/assets/connectors/openapi.png +0 -0
  46. package/dist/features/integration-studio/assets/connectors/postman.png +0 -0
  47. package/dist/features/integration-studio/assets/connectors/precisely.png +0 -0
  48. package/dist/features/integration-studio/assets/connectors/rest.svg +5 -0
  49. package/dist/features/integration-studio/assets/connectors/salesforce.png +0 -0
  50. package/dist/features/integration-studio/assets/connectors/servicebus.png +0 -0
  51. package/dist/features/integration-studio/assets/connectors/servicenow.png +0 -0
  52. package/dist/features/integration-studio/assets/connectors/sftp.svg +5 -0
  53. package/dist/features/integration-studio/assets/connectors/soap.svg +5 -0
  54. package/dist/features/integration-studio/assets/connectors/solera.png +0 -0
  55. package/dist/features/integration-studio/assets/connectors/transunion.png +0 -0
  56. package/dist/features/integration-studio/assets/connectors/verisk.png +0 -0
  57. package/dist/features/integration-studio/assets/connectors/webhook.svg +4 -0
  58. package/dist/features/integration-studio/assets/connectors/websocket.svg +5 -0
  59. package/dist/features/integration-studio/assets/connectors/xml.svg +5 -0
  60. package/dist/features/integration-studio/components/ActionEditor.d.ts +20 -0
  61. package/dist/features/integration-studio/components/ActionEditor.js +3 -0
  62. package/dist/features/integration-studio/components/ActionPanels.d.ts +20 -0
  63. package/dist/features/integration-studio/components/ActionPanels.js +1 -0
  64. package/dist/features/integration-studio/components/ActionWorkspace.d.ts +14 -0
  65. package/dist/features/integration-studio/components/ActionWorkspace.js +1 -0
  66. package/dist/features/integration-studio/components/ActionsTab.d.ts +9 -0
  67. package/dist/features/integration-studio/components/ActionsTab.js +1 -0
  68. package/dist/features/integration-studio/components/AuthProfilesTab.d.ts +8 -0
  69. package/dist/features/integration-studio/components/AuthProfilesTab.js +1 -0
  70. package/dist/features/integration-studio/components/ConnectorTypePicker.d.ts +11 -0
  71. package/dist/features/integration-studio/components/ConnectorTypePicker.js +1 -0
  72. package/dist/features/integration-studio/components/DataSourcePanel.d.ts +10 -0
  73. package/dist/features/integration-studio/components/DataSourcePanel.js +1 -0
  74. package/dist/features/integration-studio/components/EditorForm.d.ts +27 -0
  75. package/dist/features/integration-studio/components/EditorForm.js +1 -0
  76. package/dist/features/integration-studio/components/ImportSystemDialog.d.ts +13 -0
  77. package/dist/features/integration-studio/components/ImportSystemDialog.js +1 -0
  78. package/dist/features/integration-studio/components/ImportSystemFileDialog.d.ts +10 -0
  79. package/dist/features/integration-studio/components/ImportSystemFileDialog.js +1 -0
  80. package/dist/features/integration-studio/components/LogoPicker.d.ts +6 -0
  81. package/dist/features/integration-studio/components/LogoPicker.js +1 -0
  82. package/dist/features/integration-studio/components/ProfileSignIn.d.ts +14 -0
  83. package/dist/features/integration-studio/components/ProfileSignIn.js +1 -0
  84. package/dist/features/integration-studio/components/ServerKeysTab.d.ts +8 -0
  85. package/dist/features/integration-studio/components/ServerKeysTab.js +1 -0
  86. package/dist/features/integration-studio/components/SystemIcon.d.ts +6 -0
  87. package/dist/features/integration-studio/components/SystemIcon.js +1 -0
  88. package/dist/features/integration-studio/components/SystemLabelsFields.d.ts +10 -0
  89. package/dist/features/integration-studio/components/SystemLabelsFields.js +1 -0
  90. package/dist/features/integration-studio/components/SystemPills.d.ts +15 -0
  91. package/dist/features/integration-studio/components/SystemPills.js +1 -0
  92. package/dist/features/integration-studio/components/TestPanel.d.ts +11 -0
  93. package/dist/features/integration-studio/components/TestPanel.js +1 -0
  94. package/dist/features/integration-studio/components/connector-picker.css +32 -0
  95. package/dist/features/integration-studio/components/mappings/MappingsUnavailable.d.ts +8 -0
  96. package/dist/features/integration-studio/components/mappings/MappingsUnavailable.js +1 -0
  97. package/dist/features/integration-studio/components/mappings/edges.d.ts +7 -0
  98. package/dist/features/integration-studio/components/mappings/edges.js +1 -0
  99. package/dist/features/integration-studio/components/mappings/nodes.d.ts +28 -0
  100. package/dist/features/integration-studio/components/mappings/nodes.js +1 -0
  101. package/dist/features/integration-studio/components/mappings/panels.d.ts +28 -0
  102. package/dist/features/integration-studio/components/mappings/panels.js +5 -0
  103. package/dist/features/integration-studio/components/parts.d.ts +77 -0
  104. package/dist/features/integration-studio/components/parts.js +1 -0
  105. package/dist/features/integration-studio/hooks/useDatabases.d.ts +40 -0
  106. package/dist/features/integration-studio/hooks/useDatabases.js +1 -0
  107. package/dist/features/integration-studio/hooks/useResourceSave.d.ts +26 -0
  108. package/dist/features/integration-studio/hooks/useResourceSave.js +1 -0
  109. package/dist/features/integration-studio/hooks/useStudio.d.ts +218 -0
  110. package/dist/features/integration-studio/hooks/useStudio.js +1 -0
  111. package/dist/features/integration-studio/index.d.ts +8 -0
  112. package/dist/features/integration-studio/index.js +1 -0
  113. package/dist/features/integration-studio/model/action-form.d.ts +64 -0
  114. package/dist/features/integration-studio/model/action-form.js +1 -0
  115. package/dist/features/integration-studio/model/api-document.d.ts +19 -0
  116. package/dist/features/integration-studio/model/api-document.js +1 -0
  117. package/dist/features/integration-studio/model/collection-install.d.ts +15 -0
  118. package/dist/features/integration-studio/model/collection-install.js +1 -0
  119. package/dist/features/integration-studio/model/connector-form.d.ts +29 -0
  120. package/dist/features/integration-studio/model/connector-form.js +2 -0
  121. package/dist/features/integration-studio/model/connector-types.d.ts +15 -0
  122. package/dist/features/integration-studio/model/connector-types.js +1 -0
  123. package/dist/features/integration-studio/model/mappings/function-help.d.ts +1 -0
  124. package/dist/features/integration-studio/model/mappings/function-help.js +1 -0
  125. package/dist/features/integration-studio/model/mappings/mapping-model.d.ts +40 -0
  126. package/dist/features/integration-studio/model/mappings/mapping-model.js +1 -0
  127. package/dist/features/integration-studio/model/mappings/samples.d.ts +85 -0
  128. package/dist/features/integration-studio/model/mappings/samples.js +1 -0
  129. package/dist/features/integration-studio/model/presentation.d.ts +48 -0
  130. package/dist/features/integration-studio/model/presentation.js +1 -0
  131. package/dist/features/integration-studio/model/problems.d.ts +11 -0
  132. package/dist/features/integration-studio/model/problems.js +1 -0
  133. package/dist/features/integration-studio/model/profile-form.d.ts +26 -0
  134. package/dist/features/integration-studio/model/profile-form.js +1 -0
  135. package/dist/features/integration-studio/model/query-form.d.ts +33 -0
  136. package/dist/features/integration-studio/model/query-form.js +2 -0
  137. package/dist/features/integration-studio/model/system-labels.d.ts +20 -0
  138. package/dist/features/integration-studio/model/system-labels.js +1 -0
  139. package/dist/features/integration-studio/model/system-logos.d.ts +7 -0
  140. package/dist/features/integration-studio/model/system-logos.js +1 -0
  141. package/dist/features/integration-studio/pages/ConnectorLibraryPage.d.ts +5 -0
  142. package/dist/features/integration-studio/pages/ConnectorLibraryPage.js +1 -0
  143. package/dist/features/integration-studio/pages/CredentialsPage.d.ts +6 -0
  144. package/dist/features/integration-studio/pages/CredentialsPage.js +1 -0
  145. package/dist/features/integration-studio/pages/DatabasesPage.d.ts +6 -0
  146. package/dist/features/integration-studio/pages/DatabasesPage.js +1 -0
  147. package/dist/features/integration-studio/pages/MappingDesignerPage.d.ts +8 -0
  148. package/dist/features/integration-studio/pages/MappingDesignerPage.js +1 -0
  149. package/dist/features/integration-studio/pages/MappingsPage.d.ts +2 -0
  150. package/dist/features/integration-studio/pages/MappingsPage.js +1 -0
  151. package/dist/features/integration-studio/pages/QueryPage.d.ts +3 -0
  152. package/dist/features/integration-studio/pages/QueryPage.js +1 -0
  153. package/dist/features/integration-studio/pages/SystemPage.d.ts +8 -0
  154. package/dist/features/integration-studio/pages/SystemPage.js +1 -0
  155. package/dist/features/integration-studio/pages/SystemsPage.d.ts +5 -0
  156. package/dist/features/integration-studio/pages/SystemsPage.js +1 -0
  157. package/dist/features/mailboxes/README.md +5 -0
  158. package/dist/features/mailboxes/components/MailboxCreate.d.ts +5 -0
  159. package/dist/features/mailboxes/components/MailboxCreate.js +1 -0
  160. package/dist/features/mailboxes/components/MailboxDirectory.d.ts +12 -0
  161. package/dist/features/mailboxes/components/MailboxDirectory.js +1 -0
  162. package/dist/features/mailboxes/components/MailboxEditor.d.ts +11 -0
  163. package/dist/features/mailboxes/components/MailboxEditor.js +1 -0
  164. package/dist/features/mailboxes/hooks/useMailboxes.d.ts +19 -0
  165. package/dist/features/mailboxes/hooks/useMailboxes.js +1 -0
  166. package/dist/features/mailboxes/index.d.ts +1 -0
  167. package/dist/features/mailboxes/index.js +1 -0
  168. package/dist/features/mailboxes/pages/MailboxesPage.d.ts +1 -0
  169. package/dist/features/mailboxes/pages/MailboxesPage.js +1 -0
  170. package/dist/shared/api/message-mappings.d.ts +121 -0
  171. package/dist/shared/api/message-mappings.js +1 -0
  172. package/package.json +24 -4
@@ -0,0 +1,11 @@
1
+ import './connector-picker.css';
2
+ /**
3
+ * "Choose a connector type": the first step of a new system. Systems connect over REST today;
4
+ * an API description (OpenAPI, Postman, OpenAI) can create one with its endpoints. Other
5
+ * transports are shown so people see what is coming, and cannot be picked yet. Known products
6
+ * and data providers are installed from the Connector Library instead. List view by default.
7
+ */
8
+ export declare function ConnectorTypePicker({ onPick, onClose, }: {
9
+ onPick: (type: string) => void;
10
+ onClose: () => void;
11
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{Dialog as e}from"@base-ui/react/dialog";import{Boxes as t,Braces as n,Building2 as r,Car as i,Code2 as a,Database as o,FileCode2 as s,FolderInput as c,Globe as l,Landmark as u,Mail as d,MapPinned as f,MessagesSquare as p,Search as m,X as h}from"lucide-react";import{useState as g}from"react";import{Input as _}from"@/shared/components/ui/input";import{ViewToggle as v}from"@/shared/components/workspace/ViewToggle";import{useViewMode as y}from"@/shared/hooks/useViewMode";import{matchesSearch as b}from"@/shared/lib/search";import{cn as x}from"@/shared/lib/utils";import{categoryLabels as S,connectorTypes as C}from"../model/connector-types";import"./connector-picker.css";import{jsx as w,jsxs as T}from"react/jsx-runtime";const E={blob:s,rest:l,sftp:c,smtp:d,soap:a,webhook:n},D={api:l,claims:i,cloud:t,data:o,file:c,location:f,messaging:p,public:u},O={blob:`bg-[var(--ct-blob)]`,rest:`bg-[var(--ct-rest)]`,sftp:`bg-[var(--ct-sftp)]`,smtp:`bg-[var(--ct-smtp)]`,soap:`bg-[var(--ct-soap)]`,webhook:`bg-[var(--ct-webhook)]`},k=Object.keys(S),A=[...C].sort((e,t)=>k.indexOf(e.category)-k.indexOf(t.category)||e.label.localeCompare(t.label)),j=e=>[e.label,e.description,S[e.category]];function M({type:e,size:t}){let n=t===`md`?`size-10 rounded-lg`:`size-8 rounded-md`;if(e.logo)return w(`span`,{className:x(`grid shrink-0 place-items-center border bg-[var(--ct-logo-bg)] p-1.5 shadow-sm`,n),children:w(`img`,{src:e.logo,alt:``,className:`size-full object-contain`,loading:`lazy`})});let i=E[e.key]??D[e.category]??r;return w(`span`,{className:x(`grid shrink-0 place-items-center text-[var(--ct-icon)] shadow-sm`,n,O[e.key]??`bg-[var(--ct-category)]`),children:w(i,{className:t===`md`?`size-5`:`size-4`,"aria-hidden":`true`,strokeWidth:2})})}const N=`rounded-badge px-2.5 py-1 text-xs leading-4 whitespace-nowrap`;function P({type:e}){return T(`span`,{className:`flex flex-wrap items-center gap-1`,children:[w(`span`,{className:x(N,`bg-muted font-medium text-foreground`),children:S[e.category]}),e.badge===`Soon`&&w(`span`,{className:x(N,`border border-warning/45 bg-warning/8 font-semibold text-warning-foreground`),children:`SOON`})]})}const F=`Not available yet: systems connect over REST today.`;export function ConnectorTypePicker({onPick:t,onClose:n}){let[r,i]=g(``),[a,o]=y(`sirius-connector-picker-view`,`list`),s=A.filter(e=>b(r,j(e)));return w(e.Root,{open:!0,onOpenChange:e=>!e&&n(),children:T(e.Portal,{children:[w(e.Backdrop,{className:`fixed inset-0 z-[80] bg-black/45`}),T(e.Popup,{className:`connector-picker fixed top-1/2 left-1/2 z-[81] flex h-[88vh] w-[min(1180px,95vw)] -translate-1/2 flex-col overflow-hidden rounded-xl bg-card shadow-2xl`,children:[T(`div`,{className:`flex items-start gap-3 border-b px-5 py-3`,children:[T(`div`,{className:`min-w-0 flex-1`,children:[w(e.Title,{className:`text-lg font-semibold`,children:`Choose a connector type`}),w(e.Description,{className:`text-sm text-muted-foreground`,children:`Start a REST system or import an API description.`})]}),w(`button`,{type:`button`,"aria-label":`Close`,onClick:n,className:`rounded-md p-1 hover:bg-muted`,children:w(h,{className:`size-5`,"aria-hidden":`true`})})]}),T(`div`,{className:`flex items-center gap-2 border-b px-5 py-2`,children:[T(`label`,{htmlFor:`connector-search`,className:`relative`,children:[w(`span`,{className:`sr-only`,children:`Search connector types`}),w(m,{className:`pointer-events-none absolute top-2.5 left-2.5 size-4 text-muted-foreground`,"aria-hidden":`true`}),w(_,{id:`connector-search`,type:`search`,className:`h-9 w-80 bg-card pl-8 text-sm`,placeholder:`Name or type`,value:r,onChange:e=>i(e.target.value)})]}),w(`span`,{className:`ml-auto`}),w(v,{mode:a,onChange:o})]}),w(`div`,{className:`flex-1 overflow-y-auto px-5 py-3`,children:s.length===0?w(`p`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`Nothing matches this search.`}):a===`list`?w(`ul`,{"aria-label":`Connector types`,className:`divide-y rounded-lg border`,children:s.map(e=>w(`li`,{children:T(`button`,{type:`button`,disabled:!e.available,title:e.available?void 0:F,onClick:()=>t(e.key),className:x(`grid w-full grid-cols-[2rem_minmax(12rem,1fr)_minmax(14rem,1.1fr)] items-center gap-3 px-3 py-2 text-left`,e.available?`hover:bg-muted/50`:`cursor-not-allowed opacity-55`),children:[w(M,{type:e,size:`sm`}),T(`span`,{className:`flex min-w-0 flex-col`,children:[w(`b`,{className:`truncate text-sm`,children:e.label}),w(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.description})]}),w(P,{type:e})]})},e.key))}):w(`ul`,{"aria-label":`Connector types`,className:`grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] content-start gap-2.5`,children:s.map(e=>w(`li`,{children:T(`button`,{type:`button`,disabled:!e.available,title:e.available?void 0:F,onClick:()=>t(e.key),className:x(`flex h-full w-full items-start gap-3 rounded-lg border bg-card p-3 text-left transition`,e.available?`hover:-translate-y-px hover:border-primary hover:shadow-md`:`cursor-not-allowed opacity-55`),children:[w(M,{type:e,size:`md`}),T(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[w(`b`,{className:`truncate text-sm`,children:e.label}),w(`span`,{className:`line-clamp-2 text-xs leading-4 text-pretty text-muted-foreground`,children:e.description}),w(P,{type:e})]})]})},e.key))})})]})]})})}
@@ -0,0 +1,10 @@
1
+ import { type AuthProfile, type DataSource } from '@/shared/api/integrations';
2
+ import type { Studio } from '../hooks/useStudio';
3
+ /** One database as a page (back: Databases). The App DB keeps its connection from the
4
+ * platform settings: only its name, the switches and the timeout are edited here. */
5
+ export declare function DataSourcePanel({ studio, source, profiles, onClose, }: {
6
+ studio: Studio;
7
+ source: DataSource | undefined;
8
+ profiles: AuthProfile[];
9
+ onClose: () => void;
10
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{NumberInput as e}from"@/shared/components/workspace/NumberInput";import{useState as t}from"react";import{useMutation as n}from"@tanstack/react-query";import{Link as r}from"react-router-dom";import{Database as i,PlugZap as a,Save as o,Trash2 as s}from"lucide-react";import{paths as c}from"@/app/paths";import{dataSources as l}from"@/shared/api/integrations";import{Button as u}from"@/shared/components/ui/button";import{Input as d}from"@/shared/components/ui/input";import{ConfirmButton as f}from"@/shared/components/workspace/ConfirmButton";import{ControlHeader as p}from"@/shared/components/workspace/ControlHeader";import{problemMessage as m}from"../model/problems";import{useCheckDataSource as h,useRefreshDatabases as g}from"../hooks/useDatabases";import{Field as _,Pill as v}from"./parts";import{notify as y}from"@/shared/lib/notify";import{jsx as b,jsxs as x,Fragment as S}from"react/jsx-runtime";const C=[`require`,`verify-full`,`disable`],w={mysql:{label:`MySQL`,port:3306,host:`claims.mysql.database.azure.com`,kinds:[`basic`]},postgresql:{label:`PostgreSQL`,port:5432,host:`claims.postgres.database.azure.com`,kinds:[`basic`,`entra_managed_identity`]}},T=[`Amazon Redshift`,`Google BigQuery`,`Microsoft SQL Server`,`Oracle`,`Snowflake`],E=`h-9 w-full rounded-md border bg-background px-2 text-sm`,D=e=>({name:e?.name??``,display_name:e?.display_name??null,engine:e?.engine??`postgresql`,host:e?.host??``,port:e?.port??5432,database:e?.database??``,ssl_mode:e?.ssl_mode??`require`,auth_profile_id:e?.auth_profile_id??null,allow_write:e?.allow_write??!1,timeout_ms:e?.timeout_ms??1e4,enabled:e?.enabled??!1});export function DataSourcePanel({studio:O,source:k,profiles:A,onClose:j}){let[M,N]=t(()=>D(k)),P=g(O.scope.tenantId),F=k?.platform??!1,I=JSON.stringify(M)!==JSON.stringify(D(k)),L=e=>N({...M,...e}),R=w[M.engine??`postgresql`],z=A.filter(e=>R.kinds.includes(e.kind)),B=e=>L({engine:e,port:M.port===R.port?w[e].port:M.port,auth_profile_id:z.some(t=>t.id===M.auth_profile_id&&w[e].kinds.includes(t.kind))?M.auth_profile_id:null}),V=n({mutationFn:()=>k?l.update(k.id,M,`"${k.version}"`):l.create(M,O.scope.tenantId),onSuccess:async e=>{await P(),k?y.success(`Database saved.`):(y.success(`Database created.`),O.select(e.data.id))}}),H=n({mutationFn:()=>l.remove(k.id,`"${k.version}"`),onSuccess:async()=>{await P(),y.success(`Database deleted.`),j()}}),U=h(k),W=C.map(e=>b(`option`,{value:e,children:e},e));return x(`form`,{id:`data-source-form`,"aria-label":`Database`,className:`flex flex-col`,onSubmit:e=>{e.preventDefault(),V.mutate()},children:[b(p,{title:k?k.display_name??k.name:`New database`,icon:i,description:k&&!F?`${k.host}:${k.port}/${k.database}`:void 0,pills:F&&b(v,{className:`bg-primary/10 text-primary`,children:`System`}),actions:x(S,{children:[O.writable&&x(u,{type:`submit`,disabled:!I||!M.name||V.isPending,children:[b(o,{}),` `,V.isPending?`Saving…`:k?`Save`:`Create`]}),!k&&b(u,{type:`button`,variant:`outline`,onClick:j,children:`Cancel`}),k&&x(u,{type:`button`,variant:`outline`,disabled:U.isPending,onClick:()=>U.mutate(),children:[b(a,{}),` `,U.isPending?`Checking…`:`Check`]}),k&&!F&&O.writable&&x(f,{destructive:!0,title:`Delete ${k.name}?`,detail:`Queries must be retired first.`,action:`Delete`,pending:H.isPending,onConfirm:()=>H.mutate(),children:[b(s,{}),` Delete`]})]})}),b(`div`,{className:`rounded-xl border bg-card`,children:x(`fieldset`,{disabled:!O.writable,className:`grid gap-3 p-5 sm:grid-cols-2`,children:[F&&b(`p`,{className:`rounded-lg border border-primary/30 bg-primary/5 px-3 py-2 text-xs sm:col-span-2`,children:`The App DB is the application database. It connects with the platform's database settings and cannot be deleted. Write queries also need the setting SIRIUS_APP_DB_TOOL_WRITES.`}),b(_,{id:`ds-display`,label:`Display name`,children:b(d,{id:`ds-display`,value:M.display_name??``,maxLength:120,onChange:e=>L({display_name:e.target.value||null})})}),b(_,{id:`ds-name`,label:`Name`,hint:`Letters, digits, . _ -`,children:b(d,{id:`ds-name`,value:M.name,maxLength:64,className:`font-mono text-xs`,onChange:e=>L({name:e.target.value})})}),!F&&x(S,{children:[b(_,{id:`ds-engine`,label:`Engine`,children:x(`select`,{id:`ds-engine`,className:E,value:M.engine,onChange:e=>B(e.target.value),children:[Object.keys(w).map(e=>b(`option`,{value:e,children:w[e].label},e)),b(`optgroup`,{label:`Coming soon`,children:T.map(e=>b(`option`,{disabled:!0,children:e},e))})]})}),b(_,{id:`ds-host`,label:`Host`,children:b(d,{id:`ds-host`,value:M.host??``,placeholder:R.host,onChange:e=>L({host:e.target.value})})}),x(`div`,{className:`grid grid-cols-[1fr_6rem] gap-2`,children:[b(_,{id:`ds-database`,label:`Database`,children:b(d,{id:`ds-database`,value:M.database??``,onChange:e=>L({database:e.target.value})})}),b(_,{id:`ds-port`,label:`Port`,children:b(e,{id:`ds-port`,min:1,max:65535,value:M.port,onValueChange:e=>L({port:e})})})]}),b(_,{id:`ds-auth`,label:`Credential`,hint:x(S,{children:[M.engine===`mysql`?`Basic: user name and password`:`Basic (user name, password) or managed identity`,` · `,b(r,{to:`${c.credentials}?item=new`,className:`font-medium text-primary hover:underline`,children:`New credential`})]}),children:x(`select`,{id:`ds-auth`,className:E,value:M.auth_profile_id??``,onChange:e=>L({auth_profile_id:e.target.value||null}),children:[b(`option`,{value:``,children:`Choose…`}),z.map(e=>b(`option`,{value:e.id,children:e.display_name??e.name},e.id))]})}),b(_,{id:`ds-ssl`,label:`TLS`,children:b(`select`,{id:`ds-ssl`,className:E,value:M.ssl_mode,onChange:e=>L({ssl_mode:e.target.value}),children:W})})]}),b(_,{id:`ds-timeout`,label:`Timeout (ms)`,children:b(e,{id:`ds-timeout`,min:100,max:12e4,value:M.timeout_ms,onValueChange:e=>L({timeout_ms:e})})}),x(`div`,{className:`flex flex-col justify-end gap-2 text-sm`,children:[x(`label`,{className:`flex items-center gap-2`,children:[b(`input`,{type:`checkbox`,checked:M.enabled,onChange:e=>L({enabled:e.target.checked})}),`Enabled (tools may run its queries)`]}),x(`label`,{className:`flex items-center gap-2`,children:[b(`input`,{type:`checkbox`,checked:M.allow_write,onChange:e=>L({allow_write:e.target.checked})}),`Allow write queries`]})]}),k&&F&&M.allow_write&&!k.writes_allowed&&b(`p`,{className:`text-xs text-warning-foreground sm:col-span-2`,children:`Writes stay off until SIRIUS_APP_DB_TOOL_WRITES is turned on.`}),(V.error??H.error)&&b(`p`,{role:`alert`,className:`text-xs text-destructive sm:col-span-2`,children:m(V.error??H.error)})]})})]})}
@@ -0,0 +1,27 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type LucideIcon } from 'lucide-react';
3
+ /** A 412 keeps the draft and offers the latest; other problems read in plain words. */
4
+ export declare function SaveError({ error, onReload }: {
5
+ error: Error | null;
6
+ onReload?: () => void;
7
+ }): import("react").JSX.Element | null;
8
+ /** A record editor as a page: the page header holds the title and Save, extra actions and
9
+ * Delete (asks in the confirmation overlay), in that order; the way back is the page's BackLink. */
10
+ export declare function EditorForm({ id, title, meta, icon, creating, writable, dirty, valid, busy, error, extraActions, onSubmit, onDelete, onReload, deleteHint, children, }: {
11
+ id: string;
12
+ title: string;
13
+ meta?: ReactNode;
14
+ icon?: LucideIcon;
15
+ creating: boolean;
16
+ writable: boolean;
17
+ dirty: boolean;
18
+ valid: boolean;
19
+ busy: boolean;
20
+ error: Error | null;
21
+ extraActions?: ReactNode;
22
+ onSubmit: () => void;
23
+ onDelete?: () => void;
24
+ onReload: () => void;
25
+ deleteHint?: string;
26
+ children: ReactNode;
27
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{useState as e}from"react";import{Save as t,Trash2 as n}from"lucide-react";import{ApiError as r}from"@/shared/api/client";import{ErrorNotice as i}from"@/shared/components/layout/ErrorNotice";import{Button as a}from"@/shared/components/ui/button";import{ControlHeader as o}from"@/shared/components/workspace/ControlHeader";import{Confirm as s}from"./parts";import{problemMessage as c}from"../model/problems";import{jsx as l,jsxs as u,Fragment as d}from"react/jsx-runtime";export function SaveError({error:e,onReload:t}){if(!e)return null;if(e instanceof r&&e.status===412)return u(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-xs text-destructive`,children:[`Someone else changed this item. Your draft is kept.`,t&&l(a,{type:`button`,variant:`outline`,size:`sm`,onClick:t,children:`Discard draft & load latest`})]});let n=e instanceof r?new r(c(e),e.status,e.correlationId,{code:e.code,details:e.details}):e;return l(i,{error:n})}export function EditorForm({id:r,title:i,meta:c,icon:f,creating:p,writable:m,dirty:h,valid:g,busy:_,error:v,extraActions:y,onSubmit:b,onDelete:x,onReload:S,deleteHint:C,children:w}){let[T,E]=e(!1);return u(`form`,{id:r,noValidate:!0,"aria-label":i,onSubmit:e=>{e.preventDefault(),g&&h&&b()},children:[l(o,{title:i,icon:f,pills:c,actions:u(d,{children:[m&&u(a,{type:`submit`,disabled:_||!h||!g,children:[l(t,{}),_?`Saving…`:p?`Create`:`Save`]}),y,m&&!p&&x&&u(a,{variant:`destructive`,type:`button`,disabled:_||T,onClick:()=>E(!0),children:[l(n,{}),`Delete`]})]})}),u(`div`,{className:`space-y-3 rounded-xl border bg-card p-4`,children:[T&&x&&l(s,{destructive:!0,title:u(d,{children:[`Delete `,l(`strong`,{children:i}),`?`]}),action:`Delete permanently`,onCancel:()=>E(!1),onConfirm:()=>{E(!1),x()},children:C}),l(SaveError,{error:v,onReload:S}),u(`fieldset`,{disabled:!m,className:`space-y-3`,children:[l(`legend`,{className:`sr-only`,children:i}),w]})]})]})}
@@ -0,0 +1,13 @@
1
+ import { type Studio } from '../hooks/useStudio';
2
+ /** The import sources the connector type picker offers. OpenAI publishes an OpenAPI 3 spec. */
3
+ export type ImportSource = 'openapi' | 'postman' | 'openai';
4
+ /**
5
+ * Creates a system from an API description: the document prefills its name and base URL, the
6
+ * system is created (disabled, no authentication yet) and every operation becomes an endpoint
7
+ * draft. Then the system opens on its Endpoints tab.
8
+ */
9
+ export declare function ImportSystemDialog({ source, studio, onClose, }: {
10
+ source: ImportSource;
11
+ studio: Studio;
12
+ onClose: () => void;
13
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{Dialog as e}from"@base-ui/react/dialog";import{useState as t}from"react";import{useMutation as n,useQueryClient as r}from"@tanstack/react-query";import{useNavigate as i}from"react-router-dom";import{FileUp as a,X as o}from"lucide-react";import{paths as s}from"@/app/paths";import{connectors as c,importOpenApi as l}from"@/shared/api/integrations";import{Button as u}from"@/shared/components/ui/button";import{Input as d}from"@/shared/components/ui/input";import{Textarea as f}from"@/shared/components/ui/textarea";import{formatNumber as p}from"@/shared/lib/format";import{notify as m}from"@/shared/lib/notify";import{connectorsKey as h,useRefreshActions as g}from"../hooks/useStudio";import{apiFormatLabels as _,apiFormatOf as v,endpointPrefixOf as y,operationCount as b,parseApiDocument as x,systemOf as S}from"../model/api-document";import{connectorProblems as C,fromConnector as w,toConnectorWrite as T}from"../model/connector-form";import{described as E}from"../model/presentation";import{problemMessage as D}from"../model/problems";import{Field as O}from"./parts";import{jsxs as k,jsx as A}from"react/jsx-runtime";const j={openai:{title:`Import the OpenAI API`,file:`OpenAI OpenAPI spec (JSON)`,fallback:`https://api.openai.com/v1`},openapi:{title:`Import Swagger / OpenAPI`,file:`OpenAPI 3 or Swagger 2.0 file (JSON)`},postman:{title:`Import a Postman collection`,file:`Postman collection v2.x (JSON)`}},M=e=>e===1?`1 operation`:`${p(e)} operations`;export function ImportSystemDialog({source:p,studio:N,onClose:P}){let F=i(),I=r(),L=g(N.scope.tenantId),[R,z]=t(``),[B,V]=t({}),H=R.trim()?x(R):null,U=H?v(H):null,W=H&&U?S(H,U):void 0,G=j[p].fallback,K={name:B.name??(W?.name||(p===`openai`?`openai`:``)),display_name:B.display_name??(W?.display_name||``),base_url:B.base_url??(W?.base_url||G||`https://`)},q={...w(),...K},J=C(q),Y=R.trim()?H?U?void 0:`Not an OpenAPI 3, Swagger 2.0 or Postman collection document.`:`Not a JSON object. YAML is not read yet: export the document as JSON.`:void 0,X=n({mutationFn:async()=>{let e=(await c.create(T(q),N.scope.tenantId)).data.id;try{return{id:e,report:await l({connector_id:e,prefix:y(K.name),document:H},N.scope.tenantId),error:void 0}}catch(t){return{id:e,report:void 0,error:t}}},onSuccess:async({id:e,report:t,error:n})=>{if(await Promise.all([I.invalidateQueries({queryKey:h(N.scope.tenantId)}),L()]),t){let e=t.created.length===1?`1 endpoint`:`${t.created.length} endpoints`;m.success(`System created with ${e} as drafts.`)}else m.error(`System created, but the import failed: ${D(n)}`);P(),F(`${s.systems}/${e}/endpoints`)},onError:e=>m.error(`The system could not be created: ${D(e)}`)}),Z=!!U&&Object.keys(J).every(e=>e!==`name`&&e!==`base_url`),Q=e=>V(t=>({...t,...e}));return A(e.Root,{open:!0,onOpenChange:e=>!e&&P(),children:k(e.Portal,{children:[A(e.Backdrop,{className:`fixed inset-0 z-[80] bg-black/45`}),A(e.Popup,{className:`fixed top-1/2 left-1/2 z-[81] flex max-h-[90vh] w-[min(760px,94vw)] -translate-1/2 flex-col overflow-hidden rounded-xl bg-card shadow-2xl`,children:k(`form`,{"aria-label":`Import system`,className:`flex min-h-0 flex-col`,onSubmit:e=>{e.preventDefault(),Z&&X.mutate()},children:[k(`div`,{className:`flex items-start gap-3 border-b px-6 py-4`,children:[k(`div`,{className:`min-w-0 flex-1`,children:[A(e.Title,{className:`text-lg font-semibold`,children:j[p].title}),A(e.Description,{className:`text-sm text-muted-foreground`,children:`Creates the system and one endpoint draft per operation. Add its authentication, then test and publish the endpoints.`})]}),A(`button`,{type:`button`,"aria-label":`Close`,onClick:P,className:`rounded-md p-1 hover:bg-muted`,children:A(o,{className:`size-5`,"aria-hidden":`true`})})]}),k(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto px-6 py-4`,children:[A(O,{id:`import-system-file`,label:j[p].file,hint:`Or paste it below. It is read in the browser and sent to the API.`,children:A(`input`,{id:`import-system-file`,type:`file`,accept:`application/json,.json`,className:`block w-full text-xs file:mr-2 file:rounded-md file:border file:bg-card file:px-2 file:py-1 file:text-xs`,onChange:e=>{let t=e.target.files?.[0];t&&t.text().then(z)}})}),A(O,{id:`import-system-document`,label:`Document (JSON)`,hint:H&&U?`Detected: ${_[U]} · ${M(b(H,U))}`:void 0,error:Y,children:A(f,{...E(`import-system-document`,Y,!!U),rows:7,spellCheck:!1,className:`min-h-28 bg-card font-mono text-sm`,placeholder:`{"openapi": "3.0.3", "info": {...}, "paths": {...}}`,value:R,onChange:e=>z(e.target.value)})}),k(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[A(O,{id:`import-system-name`,label:`Name`,error:K.name?J.name:void 0,children:A(d,{...E(`import-system-name`,K.name?J.name:void 0),className:`h-9 bg-card font-mono text-sm`,maxLength:64,value:K.name,onChange:e=>Q({name:e.target.value})})}),A(O,{id:`import-system-display`,label:`Display name (optional)`,children:A(d,{...E(`import-system-display`),className:`h-9 bg-card text-sm`,maxLength:120,value:K.display_name,onChange:e=>Q({display_name:e.target.value})})}),A(O,{id:`import-system-base`,label:`Base URL`,className:`sm:col-span-2`,hint:`Every endpoint is called on this URL. Taken from the document when it names one.`,error:U?J.base_url:void 0,children:A(d,{...E(`import-system-base`,U?J.base_url:void 0,!0),className:`h-9 bg-card text-sm`,value:K.base_url,onChange:e=>Q({base_url:e.target.value})})})]}),K.name&&!J.name&&k(`p`,{className:`text-xs text-muted-foreground`,children:[`Endpoints are named `,k(`code`,{children:[y(K.name),`.<operation>`]}),`.`]})]}),k(`div`,{className:`flex justify-end gap-2 border-t px-6 py-3`,children:[A(u,{type:`button`,variant:`outline`,onClick:P,children:`Cancel`}),k(u,{type:`submit`,disabled:!Z||X.isPending,children:[A(a,{}),X.isPending?`Importing…`:`Create system and endpoints`]})]})]})})]})})}
@@ -0,0 +1,10 @@
1
+ import { type Studio } from '../hooks/useStudio';
2
+ /**
3
+ * Installs a whole system from a system file (what Export downloads, or a catalogue file):
4
+ * the system, its mappings and every endpoint, disabled and without credentials. Then the
5
+ * system opens.
6
+ */
7
+ export declare function ImportSystemFileDialog({ studio, onClose, }: {
8
+ studio: Studio;
9
+ onClose: () => void;
10
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{Dialog as e}from"@base-ui/react/dialog";import{useRef as t,useState as n}from"react";import{useMutation as r,useQueryClient as i}from"@tanstack/react-query";import{useNavigate as a}from"react-router-dom";import{FileUp as o,X as s}from"lucide-react";import{paths as c}from"@/app/paths";import{importSystemCollectionFile as l}from"@/shared/api/integrations";import{Button as u}from"@/shared/components/ui/button";import{formatNumber as d}from"@/shared/lib/format";import{notify as f}from"@/shared/lib/notify";import{collectionsKey as p,connectorsKey as m,useRefreshActions as h}from"../hooks/useStudio";import{installMessages as g,systemFileOf as _}from"../model/collection-install";import{problemMessage as v}from"../model/problems";import{Field as y}from"./parts";import{jsx as b,jsxs as x}from"react/jsx-runtime";const S=e=>e===1?`1 endpoint`:`${d(e)} endpoints`,C=e=>e===1?`1 mapping`:`${d(e)} mappings`;export function ImportSystemFileDialog({studio:d,onClose:w}){let T=a(),E=i(),D=h(d.scope.tenantId),[O,k]=n(null),[A,j]=n(!1),M=t(0),N=O===null?null:_(O),P=A?`The file could not be read. Choose it again.`:O===null?void 0:N?N.summary.endpoints===0?`This system has no endpoints to import.`:void 0:`Not a system file. Choose a file downloaded with Export on a system page.`,F=r({mutationFn:()=>l(N.document,d.scope.tenantId),onSuccess:async({outcome:e,connector_id:t})=>{await Promise.all([E.invalidateQueries({queryKey:m(d.scope.tenantId)}),E.invalidateQueries({queryKey:p(d.scope.tenantId)}),D()]),f.success(g[e]),w(),T(`${c.systems}/${t}`)},onError:e=>f.error(`The system could not be imported: ${v(e)}`)}),I=!!N&&!P;return b(e.Root,{open:!0,onOpenChange:e=>!e&&w(),children:x(e.Portal,{children:[b(e.Backdrop,{className:`fixed inset-0 z-[80] bg-black/45`}),b(e.Popup,{className:`fixed top-1/2 left-1/2 z-[81] flex w-[min(560px,94vw)] -translate-1/2 flex-col overflow-hidden rounded-xl bg-card shadow-2xl`,children:x(`form`,{"aria-label":`Import system file`,onSubmit:e=>{e.preventDefault(),I&&F.mutate()},children:[x(`div`,{className:`flex items-start gap-3 border-b px-6 py-4`,children:[x(`div`,{className:`min-w-0 flex-1`,children:[b(e.Title,{className:`text-lg font-semibold`,children:`Import a system file`}),b(e.Description,{className:`text-sm text-muted-foreground`,children:`Installs the whole system with its endpoints and mappings, disabled. Add its credentials, then turn it on.`})]}),b(`button`,{type:`button`,"aria-label":`Close`,onClick:w,className:`rounded-md p-1 hover:bg-muted`,children:b(s,{className:`size-5`,"aria-hidden":`true`})})]}),x(`div`,{className:`space-y-3 px-6 py-4`,children:[b(y,{id:`import-system-collection`,label:`System file (JSON)`,hint:`A file downloaded with Export on a system page.`,error:P,children:b(`input`,{id:`import-system-collection`,type:`file`,accept:`application/json,.json`,className:`block w-full text-xs file:mr-2 file:rounded-md file:border file:bg-card file:px-2 file:py-1 file:text-xs`,onChange:e=>{let t=e.target.files?.[0],n=++M.current;k(null),j(!1),t&&t.text().then(e=>{n===M.current&&k(e)},()=>{n===M.current&&j(!0)})}})}),N&&!P&&x(`div`,{className:`rounded-lg border bg-workspace-soft/40 px-3 py-2 text-sm`,children:[b(`p`,{className:`font-semibold text-primary`,children:N.summary.displayName}),b(`p`,{className:`text-xs text-muted-foreground tabular-nums`,children:`${S(N.summary.endpoints)} · ${C(N.summary.mappings)}`})]})]}),x(`div`,{className:`flex justify-end gap-2 border-t px-6 py-3`,children:[b(u,{type:`button`,variant:`outline`,onClick:w,children:`Cancel`}),x(u,{type:`submit`,disabled:!I||F.isPending,children:[b(o,{}),F.isPending?`Importing…`:`Import system`]})]})]})})]})})}
@@ -0,0 +1,6 @@
1
+ /** Choose a system's logo from the bundled logo library, or none. */
2
+ export declare function LogoPicker({ value, onPick, onClose, }: {
3
+ value: string;
4
+ onPick: (key: string) => void;
5
+ onClose: () => void;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{Dialog as e}from"@base-ui/react/dialog";import{Ban as t,Check as n,Search as r,X as i}from"lucide-react";import{useState as a}from"react";import{Input as o}from"@/shared/components/ui/input";import{matchesSearch as s}from"@/shared/lib/search";import{cn as c}from"@/shared/lib/utils";import{systemLogos as l}from"../model/system-logos";import{jsx as u,jsxs as d}from"react/jsx-runtime";const f=new Set([`api`,`csv`,`ftp`,`http`,`json`,`mcp`,`rest`,`sftp`,`soap`,`xml`]),p=e=>e.split(`-`).map(e=>f.has(e)?e.toUpperCase():`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(` `),m=`relative flex flex-col items-center gap-2 rounded-lg border bg-card p-3 text-xs transition-colors hover:border-workspace/60 focus-visible:outline-2 focus-visible:outline-ring aria-pressed:border-workspace aria-pressed:bg-workspace-soft/60`;export function LogoPicker({value:f,onPick:h,onClose:g}){let[_,v]=a(``),y=l.filter(e=>s(_,[e.key,p(e.key)])),b=e=>{h(e),g()};return u(e.Root,{open:!0,onOpenChange:e=>!e&&g(),children:d(e.Portal,{children:[u(e.Backdrop,{className:`fixed inset-0 z-[80] bg-black/45`}),d(e.Popup,{className:`fixed top-1/2 left-1/2 z-[81] flex max-h-[85vh] w-[min(760px,95vw)] -translate-1/2 flex-col overflow-hidden rounded-xl bg-card shadow-2xl`,children:[d(`div`,{className:`flex items-start gap-3 border-b px-5 py-3`,children:[d(`div`,{className:`min-w-0 flex-1`,children:[u(e.Title,{className:`text-lg font-semibold`,children:`Choose a logo`}),u(e.Description,{className:`text-sm text-muted-foreground`,children:`Shown on the system's card and in the list.`})]}),u(`button`,{type:`button`,"aria-label":`Close`,onClick:g,className:`rounded-md p-1 hover:bg-muted`,children:u(i,{className:`size-5`,"aria-hidden":`true`})})]}),u(`div`,{className:`border-b px-5 py-2`,children:d(`label`,{htmlFor:`logo-search`,className:`relative block w-72 max-w-full`,children:[u(`span`,{className:`sr-only`,children:`Search logos`}),u(r,{className:`pointer-events-none absolute top-2.5 left-2.5 size-4 text-muted-foreground`,"aria-hidden":`true`}),u(o,{id:`logo-search`,type:`search`,className:`h-9 bg-card pl-8 text-sm`,placeholder:`Search logos`,value:_,onChange:e=>v(e.target.value)})]})}),d(`ul`,{"aria-label":`Logos`,className:`grid flex-1 grid-cols-[repeat(auto-fill,minmax(7rem,1fr))] gap-2 overflow-y-auto p-5`,children:[!_&&u(`li`,{children:d(`button`,{type:`button`,"aria-pressed":f===``,className:c(m,`h-full w-full`),onClick:()=>b(``),children:[u(`span`,{className:`flex size-12 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:u(t,{className:`size-5`,"aria-hidden":`true`})}),`No logo`]})}),y.map(e=>u(`li`,{children:d(`button`,{type:`button`,"aria-pressed":f===e.key,className:c(m,`h-full w-full`),onClick:()=>b(e.key),children:[f===e.key&&u(n,{className:`absolute top-1.5 right-1.5 size-3.5 text-workspace`,"aria-hidden":`true`}),u(`span`,{className:`flex size-12 items-center justify-center rounded-lg bg-white p-1.5 ring-1 ring-border`,children:u(`img`,{src:e.url,alt:``,className:`size-full object-contain`})}),u(`span`,{className:`w-full truncate text-center`,children:p(e.key)})]})},e.key)),y.length===0&&u(`li`,{className:`col-span-full py-6 text-center text-sm text-muted-foreground`,children:`No logo matches this search.`})]})]})]})})}
@@ -0,0 +1,14 @@
1
+ import { type AuthProfile } from '@/shared/api/integrations';
2
+ /** Whether an OAuth sign-in profile is connected, shown the same way everywhere. */
3
+ export declare function ConnectionPill({ profile }: {
4
+ profile: AuthProfile;
5
+ }): import("react").JSX.Element | null;
6
+ /**
7
+ * OAuth sign-in of a saved authorization-code profile: register the callback URL with the
8
+ * provider's app, then Connect opens the provider's sign-in in a window. The callback
9
+ * page tells this window when it is done; tokens never reach the browser.
10
+ */
11
+ export declare function ProfileSignIn({ profile, writable }: {
12
+ profile: AuthProfile;
13
+ writable: boolean;
14
+ }): import("react").JSX.Element | null;
@@ -0,0 +1 @@
1
+ import{useMutation as e,useQueryClient as t}from"@tanstack/react-query";import{LogIn as n,LogOut as r,PlugZap as i}from"lucide-react";import{profileCredentials as a}from"@/shared/api/integrations";import{ErrorNotice as o}from"@/shared/components/layout/ErrorNotice";import{Button as s}from"@/shared/components/ui/button";import{ConfirmButton as c}from"@/shared/components/workspace/ConfirmButton";import{CopyValue as l}from"@/shared/components/workspace/CopyValue";import{useProfileSignIn as u}from"@/shared/hooks/useProfileSignIn";import{Pill as d}from"./parts";import{formatTime as f}from"../model/presentation";import{studioKey as p}from"../hooks/useStudio";import{notify as m}from"@/shared/lib/notify";import{jsx as h,jsxs as g}from"react/jsx-runtime";export function ConnectionPill({profile:e}){let t=e.credentials;return e.kind!==`oauth2_authorization_code`||!t?null:t.signed_in?g(d,{className:`bg-success/10 text-success-foreground`,children:[h(i,{className:`size-3`,"aria-hidden":`true`}),`Connected`]}):h(d,{className:`bg-warning/10 text-warning-foreground`,children:`Not connected`})}export function ProfileSignIn({profile:i,writable:d}){let _=t(),v=i.credentials,y=u(()=>void _.invalidateQueries({queryKey:p})),b=y.waiting===i.id,x=e({mutationFn:()=>a.signOut(i.id),onSuccess:()=>{m.success(`${i.display_name??i.name} disconnected.`),_.invalidateQueries({queryKey:p})}});return v?g(`section`,{"aria-label":`Sign-in`,className:`space-y-2 rounded-lg border p-3`,children:[g(`div`,{className:`flex items-center justify-between gap-2`,children:[h(`h3`,{className:`text-sm font-semibold`,children:`Sign-in`}),h(ConnectionPill,{profile:i})]}),v.redirect_uri&&g(`div`,{className:`space-y-1`,children:[h(`label`,{htmlFor:`oauth-callback`,className:`text-xs text-muted-foreground`,children:`Callback URL: register it in the provider’s OAuth app`}),h(l,{id:`oauth-callback`,label:`callback URL`,value:v.redirect_uri})]}),v.signed_in&&g(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 text-xs text-muted-foreground`,children:[h(`dt`,{children:`Since`}),h(`dd`,{children:f(v.signed_in_since??null)}),h(`dt`,{children:`Token`}),g(`dd`,{children:[v.token_expires_at?`expires ${f(v.token_expires_at)}`:`does not expire`,v.refreshable&&` · renews itself`]})]}),!v.secret_stored&&h(`p`,{className:`text-xs text-warning-foreground`,children:`Store the client secret first.`}),d&&g(`div`,{className:`flex flex-wrap gap-2`,children:[g(s,{type:`button`,size:`sm`,disabled:!v.secret_stored||y.pending||b,onClick:()=>y.connect(i.id),children:[h(n,{}),b?`Waiting for sign-in…`:v.signed_in?`Reconnect`:`Connect`]}),v.signed_in&&g(c,{title:`Disconnect ${i.display_name??i.name}?`,detail:`Calls that use this profile fail until someone connects again.`,action:`Disconnect`,destructive:!0,pending:x.isPending,error:x.error?.message,onConfirm:()=>x.mutate(),className:`h-7 px-2.5 text-[0.8rem]`,children:[h(r,{}),`Disconnect`]})]}),y.blockedUrl&&g(`p`,{className:`text-xs`,children:[`The sign-in window was blocked.`,` `,h(`a`,{href:y.blockedUrl,target:`_blank`,rel:`noreferrer`,className:`font-medium text-primary underline`,onClick:()=>y.markWaiting(i.id),children:`Open the sign-in`})]}),y.error&&h(o,{error:y.error})]}):null}
@@ -0,0 +1,8 @@
1
+ import type { Studio } from '../hooks/useStudio';
2
+ /**
3
+ * Inbound access: the keys other systems use to call our published MCP servers. Each
4
+ * opens one server; it was shown once when issued (on the server's Access keys tab).
5
+ */
6
+ export declare function ServerKeysTab({ studio }: {
7
+ studio: Studio;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{DataTable as e}from"@/shared/components/workspace/DataTable";import{useState as t}from"react";import{useMutation as n,useQuery as r,useQueryClient as i}from"@tanstack/react-query";import{Link as a}from"react-router-dom";import{KeyRound as o,Trash2 as s}from"lucide-react";import{paths as c}from"@/app/paths";import{getAssets as l,mcpServerKeys as u}from"@/shared/api/ai-assets";import{ErrorNotice as d}from"@/shared/components/layout/ErrorNotice";import{ConfirmButton as f}from"@/shared/components/workspace/ConfirmButton";import{PersonName as p}from"@/shared/components/workspace/PersonName";import{usePersonNames as m}from"@/shared/hooks/usePersonNames";import{formatInstant as h}from"@/shared/lib/datetime";import{Loading as g,Pill as _}from"./parts";import{notify as v}from"@/shared/lib/notify";import{jsx as y,Fragment as b,jsxs as x}from"react/jsx-runtime";export function ServerKeysTab({studio:S}){let C=i(),{tenantId:w,ready:T}=S.scope,E=[`ai-assets`,w??`own`,`mcp-server-keys`],D=r({queryKey:E,queryFn:({signal:e})=>u.list(w,void 0,e),enabled:T,retry:!1}),O=r({queryKey:[`ai-assets`,w??`own`,`list`,`mcp_server`],queryFn:({signal:e})=>l(`mcp_server`,w,e),enabled:T,retry:!1}),k=n({mutationFn:e=>u.revoke(e,w),onSuccess:()=>{v.success(`Key revoked.`),C.invalidateQueries({queryKey:E})}}),A=new Map((O.data??[]).map(e=>[e.id,e])),[j]=t(Date.now),M=m((D.data??[]).map(e=>e.created_by));return y(`section`,{"aria-label":`MCP server keys`,className:`overflow-x-auto rounded-xl border bg-card`,children:D.isPending?y(g,{children:`Loading keys…`}):D.isError?y(d,{error:D.error,retry:()=>void D.refetch()}):x(e,{searchInHeader:!0,empty:y(b,{children:`No keys yet. Issue one from AI Studio › MCP › MCP Servers (key icon).`}),className:`w-full text-left text-sm`,children:[y(`caption`,{className:`sr-only`,children:`MCP server keys`}),y(`thead`,{className:`sticky top-0 bg-muted/60 text-muted-foreground backdrop-blur`,children:y(`tr`,{children:[`Key`,`MCP server`,`Created`,`Last used`,`Expires`,``].map(e=>y(`th`,{scope:`col`,className:`px-3 py-1.5 font-medium`,children:e},e))})}),y(`tbody`,{className:`divide-y`,children:D.data.map(e=>{let t=A.get(e.server_id),n=e.expires_at!==null&&e.expires_at<=j;return x(`tr`,{children:[x(`td`,{className:`px-3 py-2`,children:[x(`span`,{className:`inline-flex items-center gap-1.5 font-semibold`,children:[y(o,{className:`size-3.5`,"aria-hidden":`true`}),e.label]}),x(`code`,{className:`block text-xs text-muted-foreground`,children:[e.prefix,`…`]})]}),y(`td`,{className:`px-3 py-2`,children:t?y(a,{to:`${c.mcpServers}/${t.id}?tab=keys`,className:`text-primary hover:underline`,children:t.display_name??t.name}):`—`}),x(`td`,{className:`px-3 py-2 whitespace-nowrap`,"data-grid-sort":e.created_at,"data-grid-value":`${h(e.created_at)} ${M(e.created_by).text}`,children:[h(e.created_at),y(p,{subject:e.created_by,className:`block text-xs text-muted-foreground`})]}),y(`td`,{className:`px-3 py-2 whitespace-nowrap`,"data-grid-sort":e.last_used_at,children:h(e.last_used_at,`Never`)}),y(`td`,{className:`px-3 py-2 whitespace-nowrap`,children:n?y(_,{className:`bg-warning/10 text-warning-foreground`,children:`Expired`}):h(e.expires_at,`No expiry`)}),y(`td`,{className:`px-3 py-2 text-right`,children:S.writable&&x(f,{destructive:!0,title:`Revoke ${e.label}?`,detail:`Calls with this key fail from now on.`,action:`Revoke`,pending:k.isPending&&k.variables===e.id,error:k.variables===e.id?k.error?.message:void 0,onConfirm:()=>k.mutate(e.id),className:`h-7 px-2 text-xs`,children:[y(s,{}),` Revoke`]})})]},e.id)})})]})})}
@@ -0,0 +1,6 @@
1
+ /** A system's logo on a framed tile (the cable icon without one); greyed when disabled. */
2
+ export declare function SystemIcon({ logo, enabled, className, }: {
3
+ logo: string | undefined;
4
+ enabled?: boolean;
5
+ className: string;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{Cable as e}from"lucide-react";import{cn as t}from"@/shared/lib/utils";import{jsx as n}from"react/jsx-runtime";export function SystemIcon({logo:r,enabled:i=!0,className:a}){return n(`span`,{className:t(`flex shrink-0 items-center justify-center rounded-xl ring-1`,r?`bg-white p-1.5 ring-border`:`bg-workspace-soft text-workspace ring-workspace/30`,!i&&`opacity-60 grayscale`,a),children:r?n(`img`,{src:r,alt:``,className:`size-full object-contain`,loading:`lazy`}):n(e,{className:`size-1/2`,"aria-hidden":`true`})})}
@@ -0,0 +1,10 @@
1
+ import { type ConnectorDraft } from '../model/connector-form';
2
+ type Patch = (patch: Partial<ConnectorDraft>) => void;
3
+ /** Logo, access, lines of business and tags: what the system's card and list row show. */
4
+ export declare function SystemLabelsFields({ draft, set, writable, tagsError, }: {
5
+ draft: ConnectorDraft;
6
+ set: Patch;
7
+ writable: boolean;
8
+ tagsError?: string;
9
+ }): import("react").JSX.Element;
10
+ export {};
@@ -0,0 +1 @@
1
+ import{Cable as e,Plus as t,X as n}from"lucide-react";import{useState as r}from"react";import{Button as i}from"@/shared/components/ui/button";import{Input as a}from"@/shared/components/ui/input";import{SegmentedControl as o}from"@/shared/components/workspace/SegmentedControl";import{cn as s}from"@/shared/lib/utils";import{MAX_TAG_LENGTH as c,MAX_TAGS as l}from"../model/connector-form";import{accessLabels as u,lineOfBusinessLabels as d}from"../model/system-labels";import{logoUrl as f}from"../model/system-logos";import{LogoPicker as p}from"./LogoPicker";import{jsx as m,jsxs as h}from"react/jsx-runtime";const g=Object.keys(d),_=[{value:``,label:`Not set`},{value:`contract`,label:`Paid`},{value:`free`,label:u.free}];export function SystemLabelsFields({draft:t,set:n,writable:i,tagsError:a}){let[c,l]=r(!1),u=f(t.icon);return h(`div`,{className:`grid gap-4 md:grid-cols-[auto_minmax(0,1fr)]`,children:[h(`div`,{className:`flex flex-col items-start gap-2`,children:[m(`span`,{className:`text-sm font-medium`,children:`Logo`}),m(`button`,{type:`button`,disabled:!i,onClick:()=>l(!0),"aria-label":u?`Change logo (${t.icon})`:`Choose a logo`,className:`group flex size-20 items-center justify-center rounded-xl border border-dashed bg-card transition-colors hover:border-workspace/60 disabled:cursor-default`,children:u?m(`span`,{className:`flex size-16 items-center justify-center rounded-lg bg-white p-2 ring-1 ring-border`,children:m(`img`,{src:u,alt:``,className:`size-full object-contain`})}):m(e,{className:`size-7 text-workspace`,"aria-hidden":`true`})}),i&&m(`span`,{className:`text-xs text-muted-foreground`,children:u?`Click to change`:`Click to choose`})]}),h(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[h(`div`,{className:`flex flex-col gap-1.5`,children:[m(`span`,{className:`text-sm font-medium`,id:`system-access-label`,children:`Access`}),i?m(o,{label:`Access`,value:t.access,segments:_,onChange:e=>n({access:e})}):m(`span`,{className:`text-sm`,children:_.find(e=>e.value===t.access)?.label})]}),h(`fieldset`,{className:`flex flex-col gap-1.5`,children:[m(`legend`,{className:`mb-1.5 text-sm font-medium`,children:`Lines of business`}),m(`div`,{className:`flex flex-wrap gap-1.5`,children:g.map(e=>{let r=t.lines_of_business.includes(e);return m(`button`,{type:`button`,"aria-pressed":r,disabled:!i,onClick:()=>n({lines_of_business:r?t.lines_of_business.filter(t=>t!==e):g.filter(n=>n===e||t.lines_of_business.includes(n))}),className:s(`rounded-badge border px-2.5 py-1 text-xs transition-colors`,r?`border-workspace/50 bg-workspace-soft font-medium text-foreground`:`text-muted-foreground hover:border-workspace/40 hover:text-foreground`),children:d[e]},e)})})]}),m(v,{tags:t.tags,onChange:e=>n({tags:e}),writable:i,error:a})]}),c&&m(p,{value:t.icon,onPick:e=>n({icon:e}),onClose:()=>l(!1)})]})}function v({tags:e,onChange:o,writable:u,error:d}){let[f,p]=r(``),g=f.trim(),_=e.length>=l,v=e.some(e=>e.toLowerCase()===g.toLowerCase()),y=()=>{!g||v||_||(o([...e,g]),p(``))},b=v?`This tag is already there.`:`Other labels people scan for, like Payments or Geocoding. Up to ${l}.`;return h(`div`,{className:`flex flex-col gap-1.5`,children:[m(`label`,{htmlFor:`system-tags`,className:`text-sm font-medium`,children:`Tags`}),h(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.map(t=>h(`span`,{className:`inline-flex items-center gap-1 rounded-badge bg-workspace-soft py-0.5 pr-1.5 pl-2.5 text-xs font-medium`,children:[t,u&&m(`button`,{type:`button`,"aria-label":`Remove tag ${t}`,className:`rounded-full p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:()=>o(e.filter(e=>e!==t)),children:m(n,{className:`size-3`,"aria-hidden":`true`})})]},t)),u&&!_&&h(`span`,{className:`inline-flex items-center gap-1`,children:[m(a,{id:`system-tags`,"aria-describedby":`system-tags-hint`,"aria-invalid":v||!!d||void 0,className:`h-8 w-44 bg-card text-sm`,maxLength:c,placeholder:`Add a tag`,value:f,onChange:e=>p(e.target.value.replace(`,`,``)),onKeyDown:t=>{t.key===`Enter`||t.key===`,`?(t.preventDefault(),y()):t.key===`Backspace`&&!f&&e.length>0&&o(e.slice(0,-1))}}),h(i,{type:`button`,variant:`outline`,size:`sm`,disabled:!g||v,onClick:y,children:[m(t,{}),` Add`]})]}),!u&&e.length===0&&m(`span`,{className:`text-sm text-muted-foreground`,children:`None`})]}),m(`p`,{id:`system-tags-hint`,className:s(`text-xs`,d||v?`text-destructive`:`text-muted-foreground`),children:d??b})]})}
@@ -0,0 +1,15 @@
1
+ import { type ConnectorAccess, type SystemLabels } from '../model/system-labels';
2
+ import './connector-picker.css';
3
+ /** Paid ($ icon, the picker's contract tone) or Free, as the connector type picker shows it. */
4
+ export declare function AccessMark({ access }: {
5
+ access: ConnectorAccess;
6
+ }): import("react").JSX.Element;
7
+ /**
8
+ * One row of pills, always the same height: access first, then lines of business, then tags.
9
+ * Pills that do not fit (`max`) fold into "+N", which names them on hover.
10
+ */
11
+ export declare function SystemPills({ labels, max, className, }: {
12
+ labels: SystemLabels;
13
+ max?: number;
14
+ className?: string;
15
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{DollarSign as e}from"lucide-react";import{cn as t}from"@/shared/lib/utils";import{lineOfBusinessLabels as n}from"../model/system-labels";import"./connector-picker.css";import{jsx as r,jsxs as i}from"react/jsx-runtime";const a=`block truncate rounded-badge px-2 py-0.5 text-[11px] leading-4 whitespace-nowrap`;export function AccessMark({access:n}){return n===`free`?r(`span`,{className:t(a,`bg-success/10 font-semibold text-success-foreground`),children:`Free`}):i(`span`,{className:`connector-access inline-flex size-5 shrink-0 items-center justify-center rounded-full bg-[var(--ct-contract-bg)] text-[var(--ct-contract)]`,title:`Paid: needs a contract with the provider`,children:[r(e,{className:`size-3`,strokeWidth:2.5,"aria-hidden":`true`}),r(`span`,{className:`sr-only`,children:`Paid`})]})}export function SystemPills({labels:e,max:o=3,className:s}){let c=[...e.lines.map(e=>({text:n[e],tag:!1})),...e.tags.map(e=>({text:e,tag:!0}))],l=c.slice(0,o),u=c.slice(o);return i(`ul`,{"aria-label":`Labels`,className:t(`flex h-6 min-w-0 flex-nowrap items-center gap-1 overflow-hidden`,s),children:[e.access&&r(`li`,{className:`inline-flex shrink-0`,children:r(AccessMark,{access:e.access})}),l.map(({text:e,tag:n})=>r(`li`,{className:`min-w-0 shrink`,children:r(`span`,{className:t(a,`max-w-36`,n?`bg-workspace-soft font-medium text-foreground`:`border text-muted-foreground`),title:e,children:e})},`${n?`tag`:`line`}-${e}`)),u.length>0&&r(`li`,{className:`relative z-10 shrink-0`,children:r(`span`,{className:t(a,`bg-muted font-medium text-muted-foreground`),title:u.map(({text:e})=>e).join(`, `),children:`+${u.length}`})})]})}
@@ -0,0 +1,11 @@
1
+ import { type ActionTestResult, type IntegrationAction } from '@/shared/api/integrations';
2
+ /**
3
+ * Test the saved version: a dry run renders the request and applies the host checks;
4
+ * a live test sends it. A write action needs the same explicit confirmation the API does.
5
+ */
6
+ export declare function TestPanel({ action, writable, unsaved, onTested, }: {
7
+ action: IntegrationAction;
8
+ writable: boolean;
9
+ unsaved: boolean;
10
+ onTested: (result: ActionTestResult) => void;
11
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{useState as e}from"react";import{useMutation as t}from"@tanstack/react-query";import{FlaskConical as n,Send as r,TriangleAlert as i}from"lucide-react";import{testAction as a}from"@/shared/api/integrations";import{Button as o}from"@/shared/components/ui/button";import{Textarea as s}from"@/shared/components/ui/textarea";import{SegmentedControl as c}from"@/shared/components/workspace/SegmentedControl";import{cn as l}from"@/shared/lib/utils";import{fromAction as u,sampleContext as d}from"../model/action-form";import{SaveError as f}from"./EditorForm";import{Field as p,JsonBlock as m,MethodBadge as h,Pill as g}from"./parts";import{described as _,outcomeLabels as v}from"../model/presentation";import{jsx as y,jsxs as b,Fragment as x}from"react/jsx-runtime";const S=[{value:`dry_run`,label:`Dry run`},{value:`live`,label:`Live`}];function C(e){try{let t=JSON.parse(e||`{}`);return typeof t==`object`&&t&&!Array.isArray(t)?t:null}catch{return null}}function w({result:e}){let t=e.request;return b(`section`,{"aria-label":`Test result`,className:`space-y-2`,children:[b(`output`,{className:l(`flex flex-wrap items-center gap-2 rounded-lg border p-2 text-xs`,e.ok?`border-success/30 bg-success/5`:`border-destructive/30 bg-destructive/5`),children:[y(g,{className:e.ok?`bg-success/10 text-success-foreground`:`bg-destructive/10 text-destructive`,children:e.ok?`Passed`:`Did not pass`}),b(`span`,{children:[e.mode===`live`?`Live`:`Dry run`,` · `,v[e.outcome]]}),e.response_status!==null&&b(`span`,{children:[`Status `,y(`strong`,{children:e.response_status})]}),e.duration_ms!==null&&b(`span`,{children:[e.duration_ms,` ms`]}),e.mode===`live`&&b(`span`,{children:[e.attempts,` attempt(s)`]}),e.error_code&&y(`code`,{className:`rounded bg-muted px-1`,children:e.error_code}),e.message&&y(`span`,{className:`basis-full text-foreground/80`,children:e.message}),e.ok&&e.action.status===`tested`&&b(`span`,{className:`basis-full text-success-foreground`,children:[`Version `,e.action.version_no,` is now tested and can be published.`]})]}),e.missing.length>0&&b(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[`Missing values: `,e.missing.join(`, `),`. Add them to the sample context.`]}),t&&b(`div`,{className:`space-y-1`,children:[b(`p`,{className:`flex min-w-0 items-center gap-2 text-xs`,children:[y(h,{method:t.method}),y(`code`,{className:`min-w-0 break-all`,children:t.url})]}),b(`p`,{className:`text-[12px] text-muted-foreground`,children:[`Signed with `,t.auth?y(`strong`,{children:t.auth}):`no auth profile`,` (its headers are never shown) · timeout `,t.timeout_ms,` ms`]}),b(`div`,{className:`grid gap-2 lg:grid-cols-2`,children:[y(m,{label:`Rendered headers`,value:t.headers}),y(m,{label:`Rendered query`,value:t.query})]}),t.body!==null&&y(m,{label:`Rendered body`,value:t.body})]}),e.mode===`live`&&b(`div`,{className:`grid gap-2 lg:grid-cols-2`,children:[y(m,{label:`Mapped output`,value:e.output}),e.response_body!==null&&y(m,{label:`Response body (not stored)`,value:e.response_body})]})]})}export function TestPanel({action:l,writable:m,unsaved:h,onTested:g}){let[v,T]=e(()=>d(u(l))),[E,D]=e(`dry_run`),[O,k]=e(!1),[A,j]=e(!1),[M,N]=e(!0),P=t({mutationFn:e=>a(l.id,e),onSuccess:g}),F=C(v),I=E===`live`,L=l.side_effect===`write`,R=I&&L,z=F!==null&&(!R||O)&&!P.isPending;return m?b(`form`,{"aria-label":`Test the action`,className:`space-y-3 p-3`,onSubmit:e=>{e.preventDefault(),z&&F&&P.mutate({mode:E,context:F,confirm_write:R&&O,include_response_body:I&&A,mark_tested:M})},children:[h&&b(`output`,{className:`block rounded-md bg-warning/10 p-2 text-xs text-warning-foreground`,children:[`You have unsaved changes. Tests run the saved version `,l.version_no,`; save first to test your draft.`]}),b(`div`,{className:`flex flex-wrap items-center gap-3`,children:[y(c,{label:`Test mode`,value:E,segments:S,onChange:e=>{D(e),k(!1),P.reset()}}),y(`p`,{className:`text-xs text-muted-foreground`,children:I?`Sends the request through the connector (at most 3 attempts) and logs it.`:`Renders the request and checks hosts; nothing is sent.`}),b(o,{type:`submit`,size:`sm`,className:`ml-auto`,variant:I?`default`:`outline`,disabled:!z,children:[y(I?r:n,{}),P.isPending?`Testing…`:I?`Send live test`:`Run dry run`]})]}),y(p,{id:`test-context`,label:`Sample context (JSON)`,error:F===null?`The context must be a JSON object.`:void 0,hint:b(x,{children:[`Values per root, e.g. `,y(`code`,{children:`{"q": {"reference_number": "P-1"}}`}),`. Use fictitious data.`]}),children:y(s,{..._(`test-context`,F===null?`x`:void 0,!0),rows:6,spellCheck:!1,className:`min-h-24 bg-card font-mono text-sm`,value:v,onChange:e=>T(e.target.value)})}),b(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-xs`,children:[l.status===`draft`&&b(`label`,{className:`flex items-center gap-2`,children:[y(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:M,onChange:e=>N(e.target.checked)}),`Mark tested when it passes`]}),I&&b(`label`,{className:`flex items-center gap-2`,children:[y(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:A,onChange:e=>j(e.target.checked)}),`Show the response body (up to 64 KiB, never stored)`]})]}),R&&b(`label`,{className:`flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive/5 p-2 text-xs`,children:[y(`input`,{type:`checkbox`,className:`mt-0.5 size-4 accent-destructive`,checked:O,onChange:e=>k(e.target.checked)}),b(`span`,{children:[y(i,{className:`mr-1 inline size-3.5 text-destructive`,"aria-hidden":`true`}),y(`strong`,{children:`I confirm this writes to the target system.`}),` This is a `,l.method,` `,`write action: a live test creates or changes real data there.`]})]}),y(f,{error:P.error}),P.data&&y(w,{result:P.data})]}):b(`p`,{className:`p-3 text-sm text-muted-foreground`,children:[`Testing needs the `,y(`code`,{children:`admin.integration.write`}),` permission.`]})}
@@ -0,0 +1,32 @@
1
+ /* Connector type colours, tuned per theme like the flow designer's step families: deep fills
2
+ * with white icons on the light theme, bright fills with ink icons on the dark theme. Products
3
+ * show their official logo on a light tile in both themes (brand marks are drawn for white).
4
+ * The icon and the name still identify the type, so colour is never the only cue. */
5
+ .connector-picker,
6
+ .connector-access {
7
+ --ct-icon: #ffffff;
8
+ --ct-logo-bg: #ffffff;
9
+ --ct-category: #475569;
10
+ --ct-contract: #1d4ed8;
11
+ --ct-contract-bg: rgb(29 78 216 / 0.1);
12
+ --ct-rest: #2563eb;
13
+ --ct-soap: #475569;
14
+ --ct-sftp: #b45309;
15
+ --ct-blob: #0369a1;
16
+ --ct-smtp: #dc2626;
17
+ --ct-webhook: #9333ea;
18
+ }
19
+ .dark .connector-picker,
20
+ .dark .connector-access {
21
+ --ct-icon: var(--brand-ink);
22
+ --ct-logo-bg: #f5f3ee;
23
+ --ct-category: #a7b4c6;
24
+ --ct-contract: #8fb4ff;
25
+ --ct-contract-bg: rgb(143 180 255 / 0.14);
26
+ --ct-rest: #6ea2ff;
27
+ --ct-soap: #a7b4c6;
28
+ --ct-sftp: #fbbf24;
29
+ --ct-blob: #38bdf8;
30
+ --ct-smtp: #f87171;
31
+ --ct-webhook: #c084fc;
32
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The mapping list failed: an older server without the message-mapping API gets a plain
3
+ * explanation instead of "Not Found"; anything else is the usual error notice.
4
+ */
5
+ export declare function MappingsUnavailable({ error, retry }: {
6
+ error: Error;
7
+ retry: () => void;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{ServerCrash as e}from"lucide-react";import{ApiError as t}from"@/shared/api/http";import{ErrorNotice as n}from"@/shared/components/layout/ErrorNotice";import{jsx as r,jsxs as i}from"react/jsx-runtime";const a=e=>e instanceof t&&e.status===404&&e.code!==`MAPPING_NOT_FOUND`;export function MappingsUnavailable({error:t,retry:o}){return a(t)?i(`div`,{role:`alert`,className:`flex items-start gap-3 p-5 text-sm`,children:[r(e,{className:`mt-0.5 size-5 shrink-0 text-warning-foreground`,"aria-hidden":`true`}),i(`div`,{children:[r(`p`,{className:`font-semibold`,children:`Message mappings are not on this server yet`}),r(`p`,{className:`mt-1 text-muted-foreground`,children:`The connected backend was deployed before message mappings were added. They appear here as soon as the latest backend version is deployed; nothing you have is lost.`}),r(`button`,{type:`button`,onClick:o,className:`mt-2 text-primary hover:underline`,children:`Check again`})]})]}):r(n,{error:t,retry:o})}
@@ -0,0 +1,7 @@
1
+ import { type Edge, type EdgeProps } from '@xyflow/react';
2
+ export type LinkEdge = Edge<{
3
+ editable: boolean;
4
+ }, 'link'>;
5
+ /** A mapping link. Pointing at it or selecting it shows a delete button on the line, the
6
+ * same control the flow designer uses; removal runs through the canvas's onEdgesDelete. */
7
+ export declare function LinkLine({ id, sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, style, markerEnd, selected, data, }: EdgeProps<LinkEdge>): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{useState as e}from"react";import{BaseEdge as t,EdgeLabelRenderer as n,getBezierPath as r}from"@xyflow/react";import{EdgeDeleteButton as i}from"@/shared/components/canvas/EdgeDeleteButton";import{jsx as a,jsxs as o}from"react/jsx-runtime";export function LinkLine({id:s,sourceX:c,sourceY:l,sourcePosition:u,targetX:d,targetY:f,targetPosition:p,style:m,markerEnd:h,selected:g,data:_}){let[v,y]=e(!1),[b,x,S]=r({sourceX:c,sourceY:l,sourcePosition:u,targetX:d,targetY:f,targetPosition:p}),C=_?.editable&&(v||g);return o(`g`,{onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),children:[a(t,{id:s,path:b,style:m,markerEnd:h,interactionWidth:24}),C&&a(n,{children:a(`div`,{className:`nodrag nopan pointer-events-auto absolute`,style:{transform:`translate(-50%, -50%) translate(${x}px, ${S}px)`},onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),children:a(i,{edgeId:s,label:`Delete link`})})})]})}
@@ -0,0 +1,28 @@
1
+ import { type Node, type NodeProps } from '@xyflow/react';
2
+ import type { MappingField, MappingFunction, MappingStep } from '@/shared/api/message-mappings';
3
+ export type FieldsData = {
4
+ side: 'source' | 'target';
5
+ title: string;
6
+ fields: readonly MappingField[];
7
+ linked: ReadonlySet<string>;
8
+ /** Folded objects and lists, as `side:path`. */
9
+ folded: ReadonlySet<string>;
10
+ onFold: (ref: string) => void;
11
+ onFoldAll: (fold: boolean) => void;
12
+ };
13
+ export type StepData = {
14
+ step: MappingStep;
15
+ fn: MappingFunction | undefined;
16
+ linked: ReadonlySet<string>;
17
+ problem: boolean;
18
+ /** Opens the function's details and settings. */
19
+ onInfo: () => void;
20
+ /** Removes the function and its links; absent when read only. */
21
+ onDelete?: () => void;
22
+ };
23
+ export type FieldsNode = Node<FieldsData, 'fields'>;
24
+ export type StepNode = Node<StepData, 'step'>;
25
+ /** A message structure: one row per field, each with its own connection point. */
26
+ export declare function FieldsCard({ data }: NodeProps<FieldsNode>): import("react").JSX.Element;
27
+ /** A function box: one input per argument on the left, its result on the right. */
28
+ export declare function StepCard({ data, selected }: NodeProps<StepNode>): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{Handle as e,Position as t}from"@xyflow/react";import{ChevronRight as n,ChevronsDownUp as r,ChevronsUpDown as i,FunctionSquare as a,Inbox as o,Info as s,Send as c,Trash2 as l}from"lucide-react";import{cn as u}from"@/shared/lib/utils";import{depthOf as d,isFolded as f,leafOf as p,typeIcon as m}from"../../model/mappings/mapping-model";import{jsx as h,jsxs as g}from"react/jsx-runtime";const _=`!size-3 !border-2 !border-card !bg-primary`;export function FieldsCard({data:a}){let s=a.side===`source`,l=s?o:c,v=new Set([...a.folded].filter(e=>e.startsWith(`${a.side}:`)).map(e=>e.slice(7))),y=e=>[...a.linked].some(t=>t.startsWith(`${a.side}:${e}.`));return g(`div`,{className:`w-[300px] rounded-xl border-2 border-border bg-card shadow-sm`,children:[g(`div`,{className:u(`flex items-center gap-2 rounded-t-[10px] border-b px-3 py-2`,s?`bg-viz-2/10`:`bg-success/10`),children:[h(l,{className:`size-4`,"aria-hidden":`true`}),h(`b`,{className:`text-sm`,children:a.title}),g(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:[a.fields.length,` fields`]}),a.fields.some(e=>e.type===`object`||e.type===`list`)&&g(`span`,{className:`flex gap-0.5`,children:[h(`button`,{type:`button`,title:`Expand all`,"aria-label":`Expand all ${a.side} fields`,onClick:()=>a.onFoldAll(!1),className:`nodrag grid size-6 place-items-center rounded-md text-muted-foreground hover:bg-card hover:text-foreground`,children:h(i,{className:`size-3.5`,"aria-hidden":`true`})}),h(`button`,{type:`button`,title:`Collapse all`,"aria-label":`Collapse all ${a.side} fields`,onClick:()=>a.onFoldAll(!0),className:`nodrag grid size-6 place-items-center rounded-md text-muted-foreground hover:bg-card hover:text-foreground`,children:h(r,{className:`size-3.5`,"aria-hidden":`true`})})]})]}),a.fields.length===0?g(`p`,{className:`px-3 py-4 text-xs text-muted-foreground`,children:[`No fields yet. Use “`,s?`Source`:`Target`,` structure” to paste an example message or add fields.`]}):h(`ul`,{children:a.fields.map(r=>{let i=`${a.side}:${r.path}`;if(f(r.path,v))return null;let o=r.type===`object`||r.type===`list`,c=a.folded.has(i),l=a.linked.has(i)||c&&y(r.path);return g(`li`,{title:r.description||r.path,className:u(`relative flex h-7 items-center gap-1.5 border-b border-border/50 pr-3 text-xs last:rounded-b-[10px] last:border-b-0`,l&&`bg-primary/6`),style:{paddingLeft:12+d(r.path)*12},children:[o?h(`button`,{type:`button`,"aria-expanded":!c,"aria-label":`${c?`Expand`:`Collapse`} ${r.path}`,onClick:()=>a.onFold(i),className:`nodrag -ml-1 grid size-5 shrink-0 place-items-center rounded text-muted-foreground hover:bg-muted hover:text-foreground`,children:h(n,{"aria-hidden":`true`,className:u(`size-3.5 transition-transform`,!c&&`rotate-90`)})}):h(`span`,{className:`w-4 shrink-0`}),h(`span`,{className:`w-5 shrink-0 text-center text-[10px] text-muted-foreground`,children:m[r.type??`any`]}),h(`span`,{className:u(`truncate`,l&&`font-semibold`),children:p(r.path)}),r.required&&h(`span`,{className:`text-destructive`,children:`*`}),c&&g(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:[a.fields.filter(e=>e.path.startsWith(`${r.path}.`)).length,` inside`]}),h(e,{id:i,type:s?`source`:`target`,position:s?t.Right:t.Left,className:s?`!size-3 !border-2 !border-card !bg-success`:_})]},r.path)})})]})}export function StepCard({data:n,selected:r}){let i=`step:${n.step.id}`,o=n.fn?.inputs??[`value`],c=n.step.params?.values??{};return g(`div`,{className:u(`w-[210px] rounded-xl border-2 bg-card shadow-sm`,r?`border-primary`:n.problem?`border-warning`:`border-border`),children:[g(`div`,{className:`group/step flex items-center gap-2 rounded-t-[10px] bg-primary/10 px-3 py-2`,children:[h(a,{className:`size-4 shrink-0 text-primary`,"aria-hidden":`true`}),h(`b`,{className:`min-w-0 flex-1 truncate text-sm`,title:n.fn?.description,children:n.fn?.label??n.step.function}),g(`span`,{className:`flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/step:opacity-100 focus-within:opacity-100`,children:[h(`button`,{type:`button`,"aria-label":`About ${n.fn?.label??n.step.function}`,title:`Details and settings`,onClick:e=>{e.stopPropagation(),n.onInfo()},className:`nodrag grid size-6 place-items-center rounded-md text-muted-foreground hover:bg-card hover:text-foreground`,children:h(s,{className:`size-3.5`,"aria-hidden":`true`})}),n.onDelete&&h(`button`,{type:`button`,"aria-label":`Delete ${n.fn?.label??n.step.function}`,title:`Delete function and its links`,onClick:e=>{e.stopPropagation(),n.onDelete?.()},className:`nodrag grid size-6 place-items-center rounded-md text-muted-foreground hover:bg-destructive/12 hover:text-destructive`,children:h(l,{className:`size-3.5`,"aria-hidden":`true`})})]})]}),h(`ul`,{className:`py-1`,children:o.map(r=>{let a=`${i}.${r}`;return g(`li`,{className:`relative flex h-6 items-center pl-3 text-xs text-muted-foreground`,children:[h(`span`,{className:u(n.linked.has(a)&&`font-semibold text-foreground`),children:r}),!n.linked.has(a)&&c[r]!==void 0&&g(`span`,{className:`ml-1.5 truncate pr-2 text-foreground`,title:String(c[r]),children:[`= `,String(c[r])]}),h(e,{id:a,type:`target`,position:t.Left,className:_})]},r)})}),g(`div`,{className:`relative flex h-7 items-center justify-end border-t pr-3 text-xs font-semibold`,children:[`result`,h(e,{id:i,type:`source`,position:t.Right,className:_})]}),Object.keys(n.step.params??{}).some(e=>e!==`values`)&&h(`p`,{className:`truncate border-t px-3 py-1 text-[11px] text-muted-foreground`,children:Object.entries(n.step.params??{}).filter(([e,t])=>e!==`values`&&t!==``&&t!==null).map(([e,t])=>`${e}: ${typeof t==`object`?`…`:String(t)}`).join(` · `)||`Default settings`})]})}
@@ -0,0 +1,28 @@
1
+ import { type MappingDefinition, type MappingField, type MappingFunction, type MappingStep } from '@/shared/api/message-mappings';
2
+ /**
3
+ * The fields of the source or target message: read them from an example message, or add,
4
+ * retype and remove them one by one. Apply replaces the side's fields on the canvas.
5
+ */
6
+ export declare function StructurePanel({ side, fields, readOnly, onApply, onClose, }: {
7
+ side: 'source' | 'target';
8
+ fields: readonly MappingField[];
9
+ readOnly: boolean;
10
+ onApply: (fields: MappingField[]) => void;
11
+ onClose: () => void;
12
+ }): import("react").JSX.Element;
13
+ /** Settings of one function box, from its catalog entry; Remove deletes it with its links. */
14
+ export declare function StepPanel({ step, fn, readOnly, linkedInputs, onApply, onRemove, onClose, }: {
15
+ step: MappingStep;
16
+ fn: MappingFunction | undefined;
17
+ readOnly: boolean;
18
+ /** The inputs that already have a link drawn to them. */
19
+ linkedInputs: ReadonlySet<string>;
20
+ onApply: (params: Record<string, unknown>) => void;
21
+ onRemove: () => void;
22
+ onClose: () => void;
23
+ }): import("react").JSX.Element;
24
+ /** Runs the current drawing (saved or not) on an example message and shows the output. */
25
+ export declare function PreviewPanel({ definition, onClose, }: {
26
+ definition: MappingDefinition;
27
+ onClose: () => void;
28
+ }): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import{useState as e}from"react";import{useMutation as t}from"@tanstack/react-query";import{ArrowRight as n,Plus as r,Trash2 as i,X as a}from"lucide-react";import{previewMapping as o}from"@/shared/api/message-mappings";import{ErrorNotice as s}from"@/shared/components/layout/ErrorNotice";import{Button as c}from"@/shared/components/ui/button";import{Input as l}from"@/shared/components/ui/input";import{Textarea as u}from"@/shared/components/ui/textarea";import{SidePanel as d}from"@/shared/components/workspace/SidePanel";import{cn as f}from"@/shared/lib/utils";import{functionHelp as p}from"../../model/mappings/function-help";import{fieldTypes as m,PATH as h}from"../../model/mappings/mapping-model";import{fieldsOf as g,pretty as _,sampleTarget as v,sampleRecord as y}from"../../model/mappings/samples";import{jsx as b,jsxs as x}from"react/jsx-runtime";function S({title:e,hint:t,onClose:n}){return x(`div`,{className:`flex flex-none items-start gap-2 border-b px-5 py-3.5`,children:[x(`div`,{className:`min-w-0 flex-1`,children:[b(`h2`,{className:`text-base font-semibold`,children:e}),t&&b(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:t})]}),b(`button`,{type:`button`,"aria-label":`Close`,onClick:n,children:b(a,{"aria-hidden":`true`,className:`size-5 text-muted-foreground`})})]})}function C(e){try{let t=JSON.parse(e);return typeof t==`object`&&t&&!Array.isArray(t)?t:null}catch{return null}}export function StructurePanel({side:t,fields:n,readOnly:a,onApply:o,onClose:s}){let[f,p]=e(()=>n.map(e=>({...e}))),w=t===`source`?y:v,[T,E]=e(()=>_(w)),[D,O]=e(``),k=T.trim()?C(T):null,A=f.some(e=>e.path===D.trim()),j=t===`source`?`Source structure`:`Target structure`;return x(d,{label:j,size:`md`,onClose:s,children:[b(S,{title:j,hint:t===`source`?`The message that comes in. Paste an example and the fields are read for you.`:`The message to produce. Mark fields the receiving system requires with “Required”.`,onClose:s}),x(`div`,{className:`flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[!a&&x(`section`,{className:`space-y-2 rounded-lg border p-3`,children:[b(`h3`,{className:`text-sm font-semibold`,children:`From an example message`}),b(u,{"aria-label":`Example message (JSON)`,rows:6,spellCheck:!1,className:`font-mono text-sm`,placeholder:`{"customer": {"name": "Acme", "address": {"city": "Denver"}}}`,value:T,onChange:e=>E(e.target.value)}),T.trim()&&!k&&x(`p`,{className:`text-xs text-destructive`,children:[`Paste a JSON object, e.g. `,`{"name": "Acme"}`,`.`]}),x(`div`,{className:`flex flex-wrap gap-2`,children:[b(c,{size:`sm`,variant:`outline`,disabled:!k,onClick:()=>k&&p(g(k)),children:`Read fields`}),x(c,{size:`sm`,variant:`ghost`,onClick:()=>E(_(w)),children:[`Use the sample `,t===`source`?`record`:`policy`]})]})]}),x(`section`,{children:[x(`h3`,{className:`mb-2 text-sm font-semibold`,children:[`Fields (`,f.length,`)`]}),f.length===0&&b(`p`,{className:`text-xs text-muted-foreground`,children:`No fields yet.`}),b(`ul`,{className:`divide-y rounded-lg border`,children:f.map((e,n)=>x(`li`,{className:`flex items-center gap-2 px-2.5 py-1.5 text-sm`,children:[b(`code`,{className:`min-w-0 flex-1 truncate text-xs`,children:e.path}),b(`select`,{"aria-label":`Type of ${e.path}`,disabled:a,value:e.type??`any`,onChange:e=>p(t=>t.map((t,r)=>r===n?{...t,type:e.target.value}:t)),className:`h-7 rounded-md border border-input bg-card px-1.5 text-xs`,children:m.map(e=>b(`option`,{children:e},e))}),t===`target`&&x(`label`,{className:`flex items-center gap-1 text-xs`,children:[b(`input`,{type:`checkbox`,disabled:a,checked:!!e.required,onChange:()=>p(e=>e.map((e,t)=>t===n?{...e,required:!e.required}:e)),className:`accent-primary`}),`Required`]}),!a&&b(`button`,{type:`button`,"aria-label":`Remove ${e.path}`,onClick:()=>p(e=>e.filter((e,t)=>t!==n)),children:b(i,{"aria-hidden":`true`,className:`size-4 text-destructive`})})]},e.path))}),!a&&x(`form`,{className:`mt-2 flex items-start gap-2`,onSubmit:e=>{e.preventDefault();let t=D.trim();h.test(t)&&!A&&(p(e=>[...e,{path:t,type:`text`,required:!1,description:``}]),O(``))},children:[x(`div`,{className:`min-w-0 flex-1`,children:[b(l,{"aria-label":`New field path`,className:`h-8 text-xs`,placeholder:`customer.address.city or vehicles[].vin`,value:D,onChange:e=>O(e.target.value)}),D.trim()&&(!h.test(D.trim())||A)&&b(`p`,{className:`mt-1 text-xs text-destructive`,children:A?`That field already exists.`:`Use dotted names; [] marks a list.`})]}),x(c,{type:`submit`,size:`sm`,variant:`outline`,children:[b(r,{}),`Add field`]})]})]})]}),x(`div`,{className:`flex flex-none justify-end gap-2 border-t px-5 py-3`,children:[b(c,{variant:`outline`,onClick:s,children:a?`Close`:`Cancel`}),!a&&b(c,{onClick:()=>o(f),children:`Apply`})]})]})}export function StepPanel({step:t,fn:n,readOnly:r,linkedInputs:a,onApply:o,onRemove:s,onClose:f}){let[m,h]=e(()=>({...t.params??{}})),g=(e,t)=>h(n=>({...n,[e]:t})),_=m.values??{},v=(e,t)=>h(n=>{let r={...n.values??{}};return t===``?delete r[e]:r[e]=t,{...n,values:r}}),y=p[t.function];return x(d,{label:`Function ${n?.label??t.function}`,size:`sm`,onClose:f,children:[b(S,{title:n?.label??t.function,hint:n?.description,onClose:f}),x(`div`,{className:`flex-1 space-y-3 overflow-y-auto px-5 py-4`,children:[y&&x(`div`,{className:`rounded-lg border border-viz-2/30 bg-viz-2/8 px-3 py-2.5 text-[13px] leading-relaxed`,children:[b(`b`,{className:`mb-0.5 block text-xs tracking-wide text-viz-2 uppercase`,children:`How to use`}),y]}),(n?.inputs??[]).length>0&&x(`section`,{className:`space-y-2`,children:[b(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase`,children:`Inputs`}),b(`p`,{className:`text-xs text-muted-foreground`,children:`Drag a field or another function’s result onto an input, or type a value for an input that has no link.`}),(n?.inputs??[]).map(e=>{let t=a.has(e),n=`input-${e}`;return x(`div`,{className:`flex items-center gap-2`,children:[b(`label`,{htmlFor:n,className:`w-24 shrink-0 text-sm font-medium`,children:e}),t?b(`span`,{className:`flex h-8 flex-1 items-center rounded-md bg-primary/10 px-2.5 text-xs text-primary`,children:`Linked on the canvas`}):b(l,{id:n,readOnly:r,className:`h-8 flex-1 text-sm`,placeholder:`Type a value, or link it`,value:String(_[e]??``),onChange:t=>v(e,t.target.value)})]},e)})]}),(n?.params??[]).length>0&&b(`h3`,{className:`pt-1 text-xs font-semibold text-muted-foreground uppercase`,children:`Settings`}),(n?.params??[]).map(e=>{let t=m[e.name]??e.default??``,n=`param-${e.name}`;return x(`div`,{className:`space-y-1`,children:[b(`label`,{htmlFor:n,className:`block text-xs font-medium text-muted-foreground`,children:e.label}),e.kind===`choice`?b(`select`,{id:n,disabled:r,value:String(t),onChange:t=>g(e.name,t.target.value),className:`h-8 w-full rounded-md border border-input bg-card px-2 text-sm`,children:e.options.map(e=>b(`option`,{children:e},e))}):e.kind===`table`?b(u,{id:n,rows:5,readOnly:r,spellCheck:!1,className:`font-mono text-sm`,placeholder:`one per line: from = to
2
+ Y = Yes
3
+ N = No`,value:Object.entries(t??{}).map(([e,t])=>`${e} = ${String(t)}`).join(`
4
+ `),onChange:t=>g(e.name,Object.fromEntries(t.target.value.split(`
5
+ `).map(e=>e.split(`=`)).filter(e=>e.length>=2&&e[0].trim()).map(([e,...t])=>[e.trim(),t.join(`=`).trim()])))}):e.kind===`expression`?b(u,{id:n,rows:3,readOnly:r,spellCheck:!1,className:`font-mono text-sm`,value:String(t),onChange:t=>g(e.name,t.target.value)}):b(l,{id:n,type:e.kind===`number`?`number`:`text`,readOnly:r,className:`h-8 text-sm`,value:String(t),onChange:t=>g(e.name,e.kind===`number`&&t.target.value!==``?Number(t.target.value):t.target.value)})]},e.name)})]}),x(`div`,{className:`flex flex-none items-center gap-2 border-t px-5 py-3`,children:[!r&&x(c,{variant:`destructive`,onClick:s,children:[b(i,{}),`Remove function`]}),b(c,{variant:`outline`,className:`ml-auto`,onClick:f,children:r?`Close`:`Cancel`}),!r&&b(c,{onClick:()=>o(m),children:`Apply`})]})]})}export function PreviewPanel({definition:r,onClose:i}){let[a,l]=e(()=>_(y)),p=t({mutationFn:e=>o(r,e)}),m=a.trim()?C(a):null,h=p.data?[...p.data.problems.map(e=>[e.level,e.message]),...p.data.issues.map(e=>[`issue`,`${e.field}: ${e.message}`])]:[];return x(d,{label:`Test mapping`,size:`xl`,onClose:i,children:[b(S,{title:`Test mapping`,hint:`Input on the left, what this mapping produces on the right. Nothing is saved or sent.`,onClose:i}),x(`div`,{className:`flex flex-none flex-wrap items-center gap-2 border-b px-5 py-2.5`,children:[b(c,{disabled:!m||p.isPending,onClick:()=>m&&p.mutate(m),children:p.isPending?`Running…`:`Run test`}),b(c,{variant:`ghost`,size:`sm`,onClick:()=>l(_(y)),children:`Reset to the sample record`}),p.data&&b(`span`,{className:f(`ml-auto text-xs font-medium`,h.length?`text-warning-foreground`:`text-success`),children:h.length?`${h.length} thing(s) to look at`:`✓ Mapped without issues`})]}),h.length>0&&b(`ul`,{className:`flex-none space-y-1 border-b px-5 py-2`,children:h.map(([e,t],n)=>b(`li`,{className:f(`rounded-md px-3 py-1.5 text-xs`,e===`error`?`bg-destructive/10 text-destructive`:`bg-warning/12 text-warning-foreground`),children:t},n))}),x(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] gap-3 px-5 py-4 max-md:grid-cols-1`,children:[x(`section`,{"aria-label":`Input`,className:`flex min-h-0 flex-col`,children:[b(`h3`,{className:`mb-1.5 text-xs font-semibold text-muted-foreground uppercase`,children:`Input · source message`}),b(u,{"aria-label":`Example source message (JSON)`,spellCheck:!1,className:`min-h-[300px] flex-1 resize-none font-mono text-sm`,placeholder:`{"customer": {"first_name": "Dana", "last_name": "Whitfield"}}`,value:a,onChange:e=>l(e.target.value)}),a.trim()&&!m&&b(`p`,{className:`mt-1 text-xs text-destructive`,children:`Not a JSON object yet.`})]}),b(`div`,{"aria-hidden":`true`,className:`flex items-center justify-center text-muted-foreground max-md:hidden`,children:b(n,{className:`size-5`})}),x(`section`,{"aria-label":`Output`,className:`flex min-h-0 flex-col`,children:[b(`h3`,{className:`mb-1.5 text-xs font-semibold text-muted-foreground uppercase`,children:`Output · target message`}),p.error?b(s,{error:p.error}):p.data?b(`pre`,{className:`min-h-[300px] flex-1 overflow-auto rounded-lg border bg-muted/40 p-3 text-sm`,children:JSON.stringify(p.data.output,null,2)}):b(`div`,{className:`flex min-h-[300px] flex-1 items-center justify-center rounded-lg border border-dashed text-sm text-muted-foreground`,children:`Run the test to see the output here.`})]})]})]})}
@@ -0,0 +1,77 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ActionStatus, HttpMethod } from '@/shared/api/integrations';
3
+ import type { Pair } from '../model/action-form';
4
+ /** A rounded status label; colour supports the text, never replaces it. */
5
+ export declare function Pill({ className, children }: {
6
+ className?: string;
7
+ children: ReactNode;
8
+ }): import("react").JSX.Element;
9
+ export declare function StatusPill({ status }: {
10
+ status: ActionStatus;
11
+ }): import("react").JSX.Element;
12
+ export declare function MethodBadge({ method }: {
13
+ method: HttpMethod;
14
+ }): import("react").JSX.Element;
15
+ export declare function Loading({ children }: {
16
+ children: ReactNode;
17
+ }): import("react").JSX.Element;
18
+ export declare function Empty({ children }: {
19
+ children: ReactNode;
20
+ }): import("react").JSX.Element;
21
+ /** Field wrapper: label, control, then either the error or a hint (announced via id). */
22
+ export declare function Field({ id, label, error, hint, className, children, }: {
23
+ id: string;
24
+ label: string;
25
+ error?: string;
26
+ hint?: ReactNode;
27
+ className?: string;
28
+ children: ReactNode;
29
+ }): import("react").JSX.Element;
30
+ /** Key/value rows (headers, query, response mapping) with add and remove. */
31
+ export declare function PairsEditor({ label, keyLabel, valueLabel, keyPlaceholder, valuePlaceholder, rows, onChange, error, hint, }: {
32
+ label: string;
33
+ keyLabel: string;
34
+ valueLabel: string;
35
+ keyPlaceholder?: string;
36
+ valuePlaceholder?: string;
37
+ rows: Pair[];
38
+ onChange: (rows: Pair[]) => void;
39
+ error?: string;
40
+ hint?: ReactNode;
41
+ }): import("react").JSX.Element;
42
+ /** Accessible tabs (WAI-ARIA tabs pattern): arrow keys move, only the active tab is tabbable. */
43
+ export declare function Tabs<T extends string>({ label, idPrefix, value, items, onChange, className, }: {
44
+ label: string;
45
+ idPrefix: string;
46
+ value: T;
47
+ items: readonly {
48
+ value: T;
49
+ label: ReactNode;
50
+ }[];
51
+ onChange: (value: T) => void;
52
+ className?: string;
53
+ }): import("react").JSX.Element;
54
+ /** Side panel frame: title, its own actions (Save, Delete…) and Close in one header row. */
55
+ export declare function PanelHeader({ title, meta, actions, onClose, }: {
56
+ title: ReactNode;
57
+ meta?: ReactNode;
58
+ actions?: ReactNode;
59
+ onClose: () => void;
60
+ }): import("react").JSX.Element;
61
+ /** Asks before a consequential step (delete, publish, retire) in the app's confirmation
62
+ * overlay; shown while rendered. `children` says what happens next. */
63
+ export declare function Confirm({ title, children, action, destructive, pending, error, onConfirm, onCancel, }: {
64
+ title: ReactNode;
65
+ children?: ReactNode;
66
+ action: string;
67
+ destructive?: boolean;
68
+ pending?: boolean;
69
+ error?: ReactNode;
70
+ onConfirm: () => void;
71
+ onCancel: () => void;
72
+ }): import("react").JSX.Element;
73
+ /** Read-only JSON with a label, for rendered requests, outputs and response bodies. */
74
+ export declare function JsonBlock({ label, value }: {
75
+ label: string;
76
+ value: unknown;
77
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ import{tabBarClass as e,tabClass as t}from"@/shared/components/workspace/tab-styles";import{Plus as n,Trash2 as r,X as i}from"lucide-react";import{Button as a}from"@/shared/components/ui/button";import{ConfirmDialog as o}from"@/shared/components/workspace/ConfirmDialog";import{Input as s}from"@/shared/components/ui/input";import{cn as c}from"@/shared/lib/utils";import{newPair as l}from"../model/action-form";import{methodClasses as u,statusLabels as d}from"../model/presentation";import{jsx as f,jsxs as p}from"react/jsx-runtime";export function Pill({className:e,children:t}){return f(`span`,{className:c(`inline-flex shrink-0 items-center gap-1.5 rounded-badge px-2.5 py-1 text-xs font-medium whitespace-nowrap`,e??`bg-muted text-muted-foreground`),children:t})}export function StatusPill({status:e}){let{label:t,className:n}=d[e];return f(Pill,{className:n,children:t})}export function MethodBadge({method:e}){return f(`span`,{className:c(`inline-flex h-5 w-14 shrink-0 items-center justify-center rounded-badge border text-[12px] font-semibold`,u[e]),children:e})}export function Loading({children:e}){return f(`output`,{className:`block p-4 text-sm text-muted-foreground`,children:e})}export function Empty({children:e}){return f(`p`,{className:`m-3 rounded-xl border border-dashed px-6 py-6 text-center text-sm text-muted-foreground`,children:e})}export function Field({id:e,label:t,error:n,hint:r,className:i,children:a}){return p(`div`,{className:c(`min-w-0`,i),children:[f(`label`,{htmlFor:e,className:`mb-1 block text-[13px] font-medium text-muted-foreground`,children:t}),a,n?f(`p`,{id:`${e}-error`,role:`alert`,className:`mt-1 text-xs text-destructive`,children:n}):r?f(`div`,{id:`${e}-hint`,className:`mt-1 text-xs text-muted-foreground`,children:r}):null]})}export function PairsEditor({label:e,keyLabel:t,valueLabel:i,keyPlaceholder:o,valuePlaceholder:c,rows:u,onChange:d,error:m,hint:h}){let g=(e,t)=>d(u.map(n=>n.id===e?{...n,...t}:n));return p(`fieldset`,{className:`min-w-0`,children:[f(`legend`,{className:`mb-1 flex w-full items-center justify-between text-xs font-medium text-muted-foreground`,children:e}),p(`div`,{className:`space-y-1`,children:[u.map((n,l)=>p(`div`,{className:`flex items-center gap-1`,children:[f(s,{"aria-label":`${t} ${l+1}`,className:`h-7 w-2/5 bg-card text-sm`,placeholder:o,value:n.key,onChange:e=>g(n.id,{key:e.target.value})}),f(s,{"aria-label":`${i} ${l+1}`,className:`h-7 flex-1 bg-card text-sm`,placeholder:c,value:n.value,onChange:e=>g(n.id,{value:e.target.value})}),f(a,{variant:`destructive`,type:`button`,size:`icon-xs`,"aria-label":`Remove ${e.toLowerCase()} row ${l+1}`,onClick:()=>d(u.filter(e=>e.id!==n.id)),children:f(r,{})})]},n.id)),p(a,{type:`button`,variant:`ghost`,size:`xs`,onClick:()=>d([...u,l()]),children:[f(n,{}),`Add `,e.toLowerCase().replace(/s$/,``)]})]}),m?f(`p`,{role:`alert`,className:`mt-1 text-xs text-destructive`,children:m}):h?f(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:h}):null]})}export function Tabs({label:n,idPrefix:r,value:i,items:a,onChange:o,className:s}){return f(`div`,{role:`tablist`,"aria-label":n,className:c(e,s),children:a.map(e=>f(`button`,{type:`button`,role:`tab`,id:`${r}-tab-${e.value}`,"aria-selected":i===e.value,"aria-controls":`${r}-panel-${e.value}`,tabIndex:i===e.value?0:-1,onClick:()=>o(e.value),onKeyDown:e=>{if(e.key!==`ArrowRight`&&e.key!==`ArrowLeft`)return;let t=a[(a.findIndex(e=>e.value===i)+(e.key===`ArrowRight`?1:a.length-1))%a.length]?.value;t!==void 0&&(o(t),document.getElementById(`${r}-tab-${t}`)?.focus())},className:t(i===e.value),children:e.label},e.value))})}export function PanelHeader({title:e,meta:t,actions:n,onClose:r}){return p(`header`,{className:`sticky top-0 z-10 flex flex-wrap items-center justify-between gap-2 border-b bg-card px-3 py-2`,children:[p(`div`,{className:`flex min-w-0 items-center gap-2`,children:[f(`h2`,{className:`truncate text-sm font-semibold`,children:e}),t]}),p(`div`,{className:`flex items-center gap-1`,children:[n,f(a,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:r,children:f(i,{})})]})]})}export function Confirm({title:e,children:t,action:n,destructive:r=!1,pending:i,error:a,onConfirm:s,onCancel:c}){return f(o,{open:!0,title:e,detail:t,action:n,destructive:r,pending:i,error:a,onConfirm:s,onCancel:c})}export function JsonBlock({label:e,value:t}){return p(`figure`,{className:`min-w-0`,children:[f(`figcaption`,{className:`mb-1 text-[12px] font-medium text-muted-foreground`,children:e}),f(`pre`,{"aria-label":e,className:`rounded-lg border bg-muted/30 p-2 font-mono text-[12px] leading-4 break-all whitespace-pre-wrap`,children:t===void 0?`—`:JSON.stringify(t,null,2)})]})}
@@ -0,0 +1,40 @@
1
+ import { type DataSource, type DbQuery, type TenantScope } from '@/shared/api/integrations';
2
+ import { type Studio } from './useStudio';
3
+ export declare const dataSourcesKey: (tenantId: TenantScope) => readonly ["integration-studio", "data-sources", string];
4
+ export declare const dbQueriesKey: (tenantId: TenantScope) => readonly ["integration-studio", "db-queries", string];
5
+ /** The tenant's databases; listing also ensures its App DB. */
6
+ export declare function useDataSources(studio: Studio): import("@tanstack/react-query").UseQueryResult<{
7
+ id: string;
8
+ tenant_id: string;
9
+ name: string;
10
+ display_name: string | null;
11
+ engine: import("@/shared/api/generated/schema").components["schemas"]["DataSourceEngine"];
12
+ platform: boolean;
13
+ host: string | null;
14
+ port: number;
15
+ database: string | null;
16
+ ssl_mode: import("@/shared/api/generated/schema").components["schemas"]["DbSslMode"];
17
+ auth_profile_id: string | null;
18
+ allow_write: boolean;
19
+ writes_allowed: boolean;
20
+ timeout_ms: number;
21
+ enabled: boolean;
22
+ version: number;
23
+ created_at: number | null;
24
+ created_by: string | null;
25
+ updated_at: number | null;
26
+ updated_by: string | null;
27
+ }[], Error>;
28
+ /** One row per query name: the latest version and the live (published) one. */
29
+ export type QueryLine = {
30
+ latest: DbQuery;
31
+ live: DbQuery | undefined;
32
+ versions: DbQuery[];
33
+ };
34
+ export declare function useQueryLines(studio: Studio): import("@tanstack/react-query").UseQueryResult<QueryLine[], Error>;
35
+ /** Checks one database's connection and reports the result in a snackbar. */
36
+ export declare function useCheckDataSource(source: DataSource | undefined): import("@tanstack/react-query").UseMutationResult<{
37
+ ok: boolean;
38
+ message: string | null;
39
+ }, Error, void, unknown>;
40
+ export declare function useRefreshDatabases(tenantId: TenantScope): () => Promise<[void, void]>;