@thisisagile/easy-express 15.8.4 → 15.8.6
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.mts +59 -0
- package/dist/index.d.ts +59 -2
- package/dist/index.js +1 -19
- package/dist/index.mjs +1 -0
- package/package.json +5 -3
- package/dist/express/AuthError.d.ts +0 -7
- package/dist/express/AuthError.js +0 -17
- package/dist/express/AuthError.js.map +0 -1
- package/dist/express/CorrelationHandler.d.ts +0 -2
- package/dist/express/CorrelationHandler.js +0 -10
- package/dist/express/CorrelationHandler.js.map +0 -1
- package/dist/express/ErrorHandler.d.ts +0 -3
- package/dist/express/ErrorHandler.js +0 -31
- package/dist/express/ErrorHandler.js.map +0 -1
- package/dist/express/ExpressProvider.d.ts +0 -17
- package/dist/express/ExpressProvider.js +0 -74
- package/dist/express/ExpressProvider.js.map +0 -1
- package/dist/express/NotFoundHandler.d.ts +0 -2
- package/dist/express/NotFoundHandler.js +0 -9
- package/dist/express/NotFoundHandler.js.map +0 -1
- package/dist/express/RequestContextHandler.d.ts +0 -2
- package/dist/express/RequestContextHandler.js +0 -7
- package/dist/express/RequestContextHandler.js.map +0 -1
- package/dist/express/SecurityHandler.d.ts +0 -19
- package/dist/express/SecurityHandler.js +0 -43
- package/dist/express/SecurityHandler.js.map +0 -1
- package/dist/express/index.d.ts +0 -7
- package/dist/express/index.js +0 -24
- package/dist/express/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types/NamespaceContext.d.ts +0 -7
- package/dist/types/NamespaceContext.js +0 -20
- package/dist/types/NamespaceContext.js.map +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +0 -18
- package/dist/types/index.js.map +0 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { HttpStatus, AppProvider, Handler, Service, Resource, RouteRequires, Endpoint, VerbOptions, Scope, UseCase, BaseRequestContext } from '@thisisagile/easy';
|
|
2
|
+
import express, { Express, RequestHandler, Response, Request, NextFunction } from 'express';
|
|
3
|
+
import * as cls_hooked from 'cls-hooked';
|
|
4
|
+
|
|
5
|
+
declare class AuthError extends Error {
|
|
6
|
+
status: number;
|
|
7
|
+
constructor({ name, status }: HttpStatus);
|
|
8
|
+
}
|
|
9
|
+
declare const authError: (status: HttpStatus) => AuthError;
|
|
10
|
+
declare const isAuthError: (e?: unknown) => e is AuthError;
|
|
11
|
+
|
|
12
|
+
declare const correlation: (req: express.Request, res: express.Response, next: express.NextFunction) => void;
|
|
13
|
+
|
|
14
|
+
declare const error: (e: Error, req: express.Request, res: express.Response, _next: express.NextFunction) => void;
|
|
15
|
+
|
|
16
|
+
type ExpressVerb = "get" | "post" | "put" | "patch" | "delete";
|
|
17
|
+
declare class ExpressProvider implements AppProvider {
|
|
18
|
+
protected app: Express;
|
|
19
|
+
constructor(app?: Express);
|
|
20
|
+
use: (handler: Handler) => void;
|
|
21
|
+
route: (service: Service, resource: Resource) => void;
|
|
22
|
+
listen: (port: number, message?: string) => void;
|
|
23
|
+
protected addSecurityMiddleware(requires: RouteRequires): RequestHandler[];
|
|
24
|
+
protected handle: (endpoint: Endpoint, options?: VerbOptions) => RequestHandler;
|
|
25
|
+
protected toResponse(res: Response, result: unknown, options: Required<VerbOptions>): void;
|
|
26
|
+
protected json(res: Response, result: unknown, options: Required<VerbOptions>): void;
|
|
27
|
+
protected stream(res: Response, result: unknown): void;
|
|
28
|
+
protected text(res: Response, data: unknown): void;
|
|
29
|
+
}
|
|
30
|
+
declare const service: (name: string) => Service;
|
|
31
|
+
|
|
32
|
+
declare const notFound: (req: Request, res: Response, next: NextFunction) => void;
|
|
33
|
+
|
|
34
|
+
declare const requestContext: (req: express.Request, res: express.Response, next: express.NextFunction) => void;
|
|
35
|
+
|
|
36
|
+
type SecretOrKeyProvider = (request: Request, rawJwtToken: any) => Promise<string | Buffer>;
|
|
37
|
+
interface SecurityOptions {
|
|
38
|
+
jwtStrategyOptions?: {
|
|
39
|
+
secretOrKey?: string | Buffer;
|
|
40
|
+
secretOrKeyProvider?: SecretOrKeyProvider;
|
|
41
|
+
issuer?: string;
|
|
42
|
+
audience?: string;
|
|
43
|
+
algorithms?: string[];
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
declare const checkLabCoat: () => RequestHandler;
|
|
47
|
+
declare const checkToken: () => RequestHandler;
|
|
48
|
+
declare const checkScope: (scope: Scope) => RequestHandler;
|
|
49
|
+
declare const checkUseCase: (uc: UseCase) => RequestHandler;
|
|
50
|
+
declare const security: ({ jwtStrategyOptions }?: SecurityOptions) => (req: express.Request, res: express.Response, next: express.NextFunction) => void;
|
|
51
|
+
|
|
52
|
+
declare class NamespaceContext extends BaseRequestContext {
|
|
53
|
+
protected readonly namespace: cls_hooked.Namespace<Record<string, any>>;
|
|
54
|
+
get<T>(key: string): T;
|
|
55
|
+
set<T>(key: string, value: T): T;
|
|
56
|
+
readonly create: (f: () => void) => void;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { AuthError, ExpressProvider, ExpressVerb, NamespaceContext, SecurityOptions, authError, checkLabCoat, checkScope, checkToken, checkUseCase, correlation, error, isAuthError, notFound, requestContext, security, service };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { HttpStatus, AppProvider, Handler, Service, Resource, RouteRequires, Endpoint, VerbOptions, Scope, UseCase, BaseRequestContext } from '@thisisagile/easy';
|
|
2
|
+
import express, { Express, RequestHandler, Response, Request, NextFunction } from 'express';
|
|
3
|
+
import * as cls_hooked from 'cls-hooked';
|
|
4
|
+
|
|
5
|
+
declare class AuthError extends Error {
|
|
6
|
+
status: number;
|
|
7
|
+
constructor({ name, status }: HttpStatus);
|
|
8
|
+
}
|
|
9
|
+
declare const authError: (status: HttpStatus) => AuthError;
|
|
10
|
+
declare const isAuthError: (e?: unknown) => e is AuthError;
|
|
11
|
+
|
|
12
|
+
declare const correlation: (req: express.Request, res: express.Response, next: express.NextFunction) => void;
|
|
13
|
+
|
|
14
|
+
declare const error: (e: Error, req: express.Request, res: express.Response, _next: express.NextFunction) => void;
|
|
15
|
+
|
|
16
|
+
type ExpressVerb = "get" | "post" | "put" | "patch" | "delete";
|
|
17
|
+
declare class ExpressProvider implements AppProvider {
|
|
18
|
+
protected app: Express;
|
|
19
|
+
constructor(app?: Express);
|
|
20
|
+
use: (handler: Handler) => void;
|
|
21
|
+
route: (service: Service, resource: Resource) => void;
|
|
22
|
+
listen: (port: number, message?: string) => void;
|
|
23
|
+
protected addSecurityMiddleware(requires: RouteRequires): RequestHandler[];
|
|
24
|
+
protected handle: (endpoint: Endpoint, options?: VerbOptions) => RequestHandler;
|
|
25
|
+
protected toResponse(res: Response, result: unknown, options: Required<VerbOptions>): void;
|
|
26
|
+
protected json(res: Response, result: unknown, options: Required<VerbOptions>): void;
|
|
27
|
+
protected stream(res: Response, result: unknown): void;
|
|
28
|
+
protected text(res: Response, data: unknown): void;
|
|
29
|
+
}
|
|
30
|
+
declare const service: (name: string) => Service;
|
|
31
|
+
|
|
32
|
+
declare const notFound: (req: Request, res: Response, next: NextFunction) => void;
|
|
33
|
+
|
|
34
|
+
declare const requestContext: (req: express.Request, res: express.Response, next: express.NextFunction) => void;
|
|
35
|
+
|
|
36
|
+
type SecretOrKeyProvider = (request: Request, rawJwtToken: any) => Promise<string | Buffer>;
|
|
37
|
+
interface SecurityOptions {
|
|
38
|
+
jwtStrategyOptions?: {
|
|
39
|
+
secretOrKey?: string | Buffer;
|
|
40
|
+
secretOrKeyProvider?: SecretOrKeyProvider;
|
|
41
|
+
issuer?: string;
|
|
42
|
+
audience?: string;
|
|
43
|
+
algorithms?: string[];
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
declare const checkLabCoat: () => RequestHandler;
|
|
47
|
+
declare const checkToken: () => RequestHandler;
|
|
48
|
+
declare const checkScope: (scope: Scope) => RequestHandler;
|
|
49
|
+
declare const checkUseCase: (uc: UseCase) => RequestHandler;
|
|
50
|
+
declare const security: ({ jwtStrategyOptions }?: SecurityOptions) => (req: express.Request, res: express.Response, next: express.NextFunction) => void;
|
|
51
|
+
|
|
52
|
+
declare class NamespaceContext extends BaseRequestContext {
|
|
53
|
+
protected readonly namespace: cls_hooked.Namespace<Record<string, any>>;
|
|
54
|
+
get<T>(key: string): T;
|
|
55
|
+
set<T>(key: string, value: T): T;
|
|
56
|
+
readonly create: (f: () => void) => void;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { AuthError, ExpressProvider, ExpressVerb, NamespaceContext, SecurityOptions, authError, checkLabCoat, checkScope, checkToken, checkUseCase, correlation, error, isAuthError, notFound, requestContext, security, service };
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./express"), exports);
|
|
18
|
-
__exportStar(require("./types"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";var B=Object.create;var x=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty;var j=(t,e)=>{for(var r in e)x(t,r,{get:e[r],enumerable:!0})},O=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of L(e))!J.call(t,n)&&n!==r&&x(t,n,{get:()=>e[n],enumerable:!(o=V(e,n))||o.enumerable});return t};var w=(t,e,r)=>(r=t!=null?B(U(t)):{},O(e||!t||!t.__esModule?x(r,"default",{value:t,enumerable:!0}):r,t)),D=t=>O(x({},"__esModule",{value:!0}),t);var X={};j(X,{AuthError:()=>R,ExpressProvider:()=>h,NamespaceContext:()=>H,authError:()=>m,checkLabCoat:()=>v,checkScope:()=>S,checkToken:()=>g,checkUseCase:()=>k,correlation:()=>I,error:()=>z,isAuthError:()=>E,notFound:()=>G,requestContext:()=>Q,security:()=>_,service:()=>$});module.exports=D(X);var F=require("@thisisagile/easy"),R=class extends Error{status;constructor({name:e,status:r}){super(e),this.name="AuthenticationError",this.status=r}},m=t=>new R(t),E=t=>(0,F.isError)(t)&&t.name==="AuthenticationError";var d=require("@thisisagile/easy"),I=(t,e,r)=>{e.setHeader(d.HttpHeader.Correlation,d.ctx.request.correlationId=t?.header(d.HttpHeader.Correlation)??(0,d.toUuid)()),r()};var s=require("@thisisagile/easy"),u=(t,e=[])=>({status:t,body:s.rest.toError(t,e)}),M=({origin:t,options:e})=>(0,s.choose)(t).type(E,r=>u((0,s.toHttpStatus)(r.status),[(0,s.toResult)(r.message)])).type(s.isDoesNotExist,r=>u(e?.onNotFound??s.HttpStatus.NotFound,[(0,s.toResult)(r.reason??r.message)])).type(s.isError,r=>u(s.HttpStatus.InternalServerError,[(0,s.toResult)(r.message)])).type(s.isResults,r=>u(e?.onError??s.HttpStatus.BadRequest,r.results)).type(s.isResponse,r=>u(s.HttpStatus.InternalServerError,r.body.error?.errors)).type(s.isException,r=>u(e?.onError??s.HttpStatus.BadRequest,[(0,s.toResult)(r.reason??r.message)])).type(s.isText,r=>u(e?.onError??s.HttpStatus.BadRequest,[(0,s.toResult)((0,s.asString)(r))])).else(()=>u(s.HttpStatus.InternalServerError,[(0,s.toResult)("Unknown error")])),z=(t,e,r,o)=>{let n;(0,s.tryTo)(()=>(0,s.toOriginatedError)(t)).map(i=>M(i)).accept(i=>n=i).accept(i=>s.ctx.request.lastError=i.status.isServerError?i.body.error?.errors[0]?.message:void 0).recover(()=>n).accept(i=>r.status(i.status.status).json(i.body))};var b=w(require("express"));var f=w(require("passport")),l=require("passport-jwt");var p=require("@thisisagile/easy"),v=()=>(t,e,r)=>r((0,p.ifFalse)(p.Environment.Dev.equals(p.ctx.env.name),m(p.HttpStatus.Forbidden))),g=()=>f.default.authenticate("jwt",{session:!1,failWithError:!0}),S=t=>(e,r,o)=>o((0,p.ifFalse)(e.user?.scopes?.includes(t.id),m(p.HttpStatus.Forbidden))),k=t=>(e,r,o)=>o((0,p.ifFalse)(e.user?.usecases?.includes(t.id),m(p.HttpStatus.Forbidden))),W=t=>t?(e,r,o)=>t(e,r).then(n=>o(null,n)).catch(n=>o(n)):void 0,_=({jwtStrategyOptions:t}={})=>{let e={jwtFromRequest:l.ExtractJwt.fromAuthHeaderAsBearerToken(),secretOrKey:t?.secretOrKey??(t?.secretOrKeyProvider?void 0:p.ctx.env.get("tokenPublicKey")),secretOrKeyProvider:W(t?.secretOrKeyProvider),issuer:t?.issuer,audience:t?.audience,algorithms:t?.algorithms,passReqToCallback:!0},r=new l.Strategy(e,(o,n,i)=>{p.ctx.request.token=n,p.ctx.request.jwt=l.ExtractJwt.fromAuthHeaderAsBearerToken()(o)??"",i(null,n)});return f.default.use(r),f.default.initialize()};var a=require("@thisisagile/easy"),h=class{constructor(e=(0,b.default)()){this.app=e;this.app.set("trust proxy",["loopback","linklocal","uniquelocal"])}use=e=>{this.app.use(e)};route=(e,r)=>{let{route:o,endpoints:n,middleware:i}=(0,a.routes)(r),c=b.default.Router({mergeParams:!0});(0,a.isEmpty)(i)||c.all(o.route(e.name),i),n.forEach(({endpoint:K,verb:q,requires:N,middleware:A})=>{console.log(q.verb.code,o.route(e.name)),c[q.verb.toString()](o.route(e.name),...this.addSecurityMiddleware(N),...A,this.handle(K,q.options))}),this.app.use(c)};listen=(e,r=`Service is listening on port ${e}.`)=>{this.app.listen(e,()=>{console.log(r)})};addSecurityMiddleware(e){let r=[];return e.labCoat&&r.push(v()),e.token&&r.push(g()),e.scope&&r.push(S(e.scope)),e.uc&&r.push(k(e.uc)),r}handle=(e,r)=>(o,n,i)=>e((0,a.toReq)(o)).then(c=>this.toResponse(n,c,(0,a.toVerbOptions)(r))).catch(c=>i((0,a.toOriginatedError)(c,r)));toResponse(e,r,o){e.status(o.onOk.status),e.type(o.type.code),o.cache.enabled&&e.setHeader(o.cache.name,o.cache.value()),(this[o.type.name]??this.json)(e,r,o)}json(e,r,o){a.HttpStatus.NoContent.equals(o.onOk)?e.send():e.json(a.rest.toData(o.onOk,(0,a.toList)(r),r?.total,r?.meta))}stream(e,r){e.end(r)}text(e,r){e.send(r)}},$=t=>new a.Service(t,new h);var y=require("@thisisagile/easy"),G=(t,e,r)=>{r((0,y.toOriginatedError)(y.Exception.DoesNotExist))};var P=require("@thisisagile/easy"),Q=(t,e,r)=>P.ctx.request.create(()=>r());var T=require("cls-hooked"),C=require("@thisisagile/easy"),H=class extends C.BaseRequestContext{namespace=(0,T.createNamespace)("context");get(e){return this.namespace.get(e)}set(e,r){return this.namespace.set(e,r)}create=e=>this.namespace.run(e)};0&&(module.exports={AuthError,ExpressProvider,NamespaceContext,authError,checkLabCoat,checkScope,checkToken,checkUseCase,correlation,error,isAuthError,notFound,requestContext,security,service});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isError as P}from"@thisisagile/easy";var l=class extends Error{status;constructor({name:e,status:r}){super(e),this.name="AuthenticationError",this.status=r}},c=t=>new l(t),y=t=>P(t)&&t.name==="AuthenticationError";import{ctx as T,HttpHeader as q,toUuid as C}from"@thisisagile/easy";var xe=(t,e,r)=>{e.setHeader(q.Correlation,T.request.correlationId=t?.header(q.Correlation)??C()),r()};import{asString as K,choose as N,ctx as A,HttpStatus as p,isDoesNotExist as B,isError as V,isException as L,isResponse as U,isResults as J,isText as j,rest as D,toHttpStatus as I,toOriginatedError as M,toResult as u,tryTo as z}from"@thisisagile/easy";var a=(t,e=[])=>({status:t,body:D.toError(t,e)}),W=({origin:t,options:e})=>N(t).type(y,r=>a(I(r.status),[u(r.message)])).type(B,r=>a(e?.onNotFound??p.NotFound,[u(r.reason??r.message)])).type(V,r=>a(p.InternalServerError,[u(r.message)])).type(J,r=>a(e?.onError??p.BadRequest,r.results)).type(U,r=>a(p.InternalServerError,r.body.error?.errors)).type(L,r=>a(e?.onError??p.BadRequest,[u(r.reason??r.message)])).type(j,r=>a(e?.onError??p.BadRequest,[u(K(r))])).else(()=>a(p.InternalServerError,[u("Unknown error")])),ve=(t,e,r,s)=>{let n;z(()=>M(t)).map(o=>W(o)).accept(o=>n=o).accept(o=>A.request.lastError=o.status.isServerError?o.body.error?.errors[0]?.message:void 0).recover(()=>n).accept(o=>r.status(o.status.status).json(o.body))};import b from"express";import x from"passport";import{ExtractJwt as E,Strategy as _}from"passport-jwt";import{ctx as d,Environment as $,HttpStatus as R,ifFalse as f}from"@thisisagile/easy";var v=()=>(t,e,r)=>r(f($.Dev.equals(d.env.name),c(R.Forbidden))),g=()=>x.authenticate("jwt",{session:!1,failWithError:!0}),S=t=>(e,r,s)=>s(f(e.user?.scopes?.includes(t.id),c(R.Forbidden))),k=t=>(e,r,s)=>s(f(e.user?.usecases?.includes(t.id),c(R.Forbidden))),G=t=>t?(e,r,s)=>t(e,r).then(n=>s(null,n)).catch(n=>s(n)):void 0,Te=({jwtStrategyOptions:t}={})=>{let e={jwtFromRequest:E.fromAuthHeaderAsBearerToken(),secretOrKey:t?.secretOrKey??(t?.secretOrKeyProvider?void 0:d.env.get("tokenPublicKey")),secretOrKeyProvider:G(t?.secretOrKeyProvider),issuer:t?.issuer,audience:t?.audience,algorithms:t?.algorithms,passReqToCallback:!0},r=new _(e,(s,n,o)=>{d.request.token=n,d.request.jwt=E.fromAuthHeaderAsBearerToken()(s)??"",o(null,n)});return x.use(r),x.initialize()};import{HttpStatus as Q,isEmpty as X,rest as Y,routes as Z,Service as ee,toList as re,toOriginatedError as te,toReq as se,toVerbOptions as oe}from"@thisisagile/easy";var h=class{constructor(e=b()){this.app=e;this.app.set("trust proxy",["loopback","linklocal","uniquelocal"])}use=e=>{this.app.use(e)};route=(e,r)=>{let{route:s,endpoints:n,middleware:o}=Z(r),i=b.Router({mergeParams:!0});X(o)||i.all(s.route(e.name),o),n.forEach(({endpoint:O,verb:m,requires:w,middleware:F})=>{console.log(m.verb.code,s.route(e.name)),i[m.verb.toString()](s.route(e.name),...this.addSecurityMiddleware(w),...F,this.handle(O,m.options))}),this.app.use(i)};listen=(e,r=`Service is listening on port ${e}.`)=>{this.app.listen(e,()=>{console.log(r)})};addSecurityMiddleware(e){let r=[];return e.labCoat&&r.push(v()),e.token&&r.push(g()),e.scope&&r.push(S(e.scope)),e.uc&&r.push(k(e.uc)),r}handle=(e,r)=>(s,n,o)=>e(se(s)).then(i=>this.toResponse(n,i,oe(r))).catch(i=>o(te(i,r)));toResponse(e,r,s){e.status(s.onOk.status),e.type(s.type.code),s.cache.enabled&&e.setHeader(s.cache.name,s.cache.value()),(this[s.type.name]??this.json)(e,r,s)}json(e,r,s){Q.NoContent.equals(s.onOk)?e.send():e.json(Y.toData(s.onOk,re(r),r?.total,r?.meta))}stream(e,r){e.end(r)}text(e,r){e.send(r)}},Ge=t=>new ee(t,new h);import{Exception as ne,toOriginatedError as ae}from"@thisisagile/easy";var Ye=(t,e,r)=>{r(ae(ne.DoesNotExist))};import{ctx as ie}from"@thisisagile/easy";var rr=(t,e,r)=>ie.request.create(()=>r());import{createNamespace as pe}from"cls-hooked";import{BaseRequestContext as ue}from"@thisisagile/easy";var H=class extends ue{namespace=pe("context");get(e){return this.namespace.get(e)}set(e,r){return this.namespace.set(e,r)}create=e=>this.namespace.run(e)};export{l as AuthError,h as ExpressProvider,H as NamespaceContext,c as authError,v as checkLabCoat,S as checkScope,g as checkToken,k as checkUseCase,xe as correlation,ve as error,y as isAuthError,Ye as notFound,rr as requestContext,Te as security,Ge as service};
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thisisagile/easy-express",
|
|
3
|
-
"version": "15.8.
|
|
3
|
+
"version": "15.8.6",
|
|
4
4
|
"description": "Straightforward library for building domain-driven microservice architectures",
|
|
5
5
|
"author": "Sander Hoogendoorn",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.mjs",
|
|
8
9
|
"types": "dist/index",
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
@@ -20,6 +21,7 @@
|
|
|
20
21
|
"lint": "yarn g:eslint . --ext .js,.jsx,.ts,.tsx --fix",
|
|
21
22
|
"format": "yarn g:prettier --check --write src test *.json",
|
|
22
23
|
"build": "yarn g:tsc",
|
|
24
|
+
"build:tsup": "yarn g:tsup",
|
|
23
25
|
"test": "yarn g:jest --coverage",
|
|
24
26
|
"prepack": "yarn g:copy-readme"
|
|
25
27
|
},
|
|
@@ -31,7 +33,7 @@
|
|
|
31
33
|
"access": "public"
|
|
32
34
|
},
|
|
33
35
|
"devDependencies": {
|
|
34
|
-
"@thisisagile/easy-test": "15.8.
|
|
36
|
+
"@thisisagile/easy-test": "15.8.6",
|
|
35
37
|
"@types/cls-hooked": "^4.3.4",
|
|
36
38
|
"@types/form-urlencoded": "^4.4.0",
|
|
37
39
|
"@types/jsonwebtoken": "^9.0.2",
|
|
@@ -41,7 +43,7 @@
|
|
|
41
43
|
"@types/validator": "^13.7.17"
|
|
42
44
|
},
|
|
43
45
|
"dependencies": {
|
|
44
|
-
"@thisisagile/easy": "^15.8.
|
|
46
|
+
"@thisisagile/easy": "^15.8.6",
|
|
45
47
|
"@types/express": "^4.17.17",
|
|
46
48
|
"cls-hooked": "^4.2.2",
|
|
47
49
|
"express": "^4.18.2",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { HttpStatus } from '@thisisagile/easy';
|
|
2
|
-
export declare class AuthError extends Error {
|
|
3
|
-
status: number;
|
|
4
|
-
constructor({ name, status }: HttpStatus);
|
|
5
|
-
}
|
|
6
|
-
export declare const authError: (status: HttpStatus) => AuthError;
|
|
7
|
-
export declare const isAuthError: (e?: unknown) => e is AuthError;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAuthError = exports.authError = exports.AuthError = void 0;
|
|
4
|
-
const easy_1 = require("@thisisagile/easy");
|
|
5
|
-
class AuthError extends Error {
|
|
6
|
-
constructor({ name, status }) {
|
|
7
|
-
super(name);
|
|
8
|
-
this.name = 'AuthenticationError';
|
|
9
|
-
this.status = status;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.AuthError = AuthError;
|
|
13
|
-
const authError = (status) => new AuthError(status);
|
|
14
|
-
exports.authError = authError;
|
|
15
|
-
const isAuthError = (e) => (0, easy_1.isError)(e) && e.name === 'AuthenticationError';
|
|
16
|
-
exports.isAuthError = isAuthError;
|
|
17
|
-
//# sourceMappingURL=AuthError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthError.js","sourceRoot":"","sources":["../../src/express/AuthError.ts"],"names":[],"mappings":";;;AAAA,4CAAwD;AAExD,MAAa,SAAU,SAAQ,KAAK;IAGlC,YAAY,EAAE,IAAI,EAAE,MAAM,EAAc;QACtC,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AARD,8BAQC;AAEM,MAAM,SAAS,GAAG,CAAC,MAAkB,EAAa,EAAE,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;AAArE,QAAA,SAAS,aAA4D;AAE3E,MAAM,WAAW,GAAG,CAAC,CAAW,EAAkB,EAAE,CAAC,IAAA,cAAO,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,qBAAqB,CAAC;AAA9F,QAAA,WAAW,eAAmF"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.correlation = void 0;
|
|
4
|
-
const easy_1 = require("@thisisagile/easy");
|
|
5
|
-
const correlation = (req, res, next) => {
|
|
6
|
-
res.setHeader(easy_1.HttpHeader.Correlation, (easy_1.ctx.request.correlationId = req?.header(easy_1.HttpHeader.Correlation) ?? (0, easy_1.toUuid)()));
|
|
7
|
-
next();
|
|
8
|
-
};
|
|
9
|
-
exports.correlation = correlation;
|
|
10
|
-
//# sourceMappingURL=CorrelationHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CorrelationHandler.js","sourceRoot":"","sources":["../../src/express/CorrelationHandler.ts"],"names":[],"mappings":";;;AACA,4CAA4D;AAErD,MAAM,WAAW,GAAG,CAAC,GAAoB,EAAE,GAAqB,EAAE,IAA0B,EAAQ,EAAE;IAC3G,GAAG,CAAC,SAAS,CAAC,iBAAU,CAAC,WAAW,EAAE,CAAC,UAAG,CAAC,OAAO,CAAC,aAAa,GAAG,GAAG,EAAE,MAAM,CAAC,iBAAU,CAAC,WAAW,CAAC,IAAI,IAAA,aAAM,GAAE,CAAC,CAAC,CAAC;IACrH,IAAI,EAAE,CAAC;AACT,CAAC,CAAC;AAHW,QAAA,WAAW,eAGtB"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.error = void 0;
|
|
4
|
-
const AuthError_1 = require("./AuthError");
|
|
5
|
-
const easy_1 = require("@thisisagile/easy");
|
|
6
|
-
const toResponse = (status, errors = []) => ({
|
|
7
|
-
status,
|
|
8
|
-
body: easy_1.rest.toError(status, errors),
|
|
9
|
-
});
|
|
10
|
-
const toBody = ({ origin, options }) => {
|
|
11
|
-
return ((0, easy_1.choose)(origin)
|
|
12
|
-
.type(AuthError_1.isAuthError, ae => toResponse((0, easy_1.toHttpStatus)(ae.status), [(0, easy_1.toResult)(ae.message)]))
|
|
13
|
-
.type(easy_1.isDoesNotExist, e => toResponse(options?.onNotFound ?? easy_1.HttpStatus.NotFound, [(0, easy_1.toResult)(e.reason ?? e.message)]))
|
|
14
|
-
.type(easy_1.isError, e => toResponse(easy_1.HttpStatus.InternalServerError, [(0, easy_1.toResult)(e.message)]))
|
|
15
|
-
.type(easy_1.isResults, r => toResponse(options?.onError ?? easy_1.HttpStatus.BadRequest, r.results))
|
|
16
|
-
.type(easy_1.isResponse, r => toResponse(easy_1.HttpStatus.InternalServerError, r.body.error?.errors))
|
|
17
|
-
.type(easy_1.isException, e => toResponse(options?.onError ?? easy_1.HttpStatus.BadRequest, [(0, easy_1.toResult)(e.reason ?? e.message)]))
|
|
18
|
-
.type(easy_1.isText, t => toResponse(options?.onError ?? easy_1.HttpStatus.BadRequest, [(0, easy_1.toResult)((0, easy_1.asString)(t))]))
|
|
19
|
-
.else(() => toResponse(easy_1.HttpStatus.InternalServerError, [(0, easy_1.toResult)('Unknown error')])));
|
|
20
|
-
};
|
|
21
|
-
const error = (e, req, res, _next) => {
|
|
22
|
-
let response;
|
|
23
|
-
(0, easy_1.tryTo)(() => (0, easy_1.toOriginatedError)(e))
|
|
24
|
-
.map(oe => toBody(oe))
|
|
25
|
-
.accept(r => (response = r))
|
|
26
|
-
.accept(r => (easy_1.ctx.request.lastError = r.status.isServerError ? r.body.error?.errors[0]?.message : undefined))
|
|
27
|
-
.recover(() => response)
|
|
28
|
-
.accept(r => res.status(r.status.status).json(r.body));
|
|
29
|
-
};
|
|
30
|
-
exports.error = error;
|
|
31
|
-
//# sourceMappingURL=ErrorHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorHandler.js","sourceRoot":"","sources":["../../src/express/ErrorHandler.ts"],"names":[],"mappings":";;;AACA,2CAA0C;AAC1C,4CAmB2B;AAE3B,MAAM,UAAU,GAAG,CAAC,MAAkB,EAAE,SAAmB,EAAE,EAAY,EAAE,CAAC,CAAC;IAC3E,MAAM;IACN,IAAI,EAAE,WAAI,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC;CACnC,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAmB,EAAY,EAAE;IAChE,OAAO,CACL,IAAA,aAAM,EAAC,MAAM,CAAC;SACX,IAAI,CAAC,uBAAW,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,IAAA,mBAAY,EAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,IAAA,eAAQ,EAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SACpF,IAAI,CAAC,qBAAc,EAAE,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,IAAI,iBAAU,CAAC,QAAQ,EAAE,CAAC,IAAA,eAAQ,EAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SAEpH,IAAI,CAAC,cAAO,EAAE,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,iBAAU,CAAC,mBAAmB,EAAE,CAAC,IAAA,eAAQ,EAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SAErF,IAAI,CAAC,gBAAS,EAAE,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,IAAI,iBAAU,CAAC,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;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AE,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;SAC5G,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC;SACvB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3D,CAAC,CAAC;AARW,QAAA,KAAK,SAQhB"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Express, RequestHandler, Response } from "express";
|
|
2
|
-
import { AppProvider, Endpoint, Handler, Resource, RouteRequires, Service, VerbOptions } from "@thisisagile/easy";
|
|
3
|
-
export type ExpressVerb = "get" | "post" | "put" | "patch" | "delete";
|
|
4
|
-
export declare class ExpressProvider implements AppProvider {
|
|
5
|
-
protected app: Express;
|
|
6
|
-
constructor(app?: Express);
|
|
7
|
-
use: (handler: Handler) => void;
|
|
8
|
-
route: (service: Service, resource: Resource) => void;
|
|
9
|
-
listen: (port: number, message?: string) => void;
|
|
10
|
-
protected addSecurityMiddleware(requires: RouteRequires): RequestHandler[];
|
|
11
|
-
protected handle: (endpoint: Endpoint, options?: VerbOptions) => RequestHandler;
|
|
12
|
-
protected toResponse(res: Response, result: unknown, options: Required<VerbOptions>): void;
|
|
13
|
-
protected json(res: Response, result: unknown, options: Required<VerbOptions>): void;
|
|
14
|
-
protected stream(res: Response, result: unknown): void;
|
|
15
|
-
protected text(res: Response, data: unknown): void;
|
|
16
|
-
}
|
|
17
|
-
export declare const service: (name: string) => Service;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.service = exports.ExpressProvider = void 0;
|
|
7
|
-
const express_1 = __importDefault(require("express"));
|
|
8
|
-
const SecurityHandler_1 = require("./SecurityHandler");
|
|
9
|
-
const easy_1 = require("@thisisagile/easy");
|
|
10
|
-
class ExpressProvider {
|
|
11
|
-
constructor(app = (0, express_1.default)()) {
|
|
12
|
-
this.app = app;
|
|
13
|
-
this.use = (handler) => {
|
|
14
|
-
this.app.use(handler);
|
|
15
|
-
};
|
|
16
|
-
this.route = (service, resource) => {
|
|
17
|
-
const { route, endpoints, middleware } = (0, easy_1.routes)(resource);
|
|
18
|
-
const router = express_1.default.Router({ mergeParams: true });
|
|
19
|
-
if (!(0, easy_1.isEmpty)(middleware))
|
|
20
|
-
router.all(route.route(service.name), middleware);
|
|
21
|
-
endpoints.forEach(({ endpoint, verb, requires, middleware }) => {
|
|
22
|
-
console.log(verb.verb.code, route.route(service.name));
|
|
23
|
-
router[verb.verb.toString()](route.route(service.name), ...this.addSecurityMiddleware(requires), ...middleware, this.handle(endpoint, verb.options));
|
|
24
|
-
});
|
|
25
|
-
this.app.use(router);
|
|
26
|
-
};
|
|
27
|
-
this.listen = (port, message = `Service is listening on port ${port}.`) => {
|
|
28
|
-
this.app.listen(port, () => {
|
|
29
|
-
console.log(message);
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
this.handle = (endpoint, options) => (req, res, next) => endpoint((0, easy_1.toReq)(req))
|
|
33
|
-
.then((r) => this.toResponse(res, r, (0, easy_1.toVerbOptions)(options)))
|
|
34
|
-
.catch(error => next((0, easy_1.toOriginatedError)(error, options)));
|
|
35
|
-
this.app.set("trust proxy", ["loopback", "linklocal", "uniquelocal"]);
|
|
36
|
-
}
|
|
37
|
-
addSecurityMiddleware(requires) {
|
|
38
|
-
const middleware = [];
|
|
39
|
-
if (requires.labCoat)
|
|
40
|
-
middleware.push((0, SecurityHandler_1.checkLabCoat)());
|
|
41
|
-
if (requires.token)
|
|
42
|
-
middleware.push((0, SecurityHandler_1.checkToken)());
|
|
43
|
-
if (requires.scope)
|
|
44
|
-
middleware.push((0, SecurityHandler_1.checkScope)(requires.scope));
|
|
45
|
-
if (requires.uc)
|
|
46
|
-
middleware.push((0, SecurityHandler_1.checkUseCase)(requires.uc));
|
|
47
|
-
return middleware;
|
|
48
|
-
}
|
|
49
|
-
toResponse(res, result, options) {
|
|
50
|
-
res.status(options.onOk.status);
|
|
51
|
-
res.type(options.type.code);
|
|
52
|
-
if (options.cache.enabled)
|
|
53
|
-
res.setHeader(options.cache.name, options.cache.value());
|
|
54
|
-
(this[options.type.name] ?? this.json)(res, result, options);
|
|
55
|
-
}
|
|
56
|
-
json(res, result, options) {
|
|
57
|
-
if (easy_1.HttpStatus.NoContent.equals(options.onOk)) {
|
|
58
|
-
res.send();
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
res.json(easy_1.rest.toData(options.onOk, (0, easy_1.toList)(result), result?.total, result?.meta));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
stream(res, result) {
|
|
65
|
-
res.end(result);
|
|
66
|
-
}
|
|
67
|
-
text(res, data) {
|
|
68
|
-
res.send(data);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.ExpressProvider = ExpressProvider;
|
|
72
|
-
const service = (name) => new easy_1.Service(name, new ExpressProvider());
|
|
73
|
-
exports.service = service;
|
|
74
|
-
//# sourceMappingURL=ExpressProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressProvider.js","sourceRoot":"","sources":["../../src/express/ExpressProvider.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA4F;AAC5F,uDAAuF;AACvF,4CAkB2B;AAI3B,MAAa,eAAe;IAC1B,YAAsB,MAAe,IAAA,iBAAO,GAAE;QAAxB,QAAG,GAAH,GAAG,CAAqB;QAI9C,QAAG,GAAG,CAAC,OAAgB,EAAQ,EAAE;YAC/B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC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");
|
|
5
|
-
const notFound = (req, res, next) => {
|
|
6
|
-
next((0, easy_1.toOriginatedError)(easy_1.Exception.DoesNotExist));
|
|
7
|
-
};
|
|
8
|
-
exports.notFound = notFound;
|
|
9
|
-
//# sourceMappingURL=NotFoundHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotFoundHandler.js","sourceRoot":"","sources":["../../src/express/NotFoundHandler.ts"],"names":[],"mappings":";;;AACA,4CAAiE;AAE1D,MAAM,QAAQ,GAAG,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAQ,EAAE;IAChF,IAAI,CAAC,IAAA,wBAAiB,EAAC,gBAAS,CAAC,YAAY,CAAC,CAAC,CAAC;AAClD,CAAC,CAAC;AAFW,QAAA,QAAQ,YAEnB"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.requestContext = void 0;
|
|
4
|
-
const easy_1 = require("@thisisagile/easy");
|
|
5
|
-
const requestContext = (req, res, next) => easy_1.ctx.request.create(() => next());
|
|
6
|
-
exports.requestContext = requestContext;
|
|
7
|
-
//# sourceMappingURL=RequestContextHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RequestContextHandler.js","sourceRoot":"","sources":["../../src/express/RequestContextHandler.ts"],"names":[],"mappings":";;;AACA,4CAAwC;AAEjC,MAAM,cAAc,GAAG,CAAC,GAAoB,EAAE,GAAqB,EAAE,IAA0B,EAAQ,EAAE,CAAC,UAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;AAArI,QAAA,cAAc,kBAAuH"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import express, { Request, RequestHandler } from 'express';
|
|
3
|
-
import { Scope, UseCase } from '@thisisagile/easy';
|
|
4
|
-
type SecretOrKeyProvider = (request: Request, rawJwtToken: any) => Promise<string | Buffer>;
|
|
5
|
-
export interface SecurityOptions {
|
|
6
|
-
jwtStrategyOptions?: {
|
|
7
|
-
secretOrKey?: string | Buffer;
|
|
8
|
-
secretOrKeyProvider?: SecretOrKeyProvider;
|
|
9
|
-
issuer?: string;
|
|
10
|
-
audience?: string;
|
|
11
|
-
algorithms?: string[];
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export declare const checkLabCoat: () => RequestHandler;
|
|
15
|
-
export declare const checkToken: () => RequestHandler;
|
|
16
|
-
export declare const checkScope: (scope: Scope) => RequestHandler;
|
|
17
|
-
export declare const checkUseCase: (uc: UseCase) => RequestHandler;
|
|
18
|
-
export declare const security: ({ jwtStrategyOptions }?: SecurityOptions) => (req: express.Request, res: express.Response, next: express.NextFunction) => void;
|
|
19
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.security = exports.checkUseCase = exports.checkScope = exports.checkToken = exports.checkLabCoat = void 0;
|
|
7
|
-
const passport_1 = __importDefault(require("passport"));
|
|
8
|
-
const passport_jwt_1 = require("passport-jwt");
|
|
9
|
-
const AuthError_1 = require("./AuthError");
|
|
10
|
-
const easy_1 = require("@thisisagile/easy");
|
|
11
|
-
const checkLabCoat = () => (req, res, next) => next((0, easy_1.ifFalse)(easy_1.Environment.Dev.equals(easy_1.ctx.env.name), (0, AuthError_1.authError)(easy_1.HttpStatus.Forbidden)));
|
|
12
|
-
exports.checkLabCoat = checkLabCoat;
|
|
13
|
-
const checkToken = () => passport_1.default.authenticate('jwt', { session: false, failWithError: true });
|
|
14
|
-
exports.checkToken = checkToken;
|
|
15
|
-
const checkScope = (scope) => (req, res, next) => next((0, easy_1.ifFalse)(req.user?.scopes?.includes(scope.id), (0, AuthError_1.authError)(easy_1.HttpStatus.Forbidden)));
|
|
16
|
-
exports.checkScope = checkScope;
|
|
17
|
-
const checkUseCase = (uc) => (req, res, next) => next((0, easy_1.ifFalse)(req.user?.usecases?.includes(uc.id), (0, AuthError_1.authError)(easy_1.HttpStatus.Forbidden)));
|
|
18
|
-
exports.checkUseCase = checkUseCase;
|
|
19
|
-
const wrapSecretOrKeyProvider = (p) => p
|
|
20
|
-
? (request, rawJwtToken, done) => p(request, rawJwtToken)
|
|
21
|
-
.then(t => done(null, t))
|
|
22
|
-
.catch(e => done(e))
|
|
23
|
-
: undefined;
|
|
24
|
-
const security = ({ jwtStrategyOptions } = {}) => {
|
|
25
|
-
const jwtConfig = {
|
|
26
|
-
jwtFromRequest: passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken(),
|
|
27
|
-
secretOrKey: jwtStrategyOptions?.secretOrKey ?? (jwtStrategyOptions?.secretOrKeyProvider ? undefined : easy_1.ctx.env.get('tokenPublicKey')),
|
|
28
|
-
secretOrKeyProvider: wrapSecretOrKeyProvider(jwtStrategyOptions?.secretOrKeyProvider),
|
|
29
|
-
issuer: jwtStrategyOptions?.issuer,
|
|
30
|
-
audience: jwtStrategyOptions?.audience,
|
|
31
|
-
algorithms: jwtStrategyOptions?.algorithms,
|
|
32
|
-
passReqToCallback: true,
|
|
33
|
-
};
|
|
34
|
-
const strategy = new passport_jwt_1.Strategy(jwtConfig, (req, payload, done) => {
|
|
35
|
-
easy_1.ctx.request.token = payload;
|
|
36
|
-
easy_1.ctx.request.jwt = passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken()(req) ?? '';
|
|
37
|
-
done(null, payload);
|
|
38
|
-
});
|
|
39
|
-
passport_1.default.use(strategy);
|
|
40
|
-
return passport_1.default.initialize();
|
|
41
|
-
};
|
|
42
|
-
exports.security = security;
|
|
43
|
-
//# sourceMappingURL=SecurityHandler.js.map
|
|
@@ -1 +0,0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AAC;IACtB,CAAC,CAAC,CAAC;IAEH,kBAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvB,OAAO,kBAAQ,CAAC,UAAU,EAAE,CAAC;AAC/B,CAAC,CAAC;AAnBW,QAAA,QAAQ,YAmBnB"}
|
package/dist/express/index.d.ts
DELETED
package/dist/express/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./AuthError"), exports);
|
|
18
|
-
__exportStar(require("./CorrelationHandler"), exports);
|
|
19
|
-
__exportStar(require("./ErrorHandler"), exports);
|
|
20
|
-
__exportStar(require("./ExpressProvider"), exports);
|
|
21
|
-
__exportStar(require("./NotFoundHandler"), exports);
|
|
22
|
-
__exportStar(require("./RequestContextHandler"), exports);
|
|
23
|
-
__exportStar(require("./SecurityHandler"), exports);
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/express/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,uDAAqC;AACrC,iDAA+B;AAC/B,oDAAkC;AAClC,oDAAkC;AAClC,0DAAwC;AACxC,oDAAkC"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,0CAAwB"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BaseRequestContext } from '@thisisagile/easy';
|
|
2
|
-
export declare class NamespaceContext extends BaseRequestContext {
|
|
3
|
-
protected readonly namespace: import("cls-hooked").Namespace<Record<string, any>>;
|
|
4
|
-
get<T>(key: string): T;
|
|
5
|
-
set<T>(key: string, value: T): T;
|
|
6
|
-
readonly create: (f: () => void) => void;
|
|
7
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NamespaceContext = void 0;
|
|
4
|
-
const cls_hooked_1 = require("cls-hooked");
|
|
5
|
-
const easy_1 = require("@thisisagile/easy");
|
|
6
|
-
class NamespaceContext extends easy_1.BaseRequestContext {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.namespace = (0, cls_hooked_1.createNamespace)('context');
|
|
10
|
-
this.create = (f) => this.namespace.run(f);
|
|
11
|
-
}
|
|
12
|
-
get(key) {
|
|
13
|
-
return this.namespace.get(key);
|
|
14
|
-
}
|
|
15
|
-
set(key, value) {
|
|
16
|
-
return this.namespace.set(key, value);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.NamespaceContext = NamespaceContext;
|
|
20
|
-
//# sourceMappingURL=NamespaceContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NamespaceContext.js","sourceRoot":"","sources":["../../src/types/NamespaceContext.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAC7C,4CAAuD;AAEvD,MAAa,gBAAiB,SAAQ,yBAAkB;IAAxD;;QACqB,cAAS,GAAG,IAAA,4BAAe,EAAC,SAAS,CAAC,CAAC;QAU1C,WAAM,GAAG,CAAC,CAAa,EAAQ,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;IATQ,GAAG,CAAI,GAAW;QACvB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAM,CAAC;IACtC,CAAC;IAEM,GAAG,CAAI,GAAW,EAAE,KAAQ;QACjC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;CAGF;AAZD,4CAYC"}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './NamespaceContext';
|
package/dist/types/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./NamespaceContext"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
|