@haneinfo/m2m-api-key 8.0.4 → 8.1.0
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/admin-key-scope-upgrade.d.ts +39 -0
- package/dist/admin-key-scope-upgrade.d.ts.map +1 -0
- package/dist/admin-key-scope-upgrade.js +34 -0
- package/dist/admin-key-scope-upgrade.js.map +1 -0
- package/dist/api-keys.controller.d.ts +10 -1
- package/dist/api-keys.controller.d.ts.map +1 -1
- package/dist/api-keys.controller.js +32 -7
- package/dist/api-keys.controller.js.map +1 -1
- package/dist/api-keys.module.d.ts.map +1 -1
- package/dist/api-keys.module.js +5 -1
- package/dist/api-keys.module.js.map +1 -1
- package/dist/api-keys.service.d.ts +6 -1
- package/dist/api-keys.service.d.ts.map +1 -1
- package/dist/api-keys.service.js +12 -13
- package/dist/api-keys.service.js.map +1 -1
- package/dist/frontend/api-key-row-actions.d.ts +1 -1
- package/dist/frontend/api-key-row-actions.d.ts.map +1 -1
- package/dist/frontend/api-key-row-actions.js +4 -2
- package/dist/frontend/api-key-row-actions.js.map +1 -1
- package/dist/frontend/api-keys-table.d.ts +1 -1
- package/dist/frontend/api-keys-table.d.ts.map +1 -1
- package/dist/frontend/api-keys-table.js +2 -2
- package/dist/frontend/api-keys-table.js.map +1 -1
- package/dist/frontend/create-api-key-dialog.d.ts +1 -1
- package/dist/frontend/create-api-key-dialog.d.ts.map +1 -1
- package/dist/frontend/create-api-key-dialog.js +82 -21
- package/dist/frontend/create-api-key-dialog.js.map +1 -1
- package/dist/frontend/created-api-key-reveal.d.ts +4 -0
- package/dist/frontend/created-api-key-reveal.d.ts.map +1 -1
- package/dist/frontend/created-api-key-reveal.js +20 -3
- package/dist/frontend/created-api-key-reveal.js.map +1 -1
- package/dist/frontend/edit-api-key-dialog.d.ts +18 -0
- package/dist/frontend/edit-api-key-dialog.d.ts.map +1 -0
- package/dist/frontend/edit-api-key-dialog.js +88 -0
- package/dist/frontend/edit-api-key-dialog.js.map +1 -0
- package/dist/frontend/index.d.ts +4 -1
- package/dist/frontend/index.d.ts.map +1 -1
- package/dist/frontend/index.js +7 -1
- package/dist/frontend/index.js.map +1 -1
- package/dist/frontend/key-draft.d.ts +19 -0
- package/dist/frontend/key-draft.d.ts.map +1 -0
- package/dist/frontend/key-draft.js +52 -0
- package/dist/frontend/key-draft.js.map +1 -0
- package/dist/frontend/scope-checklist.d.ts +14 -0
- package/dist/frontend/scope-checklist.d.ts.map +1 -0
- package/dist/frontend/scope-checklist.js +34 -0
- package/dist/frontend/scope-checklist.js.map +1 -0
- package/dist/frontend/service-account-select.d.ts +15 -0
- package/dist/frontend/service-account-select.d.ts.map +1 -0
- package/dist/frontend/service-account-select.js +48 -0
- package/dist/frontend/service-account-select.js.map +1 -0
- package/dist/frontend/types.d.ts +36 -0
- package/dist/frontend/types.d.ts.map +1 -1
- package/dist/frontend/types.js.map +1 -1
- package/dist/frontend.d.ts +2 -2
- package/dist/frontend.d.ts.map +1 -1
- package/dist/frontend.js +4 -1
- package/dist/frontend.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/scope-catalog.d.ts +63 -0
- package/dist/scope-catalog.d.ts.map +1 -0
- package/dist/scope-catalog.js +111 -0
- package/dist/scope-catalog.js.map +1 -0
- package/package.json +17 -17
- package/LICENSE +0 -14
|
@@ -6,38 +6,99 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
const frontend_shell_1 = require("@haneinfo/frontend-shell");
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const created_api_key_reveal_js_1 = require("./created-api-key-reveal.js");
|
|
9
|
+
const key_draft_js_1 = require("./key-draft.js");
|
|
10
|
+
const scope_checklist_js_1 = require("./scope-checklist.js");
|
|
11
|
+
const service_account_select_js_1 = require("./service-account-select.js");
|
|
9
12
|
const types_js_1 = require("./types.js");
|
|
10
|
-
function CreateApiKeyDialog({ roles, serviceAccounts, scopeOptions, createApiKeyAction, }) {
|
|
13
|
+
function CreateApiKeyDialog({ roles, serviceAccounts, scopeOptions, scopeGroups, createApiKeyAction, searchServiceAccountsAction, }) {
|
|
11
14
|
const t = (0, frontend_shell_1.useTranslations)('apiKeys');
|
|
15
|
+
const tCommon = (0, frontend_shell_1.useTranslations)('common');
|
|
16
|
+
const formId = (0, react_1.useId)();
|
|
12
17
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
13
18
|
const [isPending, startTransition] = (0, react_1.useTransition)();
|
|
19
|
+
const inFlight = (0, react_1.useRef)(false);
|
|
14
20
|
const [error, setError] = (0, react_1.useState)(null);
|
|
15
21
|
const [created, setCreated] = (0, react_1.useState)(null);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
setCreated(result.created);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
function handleOpenChange(next) {
|
|
29
|
-
setOpen(next);
|
|
30
|
-
if (next) {
|
|
31
|
-
setError(null);
|
|
32
|
-
setCreated(null);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
22
|
+
const [name, setName] = (0, react_1.useState)('');
|
|
23
|
+
const [roleId, setRoleId] = (0, react_1.useState)('');
|
|
24
|
+
const [actingUserId, setActingUserId] = (0, react_1.useState)(key_draft_js_1.NO_ACTING_USER);
|
|
25
|
+
const [scopes, setScopes] = (0, react_1.useState)([]);
|
|
26
|
+
const [rateLimit, setRateLimit] = (0, react_1.useState)('');
|
|
27
|
+
const [expiresAt, setExpiresAt] = (0, react_1.useState)('');
|
|
28
|
+
const draft = { name, roleId, actingUserId, scopes, rateLimit, expiresAt, isActive: true };
|
|
29
|
+
const dirty = name !== '' || roleId !== '' || scopes.length > 0 || rateLimit !== '' || expiresAt !== '';
|
|
35
30
|
const resolvedScopeOptions = scopeOptions && scopeOptions.length > 0
|
|
36
31
|
? scopeOptions
|
|
37
32
|
: types_js_1.SCOPE_RESOURCES.flatMap((resource) => types_js_1.SCOPE_ACTIONS.map((action) => ({
|
|
38
33
|
value: `${resource}:${action}`,
|
|
39
34
|
label: `${resource}:${action}`,
|
|
40
35
|
})));
|
|
41
|
-
|
|
36
|
+
function reset() {
|
|
37
|
+
setName('');
|
|
38
|
+
setRoleId('');
|
|
39
|
+
setActingUserId(key_draft_js_1.NO_ACTING_USER);
|
|
40
|
+
setScopes([]);
|
|
41
|
+
setRateLimit('');
|
|
42
|
+
setExpiresAt('');
|
|
43
|
+
setError(null);
|
|
44
|
+
setCreated(null);
|
|
45
|
+
}
|
|
46
|
+
function handleOpenChange(next) {
|
|
47
|
+
if (!next) {
|
|
48
|
+
if (isPending)
|
|
49
|
+
return;
|
|
50
|
+
// A half-filled form is not saved anywhere, so leaving it needs confirmation.
|
|
51
|
+
if (dirty && !window.confirm(t('unsavedChanges')))
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
setOpen(next);
|
|
55
|
+
if (next)
|
|
56
|
+
reset();
|
|
57
|
+
}
|
|
58
|
+
function submit(event) {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
if (inFlight.current)
|
|
61
|
+
return;
|
|
62
|
+
const problem = (0, key_draft_js_1.validateDraft)({ ...draft, roleId: roleId || '' });
|
|
63
|
+
if (problem) {
|
|
64
|
+
setError(t(problem));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (!roleId) {
|
|
68
|
+
setError(t('selectRole'));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const formData = new FormData();
|
|
72
|
+
formData.set('name', name.trim());
|
|
73
|
+
formData.set('roleId', roleId);
|
|
74
|
+
if (actingUserId !== key_draft_js_1.NO_ACTING_USER)
|
|
75
|
+
formData.set('actingUserId', actingUserId);
|
|
76
|
+
for (const scope of scopes)
|
|
77
|
+
formData.append('scopes', scope);
|
|
78
|
+
if (rateLimit.trim() !== '')
|
|
79
|
+
formData.set('rateLimit', rateLimit.trim());
|
|
80
|
+
if (expiresAt)
|
|
81
|
+
formData.set('expiresAt', new Date(expiresAt).toISOString());
|
|
82
|
+
inFlight.current = true;
|
|
83
|
+
setError(null);
|
|
84
|
+
startTransition(async () => {
|
|
85
|
+
try {
|
|
86
|
+
const result = await createApiKeyAction(formData);
|
|
87
|
+
if (result.error || !result.created) {
|
|
88
|
+
setError(result.error ?? t('createFailed'));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
setCreated(result.created);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
setError(t('requestFailed'));
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
inFlight.current = false;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return ((0, jsx_runtime_1.jsxs)(frontend_shell_1.Dialog, { open: open, onOpenChange: handleOpenChange, children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.DialogTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)(frontend_shell_1.Button, { children: t('newApiKey') }) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.DialogContent, { closeLabel: tCommon('close'), className: "max-h-[90svh] overflow-y-auto", children: created ? ((0, jsx_runtime_1.jsx)(created_api_key_reveal_js_1.CreatedApiKeyReveal, { created: created, onDone: () => setOpen(false) })) : ((0, jsx_runtime_1.jsxs)("form", { onSubmit: submit, children: [(0, jsx_runtime_1.jsxs)(frontend_shell_1.DialogHeader, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.DialogTitle, { children: t('createApiKey') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.DialogDescription, { children: t('createDesc') })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.FieldGroup, { className: "py-4", children: [(0, jsx_runtime_1.jsxs)(frontend_shell_1.Field, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.FieldLabel, { htmlFor: `${formId}-name`, children: t('name') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.Input, { id: `${formId}-name`, value: name, maxLength: 100, disabled: isPending, onChange: (event) => setName(event.target.value) })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Field, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.FieldLabel, { htmlFor: `${formId}-role`, children: t('role') }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Select, { value: roleId, onValueChange: setRoleId, disabled: isPending, children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.SelectTrigger, { id: `${formId}-role`, children: (0, jsx_runtime_1.jsx)(frontend_shell_1.SelectValue, { placeholder: t('selectRole') }) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.SelectContent, { children: roles.map((role) => ((0, jsx_runtime_1.jsx)(frontend_shell_1.SelectItem, { value: role.id, children: role.displayName }, role.id))) })] })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Field, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.FieldLabel, { htmlFor: `${formId}-acting`, children: t('actingUser') }), (0, jsx_runtime_1.jsx)(service_account_select_js_1.ServiceAccountSelect, { id: `${formId}-acting`, value: actingUserId, accounts: serviceAccounts, disabled: isPending, search: searchServiceAccountsAction, onChange: setActingUserId })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Field, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.FieldLabel, { children: t('scopes') }), (0, jsx_runtime_1.jsx)(scope_checklist_js_1.ScopeChecklist, { idPrefix: `${formId}-scope`, options: resolvedScopeOptions, groups: scopeGroups, selected: scopes, disabled: isPending, onChange: setScopes })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Field, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.FieldLabel, { htmlFor: `${formId}-rate`, children: t('rateLimit') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.Input, { id: `${formId}-rate`, type: "number", min: 1, max: 600, value: rateLimit, disabled: isPending, onChange: (event) => setRateLimit(event.target.value) })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Field, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.FieldLabel, { htmlFor: `${formId}-expires`, children: t('expiresAt') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.Input, { id: `${formId}-expires`, type: "datetime-local", value: expiresAt, disabled: isPending, onChange: (event) => setExpiresAt(event.target.value) })] }), error && (0, jsx_runtime_1.jsx)(frontend_shell_1.FieldError, { children: error })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-end gap-2 pt-2", children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.Button, { type: "button", variant: "outline", onClick: () => handleOpenChange(false), disabled: isPending, children: tCommon('cancel') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.Button, { type: "submit", disabled: isPending, children: isPending ? t('creating') : t('create') })] })] })) })] }));
|
|
42
103
|
}
|
|
43
104
|
//# sourceMappingURL=create-api-key-dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-api-key-dialog.js","sourceRoot":"","sources":["../../src/frontend/create-api-key-dialog.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AA8Bb,
|
|
1
|
+
{"version":3,"file":"create-api-key-dialog.js","sourceRoot":"","sources":["../../src/frontend/create-api-key-dialog.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AA8Bb,gDAuMC;;AAnOD,6DAmBkC;AAClC,iCAA+E;AAC/E,2EAAkE;AAClE,iDAA+D;AAC/D,6DAAsD;AACtD,2EAAmE;AAEnE,yCAA4D;AAE5D,SAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,eAAe,EACf,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,2BAA2B,GACH;IACxB,MAAM,CAAC,GAAG,IAAA,gCAAe,EAAC,SAAS,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,IAAA,gCAAe,EAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,MAAM,GA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atedApiKeyRevealProps } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Shows a new key once. If the clipboard is unavailable (permissions, insecure context), the key
|
|
4
|
+
* stays selectable on screen and the admin can confirm they saved it by hand before closing.
|
|
5
|
+
*/
|
|
2
6
|
export declare function CreatedApiKeyReveal({ created, onDone }: CreatedApiKeyRevealProps): import("react").JSX.Element;
|
|
3
7
|
//# sourceMappingURL=created-api-key-reveal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"created-api-key-reveal.d.ts","sourceRoot":"","sources":["../../src/frontend/created-api-key-reveal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"created-api-key-reveal.d.ts","sourceRoot":"","sources":["../../src/frontend/created-api-key-reveal.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,wBAAwB,+BAmEhF"}
|
|
@@ -5,13 +5,30 @@ exports.CreatedApiKeyReveal = CreatedApiKeyReveal;
|
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const frontend_shell_1 = require("@haneinfo/frontend-shell");
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* Shows a new key once. If the clipboard is unavailable (permissions, insecure context), the key
|
|
10
|
+
* stays selectable on screen and the admin can confirm they saved it by hand before closing.
|
|
11
|
+
*/
|
|
8
12
|
function CreatedApiKeyReveal({ created, onDone }) {
|
|
9
13
|
const t = (0, frontend_shell_1.useTranslations)('apiKeys');
|
|
14
|
+
const keyId = (0, react_1.useId)();
|
|
15
|
+
const keyRef = (0, react_1.useRef)(null);
|
|
10
16
|
const [copied, setCopied] = (0, react_1.useState)(false);
|
|
17
|
+
const [copyFailed, setCopyFailed] = (0, react_1.useState)(false);
|
|
18
|
+
const [savedByHand, setSavedByHand] = (0, react_1.useState)(false);
|
|
11
19
|
async function handleCopy() {
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
try {
|
|
21
|
+
await navigator.clipboard.writeText(created.key);
|
|
22
|
+
setCopied(true);
|
|
23
|
+
setCopyFailed(false);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
setCopyFailed(true);
|
|
27
|
+
keyRef.current?.focus();
|
|
28
|
+
keyRef.current?.select();
|
|
29
|
+
}
|
|
14
30
|
}
|
|
15
|
-
|
|
31
|
+
const canClose = copied || savedByHand;
|
|
32
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)(frontend_shell_1.DialogHeader, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.DialogTitle, { children: t('createdTitle') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.DialogDescription, { children: t('createdDescription') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-3 py-4", children: [copyFailed ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-2", children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.Label, { htmlFor: keyId, children: t('copyFailedManual') }), (0, jsx_runtime_1.jsx)("input", { id: keyId, ref: keyRef, readOnly: true, value: created.key, onFocus: (event) => event.currentTarget.select(), className: "w-full break-all rounded-md border bg-muted p-3 font-mono text-sm" })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "break-all rounded-md border bg-muted p-3 font-mono text-sm", children: created.key })), (0, jsx_runtime_1.jsx)(frontend_shell_1.Button, { type: "button", variant: "outline", onClick: handleCopy, children: copied ? t('copied') : t('copyToClipboard') }), !copied && ((0, jsx_runtime_1.jsxs)(frontend_shell_1.Label, { className: "flex items-center gap-2 font-normal", children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", checked: savedByHand, onChange: (event) => setSavedByHand(event.target.checked) }), t('savedByHand')] }))] }), (0, jsx_runtime_1.jsx)(frontend_shell_1.DialogFooter, { children: (0, jsx_runtime_1.jsx)(frontend_shell_1.Button, { type: "button", onClick: onDone, disabled: !canClose, children: t('doneAfterCopy') }) })] }));
|
|
16
33
|
}
|
|
17
34
|
//# sourceMappingURL=created-api-key-reveal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"created-api-key-reveal.js","sourceRoot":"","sources":["../../src/frontend/created-api-key-reveal.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"created-api-key-reveal.js","sourceRoot":"","sources":["../../src/frontend/created-api-key-reveal.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAkBb,kDAmEC;;AAnFD,6DAQkC;AAClC,iCAAgD;AAGhD;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,EAA4B;IAC/E,MAAM,CAAC,GAAG,IAAA,gCAAe,EAAC,SAAS,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,IAAA,aAAK,GAAE,CAAC;IACtB,MAAM,MAAM,GAAG,IAAA,cAAM,EAAmB,IAAI,CAAC,CAAC;IAC9C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IACpD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAEtD,KAAK,UAAU,UAAU;QACvB,IAAI,CAAC;YACH,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACjD,SAAS,CAAC,IAAI,CAAC,CAAC;YAChB,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;QAAC,MAAM,CAAC;YACP,aAAa,CAAC,IAAI,CAAC,CAAC;YACpB,MAAM,CAAC,OAAO,EAAE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,aAAa,CAAC,IACX,CACT,IACG,EACN,uBAAC,6BAAY,cACX,uBAAC,uBAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,QAAQ,YACvD,CAAC,CAAC,eAAe,CAAC,GACZ,GACI,IACX,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ApiKeyRoleOption, ApiKeyRow, ApiKeyScopeGroup, ApiKeyScopeOption, ApiKeyUpdatePayload, SearchServiceAccountsAction, ServiceAccountOption, UpdateApiKeyResult } from './types.js';
|
|
2
|
+
export interface EditApiKeyDialogProps {
|
|
3
|
+
apiKey: ApiKeyRow;
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
roles: ApiKeyRoleOption[];
|
|
7
|
+
serviceAccounts: ServiceAccountOption[];
|
|
8
|
+
scopeOptions: ApiKeyScopeOption[];
|
|
9
|
+
scopeGroups?: ApiKeyScopeGroup[];
|
|
10
|
+
updateApiKeyAction: (id: string, payload: ApiKeyUpdatePayload) => Promise<UpdateApiKeyResult>;
|
|
11
|
+
searchServiceAccountsAction?: SearchServiceAccountsAction;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Full key editor. A failed save keeps the draft, a second submit cannot send while one request is in
|
|
15
|
+
* flight, and leaving with unsaved changes asks first (a browser reload warns too).
|
|
16
|
+
*/
|
|
17
|
+
export declare function EditApiKeyDialog({ apiKey, open, onOpenChange, roles, serviceAccounts, scopeOptions, scopeGroups, updateApiKeyAction, searchServiceAccountsAction, }: EditApiKeyDialogProps): import("react").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=edit-api-key-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-api-key-dialog.d.ts","sourceRoot":"","sources":["../../src/frontend/edit-api-key-dialog.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EACV,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,EAC3B,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,eAAe,EAAE,oBAAoB,EAAE,CAAC;IACxC,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACjC,kBAAkB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9F,2BAA2B,CAAC,EAAE,2BAA2B,CAAC;CAC3D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,eAAe,EACf,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,2BAA2B,GAC5B,EAAE,qBAAqB,+BAoLvB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.EditApiKeyDialog = EditApiKeyDialog;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const frontend_shell_1 = require("@haneinfo/frontend-shell");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const key_draft_js_1 = require("./key-draft.js");
|
|
9
|
+
const scope_checklist_js_1 = require("./scope-checklist.js");
|
|
10
|
+
const service_account_select_js_1 = require("./service-account-select.js");
|
|
11
|
+
/**
|
|
12
|
+
* Full key editor. A failed save keeps the draft, a second submit cannot send while one request is in
|
|
13
|
+
* flight, and leaving with unsaved changes asks first (a browser reload warns too).
|
|
14
|
+
*/
|
|
15
|
+
function EditApiKeyDialog({ apiKey, open, onOpenChange, roles, serviceAccounts, scopeOptions, scopeGroups, updateApiKeyAction, searchServiceAccountsAction, }) {
|
|
16
|
+
const t = (0, frontend_shell_1.useTranslations)('apiKeys');
|
|
17
|
+
const tCommon = (0, frontend_shell_1.useTranslations)('common');
|
|
18
|
+
const formId = (0, react_1.useId)();
|
|
19
|
+
const [draft, setDraft] = (0, react_1.useState)(() => (0, key_draft_js_1.draftFromKey)(apiKey));
|
|
20
|
+
const [baseline, setBaseline] = (0, react_1.useState)(() => (0, key_draft_js_1.draftFromKey)(apiKey));
|
|
21
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
22
|
+
const [isPending, startTransition] = (0, react_1.useTransition)();
|
|
23
|
+
const inFlight = (0, react_1.useRef)(false);
|
|
24
|
+
const dirty = JSON.stringify(draft) !== JSON.stringify(baseline);
|
|
25
|
+
// Start from the stored key each time the editor opens, so an old draft never reappears.
|
|
26
|
+
(0, react_1.useEffect)(() => {
|
|
27
|
+
if (!open)
|
|
28
|
+
return;
|
|
29
|
+
const fresh = (0, key_draft_js_1.draftFromKey)(apiKey);
|
|
30
|
+
setDraft(fresh);
|
|
31
|
+
setBaseline(fresh);
|
|
32
|
+
setError(null);
|
|
33
|
+
}, [open, apiKey]);
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
35
|
+
if (!open || !dirty)
|
|
36
|
+
return;
|
|
37
|
+
const warnBeforeUnload = (event) => {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
event.returnValue = '';
|
|
40
|
+
};
|
|
41
|
+
window.addEventListener('beforeunload', warnBeforeUnload);
|
|
42
|
+
return () => window.removeEventListener('beforeunload', warnBeforeUnload);
|
|
43
|
+
}, [open, dirty]);
|
|
44
|
+
function handleOpenChange(next) {
|
|
45
|
+
if (!next) {
|
|
46
|
+
if (isPending)
|
|
47
|
+
return;
|
|
48
|
+
if (dirty && !window.confirm(t('unsavedChanges')))
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
onOpenChange(next);
|
|
52
|
+
}
|
|
53
|
+
function update(key, value) {
|
|
54
|
+
setDraft((current) => ({ ...current, [key]: value }));
|
|
55
|
+
}
|
|
56
|
+
function submit(event) {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
if (inFlight.current)
|
|
59
|
+
return;
|
|
60
|
+
const problem = (0, key_draft_js_1.validateDraft)(draft);
|
|
61
|
+
if (problem) {
|
|
62
|
+
setError(t(problem));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
inFlight.current = true;
|
|
66
|
+
setError(null);
|
|
67
|
+
startTransition(async () => {
|
|
68
|
+
try {
|
|
69
|
+
const result = await updateApiKeyAction(apiKey.id, (0, key_draft_js_1.payloadFromDraft)(draft));
|
|
70
|
+
if (result.error) {
|
|
71
|
+
setError(result.error);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
setBaseline(draft);
|
|
75
|
+
onOpenChange(false);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
setError(t('requestFailed'));
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
inFlight.current = false;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return ((0, jsx_runtime_1.jsx)(frontend_shell_1.Dialog, { open: open, onOpenChange: handleOpenChange, children: (0, jsx_runtime_1.jsx)(frontend_shell_1.DialogContent, { closeLabel: tCommon('close'), className: "max-h-[90svh] overflow-y-auto", children: (0, jsx_runtime_1.jsxs)("form", { onSubmit: submit, children: [(0, jsx_runtime_1.jsxs)(frontend_shell_1.DialogHeader, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.DialogTitle, { children: t('editApiKey') }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.DialogDescription, { children: [t('keyPrefix'), ": ", (0, jsx_runtime_1.jsxs)("span", { className: "font-mono", children: [apiKey.prefix, "\u2026"] })] })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.FieldGroup, { className: "py-4", children: [(0, jsx_runtime_1.jsxs)(frontend_shell_1.Field, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.FieldLabel, { htmlFor: `${formId}-name`, children: t('name') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.Input, { id: `${formId}-name`, value: draft.name, maxLength: 100, disabled: isPending, onChange: (event) => update('name', event.target.value) })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Field, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.FieldLabel, { htmlFor: `${formId}-role`, children: t('role') }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Select, { value: draft.roleId, onValueChange: (value) => update('roleId', value), disabled: isPending, children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.SelectTrigger, { id: `${formId}-role`, children: (0, jsx_runtime_1.jsx)(frontend_shell_1.SelectValue, { placeholder: t('selectRole') }) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.SelectContent, { children: roles.map((role) => ((0, jsx_runtime_1.jsx)(frontend_shell_1.SelectItem, { value: role.id, children: role.displayName }, role.id))) })] })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Field, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.FieldLabel, { htmlFor: `${formId}-acting`, children: t('actingUser') }), (0, jsx_runtime_1.jsx)(service_account_select_js_1.ServiceAccountSelect, { id: `${formId}-acting`, value: draft.actingUserId, accounts: serviceAccounts, disabled: isPending, search: searchServiceAccountsAction, onChange: (value) => update('actingUserId', value) })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Field, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.FieldLabel, { children: t('scopes') }), (0, jsx_runtime_1.jsx)(scope_checklist_js_1.ScopeChecklist, { idPrefix: `${formId}-scope`, options: scopeOptions, groups: scopeGroups, selected: draft.scopes, disabled: isPending, onChange: (scopes) => update('scopes', scopes) })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Field, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.FieldLabel, { htmlFor: `${formId}-rate`, children: t('rateLimit') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.Input, { id: `${formId}-rate`, type: "number", min: 1, max: 600, value: draft.rateLimit, disabled: isPending, onChange: (event) => update('rateLimit', event.target.value) })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Field, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.FieldLabel, { htmlFor: `${formId}-expires`, children: t('expiresAt') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.Input, { id: `${formId}-expires`, type: "datetime-local", value: draft.expiresAt, disabled: isPending, onChange: (event) => update('expiresAt', event.target.value) })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Label, { className: "flex items-center gap-2 font-normal", children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.Checkbox, { checked: draft.isActive, disabled: isPending, onCheckedChange: (checked) => update('isActive', checked === true) }), t('active')] }), error && (0, jsx_runtime_1.jsx)(frontend_shell_1.FieldError, { children: error })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.DialogFooter, { className: "py-2", children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.Button, { type: "button", variant: "outline", onClick: () => handleOpenChange(false), disabled: isPending, children: tCommon('cancel') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.Button, { type: "submit", disabled: isPending || !dirty, children: isPending ? t('saving') : tCommon('save') })] })] }) }) }));
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=edit-api-key-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-api-key-dialog.js","sourceRoot":"","sources":["../../src/frontend/edit-api-key-dialog.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAuDb,4CA8LC;;AAnPD,6DAqBkC;AAClC,iCAA0F;AAC1F,iDAAiG;AAC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AAO,EAAE,KAAK,CAAC,QAAQ,EACvB,QAAQ,EAAE,SAAS,EACnB,eAAe,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC,GAClE,EACD,CAAC,CAAC,QAAQ,CAAC,IACN,EACP,KAAK,IAAI,uBAAC,2BAAU,cAAE,KAAK,GAAc,IAC/B,EACb,wBAAC,6BAAY,IAAC,SAAS,EAAC,MAAM,aAC5B,uBAAC,uBAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,EACtC,QAAQ,EAAE,SAAS,YAElB,OAAO,CAAC,QAAQ,CAAC,GACX,EACT,uBAAC,uBAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,SAAS,IAAI,CAAC,KAAK,YAChD,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,GACnC,IACI,IACV,GACO,GACT,CACV,CAAC;AACJ,CAAC"}
|
package/dist/frontend/index.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ export { ApiKeyRowActions } from './api-key-row-actions.js';
|
|
|
2
2
|
export { ApiKeysTable } from './api-keys-table.js';
|
|
3
3
|
export { CreateApiKeyDialog } from './create-api-key-dialog.js';
|
|
4
4
|
export { CreatedApiKeyReveal } from './created-api-key-reveal.js';
|
|
5
|
-
export
|
|
5
|
+
export { EditApiKeyDialog } from './edit-api-key-dialog.js';
|
|
6
|
+
export { ScopeChecklist } from './scope-checklist.js';
|
|
7
|
+
export { ServiceAccountSelect } from './service-account-select.js';
|
|
8
|
+
export type { ApiKeyRoleOption, ApiKeyRoleRef, ApiKeyRow, ApiKeyRowActionsProps, ApiKeyScopeGroup, ApiKeyScopeOption, ApiKeySortField, ApiKeysTableKey, ApiKeysTableProps, ApiKeyUpdatePayload, CreateApiKeyDialogProps, CreateApiKeyResponse, CreateApiKeyResult, CreatedApiKeyRevealProps, SearchServiceAccountsAction, ServiceAccountOption, UpdateApiKeyResult, } from './types.js';
|
|
6
9
|
export { SCOPE_ACTIONS, SCOPE_RESOURCES } from './types.js';
|
|
7
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/frontend/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/frontend/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,2BAA2B,EAC3B,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/frontend/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SCOPE_RESOURCES = exports.SCOPE_ACTIONS = exports.CreatedApiKeyReveal = exports.CreateApiKeyDialog = exports.ApiKeysTable = exports.ApiKeyRowActions = void 0;
|
|
3
|
+
exports.SCOPE_RESOURCES = exports.SCOPE_ACTIONS = exports.ServiceAccountSelect = exports.ScopeChecklist = exports.EditApiKeyDialog = exports.CreatedApiKeyReveal = exports.CreateApiKeyDialog = exports.ApiKeysTable = exports.ApiKeyRowActions = void 0;
|
|
4
4
|
// Named re-exports, not `export * from`: TypeScript's CJS `export *` compiles to a `for...in`
|
|
5
5
|
// enumeration over the re-exported module (see `__exportStar`'s helper in the compiled output).
|
|
6
6
|
// Next.js's RSC client-reference proxy (what a 'use client' module becomes when required from a
|
|
@@ -16,6 +16,12 @@ var create_api_key_dialog_js_1 = require("./create-api-key-dialog.js");
|
|
|
16
16
|
Object.defineProperty(exports, "CreateApiKeyDialog", { enumerable: true, get: function () { return create_api_key_dialog_js_1.CreateApiKeyDialog; } });
|
|
17
17
|
var created_api_key_reveal_js_1 = require("./created-api-key-reveal.js");
|
|
18
18
|
Object.defineProperty(exports, "CreatedApiKeyReveal", { enumerable: true, get: function () { return created_api_key_reveal_js_1.CreatedApiKeyReveal; } });
|
|
19
|
+
var edit_api_key_dialog_js_1 = require("./edit-api-key-dialog.js");
|
|
20
|
+
Object.defineProperty(exports, "EditApiKeyDialog", { enumerable: true, get: function () { return edit_api_key_dialog_js_1.EditApiKeyDialog; } });
|
|
21
|
+
var scope_checklist_js_1 = require("./scope-checklist.js");
|
|
22
|
+
Object.defineProperty(exports, "ScopeChecklist", { enumerable: true, get: function () { return scope_checklist_js_1.ScopeChecklist; } });
|
|
23
|
+
var service_account_select_js_1 = require("./service-account-select.js");
|
|
24
|
+
Object.defineProperty(exports, "ServiceAccountSelect", { enumerable: true, get: function () { return service_account_select_js_1.ServiceAccountSelect; } });
|
|
19
25
|
var types_js_1 = require("./types.js");
|
|
20
26
|
Object.defineProperty(exports, "SCOPE_ACTIONS", { enumerable: true, get: function () { return types_js_1.SCOPE_ACTIONS; } });
|
|
21
27
|
Object.defineProperty(exports, "SCOPE_RESOURCES", { enumerable: true, get: function () { return types_js_1.SCOPE_RESOURCES; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/frontend/index.ts"],"names":[],"mappings":";;;AAAA,8FAA8F;AAC9F,gGAAgG;AAChG,gGAAgG;AAChG,8FAA8F;AAC9F,8FAA8F;AAC9F,4FAA4F;AAC5F,4CAA4C;AAC5C,mEAA4D;AAAnD,0HAAA,gBAAgB,OAAA;AACzB,yDAAmD;AAA1C,iHAAA,YAAY,OAAA;AACrB,uEAAgE;AAAvD,8HAAA,kBAAkB,OAAA;AAC3B,yEAAkE;AAAzD,gIAAA,mBAAmB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/frontend/index.ts"],"names":[],"mappings":";;;AAAA,8FAA8F;AAC9F,gGAAgG;AAChG,gGAAgG;AAChG,8FAA8F;AAC9F,8FAA8F;AAC9F,4FAA4F;AAC5F,4CAA4C;AAC5C,mEAA4D;AAAnD,0HAAA,gBAAgB,OAAA;AACzB,yDAAmD;AAA1C,iHAAA,YAAY,OAAA;AACrB,uEAAgE;AAAvD,8HAAA,kBAAkB,OAAA;AAC3B,yEAAkE;AAAzD,gIAAA,mBAAmB,OAAA;AAC5B,mEAA4D;AAAnD,0HAAA,gBAAgB,OAAA;AACzB,2DAAsD;AAA7C,oHAAA,cAAc,OAAA;AACvB,yEAAmE;AAA1D,iIAAA,oBAAoB,OAAA;AAoB7B,uCAA4D;AAAnD,yGAAA,aAAa,OAAA;AAAE,2GAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ApiKeyRow, ApiKeyUpdatePayload } from './types.js';
|
|
2
|
+
/** The editable fields of a key, held as form strings until submit. */
|
|
3
|
+
export interface ApiKeyDraft {
|
|
4
|
+
name: string;
|
|
5
|
+
roleId: string;
|
|
6
|
+
actingUserId: string;
|
|
7
|
+
scopes: string[];
|
|
8
|
+
rateLimit: string;
|
|
9
|
+
expiresAt: string;
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const NO_ACTING_USER = "__none";
|
|
13
|
+
/** Formats an ISO timestamp for a `datetime-local` input, in the viewer's local time. */
|
|
14
|
+
export declare function toLocalInput(iso: string): string;
|
|
15
|
+
export declare function draftFromKey(apiKey: ApiKeyRow): ApiKeyDraft;
|
|
16
|
+
/** Returns a translation key for the first problem found, or null when the draft can be sent. */
|
|
17
|
+
export declare function validateDraft(draft: ApiKeyDraft): 'nameRequired' | 'scopesRequired' | 'rateLimitInvalid' | 'expiresInvalid' | null;
|
|
18
|
+
export declare function payloadFromDraft(draft: ApiKeyDraft): ApiKeyUpdatePayload;
|
|
19
|
+
//# sourceMappingURL=key-draft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-draft.d.ts","sourceRoot":"","sources":["../../src/frontend/key-draft.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjE,uEAAuE;AACvE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,WAAW,CAAC;AAEvC,yFAAyF;AACzF,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,WAAW,CAU3D;AAED,iGAAiG;AACjG,wBAAgB,aAAa,CAC3B,KAAK,EAAE,WAAW,GACjB,cAAc,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,IAAI,CASlF;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAUxE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NO_ACTING_USER = void 0;
|
|
4
|
+
exports.toLocalInput = toLocalInput;
|
|
5
|
+
exports.draftFromKey = draftFromKey;
|
|
6
|
+
exports.validateDraft = validateDraft;
|
|
7
|
+
exports.payloadFromDraft = payloadFromDraft;
|
|
8
|
+
exports.NO_ACTING_USER = '__none';
|
|
9
|
+
/** Formats an ISO timestamp for a `datetime-local` input, in the viewer's local time. */
|
|
10
|
+
function toLocalInput(iso) {
|
|
11
|
+
const date = new Date(iso);
|
|
12
|
+
const pad = (value) => String(value).padStart(2, '0');
|
|
13
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
|
14
|
+
}
|
|
15
|
+
function draftFromKey(apiKey) {
|
|
16
|
+
return {
|
|
17
|
+
name: apiKey.name,
|
|
18
|
+
roleId: apiKey.roleId,
|
|
19
|
+
actingUserId: apiKey.actingUserId ?? exports.NO_ACTING_USER,
|
|
20
|
+
scopes: [...apiKey.scopes],
|
|
21
|
+
rateLimit: apiKey.rateLimit === null ? '' : String(apiKey.rateLimit),
|
|
22
|
+
expiresAt: apiKey.expiresAt ? toLocalInput(apiKey.expiresAt) : '',
|
|
23
|
+
isActive: apiKey.isActive,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** Returns a translation key for the first problem found, or null when the draft can be sent. */
|
|
27
|
+
function validateDraft(draft) {
|
|
28
|
+
if (!draft.name.trim())
|
|
29
|
+
return 'nameRequired';
|
|
30
|
+
if (draft.scopes.length === 0)
|
|
31
|
+
return 'scopesRequired';
|
|
32
|
+
if (draft.rateLimit.trim() !== '') {
|
|
33
|
+
const limit = Number(draft.rateLimit);
|
|
34
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 600)
|
|
35
|
+
return 'rateLimitInvalid';
|
|
36
|
+
}
|
|
37
|
+
if (draft.expiresAt && Number.isNaN(new Date(draft.expiresAt).getTime()))
|
|
38
|
+
return 'expiresInvalid';
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
function payloadFromDraft(draft) {
|
|
42
|
+
return {
|
|
43
|
+
name: draft.name.trim(),
|
|
44
|
+
roleId: draft.roleId,
|
|
45
|
+
actingUserId: draft.actingUserId === exports.NO_ACTING_USER ? null : draft.actingUserId,
|
|
46
|
+
scopes: draft.scopes,
|
|
47
|
+
rateLimit: draft.rateLimit.trim() === '' ? null : Number(draft.rateLimit),
|
|
48
|
+
expiresAt: draft.expiresAt ? new Date(draft.expiresAt).toISOString() : null,
|
|
49
|
+
isActive: draft.isActive,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=key-draft.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-draft.js","sourceRoot":"","sources":["../../src/frontend/key-draft.ts"],"names":[],"mappings":";;;AAgBA,oCAIC;AAED,oCAUC;AAGD,sCAWC;AAED,4CAUC;AA7CY,QAAA,cAAc,GAAG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ope checkboxes grouped by App-supplied display groups. Groups keep the order they were given;
|
|
4
|
+
* scopes without a known group are shown under the platform group so nothing is hidden.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ScopeChecklist({ options, groups, selected, onChange, disabled, idPrefix, }: {
|
|
7
|
+
options: ApiKeyScopeOption[];
|
|
8
|
+
groups?: ApiKeyScopeGroup[];
|
|
9
|
+
selected: string[];
|
|
10
|
+
onChange: (next: string[]) => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
idPrefix: string;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=scope-checklist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-checklist.d.ts","sourceRoot":"","sources":["../../src/frontend/scope-checklist.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAItE;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,+BAmDA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ScopeChecklist = ScopeChecklist;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const frontend_shell_1 = require("@haneinfo/frontend-shell");
|
|
7
|
+
const PLATFORM_GROUP = 'platform';
|
|
8
|
+
/**
|
|
9
|
+
* Scope checkboxes grouped by App-supplied display groups. Groups keep the order they were given;
|
|
10
|
+
* scopes without a known group are shown under the platform group so nothing is hidden.
|
|
11
|
+
*/
|
|
12
|
+
function ScopeChecklist({ options, groups, selected, onChange, disabled, idPrefix, }) {
|
|
13
|
+
const ordered = [...(groups ?? [])];
|
|
14
|
+
if (!ordered.some((group) => group.key === PLATFORM_GROUP)) {
|
|
15
|
+
ordered.push({ key: PLATFORM_GROUP, label: 'Platform' });
|
|
16
|
+
}
|
|
17
|
+
const knownKeys = new Set(ordered.map((group) => group.key));
|
|
18
|
+
const sections = ordered
|
|
19
|
+
.map((group) => ({
|
|
20
|
+
...group,
|
|
21
|
+
items: options.filter((option) => {
|
|
22
|
+
const key = option.group && knownKeys.has(option.group) ? option.group : PLATFORM_GROUP;
|
|
23
|
+
return key === group.key;
|
|
24
|
+
}),
|
|
25
|
+
}))
|
|
26
|
+
.filter((section) => section.items.length > 0);
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-4", children: sections.map((section) => ((0, jsx_runtime_1.jsxs)("fieldset", { className: "flex flex-col gap-2", children: [(0, jsx_runtime_1.jsx)("legend", { className: "mb-1 font-medium text-muted-foreground text-xs", children: section.label }), section.items.map((option, index) => {
|
|
28
|
+
const checkboxId = `${idPrefix}-${section.key}-${index}`;
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)(frontend_shell_1.Label, { htmlFor: checkboxId, className: "flex items-center gap-2 font-normal", children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.Checkbox, { id: checkboxId, disabled: disabled, checked: selected.includes(option.value), onCheckedChange: (checked) => onChange(checked === true
|
|
30
|
+
? [...selected, option.value]
|
|
31
|
+
: selected.filter((value) => value !== option.value)) }), (0, jsx_runtime_1.jsx)("span", { className: "font-mono text-xs", children: option.label })] }, option.value));
|
|
32
|
+
})] }, section.key))) }));
|
|
33
|
+
}
|
|
34
|
+
//# sourceMapp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
* Acting-user picker. Lists service accounts only. With a search action, the list comes from the
|
|
4
|
+
* server (at most 20 per request), so the picker never holds accounts the admin page did not load.
|
|
5
|
+
* Choosing an account here grants nothing: authority still comes from the key's Role and scopes.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ServiceAccountSelect({ id, value, accounts, onChange, disabled, search, }: {
|
|
8
|
+
id: string;
|
|
9
|
+
value: string;
|
|
10
|
+
accounts: ServiceAccountOption[];
|
|
11
|
+
onChange: (next: string) => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
search?: SearchServiceAccountsAction;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=service-account-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-account-select.d.ts","sourceRoot":"","sources":["../../src/frontend/service-account-select.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAIpF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,EAAE,EACF,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,MAAM,GACP,EAAE;IACD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACjC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,2BAA2B,CAAC;CACtC,+BA4DA"}
|