@punks/backend-entity-manager 0.0.258 → 0.0.259
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/cjs/index.js +10 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/platforms/nest/extensions/authentication/decorators/guards.d.ts +2 -1
- package/dist/cjs/types/platforms/nest/extensions/authentication/decorators/index.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/decorators/types.d.ts +3 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/guards/auth.d.ts +1 -1
- package/dist/esm/index.js +10 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/platforms/nest/extensions/authentication/decorators/guards.d.ts +2 -1
- package/dist/esm/types/platforms/nest/extensions/authentication/decorators/index.d.ts +1 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/decorators/types.d.ts +3 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/guards/auth.d.ts +1 -1
- package/dist/index.d.ts +7 -3
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -3732,7 +3732,7 @@ const Authenticated = () => common.SetMetadata(AuthenticationGuardsSymbols.Authe
|
|
|
3732
3732
|
const Permissions = (...permissions) => common.SetMetadata(AuthenticationGuardsSymbols.Permissions, permissions);
|
|
3733
3733
|
const Roles = (...roles) => common.SetMetadata(AuthenticationGuardsSymbols.Roles, roles);
|
|
3734
3734
|
const MemberOf = (...groups) => common.SetMetadata(AuthenticationGuardsSymbols.MemberOf, groups);
|
|
3735
|
-
const ApiKeyAccess = () => common.SetMetadata(AuthenticationGuardsSymbols.ApiKey,
|
|
3735
|
+
const ApiKeyAccess = (options) => common.SetMetadata(AuthenticationGuardsSymbols.ApiKey, options ?? {});
|
|
3736
3736
|
const buildRolesGuard = ({ mainRole, secondaryRoles, }, options) => Roles(mainRole.uid, ...(!options?.exact && secondaryRoles
|
|
3737
3737
|
? secondaryRoles.map((role) => role.uid)
|
|
3738
3738
|
: []));
|
|
@@ -3828,18 +3828,20 @@ exports.AuthGuard = AuthGuard_1 = class AuthGuard {
|
|
|
3828
3828
|
return true;
|
|
3829
3829
|
}
|
|
3830
3830
|
const auth = this.getCurrentAuth(context);
|
|
3831
|
-
const
|
|
3832
|
-
if (
|
|
3831
|
+
const apiRoute = this.getApiRoute(context);
|
|
3832
|
+
if (apiRoute) {
|
|
3833
3833
|
if (auth?.apiKey && !auth.apiKey.disabled) {
|
|
3834
3834
|
this.logger.debug(`Authorized:true -> api route with valid api key`, this.getContextInfo({
|
|
3835
3835
|
context,
|
|
3836
3836
|
}));
|
|
3837
3837
|
return true;
|
|
3838
3838
|
}
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3839
|
+
if (apiRoute.strict) {
|
|
3840
|
+
this.logger.debug(`Authorized:false -> api route without api key`, this.getContextInfo({
|
|
3841
|
+
context,
|
|
3842
|
+
}));
|
|
3843
|
+
return false;
|
|
3844
|
+
}
|
|
3843
3845
|
}
|
|
3844
3846
|
const allowedRoles = this.getAllowedRoles(context);
|
|
3845
3847
|
if (allowedRoles) {
|
|
@@ -3909,7 +3911,7 @@ exports.AuthGuard = AuthGuard_1 = class AuthGuard {
|
|
|
3909
3911
|
getIsPublic(context) {
|
|
3910
3912
|
return this.getMetadata(AuthenticationGuardsSymbols.Public, context);
|
|
3911
3913
|
}
|
|
3912
|
-
|
|
3914
|
+
getApiRoute(context) {
|
|
3913
3915
|
return this.getMetadata(AuthenticationGuardsSymbols.ApiKey, context);
|
|
3914
3916
|
}
|
|
3915
3917
|
getAllowedRoles(context) {
|