@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.
@@ -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.5",
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/cjs/index.cjs",
11
- "import": "./dist/esm/index.js",
12
- "types": "./dist/esm/index.d.ts"
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/cjs/index.cjs",
21
- "module": "dist/esm/index.js",
22
- "types": "dist/esm/index.d.ts",
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.4.1",
42
- "@typescript-eslint/parser": "6.4.1",
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.32",
46
- "build-ts": "8.2.2",
47
- "eslint": "8.47.0",
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.2",
56
+ "prettier": "3.0.3",
57
57
  "sort-package-json": "2.5.1",
58
- "typescript": "5.1.6",
59
- "vitest": "0.34.2"
58
+ "typescript": "5.2.2",
59
+ "vitest": "0.34.4"
60
60
  },
61
61
  "publishConfig": {
62
62
  "access": "public"
@@ -1 +0,0 @@
1
- export { BasicAuthMiddleware } from "./middleware.js";
@@ -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 };
@@ -1 +0,0 @@
1
- export { BasicAuthMiddleware } from "./middleware.js";
@@ -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 };
@@ -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