@nest-boot/auth 4.3.6 → 5.0.0-alpha.1
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/auth.constants.js +19 -5
- package/dist/auth.guard.js +89 -51
- package/dist/auth.middleware.js +64 -35
- package/dist/auth.module-definition.js +28 -9
- package/dist/auth.module.js +62 -34
- package/dist/auth.service.js +82 -38
- package/dist/decorators/can.decorator.js +12 -7
- package/dist/decorators/current-entity.decorator.js +23 -9
- package/dist/decorators/current-personal-access-token.decorator.js +14 -8
- package/dist/decorators/index.js +20 -20
- package/dist/decorators/require-auth.decorator.js +12 -7
- package/dist/index.js +24 -24
- package/dist/interfaces/access-token.interface.js +3 -2
- package/dist/interfaces/auth-module-options.interface.js +3 -2
- package/dist/interfaces/has-permission.interface.js +3 -2
- package/dist/interfaces/index.js +19 -19
- package/dist/utils/index.js +17 -17
- package/dist/utils/mixin-permissions.utils.js +30 -9
- package/package.json +19 -18
- package/dist/auth.constants.d.ts +0 -2
- package/dist/auth.constants.js.map +0 -1
- package/dist/auth.guard.d.ts +0 -13
- package/dist/auth.guard.js.map +0 -1
- package/dist/auth.middleware.d.ts +0 -13
- package/dist/auth.middleware.js.map +0 -1
- package/dist/auth.module-definition.d.ts +0 -4
- package/dist/auth.module-definition.js.map +0 -1
- package/dist/auth.module.d.ts +0 -8
- package/dist/auth.module.js.map +0 -1
- package/dist/auth.service.d.ts +0 -12
- package/dist/auth.service.js.map +0 -1
- package/dist/decorators/can.decorator.d.ts +0 -1
- package/dist/decorators/can.decorator.js.map +0 -1
- package/dist/decorators/current-entity.decorator.d.ts +0 -2
- package/dist/decorators/current-entity.decorator.js.map +0 -1
- package/dist/decorators/current-personal-access-token.decorator.d.ts +0 -1
- package/dist/decorators/current-personal-access-token.decorator.js.map +0 -1
- package/dist/decorators/index.d.ts +0 -4
- package/dist/decorators/index.js.map +0 -1
- package/dist/decorators/require-auth.decorator.d.ts +0 -1
- package/dist/decorators/require-auth.decorator.js.map +0 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.js.map +0 -1
- package/dist/interfaces/access-token.interface.d.ts +0 -9
- package/dist/interfaces/access-token.interface.js.map +0 -1
- package/dist/interfaces/auth-module-options.interface.d.ts +0 -10
- package/dist/interfaces/auth-module-options.interface.js.map +0 -1
- package/dist/interfaces/has-permission.interface.d.ts +0 -3
- package/dist/interfaces/has-permission.interface.js.map +0 -1
- package/dist/interfaces/index.d.ts +0 -3
- package/dist/interfaces/index.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/mixin-permissions.utils.d.ts +0 -3
- package/dist/utils/mixin-permissions.utils.js.map +0 -1
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "Can", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return Can;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _common = require("@nestjs/common");
|
|
12
|
+
const _authmoduledefinition = require("../auth.module-definition");
|
|
13
|
+
const Can = (...roles)=>(0, _common.SetMetadata)(_authmoduledefinition.PERMISSIONS_METADATA_KEY, roles);
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
const request_context_1 = require("@nest-boot/request-context");
|
|
5
|
-
const common_1 = require("@nestjs/common");
|
|
6
|
-
const auth_constants_1 = require("../auth.constants");
|
|
7
|
-
exports.CurrentEntity = (0, common_1.createParamDecorator)(() => {
|
|
8
|
-
return request_context_1.RequestContext.get(auth_constants_1.AUTH_ENTITY);
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
9
4
|
});
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
CurrentEntity: function() {
|
|
13
|
+
return CurrentEntity;
|
|
14
|
+
},
|
|
15
|
+
CurrentUser: function() {
|
|
16
|
+
return CurrentUser;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _requestcontext = require("@nest-boot/request-context");
|
|
20
|
+
const _common = require("@nestjs/common");
|
|
21
|
+
const _authconstants = require("../auth.constants");
|
|
22
|
+
const CurrentEntity = (0, _common.createParamDecorator)(()=>{
|
|
23
|
+
return _requestcontext.RequestContext.get(_authconstants.AUTH_ENTITY);
|
|
24
|
+
});
|
|
25
|
+
const CurrentUser = CurrentEntity;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "CurrentAccessToken", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return CurrentAccessToken;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _requestcontext = require("@nest-boot/request-context");
|
|
12
|
+
const _common = require("@nestjs/common");
|
|
13
|
+
const _authconstants = require("../auth.constants");
|
|
14
|
+
const CurrentAccessToken = (0, _common.createParamDecorator)(()=>{
|
|
15
|
+
return _requestcontext.RequestContext.get(_authconstants.AUTH_ACCESS_TOKEN);
|
|
9
16
|
});
|
|
10
|
-
//# sourceMappingURL=current-personal-access-token.decorator.js.map
|
package/dist/decorators/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./can.decorator"), exports);
|
|
6
|
+
_export_star(require("./current-entity.decorator"), exports);
|
|
7
|
+
_export_star(require("./current-personal-access-token.decorator"), exports);
|
|
8
|
+
_export_star(require("./require-auth.decorator"), exports);
|
|
9
|
+
function _export_star(from, to) {
|
|
10
|
+
Object.keys(from).forEach(function(k) {
|
|
11
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
12
|
+
Object.defineProperty(to, k, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function() {
|
|
15
|
+
return from[k];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return from;
|
|
21
|
+
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "RequireAuth", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return RequireAuth;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _common = require("@nestjs/common");
|
|
12
|
+
const _authmoduledefinition = require("../auth.module-definition");
|
|
13
|
+
const RequireAuth = (requireAuth = true)=>(0, _common.SetMetadata)(_authmoduledefinition.REQUIRE_AUTH_METADATA_KEY, requireAuth);
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./auth.constants"), exports);
|
|
6
|
+
_export_star(require("./auth.guard"), exports);
|
|
7
|
+
_export_star(require("./auth.middleware"), exports);
|
|
8
|
+
_export_star(require("./auth.module"), exports);
|
|
9
|
+
_export_star(require("./auth.service"), exports);
|
|
10
|
+
_export_star(require("./decorators/index"), exports);
|
|
11
|
+
_export_star(require("./interfaces/index"), exports);
|
|
12
|
+
_export_star(require("./utils/index"), exports);
|
|
13
|
+
function _export_star(from, to) {
|
|
14
|
+
Object.keys(from).forEach(function(k) {
|
|
15
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
16
|
+
Object.defineProperty(to, k, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function() {
|
|
19
|
+
return from[k];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return from;
|
|
25
|
+
}
|
package/dist/interfaces/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./access-token.interface"), exports);
|
|
6
|
+
_export_star(require("./auth-module-options.interface"), exports);
|
|
7
|
+
_export_star(require("./has-permission.interface"), exports);
|
|
8
|
+
function _export_star(from, to) {
|
|
9
|
+
Object.keys(from).forEach(function(k) {
|
|
10
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
11
|
+
Object.defineProperty(to, k, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function() {
|
|
14
|
+
return from[k];
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return from;
|
|
20
|
+
}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./mixin-permissions.utils"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
18
|
+
}
|
|
@@ -1,16 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "mixinPermissions", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return mixinPermissions;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _core = require("@mikro-orm/core");
|
|
12
|
+
function _define_property(obj, key, value) {
|
|
13
|
+
if (key in obj) {
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
value: value,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
5
25
|
function mixinPermissions(base) {
|
|
6
26
|
const trait = class extends base {
|
|
7
|
-
constructor()
|
|
8
|
-
super(...
|
|
9
|
-
this
|
|
27
|
+
constructor(...args){
|
|
28
|
+
super(...args);
|
|
29
|
+
_define_property(this, "permissions", []);
|
|
10
30
|
}
|
|
11
31
|
};
|
|
12
|
-
(0,
|
|
32
|
+
(0, _core.Property)({
|
|
33
|
+
type: _core.t.array,
|
|
34
|
+
onCreate: ()=>[]
|
|
35
|
+
})(trait.prototype, "permissions");
|
|
13
36
|
return trait;
|
|
14
37
|
}
|
|
15
|
-
exports.mixinPermissions = mixinPermissions;
|
|
16
|
-
//# sourceMappingURL=mixin-permissions.utils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nest-boot/auth",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "d4rkcr0w <me@d4rkcr0w.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "
|
|
17
|
+
"build": "nest build --builder swc",
|
|
18
18
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
19
|
-
"dev": "
|
|
19
|
+
"dev": "nest build --builder swc --watch",
|
|
20
20
|
"lint": "eslint \"{src,test}/**/*.ts\" --fix",
|
|
21
21
|
"test": "jest"
|
|
22
22
|
},
|
|
@@ -25,20 +25,21 @@
|
|
|
25
25
|
"ms": "^2.1.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@mikro-orm/nestjs": "^5.
|
|
29
|
-
"@nest-boot/database": "
|
|
30
|
-
"@nest-boot/eslint-config": "
|
|
31
|
-
"@nest-boot/request-context": "
|
|
32
|
-
"@nest-boot/tsconfig": "
|
|
33
|
-
"@nestjs/common": "^
|
|
34
|
-
"@nestjs/config": "^
|
|
35
|
-
"@nestjs/core": "^
|
|
28
|
+
"@mikro-orm/nestjs": "^5.2.0",
|
|
29
|
+
"@nest-boot/database": "5.0.0-alpha.1",
|
|
30
|
+
"@nest-boot/eslint-config": "5.0.0-alpha.1",
|
|
31
|
+
"@nest-boot/request-context": "5.0.0-alpha.1",
|
|
32
|
+
"@nest-boot/tsconfig": "5.0.0-alpha.1",
|
|
33
|
+
"@nestjs/common": "^10.0.3",
|
|
34
|
+
"@nestjs/config": "^3.0.0",
|
|
35
|
+
"@nestjs/core": "^10.0.3",
|
|
36
|
+
"@swc/cli": "^0.1.62",
|
|
37
|
+
"@swc/core": "^1.3.66",
|
|
36
38
|
"@types/express": "^4.17.17",
|
|
37
39
|
"@types/jest": "^29.5.2",
|
|
38
40
|
"@types/lodash": "^4.14.195",
|
|
39
41
|
"@types/ms": "^0.7.31",
|
|
40
42
|
"@types/node": "^20.3.1",
|
|
41
|
-
"eslint": "^8.42.0",
|
|
42
43
|
"express": "^4.18.2",
|
|
43
44
|
"jest": "^29.5.0",
|
|
44
45
|
"reflect-metadata": "^0.1.13",
|
|
@@ -48,17 +49,17 @@
|
|
|
48
49
|
},
|
|
49
50
|
"peerDependencies": {
|
|
50
51
|
"@mikro-orm/core": "^5.0.0",
|
|
51
|
-
"@mikro-orm/nestjs": "^5.
|
|
52
|
-
"@nest-boot/database": "
|
|
53
|
-
"@nest-boot/request-context": "
|
|
54
|
-
"@nestjs/common": "^
|
|
55
|
-
"@nestjs/core": "^
|
|
52
|
+
"@mikro-orm/nestjs": "^5.0.0",
|
|
53
|
+
"@nest-boot/database": "5.0.0-alpha.1",
|
|
54
|
+
"@nest-boot/request-context": "5.0.0-alpha.1",
|
|
55
|
+
"@nestjs/common": "^10.0.0",
|
|
56
|
+
"@nestjs/core": "^10.0.0",
|
|
56
57
|
"express": "^4.0.0",
|
|
57
58
|
"reflect-metadata": "^0.1.13",
|
|
58
59
|
"rxjs": "^7.0.0"
|
|
59
60
|
},
|
|
60
61
|
"optionalDependencies": {
|
|
61
|
-
"@nest-boot/i18n": "
|
|
62
|
+
"@nest-boot/i18n": "5.0.0-alpha.1"
|
|
62
63
|
},
|
|
63
64
|
"publishConfig": {
|
|
64
65
|
"access": "public"
|
package/dist/auth.constants.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.constants.js","sourceRoot":"","sources":["../src/auth.constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,aAAa,CAAC;AAC5B,QAAA,iBAAiB,GAAG,mBAAmB,CAAC"}
|
package/dist/auth.guard.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { EntityManager } from "@mikro-orm/core";
|
|
2
|
-
import { type CanActivate, type ExecutionContext } from "@nestjs/common";
|
|
3
|
-
import { Reflector } from "@nestjs/core";
|
|
4
|
-
import { AuthModuleOptions } from "./interfaces";
|
|
5
|
-
export declare class AuthGuard implements CanActivate {
|
|
6
|
-
private readonly options;
|
|
7
|
-
private readonly reflector;
|
|
8
|
-
private readonly entityManager;
|
|
9
|
-
constructor(options: AuthModuleOptions, reflector: Reflector, entityManager: EntityManager);
|
|
10
|
-
private t;
|
|
11
|
-
canActivate(executionContext: ExecutionContext): Promise<boolean>;
|
|
12
|
-
getPermissions(): Promise<string[]>;
|
|
13
|
-
}
|
package/dist/auth.guard.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.guard.js","sourceRoot":"","sources":["../src/auth.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,0CAA2D;AAC3D,0CAAkD;AAClD,gEAAqE;AACrE,2CAOwB;AACxB,uCAAyC;AACzC,oDAAuB;AAEvB,qDAAkE;AAClE,qEAIkC;AAQ3B,IAAM,SAAS,uBAAf,MAAM,SAAS;IACpB,YAEmB,OAA0B,EAC1B,SAAoB,EACpB,aAA4B;QAF5B,YAAO,GAAP,OAAO,CAAmB;QAC1B,cAAS,GAAT,SAAS,CAAW;QACpB,kBAAa,GAAb,aAAa,CAAe;QAE7C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAEO,CAAC,CAAC,GAAW;;QACnB,OAAO,MAAA,MAAA,gCAAc,CAAC,GAAG,CAAO,WAAI,CAAC,0CAAE,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,mCAAI,GAAG,CAAC;IACvE,CAAC;IAEM,KAAK,CAAC,WAAW,CACtB,gBAAkC;;QAElC,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO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7D,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,IAAI,WAAW,GAAa,EAAE,CAAC;QAE/B,MAAM,MAAM,GAAG,gCAAc,CAAC,GAAG,CAA0B,4BAAW,CAAC,CAAC;QAExE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YACjC,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,WAAW,EAAE;gBAC7C,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;aACtD;iBAAM;gBACL,MAAM,cAAc,GAAG,MAAM,gBAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CACxD,aAAa,CACd,CAAC;gBAEF,IAAI,OAAO,cAAc,KAAK,WAAW,EAAE;oBACzC,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;iBAClD;aACF;SACF;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF,CAAA;oBA9FY,SAAS;IADrB,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,6CAAoB,CAAC,CAAA;6CAED,gBAAS;QACL,oBAAa;GALpC,SAAS,CA8FrB"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { EntityManager } from "@mikro-orm/core";
|
|
2
|
-
import { type NestMiddleware } from "@nestjs/common";
|
|
3
|
-
import { type Request, type Response } from "express";
|
|
4
|
-
import { AuthService } from "./auth.service";
|
|
5
|
-
import { AuthModuleOptions } from "./interfaces";
|
|
6
|
-
export declare class AuthMiddleware implements NestMiddleware {
|
|
7
|
-
private readonly options;
|
|
8
|
-
private readonly entityManager;
|
|
9
|
-
private readonly authService;
|
|
10
|
-
constructor(options: AuthModuleOptions, entityManager: EntityManager, authService: AuthService);
|
|
11
|
-
use(req: Request, res: Response, next: () => void): Promise<void>;
|
|
12
|
-
private extractAccessToken;
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.middleware.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CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YAE3D,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,QAAQ,EAAE;gBAC7D,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;aACnB;SACF;QAED,IAAI,OAAO,CAAA,MAAA,GAAG,CAAC,OAAO,0CAAE,KAAK,CAAA,KAAK,QAAQ,EAAE;YAC1C,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;SAC1B;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;yBApDY,cAAc;IAD1B,IAAA,mBAAU,EAAC,EAAE,KAAK,EAAE,cAAK,CAAC,OAAO,EAAE,CAAC;IAGhC,WAAA,IAAA,eAAM,EAAC,6CAAoB,CAAC,CAAA;6CAEG,oBAAa;QACf,0BAAW;GALhC,cAAc,CAoD1B"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type AuthModuleOptions } from "./interfaces";
|
|
2
|
-
export declare const PERMISSIONS_METADATA_KEY: `${string}-${string}-${string}-${string}-${string}`;
|
|
3
|
-
export declare const REQUIRE_AUTH_METADATA_KEY: `${string}-${string}-${string}-${string}-${string}`;
|
|
4
|
-
export declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls<AuthModuleOptions, "register", "create", {}>, MODULE_OPTIONS_TOKEN: string | symbol;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.module-definition.js","sourceRoot":"","sources":["../src/auth.module-definition.ts"],"names":[],"mappings":";;;;AAAA,2CAA2D;AAC3D,mCAAoC;AAIvB,QAAA,wBAAwB,GAAG,IAAA,mBAAU,GAAE,CAAC;AAExC,QAAA,yBAAyB,GAAG,IAAA,mBAAU,GAAE,CAAC;AAEzC,KACX,IAAI,kCAAyB,EAAqB,CAAC,KAAK,EAAE,EAD7C,+BAAuB,+BAAE,4BAAoB,2BACC"}
|
package/dist/auth.module.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type MiddlewareConsumer, type NestModule } from "@nestjs/common";
|
|
2
|
-
import { ConfigurableModuleClass } from "./auth.module-definition";
|
|
3
|
-
import { AuthModuleOptions } from "./interfaces";
|
|
4
|
-
export declare class AuthModule extends ConfigurableModuleClass implements NestModule {
|
|
5
|
-
private readonly options;
|
|
6
|
-
constructor(options: AuthModuleOptions);
|
|
7
|
-
configure(consumer: MiddlewareConsumer): void;
|
|
8
|
-
}
|
package/dist/auth.module.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../src/auth.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAMwB;AACxB,uCAAyC;AAEzC,6CAAyC;AACzC,uDAAmD;AACnD,qEAGkC;AAClC,iDAA6C;AActC,IAAM,UAAU,wBAAhB,MAAM,UAAW,SAAQ,gDAAuB;IACrD,YAEmB,OAA0B;QAE3C,KAAK,EAAE,CAAC;QAFS,YAAO,GAAP,OAAO,CAAmB;IAG7C,CAAC;IAED,SAAS,CAAC,QAA4B;QACpC,MAAM,qBAAqB,GAAG,QAAQ,CAAC,KAAK,CAAC,gCAAc,CAAC,CAAC;QAE7D,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,KAAK,WAAW,EAAE;YACrD,qBAAqB,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;SAC9D;QAED,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,KAAK,WAAW,EAAE;YACrD,qBAAqB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;SAChE;aAAM;YACL,qBAAqB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;SACtC;IACH,CAAC;CACF,CAAA;qBArBY,UAAU;IAXtB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,gBAAS;gBAClB,QAAQ,EAAE,sBAAS;aACpB;YACD,0BAAW;SACZ;QACD,OAAO,EAAE,CAAC,0BAAW,CAAC;KACvB,CAAC;IAGG,WAAA,IAAA,eAAM,EAAC,6CAAoB,CAAC,CAAA;;GAFpB,UAAU,CAqBtB"}
|
package/dist/auth.service.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type AnyEntity, EntityManager, type Loaded } from "@mikro-orm/core";
|
|
2
|
-
import { type AccessTokenInterface, AuthModuleOptions } from "./interfaces";
|
|
3
|
-
export declare class AuthService {
|
|
4
|
-
private readonly options;
|
|
5
|
-
private readonly entityManager;
|
|
6
|
-
private readonly accessTokenRepository;
|
|
7
|
-
constructor(options: AuthModuleOptions, entityManager: EntityManager);
|
|
8
|
-
createToken(entity: AnyEntity, name: string, expiresIn?: string | number): Promise<AccessTokenInterface>;
|
|
9
|
-
getToken(token?: string): Promise<Loaded<AccessTokenInterface> | null>;
|
|
10
|
-
verifyToken(token?: string): Promise<boolean>;
|
|
11
|
-
revokeToken(token?: string): Promise<void>;
|
|
12
|
-
}
|
package/dist/auth.service.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../src/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0CAKyB;AACzB,2CAAoD;AACpD,mCAAqC;AAErC,qEAAgE;AAEhE,yBAA0B;AAC1B,gEAA4D;AAE5D,qDAAqD;AAG9C,IAAM,WAAW,yBAAjB,MAAM,WAAW;IAGtB,YAEmB,OAA0B,EAC1B,aAA4B;QAD5B,YAAO,GAAP,OAAO,CAAmB;QAC1B,kBAAa,GAAb,aAAa,CAAe;QAE7C,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAC3D,IAAI,CAAC,OAAO,CAAC,sBAAsB,CACpC,CAAC;IACJ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AAK,CAAC,WAAW,CAAC,KAAc;QAC9B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAE/C,IAAI,WAAW,KAAK,IAAI,EAAE;YACxB,MAAM,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,CAAC;SAC9D;IACH,CAAC;CACF,CAAA;sBA7EY,WAAW;IADvB,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,eAAM,EAAC,6CAAoB,CAAC,CAAA;6CAEG,oBAAa;GANpC,WAAW,CA6EvB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const Can: (...roles: string[]) => ClassDecorator & MethodDecorator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"can.decorator.js","sourceRoot":"","sources":["../../src/decorators/can.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAE7C,sEAAqE;AAE9D,MAAM,GAAG,GAAG,CAAC,GAAG,KAAe,EAAoC,EAAE,CAC1E,IAAA,oBAAW,EAAC,iDAAwB,EAAE,KAAK,CAAC,CAAC;AADlC,QAAA,GAAG,OAC+B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"current-entity.decorator.js","sourceRoot":"","sources":["../../src/decorators/current-entity.decorator.ts"],"names":[],"mappings":";;;AAAA,gEAA4D;AAC5D,2CAAsD;AAEtD,sDAAgD;AAEnC,QAAA,aAAa,GAAG,IAAA,6BAAoB,EAAC,GAAG,EAAE;IACrD,OAAO,gCAAc,CAAC,GAAG,CAAC,4BAAW,CAAC,CAAC;AACzC,CAAC,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,qBAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const CurrentAccessToken: (...dataOrPipes: any[]) => ParameterDecorator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"current-personal-access-token.decorator.js","sourceRoot":"","sources":["../../src/decorators/current-personal-access-token.decorator.ts"],"names":[],"mappings":";;;AAAA,gEAA4D;AAC5D,2CAAsD;AAEtD,sDAAsD;AAGzC,QAAA,kBAAkB,GAAG,IAAA,6BAAoB,EAAC,GAAG,EAAE;IAC1D,OAAO,gCAAc,CAAC,GAAG,CAAuB,kCAAiB,CAAC,CAAC;AACrE,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,6DAA2C;AAC3C,4EAA0D;AAC1D,2DAAyC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const RequireAuth: (requireAuth?: boolean) => ClassDecorator & MethodDecorator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"require-auth.decorator.js","sourceRoot":"","sources":["../../src/decorators/require-auth.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAE7C,sEAAsE;AAE/D,MAAM,WAAW,GAAG,CACzB,WAAW,GAAG,IAAI,EACgB,EAAE,CACpC,IAAA,oBAAW,EAAC,kDAAyB,EAAE,WAAW,CAAC,CAAC;AAHzC,QAAA,WAAW,eAG8B"}
|
package/dist/index.d.ts
DELETED
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,+CAA6B;AAC7B,oDAAkC;AAClC,gDAA8B;AAC9B,iDAA+B;AAC/B,+CAA6B;AAC7B,+CAA6B;AAC7B,0CAAwB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"access-token.interface.js","sourceRoot":"","sources":["../../src/interfaces/access-token.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type EntityClass } from "@mikro-orm/core";
|
|
2
|
-
import { type RouteInfo, type Type } from "@nestjs/common/interfaces";
|
|
3
|
-
import { type AccessTokenInterface } from "./access-token.interface";
|
|
4
|
-
export interface AuthModuleOptions {
|
|
5
|
-
accessTokenEntityClass: EntityClass<AccessTokenInterface>;
|
|
6
|
-
expiresIn?: string | number;
|
|
7
|
-
defaultRequireAuth?: boolean;
|
|
8
|
-
includeRoutes?: Array<string | Type<any> | RouteInfo>;
|
|
9
|
-
excludeRoutes?: Array<string | RouteInfo>;
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-module-options.interface.js","sourceRoot":"","sources":["../../src/interfaces/auth-module-options.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"has-permission.interface.js","sourceRoot":"","sources":["../../src/interfaces/has-permission.interface.ts"],"names":[],"mappings":""}
|