@dudousxd/nestjs-durable-dashboard 0.37.1 → 0.39.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/dist/client/console-session.d.ts +63 -0
- package/dist/client/console-session.d.ts.map +1 -0
- package/dist/client/console-session.js +107 -0
- package/dist/client/console-session.js.map +1 -0
- package/dist/client/durable-client.d.ts +1 -0
- package/dist/client/durable-client.d.ts.map +1 -1
- package/dist/client/durable-client.js +8 -0
- package/dist/client/durable-client.js.map +1 -1
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +14 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/open-console-button.d.ts +26 -0
- package/dist/react/open-console-button.d.ts.map +1 -0
- package/dist/react/open-console-button.js +26 -0
- package/dist/react/open-console-button.js.map +1 -0
- package/dist/react/use-open-console.d.ts +34 -0
- package/dist/react/use-open-console.d.ts.map +1 -0
- package/dist/react/use-open-console.js +44 -0
- package/dist/react/use-open-console.js.map +1 -0
- package/dist/server/index.cjs +113 -58
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +40 -1
- package/dist/server/index.d.ts +40 -1
- package/dist/server/index.js +118 -63
- package/dist/server/index.js.map +1 -1
- package/package.json +21 -3
package/dist/server/index.d.cts
CHANGED
|
@@ -25,6 +25,41 @@ type LoginHook = (username: string, password: string) => Promise<DashboardSessio
|
|
|
25
25
|
* console XHR does not carry — this one receives the already-minted session.
|
|
26
26
|
*/
|
|
27
27
|
type RevalidateHook = (session: DashboardSessionUser) => Promise<boolean> | boolean;
|
|
28
|
+
/** What `unauthenticatedPage` receives. An object (not positional args) so fields can be added later. */
|
|
29
|
+
interface UnauthenticatedPageContext {
|
|
30
|
+
/**
|
|
31
|
+
* The platform-native request — Express' `Request`, Fastify's `FastifyRequest`. Typed `unknown`
|
|
32
|
+
* for the same reason `SessionHook`'s is: this package refuses to depend on either platform.
|
|
33
|
+
* Cast it to whatever your app actually runs on.
|
|
34
|
+
*/
|
|
35
|
+
request: unknown;
|
|
36
|
+
/**
|
|
37
|
+
* The platform-native response. The hook OWNS it: it must write AND end it (`res.render(...)`,
|
|
38
|
+
* `res.status(401).send(...)`, an Inertia render, ...). If the hook returns without writing, the
|
|
39
|
+
* library falls back to its own built-in page rather than leaving the request hanging.
|
|
40
|
+
*/
|
|
41
|
+
response: unknown;
|
|
42
|
+
/** Where this console is mounted (e.g. `/durable`) — useful for a "back to the console" link. */
|
|
43
|
+
basePath: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Host-owned page for an unauthenticated full-page navigation to the console.
|
|
47
|
+
*
|
|
48
|
+
* The built-in page cannot know who hosts the console, so it can only say "open this console from
|
|
49
|
+
* your application" in the abstract — it can't name the launcher, link to it, or look like the rest
|
|
50
|
+
* of the host's product. This hook hands the whole response to the host instead: render through
|
|
51
|
+
* your own template engine, your own Inertia page, whatever. The page is served AT the console's
|
|
52
|
+
* own URL, so `/durable` stays `/durable`.
|
|
53
|
+
*
|
|
54
|
+
* Deliberately NOT a replacement for Mode B's built-in login form. A host that wants its own login
|
|
55
|
+
* UI uses Mode A plus this hook, and posts to `<basePath>/session` from its own page — the mint
|
|
56
|
+
* endpoint is the supported primitive for that.
|
|
57
|
+
*
|
|
58
|
+
* Fail-closed by construction: it only ever runs on a request that has ALREADY been denied. A hook
|
|
59
|
+
* that throws, or that returns without writing, falls back to the built-in page — it cannot let
|
|
60
|
+
* anyone in.
|
|
61
|
+
*/
|
|
62
|
+
type UnauthenticatedPageHook = (context: UnauthenticatedPageContext) => void | Promise<void>;
|
|
28
63
|
type AuthMode = 'session' | 'login';
|
|
29
64
|
/**
|
|
30
65
|
* Author-facing `dashboardAuth` option on `DurableDashboardModule.forRoot`/`forRootAsync`. Gates
|
|
@@ -52,6 +87,9 @@ interface DashboardAuthOptions {
|
|
|
52
87
|
/** Re-checks a live session on sliding renewal; see `RevalidateHook`. Not a mode — it cannot
|
|
53
88
|
* mint a session, only revoke one already minted by `session`/`login`. */
|
|
54
89
|
revalidate?: RevalidateHook;
|
|
90
|
+
/** Renders the host's own page for an unauthenticated navigation, in place of the built-in
|
|
91
|
+
* "open this console from your application" card; see `UnauthenticatedPageHook`. */
|
|
92
|
+
unauthenticatedPage?: UnauthenticatedPageHook;
|
|
55
93
|
}
|
|
56
94
|
/** Resolved, validated `dashboardAuth` config shared by the guards, auth controller, and login page. */
|
|
57
95
|
interface ResolvedDashboardAuth {
|
|
@@ -61,6 +99,7 @@ interface ResolvedDashboardAuth {
|
|
|
61
99
|
session?: SessionHook;
|
|
62
100
|
login?: LoginHook;
|
|
63
101
|
revalidate?: RevalidateHook;
|
|
102
|
+
unauthenticatedPage?: UnauthenticatedPageHook;
|
|
64
103
|
}
|
|
65
104
|
|
|
66
105
|
/**
|
|
@@ -455,4 +494,4 @@ declare class DurableUiController {
|
|
|
455
494
|
asset(file: string): StreamableFile;
|
|
456
495
|
}
|
|
457
496
|
|
|
458
|
-
export { DASHBOARD_API_PATH, DASHBOARD_BASE_PATH, type DashboardAuthOptions, DashboardService, type DashboardSessionUser, DurableApiController, DurableApiModule, DurableApiSessionGuard, DurableAuthController, type DurableDashboardAsyncOptions, DurableDashboardModule, type DurableDashboardOptions, DurableUiController, DurableUiSessionGuard };
|
|
497
|
+
export { DASHBOARD_API_PATH, DASHBOARD_BASE_PATH, type DashboardAuthOptions, DashboardService, type DashboardSessionUser, DurableApiController, DurableApiModule, DurableApiSessionGuard, DurableAuthController, type DurableDashboardAsyncOptions, DurableDashboardModule, type DurableDashboardOptions, DurableUiController, DurableUiSessionGuard, type UnauthenticatedPageContext, type UnauthenticatedPageHook };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -25,6 +25,41 @@ type LoginHook = (username: string, password: string) => Promise<DashboardSessio
|
|
|
25
25
|
* console XHR does not carry — this one receives the already-minted session.
|
|
26
26
|
*/
|
|
27
27
|
type RevalidateHook = (session: DashboardSessionUser) => Promise<boolean> | boolean;
|
|
28
|
+
/** What `unauthenticatedPage` receives. An object (not positional args) so fields can be added later. */
|
|
29
|
+
interface UnauthenticatedPageContext {
|
|
30
|
+
/**
|
|
31
|
+
* The platform-native request — Express' `Request`, Fastify's `FastifyRequest`. Typed `unknown`
|
|
32
|
+
* for the same reason `SessionHook`'s is: this package refuses to depend on either platform.
|
|
33
|
+
* Cast it to whatever your app actually runs on.
|
|
34
|
+
*/
|
|
35
|
+
request: unknown;
|
|
36
|
+
/**
|
|
37
|
+
* The platform-native response. The hook OWNS it: it must write AND end it (`res.render(...)`,
|
|
38
|
+
* `res.status(401).send(...)`, an Inertia render, ...). If the hook returns without writing, the
|
|
39
|
+
* library falls back to its own built-in page rather than leaving the request hanging.
|
|
40
|
+
*/
|
|
41
|
+
response: unknown;
|
|
42
|
+
/** Where this console is mounted (e.g. `/durable`) — useful for a "back to the console" link. */
|
|
43
|
+
basePath: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Host-owned page for an unauthenticated full-page navigation to the console.
|
|
47
|
+
*
|
|
48
|
+
* The built-in page cannot know who hosts the console, so it can only say "open this console from
|
|
49
|
+
* your application" in the abstract — it can't name the launcher, link to it, or look like the rest
|
|
50
|
+
* of the host's product. This hook hands the whole response to the host instead: render through
|
|
51
|
+
* your own template engine, your own Inertia page, whatever. The page is served AT the console's
|
|
52
|
+
* own URL, so `/durable` stays `/durable`.
|
|
53
|
+
*
|
|
54
|
+
* Deliberately NOT a replacement for Mode B's built-in login form. A host that wants its own login
|
|
55
|
+
* UI uses Mode A plus this hook, and posts to `<basePath>/session` from its own page — the mint
|
|
56
|
+
* endpoint is the supported primitive for that.
|
|
57
|
+
*
|
|
58
|
+
* Fail-closed by construction: it only ever runs on a request that has ALREADY been denied. A hook
|
|
59
|
+
* that throws, or that returns without writing, falls back to the built-in page — it cannot let
|
|
60
|
+
* anyone in.
|
|
61
|
+
*/
|
|
62
|
+
type UnauthenticatedPageHook = (context: UnauthenticatedPageContext) => void | Promise<void>;
|
|
28
63
|
type AuthMode = 'session' | 'login';
|
|
29
64
|
/**
|
|
30
65
|
* Author-facing `dashboardAuth` option on `DurableDashboardModule.forRoot`/`forRootAsync`. Gates
|
|
@@ -52,6 +87,9 @@ interface DashboardAuthOptions {
|
|
|
52
87
|
/** Re-checks a live session on sliding renewal; see `RevalidateHook`. Not a mode — it cannot
|
|
53
88
|
* mint a session, only revoke one already minted by `session`/`login`. */
|
|
54
89
|
revalidate?: RevalidateHook;
|
|
90
|
+
/** Renders the host's own page for an unauthenticated navigation, in place of the built-in
|
|
91
|
+
* "open this console from your application" card; see `UnauthenticatedPageHook`. */
|
|
92
|
+
unauthenticatedPage?: UnauthenticatedPageHook;
|
|
55
93
|
}
|
|
56
94
|
/** Resolved, validated `dashboardAuth` config shared by the guards, auth controller, and login page. */
|
|
57
95
|
interface ResolvedDashboardAuth {
|
|
@@ -61,6 +99,7 @@ interface ResolvedDashboardAuth {
|
|
|
61
99
|
session?: SessionHook;
|
|
62
100
|
login?: LoginHook;
|
|
63
101
|
revalidate?: RevalidateHook;
|
|
102
|
+
unauthenticatedPage?: UnauthenticatedPageHook;
|
|
64
103
|
}
|
|
65
104
|
|
|
66
105
|
/**
|
|
@@ -455,4 +494,4 @@ declare class DurableUiController {
|
|
|
455
494
|
asset(file: string): StreamableFile;
|
|
456
495
|
}
|
|
457
496
|
|
|
458
|
-
export { DASHBOARD_API_PATH, DASHBOARD_BASE_PATH, type DashboardAuthOptions, DashboardService, type DashboardSessionUser, DurableApiController, DurableApiModule, DurableApiSessionGuard, DurableAuthController, type DurableDashboardAsyncOptions, DurableDashboardModule, type DurableDashboardOptions, DurableUiController, DurableUiSessionGuard };
|
|
497
|
+
export { DASHBOARD_API_PATH, DASHBOARD_BASE_PATH, type DashboardAuthOptions, DashboardService, type DashboardSessionUser, DurableApiController, DurableApiModule, DurableApiSessionGuard, DurableAuthController, type DurableDashboardAsyncOptions, DurableDashboardModule, type DurableDashboardOptions, DurableUiController, DurableUiSessionGuard, type UnauthenticatedPageContext, type UnauthenticatedPageHook };
|
package/dist/server/index.js
CHANGED
|
@@ -518,7 +518,7 @@ DurableApiController = _ts_decorate2([
|
|
|
518
518
|
], DurableApiController);
|
|
519
519
|
|
|
520
520
|
// src/server/durable-auth.controller.ts
|
|
521
|
-
import { BadRequestException, Body as Body2, Controller as Controller3, Get as Get3, Header as Header3, HttpCode, Inject as
|
|
521
|
+
import { BadRequestException, Body as Body2, Controller as Controller3, Get as Get3, Header as Header3, HttpCode, Inject as Inject4, Logger as Logger2, NotFoundException as NotFoundException3, Optional as Optional3, Post as Post2, Req, Res, UnauthorizedException } from "@nestjs/common";
|
|
522
522
|
|
|
523
523
|
// src/server/auth/dashboard-auth-config.ts
|
|
524
524
|
var DASHBOARD_AUTH = Symbol("DASHBOARD_AUTH");
|
|
@@ -559,6 +559,9 @@ function resolveDashboardAuth(options) {
|
|
|
559
559
|
if (options.revalidate !== void 0 && typeof options.revalidate !== "function") {
|
|
560
560
|
throw new Error("DurableDashboardModule: dashboardAuth.revalidate must be a function.");
|
|
561
561
|
}
|
|
562
|
+
if (options.unauthenticatedPage !== void 0 && typeof options.unauthenticatedPage !== "function") {
|
|
563
|
+
throw new Error("DurableDashboardModule: dashboardAuth.unauthenticatedPage must be a function.");
|
|
564
|
+
}
|
|
562
565
|
if (modes.length === 0) {
|
|
563
566
|
throw new Error("DurableDashboardModule: dashboardAuth needs at least one of `session` or `login` (otherwise the cookie can never be minted). Failing closed.");
|
|
564
567
|
}
|
|
@@ -574,6 +577,9 @@ function resolveDashboardAuth(options) {
|
|
|
574
577
|
} : {},
|
|
575
578
|
...options.revalidate !== void 0 ? {
|
|
576
579
|
revalidate: options.revalidate
|
|
580
|
+
} : {},
|
|
581
|
+
...options.unauthenticatedPage !== void 0 ? {
|
|
582
|
+
unauthenticatedPage: options.unauthenticatedPage
|
|
577
583
|
} : {}
|
|
578
584
|
};
|
|
579
585
|
}
|
|
@@ -850,6 +856,11 @@ function redirectRaw(response, location, status = 302) {
|
|
|
850
856
|
raw.end();
|
|
851
857
|
}
|
|
852
858
|
__name(redirectRaw, "redirectRaw");
|
|
859
|
+
function responseAlreadyWritten(response) {
|
|
860
|
+
const raw = resolveRedirectResponse(response);
|
|
861
|
+
return raw?.headersSent === true;
|
|
862
|
+
}
|
|
863
|
+
__name(responseAlreadyWritten, "responseAlreadyWritten");
|
|
853
864
|
function writeHtmlRaw(response, html, status = 200) {
|
|
854
865
|
const raw = resolveRedirectResponse(response);
|
|
855
866
|
if (!raw) return;
|
|
@@ -1059,7 +1070,7 @@ __name(maybeRenewSession, "maybeRenewSession");
|
|
|
1059
1070
|
import { existsSync, readFileSync } from "node:fs";
|
|
1060
1071
|
import { basename, extname, join, resolve, sep } from "node:path";
|
|
1061
1072
|
import { fileURLToPath } from "node:url";
|
|
1062
|
-
import { Controller as Controller2, Get as Get2, Header as Header2, Inject as
|
|
1073
|
+
import { Controller as Controller2, Get as Get2, Header as Header2, Inject as Inject3, NotFoundException as NotFoundException2, Param as Param2, StreamableFile, UseFilters } from "@nestjs/common";
|
|
1063
1074
|
|
|
1064
1075
|
// src/server/auth/login-redirect.exception.ts
|
|
1065
1076
|
import { Catch, HttpException, HttpStatus } from "@nestjs/common";
|
|
@@ -1095,7 +1106,7 @@ DashboardLoginRedirectFilter = _ts_decorate3([
|
|
|
1095
1106
|
], DashboardLoginRedirectFilter);
|
|
1096
1107
|
|
|
1097
1108
|
// src/server/auth/session-required.exception.ts
|
|
1098
|
-
import { Catch as Catch2, HttpException as HttpException2, HttpStatus as HttpStatus2 } from "@nestjs/common";
|
|
1109
|
+
import { Catch as Catch2, HttpException as HttpException2, HttpStatus as HttpStatus2, Inject as Inject2, Logger, Optional as Optional2 } from "@nestjs/common";
|
|
1099
1110
|
function _ts_decorate4(decorators, target, key, desc) {
|
|
1100
1111
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1101
1112
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1103,6 +1114,16 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
1103
1114
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1104
1115
|
}
|
|
1105
1116
|
__name(_ts_decorate4, "_ts_decorate");
|
|
1117
|
+
function _ts_metadata3(k, v) {
|
|
1118
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1119
|
+
}
|
|
1120
|
+
__name(_ts_metadata3, "_ts_metadata");
|
|
1121
|
+
function _ts_param3(paramIndex, decorator) {
|
|
1122
|
+
return function(target, key) {
|
|
1123
|
+
decorator(target, key, paramIndex);
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
__name(_ts_param3, "_ts_param");
|
|
1106
1127
|
var DashboardSessionRequiredException = class extends HttpException2 {
|
|
1107
1128
|
static {
|
|
1108
1129
|
__name(this, "DashboardSessionRequiredException");
|
|
@@ -1114,17 +1135,51 @@ var DashboardSessionRequiredException = class extends HttpException2 {
|
|
|
1114
1135
|
}, HttpStatus2.UNAUTHORIZED), this.basePath = basePath;
|
|
1115
1136
|
}
|
|
1116
1137
|
};
|
|
1117
|
-
var DashboardSessionRequiredFilter = class {
|
|
1138
|
+
var DashboardSessionRequiredFilter = class _DashboardSessionRequiredFilter {
|
|
1118
1139
|
static {
|
|
1119
1140
|
__name(this, "DashboardSessionRequiredFilter");
|
|
1120
1141
|
}
|
|
1121
|
-
|
|
1122
|
-
|
|
1142
|
+
auth;
|
|
1143
|
+
logger = new Logger(_DashboardSessionRequiredFilter.name);
|
|
1144
|
+
warned = false;
|
|
1145
|
+
constructor(auth = null) {
|
|
1146
|
+
this.auth = auth;
|
|
1147
|
+
}
|
|
1148
|
+
async catch(exception, host) {
|
|
1149
|
+
const http = host.switchToHttp();
|
|
1150
|
+
const response = http.getResponse();
|
|
1151
|
+
const hook = this.auth?.unauthenticatedPage;
|
|
1152
|
+
if (hook) {
|
|
1153
|
+
try {
|
|
1154
|
+
await hook({
|
|
1155
|
+
request: http.getRequest(),
|
|
1156
|
+
response,
|
|
1157
|
+
basePath: exception.basePath
|
|
1158
|
+
});
|
|
1159
|
+
if (responseAlreadyWritten(response)) return;
|
|
1160
|
+
this.warnOnce("dashboardAuth.unauthenticatedPage returned without writing a response; falling back to the built-in page. The hook must write AND end the response it is given.");
|
|
1161
|
+
} catch (error) {
|
|
1162
|
+
this.warnOnce(`dashboardAuth.unauthenticatedPage threw; falling back to the built-in page. ${String(error)}`);
|
|
1163
|
+
if (responseAlreadyWritten(response)) return;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1123
1166
|
writeHtmlRaw(response, renderSessionRequiredPage(exception.basePath), HttpStatus2.UNAUTHORIZED);
|
|
1124
1167
|
}
|
|
1168
|
+
/** Once per process, not once per request: a broken hook fires on every denied navigation. */
|
|
1169
|
+
warnOnce(message) {
|
|
1170
|
+
if (this.warned) return;
|
|
1171
|
+
this.warned = true;
|
|
1172
|
+
this.logger.warn(message);
|
|
1173
|
+
}
|
|
1125
1174
|
};
|
|
1126
1175
|
DashboardSessionRequiredFilter = _ts_decorate4([
|
|
1127
|
-
Catch2(DashboardSessionRequiredException)
|
|
1176
|
+
Catch2(DashboardSessionRequiredException),
|
|
1177
|
+
_ts_param3(0, Optional2()),
|
|
1178
|
+
_ts_param3(0, Inject2(DASHBOARD_AUTH)),
|
|
1179
|
+
_ts_metadata3("design:type", Function),
|
|
1180
|
+
_ts_metadata3("design:paramtypes", [
|
|
1181
|
+
Object
|
|
1182
|
+
])
|
|
1128
1183
|
], DashboardSessionRequiredFilter);
|
|
1129
1184
|
|
|
1130
1185
|
// src/server/durable-ui.controller.ts
|
|
@@ -1135,16 +1190,16 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
1135
1190
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1136
1191
|
}
|
|
1137
1192
|
__name(_ts_decorate5, "_ts_decorate");
|
|
1138
|
-
function
|
|
1193
|
+
function _ts_metadata4(k, v) {
|
|
1139
1194
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1140
1195
|
}
|
|
1141
|
-
__name(
|
|
1142
|
-
function
|
|
1196
|
+
__name(_ts_metadata4, "_ts_metadata");
|
|
1197
|
+
function _ts_param4(paramIndex, decorator) {
|
|
1143
1198
|
return function(target, key) {
|
|
1144
1199
|
decorator(target, key, paramIndex);
|
|
1145
1200
|
};
|
|
1146
1201
|
}
|
|
1147
|
-
__name(
|
|
1202
|
+
__name(_ts_param4, "_ts_param");
|
|
1148
1203
|
var DASHBOARD_BASE_PATH = Symbol("DASHBOARD_BASE_PATH");
|
|
1149
1204
|
var DASHBOARD_API_PATH = Symbol("DASHBOARD_API_PATH");
|
|
1150
1205
|
var BUILD_BASE = "/durable";
|
|
@@ -1201,27 +1256,27 @@ _ts_decorate5([
|
|
|
1201
1256
|
Get2(),
|
|
1202
1257
|
Header2("Content-Type", "text/html; charset=utf-8"),
|
|
1203
1258
|
Header2("Cache-Control", "no-store, must-revalidate"),
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1259
|
+
_ts_metadata4("design:type", Function),
|
|
1260
|
+
_ts_metadata4("design:paramtypes", []),
|
|
1261
|
+
_ts_metadata4("design:returntype", String)
|
|
1207
1262
|
], DurableUiController.prototype, "index", null);
|
|
1208
1263
|
_ts_decorate5([
|
|
1209
1264
|
Get2("assets/:file"),
|
|
1210
1265
|
Header2("Cache-Control", "public, max-age=31536000, immutable"),
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1266
|
+
_ts_param4(0, Param2("file")),
|
|
1267
|
+
_ts_metadata4("design:type", Function),
|
|
1268
|
+
_ts_metadata4("design:paramtypes", [
|
|
1214
1269
|
String
|
|
1215
1270
|
]),
|
|
1216
|
-
|
|
1271
|
+
_ts_metadata4("design:returntype", typeof StreamableFile === "undefined" ? Object : StreamableFile)
|
|
1217
1272
|
], DurableUiController.prototype, "asset", null);
|
|
1218
1273
|
DurableUiController = _ts_decorate5([
|
|
1219
1274
|
UseFilters(DashboardLoginRedirectFilter, DashboardSessionRequiredFilter),
|
|
1220
1275
|
Controller2(),
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1276
|
+
_ts_param4(0, Inject3(DASHBOARD_BASE_PATH)),
|
|
1277
|
+
_ts_param4(1, Inject3(DASHBOARD_API_PATH)),
|
|
1278
|
+
_ts_metadata4("design:type", Function),
|
|
1279
|
+
_ts_metadata4("design:paramtypes", [
|
|
1225
1280
|
String,
|
|
1226
1281
|
String
|
|
1227
1282
|
])
|
|
@@ -1235,16 +1290,16 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
1235
1290
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1236
1291
|
}
|
|
1237
1292
|
__name(_ts_decorate6, "_ts_decorate");
|
|
1238
|
-
function
|
|
1293
|
+
function _ts_metadata5(k, v) {
|
|
1239
1294
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1240
1295
|
}
|
|
1241
|
-
__name(
|
|
1242
|
-
function
|
|
1296
|
+
__name(_ts_metadata5, "_ts_metadata");
|
|
1297
|
+
function _ts_param5(paramIndex, decorator) {
|
|
1243
1298
|
return function(target, key) {
|
|
1244
1299
|
decorator(target, key, paramIndex);
|
|
1245
1300
|
};
|
|
1246
1301
|
}
|
|
1247
|
-
__name(
|
|
1302
|
+
__name(_ts_param5, "_ts_param");
|
|
1248
1303
|
function isString(value) {
|
|
1249
1304
|
return typeof value === "string";
|
|
1250
1305
|
}
|
|
@@ -1255,7 +1310,7 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
1255
1310
|
}
|
|
1256
1311
|
auth;
|
|
1257
1312
|
basePath;
|
|
1258
|
-
logger = new
|
|
1313
|
+
logger = new Logger2(_DurableAuthController.name);
|
|
1259
1314
|
/** Warn once per hook kind so a throwing hook doesn't spam logs on every failed attempt. */
|
|
1260
1315
|
warnedHooks = /* @__PURE__ */ new Set();
|
|
1261
1316
|
constructor(auth, basePath) {
|
|
@@ -1344,58 +1399,58 @@ _ts_decorate6([
|
|
|
1344
1399
|
Get3("login"),
|
|
1345
1400
|
Header3("Content-Type", "text/html; charset=utf-8"),
|
|
1346
1401
|
Header3("Cache-Control", "no-store, must-revalidate"),
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1402
|
+
_ts_metadata5("design:type", Function),
|
|
1403
|
+
_ts_metadata5("design:paramtypes", []),
|
|
1404
|
+
_ts_metadata5("design:returntype", String)
|
|
1350
1405
|
], DurableAuthController.prototype, "loginPage", null);
|
|
1351
1406
|
_ts_decorate6([
|
|
1352
1407
|
Post2("login"),
|
|
1353
1408
|
HttpCode(200),
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1409
|
+
_ts_param5(0, Body2()),
|
|
1410
|
+
_ts_param5(1, Req()),
|
|
1411
|
+
_ts_param5(2, Res({
|
|
1357
1412
|
passthrough: true
|
|
1358
1413
|
})),
|
|
1359
|
-
|
|
1360
|
-
|
|
1414
|
+
_ts_metadata5("design:type", Function),
|
|
1415
|
+
_ts_metadata5("design:paramtypes", [
|
|
1361
1416
|
typeof LoginBody === "undefined" ? Object : LoginBody,
|
|
1362
1417
|
Object,
|
|
1363
1418
|
Object
|
|
1364
1419
|
]),
|
|
1365
|
-
|
|
1420
|
+
_ts_metadata5("design:returntype", Promise)
|
|
1366
1421
|
], DurableAuthController.prototype, "login", null);
|
|
1367
1422
|
_ts_decorate6([
|
|
1368
1423
|
Post2("session"),
|
|
1369
1424
|
HttpCode(204),
|
|
1370
|
-
|
|
1371
|
-
|
|
1425
|
+
_ts_param5(0, Req()),
|
|
1426
|
+
_ts_param5(1, Res({
|
|
1372
1427
|
passthrough: true
|
|
1373
1428
|
})),
|
|
1374
|
-
|
|
1375
|
-
|
|
1429
|
+
_ts_metadata5("design:type", Function),
|
|
1430
|
+
_ts_metadata5("design:paramtypes", [
|
|
1376
1431
|
Object,
|
|
1377
1432
|
Object
|
|
1378
1433
|
]),
|
|
1379
|
-
|
|
1434
|
+
_ts_metadata5("design:returntype", Promise)
|
|
1380
1435
|
], DurableAuthController.prototype, "session", null);
|
|
1381
1436
|
_ts_decorate6([
|
|
1382
1437
|
Get3("logout"),
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1438
|
+
_ts_param5(0, Req()),
|
|
1439
|
+
_ts_param5(1, Res()),
|
|
1440
|
+
_ts_metadata5("design:type", Function),
|
|
1441
|
+
_ts_metadata5("design:paramtypes", [
|
|
1387
1442
|
Object,
|
|
1388
1443
|
Object
|
|
1389
1444
|
]),
|
|
1390
|
-
|
|
1445
|
+
_ts_metadata5("design:returntype", void 0)
|
|
1391
1446
|
], DurableAuthController.prototype, "logout", null);
|
|
1392
1447
|
DurableAuthController = _ts_decorate6([
|
|
1393
1448
|
Controller3(),
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1449
|
+
_ts_param5(0, Optional3()),
|
|
1450
|
+
_ts_param5(0, Inject4(DASHBOARD_AUTH)),
|
|
1451
|
+
_ts_param5(1, Inject4(DASHBOARD_BASE_PATH)),
|
|
1452
|
+
_ts_metadata5("design:type", Function),
|
|
1453
|
+
_ts_metadata5("design:paramtypes", [
|
|
1399
1454
|
Object,
|
|
1400
1455
|
String
|
|
1401
1456
|
])
|
|
@@ -1407,7 +1462,7 @@ import { Module } from "@nestjs/common";
|
|
|
1407
1462
|
import { RouterModule } from "@nestjs/core";
|
|
1408
1463
|
|
|
1409
1464
|
// src/server/durable-session.guard.ts
|
|
1410
|
-
import { Inject as
|
|
1465
|
+
import { Inject as Inject5, Injectable as Injectable2, UnauthorizedException as UnauthorizedException2 } from "@nestjs/common";
|
|
1411
1466
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
1412
1467
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1413
1468
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1415,16 +1470,16 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
1415
1470
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1416
1471
|
}
|
|
1417
1472
|
__name(_ts_decorate7, "_ts_decorate");
|
|
1418
|
-
function
|
|
1473
|
+
function _ts_metadata6(k, v) {
|
|
1419
1474
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1420
1475
|
}
|
|
1421
|
-
__name(
|
|
1422
|
-
function
|
|
1476
|
+
__name(_ts_metadata6, "_ts_metadata");
|
|
1477
|
+
function _ts_param6(paramIndex, decorator) {
|
|
1423
1478
|
return function(target, key) {
|
|
1424
1479
|
decorator(target, key, paramIndex);
|
|
1425
1480
|
};
|
|
1426
1481
|
}
|
|
1427
|
-
__name(
|
|
1482
|
+
__name(_ts_param6, "_ts_param");
|
|
1428
1483
|
var DurableUiSessionGuard = class {
|
|
1429
1484
|
static {
|
|
1430
1485
|
__name(this, "DurableUiSessionGuard");
|
|
@@ -1467,10 +1522,10 @@ var DurableUiSessionGuard = class {
|
|
|
1467
1522
|
};
|
|
1468
1523
|
DurableUiSessionGuard = _ts_decorate7([
|
|
1469
1524
|
Injectable2(),
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1525
|
+
_ts_param6(0, Inject5(DASHBOARD_AUTH)),
|
|
1526
|
+
_ts_param6(1, Inject5(DASHBOARD_BASE_PATH)),
|
|
1527
|
+
_ts_metadata6("design:type", Function),
|
|
1528
|
+
_ts_metadata6("design:paramtypes", [
|
|
1474
1529
|
Object,
|
|
1475
1530
|
String
|
|
1476
1531
|
])
|
|
@@ -1511,9 +1566,9 @@ var DurableApiSessionGuard = class {
|
|
|
1511
1566
|
};
|
|
1512
1567
|
DurableApiSessionGuard = _ts_decorate7([
|
|
1513
1568
|
Injectable2(),
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1569
|
+
_ts_param6(0, Inject5(DASHBOARD_AUTH)),
|
|
1570
|
+
_ts_metadata6("design:type", Function),
|
|
1571
|
+
_ts_metadata6("design:paramtypes", [
|
|
1517
1572
|
Object
|
|
1518
1573
|
])
|
|
1519
1574
|
], DurableApiSessionGuard);
|