@willbooster/shared-lib-blitz-next 1.2.5 → 1.2.7
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/index.d.ts +1 -0
- package/dist/middleware.cjs +2 -0
- package/dist/middleware.cjs.map +1 -0
- package/dist/middleware.d.ts +8 -0
- package/dist/middleware.js +2 -0
- package/dist/middleware.js.map +1 -0
- package/package.json +15 -15
- package/dist/cjs/index.d.cts +0 -1
- package/dist/cjs/middleware.cjs +0 -2
- package/dist/cjs/middleware.cjs.map +0 -1
- package/dist/cjs/middleware.d.cts +0 -8
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/middleware.d.ts +0 -8
- package/dist/esm/middleware.js +0 -2
- package/dist/esm/middleware.js.map +0 -1
- /package/dist/{cjs/index.cjs → index.cjs} +0 -0
- /package/dist/{cjs/index.cjs.map → index.cjs.map} +0 -0
- /package/dist/{esm/index.js → index.js} +0 -0
- /package/dist/{esm/index.js.map → index.js.map} +0 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BasicAuthMiddleware } from './middleware.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";exports.BasicAuthMiddleware=function(e){return async(t,a,r)=>{var s;const i=null!=(s=t.headers.authorization)?s:"",[n,u]=i.split(" "),o=Buffer.from(null!=u?u:"","base64").toString(),[c,d]=o.split(":");if("Basic"!==n||!c||!d||c!==e.username||d!==e.password)return a.setHeader("WWW-Authenticate",`Basic realm='${e.realm||"Secure Area"}'`),a.statusCode=401,void a.end("Unauthorized");await r()}};
|
|
2
|
+
//# sourceMappingURL=middleware.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.cjs","sources":["../src/middleware.ts"],"sourcesContent":["import type { RequestMiddleware } from 'blitz';\n\ninterface BasicAuthMiddlewareOptions {\n password: string;\n realm?: string;\n username: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function BasicAuthMiddleware(options: BasicAuthMiddlewareOptions): RequestMiddleware {\n return async (request, response, next) => {\n const authorizationHeader = request.headers.authorization ?? '';\n const [type, encodedCredentials] = authorizationHeader.split(' ');\n const credentials = Buffer.from(encodedCredentials ?? '', 'base64').toString();\n const [requestUsername, requestPassword] = credentials.split(':');\n\n if (\n type !== 'Basic' ||\n !requestUsername ||\n !requestPassword ||\n requestUsername !== options.username ||\n requestPassword !== options.password\n ) {\n response.setHeader('WWW-Authenticate', `Basic realm='${options.realm || 'Secure Area'}'`);\n response.statusCode = 401;\n response.end('Unauthorized');\n return;\n }\n\n await next();\n };\n}\n"],"names":["options","async","request","response","next","_request$headers$auth","authorizationHeader","headers","authorization","type","encodedCredentials","split","credentials","Buffer","from","toString","requestUsername","requestPassword","username","password","setHeader","realm","statusCode","end"],"mappings":"yCASO,SAA6BA,GAClC,OAAOC,MAAOC,EAASC,EAAUC,KAAS,IAAAC,EACxC,MAAMC,EAAmD,OAAhCD,EAAGH,EAAQK,QAAQC,eAAaH,EAAI,IACtDI,EAAMC,GAAsBJ,EAAoBK,MAAM,KACvDC,EAAcC,OAAOC,KAAuB,MAAlBJ,EAAAA,EAAsB,GAAI,UAAUK,YAC7DC,EAAiBC,GAAmBL,EAAYD,MAAM,KAE7D,GACW,UAATF,IACCO,IACAC,GACDD,IAAoBhB,EAAQkB,UAC5BD,IAAoBjB,EAAQmB,SAK5B,OAHAhB,EAASiB,UAAU,mBAAqB,gBAAepB,EAAQqB,OAAS,kBACxElB,EAASmB,WAAa,SACtBnB,EAASoB,IAAI,sBAITnB,GAAM,CAEhB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RequestMiddleware } from 'blitz';
|
|
2
|
+
interface BasicAuthMiddlewareOptions {
|
|
3
|
+
password: string;
|
|
4
|
+
realm?: string;
|
|
5
|
+
username: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function BasicAuthMiddleware(options: BasicAuthMiddlewareOptions): RequestMiddleware;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e){return async(a,r,t)=>{var n;const s=null!=(n=a.headers.authorization)?n:"",[i,u]=s.split(" "),o=Buffer.from(null!=u?u:"","base64").toString(),[l,c]=o.split(":");if("Basic"!==i||!l||!c||l!==e.username||c!==e.password)return r.setHeader("WWW-Authenticate",`Basic realm='${e.realm||"Secure Area"}'`),r.statusCode=401,void r.end("Unauthorized");await t()}}export{e as BasicAuthMiddleware};
|
|
2
|
+
//# sourceMappingURL=middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.js","sources":["../src/middleware.ts"],"sourcesContent":["import type { RequestMiddleware } from 'blitz';\n\ninterface BasicAuthMiddlewareOptions {\n password: string;\n realm?: string;\n username: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function BasicAuthMiddleware(options: BasicAuthMiddlewareOptions): RequestMiddleware {\n return async (request, response, next) => {\n const authorizationHeader = request.headers.authorization ?? '';\n const [type, encodedCredentials] = authorizationHeader.split(' ');\n const credentials = Buffer.from(encodedCredentials ?? '', 'base64').toString();\n const [requestUsername, requestPassword] = credentials.split(':');\n\n if (\n type !== 'Basic' ||\n !requestUsername ||\n !requestPassword ||\n requestUsername !== options.username ||\n requestPassword !== options.password\n ) {\n response.setHeader('WWW-Authenticate', `Basic realm='${options.realm || 'Secure Area'}'`);\n response.statusCode = 401;\n response.end('Unauthorized');\n return;\n }\n\n await next();\n };\n}\n"],"names":["BasicAuthMiddleware","options","async","request","response","next","_request$headers$auth","authorizationHeader","headers","authorization","type","encodedCredentials","split","credentials","Buffer","from","toString","requestUsername","requestPassword","username","password","setHeader","realm","statusCode","end"],"mappings":"AASO,SAASA,EAAoBC,GAClC,OAAOC,MAAOC,EAASC,EAAUC,KAAS,IAAAC,EACxC,MAAMC,EAAmD,OAAhCD,EAAGH,EAAQK,QAAQC,eAAaH,EAAI,IACtDI,EAAMC,GAAsBJ,EAAoBK,MAAM,KACvDC,EAAcC,OAAOC,KAAuB,MAAlBJ,EAAAA,EAAsB,GAAI,UAAUK,YAC7DC,EAAiBC,GAAmBL,EAAYD,MAAM,KAE7D,GACW,UAATF,IACCO,IACAC,GACDD,IAAoBhB,EAAQkB,UAC5BD,IAAoBjB,EAAQmB,SAK5B,OAHAhB,EAASiB,UAAU,mBAAqB,gBAAepB,EAAQqB,OAAS,kBACxElB,EAASmB,WAAa,SACtBnB,EAASoB,IAAI,sBAITnB,GAAM,CAEhB"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/shared-lib-blitz-next",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "WillBooster Inc.",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"type": "module",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"require": "./dist/
|
|
11
|
-
"import": "./dist/
|
|
12
|
-
"types": "./dist/
|
|
10
|
+
"require": "./dist/index.cjs",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
13
|
},
|
|
14
14
|
"./src": {
|
|
15
15
|
"require": "./src/index.ts",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"types": "./src/index.ts"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
"main": "dist/
|
|
21
|
-
"module": "dist/
|
|
22
|
-
"types": "dist/
|
|
20
|
+
"main": "dist/index.cjs",
|
|
21
|
+
"module": "dist/index.js",
|
|
22
|
+
"types": "dist/index.d.ts",
|
|
23
23
|
"files": [
|
|
24
24
|
"bin/",
|
|
25
25
|
"dist/"
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/eslint": "8.44.2",
|
|
40
40
|
"@types/micromatch": "4.0.2",
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
42
|
-
"@typescript-eslint/parser": "6.
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "6.7.0",
|
|
42
|
+
"@typescript-eslint/parser": "6.7.0",
|
|
43
43
|
"@willbooster/eslint-config-ts": "10.5.0",
|
|
44
44
|
"@willbooster/prettier-config": "9.1.1",
|
|
45
|
-
"blitz": "2.0.0-beta.
|
|
46
|
-
"build-ts": "
|
|
47
|
-
"eslint": "8.
|
|
45
|
+
"blitz": "2.0.0-beta.33",
|
|
46
|
+
"build-ts": "9.1.4",
|
|
47
|
+
"eslint": "8.49.0",
|
|
48
48
|
"eslint-config-prettier": "9.0.0",
|
|
49
49
|
"eslint-import-resolver-typescript": "3.6.0",
|
|
50
50
|
"eslint-plugin-import": "2.28.1",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"eslint-plugin-unicorn": "48.0.1",
|
|
54
54
|
"lint-staged": "14.0.1",
|
|
55
55
|
"micromatch": "4.0.5",
|
|
56
|
-
"prettier": "3.0.
|
|
56
|
+
"prettier": "3.0.3",
|
|
57
57
|
"sort-package-json": "2.5.1",
|
|
58
|
-
"typescript": "5.
|
|
59
|
-
"vitest": "0.34.
|
|
58
|
+
"typescript": "5.2.2",
|
|
59
|
+
"vitest": "0.34.4"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
package/dist/cjs/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { BasicAuthMiddleware } from "./middleware.js";
|
package/dist/cjs/middleware.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";exports.BasicAuthMiddleware=function(e){return async(t,a,r)=>{var s;const i=null!==(s=t.headers.authorization)&&void 0!==s?s:"",[n,u]=i.split(" "),o=Buffer.from(null!=u?u:"","base64").toString(),[d,c]=o.split(":");if("Basic"!==n||!d||!c||d!==e.username||c!==e.password)return a.setHeader("WWW-Authenticate",`Basic realm='${e.realm||"Secure Area"}'`),a.statusCode=401,void a.end("Unauthorized");await r()}};
|
|
2
|
-
//# sourceMappingURL=middleware.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.cjs","sources":["../../src/middleware.ts"],"sourcesContent":["import type { RequestMiddleware } from 'blitz';\n\ninterface BasicAuthMiddlewareOptions {\n password: string;\n realm?: string;\n username: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function BasicAuthMiddleware(options: BasicAuthMiddlewareOptions): RequestMiddleware {\n return async (request, response, next) => {\n const authorizationHeader = request.headers.authorization ?? '';\n const [type, encodedCredentials] = authorizationHeader.split(' ');\n const credentials = Buffer.from(encodedCredentials ?? '', 'base64').toString();\n const [requestUsername, requestPassword] = credentials.split(':');\n\n if (\n type !== 'Basic' ||\n !requestUsername ||\n !requestPassword ||\n requestUsername !== options.username ||\n requestPassword !== options.password\n ) {\n response.setHeader('WWW-Authenticate', `Basic realm='${options.realm || 'Secure Area'}'`);\n response.statusCode = 401;\n response.end('Unauthorized');\n return;\n }\n\n await next();\n };\n}\n"],"names":["options","async","request","response","next","_request$headers$auth","authorizationHeader","headers","authorization","type","encodedCredentials","split","credentials","Buffer","from","toString","requestUsername","requestPassword","username","password","setHeader","realm","statusCode","end"],"mappings":"yCASO,SAA6BA,GAClC,OAAOC,MAAOC,EAASC,EAAUC,KAAS,IAAAC,EACxC,MAAMC,EAAmDD,QAAhCA,EAAGH,EAAQK,QAAQC,qBAAaH,IAAAA,EAAAA,EAAI,IACtDI,EAAMC,GAAsBJ,EAAoBK,MAAM,KACvDC,EAAcC,OAAOC,KAAKJ,QAAAA,EAAsB,GAAI,UAAUK,YAC7DC,EAAiBC,GAAmBL,EAAYD,MAAM,KAE7D,GACW,UAATF,IACCO,IACAC,GACDD,IAAoBhB,EAAQkB,UAC5BD,IAAoBjB,EAAQmB,SAK5B,OAHAhB,EAASiB,UAAU,mBAAqB,gBAAepB,EAAQqB,OAAS,kBACxElB,EAASmB,WAAa,SACtBnB,EAASoB,IAAI,sBAITnB,GAAM,CAEhB"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { RequestMiddleware } from 'blitz';
|
|
2
|
-
interface BasicAuthMiddlewareOptions {
|
|
3
|
-
password: string;
|
|
4
|
-
realm?: string;
|
|
5
|
-
username: string;
|
|
6
|
-
}
|
|
7
|
-
declare function BasicAuthMiddleware(options: BasicAuthMiddlewareOptions): RequestMiddleware;
|
|
8
|
-
export { BasicAuthMiddleware };
|
package/dist/esm/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { BasicAuthMiddleware } from "./middleware.js";
|
package/dist/esm/middleware.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { RequestMiddleware } from 'blitz';
|
|
2
|
-
interface BasicAuthMiddlewareOptions {
|
|
3
|
-
password: string;
|
|
4
|
-
realm?: string;
|
|
5
|
-
username: string;
|
|
6
|
-
}
|
|
7
|
-
declare function BasicAuthMiddleware(options: BasicAuthMiddlewareOptions): RequestMiddleware;
|
|
8
|
-
export { BasicAuthMiddleware };
|
package/dist/esm/middleware.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function e(e){return async(a,r,t)=>{var i;const n=null!==(i=a.headers.authorization)&&void 0!==i?i:"",[s,o]=n.split(" "),u=Buffer.from(null!=o?o:"","base64").toString(),[d,l]=u.split(":");if("Basic"!==s||!d||!l||d!==e.username||l!==e.password)return r.setHeader("WWW-Authenticate",`Basic realm='${e.realm||"Secure Area"}'`),r.statusCode=401,void r.end("Unauthorized");await t()}}export{e as BasicAuthMiddleware};
|
|
2
|
-
//# sourceMappingURL=middleware.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.js","sources":["../../src/middleware.ts"],"sourcesContent":["import type { RequestMiddleware } from 'blitz';\n\ninterface BasicAuthMiddlewareOptions {\n password: string;\n realm?: string;\n username: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function BasicAuthMiddleware(options: BasicAuthMiddlewareOptions): RequestMiddleware {\n return async (request, response, next) => {\n const authorizationHeader = request.headers.authorization ?? '';\n const [type, encodedCredentials] = authorizationHeader.split(' ');\n const credentials = Buffer.from(encodedCredentials ?? '', 'base64').toString();\n const [requestUsername, requestPassword] = credentials.split(':');\n\n if (\n type !== 'Basic' ||\n !requestUsername ||\n !requestPassword ||\n requestUsername !== options.username ||\n requestPassword !== options.password\n ) {\n response.setHeader('WWW-Authenticate', `Basic realm='${options.realm || 'Secure Area'}'`);\n response.statusCode = 401;\n response.end('Unauthorized');\n return;\n }\n\n await next();\n };\n}\n"],"names":["BasicAuthMiddleware","options","async","request","response","next","_request$headers$auth","authorizationHeader","headers","authorization","type","encodedCredentials","split","credentials","Buffer","from","toString","requestUsername","requestPassword","username","password","setHeader","realm","statusCode","end"],"mappings":"AASO,SAASA,EAAoBC,GAClC,OAAOC,MAAOC,EAASC,EAAUC,KAAS,IAAAC,EACxC,MAAMC,EAAmDD,QAAhCA,EAAGH,EAAQK,QAAQC,qBAAaH,IAAAA,EAAAA,EAAI,IACtDI,EAAMC,GAAsBJ,EAAoBK,MAAM,KACvDC,EAAcC,OAAOC,KAAKJ,QAAAA,EAAsB,GAAI,UAAUK,YAC7DC,EAAiBC,GAAmBL,EAAYD,MAAM,KAE7D,GACW,UAATF,IACCO,IACAC,GACDD,IAAoBhB,EAAQkB,UAC5BD,IAAoBjB,EAAQmB,SAK5B,OAHAhB,EAASiB,UAAU,mBAAqB,gBAAepB,EAAQqB,OAAS,kBACxElB,EAASmB,WAAa,SACtBnB,EAASoB,IAAI,sBAITnB,GAAM,CAEhB"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|