@lenne.tech/nest-server 11.42.13 → 11.42.15
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/rules/testing.md +32 -13
- package/FRAMEWORK-API.md +1 -1
- package/dist/core/modules/ai/models/core-ai-budget-limit.model.d.ts +5 -1
- package/dist/core/modules/ai/models/core-ai-connection-preference.model.d.ts +5 -1
- package/dist/core/modules/ai/models/core-ai-connection.model.d.ts +5 -1
- package/dist/core/modules/ai/models/core-ai-conversation.model.d.ts +5 -1
- package/dist/core/modules/ai/models/core-ai-interaction.model.d.ts +5 -1
- package/dist/core/modules/ai/models/core-ai-mode.model.d.ts +5 -1
- package/dist/core/modules/ai/models/core-ai-prompt-hint.model.d.ts +5 -1
- package/dist/core/modules/ai/models/core-ai-prompt.model.d.ts +5 -1
- package/dist/core/modules/ai/models/core-ai-slot.model.d.ts +5 -1
- package/dist/core/modules/ai/models/core-ai-tool-grant.model.d.ts +5 -1
- package/dist/core/modules/ai/models/core-ai-tool-policy.model.d.ts +5 -1
- package/dist/core/modules/auth/guards/auth.guard.js +14 -0
- package/dist/core/modules/auth/guards/auth.guard.js.map +1 -1
- package/dist/server/modules/file/file-info.model.d.ts +5 -1
- package/dist/server/modules/user/user.model.d.ts +5 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/docs/REQUEST-LIFECYCLE.md +8 -0
- package/migration-guides/11.42.13-to-11.42.14.md +74 -0
- package/migration-guides/11.42.14-to-11.42.15.md +117 -0
- package/package.json +14 -14
- package/src/core/modules/api-token/README.md +5 -0
- package/src/core/modules/auth/guards/auth.guard.ts +31 -1
- package/src/core/modules/better-auth/README.md +1 -1
- package/src/core/modules/hub/README.md +1 -1
package/.claude/rules/testing.md
CHANGED
|
@@ -268,7 +268,7 @@ pnpm run check:mutations -- --id=<id> # one mutation
|
|
|
268
268
|
pnpm run check:mutations -- --list # the registry, without running anything
|
|
269
269
|
pnpm run check:mutations -- --allow-dirty # when the fix and its evidence share a working tree
|
|
270
270
|
pnpm run check:mutations -- --jobs=4 # N mutations at a time (default: 2, or 4 on >=12 cores)
|
|
271
|
-
pnpm run check:mutations -- --no-infra # only the
|
|
271
|
+
pnpm run check:mutations -- --no-infra # only the 134 that need no MongoDB
|
|
272
272
|
pnpm run check:mutations -- --since=<ref> # only mutations touching files changed since <ref>
|
|
273
273
|
```
|
|
274
274
|
|
|
@@ -287,7 +287,7 @@ when the registry, a vitest config or a setup file changed, since those can move
|
|
|
287
287
|
commit, and in CI alongside the publish without blocking it. The price of caching is a cache that
|
|
288
288
|
has to model each spec's full dependency closure correctly, and getting that wrong produces a stale
|
|
289
289
|
PASS for a test that has since gone vacuous — exactly what the gate is there to prevent. Bad trade
|
|
290
|
-
at
|
|
290
|
+
at 207 mutations.
|
|
291
291
|
|
|
292
292
|
**Decided 2026-10-03 (repo owner): keep the full run.** Measured at 128 mutations, the CI job for
|
|
293
293
|
11.41.6 took **14 minutes**. The trigger to revisit is that wall time, not the mutation count —
|
|
@@ -332,9 +332,9 @@ exactly the environment where the answer matters.
|
|
|
332
332
|
|
|
333
333
|
### The cost is vitest's cold start, not the tests
|
|
334
334
|
|
|
335
|
-
Worth knowing before optimising the wrong thing: the specs behind all
|
|
335
|
+
Worth knowing before optimising the wrong thing: the specs behind all 73 e2e mutations add up to
|
|
336
336
|
**~40 seconds**. The step takes ~740s. The remaining ~700s is paying vitest's startup — process
|
|
337
|
-
spawn, transform, module graph, mongod connect, DB create and drop — once per mutation,
|
|
337
|
+
spawn, transform, module graph, mongod connect, DB create and drop — once per mutation, 207 times.
|
|
338
338
|
That work is largely single-threaded I/O and barely scales with cores: the full registry measures
|
|
339
339
|
**744s on a 12-core laptop and 777s on a 4-vCPU CI runner**.
|
|
340
340
|
|
|
@@ -652,15 +652,34 @@ differs under the starter's configuration.
|
|
|
652
652
|
|
|
653
653
|
**The copy is updated the way a consumer updates, not merely re-pointed (11.41.4).** Before the
|
|
654
654
|
checks, `alignConsumerPins()` applies the starter's own `pnpm run update` rule
|
|
655
|
-
(`extras/sync-packages.mjs`) to the tarball's manifest:
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
tarball's 11.2.6, `@nestjs/schedule` was
|
|
660
|
-
type-checking. Every release that raises
|
|
661
|
-
|
|
662
|
-
every consumer has to raise too, so the
|
|
663
|
-
`tests/unit/check-consumer-align.spec.ts` (mutation
|
|
655
|
+
(`extras/sync-packages.mjs`, rule in `extras/align-package-versions.mjs`) to the tarball's manifest:
|
|
656
|
+
a pin the starter already declares is raised to the framework's version when that is newer, in the
|
|
657
|
+
section the starter keeps it — never lowered, added or moved to another section. Without it the gate
|
|
658
|
+
tested a state no documented path produces, and refused 11.41.4 although the tarball was sound: the
|
|
659
|
+
starter still pinned `@nestjs/common` 11.2.1 against the tarball's 11.2.6, `@nestjs/schedule` was
|
|
660
|
+
installed twice and `CronJobs extends CoreCronJobs` stopped type-checking. Every release that raises
|
|
661
|
+
a shared exact pin would hit the same wall, because the starter is bumped only AFTER the npm publish.
|
|
662
|
+
The gate prints each raised pin — those are the pins every consumer has to raise too, so the
|
|
663
|
+
migration guide must list them. Pinned by `tests/unit/check-consumer-align.spec.ts` (mutation
|
|
664
|
+
`consumer-gate-skips-pin-alignment`).
|
|
665
|
+
|
|
666
|
+
**What the framework ships follows across sections; what it only develops with does not (11.42.15).**
|
|
667
|
+
Until then both the gate and the starter's script matched sections. nest-server keeps `mongodb` in
|
|
668
|
+
`dependencies`, the starter in `devDependencies` — and Better-Auth's MongoDB adapter resolves its
|
|
669
|
+
`mongodb` peer from that pin. Raising mongoose to 9.11, which needs mongodb ~7.7, therefore left the
|
|
670
|
+
starter on 7.6.0: two bson copies, the adapter's `instanceof ObjectId` failed, sign-in answered 401,
|
|
671
|
+
and the gate broke on 2026-10-06 (74/119 red). So a framework `dependencies` version now raises the
|
|
672
|
+
consumer's pin in either section (mutation `consumer-gate-same-section-only`).
|
|
673
|
+
|
|
674
|
+
The reverse direction stays closed on purpose: a framework `devDependencies` version raises only the
|
|
675
|
+
consumer's `devDependencies`, never a runtime pin. The better-auth trio is the reason — nest-server
|
|
676
|
+
holds it as devDependencies (its own test versions; the peer range is the contract), a project holds
|
|
677
|
+
it as dependencies and owns that version, because its api and app must resolve the same better-auth.
|
|
678
|
+
Letting the framework's test pin drive it would move the api on the next `pnpm run update` and leave
|
|
679
|
+
the app behind (mutation `consumer-gate-devdeps-drive-runtime-pins`). `RAISE_SOURCES` in
|
|
680
|
+
`scripts/check-consumer.mjs` and in the starter's `extras/align-package-versions.mjs` encode this;
|
|
681
|
+
the two must stay identical — a gate that is more generous than the consumer's script certifies an
|
|
682
|
+
update path nobody has.
|
|
664
683
|
|
|
665
684
|
Wired into `.github/workflows/publish.yml` before the publish step, with `--fast`. Deliberately not
|
|
666
685
|
on every push (~5 minutes), and deliberately not the starter's full `check` in CI: that also runs
|
package/FRAMEWORK-API.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @lenne.tech/nest-server — Framework API Reference
|
|
2
2
|
|
|
3
|
-
> Auto-generated from source code as of 2026-10-
|
|
3
|
+
> Auto-generated from source code as of 2026-10-17 (v11.42.15)
|
|
4
4
|
> File: `FRAMEWORK-API.md` — compact, machine-readable API surface for Claude Code
|
|
5
5
|
|
|
6
6
|
## CoreModule.forRoot()
|
|
@@ -8,7 +8,11 @@ export declare class CoreAiBudgetLimit extends CorePersistenceModel {
|
|
|
8
8
|
refId: string;
|
|
9
9
|
scope: string;
|
|
10
10
|
}
|
|
11
|
-
export declare const AiBudgetLimitSchema: import("mongoose").Schema<CoreAiBudgetLimit, import("mongoose").Model<CoreAiBudgetLimit, any, any, any, any, any, CoreAiBudgetLimit
|
|
11
|
+
export declare const AiBudgetLimitSchema: import("mongoose").Schema<CoreAiBudgetLimit, import("mongoose").Model<CoreAiBudgetLimit, any, any, any, any, any, CoreAiBudgetLimit & Required<{
|
|
12
|
+
_id: import("mongoose").Types.ObjectId;
|
|
13
|
+
}> & {
|
|
14
|
+
__v: number;
|
|
15
|
+
}>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, CoreAiBudgetLimit, Document<unknown, {}, CoreAiBudgetLimit, {}, import("mongoose").DefaultSchemaOptions> & CoreAiBudgetLimit & Required<{
|
|
12
16
|
_id: import("mongoose").Types.ObjectId;
|
|
13
17
|
}> & {
|
|
14
18
|
__v: number;
|
|
@@ -7,7 +7,11 @@ export declare class CoreAiConnectionPreference extends CorePersistenceModel {
|
|
|
7
7
|
refId: string;
|
|
8
8
|
scope: string;
|
|
9
9
|
}
|
|
10
|
-
export declare const AiConnectionPreferenceSchema: import("mongoose").Schema<CoreAiConnectionPreference, import("mongoose").Model<CoreAiConnectionPreference, any, any, any, any, any, CoreAiConnectionPreference
|
|
10
|
+
export declare const AiConnectionPreferenceSchema: import("mongoose").Schema<CoreAiConnectionPreference, import("mongoose").Model<CoreAiConnectionPreference, any, any, any, any, any, CoreAiConnectionPreference & Required<{
|
|
11
|
+
_id: import("mongoose").Types.ObjectId;
|
|
12
|
+
}> & {
|
|
13
|
+
__v: number;
|
|
14
|
+
}>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, CoreAiConnectionPreference, Document<unknown, {}, CoreAiConnectionPreference, {}, import("mongoose").DefaultSchemaOptions> & CoreAiConnectionPreference & Required<{
|
|
11
15
|
_id: import("mongoose").Types.ObjectId;
|
|
12
16
|
}> & {
|
|
13
17
|
__v: number;
|
|
@@ -26,7 +26,11 @@ export declare class CoreAiConnection extends CorePersistenceModel {
|
|
|
26
26
|
tenantIds?: string[];
|
|
27
27
|
securityCheck(user?: any, force?: boolean): this;
|
|
28
28
|
}
|
|
29
|
-
export declare const AiConnectionSchema: import("mongoose").Schema<CoreAiConnection, import("mongoose").Model<CoreAiConnection, any, any, any, any, any, CoreAiConnection
|
|
29
|
+
export declare const AiConnectionSchema: import("mongoose").Schema<CoreAiConnection, import("mongoose").Model<CoreAiConnection, any, any, any, any, any, CoreAiConnection & Required<{
|
|
30
|
+
_id: import("mongoose").Types.ObjectId;
|
|
31
|
+
}> & {
|
|
32
|
+
__v: number;
|
|
33
|
+
}>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, CoreAiConnection, Document<unknown, {}, CoreAiConnection, {}, import("mongoose").DefaultSchemaOptions> & CoreAiConnection & Required<{
|
|
30
34
|
_id: import("mongoose").Types.ObjectId;
|
|
31
35
|
}> & {
|
|
32
36
|
__v: number;
|
|
@@ -10,7 +10,11 @@ export declare class CoreAiConversation extends CorePersistenceModel {
|
|
|
10
10
|
title?: string;
|
|
11
11
|
securityCheck(user?: any, force?: boolean): this;
|
|
12
12
|
}
|
|
13
|
-
export declare const AiConversationSchema: Schema<CoreAiConversation, import("mongoose").Model<CoreAiConversation, any, any, any, any, any, CoreAiConversation
|
|
13
|
+
export declare const AiConversationSchema: Schema<CoreAiConversation, import("mongoose").Model<CoreAiConversation, any, any, any, any, any, CoreAiConversation & Required<{
|
|
14
|
+
_id: import("mongoose").Types.ObjectId;
|
|
15
|
+
}> & {
|
|
16
|
+
__v: number;
|
|
17
|
+
}>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, CoreAiConversation, Document<unknown, {}, CoreAiConversation, {}, import("mongoose").DefaultSchemaOptions> & CoreAiConversation & Required<{
|
|
14
18
|
_id: import("mongoose").Types.ObjectId;
|
|
15
19
|
}> & {
|
|
16
20
|
__v: number;
|
|
@@ -16,7 +16,11 @@ export declare class CoreAiInteraction extends CorePersistenceModel {
|
|
|
16
16
|
totalTokens?: number;
|
|
17
17
|
userId?: string;
|
|
18
18
|
}
|
|
19
|
-
export declare const AiInteractionSchema: Schema<CoreAiInteraction, import("mongoose").Model<CoreAiInteraction, any, any, any, any, any, CoreAiInteraction
|
|
19
|
+
export declare const AiInteractionSchema: Schema<CoreAiInteraction, import("mongoose").Model<CoreAiInteraction, any, any, any, any, any, CoreAiInteraction & Required<{
|
|
20
|
+
_id: import("mongoose").Types.ObjectId;
|
|
21
|
+
}> & {
|
|
22
|
+
__v: number;
|
|
23
|
+
}>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, CoreAiInteraction, Document<unknown, {}, CoreAiInteraction, {}, import("mongoose").DefaultSchemaOptions> & CoreAiInteraction & Required<{
|
|
20
24
|
_id: import("mongoose").Types.ObjectId;
|
|
21
25
|
}> & {
|
|
22
26
|
__v: number;
|
|
@@ -10,7 +10,11 @@ export declare class CoreAiMode extends CorePersistenceModel {
|
|
|
10
10
|
promptAddendum?: string;
|
|
11
11
|
roles?: string[];
|
|
12
12
|
}
|
|
13
|
-
export declare const AiModeSchema: import("mongoose").Schema<CoreAiMode, import("mongoose").Model<CoreAiMode, any, any, any, any, any, CoreAiMode
|
|
13
|
+
export declare const AiModeSchema: import("mongoose").Schema<CoreAiMode, import("mongoose").Model<CoreAiMode, any, any, any, any, any, CoreAiMode & Required<{
|
|
14
|
+
_id: import("mongoose").Types.ObjectId;
|
|
15
|
+
}> & {
|
|
16
|
+
__v: number;
|
|
17
|
+
}>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, CoreAiMode, Document<unknown, {}, CoreAiMode, {}, import("mongoose").DefaultSchemaOptions> & CoreAiMode & Required<{
|
|
14
18
|
_id: import("mongoose").Types.ObjectId;
|
|
15
19
|
}> & {
|
|
16
20
|
__v: number;
|
|
@@ -9,7 +9,11 @@ export declare class CoreAiPromptHint extends CorePersistenceModel {
|
|
|
9
9
|
status?: string;
|
|
10
10
|
trigger: string;
|
|
11
11
|
}
|
|
12
|
-
export declare const AiPromptHintSchema: import("mongoose").Schema<CoreAiPromptHint, import("mongoose").Model<CoreAiPromptHint, any, any, any, any, any, CoreAiPromptHint
|
|
12
|
+
export declare const AiPromptHintSchema: import("mongoose").Schema<CoreAiPromptHint, import("mongoose").Model<CoreAiPromptHint, any, any, any, any, any, CoreAiPromptHint & Required<{
|
|
13
|
+
_id: import("mongoose").Types.ObjectId;
|
|
14
|
+
}> & {
|
|
15
|
+
__v: number;
|
|
16
|
+
}>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, CoreAiPromptHint, Document<unknown, {}, CoreAiPromptHint, {}, import("mongoose").DefaultSchemaOptions> & CoreAiPromptHint & Required<{
|
|
13
17
|
_id: import("mongoose").Types.ObjectId;
|
|
14
18
|
}> & {
|
|
15
19
|
__v: number;
|
|
@@ -13,7 +13,11 @@ export declare class CoreAiPrompt extends CorePersistenceModel {
|
|
|
13
13
|
tenantId?: string;
|
|
14
14
|
securityCheck(user: any, _force?: boolean): this;
|
|
15
15
|
}
|
|
16
|
-
export declare const AiPromptSchema: import("mongoose").Schema<CoreAiPrompt, import("mongoose").Model<CoreAiPrompt, any, any, any, any, any, CoreAiPrompt
|
|
16
|
+
export declare const AiPromptSchema: import("mongoose").Schema<CoreAiPrompt, import("mongoose").Model<CoreAiPrompt, any, any, any, any, any, CoreAiPrompt & Required<{
|
|
17
|
+
_id: import("mongoose").Types.ObjectId;
|
|
18
|
+
}> & {
|
|
19
|
+
__v: number;
|
|
20
|
+
}>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, CoreAiPrompt, Document<unknown, {}, CoreAiPrompt, {}, import("mongoose").DefaultSchemaOptions> & CoreAiPrompt & Required<{
|
|
17
21
|
_id: import("mongoose").Types.ObjectId;
|
|
18
22
|
}> & {
|
|
19
23
|
__v: number;
|
|
@@ -12,7 +12,11 @@ export declare class CoreAiSlot extends CorePersistenceModel {
|
|
|
12
12
|
scope?: string;
|
|
13
13
|
tenantId?: string;
|
|
14
14
|
}
|
|
15
|
-
export declare const AiSlotSchema: import("mongoose").Schema<CoreAiSlot, import("mongoose").Model<CoreAiSlot, any, any, any, any, any, CoreAiSlot
|
|
15
|
+
export declare const AiSlotSchema: import("mongoose").Schema<CoreAiSlot, import("mongoose").Model<CoreAiSlot, any, any, any, any, any, CoreAiSlot & Required<{
|
|
16
|
+
_id: import("mongoose").Types.ObjectId;
|
|
17
|
+
}> & {
|
|
18
|
+
__v: number;
|
|
19
|
+
}>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, CoreAiSlot, Document<unknown, {}, CoreAiSlot, {}, import("mongoose").DefaultSchemaOptions> & CoreAiSlot & Required<{
|
|
16
20
|
_id: import("mongoose").Types.ObjectId;
|
|
17
21
|
}> & {
|
|
18
22
|
__v: number;
|
|
@@ -9,7 +9,11 @@ export declare class CoreAiToolGrant extends CorePersistenceModel {
|
|
|
9
9
|
scope: string;
|
|
10
10
|
tool: string;
|
|
11
11
|
}
|
|
12
|
-
export declare const AiToolGrantSchema: import("mongoose").Schema<CoreAiToolGrant, import("mongoose").Model<CoreAiToolGrant, any, any, any, any, any, CoreAiToolGrant
|
|
12
|
+
export declare const AiToolGrantSchema: import("mongoose").Schema<CoreAiToolGrant, import("mongoose").Model<CoreAiToolGrant, any, any, any, any, any, CoreAiToolGrant & Required<{
|
|
13
|
+
_id: import("mongoose").Types.ObjectId;
|
|
14
|
+
}> & {
|
|
15
|
+
__v: number;
|
|
16
|
+
}>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, CoreAiToolGrant, Document<unknown, {}, CoreAiToolGrant, {}, import("mongoose").DefaultSchemaOptions> & CoreAiToolGrant & Required<{
|
|
13
17
|
_id: import("mongoose").Types.ObjectId;
|
|
14
18
|
}> & {
|
|
15
19
|
__v: number;
|
|
@@ -22,7 +22,11 @@ export declare class CoreAiToolPolicy extends CorePersistenceModel {
|
|
|
22
22
|
scope: string;
|
|
23
23
|
tool: string;
|
|
24
24
|
}
|
|
25
|
-
export declare const AiToolPolicySchema: import("mongoose").Schema<CoreAiToolPolicy, import("mongoose").Model<CoreAiToolPolicy, any, any, any, any, any, CoreAiToolPolicy
|
|
25
|
+
export declare const AiToolPolicySchema: import("mongoose").Schema<CoreAiToolPolicy, import("mongoose").Model<CoreAiToolPolicy, any, any, any, any, any, CoreAiToolPolicy & Required<{
|
|
26
|
+
_id: import("mongoose").Types.ObjectId;
|
|
27
|
+
}> & {
|
|
28
|
+
__v: number;
|
|
29
|
+
}>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, CoreAiToolPolicy, Document<unknown, {}, CoreAiToolPolicy, {}, import("mongoose").DefaultSchemaOptions> & CoreAiToolPolicy & Required<{
|
|
26
30
|
_id: import("mongoose").Types.ObjectId;
|
|
27
31
|
}> & {
|
|
28
32
|
__v: number;
|
|
@@ -20,6 +20,7 @@ const passport_1 = require("@nestjs/passport");
|
|
|
20
20
|
const options_js_1 = require("@nestjs/passport/dist/options.js");
|
|
21
21
|
const memoize_util_js_1 = require("@nestjs/passport/dist/utils/memoize.util.js");
|
|
22
22
|
const passport = require("passport");
|
|
23
|
+
const core_api_token_helpers_1 = require("../../api-token/core-api-token.helpers");
|
|
23
24
|
const better_auth_token_service_1 = require("../../better-auth/better-auth-token.service");
|
|
24
25
|
const core_better_auth_service_1 = require("../../better-auth/core-better-auth.service");
|
|
25
26
|
const auth_guard_strategy_enum_1 = require("../auth-guard-strategy.enum");
|
|
@@ -28,6 +29,14 @@ const expired_token_exception_1 = require("../exceptions/expired-token.exception
|
|
|
28
29
|
const invalid_token_exception_1 = require("../exceptions/invalid-token.exception");
|
|
29
30
|
const NO_STRATEGY_ERROR = 'In order to use "defaultStrategy", please, ensure to import PassportModule in each ' +
|
|
30
31
|
"place where AuthGuard() is being used. Otherwise, passport won't work correctly.";
|
|
32
|
+
const API_TOKEN_SATISFIED_STRATEGIES = new Set([
|
|
33
|
+
auth_guard_strategy_enum_1.AuthGuardStrategy.BETTER_AUTH,
|
|
34
|
+
auth_guard_strategy_enum_1.AuthGuardStrategy.JWT,
|
|
35
|
+
]);
|
|
36
|
+
function isSatisfiedByApiToken(strategy) {
|
|
37
|
+
const strategies = Array.isArray(strategy) ? strategy : [strategy];
|
|
38
|
+
return strategies.some((value) => !!value && API_TOKEN_SATISFIED_STRATEGIES.has(value));
|
|
39
|
+
}
|
|
31
40
|
const createPassportContext = (request, response) => (type, options, callback) => new Promise((resolve, reject) => passport.authenticate(type, options, (err, user, info) => {
|
|
32
41
|
try {
|
|
33
42
|
request.authInfo = info;
|
|
@@ -77,6 +86,11 @@ function createAuthGuard(type) {
|
|
|
77
86
|
const options = { ...options_js_1.defaultOptions, ...this.options };
|
|
78
87
|
const request = this.getRequest(context);
|
|
79
88
|
const existingUser = request?.[options.property || options_js_1.defaultOptions.property];
|
|
89
|
+
if ((0, core_api_token_helpers_1.getApiTokenContext)(existingUser) && isSatisfiedByApiToken(type || this.options?.defaultStrategy)) {
|
|
90
|
+
(0, core_api_token_helpers_1.enforceApiTokenRoute)({ controllerClass: context.getClass(), handler: context.getHandler(), request });
|
|
91
|
+
request[options.property || options_js_1.defaultOptions.property] = this.handleRequest(null, existingUser, null, context);
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
80
94
|
if (existingUser && existingUser._authenticatedViaBetterAuth === true) {
|
|
81
95
|
const validatedUser = this.handleRequest(null, existingUser, null, context);
|
|
82
96
|
request[options.property || options_js_1.defaultOptions.property] = validatedUser;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.guard.js","sourceRoot":"","sources":["../../../../../src/core/modules/auth/guards/auth.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwF;AACxF,uCAAyC;AACzC,6CAAsD;AACtD,+CAA2D;AAC3D,iEAAkE;AAClE,iFAAsE;AACtE,qCAAsC;AAEtC,2FAAqF;AAErF,yFAAmF;AACnF,0EAAgE;AAChE,mGAA6F;AAC7F,mFAA8E;AAC9E,mFAA8E;AAK9E,MAAM,iBAAiB,GACrB,qFAAqF;IACrF,kFAAkF,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.guard.js","sourceRoot":"","sources":["../../../../../src/core/modules/auth/guards/auth.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwF;AACxF,uCAAyC;AACzC,6CAAsD;AACtD,+CAA2D;AAC3D,iEAAkE;AAClE,iFAAsE;AACtE,qCAAsC;AAEtC,mFAAkG;AAClG,2FAAqF;AAErF,yFAAmF;AACnF,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AAC;YACxE,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;QACnH,CAAC;QAKD,aAAa,CAAC,GAAiB,EAAE,IAAS,EAAE,IAAS,EAAE,QAA0B;YAC/E,IAAI,GAAG,EAAE,CAAC;gBACR,MAAM,IAAI,+CAAqB,EAAE,CAAC;YACpC,CAAC;YACD,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,IAAI,IAAI,EAAE,IAAI,KAAK,mBAAmB,EAAE,CAAC;oBACvC,IAAI,IAAI,KAAK,4CAAiB,CAAC,WAAW,EAAE,CAAC;wBAC3C,MAAM,IAAI,8DAA4B,EAAE,CAAC;oBAC3C,CAAC;yBAAM,CAAC;wBACN,MAAM,IAAI,+CAAqB,EAAE,CAAC;oBACpC,CAAC;gBACH,CAAC;gBACD,MAAM,IAAI,+CAAqB,EAAE,CAAC;YACpC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAA;IAvMK,cAAc;QAUf,WAAA,IAAA,iBAAQ,GAAE,CAAA;QACV,WAAA,IAAA,iBAAQ,GAAE,CAAA;yCAD8B,4BAAiB;YACjB,gBAAS;OAXhD,cAAc,CAuMnB;IAED,MAAM,KAAK,GAAG,IAAA,cAAK,EAAiB,cAAc,CAAC,CAAC;IACpD,OAAO,KAAK,CAAC;AACf,CAAC;AAKY,QAAA,SAAS,GAAuE,IAAA,yBAAO,EAAC,eAAe,CAAC,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { CoreFileInfo } from '../../../core/modules/file/core-file-info.model';
|
|
2
2
|
export declare class FileInfo extends CoreFileInfo {
|
|
3
3
|
}
|
|
4
|
-
export declare const FileInfoSchema: import("mongoose").Schema<FileInfo, import("mongoose").Model<FileInfo, any, any, any, any, any, FileInfo
|
|
4
|
+
export declare const FileInfoSchema: import("mongoose").Schema<FileInfo, import("mongoose").Model<FileInfo, any, any, any, any, any, FileInfo & Required<{
|
|
5
|
+
_id: import("mongoose").Types.ObjectId;
|
|
6
|
+
}> & {
|
|
7
|
+
__v: number;
|
|
8
|
+
}>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, FileInfo, import("mongoose").Document<unknown, {}, FileInfo, {}, import("mongoose").DefaultSchemaOptions> & FileInfo & Required<{
|
|
5
9
|
_id: import("mongoose").Types.ObjectId;
|
|
6
10
|
}> & {
|
|
7
11
|
__v: number;
|
|
@@ -14,7 +14,11 @@ export declare class User extends CoreUserModel implements PersistenceModel {
|
|
|
14
14
|
map(input: any): this;
|
|
15
15
|
securityCheck(user: User, force?: boolean): this;
|
|
16
16
|
}
|
|
17
|
-
export declare const UserSchema: Schema<User, import("mongoose").Model<User, any, any, any, any, any, User
|
|
17
|
+
export declare const UserSchema: Schema<User, import("mongoose").Model<User, any, any, any, any, any, User & Required<{
|
|
18
|
+
_id: import("mongoose").Types.ObjectId;
|
|
19
|
+
}> & {
|
|
20
|
+
__v: number;
|
|
21
|
+
}>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, User, Document<unknown, {}, User, {}, import("mongoose").DefaultSchemaOptions> & User & Required<{
|
|
18
22
|
_id: import("mongoose").Types.ObjectId;
|
|
19
23
|
}> & {
|
|
20
24
|
__v: number;
|