@bool-ts/core 1.5.10 → 1.6.1

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.
@@ -6,7 +6,8 @@ export declare enum EArgumentTypes {
6
6
  param = "PARAM",
7
7
  query = "QUERY",
8
8
  request = "REQUEST",
9
- responseHeaders = "RESPONSE_HEADERS"
9
+ responseHeaders = "RESPONSE_HEADERS",
10
+ config = "CONFIG"
10
11
  }
11
12
  export type TArgumentsMetadata = {
12
13
  index: number;
@@ -38,6 +39,10 @@ export type TArgumentsMetadata = {
38
39
  index: number;
39
40
  type: EArgumentTypes.responseHeaders;
40
41
  zodSchema?: Zod.Schema;
42
+ } | {
43
+ index: number;
44
+ type: EArgumentTypes.config;
45
+ zodSchema?: Zod.Schema;
41
46
  };
42
47
  export declare const argumentsKey: unique symbol;
43
48
  export declare const RequestHeaders: (zodSchema?: Zod.Schema) => (target: Object, methodName: string | symbol | undefined, parameterIndex: number) => void;
@@ -47,3 +52,4 @@ export declare const Param: (key: string, zodSchema?: Zod.Schema) => (target: Ob
47
52
  export declare const Query: (zodSchema?: Zod.Schema) => (target: Object, methodName: string | symbol | undefined, parameterIndex: number) => void;
48
53
  export declare const Request: (zodSchema?: Zod.Schema) => (target: Object, methodName: string | symbol | undefined, parameterIndex: number) => void;
49
54
  export declare const ResponseHeaders: (zodSchema?: Zod.Schema) => (target: Object, methodName: string | symbol | undefined, parameterIndex: number) => void;
55
+ export declare const Config: (zodSchema?: Zod.Schema) => (target: Object, methodName: string | symbol | undefined, parameterIndex: number) => void;
@@ -8,6 +8,7 @@ export var EArgumentTypes;
8
8
  EArgumentTypes["query"] = "QUERY";
9
9
  EArgumentTypes["request"] = "REQUEST";
10
10
  EArgumentTypes["responseHeaders"] = "RESPONSE_HEADERS";
11
+ EArgumentTypes["config"] = "CONFIG";
11
12
  })(EArgumentTypes || (EArgumentTypes = {}));
12
13
  export const argumentsKey = Symbol.for("__bool:arguments__");
13
14
  export const RequestHeaders = (zodSchema) => {
@@ -108,3 +109,17 @@ export const ResponseHeaders = (zodSchema) => {
108
109
  Reflect.defineMetadata(argumentsKey, queryMetadata, target.constructor, methodName);
109
110
  };
110
111
  };
112
+ export const Config = (zodSchema) => {
113
+ return (target, methodName, parameterIndex) => {
114
+ if (!methodName) {
115
+ return;
116
+ }
117
+ const queryMetadata = Reflect.getOwnMetadata(argumentsKey, target.constructor, methodName) || {};
118
+ queryMetadata[`argumentIndexes.${parameterIndex}`] = {
119
+ index: parameterIndex,
120
+ type: EArgumentTypes.config,
121
+ zodSchema: zodSchema
122
+ };
123
+ Reflect.defineMetadata(argumentsKey, queryMetadata, target.constructor, methodName);
124
+ };
125
+ };
@@ -1,4 +1,4 @@
1
- export { RequestHeaders, Body, Params, Param, Query, Request, ResponseHeaders, EArgumentTypes, argumentsKey } from "./arguments";
1
+ export { Body, Config, Params, Param, Query, Request, RequestHeaders, ResponseHeaders, EArgumentTypes, argumentsKey } from "./arguments";
2
2
  export { Controller, controllerKey } from "./controller";
3
3
  export { Guard, guardKey } from "./guard";
4
4
  export { Inject, injectKey } from "./inject";
@@ -1,4 +1,4 @@
1
- export { RequestHeaders, Body, Params, Param, Query, Request, ResponseHeaders, EArgumentTypes, argumentsKey } from "./arguments";
1
+ export { Body, Config, Params, Param, Query, Request, RequestHeaders, ResponseHeaders, EArgumentTypes, argumentsKey } from "./arguments";
2
2
  export { Controller, controllerKey } from "./controller";
3
3
  export { Guard, guardKey } from "./guard";
4
4
  export { Inject, injectKey } from "./inject";
@@ -1,6 +1,7 @@
1
1
  import type { IModule } from "../interfaces/module";
2
2
  type TInstances = Array<new (...args: any[]) => any>;
3
3
  export type TModuleOptions = Partial<{
4
+ config: Record<string | symbol, any> | (() => Record<string | symbol, any> | Promise<Record<string | symbol, any>>);
4
5
  prefix: string;
5
6
  dependencies: TInstances;
6
7
  controllers: TInstances;
@@ -10,6 +11,7 @@ export type TModuleOptions = Partial<{
10
11
  afterDispatchers: TInstances;
11
12
  }> | undefined;
12
13
  export type TModuleMetadata = Partial<{
14
+ config: Record<string | symbol, any> | (() => Record<string | symbol, any> | Promise<Record<string | symbol, any>>);
13
15
  prefix: string;
14
16
  controllers: TInstances;
15
17
  dependencies: TInstances;
@@ -6,6 +6,7 @@ import { RouterGroup } from "../entities";
6
6
  export type TBoolFactoryOptions = Required<{
7
7
  port: number;
8
8
  }> & Partial<{
9
+ config: Record<string | symbol, any> | (() => Record<string | symbol, any>);
9
10
  prefix: string;
10
11
  debug: boolean;
11
12
  log: Partial<{
@@ -15,5 +16,5 @@ export type TBoolFactoryOptions = Required<{
15
16
  }>;
16
17
  export declare const controllerCreator: (controllerConstructor: new (...args: any[]) => unknown, group: RouterGroup, prefix?: string) => RouterGroup;
17
18
  export declare const argumentsResolution: (data: unknown, zodSchema: Zod.Schema, argumentIndex: number, funcName: string | symbol) => Promise<any>;
18
- export declare const BoolFactory: (target: new (...args: any[]) => unknown, options: TBoolFactoryOptions) => import("bun").Server | undefined;
19
+ export declare const BoolFactory: (target: new (...args: any[]) => unknown, options: TBoolFactoryOptions) => Promise<import("bun").Server | undefined>;
19
20
  export default BoolFactory;