@venizia/ignis 0.0.8-8 → 0.0.9-0
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/base/controllers/common/types.d.ts +24 -4
- package/dist/base/controllers/common/types.d.ts.map +1 -1
- package/dist/base/controllers/common/types.js.map +1 -1
- package/dist/base/controllers/factory/controller.d.ts +85 -31
- package/dist/base/controllers/factory/controller.d.ts.map +1 -1
- package/dist/base/controllers/factory/controller.js +68 -49
- package/dist/base/controllers/factory/controller.js.map +1 -1
- package/dist/base/controllers/factory/definition.d.ts +105 -33
- package/dist/base/controllers/factory/definition.d.ts.map +1 -1
- package/dist/base/controllers/factory/definition.js +17 -9
- package/dist/base/controllers/factory/definition.js.map +1 -1
- package/dist/base/middlewares/app-error.middleware.d.ts.map +1 -1
- package/dist/base/middlewares/app-error.middleware.js +8 -4
- package/dist/base/middlewares/app-error.middleware.js.map +1 -1
- package/dist/base/middlewares/request-spy.middleware.d.ts.map +1 -1
- package/dist/base/middlewares/request-spy.middleware.js +2 -1
- package/dist/base/middlewares/request-spy.middleware.js.map +1 -1
- package/dist/components/auth/authenticate/common/types.d.ts +8 -2
- package/dist/components/auth/authenticate/common/types.d.ts.map +1 -1
- package/dist/components/auth/authenticate/controllers/factory.d.ts.map +1 -1
- package/dist/components/auth/authenticate/controllers/factory.js +30 -4
- package/dist/components/auth/authenticate/controllers/factory.js.map +1 -1
- package/dist/components/health-check/controller.d.ts +1 -5
- package/dist/components/health-check/controller.d.ts.map +1 -1
- package/package.json +23 -22
|
@@ -3,9 +3,10 @@ import type { IAuthorizationSpec } from '../../../components/auth/authorize/comm
|
|
|
3
3
|
import { TAnyObjectSchema } from '../../../utilities/schema.utility';
|
|
4
4
|
import type { RouteConfig as HonoRouteConfig } from '@hono/zod-openapi';
|
|
5
5
|
import { createRoute, Hook, OpenAPIHono, z } from '@hono/zod-openapi';
|
|
6
|
-
import { IConfigurable, ValueOrPromise } from '@venizia/ignis-helpers';
|
|
6
|
+
import { AnyType, IConfigurable, ValueOrPromise } from '@venizia/ignis-helpers';
|
|
7
7
|
import type { TypedResponse } from 'hono';
|
|
8
8
|
import { Context, Env, Schema } from 'hono';
|
|
9
|
+
import { ContentfulStatusCode, StatusCode } from 'hono/utils/http-status';
|
|
9
10
|
/** Typed validation results for route handlers. */
|
|
10
11
|
export interface IValidRequestProps<JsonType = unknown, QueryType = unknown, ParamType = unknown, HeaderType = unknown, CookieType = unknown, FormType = unknown> {
|
|
11
12
|
json?: JsonType;
|
|
@@ -15,17 +16,29 @@ export interface IValidRequestProps<JsonType = unknown, QueryType = unknown, Par
|
|
|
15
16
|
cookie?: CookieType;
|
|
16
17
|
form?: FormType;
|
|
17
18
|
}
|
|
19
|
+
export type TJsonResponse<ResponseBody = unknown, ResponseStatusCode extends StatusCode = StatusCode> = Response & TypedResponse<ResponseBody, ResponseStatusCode, 'json'>;
|
|
20
|
+
/**
|
|
21
|
+
* Polymorphic response body for endpoints that honor the `x-request-count-data`
|
|
22
|
+
* header — returns either the count-wrapped shape `{ count, data }` or the raw
|
|
23
|
+
* payload `T`. Pass the unwrapped payload type as `T`; for arrays use
|
|
24
|
+
* `TCountResponse<TThing[]>`.
|
|
25
|
+
*/
|
|
26
|
+
export type TCountResponse<TData = unknown> = TData | {
|
|
27
|
+
count: number;
|
|
28
|
+
data: TData;
|
|
29
|
+
};
|
|
18
30
|
/** Lightweight typed context that bypasses RouteHandler inference. */
|
|
19
|
-
export type TContext<RouteEnv extends Env = Env, ValidTargetKey extends string = string> = Omit<Context<RouteEnv>, 'req'> & {
|
|
31
|
+
export type TContext<RouteEnv extends Env = Env, ValidTargetKey extends string = string, ResponseBody = unknown> = Omit<Context<RouteEnv>, 'req' | 'json'> & {
|
|
20
32
|
req: Omit<Context<RouteEnv>['req'], 'valid'> & {
|
|
21
33
|
valid<T = unknown>(target: ValidTargetKey): T;
|
|
22
34
|
};
|
|
35
|
+
json<StatusCode extends ContentfulStatusCode = 200>(body: ResponseBody, status?: StatusCode): TJsonResponse<ResponseBody, StatusCode>;
|
|
23
36
|
};
|
|
24
|
-
export type TRouteContext<RouteEnv extends Env = Env> = TContext<RouteEnv, keyof IValidRequestProps>;
|
|
37
|
+
export type TRouteContext<RouteEnv extends Env = Env, ResponseBody = unknown> = TContext<RouteEnv, keyof IValidRequestProps, ResponseBody>;
|
|
25
38
|
/** Casts middleware context to TContext (safe -- structurally identical to Context). */
|
|
26
39
|
export declare const asTypedContext: <E extends Env>(context: unknown) => TContext<E, string>;
|
|
27
40
|
/** Lightweight handler type using TTypedContext to avoid heavy RouteHandler inference. */
|
|
28
|
-
export type TRouteHandler<ResponseType = unknown, RouteEnv extends Env = Env> = (context: TRouteContext<RouteEnv>) => ValueOrPromise<Response | TypedResponse<ResponseType>>;
|
|
41
|
+
export type TRouteHandler<ResponseType = unknown, RouteEnv extends Env = Env> = (context: TRouteContext<RouteEnv, ResponseType>) => ValueOrPromise<Response | TypedResponse<ResponseType>>;
|
|
29
42
|
/** Registered route with its configuration and router instance. */
|
|
30
43
|
export interface IDefineRouteOptions<RouteConfig extends HonoRouteConfig, RouteEnv extends Env = Env, RouteSchema extends Schema = {}, BasePath extends string = '/'> {
|
|
31
44
|
configs: ReturnType<typeof createRoute<string, RouteConfig>>;
|
|
@@ -94,7 +107,13 @@ export type TResponseHeaderObject = {
|
|
|
94
107
|
};
|
|
95
108
|
/** OpenAPI response headers format */
|
|
96
109
|
export type TResponseHeaders = Record<string, TResponseHeaderObject>;
|
|
110
|
+
type TInferDistributive<S> = S extends z.ZodType ? z.infer<S> : never;
|
|
111
|
+
export type TResponseBodyOf<R extends {
|
|
112
|
+
responses: AnyType;
|
|
113
|
+
}> = TInferDistributive<R['responses'][keyof R['responses']]['content']['application/json']['schema']>;
|
|
97
114
|
export type TCustomizableRouteConfig = TRouteAuthConfig & {
|
|
115
|
+
/** Whether this route is registered. Defaults to true. */
|
|
116
|
+
enabled?: boolean;
|
|
98
117
|
request?: {
|
|
99
118
|
params?: TAnyObjectSchema;
|
|
100
119
|
query?: TAnyObjectSchema;
|
|
@@ -118,4 +137,5 @@ export interface ICustomizableRoutes<RouteConfig extends TCustomizableRouteConfi
|
|
|
118
137
|
deleteById?: RouteConfig;
|
|
119
138
|
deleteBy?: RouteConfig;
|
|
120
139
|
}
|
|
140
|
+
export {};
|
|
121
141
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/base/controllers/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAC3F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/base/controllers/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAC3F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,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../../../src/base/controllers/common/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/base/controllers/common/types.ts"],"names":[],"mappings":";;;AA2DA,wFAAwF;AACjF,MAAM,cAAc,GAAG,CAAgB,OAAgB,EAAuB,EAAE;IACrF,OAAO,OAA8B,CAAC;AACxC,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB"}
|
|
@@ -19,6 +19,12 @@ export interface ICrudControllerOptions<EntitySchema extends TTableSchemaWithId,
|
|
|
19
19
|
name: string;
|
|
20
20
|
basePath: string;
|
|
21
21
|
readonly?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whitelist of routes to enable. When provided, only the listed routes are registered.
|
|
24
|
+
* Takes priority over per-route `enabled` flag in `routes`.
|
|
25
|
+
* @example enabledRoutes: ['count'] // only registers GET /count
|
|
26
|
+
*/
|
|
27
|
+
enabledRoutes?: Array<keyof ICustomizableRoutes>;
|
|
22
28
|
isStrict?: {
|
|
23
29
|
path?: boolean;
|
|
24
30
|
requestSchema?: boolean;
|
|
@@ -55,43 +61,39 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
55
61
|
/** GET /count */
|
|
56
62
|
count(opts: {
|
|
57
63
|
context: TRouteContext<RouteEnv>;
|
|
58
|
-
}): Promise<
|
|
64
|
+
}): Promise<import("../common").TJsonResponse<unknown, 200>>;
|
|
59
65
|
/** GET / - Returns paginated list with Content-Range header. */
|
|
60
66
|
find(opts: {
|
|
61
67
|
context: TRouteContext<RouteEnv>;
|
|
62
|
-
}): Promise<
|
|
68
|
+
}): Promise<import("../common").TJsonResponse<unknown, 200>>;
|
|
63
69
|
/** GET /:id */
|
|
64
70
|
findById(opts: {
|
|
65
71
|
context: TRouteContext<RouteEnv>;
|
|
66
|
-
}): Promise<
|
|
72
|
+
}): Promise<import("../common").TJsonResponse<unknown, 200>>;
|
|
67
73
|
/** GET /find-one */
|
|
68
74
|
findOne(opts: {
|
|
69
75
|
context: TRouteContext<RouteEnv>;
|
|
70
|
-
}): Promise<
|
|
76
|
+
}): Promise<import("../common").TJsonResponse<unknown, 200>>;
|
|
71
77
|
/** POST / */
|
|
72
78
|
create(opts: {
|
|
73
79
|
context: TRouteContext<RouteEnv>;
|
|
74
|
-
}): Promise<
|
|
80
|
+
}): Promise<import("../common").TJsonResponse<unknown, 201>>;
|
|
75
81
|
/** PATCH /:id */
|
|
76
82
|
updateById(opts: {
|
|
77
83
|
context: TRouteContext<RouteEnv>;
|
|
78
|
-
}): Promise<
|
|
84
|
+
}): Promise<import("../common").TJsonResponse<unknown, 200>>;
|
|
79
85
|
/** PATCH / */
|
|
80
86
|
updateBy(opts: {
|
|
81
87
|
context: TRouteContext<RouteEnv>;
|
|
82
|
-
}): Promise<
|
|
83
|
-
message: string;
|
|
84
|
-
}, 400, "json">)>;
|
|
88
|
+
}): Promise<import("../common").TJsonResponse<unknown, 200> | import("../common").TJsonResponse<unknown, 400>>;
|
|
85
89
|
/** DELETE /:id */
|
|
86
90
|
deleteById(opts: {
|
|
87
91
|
context: TRouteContext<RouteEnv>;
|
|
88
|
-
}): Promise<
|
|
92
|
+
}): Promise<import("../common").TJsonResponse<unknown, 200>>;
|
|
89
93
|
/** DELETE / */
|
|
90
94
|
deleteBy(opts: {
|
|
91
95
|
context: TRouteContext<RouteEnv>;
|
|
92
|
-
}): Promise<
|
|
93
|
-
message: string;
|
|
94
|
-
}, 400, "json">)>;
|
|
96
|
+
}): Promise<import("../common").TJsonResponse<unknown, 200> | import("../common").TJsonResponse<unknown, 400>>;
|
|
95
97
|
/** Registers all CRUD route handlers. */
|
|
96
98
|
binding(): ValueOrPromise<void>;
|
|
97
99
|
toHonoHandler<ResponseType = unknown>(opts: {
|
|
@@ -138,7 +140,9 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
138
140
|
description: string;
|
|
139
141
|
content: {
|
|
140
142
|
'application/json': {
|
|
141
|
-
schema: z.
|
|
143
|
+
schema: z.ZodObject<{
|
|
144
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
145
|
+
}, z.core.$strip>;
|
|
142
146
|
};
|
|
143
147
|
};
|
|
144
148
|
required: boolean | undefined;
|
|
@@ -147,7 +151,9 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
147
151
|
description: string;
|
|
148
152
|
content: {
|
|
149
153
|
'application/json': {
|
|
150
|
-
schema: z.
|
|
154
|
+
schema: z.ZodObject<{
|
|
155
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
156
|
+
}, z.core.$strip>;
|
|
151
157
|
};
|
|
152
158
|
};
|
|
153
159
|
required: boolean | undefined;
|
|
@@ -193,7 +199,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
193
199
|
description: string;
|
|
194
200
|
content: {
|
|
195
201
|
'application/json': {
|
|
196
|
-
schema: z.
|
|
202
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
203
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
204
|
+
data: z.ZodArray<import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>>;
|
|
205
|
+
}, z.core.$strip>, z.ZodArray<import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>>]>;
|
|
197
206
|
};
|
|
198
207
|
};
|
|
199
208
|
required: boolean | undefined;
|
|
@@ -202,7 +211,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
202
211
|
description: string;
|
|
203
212
|
content: {
|
|
204
213
|
'application/json': {
|
|
205
|
-
schema: z.
|
|
214
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
215
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
216
|
+
data: z.ZodArray<import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>>;
|
|
217
|
+
}, z.core.$strip>, z.ZodArray<import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>>]>;
|
|
206
218
|
};
|
|
207
219
|
};
|
|
208
220
|
required: boolean | undefined;
|
|
@@ -253,7 +265,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
253
265
|
description: string;
|
|
254
266
|
content: {
|
|
255
267
|
'application/json': {
|
|
256
|
-
schema: z.
|
|
268
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
269
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
270
|
+
data: import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>;
|
|
271
|
+
}, z.core.$strip>, import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>]>;
|
|
257
272
|
};
|
|
258
273
|
};
|
|
259
274
|
required: boolean | undefined;
|
|
@@ -262,7 +277,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
262
277
|
description: string;
|
|
263
278
|
content: {
|
|
264
279
|
'application/json': {
|
|
265
|
-
schema: z.
|
|
280
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
281
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
282
|
+
data: import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>;
|
|
283
|
+
}, z.core.$strip>, import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>]>;
|
|
266
284
|
};
|
|
267
285
|
};
|
|
268
286
|
required: boolean | undefined;
|
|
@@ -308,7 +326,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
308
326
|
description: string;
|
|
309
327
|
content: {
|
|
310
328
|
'application/json': {
|
|
311
|
-
schema: z.
|
|
329
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
330
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
331
|
+
data: import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>;
|
|
332
|
+
}, z.core.$strip>, import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>]>;
|
|
312
333
|
};
|
|
313
334
|
};
|
|
314
335
|
required: boolean | undefined;
|
|
@@ -317,7 +338,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
317
338
|
description: string;
|
|
318
339
|
content: {
|
|
319
340
|
'application/json': {
|
|
320
|
-
schema: z.
|
|
341
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
342
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
343
|
+
data: import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>;
|
|
344
|
+
}, z.core.$strip>, import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>]>;
|
|
321
345
|
};
|
|
322
346
|
};
|
|
323
347
|
required: boolean | undefined;
|
|
@@ -369,7 +393,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
369
393
|
description: string;
|
|
370
394
|
content: {
|
|
371
395
|
'application/json': {
|
|
372
|
-
schema: z.
|
|
396
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
397
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
398
|
+
data: import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>;
|
|
399
|
+
}, z.core.$strip>, import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>]>;
|
|
373
400
|
};
|
|
374
401
|
};
|
|
375
402
|
required: boolean | undefined;
|
|
@@ -378,7 +405,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
378
405
|
description: string;
|
|
379
406
|
content: {
|
|
380
407
|
'application/json': {
|
|
381
|
-
schema: z.
|
|
408
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
409
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
410
|
+
data: import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>;
|
|
411
|
+
}, z.core.$strip>, import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>]>;
|
|
382
412
|
};
|
|
383
413
|
};
|
|
384
414
|
required: boolean | undefined;
|
|
@@ -435,7 +465,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
435
465
|
description: string;
|
|
436
466
|
content: {
|
|
437
467
|
'application/json': {
|
|
438
|
-
schema: z.
|
|
468
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
469
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
470
|
+
data: import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>;
|
|
471
|
+
}, z.core.$strip>, import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>]>;
|
|
439
472
|
};
|
|
440
473
|
};
|
|
441
474
|
required: boolean | undefined;
|
|
@@ -444,7 +477,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
444
477
|
description: string;
|
|
445
478
|
content: {
|
|
446
479
|
'application/json': {
|
|
447
|
-
schema: z.
|
|
480
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
481
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
482
|
+
data: import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>;
|
|
483
|
+
}, z.core.$strip>, import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>]>;
|
|
448
484
|
};
|
|
449
485
|
};
|
|
450
486
|
required: boolean | undefined;
|
|
@@ -499,7 +535,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
499
535
|
description: string;
|
|
500
536
|
content: {
|
|
501
537
|
'application/json': {
|
|
502
|
-
schema: z.
|
|
538
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
539
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
540
|
+
data: z.ZodArray<import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>>;
|
|
541
|
+
}, z.core.$strip>, z.ZodArray<import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>>]>;
|
|
503
542
|
};
|
|
504
543
|
};
|
|
505
544
|
required: boolean | undefined;
|
|
@@ -508,7 +547,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
508
547
|
description: string;
|
|
509
548
|
content: {
|
|
510
549
|
'application/json': {
|
|
511
|
-
schema: z.
|
|
550
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
551
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
552
|
+
data: z.ZodArray<import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>>;
|
|
553
|
+
}, z.core.$strip>, z.ZodArray<import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>>]>;
|
|
512
554
|
};
|
|
513
555
|
};
|
|
514
556
|
required: boolean | undefined;
|
|
@@ -556,7 +598,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
556
598
|
description: string;
|
|
557
599
|
content: {
|
|
558
600
|
'application/json': {
|
|
559
|
-
schema: z.
|
|
601
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
602
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
603
|
+
data: import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>;
|
|
604
|
+
}, z.core.$strip>, import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>]>;
|
|
560
605
|
};
|
|
561
606
|
};
|
|
562
607
|
required: boolean | undefined;
|
|
@@ -565,7 +610,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
565
610
|
description: string;
|
|
566
611
|
content: {
|
|
567
612
|
'application/json': {
|
|
568
|
-
schema: z.
|
|
613
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
614
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
615
|
+
data: import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>;
|
|
616
|
+
}, z.core.$strip>, import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>]>;
|
|
569
617
|
};
|
|
570
618
|
};
|
|
571
619
|
required: boolean | undefined;
|
|
@@ -611,7 +659,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
611
659
|
description: string;
|
|
612
660
|
content: {
|
|
613
661
|
'application/json': {
|
|
614
|
-
schema: z.
|
|
662
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
663
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
664
|
+
data: z.ZodArray<import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>>;
|
|
665
|
+
}, z.core.$strip>, z.ZodArray<import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>>]>;
|
|
615
666
|
};
|
|
616
667
|
};
|
|
617
668
|
required: boolean | undefined;
|
|
@@ -620,7 +671,10 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
620
671
|
description: string;
|
|
621
672
|
content: {
|
|
622
673
|
'application/json': {
|
|
623
|
-
schema: z.
|
|
674
|
+
schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
675
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
676
|
+
data: z.ZodArray<import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>>;
|
|
677
|
+
}, z.core.$strip>, z.ZodArray<import("drizzle-zod").BuildSchema<"insert", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"update", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined> | import("drizzle-zod").BuildSchema<"select", EntitySchema["_"]["columns"], undefined, true | Partial<Record<"string" | "number" | "bigint" | "boolean" | "date", true>> | undefined>>]>;
|
|
624
678
|
};
|
|
625
679
|
};
|
|
626
680
|
required: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../../src/base/contro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.BaseHelper {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
// 1. Resolve EntityClass
|
|
25
|
-
|
|
26
|
-
if ((0, ignis_inversion_1.isClass)(entity)) {
|
|
27
|
-
_entityClass = entity;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
_entityClass = entity();
|
|
31
|
-
}
|
|
25
|
+
const _entityClass = (0, ignis_inversion_1.isClass)(entity) ? entity : entity();
|
|
32
26
|
const entityInstance = new _entityClass();
|
|
33
27
|
// 2. Define required CRU (Create - Retrieve - Update) schema
|
|
28
|
+
const entitySchema = {
|
|
29
|
+
select: entityInstance.getSchema({ type: constants_1.SchemaTypes.SELECT }),
|
|
30
|
+
create: entityInstance.getSchema({ type: constants_1.SchemaTypes.CREATE }),
|
|
31
|
+
update: entityInstance.getSchema({ type: constants_1.SchemaTypes.UPDATE }),
|
|
32
|
+
};
|
|
34
33
|
const routeDefinitions = (0, definition_1.defineControllerRouteConfigs)({
|
|
35
34
|
isStrict: isStrict.requestSchema ?? true,
|
|
36
35
|
idType: (0, types_1.getIdType)({ entity: entityInstance.schema }),
|
|
37
36
|
authenticate,
|
|
38
37
|
authorize,
|
|
39
38
|
routes,
|
|
40
|
-
schema:
|
|
41
|
-
select: entityInstance.getSchema({ type: constants_1.SchemaTypes.SELECT }),
|
|
42
|
-
create: entityInstance.getSchema({ type: constants_1.SchemaTypes.CREATE }),
|
|
43
|
-
update: entityInstance.getSchema({ type: constants_1.SchemaTypes.UPDATE }),
|
|
44
|
-
},
|
|
39
|
+
schema: entitySchema,
|
|
45
40
|
});
|
|
46
41
|
// 3. Define class
|
|
47
42
|
const _controller = class extends base_1.BaseRestController {
|
|
@@ -283,47 +278,71 @@ class ControllerFactory extends ignis_helpers_1.BaseHelper {
|
|
|
283
278
|
}
|
|
284
279
|
/** Registers all CRUD route handlers. */
|
|
285
280
|
binding() {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
281
|
+
const isEnabled = (routeKey) => {
|
|
282
|
+
if (controller.enabledRoutes) {
|
|
283
|
+
return controller.enabledRoutes.includes(routeKey);
|
|
284
|
+
}
|
|
285
|
+
return routes?.[routeKey]?.enabled !== false;
|
|
286
|
+
};
|
|
287
|
+
// Read routes — always registered (unless explicitly disabled)
|
|
288
|
+
if (isEnabled('count')) {
|
|
289
|
+
this.defineRoute({
|
|
290
|
+
configs: routeDefinitions.COUNT,
|
|
291
|
+
handler: async (context) => this.count({ context }),
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
if (isEnabled('find')) {
|
|
295
|
+
this.defineRoute({
|
|
296
|
+
configs: routeDefinitions.FIND,
|
|
297
|
+
handler: async (context) => this.find({ context }),
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
if (isEnabled('findOne')) {
|
|
301
|
+
this.defineRoute({
|
|
302
|
+
configs: routeDefinitions.FIND_ONE,
|
|
303
|
+
handler: async (context) => this.findOne({ context }),
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
if (isEnabled('findById')) {
|
|
307
|
+
this.defineRoute({
|
|
308
|
+
configs: routeDefinitions.FIND_BY_ID,
|
|
309
|
+
handler: async (context) => this.findById({ context }),
|
|
310
|
+
});
|
|
311
|
+
}
|
|
303
312
|
// Write routes — skipped when readonly
|
|
304
313
|
if (controller.readonly) {
|
|
305
314
|
return;
|
|
306
315
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
316
|
+
if (isEnabled('create')) {
|
|
317
|
+
this.defineRoute({
|
|
318
|
+
configs: routeDefinitions.CREATE,
|
|
319
|
+
handler: async (context) => this.create({ context }),
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
if (isEnabled('updateById')) {
|
|
323
|
+
this.defineRoute({
|
|
324
|
+
configs: routeDefinitions.UPDATE_BY_ID,
|
|
325
|
+
handler: async (context) => this.updateById({ context }),
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
if (isEnabled('updateBy')) {
|
|
329
|
+
this.defineRoute({
|
|
330
|
+
configs: routeDefinitions.UPDATE_BY,
|
|
331
|
+
handler: async (context) => this.updateBy({ context }),
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
if (isEnabled('deleteById')) {
|
|
335
|
+
this.defineRoute({
|
|
336
|
+
configs: routeDefinitions.DELETE_BY_ID,
|
|
337
|
+
handler: async (context) => this.deleteById({ context }),
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
if (isEnabled('deleteBy')) {
|
|
341
|
+
this.defineRoute({
|
|
342
|
+
configs: routeDefinitions.DELETE_BY,
|
|
343
|
+
handler: async (context) => this.deleteBy({ context }),
|
|
344
|
+
});
|
|
345
|
+
}
|
|
327
346
|
}
|
|
328
347
|
};
|
|
329
348
|
// Set the class name dynamically
|