nucleus-core-ts 0.9.837 → 0.9.839
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.
- package/dist/fe/components/IntegrationsPage/components/ConnectionList.js +11 -13
- package/dist/fe/components/IntegrationsPage/components/ConnectionTransfer.js +17 -16
- package/dist/fe/components/IntegrationsPage/components/MappingAccountFields.js +130 -0
- package/dist/fe/components/IntegrationsPage/types/records.d.ts +11 -0
- package/dist/index.js +1 -1
- package/dist/src/Services/Integrations/plan.d.ts +3 -1
- package/dist/src/Services/Integrations/transfer.d.ts +8 -0
- package/dist/src/Services/Integrations/types.d.ts +27 -0
- package/package.json +1 -1
|
@@ -81,9 +81,10 @@ export function ConnectionList({ actions, onNewConnection, reloadToken = 0 }) {
|
|
|
81
81
|
className: theme.layout.aside,
|
|
82
82
|
children: [
|
|
83
83
|
/*#__PURE__*/ _jsxs("div", {
|
|
84
|
-
className:
|
|
84
|
+
className: "flex flex-col gap-2 border-slate-200 border-b pb-3 dark:border-slate-800",
|
|
85
85
|
children: [
|
|
86
86
|
/*#__PURE__*/ _jsxs("div", {
|
|
87
|
+
className: "min-w-0",
|
|
87
88
|
children: [
|
|
88
89
|
/*#__PURE__*/ _jsx("h2", {
|
|
89
90
|
className: theme.header.title,
|
|
@@ -95,21 +96,18 @@ export function ConnectionList({ actions, onNewConnection, reloadToken = 0 }) {
|
|
|
95
96
|
})
|
|
96
97
|
]
|
|
97
98
|
}),
|
|
98
|
-
/*#__PURE__*/ _jsx("
|
|
99
|
-
className: theme.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
/*#__PURE__*/ _jsx("button", {
|
|
100
|
+
className: cn(theme.button.primary, 'w-full justify-center whitespace-nowrap'),
|
|
101
|
+
onClick: handleNew,
|
|
102
|
+
type: "button",
|
|
103
|
+
children: labels.connections.create
|
|
104
|
+
}),
|
|
105
|
+
/*#__PURE__*/ _jsx(ConnectionTransfer, {
|
|
106
|
+
actions: actions,
|
|
107
|
+
onImported: list.reload
|
|
106
108
|
})
|
|
107
109
|
]
|
|
108
110
|
}),
|
|
109
|
-
/*#__PURE__*/ _jsx(ConnectionTransfer, {
|
|
110
|
-
actions: actions,
|
|
111
|
-
onImported: list.reload
|
|
112
|
-
}),
|
|
113
111
|
/*#__PURE__*/ _jsx(Field, {
|
|
114
112
|
htmlFor: "connection-search",
|
|
115
113
|
label: labels.connections.searchLabel,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useRef, useState } from 'react';
|
|
4
|
+
import { cn } from '../../../utils/cn';
|
|
4
5
|
import { useIntegrationsStore } from '../store';
|
|
5
6
|
import { integrationsPageTheme } from '../theme';
|
|
6
7
|
import { Notice } from './Primitives';
|
|
@@ -97,10 +98,10 @@ export function ConnectionTransfer({ actions, onImported }) {
|
|
|
97
98
|
className: "flex flex-col gap-2",
|
|
98
99
|
children: [
|
|
99
100
|
/*#__PURE__*/ _jsxs("div", {
|
|
100
|
-
className: "
|
|
101
|
+
className: "grid grid-cols-2 gap-2",
|
|
101
102
|
children: [
|
|
102
103
|
/*#__PURE__*/ _jsx("button", {
|
|
103
|
-
className: theme.button.secondary,
|
|
104
|
+
className: cn(theme.button.secondary, 'w-full justify-center whitespace-nowrap'),
|
|
104
105
|
disabled: busy || !selected,
|
|
105
106
|
onClick: exportOne,
|
|
106
107
|
title: selected ? `Export ${selected.name} — its calls and mappings, without any credential` : 'Choose a connection to export',
|
|
@@ -108,27 +109,27 @@ export function ConnectionTransfer({ actions, onImported }) {
|
|
|
108
109
|
children: busy ? 'Working…' : 'Export'
|
|
109
110
|
}),
|
|
110
111
|
/*#__PURE__*/ _jsx("button", {
|
|
111
|
-
className: theme.button.secondary,
|
|
112
|
+
className: cn(theme.button.secondary, 'w-full justify-center whitespace-nowrap'),
|
|
112
113
|
disabled: busy,
|
|
113
114
|
onClick: ()=>fileRef.current?.click(),
|
|
114
115
|
type: "button",
|
|
115
116
|
children: "Import"
|
|
116
|
-
}),
|
|
117
|
-
/*#__PURE__*/ _jsx("input", {
|
|
118
|
-
accept: "application/json,.json",
|
|
119
|
-
className: "hidden",
|
|
120
|
-
onChange: (event)=>{
|
|
121
|
-
const file = event.target.files?.[0];
|
|
122
|
-
// Cleared so choosing the same file twice fires again — the second
|
|
123
|
-
// attempt is usually the one after fixing something.
|
|
124
|
-
event.target.value = '';
|
|
125
|
-
if (file) importFile(file);
|
|
126
|
-
},
|
|
127
|
-
ref: fileRef,
|
|
128
|
-
type: "file"
|
|
129
117
|
})
|
|
130
118
|
]
|
|
131
119
|
}),
|
|
120
|
+
/*#__PURE__*/ _jsx("input", {
|
|
121
|
+
accept: "application/json,.json",
|
|
122
|
+
className: "hidden",
|
|
123
|
+
onChange: (event)=>{
|
|
124
|
+
const file = event.target.files?.[0];
|
|
125
|
+
// Cleared so choosing the same file twice fires again — the second
|
|
126
|
+
// attempt is usually the one after fixing something.
|
|
127
|
+
event.target.value = '';
|
|
128
|
+
if (file) importFile(file);
|
|
129
|
+
},
|
|
130
|
+
ref: fileRef,
|
|
131
|
+
type: "file"
|
|
132
|
+
}),
|
|
132
133
|
note ? /*#__PURE__*/ _jsx("p", {
|
|
133
134
|
className: theme.field.hint,
|
|
134
135
|
children: note
|
|
@@ -199,6 +199,136 @@ export function MappingAccountFields({ value, targetFields, targets, disabled, o
|
|
|
199
199
|
})
|
|
200
200
|
]
|
|
201
201
|
}),
|
|
202
|
+
/*#__PURE__*/ _jsxs("section", {
|
|
203
|
+
className: "flex flex-col gap-2",
|
|
204
|
+
children: [
|
|
205
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
206
|
+
className: "flex flex-wrap items-center justify-between gap-2",
|
|
207
|
+
children: [
|
|
208
|
+
/*#__PURE__*/ _jsx("span", {
|
|
209
|
+
className: theme.field.label,
|
|
210
|
+
children: "What each new account is a member of"
|
|
211
|
+
}),
|
|
212
|
+
/*#__PURE__*/ _jsx("button", {
|
|
213
|
+
className: theme.button.ghost,
|
|
214
|
+
disabled: disabled,
|
|
215
|
+
onClick: ()=>patch({
|
|
216
|
+
joins: [
|
|
217
|
+
...value.joins ?? [],
|
|
218
|
+
{
|
|
219
|
+
entity: '',
|
|
220
|
+
accountColumn: '',
|
|
221
|
+
values: {}
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
}),
|
|
225
|
+
type: "button",
|
|
226
|
+
children: "Add a membership"
|
|
227
|
+
})
|
|
228
|
+
]
|
|
229
|
+
}),
|
|
230
|
+
(value.joins ?? []).length === 0 ? /*#__PURE__*/ _jsx("p", {
|
|
231
|
+
className: theme.field.hint,
|
|
232
|
+
children: "Nothing. An account with no role can sign in and do nothing — every screen it reaches refuses it. A role usually lives in its own table, joined to the account, which is what this adds."
|
|
233
|
+
}) : null,
|
|
234
|
+
(value.joins ?? []).map((join, joinIndex)=>{
|
|
235
|
+
const joinEntity = targets.find((target)=>target.entity === join.entity);
|
|
236
|
+
const pair = Object.entries(join.values)[0] ?? [
|
|
237
|
+
'',
|
|
238
|
+
''
|
|
239
|
+
];
|
|
240
|
+
const setJoin = (next)=>patch({
|
|
241
|
+
joins: (value.joins ?? []).with(joinIndex, {
|
|
242
|
+
...join,
|
|
243
|
+
...next
|
|
244
|
+
})
|
|
245
|
+
});
|
|
246
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
247
|
+
className: "grid grid-cols-1 gap-2 sm:grid-cols-[1fr_1fr_1fr_1fr_auto]",
|
|
248
|
+
children: [
|
|
249
|
+
/*#__PURE__*/ _jsxs("select", {
|
|
250
|
+
className: theme.field.input,
|
|
251
|
+
disabled: disabled,
|
|
252
|
+
onChange: (event)=>setJoin({
|
|
253
|
+
entity: event.target.value,
|
|
254
|
+
accountColumn: '',
|
|
255
|
+
values: {}
|
|
256
|
+
}),
|
|
257
|
+
value: join.entity,
|
|
258
|
+
children: [
|
|
259
|
+
/*#__PURE__*/ _jsx("option", {
|
|
260
|
+
value: "",
|
|
261
|
+
children: "Membership table…"
|
|
262
|
+
}),
|
|
263
|
+
targets.map((target)=>/*#__PURE__*/ _jsx("option", {
|
|
264
|
+
value: target.entity,
|
|
265
|
+
children: target.label
|
|
266
|
+
}, target.entity))
|
|
267
|
+
]
|
|
268
|
+
}),
|
|
269
|
+
/*#__PURE__*/ _jsxs("select", {
|
|
270
|
+
className: theme.field.input,
|
|
271
|
+
disabled: disabled || !joinEntity,
|
|
272
|
+
onChange: (event)=>setJoin({
|
|
273
|
+
accountColumn: event.target.value
|
|
274
|
+
}),
|
|
275
|
+
value: join.accountColumn,
|
|
276
|
+
children: [
|
|
277
|
+
/*#__PURE__*/ _jsx("option", {
|
|
278
|
+
value: "",
|
|
279
|
+
children: "…account id column"
|
|
280
|
+
}),
|
|
281
|
+
(joinEntity?.fields ?? []).map((field)=>/*#__PURE__*/ _jsx("option", {
|
|
282
|
+
value: field,
|
|
283
|
+
children: field
|
|
284
|
+
}, field))
|
|
285
|
+
]
|
|
286
|
+
}),
|
|
287
|
+
/*#__PURE__*/ _jsxs("select", {
|
|
288
|
+
className: theme.field.input,
|
|
289
|
+
disabled: disabled || !joinEntity,
|
|
290
|
+
onChange: (event)=>setJoin({
|
|
291
|
+
values: {
|
|
292
|
+
[event.target.value]: pair[1] ?? ''
|
|
293
|
+
}
|
|
294
|
+
}),
|
|
295
|
+
value: pair[0],
|
|
296
|
+
children: [
|
|
297
|
+
/*#__PURE__*/ _jsx("option", {
|
|
298
|
+
value: "",
|
|
299
|
+
children: "…and this column"
|
|
300
|
+
}),
|
|
301
|
+
(joinEntity?.fields ?? []).map((field)=>/*#__PURE__*/ _jsx("option", {
|
|
302
|
+
value: field,
|
|
303
|
+
children: field
|
|
304
|
+
}, field))
|
|
305
|
+
]
|
|
306
|
+
}),
|
|
307
|
+
/*#__PURE__*/ _jsx("input", {
|
|
308
|
+
className: theme.field.input,
|
|
309
|
+
disabled: disabled || !pair[0],
|
|
310
|
+
onChange: (event)=>setJoin({
|
|
311
|
+
values: {
|
|
312
|
+
[pair[0]]: event.target.value
|
|
313
|
+
}
|
|
314
|
+
}),
|
|
315
|
+
placeholder: "…set to this value",
|
|
316
|
+
value: String(pair[1] ?? '')
|
|
317
|
+
}),
|
|
318
|
+
/*#__PURE__*/ _jsx("button", {
|
|
319
|
+
className: theme.button.ghost,
|
|
320
|
+
disabled: disabled,
|
|
321
|
+
onClick: ()=>patch({
|
|
322
|
+
joins: (value.joins ?? []).toSpliced(joinIndex, 1)
|
|
323
|
+
}),
|
|
324
|
+
type: "button",
|
|
325
|
+
children: "Remove"
|
|
326
|
+
})
|
|
327
|
+
]
|
|
328
|
+
}, joinIndex);
|
|
329
|
+
})
|
|
330
|
+
]
|
|
331
|
+
}),
|
|
202
332
|
/*#__PURE__*/ _jsx(Notice, {
|
|
203
333
|
title: "One password, typed on the import screen",
|
|
204
334
|
tone: "info",
|
|
@@ -144,6 +144,17 @@ export type AccountRuleValue = {
|
|
|
144
144
|
column: string;
|
|
145
145
|
from: string;
|
|
146
146
|
}[];
|
|
147
|
+
/**
|
|
148
|
+
* Rows added in another table for each account — a role, usually.
|
|
149
|
+
*
|
|
150
|
+
* An account with no role can sign in and do nothing. A membership is not a
|
|
151
|
+
* column on the account, so it cannot be expressed as one.
|
|
152
|
+
*/
|
|
153
|
+
joins?: {
|
|
154
|
+
entity: string;
|
|
155
|
+
accountColumn: string;
|
|
156
|
+
values: Record<string, unknown>;
|
|
157
|
+
}[];
|
|
147
158
|
};
|
|
148
159
|
export type IntegrationMapping = {
|
|
149
160
|
id: string;
|