@hono-di/core 0.0.7 → 0.0.9

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.js CHANGED
@@ -3,14 +3,8 @@ import { Hono } from 'hono';
3
3
  import { Observable, from, lastValueFrom } from 'rxjs';
4
4
  import { mergeMap } from 'rxjs/operators';
5
5
 
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __decorateClass = (decorators, target, key, kind) => {
8
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
9
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
- if (decorator = decorators[i])
11
- result = (decorator(result)) || result;
12
- return result;
13
- };
6
+ var __defProp = Object.defineProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
14
8
 
15
9
  // src/constants.ts
16
10
  var METADATA_KEYS = {
@@ -40,15 +34,15 @@ var METADATA_KEYS = {
40
34
  };
41
35
 
42
36
  // src/injector/scope.ts
43
- var Scope = /* @__PURE__ */ ((Scope2) => {
37
+ var Scope = /* @__PURE__ */ (function(Scope2) {
44
38
  Scope2[Scope2["DEFAULT"] = 0] = "DEFAULT";
45
39
  Scope2[Scope2["TRANSIENT"] = 1] = "TRANSIENT";
46
40
  Scope2[Scope2["REQUEST"] = 2] = "REQUEST";
47
41
  return Scope2;
48
- })(Scope || {});
42
+ })({});
49
43
 
50
44
  // src/interfaces.ts
51
- var RequestMethod = /* @__PURE__ */ ((RequestMethod2) => {
45
+ var RequestMethod = /* @__PURE__ */ (function(RequestMethod2) {
52
46
  RequestMethod2["GET"] = "get";
53
47
  RequestMethod2["POST"] = "post";
54
48
  RequestMethod2["PUT"] = "put";
@@ -58,7 +52,7 @@ var RequestMethod = /* @__PURE__ */ ((RequestMethod2) => {
58
52
  RequestMethod2["OPTIONS"] = "options";
59
53
  RequestMethod2["HEAD"] = "head";
60
54
  return RequestMethod2;
61
- })(RequestMethod || {});
55
+ })({});
62
56
 
63
57
  // src/decorators.ts
64
58
  function Global() {
@@ -66,22 +60,28 @@ function Global() {
66
60
  Reflect.defineMetadata(METADATA_KEYS.GLOBAL, true, target);
67
61
  };
68
62
  }
63
+ __name(Global, "Global");
69
64
  function Module(options) {
70
65
  return (target) => {
71
66
  Reflect.defineMetadata(METADATA_KEYS.MODULE, options, target);
72
67
  };
73
68
  }
69
+ __name(Module, "Module");
74
70
  function Injectable(options) {
75
71
  return (target) => {
76
- Reflect.defineMetadata(METADATA_KEYS.SCOPE, options?.scope ?? 0 /* DEFAULT */, target);
72
+ Reflect.defineMetadata(METADATA_KEYS.SCOPE, options?.scope ?? Scope.DEFAULT, target);
77
73
  };
78
74
  }
75
+ __name(Injectable, "Injectable");
79
76
  function Controller(prefix = "") {
80
77
  return (target) => {
81
- Reflect.defineMetadata(METADATA_KEYS.CONTROLLER, { prefix }, target);
82
- Reflect.defineMetadata(METADATA_KEYS.SCOPE, 0 /* DEFAULT */, target);
78
+ Reflect.defineMetadata(METADATA_KEYS.CONTROLLER, {
79
+ prefix
80
+ }, target);
81
+ Reflect.defineMetadata(METADATA_KEYS.SCOPE, Scope.DEFAULT, target);
83
82
  };
84
83
  }
84
+ __name(Controller, "Controller");
85
85
  function createRouteDecorator(method) {
86
86
  return (path = "/") => {
87
87
  return (target, propertyKey, descriptor) => {
@@ -98,20 +98,22 @@ function createRouteDecorator(method) {
98
98
  };
99
99
  };
100
100
  }
101
- var Get = createRouteDecorator("get" /* GET */);
102
- var Post = createRouteDecorator("post" /* POST */);
103
- var Put = createRouteDecorator("put" /* PUT */);
104
- var Delete = createRouteDecorator("delete" /* DELETE */);
105
- var Patch = createRouteDecorator("patch" /* PATCH */);
106
- var Options = createRouteDecorator("options" /* OPTIONS */);
107
- var Head = createRouteDecorator("head" /* HEAD */);
108
- var All = createRouteDecorator("all" /* ALL */);
101
+ __name(createRouteDecorator, "createRouteDecorator");
102
+ var Get = createRouteDecorator(RequestMethod.GET);
103
+ var Post = createRouteDecorator(RequestMethod.POST);
104
+ var Put = createRouteDecorator(RequestMethod.PUT);
105
+ var Delete = createRouteDecorator(RequestMethod.DELETE);
106
+ var Patch = createRouteDecorator(RequestMethod.PATCH);
107
+ var Options = createRouteDecorator(RequestMethod.OPTIONS);
108
+ var Head = createRouteDecorator(RequestMethod.HEAD);
109
+ var All = createRouteDecorator(RequestMethod.ALL);
109
110
  function Catch(...exceptions) {
110
111
  return (target) => {
111
112
  Reflect.defineMetadata(METADATA_KEYS.FILTER_CATCH, exceptions, target);
112
- Reflect.defineMetadata(METADATA_KEYS.SCOPE, 0 /* DEFAULT */, target);
113
+ Reflect.defineMetadata(METADATA_KEYS.SCOPE, Scope.DEFAULT, target);
113
114
  };
114
115
  }
116
+ __name(Catch, "Catch");
115
117
  function UseFilters(...filters) {
116
118
  return (target, propertyKey, descriptor) => {
117
119
  if (descriptor) {
@@ -122,6 +124,7 @@ function UseFilters(...filters) {
122
124
  return target;
123
125
  };
124
126
  }
127
+ __name(UseFilters, "UseFilters");
125
128
  function Inject(token) {
126
129
  return (target, propertyKey, parameterIndex) => {
127
130
  if (parameterIndex !== void 0) {
@@ -130,11 +133,15 @@ function Inject(token) {
130
133
  Reflect.defineMetadata(METADATA_KEYS.INJECTIONS, injections, target);
131
134
  } else {
132
135
  const properties = Reflect.getMetadata(METADATA_KEYS.PROPERTY_DEPS, target.constructor) || [];
133
- properties.push({ key: propertyKey, token });
136
+ properties.push({
137
+ key: propertyKey,
138
+ token
139
+ });
134
140
  Reflect.defineMetadata(METADATA_KEYS.PROPERTY_DEPS, properties, target.constructor);
135
141
  }
136
142
  };
137
143
  }
144
+ __name(Inject, "Inject");
138
145
  function Optional() {
139
146
  return (target, propertyKey, parameterIndex) => {
140
147
  if (parameterIndex !== void 0) {
@@ -148,6 +155,7 @@ function Optional() {
148
155
  }
149
156
  };
150
157
  }
158
+ __name(Optional, "Optional");
151
159
  function UseGuards(...guards) {
152
160
  return (target, propertyKey, descriptor) => {
153
161
  if (descriptor) {
@@ -158,6 +166,7 @@ function UseGuards(...guards) {
158
166
  return target;
159
167
  };
160
168
  }
169
+ __name(UseGuards, "UseGuards");
161
170
  function UseInterceptors(...interceptors) {
162
171
  return (target, propertyKey, descriptor) => {
163
172
  if (descriptor) {
@@ -168,6 +177,7 @@ function UseInterceptors(...interceptors) {
168
177
  return target;
169
178
  };
170
179
  }
180
+ __name(UseInterceptors, "UseInterceptors");
171
181
  function UsePipes(...pipes) {
172
182
  return (target, propertyKey, descriptor) => {
173
183
  if (descriptor) {
@@ -178,7 +188,8 @@ function UsePipes(...pipes) {
178
188
  return target;
179
189
  };
180
190
  }
181
- var RouteParamtypes = /* @__PURE__ */ ((RouteParamtypes2) => {
191
+ __name(UsePipes, "UsePipes");
192
+ var RouteParamtypes = /* @__PURE__ */ (function(RouteParamtypes2) {
182
193
  RouteParamtypes2[RouteParamtypes2["REQUEST"] = 0] = "REQUEST";
183
194
  RouteParamtypes2[RouteParamtypes2["RESPONSE"] = 1] = "RESPONSE";
184
195
  RouteParamtypes2[RouteParamtypes2["NEXT"] = 2] = "NEXT";
@@ -194,7 +205,7 @@ var RouteParamtypes = /* @__PURE__ */ ((RouteParamtypes2) => {
194
205
  RouteParamtypes2[RouteParamtypes2["CONTEXT"] = 12] = "CONTEXT";
195
206
  RouteParamtypes2[RouteParamtypes2["CUSTOM"] = 13] = "CUSTOM";
196
207
  return RouteParamtypes2;
197
- })(RouteParamtypes || {});
208
+ })({});
198
209
  function assignMetadata(args, paramtype, index, data, ...pipes) {
199
210
  return {
200
211
  ...args,
@@ -206,53 +217,50 @@ function assignMetadata(args, paramtype, index, data, ...pipes) {
206
217
  }
207
218
  };
208
219
  }
220
+ __name(assignMetadata, "assignMetadata");
209
221
  function createRouteParamDecorator(paramtype) {
210
222
  return (data) => {
211
223
  return (target, key, index) => {
212
224
  const args = Reflect.getMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, target.constructor, key) || {};
213
- Reflect.defineMetadata(
214
- METADATA_KEYS.ROUTE_ARGS_METADATA,
215
- assignMetadata(args, paramtype, index, data),
216
- target.constructor,
217
- key
218
- );
225
+ Reflect.defineMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data), target.constructor, key);
219
226
  };
220
227
  };
221
228
  }
229
+ __name(createRouteParamDecorator, "createRouteParamDecorator");
222
230
  function createPipesRouteParamDecorator(paramtype) {
223
231
  return (data, ...pipes) => {
224
232
  return (target, key, index) => {
225
233
  const args = Reflect.getMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, target.constructor, key) || {};
226
- Reflect.defineMetadata(
227
- METADATA_KEYS.ROUTE_ARGS_METADATA,
228
- assignMetadata(args, paramtype, index, data, ...pipes),
229
- target.constructor,
230
- key
231
- );
234
+ Reflect.defineMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data, ...pipes), target.constructor, key);
232
235
  };
233
236
  };
234
237
  }
235
- var Request = createRouteParamDecorator(0 /* REQUEST */);
236
- var Response2 = createRouteParamDecorator(1 /* RESPONSE */);
237
- var Next = createRouteParamDecorator(2 /* NEXT */);
238
- var Session = createRouteParamDecorator(7 /* SESSION */);
239
- var FileParam = createRouteParamDecorator(8 /* FILE */);
240
- var Files = createRouteParamDecorator(9 /* FILES */);
241
- var Ip = createRouteParamDecorator(11 /* IP */);
242
- var HostParam = createRouteParamDecorator(10 /* HOST */);
243
- var Ctx = createRouteParamDecorator(12 /* CONTEXT */);
238
+ __name(createPipesRouteParamDecorator, "createPipesRouteParamDecorator");
239
+ var Request = createRouteParamDecorator(0);
240
+ var Response2 = createRouteParamDecorator(1);
241
+ var Next = createRouteParamDecorator(2);
242
+ var Session = createRouteParamDecorator(7);
243
+ var FileParam = createRouteParamDecorator(8);
244
+ var Files = createRouteParamDecorator(9);
245
+ var Ip = createRouteParamDecorator(11);
246
+ var HostParam = createRouteParamDecorator(10);
247
+ var Ctx = createRouteParamDecorator(12);
244
248
  function Body(property, ...pipes) {
245
- return createPipesRouteParamDecorator(3 /* BODY */)(property, ...pipes);
249
+ return createPipesRouteParamDecorator(3)(property, ...pipes);
246
250
  }
251
+ __name(Body, "Body");
247
252
  function Query(property, ...pipes) {
248
- return createPipesRouteParamDecorator(4 /* QUERY */)(property, ...pipes);
253
+ return createPipesRouteParamDecorator(4)(property, ...pipes);
249
254
  }
255
+ __name(Query, "Query");
250
256
  function Param(property, ...pipes) {
251
- return createPipesRouteParamDecorator(5 /* PARAM */)(property, ...pipes);
257
+ return createPipesRouteParamDecorator(5)(property, ...pipes);
252
258
  }
259
+ __name(Param, "Param");
253
260
  function Headers(property, ...pipes) {
254
- return createPipesRouteParamDecorator(6 /* HEADERS */)(property, ...pipes);
261
+ return createPipesRouteParamDecorator(6)(property, ...pipes);
255
262
  }
263
+ __name(Headers, "Headers");
256
264
  function SetMetadata(metadataKey, metadataValue) {
257
265
  return (target, key, descriptor) => {
258
266
  if (descriptor) {
@@ -263,26 +271,36 @@ function SetMetadata(metadataKey, metadataValue) {
263
271
  return target;
264
272
  };
265
273
  }
274
+ __name(SetMetadata, "SetMetadata");
266
275
  function HttpCode(statusCode) {
267
276
  return (target, key, descriptor) => {
268
277
  Reflect.defineMetadata(METADATA_KEYS.HTTP_CODE, statusCode, descriptor.value);
269
278
  return descriptor;
270
279
  };
271
280
  }
281
+ __name(HttpCode, "HttpCode");
272
282
  function Header(name, value) {
273
283
  return (target, key, descriptor) => {
274
284
  const headers = Reflect.getMetadata(METADATA_KEYS.HEADERS, descriptor.value) || [];
275
- headers.push({ name, value });
285
+ headers.push({
286
+ name,
287
+ value
288
+ });
276
289
  Reflect.defineMetadata(METADATA_KEYS.HEADERS, headers, descriptor.value);
277
290
  return descriptor;
278
291
  };
279
292
  }
293
+ __name(Header, "Header");
280
294
  function Redirect(url, statusCode = 302) {
281
295
  return (target, key, descriptor) => {
282
- Reflect.defineMetadata(METADATA_KEYS.REDIRECT, { url, statusCode }, descriptor.value);
296
+ Reflect.defineMetadata(METADATA_KEYS.REDIRECT, {
297
+ url,
298
+ statusCode
299
+ }, descriptor.value);
283
300
  return descriptor;
284
301
  };
285
302
  }
303
+ __name(Redirect, "Redirect");
286
304
  function applyDecorators(...decorators) {
287
305
  return (target, propertyKey, descriptor) => {
288
306
  for (const decorator of decorators) {
@@ -298,31 +316,33 @@ function applyDecorators(...decorators) {
298
316
  }
299
317
  };
300
318
  }
319
+ __name(applyDecorators, "applyDecorators");
301
320
  function createParamDecorator(factory) {
302
- const paramtype = 13 /* CUSTOM */;
321
+ const paramtype = 13;
303
322
  return (data) => {
304
323
  return (target, key, index) => {
305
324
  const args = Reflect.getMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, target.constructor, key) || {};
306
- Reflect.defineMetadata(
307
- METADATA_KEYS.ROUTE_ARGS_METADATA,
308
- assignMetadata(args, paramtype, index, data, factory),
309
- target.constructor,
310
- key
311
- );
325
+ Reflect.defineMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data, factory), target.constructor, key);
312
326
  };
313
327
  };
314
328
  }
329
+ __name(createParamDecorator, "createParamDecorator");
315
330
 
316
331
  // src/injector/module.ts
317
332
  var Module2 = class {
318
- constructor(metatype, token) {
319
- this.metatype = metatype;
320
- this.token = token;
333
+ static {
334
+ __name(this, "Module");
321
335
  }
336
+ metatype;
337
+ token;
322
338
  _providers = /* @__PURE__ */ new Map();
323
339
  _imports = /* @__PURE__ */ new Set();
324
340
  _exports = /* @__PURE__ */ new Set();
325
341
  _controllers = /* @__PURE__ */ new Map();
342
+ constructor(metatype, token) {
343
+ this.metatype = metatype;
344
+ this.token = token;
345
+ }
326
346
  get providers() {
327
347
  return this._providers;
328
348
  }
@@ -357,6 +377,9 @@ var Module2 = class {
357
377
 
358
378
  // src/injector/container.ts
359
379
  var Container = class {
380
+ static {
381
+ __name(this, "Container");
382
+ }
360
383
  modules = /* @__PURE__ */ new Map();
361
384
  globalModules = /* @__PURE__ */ new Set();
362
385
  addModule(moduleMeta, token) {
@@ -383,6 +406,9 @@ var Container = class {
383
406
 
384
407
  // src/injector/context-id.ts
385
408
  var ContextId = class _ContextId {
409
+ static {
410
+ __name(this, "ContextId");
411
+ }
386
412
  static idCounter = 0;
387
413
  id;
388
414
  constructor() {
@@ -393,27 +419,37 @@ new ContextId();
393
419
 
394
420
  // src/injector/module-ref.ts
395
421
  var ModuleRef = class {
422
+ static {
423
+ __name(this, "ModuleRef");
424
+ }
396
425
  };
397
426
  var ModuleRefImpl = class extends ModuleRef {
427
+ static {
428
+ __name(this, "ModuleRefImpl");
429
+ }
430
+ container;
431
+ injector;
432
+ moduleRef;
398
433
  constructor(container, injector, moduleRef) {
399
- super();
400
- this.container = container;
401
- this.injector = injector;
402
- this.moduleRef = moduleRef;
434
+ super(), this.container = container, this.injector = injector, this.moduleRef = moduleRef;
403
435
  }
404
- get(typeOrToken, options = { strict: true }) {
436
+ get(typeOrToken, options = {
437
+ strict: true
438
+ }) {
405
439
  const token = typeOrToken;
406
440
  let wrapper = this.moduleRef.getProvider(token);
407
441
  if (!wrapper && !options.strict) ;
408
442
  if (!wrapper) {
409
443
  throw new Error(`ModuleRef cannot find provider for ${token.toString()}`);
410
444
  }
411
- if (wrapper.scope !== 0 /* DEFAULT */) {
445
+ if (wrapper.scope !== Scope.DEFAULT) {
412
446
  throw new Error(`Cannot use get() for scoped provider ${token.toString()}. Use resolve() instead.`);
413
447
  }
414
448
  return wrapper.instance;
415
449
  }
416
- async resolve(typeOrToken, contextId, options = { strict: true }) {
450
+ async resolve(typeOrToken, contextId, options = {
451
+ strict: true
452
+ }) {
417
453
  const token = typeOrToken;
418
454
  const wrapper = this.moduleRef.getProvider(token);
419
455
  if (!wrapper) {
@@ -425,17 +461,24 @@ var ModuleRefImpl = class extends ModuleRef {
425
461
 
426
462
  // src/injector/injector.ts
427
463
  var Injector = class {
464
+ static {
465
+ __name(this, "Injector");
466
+ }
467
+ container;
428
468
  constructor(container) {
429
469
  this.container = container;
430
470
  }
431
471
  async resolveConstructorParams(wrapper, module, inject, callback, contextId = new ContextId(), inquire = [], parentInquire = []) {
432
- if (inquire.some((item) => item === wrapper) && wrapper.scope === 0 /* DEFAULT */) {
472
+ if (inquire.some((item) => item === wrapper) && wrapper.scope === Scope.DEFAULT) {
433
473
  throw new Error(`Circular dependency detected: ${wrapper.name}`);
434
474
  }
435
475
  const args = [];
436
476
  for (const [index, token] of inject.entries()) {
437
477
  const isOptional = wrapper.isOptional ? wrapper.isOptional[index] : false;
438
- const paramWrapper = await this.resolveSingleParam(token, module, contextId, [...inquire, wrapper], isOptional);
478
+ const paramWrapper = await this.resolveSingleParam(token, module, contextId, [
479
+ ...inquire,
480
+ wrapper
481
+ ], isOptional);
439
482
  args.push(paramWrapper);
440
483
  }
441
484
  return args;
@@ -458,11 +501,11 @@ var Injector = class {
458
501
  }
459
502
  if (isForwardRef) {
460
503
  return new Proxy({}, {
461
- get: (target, prop) => {
504
+ get: /* @__PURE__ */ __name((target, prop) => {
462
505
  if (prop === "then") return void 0;
463
506
  if (!wrapper.instance) ;
464
507
  return wrapper.instance?.[prop];
465
- }
508
+ }, "get")
466
509
  });
467
510
  }
468
511
  return this.loadInstance(wrapper, contextId, inquire);
@@ -495,17 +538,17 @@ var Injector = class {
495
538
  return void 0;
496
539
  }
497
540
  async loadInstance(wrapper, contextId, inquire = []) {
498
- if (wrapper.isResolved && wrapper.scope === 0 /* DEFAULT */) {
541
+ if (wrapper.isResolved && wrapper.scope === Scope.DEFAULT) {
499
542
  return wrapper.instance;
500
543
  }
501
- if (wrapper.scope === 2 /* REQUEST */) {
544
+ if (wrapper.scope === Scope.REQUEST) {
502
545
  const existing = wrapper.getInstanceByContextId(contextId);
503
546
  if (existing) return existing;
504
547
  }
505
548
  if (wrapper.isAlias) {
506
549
  const targetToken = wrapper.useExisting;
507
550
  const instance2 = await this.resolveSingleParam(targetToken, wrapper.host, contextId, inquire);
508
- if (wrapper.scope === 0 /* DEFAULT */) {
551
+ if (wrapper.scope === Scope.DEFAULT) {
509
552
  wrapper.instance = instance2;
510
553
  wrapper.isResolved = true;
511
554
  } else {
@@ -520,17 +563,10 @@ var Injector = class {
520
563
  }
521
564
  if (wrapper.useFactory) {
522
565
  const dependencies2 = wrapper.inject || [];
523
- const args = await this.resolveConstructorParams(
524
- wrapper,
525
- wrapper.host,
526
- dependencies2,
527
- (args2) => {
528
- },
529
- contextId,
530
- inquire
531
- );
566
+ const args = await this.resolveConstructorParams(wrapper, wrapper.host, dependencies2, (args2) => {
567
+ }, contextId, inquire);
532
568
  const instance2 = await wrapper.useFactory(...args);
533
- if (wrapper.scope === 0 /* DEFAULT */) {
569
+ if (wrapper.scope === Scope.DEFAULT) {
534
570
  wrapper.instance = instance2;
535
571
  wrapper.isResolved = true;
536
572
  } else {
@@ -543,31 +579,18 @@ var Injector = class {
543
579
  throw new Error("Invalid metatype");
544
580
  }
545
581
  let dependencies = wrapper.inject || [];
546
- const constructorArgs = await this.resolveConstructorParams(
547
- wrapper,
548
- wrapper.host,
549
- dependencies,
550
- (args) => {
551
- },
552
- contextId,
553
- inquire
554
- );
582
+ const constructorArgs = await this.resolveConstructorParams(wrapper, wrapper.host, dependencies, (args) => {
583
+ }, contextId, inquire);
555
584
  const instance = new metatype(...constructorArgs);
556
585
  if (wrapper.properties) {
557
586
  for (const prop of wrapper.properties) {
558
- const propInstance = await this.resolveSingleParam(
559
- prop.token,
560
- wrapper.host,
561
- contextId,
562
- inquire,
563
- prop.isOptional
564
- );
587
+ const propInstance = await this.resolveSingleParam(prop.token, wrapper.host, contextId, inquire, prop.isOptional);
565
588
  if (propInstance !== void 0) {
566
589
  instance[prop.key] = propInstance;
567
590
  }
568
591
  }
569
592
  }
570
- if (wrapper.scope === 0 /* DEFAULT */) {
593
+ if (wrapper.scope === Scope.DEFAULT) {
571
594
  wrapper.instance = instance;
572
595
  wrapper.isResolved = true;
573
596
  } else {
@@ -579,22 +602,22 @@ var Injector = class {
579
602
 
580
603
  // src/injector/instance-wrapper.ts
581
604
  var InstanceWrapper = class {
605
+ static {
606
+ __name(this, "InstanceWrapper");
607
+ }
582
608
  id;
583
609
  token;
584
610
  name;
585
611
  metatype;
586
- scope = 0 /* DEFAULT */;
612
+ scope = Scope.DEFAULT;
587
613
  host;
588
- // Generic logic
589
614
  inject;
590
615
  isOptional;
591
616
  properties;
592
617
  instance;
593
- // Singleton instance
594
618
  instancesPerContext = /* @__PURE__ */ new Map();
595
619
  isResolved = false;
596
620
  isPending = false;
597
- // For circular dependency detection
598
621
  isAlias = false;
599
622
  useFactory;
600
623
  useValue;
@@ -603,7 +626,7 @@ var InstanceWrapper = class {
603
626
  this.token = metadata.token;
604
627
  this.name = metadata.name;
605
628
  this.metatype = metadata.metatype;
606
- this.scope = metadata.scope ?? 0 /* DEFAULT */;
629
+ this.scope = metadata.scope ?? Scope.DEFAULT;
607
630
  this.host = metadata.host;
608
631
  this.instance = metadata.instance;
609
632
  this.inject = metadata.inject;
@@ -615,18 +638,18 @@ var InstanceWrapper = class {
615
638
  this.id = Math.random().toString(36).substring(7);
616
639
  }
617
640
  getInstanceByContextId(contextId) {
618
- if (this.scope === 1 /* TRANSIENT */) {
641
+ if (this.scope === Scope.TRANSIENT) {
619
642
  return void 0;
620
643
  }
621
- if (this.scope === 0 /* DEFAULT */) {
644
+ if (this.scope === Scope.DEFAULT) {
622
645
  return this.instance;
623
646
  }
624
647
  return this.instancesPerContext.get(contextId);
625
648
  }
626
649
  setInstanceByContextId(contextId, instance) {
627
- if (this.scope === 0 /* DEFAULT */) {
650
+ if (this.scope === Scope.DEFAULT) {
628
651
  this.instance = instance;
629
- } else if (this.scope === 2 /* REQUEST */) {
652
+ } else if (this.scope === Scope.REQUEST) {
630
653
  this.instancesPerContext.set(contextId, instance);
631
654
  }
632
655
  }
@@ -640,6 +663,9 @@ var InstanceWrapper = class {
640
663
 
641
664
  // src/services/logger.service.ts
642
665
  var Logger = class _Logger {
666
+ static {
667
+ __name(this, "Logger");
668
+ }
643
669
  static lastTimestamp;
644
670
  static instance;
645
671
  context;
@@ -694,10 +720,8 @@ var Logger = class _Logger {
694
720
  red: "\x1B[31m",
695
721
  green: "\x1B[32m",
696
722
  yellow: "\x1B[33m"};
697
- process.stdout.write(
698
- `${C.green}[Hono] ${pid}${C.reset} - ${timestamp}${color}${level.toUpperCase().padStart(7)}${C.reset} ${C.yellow}${contextMessage}${C.reset}${C.green}${output}${C.reset} ${C.yellow}${timeDiff}${C.reset}
699
- `
700
- );
723
+ process.stdout.write(`${C.green}[Hono] ${pid}${C.reset} - ${timestamp}${color}${level.toUpperCase().padStart(7)}${C.reset} ${C.yellow}${contextMessage}${C.reset}${C.green}${output}${C.reset} ${C.yellow}${timeDiff}${C.reset}
724
+ `);
701
725
  if (trace) {
702
726
  process.stdout.write(`${C.red}${trace}${C.reset}
703
727
  `);
@@ -736,6 +760,10 @@ var Logger = class _Logger {
736
760
 
737
761
  // src/scanner.ts
738
762
  var HonoDiScanner = class {
763
+ static {
764
+ __name(this, "HonoDiScanner");
765
+ }
766
+ container;
739
767
  constructor(container) {
740
768
  this.container = container;
741
769
  }
@@ -762,7 +790,7 @@ var HonoDiScanner = class {
762
790
  name: moduleClass.name,
763
791
  metatype: moduleClass,
764
792
  host: moduleRef,
765
- scope: 0 /* DEFAULT */
793
+ scope: Scope.DEFAULT
766
794
  });
767
795
  this.scanDependencies(moduleWrapper);
768
796
  moduleRef.addProvider(moduleWrapper);
@@ -774,10 +802,22 @@ var HonoDiScanner = class {
774
802
  const options = {
775
803
  ...decoratorOptions,
776
804
  ...dynamicMetadata,
777
- imports: [...decoratorOptions.imports || [], ...dynamicMetadata.imports || []],
778
- providers: [...decoratorOptions.providers || [], ...dynamicMetadata.providers || []],
779
- exports: [...decoratorOptions.exports || [], ...dynamicMetadata.exports || []],
780
- controllers: [...decoratorOptions.controllers || [], ...dynamicMetadata.controllers || []]
805
+ imports: [
806
+ ...decoratorOptions.imports || [],
807
+ ...dynamicMetadata.imports || []
808
+ ],
809
+ providers: [
810
+ ...decoratorOptions.providers || [],
811
+ ...dynamicMetadata.providers || []
812
+ ],
813
+ exports: [
814
+ ...decoratorOptions.exports || [],
815
+ ...dynamicMetadata.exports || []
816
+ ],
817
+ controllers: [
818
+ ...decoratorOptions.controllers || [],
819
+ ...dynamicMetadata.controllers || []
820
+ ]
781
821
  };
782
822
  if (options.imports) {
783
823
  for (const importedModule of options.imports) {
@@ -785,7 +825,10 @@ var HonoDiScanner = class {
785
825
  if (importedModule && typeof importedModule.forwardRef === "function") {
786
826
  actualImport = importedModule.forwardRef();
787
827
  }
788
- const importedRef = await this.scanModule(actualImport, [...scope, moduleClass]);
828
+ const importedRef = await this.scanModule(actualImport, [
829
+ ...scope,
830
+ moduleClass
831
+ ]);
789
832
  if (importedRef) {
790
833
  moduleRef.addImport(importedRef);
791
834
  }
@@ -818,7 +861,7 @@ var HonoDiScanner = class {
818
861
  name: token2.name,
819
862
  metatype: provider,
820
863
  host: moduleRef,
821
- scope: 0 /* DEFAULT */
864
+ scope: Scope.DEFAULT
822
865
  });
823
866
  this.scanDependencies(wrapper2);
824
867
  moduleRef.addProvider(wrapper2);
@@ -829,7 +872,7 @@ var HonoDiScanner = class {
829
872
  token,
830
873
  name: token && token.name ? token.name : typeof token === "string" ? token : "CustomProvider",
831
874
  host: moduleRef,
832
- scope: provider.scope || 0 /* DEFAULT */
875
+ scope: provider.scope || Scope.DEFAULT
833
876
  });
834
877
  if (provider.useValue !== void 0) {
835
878
  wrapper.useValue = provider.useValue;
@@ -852,7 +895,7 @@ var HonoDiScanner = class {
852
895
  name: token.name,
853
896
  metatype: controller,
854
897
  host: moduleRef,
855
- scope: 0 /* DEFAULT */
898
+ scope: Scope.DEFAULT
856
899
  });
857
900
  this.scanDependencies(wrapper);
858
901
  moduleRef.addController(wrapper);
@@ -883,6 +926,9 @@ var HonoDiScanner = class {
883
926
 
884
927
  // src/execution-context-host.ts
885
928
  var ExecutionContextHost = class {
929
+ static {
930
+ __name(this, "ExecutionContextHost");
931
+ }
886
932
  args;
887
933
  constructorRef;
888
934
  handler;
@@ -909,20 +955,24 @@ var ExecutionContextHost = class {
909
955
  }
910
956
  switchToHttp() {
911
957
  return {
912
- getRequest: () => this.context.req,
913
- getResponse: () => this.context,
914
- getNext: () => this.next ?? (() => Promise.resolve()),
915
- getContext: () => this.context
958
+ getRequest: /* @__PURE__ */ __name(() => this.context.req, "getRequest"),
959
+ getResponse: /* @__PURE__ */ __name(() => this.context, "getResponse"),
960
+ getNext: /* @__PURE__ */ __name(() => this.next ?? (() => Promise.resolve()), "getNext"),
961
+ getContext: /* @__PURE__ */ __name(() => this.context, "getContext")
916
962
  };
917
963
  }
918
964
  };
919
965
 
920
966
  // src/middleware/builder.ts
921
967
  var MiddlewareBuilder = class {
968
+ static {
969
+ __name(this, "MiddlewareBuilder");
970
+ }
971
+ module;
972
+ configs = [];
922
973
  constructor(module) {
923
974
  this.module = module;
924
975
  }
925
- configs = [];
926
976
  apply(...middleware) {
927
977
  return new MiddlewareConfigProxyImpl(this, middleware);
928
978
  }
@@ -938,12 +988,17 @@ var MiddlewareBuilder = class {
938
988
  return this.configs;
939
989
  }
940
990
  };
941
- var MiddlewareConfigProxyImpl = class {
991
+ var MiddlewareConfigProxyImpl = class MiddlewareConfigProxyImpl2 {
992
+ static {
993
+ __name(this, "MiddlewareConfigProxyImpl");
994
+ }
995
+ builder;
996
+ middleware;
997
+ excludes = [];
942
998
  constructor(builder, middleware) {
943
999
  this.builder = builder;
944
1000
  this.middleware = middleware;
945
1001
  }
946
- excludes = [];
947
1002
  exclude(...routes) {
948
1003
  this.excludes = routes;
949
1004
  return this;
@@ -956,10 +1011,13 @@ var MiddlewareConfigProxyImpl = class {
956
1011
 
957
1012
  // src/common/exceptions/http.exception.ts
958
1013
  var HttpException = class extends Error {
1014
+ static {
1015
+ __name(this, "HttpException");
1016
+ }
1017
+ response;
1018
+ status;
959
1019
  constructor(response, status) {
960
- super();
961
- this.response = response;
962
- this.status = status;
1020
+ super(), this.response = response, this.status = status;
963
1021
  this.message = typeof response === "string" ? response : JSON.stringify(response);
964
1022
  }
965
1023
  getResponse() {
@@ -970,89 +1028,144 @@ var HttpException = class extends Error {
970
1028
  }
971
1029
  static createBody(message, error, statusCode) {
972
1030
  if (!message) {
973
- return { statusCode, error };
1031
+ return {
1032
+ statusCode,
1033
+ error
1034
+ };
974
1035
  }
975
- return typeof message === "object" && !Array.isArray(message) ? message : { statusCode, error, message };
1036
+ return typeof message === "object" && !Array.isArray(message) ? message : {
1037
+ statusCode,
1038
+ error,
1039
+ message
1040
+ };
976
1041
  }
977
1042
  };
978
1043
 
979
1044
  // src/common/exceptions/index.ts
980
1045
  var BadRequestException = class extends HttpException {
1046
+ static {
1047
+ __name(this, "BadRequestException");
1048
+ }
981
1049
  constructor(message, error = "Bad Request") {
982
1050
  super(HttpException.createBody(message, error, 400), 400);
983
1051
  }
984
1052
  };
985
1053
  var UnauthorizedException = class extends HttpException {
1054
+ static {
1055
+ __name(this, "UnauthorizedException");
1056
+ }
986
1057
  constructor(message, error = "Unauthorized") {
987
1058
  super(HttpException.createBody(message, error, 401), 401);
988
1059
  }
989
1060
  };
990
1061
  var NotFoundException = class extends HttpException {
1062
+ static {
1063
+ __name(this, "NotFoundException");
1064
+ }
991
1065
  constructor(message, error = "Not Found") {
992
1066
  super(HttpException.createBody(message, error, 404), 404);
993
1067
  }
994
1068
  };
995
1069
  var ForbiddenException = class extends HttpException {
1070
+ static {
1071
+ __name(this, "ForbiddenException");
1072
+ }
996
1073
  constructor(message, error = "Forbidden") {
997
1074
  super(HttpException.createBody(message, error, 403), 403);
998
1075
  }
999
1076
  };
1000
1077
  var NotAcceptableException = class extends HttpException {
1078
+ static {
1079
+ __name(this, "NotAcceptableException");
1080
+ }
1001
1081
  constructor(message, error = "Not Acceptable") {
1002
1082
  super(HttpException.createBody(message, error, 406), 406);
1003
1083
  }
1004
1084
  };
1005
1085
  var RequestTimeoutException = class extends HttpException {
1086
+ static {
1087
+ __name(this, "RequestTimeoutException");
1088
+ }
1006
1089
  constructor(message, error = "Request Timeout") {
1007
1090
  super(HttpException.createBody(message, error, 408), 408);
1008
1091
  }
1009
1092
  };
1010
1093
  var ConflictException = class extends HttpException {
1094
+ static {
1095
+ __name(this, "ConflictException");
1096
+ }
1011
1097
  constructor(message, error = "Conflict") {
1012
1098
  super(HttpException.createBody(message, error, 409), 409);
1013
1099
  }
1014
1100
  };
1015
1101
  var GoneException = class extends HttpException {
1102
+ static {
1103
+ __name(this, "GoneException");
1104
+ }
1016
1105
  constructor(message, error = "Gone") {
1017
1106
  super(HttpException.createBody(message, error, 410), 410);
1018
1107
  }
1019
1108
  };
1020
1109
  var PayloadTooLargeException = class extends HttpException {
1110
+ static {
1111
+ __name(this, "PayloadTooLargeException");
1112
+ }
1021
1113
  constructor(message, error = "Payload Too Large") {
1022
1114
  super(HttpException.createBody(message, error, 413), 413);
1023
1115
  }
1024
1116
  };
1025
1117
  var UnsupportedMediaTypeException = class extends HttpException {
1118
+ static {
1119
+ __name(this, "UnsupportedMediaTypeException");
1120
+ }
1026
1121
  constructor(message, error = "Unsupported Media Type") {
1027
1122
  super(HttpException.createBody(message, error, 415), 415);
1028
1123
  }
1029
1124
  };
1030
1125
  var UnprocessableEntityException = class extends HttpException {
1126
+ static {
1127
+ __name(this, "UnprocessableEntityException");
1128
+ }
1031
1129
  constructor(message, error = "Unprocessable Entity") {
1032
1130
  super(HttpException.createBody(message, error, 422), 422);
1033
1131
  }
1034
1132
  };
1035
1133
  var InternalServerErrorException = class extends HttpException {
1134
+ static {
1135
+ __name(this, "InternalServerErrorException");
1136
+ }
1036
1137
  constructor(message, error = "Internal Server Error") {
1037
1138
  super(HttpException.createBody(message, error, 500), 500);
1038
1139
  }
1039
1140
  };
1040
1141
  var NotImplementedException = class extends HttpException {
1142
+ static {
1143
+ __name(this, "NotImplementedException");
1144
+ }
1041
1145
  constructor(message, error = "Not Implemented") {
1042
1146
  super(HttpException.createBody(message, error, 501), 501);
1043
1147
  }
1044
1148
  };
1045
1149
  var BadGatewayException = class extends HttpException {
1150
+ static {
1151
+ __name(this, "BadGatewayException");
1152
+ }
1046
1153
  constructor(message, error = "Bad Gateway") {
1047
1154
  super(HttpException.createBody(message, error, 502), 502);
1048
1155
  }
1049
1156
  };
1050
1157
  var ServiceUnavailableException = class extends HttpException {
1158
+ static {
1159
+ __name(this, "ServiceUnavailableException");
1160
+ }
1051
1161
  constructor(message, error = "Service Unavailable") {
1052
1162
  super(HttpException.createBody(message, error, 503), 503);
1053
1163
  }
1054
1164
  };
1055
1165
  var GatewayTimeoutException = class extends HttpException {
1166
+ static {
1167
+ __name(this, "GatewayTimeoutException");
1168
+ }
1056
1169
  constructor(message, error = "Gateway Timeout") {
1057
1170
  super(HttpException.createBody(message, error, 504), 504);
1058
1171
  }
@@ -1060,15 +1173,21 @@ var GatewayTimeoutException = class extends HttpException {
1060
1173
 
1061
1174
  // src/application.ts
1062
1175
  var HonoDiApplication = class {
1063
- constructor(app, container, injector) {
1064
- this.app = app;
1065
- this.container = container;
1066
- this.injector = injector;
1176
+ static {
1177
+ __name(this, "HonoDiApplication");
1067
1178
  }
1179
+ app;
1180
+ container;
1181
+ injector;
1068
1182
  globalFilters = [];
1069
1183
  globalPipes = [];
1070
1184
  globalGuards = [];
1071
1185
  globalInterceptors = [];
1186
+ constructor(app, container, injector) {
1187
+ this.app = app;
1188
+ this.container = container;
1189
+ this.injector = injector;
1190
+ }
1072
1191
  useGlobalFilters(...filters) {
1073
1192
  this.globalFilters.push(...filters);
1074
1193
  return this;
@@ -1153,7 +1272,9 @@ var HonoDiApplication = class {
1153
1272
  const fullPath = this.combinePaths(globalPrefix, this.combinePaths(prefix, route.path));
1154
1273
  app[route.requestMethod](fullPath, async (c) => {
1155
1274
  const contextId = new ContextId();
1156
- const executionContext = new ExecutionContextHost([c], controllerClass, controllerClass.prototype[route.methodName]);
1275
+ const executionContext = new ExecutionContextHost([
1276
+ c
1277
+ ], controllerClass, controllerClass.prototype[route.methodName]);
1157
1278
  try {
1158
1279
  const wrapper = moduleRef.getProvider(controllerClass) || moduleRef.controllers.get(controllerClass);
1159
1280
  if (!wrapper) {
@@ -1161,49 +1282,33 @@ var HonoDiApplication = class {
1161
1282
  }
1162
1283
  const controllerInstance = await this.injector.loadInstance(wrapper, contextId);
1163
1284
  const handler = controllerInstance[route.methodName].bind(controllerInstance);
1164
- const guards = await this.resolveContextItems(
1165
- [
1166
- ...this.globalGuards,
1167
- ...Reflect.getMetadata(METADATA_KEYS.USE_GUARDS, controllerClass) || [],
1168
- ...Reflect.getMetadata(METADATA_KEYS.USE_GUARDS, controllerInstance[route.methodName]) || []
1169
- ],
1170
- moduleRef,
1171
- contextId
1172
- );
1285
+ const guards = await this.resolveContextItems([
1286
+ ...this.globalGuards,
1287
+ ...Reflect.getMetadata(METADATA_KEYS.USE_GUARDS, controllerClass) || [],
1288
+ ...Reflect.getMetadata(METADATA_KEYS.USE_GUARDS, controllerInstance[route.methodName]) || []
1289
+ ], moduleRef, contextId);
1173
1290
  if (!await this.runGuards(guards, executionContext)) {
1174
1291
  c.status(403);
1175
- return c.json({ statusCode: 403, message: "Forbidden resource" });
1292
+ return c.json({
1293
+ statusCode: 403,
1294
+ message: "Forbidden resource"
1295
+ });
1176
1296
  }
1177
- const interceptors = await this.resolveContextItems(
1178
- [
1179
- ...this.globalInterceptors,
1180
- ...Reflect.getMetadata(METADATA_KEYS.USE_INTERCEPTORS, controllerClass) || [],
1181
- ...Reflect.getMetadata(METADATA_KEYS.USE_INTERCEPTORS, controllerInstance[route.methodName]) || []
1182
- ],
1183
- moduleRef,
1184
- contextId
1185
- );
1186
- const pipes = await this.resolveContextItems(
1187
- [
1188
- ...this.globalPipes,
1189
- ...Reflect.getMetadata(METADATA_KEYS.USE_PIPES, controllerClass) || [],
1190
- ...Reflect.getMetadata(METADATA_KEYS.USE_PIPES, controllerInstance[route.methodName]) || []
1191
- ],
1192
- moduleRef,
1193
- contextId
1194
- );
1195
- const args = await this.resolveArgs(
1196
- contextId,
1197
- executionContext,
1198
- controllerClass,
1199
- route.methodName,
1200
- moduleRef,
1201
- pipes
1202
- );
1297
+ const interceptors = await this.resolveContextItems([
1298
+ ...this.globalInterceptors,
1299
+ ...Reflect.getMetadata(METADATA_KEYS.USE_INTERCEPTORS, controllerClass) || [],
1300
+ ...Reflect.getMetadata(METADATA_KEYS.USE_INTERCEPTORS, controllerInstance[route.methodName]) || []
1301
+ ], moduleRef, contextId);
1302
+ const pipes = await this.resolveContextItems([
1303
+ ...this.globalPipes,
1304
+ ...Reflect.getMetadata(METADATA_KEYS.USE_PIPES, controllerClass) || [],
1305
+ ...Reflect.getMetadata(METADATA_KEYS.USE_PIPES, controllerInstance[route.methodName]) || []
1306
+ ], moduleRef, contextId);
1307
+ const args = await this.resolveArgs(contextId, executionContext, controllerClass, route.methodName, moduleRef, pipes);
1203
1308
  if (args.length === 0 && !Reflect.hasMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, controllerClass, route.methodName)) {
1204
1309
  args.push(c);
1205
1310
  }
1206
- const interceptorChain = async (index) => {
1311
+ const interceptorChain = /* @__PURE__ */ __name(async (index) => {
1207
1312
  if (index >= interceptors.length) {
1208
1313
  return new Observable((subscriber) => {
1209
1314
  try {
@@ -1223,9 +1328,9 @@ var HonoDiApplication = class {
1223
1328
  });
1224
1329
  }
1225
1330
  return interceptors[index].intercept(executionContext, {
1226
- handle: () => from(interceptorChain(index + 1)).pipe(mergeMap((obs2) => obs2))
1331
+ handle: /* @__PURE__ */ __name(() => from(interceptorChain(index + 1)).pipe(mergeMap((obs2) => obs2)), "handle")
1227
1332
  });
1228
- };
1333
+ }, "interceptorChain");
1229
1334
  const obs = await interceptorChain(0);
1230
1335
  const result = await lastValueFrom(obs);
1231
1336
  const httpCode = Reflect.getMetadata(METADATA_KEYS.HTTP_CODE, controllerInstance[route.methodName]);
@@ -1258,19 +1363,17 @@ var HonoDiApplication = class {
1258
1363
  });
1259
1364
  }
1260
1365
  async handleException(exception, c, controllerClass, methodName, moduleRef, contextId) {
1261
- const filters = await this.resolveContextItems(
1262
- [
1263
- ...Reflect.getMetadata(METADATA_KEYS.USE_FILTERS, moduleRef.controllers.get(controllerClass)?.instance?.[methodName]) || [],
1264
- ...Reflect.getMetadata(METADATA_KEYS.USE_FILTERS, controllerClass) || [],
1265
- ...this.globalFilters
1266
- ],
1267
- moduleRef,
1268
- contextId
1269
- );
1366
+ const filters = await this.resolveContextItems([
1367
+ ...Reflect.getMetadata(METADATA_KEYS.USE_FILTERS, moduleRef.controllers.get(controllerClass)?.instance?.[methodName]) || [],
1368
+ ...Reflect.getMetadata(METADATA_KEYS.USE_FILTERS, controllerClass) || [],
1369
+ ...this.globalFilters
1370
+ ], moduleRef, contextId);
1270
1371
  for (const filter of filters) {
1271
1372
  const catchExceptions = Reflect.getMetadata(METADATA_KEYS.FILTER_CATCH, filter.constructor) || [];
1272
1373
  if (catchExceptions.length === 0 || catchExceptions.some((e) => exception instanceof e)) {
1273
- const host = new ExecutionContextHost([c], controllerClass, moduleRef.controllers.get(controllerClass)?.instance?.[methodName]);
1374
+ const host = new ExecutionContextHost([
1375
+ c
1376
+ ], controllerClass, moduleRef.controllers.get(controllerClass)?.instance?.[methodName]);
1274
1377
  return await filter.catch(exception, host);
1275
1378
  }
1276
1379
  }
@@ -1302,7 +1405,7 @@ var HonoDiApplication = class {
1302
1405
  name: item.name,
1303
1406
  metatype: item,
1304
1407
  host: moduleRef,
1305
- scope: 1 /* TRANSIENT */
1408
+ scope: Scope.TRANSIENT
1306
1409
  });
1307
1410
  scanner.scanDependencies(wrapper);
1308
1411
  }
@@ -1323,19 +1426,19 @@ var HonoDiApplication = class {
1323
1426
  let value;
1324
1427
  const { index, data, pipes, paramtype } = arg;
1325
1428
  switch (paramtype) {
1326
- case 0 /* REQUEST */:
1429
+ case RouteParamtypes.REQUEST:
1327
1430
  value = c.req;
1328
1431
  break;
1329
- case 1 /* RESPONSE */:
1432
+ case RouteParamtypes.RESPONSE:
1330
1433
  value = c;
1331
1434
  break;
1332
- case 2 /* NEXT */:
1435
+ case RouteParamtypes.NEXT:
1333
1436
  value = context.getArgs()[1];
1334
1437
  break;
1335
- case 12 /* CONTEXT */:
1438
+ case RouteParamtypes.CONTEXT:
1336
1439
  value = c;
1337
1440
  break;
1338
- case 3 /* BODY */:
1441
+ case RouteParamtypes.BODY:
1339
1442
  if (data && c.req.parseBody) {
1340
1443
  const body = await c.req.parseBody();
1341
1444
  value = body[data];
@@ -1348,19 +1451,19 @@ var HonoDiApplication = class {
1348
1451
  }
1349
1452
  }
1350
1453
  break;
1351
- case 4 /* QUERY */:
1454
+ case RouteParamtypes.QUERY:
1352
1455
  value = data ? c.req.query(data) : c.req.query();
1353
1456
  break;
1354
- case 5 /* PARAM */:
1457
+ case RouteParamtypes.PARAM:
1355
1458
  value = data ? c.req.param(data) : c.req.param();
1356
1459
  break;
1357
- case 6 /* HEADERS */:
1460
+ case RouteParamtypes.HEADERS:
1358
1461
  value = data ? c.req.header(data) : c.req.header();
1359
1462
  break;
1360
- case 11 /* IP */:
1463
+ case RouteParamtypes.IP:
1361
1464
  value = c.req.header("x-forwarded-for") || "127.0.0.1";
1362
1465
  break;
1363
- case 13 /* CUSTOM */:
1466
+ case RouteParamtypes.CUSTOM:
1364
1467
  const factory = arg.pipes[0];
1365
1468
  if (typeof factory === "function") {
1366
1469
  value = factory(data, context);
@@ -1370,9 +1473,16 @@ var HonoDiApplication = class {
1370
1473
  value = null;
1371
1474
  }
1372
1475
  const paramPipeInstances = await this.resolveContextItems(pipes || [], moduleRef, contextId);
1373
- const allPipes = [...methodPipes, ...paramPipeInstances];
1476
+ const allPipes = [
1477
+ ...methodPipes,
1478
+ ...paramPipeInstances
1479
+ ];
1374
1480
  for (const pipe of allPipes) {
1375
- value = await pipe.transform(value, { type: "custom", metatype: null, data });
1481
+ value = await pipe.transform(value, {
1482
+ type: "custom",
1483
+ metatype: null,
1484
+ data
1485
+ });
1376
1486
  }
1377
1487
  args[index] = value;
1378
1488
  }
@@ -1410,7 +1520,7 @@ var HonoDiApplication = class {
1410
1520
  token: m,
1411
1521
  name: m.name,
1412
1522
  metatype: m,
1413
- scope: 1 /* TRANSIENT */
1523
+ scope: Scope.TRANSIENT
1414
1524
  });
1415
1525
  const scanner = new HonoDiScanner(this.container);
1416
1526
  scanner.scanDependencies(wrapper);
@@ -1420,7 +1530,10 @@ var HonoDiApplication = class {
1420
1530
  instances.push(instance);
1421
1531
  }
1422
1532
  }
1423
- resolvedConfigs.push({ ...config, instances });
1533
+ resolvedConfigs.push({
1534
+ ...config,
1535
+ instances
1536
+ });
1424
1537
  }
1425
1538
  this.app.use("*", async (c, next) => {
1426
1539
  const path = c.req.path;
@@ -1435,14 +1548,14 @@ var HonoDiApplication = class {
1435
1548
  if (matchingMiddleware.length === 0) {
1436
1549
  return await next();
1437
1550
  }
1438
- const executeChain = async (index, finalNext) => {
1551
+ const executeChain = /* @__PURE__ */ __name(async (index, finalNext) => {
1439
1552
  if (index >= matchingMiddleware.length) {
1440
1553
  return await finalNext();
1441
1554
  }
1442
1555
  const middleware = matchingMiddleware[index];
1443
1556
  return new Promise((resolve, reject) => {
1444
1557
  let nextCalled = false;
1445
- const nextFn = async () => {
1558
+ const nextFn = /* @__PURE__ */ __name(async () => {
1446
1559
  nextCalled = true;
1447
1560
  try {
1448
1561
  await executeChain(index + 1, finalNext);
@@ -1450,7 +1563,7 @@ var HonoDiApplication = class {
1450
1563
  } catch (e) {
1451
1564
  reject(e);
1452
1565
  }
1453
- };
1566
+ }, "nextFn");
1454
1567
  try {
1455
1568
  const useFn = middleware.use ? middleware.use.bind(middleware) : middleware;
1456
1569
  const result = useFn(c, nextFn);
@@ -1465,7 +1578,7 @@ var HonoDiApplication = class {
1465
1578
  reject(e);
1466
1579
  }
1467
1580
  });
1468
- };
1581
+ }, "executeChain");
1469
1582
  await executeChain(0, next);
1470
1583
  });
1471
1584
  }
@@ -1476,7 +1589,7 @@ var HonoDiApplication = class {
1476
1589
  if (normalizedRoute === "*" || path.startsWith(normalizedRoute)) return true;
1477
1590
  if (path === normalizedRoute) return true;
1478
1591
  } else if (typeof route === "object" && route.path && route.method) {
1479
- if (route.method !== -1 && route.method !== "all" /* ALL */ && route.method !== method.toLowerCase()) {
1592
+ if (route.method !== -1 && route.method !== RequestMethod.ALL && route.method !== method.toLowerCase()) {
1480
1593
  continue;
1481
1594
  }
1482
1595
  if (route.path === "*" || path === route.path) return true;
@@ -1533,6 +1646,9 @@ var HonoDiApplication = class {
1533
1646
 
1534
1647
  // src/factory.ts
1535
1648
  var HonoDiFactory = class {
1649
+ static {
1650
+ __name(this, "HonoDiFactory");
1651
+ }
1536
1652
  static logger = new Logger("HonoDiFactory");
1537
1653
  static async create(rootModule, appOrOptions) {
1538
1654
  let app;
@@ -1567,12 +1683,12 @@ var HonoDiFactory = class {
1567
1683
  const globalContextId = new ContextId();
1568
1684
  for (const module of modules.values()) {
1569
1685
  for (const wrapper of module.providers.values()) {
1570
- if (wrapper.scope === 0 /* DEFAULT */) {
1686
+ if (wrapper.scope === Scope.DEFAULT) {
1571
1687
  await injector.loadInstance(wrapper, globalContextId);
1572
1688
  }
1573
1689
  }
1574
1690
  for (const wrapper of module.controllers.values()) {
1575
- if (wrapper.scope === 0 /* DEFAULT */) {
1691
+ if (wrapper.scope === Scope.DEFAULT) {
1576
1692
  await injector.loadInstance(wrapper, globalContextId);
1577
1693
  }
1578
1694
  }
@@ -1597,11 +1713,24 @@ var HonoDiFactory = class {
1597
1713
 
1598
1714
  // src/utils.ts
1599
1715
  function forwardRef(fn) {
1600
- return { forwardRef: fn };
1716
+ return {
1717
+ forwardRef: fn
1718
+ };
1601
1719
  }
1720
+ __name(forwardRef, "forwardRef");
1602
1721
 
1603
1722
  // src/services/reflector.service.ts
1723
+ function _ts_decorate(decorators, target, key, desc) {
1724
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1725
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1726
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1727
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1728
+ }
1729
+ __name(_ts_decorate, "_ts_decorate");
1604
1730
  var Reflector = class {
1731
+ static {
1732
+ __name(this, "Reflector");
1733
+ }
1605
1734
  get(metadataKey, target) {
1606
1735
  return Reflect.getMetadata(metadataKey, target);
1607
1736
  }
@@ -1629,12 +1758,22 @@ var Reflector = class {
1629
1758
  return result;
1630
1759
  }
1631
1760
  };
1632
- Reflector = __decorateClass([
1761
+ Reflector = _ts_decorate([
1633
1762
  Injectable()
1634
1763
  ], Reflector);
1635
1764
 
1636
1765
  // src/common/pipes/index.ts
1766
+ function _ts_decorate2(decorators, target, key, desc) {
1767
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1768
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1769
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1770
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1771
+ }
1772
+ __name(_ts_decorate2, "_ts_decorate");
1637
1773
  var ParseIntPipe = class {
1774
+ static {
1775
+ __name(this, "ParseIntPipe");
1776
+ }
1638
1777
  transform(value, metadata) {
1639
1778
  const isNumeric = !isNaN(parseFloat(value)) && isFinite(value);
1640
1779
  if (!isNumeric) {
@@ -1643,10 +1782,13 @@ var ParseIntPipe = class {
1643
1782
  return parseInt(value, 10);
1644
1783
  }
1645
1784
  };
1646
- ParseIntPipe = __decorateClass([
1785
+ ParseIntPipe = _ts_decorate2([
1647
1786
  Injectable()
1648
1787
  ], ParseIntPipe);
1649
1788
  var ParseFloatPipe = class {
1789
+ static {
1790
+ __name(this, "ParseFloatPipe");
1791
+ }
1650
1792
  transform(value, metadata) {
1651
1793
  const isNumeric = !isNaN(parseFloat(value)) && isFinite(value);
1652
1794
  if (!isNumeric) {
@@ -1655,10 +1797,13 @@ var ParseFloatPipe = class {
1655
1797
  return parseFloat(value);
1656
1798
  }
1657
1799
  };
1658
- ParseFloatPipe = __decorateClass([
1800
+ ParseFloatPipe = _ts_decorate2([
1659
1801
  Injectable()
1660
1802
  ], ParseFloatPipe);
1661
1803
  var ParseBoolPipe = class {
1804
+ static {
1805
+ __name(this, "ParseBoolPipe");
1806
+ }
1662
1807
  transform(value, metadata) {
1663
1808
  if (value === true || value === "true") {
1664
1809
  return true;
@@ -1669,50 +1814,71 @@ var ParseBoolPipe = class {
1669
1814
  throw new BadRequestException("Validation failed (boolean string is expected)");
1670
1815
  }
1671
1816
  };
1672
- ParseBoolPipe = __decorateClass([
1817
+ ParseBoolPipe = _ts_decorate2([
1673
1818
  Injectable()
1674
1819
  ], ParseBoolPipe);
1675
1820
  var ValidationPipe = class {
1821
+ static {
1822
+ __name(this, "ValidationPipe");
1823
+ }
1676
1824
  transform(value, metadata) {
1677
1825
  return value;
1678
1826
  }
1679
1827
  };
1680
- ValidationPipe = __decorateClass([
1828
+ ValidationPipe = _ts_decorate2([
1681
1829
  Injectable()
1682
1830
  ], ValidationPipe);
1683
1831
 
1684
1832
  // src/common/errors/AppError.ts
1685
1833
  var AppError = class _AppError extends Error {
1834
+ static {
1835
+ __name(this, "AppError");
1836
+ }
1837
+ statusCode;
1838
+ message;
1839
+ isOperational;
1686
1840
  constructor(statusCode, message, isOperational = true) {
1687
- super(message);
1688
- this.statusCode = statusCode;
1689
- this.message = message;
1690
- this.isOperational = isOperational;
1841
+ super(message), this.statusCode = statusCode, this.message = message, this.isOperational = isOperational;
1691
1842
  Object.setPrototypeOf(this, _AppError.prototype);
1692
1843
  Error.captureStackTrace(this, this.constructor);
1693
1844
  }
1694
1845
  };
1695
1846
  var NotFoundError = class extends AppError {
1847
+ static {
1848
+ __name(this, "NotFoundError");
1849
+ }
1696
1850
  constructor(message = "Resource not found") {
1697
1851
  super(404, message);
1698
1852
  }
1699
1853
  };
1700
1854
  var BadRequestError = class extends AppError {
1855
+ static {
1856
+ __name(this, "BadRequestError");
1857
+ }
1701
1858
  constructor(message = "Bad request") {
1702
1859
  super(400, message);
1703
1860
  }
1704
1861
  };
1705
1862
  var UnauthorizedError = class extends AppError {
1863
+ static {
1864
+ __name(this, "UnauthorizedError");
1865
+ }
1706
1866
  constructor(message = "Unauthorized") {
1707
1867
  super(401, message);
1708
1868
  }
1709
1869
  };
1710
1870
  var ForbiddenError = class extends AppError {
1871
+ static {
1872
+ __name(this, "ForbiddenError");
1873
+ }
1711
1874
  constructor(message = "Forbidden") {
1712
1875
  super(403, message);
1713
1876
  }
1714
1877
  };
1715
1878
  var ConflictError = class extends AppError {
1879
+ static {
1880
+ __name(this, "ConflictError");
1881
+ }
1716
1882
  constructor(message = "Resource already exists") {
1717
1883
  super(409, message);
1718
1884
  }
@@ -1720,10 +1886,13 @@ var ConflictError = class extends AppError {
1720
1886
 
1721
1887
  // src/common/exceptions/HttpException.ts
1722
1888
  var HttpException2 = class extends Error {
1889
+ static {
1890
+ __name(this, "HttpException");
1891
+ }
1892
+ response;
1893
+ status;
1723
1894
  constructor(response, status) {
1724
- super();
1725
- this.response = response;
1726
- this.status = status;
1895
+ super(), this.response = response, this.status = status;
1727
1896
  this.message = typeof response === "string" ? response : JSON.stringify(response);
1728
1897
  }
1729
1898
  getResponse() {
@@ -1734,14 +1903,31 @@ var HttpException2 = class extends Error {
1734
1903
  }
1735
1904
  static createBody(message, error, statusCode) {
1736
1905
  if (!message) {
1737
- return { statusCode, error };
1906
+ return {
1907
+ statusCode,
1908
+ error
1909
+ };
1738
1910
  }
1739
- return typeof message === "object" && !Array.isArray(message) ? message : { statusCode, error, message };
1911
+ return typeof message === "object" && !Array.isArray(message) ? message : {
1912
+ statusCode,
1913
+ error,
1914
+ message
1915
+ };
1740
1916
  }
1741
1917
  };
1742
1918
 
1743
1919
  // src/common/filters/BaseExceptionFilter.ts
1920
+ function _ts_decorate3(decorators, target, key, desc) {
1921
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1922
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1923
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1924
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1925
+ }
1926
+ __name(_ts_decorate3, "_ts_decorate");
1744
1927
  var BaseExceptionFilter = class {
1928
+ static {
1929
+ __name(this, "BaseExceptionFilter");
1930
+ }
1745
1931
  catch(exception, host) {
1746
1932
  const ctx = host.switchToHttp();
1747
1933
  ctx.getResponse();
@@ -1760,7 +1946,7 @@ var BaseExceptionFilter = class {
1760
1946
  });
1761
1947
  }
1762
1948
  };
1763
- BaseExceptionFilter = __decorateClass([
1949
+ BaseExceptionFilter = _ts_decorate3([
1764
1950
  Catch()
1765
1951
  ], BaseExceptionFilter);
1766
1952