@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.
Files changed (68) hide show
  1. package/dist/admin-key-scope-upgrade.d.ts +39 -0
  2. package/dist/admin-key-scope-upgrade.d.ts.map +1 -0
  3. package/dist/admin-key-scope-upgrade.js +34 -0
  4. package/dist/admin-key-scope-upgrade.js.map +1 -0
  5. package/dist/api-keys.controller.d.ts +10 -1
  6. package/dist/api-keys.controller.d.ts.map +1 -1
  7. package/dist/api-keys.controller.js +32 -7
  8. package/dist/api-keys.controller.js.map +1 -1
  9. package/dist/api-keys.module.d.ts.map +1 -1
  10. package/dist/api-keys.module.js +5 -1
  11. package/dist/api-keys.module.js.map +1 -1
  12. package/dist/api-keys.service.d.ts +6 -1
  13. package/dist/api-keys.service.d.ts.map +1 -1
  14. package/dist/api-keys.service.js +12 -13
  15. package/dist/api-keys.service.js.map +1 -1
  16. package/dist/frontend/api-key-row-actions.d.ts +1 -1
  17. package/dist/frontend/api-key-row-actions.d.ts.map +1 -1
  18. package/dist/frontend/api-key-row-actions.js +4 -2
  19. package/dist/frontend/api-key-row-actions.js.map +1 -1
  20. package/dist/frontend/api-keys-table.d.ts +1 -1
  21. package/dist/frontend/api-keys-table.d.ts.map +1 -1
  22. package/dist/frontend/api-keys-table.js +2 -2
  23. package/dist/frontend/api-keys-table.js.map +1 -1
  24. package/dist/frontend/create-api-key-dialog.d.ts +1 -1
  25. package/dist/frontend/create-api-key-dialog.d.ts.map +1 -1
  26. package/dist/frontend/create-api-key-dialog.js +81 -21
  27. package/dist/frontend/create-api-key-dialog.js.map +1 -1
  28. package/dist/frontend/created-api-key-reveal.d.ts +4 -0
  29. package/dist/frontend/created-api-key-reveal.d.ts.map +1 -1
  30. package/dist/frontend/created-api-key-reveal.js +20 -3
  31. package/dist/frontend/created-api-key-reveal.js.map +1 -1
  32. package/dist/frontend/edit-api-key-dialog.d.ts +18 -0
  33. package/dist/frontend/edit-api-key-dialog.d.ts.map +1 -0
  34. package/dist/frontend/edit-api-key-dialog.js +88 -0
  35. package/dist/frontend/edit-api-key-dialog.js.map +1 -0
  36. package/dist/frontend/index.d.ts +4 -1
  37. package/dist/frontend/index.d.ts.map +1 -1
  38. package/dist/frontend/index.js +7 -1
  39. package/dist/frontend/index.js.map +1 -1
  40. package/dist/frontend/key-draft.d.ts +19 -0
  41. package/dist/frontend/key-draft.d.ts.map +1 -0
  42. package/dist/frontend/key-draft.js +52 -0
  43. package/dist/frontend/key-draft.js.map +1 -0
  44. package/dist/frontend/scope-checklist.d.ts +14 -0
  45. package/dist/frontend/scope-checklist.d.ts.map +1 -0
  46. package/dist/frontend/scope-checklist.js +34 -0
  47. package/dist/frontend/scope-checklist.js.map +1 -0
  48. package/dist/frontend/service-account-select.d.ts +15 -0
  49. package/dist/frontend/service-account-select.d.ts.map +1 -0
  50. package/dist/frontend/service-account-select.js +48 -0
  51. package/dist/frontend/service-account-select.js.map +1 -0
  52. package/dist/frontend/types.d.ts +36 -0
  53. package/dist/frontend/types.d.ts.map +1 -1
  54. package/dist/frontend/types.js.map +1 -1
  55. package/dist/frontend.d.ts +2 -2
  56. package/dist/frontend.d.ts.map +1 -1
  57. package/dist/frontend.js +4 -1
  58. package/dist/frontend.js.map +1 -1
  59. package/dist/index.d.ts +2 -0
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js +2 -0
  62. package/dist/index.js.map +1 -1
  63. package/dist/scope-catalog.d.ts +63 -0
  64. package/dist/scope-catalog.d.ts.map +1 -0
  65. package/dist/scope-catalog.js +111 -0
  66. package/dist/scope-catalog.js.map +1 -0
  67. package/package.json +17 -17
  68. package/LICENSE +0 -14
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ServiceAccountSelect = ServiceAccountSelect;
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 NONE = '__none';
9
+ /**
10
+ * Acting-user picker. Lists service accounts only. With a search action, the list comes from the
11
+ * server (at most 20 per request), so the picker never holds accounts the admin page did not load.
12
+ * Choosing an account here grants nothing: authority still comes from the key's Role and scopes.
13
+ */
14
+ function ServiceAccountSelect({ id, value, accounts, onChange, disabled, search, }) {
15
+ const t = (0, frontend_shell_1.useTranslations)('apiKeys');
16
+ const [query, setQuery] = (0, react_1.useState)('');
17
+ const [results, setResults] = (0, react_1.useState)(null);
18
+ const [searching, setSearching] = (0, react_1.useState)(false);
19
+ const requestRef = (0, react_1.useRef)(0);
20
+ (0, react_1.useEffect)(() => {
21
+ if (!search)
22
+ return;
23
+ const requestId = ++requestRef.current;
24
+ const handle = setTimeout(async () => {
25
+ setSearching(true);
26
+ try {
27
+ const next = await search(query.trim());
28
+ if (requestRef.current === requestId)
29
+ setResults(next);
30
+ }
31
+ catch {
32
+ if (requestRef.current === requestId)
33
+ setResults([]);
34
+ }
35
+ finally {
36
+ if (requestRef.current === requestId)
37
+ setSearching(false);
38
+ }
39
+ }, 250);
40
+ return () => clearTimeout(handle);
41
+ }, [query, search]);
42
+ const listed = search && results ? results : accounts;
43
+ // Keep the current binding visible even when a search no longer returns it.
44
+ const bound = value === NONE ? undefined : accounts.find((account) => account.id === value);
45
+ const items = bound && !listed.some((account) => account.id === bound.id) ? [...listed, bound] : listed;
46
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-2", children: [search && ((0, jsx_runtime_1.jsx)(frontend_shell_1.Input, { "aria-label": t('searchServiceAccounts'), placeholder: t('searchServiceAccounts'), value: query, disabled: disabled, maxLength: 100, onChange: (event) => setQuery(event.target.value) })), (0, jsx_runtime_1.jsxs)(frontend_shell_1.Select, { value: value, onValueChange: onChange, disabled: disabled, children: [(0, jsx_runtime_1.jsx)(frontend_shell_1.SelectTrigger, { id: id, 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') }), items.map((account) => ((0, jsx_runtime_1.jsxs)(frontend_shell_1.SelectItem, { value: account.id, children: [account.email, account.name ? ` (${account.name})` : '', account.isActive === false ? ` · ${t('inactive')}` : ''] }, account.id)))] })] }), searching && (0, jsx_runtime_1.jsx)("p", { className: "text-muted-foreground text-xs", children: t('searching') })] }));
47
+ }
48
+ //# sourceMappingURL=service-account-select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-account-select.js","sourceRoot":"","sources":["../../src/frontend/service-account-select.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAqBb,oDA0EC;;AA7FD,6DAQkC;AAClC,iCAAoD;AAGpD,MAAM,IAAI,GAAG,QAAQ,CAAC;AAEtB;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,EACnC,EAAE,EACF,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,MAAM,GAQP;IACC,MAAM,CAAC,GAAG,IAAA,gCAAe,EAAC,SAAS,CAAC,CAAC;IACrC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IACvC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAgC,IAAI,CAAC,CAAC;IAC5E,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,IAAA,cAAM,EAAC,CAAC,CAAC,CAAC;IAE7B,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,MAAM,SAAS,GAAG,EAAE,UAAU,CAAC,OAAO,CAAC;QACvC,MAAM,MAAM,GAAG,UAAU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,CAAC,CAAC,uBAAuB,CAAC,EACtC,WAAW,EAAE,CAAC,CAAC,uBAAuB,CAAC,EACvC,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,GAAG,EACd,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GACjD,CACH,EACD,wBAAC,uBAAM,IAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,aAC/D,uBAAC,8BAAa,IAAC,EAAE,EAAE,EAAE,YACnB,uBAAC,4BAAW,IAAC,WAAW,EAAE,CAAC,CAAC,gBAAgB,CAAC,GAAI,GACnC,EAChB,wBAAC,8BAAa,eACZ,uBAAC,2BAAU,IAAC,KAAK,EAAE,IAAI,YAAG,CAAC,CAAC,gBAAgB,CAAC,GAAc,EAC1D,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACtB,wBAAC,2BAAU,IAAkB,KAAK,EAAE,OAAO,CAAC,EAAE,aAC3C,OAAO,CAAC,KAAK,EACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,EACxC,OAAO,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAHzC,OAAO,CAAC,EAAE,CAId,CACd,CAAC,IACY,IACT,EACR,SAAS,IAAI,8BAAG,SAAS,EAAC,+BAA+B,YAAE,CAAC,CAAC,WAAW,CAAC,GAAK,IAC3E,CACP,CAAC;AACJ,CAAC"}
@@ -47,11 +47,34 @@ export interface ServiceAccountOption {
47
47
  id: string;
48
48
  email: string;
49
49
  name: string | null;
50
+ /** Inactive accounts stay listed so an existing binding still reads correctly. */
51
+ isActive?: boolean;
50
52
  }
51
53
  export interface ApiKeyScopeOption {
52
54
  value: string;
53
55
  label: string;
56
+ /** Key of the group this scope is displayed under; unset scopes fall into the platform group. */
57
+ group?: string;
54
58
  }
59
+ export interface ApiKeyScopeGroup {
60
+ key: string;
61
+ label: string;
62
+ }
63
+ /** What the key editor sends. The PATCH endpoint takes every field, so the whole draft is sent. */
64
+ export interface ApiKeyUpdatePayload {
65
+ name: string;
66
+ roleId: string;
67
+ actingUserId: string | null;
68
+ scopes: string[];
69
+ rateLimit: number | null;
70
+ expiresAt: string | null;
71
+ isActive: boolean;
72
+ }
73
+ export interface UpdateApiKeyResult {
74
+ error?: string;
75
+ }
76
+ /** Optional server search for the service-account picker; a page is at most 20 accounts. */
77
+ export type SearchServiceAccountsAction = (search: string) => Promise<ServiceAccountOption[]>;
55
78
  export declare const SCOPE_RESOURCES: readonly ["users", "api-keys"];
56
79
  export declare const SCOPE_ACTIONS: readonly ["read", "write"];
57
80
  export interface ApiKeysTableProps {
@@ -71,12 +94,20 @@ export interface ApiKeysTableProps {
71
94
  updateApiKeyActingUserAction: (id: string, actingUserId: string | null) => Promise<{
72
95
  error?: string;
73
96
  }>;
97
+ /** Optional so Apps that have not adopted the full editor keep working. Without it, no edit entry shows. */
98
+ roles?: ApiKeyRoleOption[];
99
+ scopeOptions?: ApiKeyScopeOption[];
100
+ scopeGroups?: ApiKeyScopeGroup[];
101
+ updateApiKeyAction?: (id: string, payload: ApiKeyUpdatePayload) => Promise<UpdateApiKeyResult>;
102
+ searchServiceAccountsAction?: SearchServiceAccountsAction;
74
103
  }
75
104
  export interface CreateApiKeyDialogProps {
76
105
  roles: ApiKeyRoleOption[];
77
106
  serviceAccounts: ServiceAccountOption[];
78
107
  scopeOptions?: ApiKeyScopeOption[];
108
+ scopeGroups?: ApiKeyScopeGroup[];
79
109
  createApiKeyAction: (formData: FormData) => Promise<CreateApiKeyResult>;
110
+ searchServiceAccountsAction?: SearchServiceAccountsAction;
80
111
  }
81
112
  export interface CreatedApiKeyRevealProps {
82
113
  created: CreateApiKeyResponse;
@@ -94,5 +125,10 @@ export interface ApiKeyRowActionsProps {
94
125
  updateApiKeyActingUserAction: (id: string, actingUserId: string | null) => Promise<{
95
126
  error?: string;
96
127
  }>;
128
+ roles?: ApiKeyRoleOption[];
129
+ scopeOptions?: ApiKeyScopeOption[];
130
+ scopeGroups?: ApiKeyScopeGroup[];
131
+ updateApiKeyAction?: (id: string, payload: ApiKeyUpdatePayload) => Promise<UpdateApiKeyResult>;
132
+ searchServiceAccountsAction?: SearchServiceAccountsAction;
97
133
  }
98
134
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/frontend/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;IAC/E,iBAAiB,EAAE,QAAQ;CAC5B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,YAAY,CAAC;AAEpD,MAAM,MAAM,eAAe,GACvB,YAAY,GACZ,gBAAgB,GAChB,QAAQ,GACR,UAAU,GACV,KAAK,GACL,UAAU,GACV,MAAM,GACN,OAAO,GACP,WAAW,GACX,MAAM,GACN,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,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,aAAa,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,OAA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O,CAAC,kBAAkB,CAAC,CAAC;IAC/F,2BAA2B,CAAC,EAAE,2BAA2B,CAAC;CAC3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/frontend/types.ts"],"names":[],"mappings":";;;AA4Ea,QAAA,eAAe,GAAG,CAAC,OAAO,EAAE,UAAU,CAAU,CAAC;AACjD,QAAA,aAAa,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/frontend/types.ts"],"names":[],"mappings":";;;AAuGa,QAAA,eAAe,GAAG,CAAC,OAAO,EAAE,UAAU,CAAU,CAAC;AACjD,QAAA,aAAa,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC"}
@@ -4,6 +4,6 @@
4
4
  export interface M2mApiKeyFrontendContribution {
5
5
  readonly kind: 'haneinfo.m2m-api-key.frontend';
6
6
  }
7
- export type { ApiKeyRoleOption, ApiKeyRoleRef, ApiKeyRow, ApiKeyRowActionsProps, ApiKeyScopeOption, ApiKeySortField, ApiKeysTableKey, ApiKeysTableProps, CreateApiKeyDialogProps, CreateApiKeyResponse, CreateApiKeyResult, CreatedApiKeyRevealProps, ServiceAccountOption, } from './frontend/index.js';
8
- export { ApiKeyRowActions, ApiKeysTable, CreateApiKeyDialog, CreatedApiKeyReveal, SCOPE_ACTIONS, SCOPE_RESOURCES, } from './frontend/index.js';
7
+ export type { ApiKeyRoleOption, ApiKeyRoleRef, ApiKeyRow, ApiKeyRowActionsProps, ApiKeyScopeGroup, ApiKeyScopeOption, ApiKeySortField, ApiKeysTableKey, ApiKeysTableProps, ApiKeyUpdatePayload, CreateApiKeyDialogProps, CreateApiKeyResponse, CreateApiKeyResult, CreatedApiKeyRevealProps, SearchServiceAccountsAction, ServiceAccountOption, UpdateApiKeyResult, } from './frontend/index.js';
8
+ export { ApiKeyRowActions, ApiKeysTable, CreateApiKeyDialog, CreatedApiKeyReveal, EditApiKeyDialog, SCOPE_ACTIONS, SCOPE_RESOURCES, ScopeChecklist, ServiceAccountSelect, } from './frontend/index.js';
9
9
  //# sourceMappingURL=frontend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"frontend.d.ts","sourceRoot":"","sources":["../src/frontend.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,EAAE,+BAA+B,CAAC;CAChD;AAED,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,eAAe,GAChB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"frontend.d.ts","sourceRoot":"","sources":["../src/frontend.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,EAAE,+BAA+B,CAAC;CAChD;AAED,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,2BAA2B,EAC3B,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,cAAc,EACd,oBAAoB,GACrB,MAAM,qBAAqB,CAAC"}
package/dist/frontend.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SCOPE_RESOURCES = exports.SCOPE_ACTIONS = exports.CreatedApiKeyReveal = exports.CreateApiKeyDialog = exports.ApiKeysTable = exports.ApiKeyRowActions = void 0;
3
+ exports.ServiceAccountSelect = exports.ScopeChecklist = exports.SCOPE_RESOURCES = exports.SCOPE_ACTIONS = exports.EditApiKeyDialog = exports.CreatedApiKeyReveal = exports.CreateApiKeyDialog = exports.ApiKeysTable = exports.ApiKeyRowActions = void 0;
4
4
  // Named re-exports, not `export * from`: see frontend/index.ts for why -- a `for...in`-based
5
5
  // re-export silently drops anything backed by an RSC client-reference proxy.
6
6
  var index_js_1 = require("./frontend/index.js");
@@ -8,6 +8,9 @@ Object.defineProperty(exports, "ApiKeyRowActions", { enumerable: true, get: func
8
8
  Object.defineProperty(exports, "ApiKeysTable", { enumerable: true, get: function () { return index_js_1.ApiKeysTable; } });
9
9
  Object.defineProperty(exports, "CreateApiKeyDialog", { enumerable: true, get: function () { return index_js_1.CreateApiKeyDialog; } });
10
10
  Object.defineProperty(exports, "CreatedApiKeyReveal", { enumerable: true, get: function () { return index_js_1.CreatedApiKeyReveal; } });
11
+ Object.defineProperty(exports, "EditApiKeyDialog", { enumerable: true, get: function () { return index_js_1.EditApiKeyDialog; } });
11
12
  Object.defineProperty(exports, "SCOPE_ACTIONS", { enumerable: true, get: function () { return index_js_1.SCOPE_ACTIONS; } });
12
13
  Object.defineProperty(exports, "SCOPE_RESOURCES", { enumerable: true, get: function () { return index_js_1.SCOPE_RESOURCES; } });
14
+ Object.defineProperty(exports, "ScopeChecklist", { enumerable: true, get: function () { return index_js_1.ScopeChecklist; } });
15
+ Object.defineProperty(exports, "ServiceAccountSelect", { enumerable: true, get: function () { return index_js_1.ServiceAccountSelect; } });
13
16
  //# sourceMappingURL=frontend.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"frontend.js","sourceRoot":"","sources":["../src/frontend.ts"],"names":[],"mappings":";;;AAsBA,6FAA6F;AAC7F,6EAA6E;AAC7E,gDAO6B;AAN3B,4GAAA,gBAAgB,OAAA;AAChB,wGAAA,YAAY,OAAA;AACZ,8GAAA,kBAAkB,OAAA;AAClB,+GAAA,mBAAmB,OAAA;AACnB,yGAAA,aAAa,OAAA;AACb,2GAAA,eAAe,OAAA"}
1
+ {"version":3,"file":"frontend.js","sourceRoot":"","sources":["../src/frontend.ts"],"names":[],"mappings":";;;AA0BA,6FAA6F;AAC7F,6EAA6E;AAC7E,gDAU6B;AAT3B,4GAAA,gBAAgB,OAAA;AAChB,wGAAA,YAAY,OAAA;AACZ,8GAAA,kBAAkB,OAAA;AAClB,+GAAA,mBAAmB,OAAA;AACnB,4GAAA,gBAAgB,OAAA;AAChB,yGAAA,aAAa,OAAA;AACb,2GAAA,eAAe,OAAA;AACf,0GAAA,cAAc,OAAA;AACd,gHAAA,oBAAoB,OAAA"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './admin-key-scope-upgrade';
1
2
  export * from './api-key.guard';
2
3
  export * from './api-key-machine.strategy';
3
4
  export * from './api-key-rate-limiter';
@@ -8,5 +9,6 @@ export * from './decorators/scopes.decorator';
8
9
  export * from './dto/api-key.dto';
9
10
  export * from './guards/admin.guard';
10
11
  export * from './guards/scope.guard';
12
+ export * from './scope-catalog';
11
13
  export * from './scope-matcher.service';
12
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,iBAAiB,CAAC;AAGhC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,+BAA+B,CAAC;AAE9C,cAAc,mBAAmB,CAAC;AAElC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAEhC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,+BAA+B,CAAC;AAE9C,cAAc,mBAAmB,CAAC;AAElC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ __exportStar(require("./admin-key-scope-upgrade"), exports);
18
19
  __exportStar(require("./api-key.guard"), exports);
19
20
  // Strategy & Service / Controller
20
21
  __exportStar(require("./api-key-machine.strategy"), exports);
@@ -29,5 +30,6 @@ __exportStar(require("./dto/api-key.dto"), exports);
29
30
  // Guards
30
31
  __exportStar(require("./guards/admin.guard"), exports);
31
32
  __exportStar(require("./guards/scope.guard"), exports);
33
+ __exportStar(require("./scope-catalog"), exports);
32
34
  __exportStar(require("./scope-matcher.service"), exports);
33
35
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,SAAS;;;;;;;;;;;;;;;;AAET,kDAAgC;AAEhC,kCAAkC;AAClC,6DAA2C;AAC3C,yDAAuC;AACvC,wDAAsC;AACtC,oDAAkC;AAClC,qDAAmC;AACnC,aAAa;AACb,gEAA8C;AAC9C,MAAM;AACN,oDAAkC;AAClC,SAAS;AACT,uDAAqC;AACrC,uDAAqC;AACrC,0DAAwC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,SAAS;;;;;;;;;;;;;;;;AAET,4DAA0C;AAC1C,kDAAgC;AAChC,kCAAkC;AAClC,6DAA2C;AAC3C,yDAAuC;AACvC,wDAAsC;AACtC,oDAAkC;AAClC,qDAAmC;AACnC,aAAa;AACb,gEAA8C;AAC9C,MAAM;AACN,oDAAkC;AAClC,SAAS;AACT,uDAAqC;AACrC,uDAAqC;AACrC,kDAAgC;AAChC,0DAAwC"}
@@ -0,0 +1,63 @@
1
+ import { type OnApplicationBootstrap } from '@nestjs/common';
2
+ import { DiscoveryService, MetadataScanner } from '@nestjs/core';
3
+ /**
4
+ * Extra scopes an App contributes beyond its mounted REST routes, e.g. the `requiredScopes` of its
5
+ * machine MCP tools. Apps provide an array of these under `M2M_SCOPE_SOURCES`.
6
+ */
7
+ export interface ScopeSource {
8
+ listScopes(): readonly string[];
9
+ }
10
+ export declare const M2M_SCOPE_SOURCES: unique symbol;
11
+ /**
12
+ * Display grouping an App supplies for its own resources, e.g. `{ key: 'calendar', label: 'Calendar',
13
+ * resources: ['calendars', 'calendar_events'] }`. The package names no App's resources; anything no
14
+ * group claims falls into the shared `platform` group.
15
+ */
16
+ export interface ScopeGroupDefinition {
17
+ key: string;
18
+ label: string;
19
+ resources: readonly string[];
20
+ }
21
+ export declare const M2M_SCOPE_GROUPS: unique symbol;
22
+ export declare const PLATFORM_SCOPE_GROUP: {
23
+ readonly key: "platform";
24
+ readonly label: "Platform";
25
+ };
26
+ export interface CatalogScope {
27
+ scope: string;
28
+ group: string;
29
+ }
30
+ export interface CatalogGroup {
31
+ key: string;
32
+ label: string;
33
+ }
34
+ export declare const WILDCARD_SCOPE = "*";
35
+ /**
36
+ * The single source of truth for which scopes exist. Derived at bootstrap from the mounted REST
37
+ * controllers (`@Scopes()` metadata) and any App-supplied `ScopeSource`. Display, issuance and
38
+ * validation all read from here, so a scope cannot be issued unless something actually declares it.
39
+ */
40
+ export declare class M2mScopeCatalogService implements OnApplicationBootstrap {
41
+ private readonly discovery;
42
+ private readonly scanner;
43
+ private readonly sources?;
44
+ private readonly groupDefinitions?;
45
+ private scopes;
46
+ private resources;
47
+ constructor(discovery: DiscoveryService, scanner: MetadataScanner, sources?: ScopeSource[] | undefined, groupDefinitions?: ScopeGroupDefinition[] | undefined);
48
+ onApplicationBootstrap(): void;
49
+ /** Every concrete scope the catalog knows, sorted for stable display. */
50
+ list(): string[];
51
+ /** Groups in App order, then the shared platform group. Used by the key editor for display. */
52
+ groups(): CatalogGroup[];
53
+ /** Every catalog scope with the group it is displayed under, in the same order as `list()`. */
54
+ describe(): CatalogScope[];
55
+ /** The group a scope belongs to: the first App group that claims its resource, else platform. */
56
+ groupOf(scope: string): string;
57
+ /**
58
+ * Whether a scope may be newly issued: `*`, a catalog entry, or `resource:*` for a resource the
59
+ * catalog knows. Anything else (unknown resource, unregistered action, malformed string) is refused.
60
+ */
61
+ isKnown(scope: string): boolean;
62
+ }
63
+ //# sourceMappingURL=scope-catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-catalog.d.ts","sourceRoot":"","sources":["../src/scope-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,sBAAsB,EAAY,MAAM,gBAAgB,CAAC;AAE3F,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGjE;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,UAAU,IAAI,SAAS,MAAM,EAAE,CAAC;CACjC;AAED,eAAO,MAAM,iBAAiB,eAA2C,CAAC;AAE1E;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B;AAED,eAAO,MAAM,gBAAgB,eAA0C,CAAC;AAExE,eAAO,MAAM,oBAAoB;;;CAAkD,CAAC;AAEpF,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,cAAc,MAAM,CAAC;AAQlC;;;;GAIG;AACH,qBACa,sBAAuB,YAAW,sBAAsB;IAKvC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACV,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAGhE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IATpC,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,SAAS,CAAqB;gBAGO,SAAS,EAAE,gBAAgB,EAC5B,OAAO,EAAE,eAAe,EACV,OAAO,CAAC,EAAE,WAAW,EAAE,YAAA,EAG9D,gBAAgB,CAAC,EAAE,oBAAoB,EAAE,YAAA;IAG5D,sBAAsB,IAAI,IAAI;IA2B9B,yEAAyE;IACzE,IAAI,IAAI,MAAM,EAAE;IAIhB,+FAA+F;IAC/F,MAAM,IAAI,YAAY,EAAE;IAOxB,+FAA+F;IAC/F,QAAQ,IAAI,YAAY,EAAE;IAI1B,iGAAiG;IACjG,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAM9B;;;OAGG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAKhC"}
@@ -0,0 +1,111 @@
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.M2mScopeCatalogService = exports.WILDCARD_SCOPE = exports.PLATFORM_SCOPE_GROUP = exports.M2M_SCOPE_GROUPS = exports.M2M_SCOPE_SOURCES = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const constants_1 = require("@nestjs/common/constants");
18
+ const core_1 = require("@nestjs/core");
19
+ const scopes_decorator_1 = require("./decorators/scopes.decorator");
20
+ exports.M2M_SCOPE_SOURCES = Symbol.for('haneinfo.m2m-scope-sources');
21
+ exports.M2M_SCOPE_GROUPS = Symbol.for('haneinfo.m2m-scope-groups');
22
+ exports.PLATFORM_SCOPE_GROUP = { key: 'platform', label: 'Platform' };
23
+ exports.WILDCARD_SCOPE = '*';
24
+ // `resource:action`, where both halves are lowercase identifiers. The action half is NOT limited to
25
+ // read/write/call: any action an App declares via `@Scopes()` (e.g. `esign-templates:publish`) is
26
+ // valid once it appears in the catalog.
27
+ const SCOPE_FORMAT = /^[a-z0-9_-]+:[a-z0-9_-]+$/;
28
+ const RESOURCE_WILDCARD_FORMAT = /^([a-z0-9_-]+):\*$/;
29
+ /**
30
+ * The single source of truth for which scopes exist. Derived at bootstrap from the mounted REST
31
+ * controllers (`@Scopes()` metadata) and any App-supplied `ScopeSource`. Display, issuance and
32
+ * validation all read from here, so a scope cannot be issued unless something actually declares it.
33
+ */
34
+ let M2mScopeCatalogService = class M2mScopeCatalogService {
35
+ constructor(discovery, scanner, sources, groupDefinitions) {
36
+ this.discovery = discovery;
37
+ this.scanner = scanner;
38
+ this.sources = sources;
39
+ this.groupDefinitions = groupDefinitions;
40
+ this.scopes = new Set();
41
+ this.resources = new Set();
42
+ }
43
+ onApplicationBootstrap() {
44
+ const found = new Set();
45
+ for (const wrapper of this.discovery.getControllers()) {
46
+ const type = wrapper.metatype;
47
+ const instance = wrapper.instance;
48
+ if (!type || !instance)
49
+ continue;
50
+ for (const name of this.scanner.getAllMethodNames(Object.getPrototypeOf(instance))) {
51
+ const handler = instance[name];
52
+ if (Reflect.getMetadata(constants_1.METHOD_METADATA, handler) === undefined)
53
+ continue;
54
+ const scopes = Reflect.getMetadata(scopes_decorator_1.SCOPES_KEY, handler) ?? Reflect.getMetadata(scopes_decorator_1.SCOPES_KEY, type) ?? [];
55
+ for (const scope of scopes)
56
+ found.add(scope);
57
+ }
58
+ }
59
+ for (const source of this.sources ?? []) {
60
+ for (const scope of source.listScopes())
61
+ found.add(scope);
62
+ }
63
+ // `*` is the legacy all-access grant and is handled separately; it is not a catalog entry.
64
+ this.scopes = new Set([...found].filter((scope) => scope !== exports.WILDCARD_SCOPE && SCOPE_FORMAT.test(scope)));
65
+ this.resources = new Set([...this.scopes].map((scope) => scope.split(':')[0]));
66
+ }
67
+ /** Every concrete scope the catalog knows, sorted for stable display. */
68
+ list() {
69
+ return [...this.scopes].sort();
70
+ }
71
+ /** Groups in App order, then the shared platform group. Used by the key editor for display. */
72
+ groups() {
73
+ return [...(this.groupDefinitions ?? []), exports.PLATFORM_SCOPE_GROUP].map(({ key, label }) => ({
74
+ key,
75
+ label,
76
+ }));
77
+ }
78
+ /** Every catalog scope with the group it is displayed under, in the same order as `list()`. */
79
+ describe() {
80
+ return this.list().map((scope) => ({ scope, group: this.groupOf(scope) }));
81
+ }
82
+ /** The group a scope belongs to: the first App group that claims its resource, else platform. */
83
+ groupOf(scope) {
84
+ const resource = scope.split(':')[0];
85
+ const match = (this.groupDefinitions ?? []).find((group) => group.resources.includes(resource));
86
+ return match?.key ?? exports.PLATFORM_SCOPE_GROUP.key;
87
+ }
88
+ /**
89
+ * Whether a scope may be newly issued: `*`, a catalog entry, or `resource:*` for a resource the
90
+ * catalog knows. Anything else (unknown resource, unregistered action, malformed string) is refused.
91
+ */
92
+ isKnown(scope) {
93
+ if (scope === exports.WILDCARD_SCOPE || this.scopes.has(scope))
94
+ return true;
95
+ const match = RESOURCE_WILDCARD_FORMAT.exec(scope);
96
+ return match !== null && this.resources.has(match[1]);
97
+ }
98
+ };
99
+ exports.M2mScopeCatalogService = M2mScopeCatalogService;
100
+ exports.M2mScopeCatalogService = M2mScopeCatalogService = __decorate([
101
+ (0, common_1.Injectable)(),
102
+ __param(0, (0, common_1.Inject)(core_1.DiscoveryService)),
103
+ __param(1, (0, common_1.Inject)(core_1.MetadataScanner)),
104
+ __param(2, (0, common_1.Optional)()),
105
+ __param(2, (0, common_1.Inject)(exports.M2M_SCOPE_SOURCES)),
106
+ __param(3, (0, common_1.Optional)()),
107
+ __param(3, (0, common_1.Inject)(exports.M2M_SCOPE_GROUPS)),
108
+ __metadata("design:paramtypes", [core_1.DiscoveryService,
109
+ core_1.MetadataScanner, Array, Array])
110
+ ], M2mScopeCatalogService);
111
+ //# sourceMappingURL=scope-catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-catalog.js","sourceRoot":"","sources":["../src/scope-catalog.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA2F;AAC3F,wDAA2D;AAC3D,uCAAiE;AACjE,oEAA2D;AAU9C,QAAA,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAa7D,QAAA,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AAE3D,QAAA,oBAAoB,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAW,CAAC;AAYvE,QAAA,cAAc,GAAG,GAAG,CAAC;AAElC,oGAAoG;A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"8.1.0",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -29,10 +29,16 @@
29
29
  "./prisma/api-key.prisma": "./prisma/api-key.prisma",
30
30
  "./package.json": "./package.json"
31
31
  },
32
+ "scripts": {
33
+ "build": "tsc -p tsconfig.build.json",
34
+ "dev": "tsc -p tsconfig.build.json --watch",
35
+ "test": "vitest run",
36
+ "typecheck": "tsc --noEmit"
37
+ },
32
38
  "dependencies": {
33
- "@haneinfo/common": "0.3.4",
34
- "@haneinfo/frontend-shell": "1.3.0",
35
- "@haneinfo/plugin-api": "1.4.0"
39
+ "@haneinfo/common": "workspace:*",
40
+ "@haneinfo/frontend-shell": "workspace:*",
41
+ "@haneinfo/plugin-api": "workspace:*"
36
42
  },
37
43
  "peerDependencies": {
38
44
  "@haneinfo/common": "^0.3.4",
@@ -65,6 +71,11 @@
65
71
  }
66
72
  },
67
73
  "devDependencies": {
74
+ "@haneinfo/common": "workspace:*",
75
+ "@haneinfo/frontend-shell": "workspace:*",
76
+ "@haneinfo/plugin-host-nest": "workspace:*",
77
+ "@haneinfo/plugin-testkit": "workspace:*",
78
+ "@haneinfo/rbac": "workspace:*",
68
79
  "@nestjs/common": "^11.0.0",
69
80
  "@nestjs/core": "^11.0.0",
70
81
  "@nestjs/testing": "^11.0.0",
@@ -77,22 +88,11 @@
77
88
  "react-dom": "^19.2.7",
78
89
  "typescript": "^5.9.3",
79
90
  "vitest": "^4.1.11",
80
- "zod": "^4.4.0",
81
- "@haneinfo/plugin-host-nest": "2.0.0",
82
- "@haneinfo/common": "0.3.4",
83
- "@haneinfo/plugin-testkit": "2.2.0",
84
- "@haneinfo/frontend-shell": "1.3.0",
85
- "@haneinfo/rbac": "7.0.5"
91
+ "zod": "^4.4.0"
86
92
  },
87
93
  "license": "UNLICENSED",
88
94
  "publishConfig": {
89
95
  "registry": "https://registry.npmjs.org/",
90
96
  "access": "public"
91
- },
92
- "scripts": {
93
- "build": "tsc -p tsconfig.build.json",
94
- "dev": "tsc -p tsconfig.build.json --watch",
95
- "test": "vitest run",
96
- "typecheck": "tsc --noEmit"
97
97
  }
98
- }
98
+ }
package/LICENSE DELETED
@@ -1,14 +0,0 @@
1
- Copyright (c) 2026 Haneinfo. All Rights Reserved.
2
-
3
- This software and associated documentation files (the "Software") are the proprietary and
4
- confidential property of Haneinfo. No part of the Software may be copied, modified, merged,
5
- published, distributed, sublicensed, or sold without the prior written permission of Haneinfo.
6
-
7
- The Software is provided for internal use by Haneinfo and its authorized personnel only, and is
8
- NOT licensed for external distribution or open-source use.
9
-
10
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
11
- NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
12
- NONINFRINGEMENT. IN NO EVENT SHALL HANEINFO BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
13
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
14
- THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.