vona-module-a-openapiutils 5.1.3 → 5.1.5

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 (67) hide show
  1. package/LICENSE +0 -0
  2. package/dist/.metadata/locales.d.ts.map +1 -1
  3. package/dist/index.js +42 -173
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/decorator/api.d.ts.map +1 -1
  6. package/dist/lib/index.d.ts +1 -0
  7. package/dist/lib/index.d.ts.map +1 -1
  8. package/dist/lib/resource.d.ts +3 -0
  9. package/dist/lib/resource.d.ts.map +1 -0
  10. package/dist/lib/schema/index.d.ts +1 -0
  11. package/dist/lib/schema/index.d.ts.map +1 -1
  12. package/dist/lib/schema/makeMetadata.d.ts +2 -2
  13. package/dist/lib/schema/makeMetadata.d.ts.map +1 -1
  14. package/dist/lib/schema/makeSchemaLikes.d.ts.map +1 -1
  15. package/dist/lib/schema/v/filter.d.ts +1 -2
  16. package/dist/lib/schema/v/filter.d.ts.map +1 -1
  17. package/dist/lib/schema/v/helpers.d.ts.map +1 -1
  18. package/dist/lib/schema/v/openapi.d.ts +3 -3
  19. package/dist/lib/schema/v/openapi.d.ts.map +1 -1
  20. package/dist/lib/schema/v/serializer.d.ts.map +1 -1
  21. package/dist/lib/schema/v/system.d.ts.map +1 -1
  22. package/dist/lib/schema/v/utils.d.ts.map +1 -1
  23. package/dist/lib/schema/v/zod.d.ts.map +1 -1
  24. package/dist/lib/schema/v.d.ts +3 -12
  25. package/dist/lib/schema/v.d.ts.map +1 -1
  26. package/dist/lib/schema/visible.d.ts +4 -0
  27. package/dist/lib/schema/visible.d.ts.map +1 -0
  28. package/dist/lib/utils.d.ts +3 -4
  29. package/dist/lib/utils.d.ts.map +1 -1
  30. package/dist/lib/web.d.ts.map +1 -1
  31. package/dist/types/api.d.ts.map +1 -1
  32. package/dist/types/index.d.ts +0 -2
  33. package/dist/types/index.d.ts.map +1 -1
  34. package/package.json +8 -13
  35. package/src/.metadata/locales.ts +6 -1
  36. package/src/lib/decorator/api.ts +82 -13
  37. package/src/lib/index.ts +1 -0
  38. package/src/lib/resource.ts +5 -0
  39. package/src/lib/schema/index.ts +1 -0
  40. package/src/lib/schema/makeMetadata.ts +5 -3
  41. package/src/lib/schema/makeSchemaLikes.ts +23 -7
  42. package/src/lib/schema/v/filter.ts +36 -0
  43. package/src/lib/schema/v/helpers.ts +32 -7
  44. package/src/lib/schema/v/openapi.ts +6 -3
  45. package/src/lib/schema/v/serializer.ts +12 -4
  46. package/src/lib/schema/v/system.ts +4 -1
  47. package/src/lib/schema/v/utils.ts +5 -1
  48. package/src/lib/schema/v/zod.ts +18 -4
  49. package/src/lib/schema/v.ts +5 -14
  50. package/src/lib/schema/visible.ts +14 -0
  51. package/src/lib/utils.ts +15 -7
  52. package/src/lib/web.ts +4 -1
  53. package/src/types/api.ts +8 -2
  54. package/src/types/index.ts +0 -2
  55. package/dist/lib/schema/v/component.d.ts +0 -5
  56. package/dist/lib/schema/v/component.d.ts.map +0 -1
  57. package/dist/lib/schema/v/rest.d.ts +0 -9
  58. package/dist/lib/schema/v/rest.d.ts.map +0 -1
  59. package/dist/types/component.d.ts +0 -12
  60. package/dist/types/component.d.ts.map +0 -1
  61. package/dist/types/order.d.ts +0 -8
  62. package/dist/types/order.d.ts.map +0 -1
  63. package/src/lib/schema/v/component.ts +0 -78
  64. package/src/lib/schema/v/filter.tsx +0 -40
  65. package/src/lib/schema/v/rest.ts +0 -50
  66. package/src/types/component.ts +0 -19
  67. package/src/types/order.ts +0 -9
@@ -1 +1 @@
1
- {"version":3,"file":"v.d.ts","sourceRoot":"","sources":["../../../src/lib/schema/v.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,EACV,eAAe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AAyB,EAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,WAAW,EACX,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEjE,eAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCb,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { TypeSchemaScene } from 'vona-module-a-openapi';
2
+ import type z from 'zod';
3
+ export declare function schemaRenderVisible<T extends z.ZodType>(visible?: boolean, scene?: TypeSchemaScene): (schema: T) => T;
4
+ //# sourceMappingURL=visible.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visible.d.ts","sourceRoot":"","sources":["../../../src/lib/schema/visible.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EACrD,OAAO,CAAC,EAAE,OAAO,EACjB,KAAK,CAAC,EAAE,eAAe,IAEN,QAAQ,CAAC,KAAG,CAAC,CAI/B"}
@@ -1,13 +1,12 @@
1
1
  import type { Constructable, ILocaleMagic } from 'vona';
2
- import type { TypeOpenapiMetadata } from 'vona-module-a-openapi';
2
+ import type { ISchemaObjectExtensionField, TypeSchemaOrderLevel } from 'vona-module-a-openapi';
3
3
  import { z } from 'zod';
4
4
  import type { TypeDecoratorRules } from '../types/decorator.ts';
5
- import type { TypeSchemaOrderLevel } from '../types/order.ts';
6
5
  export declare function getTargetDecoratorRules(target: object, disableRegisterMetadata?: boolean): TypeDecoratorRules;
7
6
  export declare function getTargetDecoratorRuleColumns(target: object): string[];
8
7
  export declare function getTargetDecoratorRuleColumnsMap(target: object): Record<string, string>;
9
- export declare function mergeFieldsOpenapiMetadata(target: Constructable): void;
10
- export declare function mergeFieldOpenapiMetadata(target: object, prop: string, fieldRule?: TypeOpenapiMetadata | z.ZodType): TypeDecoratorRules;
8
+ export declare function mergeDtoFieldsOpenapiMetadata(target: Constructable): void;
9
+ export declare function mergeFieldOpenapiMetadata(target: object, prop: string, fieldRule?: ISchemaObjectExtensionField | z.ZodType): TypeDecoratorRules;
11
10
  export declare function prepareClassType<T>(classType: (() => Constructable<T>) | Constructable<T>): Constructable<T>;
12
11
  export declare function normalizeErrorParams(params?: string | ILocaleMagic | any, errorDefault?: any): any;
13
12
  export declare function $order(order: number, level?: TypeSchemaOrderLevel): number;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAKjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAK9D,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,uBAAuB,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAS7G;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAGtE;AAED,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOvF;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,aAAa,QAU/D;AAGD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,mB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C,EAChC,SAAS,EAAE,CAAC,MAAM,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,GACrD,aAAa,CAAC,CAAC,CAAC,CAElB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,GAAG,EAAE,YAAY,CAAC,EAAE,GAAG,OAO5F;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,oBAAoB,UAGjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../src/lib/web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAIxD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,cAAc,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAEnE;AAED,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,MAAM,cAAc,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE/I"}
1
+ {"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../src/lib/web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAIxD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,cAAc,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAEnE;AAED,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,MAAM,cAAc,EAC7E,IAAI,EAAE,CAAC,EACP,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5C,MAAM,CAER"}
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"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,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED,MAAM,MAAM,uBAAuB,GAC/B,kBAAkB,GAClB,iBAAiB,GACjB,mCAAmC,GACnC,qBAAqB,GACrB,YAAY,GACZ,WAAW,GACX,0BAA0B,GAC1B,iBAAiB,GACjB,WAAW,GACX,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,eAAe,GACf,WAAW,GACX,YAAY,GACZ,0BAA0B,GAC1B,oBAAoB,GACpB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,yBAAyB,GACzB,0BAA0B,GAC1B,yBAAyB,GACzB,iBAAiB,GACjB,iBAAiB,GACjB,qBAAqB,GACrB,WAAW,GACX,aAAa,GACb,iBAAiB,GACjB,oBAAoB,GACpB,qBAAqB,GACrB,cAAc,GACd,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,0BAA0B,GAC1B,WAAW,GACX,YAAY,GACZ,UAAU,GACV,UAAU,GACV,WAAW,GACX,iBAAiB,GACjB,YAAY,GACZ,UAAU,GACV,wBAAwB,GACxB,wBAAwB,GACxB,kBAAkB,GAClB,qBAAqB,GACrB,2BAA2B,GAC3B,wBAAwB,GACxB,0BAA0B,GAC1B,oBAAoB,GACpB,8BAA8B,CAAC"}
@@ -1,5 +1,3 @@
1
1
  export * from './api.ts';
2
- export * from './component.ts';
3
2
  export * from './decorator.ts';
4
- export * from './order.ts';
5
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "vona-module-a-openapiutils",
3
- "version": "5.1.3",
3
+ "version": "5.1.5",
4
+ "gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
4
5
  "description": "",
5
6
  "keywords": [
6
7
  "Vona Module"
@@ -22,19 +23,13 @@
22
23
  },
23
24
  "./package.json": "./package.json"
24
25
  },
25
- "scripts": {
26
- "clean": "rimraf dist tsconfig.build.tsbuildinfo",
27
- "tsc:publish": "npm run clean && vona :bin:buildModule --sourcemap && tsc -p tsconfig.build.json",
28
- "prepublishOnly": "npm run tsc:publish",
29
- "prepack": "clean-package",
30
- "postpack": "clean-package restore && npm run clean"
31
- },
32
- "dependencies": {
33
- "@zhennann/currency": "^2.0.0"
34
- },
26
+ "dependencies": {},
35
27
  "title": "a-openapiutils",
36
28
  "vonaModule": {
37
29
  "dependencies": {}
38
30
  },
39
- "gitHead": "0b0466b8fea18335b1be8a44161aedf045e3d716"
40
- }
31
+ "scripts": {
32
+ "clean": "rimraf dist tsconfig.build.tsbuildinfo",
33
+ "tsc:publish": "npm run clean && vona :bin:buildModule --sourcemap && tsc -p tsconfig.build.json"
34
+ }
35
+ }
@@ -1,5 +1,7 @@
1
1
  import type { TypeLocaleBase } from 'vona';
2
+
2
3
  import { $makeLocaleMagic } from 'vona';
4
+
3
5
  import locale_en_us from '../config/locale/en-us.ts';
4
6
  import locale_zh_cn from '../config/locale/zh-cn.ts';
5
7
 
@@ -8,6 +10,9 @@ export const locales = {
8
10
  'zh-cn': locale_zh_cn,
9
11
  };
10
12
 
11
- export function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K, ...args: any[]): any {
13
+ export function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(
14
+ key: K,
15
+ ...args: any[]
16
+ ): any {
12
17
  return $makeLocaleMagic(`a-openapiutils::${key}`, ...args);
13
18
  }
@@ -11,7 +11,12 @@ import { Field } from './field.ts';
11
11
 
12
12
  function httpCode(httpCode: number): MethodDecorator {
13
13
  return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
14
- const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
14
+ const options = appMetadata.getOwnMetadataMap(
15
+ false,
16
+ SymbolOpenApiOptions,
17
+ target,
18
+ prop,
19
+ ) as IOpenapiOptions;
15
20
  options.httpCode = httpCode;
16
21
  return descriptor;
17
22
  } as any;
@@ -19,7 +24,12 @@ function httpCode(httpCode: number): MethodDecorator {
19
24
 
20
25
  function contentType(contentType: TypeResponseContentType): MethodDecorator {
21
26
  return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
22
- const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
27
+ const options = appMetadata.getOwnMetadataMap(
28
+ false,
29
+ SymbolOpenApiOptions,
30
+ target,
31
+ prop,
32
+ ) as IOpenapiOptions;
23
33
  options.contentType = contentType;
24
34
  return descriptor;
25
35
  } as any;
@@ -31,19 +41,32 @@ function body(...schemaLikes: SchemaLike[]): MethodDecorator {
31
41
  const metaType = appMetadata.getDesignReturntype(target, prop);
32
42
  const schema = makeSchemaLikes(schemaLikes, metaType);
33
43
  // options
34
- const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
44
+ const options = appMetadata.getOwnMetadataMap(
45
+ false,
46
+ SymbolOpenApiOptions,
47
+ target,
48
+ prop,
49
+ ) as IOpenapiOptions;
35
50
  options.bodySchema = schema;
36
51
  return descriptor;
37
52
  } as any;
38
53
  }
39
54
 
40
- function bodyCustom(bodySchemaWrapper: SchemaLikeCreate | false, ...schemaLikes: SchemaLike[]): MethodDecorator {
55
+ function bodyCustom(
56
+ bodySchemaWrapper: SchemaLikeCreate | false,
57
+ ...schemaLikes: SchemaLike[]
58
+ ): MethodDecorator {
41
59
  return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
42
60
  // schema
43
61
  const metaType = appMetadata.getDesignReturntype(target, prop);
44
62
  const schema = makeSchemaLikes(schemaLikes, metaType);
45
63
  // options
46
- const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
64
+ const options = appMetadata.getOwnMetadataMap(
65
+ false,
66
+ SymbolOpenApiOptions,
67
+ target,
68
+ prop,
69
+ ) as IOpenapiOptions;
47
70
  options.bodySchema = schema;
48
71
  options.bodySchemaWrapper = bodySchemaWrapper;
49
72
  return descriptor;
@@ -52,7 +75,12 @@ function bodyCustom(bodySchemaWrapper: SchemaLikeCreate | false, ...schemaLikes:
52
75
 
53
76
  function exclude(): ClassDecorator & MethodDecorator {
54
77
  return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
55
- const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
78
+ const options = appMetadata.getOwnMetadataMap(
79
+ false,
80
+ SymbolOpenApiOptions,
81
+ target,
82
+ prop,
83
+ ) as IOpenapiOptions;
56
84
  options.exclude = true;
57
85
  return descriptor;
58
86
  } as any;
@@ -60,7 +88,12 @@ function exclude(): ClassDecorator & MethodDecorator {
60
88
 
61
89
  function tags(tags: string[]): ClassDecorator & MethodDecorator {
62
90
  return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
63
- const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
91
+ const options = appMetadata.getOwnMetadataMap(
92
+ false,
93
+ SymbolOpenApiOptions,
94
+ target,
95
+ prop,
96
+ ) as IOpenapiOptions;
64
97
  options.tags = tags;
65
98
  return descriptor;
66
99
  } as any;
@@ -68,7 +101,12 @@ function tags(tags: string[]): ClassDecorator & MethodDecorator {
68
101
 
69
102
  function header(header: IOpenapiHeader): ClassDecorator & MethodDecorator {
70
103
  return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
71
- const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
104
+ const options = appMetadata.getOwnMetadataMap(
105
+ false,
106
+ SymbolOpenApiOptions,
107
+ target,
108
+ prop,
109
+ ) as IOpenapiOptions;
72
110
  if (!options.headers) options.headers = [];
73
111
  options.headers.push(header);
74
112
  return descriptor;
@@ -77,7 +115,12 @@ function header(header: IOpenapiHeader): ClassDecorator & MethodDecorator {
77
115
 
78
116
  function headers(headers: IOpenapiHeader[]): ClassDecorator & MethodDecorator {
79
117
  return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
80
- const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
118
+ const options = appMetadata.getOwnMetadataMap(
119
+ false,
120
+ SymbolOpenApiOptions,
121
+ target,
122
+ prop,
123
+ ) as IOpenapiOptions;
81
124
  if (!options.headers) options.headers = [];
82
125
  options.headers.push(...headers);
83
126
  return descriptor;
@@ -88,7 +131,12 @@ function setHeader(field: { [key: string]: string | string[] }): ClassDecorator
88
131
  function setHeader(field: string, val: string | string[]): ClassDecorator & MethodDecorator;
89
132
  function setHeader(field: any, val?: any): ClassDecorator & MethodDecorator {
90
133
  return function (target: object, prop?: MetadataKey, descriptor?: PropertyDescriptor) {
91
- const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
134
+ const options = appMetadata.getOwnMetadataMap(
135
+ false,
136
+ SymbolOpenApiOptions,
137
+ target,
138
+ prop,
139
+ ) as IOpenapiOptions;
92
140
  if (!options.setHeaders) options.setHeaders = {};
93
141
  if (typeof field === 'string') {
94
142
  options.setHeaders[field] = val;
@@ -99,9 +147,30 @@ function setHeader(field: any, val?: any): ClassDecorator & MethodDecorator {
99
147
  } as any;
100
148
  }
101
149
 
102
- export const Api = { field: Field, httpCode, contentType, body, bodyCustom, exclude, tags, header, headers, setHeader };
150
+ export const Api = {
151
+ field: Field,
152
+ httpCode,
153
+ contentType,
154
+ body,
155
+ bodyCustom,
156
+ exclude,
157
+ tags,
158
+ header,
159
+ headers,
160
+ setHeader,
161
+ };
103
162
 
104
- export function setPublic(target: object, prop?: MetadataKey, _descriptor?: PropertyDescriptor, value?: boolean) {
105
- const options = appMetadata.getOwnMetadataMap(false, SymbolOpenApiOptions, target, prop) as IOpenapiOptions;
163
+ export function setPublic(
164
+ target: object,
165
+ prop?: MetadataKey,
166
+ _descriptor?: PropertyDescriptor,
167
+ value?: boolean,
168
+ ) {
169
+ const options = appMetadata.getOwnMetadataMap(
170
+ false,
171
+ SymbolOpenApiOptions,
172
+ target,
173
+ prop,
174
+ ) as IOpenapiOptions;
106
175
  options.public = value;
107
176
  }
package/src/lib/index.ts CHANGED
@@ -4,3 +4,4 @@ export * from './decorator/index.ts';
4
4
  export * from './schema/index.ts';
5
5
  export * from './utils.ts';
6
6
  export * from './web.ts';
7
+ export * from './resource.ts';
@@ -0,0 +1,5 @@
1
+ import type { IResourceRecord } from 'vona-module-a-openapi';
2
+
3
+ export function $resourceName<K extends keyof IResourceRecord>(name: K): K {
4
+ return name;
5
+ }
@@ -3,3 +3,4 @@ export * from './makeMetadata.ts';
3
3
  export * from './makeSchemaLikes.ts';
4
4
  export * from './schemaDynamic.ts';
5
5
  export * from './v.ts';
6
+ export * from './visible.ts';
@@ -1,4 +1,4 @@
1
- import type { ZodOpenAPIMetadata } from '@cabloy/zod-to-openapi';
1
+ import type { ISchemaObjectExtensionField } from 'vona-module-a-openapi';
2
2
 
3
3
  import { ZodMetadata } from '@cabloy/zod-openapi';
4
4
 
@@ -6,7 +6,9 @@ import type { SchemaLike } from '../../types/decorator.ts';
6
6
 
7
7
  import { $makeSchema } from './makeSchemaLikes.ts';
8
8
 
9
- export function $makeMetadata<T>(...schemaLikes: SchemaLike<T>[]): ZodOpenAPIMetadata<T> | undefined {
9
+ export function $makeMetadata<T>(
10
+ ...schemaLikes: SchemaLike<T>[]
11
+ ): ISchemaObjectExtensionField | undefined {
10
12
  const schema = $makeSchema(...schemaLikes);
11
- return ZodMetadata.getOpenapiMetadata(schema);
13
+ return ZodMetadata.getOpenapiMetadata(schema) as ISchemaObjectExtensionField;
12
14
  }
@@ -1,5 +1,5 @@
1
1
  import type { Constructable } from 'vona';
2
- import type { ISchemaObjectOptions, TypeOpenapiMetadata } from 'vona-module-a-openapi';
2
+ import type { ISchemaObjectExtensionField, ISchemaObjectOptions } from 'vona-module-a-openapi';
3
3
 
4
4
  import { isClass } from '@cabloy/utils';
5
5
  import { appMetadata, appResource, cast } from 'vona';
@@ -15,7 +15,10 @@ export function $makeSchema<T>(...schemaLikes: SchemaLike<T>[]): z.ZodType<T> {
15
15
  return makeSchemaLikes(schemaLikes, undefined);
16
16
  }
17
17
 
18
- export function makeSchemaLikes<T>(schemaLikes: SchemaLike<T> | SchemaLike<T>[], typeInit: any): z.ZodType<T> {
18
+ export function makeSchemaLikes<T>(
19
+ schemaLikes: SchemaLike<T> | SchemaLike<T>[],
20
+ typeInit: any,
21
+ ): z.ZodType<T> {
19
22
  if (!Array.isArray(schemaLikes)) schemaLikes = [schemaLikes];
20
23
  // default schema
21
24
  let argSchema: z.ZodType<T> = $schema(typeInit);
@@ -27,12 +30,20 @@ export function makeSchemaLikes<T>(schemaLikes: SchemaLike<T> | SchemaLike<T>[],
27
30
  return argSchema;
28
31
  }
29
32
 
30
- export function makeSchemaLike<T>(schemaLike: SchemaLike<T> | undefined, schemaPrevious: z.ZodType<T>): z.ZodType<T> {
33
+ export function makeSchemaLike<T>(
34
+ schemaLike: SchemaLike<T> | undefined,
35
+ schemaPrevious: z.ZodType<T>,
36
+ ): z.ZodType<T> {
31
37
  if (!schemaLike) return schemaPrevious;
32
38
  if (Object.prototype.hasOwnProperty.call(schemaLike, 'parseAsync')) {
33
39
  // schema
34
40
  return schemaLike as z.ZodType<T>;
35
- } else if (isClass(schemaLike) || ['String', 'Number', 'Boolean', 'Date', 'BigInt', 'Array'].includes(cast<Function>(schemaLike).name)) {
41
+ } else if (
42
+ isClass(schemaLike) ||
43
+ ['String', 'Number', 'Boolean', 'Date', 'BigInt', 'Array'].includes(
44
+ cast<Function>(schemaLike).name,
45
+ )
46
+ ) {
36
47
  // class
37
48
  return $schema(cast<Constructable>(schemaLike)) as z.ZodType<T>;
38
49
  } else {
@@ -48,7 +59,10 @@ export function $schema(classType: BooleanConstructor): z.ZodBoolean;
48
59
  export function $schema(classType: DateConstructor): z.ZodDate;
49
60
  export function $schema(classType: BigIntConstructor): z.ZodBigInt;
50
61
  export function $schema(classType: ArrayConstructor): z.ZodArray<z.ZodAny>;
51
- export function $schema<T>(classType: Constructable<T>, options?: ISchemaObjectOptions): z.ZodType<T>;
62
+ export function $schema<T>(
63
+ classType: Constructable<T>,
64
+ options?: ISchemaObjectOptions,
65
+ ): z.ZodType<T>;
52
66
  export function $schema(classType: any, options?: ISchemaObjectOptions): any {
53
67
  if (!classType) return z.any();
54
68
  if (classType.parseAsync) return classType;
@@ -59,7 +73,9 @@ export function $schema(classType: any, options?: ISchemaObjectOptions): any {
59
73
  if (classType.name === 'BigInt') return z.bigint();
60
74
  if (classType.name === 'Array') return z.array(z.any());
61
75
  // check if object
62
- const rules = classType.prototype ? appMetadata.getMetadata(SymbolDecoratorRule, classType.prototype) : undefined;
76
+ const rules = classType.prototype
77
+ ? appMetadata.getMetadata(SymbolDecoratorRule, classType.prototype)
78
+ : undefined;
63
79
  if (!rules) {
64
80
  // not object
65
81
  return z.any();
@@ -79,7 +95,7 @@ export function $schema(classType: any, options?: ISchemaObjectOptions): any {
79
95
  if (pipes) {
80
96
  schema = makeSchemaLikes(pipes, schema) as any;
81
97
  }
82
- const openapi: TypeOpenapiMetadata = cast(beanOptions.options)?.openapi;
98
+ const openapi: ISchemaObjectExtensionField = cast(beanOptions.options)?.openapi;
83
99
  schema = schema.openapi(beanOptions.beanFullName, openapi);
84
100
  }
85
101
  }
@@ -0,0 +1,36 @@
1
+ import type { IFilterTransformRecord, ISchemaObjectExtensionFieldFilter } from 'vona-module-a-web';
2
+ import type z from 'zod';
3
+
4
+ export function schemaFilter(options: ISchemaObjectExtensionFieldFilter) {
5
+ return function (schema: z.ZodType): z.ZodType {
6
+ return schema.openapi({
7
+ filter: options,
8
+ });
9
+ };
10
+ }
11
+
12
+ export function schemaFilterTransform<T extends keyof IFilterTransformRecord>(
13
+ filterTransformName: T,
14
+ options?: Partial<IFilterTransformRecord[T]>,
15
+ ) {
16
+ return function (schema: z.ZodType): z.ZodType {
17
+ return schema.openapi({
18
+ filter: {
19
+ transform: [filterTransformName, options],
20
+ },
21
+ });
22
+ };
23
+ }
24
+
25
+ // export function schemaFilterDateRange(options?: Partial<IFilterTransformOptionsDateRange>) {
26
+ // const separator = options?.separator;
27
+ // const fnFilterRender = schemaRenderComponent(
28
+ // 'dataRange',
29
+ // separator ? { separator } : undefined,
30
+ // 'filter',
31
+ // );
32
+ // const fnFilterTransform = schemaFilterTransform('a-web:dateRange', options);
33
+ // return function (schema: z.ZodType): z.ZodType {
34
+ // return fnFilterTransform(fnFilterRender(schema));
35
+ // };
36
+ // }
@@ -35,22 +35,44 @@ export function schemaIPv6(params?: string | ILocaleMagic | z.core.$ZodIPv6Param
35
35
  };
36
36
  }
37
37
 
38
- export function schemaMin(min: number, params?: string | ILocaleMagic | z.core.$ZodCheckMinLengthParams | z.core.$ZodCheckGreaterThanParams) {
38
+ export function schemaMin(
39
+ min: number,
40
+ params?:
41
+ | string
42
+ | ILocaleMagic
43
+ | z.core.$ZodCheckMinLengthParams
44
+ | z.core.$ZodCheckGreaterThanParams,
45
+ ) {
39
46
  return function (schema: z.ZodString | z.ZodNumber): z.ZodString | z.ZodNumber {
40
47
  if (schema.type === 'string') {
41
- return schema.min(min, normalizeErrorParams(params) as string | z.core.$ZodCheckMinLengthParams);
48
+ return schema.min(
49
+ min,
50
+ normalizeErrorParams(params) as string | z.core.$ZodCheckMinLengthParams,
51
+ );
42
52
  } else {
43
- return schema.min(min, normalizeErrorParams(params) as string | z.core.$ZodCheckGreaterThanParams);
53
+ return schema.min(
54
+ min,
55
+ normalizeErrorParams(params) as string | z.core.$ZodCheckGreaterThanParams,
56
+ );
44
57
  }
45
58
  };
46
59
  }
47
60
 
48
- export function schemaMax(max: number, params?: string | ILocaleMagic | z.core.$ZodCheckMaxLengthParams | z.core.$ZodCheckLessThanParams) {
61
+ export function schemaMax(
62
+ max: number,
63
+ params?: string | ILocaleMagic | z.core.$ZodCheckMaxLengthParams | z.core.$ZodCheckLessThanParams,
64
+ ) {
49
65
  return function (schema: z.ZodString | z.ZodNumber): z.ZodString | z.ZodNumber {
50
66
  if (schema.type === 'string') {
51
- return schema.max(max, normalizeErrorParams(params) as string | z.core.$ZodCheckMaxLengthParams);
67
+ return schema.max(
68
+ max,
69
+ normalizeErrorParams(params) as string | z.core.$ZodCheckMaxLengthParams,
70
+ );
52
71
  } else {
53
- return schema.max(max, normalizeErrorParams(params) as string | z.core.$ZodCheckLessThanParams);
72
+ return schema.max(
73
+ max,
74
+ normalizeErrorParams(params) as string | z.core.$ZodCheckLessThanParams,
75
+ );
54
76
  }
55
77
  };
56
78
  }
@@ -85,7 +107,10 @@ export function schemaUppercase(params?: string | ILocaleMagic | z.core.$ZodChec
85
107
  };
86
108
  }
87
109
 
88
- export function schemaRegex(regex: RegExp, params?: string | ILocaleMagic | z.core.$ZodCheckRegexParams) {
110
+ export function schemaRegex(
111
+ regex: RegExp,
112
+ params?: string | ILocaleMagic | z.core.$ZodCheckRegexParams,
113
+ ) {
89
114
  return function (schema: z.ZodString): z.ZodString {
90
115
  return schema.regex(regex, normalizeErrorParams(params));
91
116
  };
@@ -1,9 +1,12 @@
1
1
  import type { ILocaleMagic } from 'vona';
2
- import type { TypeOpenapiMetadata } from 'vona-module-a-openapi';
2
+ import type { ISchemaObjectExtensionField } from 'vona-module-a-openapi';
3
3
  import type { z } from 'zod';
4
4
 
5
- export function schemaOpenapi<T extends z.ZodType>(metadata: TypeOpenapiMetadata<T>): T;
6
- export function schemaOpenapi<T extends z.ZodType>(refId: string, metadata?: TypeOpenapiMetadata<T>): T;
5
+ export function schemaOpenapi<T extends z.ZodType>(metadata: ISchemaObjectExtensionField): T;
6
+ export function schemaOpenapi<T extends z.ZodType>(
7
+ refId: string,
8
+ metadata?: ISchemaObjectExtensionField,
9
+ ): T;
7
10
  export function schemaOpenapi<T extends z.ZodType>(refId: any, metadata?: any) {
8
11
  return function (schema: T): T {
9
12
  return schema.openapi(refId, metadata);
@@ -23,7 +23,9 @@ export function schemaSerializerTransform<T extends keyof ISerializerTransformRe
23
23
 
24
24
  export function schemaSerializerExclude(options: Partial<ISerializerTransformOptionsExclude>);
25
25
  export function schemaSerializerExclude(exclude?: boolean);
26
- export function schemaSerializerExclude(param?: boolean | Partial<ISerializerTransformOptionsExclude>) {
26
+ export function schemaSerializerExclude(
27
+ param?: boolean | Partial<ISerializerTransformOptionsExclude>,
28
+ ) {
27
29
  let options: Partial<ISerializerTransformOptionsExclude>;
28
30
  if (!param || typeof param === 'boolean') {
29
31
  options = { exclude: param };
@@ -39,7 +41,9 @@ export function schemaSerializerExclude(param?: boolean | Partial<ISerializerTra
39
41
  };
40
42
  }
41
43
 
42
- export function schemaSerializerReplace(options: ISerializerTransformRecord['a-serialization:replace']) {
44
+ export function schemaSerializerReplace(
45
+ options: ISerializerTransformRecord['a-serialization:replace'],
46
+ ) {
43
47
  return function (schema: z.ZodType): z.ZodType {
44
48
  return schema.openapi({
45
49
  serializerTransforms: {
@@ -51,7 +55,9 @@ export function schemaSerializerReplace(options: ISerializerTransformRecord['a-s
51
55
 
52
56
  export function schemaSerializerGetter(options: Partial<ISerializerTransformOptionsGetter>);
53
57
  export function schemaSerializerGetter(getter: TypeSerializerTransformGetter);
54
- export function schemaSerializerGetter(param: TypeSerializerTransformGetter | Partial<ISerializerTransformOptionsGetter>) {
58
+ export function schemaSerializerGetter(
59
+ param: TypeSerializerTransformGetter | Partial<ISerializerTransformOptionsGetter>,
60
+ ) {
55
61
  let options: Partial<ISerializerTransformOptionsGetter>;
56
62
  if (typeof param === 'function') {
57
63
  options = { getter: param };
@@ -69,7 +75,9 @@ export function schemaSerializerGetter(param: TypeSerializerTransformGetter | Pa
69
75
 
70
76
  export function schemaSerializerCustom(options: Partial<ISerializerTransformOptionsCustom>);
71
77
  export function schemaSerializerCustom(getter: TypeSerializerTransformCustom);
72
- export function schemaSerializerCustom(param: TypeSerializerTransformCustom | Partial<ISerializerTransformOptionsCustom>) {
78
+ export function schemaSerializerCustom(
79
+ param: TypeSerializerTransformCustom | Partial<ISerializerTransformOptionsCustom>,
80
+ ) {
73
81
  let options: Partial<ISerializerTransformOptionsCustom>;
74
82
  if (typeof param === 'function') {
75
83
  options = { custom: param };
@@ -35,7 +35,10 @@ export function schemaObject<T>(classType: Constructable<T>, options?: ISchemaOb
35
35
  };
36
36
  }
37
37
 
38
- export function schemaArray(schemaLike?: SchemaLike, params?: z.core.$ZodArrayParams & { separator?: string }) {
38
+ export function schemaArray(
39
+ schemaLike?: SchemaLike,
40
+ params?: z.core.$ZodArrayParams & { separator?: string },
41
+ ) {
39
42
  return function (schema: z.ZodType): z.ZodType {
40
43
  return z.preprocess(
41
44
  val => {
@@ -1,6 +1,10 @@
1
1
  import type { TypeSchemaScene } from 'vona-module-a-openapi';
2
2
  import type z from 'zod';
3
3
 
4
- export function _generalSchemaRest<T extends z.ZodType>(schema: T, options: any, scene?: TypeSchemaScene) {
4
+ export function _generalSchemaRest<T extends z.ZodType>(
5
+ schema: T,
6
+ options: any,
7
+ scene?: TypeSchemaScene,
8
+ ) {
5
9
  return schema.openapi(scene ? { rest: { [scene]: options } } : { rest: options });
6
10
  }
@@ -1,9 +1,17 @@
1
- import type { IZodRefineExecute, IZodRefineRecord, IZodTransformExecute, IZodTransformRecord } from 'vona-module-a-zod';
1
+ import type {
2
+ IZodRefineExecute,
3
+ IZodRefineRecord,
4
+ IZodTransformExecute,
5
+ IZodTransformRecord,
6
+ } from 'vona-module-a-zod';
2
7
  import type z from 'zod';
3
8
 
4
9
  import { beanFullNameFromOnionName, useApp } from 'vona';
5
10
 
6
- export function schemaZodRefine<T extends keyof IZodRefineRecord>(zodRefineName: T, options?: Partial<IZodRefineRecord[T]>) {
11
+ export function schemaZodRefine<T extends keyof IZodRefineRecord>(
12
+ zodRefineName: T,
13
+ options?: Partial<IZodRefineRecord[T]>,
14
+ ) {
7
15
  return function (schema: z.ZodType): z.ZodType {
8
16
  return schema.superRefine(async (value, refinementCtx) => {
9
17
  const app = useApp();
@@ -19,11 +27,17 @@ export function schemaZodRefine<T extends keyof IZodRefineRecord>(zodRefineName:
19
27
  };
20
28
  }
21
29
 
22
- export function schemaZodTransform<T extends keyof IZodTransformRecord>(zodTransformName: T, options?: Partial<IZodTransformRecord[T]>) {
30
+ export function schemaZodTransform<T extends keyof IZodTransformRecord>(
31
+ zodTransformName: T,
32
+ options?: Partial<IZodTransformRecord[T]>,
33
+ ) {
23
34
  return function (schema: z.ZodType): z.ZodType {
24
35
  return schema.transform(async value => {
25
36
  const app = useApp();
26
- const options2 = app.bean.onion.zodTransform.getOnionOptionsDynamic(zodTransformName, options);
37
+ const options2 = app.bean.onion.zodTransform.getOnionOptionsDynamic(
38
+ zodTransformName,
39
+ options,
40
+ );
27
41
  // execute
28
42
  const beanFullName = beanFullNameFromOnionName(zodTransformName, 'zodTransform');
29
43
  const beanInstance = app.bean._getBean(beanFullName) as IZodTransformExecute;