@contember/engine-panel 2.2.0-alpha.4
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/CLAUDE.md +29 -0
- package/dist/development/index.cjs +21 -0
- package/dist/development/index.cjs.map +1 -0
- package/dist/development/index.js +21 -0
- package/dist/development/index.js.map +1 -0
- package/dist/development/src/PanelAccessCheck.cjs +21 -0
- package/dist/development/src/PanelAccessCheck.cjs.map +1 -0
- package/dist/development/src/PanelAccessCheck.js +21 -0
- package/dist/development/src/PanelAccessCheck.js.map +1 -0
- package/dist/development/src/PanelApiController.cjs +60 -0
- package/dist/development/src/PanelApiController.cjs.map +1 -0
- package/dist/development/src/PanelApiController.js +60 -0
- package/dist/development/src/PanelApiController.js.map +1 -0
- package/dist/development/src/PanelAssets.cjs +57 -0
- package/dist/development/src/PanelAssets.cjs.map +1 -0
- package/dist/development/src/PanelAssets.js +57 -0
- package/dist/development/src/PanelAssets.js.map +1 -0
- package/dist/development/src/PanelController.cjs +108 -0
- package/dist/development/src/PanelController.cjs.map +1 -0
- package/dist/development/src/PanelController.js +108 -0
- package/dist/development/src/PanelController.js.map +1 -0
- package/dist/development/src/PanelMount.cjs +27 -0
- package/dist/development/src/PanelMount.cjs.map +1 -0
- package/dist/development/src/PanelMount.js +27 -0
- package/dist/development/src/PanelMount.js.map +1 -0
- package/dist/development/src/PanelPlugin.cjs +66 -0
- package/dist/development/src/PanelPlugin.cjs.map +1 -0
- package/dist/development/src/PanelPlugin.js +66 -0
- package/dist/development/src/PanelPlugin.js.map +1 -0
- package/dist/development/src/TtlCache.cjs +47 -0
- package/dist/development/src/TtlCache.cjs.map +1 -0
- package/dist/development/src/TtlCache.js +47 -0
- package/dist/development/src/TtlCache.js.map +1 -0
- package/dist/development/src/generated/assets.cjs +46 -0
- package/dist/development/src/generated/assets.cjs.map +1 -0
- package/dist/development/src/generated/assets.js +46 -0
- package/dist/development/src/generated/assets.js.map +1 -0
- package/dist/production/index.cjs +21 -0
- package/dist/production/index.cjs.map +1 -0
- package/dist/production/index.js +21 -0
- package/dist/production/index.js.map +1 -0
- package/dist/production/src/PanelAccessCheck.cjs +21 -0
- package/dist/production/src/PanelAccessCheck.cjs.map +1 -0
- package/dist/production/src/PanelAccessCheck.js +21 -0
- package/dist/production/src/PanelAccessCheck.js.map +1 -0
- package/dist/production/src/PanelApiController.cjs +60 -0
- package/dist/production/src/PanelApiController.cjs.map +1 -0
- package/dist/production/src/PanelApiController.js +60 -0
- package/dist/production/src/PanelApiController.js.map +1 -0
- package/dist/production/src/PanelAssets.cjs +57 -0
- package/dist/production/src/PanelAssets.cjs.map +1 -0
- package/dist/production/src/PanelAssets.js +57 -0
- package/dist/production/src/PanelAssets.js.map +1 -0
- package/dist/production/src/PanelController.cjs +108 -0
- package/dist/production/src/PanelController.cjs.map +1 -0
- package/dist/production/src/PanelController.js +108 -0
- package/dist/production/src/PanelController.js.map +1 -0
- package/dist/production/src/PanelMount.cjs +27 -0
- package/dist/production/src/PanelMount.cjs.map +1 -0
- package/dist/production/src/PanelMount.js +27 -0
- package/dist/production/src/PanelMount.js.map +1 -0
- package/dist/production/src/PanelPlugin.cjs +66 -0
- package/dist/production/src/PanelPlugin.cjs.map +1 -0
- package/dist/production/src/PanelPlugin.js +66 -0
- package/dist/production/src/PanelPlugin.js.map +1 -0
- package/dist/production/src/TtlCache.cjs +47 -0
- package/dist/production/src/TtlCache.cjs.map +1 -0
- package/dist/production/src/TtlCache.js +47 -0
- package/dist/production/src/TtlCache.js.map +1 -0
- package/dist/production/src/generated/assets.cjs +46 -0
- package/dist/production/src/generated/assets.cjs.map +1 -0
- package/dist/production/src/generated/assets.js +46 -0
- package/dist/production/src/generated/assets.js.map +1 -0
- package/dist/tests/cases/unit/panelController.test.d.ts +2 -0
- package/dist/tests/cases/unit/panelController.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/panelMount.test.d.ts +2 -0
- package/dist/tests/cases/unit/panelMount.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/ttlCache.test.d.ts +2 -0
- package/dist/tests/cases/unit/ttlCache.test.d.ts.map +1 -0
- package/dist/tests/tsconfig.tsbuildinfo +1 -0
- package/dist/types/PanelAccessCheck.d.ts +16 -0
- package/dist/types/PanelAccessCheck.d.ts.map +1 -0
- package/dist/types/PanelApiController.d.ts +58 -0
- package/dist/types/PanelApiController.d.ts.map +1 -0
- package/dist/types/PanelAssets.d.ts +32 -0
- package/dist/types/PanelAssets.d.ts.map +1 -0
- package/dist/types/PanelController.d.ts +46 -0
- package/dist/types/PanelController.d.ts.map +1 -0
- package/dist/types/PanelMount.d.ts +26 -0
- package/dist/types/PanelMount.d.ts.map +1 -0
- package/dist/types/PanelPlugin.d.ts +6 -0
- package/dist/types/PanelPlugin.d.ts.map +1 -0
- package/dist/types/TtlCache.d.ts +16 -0
- package/dist/types/TtlCache.d.ts.map +1 -0
- package/dist/types/generated/assets.d.ts +3 -0
- package/dist/types/generated/assets.d.ts.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +40 -0
- package/scripts/buildAssets.ts +79 -0
- package/src/PanelAccessCheck.ts +24 -0
- package/src/PanelApiController.ts +126 -0
- package/src/PanelAssets.ts +69 -0
- package/src/PanelController.ts +166 -0
- package/src/PanelMount.ts +34 -0
- package/src/PanelPlugin.ts +77 -0
- package/src/TtlCache.ts +53 -0
- package/src/index.ts +11 -0
- package/src/tsconfig.json +9 -0
- package/tests/cases/unit/panelController.test.ts +159 -0
- package/tests/cases/unit/panelMount.test.ts +55 -0
- package/tests/cases/unit/ttlCache.test.ts +55 -0
- package/tests/tsconfig.json +9 -0
- package/tsconfig.json +8 -0
- package/tsconfig.settings.json +6 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AuthResult, ProjectGroupContainer } from '@contember/engine-http';
|
|
2
|
+
import type { PanelAccessCheck } from './PanelApiController.js';
|
|
3
|
+
/**
|
|
4
|
+
* Evaluates the tenant-configured panel policy, memoized per api key so a page of parallel requests
|
|
5
|
+
* costs one lookup rather than one per request. The TTL is deliberately short: revoking someone's
|
|
6
|
+
* access should take effect in seconds, not on their next sign-in.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ConfiguredPanelAccessCheck implements PanelAccessCheck {
|
|
9
|
+
private readonly cache;
|
|
10
|
+
constructor(ttlMs?: number);
|
|
11
|
+
isAllowed({ projectGroup, authResult }: {
|
|
12
|
+
projectGroup: ProjectGroupContainer;
|
|
13
|
+
authResult: AuthResult;
|
|
14
|
+
}): Promise<boolean>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=PanelAccessCheck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelAccessCheck.d.ts","sourceRoot":"","sources":["../../src/PanelAccessCheck.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAG/D;;;;GAIG;AACH,qBAAa,0BAA2B,YAAW,gBAAgB;IAClE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IAEzC,YAAY,KAAK,GAAE,MAAe,EAEjC;IAEY,SAAS,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE;QAAE,YAAY,EAAE,qBAAqB,CAAC;QAAC,UAAU,EAAE,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAMtI;CACD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { AuthResult, HttpController, ProjectGroupContainer } from '@contember/engine-http';
|
|
2
|
+
import { HttpErrorResponse } from '@contember/engine-http';
|
|
3
|
+
/**
|
|
4
|
+
* Decides whether a signed-in identity may use the management panel. This is an entry gate for the
|
|
5
|
+
* console, not an authorization system — every API the panel calls still enforces the tenant ACL.
|
|
6
|
+
*/
|
|
7
|
+
export interface PanelAccessCheck {
|
|
8
|
+
isAllowed(args: {
|
|
9
|
+
projectGroup: ProjectGroupContainer;
|
|
10
|
+
authResult: AuthResult;
|
|
11
|
+
}): Promise<boolean>;
|
|
12
|
+
}
|
|
13
|
+
export interface PanelApiControllerOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Whether a request carrying no credentials may act as the virtual `login` identity. Only the
|
|
16
|
+
* tenant mount has a pre-sign-in caller (the login screen); content and system do not, so they
|
|
17
|
+
* answer 401 rather than widening the anonymous surface for nobody.
|
|
18
|
+
*/
|
|
19
|
+
allowAnonymous: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Wraps an API controller (tenant / content / system) for the panel's own `/panel/api/*` mount.
|
|
23
|
+
*
|
|
24
|
+
* Two things happen here that do not happen on the public routes:
|
|
25
|
+
*
|
|
26
|
+
* 1. **Anonymous calls act as a virtual `login` identity.** The panel's sign-in screen has no
|
|
27
|
+
* credentials of its own, and shipping a login token to the browser — which is what every
|
|
28
|
+
* Contember admin app does today — would publish it. Instead the caller is given
|
|
29
|
+
* `createUnpersistedLoginVerifyResult()`: no token exists anywhere, no `api_key` row is read or
|
|
30
|
+
* written, and the roles are pinned in code, so a misconfigured `CONTEMBER_LOGIN_TOKEN` cannot
|
|
31
|
+
* turn this into anything but `login`. Browser requests must be same-origin; direct clients can
|
|
32
|
+
* reproduce the required headers. See {@link isSameOriginBrowser}.
|
|
33
|
+
* 2. **The access gate runs.** Anything the caller authenticated itself is checked against the
|
|
34
|
+
* configured panel policy before it reaches the API.
|
|
35
|
+
*/
|
|
36
|
+
export declare class PanelApiControllerFactory {
|
|
37
|
+
private readonly access;
|
|
38
|
+
constructor(access: PanelAccessCheck);
|
|
39
|
+
create(inner: HttpController, { allowAnonymous }: PanelApiControllerOptions): HttpController;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Names the gate as the source of a 403, because the status alone does not: the system API answers
|
|
43
|
+
* 403 for a project the caller is not a member of when the server runs in debug mode, and the content
|
|
44
|
+
* API does the same for a rejected `assumeMembership`. Without this header the panel would read either
|
|
45
|
+
* of those as "you may not be here" and throw the whole session away.
|
|
46
|
+
*
|
|
47
|
+
* `GraphQlClient` drops the body of a 403 but keeps the `Response`, so a header is what reaches the
|
|
48
|
+
* client. The panel is served from this origin, so it is readable without `Access-Control-Expose-Headers`.
|
|
49
|
+
* The client half is `isPanelAccessDenied` in `panel-ui/src/shell/accessDenied.ts`.
|
|
50
|
+
*/
|
|
51
|
+
export declare const panelErrorHeader = "X-Contember-Panel-Error";
|
|
52
|
+
/**
|
|
53
|
+
* 403 rather than a GraphQL error, so the panel can tell "you may not be here" apart from "you may
|
|
54
|
+
* not see this particular thing" (which the APIs report as a 200 with a `ForbiddenError` extension).
|
|
55
|
+
* The message is for operators reading logs; the browser acts on {@link panelErrorHeader}.
|
|
56
|
+
*/
|
|
57
|
+
export declare const accessDeniedResponse: () => HttpErrorResponse;
|
|
58
|
+
//# sourceMappingURL=PanelApiController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelApiController.d.ts","sourceRoot":"","sources":["../../src/PanelApiController.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC/F,OAAO,EAAsC,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE9F;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC,SAAS,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,qBAAqB,CAAC;QAAC,UAAU,EAAE,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAClG;AAED,MAAM,WAAW,yBAAyB;IACzC;;;;OAIG;IACH,cAAc,EAAE,OAAO,CAAA;CACvB;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,yBAAyB;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAnC,YAA6B,MAAM,EAAE,gBAAgB,EAAI;IAElD,MAAM,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,cAAc,EAAE,EAAE,yBAAyB,GAAG,cAAc,CA2BlG;CACD;AAsCD;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,4BAA4B,CAAA;AAEzD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,QAAO,iBAGrC,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single file of the built panel UI. Every entry is stored gzip-compressed and base64-encoded so
|
|
3
|
+
* the whole panel can be bundled into `dist/start.js` — the engine docker image contains nothing but
|
|
4
|
+
* that one file, so there is no directory to serve from.
|
|
5
|
+
*/
|
|
6
|
+
export interface PanelAsset {
|
|
7
|
+
readonly contentType: string;
|
|
8
|
+
/** gzip-compressed content, base64-encoded. */
|
|
9
|
+
readonly gzip: string;
|
|
10
|
+
}
|
|
11
|
+
/** Keys are paths relative to the panel root, without a leading slash (`assets/index-a1b2.js`). */
|
|
12
|
+
export type PanelAssetMap = Readonly<Record<string, PanelAsset>>;
|
|
13
|
+
export declare const indexAssetPath = "index.html";
|
|
14
|
+
export declare class PanelAssetStore {
|
|
15
|
+
private readonly assets;
|
|
16
|
+
private readonly gzip;
|
|
17
|
+
private readonly identity;
|
|
18
|
+
constructor(assets: PanelAssetMap);
|
|
19
|
+
/** True when the panel was not built into this binary — see `scripts/buildAssets.ts`. */
|
|
20
|
+
isEmpty(): boolean;
|
|
21
|
+
getContentType(path: string): string | undefined;
|
|
22
|
+
/** Gzipped bytes, decoded from base64 on first use and kept for the process lifetime. */
|
|
23
|
+
getGzip(path: string): Buffer | undefined;
|
|
24
|
+
/** Uncompressed bytes, decoded once for clients that do not accept gzip. */
|
|
25
|
+
getIdentity(path: string): Buffer | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The map is a plain object literal, so a request for `constructor` or `toString` would otherwise
|
|
28
|
+
* resolve an inherited member and blow up further down. The route is unauthenticated.
|
|
29
|
+
*/
|
|
30
|
+
private get;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=PanelAssets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelAssets.d.ts","sourceRoot":"","sources":["../../src/PanelAssets.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACrB;AAED,mGAAmG;AACnG,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAA;AAEhE,eAAO,MAAM,cAAc,eAAe,CAAA;AAE1C,qBAAa,eAAe;IAIf,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHnC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA4B;IACjD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4B;IAErD,YAA6B,MAAM,EAAE,aAAa,EAAI;IAEtD,yFAAyF;IAClF,OAAO,IAAI,OAAO,CAExB;IAEM,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEtD;IAED,yFAAyF;IAClF,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAW/C;IAED,4EAA4E;IACrE,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAWnD;IAED;;;OAGG;IACH,OAAO,CAAC,GAAG;CAGX"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { InternalHttpController } from '@contember/engine-http';
|
|
2
|
+
import { PanelAssetStore } from './PanelAssets.js';
|
|
3
|
+
export interface PanelControllerArgs {
|
|
4
|
+
/** Mount path without a trailing slash, e.g. `/panel`. */
|
|
5
|
+
basePath: string;
|
|
6
|
+
/** Prefix the panel prepends to every API path, e.g. `/panel/api`. */
|
|
7
|
+
apiBaseUrl: string;
|
|
8
|
+
assets: PanelAssetStore;
|
|
9
|
+
/** Plugin APIs mounted under {@link apiBaseUrl}; read on the first request, see {@link PanelController.indexHtml}. */
|
|
10
|
+
pluginApis: () => readonly string[];
|
|
11
|
+
}
|
|
12
|
+
/** Everything the controller reads from a request — see {@link PanelController.handle}. */
|
|
13
|
+
export interface PanelRequest {
|
|
14
|
+
method: string;
|
|
15
|
+
/** Path relative to the panel root, i.e. the route's wildcard parameter. */
|
|
16
|
+
path: string | undefined;
|
|
17
|
+
acceptEncoding: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export interface PanelResponse {
|
|
20
|
+
status: number;
|
|
21
|
+
headers: Readonly<Record<string, string>>;
|
|
22
|
+
body: Buffer;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Serves the built panel UI out of the bundled asset map.
|
|
26
|
+
*
|
|
27
|
+
* Registered as an *internal* route: static assets must not authenticate, and going through the
|
|
28
|
+
* regular pipeline would resolve a project group and verify an API key against the database on every
|
|
29
|
+
* file request. The panel's API traffic is a separate, regular route.
|
|
30
|
+
*/
|
|
31
|
+
export declare class PanelController {
|
|
32
|
+
private readonly args;
|
|
33
|
+
/**
|
|
34
|
+
* Rendered on the first request rather than here: the plugins that mount their API into the panel
|
|
35
|
+
* are not all registered yet while the container is still being built, and the shell carries the
|
|
36
|
+
* list. Built once and kept, since nothing in it can change afterwards.
|
|
37
|
+
*/
|
|
38
|
+
private indexHtml;
|
|
39
|
+
private readonly indexSource;
|
|
40
|
+
constructor(args: PanelControllerArgs);
|
|
41
|
+
create(): InternalHttpController;
|
|
42
|
+
handle(request: PanelRequest): PanelResponse;
|
|
43
|
+
private respond;
|
|
44
|
+
private renderIndex;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=PanelController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelController.d.ts","sourceRoot":"","sources":["../../src/PanelController.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAuB,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AACzF,OAAO,EAAkB,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElE,MAAM,WAAW,mBAAmB;IACnC,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAA;IAChB,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,eAAe,CAAA;IACvB,sHAAsH;IACtH,UAAU,EAAE,MAAM,SAAS,MAAM,EAAE,CAAA;CACnC;AAED,2FAA2F;AAC3F,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,4EAA4E;IAC5E,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAA;CAClC;AAED,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACzC,IAAI,EAAE,MAAM,CAAA;CACZ;AAqBD;;;;;;GAMG;AACH,qBAAa,eAAe;IASf,OAAO,CAAC,QAAQ,CAAC,IAAI;IARjC;;;;OAIG;IACH,OAAO,CAAC,SAAS,CAAgD;IACjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;IAEpC,YAA6B,IAAI,EAAE,mBAAmB,EAMrD;IAEM,MAAM,IAAI,sBAAsB,CAatC;IAEM,MAAM,CAAC,OAAO,EAAE,YAAY,GAAG,aAAa,CAwBlD;IAED,OAAO,CAAC,OAAO;IAYf,OAAO,CAAC,WAAW;CAgBnB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PanelApiMount, PanelApiMountArgs, PanelApiMountTarget } from '@contember/engine-http';
|
|
2
|
+
import type { PanelApiControllerFactory } from './PanelApiController.js';
|
|
3
|
+
import type { PanelAssetStore } from './PanelAssets.js';
|
|
4
|
+
/**
|
|
5
|
+
* Everything needed to serve the panel, resolved once. It exists only when the panel really is
|
|
6
|
+
* served — enabled *and* built into this binary — so a plugin can read "this resolved" as "there is
|
|
7
|
+
* a panel to mount into" and skip its panel route otherwise.
|
|
8
|
+
*/
|
|
9
|
+
export declare class PanelMount implements PanelApiMount {
|
|
10
|
+
readonly basePath: string;
|
|
11
|
+
readonly assets: PanelAssetStore;
|
|
12
|
+
/** Shared with the panel's own routes: one factory means one access-check cache for all of them. */
|
|
13
|
+
readonly api: PanelApiControllerFactory;
|
|
14
|
+
private readonly pluginApiNames;
|
|
15
|
+
constructor(basePath: string, assets: PanelAssetStore,
|
|
16
|
+
/** Shared with the panel's own routes: one factory means one access-check cache for all of them. */
|
|
17
|
+
api: PanelApiControllerFactory);
|
|
18
|
+
mount(application: PanelApiMountTarget, { name, path, controller }: PanelApiMountArgs): void;
|
|
19
|
+
/**
|
|
20
|
+
* APIs plugins have mounted, reported to the UI so a module can hide itself when the plugin that
|
|
21
|
+
* backs it is not installed. Read when the shell is rendered, not when it is constructed, so a
|
|
22
|
+
* plugin registering after the panel is still counted.
|
|
23
|
+
*/
|
|
24
|
+
get pluginApis(): readonly string[];
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=PanelMount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelMount.d.ts","sourceRoot":"","sources":["../../src/PanelMount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACnG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEvD;;;;GAIG;AACH,qBAAa,UAAW,YAAW,aAAa;aAI9B,QAAQ,EAAE,MAAM;aAChB,MAAM,EAAE,eAAe;IACvC,oGAAoG;aACpF,GAAG,EAAE,yBAAyB;IAN/C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAoB;IAEnD,YACiB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,eAAe;IACvC,oGAAoG;IACpF,GAAG,EAAE,yBAAyB,EAE9C;IAEM,KAAK,CAAC,WAAW,EAAE,mBAAmB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,iBAAiB,GAAG,IAAI,CAGlG;IAED;;;;OAIG;IACH,IAAW,UAAU,IAAI,SAAS,MAAM,EAAE,CAEzC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelPlugin.d.ts","sourceRoot":"","sources":["../../src/PanelPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA0B,mBAAmB,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAUjG,qBAAa,WAAY,YAAW,MAAM;IACzC,IAAI,SAAoB;IAExB,sBAAsB,IAAI,mBAAmB,CAsD5C;CACD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A minimal time-boxed memo. Entries are keyed by api key, so the map would otherwise grow with
|
|
3
|
+
* every session the process ever sees — expired entries are swept once the map gets large rather
|
|
4
|
+
* than on a timer.
|
|
5
|
+
*/
|
|
6
|
+
export declare class TtlCache<T> {
|
|
7
|
+
private readonly ttlMs;
|
|
8
|
+
private readonly sweepThreshold;
|
|
9
|
+
private readonly now;
|
|
10
|
+
private readonly entries;
|
|
11
|
+
constructor(ttlMs: number, sweepThreshold?: number, now?: () => number);
|
|
12
|
+
resolve(key: string, compute: () => Promise<T>): Promise<T>;
|
|
13
|
+
get size(): number;
|
|
14
|
+
private sweep;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=TtlCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TtlCache.d.ts","sourceRoot":"","sources":["../../src/TtlCache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,QAAQ,CAAC,CAAC;IAIrB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,GAAG;IALrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8D;IAEtF,YACkB,KAAK,EAAE,MAAM,EACb,cAAc,GAAE,MAAa,EAC7B,GAAG,GAAE,MAAM,MAAyB,EAClD;IAES,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAsBvE;IAED,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,OAAO,CAAC,KAAK;CAUb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../src/generated/assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGtD,eAAO,MAAM,WAAW,EAAE,aAyCzB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PanelPlugin } from './PanelPlugin.js';
|
|
2
|
+
export * from './PanelAccessCheck.js';
|
|
3
|
+
export * from './PanelApiController.js';
|
|
4
|
+
export * from './PanelAssets.js';
|
|
5
|
+
export * from './PanelController.js';
|
|
6
|
+
export * from './PanelMount.js';
|
|
7
|
+
export * from './PanelPlugin.js';
|
|
8
|
+
export * from './TtlCache.js';
|
|
9
|
+
export default PanelPlugin;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;eAEd,WAAW"}
|