vona-module-a-openapi 5.0.11 → 5.0.12

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.
Files changed (69) hide show
  1. package/dist/.metadata/index.d.ts +222 -0
  2. package/dist/.metadata/index.js +39 -0
  3. package/dist/.metadata/this.d.ts +2 -0
  4. package/dist/.metadata/this.js +2 -0
  5. package/dist/config/config.d.ts +12 -0
  6. package/dist/config/config.js +30 -0
  7. package/dist/config/locale/en-us.d.ts +80 -0
  8. package/dist/config/locale/en-us.js +2 -0
  9. package/dist/config/locale/zh-cn.d.ts +80 -0
  10. package/dist/config/locale/zh-cn.js +2 -0
  11. package/dist/index.d.ts +3 -0
  12. package/dist/index.js +3 -0
  13. package/dist/lib/decorator/api.d.ts +23 -0
  14. package/dist/lib/decorator/api.js +71 -0
  15. package/dist/lib/decorator/arguments.d.ts +38 -0
  16. package/dist/lib/decorator/arguments.js +39 -0
  17. package/dist/lib/decorator/field.d.ts +2 -0
  18. package/dist/lib/decorator/field.js +15 -0
  19. package/dist/lib/decorator/index.d.ts +3 -0
  20. package/dist/lib/decorator/index.js +3 -0
  21. package/dist/lib/decorator/pipesArgument.d.ts +2 -0
  22. package/dist/lib/decorator/pipesArgument.js +35 -0
  23. package/dist/lib/index.d.ts +4 -0
  24. package/dist/lib/index.js +4 -0
  25. package/dist/lib/schema/bodySchemaWrapper.d.ts +14 -0
  26. package/dist/lib/schema/bodySchemaWrapper.js +8 -0
  27. package/dist/lib/schema/index.d.ts +4 -0
  28. package/dist/lib/schema/index.js +4 -0
  29. package/dist/lib/schema/makeSchemaLikes.d.ts +4 -0
  30. package/dist/lib/schema/makeSchemaLikes.js +29 -0
  31. package/dist/lib/schema/schema.d.ts +11 -0
  32. package/dist/lib/schema/schema.js +40 -0
  33. package/dist/lib/schema/v/helpers.d.ts +13 -0
  34. package/dist/lib/schema/v/helpers.js +36 -0
  35. package/dist/lib/schema/v/openapi.d.ts +7 -0
  36. package/dist/lib/schema/v/openapi.js +20 -0
  37. package/dist/lib/schema/v/system.d.ts +9 -0
  38. package/dist/lib/schema/v/system.js +34 -0
  39. package/dist/lib/schema/v.d.ts +20 -0
  40. package/dist/lib/schema/v.js +22 -0
  41. package/dist/lib/utils.d.ts +4 -0
  42. package/dist/lib/utils.js +43 -0
  43. package/dist/lib/zod/errorUtil.d.ts +9 -0
  44. package/dist/lib/zod/errorUtil.js +1 -0
  45. package/dist/lib/zod/errorsAdapter.d.ts +2 -0
  46. package/dist/lib/zod/errorsAdapter.js +9 -0
  47. package/dist/lib/zod/index.d.ts +2 -0
  48. package/dist/lib/zod/index.js +2 -0
  49. package/dist/main.d.ts +7 -0
  50. package/dist/main.js +9 -0
  51. package/dist/service/openapi.d.ts +19 -0
  52. package/dist/service/openapi.js +352 -0
  53. package/dist/types/actions.d.ts +15 -0
  54. package/dist/types/actions.js +1 -0
  55. package/dist/types/api.d.ts +33 -0
  56. package/dist/types/api.js +1 -0
  57. package/dist/types/behavior.d.ts +10 -0
  58. package/dist/types/behavior.js +1 -0
  59. package/dist/types/component.d.ts +11 -0
  60. package/dist/types/component.js +1 -0
  61. package/dist/types/database.d.ts +4 -0
  62. package/dist/types/database.js +4 -0
  63. package/dist/types/decorator.d.ts +30 -0
  64. package/dist/types/decorator.js +4 -0
  65. package/dist/types/index.d.ts +8 -0
  66. package/dist/types/index.js +8 -0
  67. package/dist/types/rest.d.ts +37 -0
  68. package/dist/types/rest.js +2 -0
  69. package/package.json +7 -3
@@ -0,0 +1,15 @@
1
+ import { appMetadata } from 'vona';
2
+ import { makeSchemaLikes } from "../schema/makeSchemaLikes.js";
3
+ import { getTargetDecoratorRuleColumns, getTargetDecoratorRules } from "../utils.js";
4
+ export function Field(...schemaLikes) {
5
+ return function (target, prop) {
6
+ // rules
7
+ const rules = getTargetDecoratorRules(target);
8
+ // rule
9
+ const metaType = appMetadata.getDesignType(target, prop);
10
+ rules[prop] = makeSchemaLikes(schemaLikes, metaType);
11
+ //
12
+ const columns = getTargetDecoratorRuleColumns(target);
13
+ columns[prop] = prop;
14
+ };
15
+ }
@@ -0,0 +1,3 @@
1
+ export * from './api.ts';
2
+ export * from './arguments.ts';
3
+ export * from './pipesArgument.ts';
@@ -0,0 +1,3 @@
1
+ export * from "./api.js";
2
+ export * from "./arguments.js";
3
+ export * from "./pipesArgument.js";
@@ -0,0 +1,2 @@
1
+ import type { RouteHandlerArgumentType, SchemaLike, TypeExtractValue } from '../../types/decorator.ts';
2
+ export declare function createPipesArgumentDecorator(paramType: RouteHandlerArgumentType, extractValue?: TypeExtractValue): (field?: string | SchemaLike, ...schemaLikes: SchemaLike[]) => ParameterDecorator;
@@ -0,0 +1,35 @@
1
+ import { appMetadata } from 'vona';
2
+ import { z } from 'zod';
3
+ import { SymbolRouteHandlersArgumentsMeta, } from "../../types/decorator.js";
4
+ import { makeSchemaLikes } from "../schema/makeSchemaLikes.js";
5
+ export function createPipesArgumentDecorator(paramType, extractValue) {
6
+ return function (field, ...schemaLikes) {
7
+ return function (target, prop, index) {
8
+ // not inherit
9
+ const argsMeta = appMetadata.getOwnMetadataArray(false, SymbolRouteHandlersArgumentsMeta, target, prop);
10
+ const hasParamField = typeof field === 'string';
11
+ const paramField = hasParamField ? field : undefined;
12
+ const paramSchemaLikes = hasParamField ? schemaLikes : [field, ...schemaLikes].filter(item => !!item);
13
+ const paramtypes = appMetadata.getMetadata('design:paramtypes', target, prop);
14
+ let metaType;
15
+ if (paramType === 'file') {
16
+ metaType = z.string().openapi({ format: 'binary' });
17
+ }
18
+ else if (paramType === 'files') {
19
+ metaType = z.array(z.string().openapi({ format: 'binary' }));
20
+ }
21
+ else {
22
+ metaType = paramtypes[index];
23
+ }
24
+ const argSchema = makeSchemaLikes(paramSchemaLikes, metaType);
25
+ argsMeta.push({
26
+ index,
27
+ type: paramType,
28
+ field: paramField,
29
+ pipes: [argSchema],
30
+ schema: argSchema,
31
+ extractValue,
32
+ });
33
+ };
34
+ };
35
+ }
@@ -0,0 +1,4 @@
1
+ export * from './decorator/index.ts';
2
+ export * from './schema/index.ts';
3
+ export * from './utils.ts';
4
+ export * from './zod/index.ts';
@@ -0,0 +1,4 @@
1
+ export * from "./decorator/index.js";
2
+ export * from "./schema/index.js";
3
+ export * from "./utils.js";
4
+ export * from "./zod/index.js";
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ export declare function bodySchemaWrapperDefault(bodySchema: any): z.ZodObject<{
3
+ code: z.ZodString;
4
+ message: z.ZodString;
5
+ data: any;
6
+ }, "strip", z.ZodTypeAny, {
7
+ message: string;
8
+ code: string;
9
+ data?: any;
10
+ }, {
11
+ message: string;
12
+ code: string;
13
+ data?: any;
14
+ }>;
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ export function bodySchemaWrapperDefault(bodySchema) {
3
+ return z.object({
4
+ code: z.string(),
5
+ message: z.string(),
6
+ data: bodySchema,
7
+ });
8
+ }
@@ -0,0 +1,4 @@
1
+ export * from './bodySchemaWrapper.ts';
2
+ export * from './makeSchemaLikes.ts';
3
+ export * from './schema.ts';
4
+ export * from './v.ts';
@@ -0,0 +1,4 @@
1
+ export * from "./bodySchemaWrapper.js";
2
+ export * from "./makeSchemaLikes.js";
3
+ export * from "./schema.js";
4
+ export * from "./v.js";
@@ -0,0 +1,4 @@
1
+ import type { z } from 'zod';
2
+ import type { SchemaLike } from '../../types/decorator.ts';
3
+ export declare function makeSchemaLikes(schemaLikes: SchemaLike[], typeInit: any): z.ZodSchema;
4
+ export declare function makeSchemaLike(schemaLike: SchemaLike | undefined, schemaPrevious: z.ZodSchema): z.ZodSchema;
@@ -0,0 +1,29 @@
1
+ import { cast, isClassStrict } from 'vona';
2
+ import { $schema } from "./schema.js";
3
+ export function makeSchemaLikes(schemaLikes, typeInit) {
4
+ // default schema
5
+ let argSchema = $schema(typeInit);
6
+ // loop
7
+ for (let index = schemaLikes.length - 1; index >= 0; index--) {
8
+ const schemaLike = schemaLikes[index];
9
+ argSchema = makeSchemaLike(schemaLike, argSchema);
10
+ }
11
+ return argSchema;
12
+ }
13
+ export function makeSchemaLike(schemaLike, schemaPrevious) {
14
+ if (!schemaLike)
15
+ return schemaPrevious;
16
+ if (Object.prototype.hasOwnProperty.call(schemaLike, 'parseAsync')) {
17
+ // schema
18
+ return schemaLike;
19
+ }
20
+ else if (isClassStrict(schemaLike) ||
21
+ ['String', 'Number', 'Boolean', 'Date', 'BigInt', 'Array'].includes(cast(schemaLike).name)) {
22
+ // class
23
+ return $schema(cast(schemaLike));
24
+ }
25
+ else {
26
+ // function
27
+ return cast(schemaLike)(schemaPrevious);
28
+ }
29
+ }
@@ -0,0 +1,11 @@
1
+ import type { Constructable } from 'vona';
2
+ import type { ISchemaObjectOptions } from '../../types/decorator.ts';
3
+ import { z } from 'zod';
4
+ export declare function $schema(schemaLike: z.ZodSchema): z.ZodSchema;
5
+ export declare function $schema(classType: StringConstructor): z.ZodString;
6
+ export declare function $schema(classType: NumberConstructor): z.ZodNumber;
7
+ export declare function $schema(classType: BooleanConstructor): z.ZodBoolean;
8
+ export declare function $schema(classType: DateConstructor): z.ZodDate;
9
+ export declare function $schema(classType: BigIntConstructor): z.ZodBigInt;
10
+ export declare function $schema(classType: ArrayConstructor): z.ZodArray<z.ZodAny>;
11
+ export declare function $schema<T>(classType: Constructable<T>, options?: ISchemaObjectOptions): z.ZodSchema<T>;
@@ -0,0 +1,40 @@
1
+ import { appMetadata, appResource, cast } from 'vona';
2
+ import { z } from 'zod';
3
+ import { SymbolDecoratorRule } from "../../types/decorator.js";
4
+ export function $schema(classType, options) {
5
+ if (!classType)
6
+ return z.any();
7
+ if (classType.parseAsync)
8
+ return classType;
9
+ if (classType.name === 'String')
10
+ return z.string();
11
+ if (classType.name === 'Number')
12
+ return z.number();
13
+ if (classType.name === 'Boolean')
14
+ return z.boolean();
15
+ if (classType.name === 'Date')
16
+ return z.date();
17
+ if (classType.name === 'BigInt')
18
+ return z.bigint();
19
+ if (classType.name === 'Array')
20
+ return z.array(z.any());
21
+ // check if object
22
+ const rules = classType.prototype ? appMetadata.getMetadata(SymbolDecoratorRule, classType.prototype) : undefined;
23
+ if (!rules) {
24
+ // not object
25
+ return z.any();
26
+ }
27
+ // object
28
+ let schema = z.object(rules);
29
+ if (options?.passthrough)
30
+ schema = schema.passthrough();
31
+ if (options?.strict)
32
+ schema = schema.strict();
33
+ // refId
34
+ const beanOptions = appResource.getBean(classType);
35
+ if (beanOptions) {
36
+ const openapi = cast(beanOptions.options)?.openapi;
37
+ schema = schema.openapi(beanOptions.beanFullName, openapi);
38
+ }
39
+ return schema;
40
+ }
@@ -0,0 +1,13 @@
1
+ import type { IpVersion } from 'zod';
2
+ import type { errorUtil } from '../../zod/errorUtil.ts';
3
+ import { z } from 'zod';
4
+ export declare function schemaEmail(message?: errorUtil.ErrMessage): (schema: z.ZodString) => z.ZodString;
5
+ export declare function schemaUrl(message?: errorUtil.ErrMessage): (schema: z.ZodString) => z.ZodString;
6
+ export declare function schemaUuid(message?: errorUtil.ErrMessage): (schema: z.ZodString) => z.ZodString;
7
+ export declare function schemaIp(options?: string | {
8
+ version?: IpVersion;
9
+ message?: string;
10
+ }): (schema: z.ZodString) => z.ZodString;
11
+ export declare function schemaMin(min: number, message?: errorUtil.ErrMessage): (schema: any) => any;
12
+ export declare function schemaMax(max: number, message?: errorUtil.ErrMessage): (schema: any) => any;
13
+ export declare function schemaTableIdentity(): (_schema: any) => any;
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ export function schemaEmail(message) {
3
+ return function (schema) {
4
+ return schema.email(message);
5
+ };
6
+ }
7
+ export function schemaUrl(message) {
8
+ return function (schema) {
9
+ return schema.url(message);
10
+ };
11
+ }
12
+ export function schemaUuid(message) {
13
+ return function (schema) {
14
+ return schema.uuid(message);
15
+ };
16
+ }
17
+ export function schemaIp(options) {
18
+ return function (schema) {
19
+ return schema.ip(options);
20
+ };
21
+ }
22
+ export function schemaMin(min, message) {
23
+ return function (schema) {
24
+ return schema.min(min, message);
25
+ };
26
+ }
27
+ export function schemaMax(max, message) {
28
+ return function (schema) {
29
+ return schema.max(max, message);
30
+ };
31
+ }
32
+ export function schemaTableIdentity() {
33
+ return function (_schema) {
34
+ return z.union([z.string(), z.number()]);
35
+ };
36
+ }
@@ -0,0 +1,7 @@
1
+ import type { ZodOpenAPIMetadata } from '@asteasolutions/zod-to-openapi';
2
+ import type { z, ZodTypeAny } from 'zod';
3
+ export declare function schemaOpenapi<T extends ZodTypeAny>(metadata: Partial<ZodOpenAPIMetadata<z.input<T>>>): any;
4
+ export declare function schemaOpenapi<T extends ZodTypeAny>(refId: string, metadata?: Partial<ZodOpenAPIMetadata<z.input<T>>>): any;
5
+ export declare function schemaTitle<T extends ZodTypeAny>(title?: string): (schema: T) => T;
6
+ export declare function schemaDescription<T extends ZodTypeAny>(description?: string): (schema: T) => T;
7
+ export declare function schemaExample<T extends ZodTypeAny>(example?: any): (schema: T) => T;
@@ -0,0 +1,20 @@
1
+ export function schemaOpenapi(refId, metadata) {
2
+ return function (schema) {
3
+ return schema.openapi(refId, metadata);
4
+ };
5
+ }
6
+ export function schemaTitle(title) {
7
+ return function (schema) {
8
+ return schema.openapi({ title });
9
+ };
10
+ }
11
+ export function schemaDescription(description) {
12
+ return function (schema) {
13
+ return schema.openapi({ description });
14
+ };
15
+ }
16
+ export function schemaExample(example) {
17
+ return function (schema) {
18
+ return schema.openapi({ example });
19
+ };
20
+ }
@@ -0,0 +1,9 @@
1
+ import type { Constructable } from 'vona';
2
+ import type { ISchemaObjectOptions, SchemaLike } from '../../../types/decorator.ts';
3
+ import { z } from 'zod';
4
+ export declare function schemaDefault<T>(defaultValue: T): (schema: z.ZodSchema) => z.ZodSchema;
5
+ export declare function schemaOptional(): (schema: z.ZodSchema) => z.ZodSchema;
6
+ export declare function schemaObject<T>(classType: Constructable<T>, options?: ISchemaObjectOptions): (_schema: z.ZodSchema) => z.ZodSchema<T>;
7
+ export declare function schemaArray(schemaLike?: SchemaLike, params?: z.RawCreateParams & {
8
+ separator?: string;
9
+ }): (schema: z.ZodSchema) => z.ZodSchema;
@@ -0,0 +1,34 @@
1
+ import { isNil } from '@cabloy/utils';
2
+ import { coerceWithNil } from '@cabloy/zod-query';
3
+ import { z } from 'zod';
4
+ import { makeSchemaLike } from "../makeSchemaLikes.js";
5
+ import { $schema } from "../schema.js";
6
+ export function schemaDefault(defaultValue) {
7
+ return function (schema) {
8
+ return schema.default(defaultValue);
9
+ };
10
+ }
11
+ export function schemaOptional() {
12
+ return function (schema) {
13
+ return schema.optional();
14
+ };
15
+ }
16
+ export function schemaObject(classType, options) {
17
+ return function (_schema) {
18
+ return $schema(classType, options);
19
+ };
20
+ }
21
+ export function schemaArray(schemaLike, params) {
22
+ return function (schema) {
23
+ return z.preprocess(val => {
24
+ val = coerceWithNil(val);
25
+ if (isNil(val))
26
+ return val;
27
+ if (typeof val !== 'string')
28
+ return val;
29
+ if (isNil(params?.separator) && val[0] === '[')
30
+ return JSON.parse(val);
31
+ return val.split(params?.separator ?? ',');
32
+ }, z.array(makeSchemaLike(schemaLike ?? schema, z.any()), params));
33
+ };
34
+ }
@@ -0,0 +1,20 @@
1
+ import { schemaEmail, schemaIp, schemaMax, schemaMin, schemaTableIdentity, schemaUrl, schemaUuid } from './v/helpers.ts';
2
+ import { schemaDescription, schemaExample, schemaOpenapi, schemaTitle } from './v/openapi.ts';
3
+ import { schemaArray, schemaDefault, schemaObject, schemaOptional } from './v/system.ts';
4
+ export declare const v: {
5
+ array: typeof schemaArray;
6
+ default: typeof schemaDefault;
7
+ object: typeof schemaObject;
8
+ optional: typeof schemaOptional;
9
+ email: typeof schemaEmail;
10
+ url: typeof schemaUrl;
11
+ uuid: typeof schemaUuid;
12
+ ip: typeof schemaIp;
13
+ min: typeof schemaMin;
14
+ max: typeof schemaMax;
15
+ tableIdentity: typeof schemaTableIdentity;
16
+ openapi: typeof schemaOpenapi;
17
+ title: typeof schemaTitle;
18
+ description: typeof schemaDescription;
19
+ example: typeof schemaExample;
20
+ };
@@ -0,0 +1,22 @@
1
+ import { schemaEmail, schemaIp, schemaMax, schemaMin, schemaTableIdentity, schemaUrl, schemaUuid } from "./v/helpers.js";
2
+ import { schemaDescription, schemaExample, schemaOpenapi, schemaTitle } from "./v/openapi.js";
3
+ import { schemaArray, schemaDefault, schemaObject, schemaOptional } from "./v/system.js";
4
+ export const v = {
5
+ array: schemaArray,
6
+ default: schemaDefault,
7
+ object: schemaObject,
8
+ optional: schemaOptional,
9
+ // helpers
10
+ email: schemaEmail,
11
+ url: schemaUrl,
12
+ uuid: schemaUuid,
13
+ ip: schemaIp,
14
+ min: schemaMin,
15
+ max: schemaMax,
16
+ tableIdentity: schemaTableIdentity,
17
+ // openapi
18
+ openapi: schemaOpenapi,
19
+ title: schemaTitle,
20
+ description: schemaDescription,
21
+ example: schemaExample,
22
+ };
@@ -0,0 +1,4 @@
1
+ import type { Constructable } from 'vona';
2
+ export declare function getTargetDecoratorRules(target: object): Record<PropertyKey, unknown>;
3
+ export declare function getTargetDecoratorRuleColumns(target: object): Record<PropertyKey, unknown>;
4
+ export declare function mergeFieldsOpenAPIMetadata(target: Constructable): void;
@@ -0,0 +1,43 @@
1
+ import { appMetadata, appResource, cast, deepExtend, registerMappedClassMetadataKey } from 'vona';
2
+ import { z } from 'zod';
3
+ import { SymbolDecoratorRule, SymbolDecoratorRuleColumn } from "../types/decorator.js";
4
+ export function getTargetDecoratorRules(target) {
5
+ registerMappedClassMetadataKey(target, SymbolDecoratorRule, {
6
+ partialClass: (meta) => {
7
+ return meta.optional();
8
+ },
9
+ });
10
+ return appMetadata.getOwnMetadataMap(true, SymbolDecoratorRule, target);
11
+ }
12
+ export function getTargetDecoratorRuleColumns(target) {
13
+ registerMappedClassMetadataKey(target, SymbolDecoratorRuleColumn);
14
+ return appMetadata.getOwnMetadataMap(true, SymbolDecoratorRuleColumn, target);
15
+ }
16
+ export function mergeFieldsOpenAPIMetadata(target) {
17
+ // rules
18
+ const rules = getTargetDecoratorRules(target.prototype);
19
+ // beanOptions
20
+ const beanOptions = appResource.getBean(target);
21
+ const fields = cast(beanOptions?.options)?.fields;
22
+ if (!fields)
23
+ return;
24
+ for (const key in fields) {
25
+ const field = fields[key];
26
+ if (!field)
27
+ continue;
28
+ const schemaCurrent = rules[key];
29
+ if (Object.prototype.hasOwnProperty.call(field, 'parseAsync')) {
30
+ const schema = field;
31
+ rules[key] = schema.openapi(deepExtend({}, schemaCurrent?._def.openapi?.metadata, schema._def.openapi?.metadata));
32
+ }
33
+ else {
34
+ // use deepExtend for sure strict
35
+ if (schemaCurrent) {
36
+ rules[key] = schemaCurrent.openapi(deepExtend({}, schemaCurrent._def.openapi?.metadata, field));
37
+ }
38
+ else {
39
+ rules[key] = z.any().openapi(deepExtend({}, field));
40
+ }
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,9 @@
1
+ export declare namespace errorUtil {
2
+ type ErrMessage = string | {
3
+ message?: string;
4
+ };
5
+ const errToObj: (message?: ErrMessage) => {
6
+ message?: string | undefined;
7
+ };
8
+ const toString: (message?: ErrMessage) => string | undefined;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { VonaApplication } from 'vona';
2
+ export declare function errorsAdapter(app: VonaApplication): void;
@@ -0,0 +1,9 @@
1
+ import { setErrorMapDefault, setErrorMapSchema } from '@cabloy/zod-errors-custom';
2
+ export function errorsAdapter(app) {
3
+ setErrorMapDefault((text, ...args) => {
4
+ return app.meta.text(text, ...args);
5
+ });
6
+ setErrorMapSchema((text, ...args) => {
7
+ return app.meta.text(text, ...args);
8
+ });
9
+ }
@@ -0,0 +1,2 @@
1
+ export * from './errorsAdapter.ts';
2
+ export * from './errorUtil.ts';
@@ -0,0 +1,2 @@
1
+ export * from "./errorsAdapter.js";
2
+ export * from "./errorUtil.js";
package/dist/main.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { IModuleMain } from 'vona';
2
+ import { BeanSimple } from 'vona';
3
+ export declare class Main extends BeanSimple implements IModuleMain {
4
+ moduleLoading(): Promise<void>;
5
+ moduleLoaded(): Promise<void>;
6
+ configLoaded(_config: any): Promise<void>;
7
+ }
package/dist/main.js ADDED
@@ -0,0 +1,9 @@
1
+ import { BeanSimple } from 'vona';
2
+ import { errorsAdapter } from "./lib/zod/errorsAdapter.js";
3
+ export class Main extends BeanSimple {
4
+ async moduleLoading() { }
5
+ async moduleLoaded() {
6
+ errorsAdapter(this.app);
7
+ }
8
+ async configLoaded(_config) { }
9
+ }
@@ -0,0 +1,19 @@
1
+ import type { Constructable } from 'vona';
2
+ import type { IOpenAPIObject } from '../types/api.ts';
3
+ import { BeanBase } from 'vona';
4
+ export declare class ServiceOpenapi extends BeanBase {
5
+ generateJson<K extends keyof IOpenAPIObject>(version?: K): IOpenAPIObject[K];
6
+ generateJsonOfControllerAction<K extends keyof IOpenAPIObject>(controller: Constructable, actionKey: string, version?: K): IOpenAPIObject[K];
7
+ private _translate;
8
+ private _translateSchema;
9
+ private _translateStrings;
10
+ private _translateString;
11
+ private _collectRegistry;
12
+ private _collectController;
13
+ private _registerControllerAction;
14
+ private _collectRequest;
15
+ private _collectResponses;
16
+ private _parseBodySchema;
17
+ private _prepareArgsMeta;
18
+ private _combineArgHeaders;
19
+ }