@vercube/auth 0.0.22 → 0.0.24
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/README.md +10 -5
- package/dist/index.mjs +16 -49
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
<br>
|
|
4
4
|
<br>
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
# Vercube
|
|
7
|
+
|
|
8
|
+
Next generation HTTP framework
|
|
9
|
+
|
|
10
10
|
<a href="https://www.npmjs.com/package/@vercube/auth">
|
|
11
11
|
<img src="https://img.shields.io/npm/v/%40vercube%2Fauth?style=for-the-badge&logo=npm&color=%23767eff" alt="npm"/>
|
|
12
12
|
</a>
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
<a href="https://github.com/vercube/vercube/blob/main/LICENSE" target="_blank">
|
|
17
17
|
<img src="https://img.shields.io/npm/l/%40vercube%2Fauth?style=for-the-badge&color=%23767eff" alt="License"/>
|
|
18
18
|
</a>
|
|
19
|
+
<a href="https://codecov.io/gh/vercube/vercube" target="_blank">
|
|
20
|
+
<img src="https://img.shields.io/codecov/c/github/vercube/vercube?style=for-the-badge&color=%23767eff" alt="Coverage"/>
|
|
21
|
+
</a>
|
|
19
22
|
<br/>
|
|
20
23
|
<br/>
|
|
21
24
|
</div>
|
|
@@ -23,7 +26,9 @@
|
|
|
23
26
|
An ultra-efficient JavaScript server framework that runs anywhere - Node.js, Bun, or Deno - with unmatched flexibility and complete configurability for developers who refuse to sacrifice speed or control.
|
|
24
27
|
|
|
25
28
|
## <a name="module">Auth module</a>
|
|
29
|
+
|
|
26
30
|
The Auth module provides a flexible and extensible authentication and authorization system for Vercube applications. It offers a unified interface for different authentication implementations through a dependency injection-based architecture.
|
|
27
31
|
|
|
28
32
|
## <a name="documentation">📖 Documentation</a>
|
|
29
|
-
|
|
33
|
+
|
|
34
|
+
Comprehensive documentation is available at [vercube.dev](https://vercube.dev). There you'll find detailed module descriptions, project information, guides, and everything else you need to know about Vercube.
|
package/dist/index.mjs
CHANGED
|
@@ -1,52 +1,21 @@
|
|
|
1
|
-
import "node:module";
|
|
2
1
|
import { UnauthorizedError, initializeMetadata, initializeMetadataMethod } from "@vercube/core";
|
|
3
2
|
import { BaseDecorator, Container, Inject, InjectOptional, createDecorator } from "@vercube/di";
|
|
4
3
|
import { Logger } from "@vercube/logger";
|
|
5
4
|
|
|
6
|
-
//#region rolldown:runtime
|
|
7
|
-
var __create = Object.create;
|
|
8
|
-
var __defProp = Object.defineProperty;
|
|
9
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
12
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
|
-
var __commonJS = (cb, mod) => function() {
|
|
14
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
-
};
|
|
16
|
-
var __copyProps = (to, from, except, desc) => {
|
|
17
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
18
|
-
key = keys[i];
|
|
19
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
20
|
-
get: ((k) => from[k]).bind(null, key),
|
|
21
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
27
|
-
value: mod,
|
|
28
|
-
enumerable: true
|
|
29
|
-
}) : target, mod));
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
5
|
//#region src/Services/AuthProvider.ts
|
|
33
6
|
var AuthProvider = class {};
|
|
34
7
|
|
|
35
8
|
//#endregion
|
|
36
|
-
//#region
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
module.exports = __decorate, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
45
|
-
}) });
|
|
9
|
+
//#region \0@oxc-project+runtime@0.90.0/helpers/decorate.js
|
|
10
|
+
function __decorate(decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
}
|
|
46
16
|
|
|
47
17
|
//#endregion
|
|
48
18
|
//#region src/Middleware/AuthMiddleware.ts
|
|
49
|
-
var import_decorate$1 = /* @__PURE__ */ __toESM(require_decorate(), 1);
|
|
50
19
|
/**
|
|
51
20
|
* Middleware for auth
|
|
52
21
|
* @implements {BaseMiddleware}
|
|
@@ -78,9 +47,9 @@ var AuthMiddleware = class {
|
|
|
78
47
|
if (authenticationError) throw new UnauthorizedError(authenticationError);
|
|
79
48
|
}
|
|
80
49
|
};
|
|
81
|
-
(
|
|
82
|
-
(
|
|
83
|
-
(
|
|
50
|
+
__decorate([Inject(Container)], AuthMiddleware.prototype, "gContainer", void 0);
|
|
51
|
+
__decorate([InjectOptional(Logger)], AuthMiddleware.prototype, "gLogger", void 0);
|
|
52
|
+
__decorate([InjectOptional(AuthProvider)], AuthMiddleware.prototype, "gAuthProvider", void 0);
|
|
84
53
|
|
|
85
54
|
//#endregion
|
|
86
55
|
//#region src/Decorators/Auth.ts
|
|
@@ -104,11 +73,10 @@ function Auth(options) {
|
|
|
104
73
|
|
|
105
74
|
//#endregion
|
|
106
75
|
//#region src/Decorators/User.ts
|
|
107
|
-
var import_decorate = /* @__PURE__ */ __toESM(require_decorate(), 1);
|
|
108
76
|
/**
|
|
109
77
|
* Decorator class for injecting the current user into controller methods
|
|
110
78
|
* Extends BaseDecorator to provide user injection functionality
|
|
111
|
-
*
|
|
79
|
+
*
|
|
112
80
|
* @class UserDecorator
|
|
113
81
|
* @extends {BaseDecorator<UserDecoratorOptions>}
|
|
114
82
|
*/
|
|
@@ -121,8 +89,7 @@ var UserDecorator = class extends BaseDecorator {
|
|
|
121
89
|
*/
|
|
122
90
|
created() {
|
|
123
91
|
initializeMetadata(this.prototype);
|
|
124
|
-
|
|
125
|
-
method.args.push({
|
|
92
|
+
initializeMetadataMethod(this.prototype, this.propertyName).args.push({
|
|
126
93
|
idx: this.propertyIndex,
|
|
127
94
|
type: "custom",
|
|
128
95
|
resolver: async (event) => {
|
|
@@ -133,19 +100,19 @@ var UserDecorator = class extends BaseDecorator {
|
|
|
133
100
|
});
|
|
134
101
|
}
|
|
135
102
|
};
|
|
136
|
-
(
|
|
103
|
+
__decorate([Inject(Container)], UserDecorator.prototype, "gContainer", void 0);
|
|
137
104
|
/**
|
|
138
105
|
* Creates a decorator that injects the current user into controller methods
|
|
139
|
-
*
|
|
106
|
+
*
|
|
140
107
|
* @param {UserDecoratorOptions} [params] - Optional configuration for the decorator
|
|
141
108
|
* @returns {Function} A decorator function that can be applied to controller method parameters
|
|
142
|
-
*
|
|
109
|
+
*
|
|
143
110
|
* @example
|
|
144
111
|
* // Basic usage
|
|
145
112
|
* async someMethod(@User() user: User) {
|
|
146
113
|
* // user is automatically injected
|
|
147
114
|
* }
|
|
148
|
-
*
|
|
115
|
+
*
|
|
149
116
|
* @example
|
|
150
117
|
* // With custom provider
|
|
151
118
|
* async someMethod(@User() user: User) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercube/auth",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "Auth module for Vercube framework",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@vercube/core": "0.0.
|
|
26
|
-
"@vercube/
|
|
27
|
-
"@vercube/
|
|
25
|
+
"@vercube/core": "0.0.24",
|
|
26
|
+
"@vercube/logger": "0.0.24",
|
|
27
|
+
"@vercube/di": "0.0.24"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|