@willbooster/shared-lib-blitz-next 2.1.17 → 2.1.19
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/middleware.cjs.map +1 -1
- package/dist/middleware.js.map +1 -1
- package/package.json +15 -12
package/dist/middleware.cjs.map
CHANGED
|
@@ -1 +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\
|
|
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\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":"yCAQO,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,mBAAoB,gBAAgBpB,EAAQqB,OAAS,kBACxElB,EAASmB,WAAa,SACtBnB,EAASoB,IAAI,sBAITnB,GAAM,CAEhB"}
|
package/dist/middleware.js.map
CHANGED
|
@@ -1 +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\
|
|
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\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":"AAQO,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,mBAAoB,gBAAgBpB,EAAQqB,OAAS,kBACxElB,EAASmB,WAAa,SACtBnB,EAASoB,IAAI,sBAITnB,GAAM,CAEhB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/shared-lib-blitz-next",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.19",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "WillBooster Inc.",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -26,9 +26,10 @@
|
|
|
26
26
|
],
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "build-ts lib",
|
|
29
|
+
"check-all": "yarn cleanup && yarn typecheck && yarn test",
|
|
29
30
|
"cleanup": "yarn format && yarn lint-fix",
|
|
30
31
|
"format": "sort-package-json && yarn prettify",
|
|
31
|
-
"lint": "eslint --color
|
|
32
|
+
"lint": "eslint --color",
|
|
32
33
|
"lint-fix": "yarn lint --fix",
|
|
33
34
|
"prettify": "prettier --cache --color --write \"**/{.*/,}*.{cjs,css,cts,htm,html,js,json,json5,jsonc,jsx,md,mjs,mts,scss,ts,tsx,vue,yaml,yml}\" \"!**/test-fixtures/**\"",
|
|
34
35
|
"test": "vitest",
|
|
@@ -38,24 +39,26 @@
|
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@types/eslint": "8.56.10",
|
|
40
41
|
"@types/micromatch": "4.0.9",
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@willbooster/eslint-config-ts": "10.6.1",
|
|
44
|
-
"@willbooster/prettier-config": "9.1.3",
|
|
42
|
+
"@willbooster/eslint-config-ts": "11.2.0",
|
|
43
|
+
"@willbooster/prettier-config": "10.0.0",
|
|
45
44
|
"blitz": "2.1.3",
|
|
46
|
-
"build-ts": "13.1.
|
|
47
|
-
"eslint": "
|
|
45
|
+
"build-ts": "13.1.39",
|
|
46
|
+
"eslint": "9.25.0",
|
|
47
|
+
"eslint-config-flat-gitignore": "2.1.0",
|
|
48
48
|
"eslint-config-prettier": "10.1.2",
|
|
49
|
-
"eslint-import-resolver-typescript": "3.
|
|
50
|
-
"eslint-plugin-import": "
|
|
49
|
+
"eslint-import-resolver-typescript": "4.3.2",
|
|
50
|
+
"eslint-plugin-import-x": "4.10.5",
|
|
51
51
|
"eslint-plugin-sort-class-members": "1.21.0",
|
|
52
52
|
"eslint-plugin-sort-destructure-keys": "2.0.0",
|
|
53
|
-
"eslint-plugin-unicorn": "
|
|
53
|
+
"eslint-plugin-unicorn": "58.0.0",
|
|
54
|
+
"eslint-plugin-unused-imports": "4.1.4",
|
|
55
|
+
"globals": "16.0.0",
|
|
54
56
|
"lint-staged": "15.5.1",
|
|
55
57
|
"micromatch": "4.0.8",
|
|
56
58
|
"prettier": "3.5.3",
|
|
57
|
-
"sort-package-json": "
|
|
59
|
+
"sort-package-json": "3.0.0",
|
|
58
60
|
"typescript": "5.8.3",
|
|
61
|
+
"typescript-eslint": "8.30.1",
|
|
59
62
|
"vitest": "3.1.1"
|
|
60
63
|
},
|
|
61
64
|
"publishConfig": {
|