@lensmcp/cluster 1.11.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/executors/gateway/gateway-errors.d.ts +36 -0
- package/executors/gateway/gateway-errors.d.ts.map +1 -0
- package/executors/gateway/gateway-errors.js +43 -0
- package/executors/gateway/gateway.lib.d.ts +15 -167
- package/executors/gateway/gateway.lib.d.ts.map +1 -1
- package/executors/gateway/gateway.lib.js +24 -1034
- package/executors/gateway/main.prod-gateway.js +74 -2
- package/executors/gateway/prod-gateway.lib.d.ts +19 -143
- package/executors/gateway/prod-gateway.lib.d.ts.map +1 -1
- package/executors/gateway/prod-gateway.lib.js +16 -831
- package/executors/gateway/prod-runtime/access-log.d.ts +9 -0
- package/executors/gateway/prod-runtime/access-log.d.ts.map +1 -0
- package/executors/gateway/prod-runtime/access-log.js +24 -0
- package/executors/gateway/prod-runtime/app.d.ts +23 -0
- package/executors/gateway/prod-runtime/app.d.ts.map +1 -0
- package/executors/gateway/prod-runtime/app.js +123 -0
- package/executors/gateway/prod-runtime/auth.d.ts +30 -0
- package/executors/gateway/prod-runtime/auth.d.ts.map +1 -0
- package/executors/gateway/prod-runtime/auth.js +51 -0
- package/executors/gateway/prod-runtime/cors.d.ts +19 -0
- package/executors/gateway/prod-runtime/cors.d.ts.map +1 -0
- package/executors/gateway/prod-runtime/cors.js +40 -0
- package/executors/gateway/prod-runtime/edge.d.ts +16 -0
- package/executors/gateway/prod-runtime/edge.d.ts.map +1 -0
- package/executors/gateway/prod-runtime/edge.js +65 -0
- package/executors/gateway/prod-runtime/handler.d.ts +32 -0
- package/executors/gateway/prod-runtime/handler.d.ts.map +1 -0
- package/executors/gateway/prod-runtime/handler.js +226 -0
- package/executors/gateway/prod-runtime/hooks.d.ts +20 -0
- package/executors/gateway/prod-runtime/hooks.d.ts.map +1 -0
- package/executors/gateway/prod-runtime/hooks.js +42 -0
- package/executors/gateway/prod-runtime/observability.d.ts +23 -0
- package/executors/gateway/prod-runtime/observability.d.ts.map +1 -0
- package/executors/gateway/prod-runtime/observability.js +125 -0
- package/executors/gateway/prod-runtime/rollout.d.ts +18 -0
- package/executors/gateway/prod-runtime/rollout.d.ts.map +1 -0
- package/executors/gateway/prod-runtime/rollout.js +103 -0
- package/executors/gateway/prod-runtime/routing.d.ts +4 -0
- package/executors/gateway/prod-runtime/routing.d.ts.map +1 -0
- package/executors/gateway/prod-runtime/routing.js +40 -0
- package/executors/gateway/prod-runtime/server.d.ts +3 -0
- package/executors/gateway/prod-runtime/server.d.ts.map +1 -0
- package/executors/gateway/prod-runtime/server.js +79 -0
- package/executors/gateway/prod-runtime/trust.d.ts +12 -0
- package/executors/gateway/prod-runtime/trust.d.ts.map +1 -0
- package/executors/gateway/prod-runtime/trust.js +32 -0
- package/executors/gateway/prod-runtime/types.d.ts +241 -0
- package/executors/gateway/prod-runtime/types.d.ts.map +1 -0
- package/executors/gateway/prod-runtime/types.js +2 -0
- package/executors/gateway/prod-runtime/upgrade.d.ts +21 -0
- package/executors/gateway/prod-runtime/upgrade.d.ts.map +1 -0
- package/executors/gateway/prod-runtime/upgrade.js +116 -0
- package/executors/gateway/prod-runtime/upstream.d.ts +13 -0
- package/executors/gateway/prod-runtime/upstream.d.ts.map +1 -0
- package/executors/gateway/prod-runtime/upstream.js +21 -0
- package/executors/gateway/runtime/auth.d.ts +8 -0
- package/executors/gateway/runtime/auth.d.ts.map +1 -0
- package/executors/gateway/runtime/auth.js +60 -0
- package/executors/gateway/runtime/dev-auth.d.ts +9 -0
- package/executors/gateway/runtime/dev-auth.d.ts.map +1 -0
- package/executors/gateway/runtime/dev-auth.js +79 -0
- package/executors/gateway/runtime/discovery.d.ts +17 -0
- package/executors/gateway/runtime/discovery.d.ts.map +1 -0
- package/executors/gateway/runtime/discovery.js +111 -0
- package/executors/gateway/runtime/edge.d.ts +31 -0
- package/executors/gateway/runtime/edge.d.ts.map +1 -0
- package/executors/gateway/runtime/edge.js +47 -0
- package/executors/gateway/runtime/handler.d.ts +24 -0
- package/executors/gateway/runtime/handler.d.ts.map +1 -0
- package/executors/gateway/runtime/handler.js +165 -0
- package/executors/gateway/runtime/hooks.d.ts +23 -0
- package/executors/gateway/runtime/hooks.d.ts.map +1 -0
- package/executors/gateway/runtime/hooks.js +55 -0
- package/executors/gateway/runtime/lens-children.d.ts +13 -0
- package/executors/gateway/runtime/lens-children.d.ts.map +1 -0
- package/executors/gateway/runtime/lens-children.js +136 -0
- package/executors/gateway/runtime/lifecycle.d.ts +13 -0
- package/executors/gateway/runtime/lifecycle.d.ts.map +1 -0
- package/executors/gateway/runtime/lifecycle.js +179 -0
- package/executors/gateway/runtime/observability.d.ts +17 -0
- package/executors/gateway/runtime/observability.d.ts.map +1 -0
- package/executors/gateway/runtime/observability.js +107 -0
- package/executors/gateway/runtime/proxy.d.ts +20 -0
- package/executors/gateway/runtime/proxy.d.ts.map +1 -0
- package/executors/gateway/runtime/proxy.js +113 -0
- package/executors/gateway/runtime/scope.d.ts +16 -0
- package/executors/gateway/runtime/scope.d.ts.map +1 -0
- package/executors/gateway/runtime/scope.js +68 -0
- package/executors/gateway/runtime/server.d.ts +3 -0
- package/executors/gateway/runtime/server.d.ts.map +1 -0
- package/executors/gateway/runtime/server.js +168 -0
- package/executors/gateway/runtime/service-keys.d.ts +11 -0
- package/executors/gateway/runtime/service-keys.d.ts.map +1 -0
- package/executors/gateway/runtime/service-keys.js +49 -0
- package/executors/gateway/runtime/types.d.ts +234 -0
- package/executors/gateway/runtime/types.d.ts.map +1 -0
- package/executors/gateway/runtime/types.js +2 -0
- package/executors/gateway/runtime/upgrade.d.ts +22 -0
- package/executors/gateway/runtime/upgrade.d.ts.map +1 -0
- package/executors/gateway/runtime/upgrade.js +63 -0
- package/package.json +3 -3
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type * as http from 'node:http';
|
|
2
|
+
/**
|
|
3
|
+
* The gateway's EDGE error contract — shared by the dev (`gateway.lib.ts`) and prod
|
|
4
|
+
* (`prod-gateway.lib.ts`) gateways so an error the gateway generates ITSELF (before/instead of an
|
|
5
|
+
* upstream) has the SAME shape as an error a service returns.
|
|
6
|
+
*
|
|
7
|
+
* Two properties the gateway guarantees for every request:
|
|
8
|
+
* 1. **JSON, not `text/plain`.** A gateway-generated 4xx/5xx is the JSON envelope
|
|
9
|
+
* `{ key, status, traceId, message? }` — the same `{ key, status }` localized contract the house
|
|
10
|
+
* `ApiError` uses, so a browser app renders `t(key)` (a localized message) AND can read the trace id.
|
|
11
|
+
* `key` is a framework-NEUTRAL `gateway.*` slug; the consumer ships the `gateway.*` translations.
|
|
12
|
+
* `message` is a developer-facing hint (never shown to users), preserving the old plain-text detail.
|
|
13
|
+
* 2. **A trace id on EVERY request.** {@link ensureRequestId} mints `x-request-id` at the edge if the
|
|
14
|
+
* client didn't send one, so the SAME id is forwarded to the upstream (the pod adopts it as its
|
|
15
|
+
* trace id) AND returned to the client — making any request traceable end-to-end, not just lensmcp
|
|
16
|
+
* flow-traced ones.
|
|
17
|
+
*
|
|
18
|
+
* This keeps the gateway generic (no consumer-specific keys baked in beyond the neutral `gateway.*`
|
|
19
|
+
* namespace) while integrating cleanly with a localized-error system.
|
|
20
|
+
*/
|
|
21
|
+
export type GatewayErrorReason = 'bad_request' | 'unauthorized' | 'forbidden' | 'not_found' | 'rate_limited' | 'unavailable' | 'internal';
|
|
22
|
+
/** Reason → stable, neutral localized key (the consumer translates the `gateway.*` namespace). */
|
|
23
|
+
export declare const GATEWAY_ERROR_KEY: Record<GatewayErrorReason, string>;
|
|
24
|
+
/**
|
|
25
|
+
* Ensure the request carries an `x-request-id` (mint one at the edge if absent) and return it. Because
|
|
26
|
+
* the gateway forwards `req.headers` to the upstream, the pod's request-context adopts THIS id as its
|
|
27
|
+
* `traceId`, and the gateway returns it on the response — one id, end-to-end, for ANY request.
|
|
28
|
+
*/
|
|
29
|
+
export declare function ensureRequestId(req: http.IncomingMessage): string;
|
|
30
|
+
/**
|
|
31
|
+
* Build the JSON edge-error body `{ key, status, traceId, message? }`. `detail` becomes the dev-facing
|
|
32
|
+
* `message` (e.g. the old plain-text reason), never surfaced to end users.
|
|
33
|
+
*/
|
|
34
|
+
export declare function gatewayErrorBody(status: number, reason: GatewayErrorReason, traceId: string, detail?: string): string;
|
|
35
|
+
export declare const GATEWAY_ERROR_CONTENT_TYPE = "application/json; charset=utf-8";
|
|
36
|
+
//# sourceMappingURL=gateway-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway-errors.d.ts","sourceRoot":"","sources":["../../../../../libs/cluster/src/executors/gateway/gateway-errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AAEvC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,kBAAkB,GAC1B,aAAa,GACb,cAAc,GACd,WAAW,GACX,WAAW,GACX,cAAc,GACd,aAAa,GACb,UAAU,CAAC;AAEf,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAQhE,CAAC;AAOF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,GAAG,MAAM,CAMjE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CAOR;AAED,eAAO,MAAM,0BAA0B,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GATEWAY_ERROR_CONTENT_TYPE = exports.GATEWAY_ERROR_KEY = void 0;
|
|
4
|
+
exports.ensureRequestId = ensureRequestId;
|
|
5
|
+
exports.gatewayErrorBody = gatewayErrorBody;
|
|
6
|
+
/** Reason → stable, neutral localized key (the consumer translates the `gateway.*` namespace). */
|
|
7
|
+
exports.GATEWAY_ERROR_KEY = {
|
|
8
|
+
bad_request: 'gateway.badRequest',
|
|
9
|
+
unauthorized: 'gateway.unauthorized',
|
|
10
|
+
forbidden: 'gateway.forbidden',
|
|
11
|
+
not_found: 'gateway.notFound',
|
|
12
|
+
rate_limited: 'gateway.rateLimited',
|
|
13
|
+
unavailable: 'gateway.unavailable',
|
|
14
|
+
internal: 'gateway.internal',
|
|
15
|
+
};
|
|
16
|
+
const headerValue = (v) => typeof v === 'string' && v !== '' ? v : Array.isArray(v) ? v[0] : undefined;
|
|
17
|
+
const mintId = () => Date.now().toString(36) + Math.random().toString(36).slice(2, 12);
|
|
18
|
+
/**
|
|
19
|
+
* Ensure the request carries an `x-request-id` (mint one at the edge if absent) and return it. Because
|
|
20
|
+
* the gateway forwards `req.headers` to the upstream, the pod's request-context adopts THIS id as its
|
|
21
|
+
* `traceId`, and the gateway returns it on the response — one id, end-to-end, for ANY request.
|
|
22
|
+
*/
|
|
23
|
+
function ensureRequestId(req) {
|
|
24
|
+
const existing = headerValue(req.headers['x-request-id']);
|
|
25
|
+
if (existing)
|
|
26
|
+
return existing;
|
|
27
|
+
const rid = mintId();
|
|
28
|
+
req.headers['x-request-id'] = rid;
|
|
29
|
+
return rid;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Build the JSON edge-error body `{ key, status, traceId, message? }`. `detail` becomes the dev-facing
|
|
33
|
+
* `message` (e.g. the old plain-text reason), never surfaced to end users.
|
|
34
|
+
*/
|
|
35
|
+
function gatewayErrorBody(status, reason, traceId, detail) {
|
|
36
|
+
return JSON.stringify({
|
|
37
|
+
key: exports.GATEWAY_ERROR_KEY[reason],
|
|
38
|
+
status,
|
|
39
|
+
traceId,
|
|
40
|
+
...(detail ? { message: detail } : {}),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
exports.GATEWAY_ERROR_CONTENT_TYPE = 'application/json; charset=utf-8';
|
|
@@ -1,171 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Public facade for the dev gateway runtime.
|
|
3
|
+
*
|
|
4
|
+
* The implementation now lives in `./runtime/*` as composable LAYERS — see
|
|
5
|
+
* `runtime/server.ts` for the composition root (`startGateway`), `runtime/types.ts`
|
|
6
|
+
* for the shared types + the customer **hooks** API, and the sibling modules for
|
|
7
|
+
* each layer (discovery, dev-auth, observability, lifecycle, lens-children, proxy,
|
|
8
|
+
* auth, hooks, handler, upgrade). This barrel preserves the original module's
|
|
9
|
+
* public surface so the executor wrapper (`gateway.impl.ts`) and the existing
|
|
10
|
+
* specs keep importing from one stable path, and additionally exposes the new
|
|
11
|
+
* hooks types so customers can author typed layers on top of the gateway.
|
|
5
12
|
*/
|
|
6
|
-
import { type ChildProcess } from 'node:child_process';
|
|
7
|
-
import * as http from 'node:http';
|
|
8
|
-
import type { GatewayExecutorSchema } from './schema';
|
|
9
|
-
import { type AuthPolicy } from './manifest';
|
|
10
13
|
export { hostMatches } from './manifest';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export declare function verifyDevJwt(req: http.IncomingMessage): Record<string, unknown> | undefined;
|
|
17
|
-
/** Stamp verified identity onto the forwarded request — tenant from the `tid` CLAIM, never a client header. */
|
|
18
|
-
export declare function stampIdentity(req: http.IncomingMessage, claims: Record<string, unknown>): void;
|
|
19
|
-
export interface GatewayContext {
|
|
20
|
-
root: string;
|
|
21
|
-
projectName?: string;
|
|
22
|
-
projectsConfigurations?: {
|
|
23
|
-
projects: Record<string, {
|
|
24
|
-
root: string;
|
|
25
|
-
}>;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/** Per-project declaration: top-level `cluster` field in project.json (`davnx` legacy). */
|
|
29
|
-
export interface ClusterProjectDecl {
|
|
30
|
-
/** Public dev hostname (e.g. `api.tetros.ai.local`). */
|
|
31
|
-
host?: string;
|
|
32
|
-
/** Mount PATH under the host — backend services share api.<domain> path-routed (e.g. `/channels`). */
|
|
33
|
-
path?: string;
|
|
34
|
-
/**
|
|
35
|
-
* Socket-pool mode (the "pods" model): the cluster devserver's service
|
|
36
|
-
* name. The gateway round-robins DIRECTLY over its children's unix
|
|
37
|
-
* sockets (`$TMPDIR/<service>-devserver/child-*.sock`) — one load
|
|
38
|
-
* balancer in front of N pods, like production. Also auto-exposes
|
|
39
|
-
* `internal.<host>` for east-west calls that SKIP the middleware (JWT).
|
|
40
|
-
*/
|
|
41
|
-
service?: string;
|
|
42
|
-
/** TCP mode (vite apps etc.): where the dev server listens. */
|
|
43
|
-
upstream?: string;
|
|
44
|
-
/** Shorthand for upstream. */
|
|
45
|
-
port?: number;
|
|
46
|
-
/** Prepend to forwarded URLs (e.g. `/api` for an app mounted under a prefix). */
|
|
47
|
-
prependPrefix?: string;
|
|
48
|
-
/** This project also serves unmatched hostnames (the catch-all). */
|
|
49
|
-
default?: boolean;
|
|
50
|
-
/** Override the auto `internal.<host>` name, or `false` to disable it. */
|
|
51
|
-
internalHost?: string | false;
|
|
52
|
-
/** Edge auth policy (default + per-path overrides) — generated from controller decorators
|
|
53
|
-
* by @tetros-server/gateway-sync; the gateway verifies + injects identity + enforces it.
|
|
54
|
-
* Absent ⇒ the service is unguarded at the edge (current behavior — opt-in enforcement). */
|
|
55
|
-
auth?: AuthPolicy;
|
|
56
|
-
/** Start at gateway boot (true) or on first request — scale from zero (false, default). */
|
|
57
|
-
eager?: boolean;
|
|
58
|
-
/** Pod range: spawn with min, autoscale up to max while requests overlap. */
|
|
59
|
-
minPods?: number;
|
|
60
|
-
maxPods?: number;
|
|
61
|
-
/** Kill a gateway-spawned (non-eager) service after this many idle seconds. */
|
|
62
|
-
idleKillSec?: number;
|
|
63
|
-
/** Nx target that runs the service. Default serve-hmr. */
|
|
64
|
-
serveTarget?: string;
|
|
65
|
-
/** Devserver admin endpoint for scaling (default from port: http(s)://localhost:<port>). */
|
|
66
|
-
adminUrl?: string;
|
|
67
|
-
/**
|
|
68
|
-
* FRONTEND apps only: run this app UNDER the lens. When true, the gateway
|
|
69
|
-
* SPAWNS the app's own Vite dev server with `@lensmcp/vite-plugin`
|
|
70
|
-
* instrumentation + a browser-capture sidecar (via the shared
|
|
71
|
-
* `spawnLensFrontend` helper) and routes THAT as the upstream — instead of
|
|
72
|
-
* assuming an external Vite already runs on `port`/`upstream`. The
|
|
73
|
-
* cluster-wide singletons (dashboard + MCP) are owned by the gateway, so a
|
|
74
|
-
* `lens:true` app never spawns its own. Absent/false ⇒ today's behavior
|
|
75
|
-
* (plain TCP upstream; bring-your-own Vite). Ignored for pod (`service`) decls.
|
|
76
|
-
*/
|
|
77
|
-
lens?: boolean;
|
|
78
|
-
}
|
|
79
|
-
export interface SockPool {
|
|
80
|
-
dir: string;
|
|
81
|
-
socks: string[];
|
|
82
|
-
idx: number;
|
|
83
|
-
scannedAt: number;
|
|
84
|
-
}
|
|
85
|
-
export interface Route {
|
|
86
|
-
host?: string;
|
|
87
|
-
prefix?: string;
|
|
88
|
-
project: string;
|
|
89
|
-
prependPrefix?: string;
|
|
90
|
-
target?: string;
|
|
91
|
-
pool?: SockPool;
|
|
92
|
-
svc?: ServiceCtl;
|
|
93
|
-
internal?: boolean;
|
|
94
|
-
auth?: AuthPolicy;
|
|
95
|
-
/** Frontend `lens:true` route: the gateway spawns this app's Vite + lens
|
|
96
|
-
* instrumentation as the upstream (see `LensFrontend`). */
|
|
97
|
-
lens?: LensFrontend;
|
|
98
|
-
}
|
|
99
|
-
/** A frontend app the gateway runs UNDER the lens (`cluster.lens: true`). The
|
|
100
|
-
* gateway spawns its Vite + browser capture as the upstream, deterministically
|
|
101
|
-
* on `port`, and never spawns the per-app dashboard/MCP (those are singletons
|
|
102
|
-
* the gateway owns). */
|
|
103
|
-
export interface LensFrontend {
|
|
104
|
-
project: string;
|
|
105
|
-
/** Absolute project root (holds vite.config.*). */
|
|
106
|
-
projectRoot: string;
|
|
107
|
-
/** The pinned Vite dev port (also the upstream target's port). */
|
|
108
|
-
port: number;
|
|
109
|
-
/** Set once the Vite child has been spawned (idempotency guard). */
|
|
110
|
-
started?: boolean;
|
|
111
|
-
}
|
|
112
|
-
export interface ServiceCtl {
|
|
113
|
-
project: string;
|
|
114
|
-
decl: ClusterProjectDecl;
|
|
115
|
-
pool: SockPool;
|
|
116
|
-
proc?: ChildProcess;
|
|
117
|
-
state: 'down' | 'starting' | 'up';
|
|
118
|
-
lastUsed: number;
|
|
119
|
-
inflight: number;
|
|
120
|
-
lastScaleAt: number;
|
|
121
|
-
spawnAt?: number;
|
|
122
|
-
lastErrors?: string[];
|
|
123
|
-
buildFailed?: boolean;
|
|
124
|
-
}
|
|
125
|
-
/** Test-tunable knobs on top of the user-facing schema. */
|
|
126
|
-
export interface GatewayRuntimeOptions extends GatewayExecutorSchema {
|
|
127
|
-
/** Traffic-edge flush period (ms). Default 5000. */
|
|
128
|
-
trafficFlushMs?: number;
|
|
129
|
-
/** Idle sweeper period (ms). Default 10000. */
|
|
130
|
-
sweepMs?: number;
|
|
131
|
-
/** Sock-dir rescan TTL (ms). Default 1500. */
|
|
132
|
-
scanTtlMs?: number;
|
|
133
|
-
/** Cold-start wait budget (ms). Default 120000. */
|
|
134
|
-
startupTimeoutMs?: number;
|
|
135
|
-
}
|
|
136
|
-
export interface GatewayHandle {
|
|
137
|
-
/** Ports actually bound (resolves `0` to the assigned ephemeral port). */
|
|
138
|
-
ports: number[];
|
|
139
|
-
routes: Route[];
|
|
140
|
-
services: ServiceCtl[];
|
|
141
|
-
stop: () => Promise<void>;
|
|
142
|
-
}
|
|
143
|
-
/** The base domain for the lens dashboard host — the longest common dotted
|
|
144
|
-
* suffix of the declared cluster hosts (e.g. ['api.tetros.ai.local',
|
|
145
|
-
* 'tetros.ai.local'] → 'tetros.ai.local'). Falls back to the first host, then
|
|
146
|
-
* to 'lens.local' if no host is declared. */
|
|
147
|
-
export declare function baseDomainOf(hosts: string[]): string;
|
|
148
|
-
/** Per-workspace lens scope (key + dashboard port + mount path). Prefers the
|
|
149
|
-
* CLI-written `.lensmcp/config.json` (so the gateway agrees with `lensmcp gateway`
|
|
150
|
-
* / `lensmcp dashboard`); falls back to deriving from the workspace. Mirrors the
|
|
151
|
-
* derivation in the `lensmcp` CLI's `workspace-scope` (kept in lock-step). */
|
|
152
|
-
export declare function readLensScope(root: string): {
|
|
153
|
-
key: string;
|
|
154
|
-
dashboardPort: number;
|
|
155
|
-
basePath: string;
|
|
156
|
-
};
|
|
157
|
-
/** Round-robin over the pool's sockets, rescanning the dir when the cache ages out. */
|
|
158
|
-
export declare function pickSock(pool: SockPool, scanTtlMs?: number): string | undefined;
|
|
159
|
-
/**
|
|
160
|
-
* Read every project's `cluster` (or legacy `davnx`) declaration and build
|
|
161
|
-
* the route table: host routes first (plus auto `internal.<host>` for pod
|
|
162
|
-
* services), the `default` catch-all last.
|
|
163
|
-
*/
|
|
164
|
-
export declare function discoverRoutes(rootDir: string, projects: Record<string, {
|
|
165
|
-
root: string;
|
|
166
|
-
}>, sockBaseDir?: string): {
|
|
167
|
-
routes: Route[];
|
|
168
|
-
services: ServiceCtl[];
|
|
169
|
-
};
|
|
170
|
-
export declare function startGateway(options: GatewayRuntimeOptions, context: GatewayContext): Promise<GatewayHandle>;
|
|
14
|
+
export { startGateway } from './runtime/server';
|
|
15
|
+
export { verifyDevJwt, stampIdentity } from './runtime/dev-auth';
|
|
16
|
+
export { baseDomainOf, readLensScope } from './runtime/scope';
|
|
17
|
+
export { pickSock, discoverRoutes } from './runtime/discovery';
|
|
18
|
+
export type { GatewayContext, ClusterProjectDecl, SockPool, Route, LensFrontend, ServiceCtl, GatewayRuntimeOptions, GatewayHandle, GatewayHooks, GatewayPhase, HookHandler, HookContext, } from './runtime/types';
|
|
171
19
|
//# sourceMappingURL=gateway.lib.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.lib.d.ts","sourceRoot":"","sources":["../../../../../libs/cluster/src/executors/gateway/gateway.lib.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"gateway.lib.d.ts","sourceRoot":"","sources":["../../../../../libs/cluster/src/executors/gateway/gateway.lib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE/D,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,UAAU,EACV,qBAAqB,EACrB,aAAa,EAEb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,iBAAiB,CAAC"}
|