@contractspec/example.integration-hub 3.8.9 → 3.8.10

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 (89) hide show
  1. package/dist/connection/connection.enum.js +1 -29
  2. package/dist/connection/connection.operation.js +1 -124
  3. package/dist/connection/connection.presentation.js +1 -125
  4. package/dist/connection/connection.schema.js +1 -71
  5. package/dist/connection/index.js +1 -127
  6. package/dist/docs/index.js +5 -49
  7. package/dist/docs/integration-hub.docblock.js +5 -49
  8. package/dist/events.js +1 -211
  9. package/dist/example.js +1 -42
  10. package/dist/handlers/index.js +5 -292
  11. package/dist/handlers/integration.handlers.js +5 -292
  12. package/dist/index.js +8 -2355
  13. package/dist/integration/index.js +1 -92
  14. package/dist/integration/integration.enum.js +1 -12
  15. package/dist/integration/integration.operations.js +1 -89
  16. package/dist/integration/integration.presentation.js +1 -120
  17. package/dist/integration/integration.schema.js +1 -42
  18. package/dist/integration-hub.capability.js +1 -43
  19. package/dist/integration-hub.feature.js +1 -330
  20. package/dist/mcp-example.js +1 -154
  21. package/dist/node/connection/connection.enum.js +1 -29
  22. package/dist/node/connection/connection.operation.js +1 -124
  23. package/dist/node/connection/connection.presentation.js +1 -125
  24. package/dist/node/connection/connection.schema.js +1 -71
  25. package/dist/node/connection/index.js +1 -127
  26. package/dist/node/docs/index.js +5 -49
  27. package/dist/node/docs/integration-hub.docblock.js +5 -49
  28. package/dist/node/events.js +1 -211
  29. package/dist/node/example.js +1 -42
  30. package/dist/node/handlers/index.js +5 -292
  31. package/dist/node/handlers/integration.handlers.js +5 -292
  32. package/dist/node/index.js +8 -2355
  33. package/dist/node/integration/index.js +1 -92
  34. package/dist/node/integration/integration.enum.js +1 -12
  35. package/dist/node/integration/integration.operations.js +1 -89
  36. package/dist/node/integration/integration.presentation.js +1 -120
  37. package/dist/node/integration/integration.schema.js +1 -42
  38. package/dist/node/integration-hub.capability.js +1 -43
  39. package/dist/node/integration-hub.feature.js +1 -330
  40. package/dist/node/mcp-example.js +1 -154
  41. package/dist/node/run-mcp.js +1 -159
  42. package/dist/node/seeders/index.js +6 -60
  43. package/dist/node/sync/index.js +1 -332
  44. package/dist/node/sync/sync.enum.js +1 -26
  45. package/dist/node/sync/sync.operations.js +1 -321
  46. package/dist/node/sync/sync.presentation.js +1 -301
  47. package/dist/node/sync/sync.schema.js +1 -154
  48. package/dist/node/sync-engine/index.js +1 -186
  49. package/dist/node/tests/operations.test-spec.js +1 -85
  50. package/dist/node/ui/IntegrationDashboard.js +1 -886
  51. package/dist/node/ui/IntegrationDashboard.visualizations.js +1 -250
  52. package/dist/node/ui/IntegrationHubChat.js +1 -34
  53. package/dist/node/ui/hooks/index.js +1 -57
  54. package/dist/node/ui/hooks/useIntegrationData.js +1 -54
  55. package/dist/node/ui/index.js +4 -1173
  56. package/dist/node/ui/renderers/index.js +4 -484
  57. package/dist/node/ui/renderers/integration.markdown.js +4 -484
  58. package/dist/node/ui/tables/ConnectionsTable.js +1 -211
  59. package/dist/node/ui/tables/IntegrationTables.js +1 -361
  60. package/dist/node/ui/tables/SyncConfigsTable.js +1 -230
  61. package/dist/node/ui/tables/integration-table.shared.js +1 -84
  62. package/dist/node/visualizations/catalog.js +1 -137
  63. package/dist/node/visualizations/index.js +1 -211
  64. package/dist/node/visualizations/selectors.js +1 -204
  65. package/dist/run-mcp.js +1 -159
  66. package/dist/seeders/index.js +6 -60
  67. package/dist/sync/index.js +1 -332
  68. package/dist/sync/sync.enum.js +1 -26
  69. package/dist/sync/sync.operations.js +1 -321
  70. package/dist/sync/sync.presentation.js +1 -301
  71. package/dist/sync/sync.schema.js +1 -154
  72. package/dist/sync-engine/index.js +1 -186
  73. package/dist/tests/operations.test-spec.js +1 -85
  74. package/dist/ui/IntegrationDashboard.js +1 -886
  75. package/dist/ui/IntegrationDashboard.visualizations.js +1 -250
  76. package/dist/ui/IntegrationHubChat.js +1 -34
  77. package/dist/ui/hooks/index.js +1 -57
  78. package/dist/ui/hooks/useIntegrationData.js +1 -54
  79. package/dist/ui/index.js +4 -1173
  80. package/dist/ui/renderers/index.js +4 -484
  81. package/dist/ui/renderers/integration.markdown.js +4 -484
  82. package/dist/ui/tables/ConnectionsTable.js +1 -211
  83. package/dist/ui/tables/IntegrationTables.js +1 -361
  84. package/dist/ui/tables/SyncConfigsTable.js +1 -230
  85. package/dist/ui/tables/integration-table.shared.js +1 -84
  86. package/dist/visualizations/catalog.js +1 -137
  87. package/dist/visualizations/index.js +1 -211
  88. package/dist/visualizations/selectors.js +1 -204
  89. package/package.json +11 -11
@@ -1,211 +1 @@
1
- // src/ui/tables/integration-table.shared.tsx
2
- import { Button } from "@contractspec/lib.design-system";
3
- import { Badge } from "@contractspec/lib.ui-kit-web/ui/badge";
4
- import { HStack } from "@contractspec/lib.ui-kit-web/ui/stack";
5
- import { jsxDEV } from "react/jsx-dev-runtime";
6
- "use client";
7
- var STATUS_VARIANTS = {
8
- ACTIVE: "default",
9
- CONNECTED: "default",
10
- SUCCESS: "default",
11
- PENDING: "secondary",
12
- PAUSED: "secondary",
13
- ERROR: "destructive",
14
- DISCONNECTED: "outline"
15
- };
16
- function formatDateTime(value) {
17
- return value ? value.toLocaleString() : "Never";
18
- }
19
- function formatJson(value) {
20
- return value ? JSON.stringify(value, null, 2) : "No configuration";
21
- }
22
- function StatusBadge({ status }) {
23
- return /* @__PURE__ */ jsxDEV(Badge, {
24
- variant: STATUS_VARIANTS[status] ?? "outline",
25
- children: status
26
- }, undefined, false, undefined, this);
27
- }
28
- function IntegrationTableToolbar({
29
- controller,
30
- label,
31
- toggleColumnId,
32
- toggleVisibleLabel,
33
- toggleHiddenLabel,
34
- pinColumnId,
35
- pinLabel,
36
- resizeColumnId,
37
- resizeLabel
38
- }) {
39
- const firstRow = controller.rows[0];
40
- const toggleColumn = controller.columns.find((column) => column.id === toggleColumnId);
41
- const pinColumn = controller.columns.find((column) => column.id === pinColumnId);
42
- const resizeColumn = controller.columns.find((column) => column.id === resizeColumnId);
43
- const pinTarget = pinColumn?.pinState === "left" ? false : "left";
44
- return /* @__PURE__ */ jsxDEV(HStack, {
45
- gap: "sm",
46
- className: "flex-wrap",
47
- children: [
48
- /* @__PURE__ */ jsxDEV(Badge, {
49
- variant: "outline",
50
- children: label
51
- }, undefined, false, undefined, this),
52
- /* @__PURE__ */ jsxDEV(Button, {
53
- variant: "outline",
54
- size: "sm",
55
- onPress: () => firstRow?.toggleExpanded?.(!firstRow?.isExpanded),
56
- children: "Expand First Row"
57
- }, undefined, false, undefined, this),
58
- /* @__PURE__ */ jsxDEV(Button, {
59
- variant: "outline",
60
- size: "sm",
61
- onPress: () => toggleColumn?.toggleVisibility?.(!toggleColumn?.visible),
62
- children: toggleColumn?.visible ? toggleVisibleLabel : toggleHiddenLabel
63
- }, undefined, false, undefined, this),
64
- /* @__PURE__ */ jsxDEV(Button, {
65
- variant: "outline",
66
- size: "sm",
67
- onPress: () => pinColumn?.pin?.(pinTarget),
68
- children: pinColumn?.pinState === "left" ? `Unpin ${pinLabel}` : `Pin ${pinLabel}`
69
- }, undefined, false, undefined, this),
70
- /* @__PURE__ */ jsxDEV(Button, {
71
- variant: "outline",
72
- size: "sm",
73
- onPress: () => resizeColumn?.resizeBy?.(40),
74
- children: resizeLabel
75
- }, undefined, false, undefined, this)
76
- ]
77
- }, undefined, true, undefined, this);
78
- }
79
-
80
- // src/ui/tables/ConnectionsTable.tsx
81
- import { DataTable } from "@contractspec/lib.design-system";
82
- import { useContractTable } from "@contractspec/lib.presentation-runtime-react";
83
- import { VStack } from "@contractspec/lib.ui-kit-web/ui/stack";
84
- import { Text } from "@contractspec/lib.ui-kit-web/ui/text";
85
- import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
86
- "use client";
87
- function ConnectionsTable({
88
- connections
89
- }) {
90
- const controller = useContractTable({
91
- data: connections,
92
- columns: [
93
- {
94
- id: "connection",
95
- header: "Connection",
96
- label: "Connection",
97
- accessor: (connection) => connection.name,
98
- cell: ({ item }) => /* @__PURE__ */ jsxDEV2(VStack, {
99
- gap: "xs",
100
- children: [
101
- /* @__PURE__ */ jsxDEV2(Text, {
102
- className: "font-medium text-sm",
103
- children: item.name
104
- }, undefined, false, undefined, this),
105
- /* @__PURE__ */ jsxDEV2(Text, {
106
- className: "text-muted-foreground text-xs",
107
- children: [
108
- "Created ",
109
- item.createdAt.toLocaleDateString()
110
- ]
111
- }, undefined, true, undefined, this)
112
- ]
113
- }, undefined, true, undefined, this),
114
- size: 240,
115
- minSize: 180,
116
- canSort: true,
117
- canPin: true,
118
- canResize: true
119
- },
120
- {
121
- id: "status",
122
- header: "Status",
123
- label: "Status",
124
- accessorKey: "status",
125
- cell: ({ value }) => /* @__PURE__ */ jsxDEV2(StatusBadge, {
126
- status: String(value)
127
- }, undefined, false, undefined, this),
128
- size: 150,
129
- canSort: true,
130
- canPin: true,
131
- canResize: true
132
- },
133
- {
134
- id: "lastSyncAt",
135
- header: "Last Sync",
136
- label: "Last Sync",
137
- accessor: (connection) => connection.lastSyncAt?.getTime() ?? 0,
138
- cell: ({ item }) => formatDateTime(item.lastSyncAt),
139
- size: 200,
140
- canSort: true,
141
- canHide: true,
142
- canResize: true
143
- },
144
- {
145
- id: "errorMessage",
146
- header: "Errors",
147
- label: "Errors",
148
- accessor: (connection) => connection.errorMessage ?? "",
149
- cell: ({ value }) => String(value || "No errors"),
150
- size: 240,
151
- canHide: true,
152
- canResize: true
153
- }
154
- ],
155
- initialState: {
156
- pagination: { pageIndex: 0, pageSize: 3 },
157
- columnVisibility: { errorMessage: false },
158
- columnPinning: { left: ["connection"], right: [] }
159
- },
160
- renderExpandedContent: (connection) => /* @__PURE__ */ jsxDEV2(VStack, {
161
- gap: "sm",
162
- className: "py-2",
163
- children: [
164
- /* @__PURE__ */ jsxDEV2(Text, {
165
- className: "font-medium text-sm",
166
- children: "Credentials"
167
- }, undefined, false, undefined, this),
168
- /* @__PURE__ */ jsxDEV2("pre", {
169
- className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
170
- children: formatJson(connection.credentials)
171
- }, undefined, false, undefined, this),
172
- /* @__PURE__ */ jsxDEV2(Text, {
173
- className: "font-medium text-sm",
174
- children: "Config"
175
- }, undefined, false, undefined, this),
176
- /* @__PURE__ */ jsxDEV2("pre", {
177
- className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
178
- children: formatJson(connection.config)
179
- }, undefined, false, undefined, this),
180
- /* @__PURE__ */ jsxDEV2(Text, {
181
- className: "text-muted-foreground text-sm",
182
- children: connection.errorMessage ?? "No sync errors recorded."
183
- }, undefined, false, undefined, this)
184
- ]
185
- }, undefined, true, undefined, this),
186
- getCanExpand: () => true
187
- });
188
- return /* @__PURE__ */ jsxDEV2(DataTable, {
189
- controller,
190
- title: "Connections",
191
- description: "Client-mode ContractSpec table with visibility, pinning, resizing, and expanded diagnostics.",
192
- toolbar: /* @__PURE__ */ jsxDEV2(IntegrationTableToolbar, {
193
- controller,
194
- label: `${connections.length} total connections`,
195
- toggleColumnId: "errorMessage",
196
- toggleVisibleLabel: "Hide Error Column",
197
- toggleHiddenLabel: "Show Error Column",
198
- pinColumnId: "status",
199
- pinLabel: "Status",
200
- resizeColumnId: "connection",
201
- resizeLabel: "Widen Connection"
202
- }, undefined, false, undefined, this),
203
- emptyState: /* @__PURE__ */ jsxDEV2("div", {
204
- className: "rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",
205
- children: "No connections found"
206
- }, undefined, false, undefined, this)
207
- }, undefined, false, undefined, this);
208
- }
209
- export {
210
- ConnectionsTable
211
- };
1
+ import{Button as O}from"@contractspec/lib.design-system";import{Badge as $}from"@contractspec/lib.ui-kit-web/ui/badge";import{HStack as z}from"@contractspec/lib.ui-kit-web/ui/stack";import{jsx as F,jsxs as k}from"react/jsx-runtime";var V={ACTIVE:"default",CONNECTED:"default",SUCCESS:"default",PENDING:"secondary",PAUSED:"secondary",ERROR:"destructive",DISCONNECTED:"outline"};function h(y){return y?y.toLocaleString():"Never"}function W(y){return y?JSON.stringify(y,null,2):"No configuration"}function N({status:y}){return F($,{variant:V[y]??"outline",children:y})}function U({controller:y,label:M,toggleColumnId:q,toggleVisibleLabel:D,toggleHiddenLabel:J,pinColumnId:A,pinLabel:Y,resizeColumnId:H,resizeLabel:R}){let Z=y.rows[0],P=y.columns.find((G)=>G.id===q),Q=y.columns.find((G)=>G.id===A),w=y.columns.find((G)=>G.id===H),f=Q?.pinState==="left"?!1:"left";return k(z,{gap:"sm",className:"flex-wrap",children:[F($,{variant:"outline",children:M}),F(O,{variant:"outline",size:"sm",onPress:()=>Z?.toggleExpanded?.(!Z?.isExpanded),children:"Expand First Row"}),F(O,{variant:"outline",size:"sm",onPress:()=>P?.toggleVisibility?.(!P?.visible),children:P?.visible?D:J}),F(O,{variant:"outline",size:"sm",onPress:()=>Q?.pin?.(f),children:Q?.pinState==="left"?`Unpin ${Y}`:`Pin ${Y}`}),F(O,{variant:"outline",size:"sm",onPress:()=>w?.resizeBy?.(40),children:R})]})}import{DataTable as B}from"@contractspec/lib.design-system";import{useContractTable as S}from"@contractspec/lib.presentation-runtime-react";import{VStack as _}from"@contractspec/lib.ui-kit-web/ui/stack";import{Text as K}from"@contractspec/lib.ui-kit-web/ui/text";import{jsx as E,jsxs as X}from"react/jsx-runtime";function x({connections:y}){let M=S({data:y,columns:[{id:"connection",header:"Connection",label:"Connection",accessor:(q)=>q.name,cell:({item:q})=>X(_,{gap:"xs",children:[E(K,{className:"font-medium text-sm",children:q.name}),X(K,{className:"text-muted-foreground text-xs",children:["Created ",q.createdAt.toLocaleDateString()]})]}),size:240,minSize:180,canSort:!0,canPin:!0,canResize:!0},{id:"status",header:"Status",label:"Status",accessorKey:"status",cell:({value:q})=>E(N,{status:String(q)}),size:150,canSort:!0,canPin:!0,canResize:!0},{id:"lastSyncAt",header:"Last Sync",label:"Last Sync",accessor:(q)=>q.lastSyncAt?.getTime()??0,cell:({item:q})=>h(q.lastSyncAt),size:200,canSort:!0,canHide:!0,canResize:!0},{id:"errorMessage",header:"Errors",label:"Errors",accessor:(q)=>q.errorMessage??"",cell:({value:q})=>String(q||"No errors"),size:240,canHide:!0,canResize:!0}],initialState:{pagination:{pageIndex:0,pageSize:3},columnVisibility:{errorMessage:!1},columnPinning:{left:["connection"],right:[]}},renderExpandedContent:(q)=>X(_,{gap:"sm",className:"py-2",children:[E(K,{className:"font-medium text-sm",children:"Credentials"}),E("pre",{className:"overflow-auto rounded-md bg-muted/40 p-3 text-xs",children:W(q.credentials)}),E(K,{className:"font-medium text-sm",children:"Config"}),E("pre",{className:"overflow-auto rounded-md bg-muted/40 p-3 text-xs",children:W(q.config)}),E(K,{className:"text-muted-foreground text-sm",children:q.errorMessage??"No sync errors recorded."})]}),getCanExpand:()=>!0});return E(B,{controller:M,title:"Connections",description:"Client-mode ContractSpec table with visibility, pinning, resizing, and expanded diagnostics.",toolbar:E(U,{controller:M,label:`${y.length} total connections`,toggleColumnId:"errorMessage",toggleVisibleLabel:"Hide Error Column",toggleHiddenLabel:"Show Error Column",pinColumnId:"status",pinLabel:"Status",resizeColumnId:"connection",resizeLabel:"Widen Connection"}),emptyState:E("div",{className:"rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",children:"No connections found"})})}export{x as ConnectionsTable};
@@ -1,361 +1 @@
1
- // src/ui/tables/integration-table.shared.tsx
2
- import { Button } from "@contractspec/lib.design-system";
3
- import { Badge } from "@contractspec/lib.ui-kit-web/ui/badge";
4
- import { HStack } from "@contractspec/lib.ui-kit-web/ui/stack";
5
- import { jsxDEV } from "react/jsx-dev-runtime";
6
- "use client";
7
- var STATUS_VARIANTS = {
8
- ACTIVE: "default",
9
- CONNECTED: "default",
10
- SUCCESS: "default",
11
- PENDING: "secondary",
12
- PAUSED: "secondary",
13
- ERROR: "destructive",
14
- DISCONNECTED: "outline"
15
- };
16
- function formatDateTime(value) {
17
- return value ? value.toLocaleString() : "Never";
18
- }
19
- function formatJson(value) {
20
- return value ? JSON.stringify(value, null, 2) : "No configuration";
21
- }
22
- function StatusBadge({ status }) {
23
- return /* @__PURE__ */ jsxDEV(Badge, {
24
- variant: STATUS_VARIANTS[status] ?? "outline",
25
- children: status
26
- }, undefined, false, undefined, this);
27
- }
28
- function IntegrationTableToolbar({
29
- controller,
30
- label,
31
- toggleColumnId,
32
- toggleVisibleLabel,
33
- toggleHiddenLabel,
34
- pinColumnId,
35
- pinLabel,
36
- resizeColumnId,
37
- resizeLabel
38
- }) {
39
- const firstRow = controller.rows[0];
40
- const toggleColumn = controller.columns.find((column) => column.id === toggleColumnId);
41
- const pinColumn = controller.columns.find((column) => column.id === pinColumnId);
42
- const resizeColumn = controller.columns.find((column) => column.id === resizeColumnId);
43
- const pinTarget = pinColumn?.pinState === "left" ? false : "left";
44
- return /* @__PURE__ */ jsxDEV(HStack, {
45
- gap: "sm",
46
- className: "flex-wrap",
47
- children: [
48
- /* @__PURE__ */ jsxDEV(Badge, {
49
- variant: "outline",
50
- children: label
51
- }, undefined, false, undefined, this),
52
- /* @__PURE__ */ jsxDEV(Button, {
53
- variant: "outline",
54
- size: "sm",
55
- onPress: () => firstRow?.toggleExpanded?.(!firstRow?.isExpanded),
56
- children: "Expand First Row"
57
- }, undefined, false, undefined, this),
58
- /* @__PURE__ */ jsxDEV(Button, {
59
- variant: "outline",
60
- size: "sm",
61
- onPress: () => toggleColumn?.toggleVisibility?.(!toggleColumn?.visible),
62
- children: toggleColumn?.visible ? toggleVisibleLabel : toggleHiddenLabel
63
- }, undefined, false, undefined, this),
64
- /* @__PURE__ */ jsxDEV(Button, {
65
- variant: "outline",
66
- size: "sm",
67
- onPress: () => pinColumn?.pin?.(pinTarget),
68
- children: pinColumn?.pinState === "left" ? `Unpin ${pinLabel}` : `Pin ${pinLabel}`
69
- }, undefined, false, undefined, this),
70
- /* @__PURE__ */ jsxDEV(Button, {
71
- variant: "outline",
72
- size: "sm",
73
- onPress: () => resizeColumn?.resizeBy?.(40),
74
- children: resizeLabel
75
- }, undefined, false, undefined, this)
76
- ]
77
- }, undefined, true, undefined, this);
78
- }
79
-
80
- // src/ui/tables/ConnectionsTable.tsx
81
- import { DataTable } from "@contractspec/lib.design-system";
82
- import { useContractTable } from "@contractspec/lib.presentation-runtime-react";
83
- import { VStack } from "@contractspec/lib.ui-kit-web/ui/stack";
84
- import { Text } from "@contractspec/lib.ui-kit-web/ui/text";
85
- import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
86
- "use client";
87
- function ConnectionsTable({
88
- connections
89
- }) {
90
- const controller = useContractTable({
91
- data: connections,
92
- columns: [
93
- {
94
- id: "connection",
95
- header: "Connection",
96
- label: "Connection",
97
- accessor: (connection) => connection.name,
98
- cell: ({ item }) => /* @__PURE__ */ jsxDEV2(VStack, {
99
- gap: "xs",
100
- children: [
101
- /* @__PURE__ */ jsxDEV2(Text, {
102
- className: "font-medium text-sm",
103
- children: item.name
104
- }, undefined, false, undefined, this),
105
- /* @__PURE__ */ jsxDEV2(Text, {
106
- className: "text-muted-foreground text-xs",
107
- children: [
108
- "Created ",
109
- item.createdAt.toLocaleDateString()
110
- ]
111
- }, undefined, true, undefined, this)
112
- ]
113
- }, undefined, true, undefined, this),
114
- size: 240,
115
- minSize: 180,
116
- canSort: true,
117
- canPin: true,
118
- canResize: true
119
- },
120
- {
121
- id: "status",
122
- header: "Status",
123
- label: "Status",
124
- accessorKey: "status",
125
- cell: ({ value }) => /* @__PURE__ */ jsxDEV2(StatusBadge, {
126
- status: String(value)
127
- }, undefined, false, undefined, this),
128
- size: 150,
129
- canSort: true,
130
- canPin: true,
131
- canResize: true
132
- },
133
- {
134
- id: "lastSyncAt",
135
- header: "Last Sync",
136
- label: "Last Sync",
137
- accessor: (connection) => connection.lastSyncAt?.getTime() ?? 0,
138
- cell: ({ item }) => formatDateTime(item.lastSyncAt),
139
- size: 200,
140
- canSort: true,
141
- canHide: true,
142
- canResize: true
143
- },
144
- {
145
- id: "errorMessage",
146
- header: "Errors",
147
- label: "Errors",
148
- accessor: (connection) => connection.errorMessage ?? "",
149
- cell: ({ value }) => String(value || "No errors"),
150
- size: 240,
151
- canHide: true,
152
- canResize: true
153
- }
154
- ],
155
- initialState: {
156
- pagination: { pageIndex: 0, pageSize: 3 },
157
- columnVisibility: { errorMessage: false },
158
- columnPinning: { left: ["connection"], right: [] }
159
- },
160
- renderExpandedContent: (connection) => /* @__PURE__ */ jsxDEV2(VStack, {
161
- gap: "sm",
162
- className: "py-2",
163
- children: [
164
- /* @__PURE__ */ jsxDEV2(Text, {
165
- className: "font-medium text-sm",
166
- children: "Credentials"
167
- }, undefined, false, undefined, this),
168
- /* @__PURE__ */ jsxDEV2("pre", {
169
- className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
170
- children: formatJson(connection.credentials)
171
- }, undefined, false, undefined, this),
172
- /* @__PURE__ */ jsxDEV2(Text, {
173
- className: "font-medium text-sm",
174
- children: "Config"
175
- }, undefined, false, undefined, this),
176
- /* @__PURE__ */ jsxDEV2("pre", {
177
- className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
178
- children: formatJson(connection.config)
179
- }, undefined, false, undefined, this),
180
- /* @__PURE__ */ jsxDEV2(Text, {
181
- className: "text-muted-foreground text-sm",
182
- children: connection.errorMessage ?? "No sync errors recorded."
183
- }, undefined, false, undefined, this)
184
- ]
185
- }, undefined, true, undefined, this),
186
- getCanExpand: () => true
187
- });
188
- return /* @__PURE__ */ jsxDEV2(DataTable, {
189
- controller,
190
- title: "Connections",
191
- description: "Client-mode ContractSpec table with visibility, pinning, resizing, and expanded diagnostics.",
192
- toolbar: /* @__PURE__ */ jsxDEV2(IntegrationTableToolbar, {
193
- controller,
194
- label: `${connections.length} total connections`,
195
- toggleColumnId: "errorMessage",
196
- toggleVisibleLabel: "Hide Error Column",
197
- toggleHiddenLabel: "Show Error Column",
198
- pinColumnId: "status",
199
- pinLabel: "Status",
200
- resizeColumnId: "connection",
201
- resizeLabel: "Widen Connection"
202
- }, undefined, false, undefined, this),
203
- emptyState: /* @__PURE__ */ jsxDEV2("div", {
204
- className: "rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",
205
- children: "No connections found"
206
- }, undefined, false, undefined, this)
207
- }, undefined, false, undefined, this);
208
- }
209
-
210
- // src/ui/tables/SyncConfigsTable.tsx
211
- import { DataTable as DataTable2 } from "@contractspec/lib.design-system";
212
- import { useContractTable as useContractTable2 } from "@contractspec/lib.presentation-runtime-react";
213
- import { VStack as VStack2 } from "@contractspec/lib.ui-kit-web/ui/stack";
214
- import { Text as Text2 } from "@contractspec/lib.ui-kit-web/ui/text";
215
- import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
216
- "use client";
217
- function SyncConfigsTable({
218
- syncConfigs
219
- }) {
220
- const controller = useContractTable2({
221
- data: syncConfigs,
222
- columns: [
223
- {
224
- id: "sync",
225
- header: "Sync Config",
226
- label: "Sync Config",
227
- accessor: (sync) => sync.name,
228
- cell: ({ item }) => /* @__PURE__ */ jsxDEV3(VStack2, {
229
- gap: "xs",
230
- children: [
231
- /* @__PURE__ */ jsxDEV3(Text2, {
232
- className: "font-medium text-sm",
233
- children: item.name
234
- }, undefined, false, undefined, this),
235
- /* @__PURE__ */ jsxDEV3(Text2, {
236
- className: "text-muted-foreground text-xs",
237
- children: [
238
- item.sourceEntity,
239
- " → ",
240
- item.targetEntity
241
- ]
242
- }, undefined, true, undefined, this)
243
- ]
244
- }, undefined, true, undefined, this),
245
- size: 260,
246
- minSize: 200,
247
- canSort: true,
248
- canPin: true,
249
- canResize: true
250
- },
251
- {
252
- id: "frequency",
253
- header: "Frequency",
254
- label: "Frequency",
255
- accessorKey: "frequency",
256
- size: 160,
257
- canSort: true,
258
- canHide: true,
259
- canResize: true
260
- },
261
- {
262
- id: "status",
263
- header: "Status",
264
- label: "Status",
265
- accessorKey: "status",
266
- cell: ({ value }) => /* @__PURE__ */ jsxDEV3(StatusBadge, {
267
- status: String(value)
268
- }, undefined, false, undefined, this),
269
- size: 150,
270
- canSort: true,
271
- canPin: true,
272
- canResize: true
273
- },
274
- {
275
- id: "recordsSynced",
276
- header: "Records",
277
- label: "Records",
278
- accessorKey: "recordsSynced",
279
- align: "right",
280
- size: 140,
281
- canSort: true,
282
- canResize: true
283
- },
284
- {
285
- id: "lastRunAt",
286
- header: "Last Run",
287
- label: "Last Run",
288
- accessor: (sync) => sync.lastRunAt?.getTime() ?? 0,
289
- cell: ({ item }) => formatDateTime(item.lastRunAt),
290
- size: 200,
291
- canSort: true,
292
- canHide: true,
293
- canResize: true
294
- }
295
- ],
296
- initialState: {
297
- pagination: { pageIndex: 0, pageSize: 3 },
298
- columnVisibility: { lastRunAt: false },
299
- columnPinning: { left: ["sync"], right: [] }
300
- },
301
- renderExpandedContent: (sync) => /* @__PURE__ */ jsxDEV3(VStack2, {
302
- gap: "sm",
303
- className: "py-2",
304
- children: [
305
- /* @__PURE__ */ jsxDEV3(Text2, {
306
- className: "text-muted-foreground text-sm",
307
- children: [
308
- "Connection ",
309
- sync.connectionId
310
- ]
311
- }, undefined, true, undefined, this),
312
- /* @__PURE__ */ jsxDEV3(Text2, {
313
- className: "text-muted-foreground text-sm",
314
- children: [
315
- "Last run: ",
316
- formatDateTime(sync.lastRunAt)
317
- ]
318
- }, undefined, true, undefined, this),
319
- /* @__PURE__ */ jsxDEV3(Text2, {
320
- className: "text-muted-foreground text-sm",
321
- children: [
322
- "Last status: ",
323
- sync.lastRunStatus ?? "No runs recorded"
324
- ]
325
- }, undefined, true, undefined, this),
326
- /* @__PURE__ */ jsxDEV3(Text2, {
327
- className: "text-muted-foreground text-sm",
328
- children: [
329
- "Updated ",
330
- sync.updatedAt.toLocaleString()
331
- ]
332
- }, undefined, true, undefined, this)
333
- ]
334
- }, undefined, true, undefined, this),
335
- getCanExpand: () => true
336
- });
337
- return /* @__PURE__ */ jsxDEV3(DataTable2, {
338
- controller,
339
- title: "Sync Configs",
340
- description: "Shared table primitives applied to sync monitoring without changing the surrounding dashboard layout.",
341
- toolbar: /* @__PURE__ */ jsxDEV3(IntegrationTableToolbar, {
342
- controller,
343
- label: `${syncConfigs.length} syncs`,
344
- toggleColumnId: "lastRunAt",
345
- toggleVisibleLabel: "Hide Last Run",
346
- toggleHiddenLabel: "Show Last Run",
347
- pinColumnId: "status",
348
- pinLabel: "Status",
349
- resizeColumnId: "sync",
350
- resizeLabel: "Widen Sync"
351
- }, undefined, false, undefined, this),
352
- emptyState: /* @__PURE__ */ jsxDEV3("div", {
353
- className: "rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",
354
- children: "No sync configurations found"
355
- }, undefined, false, undefined, this)
356
- }, undefined, false, undefined, this);
357
- }
358
- export {
359
- SyncConfigsTable,
360
- ConnectionsTable
361
- };
1
+ import{Button as Y}from"@contractspec/lib.design-system";import{Badge as H}from"@contractspec/lib.ui-kit-web/ui/badge";import{HStack as S}from"@contractspec/lib.ui-kit-web/ui/stack";import{jsx as M,jsxs as p}from"react/jsx-runtime";var L={ACTIVE:"default",CONNECTED:"default",SUCCESS:"default",PENDING:"secondary",PAUSED:"secondary",ERROR:"destructive",DISCONNECTED:"outline"};function Q(E){return E?E.toLocaleString():"Never"}function _(E){return E?JSON.stringify(E,null,2):"No configuration"}function Z({status:E}){return M(H,{variant:L[E]??"outline",children:E})}function $({controller:E,label:G,toggleColumnId:q,toggleVisibleLabel:z,toggleHiddenLabel:D,pinColumnId:V,pinLabel:J,resizeColumnId:f,resizeLabel:B}){let A=E.rows[0],N=E.columns.find((P)=>P.id===q),U=E.columns.find((P)=>P.id===V),k=E.columns.find((P)=>P.id===f),I=U?.pinState==="left"?!1:"left";return p(S,{gap:"sm",className:"flex-wrap",children:[M(H,{variant:"outline",children:G}),M(Y,{variant:"outline",size:"sm",onPress:()=>A?.toggleExpanded?.(!A?.isExpanded),children:"Expand First Row"}),M(Y,{variant:"outline",size:"sm",onPress:()=>N?.toggleVisibility?.(!N?.visible),children:N?.visible?z:D}),M(Y,{variant:"outline",size:"sm",onPress:()=>U?.pin?.(I),children:U?.pinState==="left"?`Unpin ${J}`:`Pin ${J}`}),M(Y,{variant:"outline",size:"sm",onPress:()=>k?.resizeBy?.(40),children:B})]})}import{DataTable as v}from"@contractspec/lib.design-system";import{useContractTable as y}from"@contractspec/lib.presentation-runtime-react";import{VStack as R}from"@contractspec/lib.ui-kit-web/ui/stack";import{Text as W}from"@contractspec/lib.ui-kit-web/ui/text";import{jsx as F,jsxs as h}from"react/jsx-runtime";function d({connections:E}){let G=y({data:E,columns:[{id:"connection",header:"Connection",label:"Connection",accessor:(q)=>q.name,cell:({item:q})=>h(R,{gap:"xs",children:[F(W,{className:"font-medium text-sm",children:q.name}),h(W,{className:"text-muted-foreground text-xs",children:["Created ",q.createdAt.toLocaleDateString()]})]}),size:240,minSize:180,canSort:!0,canPin:!0,canResize:!0},{id:"status",header:"Status",label:"Status",accessorKey:"status",cell:({value:q})=>F(Z,{status:String(q)}),size:150,canSort:!0,canPin:!0,canResize:!0},{id:"lastSyncAt",header:"Last Sync",label:"Last Sync",accessor:(q)=>q.lastSyncAt?.getTime()??0,cell:({item:q})=>Q(q.lastSyncAt),size:200,canSort:!0,canHide:!0,canResize:!0},{id:"errorMessage",header:"Errors",label:"Errors",accessor:(q)=>q.errorMessage??"",cell:({value:q})=>String(q||"No errors"),size:240,canHide:!0,canResize:!0}],initialState:{pagination:{pageIndex:0,pageSize:3},columnVisibility:{errorMessage:!1},columnPinning:{left:["connection"],right:[]}},renderExpandedContent:(q)=>h(R,{gap:"sm",className:"py-2",children:[F(W,{className:"font-medium text-sm",children:"Credentials"}),F("pre",{className:"overflow-auto rounded-md bg-muted/40 p-3 text-xs",children:_(q.credentials)}),F(W,{className:"font-medium text-sm",children:"Config"}),F("pre",{className:"overflow-auto rounded-md bg-muted/40 p-3 text-xs",children:_(q.config)}),F(W,{className:"text-muted-foreground text-sm",children:q.errorMessage??"No sync errors recorded."})]}),getCanExpand:()=>!0});return F(v,{controller:G,title:"Connections",description:"Client-mode ContractSpec table with visibility, pinning, resizing, and expanded diagnostics.",toolbar:F($,{controller:G,label:`${E.length} total connections`,toggleColumnId:"errorMessage",toggleVisibleLabel:"Hide Error Column",toggleHiddenLabel:"Show Error Column",pinColumnId:"status",pinLabel:"Status",resizeColumnId:"connection",resizeLabel:"Widen Connection"}),emptyState:F("div",{className:"rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",children:"No connections found"})})}import{DataTable as C}from"@contractspec/lib.design-system";import{useContractTable as T}from"@contractspec/lib.presentation-runtime-react";import{VStack as w}from"@contractspec/lib.ui-kit-web/ui/stack";import{Text as O}from"@contractspec/lib.ui-kit-web/ui/text";import{jsx as X,jsxs as K}from"react/jsx-runtime";function b({syncConfigs:E}){let G=T({data:E,columns:[{id:"sync",header:"Sync Config",label:"Sync Config",accessor:(q)=>q.name,cell:({item:q})=>K(w,{gap:"xs",children:[X(O,{className:"font-medium text-sm",children:q.name}),K(O,{className:"text-muted-foreground text-xs",children:[q.sourceEntity," → ",q.targetEntity]})]}),size:260,minSize:200,canSort:!0,canPin:!0,canResize:!0},{id:"frequency",header:"Frequency",label:"Frequency",accessorKey:"frequency",size:160,canSort:!0,canHide:!0,canResize:!0},{id:"status",header:"Status",label:"Status",accessorKey:"status",cell:({value:q})=>X(Z,{status:String(q)}),size:150,canSort:!0,canPin:!0,canResize:!0},{id:"recordsSynced",header:"Records",label:"Records",accessorKey:"recordsSynced",align:"right",size:140,canSort:!0,canResize:!0},{id:"lastRunAt",header:"Last Run",label:"Last Run",accessor:(q)=>q.lastRunAt?.getTime()??0,cell:({item:q})=>Q(q.lastRunAt),size:200,canSort:!0,canHide:!0,canResize:!0}],initialState:{pagination:{pageIndex:0,pageSize:3},columnVisibility:{lastRunAt:!1},columnPinning:{left:["sync"],right:[]}},renderExpandedContent:(q)=>K(w,{gap:"sm",className:"py-2",children:[K(O,{className:"text-muted-foreground text-sm",children:["Connection ",q.connectionId]}),K(O,{className:"text-muted-foreground text-sm",children:["Last run: ",Q(q.lastRunAt)]}),K(O,{className:"text-muted-foreground text-sm",children:["Last status: ",q.lastRunStatus??"No runs recorded"]}),K(O,{className:"text-muted-foreground text-sm",children:["Updated ",q.updatedAt.toLocaleString()]})]}),getCanExpand:()=>!0});return X(C,{controller:G,title:"Sync Configs",description:"Shared table primitives applied to sync monitoring without changing the surrounding dashboard layout.",toolbar:X($,{controller:G,label:`${E.length} syncs`,toggleColumnId:"lastRunAt",toggleVisibleLabel:"Hide Last Run",toggleHiddenLabel:"Show Last Run",pinColumnId:"status",pinLabel:"Status",resizeColumnId:"sync",resizeLabel:"Widen Sync"}),emptyState:X("div",{className:"rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",children:"No sync configurations found"})})}export{b as SyncConfigsTable,d as ConnectionsTable};