vona-module-a-openapi 5.0.21 → 5.0.22

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.
@@ -1,7 +1,7 @@
1
1
  /** service: begin */
2
2
  export * from '../service/openapi.ts';
3
3
  import 'vona';
4
- declare module 'vona-module-a-web' {
4
+ declare module 'vona-module-a-bean' {
5
5
  interface IServiceRecord {
6
6
  'a-openapi:openapi': never;
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import type { OpenAPIObjectConfig as OpenAPIObjectConfigV30 } from '@asteasolutions/zod-to-openapi/dist/v3.0/openapi-generator.ts';
2
2
  import type { OpenAPIObjectConfigV31 } from '@asteasolutions/zod-to-openapi/dist/v3.1/openapi-generator.ts';
3
3
  import type { VonaApplication } from 'vona';
4
- import type { TypeOpenApiVersion, TypeSecuritySchemes } from '../types/api.ts';
4
+ import type { TypeOpenApiVersion, TypeSecuritySchemes } from 'vona-module-a-openapiutils';
5
5
  export declare function config(_app: VonaApplication): {
6
6
  defaultVersion: TypeOpenApiVersion;
7
7
  generateDocument: {
package/dist/index.js CHANGED
@@ -4,10 +4,11 @@ import * as ModuleInfo from '@cabloy/module-info';
4
4
  import { isEmptyObject, isNil } from '@cabloy/utils';
5
5
  import { toUpperCaseFirstChar } from '@cabloy/word-utils';
6
6
  import { getTypeName, coerceWithNil } from '@cabloy/zod-query';
7
- import { Service, SymbolRequestMappingHandler } from 'vona-module-a-web';
7
+ import { Service, Scope } from 'vona-module-a-bean';
8
+ import { SymbolDecoratorRule, SymbolOpenApiOptions, SymbolDecoratorRuleColumn } from 'vona-module-a-openapiutils';
9
+ import { SymbolRequestMappingHandler } from 'vona-module-a-web';
8
10
  import { z } from 'zod';
9
11
  import { locales as locales$1, setErrorMapDefault, setErrorMapSchema } from '@cabloy/zod-errors-custom';
10
- import { Scope } from 'vona-module-a-bean';
11
12
  import 'openapi3-ts/oas30';
12
13
  import 'openapi3-ts/oas31';
13
14
 
@@ -19,14 +20,6 @@ function bodySchemaWrapperDefault(bodySchema) {
19
20
  });
20
21
  }
21
22
 
22
- const SymbolDecoratorRule = Symbol('SymbolDecoratorRule');
23
- const SymbolDecoratorRuleColumn = Symbol('SymbolDecoratorRuleColumn');
24
-
25
- // not use z.ZodSchema
26
-
27
- const SymbolRouteHandlersArgumentsMeta = Symbol('SymbolRouteHandlersArgumentsMeta');
28
- const SymbolRouteHandlersArgumentsValue = Symbol('SymbolRouteHandlersArgumentsValue');
29
-
30
23
  function $schema(classType, options) {
31
24
  if (!classType) return z.any();
32
25
  if (classType.parseAsync) return classType;
@@ -55,7 +48,8 @@ function $schema(classType, options) {
55
48
  return schema;
56
49
  }
57
50
 
58
- const SymbolOpenApiOptions = Symbol('SymbolOpenApiOptions');
51
+ const SymbolRouteHandlersArgumentsMeta = Symbol('SymbolRouteHandlersArgumentsMeta');
52
+ const SymbolRouteHandlersArgumentsValue = Symbol('SymbolRouteHandlersArgumentsValue');
59
53
 
60
54
  var _dec$1, _dec2$1, _class$1;
61
55
  const __ArgumentTypes = ['param', 'query', 'body', 'headers', 'fields', 'field', 'files', 'file'];
@@ -519,10 +513,6 @@ function Field$1(...schemaLikes) {
519
513
  };
520
514
  }
521
515
 
522
- function setPublic(target, prop, _descriptor, value) {
523
- const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop);
524
- options.public = value;
525
- }
526
516
  function httpCode(httpCode) {
527
517
  return function (target, prop, descriptor) {
528
518
  const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop);
@@ -805,4 +795,4 @@ const OrderBusinessBase = 1000;
805
795
  const OrderUnknownBase = 10000;
806
796
  const OrderMaxBase = 100000;
807
797
 
808
- export { $locale, $schema, Api, Arg, Main, OrderBusinessBase, OrderCoreBase, OrderMaxBase, OrderUnknownBase, ScopeModuleAOpenapi, ServiceOpenapi, SymbolDecoratorRule, SymbolDecoratorRuleColumn, SymbolOpenApiOptions, SymbolRouteHandlersArgumentsMeta, SymbolRouteHandlersArgumentsValue, bodySchemaWrapperDefault, config, createPipesArgumentDecorator, errorsAdapter, getTargetDecoratorRuleColumns, getTargetDecoratorRules, locales, makeSchemaLike, makeSchemaLikes, mergeFieldsOpenAPIMetadata, setPublic, v };
798
+ export { $locale, $schema, Api, Arg, Main, OrderBusinessBase, OrderCoreBase, OrderMaxBase, OrderUnknownBase, ScopeModuleAOpenapi, ServiceOpenapi, SymbolRouteHandlersArgumentsMeta, SymbolRouteHandlersArgumentsValue, bodySchemaWrapperDefault, config, createPipesArgumentDecorator, errorsAdapter, getTargetDecoratorRuleColumns, getTargetDecoratorRules, locales, makeSchemaLike, makeSchemaLikes, mergeFieldsOpenAPIMetadata, v };
@@ -1,8 +1,5 @@
1
- import type { MetadataKey } from 'vona';
2
- import type { IOpenApiHeader, TypeResponseContentType } from '../../types/api.ts';
3
- import type { SchemaLike, SchemaLikeCreate } from '../../types/decorator.ts';
1
+ import type { IOpenApiHeader, SchemaLike, SchemaLikeCreate, TypeResponseContentType } from 'vona-module-a-openapiutils';
4
2
  import { Field } from './field.ts';
5
- export declare function setPublic(target: object, prop?: MetadataKey, _descriptor?: PropertyDescriptor, value?: boolean): void;
6
3
  declare function httpCode(httpCode: number): MethodDecorator;
7
4
  declare function contentType(contentType: TypeResponseContentType): MethodDecorator;
8
5
  declare function body(...schemaLikes: SchemaLike[]): MethodDecorator;
@@ -1,4 +1,4 @@
1
- import type { SchemaLike } from '../../types/decorator.ts';
1
+ import type { SchemaLike } from 'vona-module-a-openapiutils';
2
2
  declare function Param(): ParameterDecorator;
3
3
  declare function Param(...schemaLikes: SchemaLike[]): ParameterDecorator;
4
4
  declare function Param(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
@@ -1,2 +1,2 @@
1
- import type { SchemaLike } from '../../types/decorator.ts';
1
+ import type { SchemaLike } from 'vona-module-a-openapiutils';
2
2
  export declare function Field(...schemaLikes: SchemaLike[]): PropertyDecorator;
@@ -1,2 +1,3 @@
1
- import type { RouteHandlerArgumentType, SchemaLike, TypeExtractValue } from '../../types/decorator.ts';
1
+ import type { SchemaLike } from 'vona-module-a-openapiutils';
2
+ import type { RouteHandlerArgumentType, TypeExtractValue } from '../../types/decorator.ts';
2
3
  export declare function createPipesArgumentDecorator(paramType: RouteHandlerArgumentType, extractValue?: TypeExtractValue): (field?: string | SchemaLike, ...schemaLikes: SchemaLike[]) => ParameterDecorator;
@@ -1,4 +1,4 @@
1
+ import type { SchemaLike } from 'vona-module-a-openapiutils';
1
2
  import type { z } from 'zod';
2
- import type { SchemaLike } from '../../types/decorator.ts';
3
3
  export declare function makeSchemaLikes(schemaLikes: SchemaLike[], typeInit: any): z.ZodSchema;
4
4
  export declare function makeSchemaLike(schemaLike: SchemaLike | undefined, schemaPrevious: z.ZodSchema): z.ZodSchema;
@@ -1,5 +1,6 @@
1
1
  import type { Constructable } from 'vona';
2
- import type { ISchemaObjectOptions, SchemaLike } from '../../../types/decorator.ts';
2
+ import type { SchemaLike } from 'vona-module-a-openapiutils';
3
+ import type { ISchemaObjectOptions } from '../../../types/decorator.ts';
3
4
  import { z } from 'zod';
4
5
  export declare function schemaDefault<T>(defaultValue: T): (schema: z.ZodSchema) => z.ZodSchema;
5
6
  export declare function schemaOptional(): (schema: z.ZodSchema) => z.ZodSchema;
@@ -1,5 +1,5 @@
1
1
  import type { Constructable } from 'vona';
2
- import type { IOpenAPIObject } from '../types/api.ts';
2
+ import type { IOpenAPIObject } from 'vona-module-a-openapiutils';
3
3
  import { BeanBase } from 'vona';
4
4
  export declare class ServiceOpenapi extends BeanBase {
5
5
  generateJson<K extends keyof IOpenAPIObject>(version?: K): IOpenAPIObject[K];
@@ -1,9 +1,5 @@
1
1
  import type { Constructable, Type, VonaContext } from 'vona';
2
2
  import type { z } from 'zod';
3
- export declare const SymbolDecoratorRule: unique symbol;
4
- export declare const SymbolDecoratorRuleColumn: unique symbol;
5
- export type SchemaLikeCreate = (schema: any) => any;
6
- export type SchemaLike = SchemaLikeCreate | z.ZodSchema | Constructable;
7
3
  export interface ISchemaObjectOptions {
8
4
  passthrough?: boolean;
9
5
  strict?: boolean;
@@ -1,6 +1,5 @@
1
1
  import '@cabloy/zod-query';
2
2
  export * from './actions.ts';
3
- export * from './api.ts';
4
3
  export * from './behavior.ts';
5
4
  export * from './component.ts';
6
5
  export * from './database.ts';
@@ -1,8 +1,8 @@
1
1
  import type { ZodOpenAPIMetadata } from '@asteasolutions/zod-to-openapi';
2
2
  import type { CurrencyOptions } from '@zhennann/currency';
3
+ import type { IOpenApiOptions } from 'vona-module-a-openapiutils';
3
4
  import type { z, ZodTypeAny } from 'zod';
4
5
  import type { TypeResourceActionRowRecordRender } from './actions.ts';
5
- import type { IOpenApiOptions } from './api.ts';
6
6
  import type { IComponentRecord } from './component.ts';
7
7
  import 'openapi3-ts/oas30';
8
8
  import 'openapi3-ts/oas31';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-module-a-openapi",
3
3
  "type": "module",
4
- "version": "5.0.21",
4
+ "version": "5.0.22",
5
5
  "title": "a-openapi",
6
6
  "vonaModule": {
7
7
  "capabilities": {
@@ -1,39 +0,0 @@
1
- import type { OpenAPIObject as OpenAPIObject30, SchemaObject as SchemaObject30 } from 'openapi3-ts/oas30';
2
- import type { OpenAPIObject as OpenAPIObject31, SchemaObject as SchemaObject31 } from 'openapi3-ts/oas31';
3
- import type { VonaApplication } from 'vona';
4
- import type { z } from 'zod';
5
- import type { SchemaLikeCreate } from './decorator.ts';
6
- export declare const SymbolOpenApiOptions: unique symbol;
7
- export interface IOpenApiHeader {
8
- name: string;
9
- description?: string;
10
- }
11
- export interface IResponseHeaders {
12
- [key: string]: string | string[];
13
- }
14
- export interface IOpenApiOptions {
15
- public?: boolean;
16
- description?: string;
17
- summary?: string;
18
- httpCode?: number;
19
- contentType?: TypeResponseContentType;
20
- bodySchema?: z.ZodSchema;
21
- bodySchemaWrapper?: SchemaLikeCreate | false;
22
- exclude?: boolean;
23
- tags?: string[];
24
- operationId?: string;
25
- headers?: IOpenApiHeader[];
26
- setHeaders?: IResponseHeaders;
27
- }
28
- export type TypeGenerateJsonScene = 'api' | 'rest';
29
- export type TypeOpenApiVersion = 'V30' | 'V31';
30
- export interface IOpenAPIObject {
31
- V30: OpenAPIObject30;
32
- V31: OpenAPIObject31;
33
- }
34
- export interface IOpenAPISchemaObject {
35
- V30: SchemaObject30;
36
- V31: SchemaObject31;
37
- }
38
- export type TypeSecuritySchemes = Record<string, ((this: VonaApplication) => object) | object>;
39
- export type TypeResponseContentType = 'application/json' | 'application/xml' | 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain' | 'text/html' | 'application/octet-stream' | 'application/pdf' | 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp' | 'image/svg+xml' | 'image/bmp' | 'image/tiff' | 'image/vnd.microsoft.icon' | 'image/vnd.wap.wbmp' | 'image/x-icon' | 'image/x-jng' | 'image/x-ms-bmp' | 'image/x-portable-bitmap' | 'image/x-portable-graymap' | 'image/x-portable-pixmap' | 'image/x-xbitmap' | 'image/x-xpixmap' | 'image/x-xwindowdump' | 'image/bmp' | 'image/x-bmp' | 'image/x-xbitmap' | 'image/x-win-bitmap' | 'image/x-windows-bmp' | 'image/ms-bmp' | 'image/x-ms-bmp' | 'image/x-icon' | 'image/x-ico' | 'image/vnd.microsoft.icon' | 'image/ico' | 'image/icon' | 'text/css' | 'text/csv' | 'text/html' | 'text/javascript' | 'text/plain' | 'text/xml' | 'application/javascript' | 'application/ecmascript' | 'application/json' | 'application/ld+json' | 'application/manifest+json' | 'application/javascript' | 'application/x-javascript' | 'application/x-json' | 'application/x-ms-application';