@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 @@
1
+ import{useMutation as e,useQuery as t,useQueryClient as n}from"@tanstack/react-query";import{checkDataSource as r,dataSources as i,dbQueries as a}from"@/shared/api/integrations";import{notify as o}from"@/shared/lib/notify";import{problemMessage as s}from"../model/problems";import{studioKey as c}from"./useStudio";const l={staleTime:3e4,refetchOnWindowFocus:!1,retry:!1},u=e=>e??`own`;export const dataSourcesKey=e=>[...c,`data-sources`,u(e)];export const dbQueriesKey=e=>[...c,`db-queries`,u(e)];export function useDataSources(e){let{tenantId:n,ready:r}=e.scope;return t({queryKey:dataSourcesKey(n),queryFn:({signal:e})=>i.list(n,e),enabled:e.readable&&r,...l})}export function useQueryLines(e){let{tenantId:n,ready:r}=e.scope;return t({queryKey:dbQueriesKey(n),queryFn:({signal:e})=>a.list({},n,e),enabled:e.readable&&r,select:e=>{let t=new Map;for(let n of e){let e=t.get(n.name)??{latest:n,live:void 0,versions:[]};n.version_no>e.latest.version_no&&(e.latest=n),n.status===`published`&&(e.live=n),e.versions.push(n),t.set(n.name,e)}return[...t.values()].sort((e,t)=>e.latest.name.localeCompare(t.latest.name))},...l})}export function useCheckDataSource(t){return e({mutationFn:()=>r(t.id),onSuccess:e=>{let n=t?.display_name??t?.name??``;e.ok?o.success(`${n}: connected.`):o.failure(`${n}: could not connect. ${e.message??``}`.trim())},onError:e=>o.error(s(e))})}export function useRefreshDatabases(e){let t=n();return()=>Promise.all([t.invalidateQueries({queryKey:dataSourcesKey(e)}),t.invalidateQueries({queryKey:dbQueriesKey(e)})])}
@@ -0,0 +1,26 @@
1
+ import type { TenantScope, Versioned } from '@/shared/api/integrations';
2
+ type Kind = 'profile' | 'connector';
3
+ type Api<T, W> = {
4
+ create: (input: W, tenantId: TenantScope) => Promise<Versioned<T>>;
5
+ update: (id: string, input: W, etag: string) => Promise<Versioned<T>>;
6
+ remove: (id: string, etag: string) => Promise<void>;
7
+ };
8
+ /**
9
+ * Create, replace (`If-Match` of the version read) and delete one connector or auth
10
+ * profile. A stale version keeps the draft; `reload` fetches the latest. Each outcome
11
+ * confirms with a toast.
12
+ */
13
+ export declare function useResourceSave<T extends {
14
+ id: string;
15
+ version: number;
16
+ }, W>(kind: Kind, api: Api<T, W>, saved: Versioned<T> | undefined, options: {
17
+ tenantId: TenantScope;
18
+ listKey: readonly unknown[];
19
+ onSaved: (id: string) => void;
20
+ onDeleted: () => void;
21
+ }): {
22
+ save: import("@tanstack/react-query").UseMutationResult<Versioned<T>, Error, W, unknown>;
23
+ remove: import("@tanstack/react-query").UseMutationResult<void, Error, void, unknown>;
24
+ reload: () => undefined;
25
+ };
26
+ export {};
@@ -0,0 +1 @@
1
+ import{useMutation as e,useQueryClient as t}from"@tanstack/react-query";import{notify as n}from"@/shared/lib/notify";import{detailKey as r}from"./useStudio";const i={connector:{created:`System created.`,deleted:`System deleted.`,saved:`System saved.`},profile:{created:`Credential created.`,deleted:`Credential deleted.`,saved:`Credential saved.`}};export function useResourceSave(a,o,s,c){let l=t(),u=()=>l.invalidateQueries({queryKey:c.listKey});return{save:e({mutationFn:e=>s?o.update(s.data.id,e,s.etag):o.create(e,c.tenantId),onSuccess:async e=>{l.setQueryData(r(a,e.data.id),e),await u(),n.success(i[a][s?`saved`:`created`]),c.onSaved(e.data.id)}}),remove:e({mutationFn:()=>s?o.remove(s.data.id,s.etag):Promise.resolve(),onSuccess:async()=>{await u(),n.success(i[a].deleted),c.onDeleted()}}),reload:()=>s&&void l.invalidateQueries({queryKey:r(a,s.data.id)})}}
@@ -0,0 +1,218 @@
1
+ import { type IntegrationAction, type TenantScope, type Versioned } from '@/shared/api/integrations';
2
+ export type StudioTab = 'connectors' | 'profiles' | 'actions';
3
+ export type ActionView = 'definition' | 'test' | 'deploy' | 'calls' | 'versions';
4
+ export declare const studioKey: readonly ['integration-studio'];
5
+ /** Permissions, scope, and the URL state: `tab`, selected `item` (id, `new`, `import`), `view`. */
6
+ export declare function useStudio(): {
7
+ scope: {
8
+ platform: boolean;
9
+ tenantId: string | undefined;
10
+ ready: boolean;
11
+ };
12
+ readable: boolean;
13
+ writable: boolean;
14
+ publishable: boolean;
15
+ tab: StudioTab;
16
+ view: ActionView;
17
+ selected: string;
18
+ openTab: (next: StudioTab) => void;
19
+ select: (id: string, nextView?: ActionView | '') => void;
20
+ setView: (next: ActionView) => void;
21
+ };
22
+ export type Studio = ReturnType<typeof useStudio>;
23
+ export declare const profilesKey: (tenantId: TenantScope) => readonly ["integration-studio", "profiles", string];
24
+ export declare const connectorsKey: (tenantId: TenantScope) => readonly ["integration-studio", "connectors", string];
25
+ export declare const actionsKey: (tenantId: TenantScope) => readonly ["integration-studio", "actions", string];
26
+ export declare const detailKey: (kind: 'profile' | 'connector' | 'action', id: string) => readonly ["integration-studio", "action" | "connector" | "profile", string];
27
+ export declare function useProfiles(studio: Studio): import("@tanstack/react-query").UseQueryResult<{
28
+ id: string;
29
+ tenant_id: string;
30
+ name: string;
31
+ display_name: string | null;
32
+ kind: import("@/shared/api/generated/schema").components["schemas"]["AuthProfileKind"];
33
+ config: {
34
+ [key: string]: string;
35
+ };
36
+ secret_ref: string | null;
37
+ enabled: boolean;
38
+ version: number;
39
+ created_at: number | null;
40
+ created_by: string | null;
41
+ updated_at: number | null;
42
+ updated_by: string | null;
43
+ credentials?: import("@/shared/api/generated/schema").components["schemas"]["CredentialsRead"] | null;
44
+ }[], Error>;
45
+ export declare const collectionsKey: (tenantId: TenantScope) => readonly ["integration-studio", "collections", string];
46
+ /** The system catalogue: whole systems the customer can import (loaded when `enabled`). */
47
+ export declare function useSystemCollections(studio: Studio, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
48
+ key: string;
49
+ category: string | null;
50
+ name: string;
51
+ display_name: string;
52
+ description: string | null;
53
+ base_url: string;
54
+ icon: string | null;
55
+ access: import("@/shared/api/generated/schema").components["schemas"]["SystemAccess"] | null;
56
+ lines_of_business: import("@/shared/api/generated/schema").components["schemas"]["LineOfBusiness"][];
57
+ tags: string[];
58
+ endpoints: number;
59
+ mappings: number;
60
+ installed: boolean;
61
+ published_by: string | null;
62
+ published_at: number | null;
63
+ removable: boolean;
64
+ }[], Error>;
65
+ export declare function useConnectors(studio: Studio): import("@tanstack/react-query").UseQueryResult<{
66
+ id: string;
67
+ tenant_id: string;
68
+ name: string;
69
+ display_name: string | null;
70
+ description: string | null;
71
+ base_url: string;
72
+ auth_profile_id: string | null;
73
+ default_headers: {
74
+ [key: string]: string;
75
+ };
76
+ timeout_ms: number;
77
+ allowed_hosts: string[];
78
+ allow_private_network: boolean;
79
+ enabled: boolean;
80
+ platform: boolean;
81
+ icon: string | null;
82
+ access: import("@/shared/api/generated/schema").components["schemas"]["SystemAccess"] | null;
83
+ lines_of_business: import("@/shared/api/generated/schema").components["schemas"]["LineOfBusiness"][];
84
+ tags: string[];
85
+ version: number;
86
+ created_at: number | null;
87
+ created_by: string | null;
88
+ updated_at: number | null;
89
+ updated_by: string | null;
90
+ }[], Error>;
91
+ /** Names (with status) of the tenant's message mappings, for an action's mapping pickers. */
92
+ export declare function useMappingNames(studio: Studio): import("@tanstack/react-query").UseQueryResult<{
93
+ name: string;
94
+ status: "draft" | "published" | "retired";
95
+ version_no: number;
96
+ }[], Error>;
97
+ /** One row per action name: the latest version and the one that is live (published). */
98
+ export type ActionLine = {
99
+ latest: IntegrationAction;
100
+ live: IntegrationAction | undefined;
101
+ };
102
+ export declare function useActionLines(studio: Studio): import("@tanstack/react-query").UseQueryResult<ActionLine[], Error>;
103
+ /** The editors start from this read; it reloads only after a change or an explicit reload. */
104
+ export declare function useDetail<T extends {
105
+ version: number;
106
+ }>(kind: 'profile' | 'connector' | 'action', id: string, load: (id: string, signal: AbortSignal) => Promise<Versioned<T>>): import("@tanstack/react-query").UseQueryResult<Versioned<T>, Error>;
107
+ export declare const useAction: (id: string) => import("@tanstack/react-query").UseQueryResult<Versioned<{
108
+ id: string;
109
+ tenant_id: string;
110
+ name: string;
111
+ display_name: string | null;
112
+ description: string | null;
113
+ version_no: number;
114
+ status: import("@/shared/api/generated/schema").components["schemas"]["ActionStatus"];
115
+ content_hash: string;
116
+ role: import("@/shared/api/generated/schema").components["schemas"]["ActionRole"];
117
+ method: import("@/shared/api/generated/schema").components["schemas"]["HttpMethod"];
118
+ url_template: string;
119
+ side_effect: import("@/shared/api/generated/schema").components["schemas"]["SideEffect"];
120
+ connector_id: string | null;
121
+ auth_profile_id: string | null;
122
+ headers_template: {
123
+ [key: string]: unknown;
124
+ };
125
+ query_template: {
126
+ [key: string]: unknown;
127
+ };
128
+ body_template: import("@/shared/api/generated/schema").components["schemas"]["JsonValue"];
129
+ response_mapping: {
130
+ [key: string]: string;
131
+ };
132
+ success_codes: number[];
133
+ idempotency: {
134
+ [key: string]: string;
135
+ } | null;
136
+ pagination: {
137
+ [key: string]: unknown;
138
+ } | null;
139
+ timeout_ms: number;
140
+ retry_policy: {
141
+ [key: string]: unknown;
142
+ };
143
+ rate_limit_per_minute: number | null;
144
+ schema_version: number;
145
+ payload_mapping: string | null;
146
+ response_message_mapping: string | null;
147
+ response_mode: import("@/shared/api/generated/schema").components["schemas"]["ResponseMode"];
148
+ version: number;
149
+ created_at: number | null;
150
+ created_by: string | null;
151
+ updated_at: number | null;
152
+ updated_by: string | null;
153
+ }>, Error>;
154
+ export declare function useVersions(id: string): import("@tanstack/react-query").UseQueryResult<{
155
+ id: string;
156
+ tenant_id: string;
157
+ name: string;
158
+ display_name: string | null;
159
+ description: string | null;
160
+ version_no: number;
161
+ status: import("@/shared/api/generated/schema").components["schemas"]["ActionStatus"];
162
+ content_hash: string;
163
+ role: import("@/shared/api/generated/schema").components["schemas"]["ActionRole"];
164
+ method: import("@/shared/api/generated/schema").components["schemas"]["HttpMethod"];
165
+ url_template: string;
166
+ side_effect: import("@/shared/api/generated/schema").components["schemas"]["SideEffect"];
167
+ connector_id: string | null;
168
+ auth_profile_id: string | null;
169
+ headers_template: {
170
+ [key: string]: unknown;
171
+ };
172
+ query_template: {
173
+ [key: string]: unknown;
174
+ };
175
+ body_template: import("@/shared/api/generated/schema").components["schemas"]["JsonValue"];
176
+ response_mapping: {
177
+ [key: string]: string;
178
+ };
179
+ success_codes: number[];
180
+ idempotency: {
181
+ [key: string]: string;
182
+ } | null;
183
+ pagination: {
184
+ [key: string]: unknown;
185
+ } | null;
186
+ timeout_ms: number;
187
+ retry_policy: {
188
+ [key: string]: unknown;
189
+ };
190
+ rate_limit_per_minute: number | null;
191
+ schema_version: number;
192
+ payload_mapping: string | null;
193
+ response_message_mapping: string | null;
194
+ response_mode: import("@/shared/api/generated/schema").components["schemas"]["ResponseMode"];
195
+ version: number;
196
+ created_at: number | null;
197
+ created_by: string | null;
198
+ updated_at: number | null;
199
+ updated_by: string | null;
200
+ }[], Error>;
201
+ export declare function useCalls(id: string, enabled: boolean): import("@tanstack/react-query").UseQueryResult<{
202
+ id: string;
203
+ action_id: string;
204
+ method: import("@/shared/api/generated/schema").components["schemas"]["HttpMethod"];
205
+ url_hash: string;
206
+ request_body_hash: string | null;
207
+ response_status: number | null;
208
+ response_hash: string | null;
209
+ duration_ms: number | null;
210
+ error: string | null;
211
+ correlation_id: string | null;
212
+ hook_delivery_id: string | null;
213
+ ai_run_id: string | null;
214
+ called_at: number;
215
+ created_by: string | null;
216
+ }[], Error>;
217
+ /** After any action change: lists, versions and the call log may all have moved. */
218
+ export declare function useRefreshActions(tenantId: TenantScope): (changed?: Versioned<IntegrationAction>) => Promise<void>;
@@ -0,0 +1 @@
1
+ import{useQuery as e,useQueryClient as t}from"@tanstack/react-query";import{useSearchParams as n}from"react-router-dom";import{authProfiles as r,connectors as i,getAction as a,getActionCalls as o,getActions as s,getActionVersions as c,getSystemCollections as l}from"@/shared/api/integrations";import{getMappings as u}from"@/shared/api/message-mappings";import{useSession as d}from"@/shared/auth/session-context";import{useTenantScope as f}from"@/shared/hooks/useTenantScope";const p=[`connectors`,`profiles`,`actions`],m=[`definition`,`test`,`deploy`,`calls`,`versions`];export const studioKey=[`integration-studio`];const h={staleTime:3e4,refetchOnWindowFocus:!1,retry:!1},g=e=>e??`own`;export function useStudio(){let{can:e}=d(),t=f(),[r,i]=n(),a=r.get(`tab`),o=p.find(e=>e===a)??`actions`,s=r.get(`view`),c=m.find(e=>e===s)??`definition`,l=r.get(`item`)??``,u=e=>i(t=>{let n=new URLSearchParams(t);return Object.entries(e).forEach(([e,t])=>t?n.set(e,t):n.delete(e)),n},{replace:!(e.item&&!l)});return{scope:t,readable:e(`admin.integration.read`),writable:e(`admin.integration.write`),publishable:e(`admin.integration.publish`),tab:o,view:c,selected:l,openTab:e=>u({tab:e,item:``,view:``}),select:(e,t=``)=>u({item:e,view:t}),setView:e=>u({view:e===`definition`?``:e})}}export const profilesKey=e=>[...studioKey,`profiles`,g(e)];export const connectorsKey=e=>[...studioKey,`connectors`,g(e)];export const actionsKey=e=>[...studioKey,`actions`,g(e)];export const detailKey=(e,t)=>[...studioKey,e,t];export function useProfiles(t){let{tenantId:n,ready:i}=t.scope;return e({queryKey:profilesKey(n),queryFn:({signal:e})=>r.list(n,e),enabled:t.readable&&i,...h})}export const collectionsKey=e=>[...studioKey,`collections`,g(e)];export function useSystemCollections(t,n=!0){let{tenantId:r,ready:i}=t.scope;return e({queryKey:collectionsKey(r),queryFn:({signal:e})=>l(r,e),enabled:n&&t.readable&&i,...h})}export function useConnectors(t){let{tenantId:n,ready:r}=t.scope;return e({queryKey:connectorsKey(n),queryFn:({signal:e})=>i.list(n,e),enabled:t.readable&&r,...h})}export function useMappingNames(t){let{tenantId:n,ready:r}=t.scope;return e({queryKey:[`message-mappings`,`list`,g(n)],queryFn:({signal:e})=>u(n,e),enabled:t.readable&&r,select:e=>e.map(({name:e,status:t,version_no:n})=>({name:e,status:t,version_no:n})),...h})}export function useActionLines(t){let{tenantId:n,ready:r}=t.scope;return e({queryKey:[...actionsKey(n),`all-versions`],queryFn:({signal:e})=>s({all_versions:!0},n,e),enabled:t.readable&&r,select:e=>{let t=new Map;for(let n of e){let e=t.get(n.name),r=!e||n.version_no>e.latest.version_no?n:e.latest,i=n.status===`published`?n:e?.live;t.set(n.name,{latest:r,live:i})}return[...t.values()].sort((e,t)=>e.latest.name.localeCompare(t.latest.name))},...h})}export function useDetail(t,n,r){return e({queryKey:detailKey(t,n),queryFn:({signal:e})=>r(n,e),enabled:!!n,...h,staleTime:1/0})}export const useAction=e=>useDetail(`action`,e,a);export function useVersions(t){return e({queryKey:[...studioKey,`versions`,t],queryFn:({signal:e})=>c(t,e),enabled:!!t,...h})}export function useCalls(t,n){return e({queryKey:[...studioKey,`calls`,t],queryFn:({signal:e})=>o(t,50,e),enabled:n&&!!t,...h})}export function useRefreshActions(e){let n=t();return async t=>{t&&n.setQueryData(detailKey(`action`,t.data.id),t),await Promise.all([n.invalidateQueries({queryKey:actionsKey(e)}),n.invalidateQueries({queryKey:[...studioKey,`versions`]}),n.invalidateQueries({queryKey:[...studioKey,`calls`]})])}}
@@ -0,0 +1,8 @@
1
+ export { ConnectorLibraryPage } from './pages/ConnectorLibraryPage';
2
+ export { CredentialsPage } from './pages/CredentialsPage';
3
+ export { DatabasesPage } from './pages/DatabasesPage';
4
+ export { QueryPage } from './pages/QueryPage';
5
+ export { SystemPage } from './pages/SystemPage';
6
+ export { SystemsPage } from './pages/SystemsPage';
7
+ export { MappingDesignerPage } from './pages/MappingDesignerPage';
8
+ export { MappingsPage } from './pages/MappingsPage';
@@ -0,0 +1 @@
1
+ export{ConnectorLibraryPage}from"./pages/ConnectorLibraryPage";export{CredentialsPage}from"./pages/CredentialsPage";export{DatabasesPage}from"./pages/DatabasesPage";export{QueryPage}from"./pages/QueryPage";export{SystemPage}from"./pages/SystemPage";export{SystemsPage}from"./pages/SystemsPage";export{MappingDesignerPage}from"./pages/MappingDesignerPage";export{MappingsPage}from"./pages/MappingsPage";
@@ -0,0 +1,64 @@
1
+ import type { ActionRole, ActionWrite, HttpMethod, IntegrationAction, ResponseMode, SideEffect } from '@/shared/api/integrations';
2
+ /** One editable key/value row; `typed` keeps a non-text value (query numbers) unchanged. */
3
+ export type Pair = {
4
+ id: string;
5
+ key: string;
6
+ value: string;
7
+ typed?: unknown;
8
+ };
9
+ export type IdempotencyKind = 'none' | 'header' | 'body_field';
10
+ /** The action editor's draft: text for every input, converted to `ActionWrite` on save. */
11
+ export type ActionDraft = {
12
+ name: string;
13
+ /** Readable name shown in lists; empty: the name. A label, not content. */
14
+ display_name: string;
15
+ /** What the endpoint does, for people. A label, not content. */
16
+ description: string;
17
+ role: ActionRole;
18
+ method: HttpMethod;
19
+ side_effect: SideEffect;
20
+ connector_id: string;
21
+ /** Empty: sign with the connector's auth profile. */
22
+ auth_profile_id: string;
23
+ url_template: string;
24
+ headers: Pair[];
25
+ query: Pair[];
26
+ /** JSON text; empty means no body. */
27
+ body: string;
28
+ mapping: Pair[];
29
+ success_codes: string;
30
+ idempotency: IdempotencyKind;
31
+ idempotency_value: string;
32
+ timeout_ms: string;
33
+ max_attempts: string;
34
+ backoff: 'exponential' | 'fixed';
35
+ base_delay_ms: string;
36
+ rate_limit: string;
37
+ /** JSON text; stored and versioned for the paging step that follows. */
38
+ pagination: string;
39
+ schema_version: number;
40
+ /** Message mapping that builds the request body (before sending); empty: the body template. */
41
+ payload_mapping: string;
42
+ /** Message mapping that shapes the response (after it); empty: the response paths. */
43
+ response_message_mapping: string;
44
+ /** How the body becomes the output; `file` stores it and outputs its reference. */
45
+ response_mode: ResponseMode;
46
+ };
47
+ export type ActionField = keyof ActionDraft;
48
+ export declare const newPair: (key?: string, value?: string) => Pair;
49
+ export declare function fromAction(action?: IntegrationAction, connectorId?: string): ActionDraft;
50
+ /** Compares what is sent, so reordering nothing or retyping the same text is not a change. */
51
+ /** The draft without its labels: equal keys mean only the display name or description changed. */
52
+ export declare const contentKey: (draft: ActionDraft) => string;
53
+ export declare const draftKey: (draft: ActionDraft) => string;
54
+ /** Placeholders whose root the backend sandbox would refuse (a hint while typing). */
55
+ export declare function unknownRoots(draft: ActionDraft): string[];
56
+ /** Client-side checks that mirror the contract; the server stays the authority. */
57
+ export declare function actionProblems(draft: ActionDraft): Partial<Record<ActionField, string>>;
58
+ /** The `ActionWrite` body; call only when `actionProblems` is empty. */
59
+ export declare function toWrite(draft: ActionDraft): ActionWrite;
60
+ /** Where each "field: reason" of a 422 lands in the editor. */
61
+ export declare const actionFields: Record<string, ActionField>;
62
+ export declare const actionCodes: Record<string, ActionField>;
63
+ /** A starting context for the test panel: one key per root the templates read. */
64
+ export declare function sampleContext(draft: ActionDraft): string;
@@ -0,0 +1 @@
1
+ import{templateRoots as e}from"./presentation";let t=0;const n=()=>`row-${++t}`;export const newPair=(e=``,t=``)=>({id:n(),key:e,value:t});const r=e=>typeof e==`string`?e:e==null?``:String(e),i=e=>Object.entries(e??{}).map(([e,t])=>({...newPair(e,r(t)),...typeof t==`string`?{}:{typed:t}})),a=e=>e==null?``:JSON.stringify(e,null,2);export function fromAction(e,t=``){let n=e?.idempotency??null,o=n?.header?`header`:n?.body_field?`body_field`:`none`,s=e?.retry_policy??{};return{name:e?.name??``,display_name:e?.display_name??``,description:e?.description??``,role:e?.role??`custom`,method:e?.method??`GET`,side_effect:e?.side_effect??`read`,connector_id:e?.connector_id??t,auth_profile_id:e?.auth_profile_id??``,url_template:e?.url_template??`{{base}}/`,headers:i(e?.headers_template),query:i(e?.query_template),body:a(e?.body_template),mapping:i(e?.response_mapping),success_codes:(e?.success_codes??[200]).join(`, `),idempotency:o,idempotency_value:o===`header`?r(n?.header):o===`body_field`?r(n?.body_field):``,timeout_ms:String(e?.timeout_ms??1e4),max_attempts:r(s.max_attempts),backoff:s.backoff===`fixed`?`fixed`:`exponential`,base_delay_ms:r(s.base_delay_ms),rate_limit:r(e?.rate_limit_per_minute),pagination:a(e?.pagination),schema_version:e?.schema_version??1,payload_mapping:e?.payload_mapping??``,response_message_mapping:e?.response_message_mapping??``,response_mode:e?.response_mode??`auto`}}export const contentKey=e=>draftKey({...e,display_name:``,description:``});export const draftKey=e=>JSON.stringify({...e,headers:e.headers.map(({key:e,value:t})=>[e,t]),query:e.query.map(({key:e,value:t})=>[e,t]),mapping:e.mapping.map(({key:e,value:t})=>[e,t])});function o(e){try{return{ok:!0,value:JSON.parse(e)}}catch{return{ok:!1}}}const s=e=>e.split(/[\s,]+/).filter(Boolean).map(Number),c=e=>/^\d+$/.test(e.trim()),l=/^[a-z0-9_]+(\.[a-z0-9_]+)+$/,u=/^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$/,d=[`authorization`,`proxy-authorization`,`cookie`,`host`,`content-length`],f=/\{\{\s*([^}|]+?)\s*(?:\|[^}]*)?\}\}/g;export function unknownRoots(t){let n=[t.url_template,t.body,...t.headers.map(e=>e.value),...t.query.map(e=>e.value)],r=new Set(e),i=new Set;for(let e of n)for(let t of e.matchAll(f)){let e=t[1]?.split(/[.[]/)[0]??``;e&&!r.has(e)&&i.add(e)}return[...i]}export function actionProblems(e){let t={};(!l.test(e.name.trim())||e.name.length>128)&&(t.name=`Dotted lower-case words, such as pas.policy.search.`),e.connector_id||(t.connector_id=`Choose the connector.`),e.url_template.trim()||(t.url_template=`Enter the URL template.`),e.method===`GET`&&e.side_effect!==`read`&&(t.side_effect=`A GET action is always a read.`),e.body.trim()&&(e.method===`GET`?t.body=`A GET action has no body.`:o(e.body).ok||(t.body=`The body template must be valid JSON.`));let n=e.headers.find(e=>e.key.trim()&&(!u.test(e.key.trim())||d.includes(e.key.trim().toLowerCase())));n&&(t.headers=`${n.key}: not a header name, or one the auth profile or HTTP client sets.`),e.mapping.some(e=>e.key.trim()&&!e.value.trim().startsWith(`$`))&&(t.mapping=`Each response path starts with $, e.g. $.result.id.`);let r=s(e.success_codes);(!r.length||r.some(e=>!Number.isInteger(e)||e<100||e>599)||new Set(r).size!==r.length)&&(t.success_codes=`One or more HTTP status codes (100–599), no duplicates.`),e.idempotency!==`none`&&!e.idempotency_value.trim()&&(t.idempotency_value=`Name the header or body field.`);let i=Number(e.timeout_ms);if((!c(e.timeout_ms)||i<100||i>12e4)&&(t.timeout_ms=`Between 100 and 120000 ms.`),e.max_attempts.trim()&&(!c(e.max_attempts)||+e.max_attempts<1||+e.max_attempts>10)&&(t.max_attempts=`1 to 10 attempts.`),e.base_delay_ms.trim()&&(!c(e.base_delay_ms)||+e.base_delay_ms>6e4)&&(t.base_delay_ms=`0 to 60000 ms.`),e.rate_limit.trim()&&(!c(e.rate_limit)||+e.rate_limit<1||+e.rate_limit>6e3)&&(t.rate_limit=`1 to 6000 calls per minute.`),e.pagination.trim()){let n=o(e.pagination);(!n.ok||typeof n.value!=`object`||n.value===null||Array.isArray(n.value))&&(t.pagination=`Pagination is a JSON object.`)}return t}const p=e=>Object.fromEntries(e.filter(e=>e.key.trim()).map(e=>[e.key.trim(),e.value]));export function toWrite(e){let t={};e.max_attempts.trim()&&(t.max_attempts=Number(e.max_attempts)),(e.max_attempts.trim()||e.base_delay_ms.trim())&&(t.backoff=e.backoff),e.base_delay_ms.trim()&&(t.base_delay_ms=Number(e.base_delay_ms));let n=e.body.trim()?o(e.body):null,i=e.pagination.trim()?o(e.pagination):null;return{name:e.name.trim(),display_name:e.display_name.trim(),description:e.description.trim(),role:e.role,method:e.method,url_template:e.url_template.trim(),side_effect:e.method===`GET`?`read`:e.side_effect,connector_id:e.connector_id,auth_profile_id:e.auth_profile_id||null,headers_template:p(e.headers),query_template:Object.fromEntries(e.query.filter(e=>e.key.trim()).map(e=>[e.key.trim(),e.typed!==void 0&&r(e.typed)===e.value?e.typed:e.value])),body_template:n?.ok?n.value:null,response_mapping:Object.fromEntries(e.mapping.filter(e=>e.key.trim()).map(e=>[e.key.trim(),e.value.trim()])),success_codes:s(e.success_codes),idempotency:e.idempotency===`none`?null:{[e.idempotency]:e.idempotency_value.trim()},pagination:i?.ok?i.value:null,timeout_ms:Number(e.timeout_ms),retry_policy:t,rate_limit_per_minute:e.rate_limit.trim()?Number(e.rate_limit):null,schema_version:e.schema_version,payload_mapping:e.method===`GET`?null:e.payload_mapping||null,response_message_mapping:e.response_message_mapping||null,response_mode:e.response_mode}}export const actionFields={name:`name`,display_name:`display_name`,description:`description`,role:`role`,method:`method`,side_effect:`side_effect`,connector_id:`connector_id`,auth_profile_id:`auth_profile_id`,url_template:`url_template`,headers_template:`headers`,query_template:`query`,body_template:`body`,response_mapping:`mapping`,success_codes:`success_codes`,idempotency:`idempotency_value`,timeout_ms:`timeout_ms`,retry_policy:`max_attempts`,rate_limit_per_minute:`rate_limit`,pagination:`pagination`,payload_mapping:`payload_mapping`,response_message_mapping:`response_message_mapping`,response_mode:`response_mode`};export const actionCodes={ACTION_EXISTS:`name`};export function sampleContext(e){let t={},n=[e.url_template,e.body,...e.headers.map(e=>e.value),...e.query.map(e=>e.value)];for(let e of n)for(let n of e.matchAll(f)){let e=(n[1]??``).replace(/\[.*$/,``).split(`.`).filter(Boolean),r=e[0];if(!r||r===`base`||r===`idempotency_key`||e.length<2)continue;let i=t;e.forEach((t,n)=>{if(n===e.length-1){t in i||(i[t]=``);return}let r=i[t];i[t]=typeof r==`object`&&r&&!Array.isArray(r)?r:{},i=i[t]})}return JSON.stringify(t,null,2)}
@@ -0,0 +1,19 @@
1
+ export type ApiDocument = Record<string, unknown>;
2
+ export type ApiFormat = 'openapi' | 'swagger' | 'postman';
3
+ export declare const apiFormatLabels: Record<ApiFormat, string>;
4
+ /** A JSON object, or null for anything else (YAML, arrays, broken JSON). */
5
+ export declare function parseApiDocument(source: string): ApiDocument | null;
6
+ /** The format the API reads the document as, or null when it reads none of them. */
7
+ export declare function apiFormatOf(document: ApiDocument): ApiFormat | null;
8
+ /** A connector name from a title: `Policy Admin API` -> `policy_admin_api`. */
9
+ export declare const systemNameOf: (title: string) => string;
10
+ /** An endpoint name prefix from a system name: dotted lower-case words. */
11
+ export declare const endpointPrefixOf: (name: string) => string;
12
+ /** The system a document describes; empty fields are left for the person to fill in. */
13
+ export declare function systemOf(document: ApiDocument, format: ApiFormat): {
14
+ name: string;
15
+ display_name: string;
16
+ base_url: string;
17
+ };
18
+ /** How many operations (OpenAPI, Swagger) or requests (Postman) the document holds. */
19
+ export declare function operationCount(document: ApiDocument, format: ApiFormat): number;
@@ -0,0 +1 @@
1
+ export const apiFormatLabels={openapi:`OpenAPI 3`,postman:`Postman collection`,swagger:`Swagger 2.0`};const e=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:void 0,t=e=>Array.isArray(e)?e:[],n=e=>typeof e==`string`?e:``;export function parseApiDocument(t){try{return e(JSON.parse(t))??null}catch{return null}}export function apiFormatOf(t){return n(e(t.info)?.schema).toLowerCase().includes(`postman`)?`postman`:String(t.openapi??``).startsWith(`3.`)?`openapi`:String(t.swagger)===`2.0`?`swagger`:null}export const systemNameOf=e=>e.toLowerCase().replace(/[^a-z0-9._-]+/g,`_`).replace(/^[^a-z]+|[_.-]+$/g,``).slice(0,64)||`imported_api`;export const endpointPrefixOf=e=>e.toLowerCase().replace(/[^a-z0-9.]+/g,`_`).replace(/^[_.]+|[_.]+$/g,``).slice(0,60);const r=e=>/^https?:\/\/[^/{}\s]+/i.test(e)?e.replace(/\/+$/,``):``;function i(i){let a=e(t(i.servers)[0]),o=e(a?.variables)??{},s=n(a?.url).replace(/\{([^{}]+)\}/g,(t,r)=>n(e(o[r])?.default)||t);return r(s)}function a(e){let i=n(e.host);if(!i)return``;let a=t(e.schemes).includes(`https`)?`https`:n(t(e.schemes)[0])||`https`;return r(`${a}://${i}${n(e.basePath)}`)}function o(n,r=0){return r>10?[]:t(n).flatMap(t=>{let n=e(t);if(!n)return[];let i=e(n.request)??(typeof n.request==`string`?n:null);return[...i?[i]:[],...o(n.item,r+1)]})}function s(i){for(let a of t(i.variable)){let t=e(a);if(/^(base_?url|url|host)$/i.test(n(t?.key))&&r(n(t?.value)))return r(n(t?.value))}for(let t of o(i.item)){let r=t.url??t.request,i=n(r)||n(e(r)?.raw),a=/^(https?:\/\/[^/?#{}\s]+)/i.exec(i)?.[1];if(a)return a}return``}export function systemOf(t,r){let o=n(e(t.info)?.title)||n(e(t.info)?.name),c=r===`openapi`?i(t):r===`swagger`?a(t):s(t);return{name:o?systemNameOf(o):``,display_name:o,base_url:c}}export function operationCount(t,n){if(n===`postman`)return o(t.item).length;let r=[`get`,`post`,`put`,`patch`,`delete`];return Object.values(e(t.paths)??{}).reduce((t,n)=>t+r.filter(t=>e(n)?.[t]).length,0)}
@@ -0,0 +1,15 @@
1
+ import type { SystemCollectionInstall } from '@/shared/api/integrations';
2
+ /** What installing a whole system did, as the person reads it. */
3
+ export declare const installMessages: Record<SystemCollectionInstall['outcome'], string>;
4
+ /** The parts of a system file the import dialog shows before it is sent. */
5
+ export type SystemFileSummary = {
6
+ name: string;
7
+ displayName: string;
8
+ endpoints: number;
9
+ mappings: number;
10
+ };
11
+ /** Reads a system file (`{connector, mappings, actions}`); null when it is not one. */
12
+ export declare function systemFileOf(text: string): {
13
+ document: Record<string, unknown>;
14
+ summary: SystemFileSummary;
15
+ } | null;
@@ -0,0 +1 @@
1
+ export const installMessages={installed:`Installed in Systems with its endpoints.`,kept:`You already have this system in Systems.`,restored:`Your deleted system is back in Systems with all its endpoints.`};const e=e=>typeof e==`object`&&!!e&&!Array.isArray(e);export function systemFileOf(t){let n;try{n=JSON.parse(t)}catch{return null}if(!e(n)||!e(n.connector))return null;let{connector:r,actions:i,mappings:a}=n;return typeof r.name!=`string`||!Array.isArray(i)?null:{document:n,summary:{name:r.name,displayName:typeof r.display_name==`string`?r.display_name:r.name,endpoints:i.length,mappings:Array.isArray(a)?a.length:0}}}
@@ -0,0 +1,29 @@
1
+ import type { Connector, ConnectorWrite } from '@/shared/api/integrations';
2
+ import { type Pair } from './action-form';
3
+ import type { ConnectorAccess, LineOfBusiness } from './system-labels';
4
+ export declare const MAX_TAGS = 8;
5
+ export declare const MAX_TAG_LENGTH = 30;
6
+ /** The connector editor's draft: text for every input, converted to `ConnectorWrite` on save. */
7
+ export type ConnectorDraft = {
8
+ name: string;
9
+ display_name: string;
10
+ /** What the system is and what it is used for. */
11
+ description: string;
12
+ base_url: string;
13
+ auth_profile_id: string;
14
+ headers: Pair[];
15
+ timeout_ms: string;
16
+ allowed_hosts: string;
17
+ allow_private_network: boolean;
18
+ enabled: boolean;
19
+ /** Key of a logo in the logo library; empty for none. */
20
+ icon: string;
21
+ access: ConnectorAccess | '';
22
+ lines_of_business: LineOfBusiness[];
23
+ tags: string[];
24
+ };
25
+ export type ConnectorField = keyof ConnectorDraft;
26
+ export declare function fromConnector(connector?: Connector): ConnectorDraft;
27
+ export declare function toConnectorWrite(draft: ConnectorDraft): ConnectorWrite;
28
+ /** Client-side checks that mirror the contract; the server stays the authority. */
29
+ export declare function connectorProblems(draft: ConnectorDraft): Partial<Record<ConnectorField, string>>;
@@ -0,0 +1,2 @@
1
+ import{newPair as e}from"./action-form";export const MAX_TAGS=8;export const MAX_TAG_LENGTH=30;export function fromConnector(t){return{name:t?.name??``,display_name:t?.display_name??``,description:t?.description??``,base_url:t?.base_url??`https://`,auth_profile_id:t?.auth_profile_id??``,headers:Object.entries(t?.default_headers??{}).map(([t,n])=>e(t,n)),timeout_ms:String(t?.timeout_ms??1e4),allowed_hosts:(t?.allowed_hosts??[]).join(`
2
+ `),allow_private_network:t?.allow_private_network??!1,enabled:t?.enabled??!1,icon:t?.icon??``,access:t?.access??``,lines_of_business:[...t?.lines_of_business??[]],tags:[...t?.tags??[]]}}const t=e=>e.split(/[\s,]+/).map(e=>e.trim().toLowerCase()).filter(Boolean);export function toConnectorWrite(e){return{name:e.name.trim(),display_name:e.display_name.trim()||null,description:e.description.trim()||null,base_url:e.base_url.trim(),auth_profile_id:e.auth_profile_id||null,default_headers:Object.fromEntries(e.headers.filter(e=>e.key.trim()).map(e=>[e.key.trim(),e.value])),timeout_ms:Number(e.timeout_ms),allowed_hosts:t(e.allowed_hosts),allow_private_network:e.allow_private_network,enabled:e.enabled,icon:e.icon||null,access:e.access||null,lines_of_business:e.lines_of_business,tags:e.tags}}const n=/^[a-zA-Z][a-zA-Z0-9._-]{0,63}$/,r=/^https?:\/\/[^/?#\s]+(\/[^?#\s]*)?$/,i=/^(\*\.)?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/;export function connectorProblems(e){let a={};n.test(e.name.trim())||(a.name=`A letter, then letters, digits, '.', '_' or '-' (max 64).`),r.test(e.base_url.trim())?e.base_url.trim().startsWith(`http:`)&&!e.allow_private_network&&(a.base_url=`Use https. Plain http is only allowed with private network (development).`):a.base_url=`An absolute https URL without query or fragment.`;let o=Number(e.timeout_ms);(!/^\d+$/.test(e.timeout_ms)||o<100||o>12e4)&&(a.timeout_ms=`Between 100 and 120000 ms.`);let s=t(e.allowed_hosts);return(s.length>20||s.some(e=>!i.test(e)))&&(a.allowed_hosts=`Up to 20 host names or *.domain, one per line.`),e.tags.length>8&&(a.tags=`Up to 8 tags.`),a}
@@ -0,0 +1,15 @@
1
+ export type ConnectorCategory = 'api' | 'claims' | 'cloud' | 'data' | 'file' | 'location' | 'messaging' | 'public';
2
+ /** Category labels, in the order the picker groups them. */
3
+ export declare const categoryLabels: Record<ConnectorCategory, string>;
4
+ export type ConnectorType = {
5
+ key: string;
6
+ label: string;
7
+ category: ConnectorCategory;
8
+ description: string;
9
+ available: boolean;
10
+ badge?: 'Ready' | 'Soon';
11
+ /** The product's official icon (bundled under `assets/connectors`). */
12
+ logo?: string;
13
+ };
14
+ export declare const connectorTypes: readonly ConnectorType[];
15
+ export declare const connectorType: (key: string | null) => ConnectorType | undefined;
@@ -0,0 +1 @@
1
+ import{logoUrl as e}from"./system-logos";export const categoryLabels={cloud:`Systems of record`,data:`Business data & scores`,location:`Location & property`,claims:`Claims & vehicles`,public:`Public data`,api:`API`,file:`File`,messaging:`Messaging`};const t=t=>e(t);export const connectorTypes=[{key:`rest`,label:`REST API`,category:`api`,available:!0,badge:`Ready`,logo:t(`rest`),description:`Connect to any REST API with OAuth 2.0, API key, bearer token or basic auth.`},{key:`import-openapi`,label:`Swagger / OpenAPI`,category:`api`,available:!0,badge:`Ready`,logo:t(`openapi`),description:`Create a REST system and its endpoints from an OpenAPI 3 or Swagger 2.0 file.`},{key:`import-postman`,label:`Postman collection`,category:`api`,available:!0,badge:`Ready`,logo:t(`postman`),description:`Create a REST system and its endpoints from a Postman collection (v2.x).`},{key:`import-openai`,label:`OpenAI API`,category:`api`,available:!0,badge:`Ready`,logo:t(`openai`),description:`Create a system from OpenAI's published OpenAPI spec; base URL api.openai.com/v1.`},{key:`graphql`,label:`GraphQL`,category:`api`,available:!1,badge:`Soon`,logo:t(`graphql`),description:`Execute GraphQL queries and mutations against any endpoint.`},{key:`grpc`,label:`gRPC`,category:`api`,available:!1,badge:`Soon`,logo:t(`grpc`),description:`Call gRPC services using a proto schema or reflection.`},{key:`soap`,label:`SOAP / WSDL`,category:`api`,available:!1,badge:`Soon`,logo:t(`soap`),description:`Invoke SOAP web services from WSDL definitions.`},{key:`sftp`,label:`SFTP`,category:`file`,available:!1,badge:`Soon`,logo:t(`sftp`),description:`Pick up and drop files on an SFTP server, with key or password auth.`},{key:`blob`,label:`Azure Blob / S3`,category:`file`,available:!1,badge:`Soon`,description:`Read and write files in Azure Blob Storage or Amazon S3 buckets.`},{key:`kafka`,label:`Kafka`,category:`messaging`,available:!1,badge:`Soon`,logo:t(`kafka`),description:`Publish to and consume from Kafka topics.`},{key:`servicebus`,label:`Azure Service Bus`,category:`messaging`,available:!1,badge:`Soon`,logo:t(`servicebus`),description:`Send and receive Service Bus queue and topic messages.`},{key:`smtp`,label:`Email (SMTP)`,category:`messaging`,available:!1,badge:`Soon`,description:`Send notifications and documents by email.`}];export const connectorType=e=>connectorTypes.find(t=>t.key===e);
@@ -0,0 +1 @@
1
+ export declare const functionHelp: Readonly<Record<string, string>>;
@@ -0,0 +1 @@
1
+ export const functionHelp={if_then_else:`Link a yes/no result (from Equals, Greater than, Contains, Is empty, All true …) to “condition”. Type or link what to give for “then” (yes) and “else” (no). Example: Equals(line_of_business, "Property") → condition, then "PROP", else "OTHER".`,equals:`Link a field to “a” and type the value to compare with in “b” (or link another field). Case does not matter: "property" equals "Property". Link its result to an If … then … else.`,greater_than:`Yes when a > b. Link the number to “a” and type the limit in “b”, e.g. amount > 100000.`,less_than:`Yes when a < b. Link the number to “a” and type the limit in “b”.`,contains:`Yes when “text” contains “part”, e.g. the email contains "@marsh.com". Case does not matter.`,all_true:`Combine conditions with AND: link up to three yes/no results; empty inputs are ignored. Example: amount > 100000 AND line is Property.`,any_true:`Combine conditions with OR: yes when at least one linked condition is yes.`,not:`Turns a yes/no result around (not empty, not equal …).`,is_empty:`Yes when the field has no value; useful as the condition of a default.`,default_value:`Gives the setting “Default value” when the input is empty.`,first_filled:`Takes the first of up to three inputs that has a value (fallbacks).`,lookup:`Translates codes with a table, one per line “from = to” (M = Male, NY = New York). “When not in the table” is used for anything else.`,join_text:`Puts up to three texts together with the separator, skipping empty ones: first_name + " " + last_name.`,split_text:`Cuts text at the separator. Leave “position” empty for a list, or give a number (1 = first part).`,part_of_text:`Takes characters counting from 1: start 1, length 3 on "ABCDEF" gives "ABC".`,format_date:`Writes a date in the target’s format. Give the incoming format if it is not ISO (e.g. DD/MM/YYYY).`,add_days:`Moves a date by a number of days (negative moves back).`,multiply:`a × b. Type a fixed factor in “b”, e.g. amount × 1.18.`,percent_of:`a % of b: link the percent to “a” and the amount to “b”.`,fixed_value:`Always gives the same value; link it where a constant is needed.`,expression:`For anything the boxes cannot do: a CEL expression over inputs a, b and c, e.g. a == "Property" ? "PROP" : "OTHER", or a * 1.18.`,first_item:`The first item of a list (e.g. the first location’s address).`,count_items:`How many items a list has (e.g. number of locations).`,sum_items:`Adds up a list of numbers (e.g. the total value of all sites).`,join_list:`Writes all list items as one text with the separator.`};
@@ -0,0 +1,40 @@
1
+ import type { MappingDefinition, MappingField, MappingFunction, MappingLink, MappingStep } from '@/shared/api/message-mappings';
2
+ export type Position = {
3
+ x: number;
4
+ y: number;
5
+ };
6
+ /** A definition with every list present (the API treats missing lists as empty). */
7
+ export type Definition = Required<MappingDefinition>;
8
+ export declare function normalize(definition: MappingDefinition | undefined): Definition;
9
+ export declare const mappingsKey: readonly ['message-mappings'];
10
+ export declare const NAME: RegExp;
11
+ /** The technical name a display name suggests: "Record to ERP" → record_to_erp. */
12
+ export declare const technicalName: (displayName: string) => string;
13
+ export declare const PATH: RegExp;
14
+ /** Saved node positions (`layout.nodes`), with defaults for the two field lists. */
15
+ export declare function positionsOf(definition: Definition): Record<string, Position>;
16
+ export declare function withPosition(definition: Definition, id: string, position: Position): Definition;
17
+ /** A fresh step id from the function key (`join_text_2`). */
18
+ export declare function nextStepId(steps: readonly MappingStep[], key: string): string;
19
+ /** Default settings of a function, from the catalog. */
20
+ export declare function defaultParams(fn: MappingFunction): Record<string, unknown>;
21
+ /** Whether a link may go from `from` to `to` (drawn left to right). */
22
+ export declare function canLink(from: string | null | undefined, to: string | null | undefined): boolean;
23
+ /** Adds a link; a target field or step input takes one link, so it replaces the old one. */
24
+ export declare function addLink(definition: Definition, link: MappingLink): Definition;
25
+ export declare const linkId: (link: MappingLink) => string;
26
+ /** Removes a step with every link that touches it. */
27
+ export declare function removeStep(definition: Definition, id: string): Definition;
28
+ /** Replaces one side's fields and drops links to fields that no longer exist. */
29
+ export declare function withFields(definition: Definition, side: 'source' | 'target', fields: MappingField[]): Definition;
30
+ export declare const typeIcon: Record<string, string>;
31
+ export declare const fieldTypes: readonly ['text', 'number', 'boolean', 'date', 'object', 'list', 'any'];
32
+ /** Indentation level of a dotted path (for the tree look). */
33
+ export declare const depthOf: (path: string) => number;
34
+ export declare const leafOf: (path: string) => string;
35
+ /** The object and list fields a path sits in, outermost first (`a.b[].c` → `a`, `a.b[]`). */
36
+ export declare function ancestorsOf(path: string): string[];
37
+ /** Hidden when any enclosing object or list is folded. */
38
+ export declare const isFolded: (path: string, folded: ReadonlySet<string>) => boolean;
39
+ /** Where a link to `ref` shows: the field itself, or its outermost folded parent. */
40
+ export declare function shownRef(ref: string, folded: ReadonlySet<string>): string;
@@ -0,0 +1 @@
1
+ export function normalize(e){return{schema_version:e?.schema_version??1,source_fields:e?.source_fields??[],target_fields:e?.target_fields??[],steps:e?.steps??[],links:e?.links??[],layout:e?.layout??{}}}export const mappingsKey=[`message-mappings`];export const NAME=/^[a-z0-9_]+(\.[a-z0-9_]+)*$/;export const technicalName=e=>e.toLowerCase().replace(/[^a-z0-9.]+/g,`_`).replace(/_*\._*/g,`.`).replace(/\.{2,}/g,`.`).replace(/^[._]+|[._]+$/g,``);export const PATH=/^[A-Za-z_][\w-]*(\[\])?(\.[A-Za-z_][\w-]*(\[\])?)*$/;export function positionsOf(e){return{source:{x:0,y:0},target:{x:900,y:0},...e.layout?.nodes??{}}}export function withPosition(e,t,n){let r={...positionsOf(e),[t]:{x:Math.round(n.x),y:Math.round(n.y)}};return{...e,layout:{...e.layout,nodes:r}}}export function nextStepId(e,t){let n=t.replace(/[^\w-]/g,`_`).replace(/^[^A-Za-z]+/,`f`),r=1;for(;e.some(e=>e.id===`${n}_${r}`);)r++;return`${n}_${r}`}export function defaultParams(e){return Object.fromEntries(e.params.map(e=>[e.name,e.default??``]))}export function canLink(e,t){if(!e||!t)return!1;let n=e.startsWith(`source:`)||e.startsWith(`step:`)&&!e.includes(`.`,5),r=t.startsWith(`target:`)||t.startsWith(`step:`)&&t.includes(`.`,5);return!n||!r?!1:!(e.startsWith(`step:`)&&t.startsWith(`${e}.`))}export function addLink(e,t){return{...e,links:[...e.links.filter(e=>e.target!==t.target),t]}}export const linkId=e=>`${e.source}->${e.target}`;export function removeStep(e,t){let n=`step:${t}`,r={...positionsOf(e)};return delete r[t],{...e,steps:e.steps.filter(e=>e.id!==t),links:e.links.filter(e=>e.source!==n&&!e.target.startsWith(`${n}.`)),layout:{...e.layout,nodes:r}}}export function withFields(e,t,n){let r=new Set(n.map(e=>`${t}:${e.path}`)),i=t===`source`?`source_fields`:`target_fields`;return{...e,[i]:n,links:e.links.filter(e=>{let n=t===`source`?e.source:e.target;return!n.startsWith(`${t}:`)||r.has(n)})}}export const typeIcon={text:`Aa`,number:`#`,boolean:`✓`,date:`📅`,object:`{}`,list:`[]`,any:`•`};export const fieldTypes=[`text`,`number`,`boolean`,`date`,`object`,`list`,`any`];export const depthOf=e=>e.split(`.`).length-1;export const leafOf=e=>e.split(`.`).pop()??e;export function ancestorsOf(e){let t=e.split(`.`);return t.slice(0,-1).map((e,n)=>t.slice(0,n+1).join(`.`))}export const isFolded=(e,t)=>ancestorsOf(e).some(e=>t.has(e));export function shownRef(e,t){let[n,r]=[e.slice(0,e.indexOf(`:`)),e.slice(e.indexOf(`:`)+1)];if(n!==`source`&&n!==`target`)return e;let i=ancestorsOf(r).find(e=>t.has(`${n}:${e}`));return i?`${n}:${i}`:e}
@@ -0,0 +1,85 @@
1
+ import type { MappingField } from '@/shared/api/message-mappings';
2
+ import { type Definition } from './mapping-model';
3
+ export declare const sampleRecord: {
4
+ record_id: string;
5
+ received_at: string;
6
+ segment: string;
7
+ start_date: string;
8
+ end_date: string;
9
+ sender: {
10
+ name: string;
11
+ contact: string;
12
+ email: string;
13
+ };
14
+ customer: {
15
+ name: string;
16
+ tax_id: string;
17
+ industry_code: string;
18
+ address: {
19
+ street: string;
20
+ city: string;
21
+ state: string;
22
+ postal_code: string;
23
+ };
24
+ };
25
+ terms: {
26
+ limit: number;
27
+ payment_days: number;
28
+ currency: string;
29
+ };
30
+ sites: {
31
+ number: number;
32
+ address: string;
33
+ kind: string;
34
+ opened: number;
35
+ value: number;
36
+ }[];
37
+ target_amount: number;
38
+ };
39
+ export declare const sampleTarget: {
40
+ reference_number: string;
41
+ product_code: string;
42
+ segment: string;
43
+ term: {
44
+ start_date: string;
45
+ end_date: string;
46
+ };
47
+ account: {
48
+ name: string;
49
+ tax_id: string;
50
+ mailing_address: {
51
+ street: string;
52
+ city: string;
53
+ state: string;
54
+ postal_code: string;
55
+ };
56
+ };
57
+ contact: {
58
+ name: string;
59
+ email: string;
60
+ };
61
+ limits: {
62
+ limit: number;
63
+ payment_days: number;
64
+ currency: string;
65
+ };
66
+ sites: {
67
+ site_number: number;
68
+ address: string;
69
+ kind: string;
70
+ opened: number;
71
+ value: number;
72
+ }[];
73
+ amount: {
74
+ annual: number;
75
+ currency: string;
76
+ };
77
+ };
78
+ /**
79
+ * The fields of an example message (same rules as the API's "fields from example"): dotted
80
+ * paths, `[]` after a list, and the fields of a list's first item under it.
81
+ */
82
+ export declare function fieldsOf(example: unknown, prefix?: string): MappingField[];
83
+ /** A new mapping: the sample record as source and the sample order as target. */
84
+ export declare function starterDefinition(): Definition;
85
+ export declare const pretty: (value: unknown) => string;
@@ -0,0 +1 @@
1
+ import{withPosition as e}from"./mapping-model";export const sampleRecord={record_id:`REC0001010`,received_at:`2026-10-31`,segment:`Wholesale`,start_date:`2026-12-01`,end_date:`2027-12-01`,sender:{name:`Contoso Partners`,contact:`Colin Mbeki`,email:`colin.mbeki@contoso.example`},customer:{name:`Summit Energy Partners`,tax_id:`84-2231944`,industry_code:`486910`,address:{street:`3400 Energy Plaza`,city:`Denver`,state:`CO`,postal_code:`80202`}},terms:{limit:5e5,payment_days:30,currency:`USD`},sites:[{number:1,address:`2200 Ship Channel Rd, Houston TX`,kind:`Warehouse`,opened:2006,value:146e3},{number:2,address:`91 Industrial Pkwy, Lake Charles LA`,kind:`Depot`,opened:1998,value:94e3}],target_amount:279520};export const sampleTarget={reference_number:`REF-2026-10417`,product_code:`SUP-STD-26`,segment:`Wholesale`,term:{start_date:`2026-12-01`,end_date:`2027-12-01`},account:{name:`Summit Energy Partners`,tax_id:`84-2231944`,mailing_address:{street:`3400 Energy Plaza`,city:`Denver`,state:`CO`,postal_code:`80202`}},contact:{name:`Colin Mbeki`,email:`colin.mbeki@contoso.example`},limits:{limit:5e5,payment_days:30,currency:`USD`},sites:[{site_number:1,address:`2200 Ship Channel Rd, Houston TX`,kind:`Warehouse`,opened:2006,value:146e3}],amount:{annual:279520,currency:`USD`}};const t=new Set([`segment`,`term.start_date`,`account.name`,`limits.limit`]),n=e=>typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:typeof e==`string`?`text`:Array.isArray(e)?`list`:e&&typeof e==`object`?`object`:`any`;export function fieldsOf(e,t=``){if(!e||typeof e!=`object`||Array.isArray(e))return[];let r=[];for(let[i,a]of Object.entries(e)){let e=t?`${t}.${i}`:i;if(Array.isArray(a)){r.push({path:`${e}[]`,type:`list`,required:!1,description:``});let t=a.find(e=>e!=null);t&&typeof t==`object`&&!Array.isArray(t)&&r.push(...fieldsOf(t,`${e}[]`))}else r.push({path:e,type:n(a),required:!1,description:``}),a&&typeof a==`object`&&r.push(...fieldsOf(a,e))}return r}export function starterDefinition(){let n={schema_version:1,source_fields:fieldsOf(sampleRecord),target_fields:fieldsOf(sampleTarget).map(e=>({...e,required:t.has(e.path)})),steps:[],links:[],layout:{}};return e(e(n,`source`,{x:0,y:0}),`target`,{x:760,y:0})}export const pretty=e=>JSON.stringify(e,null,2);