@burdenoff/microfe-integrations 2026.810.1 → 2026.810.2
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/generated/wspace-operations.d.ts +36 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +98 -81
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/integrations/components/AddConnectionDialog.d.ts.map +1 -1
- package/dist/integrations/components/AddConnectionDialog.js +231 -201
- package/dist/integrations/components/AddConnectionDialog.js.map +1 -1
- package/dist/integrations/components/AuthMethodSelector.d.ts +17 -0
- package/dist/integrations/components/AuthMethodSelector.d.ts.map +1 -1
- package/dist/integrations/components/AuthMethodSelector.js +45 -40
- package/dist/integrations/components/AuthMethodSelector.js.map +1 -1
- package/dist/integrations/components/CredentialStorageSelector.d.ts.map +1 -1
- package/dist/integrations/components/CredentialStorageSelector.js +151 -59
- package/dist/integrations/components/CredentialStorageSelector.js.map +1 -1
- package/dist/integrations/constants/permissions.d.ts +1 -0
- package/dist/integrations/constants/permissions.d.ts.map +1 -1
- package/dist/integrations/constants/permissions.js +2 -1
- package/dist/integrations/constants/permissions.js.map +1 -1
- package/dist/integrations/hooks/useCredentialVaults.d.ts +19 -0
- package/dist/integrations/hooks/useCredentialVaults.d.ts.map +1 -1
- package/dist/integrations/hooks/useCredentialVaults.js +43 -22
- package/dist/integrations/hooks/useCredentialVaults.js.map +1 -1
- package/dist/integrations/pages/ProviderDetail.d.ts.map +1 -1
- package/dist/integrations/pages/ProviderDetail.js +1 -1
- package/dist/integrations/pages/ProviderDetail.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,83 +1,158 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { INTEGRATION_PERMISSIONS as e } from "../constants/permissions.js";
|
|
2
|
+
import { useCreateCredentialVault as t, useCredentialVaults as n, useVaultSecrets as r } from "../hooks/useCredentialVaults.js";
|
|
3
|
+
import { useId as i, useState as a } from "react";
|
|
4
|
+
import { AlertCircle as o, Database as s, FolderKey as c, KeyRound as l, Loader2 as u, Plus as d, X as f } from "lucide-react";
|
|
5
|
+
import { usePermissions as p } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
6
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
5
7
|
//#region src/integrations/components/CredentialStorageSelector.tsx
|
|
6
|
-
function
|
|
7
|
-
let { vaults:
|
|
8
|
-
|
|
8
|
+
function _({ value: _, onChange: v, providerAuthType: y }) {
|
|
9
|
+
let { vaults: b, loading: x, refetch: S } = n(), { secrets: C, loading: w } = r(_.vaultId || null, y), { createVault: T, creating: E, error: D, clearError: O } = t(), { hasPermission: k, isLoading: A } = p(), j = !A && k(e.VAULT_CREATE), [M, N] = a(!1), [P, F] = a(""), I = i(), L = `${I}-vault`, R = `${I}-new-vault`, z = `${I}-managed-name`, B = `${I}-existing-secret`, V = () => {
|
|
10
|
+
O(), F(""), N(!0);
|
|
11
|
+
}, H = async () => {
|
|
12
|
+
if (!P.trim()) return;
|
|
13
|
+
let e = await T(P);
|
|
14
|
+
e && (F(""), await S(), v((t) => ({
|
|
15
|
+
...t,
|
|
16
|
+
vaultId: e.id,
|
|
17
|
+
secretId: ""
|
|
18
|
+
})), N(!1));
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ g("div", {
|
|
9
21
|
className: "rounded-xl border border-border-subtle/50 bg-bg-surface p-4 space-y-4",
|
|
10
22
|
children: [
|
|
11
|
-
/* @__PURE__ */
|
|
23
|
+
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ g("h3", {
|
|
12
24
|
className: "text-sm font-semibold text-text-primary flex items-center gap-2",
|
|
13
|
-
children: [/* @__PURE__ */ s
|
|
25
|
+
children: [/* @__PURE__ */ h(s, {
|
|
14
26
|
size: 16,
|
|
15
27
|
className: "text-primary"
|
|
16
28
|
}), "Credential Storage"]
|
|
17
|
-
}), /* @__PURE__ */
|
|
29
|
+
}), /* @__PURE__ */ h("p", {
|
|
18
30
|
className: "text-xs text-text-secondary mt-1",
|
|
19
31
|
children: "Connections use vault-managed secrets by default. You can also reuse an existing compatible secret."
|
|
20
32
|
})] }),
|
|
21
|
-
/* @__PURE__ */
|
|
33
|
+
/* @__PURE__ */ g("div", {
|
|
22
34
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-3",
|
|
23
|
-
children: [/* @__PURE__ */
|
|
35
|
+
children: [/* @__PURE__ */ g("button", {
|
|
24
36
|
type: "button",
|
|
25
|
-
onClick: () =>
|
|
37
|
+
onClick: () => v((e) => ({
|
|
26
38
|
...e,
|
|
27
39
|
mode: "managed",
|
|
28
40
|
secretId: ""
|
|
29
41
|
})),
|
|
30
|
-
className: `rounded-xl border px-4 py-3 text-left transition-colors ${
|
|
31
|
-
children: [/* @__PURE__ */
|
|
42
|
+
className: `rounded-xl border px-4 py-3 text-left transition-colors ${_.mode === "managed" ? "border-primary bg-action-primary-bg/5" : "border-border-subtle hover:border-primary/40 hover:bg-accent/30"}`,
|
|
43
|
+
children: [/* @__PURE__ */ g("div", {
|
|
32
44
|
className: "flex items-center gap-2 text-sm font-medium text-text-primary",
|
|
33
|
-
children: [/* @__PURE__ */
|
|
45
|
+
children: [/* @__PURE__ */ h(c, {
|
|
34
46
|
size: 16,
|
|
35
47
|
className: "text-primary"
|
|
36
48
|
}), "Dedicated secret"]
|
|
37
|
-
}), /* @__PURE__ */
|
|
49
|
+
}), /* @__PURE__ */ h("p", {
|
|
38
50
|
className: "text-xs text-text-secondary mt-1",
|
|
39
51
|
children: "Create and own a vault secret for this connection."
|
|
40
52
|
})]
|
|
41
|
-
}), /* @__PURE__ */
|
|
53
|
+
}), /* @__PURE__ */ g("button", {
|
|
42
54
|
type: "button",
|
|
43
|
-
onClick: () =>
|
|
55
|
+
onClick: () => v((e) => ({
|
|
44
56
|
...e,
|
|
45
57
|
mode: "existing"
|
|
46
58
|
})),
|
|
47
|
-
className: `rounded-xl border px-4 py-3 text-left transition-colors ${
|
|
48
|
-
children: [/* @__PURE__ */
|
|
59
|
+
className: `rounded-xl border px-4 py-3 text-left transition-colors ${_.mode === "existing" ? "border-primary bg-action-primary-bg/5" : "border-border-subtle hover:border-primary/40 hover:bg-accent/30"}`,
|
|
60
|
+
children: [/* @__PURE__ */ g("div", {
|
|
49
61
|
className: "flex items-center gap-2 text-sm font-medium text-text-primary",
|
|
50
|
-
children: [/* @__PURE__ */
|
|
62
|
+
children: [/* @__PURE__ */ h(l, {
|
|
51
63
|
size: 16,
|
|
52
64
|
className: "text-primary"
|
|
53
65
|
}), "Existing secret"]
|
|
54
|
-
}), /* @__PURE__ */
|
|
66
|
+
}), /* @__PURE__ */ h("p", {
|
|
55
67
|
className: "text-xs text-text-secondary mt-1",
|
|
56
68
|
children: "Reference an already stored secret from the vault."
|
|
57
69
|
})]
|
|
58
70
|
})]
|
|
59
71
|
}),
|
|
60
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ g("div", {
|
|
61
73
|
className: "space-y-2",
|
|
62
|
-
children: [/* @__PURE__ */
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
children: [/* @__PURE__ */ g("div", {
|
|
75
|
+
className: "flex items-center justify-between gap-2",
|
|
76
|
+
children: [/* @__PURE__ */ h("label", {
|
|
77
|
+
htmlFor: L,
|
|
78
|
+
className: "block text-xs font-semibold text-text-primary uppercase tracking-wide",
|
|
79
|
+
children: "Vault"
|
|
80
|
+
}), !M && j && /* @__PURE__ */ g("button", {
|
|
81
|
+
type: "button",
|
|
82
|
+
onClick: V,
|
|
83
|
+
className: "inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline",
|
|
84
|
+
children: [/* @__PURE__ */ h(d, { size: 13 }), " New vault"]
|
|
85
|
+
})]
|
|
86
|
+
}), M ? /* @__PURE__ */ g("div", {
|
|
87
|
+
className: "rounded-lg border border-primary/40 bg-action-primary-bg/5 p-3 space-y-2",
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ g("div", {
|
|
90
|
+
className: "flex items-center justify-between gap-2",
|
|
91
|
+
children: [/* @__PURE__ */ h("label", {
|
|
92
|
+
htmlFor: R,
|
|
93
|
+
className: "text-xs font-medium text-text-primary",
|
|
94
|
+
children: "New vault name"
|
|
95
|
+
}), /* @__PURE__ */ h("button", {
|
|
96
|
+
type: "button",
|
|
97
|
+
onClick: () => N(!1),
|
|
98
|
+
"aria-label": "Cancel creating a vault",
|
|
99
|
+
className: "text-text-secondary hover:text-text-primary",
|
|
100
|
+
children: /* @__PURE__ */ h(f, { size: 14 })
|
|
101
|
+
})]
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ h("input", {
|
|
104
|
+
id: R,
|
|
105
|
+
"aria-label": "New vault name",
|
|
106
|
+
type: "text",
|
|
107
|
+
value: P,
|
|
108
|
+
autoFocus: !0,
|
|
109
|
+
onChange: (e) => F(e.target.value),
|
|
110
|
+
onKeyDown: (e) => {
|
|
111
|
+
e.key === "Enter" && (e.preventDefault(), H());
|
|
112
|
+
},
|
|
113
|
+
placeholder: "e.g. Integrations",
|
|
114
|
+
disabled: E,
|
|
115
|
+
className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50"
|
|
116
|
+
}),
|
|
117
|
+
D && /* @__PURE__ */ g("p", {
|
|
118
|
+
className: "flex items-center gap-1.5 text-xs text-status-error-text",
|
|
119
|
+
children: [/* @__PURE__ */ h(o, {
|
|
120
|
+
size: 13,
|
|
121
|
+
className: "flex-shrink-0"
|
|
122
|
+
}), D]
|
|
123
|
+
}),
|
|
124
|
+
/* @__PURE__ */ g("div", {
|
|
125
|
+
className: "flex items-center gap-2",
|
|
126
|
+
children: [/* @__PURE__ */ g("button", {
|
|
127
|
+
type: "button",
|
|
128
|
+
onClick: () => void H(),
|
|
129
|
+
disabled: E || !P.trim(),
|
|
130
|
+
className: "inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-1.5 text-xs font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-50",
|
|
131
|
+
children: [E ? /* @__PURE__ */ h(u, {
|
|
132
|
+
size: 13,
|
|
133
|
+
className: "animate-spin"
|
|
134
|
+
}) : /* @__PURE__ */ h(d, { size: 13 }), "Create vault"]
|
|
135
|
+
}), /* @__PURE__ */ h("span", {
|
|
136
|
+
className: "text-xs text-text-secondary",
|
|
137
|
+
children: "Scoped to this workspace."
|
|
138
|
+
})]
|
|
139
|
+
})
|
|
140
|
+
]
|
|
141
|
+
}) : /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("div", {
|
|
67
142
|
className: "relative",
|
|
68
|
-
children: [/* @__PURE__ */
|
|
69
|
-
id:
|
|
70
|
-
value:
|
|
71
|
-
onChange: (e) =>
|
|
143
|
+
children: [/* @__PURE__ */ g("select", {
|
|
144
|
+
id: L,
|
|
145
|
+
value: _.vaultId,
|
|
146
|
+
onChange: (e) => v((t) => ({
|
|
72
147
|
...t,
|
|
73
148
|
vaultId: e.target.value,
|
|
74
149
|
secretId: ""
|
|
75
150
|
})),
|
|
76
151
|
className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary",
|
|
77
|
-
children: [/* @__PURE__ */
|
|
152
|
+
children: [/* @__PURE__ */ h("option", {
|
|
78
153
|
value: "",
|
|
79
154
|
children: "Select a vault"
|
|
80
|
-
}),
|
|
155
|
+
}), b.map((e) => /* @__PURE__ */ g("option", {
|
|
81
156
|
value: e.id,
|
|
82
157
|
children: [
|
|
83
158
|
e.name,
|
|
@@ -86,60 +161,77 @@ function l({ value: l, onChange: u, providerAuthType: d }) {
|
|
|
86
161
|
")"
|
|
87
162
|
]
|
|
88
163
|
}, e.id))]
|
|
89
|
-
}),
|
|
164
|
+
}), x && /* @__PURE__ */ h(u, {
|
|
90
165
|
size: 16,
|
|
91
166
|
className: "absolute right-3 top-3 animate-spin text-text-secondary"
|
|
92
167
|
})]
|
|
93
|
-
})
|
|
168
|
+
}), !x && b.length === 0 && (j ? /* @__PURE__ */ g("p", {
|
|
169
|
+
className: "text-xs text-text-secondary",
|
|
170
|
+
children: [
|
|
171
|
+
"No vaults yet.",
|
|
172
|
+
" ",
|
|
173
|
+
/* @__PURE__ */ h("button", {
|
|
174
|
+
type: "button",
|
|
175
|
+
onClick: V,
|
|
176
|
+
className: "font-medium text-primary hover:underline",
|
|
177
|
+
children: "Create one"
|
|
178
|
+
}),
|
|
179
|
+
" ",
|
|
180
|
+
"to store this connection’s credentials."
|
|
181
|
+
]
|
|
182
|
+
}) : /* @__PURE__ */ h("p", {
|
|
183
|
+
className: "text-xs text-text-secondary",
|
|
184
|
+
children: "No vaults yet. Ask an administrator to create one — a connection needs a vault to store its credentials."
|
|
185
|
+
}))] })]
|
|
94
186
|
}),
|
|
95
|
-
|
|
187
|
+
_.mode === "managed" ? /* @__PURE__ */ g("div", {
|
|
96
188
|
className: "space-y-2",
|
|
97
189
|
children: [
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
htmlFor:
|
|
190
|
+
/* @__PURE__ */ h("label", {
|
|
191
|
+
htmlFor: z,
|
|
100
192
|
className: "block text-xs font-semibold text-text-primary uppercase tracking-wide",
|
|
101
193
|
children: "Managed secret name"
|
|
102
194
|
}),
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
id:
|
|
195
|
+
/* @__PURE__ */ h("input", {
|
|
196
|
+
id: z,
|
|
105
197
|
"aria-label": "Managed secret name",
|
|
106
198
|
type: "text",
|
|
107
|
-
value:
|
|
108
|
-
onChange: (e) =>
|
|
199
|
+
value: _.managedSecretName,
|
|
200
|
+
onChange: (e) => v((t) => ({
|
|
109
201
|
...t,
|
|
110
202
|
managedSecretName: e.target.value
|
|
111
203
|
})),
|
|
112
204
|
placeholder: "Optional custom vault secret name",
|
|
113
205
|
className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary"
|
|
114
206
|
}),
|
|
115
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ h("p", {
|
|
116
208
|
className: "text-xs text-text-secondary",
|
|
117
209
|
children: "Leave empty to auto-generate a secret name from the connection and provider."
|
|
118
210
|
})
|
|
119
211
|
]
|
|
120
|
-
}) : /* @__PURE__ */
|
|
212
|
+
}) : /* @__PURE__ */ g("div", {
|
|
121
213
|
className: "space-y-2",
|
|
122
214
|
children: [
|
|
123
|
-
/* @__PURE__ */
|
|
124
|
-
htmlFor:
|
|
215
|
+
/* @__PURE__ */ h("label", {
|
|
216
|
+
htmlFor: B,
|
|
125
217
|
className: "block text-xs font-semibold text-text-primary uppercase tracking-wide",
|
|
126
218
|
children: "Existing secret"
|
|
127
219
|
}),
|
|
128
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ g("div", {
|
|
129
221
|
className: "relative",
|
|
130
|
-
children: [/* @__PURE__ */
|
|
131
|
-
id:
|
|
132
|
-
value:
|
|
133
|
-
onChange: (e) =>
|
|
222
|
+
children: [/* @__PURE__ */ g("select", {
|
|
223
|
+
id: B,
|
|
224
|
+
value: _.secretId,
|
|
225
|
+
onChange: (e) => v((t) => ({
|
|
134
226
|
...t,
|
|
135
227
|
secretId: e.target.value
|
|
136
228
|
})),
|
|
137
|
-
disabled: !
|
|
229
|
+
disabled: !_.vaultId,
|
|
138
230
|
className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-60",
|
|
139
|
-
children: [/* @__PURE__ */
|
|
231
|
+
children: [/* @__PURE__ */ h("option", {
|
|
140
232
|
value: "",
|
|
141
233
|
children: "Select an existing secret"
|
|
142
|
-
}),
|
|
234
|
+
}), C.map((e) => /* @__PURE__ */ g("option", {
|
|
143
235
|
value: e.id,
|
|
144
236
|
children: [
|
|
145
237
|
e.name,
|
|
@@ -147,12 +239,12 @@ function l({ value: l, onChange: u, providerAuthType: d }) {
|
|
|
147
239
|
e.type
|
|
148
240
|
]
|
|
149
241
|
}, e.id))]
|
|
150
|
-
}),
|
|
242
|
+
}), w && /* @__PURE__ */ h(u, {
|
|
151
243
|
size: 16,
|
|
152
244
|
className: "absolute right-3 top-3 animate-spin text-text-secondary"
|
|
153
245
|
})]
|
|
154
246
|
}),
|
|
155
|
-
/* @__PURE__ */
|
|
247
|
+
/* @__PURE__ */ h("p", {
|
|
156
248
|
className: "text-xs text-text-secondary",
|
|
157
249
|
children: "For OAuth and basic auth, choose a structured credential secret created for integrations."
|
|
158
250
|
})
|
|
@@ -162,6 +254,6 @@ function l({ value: l, onChange: u, providerAuthType: d }) {
|
|
|
162
254
|
});
|
|
163
255
|
}
|
|
164
256
|
//#endregion
|
|
165
|
-
export {
|
|
257
|
+
export { _ as CredentialStorageSelector };
|
|
166
258
|
|
|
167
259
|
//# sourceMappingURL=CredentialStorageSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialStorageSelector.js","names":[],"sources":["../../../src/integrations/components/CredentialStorageSelector.tsx"],"sourcesContent":["import { useId, type Dispatch, type SetStateAction } from 'react';\nimport { Database, FolderKey, KeyRound, Loader2 } from 'lucide-react';\n\nimport { useCredentialVaults, useVaultSecrets } from '../hooks/useCredentialVaults';\nimport type { VaultSecretSummary, VaultSummary } from '../types';\n\nexport interface CredentialStorageState {\n mode: 'managed' | 'existing';\n vaultId: string;\n secretId: string;\n managedSecretName: string;\n}\n\ninterface CredentialStorageSelectorProps {\n value: CredentialStorageState;\n onChange: Dispatch<SetStateAction<CredentialStorageState>>;\n providerAuthType?: string | null;\n}\n\nexport function CredentialStorageSelector({\n value,\n onChange,\n providerAuthType,\n}: CredentialStorageSelectorProps) {\n const { vaults, loading: vaultsLoading } = useCredentialVaults();\n const { secrets, loading: secretsLoading } = useVaultSecrets(\n value.vaultId || null,\n providerAuthType\n );\n const idPrefix = useId();\n const vaultSelectId = `${idPrefix}-vault`;\n const managedNameId = `${idPrefix}-managed-name`;\n const existingSecretId = `${idPrefix}-existing-secret`;\n\n return (\n <div className=\"rounded-xl border border-border-subtle/50 bg-bg-surface p-4 space-y-4\">\n <div>\n <h3 className=\"text-sm font-semibold text-text-primary flex items-center gap-2\">\n <Database size={16} className=\"text-primary\" />\n Credential Storage\n </h3>\n <p className=\"text-xs text-text-secondary mt-1\">\n Connections use vault-managed secrets by default. You can also reuse an existing\n compatible secret.\n </p>\n </div>\n\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\n <button\n type=\"button\"\n onClick={() => onChange((current) => ({ ...current, mode: 'managed', secretId: '' }))}\n className={`rounded-xl border px-4 py-3 text-left transition-colors ${\n value.mode === 'managed'\n ? 'border-primary bg-action-primary-bg/5'\n : 'border-border-subtle hover:border-primary/40 hover:bg-accent/30'\n }`}\n >\n <div className=\"flex items-center gap-2 text-sm font-medium text-text-primary\">\n <FolderKey size={16} className=\"text-primary\" />\n Dedicated secret\n </div>\n <p className=\"text-xs text-text-secondary mt-1\">\n Create and own a vault secret for this connection.\n </p>\n </button>\n\n <button\n type=\"button\"\n onClick={() => onChange((current) => ({ ...current, mode: 'existing' }))}\n className={`rounded-xl border px-4 py-3 text-left transition-colors ${\n value.mode === 'existing'\n ? 'border-primary bg-action-primary-bg/5'\n : 'border-border-subtle hover:border-primary/40 hover:bg-accent/30'\n }`}\n >\n <div className=\"flex items-center gap-2 text-sm font-medium text-text-primary\">\n <KeyRound size={16} className=\"text-primary\" />\n Existing secret\n </div>\n <p className=\"text-xs text-text-secondary mt-1\">\n Reference an already stored secret from the vault.\n </p>\n </button>\n </div>\n\n <div className=\"space-y-2\">\n <label\n htmlFor={vaultSelectId}\n className=\"block text-xs font-semibold text-text-primary uppercase tracking-wide\"\n >\n Vault\n </label>\n <div className=\"relative\">\n <select\n id={vaultSelectId}\n value={value.vaultId}\n onChange={(event) =>\n onChange((current) => ({\n ...current,\n vaultId: event.target.value,\n secretId: '',\n }))\n }\n className=\"w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n >\n <option value=\"\">Select a vault</option>\n {vaults.map((vault: VaultSummary) => (\n <option key={vault.id} value={vault.id}>\n {vault.name} ({vault.secretCount})\n </option>\n ))}\n </select>\n {vaultsLoading && (\n <Loader2\n size={16}\n className=\"absolute right-3 top-3 animate-spin text-text-secondary\"\n />\n )}\n </div>\n </div>\n\n {value.mode === 'managed' ? (\n <div className=\"space-y-2\">\n <label\n htmlFor={managedNameId}\n className=\"block text-xs font-semibold text-text-primary uppercase tracking-wide\"\n >\n Managed secret name\n </label>\n <input\n id={managedNameId}\n aria-label=\"Managed secret name\"\n type=\"text\"\n value={value.managedSecretName}\n onChange={(event) =>\n onChange((current) => ({\n ...current,\n managedSecretName: event.target.value,\n }))\n }\n placeholder=\"Optional custom vault secret name\"\n className=\"w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n <p className=\"text-xs text-text-secondary\">\n Leave empty to auto-generate a secret name from the connection and provider.\n </p>\n </div>\n ) : (\n <div className=\"space-y-2\">\n <label\n htmlFor={existingSecretId}\n className=\"block text-xs font-semibold text-text-primary uppercase tracking-wide\"\n >\n Existing secret\n </label>\n <div className=\"relative\">\n <select\n id={existingSecretId}\n value={value.secretId}\n onChange={(event) =>\n onChange((current) => ({\n ...current,\n secretId: event.target.value,\n }))\n }\n disabled={!value.vaultId}\n className=\"w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-60\"\n >\n <option value=\"\">Select an existing secret</option>\n {secrets.map((secret: VaultSecretSummary) => (\n <option key={secret.id} value={secret.id}>\n {secret.name} · {secret.type}\n </option>\n ))}\n </select>\n {secretsLoading && (\n <Loader2\n size={16}\n className=\"absolute right-3 top-3 animate-spin text-text-secondary\"\n />\n )}\n </div>\n <p className=\"text-xs text-text-secondary\">\n For OAuth and basic auth, choose a structured credential secret created for\n integrations.\n </p>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;AAmBA,SAAgB,EAA0B,EACxC,UACA,aACA,uBACiC;CACjC,IAAM,EAAE,WAAQ,SAAS,MAAkB,GAAqB,EAC1D,EAAE,YAAS,SAAS,MAAmB,EAC3C,EAAM,WAAW,MACjB,EACD,EACK,IAAW,GAAO,EAClB,IAAgB,GAAG,EAAS,SAC5B,IAAgB,GAAG,EAAS,gBAC5B,IAAmB,GAAG,EAAS;AAErC,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;IAAI,WAAU;cAAd,CACE,kBAAC,GAAD;KAAU,MAAM;KAAI,WAAU;KAAiB,CAAA,EAAA,qBAE5C;OACL,kBAAC,KAAD;IAAG,WAAU;cAAmC;IAG5C,CAAA,CACA,EAAA,CAAA;GAEN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,UAAD;KACE,MAAK;KACL,eAAe,GAAU,OAAa;MAAE,GAAG;MAAS,MAAM;MAAW,UAAU;MAAI,EAAE;KACrF,WAAW,2DACT,EAAM,SAAS,YACX,0CACA;eANR,CASE,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,GAAD;OAAW,MAAM;OAAI,WAAU;OAAiB,CAAA,EAAA,mBAE5C;SACN,kBAAC,KAAD;MAAG,WAAU;gBAAmC;MAE5C,CAAA,CACG;QAET,kBAAC,UAAD;KACE,MAAK;KACL,eAAe,GAAU,OAAa;MAAE,GAAG;MAAS,MAAM;MAAY,EAAE;KACxE,WAAW,2DACT,EAAM,SAAS,aACX,0CACA;eANR,CASE,kBAAC,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MACT,GAAU,OAAa;QACrB,GAAG;QACH,UAAU,EAAM,OAAO;QACxB,EAAE;OAEL,UAAU,CAAC,EAAM;OACjB,WAAU;iBAVZ,CAYE,kBAAC,UAAD;QAAQ,OAAM;kBAAG;QAAkC,CAAA,EAClD,EAAQ,KAAK,MACZ,kBAAC,UAAD;QAAwB,OAAO,EAAO;kBAAtC;SACG,EAAO;SAAK;SAAI,EAAO;SACjB;UAFI,EAAO,GAEX,CACT,CACK;UACR,KACC,kBAAC,GAAD;OACE,MAAM;OACN,WAAU;OACV,CAAA,CAEA;;KACN,kBAAC,KAAD;MAAG,WAAU;gBAA8B;MAGvC,CAAA;KACA;;GAEJ"}
|
|
1
|
+
{"version":3,"file":"CredentialStorageSelector.js","names":[],"sources":["../../../src/integrations/components/CredentialStorageSelector.tsx"],"sourcesContent":["import { useId, useState, type Dispatch, type SetStateAction } from 'react';\nimport { AlertCircle, Database, FolderKey, KeyRound, Loader2, Plus, X } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\n\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\n\nimport {\n useCreateCredentialVault,\n useCredentialVaults,\n useVaultSecrets,\n} from '../hooks/useCredentialVaults';\nimport type { VaultSecretSummary, VaultSummary } from '../types';\n\nexport interface CredentialStorageState {\n mode: 'managed' | 'existing';\n vaultId: string;\n secretId: string;\n managedSecretName: string;\n}\n\ninterface CredentialStorageSelectorProps {\n value: CredentialStorageState;\n onChange: Dispatch<SetStateAction<CredentialStorageState>>;\n providerAuthType?: string | null;\n}\n\nexport function CredentialStorageSelector({\n value,\n onChange,\n providerAuthType,\n}: CredentialStorageSelectorProps) {\n const { vaults, loading: vaultsLoading, refetch: refetchVaults } = useCredentialVaults();\n const { secrets, loading: secretsLoading } = useVaultSecrets(\n value.vaultId || null,\n providerAuthType\n );\n const { createVault, creating, error: createError, clearError } = useCreateCredentialVault();\n // Vaults belong to the security module, so creating a connection does not\n // imply being allowed to create one. Offering the action to someone who is\n // not would produce a button that always fails at the mutation.\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canCreateVault = !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.VAULT_CREATE);\n const [showCreateVault, setShowCreateVault] = useState(false);\n const [newVaultName, setNewVaultName] = useState('');\n const idPrefix = useId();\n const vaultSelectId = `${idPrefix}-vault`;\n const newVaultNameId = `${idPrefix}-new-vault`;\n const managedNameId = `${idPrefix}-managed-name`;\n const existingSecretId = `${idPrefix}-existing-secret`;\n\n const openCreateVault = () => {\n clearError();\n setNewVaultName('');\n setShowCreateVault(true);\n };\n\n const handleCreateVault = async () => {\n if (!newVaultName.trim()) return;\n const created = await createVault(newVaultName);\n if (!created) return;\n setNewVaultName('');\n // Refresh BEFORE selecting, so the new vault's <option> exists on the same\n // render that sets the value. Selecting first left the dropdown blank: a\n // controlled <select> whose value matches no option falls back to \"\", and\n // React does not re-apply an unchanged value prop when the options arrive\n // later — so the selection was silently dropped and saving then failed with\n // \"Please select a vault\", pointing at a vault the user had just made.\n await refetchVaults();\n onChange((current) => ({ ...current, vaultId: created.id, secretId: '' }));\n setShowCreateVault(false);\n };\n\n return (\n <div className=\"rounded-xl border border-border-subtle/50 bg-bg-surface p-4 space-y-4\">\n <div>\n <h3 className=\"text-sm font-semibold text-text-primary flex items-center gap-2\">\n <Database size={16} className=\"text-primary\" />\n Credential Storage\n </h3>\n <p className=\"text-xs text-text-secondary mt-1\">\n Connections use vault-managed secrets by default. You can also reuse an existing\n compatible secret.\n </p>\n </div>\n\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\n <button\n type=\"button\"\n onClick={() => onChange((current) => ({ ...current, mode: 'managed', secretId: '' }))}\n className={`rounded-xl border px-4 py-3 text-left transition-colors ${\n value.mode === 'managed'\n ? 'border-primary bg-action-primary-bg/5'\n : 'border-border-subtle hover:border-primary/40 hover:bg-accent/30'\n }`}\n >\n <div className=\"flex items-center gap-2 text-sm font-medium text-text-primary\">\n <FolderKey size={16} className=\"text-primary\" />\n Dedicated secret\n </div>\n <p className=\"text-xs text-text-secondary mt-1\">\n Create and own a vault secret for this connection.\n </p>\n </button>\n\n <button\n type=\"button\"\n onClick={() => onChange((current) => ({ ...current, mode: 'existing' }))}\n className={`rounded-xl border px-4 py-3 text-left transition-colors ${\n value.mode === 'existing'\n ? 'border-primary bg-action-primary-bg/5'\n : 'border-border-subtle hover:border-primary/40 hover:bg-accent/30'\n }`}\n >\n <div className=\"flex items-center gap-2 text-sm font-medium text-text-primary\">\n <KeyRound size={16} className=\"text-primary\" />\n Existing secret\n </div>\n <p className=\"text-xs text-text-secondary mt-1\">\n Reference an already stored secret from the vault.\n </p>\n </button>\n </div>\n\n <div className=\"space-y-2\">\n <div className=\"flex items-center justify-between gap-2\">\n <label\n htmlFor={vaultSelectId}\n className=\"block text-xs font-semibold text-text-primary uppercase tracking-wide\"\n >\n Vault\n </label>\n {!showCreateVault && canCreateVault && (\n <button\n type=\"button\"\n onClick={openCreateVault}\n className=\"inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline\"\n >\n <Plus size={13} /> New vault\n </button>\n )}\n </div>\n\n {showCreateVault ? (\n <div className=\"rounded-lg border border-primary/40 bg-action-primary-bg/5 p-3 space-y-2\">\n <div className=\"flex items-center justify-between gap-2\">\n <label htmlFor={newVaultNameId} className=\"text-xs font-medium text-text-primary\">\n New vault name\n </label>\n <button\n type=\"button\"\n onClick={() => setShowCreateVault(false)}\n aria-label=\"Cancel creating a vault\"\n className=\"text-text-secondary hover:text-text-primary\"\n >\n <X size={14} />\n </button>\n </div>\n <input\n id={newVaultNameId}\n aria-label=\"New vault name\"\n type=\"text\"\n value={newVaultName}\n autoFocus\n onChange={(event) => setNewVaultName(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n void handleCreateVault();\n }\n }}\n placeholder=\"e.g. Integrations\"\n disabled={creating}\n className=\"w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50\"\n />\n {createError && (\n <p className=\"flex items-center gap-1.5 text-xs text-status-error-text\">\n <AlertCircle size={13} className=\"flex-shrink-0\" />\n {createError}\n </p>\n )}\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => void handleCreateVault()}\n disabled={creating || !newVaultName.trim()}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-1.5 text-xs font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n {creating ? <Loader2 size={13} className=\"animate-spin\" /> : <Plus size={13} />}\n Create vault\n </button>\n <span className=\"text-xs text-text-secondary\">Scoped to this workspace.</span>\n </div>\n </div>\n ) : (\n <>\n <div className=\"relative\">\n <select\n id={vaultSelectId}\n value={value.vaultId}\n onChange={(event) =>\n onChange((current) => ({\n ...current,\n vaultId: event.target.value,\n secretId: '',\n }))\n }\n className=\"w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n >\n <option value=\"\">Select a vault</option>\n {vaults.map((vault: VaultSummary) => (\n <option key={vault.id} value={vault.id}>\n {vault.name} ({vault.secretCount})\n </option>\n ))}\n </select>\n {vaultsLoading && (\n <Loader2\n size={16}\n className=\"absolute right-3 top-3 animate-spin text-text-secondary\"\n />\n )}\n </div>\n {/* A workspace starts with no vaults, and a connection cannot be\n saved without one. Saying so here — next to the fix — beats\n letting the user discover it from a validation error on save. */}\n {!vaultsLoading &&\n vaults.length === 0 &&\n (canCreateVault ? (\n <p className=\"text-xs text-text-secondary\">\n No vaults yet.{' '}\n <button\n type=\"button\"\n onClick={openCreateVault}\n className=\"font-medium text-primary hover:underline\"\n >\n Create one\n </button>{' '}\n to store this connection’s credentials.\n </p>\n ) : (\n <p className=\"text-xs text-text-secondary\">\n No vaults yet. Ask an administrator to create one — a connection needs a vault to\n store its credentials.\n </p>\n ))}\n </>\n )}\n </div>\n\n {value.mode === 'managed' ? (\n <div className=\"space-y-2\">\n <label\n htmlFor={managedNameId}\n className=\"block text-xs font-semibold text-text-primary uppercase tracking-wide\"\n >\n Managed secret name\n </label>\n <input\n id={managedNameId}\n aria-label=\"Managed secret name\"\n type=\"text\"\n value={value.managedSecretName}\n onChange={(event) =>\n onChange((current) => ({\n ...current,\n managedSecretName: event.target.value,\n }))\n }\n placeholder=\"Optional custom vault secret name\"\n className=\"w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n <p className=\"text-xs text-text-secondary\">\n Leave empty to auto-generate a secret name from the connection and provider.\n </p>\n </div>\n ) : (\n <div className=\"space-y-2\">\n <label\n htmlFor={existingSecretId}\n className=\"block text-xs font-semibold text-text-primary uppercase tracking-wide\"\n >\n Existing secret\n </label>\n <div className=\"relative\">\n <select\n id={existingSecretId}\n value={value.secretId}\n onChange={(event) =>\n onChange((current) => ({\n ...current,\n secretId: event.target.value,\n }))\n }\n disabled={!value.vaultId}\n className=\"w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-60\"\n >\n <option value=\"\">Select an existing secret</option>\n {secrets.map((secret: VaultSecretSummary) => (\n <option key={secret.id} value={secret.id}>\n {secret.name} · {secret.type}\n </option>\n ))}\n </select>\n {secretsLoading && (\n <Loader2\n size={16}\n className=\"absolute right-3 top-3 animate-spin text-text-secondary\"\n />\n )}\n </div>\n <p className=\"text-xs text-text-secondary\">\n For OAuth and basic auth, choose a structured credential secret created for\n integrations.\n </p>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AA0BA,SAAgB,EAA0B,EACxC,UACA,aACA,uBACiC;CACjC,IAAM,EAAE,WAAQ,SAAS,GAAe,SAAS,MAAkB,GAAqB,EAClF,EAAE,YAAS,SAAS,MA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,OAAO,EAAM;MACb,WAAW,MACT,GAAU,OAAa;OACrB,GAAG;OACH,mBAAmB,EAAM,OAAO;OACjC,EAAE;MAEL,aAAY;MACZ,WAAU;MACV,CAAA;KACF,kBAAC,KAAD;MAAG,WAAU;gBAA8B;MAEvC,CAAA;KACA;QAEN,kBAAC,OAAD;IAAK,WAAU;cAAf;KACE,kBAAC,SAAD;MACE,SAAS;MACT,WAAU;gBACX;MAEO,CAAA;KACR,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,UAAD;OACE,IAAI;OACJ,OAAO,EAAM;OACb,WAAW,MACT,GAAU,OAAa;QACrB,GAAG;QACH,UAAU,EAAM,OAAO;QACxB,EAAE;OAEL,UAAU,CAAC,EAAM;OACjB,WAAU;iBAVZ,CAYE,kBAAC,UAAD;QAAQ,OAAM;kBAAG;QAAkC,CAAA,EAClD,EAAQ,KAAK,MACZ,kBAAC,UAAD;QAAwB,OAAO,EAAO;kBAAtC;SACG,EAAO;SAAK;SAAI,EAAO;SACjB;UAFI,EAAO,GAEX,CACT,CACK;UACR,KACC,kBAAC,GAAD;OACE,MAAM;OACN,WAAU;OACV,CAAA,CAEA;;KACN,kBAAC,KAAD;MAAG,WAAU;gBAA8B;MAGvC,CAAA;KACA;;GAEJ"}
|
|
@@ -17,6 +17,7 @@ export declare const INTEGRATION_PERMISSIONS: {
|
|
|
17
17
|
readonly PROVIDER_UPDATE: "integration-provider:update";
|
|
18
18
|
readonly PROVIDER_DELETE: "integration-provider:delete";
|
|
19
19
|
readonly LOG_READ: "integration-log:read";
|
|
20
|
+
readonly VAULT_CREATE: "vault:create";
|
|
20
21
|
};
|
|
21
22
|
export type IntegrationPermission = (typeof INTEGRATION_PERMISSIONS)[keyof typeof INTEGRATION_PERMISSIONS];
|
|
22
23
|
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/integrations/constants/permissions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/integrations/constants/permissions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;CA4B1B,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAC/B,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -12,7 +12,8 @@ var e = {
|
|
|
12
12
|
PROVIDER_CREATE: "integration-provider:create",
|
|
13
13
|
PROVIDER_UPDATE: "integration-provider:update",
|
|
14
14
|
PROVIDER_DELETE: "integration-provider:delete",
|
|
15
|
-
LOG_READ: "integration-log:read"
|
|
15
|
+
LOG_READ: "integration-log:read",
|
|
16
|
+
VAULT_CREATE: "vault:create"
|
|
16
17
|
};
|
|
17
18
|
//#endregion
|
|
18
19
|
export { e as INTEGRATION_PERMISSIONS };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.js","names":[],"sources":["../../../src/integrations/constants/permissions.ts"],"sourcesContent":["/**\n * Integrations Permission Constants\n *\n * Usage: hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE)\n */\n\nexport const INTEGRATION_PERMISSIONS = {\n // integration (module-level)\n // Note: the backend RBAC seed defines `integration:write` (not `update`) for\n // module-level config changes. Sub-resources use standard CRUD `update`.\n INTEGRATION_READ: 'integration:read',\n INTEGRATION_CREATE: 'integration:create',\n INTEGRATION_WRITE: 'integration:write',\n INTEGRATION_DELETE: 'integration:delete',\n\n // integration-connection\n CONNECTION_READ: 'integration-connection:read',\n CONNECTION_CREATE: 'integration-connection:create',\n CONNECTION_UPDATE: 'integration-connection:update',\n CONNECTION_DELETE: 'integration-connection:delete',\n\n // integration-provider\n PROVIDER_READ: 'integration-provider:read',\n PROVIDER_CREATE: 'integration-provider:create',\n PROVIDER_UPDATE: 'integration-provider:update',\n PROVIDER_DELETE: 'integration-provider:delete',\n\n // integration-log\n LOG_READ: 'integration-log:read',\n} as const;\n\nexport type IntegrationPermission =\n (typeof INTEGRATION_PERMISSIONS)[keyof typeof INTEGRATION_PERMISSIONS];\n"],"mappings":";AAMA,IAAa,IAA0B;CAIrC,kBAAkB;CAClB,oBAAoB;CACpB,mBAAmB;CACnB,oBAAoB;CAGpB,iBAAiB;CACjB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CAGnB,eAAe;CACf,iBAAiB;CACjB,iBAAiB;CACjB,iBAAiB;CAGjB,UAAU;
|
|
1
|
+
{"version":3,"file":"permissions.js","names":[],"sources":["../../../src/integrations/constants/permissions.ts"],"sourcesContent":["/**\n * Integrations Permission Constants\n *\n * Usage: hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE)\n */\n\nexport const INTEGRATION_PERMISSIONS = {\n // integration (module-level)\n // Note: the backend RBAC seed defines `integration:write` (not `update`) for\n // module-level config changes. Sub-resources use standard CRUD `update`.\n INTEGRATION_READ: 'integration:read',\n INTEGRATION_CREATE: 'integration:create',\n INTEGRATION_WRITE: 'integration:write',\n INTEGRATION_DELETE: 'integration:delete',\n\n // integration-connection\n CONNECTION_READ: 'integration-connection:read',\n CONNECTION_CREATE: 'integration-connection:create',\n CONNECTION_UPDATE: 'integration-connection:update',\n CONNECTION_DELETE: 'integration-connection:delete',\n\n // integration-provider\n PROVIDER_READ: 'integration-provider:read',\n PROVIDER_CREATE: 'integration-provider:create',\n PROVIDER_UPDATE: 'integration-provider:update',\n PROVIDER_DELETE: 'integration-provider:delete',\n\n // integration-log\n LOG_READ: 'integration-log:read',\n\n // vault — owned by the security module, not this one, but a connection\n // cannot be stored without one, so the connection dialog offers to create a\n // vault inline and must know whether this user is allowed to.\n VAULT_CREATE: 'vault:create',\n} as const;\n\nexport type IntegrationPermission =\n (typeof INTEGRATION_PERMISSIONS)[keyof typeof INTEGRATION_PERMISSIONS];\n"],"mappings":";AAMA,IAAa,IAA0B;CAIrC,kBAAkB;CAClB,oBAAoB;CACpB,mBAAmB;CACnB,oBAAoB;CAGpB,iBAAiB;CACjB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CAGnB,eAAe;CACf,iBAAiB;CACjB,iBAAiB;CACjB,iBAAiB;CAGjB,UAAU;CAKV,cAAc;CACf"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { VaultSummary } from '../types';
|
|
2
|
+
|
|
1
3
|
export declare function useCredentialVaults(): {
|
|
2
4
|
vaults: any;
|
|
3
5
|
total: number;
|
|
@@ -8,6 +10,23 @@ export declare function useCredentialVaults(): {
|
|
|
8
10
|
error?: import('@apollo/client').ErrorLike;
|
|
9
11
|
}>;
|
|
10
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Create a vault without leaving the connection dialog.
|
|
15
|
+
*
|
|
16
|
+
* A connection cannot be saved without a vault to hold its secret, and a
|
|
17
|
+
* workspace starts with none — so the dialog was a dead end until someone went
|
|
18
|
+
* to the security module, created one, and came back. Creating it here keeps
|
|
19
|
+
* the whole flow in one place.
|
|
20
|
+
*
|
|
21
|
+
* `WORKSPACE` scope matches what the security module's own create page uses, so
|
|
22
|
+
* a vault made here is the same kind of vault, visible in both.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useCreateCredentialVault(): {
|
|
25
|
+
createVault: (name: string, description?: string) => Promise<VaultSummary | null>;
|
|
26
|
+
creating: boolean;
|
|
27
|
+
error: string | null;
|
|
28
|
+
clearError: () => void;
|
|
29
|
+
};
|
|
11
30
|
export declare function useVaultSecrets(vaultId: string | null, authType?: string | null): {
|
|
12
31
|
secrets: any;
|
|
13
32
|
total: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCredentialVaults.d.ts","sourceRoot":"","sources":["../../../src/integrations/hooks/useCredentialVaults.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCredentialVaults.d.ts","sourceRoot":"","sources":["../../../src/integrations/hooks/useCredentialVaults.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAsB,YAAY,EAAE,MAAM,UAAU,CAAC;AAwBjE,wBAAgB,mBAAmB;;;;;;;;;EAwBlC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB;wBAKvB,MAAM,gBAAgB,MAAM,KAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;;;;EA6B3E;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;;;;;;;;;EA2C/E"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useIntegrations as e } from "../providers/IntegrationsProvider.js";
|
|
2
|
-
import {
|
|
3
|
-
import { useMemo as
|
|
2
|
+
import { useCreateVaultForIntegrationsMutation as t, useGetVaultSecretsForIntegrationsQuery as n, useGetVaultsForIntegrationsQuery as r } from "../../generated/wspace-operations.js";
|
|
3
|
+
import { useCallback as i, useMemo as a, useState as o } from "react";
|
|
4
4
|
//#region src/integrations/hooks/useCredentialVaults.ts
|
|
5
|
-
function
|
|
5
|
+
function s(e) {
|
|
6
6
|
return {
|
|
7
7
|
id: String(e.id ?? ""),
|
|
8
8
|
name: String(e.name ?? ""),
|
|
@@ -11,7 +11,7 @@ function i(e) {
|
|
|
11
11
|
secretCount: Number(e.secretCount ?? 0)
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function c(e) {
|
|
15
15
|
return {
|
|
16
16
|
id: String(e.id ?? ""),
|
|
17
17
|
vaultId: String(e.vaultId ?? ""),
|
|
@@ -22,8 +22,8 @@ function a(e) {
|
|
|
22
22
|
status: String(e.status ?? "")
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
let { workspaceId: t } = e(), { data:
|
|
25
|
+
function l() {
|
|
26
|
+
let { workspaceId: t } = e(), { data: n, loading: i, error: o, refetch: c } = r({
|
|
27
27
|
variables: {
|
|
28
28
|
filter: { status: "ACTIVE" },
|
|
29
29
|
pagination: { limit: 100 }
|
|
@@ -33,45 +33,66 @@ function o() {
|
|
|
33
33
|
errorPolicy: "all"
|
|
34
34
|
});
|
|
35
35
|
return {
|
|
36
|
-
vaults:
|
|
37
|
-
total: Number(
|
|
38
|
-
loading:
|
|
39
|
-
error:
|
|
36
|
+
vaults: a(() => (n?.getVaults?.items ?? []).map((e) => s(e)), [n]),
|
|
37
|
+
total: Number(n?.getVaults?.total ?? 0),
|
|
38
|
+
loading: i,
|
|
39
|
+
error: o,
|
|
40
40
|
refetch: c
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
let {
|
|
43
|
+
function u() {
|
|
44
|
+
let [e, { loading: n }] = t(), [r, a] = o(null);
|
|
45
|
+
return {
|
|
46
|
+
createVault: i(async (t, n) => {
|
|
47
|
+
a(null);
|
|
48
|
+
try {
|
|
49
|
+
let r = (await e({ variables: { input: {
|
|
50
|
+
name: t.trim(),
|
|
51
|
+
description: n?.trim() ? n.trim() : void 0,
|
|
52
|
+
scope: "WORKSPACE"
|
|
53
|
+
} } })).data?.createVault;
|
|
54
|
+
return r ? s(r) : (a("The vault could not be created"), null);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
return a(e instanceof Error ? e.message : "The vault could not be created"), null;
|
|
57
|
+
}
|
|
58
|
+
}, [e]),
|
|
59
|
+
creating: n,
|
|
60
|
+
error: r,
|
|
61
|
+
clearError: i(() => a(null), [])
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function d(t, r) {
|
|
65
|
+
let { workspaceId: i } = e(), { data: o, loading: s, error: l, refetch: u } = n({
|
|
45
66
|
variables: {
|
|
46
|
-
vaultId:
|
|
67
|
+
vaultId: t ?? "",
|
|
47
68
|
filter: { status: "ACTIVE" },
|
|
48
69
|
pagination: { limit: 100 }
|
|
49
70
|
},
|
|
50
|
-
skip: !
|
|
71
|
+
skip: !i || !t,
|
|
51
72
|
fetchPolicy: "network-only",
|
|
52
73
|
errorPolicy: "all"
|
|
53
74
|
});
|
|
54
75
|
return {
|
|
55
|
-
secrets:
|
|
56
|
-
let e = (
|
|
57
|
-
return
|
|
76
|
+
secrets: a(() => {
|
|
77
|
+
let e = (o?.getSecrets?.items ?? []).map((e) => c(e));
|
|
78
|
+
return r ? r === "oauth2" || r === "basic_auth" ? e.filter((e) => [
|
|
58
79
|
"TOKEN",
|
|
59
80
|
"CREDENTIAL",
|
|
60
81
|
"STRUCTURED_DATA"
|
|
61
|
-
].includes(e.type)) :
|
|
82
|
+
].includes(e.type)) : r === "api_key" || r === "bearer_token" ? e.filter((e) => [
|
|
62
83
|
"API_KEY",
|
|
63
84
|
"TOKEN",
|
|
64
85
|
"TEXT",
|
|
65
86
|
"STRUCTURED_DATA"
|
|
66
87
|
].includes(e.type)) : e : e;
|
|
67
|
-
}, [
|
|
68
|
-
total: Number(
|
|
69
|
-
loading:
|
|
88
|
+
}, [r, o]),
|
|
89
|
+
total: Number(o?.getSecrets?.total ?? 0),
|
|
90
|
+
loading: s,
|
|
70
91
|
error: l,
|
|
71
92
|
refetch: u
|
|
72
93
|
};
|
|
73
94
|
}
|
|
74
95
|
//#endregion
|
|
75
|
-
export {
|
|
96
|
+
export { u as useCreateCredentialVault, l as useCredentialVaults, d as useVaultSecrets };
|
|
76
97
|
|
|
77
98
|
//# sourceMappingURL=useCredentialVaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCredentialVaults.js","names":[],"sources":["../../../src/integrations/hooks/useCredentialVaults.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport {\n useGetVaultsForIntegrationsQuery,\n useGetVaultSecretsForIntegrationsQuery,\n} from '../../generated/wspace-operations';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport type { VaultSecretSummary, VaultSummary } from '../types';\n\nfunction mapVault(raw: Record<string, unknown>): VaultSummary {\n return {\n id: String(raw.id ?? ''),\n name: String(raw.name ?? ''),\n description: raw.description ? String(raw.description) : null,\n status: String(raw.status ?? 'UNKNOWN'),\n secretCount: Number(raw.secretCount ?? 0),\n };\n}\n\nfunction mapSecret(raw: Record<string, unknown>): VaultSecretSummary {\n return {\n id: String(raw.id ?? ''),\n vaultId: String(raw.vaultId ?? ''),\n name: String(raw.name ?? ''),\n key: String(raw.key ?? ''),\n description: raw.description ? String(raw.description) : null,\n type: String(raw.type ?? ''),\n status: String(raw.status ?? ''),\n };\n}\n\nexport function useCredentialVaults() {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetVaultsForIntegrationsQuery({\n variables: {\n filter: { status: 'ACTIVE' },\n pagination: { limit: 100 },\n },\n skip: !workspaceId,\n fetchPolicy: 'network-only',\n errorPolicy: 'all',\n });\n\n const vaults = useMemo(\n () => (data?.getVaults?.items ?? []).map((item: Record<string, unknown>) => mapVault(item)),\n [data]\n );\n\n return {\n vaults,\n total: Number(data?.getVaults?.total ?? 0),\n loading,\n error,\n refetch,\n };\n}\n\nexport function useVaultSecrets(vaultId: string | null, authType?: string | null) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetVaultSecretsForIntegrationsQuery({\n variables: {\n vaultId: vaultId ?? '',\n filter: { status: 'ACTIVE' },\n pagination: { limit: 100 },\n },\n skip: !workspaceId || !vaultId,\n fetchPolicy: 'network-only',\n errorPolicy: 'all',\n });\n\n const secrets = useMemo(() => {\n const items = (data?.getSecrets?.items ?? []).map((item: Record<string, unknown>) =>\n mapSecret(item)\n );\n if (!authType) {\n return items;\n }\n\n if (authType === 'oauth2' || authType === 'basic_auth') {\n return items.filter((secret: VaultSecretSummary) =>\n ['TOKEN', 'CREDENTIAL', 'STRUCTURED_DATA'].includes(secret.type)\n );\n }\n\n if (authType === 'api_key' || authType === 'bearer_token') {\n return items.filter((secret: VaultSecretSummary) =>\n ['API_KEY', 'TOKEN', 'TEXT', 'STRUCTURED_DATA'].includes(secret.type)\n );\n }\n\n return items;\n }, [authType, data]);\n\n return {\n secrets,\n total: Number(data?.getSecrets?.total ?? 0),\n loading,\n error,\n refetch,\n };\n}\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"useCredentialVaults.js","names":[],"sources":["../../../src/integrations/hooks/useCredentialVaults.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react';\n\nimport {\n useCreateVaultForIntegrationsMutation,\n useGetVaultsForIntegrationsQuery,\n useGetVaultSecretsForIntegrationsQuery,\n} from '../../generated/wspace-operations';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport type { VaultSecretSummary, VaultSummary } from '../types';\n\nfunction mapVault(raw: Record<string, unknown>): VaultSummary {\n return {\n id: String(raw.id ?? ''),\n name: String(raw.name ?? ''),\n description: raw.description ? String(raw.description) : null,\n status: String(raw.status ?? 'UNKNOWN'),\n secretCount: Number(raw.secretCount ?? 0),\n };\n}\n\nfunction mapSecret(raw: Record<string, unknown>): VaultSecretSummary {\n return {\n id: String(raw.id ?? ''),\n vaultId: String(raw.vaultId ?? ''),\n name: String(raw.name ?? ''),\n key: String(raw.key ?? ''),\n description: raw.description ? String(raw.description) : null,\n type: String(raw.type ?? ''),\n status: String(raw.status ?? ''),\n };\n}\n\nexport function useCredentialVaults() {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetVaultsForIntegrationsQuery({\n variables: {\n filter: { status: 'ACTIVE' },\n pagination: { limit: 100 },\n },\n skip: !workspaceId,\n fetchPolicy: 'network-only',\n errorPolicy: 'all',\n });\n\n const vaults = useMemo(\n () => (data?.getVaults?.items ?? []).map((item: Record<string, unknown>) => mapVault(item)),\n [data]\n );\n\n return {\n vaults,\n total: Number(data?.getVaults?.total ?? 0),\n loading,\n error,\n refetch,\n };\n}\n\n/**\n * Create a vault without leaving the connection dialog.\n *\n * A connection cannot be saved without a vault to hold its secret, and a\n * workspace starts with none — so the dialog was a dead end until someone went\n * to the security module, created one, and came back. Creating it here keeps\n * the whole flow in one place.\n *\n * `WORKSPACE` scope matches what the security module's own create page uses, so\n * a vault made here is the same kind of vault, visible in both.\n */\nexport function useCreateCredentialVault() {\n const [mutate, { loading }] = useCreateVaultForIntegrationsMutation();\n const [error, setError] = useState<string | null>(null);\n\n const createVault = useCallback(\n async (name: string, description?: string): Promise<VaultSummary | null> => {\n setError(null);\n try {\n const result = await mutate({\n variables: {\n input: {\n name: name.trim(),\n description: description?.trim() ? description.trim() : undefined,\n scope: 'WORKSPACE',\n },\n },\n });\n const created = result.data?.createVault;\n if (!created) {\n setError('The vault could not be created');\n return null;\n }\n return mapVault(created);\n } catch (caught) {\n setError(caught instanceof Error ? caught.message : 'The vault could not be created');\n return null;\n }\n },\n [mutate]\n );\n\n const clearError = useCallback(() => setError(null), []);\n\n return { createVault, creating: loading, error, clearError };\n}\n\nexport function useVaultSecrets(vaultId: string | null, authType?: string | null) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetVaultSecretsForIntegrationsQuery({\n variables: {\n vaultId: vaultId ?? '',\n filter: { status: 'ACTIVE' },\n pagination: { limit: 100 },\n },\n skip: !workspaceId || !vaultId,\n fetchPolicy: 'network-only',\n errorPolicy: 'all',\n });\n\n const secrets = useMemo(() => {\n const items = (data?.getSecrets?.items ?? []).map((item: Record<string, unknown>) =>\n mapSecret(item)\n );\n if (!authType) {\n return items;\n }\n\n if (authType === 'oauth2' || authType === 'basic_auth') {\n return items.filter((secret: VaultSecretSummary) =>\n ['TOKEN', 'CREDENTIAL', 'STRUCTURED_DATA'].includes(secret.type)\n );\n }\n\n if (authType === 'api_key' || authType === 'bearer_token') {\n return items.filter((secret: VaultSecretSummary) =>\n ['API_KEY', 'TOKEN', 'TEXT', 'STRUCTURED_DATA'].includes(secret.type)\n );\n }\n\n return items;\n }, [authType, data]);\n\n return {\n secrets,\n total: Number(data?.getSecrets?.total ?? 0),\n loading,\n error,\n refetch,\n };\n}\n"],"mappings":";;;;AAUA,SAAS,EAAS,GAA4C;AAC5D,QAAO;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AG,KAAA;KACxD,OAAO;KACR,EACF,EACF,CAAC,EACqB,MAAM;AAK7B,WAJK,IAIE,EAAS,EAAQ,IAHtB,EAAS,iCAAiC,EACnC;YAGF,GAAQ;AAEf,WADA,EAAS,aAAkB,QAAQ,EAAO,UAAU,iCAAiC,EAC9E;;KAGX,CAAC,EAAO,CACT;EAIqB,UAAU;EAAS;EAAO,YAF7B,QAAkB,EAAS,KAAK,EAAE,EAAE,CAAC;EAEI;;AAG9D,SAAgB,EAAgB,GAAwB,GAA0B;CAChF,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAuC;EAC/E,WAAW;GACT,SAAS,KAAW;GACpB,QAAQ,EAAE,QAAQ,UAAU;GAC5B,YAAY,EAAE,OAAO,KAAK;GAC3B;EACD,MAAM,CAAC,KAAe,CAAC;EACvB,aAAa;EACb,aAAa;EACd,CAAC;AAyBF,QAAO;EACL,SAxBc,QAAc;GAC5B,IAAM,KAAS,GAAM,YAAY,SAAS,EAAE,EAAE,KAAK,MACjD,EAAU,EAAK,CAChB;AAiBD,UAhBK,IAID,MAAa,YAAY,MAAa,eACjC,EAAM,QAAQ,MACnB;IAAC;IAAS;IAAc;IAAkB,CAAC,SAAS,EAAO,KAAK,CACjE,GAGC,MAAa,aAAa,MAAa,iBAClC,EAAM,QAAQ,MACnB;IAAC;IAAW;IAAS;IAAQ;IAAkB,CAAC,SAAS,EAAO,KAAK,CACtE,GAGI,IAfE;KAgBR,CAAC,GAAU,EAAK,CAAC;EAIlB,OAAO,OAAO,GAAM,YAAY,SAAS,EAAE;EAC3C;EACA;EACA;EACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProviderDetail.d.ts","sourceRoot":"","sources":["../../../src/integrations/pages/ProviderDetail.tsx"],"names":[],"mappings":"AAmDA;;GAEG;AACH,wBAAgB,cAAc,
|
|
1
|
+
{"version":3,"file":"ProviderDetail.d.ts","sourceRoot":"","sources":["../../../src/integrations/pages/ProviderDetail.tsx"],"names":[],"mappings":"AAmDA;;GAEG;AACH,wBAAgB,cAAc,gCA+c7B"}
|
|
@@ -18,7 +18,7 @@ import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
|
18
18
|
import { Button as x, CTAOverflowMenu as S, EmphasisPanel as C, GlassCard as w, IllustratedEmptyState as T, NextSteps as E, PagePurpose as D, ShowMore as O } from "@burdenoff/fe-libs/ui";
|
|
19
19
|
//#region src/integrations/pages/ProviderDetail.tsx
|
|
20
20
|
function k() {
|
|
21
|
-
let { providerId: k } = pe(), { adminMode: A = !1, basePath: j = "/", navigate: M, onConnectionSelect: N } = e(), { addConnectionDialogOpen: P, addConnectionProviderId: F, openAddConnectionDialog: I, closeAddConnectionDialog: L } = te(), { provider: R, loading: z, error: B, refetch: V } = o(k ?? ""), { connections: H, loading: U } = c(k ?? ""), { enableProvider: he, loading: ge } = a(), { disableProvider: _e, loading: ve } = i(), { uninstallPlugin: ye, loading: W } = s(), { hasPermission: G, isLoading: K } = me(), [be, q] = ae(!1), J = !K && G(t.CONNECTION_CREATE), xe = A && !K && G(t.PROVIDER_CREATE), Y = A && !K && G(t.PROVIDER_UPDATE), Se = A && !K && G(t.PROVIDER_DELETE), Ce = z, X = ge || ve || W;
|
|
21
|
+
let { providerId: k } = pe(), { adminMode: A = !1, basePath: j = "/", navigate: M, onConnectionSelect: N } = e(), { addConnectionDialogOpen: P, addConnectionProviderId: F, openAddConnectionDialog: I, closeAddConnectionDialog: L } = te(), { provider: R, loading: z, error: B, refetch: V } = o(k ?? ""), { connections: H, loading: U } = c(k ?? ""), { enableProvider: he, loading: ge } = a(), { disableProvider: _e, loading: ve } = i(), { uninstallPlugin: ye, loading: W } = s(), { hasPermission: G, isLoading: K } = me(), [be, q] = ae(!1), J = !K && G(t.CONNECTION_CREATE), xe = A && !K && G(t.PROVIDER_CREATE), Y = A && !K && G(t.PROVIDER_UPDATE), Se = A && !K && G(t.PROVIDER_DELETE), Ce = z && !R, X = ge || ve || W;
|
|
22
22
|
if (Ce) return /* @__PURE__ */ b("div", {
|
|
23
23
|
className: "flex flex-col items-center justify-center py-20",
|
|
24
24
|
children: [/* @__PURE__ */ b("div", {
|