@jsfsi-core/ts-nestjs 1.1.13 → 1.1.15
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/README.md +19 -19
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +55 -40
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package provides NestJS-specific implementations of hexagonal architecture
|
|
|
27
27
|
|
|
28
28
|
### Application Structure
|
|
29
29
|
|
|
30
|
-
```
|
|
30
|
+
```text
|
|
31
31
|
src/
|
|
32
32
|
├── app/
|
|
33
33
|
│ ├── app.ts # Application factory
|
|
@@ -55,12 +55,14 @@ import 'reflect-metadata';
|
|
|
55
55
|
|
|
56
56
|
import * as path from 'path';
|
|
57
57
|
import { bootstrap } from '@jsfsi-core/ts-nestjs';
|
|
58
|
+
import { GCPLogger } from '@jsfsi-core/ts-nodejs';
|
|
58
59
|
|
|
59
60
|
import { AppModule } from './app/AppModule';
|
|
60
61
|
|
|
61
62
|
bootstrap({
|
|
62
63
|
appModule: AppModule,
|
|
63
64
|
configPath: path.resolve(__dirname, '../configuration'),
|
|
65
|
+
logger: new GCPLogger('my-app'),
|
|
64
66
|
});
|
|
65
67
|
```
|
|
66
68
|
|
|
@@ -68,9 +70,12 @@ The `bootstrap` function:
|
|
|
68
70
|
|
|
69
71
|
- Loads environment configuration from the specified `configPath`
|
|
70
72
|
- Creates and configures the NestJS application
|
|
73
|
+
- Retrieves configuration using `ConfigService` with `APP_CONFIG_TOKEN`
|
|
71
74
|
- Automatically starts the application on the port specified in your configuration
|
|
72
75
|
- Handles CORS, exception filters, and logging setup
|
|
73
76
|
|
|
77
|
+
**Important**: Your `AppModule` must import `appConfigModuleSetup()` to register the configuration with the `APP_CONFIG_TOKEN`. The bootstrap function will throw an error if the configuration is not found.
|
|
78
|
+
|
|
74
79
|
### Configuration Service
|
|
75
80
|
|
|
76
81
|
Type-safe configuration with Zod schemas:
|
|
@@ -132,23 +137,14 @@ export class MyService {
|
|
|
132
137
|
|
|
133
138
|
Centralized exception handling at the application edge:
|
|
134
139
|
|
|
135
|
-
|
|
136
|
-
import { AllExceptionsFilter } from '@jsfsi-core/ts-nestjs';
|
|
137
|
-
import { HttpAdapterHost } from '@nestjs/core';
|
|
138
|
-
|
|
139
|
-
// Automatically registered in createApp()
|
|
140
|
-
// Or manually:
|
|
141
|
-
app.useGlobalFilters(new AllExceptionsFilter(httpAdapterHost));
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
This filter:
|
|
140
|
+
The `createApp()` function automatically registers `AllExceptionsFilter` which:
|
|
145
141
|
|
|
146
142
|
- Catches all unhandled exceptions
|
|
147
143
|
- Maps HTTP exceptions to appropriate status codes
|
|
148
144
|
- Logs errors for monitoring
|
|
149
145
|
- Returns consistent error responses
|
|
150
146
|
|
|
151
|
-
**Note**: This is where exceptions are caught (edge of hexagonal architecture).
|
|
147
|
+
**Note**: This is where exceptions are caught (edge of hexagonal architecture). The filter is automatically registered, no manual setup needed.
|
|
152
148
|
|
|
153
149
|
### Request Validation
|
|
154
150
|
|
|
@@ -238,8 +234,9 @@ Logs include:
|
|
|
238
234
|
### Testing Controllers
|
|
239
235
|
|
|
240
236
|
```typescript
|
|
241
|
-
import {
|
|
242
|
-
import { Controller, Get } from '@nestjs/common';
|
|
237
|
+
import { createTestingApp } from '@jsfsi-core/ts-nestjs';
|
|
238
|
+
import { Controller, Get, Module } from '@nestjs/common';
|
|
239
|
+
import request from 'supertest';
|
|
243
240
|
|
|
244
241
|
@Controller('test')
|
|
245
242
|
class TestController {
|
|
@@ -249,13 +246,16 @@ class TestController {
|
|
|
249
246
|
}
|
|
250
247
|
}
|
|
251
248
|
|
|
249
|
+
@Module({
|
|
250
|
+
controllers: [TestController],
|
|
251
|
+
})
|
|
252
|
+
class TestModule {}
|
|
253
|
+
|
|
252
254
|
describe('TestController', () => {
|
|
253
255
|
it('returns hello message', async () => {
|
|
254
|
-
const app = await
|
|
255
|
-
controllers: [TestController],
|
|
256
|
-
});
|
|
256
|
+
const app = await createTestingApp(TestModule);
|
|
257
257
|
|
|
258
|
-
const response = await app.get('/test');
|
|
258
|
+
const response = await request(app.getHttpServer()).get('/test');
|
|
259
259
|
|
|
260
260
|
expect(response.status).toBe(200);
|
|
261
261
|
expect(response.body).toEqual({ message: 'Hello' });
|
|
@@ -432,7 +432,7 @@ async createUser(@Body() user: any) {
|
|
|
432
432
|
|
|
433
433
|
Domain logic should be framework-agnostic:
|
|
434
434
|
|
|
435
|
-
```
|
|
435
|
+
```text
|
|
436
436
|
src/
|
|
437
437
|
├── domain/
|
|
438
438
|
│ ├── models/
|
package/dist/index.cjs
CHANGED
|
@@ -169,4 +169,4 @@ If the argument is passed in, for example, "debug(MyModule)" then it will only p
|
|
|
169
169
|
|
|
170
170
|
`),this.context.help(),this.output.write(`
|
|
171
171
|
Press Ctrl+C to abort current expression, Ctrl+D to exit the REPL
|
|
172
|
-
`);this.displayPrompt()}})}return tp}var RI;function MZ(){if(RI)return Jd;RI=1,Object.defineProperty(Jd,"__esModule",{value:!0}),Jd.repl=c;const e=ve(),t=nr(),r=GN(),a=gZ(),o=bZ(),n=TZ(),s=AZ(),i=RZ();async function c(u,p={}){const l=await r.NestFactory.createApplicationContext(u,{abortOnError:!1,logger:new s.ReplLogger});await l.init();const d=new n.ReplContext(l);e.Logger.log(o.REPL_INITIALIZED_MESSAGE);const h=(await Promise.resolve().then(()=>aD)).start({prompt:t.clc.green("> "),ignoreUndefined:!0,...p});return(0,a.assignToObject)(h.context,d.globalScope),(0,i.defineDefaultCommandsOnRepl)(h),h.on("exit",async()=>{await l.close()}),h}return Jd}var MI;function IZ(){return MI||(MI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),ae().__exportStar(MZ(),e)})(B_)),B_}var V_={},G_={},W_={},II;function CZ(){return II||(II=1,Object.defineProperty(W_,"__esModule",{value:!0})),W_}var CI;function jZ(){return CI||(CI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),ae().__exportStar(CZ(),e)})(G_)),G_}var Z_={},jI;function qZ(){return jI||(jI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.REQUEST=void 0;var t=wn();Object.defineProperty(e,"REQUEST",{enumerable:!0,get:function(){return t.REQUEST}})})(Z_)),Z_}var qI;function NZ(){return qI||(qI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RouterModule=void 0;const t=ae();t.__exportStar(jZ(),e),t.__exportStar(qZ(),e);var r=MN();Object.defineProperty(e,"RouterModule",{enumerable:!0,get:function(){return r.RouterModule}})})(V_)),V_}var NI;function WN(){return NI||(NI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NestFactory=e.APP_PIPE=e.APP_INTERCEPTOR=e.APP_GUARD=e.APP_FILTER=void 0;const t=ae();cg(),t.__exportStar(eW(),e),t.__exportStar(pr(),e);var r=pi();Object.defineProperty(e,"APP_FILTER",{enumerable:!0,get:function(){return r.APP_FILTER}}),Object.defineProperty(e,"APP_GUARD",{enumerable:!0,get:function(){return r.APP_GUARD}}),Object.defineProperty(e,"APP_INTERCEPTOR",{enumerable:!0,get:function(){return r.APP_INTERCEPTOR}}),Object.defineProperty(e,"APP_PIPE",{enumerable:!0,get:function(){return r.APP_PIPE}}),t.__exportStar(rW(),e),t.__exportStar(nW(),e),t.__exportStar(hW(),e),t.__exportStar(yN(),e),t.__exportStar(jW(),e),t.__exportStar(On(),e),t.__exportStar(FW(),e),t.__exportStar(Sb(),e),t.__exportStar(Ob(),e);var a=GN();Object.defineProperty(e,"NestFactory",{enumerable:!0,get:function(){return a.NestFactory}}),t.__exportStar(IZ(),e),t.__exportStar(NZ(),e),t.__exportStar(bN(),e)})(wm)),wm}var FI=WN(),FZ=Object.getOwnPropertyDescriptor,DZ=(e,t,r,a)=>{for(var o=a>1?void 0:a?FZ(t,r):t,n=e.length-1,s;n>=0;n--)(s=e[n])&&(o=s(o)||o);return o};let up=class{constructor(e){this.httpAdapterHost=e}logger=new tr.Logger(up.name);mapStatusCode(e){return"getStatus"in e&&typeof e.getStatus=="function"?e.getStatus():tr.HttpStatus.INTERNAL_SERVER_ERROR}mapError(e){return"getResponse"in e&&typeof e.getResponse=="function"?e.getResponse():{error:"internal-error"}}catch(e,t){const{httpAdapter:r}=this.httpAdapterHost,a=t.switchToHttp();this.logger.error("Unhandled exception",e);const o=this.mapStatusCode(e),n=this.mapError(e);r.reply(a.getResponse(),n,o)}};up=DZ([tr.Catch()],up);const Rb=async({existentApp:e,existentLogger:t,appModule:r})=>{if(!e&&!r)throw new Error("Either existentApp or appModule must be provided");const a=process.env.LOGGER_PROVIDER==="NESTJS"||!t?new tr.Logger:t;a.setLogLevels?.(["verbose","debug","log","warn","error","fatal"]);const o=e||await FI.NestFactory.create(r,{bufferLogs:!0,logger:a}),s=o.get(np.ConfigService).get(ni);if(!s)throw new Error(`Configuration with token ${ni} not found`);a.setLogLevels?.(s.LOG_LEVELS),o.useLogger(a);const i=o.get(FI.HttpAdapterHost);return o.useGlobalFilters(new up(i)),o.enableCors({origin:s.CORS_ORIGIN,methods:s.CORS_METHODS,allowedHeaders:s.CORS_ALLOWED_HEADERS,credentials:s.CORS_CREDENTIALS,maxAge:s.CORS_MAX_AGE}),{app:o,logger:a}};async function kZ({appModule:e,configPath:t=sD.resolve(__dirname,"../configuration"),logger:r}){hD({env:"",configPath:t});const{app:a,logger:o}=await Rb({appModule:e,existentLogger:r}),s=a.get(np.ConfigService).get(ni);if(!s)throw new Error(`Configuration with token ${ni} not found`);await a.listen(s.APP_PORT),o.log(`NestJS App is running at http://localhost:${s.APP_PORT}`)}var LZ=Object.getOwnPropertyDescriptor,UZ=(e,t,r,a)=>{for(var o=a>1?void 0:a?LZ(t,r):t,n=e.length-1,s;n>=0;n--)(s=e[n])&&(o=s(o)||o);return o};const K_={"2XX":"verbose","3XX":"debug",400:"log",401:"log",403:"log",404:"log","4XX":"warn","5XX":"error"};exports.RequestMiddleware=class{logger=new tr.Logger(exports.RequestMiddleware.name);statusCodeToSeverity(t){const r=t.toString();return K_[r]?K_[r]:K_[`${t.toString().slice(0,1)}XX`]}use(t,r,a){if(t.headers.host!=="127.0.0.1"){const o=Date.now();r.on("finish",()=>{const n=Date.now()-o,s={method:t.method,url:t.originalUrl,statusCode:r.statusCode,timeSpentMs:n,domain:t.hostname,requestHeaders:t.headers,responseHeaders:r.getHeaders()},i=this.statusCodeToSeverity(r.statusCode);this.logger[i](`Request: ${t.method} ${t.originalUrl} ${r.statusCode}`,s)})}a()}};exports.RequestMiddleware=UZ([tr.Injectable()],exports.RequestMiddleware);var Y_={},X_={},Q_={},DI;function $Z(){return DI||(DI=1,Object.defineProperty(Q_,"__esModule",{value:!0})),Q_}var J_={},kI;function zZ(){return kI||(kI=1,Object.defineProperty(J_,"__esModule",{value:!0})),J_}var eg={},LI;function BZ(){return LI||(LI=1,Object.defineProperty(eg,"__esModule",{value:!0})),eg}var UI;function HZ(){return UI||(UI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=ae();t.__exportStar($Z(),e),t.__exportStar(zZ(),e),t.__exportStar(BZ(),e)})(X_)),X_}var ol={},sl={},cl={},$I;function VZ(){if($I)return cl;$I=1,Object.defineProperty(cl,"__esModule",{value:!0}),cl.TestingLogger=void 0;const e=ve();class t extends e.ConsoleLogger{constructor(){super("Testing")}log(a){}warn(a){}debug(a){}verbose(a){}error(a,...o){return super.error(a,...o)}}return cl.TestingLogger=t,cl}var ul={},zI;function GZ(){if(zI)return ul;zI=1,Object.defineProperty(ul,"__esModule",{value:!0}),ul.TestingInjector=void 0;const e=it(),t=hi(),r=Dl();class a extends t.Injector{setMocker(n){this.mocker=n}setContainer(n){this.container=n}async resolveComponentWrapper(n,s,i,c,u=e.STATIC_CONTEXT,p,l){try{return await super.resolveComponentWrapper(n,s,i,c,u,p,l)}catch(d){return this.mockWrapper(d,n,s,c)}}async resolveComponentHost(n,s,i=e.STATIC_CONTEXT,c){try{return await super.resolveComponentHost(n,s,i,c)}catch(u){return this.mockWrapper(u,n,s.name,s)}}async mockWrapper(n,s,i,c){if(!this.mocker)throw n;const u=this.mocker(i);if(!u)throw n;const p=new r.InstanceWrapper({name:i,isAlias:!1,scope:c.scope,instance:u,isResolved:!0,host:s,metatype:c.metatype}),l=this.container.getInternalCoreModuleRef();if(!l)throw new Error("Expected to have internal core module reference at this point.");return l.addCustomProvider({provide:i,useValue:u},l.providers),l.addExportedProviderOrModule(i),p}}return ul.TestingInjector=a,ul}var ll={},BI;function WZ(){if(BI)return ll;BI=1,Object.defineProperty(ll,"__esModule",{value:!0}),ll.TestingInstanceLoader=void 0;const e=Pb();class t extends e.InstanceLoader{async createInstancesOfDependencies(a=this.container.getModules(),o){this.injector.setContainer(this.container),o&&this.injector.setMocker(o),await super.createInstancesOfDependencies()}}return ll.TestingInstanceLoader=t,ll}var dl={};const ZZ={},KZ=Object.freeze(Object.defineProperty({__proto__:null,default:ZZ},Symbol.toStringTag,{value:"Module"})),YZ=ci(KZ);var HI;function ZN(){if(HI)return dl;HI=1,Object.defineProperty(dl,"__esModule",{value:!0}),dl.TestingModule=void 0;const e=ve(),t=bl(),r=ne(),a=WN();class o extends a.NestApplicationContext{constructor(s,i,c,u,p=[]){const l={};super(s,l,c,p),this.applicationConfig=u,this.graphInspector=i}isHttpServer(s){return!!(s&&s.patch)}createNestApplication(s,i){const[c,u]=this.isHttpServer(s)?[s,i]:[this.createHttpAdapter(),s];this.applyLogger(u),this.container.setHttpAdapter(c);const p=new a.NestApplication(this.container,c,this.applicationConfig,this.graphInspector,u);return this.createAdapterProxy(p,c)}createNestMicroservice(s){const{NestMicroservice:i}=(0,t.loadPackage)("@nestjs/microservices","TestingModule",()=>YZ);return this.applyLogger(s),new i(this.container,s,this.graphInspector,this.applicationConfig)}createHttpAdapter(s){const{ExpressAdapter:i}=(0,t.loadPackage)("@nestjs/platform-express","NestFactory",()=>VN());return new i(s)}applyLogger(s){!s||(0,r.isUndefined)(s.logger)||e.Logger.overrideLogger(s.logger)}createAdapterProxy(s,i){return new Proxy(s,{get:(c,u)=>!(u in c)&&u in i?i[u]:c[u]})}}return dl.TestingModule=o,dl}var VI;function KN(){if(VI)return sl;VI=1,Object.defineProperty(sl,"__esModule",{value:!0}),sl.TestingModuleBuilder=void 0;const e=ve(),t=pr(),r=xb(),a=Lp(),o=NN(),n=Fl(),s=FN(),i=VZ(),c=GZ(),u=WZ(),p=ZN();class l{constructor(f,h,m){this.metadataScanner=f,this.applicationConfig=new t.ApplicationConfig,this.overloadsMap=new Map,this.moduleOverloadsMap=new Map,this.container=new r.NestContainer(this.applicationConfig,m),this.module=this.createModule(h)}setLogger(f){return this.testingLogger=f,this}overridePipe(f){return this.override(f,!1)}useMocker(f){return this.mocker=f,this}overrideFilter(f){return this.override(f,!1)}overrideGuard(f){return this.override(f,!1)}overrideInterceptor(f){return this.override(f,!1)}overrideProvider(f){return this.override(f,!0)}overrideModule(f){return{useModule:h=>(this.moduleOverloadsMap.set(f,h),this)}}async compile(f={}){this.applyLogger();let h;f?.snapshot?(h=new a.GraphInspector(this.container),n.UuidFactory.mode=n.UuidFactoryMode.Deterministic):(h=o.NoopGraphInspector,n.UuidFactory.mode=n.UuidFactoryMode.Random);const m=new s.DependenciesScanner(this.container,this.metadataScanner,h,this.applicationConfig);await m.scan(this.module,{overrides:this.getModuleOverloads()}),this.applyOverloadsMap(),await this.createInstancesOfDependencies(h,f),m.applyApplicationProviders();const v=this.getRootModule();return new p.TestingModule(this.container,h,v,this.applicationConfig)}override(f,h){const m=v=>(this.overloadsMap.set(f,{...v,isProvider:h}),this);return this.createOverrideByBuilder(m)}createOverrideByBuilder(f){return{useValue:h=>f({useValue:h}),useFactory:h=>f({...h,useFactory:h.factory}),useClass:h=>f({useClass:h})}}applyOverloadsMap(){[...this.overloadsMap.entries()].forEach(([h,m])=>{this.container.replace(h,m)})}getModuleOverloads(){return[...this.moduleOverloadsMap.entries()].map(([h,m])=>({moduleToReplace:h,newModule:m}))}getRootModule(){return this.container.getModules().values().next().value}async createInstancesOfDependencies(f,h){const m=new c.TestingInjector({preview:h?.preview??!1});await new u.TestingInstanceLoader(this.container,m,f).createInstancesOfDependencies(this.container.getModules(),this.mocker)}createModule(f){class h{}return(0,e.Module)(f)(h),h}applyLogger(){e.Logger.overrideLogger(this.testingLogger||new i.TestingLogger)}}return sl.TestingModuleBuilder=l,sl}var GI;function XZ(){if(GI)return ol;GI=1,Object.defineProperty(ol,"__esModule",{value:!0}),ol.Test=void 0;const e=On(),t=KN();class r{static createTestingModule(o,n){return new t.TestingModuleBuilder(this.metadataScanner,o,n)}}return ol.Test=r,r.metadataScanner=new e.MetadataScanner,ol}var WI;function QZ(){return WI||(WI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=ae();t.__exportStar(HZ(),e),t.__exportStar(XZ(),e),t.__exportStar(ZN(),e),t.__exportStar(KN(),e)})(Y_)),Y_}var JZ=QZ();function e4(e,t=[]){return t.forEach(r=>{e=e.overrideGuard(r.type).useValue(r.value)}),e}function t4(e,t=[]){return t.forEach(r=>{e=e.overrideProvider(r.type).useValue(r.value)}),e}async function YN(e={},t){let r=JZ.Test.createTestingModule({imports:[t]});r=e4(r,e.guards),r=t4(r,e.providers);const a=await r.compile();return e.logger&&a.useLogger(e.logger),a}async function r4(e,t={}){const r=await YN(t,e),{app:a}=await Rb({existentApp:r.createNestApplication(),existentLogger:t.logger});return a.init()}function Up(e,t="body"){return tr.createParamDecorator((r,a)=>{const n=a.switchToHttp().getRequest()[t],s=e.safeParse(n);if(!s.success)throw new tr.BadRequestException({message:`Invalid ${t} data`,errors:s.error});return s.data})()}function n4(e){return Up(e,"query")}function i4(e){return Up(e,"body")}function a4(e){return Up(e,"params")}exports.APP_CONFIG_TOKEN=ni;exports.AppConfigSchema=Qq;exports.SafeBody=i4;exports.SafeParams=a4;exports.SafeQuery=n4;exports.ZodValidator=Up;exports.appConfigModuleSetup=J2;exports.bootstrap=kZ;exports.createApp=Rb;exports.createTestingApp=r4;exports.createTestingModule=YN;
|
|
172
|
+
`);this.displayPrompt()}})}return tp}var RI;function MZ(){if(RI)return Jd;RI=1,Object.defineProperty(Jd,"__esModule",{value:!0}),Jd.repl=c;const e=ve(),t=nr(),r=GN(),a=gZ(),o=bZ(),n=TZ(),s=AZ(),i=RZ();async function c(u,p={}){const l=await r.NestFactory.createApplicationContext(u,{abortOnError:!1,logger:new s.ReplLogger});await l.init();const d=new n.ReplContext(l);e.Logger.log(o.REPL_INITIALIZED_MESSAGE);const h=(await Promise.resolve().then(()=>aD)).start({prompt:t.clc.green("> "),ignoreUndefined:!0,...p});return(0,a.assignToObject)(h.context,d.globalScope),(0,i.defineDefaultCommandsOnRepl)(h),h.on("exit",async()=>{await l.close()}),h}return Jd}var MI;function IZ(){return MI||(MI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),ae().__exportStar(MZ(),e)})(B_)),B_}var V_={},G_={},W_={},II;function CZ(){return II||(II=1,Object.defineProperty(W_,"__esModule",{value:!0})),W_}var CI;function jZ(){return CI||(CI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),ae().__exportStar(CZ(),e)})(G_)),G_}var Z_={},jI;function qZ(){return jI||(jI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.REQUEST=void 0;var t=wn();Object.defineProperty(e,"REQUEST",{enumerable:!0,get:function(){return t.REQUEST}})})(Z_)),Z_}var qI;function NZ(){return qI||(qI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RouterModule=void 0;const t=ae();t.__exportStar(jZ(),e),t.__exportStar(qZ(),e);var r=MN();Object.defineProperty(e,"RouterModule",{enumerable:!0,get:function(){return r.RouterModule}})})(V_)),V_}var NI;function WN(){return NI||(NI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NestFactory=e.APP_PIPE=e.APP_INTERCEPTOR=e.APP_GUARD=e.APP_FILTER=void 0;const t=ae();cg(),t.__exportStar(eW(),e),t.__exportStar(pr(),e);var r=pi();Object.defineProperty(e,"APP_FILTER",{enumerable:!0,get:function(){return r.APP_FILTER}}),Object.defineProperty(e,"APP_GUARD",{enumerable:!0,get:function(){return r.APP_GUARD}}),Object.defineProperty(e,"APP_INTERCEPTOR",{enumerable:!0,get:function(){return r.APP_INTERCEPTOR}}),Object.defineProperty(e,"APP_PIPE",{enumerable:!0,get:function(){return r.APP_PIPE}}),t.__exportStar(rW(),e),t.__exportStar(nW(),e),t.__exportStar(hW(),e),t.__exportStar(yN(),e),t.__exportStar(jW(),e),t.__exportStar(On(),e),t.__exportStar(FW(),e),t.__exportStar(Sb(),e),t.__exportStar(Ob(),e);var a=GN();Object.defineProperty(e,"NestFactory",{enumerable:!0,get:function(){return a.NestFactory}}),t.__exportStar(IZ(),e),t.__exportStar(NZ(),e),t.__exportStar(bN(),e)})(wm)),wm}var FI=WN(),FZ=Object.getOwnPropertyDescriptor,DZ=(e,t,r,a)=>{for(var o=a>1?void 0:a?FZ(t,r):t,n=e.length-1,s;n>=0;n--)(s=e[n])&&(o=s(o)||o);return o};let up=class{constructor(e){this.httpAdapterHost=e}logger=new tr.Logger(up.name);mapStatusCode(e){return"getStatus"in e&&typeof e.getStatus=="function"?e.getStatus():tr.HttpStatus.INTERNAL_SERVER_ERROR}mapError(e){return"getResponse"in e&&typeof e.getResponse=="function"?e.getResponse():{error:"internal-error"}}catch(e,t){const{httpAdapter:r}=this.httpAdapterHost,a=t.switchToHttp();this.logger.error("Unhandled exception",e);const o=this.mapStatusCode(e),n=this.mapError(e);r.reply(a.getResponse(),n,o)}};up=DZ([tr.Catch()],up);const Rb=async({existentApp:e,existentLogger:t,appModule:r})=>{if(!e&&!r)throw new Error("Either existentApp or appModule must be provided");const a=process.env.LOGGER_PROVIDER==="NESTJS"||!t?new tr.Logger:t;a.setLogLevels?.(["verbose","debug","log","warn","error","fatal"]);const o=e||await FI.NestFactory.create(r,{bufferLogs:!0,logger:a}),s=o.get(np.ConfigService).get(ni);if(!s)throw new Error(`Configuration with token ${ni} not found`);a.setLogLevels?.(s.LOG_LEVELS),o.useLogger(a);const i=o.get(FI.HttpAdapterHost);return o.useGlobalFilters(new up(i)),o.enableCors({origin:s.CORS_ORIGIN,methods:s.CORS_METHODS,allowedHeaders:s.CORS_ALLOWED_HEADERS,credentials:s.CORS_CREDENTIALS,maxAge:s.CORS_MAX_AGE}),{app:o,logger:a}};async function kZ({appModule:e,configPath:t=sD.resolve(__dirname,"../configuration"),logger:r}){hD({env:"",configPath:t});const{app:a,logger:o}=await Rb({appModule:e,existentLogger:r}),s=a.get(np.ConfigService).get(ni);if(!s)throw new Error(`Configuration with token ${ni} not found`);await a.listen(s.APP_PORT),o.log(`NestJS App is running at http://localhost:${s.APP_PORT}`),LZ(a,o)}function LZ(e,t){const r=async a=>{t.log(`Received ${a}, starting graceful shutdown...`);try{await e.close(),t.log("Application closed successfully"),process.exit(0)}catch(o){t.error("Error during shutdown",o),process.exit(1)}};process.on("SIGINT",()=>{r("SIGINT")}),process.on("SIGTERM",()=>{r("SIGTERM")})}var UZ=Object.getOwnPropertyDescriptor,$Z=(e,t,r,a)=>{for(var o=a>1?void 0:a?UZ(t,r):t,n=e.length-1,s;n>=0;n--)(s=e[n])&&(o=s(o)||o);return o};const K_={"2XX":"verbose","3XX":"debug",400:"log",401:"log",403:"log",404:"log","4XX":"warn","5XX":"error"};exports.RequestMiddleware=class{logger=new tr.Logger(exports.RequestMiddleware.name);statusCodeToSeverity(t){const r=t.toString();return K_[r]?K_[r]:K_[`${t.toString().slice(0,1)}XX`]}use(t,r,a){if(t.headers.host!=="127.0.0.1"){const o=Date.now();r.on("finish",()=>{const n=Date.now()-o,s={method:t.method,url:t.originalUrl,statusCode:r.statusCode,timeSpentMs:n,domain:t.hostname,requestHeaders:t.headers,responseHeaders:r.getHeaders()},i=this.statusCodeToSeverity(r.statusCode);this.logger[i](`Request: ${t.method} ${t.originalUrl} ${r.statusCode}`,s)})}a()}};exports.RequestMiddleware=$Z([tr.Injectable()],exports.RequestMiddleware);var Y_={},X_={},Q_={},DI;function zZ(){return DI||(DI=1,Object.defineProperty(Q_,"__esModule",{value:!0})),Q_}var J_={},kI;function BZ(){return kI||(kI=1,Object.defineProperty(J_,"__esModule",{value:!0})),J_}var eg={},LI;function HZ(){return LI||(LI=1,Object.defineProperty(eg,"__esModule",{value:!0})),eg}var UI;function VZ(){return UI||(UI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=ae();t.__exportStar(zZ(),e),t.__exportStar(BZ(),e),t.__exportStar(HZ(),e)})(X_)),X_}var ol={},sl={},cl={},$I;function GZ(){if($I)return cl;$I=1,Object.defineProperty(cl,"__esModule",{value:!0}),cl.TestingLogger=void 0;const e=ve();class t extends e.ConsoleLogger{constructor(){super("Testing")}log(a){}warn(a){}debug(a){}verbose(a){}error(a,...o){return super.error(a,...o)}}return cl.TestingLogger=t,cl}var ul={},zI;function WZ(){if(zI)return ul;zI=1,Object.defineProperty(ul,"__esModule",{value:!0}),ul.TestingInjector=void 0;const e=it(),t=hi(),r=Dl();class a extends t.Injector{setMocker(n){this.mocker=n}setContainer(n){this.container=n}async resolveComponentWrapper(n,s,i,c,u=e.STATIC_CONTEXT,p,l){try{return await super.resolveComponentWrapper(n,s,i,c,u,p,l)}catch(d){return this.mockWrapper(d,n,s,c)}}async resolveComponentHost(n,s,i=e.STATIC_CONTEXT,c){try{return await super.resolveComponentHost(n,s,i,c)}catch(u){return this.mockWrapper(u,n,s.name,s)}}async mockWrapper(n,s,i,c){if(!this.mocker)throw n;const u=this.mocker(i);if(!u)throw n;const p=new r.InstanceWrapper({name:i,isAlias:!1,scope:c.scope,instance:u,isResolved:!0,host:s,metatype:c.metatype}),l=this.container.getInternalCoreModuleRef();if(!l)throw new Error("Expected to have internal core module reference at this point.");return l.addCustomProvider({provide:i,useValue:u},l.providers),l.addExportedProviderOrModule(i),p}}return ul.TestingInjector=a,ul}var ll={},BI;function ZZ(){if(BI)return ll;BI=1,Object.defineProperty(ll,"__esModule",{value:!0}),ll.TestingInstanceLoader=void 0;const e=Pb();class t extends e.InstanceLoader{async createInstancesOfDependencies(a=this.container.getModules(),o){this.injector.setContainer(this.container),o&&this.injector.setMocker(o),await super.createInstancesOfDependencies()}}return ll.TestingInstanceLoader=t,ll}var dl={};const KZ={},YZ=Object.freeze(Object.defineProperty({__proto__:null,default:KZ},Symbol.toStringTag,{value:"Module"})),XZ=ci(YZ);var HI;function ZN(){if(HI)return dl;HI=1,Object.defineProperty(dl,"__esModule",{value:!0}),dl.TestingModule=void 0;const e=ve(),t=bl(),r=ne(),a=WN();class o extends a.NestApplicationContext{constructor(s,i,c,u,p=[]){const l={};super(s,l,c,p),this.applicationConfig=u,this.graphInspector=i}isHttpServer(s){return!!(s&&s.patch)}createNestApplication(s,i){const[c,u]=this.isHttpServer(s)?[s,i]:[this.createHttpAdapter(),s];this.applyLogger(u),this.container.setHttpAdapter(c);const p=new a.NestApplication(this.container,c,this.applicationConfig,this.graphInspector,u);return this.createAdapterProxy(p,c)}createNestMicroservice(s){const{NestMicroservice:i}=(0,t.loadPackage)("@nestjs/microservices","TestingModule",()=>XZ);return this.applyLogger(s),new i(this.container,s,this.graphInspector,this.applicationConfig)}createHttpAdapter(s){const{ExpressAdapter:i}=(0,t.loadPackage)("@nestjs/platform-express","NestFactory",()=>VN());return new i(s)}applyLogger(s){!s||(0,r.isUndefined)(s.logger)||e.Logger.overrideLogger(s.logger)}createAdapterProxy(s,i){return new Proxy(s,{get:(c,u)=>!(u in c)&&u in i?i[u]:c[u]})}}return dl.TestingModule=o,dl}var VI;function KN(){if(VI)return sl;VI=1,Object.defineProperty(sl,"__esModule",{value:!0}),sl.TestingModuleBuilder=void 0;const e=ve(),t=pr(),r=xb(),a=Lp(),o=NN(),n=Fl(),s=FN(),i=GZ(),c=WZ(),u=ZZ(),p=ZN();class l{constructor(f,h,m){this.metadataScanner=f,this.applicationConfig=new t.ApplicationConfig,this.overloadsMap=new Map,this.moduleOverloadsMap=new Map,this.container=new r.NestContainer(this.applicationConfig,m),this.module=this.createModule(h)}setLogger(f){return this.testingLogger=f,this}overridePipe(f){return this.override(f,!1)}useMocker(f){return this.mocker=f,this}overrideFilter(f){return this.override(f,!1)}overrideGuard(f){return this.override(f,!1)}overrideInterceptor(f){return this.override(f,!1)}overrideProvider(f){return this.override(f,!0)}overrideModule(f){return{useModule:h=>(this.moduleOverloadsMap.set(f,h),this)}}async compile(f={}){this.applyLogger();let h;f?.snapshot?(h=new a.GraphInspector(this.container),n.UuidFactory.mode=n.UuidFactoryMode.Deterministic):(h=o.NoopGraphInspector,n.UuidFactory.mode=n.UuidFactoryMode.Random);const m=new s.DependenciesScanner(this.container,this.metadataScanner,h,this.applicationConfig);await m.scan(this.module,{overrides:this.getModuleOverloads()}),this.applyOverloadsMap(),await this.createInstancesOfDependencies(h,f),m.applyApplicationProviders();const v=this.getRootModule();return new p.TestingModule(this.container,h,v,this.applicationConfig)}override(f,h){const m=v=>(this.overloadsMap.set(f,{...v,isProvider:h}),this);return this.createOverrideByBuilder(m)}createOverrideByBuilder(f){return{useValue:h=>f({useValue:h}),useFactory:h=>f({...h,useFactory:h.factory}),useClass:h=>f({useClass:h})}}applyOverloadsMap(){[...this.overloadsMap.entries()].forEach(([h,m])=>{this.container.replace(h,m)})}getModuleOverloads(){return[...this.moduleOverloadsMap.entries()].map(([h,m])=>({moduleToReplace:h,newModule:m}))}getRootModule(){return this.container.getModules().values().next().value}async createInstancesOfDependencies(f,h){const m=new c.TestingInjector({preview:h?.preview??!1});await new u.TestingInstanceLoader(this.container,m,f).createInstancesOfDependencies(this.container.getModules(),this.mocker)}createModule(f){class h{}return(0,e.Module)(f)(h),h}applyLogger(){e.Logger.overrideLogger(this.testingLogger||new i.TestingLogger)}}return sl.TestingModuleBuilder=l,sl}var GI;function QZ(){if(GI)return ol;GI=1,Object.defineProperty(ol,"__esModule",{value:!0}),ol.Test=void 0;const e=On(),t=KN();class r{static createTestingModule(o,n){return new t.TestingModuleBuilder(this.metadataScanner,o,n)}}return ol.Test=r,r.metadataScanner=new e.MetadataScanner,ol}var WI;function JZ(){return WI||(WI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=ae();t.__exportStar(VZ(),e),t.__exportStar(QZ(),e),t.__exportStar(ZN(),e),t.__exportStar(KN(),e)})(Y_)),Y_}var e4=JZ();function t4(e,t=[]){return t.forEach(r=>{e=e.overrideGuard(r.type).useValue(r.value)}),e}function r4(e,t=[]){return t.forEach(r=>{e=e.overrideProvider(r.type).useValue(r.value)}),e}async function YN(e={},t){let r=e4.Test.createTestingModule({imports:[t]});r=t4(r,e.guards),r=r4(r,e.providers);const a=await r.compile();return e.logger&&a.useLogger(e.logger),a}async function n4(e,t={}){const r=await YN(t,e),{app:a}=await Rb({existentApp:r.createNestApplication(),existentLogger:t.logger});return a.init()}function Up(e,t="body"){return tr.createParamDecorator((r,a)=>{const n=a.switchToHttp().getRequest()[t],s=e.safeParse(n);if(!s.success)throw new tr.BadRequestException({message:`Invalid ${t} data`,errors:s.error});return s.data})()}function i4(e){return Up(e,"query")}function a4(e){return Up(e,"body")}function o4(e){return Up(e,"params")}exports.APP_CONFIG_TOKEN=ni;exports.AppConfigSchema=Qq;exports.SafeBody=a4;exports.SafeParams=o4;exports.SafeQuery=i4;exports.ZodValidator=Up;exports.appConfigModuleSetup=J2;exports.bootstrap=kZ;exports.createApp=Rb;exports.createTestingApp=n4;exports.createTestingModule=YN;
|
package/dist/index.mjs
CHANGED
|
@@ -17454,7 +17454,7 @@ const vl = "nestjs-app-config", Z2 = Wq(Zq(["verbose", "debug", "log", "warn", "
|
|
|
17454
17454
|
expandVariables: !0,
|
|
17455
17455
|
cache: !1,
|
|
17456
17456
|
load: [np.registerAs(e, () => K$(K2))]
|
|
17457
|
-
}),
|
|
17457
|
+
}), I4 = () => Y2(vl);
|
|
17458
17458
|
var er = ve(), xm = {}, Om = {}, oc = {}, xT;
|
|
17459
17459
|
function Xq() {
|
|
17460
17460
|
if (xT) return oc;
|
|
@@ -33449,7 +33449,7 @@ const GN = async ({
|
|
|
33449
33449
|
maxAge: s.CORS_MAX_AGE
|
|
33450
33450
|
}), { app: o, logger: a };
|
|
33451
33451
|
};
|
|
33452
|
-
async function
|
|
33452
|
+
async function z4({
|
|
33453
33453
|
appModule: e,
|
|
33454
33454
|
configPath: t = XF.resolve(__dirname, "../configuration"),
|
|
33455
33455
|
logger: r
|
|
@@ -33458,10 +33458,25 @@ async function $4({
|
|
|
33458
33458
|
const { app: a, logger: o } = await GN({ appModule: e, existentLogger: r }), s = a.get(np.ConfigService).get(vl);
|
|
33459
33459
|
if (!s)
|
|
33460
33460
|
throw new Error(`Configuration with token ${vl} not found`);
|
|
33461
|
-
await a.listen(s.APP_PORT), o.log(`NestJS App is running at http://localhost:${s.APP_PORT}`);
|
|
33461
|
+
await a.listen(s.APP_PORT), o.log(`NestJS App is running at http://localhost:${s.APP_PORT}`), NZ(a, o);
|
|
33462
33462
|
}
|
|
33463
|
-
|
|
33464
|
-
|
|
33463
|
+
function NZ(e, t) {
|
|
33464
|
+
const r = async (a) => {
|
|
33465
|
+
t.log(`Received ${a}, starting graceful shutdown...`);
|
|
33466
|
+
try {
|
|
33467
|
+
await e.close(), t.log("Application closed successfully"), process.exit(0);
|
|
33468
|
+
} catch (o) {
|
|
33469
|
+
t.error("Error during shutdown", o), process.exit(1);
|
|
33470
|
+
}
|
|
33471
|
+
};
|
|
33472
|
+
process.on("SIGINT", () => {
|
|
33473
|
+
r("SIGINT");
|
|
33474
|
+
}), process.on("SIGTERM", () => {
|
|
33475
|
+
r("SIGTERM");
|
|
33476
|
+
});
|
|
33477
|
+
}
|
|
33478
|
+
var FZ = Object.getOwnPropertyDescriptor, DZ = (e, t, r, a) => {
|
|
33479
|
+
for (var o = a > 1 ? void 0 : a ? FZ(t, r) : t, n = e.length - 1, s; n >= 0; n--)
|
|
33465
33480
|
(s = e[n]) && (o = s(o) || o);
|
|
33466
33481
|
return o;
|
|
33467
33482
|
};
|
|
@@ -33500,31 +33515,31 @@ let ag = class {
|
|
|
33500
33515
|
r();
|
|
33501
33516
|
}
|
|
33502
33517
|
};
|
|
33503
|
-
ag =
|
|
33518
|
+
ag = DZ([
|
|
33504
33519
|
er.Injectable()
|
|
33505
33520
|
], ag);
|
|
33506
33521
|
var Z_ = {}, K_ = {}, Y_ = {}, FI;
|
|
33507
|
-
function
|
|
33522
|
+
function kZ() {
|
|
33508
33523
|
return FI || (FI = 1, Object.defineProperty(Y_, "__esModule", { value: !0 })), Y_;
|
|
33509
33524
|
}
|
|
33510
33525
|
var X_ = {}, DI;
|
|
33511
|
-
function
|
|
33526
|
+
function LZ() {
|
|
33512
33527
|
return DI || (DI = 1, Object.defineProperty(X_, "__esModule", { value: !0 })), X_;
|
|
33513
33528
|
}
|
|
33514
33529
|
var Q_ = {}, kI;
|
|
33515
|
-
function
|
|
33530
|
+
function UZ() {
|
|
33516
33531
|
return kI || (kI = 1, Object.defineProperty(Q_, "__esModule", { value: !0 })), Q_;
|
|
33517
33532
|
}
|
|
33518
33533
|
var LI;
|
|
33519
|
-
function
|
|
33534
|
+
function $Z() {
|
|
33520
33535
|
return LI || (LI = 1, (function(e) {
|
|
33521
33536
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
33522
33537
|
const t = /* @__PURE__ */ ae();
|
|
33523
|
-
t.__exportStar(
|
|
33538
|
+
t.__exportStar(kZ(), e), t.__exportStar(LZ(), e), t.__exportStar(UZ(), e);
|
|
33524
33539
|
})(K_)), K_;
|
|
33525
33540
|
}
|
|
33526
33541
|
var al = {}, ol = {}, sl = {}, UI;
|
|
33527
|
-
function
|
|
33542
|
+
function zZ() {
|
|
33528
33543
|
if (UI) return sl;
|
|
33529
33544
|
UI = 1, Object.defineProperty(sl, "__esModule", { value: !0 }), sl.TestingLogger = void 0;
|
|
33530
33545
|
const e = ve();
|
|
@@ -33547,7 +33562,7 @@ function $Z() {
|
|
|
33547
33562
|
return sl.TestingLogger = t, sl;
|
|
33548
33563
|
}
|
|
33549
33564
|
var cl = {}, $I;
|
|
33550
|
-
function
|
|
33565
|
+
function BZ() {
|
|
33551
33566
|
if ($I) return cl;
|
|
33552
33567
|
$I = 1, Object.defineProperty(cl, "__esModule", { value: !0 }), cl.TestingInjector = void 0;
|
|
33553
33568
|
const e = it(), t = fi(), r = Dl();
|
|
@@ -33598,7 +33613,7 @@ function zZ() {
|
|
|
33598
33613
|
return cl.TestingInjector = a, cl;
|
|
33599
33614
|
}
|
|
33600
33615
|
var ul = {}, zI;
|
|
33601
|
-
function
|
|
33616
|
+
function HZ() {
|
|
33602
33617
|
if (zI) return ul;
|
|
33603
33618
|
zI = 1, Object.defineProperty(ul, "__esModule", { value: !0 }), ul.TestingInstanceLoader = void 0;
|
|
33604
33619
|
const e = Sb();
|
|
@@ -33610,10 +33625,10 @@ function BZ() {
|
|
|
33610
33625
|
return ul.TestingInstanceLoader = t, ul;
|
|
33611
33626
|
}
|
|
33612
33627
|
var ll = {};
|
|
33613
|
-
const
|
|
33628
|
+
const VZ = {}, GZ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
33614
33629
|
__proto__: null,
|
|
33615
|
-
default:
|
|
33616
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
33630
|
+
default: VZ
|
|
33631
|
+
}, Symbol.toStringTag, { value: "Module" })), WZ = /* @__PURE__ */ si(GZ);
|
|
33617
33632
|
var BI;
|
|
33618
33633
|
function WN() {
|
|
33619
33634
|
if (BI) return ll;
|
|
@@ -33634,7 +33649,7 @@ function WN() {
|
|
|
33634
33649
|
return this.createAdapterProxy(p, c);
|
|
33635
33650
|
}
|
|
33636
33651
|
createNestMicroservice(s) {
|
|
33637
|
-
const { NestMicroservice: i } = (0, t.loadPackage)("@nestjs/microservices", "TestingModule", () =>
|
|
33652
|
+
const { NestMicroservice: i } = (0, t.loadPackage)("@nestjs/microservices", "TestingModule", () => WZ);
|
|
33638
33653
|
return this.applyLogger(s), new i(this.container, s, this.graphInspector, this.applicationConfig);
|
|
33639
33654
|
}
|
|
33640
33655
|
createHttpAdapter(s) {
|
|
@@ -33656,7 +33671,7 @@ var HI;
|
|
|
33656
33671
|
function ZN() {
|
|
33657
33672
|
if (HI) return ol;
|
|
33658
33673
|
HI = 1, Object.defineProperty(ol, "__esModule", { value: !0 }), ol.TestingModuleBuilder = void 0;
|
|
33659
|
-
const e = ve(), t = pr(), r = Eb(), a = Lp(), o = jN(), n = Fl(), s = qN(), i =
|
|
33674
|
+
const e = ve(), t = pr(), r = Eb(), a = Lp(), o = jN(), n = Fl(), s = qN(), i = zZ(), c = BZ(), u = HZ(), p = WN();
|
|
33660
33675
|
class l {
|
|
33661
33676
|
constructor(f, h, m) {
|
|
33662
33677
|
this.metadataScanner = f, this.applicationConfig = new t.ApplicationConfig(), this.overloadsMap = /* @__PURE__ */ new Map(), this.moduleOverloadsMap = /* @__PURE__ */ new Map(), this.container = new r.NestContainer(this.applicationConfig, m), this.module = this.createModule(h);
|
|
@@ -33744,7 +33759,7 @@ function ZN() {
|
|
|
33744
33759
|
return ol.TestingModuleBuilder = l, ol;
|
|
33745
33760
|
}
|
|
33746
33761
|
var VI;
|
|
33747
|
-
function
|
|
33762
|
+
function ZZ() {
|
|
33748
33763
|
if (VI) return al;
|
|
33749
33764
|
VI = 1, Object.defineProperty(al, "__esModule", { value: !0 }), al.Test = void 0;
|
|
33750
33765
|
const e = On(), t = ZN();
|
|
@@ -33756,34 +33771,34 @@ function WZ() {
|
|
|
33756
33771
|
return al.Test = r, r.metadataScanner = new e.MetadataScanner(), al;
|
|
33757
33772
|
}
|
|
33758
33773
|
var GI;
|
|
33759
|
-
function
|
|
33774
|
+
function KZ() {
|
|
33760
33775
|
return GI || (GI = 1, (function(e) {
|
|
33761
33776
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
33762
33777
|
const t = /* @__PURE__ */ ae();
|
|
33763
|
-
t.__exportStar(
|
|
33778
|
+
t.__exportStar($Z(), e), t.__exportStar(ZZ(), e), t.__exportStar(WN(), e), t.__exportStar(ZN(), e);
|
|
33764
33779
|
})(Z_)), Z_;
|
|
33765
33780
|
}
|
|
33766
|
-
var
|
|
33767
|
-
function
|
|
33781
|
+
var YZ = KZ();
|
|
33782
|
+
function XZ(e, t = []) {
|
|
33768
33783
|
return t.forEach((r) => {
|
|
33769
33784
|
e = e.overrideGuard(r.type).useValue(r.value);
|
|
33770
33785
|
}), e;
|
|
33771
33786
|
}
|
|
33772
|
-
function
|
|
33787
|
+
function QZ(e, t = []) {
|
|
33773
33788
|
return t.forEach((r) => {
|
|
33774
33789
|
e = e.overrideProvider(r.type).useValue(r.value);
|
|
33775
33790
|
}), e;
|
|
33776
33791
|
}
|
|
33777
|
-
async function
|
|
33778
|
-
let r =
|
|
33792
|
+
async function JZ(e = {}, t) {
|
|
33793
|
+
let r = YZ.Test.createTestingModule({
|
|
33779
33794
|
imports: [t]
|
|
33780
33795
|
});
|
|
33781
|
-
r =
|
|
33796
|
+
r = XZ(r, e.guards), r = QZ(r, e.providers);
|
|
33782
33797
|
const a = await r.compile();
|
|
33783
33798
|
return e.logger && a.useLogger(e.logger), a;
|
|
33784
33799
|
}
|
|
33785
|
-
async function
|
|
33786
|
-
const r = await
|
|
33800
|
+
async function B4(e, t = {}) {
|
|
33801
|
+
const r = await JZ(t, e), { app: a } = await GN({
|
|
33787
33802
|
existentApp: r.createNestApplication(),
|
|
33788
33803
|
existentLogger: t.logger
|
|
33789
33804
|
});
|
|
@@ -33800,26 +33815,26 @@ function Ab(e, t = "body") {
|
|
|
33800
33815
|
return s.data;
|
|
33801
33816
|
})();
|
|
33802
33817
|
}
|
|
33803
|
-
function
|
|
33818
|
+
function H4(e) {
|
|
33804
33819
|
return Ab(e, "query");
|
|
33805
33820
|
}
|
|
33806
|
-
function
|
|
33821
|
+
function V4(e) {
|
|
33807
33822
|
return Ab(e, "body");
|
|
33808
33823
|
}
|
|
33809
|
-
function
|
|
33824
|
+
function G4(e) {
|
|
33810
33825
|
return Ab(e, "params");
|
|
33811
33826
|
}
|
|
33812
33827
|
export {
|
|
33813
33828
|
vl as APP_CONFIG_TOKEN,
|
|
33814
33829
|
K2 as AppConfigSchema,
|
|
33815
33830
|
ag as RequestMiddleware,
|
|
33816
|
-
|
|
33817
|
-
|
|
33818
|
-
|
|
33831
|
+
V4 as SafeBody,
|
|
33832
|
+
G4 as SafeParams,
|
|
33833
|
+
H4 as SafeQuery,
|
|
33819
33834
|
Ab as ZodValidator,
|
|
33820
|
-
|
|
33821
|
-
|
|
33835
|
+
I4 as appConfigModuleSetup,
|
|
33836
|
+
z4 as bootstrap,
|
|
33822
33837
|
GN as createApp,
|
|
33823
|
-
|
|
33824
|
-
|
|
33838
|
+
B4 as createTestingApp,
|
|
33839
|
+
JZ as createTestingModule
|
|
33825
33840
|
};
|