vona-module-a-openapi 5.0.19 → 5.0.21

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,19 +1,6 @@
1
- import type { BeanScopeUtil, TypeLocaleBase, TypeModuleConfig, TypeModuleLocales } from 'vona';
2
- import type { config } from '../config/config.ts';
3
- /** service: end */
4
1
  /** service: begin */
5
- /** service: end */
6
- /** service: begin */
7
- import type { ServiceOpenapi } from '../service/openapi.ts';
8
- /** main: end */
9
- /** scope: begin */
10
- import { BeanScopeBase } from 'vona';
11
- /** service: end */
12
- /** config: begin */
13
- import 'vona';
14
- import 'vona';
2
+ export * from '../service/openapi.ts';
15
3
  import 'vona';
16
- export * from '../config/config.ts';
17
4
  declare module 'vona-module-a-web' {
18
5
  interface IServiceRecord {
19
6
  'a-openapi:openapi': never;
@@ -23,17 +10,24 @@ declare module 'vona-module-a-openapi' {
23
10
  interface ServiceOpenapi {
24
11
  }
25
12
  }
13
+ /** service: end */
14
+ /** service: begin */
15
+ import type { ServiceOpenapi } from '../service/openapi.ts';
26
16
  export interface IModuleService {
27
- openapi: ServiceOpenapi;
17
+ 'openapi': ServiceOpenapi;
28
18
  }
19
+ /** service: end */
20
+ /** service: begin */
21
+ import 'vona';
29
22
  declare module 'vona' {
30
23
  interface IBeanRecordGeneral {
31
24
  'a-openapi.service.openapi': ServiceOpenapi;
32
25
  }
33
26
  }
34
- /** locale: end */
35
- /** main: begin */
36
- export * from '../main.ts';
27
+ /** service: end */
28
+ /** config: begin */
29
+ export * from '../config/config.ts';
30
+ import type { config } from '../config/config.ts';
37
31
  export declare const locales: {
38
32
  'en-us': {
39
33
  ZodError_invalid_input: string;
@@ -194,8 +188,12 @@ export declare const locales: {
194
188
  ZodError_types_set: string;
195
189
  };
196
190
  };
197
- /** service: begin */
198
- export * from '../service/openapi.ts';
191
+ /** locale: end */
192
+ /** main: begin */
193
+ export * from '../main.ts';
194
+ /** main: end */
195
+ /** scope: begin */
196
+ import { BeanScopeBase, type BeanScopeUtil, type TypeModuleConfig, type TypeModuleLocales, type TypeLocaleBase } from 'vona';
199
197
  export declare class ScopeModuleAOpenapi extends BeanScopeBase {
200
198
  }
201
199
  export interface ScopeModuleAOpenapi {
@@ -204,6 +202,7 @@ export interface ScopeModuleAOpenapi {
204
202
  locale: TypeModuleLocales<(typeof locales)[TypeLocaleBase]>;
205
203
  service: IModuleService;
206
204
  }
205
+ import 'vona';
207
206
  declare module 'vona' {
208
207
  interface IBeanScopeRecord {
209
208
  'a-openapi': ScopeModuleAOpenapi;
package/dist/index.js CHANGED
@@ -1,6 +1,4 @@
1
- import { BeanSimple, appMetadata, appResource, cast, BeanInfo, BeanBase, LocaleModuleNameSeparator, HttpStatus, BeanScopeBase, isClassStrict, registerMappedClassMetadataKey, deepExtend } from 'vona';
2
- import { Scope } from 'vona-module-a-bean';
3
- import { locales as locales$1, setErrorMapDefault, setErrorMapSchema } from '@cabloy/zod-errors-custom';
1
+ import { appMetadata, appResource, cast, BeanInfo, BeanBase, LocaleModuleNameSeparator, HttpStatus, BeanSimple, BeanScopeBase, isClassStrict, registerMappedClassMetadataKey, deepExtend } from 'vona';
4
2
  import { OpenApiGeneratorV3, OpenApiGeneratorV31, OpenAPIRegistry } from '@asteasolutions/zod-to-openapi';
5
3
  import * as ModuleInfo from '@cabloy/module-info';
6
4
  import { isEmptyObject, isNil } from '@cabloy/utils';
@@ -8,61 +6,11 @@ import { toUpperCaseFirstChar } from '@cabloy/word-utils';
8
6
  import { getTypeName, coerceWithNil } from '@cabloy/zod-query';
9
7
  import { Service, SymbolRequestMappingHandler } from 'vona-module-a-web';
10
8
  import { z } from 'zod';
9
+ import { locales as locales$1, setErrorMapDefault, setErrorMapSchema } from '@cabloy/zod-errors-custom';
10
+ import { Scope } from 'vona-module-a-bean';
11
11
  import 'openapi3-ts/oas30';
12
12
  import 'openapi3-ts/oas31';
13
13
 
14
- var locale_en_us = locales$1['en-us'];
15
-
16
- var locale_zh_cn = locales$1['zh-cn'];
17
-
18
- function config(_app) {
19
- return {
20
- defaultVersion: 'V31',
21
- generateDocument: {
22
- V30: {
23
- openapi: '3.0.0',
24
- info: {
25
- version: '5.0.0',
26
- title: 'Vona',
27
- description: 'Vona API'
28
- }
29
- },
30
- V31: {
31
- openapi: '3.1.0',
32
- info: {
33
- version: '5.0.0',
34
- title: 'Vona',
35
- description: 'Vona API'
36
- }
37
- }
38
- },
39
- securitySchemes: {
40
- bearerAuth: {
41
- type: 'http',
42
- scheme: 'bearer',
43
- bearerFormat: 'JWT'
44
- }
45
- }
46
- };
47
- }
48
-
49
- function errorsAdapter(app) {
50
- setErrorMapDefault((text, ...args) => {
51
- return app.meta.text(text, ...args);
52
- });
53
- setErrorMapSchema((text, ...args) => {
54
- return app.meta.text(text, ...args);
55
- });
56
- }
57
-
58
- class Main extends BeanSimple {
59
- async moduleLoading() {}
60
- async moduleLoaded() {
61
- errorsAdapter(this.app);
62
- }
63
- async configLoaded(_config) {}
64
- }
65
-
66
14
  function bodySchemaWrapperDefault(bodySchema) {
67
15
  return z.object({
68
16
  code: z.string(),
@@ -432,6 +380,58 @@ let ServiceOpenapi = (_dec$1 = Service(), _dec2$1 = BeanInfo({
432
380
  }
433
381
  }) || _class$1) || _class$1);
434
382
 
383
+ function config(_app) {
384
+ return {
385
+ defaultVersion: 'V31',
386
+ generateDocument: {
387
+ V30: {
388
+ openapi: '3.0.0',
389
+ info: {
390
+ version: '5.0.0',
391
+ title: 'Vona',
392
+ description: 'Vona API'
393
+ }
394
+ },
395
+ V31: {
396
+ openapi: '3.1.0',
397
+ info: {
398
+ version: '5.0.0',
399
+ title: 'Vona',
400
+ description: 'Vona API'
401
+ }
402
+ }
403
+ },
404
+ securitySchemes: {
405
+ bearerAuth: {
406
+ type: 'http',
407
+ scheme: 'bearer',
408
+ bearerFormat: 'JWT'
409
+ }
410
+ }
411
+ };
412
+ }
413
+
414
+ var locale_en_us = locales$1['en-us'];
415
+
416
+ var locale_zh_cn = locales$1['zh-cn'];
417
+
418
+ function errorsAdapter(app) {
419
+ setErrorMapDefault((text, ...args) => {
420
+ return app.meta.text(text, ...args);
421
+ });
422
+ setErrorMapSchema((text, ...args) => {
423
+ return app.meta.text(text, ...args);
424
+ });
425
+ }
426
+
427
+ class Main extends BeanSimple {
428
+ async moduleLoading() {}
429
+ async moduleLoaded() {
430
+ errorsAdapter(this.app);
431
+ }
432
+ async configLoaded(_config) {}
433
+ }
434
+
435
435
  var _dec, _dec2, _class;
436
436
  const locales = {
437
437
  'en-us': locale_en_us,
@@ -30,7 +30,7 @@ export type TypeFieldRenderComponentProvider = (keyof IComponentRecord) | (keyof
30
30
  export type TypeSchemaScene = 'table' | 'form';
31
31
  export type TypeOpenAPIMetadata<T extends ZodTypeAny = ZodTypeAny> = Partial<ZodOpenAPIMetadata<z.input<T>>>;
32
32
  export type TypeEntityOptionsFields<T extends {}, More extends string | undefined = never> = {
33
- [key in ((keyof Omit<T, '$table'>) | (More extends string ? More : never))]?: TypeOpenAPIMetadata | z.ZodSchema;
33
+ [key in ((keyof T) | (More extends string ? More : never))]?: TypeOpenAPIMetadata | z.ZodSchema;
34
34
  };
35
35
  export type TypeControllerOptionsActions<T extends {}> = {
36
36
  [key in (keyof T)]?: IOpenApiOptions;
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.19",
4
+ "version": "5.0.21",
5
5
  "title": "a-openapi",
6
6
  "vonaModule": {
7
7
  "capabilities": {