@haneinfo/m2m-api-key 8.0.5 → 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 +81 -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
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Scopes that gate key management for machine callers (see `ApiKeysController`). */
|
|
2
|
+
export declare const API_KEY_MANAGEMENT_SCOPES: readonly ["api-keys:read", "api-keys:write"];
|
|
3
|
+
/** The subset of the Prisma client this upgrade needs, so callers pass their own `PrismaService`. */
|
|
4
|
+
export interface AdminKeyScopeStore {
|
|
5
|
+
apiKey: {
|
|
6
|
+
findMany(args: {
|
|
7
|
+
where: {
|
|
8
|
+
role: {
|
|
9
|
+
name: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
select: {
|
|
13
|
+
id: true;
|
|
14
|
+
scopes: true;
|
|
15
|
+
};
|
|
16
|
+
}): Promise<{
|
|
17
|
+
id: string;
|
|
18
|
+
scopes: string[];
|
|
19
|
+
}[]>;
|
|
20
|
+
update(args: {
|
|
21
|
+
where: {
|
|
22
|
+
id: string;
|
|
23
|
+
};
|
|
24
|
+
data: {
|
|
25
|
+
scopes: string[];
|
|
26
|
+
};
|
|
27
|
+
}): Promise<unknown>;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* One-time upgrade for keys issued before `api-keys:*` existed. Adds the two management scopes to
|
|
32
|
+
* keys whose Role is ADMIN, which is the power those keys already had through the ADMIN gate, so no
|
|
33
|
+
* key gains access it did not have. Keys on other roles are left alone.
|
|
34
|
+
*
|
|
35
|
+
* Run it once from the app's upgrade or migration script. Do not run it on every boot: it would
|
|
36
|
+
* re-grant a scope an operator removed on purpose. Returns the number of keys updated.
|
|
37
|
+
*/
|
|
38
|
+
export declare function grantAdminKeyManagementScopes(store: AdminKeyScopeStore): Promise<number>;
|
|
39
|
+
//# sourceMappingURL=admin-key-scope-upgrade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-key-scope-upgrade.d.ts","sourceRoot":"","sources":["../src/admin-key-scope-upgrade.ts"],"names":[],"mappings":"AAEA,qFAAqF;AACrF,eAAO,MAAM,yBAAyB,8CAA+C,CAAC;AAEtF,qGAAqG;AACrG,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE;QACN,QAAQ,CAAC,IAAI,EAAE;YACb,KAAK,EAAE;gBAAE,IAAI,EAAE;oBAAE,IAAI,EAAE,MAAM,CAAA;iBAAE,CAAA;aAAE,CAAC;YAClC,MAAM,EAAE;gBAAE,EAAE,EAAE,IAAI,CAAC;gBAAC,MAAM,EAAE,IAAI,CAAA;aAAE,CAAC;SACpC,GAAG,OAAO,CAAC;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,EAAE,CAAA;SAAE,EAAE,CAAC,CAAC;QAChD,MAAM,CAAC,IAAI,EAAE;YAAE,KAAK,EAAE;gBAAE,EAAE,EAAE,MAAM,CAAA;aAAE,CAAC;YAAC,IAAI,EAAE;gBAAE,MAAM,EAAE,MAAM,EAAE,CAAA;aAAE,CAAA;SAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;KACvF,CAAC;CACH;AAED;;;;;;;GAOG;AACH,wBAAsB,6BAA6B,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB9F"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.API_KEY_MANAGEMENT_SCOPES = void 0;
|
|
4
|
+
exports.grantAdminKeyManagementScopes = grantAdminKeyManagementScopes;
|
|
5
|
+
const plugin_api_1 = require("@haneinfo/plugin-api");
|
|
6
|
+
/** Scopes that gate key management for machine callers (see `ApiKeysController`). */
|
|
7
|
+
exports.API_KEY_MANAGEMENT_SCOPES = ['api-keys:read', 'api-keys:write'];
|
|
8
|
+
/**
|
|
9
|
+
* One-time upgrade for keys issued before `api-keys:*` existed. Adds the two management scopes to
|
|
10
|
+
* keys whose Role is ADMIN, which is the power those keys already had through the ADMIN gate, so no
|
|
11
|
+
* key gains access it did not have. Keys on other roles are left alone.
|
|
12
|
+
*
|
|
13
|
+
* Run it once from the app's upgrade or migration script. Do not run it on every boot: it would
|
|
14
|
+
* re-grant a scope an operator removed on purpose. Returns the number of keys updated.
|
|
15
|
+
*/
|
|
16
|
+
async function grantAdminKeyManagementScopes(store) {
|
|
17
|
+
const keys = await store.apiKey.findMany({
|
|
18
|
+
where: { role: { name: plugin_api_1.SYSTEM_ADMIN_ROLE } },
|
|
19
|
+
select: { id: true, scopes: true },
|
|
20
|
+
});
|
|
21
|
+
let updated = 0;
|
|
22
|
+
for (const key of keys) {
|
|
23
|
+
const missing = exports.API_KEY_MANAGEMENT_SCOPES.filter((scope) => !key.scopes.includes(scope));
|
|
24
|
+
if (missing.length === 0)
|
|
25
|
+
continue;
|
|
26
|
+
await store.apiKey.update({
|
|
27
|
+
where: { id: key.id },
|
|
28
|
+
data: { scopes: [...key.scopes, ...missing] },
|
|
29
|
+
});
|
|
30
|
+
updated += 1;
|
|
31
|
+
}
|
|
32
|
+
return updated;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=admin-key-scope-upgrade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-key-scope-upgrade.js","sourceRoot":"","sources":["../src/admin-key-scope-upgrade.ts"],"names":[],"mappings":";;;AAwBA,sEAiBC;AAzCD,qDAAyD;AAEzD,qFAAqF;AACxE,QAAA,yBAAyB,GAAG,CAAC,eAAe,EAAE,gBAAgB,CAAU,CAAC;AAatF;;;;;;;GAOG;AACI,KAAK,UAAU,6BAA6B,CAAC,KAAyB;IAC3E,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,8BAAiB,EAAE,EAAE;QAC5C,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;KACnC,CAAC,CAAC;IAEH,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,iCAAyB,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QACzF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACnC,MAAM,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;YACxB,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE;YACrB,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE;SAC9C,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,CAAC;IACf,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -2,11 +2,15 @@ import type { PaginationQuery } from '@haneinfo/common';
|
|
|
2
2
|
import { type AuditSinkPort } from '@haneinfo/plugin-api';
|
|
3
3
|
import { ApiKeysService } from './api-keys.service';
|
|
4
4
|
import type { CreateApiKeyDto, UpdateApiKeyDto } from './dto/api-key.dto';
|
|
5
|
+
import { M2mScopeCatalogService } from './scope-catalog';
|
|
6
|
+
export declare const API_KEYS_READ_SCOPE = "api-keys:read";
|
|
7
|
+
export declare const API_KEYS_WRITE_SCOPE = "api-keys:write";
|
|
5
8
|
export declare class ApiKeysController {
|
|
6
9
|
private readonly apiKeysService;
|
|
10
|
+
private readonly catalog;
|
|
7
11
|
private readonly auditSink?;
|
|
8
12
|
private readonly logger;
|
|
9
|
-
constructor(apiKeysService: ApiKeysService, auditSink?: AuditSinkPort | undefined);
|
|
13
|
+
constructor(apiKeysService: ApiKeysService, catalog: M2mScopeCatalogService, auditSink?: AuditSinkPort | undefined);
|
|
10
14
|
private recordAudit;
|
|
11
15
|
create(dto: CreateApiKeyDto, actor: {
|
|
12
16
|
sub: string;
|
|
@@ -14,6 +18,11 @@ export declare class ApiKeysController {
|
|
|
14
18
|
isApiKey?: boolean;
|
|
15
19
|
}): Promise<import("./dto/api-key.dto").CreateApiKeyResponse>;
|
|
16
20
|
findAll(query: PaginationQuery): Promise<import("@haneinfo/common").PaginatedResult<import("./api-keys.service").ApiKeyRecord>>;
|
|
21
|
+
/** The grantable scopes, for the key editor. Declared before `:id` so it is not captured as an id. */
|
|
22
|
+
listScopes(): {
|
|
23
|
+
groups: import("./scope-catalog").CatalogGroup[];
|
|
24
|
+
scopes: import("./scope-catalog").CatalogScope[];
|
|
25
|
+
};
|
|
17
26
|
findOne(id: string): Promise<import("./api-keys.service").ApiKeyRecord>;
|
|
18
27
|
update(id: string, dto: UpdateApiKeyDto, actor: {
|
|
19
28
|
sub: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.controller.d.ts","sourceRoot":"","sources":["../src/api-keys.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAiBtE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"api-keys.controller.d.ts","sourceRoot":"","sources":["../src/api-keys.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAiBtE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAI1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AACnD,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AAIrD,qBAEa,iBAAiB;IAIF,OAAO,CAAC,QAAQ,CAAC,cAAc;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;IAL7D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsC;gBAGlB,cAAc,EAAE,cAAc,EACtB,OAAO,EAAE,sBAAsB,EAC/B,SAAS,CAAC,EAAE,aAAa,YAAA;IAM5E,OAAO,CAAC,WAAW;IAsBb,MAAM,CACuC,GAAG,EAAE,eAAe,EAEtD,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE;IAS3E,OAAO,CAAsD,KAAK,EAAE,eAAe;IAInF,sGAAsG;IAGtG,UAAU;;;;IAMV,OAAO,CAAc,EAAE,EAAE,MAAM;IAMzB,MAAM,CACG,EAAE,EAAE,MAAM,EAC0B,GAAG,EAAE,eAAe,EACtD,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE;IAUrE,MAAM,CACG,EAAE,EAAE,MAAM,EACR,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE;CAK5E"}
|
|
@@ -13,18 +13,25 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
var ApiKeysController_1;
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.ApiKeysController = void 0;
|
|
16
|
+
exports.ApiKeysController = exports.API_KEYS_WRITE_SCOPE = exports.API_KEYS_READ_SCOPE = void 0;
|
|
17
17
|
const common_1 = require("@haneinfo/common");
|
|
18
18
|
const plugin_api_1 = require("@haneinfo/plugin-api");
|
|
19
19
|
const plugin_host_nest_1 = require("@haneinfo/plugin-host-nest");
|
|
20
20
|
const common_2 = require("@nestjs/common");
|
|
21
21
|
const api_keys_service_1 = require("./api-keys.service");
|
|
22
|
+
const scopes_decorator_1 = require("./decorators/scopes.decorator");
|
|
22
23
|
const api_key_dto_1 = require("./dto/api-key.dto");
|
|
23
24
|
const admin_guard_1 = require("./guards/admin.guard");
|
|
24
|
-
|
|
25
|
+
const scope_guard_1 = require("./guards/scope.guard");
|
|
26
|
+
const scope_catalog_1 = require("./scope-catalog");
|
|
27
|
+
exports.API_KEYS_READ_SCOPE = 'api-keys:read';
|
|
28
|
+
exports.API_KEYS_WRITE_SCOPE = 'api-keys:write';
|
|
29
|
+
// API key management is ADMIN-only per user requirement. Machine callers must additionally hold
|
|
30
|
+
// api-keys:read (GET) or api-keys:write (other methods); JWT callers are not scope-restricted.
|
|
25
31
|
let ApiKeysController = ApiKeysController_1 = class ApiKeysController {
|
|
26
|
-
constructor(apiKeysService, auditSink) {
|
|
32
|
+
constructor(apiKeysService, catalog, auditSink) {
|
|
27
33
|
this.apiKeysService = apiKeysService;
|
|
34
|
+
this.catalog = catalog;
|
|
28
35
|
this.auditSink = auditSink;
|
|
29
36
|
this.logger = new common_2.Logger(ApiKeysController_1.name);
|
|
30
37
|
}
|
|
@@ -54,6 +61,10 @@ let ApiKeysController = ApiKeysController_1 = class ApiKeysController {
|
|
|
54
61
|
findAll(query) {
|
|
55
62
|
return this.apiKeysService.findAll(query);
|
|
56
63
|
}
|
|
64
|
+
/** The grantable scopes, for the key editor. Declared before `:id` so it is not captured as an id. */
|
|
65
|
+
listScopes() {
|
|
66
|
+
return { groups: this.catalog.groups(), scopes: this.catalog.describe() };
|
|
67
|
+
}
|
|
57
68
|
findOne(id) {
|
|
58
69
|
return this.apiKeysService.findOne(id);
|
|
59
70
|
}
|
|
@@ -70,6 +81,7 @@ let ApiKeysController = ApiKeysController_1 = class ApiKeysController {
|
|
|
70
81
|
exports.ApiKeysController = ApiKeysController;
|
|
71
82
|
__decorate([
|
|
72
83
|
(0, common_2.Post)(),
|
|
84
|
+
(0, scopes_decorator_1.Scopes)(exports.API_KEYS_WRITE_SCOPE),
|
|
73
85
|
__param(0, (0, common_2.Body)(new common_1.ZodValidationPipe(api_key_dto_1.createApiKeySchema))),
|
|
74
86
|
__param(1, (0, plugin_host_nest_1.CurrentUser)()),
|
|
75
87
|
__metadata("design:type", Function),
|
|
@@ -78,13 +90,22 @@ __decorate([
|
|
|
78
90
|
], ApiKeysController.prototype, "create", null);
|
|
79
91
|
__decorate([
|
|
80
92
|
(0, common_2.Get)(),
|
|
93
|
+
(0, scopes_decorator_1.Scopes)(exports.API_KEYS_READ_SCOPE),
|
|
81
94
|
__param(0, (0, common_2.Query)(new common_1.ZodValidationPipe(common_1.paginationQuerySchema))),
|
|
82
95
|
__metadata("design:type", Function),
|
|
83
96
|
__metadata("design:paramtypes", [Object]),
|
|
84
97
|
__metadata("design:returntype", void 0)
|
|
85
98
|
], ApiKeysController.prototype, "findAll", null);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, common_2.Get)('scopes'),
|
|
101
|
+
(0, scopes_decorator_1.Scopes)(exports.API_KEYS_READ_SCOPE),
|
|
102
|
+
__metadata("design:type", Function),
|
|
103
|
+
__metadata("design:paramtypes", []),
|
|
104
|
+
__metadata("design:returntype", void 0)
|
|
105
|
+
], ApiKeysController.prototype, "listScopes", null);
|
|
86
106
|
__decorate([
|
|
87
107
|
(0, common_2.Get)(':id'),
|
|
108
|
+
(0, scopes_decorator_1.Scopes)(exports.API_KEYS_READ_SCOPE),
|
|
88
109
|
__param(0, (0, common_2.Param)('id')),
|
|
89
110
|
__metadata("design:type", Function),
|
|
90
111
|
__metadata("design:paramtypes", [String]),
|
|
@@ -92,6 +113,7 @@ __decorate([
|
|
|
92
113
|
], ApiKeysController.prototype, "findOne", null);
|
|
93
114
|
__decorate([
|
|
94
115
|
(0, common_2.Patch)(':id'),
|
|
116
|
+
(0, scopes_decorator_1.Scopes)(exports.API_KEYS_WRITE_SCOPE),
|
|
95
117
|
__param(0, (0, common_2.Param)('id')),
|
|
96
118
|
__param(1, (0, common_2.Body)(new common_1.ZodValidationPipe(api_key_dto_1.updateApiKeySchema))),
|
|
97
119
|
__param(2, (0, plugin_host_nest_1.CurrentUser)()),
|
|
@@ -102,6 +124,7 @@ __decorate([
|
|
|
102
124
|
__decorate([
|
|
103
125
|
(0, common_2.Delete)(':id'),
|
|
104
126
|
(0, common_2.HttpCode)(204),
|
|
127
|
+
(0, scopes_decorator_1.Scopes)(exports.API_KEYS_WRITE_SCOPE),
|
|
105
128
|
__param(0, (0, common_2.Param)('id')),
|
|
106
129
|
__param(1, (0, plugin_host_nest_1.CurrentUser)()),
|
|
107
130
|
__metadata("design:type", Function),
|
|
@@ -110,10 +133,12 @@ __decorate([
|
|
|
110
133
|
], ApiKeysController.prototype, "remove", null);
|
|
111
134
|
exports.ApiKeysController = ApiKeysController = ApiKeysController_1 = __decorate([
|
|
112
135
|
(0, common_2.Controller)('api-keys'),
|
|
113
|
-
(0, common_2.UseGuards)(plugin_host_nest_1.HaneinfoAuthGuard, admin_guard_1.ApiKeyAdminGuard),
|
|
136
|
+
(0, common_2.UseGuards)(plugin_host_nest_1.HaneinfoAuthGuard, admin_guard_1.ApiKeyAdminGuard, scope_guard_1.ScopeGuard),
|
|
114
137
|
__param(0, (0, common_2.Inject)(api_keys_service_1.ApiKeysService)),
|
|
115
|
-
__param(1, (0, common_2.
|
|
116
|
-
__param(
|
|
117
|
-
|
|
138
|
+
__param(1, (0, common_2.Inject)(scope_catalog_1.M2mScopeCatalogService)),
|
|
139
|
+
__param(2, (0, common_2.Optional)()),
|
|
140
|
+
__param(2, (0, common_2.Inject)(plugin_api_1.AUDIT_SINK)),
|
|
141
|
+
__metadata("design:paramtypes", [api_keys_service_1.ApiKeysService,
|
|
142
|
+
scope_catalog_1.M2mScopeCatalogService, Object])
|
|
118
143
|
], ApiKeysController);
|
|
119
144
|
//# sourceMappingURL=api-keys.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.controller.js","sourceRoot":"","sources":["../src/api-keys.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,6CAAyF;AACzF,qDAAsE;AACtE,iEAA4E;AAC5E,2CAcwB;AACxB,yDAAoD;
|
|
1
|
+
{"version":3,"file":"api-keys.controller.js","sourceRoot":"","sources":["../src/api-keys.controller.ts"],"names":[],"mappings":";;;;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Ac,CAAC,CAAA;IACtB,WAAA,IAAA,eAAM,EAAC,sCAAsB,CAAC,CAAA;IAC9B,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,uBAAU,CAAC,CAAA;qCAF0B,iCAAc;QACb,sCAAsB;GALvE,iBAAiB,CAqF7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.module.d.ts","sourceRoot":"","sources":["../src/api-keys.module.ts"],"names":[],"mappings":"AACA,OAAO,EACL,8BAA8B,EAG/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"api-keys.module.d.ts","sourceRoot":"","sources":["../src/api-keys.module.ts"],"names":[],"mappings":"AACA,OAAO,EACL,8BAA8B,EAG/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AASnE;;;;;;;;;;GAUG;AACH,qBA4Ba,aAAc,YAAW,YAAY;IAG9C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAEzB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAFR,QAAQ,EAAE,8BAA8B,EAExC,QAAQ,EAAE,qBAAqB;IAGlD;;OAEG;IACH,YAAY,IAAI,IAAI;CAKrB"}
|
package/dist/api-keys.module.js
CHANGED
|
@@ -16,6 +16,7 @@ exports.ApiKeysModule = void 0;
|
|
|
16
16
|
const plugin_api_1 = require("@haneinfo/plugin-api");
|
|
17
17
|
const plugin_host_nest_1 = require("@haneinfo/plugin-host-nest");
|
|
18
18
|
const common_1 = require("@nestjs/common");
|
|
19
|
+
const core_1 = require("@nestjs/core");
|
|
19
20
|
const api_key_guard_1 = require("./api-key.guard");
|
|
20
21
|
const api_key_machine_strategy_1 = require("./api-key-machine.strategy");
|
|
21
22
|
const api_key_rate_limiter_1 = require("./api-key-rate-limiter");
|
|
@@ -23,6 +24,7 @@ const api_keys_controller_1 = require("./api-keys.controller");
|
|
|
23
24
|
const api_keys_service_1 = require("./api-keys.service");
|
|
24
25
|
const admin_guard_1 = require("./guards/admin.guard");
|
|
25
26
|
const scope_guard_1 = require("./guards/scope.guard");
|
|
27
|
+
const scope_catalog_1 = require("./scope-catalog");
|
|
26
28
|
const scope_matcher_service_1 = require("./scope-matcher.service");
|
|
27
29
|
/**
|
|
28
30
|
* Machine-to-Machine API Keys capability module (051 PL4-03).
|
|
@@ -52,7 +54,7 @@ let ApiKeysModule = class ApiKeysModule {
|
|
|
52
54
|
exports.ApiKeysModule = ApiKeysModule;
|
|
53
55
|
exports.ApiKeysModule = ApiKeysModule = __decorate([
|
|
54
56
|
(0, common_1.Module)({
|
|
55
|
-
imports: [plugin_host_nest_1.HaneinfoAuthInfrastructureModule],
|
|
57
|
+
imports: [plugin_host_nest_1.HaneinfoAuthInfrastructureModule, core_1.DiscoveryModule],
|
|
56
58
|
controllers: [api_keys_controller_1.ApiKeysController],
|
|
57
59
|
providers: [
|
|
58
60
|
api_keys_service_1.ApiKeysService,
|
|
@@ -63,6 +65,7 @@ exports.ApiKeysModule = ApiKeysModule = __decorate([
|
|
|
63
65
|
scope_guard_1.ScopeGuard,
|
|
64
66
|
api_key_machine_strategy_1.ApiKeyMachineStrategy,
|
|
65
67
|
scope_matcher_service_1.ScopeMatcherService,
|
|
68
|
+
scope_catalog_1.M2mScopeCatalogService,
|
|
66
69
|
{ provide: plugin_api_1.SCOPE_MATCHER, useExisting: scope_matcher_service_1.ScopeMatcherService },
|
|
67
70
|
],
|
|
68
71
|
exports: [
|
|
@@ -74,6 +77,7 @@ exports.ApiKeysModule = ApiKeysModule = __decorate([
|
|
|
74
77
|
scope_guard_1.ScopeGuard,
|
|
75
78
|
api_key_machine_strategy_1.ApiKeyMachineStrategy,
|
|
76
79
|
scope_matcher_service_1.ScopeMatcherService,
|
|
80
|
+
scope_catalog_1.M2mScopeCatalogService,
|
|
77
81
|
plugin_api_1.SCOPE_MATCHER,
|
|
78
82
|
],
|
|
79
83
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.module.js","sourceRoot":"","sources":["../src/api-keys.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qDAAqD;AACrD,iEAIoC;AACpC,2CAAmE;AACnE,mDAA8C;AAC9C,yEAAmE;AACnE,iEAA2D;AAC3D,+DAA0D;AAC1D,yDAAoD;AACpD,sDAAwD;AACxD,sDAAkD;AAClD,mEAA8D;AAE9D;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"api-keys.module.js","sourceRoot":"","sources":["../src/api-keys.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qDAAqD;AACrD,iEAIoC;AACpC,2CAAmE;AACnE,uCAA+C;AAC/C,mDAA8C;AAC9C,yEAAmE;AACnE,iEAA2D;AAC3D,+DAA0D;AAC1D,yDAAoD;AACpD,sDAAwD;AACxD,sDAAkD;AAClD,mDAAyD;AACzD,mEAA8D;AAE9D;;;;;;;;;;GAUG;AA6BI,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAEmB,QAAwC,EAExC,QAA+B;QAF/B,aAAQ,GAAR,QAAQ,CAAgC;QAExC,aAAQ,GAAR,QAAQ,CAAuB;IAC/C,CAAC;IAEJ;;OAEG;IACH,YAAY;QACV,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;YACzC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF,CAAA;AAhBY,sCAAa;wBAAb,aAAa;IA5BzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,mDAAgC,EAAE,sBAAe,CAAC;QAC5D,WAAW,EAAE,CAAC,uCAAiB,CAAC;QAChC,SAAS,EAAE;YACT,iCAAc;YACd,2BAAW;YACX,wCAAiB;YACjB,8BAAgB;YAChB,oCAAiB;YACjB,wBAAU;YACV,gDAAqB;YACrB,2CAAmB;YACnB,sCAAsB;YACtB,EAAE,OAAO,EAAE,0BAAa,EAAE,WAAW,EAAE,2CAAmB,EAAE;SAC7D;QACD,OAAO,EAAE;YACP,iCAAc;YACd,2BAAW;YACX,wCAAiB;YACjB,8BAAgB;YAChB,oCAAiB;YACjB,wBAAU;YACV,gDAAqB;YACrB,2CAAmB;YACnB,sCAAsB;YACtB,0BAAa;SACd;KACF,CAAC;IAGG,WAAA,IAAA,eAAM,EAAC,iDAA8B,CAAC,CAAA;IAEtC,WAAA,IAAA,eAAM,EAAC,gDAAqB,CAAC,CAAA;qCADH,iDAA8B;QAE9B,gDAAqB;GALvC,aAAa,CAgBzB"}
|
|
@@ -2,6 +2,7 @@ import type { PaginatedResult, PaginationQuery } from '@haneinfo/common';
|
|
|
2
2
|
import { PrismaService } from '@haneinfo/common';
|
|
3
3
|
import { type IdentityStorePort } from '@haneinfo/plugin-api';
|
|
4
4
|
import { CreateApiKeyDto, CreateApiKeyResponse, RoleRef, UpdateApiKeyDto } from './dto/api-key.dto';
|
|
5
|
+
import { M2mScopeCatalogService } from './scope-catalog';
|
|
5
6
|
export interface ApiKeyRecord {
|
|
6
7
|
id: string;
|
|
7
8
|
name: string;
|
|
@@ -30,6 +31,8 @@ export declare class ApiKeysService {
|
|
|
30
31
|
* Phase 1 split is specifically removing.
|
|
31
32
|
*/
|
|
32
33
|
private readonly identityStore;
|
|
34
|
+
/** Scope issuance is checked against the catalog, so an unknown scope cannot be granted. */
|
|
35
|
+
private readonly catalog;
|
|
33
36
|
constructor(prisma: PrismaService,
|
|
34
37
|
/**
|
|
35
38
|
* PL0-04 §1 found this service reading `identity-core`'s `User` table directly to validate an
|
|
@@ -39,7 +42,9 @@ export declare class ApiKeysService {
|
|
|
39
42
|
* Required: accepting a fallback direct query would preserve the cross-owner dependency the
|
|
40
43
|
* Phase 1 split is specifically removing.
|
|
41
44
|
*/
|
|
42
|
-
identityStore: IdentityStorePort
|
|
45
|
+
identityStore: IdentityStorePort,
|
|
46
|
+
/** Scope issuance is checked against the catalog, so an unknown scope cannot be granted. */
|
|
47
|
+
catalog: M2mScopeCatalogService);
|
|
43
48
|
create(dto: CreateApiKeyDto, createdBy?: string): Promise<CreateApiKeyResponse>;
|
|
44
49
|
findAll(query: PaginationQuery): Promise<PaginatedResult<ApiKeyRecord>>;
|
|
45
50
|
findOne(id: string): Promise<ApiKeyRecord>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.service.d.ts","sourceRoot":"","sources":["../src/api-keys.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,aAAa,EAA2C,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"api-keys.service.d.ts","sourceRoot":"","sources":["../src/api-keys.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,aAAa,EAA2C,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC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B;CAS/B"}
|
package/dist/api-keys.service.js
CHANGED
|
@@ -17,16 +17,10 @@ const node_crypto_1 = require("node:crypto");
|
|
|
17
17
|
const common_1 = require("@haneinfo/common");
|
|
18
18
|
const plugin_api_1 = require("@haneinfo/plugin-api");
|
|
19
19
|
const common_2 = require("@nestjs/common");
|
|
20
|
+
const scope_catalog_1 = require("./scope-catalog");
|
|
20
21
|
exports.KEY_PREFIX = 'an_live_';
|
|
21
22
|
const PREFIX_DISPLAY_LENGTH = 16;
|
|
22
23
|
const ALLOWED_SORT_FIELDS = ['name', 'createdAt', 'lastUsedAt', 'expiresAt'];
|
|
23
|
-
// resource:action, e.g. "users:read" — action is read/write/call/*, or the bare wildcard
|
|
24
|
-
// "*". "call" was added for dev_docs 025's mcp-gateway aggregator (gateway:call, the
|
|
25
|
-
// call_tool meta-tool's requiredScopes) -- a forwarded tool invocation isn't itself a
|
|
26
|
-
// read or a write on the gateway's own resources, so neither existing action word fit.
|
|
27
|
-
// This is a format-only check; cross-referencing against the app's real scope catalog
|
|
28
|
-
// is deferred until @haneinfo/metadata-schema exists (dev_docs/003).
|
|
29
|
-
const SCOPE_PATTERN = /^[a-z0-9_-]+:(read|write|call|\*)$/;
|
|
30
24
|
const API_KEY_SELECT = {
|
|
31
25
|
id: true,
|
|
32
26
|
name: true,
|
|
@@ -44,9 +38,10 @@ const API_KEY_SELECT = {
|
|
|
44
38
|
updatedAt: true,
|
|
45
39
|
};
|
|
46
40
|
let ApiKeysService = class ApiKeysService {
|
|
47
|
-
constructor(prisma, identityStore) {
|
|
41
|
+
constructor(prisma, identityStore, catalog) {
|
|
48
42
|
this.prisma = prisma;
|
|
49
43
|
this.identityStore = identityStore;
|
|
44
|
+
this.catalog = catalog;
|
|
50
45
|
}
|
|
51
46
|
async create(dto, createdBy) {
|
|
52
47
|
this.validateScopes(dto.scopes);
|
|
@@ -103,9 +98,12 @@ let ApiKeysService = class ApiKeysService {
|
|
|
103
98
|
return apiKey;
|
|
104
99
|
}
|
|
105
100
|
async update(id, dto) {
|
|
106
|
-
await this.findOne(id);
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
const existing = await this.findOne(id);
|
|
102
|
+
// Only scopes newly added by this edit are checked. Legacy grants already on the key are kept
|
|
103
|
+
// through unrelated edits (rename, toggle, rate limit) even if the catalog no longer lists them.
|
|
104
|
+
if (dto.scopes) {
|
|
105
|
+
this.validateScopes(dto.scopes.filter((scope) => !existing.scopes.includes(scope)));
|
|
106
|
+
}
|
|
109
107
|
if (dto.actingUserId)
|
|
110
108
|
await this.assertActingUser(dto.actingUserId);
|
|
111
109
|
return this.prisma.apiKey.update({
|
|
@@ -129,7 +127,7 @@ let ApiKeysService = class ApiKeysService {
|
|
|
129
127
|
await this.prisma.apiKey.delete({ where: { id } });
|
|
130
128
|
}
|
|
131
129
|
validateScopes(scopes) {
|
|
132
|
-
const invalid = scopes.filter((
|
|
130
|
+
const invalid = scopes.filter((scope) => !this.catalog.isKnown(scope));
|
|
133
131
|
if (invalid.length > 0) {
|
|
134
132
|
throw new common_2.BadRequestException(`Invalid scopes: ${invalid.join(', ')}`);
|
|
135
133
|
}
|
|
@@ -148,6 +146,7 @@ exports.ApiKeysService = ApiKeysService = __decorate([
|
|
|
148
146
|
(0, common_2.Injectable)(),
|
|
149
147
|
__param(0, (0, common_2.Inject)(common_1.PrismaService)),
|
|
150
148
|
__param(1, (0, common_2.Inject)(plugin_api_1.IDENTITY_STORE)),
|
|
151
|
-
|
|
149
|
+
__param(2, (0, common_2.Inject)(scope_catalog_1.M2mScopeCatalogService)),
|
|
150
|
+
__metadata("design:paramtypes", [common_1.PrismaService, Object, scope_catalog_1.M2mScopeCatalogService])
|
|
152
151
|
], ApiKeysService);
|
|
153
152
|
//# sourceMappingURL=api-keys.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.service.js","sourceRoot":"","sources":["../src/api-keys.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAsD;A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} from './types.js';
|
|
2
|
-
export declare function ApiKeyRowActions({ apiKey, serviceAccounts, setApiKeyActiveAction, deleteApiKeyAction, updateApiKeyActingUserAction, }: ApiKeyRowActionsProps): import("react").JSX.Element;
|
|
2
|
+
export declare function ApiKeyRowActions({ apiKey, serviceAccounts, setApiKeyActiveAction, deleteApiKeyAction, updateApiKeyActingUserAction, roles, scopeOptions, scopeGroups, updateApiKeyAction, searchServiceAccountsAction, }: ApiKeyRowActionsProps): import("react").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=api-key-row-actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-key-row-actions.d.ts","sourceRoot":"","sources":["../../src/frontend/api-key-row-actions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-key-row-actions.d.ts","sourceRoot":"","sources":["../../src/frontend/api-key-row-actions.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,4BAA4B,EAC5B,KAAK,EACL,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,2BAA2B,GAC5B,EAAE,qBAAqB,+BAoJvB"}
|
|
@@ -6,9 +6,11 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
const frontend_shell_1 = require("@haneinfo/frontend-shell");
|
|
7
7
|
const lucide_react_1 = require("lucide-react");
|
|
8
8
|
const react_1 = require("react");
|
|
9
|
-
|
|
9
|
+
const edit_api_key_dialog_js_1 = require("./edit-api-key-dialog.js");
|
|
10
|
+
function ApiKeyRowActions({ apiKey, serviceAccounts, setApiKeyActiveAction, deleteApiKeyAction, updateApiKeyActingUserAction, roles, scopeOptions, scopeGroups, updateApiKeyAction, searchServiceAccountsAction, }) {
|
|
10
11
|
const t = (0, frontend_shell_1.useTranslations)('apiKeys');
|
|
11
12
|
const tCommon = (0, frontend_shell_1.useTranslations)('common');
|
|
13
|
+
const [editOpen, setEditOpen] = (0, react_1.useState)(false);
|
|
12
14
|
const [deleteOpen, setDeleteOpen] = (0, react_1.useState)(false);
|
|
13
15
|
const [actingUserOpen, setActingUserOpen] = (0, react_1.useState)(false);
|
|
14
16
|
const [selectedActingUserId, setSelectedActingUserId] = (0, react_1.useState)(apiKey.actingUserId ?? '__none');
|
|
@@ -46,7 +48,7 @@ function ApiKeyRowActions({ apiKey, serviceAccounts, setApiKeyActiveAction, dele
|
|
|
46
48
|
}
|
|
47
49
|
});
|
|
48
50
|
}
|
|
49
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(frontend_shell_1.DropdownMenu, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.DropdownMenuTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)(frontend_shell_1.Button, { variant: "ghost", size: "icon", "aria-label": `${tCommon('actions')}: ${apiKey.name}`, children: (0, jsx_runtime_1.jsx)(lucide_react_1.MoreHorizontal, { className: "size-4" }) }) }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.DropdownMenuContent, { align: "end", children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.DropdownMenuItem, { onSelect: toggleActive, disabled: isPending, children: apiKey.isActive ? t('deactivate') : t('activate') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.DropdownMenuItem, { onSelect: () => setActingUserOpen(true), children: t('editActingUser') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.DropdownMenuItem, { variant: "destructive", onSelect: () => setDeleteOpen(true), children: tCommon('delete') })] })] }), (0, jsx_runtime_1.jsx)(frontend_shell_1.Dialog, { open: actingUserOpen, onOpenChange: setActingUserOpen, children: (0, jsx_runtime_1.jsxs)(frontend_shell_1.DialogContent, { closeLabel: tCommon('close'), children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.DialogHeader, { children: (0, jsx_runtime_1.jsx)(frontend_shell_1.DialogTitle, { children: t('editActingUser') }) }), (0, jsx_runtime_1.jsxs)("div", { className: "py-4", children: [(0, jsx_runtime_1.jsxs)(frontend_shell_1.Select, { value: selectedActingUserId, onValueChange: setSelectedActingUserId, children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.SelectTrigger, { children: (0, jsx_runtime_1.jsx)(frontend_shell_1.SelectValue, { placeholder: t('actingUserNone') }) }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.SelectContent, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.SelectItem, { value: "__none", children: t('actingUserNone') }), serviceAccounts.map((account) => ((0, jsx_runtime_1.jsxs)(frontend_shell_1.SelectItem, { value: account.id, children: [account.email, " ", account.name ? `(${account.name})` : ''] }, account.id)))] })] }), error && (0, jsx_runtime_1.jsx)(frontend_shell_1.FieldError, { className: "mt-2", children: error })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.DialogFooter, { className: "py-5", children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.Button, { type: "button", variant: "outline", onClick: () => setActingUserOpen(false), disabled: isPending, children: tCommon('cancel') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.Button, { onClick: handleActingUserSubmit, disabled: isPending, children: isPending ? t('saving') : tCommon('save') })] })] }) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.AlertDialog, { open: deleteOpen, onOpenChange: setDeleteOpen, children: (0, jsx_runtime_1.jsxs)(frontend_shell_1.AlertDialogContent, { children: [(0, jsx_runtime_1.jsxs)(frontend_shell_1.AlertDialogHeader, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.AlertDialogTitle, { children: t('deleteApiKeyTitle').replace('{name}', apiKey.name) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.AlertDialogDescription, { children: t('deleteWarning') })] }), error && (0, jsx_runtime_1.jsx)(frontend_shell_1.FieldError, { children: error }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.AlertDialogFooter, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.AlertDialogCancel, { disabled: isPending, children: tCommon('cancel') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.AlertDialogAction, { onClick: (e) => {
|
|
51
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(frontend_shell_1.DropdownMenu, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.DropdownMenuTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)(frontend_shell_1.Button, { variant: "ghost", size: "icon", "aria-label": `${tCommon('actions')}: ${apiKey.name}`, children: (0, jsx_runtime_1.jsx)(lucide_react_1.MoreHorizontal, { className: "size-4" }) }) }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.DropdownMenuContent, { align: "end", children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.DropdownMenuItem, { onSelect: toggleActive, disabled: isPending, children: apiKey.isActive ? t('deactivate') : t('activate') }), updateApiKeyAction && roles && scopeOptions && ((0, jsx_runtime_1.jsx)(frontend_shell_1.DropdownMenuItem, { onSelect: () => setEditOpen(true), children: t('editApiKey') })), (0, jsx_runtime_1.jsx)(frontend_shell_1.DropdownMenuItem, { onSelect: () => setActingUserOpen(true), children: t('editActingUser') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.DropdownMenuItem, { variant: "destructive", onSelect: () => setDeleteOpen(true), children: tCommon('delete') })] })] }), updateApiKeyAction && roles && scopeOptions && ((0, jsx_runtime_1.jsx)(edit_api_key_dialog_js_1.EditApiKeyDialog, { apiKey: apiKey, open: editOpen, onOpenChange: setEditOpen, roles: roles, serviceAccounts: serviceAccounts, scopeOptions: scopeOptions, scopeGroups: scopeGroups, updateApiKeyAction: updateApiKeyAction, searchServiceAccountsAction: searchServiceAccountsAction })), (0, jsx_runtime_1.jsx)(frontend_shell_1.Dialog, { open: actingUserOpen, onOpenChange: setActingUserOpen, children: (0, jsx_runtime_1.jsxs)(frontend_shell_1.DialogContent, { closeLabel: tCommon('close'), children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.DialogHeader, { children: (0, jsx_runtime_1.jsx)(frontend_shell_1.DialogTitle, { children: t('editActingUser') }) }), (0, jsx_runtime_1.jsxs)("div", { className: "py-4", children: [(0, jsx_runtime_1.jsxs)(frontend_shell_1.Select, { value: selectedActingUserId, onValueChange: setSelectedActingUserId, children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.SelectTrigger, { children: (0, jsx_runtime_1.jsx)(frontend_shell_1.SelectValue, { placeholder: t('actingUserNone') }) }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.SelectContent, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.SelectItem, { value: "__none", children: t('actingUserNone') }), serviceAccounts.map((account) => ((0, jsx_runtime_1.jsxs)(frontend_shell_1.SelectItem, { value: account.id, children: [account.email, " ", account.name ? `(${account.name})` : ''] }, account.id)))] })] }), error && (0, jsx_runtime_1.jsx)(frontend_shell_1.FieldError, { className: "mt-2", children: error })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.DialogFooter, { className: "py-5", children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.Button, { type: "button", variant: "outline", onClick: () => setActingUserOpen(false), disabled: isPending, children: tCommon('cancel') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.Button, { onClick: handleActingUserSubmit, disabled: isPending, children: isPending ? t('saving') : tCommon('save') })] })] }) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.AlertDialog, { open: deleteOpen, onOpenChange: setDeleteOpen, children: (0, jsx_runtime_1.jsxs)(frontend_shell_1.AlertDialogContent, { children: [(0, jsx_runtime_1.jsxs)(frontend_shell_1.AlertDialogHeader, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.AlertDialogTitle, { children: t('deleteApiKeyTitle').replace('{name}', apiKey.name) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.AlertDialogDescription, { children: t('deleteWarning') })] }), error && (0, jsx_runtime_1.jsx)(frontend_shell_1.FieldError, { children: error }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.AlertDialogFooter, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.AlertDialogCancel, { disabled: isPending, children: tCommon('cancel') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.AlertDialogAction, { onClick: (e) => {
|
|
50
52
|
e.preventDefault();
|
|
51
53
|
handleDelete();
|
|
52
54
|
}, disabled: isPending, className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", children: isPending ? t('deleting') : tCommon('delete') })] })] }) })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-key-row-actions.js","sourceRoot":"","sources":["../../src/frontend/api-key-row-actions.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"api-key-row-actions.js","sourceRoot":"","sources":["../../src/frontend/api-key-row-actions.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAkCb,4CA+JC;;AA/LD,6DA0BkC;AAClC,+CAA8C;AAC9C,iCAAgD;AAChD,qEAA4D;AAG5D,SAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,4BAA4B,EAC5B,KAAK,EACL,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,2BAA2B,GACL;IACtB,MAAM,CAAC,GAAG,IAAA,gCAAe,EAAC,SAAS,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,IAAA,gCAAe,EAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAChD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IACpD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,CAAC,o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AK,CAAC,EACvC,QAAQ,EAAE,SAAS,YAElB,OAAO,CAAC,QAAQ,CAAC,GACX,EACT,uBAAC,uBAAM,IAAC,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,SAAS,YACzD,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,GACnC,IACI,IACD,GACT,EAET,uBAAC,4BAAW,IAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,YACxD,wBAAC,mCAAkB,eACjB,wBAAC,kCAAiB,eAChB,uBAAC,iCAAgB,cACd,CAAC,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,GACrC,EACnB,uBAAC,uCAAsB,cAAE,CAAC,CAAC,eAAe,CAAC,GAA0B,IACnD,EACnB,KAAK,IAAI,uBAAC,2BAAU,cAAE,KAAK,GAAc,EAC1C,wBAAC,kCAAiB,eAChB,uBAAC,kCAAiB,IAAC,QAAQ,EAAE,SAAS,YAAG,OAAO,CAAC,QAAQ,CAAC,GAAqB,EAC/E,uBAAC,kCAAiB,IAChB,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;wCACb,CAAC,CAAC,cAAc,EAAE,CAAC;wCACnB,YAAY,EAAE,CAAC;oCACjB,CAAC,EACD,QAAQ,EAAE,SAAS,EACnB,SAAS,EAAC,oEAAoE,YAE7E,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,GAC5B,IACF,IACD,GACT,IACb,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ApiKeysTableProps } from './types.js';
|
|
2
|
-
export declare function ApiKeysTable({ apiKeys, serviceAccounts, sortField, sortOrder, LinkComponent, buildSortHref, t, setApiKeyActiveAction, deleteApiKeyAction, updateApiKeyActingUserAction, }: ApiKeysTableProps): import("react").JSX.Element;
|
|
2
|
+
export declare function ApiKeysTable({ apiKeys, serviceAccounts, sortField, sortOrder, LinkComponent, buildSortHref, t, setApiKeyActiveAction, deleteApiKeyAction, updateApiKeyActingUserAction, roles, scopeOptions, scopeGroups, updateApiKeyAction, searchServiceAccountsAction, }: ApiKeysTableProps): import("react").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=api-keys-table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys-table.d.ts","sourceRoot":"","sources":["../../src/frontend/api-keys-table.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAErE,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,eAAe,EACf,SAAS,EACT,SAAS,EACT,aAAa,EACb,aAAa,EACb,CAAC,EACD,qBAAqB,EACrB,kBAAkB,EAClB,4BAA4B,
|
|
1
|
+
{"version":3,"file":"api-keys-table.d.ts","sourceRoot":"","sources":["../../src/frontend/api-keys-table.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAErE,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,eAAe,EACf,SAAS,EACT,SAAS,EACT,aAAa,EACb,aAAa,EACb,CAAC,EACD,qBAAqB,EACrB,kBAAkB,EAClB,4BAA4B,EAC5B,KAAK,EACL,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,2BAA2B,GAC5B,EAAE,iBAAiB,+BA2GnB"}
|
|
@@ -4,8 +4,8 @@ exports.ApiKeysTable = ApiKeysTable;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const frontend_shell_1 = require("@haneinfo/frontend-shell");
|
|
6
6
|
const api_key_row_actions_js_1 = require("./api-key-row-actions.js");
|
|
7
|
-
function ApiKeysTable({ apiKeys, serviceAccounts, sortField, sortOrder, LinkComponent, buildSortHref, t, setApiKeyActiveAction, deleteApiKeyAction, updateApiKeyActingUserAction, }) {
|
|
7
|
+
function ApiKeysTable({ apiKeys, serviceAccounts, sortField, sortOrder, LinkComponent, buildSortHref, t, setApiKeyActiveAction, deleteApiKeyAction, updateApiKeyActingUserAction, roles, scopeOptions, scopeGroups, updateApiKeyAction, searchServiceAccountsAction, }) {
|
|
8
8
|
const serviceAccountEmailById = new Map(serviceAccounts.map((account) => [account.id, account.email]));
|
|
9
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "rounded-lg border", children: (0, jsx_runtime_1.jsxs)(frontend_shell_1.Table, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.TableHeader, { children: (0, jsx_runtime_1.jsxs)(frontend_shell_1.TableRow, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { children: (0, jsx_runtime_1.jsx)(frontend_shell_1.SortableColumnHeader, { label: t('name'), field: "name", currentSortField: sortField, currentSortOrder: sortOrder, LinkComponent: LinkComponent, buildSortHref: buildSortHref }) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { children: t('key') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { children: t('role') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { children: t('actingUser') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { children: t('scopes') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { children: t('status') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { children: (0, jsx_runtime_1.jsx)(frontend_shell_1.SortableColumnHeader, { label: t('lastUsed'), field: "lastUsedAt", currentSortField: sortField, currentSortOrder: sortOrder, LinkComponent: LinkComponent, buildSortHref: buildSortHref }) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { className: "w-10" })] }) }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.TableBody, { children: [apiKeys.length === 0 && ((0, jsx_runtime_1.jsx)(frontend_shell_1.TableRow, { children: (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { colSpan: 8, className: "text-center text-muted-foreground", children: t('noApiKeys') }) })), apiKeys.map((apiKey) => ((0, jsx_runtime_1.jsxs)(frontend_shell_1.TableRow, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { children: apiKey.name }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { children: (0, jsx_runtime_1.jsxs)("code", { className: "rounded bg-muted px-1.5 py-0.5 text-xs font-mono", children: [apiKey.prefix, "\u2026"] }) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { children: (0, jsx_runtime_1.jsx)(frontend_shell_1.Badge, { variant: "secondary", children: apiKey.role.displayName }) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { children: apiKey.actingUserId ? ((0, jsx_runtime_1.jsx)("span", { className: "text-sm", children: serviceAccountEmailById.get(apiKey.actingUserId) ?? apiKey.actingUserId })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-xs text-muted-foreground", children: t('actingUserNone') })) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { children: apiKey.scopes.length === 0 ? ((0, jsx_runtime_1.jsx)("span", { className: "text-xs text-muted-foreground", children: "-" })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex max-w-xs flex-wrap gap-1", children: apiKey.scopes.map((s) => ((0, jsx_runtime_1.jsx)(frontend_shell_1.Badge, { variant: "outline", className: "text-xs font-mono", children: s }, s))) })) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { children: (0, jsx_runtime_1.jsx)(frontend_shell_1.Badge, { variant: apiKey.isActive ? 'default' : 'outline', children: apiKey.isActive ? t('active') : t('inactive') }) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { className: "text-xs text-muted-foreground", children: apiKey.lastUsedAt ? new Date(apiKey.lastUsedAt).toLocaleDateString() : t('never') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { children: (0, jsx_runtime_1.jsx)(api_key_row_actions_js_1.ApiKeyRowActions, { apiKey: apiKey, serviceAccounts: serviceAccounts, setApiKeyActiveAction: setApiKeyActiveAction, deleteApiKeyAction: deleteApiKeyAction, updateApiKeyActingUserAction: updateApiKeyActingUserAction }) })] }, apiKey.id)))] })] }) }));
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "rounded-lg border", children: (0, jsx_runtime_1.jsxs)(frontend_shell_1.Table, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.TableHeader, { children: (0, jsx_runtime_1.jsxs)(frontend_shell_1.TableRow, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { children: (0, jsx_runtime_1.jsx)(frontend_shell_1.SortableColumnHeader, { label: t('name'), field: "name", currentSortField: sortField, currentSortOrder: sortOrder, LinkComponent: LinkComponent, buildSortHref: buildSortHref }) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { children: t('key') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { children: t('role') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { children: t('actingUser') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { children: t('scopes') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { children: t('status') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { children: (0, jsx_runtime_1.jsx)(frontend_shell_1.SortableColumnHeader, { label: t('lastUsed'), field: "lastUsedAt", currentSortField: sortField, currentSortOrder: sortOrder, LinkComponent: LinkComponent, buildSortHref: buildSortHref }) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableHead, { className: "w-10" })] }) }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.TableBody, { children: [apiKeys.length === 0 && ((0, jsx_runtime_1.jsx)(frontend_shell_1.TableRow, { children: (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { colSpan: 8, className: "text-center text-muted-foreground", children: t('noApiKeys') }) })), apiKeys.map((apiKey) => ((0, jsx_runtime_1.jsxs)(frontend_shell_1.TableRow, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { children: apiKey.name }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { children: (0, jsx_runtime_1.jsxs)("code", { className: "rounded bg-muted px-1.5 py-0.5 text-xs font-mono", children: [apiKey.prefix, "\u2026"] }) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { children: (0, jsx_runtime_1.jsx)(frontend_shell_1.Badge, { variant: "secondary", children: apiKey.role.displayName }) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { children: apiKey.actingUserId ? ((0, jsx_runtime_1.jsx)("span", { className: "text-sm", children: serviceAccountEmailById.get(apiKey.actingUserId) ?? apiKey.actingUserId })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-xs text-muted-foreground", children: t('actingUserNone') })) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { children: apiKey.scopes.length === 0 ? ((0, jsx_runtime_1.jsx)("span", { className: "text-xs text-muted-foreground", children: "-" })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex max-w-xs flex-wrap gap-1", children: apiKey.scopes.map((s) => ((0, jsx_runtime_1.jsx)(frontend_shell_1.Badge, { variant: "outline", className: "text-xs font-mono", children: s }, s))) })) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { children: (0, jsx_runtime_1.jsx)(frontend_shell_1.Badge, { variant: apiKey.isActive ? 'default' : 'outline', children: apiKey.isActive ? t('active') : t('inactive') }) }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { className: "text-xs text-muted-foreground", children: apiKey.lastUsedAt ? new Date(apiKey.lastUsedAt).toLocaleDateString() : t('never') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.TableCell, { children: (0, jsx_runtime_1.jsx)(api_key_row_actions_js_1.ApiKeyRowActions, { apiKey: apiKey, serviceAccounts: serviceAccounts, setApiKeyActiveAction: setApiKeyActiveAction, deleteApiKeyAction: deleteApiKeyAction, updateApiKeyActingUserAction: updateApiKeyActingUserAction, roles: roles, scopeOptions: scopeOptions, scopeGroups: scopeGroups, updateApiKeyAction: updateApiKeyAction, searchServiceAccountsAction: searchServiceAccountsAction }) })] }, apiKey.id)))] })] }) }));
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=api-keys-table.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys-table.js","sourceRoot":"","sources":["../../src/frontend/api-keys-table.tsx"],"names":[],"mappings":";;AAaA,
|
|
1
|
+
{"version":3,"file":"api-keys-table.js","sourceRoot":"","sources":["../../src/frontend/api-keys-table.tsx"],"names":[],"mappings":";;AAaA,oCA2HC;;AAxID,6DASkC;AAClC,qEAA4D;AAG5D,SAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,eAAe,EACf,SAAS,EACT,SAAS,EACT,aAAa,EACb,aAAa,EACb,CAAC,EACD,qBAAqB,EACrB,kBAAkB,EAClB,4BAA4B,EAC5B,KAAK,EACL,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,2BAA2B,GACT;IAClB,MAAM,uBAAuB,GAAG,IAAI,GAAG,CACrC,eAAe,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAC9D,CAAC;IAEF,OAAO,CACL,gCAAK,SAAS,EAAC,mBAAmB,YAChC,wBAAC,sBAAK,eACJ,uBAAC,4BAAW,cACV,wBAAC,yBAAQ,eACP,uBAAC,0BAAS,cACR,uBAAC,qCAAoB,IACnB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAChB,KAAK,EAAC,MAAM,EACZ,gBAAgB,EAAE,SAAS,EAC3B,gBAAgB,EAAE,SAAS,EAC3B,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,GAC5B,GACQ,EACZ,uBAAC,0BAAS,cAAE,CAAC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ACtC,2BAA2B,EAAE,2BAA2B,GACxD,GACQ,KArDC,MAAM,CAAC,EAAE,CAsDb,CACZ,CAAC,IACQ,IACN,GACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CreateApiKeyDialogProps } from './types.js';
|
|
2
|
-
export declare function CreateApiKeyDialog({ roles, serviceAccounts, scopeOptions, createApiKeyAction, }: CreateApiKeyDialogProps): import("react").JSX.Element;
|
|
2
|
+
export declare function CreateApiKeyDialog({ roles, serviceAccounts, scopeOptions, scopeGroups, createApiKeyAction, searchServiceAccountsAction, }: CreateApiKeyDialogProps): import("react").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=create-api-key-dialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-api-key-dialog.d.ts","sourceRoot":"","sources":["../../src/frontend/create-api-key-dialog.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"create-api-key-dialog.d.ts","sourceRoot":"","sources":["../../src/frontend/create-api-key-dialog.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAqB,uBAAuB,EAAwB,MAAM,YAAY,CAAC;AAGnG,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,eAAe,EACf,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,2BAA2B,GAC5B,EAAE,uBAAuB,+BAgMzB"}
|