nucleus-core-ts 0.9.781 → 0.9.783

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 (154) hide show
  1. package/dist/client.js +1 -1
  2. package/dist/fe/components/IntegrationsPage/components/ConnectionAuthFields.d.ts +2 -0
  3. package/dist/fe/components/IntegrationsPage/components/ConnectionAuthFields.js +85 -0
  4. package/dist/fe/components/IntegrationsPage/components/ConnectionBasicFields.d.ts +2 -0
  5. package/dist/fe/components/IntegrationsPage/components/ConnectionBasicFields.js +165 -0
  6. package/dist/fe/components/IntegrationsPage/components/ConnectionForm.d.ts +10 -0
  7. package/dist/fe/components/IntegrationsPage/components/ConnectionForm.js +112 -0
  8. package/dist/fe/components/IntegrationsPage/components/ConnectionList.d.ts +9 -0
  9. package/dist/fe/components/IntegrationsPage/components/ConnectionList.js +184 -0
  10. package/dist/fe/components/IntegrationsPage/components/ConnectionOauthFields.d.ts +2 -0
  11. package/dist/fe/components/IntegrationsPage/components/ConnectionOauthFields.js +131 -0
  12. package/dist/fe/components/IntegrationsPage/components/ConnectionSettingsTab.d.ts +21 -0
  13. package/dist/fe/components/IntegrationsPage/components/ConnectionSettingsTab.js +49 -0
  14. package/dist/fe/components/IntegrationsPage/components/ConnectionTabs.d.ts +12 -0
  15. package/dist/fe/components/IntegrationsPage/components/ConnectionTabs.js +95 -0
  16. package/dist/fe/components/IntegrationsPage/components/ConnectionTest.d.ts +9 -0
  17. package/dist/fe/components/IntegrationsPage/components/ConnectionTest.js +116 -0
  18. package/dist/fe/components/IntegrationsPage/components/CredentialFields.d.ts +9 -0
  19. package/dist/fe/components/IntegrationsPage/components/CredentialFields.js +171 -0
  20. package/dist/fe/components/IntegrationsPage/components/CredentialSlotRow.d.ts +13 -0
  21. package/dist/fe/components/IntegrationsPage/components/CredentialSlotRow.js +63 -0
  22. package/dist/fe/components/IntegrationsPage/components/EndpointForm.d.ts +11 -0
  23. package/dist/fe/components/IntegrationsPage/components/EndpointForm.js +166 -0
  24. package/dist/fe/components/IntegrationsPage/components/EndpointFormFields.d.ts +19 -0
  25. package/dist/fe/components/IntegrationsPage/components/EndpointFormFields.js +162 -0
  26. package/dist/fe/components/IntegrationsPage/components/EndpointList.d.ts +12 -0
  27. package/dist/fe/components/IntegrationsPage/components/EndpointList.js +205 -0
  28. package/dist/fe/components/IntegrationsPage/components/EndpointSample.d.ts +6 -0
  29. package/dist/fe/components/IntegrationsPage/components/EndpointSample.js +204 -0
  30. package/dist/fe/components/IntegrationsPage/components/EndpointsTab.d.ts +5 -0
  31. package/dist/fe/components/IntegrationsPage/components/EndpointsTab.js +101 -0
  32. package/dist/fe/components/IntegrationsPage/components/FieldMappingRow.d.ts +17 -0
  33. package/dist/fe/components/IntegrationsPage/components/FieldMappingRow.js +179 -0
  34. package/dist/fe/components/IntegrationsPage/components/FieldMappingRows.d.ts +11 -0
  35. package/dist/fe/components/IntegrationsPage/components/FieldMappingRows.js +115 -0
  36. package/dist/fe/components/IntegrationsPage/components/IntegrationsPage.d.ts +2 -0
  37. package/dist/fe/components/IntegrationsPage/components/IntegrationsPage.js +175 -0
  38. package/dist/fe/components/IntegrationsPage/components/MappingEditor.d.ts +15 -0
  39. package/dist/fe/components/IntegrationsPage/components/MappingEditor.js +193 -0
  40. package/dist/fe/components/IntegrationsPage/components/MappingList.d.ts +11 -0
  41. package/dist/fe/components/IntegrationsPage/components/MappingList.js +191 -0
  42. package/dist/fe/components/IntegrationsPage/components/MappingWriteModeFields.d.ts +19 -0
  43. package/dist/fe/components/IntegrationsPage/components/MappingWriteModeFields.js +150 -0
  44. package/dist/fe/components/IntegrationsPage/components/MappingsTab.d.ts +5 -0
  45. package/dist/fe/components/IntegrationsPage/components/MappingsTab.js +154 -0
  46. package/dist/fe/components/IntegrationsPage/components/PaginationFields.d.ts +9 -0
  47. package/dist/fe/components/IntegrationsPage/components/PaginationFields.js +218 -0
  48. package/dist/fe/components/IntegrationsPage/components/ParamBindingRow.d.ts +24 -0
  49. package/dist/fe/components/IntegrationsPage/components/ParamBindingRow.js +180 -0
  50. package/dist/fe/components/IntegrationsPage/components/ParamBindingRows.d.ts +33 -0
  51. package/dist/fe/components/IntegrationsPage/components/ParamBindingRows.js +100 -0
  52. package/dist/fe/components/IntegrationsPage/components/Primitives.d.ts +65 -0
  53. package/dist/fe/components/IntegrationsPage/components/Primitives.js +94 -0
  54. package/dist/fe/components/IntegrationsPage/components/RunConfirmStep.d.ts +10 -0
  55. package/dist/fe/components/IntegrationsPage/components/RunConfirmStep.js +48 -0
  56. package/dist/fe/components/IntegrationsPage/components/RunHistory.d.ts +10 -0
  57. package/dist/fe/components/IntegrationsPage/components/RunHistory.js +124 -0
  58. package/dist/fe/components/IntegrationsPage/components/RunHistoryRow.d.ts +7 -0
  59. package/dist/fe/components/IntegrationsPage/components/RunHistoryRow.js +129 -0
  60. package/dist/fe/components/IntegrationsPage/components/RunPanel.d.ts +9 -0
  61. package/dist/fe/components/IntegrationsPage/components/RunPanel.js +160 -0
  62. package/dist/fe/components/IntegrationsPage/components/RunPlanIssues.d.ts +5 -0
  63. package/dist/fe/components/IntegrationsPage/components/RunPlanIssues.js +43 -0
  64. package/dist/fe/components/IntegrationsPage/components/RunPlanSummary.d.ts +5 -0
  65. package/dist/fe/components/IntegrationsPage/components/RunPlanSummary.js +92 -0
  66. package/dist/fe/components/IntegrationsPage/components/RunProgressBar.d.ts +8 -0
  67. package/dist/fe/components/IntegrationsPage/components/RunProgressBar.js +77 -0
  68. package/dist/fe/components/IntegrationsPage/components/RunRevertConflicts.d.ts +13 -0
  69. package/dist/fe/components/IntegrationsPage/components/RunRevertConflicts.js +65 -0
  70. package/dist/fe/components/IntegrationsPage/components/RunsTab.d.ts +13 -0
  71. package/dist/fe/components/IntegrationsPage/components/RunsTab.js +39 -0
  72. package/dist/fe/components/IntegrationsPage/components/Skeletons.d.ts +9 -0
  73. package/dist/fe/components/IntegrationsPage/components/Skeletons.js +139 -0
  74. package/dist/fe/components/IntegrationsPage/components/authOptions.d.ts +29 -0
  75. package/dist/fe/components/IntegrationsPage/components/authOptions.js +71 -0
  76. package/dist/fe/components/IntegrationsPage/components/connectionDraft.d.ts +64 -0
  77. package/dist/fe/components/IntegrationsPage/components/connectionDraft.js +112 -0
  78. package/dist/fe/components/IntegrationsPage/components/credentialSlots.d.ts +25 -0
  79. package/dist/fe/components/IntegrationsPage/components/credentialSlots.js +67 -0
  80. package/dist/fe/components/IntegrationsPage/components/fieldMappingOptions.d.ts +16 -0
  81. package/dist/fe/components/IntegrationsPage/components/fieldMappingOptions.js +41 -0
  82. package/dist/fe/components/IntegrationsPage/components/formSupport.d.ts +19 -0
  83. package/dist/fe/components/IntegrationsPage/components/formSupport.js +25 -0
  84. package/dist/fe/components/IntegrationsPage/components/mappingDraft.d.ts +40 -0
  85. package/dist/fe/components/IntegrationsPage/components/mappingDraft.js +44 -0
  86. package/dist/fe/components/IntegrationsPage/components/pathParams.d.ts +9 -0
  87. package/dist/fe/components/IntegrationsPage/components/pathParams.js +15 -0
  88. package/dist/fe/components/IntegrationsPage/components/runFormat.d.ts +33 -0
  89. package/dist/fe/components/IntegrationsPage/components/runFormat.js +85 -0
  90. package/dist/fe/components/IntegrationsPage/components/useInfiniteList.d.ts +40 -0
  91. package/dist/fe/components/IntegrationsPage/components/useInfiniteList.js +110 -0
  92. package/dist/fe/components/IntegrationsPage/index.d.ts +18 -0
  93. package/dist/fe/components/IntegrationsPage/index.js +11 -0
  94. package/dist/fe/components/IntegrationsPage/store/index.d.ts +2 -0
  95. package/dist/fe/components/IntegrationsPage/store/index.js +124 -0
  96. package/dist/fe/components/IntegrationsPage/store/state.d.ts +80 -0
  97. package/dist/fe/components/IntegrationsPage/store/state.js +32 -0
  98. package/dist/fe/components/IntegrationsPage/theme/index.d.ts +103 -0
  99. package/dist/fe/components/IntegrationsPage/theme/index.js +113 -0
  100. package/dist/fe/components/IntegrationsPage/types/actions.d.ts +91 -0
  101. package/dist/fe/components/IntegrationsPage/types/actions.js +1 -0
  102. package/dist/fe/components/IntegrationsPage/types/index.d.ts +3 -0
  103. package/dist/fe/components/IntegrationsPage/types/index.js +3 -0
  104. package/dist/fe/components/IntegrationsPage/types/records.d.ts +139 -0
  105. package/dist/fe/components/IntegrationsPage/types/records.js +11 -0
  106. package/dist/fe/components/IntegrationsPage/types/results.d.ts +52 -0
  107. package/dist/fe/components/IntegrationsPage/types/results.js +4 -0
  108. package/dist/fe/index.d.ts +2 -0
  109. package/dist/fe/index.js +1 -0
  110. package/dist/index.js +14 -14
  111. package/dist/src/Client/ApiCaller/system-tables.d.ts +505 -0
  112. package/dist/src/Client/Proxy/wsProxy.js +25 -1
  113. package/dist/src/ElysiaPlugin/routes/backup/types.d.ts +3 -1
  114. package/dist/src/ElysiaPlugin/routes/integrations/index.d.ts +49 -0
  115. package/dist/src/ElysiaPlugin/routes/integrations/inspect.d.ts +87 -0
  116. package/dist/src/ElysiaPlugin/routes/integrations/inspectRoutes.d.ts +41 -0
  117. package/dist/src/ElysiaPlugin/routes/integrations/repository.d.ts +88 -0
  118. package/dist/src/ElysiaPlugin/routes/integrations/types.d.ts +22 -0
  119. package/dist/src/ElysiaPlugin/routes/pubsub/frame.d.ts +37 -0
  120. package/dist/src/ElysiaPlugin/routes/pubsub/frame.test.d.ts +1 -0
  121. package/dist/src/Services/Backup/BackupService.d.ts +16 -8
  122. package/dist/src/Services/Backup/types.d.ts +25 -0
  123. package/dist/src/Services/Integrations/bindings.d.ts +116 -0
  124. package/dist/src/Services/Integrations/bindings.test.d.ts +1 -0
  125. package/dist/src/Services/Integrations/collect.d.ts +68 -0
  126. package/dist/src/Services/Integrations/collect.test.d.ts +1 -0
  127. package/dist/src/Services/Integrations/fetcher.d.ts +100 -0
  128. package/dist/src/Services/Integrations/fetcher.test.d.ts +1 -0
  129. package/dist/src/Services/Integrations/lock.d.ts +77 -0
  130. package/dist/src/Services/Integrations/lock.test.d.ts +1 -0
  131. package/dist/src/Services/Integrations/mapping.d.ts +63 -0
  132. package/dist/src/Services/Integrations/mapping.test.d.ts +1 -0
  133. package/dist/src/Services/Integrations/oauth.d.ts +89 -0
  134. package/dist/src/Services/Integrations/oauth.test.d.ts +1 -0
  135. package/dist/src/Services/Integrations/pagination.d.ts +97 -0
  136. package/dist/src/Services/Integrations/pagination.test.d.ts +1 -0
  137. package/dist/src/Services/Integrations/plan.d.ts +74 -0
  138. package/dist/src/Services/Integrations/plan.test.d.ts +1 -0
  139. package/dist/src/Services/Integrations/revert.d.ts +78 -0
  140. package/dist/src/Services/Integrations/revert.test.d.ts +1 -0
  141. package/dist/src/Services/Integrations/runner.d.ts +126 -0
  142. package/dist/src/Services/Integrations/runner.test.d.ts +1 -0
  143. package/dist/src/Services/Integrations/types.d.ts +208 -0
  144. package/dist/src/Services/Integrations/writer.d.ts +105 -0
  145. package/dist/src/Services/Integrations/writer.test.d.ts +1 -0
  146. package/dist/src/Utils/cron.d.ts +65 -0
  147. package/dist/src/Utils/cron.test.d.ts +1 -0
  148. package/dist/src/types.d.ts +67 -1
  149. package/package.json +1 -1
  150. package/schemas/config.nucleus.json +43 -0
  151. package/schemas/table.schema.json +2 -1
  152. package/scripts/generate-schema.test.ts +78 -0
  153. package/scripts/generate-schema.ts +43 -5
  154. package/src/system.tables.json +362 -0
@@ -0,0 +1,180 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useId } from 'react';
4
+ import { integrationsPageTheme as theme } from '../theme';
5
+ import { Field } from './Primitives';
6
+ export function ParamBindingRow({ binding, onChange, onRemove, siblings, entities, disabled }) {
7
+ const rowId = useId();
8
+ const changeSource = (from)=>{
9
+ if (from === 'static') onChange({
10
+ param: binding.param,
11
+ from: 'static',
12
+ value: ''
13
+ });
14
+ else if (from === 'endpoint') onChange({
15
+ param: binding.param,
16
+ from: 'endpoint',
17
+ endpointId: siblings[0]?.id ?? '',
18
+ field: ''
19
+ });
20
+ else onChange({
21
+ param: binding.param,
22
+ from: 'entity',
23
+ entity: entities[0]?.entity ?? '',
24
+ field: ''
25
+ });
26
+ };
27
+ return /*#__PURE__*/ _jsxs("div", {
28
+ className: "flex flex-col gap-2 rounded-lg border border-slate-200 p-3 sm:flex-row sm:items-end dark:border-slate-800",
29
+ children: [
30
+ /*#__PURE__*/ _jsx(Field, {
31
+ htmlFor: `${rowId}-from`,
32
+ label: binding.param,
33
+ children: /*#__PURE__*/ _jsxs("select", {
34
+ className: theme.field.input,
35
+ disabled: disabled,
36
+ id: `${rowId}-from`,
37
+ onChange: (event)=>changeSource(event.target.value),
38
+ value: binding.from,
39
+ children: [
40
+ /*#__PURE__*/ _jsx("option", {
41
+ value: "static",
42
+ children: "A fixed value"
43
+ }),
44
+ /*#__PURE__*/ _jsx("option", {
45
+ value: "endpoint",
46
+ children: "A field of another endpoint"
47
+ }),
48
+ /*#__PURE__*/ _jsx("option", {
49
+ value: "entity",
50
+ children: "A column of one of our tables"
51
+ })
52
+ ]
53
+ })
54
+ }),
55
+ /*#__PURE__*/ _jsx(ParamBindingValueFields, {
56
+ binding: binding,
57
+ disabled: disabled,
58
+ entities: entities,
59
+ onChange: onChange,
60
+ rowId: rowId,
61
+ siblings: siblings
62
+ }),
63
+ /*#__PURE__*/ _jsx("button", {
64
+ "aria-label": `Remove the binding for ${binding.param}`,
65
+ className: theme.button.ghost,
66
+ disabled: disabled,
67
+ onClick: onRemove,
68
+ type: "button",
69
+ children: "Remove"
70
+ })
71
+ ]
72
+ });
73
+ }
74
+ /** The half of a row that depends on which source was chosen. */ function ParamBindingValueFields({ binding, onChange, siblings, entities, disabled, rowId }) {
75
+ if (binding.from === 'static') {
76
+ return /*#__PURE__*/ _jsx(Field, {
77
+ htmlFor: `${rowId}-value`,
78
+ label: "Value",
79
+ children: /*#__PURE__*/ _jsx("input", {
80
+ className: theme.field.input,
81
+ disabled: disabled,
82
+ id: `${rowId}-value`,
83
+ onChange: (event)=>onChange({
84
+ ...binding,
85
+ value: event.target.value
86
+ }),
87
+ placeholder: "e.g. ACTIVE",
88
+ value: binding.value
89
+ })
90
+ });
91
+ }
92
+ if (binding.from === 'endpoint') {
93
+ return /*#__PURE__*/ _jsxs(_Fragment, {
94
+ children: [
95
+ /*#__PURE__*/ _jsx(Field, {
96
+ hint: "Fetched first; this endpoint is then called once per record it returns.",
97
+ htmlFor: `${rowId}-endpoint`,
98
+ label: "From endpoint",
99
+ children: /*#__PURE__*/ _jsx("select", {
100
+ className: theme.field.input,
101
+ disabled: disabled,
102
+ id: `${rowId}-endpoint`,
103
+ onChange: (event)=>onChange({
104
+ ...binding,
105
+ endpointId: event.target.value
106
+ }),
107
+ value: binding.endpointId,
108
+ children: siblings.map((sibling)=>/*#__PURE__*/ _jsx("option", {
109
+ value: sibling.id,
110
+ children: sibling.tag
111
+ }, sibling.id))
112
+ })
113
+ }),
114
+ /*#__PURE__*/ _jsx(Field, {
115
+ htmlFor: `${rowId}-field`,
116
+ label: "Field",
117
+ children: /*#__PURE__*/ _jsx("input", {
118
+ className: theme.field.input,
119
+ disabled: disabled,
120
+ id: `${rowId}-field`,
121
+ onChange: (event)=>onChange({
122
+ ...binding,
123
+ field: event.target.value
124
+ }),
125
+ placeholder: "e.g. name",
126
+ value: binding.field
127
+ })
128
+ })
129
+ ]
130
+ });
131
+ }
132
+ const selected = entities.find((entity)=>entity.entity === binding.entity);
133
+ return /*#__PURE__*/ _jsxs(_Fragment, {
134
+ children: [
135
+ /*#__PURE__*/ _jsx(Field, {
136
+ htmlFor: `${rowId}-entity`,
137
+ label: "From table",
138
+ children: /*#__PURE__*/ _jsx("select", {
139
+ className: theme.field.input,
140
+ disabled: disabled,
141
+ id: `${rowId}-entity`,
142
+ onChange: (event)=>onChange({
143
+ ...binding,
144
+ entity: event.target.value,
145
+ field: ''
146
+ }),
147
+ value: binding.entity,
148
+ children: entities.map((entity)=>/*#__PURE__*/ _jsx("option", {
149
+ value: entity.entity,
150
+ children: entity.label
151
+ }, entity.entity))
152
+ })
153
+ }),
154
+ /*#__PURE__*/ _jsx(Field, {
155
+ htmlFor: `${rowId}-column`,
156
+ label: "Column",
157
+ children: /*#__PURE__*/ _jsxs("select", {
158
+ className: theme.field.input,
159
+ disabled: disabled,
160
+ id: `${rowId}-column`,
161
+ onChange: (event)=>onChange({
162
+ ...binding,
163
+ field: event.target.value
164
+ }),
165
+ value: binding.field,
166
+ children: [
167
+ /*#__PURE__*/ _jsx("option", {
168
+ value: "",
169
+ children: "Choose a column…"
170
+ }),
171
+ (selected?.fields ?? []).map((field)=>/*#__PURE__*/ _jsx("option", {
172
+ value: field,
173
+ children: field
174
+ }, field))
175
+ ]
176
+ })
177
+ })
178
+ ]
179
+ });
180
+ }
@@ -0,0 +1,33 @@
1
+ import type { IntegrationEndpoint, ParamBindingValue } from '../types';
2
+ export type ParamBindingRowsProps = {
3
+ /** Parameter names the path and query need filling. */
4
+ required: string[];
5
+ value: ParamBindingValue[];
6
+ onChange: (next: ParamBindingValue[]) => void;
7
+ /** Other endpoints of this connection, as possible parents. */
8
+ siblings: IntegrationEndpoint[];
9
+ /** Target entities, for binding a parameter to one of our own columns. */
10
+ entities: {
11
+ entity: string;
12
+ label: string;
13
+ fields: string[];
14
+ }[];
15
+ disabled?: boolean;
16
+ };
17
+ /**
18
+ * Where each parameter of an endpoint gets its value.
19
+ *
20
+ * This is what makes an endpoint that is only reachable per item — `/thing/{id}`,
21
+ * with no endpoint that lists everything — importable at all. Without it such an
22
+ * endpoint could be TESTED from the panel (the sample screen asks for a value by
23
+ * hand) but never imported, because a run had nothing to supply the parameter
24
+ * from. That gap is exactly why this screen exists.
25
+ *
26
+ * Three sources, and the difference matters:
27
+ * - a fixed value, the same on every call;
28
+ * - a field of another endpoint's records — one call per record, which is the
29
+ * fan-out;
30
+ * - a column of one of our own tables, for "fetch the detail of everything I
31
+ * already have".
32
+ */
33
+ export declare function ParamBindingRows({ required, value, onChange, siblings, entities, disabled, }: ParamBindingRowsProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,100 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useId } from 'react';
4
+ import { integrationsPageTheme as theme } from '../theme';
5
+ import { ParamBindingRow } from './ParamBindingRow';
6
+ import { Notice } from './Primitives';
7
+ /**
8
+ * Where each parameter of an endpoint gets its value.
9
+ *
10
+ * This is what makes an endpoint that is only reachable per item — `/thing/{id}`,
11
+ * with no endpoint that lists everything — importable at all. Without it such an
12
+ * endpoint could be TESTED from the panel (the sample screen asks for a value by
13
+ * hand) but never imported, because a run had nothing to supply the parameter
14
+ * from. That gap is exactly why this screen exists.
15
+ *
16
+ * Three sources, and the difference matters:
17
+ * - a fixed value, the same on every call;
18
+ * - a field of another endpoint's records — one call per record, which is the
19
+ * fan-out;
20
+ * - a column of one of our own tables, for "fetch the detail of everything I
21
+ * already have".
22
+ */ export function ParamBindingRows({ required, value, onChange, siblings, entities, disabled = false }) {
23
+ const groupId = useId();
24
+ const bound = new Set(value.map((binding)=>binding.param));
25
+ const unbound = required.filter((name)=>!bound.has(name));
26
+ const update = (index, next)=>{
27
+ onChange(value.map((binding, position)=>position === index ? next : binding));
28
+ };
29
+ const remove = (index)=>{
30
+ onChange(value.filter((_binding, position)=>position !== index));
31
+ };
32
+ const add = (param)=>{
33
+ onChange([
34
+ ...value,
35
+ {
36
+ param,
37
+ from: 'static',
38
+ value: ''
39
+ }
40
+ ]);
41
+ };
42
+ return /*#__PURE__*/ _jsxs("section", {
43
+ "aria-labelledby": `${groupId}-title`,
44
+ className: theme.card.wrapper,
45
+ children: [
46
+ /*#__PURE__*/ _jsx("header", {
47
+ className: theme.card.header,
48
+ children: /*#__PURE__*/ _jsx("h4", {
49
+ className: theme.card.title,
50
+ id: `${groupId}-title`,
51
+ children: "Parameter values"
52
+ })
53
+ }),
54
+ /*#__PURE__*/ _jsxs("div", {
55
+ className: theme.card.body,
56
+ children: [
57
+ required.length === 0 ? /*#__PURE__*/ _jsxs("p", {
58
+ className: theme.field.hint,
59
+ children: [
60
+ "This endpoint takes no parameters. Add a ",
61
+ /*#__PURE__*/ _jsx("code", {
62
+ children: '{name}'
63
+ }),
64
+ " token to its path if it needs one."
65
+ ]
66
+ }) : null,
67
+ unbound.length > 0 ? /*#__PURE__*/ _jsxs(Notice, {
68
+ title: "These parameters have no value yet",
69
+ tone: "warning",
70
+ children: [
71
+ unbound.join(', '),
72
+ " — an import cannot run until every one of them is bound. Add a binding for each below."
73
+ ]
74
+ }) : null,
75
+ value.map((binding, index)=>/*#__PURE__*/ _jsx(ParamBindingRow, {
76
+ binding: binding,
77
+ disabled: disabled,
78
+ entities: entities,
79
+ onChange: (next)=>update(index, next),
80
+ onRemove: ()=>remove(index),
81
+ siblings: siblings
82
+ }, `${binding.param}-${index}`)),
83
+ unbound.length > 0 ? /*#__PURE__*/ _jsx("div", {
84
+ className: "flex flex-wrap gap-2",
85
+ children: unbound.map((name)=>/*#__PURE__*/ _jsxs("button", {
86
+ className: theme.button.secondary,
87
+ disabled: disabled,
88
+ onClick: ()=>add(name),
89
+ type: "button",
90
+ children: [
91
+ "Bind ",
92
+ name
93
+ ]
94
+ }, name))
95
+ }) : null
96
+ ]
97
+ })
98
+ ]
99
+ });
100
+ }
@@ -0,0 +1,65 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * The five pieces every other screen in this panel is built from.
4
+ *
5
+ * Nothing here holds state or fetches anything: each one takes what it shows and
6
+ * paints it with a class the theme already owns, so a colour is changed in one
7
+ * file and no component can drift into a light-only or a dark-only look.
8
+ */
9
+ export type BadgeTone = 'neutral' | 'success' | 'warning' | 'danger' | 'info';
10
+ export type NoticeTone = 'info' | 'warning' | 'danger';
11
+ export type BadgeProps = {
12
+ tone: BadgeTone;
13
+ children: ReactNode;
14
+ };
15
+ /** A status word — a run's outcome, an auth type, an enabled flag. */
16
+ export declare function Badge({ tone, children }: BadgeProps): import("react/jsx-runtime").JSX.Element;
17
+ export type StatProps = {
18
+ label: string;
19
+ value: ReactNode;
20
+ tone?: BadgeTone;
21
+ };
22
+ /**
23
+ * One number with its name under it.
24
+ *
25
+ * The tone tints the whole cell rather than the digits alone: an operator scans
26
+ * a row of counts, and a red *cell* is findable where red text is not.
27
+ */
28
+ export declare function Stat({ label, value, tone }: StatProps): import("react/jsx-runtime").JSX.Element;
29
+ export type NoticeProps = {
30
+ tone: NoticeTone;
31
+ title: string;
32
+ children?: ReactNode;
33
+ };
34
+ /**
35
+ * Something the operator has to read before acting.
36
+ *
37
+ * A danger notice is announced immediately because it is the one that reports a
38
+ * write that failed or is about to delete rows; the calmer tones wait their turn.
39
+ */
40
+ export declare function Notice({ tone, title, children }: NoticeProps): import("react/jsx-runtime").JSX.Element;
41
+ export type FieldProps = {
42
+ label: string;
43
+ htmlFor: string;
44
+ hint?: string;
45
+ error?: string | null;
46
+ children: ReactNode;
47
+ };
48
+ /**
49
+ * A labelled control.
50
+ *
51
+ * The hint and the error carry ids derived from the control's own id so the
52
+ * caller can point `aria-describedby` at them; the label is not optional,
53
+ * because a form of unlabelled boxes is unusable with a screen reader.
54
+ */
55
+ export declare function Field({ label, htmlFor, hint, error, children }: FieldProps): import("react/jsx-runtime").JSX.Element;
56
+ export type CodeBlockProps = {
57
+ children: ReactNode;
58
+ };
59
+ /**
60
+ * One line of verbatim text — a URL, a JSON path, a header name.
61
+ *
62
+ * It scrolls sideways instead of wrapping: a wrapped path invites the reader to
63
+ * copy a line break into a field where it will silently break the request.
64
+ */
65
+ export declare function CodeBlock({ children }: CodeBlockProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,94 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cn } from '../../../utils/cn';
4
+ import { integrationsPageTheme } from '../theme';
5
+ const theme = integrationsPageTheme;
6
+ /** A status word — a run's outcome, an auth type, an enabled flag. */ export function Badge({ tone, children }) {
7
+ return /*#__PURE__*/ _jsx("span", {
8
+ className: cn(theme.badge.base, theme.badge[tone]),
9
+ children: children
10
+ });
11
+ }
12
+ /**
13
+ * One number with its name under it.
14
+ *
15
+ * The tone tints the whole cell rather than the digits alone: an operator scans
16
+ * a row of counts, and a red *cell* is findable where red text is not.
17
+ */ export function Stat({ label, value, tone }) {
18
+ return /*#__PURE__*/ _jsxs("div", {
19
+ className: cn(theme.stat.cell, tone ? theme.badge[tone] : undefined),
20
+ children: [
21
+ /*#__PURE__*/ _jsx("span", {
22
+ className: theme.stat.value,
23
+ children: value
24
+ }),
25
+ /*#__PURE__*/ _jsx("span", {
26
+ className: theme.stat.label,
27
+ children: label
28
+ })
29
+ ]
30
+ });
31
+ }
32
+ /**
33
+ * Something the operator has to read before acting.
34
+ *
35
+ * A danger notice is announced immediately because it is the one that reports a
36
+ * write that failed or is about to delete rows; the calmer tones wait their turn.
37
+ */ export function Notice({ tone, title, children }) {
38
+ return /*#__PURE__*/ _jsxs("section", {
39
+ className: theme.notice[tone],
40
+ role: tone === 'danger' ? 'alert' : 'status',
41
+ children: [
42
+ /*#__PURE__*/ _jsx("p", {
43
+ className: theme.notice.title,
44
+ children: title
45
+ }),
46
+ children ? /*#__PURE__*/ _jsx("div", {
47
+ className: theme.notice.body,
48
+ children: children
49
+ }) : null
50
+ ]
51
+ });
52
+ }
53
+ /**
54
+ * A labelled control.
55
+ *
56
+ * The hint and the error carry ids derived from the control's own id so the
57
+ * caller can point `aria-describedby` at them; the label is not optional,
58
+ * because a form of unlabelled boxes is unusable with a screen reader.
59
+ */ export function Field({ label, htmlFor, hint, error, children }) {
60
+ return /*#__PURE__*/ _jsxs("div", {
61
+ className: theme.field.wrapper,
62
+ children: [
63
+ /*#__PURE__*/ _jsx("label", {
64
+ className: theme.field.label,
65
+ htmlFor: htmlFor,
66
+ children: label
67
+ }),
68
+ children,
69
+ hint ? /*#__PURE__*/ _jsx("span", {
70
+ className: theme.field.hint,
71
+ id: `${htmlFor}-hint`,
72
+ children: hint
73
+ }) : null,
74
+ error ? /*#__PURE__*/ _jsx("span", {
75
+ className: theme.field.error,
76
+ id: `${htmlFor}-error`,
77
+ children: error
78
+ }) : null
79
+ ]
80
+ });
81
+ }
82
+ /**
83
+ * One line of verbatim text — a URL, a JSON path, a header name.
84
+ *
85
+ * It scrolls sideways instead of wrapping: a wrapped path invites the reader to
86
+ * copy a line break into a field where it will silently break the request.
87
+ */ export function CodeBlock({ children }) {
88
+ return /*#__PURE__*/ _jsx("pre", {
89
+ className: cn(theme.code, 'whitespace-pre'),
90
+ children: /*#__PURE__*/ _jsx("code", {
91
+ children: children
92
+ })
93
+ });
94
+ }
@@ -0,0 +1,10 @@
1
+ export type RunConfirmStepProps = {
2
+ /** One line per destructive effect, already counted where a plan allowed it. */
3
+ lines: string[];
4
+ /** False when the operator skipped the preview, so the lines carry no counts. */
5
+ counted: boolean;
6
+ working: boolean;
7
+ onConfirm: () => void;
8
+ onDismiss: () => void;
9
+ };
10
+ export declare function RunConfirmStep({ lines, counted, working, onConfirm, onDismiss, }: RunConfirmStepProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,48 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { integrationsPageTheme } from '../theme';
4
+ import { Notice } from './Primitives';
5
+ /**
6
+ * The step between "Run import" and a destroyed table.
7
+ *
8
+ * It appears only when the server says the run needs confirming, and it says what
9
+ * goes away with a NUMBER in front of it. A confirmation that reads "are you
10
+ * sure?" transfers no information, so this one refuses to be that.
11
+ */ const theme = integrationsPageTheme;
12
+ export function RunConfirmStep({ lines, counted, working, onConfirm, onDismiss }) {
13
+ return /*#__PURE__*/ _jsxs(Notice, {
14
+ tone: "danger",
15
+ title: "This import destroys data. Read what it removes, then confirm.",
16
+ children: [
17
+ /*#__PURE__*/ _jsx("ul", {
18
+ className: "flex list-disc flex-col gap-1 pl-5",
19
+ children: lines.map((line)=>/*#__PURE__*/ _jsx("li", {
20
+ children: line
21
+ }, line))
22
+ }),
23
+ counted ? null : /*#__PURE__*/ _jsx("p", {
24
+ className: "mt-2",
25
+ children: "These counts are unknown because nothing was previewed. Run a preview first if you want to know how many rows this removes before it removes them."
26
+ }),
27
+ /*#__PURE__*/ _jsxs("div", {
28
+ className: "mt-3 flex flex-wrap items-center gap-2",
29
+ children: [
30
+ /*#__PURE__*/ _jsx("button", {
31
+ className: theme.button.danger,
32
+ disabled: working,
33
+ onClick: onConfirm,
34
+ type: "button",
35
+ children: working ? 'Starting…' : 'Run it and remove those rows'
36
+ }),
37
+ /*#__PURE__*/ _jsx("button", {
38
+ className: theme.button.secondary,
39
+ disabled: working,
40
+ onClick: onDismiss,
41
+ type: "button",
42
+ children: "Keep them, do not run"
43
+ })
44
+ ]
45
+ })
46
+ ]
47
+ });
48
+ }
@@ -0,0 +1,10 @@
1
+ import type { IntegrationsActions } from '../types';
2
+ export type RunHistoryProps = {
3
+ actions: IntegrationsActions;
4
+ /** Scopes the history to one mapping. Null lists the runs of every mapping. */
5
+ mappingId: string | null;
6
+ /** Bumped by the caller after a run finishes or is undone; refetches page 1. */
7
+ refreshKey: number;
8
+ onRefresh: () => void;
9
+ };
10
+ export declare function RunHistory({ actions, mappingId, refreshKey, onRefresh }: RunHistoryProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,124 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useEffectEvent } from 'react';
4
+ import { useIntegrationsStore } from '../store';
5
+ import { integrationsPageTheme } from '../theme';
6
+ import { Notice } from './Primitives';
7
+ import { RunHistoryRow } from './RunHistoryRow';
8
+ import { ListSkeleton } from './Skeletons';
9
+ import { useInfiniteList } from './useInfiniteList';
10
+ /**
11
+ * Every run, newest first, one page at a time.
12
+ *
13
+ * The server pages, sorts and scopes it — nothing is filtered here, so a table
14
+ * with a hundred thousand runs behaves exactly like a table with ten. The
15
+ * sentinel at the bottom is what asks for the next page.
16
+ */ const theme = integrationsPageTheme;
17
+ const PAGE_SIZE = 20;
18
+ export function RunHistory({ actions, mappingId, refreshKey, onRefresh }) {
19
+ const store = useIntegrationsStore();
20
+ const list = useInfiniteList({
21
+ load: (page)=>actions.listRuns({
22
+ page,
23
+ limit: PAGE_SIZE,
24
+ sort: [
25
+ {
26
+ field: 'createdAt',
27
+ direction: 'desc'
28
+ }
29
+ ],
30
+ ...mappingId ? {
31
+ mappingId
32
+ } : {}
33
+ }).then((result)=>({
34
+ items: result.items,
35
+ total: result.meta?.totalItems ?? result.items.length
36
+ })),
37
+ deps: [
38
+ mappingId,
39
+ refreshKey
40
+ ],
41
+ pageSize: PAGE_SIZE
42
+ });
43
+ // Mirrored into the store so the tab strip can show how many runs there are.
44
+ // Without this the counter read 0 forever, which on the one tab that exists to
45
+ // show history is worse than showing nothing.
46
+ const publishRuns = useEffectEvent(()=>{
47
+ store.setRuns(list.items, list.total);
48
+ });
49
+ const publishLoading = useEffectEvent(()=>{
50
+ store.setRunsLoading(list.loading);
51
+ });
52
+ useEffect(()=>{
53
+ publishRuns();
54
+ }, [
55
+ list.items,
56
+ list.total
57
+ ]);
58
+ useEffect(()=>{
59
+ publishLoading();
60
+ }, [
61
+ list.loading
62
+ ]);
63
+ const firstPagePending = list.loading && list.items.length === 0;
64
+ return /*#__PURE__*/ _jsxs("section", {
65
+ className: theme.card.wrapper,
66
+ children: [
67
+ /*#__PURE__*/ _jsxs("header", {
68
+ className: theme.card.header,
69
+ children: [
70
+ /*#__PURE__*/ _jsx("h3", {
71
+ className: theme.card.title,
72
+ children: "History"
73
+ }),
74
+ /*#__PURE__*/ _jsx("span", {
75
+ className: theme.field.hint,
76
+ children: mappingId ? `${list.total} run(s) for this mapping` : `${list.total} run(s)`
77
+ })
78
+ ]
79
+ }),
80
+ /*#__PURE__*/ _jsxs("div", {
81
+ className: theme.card.body,
82
+ children: [
83
+ firstPagePending ? /*#__PURE__*/ _jsx(ListSkeleton, {
84
+ rows: 4
85
+ }) : null,
86
+ list.error ? /*#__PURE__*/ _jsxs(Notice, {
87
+ title: "This list could not be loaded",
88
+ tone: "danger",
89
+ children: [
90
+ list.error,
91
+ ' ',
92
+ /*#__PURE__*/ _jsx("button", {
93
+ className: theme.button.ghost,
94
+ onClick: list.reload,
95
+ type: "button",
96
+ children: "Try again"
97
+ })
98
+ ]
99
+ }) : null,
100
+ !firstPagePending && list.items.length === 0 && !list.error ? /*#__PURE__*/ _jsx("p", {
101
+ className: theme.list.empty,
102
+ children: "Nothing has run yet. A preview writes nothing; the first entry appears here once an import is started."
103
+ }) : null,
104
+ list.items.length > 0 ? /*#__PURE__*/ _jsx("ul", {
105
+ className: theme.list.wrapper,
106
+ children: list.items.map((run)=>/*#__PURE__*/ _jsx(RunHistoryRow, {
107
+ actions: actions,
108
+ onReverted: onRefresh,
109
+ run: run
110
+ }, run.id))
111
+ }) : null,
112
+ list.loading && list.items.length > 0 ? /*#__PURE__*/ _jsx(ListSkeleton, {
113
+ rows: 2
114
+ }) : null,
115
+ /*#__PURE__*/ _jsx("div", {
116
+ "aria-hidden": "true",
117
+ className: theme.list.sentinel,
118
+ ref: list.sentinelRef
119
+ })
120
+ ]
121
+ })
122
+ ]
123
+ });
124
+ }
@@ -0,0 +1,7 @@
1
+ import type { IntegrationRun, IntegrationsActions } from '../types';
2
+ export type RunHistoryRowProps = {
3
+ run: IntegrationRun;
4
+ actions: IntegrationsActions;
5
+ onReverted: () => void;
6
+ };
7
+ export declare function RunHistoryRow({ run, actions, onReverted }: RunHistoryRowProps): import("react/jsx-runtime").JSX.Element;