@authup/server-auth-console 1.0.0-beta.64

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC7B,OAAO,GAAE,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC,CAAM,GAC9E,WAAW,CAMd"}
package/dist/bin.d.mts ADDED
@@ -0,0 +1 @@
1
+ export {}
package/dist/bin.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
package/dist/bin.mjs ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ import { t as createServer, v as readConfigFromEnv } from "./server-Brhsp_x-.mjs";
3
+ import { serve } from "routup/node";
4
+ //#region src/bin.ts
5
+ /**
6
+ * The standalone entry. It reads the keys this service declares from the
7
+ * environment; `authup.yml` reaches the service through the CLI roles
8
+ * (`authup start console auth`), which hand each factory its own section, and that
9
+ * is also how it is started in practice.
10
+ */
11
+ const config = readConfigFromEnv();
12
+ const app = await createServer(config);
13
+ await serve(app, {
14
+ port: config.port,
15
+ hostname: config.host,
16
+ silent: true
17
+ }).ready();
18
+ //#endregion
19
+ export {};
20
+
21
+ //# sourceMappingURL=bin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.mjs","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { serve } from 'routup/node';\nimport { readConfigFromEnv } from './config';\nimport { createServer } from './server';\n\n/**\n * The standalone entry. It reads the keys this service declares from the\n * environment; `authup.yml` reaches the service through the CLI roles\n * (`authup start console auth`), which hand each factory its own section, and that\n * is also how it is started in practice.\n */\nconst config = readConfigFromEnv();\nconst app = await createServer(config);\n\nconst server = serve(app, {\n port: config.port,\n hostname: config.host,\n silent: true,\n});\n\nawait server.ready();\n"],"mappings":";;;;;;;;;;AAkBA,MAAM,SAAS,kBAAkB;AACjC,MAAM,MAAM,MAAM,aAAa,MAAM;AAQrC,MANe,MAAM,KAAK;CACtB,MAAM,OAAO;CACb,UAAU,OAAO;CACjB,QAAQ;AACZ,CAEW,CAAC,CAAC,MAAM"}
@@ -0,0 +1,37 @@
1
+ import type { CoreConfig } from '@authup/server-config';
2
+ import type { Config, ConfigInput } from './types';
3
+ /**
4
+ * The keys this service reads, SELECTED out of the document schema by name.
5
+ *
6
+ * Nothing is declared here: every key of `authup.yml` is declared once in
7
+ * `@authup/server-config`, so this service cannot spell a path, an
8
+ * environment variable, a default or a reader differently from server-core,
9
+ * which reads several of the same keys. Neither package depends on the other;
10
+ * both depend on the declaration.
11
+ *
12
+ * Its own section is spread, so this service reads it in its own vocabulary
13
+ * (`url`, `port`, `host`); every other section stays under the key the
14
+ * document nests it at.
15
+ */
16
+ export declare const CONFIG_SCHEMA: import("@authup/server-config-kit").Schema<import("@authup/server-config").ToObjectLiteral<import("@authup/server-config").RootConfig & {
17
+ theme: import("@authup/server-config").ThemeConfig;
18
+ core: Pick<CoreConfig, "host" | "port">;
19
+ } & import("@authup/server-config").AuthConsoleConfig>, "publicUrl" | "internalUrl" | "db", string>;
20
+ /**
21
+ * Turn the configuration namespace into the service's own shape: fill the
22
+ * defaults, derive the one key that is derived rather than configured, and
23
+ * rename. An empty `url` means the console sits on server-core's own origin
24
+ * under the default segment, which is the single-origin deployment.
25
+ *
26
+ * The defaults are layered SECTION-AWARE ({@link mergeSchemaData}): a spread
27
+ * would let an input carrying one key of a section replace the whole section
28
+ * and take every other key's default with it.
29
+ */
30
+ export declare function resolveConfig(input: Partial<ConfigInput>): Config;
31
+ /**
32
+ * The standalone entry's configuration, read from the environment alone.
33
+ * `authup.yml` reaches this service through the CLI roles, which compose this
34
+ * very registry into the one document loader.
35
+ */
36
+ export declare function readConfigFromEnv(): Config;
37
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,UAAU,EAAuB,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa;;;mGAcxB,CAAC;AAEH;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CACzB,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,GAC3B,MAAM,CAuBT;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAK,MAAM,CAO3C"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The vite base the auth console bundle is built with. Asset hrefs in the
3
+ * shell are emitted against it, so the service mounts its assets there and
4
+ * rebases them only when the deployment carries a sub-path.
5
+ */
6
+ export declare const VITE_BASE = "/console/auth/";
7
+ /**
8
+ * The path the service is served under by default, i.e. the path component
9
+ * of `authConsole.url`. It is the same segment server-core mounted
10
+ * the assets at before the split, so a built bundle needs no rebuild.
11
+ */
12
+ export declare const BASE_PATH = "/console/auth";
13
+ /**
14
+ * The pages the service renders. Each is a route of the console bundle's
15
+ * own router, and each is what a server-core page GET now redirects to.
16
+ */
17
+ export declare const PAGES: readonly ["/authorize", "/register", "/activate", "/password-forgot", "/password-reset", "/logout"];
18
+ /**
19
+ * Where this service mounts the bundle's `assets/` directory. The public
20
+ * asset URL is the service's own public path plus this route, which is what
21
+ * the bundle's fixed vite base is rebased onto.
22
+ */
23
+ export declare const ASSETS_PATH = "/assets";
24
+ export declare const HEALTH_PATH = "/healthy";
25
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,eAAO,MAAM,SAAS,mBAAmB,CAAC;AAE1C;;;;GAIG;AACH,eAAO,MAAM,SAAS,kBAAkB,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,KAAK,qGAOR,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,WAAW,YAAY,CAAC;AAErC,eAAO,MAAM,WAAW,aAAa,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { IThemeProvider } from '@authup/server-console-kit';
2
+ import type { IApp } from 'routup';
3
+ import type { Config, RenderPage } from './types';
4
+ /**
5
+ * The service as a mountable routup handler, so the CLI can compose it onto
6
+ * server-core's own listener for the single-container deployment while a
7
+ * split deployment runs it behind its own server.
8
+ *
9
+ * The paths are prefix-free. authup assumes a prefix-stripping reverse
10
+ * proxy, so a service published at `<origin>/console/auth` receives
11
+ * `/authorize`, exactly as server-core received it before the split.
12
+ */
13
+ export declare function createHandler(config: Config, themeProvider?: IThemeProvider, render?: RenderPage): Promise<IApp>;
14
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AASjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAWnC,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAiBlD;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAC/B,MAAM,EAAE,MAAM,EACd,aAAa,CAAC,EAAE,cAAc,EAC9B,MAAM,GAAE,UAAuB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAuFhB"}
@@ -0,0 +1,273 @@
1
+ import { CreateApplicationContext, IThemeProvider } from "@authup/server-console-kit";
2
+ import { AuthConsoleConfig, CoreConfig, RootConfig, SECTION_KEY, ThemeConfig, ToObjectLiteral } from "@authup/server-config";
3
+ import { App, IApp, IAppEvent } from "routup";
4
+ import { AuthorizeInfo, Client, StatusResponseFeatures } from "@authup/core-http-kit";
5
+ import { Application } from "orkos";
6
+ //#region src/types.d.ts
7
+ /**
8
+ * The `authup.yml` NAMESPACE: the sections this service selects keys from.
9
+ *
10
+ * Its OWN section is spread flat, because those keys are already this
11
+ * service's vocabulary; every other section keeps the key the document nests
12
+ * it at. What the two vocabularies do not share stays out: `apiUrl` and
13
+ * `distPath` below are this service's names for values the document calls
14
+ * something else, so they belong to {@link Config} alone.
15
+ */
16
+ type ConfigInput = ToObjectLiteral<RootConfig & {
17
+ [SECTION_KEY.THEME]: ThemeConfig;
18
+ [SECTION_KEY.CORE]: Pick<CoreConfig, 'host' | 'port'>;
19
+ } & AuthConsoleConfig>;
20
+ /**
21
+ * The service's own configuration. This console is the primary context here
22
+ * and server-core is the external thing it calls, hence `url` for its own
23
+ * address and `apiUrl` for the API's.
24
+ */
25
+ type Config = {
26
+ /**
27
+ * The public URL this service is reachable at, e.g.
28
+ * `https://example.com/console/auth`. Its path component becomes the
29
+ * console router's base and the prefix every inter-page href carries.
30
+ */
31
+ url: string;
32
+ /**
33
+ * The public URL of server-core, e.g. `https://example.com`. It is what
34
+ * the rendered page talks to, so it must be the address the VISITOR can
35
+ * reach, not an internal one: it becomes the hydration payload's
36
+ * `baseURL`, from which the console derives its HTTP client and its
37
+ * cookie path.
38
+ */
39
+ apiUrl: string;
40
+ /**
41
+ * Where THIS PROCESS reaches server-core: the document's `internalUrl`.
42
+ * This is the one console that renders server-side, so the two addresses
43
+ * are different questions, and a container port mapping is enough to make
44
+ * them different answers: published as `-p 3001:3000`, `apiUrl` names a
45
+ * port nothing listens on inside the container and every hosted page
46
+ * answers 502 (#3550). On a cluster network it is the service DNS name,
47
+ * so the render never leaves for the ingress and back.
48
+ *
49
+ * Defaults to {@link apiUrl}, which is right whenever the deployment
50
+ * answers at one address from both sides. The composed `authup start`
51
+ * overrides it with its own listen address unless the document named one,
52
+ * the same self-call rule server-core's internal client follows.
53
+ */
54
+ apiInternalUrl: string;
55
+ /**
56
+ * Where the standalone service listens. Unrelated to `url`: behind a
57
+ * reverse proxy the two always differ.
58
+ */
59
+ port: number;
60
+ host: string;
61
+ /**
62
+ * A substituted console package to render instead of the resolved
63
+ * `@authup/client-auth-console` (the `AUTH_CONSOLE_PATH` seam).
64
+ */
65
+ distPath: string;
66
+ theme: ThemeConfig;
67
+ };
68
+ /**
69
+ * How a page becomes a document. The default is this service's own
70
+ * `renderPage`, reading the built bundle; a caller serving the console from
71
+ * source substitutes one that reads through a vite dev server instead.
72
+ */
73
+ type RenderPage = (event: IAppEvent, config: Config, ctx: {
74
+ url: string;
75
+ data: Record<string, any>;
76
+ theme?: IThemeProvider;
77
+ }) => Promise<string>;
78
+ //#endregion
79
+ //#region src/application.d.ts
80
+ /**
81
+ * This console as a runnable service: its own module graph, its own
82
+ * container, its own lifecycle, and nothing of server-core's. It is what
83
+ * `authup start console` starts, what the `authup-auth-console` bin starts, and what
84
+ * `authup start` composes onto its own listener, so no caller reaches past
85
+ * the graph for a bare handler.
86
+ *
87
+ * `config` defaults to a FACTORY, not a value: resolving it reads the
88
+ * document, and a console started alongside others must not do that at
89
+ * construction time, before the caller has said where to look. Pass
90
+ * `listen: false` to be mounted on someone else's listener.
91
+ */
92
+ declare function createApplication(context?: Partial<Omit<CreateApplicationContext<Config>, 'createHandler'>>): Application;
93
+ //#endregion
94
+ //#region src/config.d.ts
95
+ /**
96
+ * The keys this service reads, SELECTED out of the document schema by name.
97
+ *
98
+ * Nothing is declared here: every key of `authup.yml` is declared once in
99
+ * `@authup/server-config`, so this service cannot spell a path, an
100
+ * environment variable, a default or a reader differently from server-core,
101
+ * which reads several of the same keys. Neither package depends on the other;
102
+ * both depend on the declaration.
103
+ *
104
+ * Its own section is spread, so this service reads it in its own vocabulary
105
+ * (`url`, `port`, `host`); every other section stays under the key the
106
+ * document nests it at.
107
+ */
108
+ declare const CONFIG_SCHEMA: import("@authup/server-config-kit").Schema<import("@authup/server-config").ToObjectLiteral<import("@authup/server-config").RootConfig & {
109
+ theme: import("@authup/server-config").ThemeConfig;
110
+ core: Pick<CoreConfig, "host" | "port">;
111
+ } & import("@authup/server-config").AuthConsoleConfig>, "publicUrl" | "internalUrl" | "db", string>;
112
+ /**
113
+ * Turn the configuration namespace into the service's own shape: fill the
114
+ * defaults, derive the one key that is derived rather than configured, and
115
+ * rename. An empty `url` means the console sits on server-core's own origin
116
+ * under the default segment, which is the single-origin deployment.
117
+ *
118
+ * The defaults are layered SECTION-AWARE ({@link mergeSchemaData}): a spread
119
+ * would let an input carrying one key of a section replace the whole section
120
+ * and take every other key's default with it.
121
+ */
122
+ declare function resolveConfig(input: Partial<ConfigInput>): Config;
123
+ /**
124
+ * The standalone entry's configuration, read from the environment alone.
125
+ * `authup.yml` reaches this service through the CLI roles, which compose this
126
+ * very registry into the one document loader.
127
+ */
128
+ declare function readConfigFromEnv(): Config;
129
+ //#endregion
130
+ //#region src/constants.d.ts
131
+ /**
132
+ * The vite base the auth console bundle is built with. Asset hrefs in the
133
+ * shell are emitted against it, so the service mounts its assets there and
134
+ * rebases them only when the deployment carries a sub-path.
135
+ */
136
+ declare const VITE_BASE = "/console/auth/";
137
+ /**
138
+ * The path the service is served under by default, i.e. the path component
139
+ * of `authConsole.url`. It is the same segment server-core mounted
140
+ * the assets at before the split, so a built bundle needs no rebuild.
141
+ */
142
+ declare const BASE_PATH = "/console/auth";
143
+ /**
144
+ * The pages the service renders. Each is a route of the console bundle's
145
+ * own router, and each is what a server-core page GET now redirects to.
146
+ */
147
+ declare const PAGES: readonly ["/authorize", "/register", "/activate", "/password-forgot", "/password-reset", "/logout"];
148
+ /**
149
+ * Where this service mounts the bundle's `assets/` directory. The public
150
+ * asset URL is the service's own public path plus this route, which is what
151
+ * the bundle's fixed vite base is rebased onto.
152
+ */
153
+ declare const ASSETS_PATH = "/assets";
154
+ declare const HEALTH_PATH = "/healthy";
155
+ //#endregion
156
+ //#region src/handler.d.ts
157
+ /**
158
+ * The service as a mountable routup handler, so the CLI can compose it onto
159
+ * server-core's own listener for the single-container deployment while a
160
+ * split deployment runs it behind its own server.
161
+ *
162
+ * The paths are prefix-free. authup assumes a prefix-stripping reverse
163
+ * proxy, so a service published at `<origin>/console/auth` receives
164
+ * `/authorize`, exactly as server-core received it before the split.
165
+ */
166
+ declare function createHandler(config: Config, themeProvider?: IThemeProvider, render?: RenderPage): Promise<IApp>;
167
+ //#endregion
168
+ //#region src/payload.d.ts
169
+ /**
170
+ * The service hydrates ANONYMOUSLY. It holds no credential of its own and
171
+ * asks server-core only for what an unauthenticated visitor may see, which
172
+ * is the whole of what these pages render.
173
+ *
174
+ * It dispatches against `apiInternalUrl`, never the browser-facing `apiUrl`:
175
+ * this is a server-side call, so it must not depend on the public address
176
+ * resolving from inside the deployment. Unlike server-core's own internal
177
+ * client the swap is on `baseURL` rather than at the transport layer,
178
+ * because nothing derived from it reaches a caller -- there is no
179
+ * `redirect_uri` here to be compared byte for byte later.
180
+ */
181
+ declare function createAPIClient(config: Config): Client;
182
+ /**
183
+ * The feature flags every workflow page gates its form on. A page that
184
+ * cannot reach them must not silently claim a workflow is disabled, so the
185
+ * failure propagates rather than defaulting to false.
186
+ *
187
+ * Read ONCE and held for the reader's lifetime, the same shape render.ts
188
+ * keeps for the dist template, manifest and render entry: `GET /` reports
189
+ * the version and the boot-config feature flags, none of which changes
190
+ * without a restart, so a TTL would be a number with nothing behind it.
191
+ * Without it every workflow page render is an API call, and under the
192
+ * composed `authup start` those all arrive over loopback on one shared
193
+ * rate-limit key. Only a SUCCESS is held, so an API that was down at the
194
+ * first render is retried rather than remembered as broken.
195
+ *
196
+ * The cache is instance-scoped rather than module-scoped (098 C4): the
197
+ * answer depends on which API the client was built against, so two handlers
198
+ * in one process must not share one, and a module slot would additionally
199
+ * leak between test cases.
200
+ */
201
+ declare function createFeaturesReader(client: Client): () => Promise<StatusResponseFeatures>;
202
+ /**
203
+ * The `/authorize` render input, resolved by server-core (plan 101 D2-1).
204
+ * The browser's query is forwarded verbatim: the answer is derived from all
205
+ * of it, the `provider` hint and the closed `error` marker set included.
206
+ */
207
+ declare function readAuthorizeInfo(client: Client, event: IAppEvent): Promise<AuthorizeInfo>;
208
+ type WorkflowPageOptions = {
209
+ realmAware?: boolean;
210
+ tokenAware?: boolean;
211
+ };
212
+ /**
213
+ * The payload the four workflow pages render from: the feature flags plus
214
+ * the handful of query params each one declares. Unchanged from the
215
+ * assembly server-core did before the split, including the open-redirect
216
+ * guard on `redirect`.
217
+ */
218
+ declare function buildWorkflowPageData(event: IAppEvent, features: StatusResponseFeatures, options?: WorkflowPageOptions): Record<string, any>;
219
+ //#endregion
220
+ //#region src/redirect.d.ts
221
+ /**
222
+ * Open-redirect guard for the `redirect` query parameter carried by the
223
+ * auth workflow pages: only same-origin relative paths pass through, so the
224
+ * value can be safely reflected into an anchor href / forwarded as a
225
+ * post-login destination.
226
+ *
227
+ * Rejects: non-strings, control/whitespace chars (browsers strip some,
228
+ * shifting where the URL authority begins), protocol-relative (`//host`),
229
+ * backslash variants (browsers normalise `\` → `/`), and any scheme
230
+ * (`javascript:`, `http:`) — both on the raw and once-decoded form so a
231
+ * percent-encoded separator (`%2f`, `%5c`) can't slip past.
232
+ */
233
+ declare function sanitizeRelativeRedirect(input: unknown): string | undefined;
234
+ //#endregion
235
+ //#region src/render.d.ts
236
+ declare const renderPage: RenderPage;
237
+ //#endregion
238
+ //#region src/resolve.d.ts
239
+ /**
240
+ * Point the resolution at a substituted package (config `distPath`)
241
+ * instead of the node_modules walk. Called once at boot.
242
+ */
243
+ declare function setPackagePath(value: string | undefined): void;
244
+ /**
245
+ * Locate the auth console package. The SSR auth workflow UI ships as
246
+ * `@authup/client-auth-console` (a dependency of THIS service), so the
247
+ * node_modules ancestor walk from this package's own root (locter's
248
+ * `locateUp`) finds it for the workspace (symlink onto
249
+ * apps/client-auth-console) and for a published install alike. Only a
250
+ * positive result is cached.
251
+ *
252
+ * The `cwd` anchor is behavioural, not incidental: it decides which
253
+ * node_modules tree is walked, so it stays pinned to this package rather
254
+ * than to the process cwd.
255
+ */
256
+ declare function resolvePackagePath(): string | undefined;
257
+ /**
258
+ * Locate the BUILT auth console bundle (`dist/client` template + assets,
259
+ * `dist/server/server.js` render entry). Only a positive result is cached,
260
+ * so a dev building the package after boot is picked up on the next
261
+ * request.
262
+ */
263
+ declare function resolveDistPath(): string | undefined;
264
+ //#endregion
265
+ //#region src/server.d.ts
266
+ /**
267
+ * The standalone service: the same handler the CLI mounts in process,
268
+ * behind a listener of its own.
269
+ */
270
+ declare function createServer(config: Config): Promise<App>;
271
+ //#endregion
272
+ export { ASSETS_PATH, BASE_PATH, CONFIG_SCHEMA, Config, ConfigInput, HEALTH_PATH, PAGES, RenderPage, VITE_BASE, WorkflowPageOptions, buildWorkflowPageData, createAPIClient, createApplication, createFeaturesReader, createHandler, createServer, readAuthorizeInfo, readConfigFromEnv, renderPage, resolveConfig, resolveDistPath, resolvePackagePath, sanitizeRelativeRedirect, setPackagePath };
273
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/application.ts","../src/config.ts","../src/constants.ts","../src/handler.ts","../src/payload.ts","../src/redirect.ts","../src/render.ts","../src/resolve.ts","../src/server.ts"],"mappings":";;;;;;;;;;;;;;;KA2BY,cAAc,gBACtB;GAEK,YAAY,QAAQ;GAEpB,YAAY,OAAO,KAAK;IAE7B;;;;;;KAQQ;;;;;;EAMR;;;;;;;;EAQA;;;;;;;;;;;;;;;EAeA;;;;;EAKA;EACA;;;;;EAKA;EAEA,OAAO;;;;;;;KAQC,cACR,OAAO,WACP,QAAQ,QACR;EACI;EACA,MAAM;EACN,QAAQ;MAEX;;;;;;;;;;;;;;;iBC1EW,kBACZ,UAAS,QAAQ,KAAK,yBAAyB,6BAC/C;;;;;;;;;;;;;;;;cCSS,mDAAa,uCAAA,gDAAA;;QAAb,KAAA;oCAcX;;;;;;;;;;;iBAYc,cACZ,OAAO,QAAQ,eACf;;;;;;iBA8BY,qBAAsB;;;;;;;;cCnFzB;;;;;;cAOA;;;;;cAMA;;;;;;cAcA;cAEA;;;;;;;;;;;;iBCYS,cAClB,QAAQ,QACR,gBAAgB,gBAChB,SAAQ,aACR,QAAQ;;;;;;;;;;;;;;;iBC/BI,gBAAgB,QAAQ,SAAU;;;;;;;;;;;;;;;;;;;;iBAiDlC,qBAAqB,QAAQ,eAAgB,QAAQ;;;;;;iBAmC/C,kBAAkB,QAAQ,QAAQ,OAAO,YAAa,QAAQ;KAUxE;EAIR;EACA;;;;;;;;iBASY,sBACZ,OAAO,WACP,UAAU,wBACV,UAAS,sBACT;;;;;;;;;;;;;;;iBCvHY,yBAAyB;;;cCa5B,YAAa;;;;;;;iBCZV,eAAe;;;;;;;;;;;;;iBAkBf;;;;;;;iBA4BA;;;;;;;iBCnDM,aAAa,QAAQ,SAAU,QAAQ"}
@@ -0,0 +1,11 @@
1
+ export * from './application';
2
+ export * from './config';
3
+ export * from './constants';
4
+ export * from './handler';
5
+ export * from './payload';
6
+ export * from './redirect';
7
+ export * from './render';
8
+ export * from './resolve';
9
+ export * from './server';
10
+ export * from './types';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
package/dist/index.mjs ADDED
@@ -0,0 +1,26 @@
1
+ import { _ as CONFIG_SCHEMA, a as resolvePackagePath, c as createAPIClient, d as sanitizeRelativeRedirect, f as ASSETS_PATH, g as VITE_BASE, h as PAGES, i as resolveDistPath, l as createFeaturesReader, m as HEALTH_PATH, n as createHandler, o as setPackagePath, p as BASE_PATH, r as renderPage, s as buildWorkflowPageData, t as createServer, u as readAuthorizeInfo, v as readConfigFromEnv, y as resolveConfig } from "./server-Brhsp_x-.mjs";
2
+ import { createApplication as createApplication$1 } from "@authup/server-console-kit";
3
+ //#region src/application.ts
4
+ /**
5
+ * This console as a runnable service: its own module graph, its own
6
+ * container, its own lifecycle, and nothing of server-core's. It is what
7
+ * `authup start console` starts, what the `authup-auth-console` bin starts, and what
8
+ * `authup start` composes onto its own listener, so no caller reaches past
9
+ * the graph for a bare handler.
10
+ *
11
+ * `config` defaults to a FACTORY, not a value: resolving it reads the
12
+ * document, and a console started alongside others must not do that at
13
+ * construction time, before the caller has said where to look. Pass
14
+ * `listen: false` to be mounted on someone else's listener.
15
+ */
16
+ function createApplication(context = {}) {
17
+ return createApplication$1({
18
+ listen: context.listen,
19
+ config: context.config ?? readConfigFromEnv,
20
+ createHandler: (resolved, theme) => createHandler(resolved, theme)
21
+ });
22
+ }
23
+ //#endregion
24
+ export { ASSETS_PATH, BASE_PATH, CONFIG_SCHEMA, HEALTH_PATH, PAGES, VITE_BASE, buildWorkflowPageData, createAPIClient, createApplication, createFeaturesReader, createHandler, createServer, readAuthorizeInfo, readConfigFromEnv, renderPage, resolveConfig, resolveDistPath, resolvePackagePath, sanitizeRelativeRedirect, setPackagePath };
25
+
26
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["createConsoleApplication"],"sources":["../src/application.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { createApplication as createConsoleApplication } from '@authup/server-console-kit';\nimport type { CreateApplicationContext } from '@authup/server-console-kit';\nimport type { Application } from 'orkos';\nimport { readConfigFromEnv } from './config';\nimport { createHandler } from './handler';\nimport type { Config } from './types';\n\n/**\n * This console as a runnable service: its own module graph, its own\n * container, its own lifecycle, and nothing of server-core's. It is what\n * `authup start console` starts, what the `authup-auth-console` bin starts, and what\n * `authup start` composes onto its own listener, so no caller reaches past\n * the graph for a bare handler.\n *\n * `config` defaults to a FACTORY, not a value: resolving it reads the\n * document, and a console started alongside others must not do that at\n * construction time, before the caller has said where to look. Pass\n * `listen: false` to be mounted on someone else's listener.\n */\nexport function createApplication(\n context: Partial<Omit<CreateApplicationContext<Config>, 'createHandler'>> = {},\n) : Application {\n return createConsoleApplication<Config>({\n listen: context.listen,\n config: context.config ?? readConfigFromEnv,\n createHandler: (resolved, theme) => createHandler(resolved, theme),\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,SAAgB,kBACZ,UAA4E,CAAC,GACjE;CACZ,OAAOA,oBAAiC;EACpC,QAAQ,QAAQ;EAChB,QAAQ,QAAQ,UAAU;EAC1B,gBAAgB,UAAU,UAAU,cAAc,UAAU,KAAK;CACrE,CAAC;AACL"}
package/dist/path.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare const CODE_PATH: string;
2
+ export declare const PACKAGE_PATH: string;
3
+ //# sourceMappingURL=path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,SAAS,QAA+C,CAAC;AACtE,eAAO,MAAM,YAAY,QAA6B,CAAC"}
@@ -0,0 +1,55 @@
1
+ import type { AuthorizeInfo, StatusResponseFeatures } from '@authup/core-http-kit';
2
+ import { Client } from '@authup/core-http-kit';
3
+ import type { IAppEvent } from 'routup';
4
+ import type { Config } from './types';
5
+ /**
6
+ * The service hydrates ANONYMOUSLY. It holds no credential of its own and
7
+ * asks server-core only for what an unauthenticated visitor may see, which
8
+ * is the whole of what these pages render.
9
+ *
10
+ * It dispatches against `apiInternalUrl`, never the browser-facing `apiUrl`:
11
+ * this is a server-side call, so it must not depend on the public address
12
+ * resolving from inside the deployment. Unlike server-core's own internal
13
+ * client the swap is on `baseURL` rather than at the transport layer,
14
+ * because nothing derived from it reaches a caller -- there is no
15
+ * `redirect_uri` here to be compared byte for byte later.
16
+ */
17
+ export declare function createAPIClient(config: Config): Client;
18
+ /**
19
+ * The feature flags every workflow page gates its form on. A page that
20
+ * cannot reach them must not silently claim a workflow is disabled, so the
21
+ * failure propagates rather than defaulting to false.
22
+ *
23
+ * Read ONCE and held for the reader's lifetime, the same shape render.ts
24
+ * keeps for the dist template, manifest and render entry: `GET /` reports
25
+ * the version and the boot-config feature flags, none of which changes
26
+ * without a restart, so a TTL would be a number with nothing behind it.
27
+ * Without it every workflow page render is an API call, and under the
28
+ * composed `authup start` those all arrive over loopback on one shared
29
+ * rate-limit key. Only a SUCCESS is held, so an API that was down at the
30
+ * first render is retried rather than remembered as broken.
31
+ *
32
+ * The cache is instance-scoped rather than module-scoped (098 C4): the
33
+ * answer depends on which API the client was built against, so two handlers
34
+ * in one process must not share one, and a module slot would additionally
35
+ * leak between test cases.
36
+ */
37
+ export declare function createFeaturesReader(client: Client): () => Promise<StatusResponseFeatures>;
38
+ /**
39
+ * The `/authorize` render input, resolved by server-core (plan 101 D2-1).
40
+ * The browser's query is forwarded verbatim: the answer is derived from all
41
+ * of it, the `provider` hint and the closed `error` marker set included.
42
+ */
43
+ export declare function readAuthorizeInfo(client: Client, event: IAppEvent): Promise<AuthorizeInfo>;
44
+ export type WorkflowPageOptions = {
45
+ realmAware?: boolean;
46
+ tokenAware?: boolean;
47
+ };
48
+ /**
49
+ * The payload the four workflow pages render from: the feature flags plus
50
+ * the handful of query params each one declares. Unchanged from the
51
+ * assembly server-core did before the split, including the open-redirect
52
+ * guard on `redirect`.
53
+ */
54
+ export declare function buildWorkflowPageData(event: IAppEvent, features: StatusResponseFeatures, options?: WorkflowPageOptions): Record<string, any>;
55
+ //# sourceMappingURL=payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../src/payload.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAkB,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACnG,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAI,MAAM,CAEvD;AA4BD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAI,MAAM,OAAO,CAAC,sBAAsB,CAAC,CA4B3F;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAI,OAAO,CAAC,aAAa,CAAC,CAQjG;AAED,MAAM,MAAM,mBAAmB,GAAG;IAI9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,sBAAsB,EAChC,OAAO,GAAE,mBAAwB,GACjC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAkBtB"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Open-redirect guard for the `redirect` query parameter carried by the
3
+ * auth workflow pages: only same-origin relative paths pass through, so the
4
+ * value can be safely reflected into an anchor href / forwarded as a
5
+ * post-login destination.
6
+ *
7
+ * Rejects: non-strings, control/whitespace chars (browsers strip some,
8
+ * shifting where the URL authority begins), protocol-relative (`//host`),
9
+ * backslash variants (browsers normalise `\` → `/`), and any scheme
10
+ * (`javascript:`, `http:`) — both on the raw and once-decoded form so a
11
+ * percent-encoded separator (`%2f`, `%5c`) can't slip past.
12
+ */
13
+ export declare function sanitizeRelativeRedirect(input: unknown): string | undefined;
14
+ //# sourceMappingURL=redirect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../src/redirect.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAwC3E"}
@@ -0,0 +1,3 @@
1
+ import type { RenderPage } from './types';
2
+ export declare const renderPage: RenderPage;
3
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAS1C,eAAO,MAAM,UAAU,EAAG,UAkEzB,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Point the resolution at a substituted package (config `distPath`)
3
+ * instead of the node_modules walk. Called once at boot.
4
+ */
5
+ export declare function setPackagePath(value: string | undefined): void;
6
+ /**
7
+ * Locate the auth console package. The SSR auth workflow UI ships as
8
+ * `@authup/client-auth-console` (a dependency of THIS service), so the
9
+ * node_modules ancestor walk from this package's own root (locter's
10
+ * `locateUp`) finds it for the workspace (symlink onto
11
+ * apps/client-auth-console) and for a published install alike. Only a
12
+ * positive result is cached.
13
+ *
14
+ * The `cwd` anchor is behavioural, not incidental: it decides which
15
+ * node_modules tree is walked, so it stays pinned to this package rather
16
+ * than to the process cwd.
17
+ */
18
+ export declare function resolvePackagePath(): string | undefined;
19
+ /**
20
+ * Locate the BUILT auth console bundle (`dist/client` template + assets,
21
+ * `dist/server/server.js` render entry). Only a positive result is cached,
22
+ * so a dev building the package after boot is picked up on the next
23
+ * request.
24
+ */
25
+ export declare function resolveDistPath(): string | undefined;
26
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAI,IAAI,CAI/D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,IAAK,MAAM,GAAG,SAAS,CAoBxD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAK,MAAM,GAAG,SAAS,CAerD"}