@mantiq/core 0.1.4 → 0.2.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/package.json +2 -2
- package/src/contracts/Request.ts +1 -0
- package/src/http/Request.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantiq/core",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Service container, router, middleware, HTTP kernel, config, and exception handler",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"LICENSE"
|
|
41
41
|
],
|
|
42
42
|
"scripts": {
|
|
43
|
-
"build": "bun build ./src/index.ts --outdir ./dist --target bun",
|
|
43
|
+
"build": "bun build ./src/index.ts --outdir ./dist --target bun --packages=external",
|
|
44
44
|
"test": "bun test",
|
|
45
45
|
"typecheck": "tsc --noEmit",
|
|
46
46
|
"clean": "rm -rf dist"
|
package/src/contracts/Request.ts
CHANGED
package/src/http/Request.ts
CHANGED
|
@@ -193,6 +193,12 @@ export class MantiqRequest implements MantiqRequestContract {
|
|
|
193
193
|
|
|
194
194
|
// ── Auth ─────────────────────────────────────────────────────────────────
|
|
195
195
|
|
|
196
|
+
bearerToken(): string | null {
|
|
197
|
+
const auth = this.header('authorization')
|
|
198
|
+
if (!auth || !auth.startsWith('Bearer ')) return null
|
|
199
|
+
return auth.slice(7).trim() || null
|
|
200
|
+
}
|
|
201
|
+
|
|
196
202
|
user<T = any>(): T | null {
|
|
197
203
|
return this.authenticatedUser as T | null
|
|
198
204
|
}
|