@haneinfo/m2m-api-key 0.0.0-stage → 8.0.5
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/LICENSE +14 -0
- package/dist/api-key-machine.strategy.d.ts +25 -0
- package/dist/api-key-machine.strategy.d.ts.map +1 -0
- package/dist/api-key-machine.strategy.js +110 -0
- package/dist/api-key-machine.strategy.js.map +1 -0
- package/dist/api-key-rate-limiter.d.ts +10 -0
- package/dist/api-key-rate-limiter.d.ts.map +1 -0
- package/dist/api-key-rate-limiter.js +53 -0
- package/dist/api-key-rate-limiter.js.map +1 -0
- package/dist/api-key.guard.d.ts +26 -0
- package/dist/api-key.guard.d.ts.map +1 -0
- package/dist/api-key.guard.js +109 -0
- package/dist/api-key.guard.js.map +1 -0
- package/dist/api-keys.controller.d.ts +29 -0
- package/dist/api-keys.controller.d.ts.map +1 -0
- package/dist/api-keys.controller.js +119 -0
- package/dist/api-keys.controller.js.map +1 -0
- package/dist/api-keys.module.d.ts +24 -0
- package/dist/api-keys.module.d.ts.map +1 -0
- package/dist/api-keys.module.js +85 -0
- package/dist/api-keys.module.js.map +1 -0
- package/dist/api-keys.service.d.ts +51 -0
- package/dist/api-keys.service.d.ts.map +1 -0
- package/dist/api-keys.service.js +153 -0
- package/dist/api-keys.service.js.map +1 -0
- package/dist/decorators/scopes.decorator.d.ts +3 -0
- package/dist/decorators/scopes.decorator.d.ts.map +1 -0
- package/dist/decorators/scopes.decorator.js +8 -0
- package/dist/decorators/scopes.decorator.js.map +1 -0
- package/dist/dto/api-key.dto.d.ts +37 -0
- package/dist/dto/api-key.dto.d.ts.map +1 -0
- package/dist/dto/api-key.dto.js +22 -0
- package/dist/dto/api-key.dto.js.map +1 -0
- package/dist/frontend/api-key-row-actions.d.ts +3 -0
- package/dist/frontend/api-key-row-actions.d.ts.map +1 -0
- package/dist/frontend/api-key-row-actions.js +54 -0
- package/dist/frontend/api-key-row-actions.js.map +1 -0
- package/dist/frontend/api-keys-table.d.ts +3 -0
- package/dist/frontend/api-keys-table.d.ts.map +1 -0
- package/dist/frontend/api-keys-table.js +11 -0
- package/dist/frontend/api-keys-table.js.map +1 -0
- package/dist/frontend/create-api-key-dialog.d.ts +3 -0
- package/dist/frontend/create-api-key-dialog.d.ts.map +1 -0
- package/dist/frontend/create-api-key-dialog.js +44 -0
- package/dist/frontend/create-api-key-dialog.js.map +1 -0
- package/dist/frontend/created-api-key-reveal.d.ts +3 -0
- package/dist/frontend/created-api-key-reveal.d.ts.map +1 -0
- package/dist/frontend/created-api-key-reveal.js +17 -0
- package/dist/frontend/created-api-key-reveal.js.map +1 -0
- package/dist/frontend/index.d.ts +7 -0
- package/dist/frontend/index.d.ts.map +1 -0
- package/dist/frontend/index.js +22 -0
- package/dist/frontend/index.js.map +1 -0
- package/dist/frontend/types.d.ts +98 -0
- package/dist/frontend/types.d.ts.map +1 -0
- package/dist/frontend/types.js +6 -0
- package/dist/frontend/types.js.map +1 -0
- package/dist/frontend.d.ts +9 -0
- package/dist/frontend.d.ts.map +1 -0
- package/dist/frontend.js +13 -0
- package/dist/frontend.js.map +1 -0
- package/dist/guards/admin.guard.d.ts +7 -0
- package/dist/guards/admin.guard.d.ts.map +1 -0
- package/dist/guards/admin.guard.js +6 -0
- package/dist/guards/admin.guard.js.map +1 -0
- package/dist/guards/scope.guard.d.ts +11 -0
- package/dist/guards/scope.guard.d.ts.map +1 -0
- package/dist/guards/scope.guard.js +53 -0
- package/dist/guards/scope.guard.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +16 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +109 -0
- package/dist/plugin.js.map +1 -0
- package/dist/scope-matcher.service.d.ts +12 -0
- package/dist/scope-matcher.service.d.ts.map +1 -0
- package/dist/scope-matcher.service.js +28 -0
- package/dist/scope-matcher.service.js.map +1 -0
- package/haneinfo.plugin.json +82 -0
- package/package.json +95 -3
- package/plugin.d.ts +2 -0
- package/plugin.js +4 -0
- package/prisma/api-key.prisma +43 -0
- package/README.md +0 -3
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ApiKeysModule = void 0;
|
|
16
|
+
const plugin_api_1 = require("@haneinfo/plugin-api");
|
|
17
|
+
const plugin_host_nest_1 = require("@haneinfo/plugin-host-nest");
|
|
18
|
+
const common_1 = require("@nestjs/common");
|
|
19
|
+
const api_key_guard_1 = require("./api-key.guard");
|
|
20
|
+
const api_key_machine_strategy_1 = require("./api-key-machine.strategy");
|
|
21
|
+
const api_key_rate_limiter_1 = require("./api-key-rate-limiter");
|
|
22
|
+
const api_keys_controller_1 = require("./api-keys.controller");
|
|
23
|
+
const api_keys_service_1 = require("./api-keys.service");
|
|
24
|
+
const admin_guard_1 = require("./guards/admin.guard");
|
|
25
|
+
const scope_guard_1 = require("./guards/scope.guard");
|
|
26
|
+
const scope_matcher_service_1 = require("./scope-matcher.service");
|
|
27
|
+
/**
|
|
28
|
+
* Machine-to-Machine API Keys capability module (051 PL4-03).
|
|
29
|
+
*
|
|
30
|
+
* Provides:
|
|
31
|
+
* - `haneinfo.machine-auth-provider`: registers `ApiKeyMachineStrategy` into `AuthenticationStrategyRegistry`.
|
|
32
|
+
* - `haneinfo.scope-matcher`: bound to `SCOPE_MATCHER` token via `ScopeMatcherService`.
|
|
33
|
+
* - Admin key management CRUD endpoints (`ApiKeysController` / `ApiKeysService`).
|
|
34
|
+
*
|
|
35
|
+
* The module is deliberately scoped. Consumers must import it explicitly or import a generated
|
|
36
|
+
* plugin composition module that exports it.
|
|
37
|
+
*/
|
|
38
|
+
let ApiKeysModule = class ApiKeysModule {
|
|
39
|
+
constructor(registry, strategy) {
|
|
40
|
+
this.registry = registry;
|
|
41
|
+
this.strategy = strategy;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Registers the machine strategy with the host (PL1-11, PL4-03).
|
|
45
|
+
*/
|
|
46
|
+
onModuleInit() {
|
|
47
|
+
if (!this.registry.has(this.strategy.id)) {
|
|
48
|
+
this.registry.register(this.strategy);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
exports.ApiKeysModule = ApiKeysModule;
|
|
53
|
+
exports.ApiKeysModule = ApiKeysModule = __decorate([
|
|
54
|
+
(0, common_1.Module)({
|
|
55
|
+
imports: [plugin_host_nest_1.HaneinfoAuthInfrastructureModule],
|
|
56
|
+
controllers: [api_keys_controller_1.ApiKeysController],
|
|
57
|
+
providers: [
|
|
58
|
+
api_keys_service_1.ApiKeysService,
|
|
59
|
+
api_key_guard_1.ApiKeyGuard,
|
|
60
|
+
api_key_rate_limiter_1.ApiKeyRateLimiter,
|
|
61
|
+
admin_guard_1.ApiKeyAdminGuard,
|
|
62
|
+
plugin_host_nest_1.HaneinfoAuthGuard,
|
|
63
|
+
scope_guard_1.ScopeGuard,
|
|
64
|
+
api_key_machine_strategy_1.ApiKeyMachineStrategy,
|
|
65
|
+
scope_matcher_service_1.ScopeMatcherService,
|
|
66
|
+
{ provide: plugin_api_1.SCOPE_MATCHER, useExisting: scope_matcher_service_1.ScopeMatcherService },
|
|
67
|
+
],
|
|
68
|
+
exports: [
|
|
69
|
+
api_keys_service_1.ApiKeysService,
|
|
70
|
+
api_key_guard_1.ApiKeyGuard,
|
|
71
|
+
api_key_rate_limiter_1.ApiKeyRateLimiter,
|
|
72
|
+
admin_guard_1.ApiKeyAdminGuard,
|
|
73
|
+
plugin_host_nest_1.HaneinfoAuthGuard,
|
|
74
|
+
scope_guard_1.ScopeGuard,
|
|
75
|
+
api_key_machine_strategy_1.ApiKeyMachineStrategy,
|
|
76
|
+
scope_matcher_service_1.ScopeMatcherService,
|
|
77
|
+
plugin_api_1.SCOPE_MATCHER,
|
|
78
|
+
],
|
|
79
|
+
}),
|
|
80
|
+
__param(0, (0, common_1.Inject)(plugin_host_nest_1.AuthenticationStrategyRegistry)),
|
|
81
|
+
__param(1, (0, common_1.Inject)(api_key_machine_strategy_1.ApiKeyMachineStrategy)),
|
|
82
|
+
__metadata("design:paramtypes", [plugin_host_nest_1.AuthenticationStrategyRegistry,
|
|
83
|
+
api_key_machine_strategy_1.ApiKeyMachineStrategy])
|
|
84
|
+
], ApiKeysModule);
|
|
85
|
+
//# sourceMappingURL=api-keys.module.js.map
|
|
@@ -0,0 +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;AA2BI,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;IA1BzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,mDAAgC,CAAC;QAC3C,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,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,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"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { PaginatedResult, PaginationQuery } from '@haneinfo/common';
|
|
2
|
+
import { PrismaService } from '@haneinfo/common';
|
|
3
|
+
import { type IdentityStorePort } from '@haneinfo/plugin-api';
|
|
4
|
+
import { CreateApiKeyDto, CreateApiKeyResponse, RoleRef, UpdateApiKeyDto } from './dto/api-key.dto';
|
|
5
|
+
export interface ApiKeyRecord {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
prefix: string;
|
|
9
|
+
roleId: string;
|
|
10
|
+
actingUserId: string | null;
|
|
11
|
+
role: RoleRef;
|
|
12
|
+
scopes: string[];
|
|
13
|
+
rateLimit: number | null;
|
|
14
|
+
isActive: boolean;
|
|
15
|
+
expiresAt: Date | null;
|
|
16
|
+
createdBy: string | null;
|
|
17
|
+
lastUsedAt: Date | null;
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
updatedAt: Date;
|
|
20
|
+
}
|
|
21
|
+
export declare const KEY_PREFIX = "an_live_";
|
|
22
|
+
export declare class ApiKeysService {
|
|
23
|
+
private readonly prisma;
|
|
24
|
+
/**
|
|
25
|
+
* PL0-04 §1 found this service reading `identity-core`'s `User` table directly to validate an
|
|
26
|
+
* acting user — a cross-owner query the 051 split replaces with the
|
|
27
|
+
* `haneinfo.identity-store` capability.
|
|
28
|
+
*
|
|
29
|
+
* Required: accepting a fallback direct query would preserve the cross-owner dependency the
|
|
30
|
+
* Phase 1 split is specifically removing.
|
|
31
|
+
*/
|
|
32
|
+
private readonly identityStore;
|
|
33
|
+
constructor(prisma: PrismaService,
|
|
34
|
+
/**
|
|
35
|
+
* PL0-04 §1 found this service reading `identity-core`'s `User` table directly to validate an
|
|
36
|
+
* acting user — a cross-owner query the 051 split replaces with the
|
|
37
|
+
* `haneinfo.identity-store` capability.
|
|
38
|
+
*
|
|
39
|
+
* Required: accepting a fallback direct query would preserve the cross-owner dependency the
|
|
40
|
+
* Phase 1 split is specifically removing.
|
|
41
|
+
*/
|
|
42
|
+
identityStore: IdentityStorePort);
|
|
43
|
+
create(dto: CreateApiKeyDto, createdBy?: string): Promise<CreateApiKeyResponse>;
|
|
44
|
+
findAll(query: PaginationQuery): Promise<PaginatedResult<ApiKeyRecord>>;
|
|
45
|
+
findOne(id: string): Promise<ApiKeyRecord>;
|
|
46
|
+
update(id: string, dto: UpdateApiKeyDto): Promise<ApiKeyRecord>;
|
|
47
|
+
remove(id: string): Promise<void>;
|
|
48
|
+
private validateScopes;
|
|
49
|
+
private assertActingUser;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=api-keys.service.d.ts.map
|
|
@@ -0,0 +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;AAEpG,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,eAAO,MAAM,UAAU,aAAa,CAAC;AA6BrC,qBACa,cAAc;IAEA,OAAO,CAAC,QAAQ,CAAC,MAAM;IAC9C;;;;;;;OAOG;IACqB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBATd,MAAM,EAAE,aAAa;IAC7D;;;;;;;OAOG;IACsC,aAAa,EAAE,iBAAiB;IAGrE,MAAM,CAAC,GAAG,EAAE,eAAe,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAoC/E,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IAkBvE,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAM1C,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC;IAsB/D,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvC,OAAO,CAAC,cAAc;YAOR,gBAAgB;CAS/B"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ApiKeysService = exports.KEY_PREFIX = void 0;
|
|
16
|
+
const node_crypto_1 = require("node:crypto");
|
|
17
|
+
const common_1 = require("@haneinfo/common");
|
|
18
|
+
const plugin_api_1 = require("@haneinfo/plugin-api");
|
|
19
|
+
const common_2 = require("@nestjs/common");
|
|
20
|
+
exports.KEY_PREFIX = 'an_live_';
|
|
21
|
+
const PREFIX_DISPLAY_LENGTH = 16;
|
|
22
|
+
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
|
+
const API_KEY_SELECT = {
|
|
31
|
+
id: true,
|
|
32
|
+
name: true,
|
|
33
|
+
prefix: true,
|
|
34
|
+
roleId: true,
|
|
35
|
+
actingUserId: true,
|
|
36
|
+
role: { select: { id: true, name: true, displayName: true } },
|
|
37
|
+
scopes: true,
|
|
38
|
+
rateLimit: true,
|
|
39
|
+
isActive: true,
|
|
40
|
+
expiresAt: true,
|
|
41
|
+
createdBy: true,
|
|
42
|
+
lastUsedAt: true,
|
|
43
|
+
createdAt: true,
|
|
44
|
+
updatedAt: true,
|
|
45
|
+
};
|
|
46
|
+
let ApiKeysService = class ApiKeysService {
|
|
47
|
+
constructor(prisma, identityStore) {
|
|
48
|
+
this.prisma = prisma;
|
|
49
|
+
this.identityStore = identityStore;
|
|
50
|
+
}
|
|
51
|
+
async create(dto, createdBy) {
|
|
52
|
+
this.validateScopes(dto.scopes);
|
|
53
|
+
if (dto.actingUserId)
|
|
54
|
+
await this.assertActingUser(dto.actingUserId);
|
|
55
|
+
const raw = exports.KEY_PREFIX + (0, node_crypto_1.randomBytes)(16).toString('hex');
|
|
56
|
+
const hashedKey = (0, node_crypto_1.createHash)('sha256').update(raw).digest('hex');
|
|
57
|
+
const prefix = raw.slice(0, exports.KEY_PREFIX.length + PREFIX_DISPLAY_LENGTH);
|
|
58
|
+
const apiKey = await this.prisma.apiKey.create({
|
|
59
|
+
data: {
|
|
60
|
+
name: dto.name,
|
|
61
|
+
prefix,
|
|
62
|
+
hashedKey,
|
|
63
|
+
roleId: dto.roleId,
|
|
64
|
+
actingUserId: dto.actingUserId ?? null,
|
|
65
|
+
scopes: dto.scopes,
|
|
66
|
+
rateLimit: dto.rateLimit ?? null,
|
|
67
|
+
expiresAt: dto.expiresAt ? new Date(dto.expiresAt) : null,
|
|
68
|
+
createdBy: createdBy ?? null,
|
|
69
|
+
},
|
|
70
|
+
select: API_KEY_SELECT,
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
id: apiKey.id,
|
|
74
|
+
key: raw,
|
|
75
|
+
prefix: apiKey.prefix,
|
|
76
|
+
name: apiKey.name,
|
|
77
|
+
roleId: apiKey.roleId,
|
|
78
|
+
actingUserId: apiKey.actingUserId,
|
|
79
|
+
role: apiKey.role,
|
|
80
|
+
scopes: apiKey.scopes,
|
|
81
|
+
createdAt: apiKey.createdAt,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
async findAll(query) {
|
|
85
|
+
const where = query.search
|
|
86
|
+
? { name: { contains: query.search, mode: 'insensitive' } }
|
|
87
|
+
: {};
|
|
88
|
+
const [data, total] = await Promise.all([
|
|
89
|
+
this.prisma.apiKey.findMany({
|
|
90
|
+
where,
|
|
91
|
+
...(0, common_1.toPrismaPage)(query),
|
|
92
|
+
orderBy: (0, common_1.toPrismaOrderBy)(query, ALLOWED_SORT_FIELDS),
|
|
93
|
+
select: API_KEY_SELECT,
|
|
94
|
+
}),
|
|
95
|
+
this.prisma.apiKey.count({ where }),
|
|
96
|
+
]);
|
|
97
|
+
return (0, common_1.paginate)(data, total);
|
|
98
|
+
}
|
|
99
|
+
async findOne(id) {
|
|
100
|
+
const apiKey = await this.prisma.apiKey.findUnique({ where: { id }, select: API_KEY_SELECT });
|
|
101
|
+
if (!apiKey)
|
|
102
|
+
throw new common_2.NotFoundException(`ApiKey ${id} not found`);
|
|
103
|
+
return apiKey;
|
|
104
|
+
}
|
|
105
|
+
async update(id, dto) {
|
|
106
|
+
await this.findOne(id);
|
|
107
|
+
if (dto.scopes)
|
|
108
|
+
this.validateScopes(dto.scopes);
|
|
109
|
+
if (dto.actingUserId)
|
|
110
|
+
await this.assertActingUser(dto.actingUserId);
|
|
111
|
+
return this.prisma.apiKey.update({
|
|
112
|
+
where: { id },
|
|
113
|
+
data: {
|
|
114
|
+
...(dto.name !== undefined && { name: dto.name }),
|
|
115
|
+
...(dto.roleId !== undefined && { roleId: dto.roleId }),
|
|
116
|
+
...(dto.actingUserId !== undefined && { actingUserId: dto.actingUserId }),
|
|
117
|
+
...(dto.scopes !== undefined && { scopes: dto.scopes }),
|
|
118
|
+
...(dto.rateLimit !== undefined && { rateLimit: dto.rateLimit }),
|
|
119
|
+
...(dto.isActive !== undefined && { isActive: dto.isActive }),
|
|
120
|
+
...(dto.expiresAt !== undefined && {
|
|
121
|
+
expiresAt: dto.expiresAt ? new Date(dto.expiresAt) : null,
|
|
122
|
+
}),
|
|
123
|
+
},
|
|
124
|
+
select: API_KEY_SELECT,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
async remove(id) {
|
|
128
|
+
await this.findOne(id);
|
|
129
|
+
await this.prisma.apiKey.delete({ where: { id } });
|
|
130
|
+
}
|
|
131
|
+
validateScopes(scopes) {
|
|
132
|
+
const invalid = scopes.filter((s) => s !== '*' && !SCOPE_PATTERN.test(s));
|
|
133
|
+
if (invalid.length > 0) {
|
|
134
|
+
throw new common_2.BadRequestException(`Invalid scopes: ${invalid.join(', ')}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async assertActingUser(actingUserId) {
|
|
138
|
+
const user = await this.identityStore.findById(actingUserId);
|
|
139
|
+
if (!user)
|
|
140
|
+
throw new common_2.BadRequestException(`Acting user ${actingUserId} not found`);
|
|
141
|
+
if (!user.isServiceAccount) {
|
|
142
|
+
throw new common_2.BadRequestException('This account is not marked as a service account and cannot be bound as an API key acting user.');
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
exports.ApiKeysService = ApiKeysService;
|
|
147
|
+
exports.ApiKeysService = ApiKeysService = __decorate([
|
|
148
|
+
(0, common_2.Injectable)(),
|
|
149
|
+
__param(0, (0, common_2.Inject)(common_1.PrismaService)),
|
|
150
|
+
__param(1, (0, common_2.Inject)(plugin_api_1.IDENTITY_STORE)),
|
|
151
|
+
__metadata("design:paramtypes", [common_1.PrismaService, Object])
|
|
152
|
+
], ApiKeysService);
|
|
153
|
+
//# sourceMappingURL=api-keys.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-keys.service.js","sourceRoot":"","sources":["../src/api-keys.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAsD;AAEtD,6CAA0F;AAC1F,qDAA8E;AAC9E,2CAA4F;AAoB/E,QAAA,UAAU,GAAG,UAAU,CAAC;AACrC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,CAAU,CAAC;AAEtF,yFAAyF;AACzF,qFAAqF;AACrF,sFAAsF;AACtF,uFAAuF;AACvF,sFAAsF;AACtF,qEAAqE;AACrE,MAAM,aAAa,GAAG,oCAAoC,CAAC;AAE3D,MAAM,cAAc,GAAG;IACrB,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;IACZ,YAAY,EAAE,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B,CAAC,eAAe,YAAY,YAAY,CAAC,CAAC;QAClF,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC3B,MAAM,IAAI,4BAAmB,CAC3B,gGAAgG,CACjG,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AArHY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,sBAAa,CAAC,CAAA;IASrB,WAAA,IAAA,eAAM,EAAC,2BAAc,CAAC,CAAA;qCATyB,sBAAa;GAFpD,cAAc,CAqH1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopes.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/scopes.decorator.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,WAAW,CAAC;AACnC,eAAO,MAAM,MAAM,GAAI,GAAG,QAAQ,MAAM,EAAE,qDAAoC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Scopes = exports.SCOPES_KEY = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
exports.SCOPES_KEY = 'scopes';
|
|
6
|
+
const Scopes = (...scopes) => (0, common_1.SetMetadata)(exports.SCOPES_KEY, scopes);
|
|
7
|
+
exports.Scopes = Scopes;
|
|
8
|
+
//# sourceMappingURL=scopes.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopes.decorator.js","sourceRoot":"","sources":["../../src/decorators/scopes.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAEhC,QAAA,UAAU,GAAG,QAAQ,CAAC;AAC5B,MAAM,MAAM,GAAG,CAAC,GAAG,MAAgB,EAAE,EAAE,CAAC,IAAA,oBAAW,EAAC,kBAAU,EAAE,MAAM,CAAC,CAAC;AAAlE,QAAA,MAAM,UAA4D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createApiKeySchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
roleId: z.ZodString;
|
|
5
|
+
actingUserId: z.ZodOptional<z.ZodString>;
|
|
6
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
7
|
+
rateLimit: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export declare const updateApiKeySchema: z.ZodObject<{
|
|
11
|
+
name: z.ZodOptional<z.ZodString>;
|
|
12
|
+
roleId: z.ZodOptional<z.ZodString>;
|
|
13
|
+
actingUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
15
|
+
rateLimit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
16
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type CreateApiKeyDto = z.infer<typeof createApiKeySchema>;
|
|
20
|
+
export type UpdateApiKeyDto = z.infer<typeof updateApiKeySchema>;
|
|
21
|
+
export interface RoleRef {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
displayName: string;
|
|
25
|
+
}
|
|
26
|
+
export interface CreateApiKeyResponse {
|
|
27
|
+
id: string;
|
|
28
|
+
key: string;
|
|
29
|
+
prefix: string;
|
|
30
|
+
name: string;
|
|
31
|
+
roleId: string;
|
|
32
|
+
actingUserId: string | null;
|
|
33
|
+
role: RoleRef;
|
|
34
|
+
scopes: string[];
|
|
35
|
+
createdAt: Date;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=api-key.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-key.dto.d.ts","sourceRoot":"","sources":["../../src/dto/api-key.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kBAAkB;;;;;;;iBAO7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;iBAQ7B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACjE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEjE,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateApiKeySchema = exports.createApiKeySchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.createApiKeySchema = zod_1.z.object({
|
|
6
|
+
name: zod_1.z.string().min(1).max(100),
|
|
7
|
+
roleId: zod_1.z.string().min(1),
|
|
8
|
+
actingUserId: zod_1.z.string().min(1).optional(),
|
|
9
|
+
scopes: zod_1.z.array(zod_1.z.string().min(1)),
|
|
10
|
+
rateLimit: zod_1.z.number().int().min(1).max(600).optional(),
|
|
11
|
+
expiresAt: zod_1.z.string().datetime().optional(),
|
|
12
|
+
});
|
|
13
|
+
exports.updateApiKeySchema = zod_1.z.object({
|
|
14
|
+
name: zod_1.z.string().min(1).max(100).optional(),
|
|
15
|
+
roleId: zod_1.z.string().min(1).optional(),
|
|
16
|
+
actingUserId: zod_1.z.string().min(1).nullable().optional(),
|
|
17
|
+
scopes: zod_1.z.array(zod_1.z.string().min(1)).optional(),
|
|
18
|
+
rateLimit: zod_1.z.number().int().min(1).max(600).nullable().optional(),
|
|
19
|
+
isActive: zod_1.z.boolean().optional(),
|
|
20
|
+
expiresAt: zod_1.z.string().datetime().nullable().optional(),
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=api-key.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-key.dto.js","sourceRoot":"","sources":["../../src/dto/api-key.dto.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAChC,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC1C,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAClC,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACtD,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC5C,CAAC,CAAC;AAEU,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAC3C,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACpC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACrD,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC7C,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACjE,QAAQ,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAChC,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACvD,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ApiKeyRowActionsProps } from './types.js';
|
|
2
|
+
export declare function ApiKeyRowActions({ apiKey, serviceAccounts, setApiKeyActiveAction, deleteApiKeyAction, updateApiKeyActingUserAction, }: ApiKeyRowActionsProps): import("react").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=api-key-row-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-key-row-actions.d.ts","sourceRoot":"","sources":["../../src/frontend/api-key-row-actions.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,4BAA4B,GAC7B,EAAE,qBAAqB,+BAgIvB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ApiKeyRowActions = ApiKeyRowActions;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const frontend_shell_1 = require("@haneinfo/frontend-shell");
|
|
7
|
+
const lucide_react_1 = require("lucide-react");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
function ApiKeyRowActions({ apiKey, serviceAccounts, setApiKeyActiveAction, deleteApiKeyAction, updateApiKeyActingUserAction, }) {
|
|
10
|
+
const t = (0, frontend_shell_1.useTranslations)('apiKeys');
|
|
11
|
+
const tCommon = (0, frontend_shell_1.useTranslations)('common');
|
|
12
|
+
const [deleteOpen, setDeleteOpen] = (0, react_1.useState)(false);
|
|
13
|
+
const [actingUserOpen, setActingUserOpen] = (0, react_1.useState)(false);
|
|
14
|
+
const [selectedActingUserId, setSelectedActingUserId] = (0, react_1.useState)(apiKey.actingUserId ?? '__none');
|
|
15
|
+
const [isPending, startTransition] = (0, react_1.useTransition)();
|
|
16
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
17
|
+
function toggleActive() {
|
|
18
|
+
setError(null);
|
|
19
|
+
startTransition(async () => {
|
|
20
|
+
const result = await setApiKeyActiveAction(apiKey.id, !apiKey.isActive);
|
|
21
|
+
if (result.error)
|
|
22
|
+
setError(result.error);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function handleDelete() {
|
|
26
|
+
setError(null);
|
|
27
|
+
startTransition(async () => {
|
|
28
|
+
const result = await deleteApiKeyAction(apiKey.id);
|
|
29
|
+
if (result.error) {
|
|
30
|
+
setError(result.error);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
setDeleteOpen(false);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function handleActingUserSubmit() {
|
|
38
|
+
setError(null);
|
|
39
|
+
startTransition(async () => {
|
|
40
|
+
const result = await updateApiKeyActingUserAction(apiKey.id, selectedActingUserId === '__none' ? null : selectedActingUserId);
|
|
41
|
+
if (result.error) {
|
|
42
|
+
setError(result.error);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
setActingUserOpen(false);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
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) => {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
handleDelete();
|
|
52
|
+
}, disabled: isPending, className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", children: isPending ? t('deleting') : tCommon('delete') })] })] }) })] }));
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=api-key-row-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-key-row-actions.js","sourceRoot":"","sources":["../../src/frontend/api-key-row-actions.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAiCb,4CAsIC;;AArKD,6DA0BkC;AAClC,+CAA8C;AAC9C,iCAAgD;AAGhD,SAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,4BAA4B,GACN;IACtB,MAAM,CAAC,GAAG,IAAA,gCAAe,EAAC,SAAS,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,IAAA,gCAAe,EAAC,QAAQ,CAAC,CAAC;IAC1C,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,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,IAAA,gBAAQ,EAAC,MAAM,CAAC,YAAY,IAAI,QAAQ,CAAC,CAAC;IAClG,MAAM,CAAC,SAAS,EAAE,eAAe,CAAC,GAAG,IAAA,qBAAa,GAAE,CAAC;IACrD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAgB,IAAI,CAAC,CAAC;IAExD,SAAS,Y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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"}
|
|
@@ -0,0 +1,3 @@
|
|
|
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;
|
|
3
|
+
//# sourceMappingURL=api-keys-table.d.ts.map
|
|
@@ -0,0 +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,GAC7B,EAAE,iBAAiB,+BAsGnB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiKeysTable = ApiKeysTable;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const frontend_shell_1 = require("@haneinfo/frontend-shell");
|
|
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, }) {
|
|
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)))] })] }) }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=api-keys-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-keys-table.js","sourceRoot":"","sources":["../../src/frontend/api-keys-table.tsx"],"names":[],"mappings":";;AAaA,oCAiHC;;AA9HD,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,GACV;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,CAAC,KAAK,CAAC,GAAa,EACjC,uBAAC,0BAAS,cAAE,CAAC,CAAC,MAAM,CAAC,GAAa,EAClC,uBAAC,0BAAS,cAAE,CAAC,CAAC,YAAY,CAAC,GAAa,EACxC,uBAAC,0BAAS,cAAE,CAAC,CAAC,QAAQ,CAAC,GAAa,EACpC,uBAAC,0BAAS,cAAE,CAAC,CAAC,QAAQ,CAAC,GAAa,EACpC,uBAAC,0BAAS,cACR,uBAAC,qCAAoB,IACnB,KAAK,EAAE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|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CreateApiKeyDialog = CreateApiKeyDialog;
|
|
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 created_api_key_reveal_js_1 = require("./created-api-key-reveal.js");
|
|
9
|
+
const types_js_1 = require("./types.js");
|
|
10
|
+
function CreateApiKeyDialog({ roles, serviceAccounts, scopeOptions, createApiKeyAction, }) {
|
|
11
|
+
const t = (0, frontend_shell_1.useTranslations)('apiKeys');
|
|
12
|
+
const tCommon = (0, frontend_shell_1.useTranslations)('common');
|
|
13
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
14
|
+
const [isPending, startTransition] = (0, react_1.useTransition)();
|
|
15
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
16
|
+
const [created, setCreated] = (0, react_1.useState)(null);
|
|
17
|
+
function handleSubmit(formData) {
|
|
18
|
+
setError(null);
|
|
19
|
+
startTransition(async () => {
|
|
20
|
+
const result = await createApiKeyAction(formData);
|
|
21
|
+
if (result.error || !result.created) {
|
|
22
|
+
setError(result.error ?? t('createFailed'));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
setCreated(result.created);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function handleOpenChange(next) {
|
|
30
|
+
setOpen(next);
|
|
31
|
+
if (next) {
|
|
32
|
+
setError(null);
|
|
33
|
+
setCreated(null);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const resolvedScopeOptions = scopeOptions && scopeOptions.length > 0
|
|
37
|
+
? scopeOptions
|
|
38
|
+
: types_js_1.SCOPE_RESOURCES.flatMap((resource) => types_js_1.SCOPE_ACTIONS.map((action) => ({
|
|
39
|
+
value: `${resource}:${action}`,
|
|
40
|
+
label: `${resource}:${action}`,
|
|
41
|
+
})));
|
|
42
|
+
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'), 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", { action: handleSubmit, 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: "new-key-name", children: t('name') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.Input, { id: "new-key-name", name: "name", type: "text", required: true })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Field, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.FieldLabel, { htmlFor: "new-key-role", children: t('role') }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Select, { name: "roleId", required: true, children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.SelectTrigger, { id: "new-key-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: "new-key-acting-user", children: t('actingUser') }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Select, { name: "actingUserId", defaultValue: "__none", children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.SelectTrigger, { id: "new-key-acting-user", 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)))] })] })] }), (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)("div", { className: "max-h-40 overflow-y-auto rounded-md border p-3", children: (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-2", children: resolvedScopeOptions.map((scope) => ((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, { name: "scopes", value: scope.value }), (0, jsx_runtime_1.jsx)("span", { className: "font-mono text-xs", children: scope.label })] }, scope.value))) }) })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Field, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.FieldLabel, { htmlFor: "new-key-rate-limit", children: t('rateLimit') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.Input, { id: "new-key-rate-limit", name: "rateLimit", type: "number", min: 1 })] }), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Field, { children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.FieldLabel, { htmlFor: "new-key-expires", children: t('expiresAt') }), (0, jsx_runtime_1.jsx)(frontend_shell_1.DateTimePicker, { name: "expiresAt" })] }), 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: () => setOpen(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') })] })] })) })] }));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=create-api-key-dialog.js.map
|
|
@@ -0,0 +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,gDAsIC;;AAlKD,6DAsBkC;AAClC,iCAAgD;AAChD,2EAAkE;AAElE,yCAA4D;AAE5D,SAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,eAAe,EACf,YAAY,EACZ,kBAAkB,GACM;IACxB,MAAM,CAAC,GAAG,IAAA,gCAAe,EAAC,SAAS,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,IAAA,gCAAe,EAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,SAAS,EAAE,eAAe,CAAC,GAAG,IAAA,qBAAa,GAAE,CAAC;IACrD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAgB,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAA8B,IAAI,CAAC,CAAC;IAE1E,SAAS,YAAY,CAAC,QAAkB;QACtC,QAAQ,CAAC,IAAI,CAAC,CA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