vona-module-a-openapi 5.0.29 → 5.0.30
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/index.js +5 -77
- package/dist/lib/decorator/index.d.ts +0 -2
- package/dist/types/decorator.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/query.d.ts +11 -0
- package/dist/types/rest.d.ts +2 -0
- package/package.json +2 -2
- package/dist/lib/decorator/arguments.d.ts +0 -38
- package/dist/lib/decorator/pipesArgument.d.ts +0 -3
package/dist/index.js
CHANGED
|
@@ -381,6 +381,7 @@ let ServiceOpenapi = (_dec$2 = Service(), _dec2$2 = BeanInfo({
|
|
|
381
381
|
const argsMapIsolate = {};
|
|
382
382
|
let isUpload;
|
|
383
383
|
for (const argMeta of argsMeta) {
|
|
384
|
+
if (!argMeta) continue;
|
|
384
385
|
if (!__ArgumentTypes.includes(argMeta.type)) continue;
|
|
385
386
|
if (['fields', 'field', 'files', 'file'].includes(argMeta.type)) {
|
|
386
387
|
isUpload = true;
|
|
@@ -628,7 +629,7 @@ function $locale(key) {
|
|
|
628
629
|
}
|
|
629
630
|
/** scope: end */
|
|
630
631
|
|
|
631
|
-
function Field
|
|
632
|
+
function Field(...schemaLikes) {
|
|
632
633
|
return function (target, prop) {
|
|
633
634
|
// rules
|
|
634
635
|
const rules = getTargetDecoratorRules(target);
|
|
@@ -721,7 +722,7 @@ function setHeader(field, val) {
|
|
|
721
722
|
};
|
|
722
723
|
}
|
|
723
724
|
const Api = {
|
|
724
|
-
field: Field
|
|
725
|
+
field: Field,
|
|
725
726
|
httpCode,
|
|
726
727
|
contentType,
|
|
727
728
|
body,
|
|
@@ -733,79 +734,6 @@ const Api = {
|
|
|
733
734
|
setHeader
|
|
734
735
|
};
|
|
735
736
|
|
|
736
|
-
function createPipesArgumentDecorator(paramType, extractValue) {
|
|
737
|
-
return function (field, ...schemaLikes) {
|
|
738
|
-
return function (target, prop, index) {
|
|
739
|
-
// not inherit
|
|
740
|
-
const argsMeta = appMetadata.getOwnMetadataArray(false, SymbolRouteHandlersArgumentsMeta, target, prop);
|
|
741
|
-
const hasParamField = typeof field === 'string';
|
|
742
|
-
const paramField = hasParamField ? field : undefined;
|
|
743
|
-
const paramSchemaLikes = hasParamField ? schemaLikes : [field, ...schemaLikes].filter(item => !!item);
|
|
744
|
-
const paramtypes = appMetadata.getMetadata('design:paramtypes', target, prop);
|
|
745
|
-
let metaType;
|
|
746
|
-
if (paramType === 'file') {
|
|
747
|
-
metaType = z.string().openapi({
|
|
748
|
-
format: 'binary'
|
|
749
|
-
});
|
|
750
|
-
} else if (paramType === 'files') {
|
|
751
|
-
metaType = z.array(z.string().openapi({
|
|
752
|
-
format: 'binary'
|
|
753
|
-
}));
|
|
754
|
-
} else {
|
|
755
|
-
metaType = paramtypes[index];
|
|
756
|
-
}
|
|
757
|
-
const argSchema = makeSchemaLikes(paramSchemaLikes, metaType);
|
|
758
|
-
argsMeta.push({
|
|
759
|
-
index,
|
|
760
|
-
type: paramType,
|
|
761
|
-
field: paramField,
|
|
762
|
-
pipes: [argSchema],
|
|
763
|
-
schema: argSchema,
|
|
764
|
-
extractValue
|
|
765
|
-
});
|
|
766
|
-
};
|
|
767
|
-
};
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
function Param(property, ...schemaLikes) {
|
|
771
|
-
return createPipesArgumentDecorator('param')(property, ...schemaLikes);
|
|
772
|
-
}
|
|
773
|
-
function Query(property, ...schemaLikes) {
|
|
774
|
-
return createPipesArgumentDecorator('query')(property, ...schemaLikes);
|
|
775
|
-
}
|
|
776
|
-
function Body(property, ...schemaLikes) {
|
|
777
|
-
return createPipesArgumentDecorator('body')(property, ...schemaLikes);
|
|
778
|
-
}
|
|
779
|
-
function Headers(property, ...schemaLikes) {
|
|
780
|
-
return createPipesArgumentDecorator('headers')(property, ...schemaLikes);
|
|
781
|
-
}
|
|
782
|
-
function Fields(property, ...schemaLikes) {
|
|
783
|
-
return createPipesArgumentDecorator('fields')(property, ...schemaLikes);
|
|
784
|
-
}
|
|
785
|
-
function Field(property, ...schemaLikes) {
|
|
786
|
-
return createPipesArgumentDecorator('field')(property, ...schemaLikes);
|
|
787
|
-
}
|
|
788
|
-
function Files(property, ...schemaLikes) {
|
|
789
|
-
return createPipesArgumentDecorator('files')(property, ...schemaLikes);
|
|
790
|
-
}
|
|
791
|
-
function File(property, ...schemaLikes) {
|
|
792
|
-
return createPipesArgumentDecorator('file')(property, ...schemaLikes);
|
|
793
|
-
}
|
|
794
|
-
function User(...schemaLikes) {
|
|
795
|
-
return createPipesArgumentDecorator('user')(undefined, ...schemaLikes);
|
|
796
|
-
}
|
|
797
|
-
const Arg = {
|
|
798
|
-
param: Param,
|
|
799
|
-
query: Query,
|
|
800
|
-
body: Body,
|
|
801
|
-
headers: Headers,
|
|
802
|
-
fields: Fields,
|
|
803
|
-
field: Field,
|
|
804
|
-
files: Files,
|
|
805
|
-
file: File,
|
|
806
|
-
user: User
|
|
807
|
-
};
|
|
808
|
-
|
|
809
737
|
function schemaEmail(message) {
|
|
810
738
|
return function (schema) {
|
|
811
739
|
return schema.email(message);
|
|
@@ -908,7 +836,7 @@ function schemaArray(schemaLike, params) {
|
|
|
908
836
|
val = coerceWithNil(val);
|
|
909
837
|
if (isNil(val)) return val;
|
|
910
838
|
if (typeof val !== 'string') return val;
|
|
911
|
-
if (
|
|
839
|
+
if (val.startsWith('[') && val.endsWith(']')) return JSON.parse(val);
|
|
912
840
|
return val.split(params?.separator ?? ',');
|
|
913
841
|
}, z.array(makeSchemaLike(schemaLike ?? schema, z.any()), params)
|
|
914
842
|
// z.array(makeSchemaLike(schemaLike, schema), params),
|
|
@@ -943,4 +871,4 @@ const OrderBusinessBase = 1000;
|
|
|
943
871
|
const OrderUnknownBase = 10000;
|
|
944
872
|
const OrderMaxBase = 100000;
|
|
945
873
|
|
|
946
|
-
export { $locale, $schema, $schemaLazy, Api,
|
|
874
|
+
export { $locale, $schema, $schemaLazy, Api, Main, OrderBusinessBase, OrderCoreBase, OrderMaxBase, OrderUnknownBase, ScopeModuleAOpenapi, ServiceOpenapi, SummerCacheJson, SymbolRouteHandlersArgumentsMeta, SymbolRouteHandlersArgumentsValue, SymbolSchemaDynamicRefId, addSchemaDynamic, bodySchemaWrapperDefault, config, errorsAdapter, getSchemaDynamic, getSchemasDynamic, getTargetDecoratorRuleColumns, getTargetDecoratorRules, locales, makeSchemaLike, makeSchemaLikes, mergeFieldsOpenapiMetadata, prepareClassType, schemaRefCustomAdapter, v };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IModelSelectParamsJoinType, ITableRecord, TypeOpsNormal } from 'vona-module-a-orm';
|
|
2
|
+
export interface ISchemaObjectExtensionFieldQueryJoin {
|
|
3
|
+
type?: IModelSelectParamsJoinType;
|
|
4
|
+
table: keyof ITableRecord;
|
|
5
|
+
on: [string, string];
|
|
6
|
+
}
|
|
7
|
+
export interface ISchemaObjectExtensionFieldQuery {
|
|
8
|
+
join?: ISchemaObjectExtensionFieldQueryJoin;
|
|
9
|
+
originalName?: string;
|
|
10
|
+
op?: TypeOpsNormal;
|
|
11
|
+
}
|
package/dist/types/rest.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { IOpenApiOptions } from 'vona-module-a-openapiutils';
|
|
|
4
4
|
import type { z, ZodTypeAny } from 'zod';
|
|
5
5
|
import type { TypeResourceActionRowRecordRender } from './actions.ts';
|
|
6
6
|
import type { IComponentRecord } from './component.ts';
|
|
7
|
+
import type { ISchemaObjectExtensionFieldQuery } from './query.ts';
|
|
7
8
|
import 'openapi3-ts/oas30';
|
|
8
9
|
import 'openapi3-ts/oas31';
|
|
9
10
|
export interface ISchemaObjectExtensionFieldRest {
|
|
@@ -16,6 +17,7 @@ export interface ISchemaObjectExtensionFieldRest {
|
|
|
16
17
|
}
|
|
17
18
|
export interface ISchemaObjectExtensionField {
|
|
18
19
|
rest?: ISchemaObjectExtensionFieldRest;
|
|
20
|
+
query?: ISchemaObjectExtensionFieldQuery;
|
|
19
21
|
}
|
|
20
22
|
declare module 'openapi3-ts/oas30' {
|
|
21
23
|
interface SchemaObject extends ISchemaObjectExtensionField {
|
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.
|
|
4
|
+
"version": "5.0.30",
|
|
5
5
|
"title": "a-openapi",
|
|
6
6
|
"vonaModule": {
|
|
7
7
|
"capabilities": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@asteasolutions/zod-to-openapi": "^7.3.0",
|
|
37
37
|
"@cabloy/zod-errors-custom": "^1.0.13",
|
|
38
|
-
"@cabloy/zod-query": "^1.0.
|
|
38
|
+
"@cabloy/zod-query": "^1.0.17",
|
|
39
39
|
"@zhennann/currency": "^2.0.0",
|
|
40
40
|
"openapi3-ts": "^4.4.0",
|
|
41
41
|
"zod": "^3.25.58"
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { SchemaLike } from 'vona-module-a-openapiutils';
|
|
2
|
-
declare function Param(): ParameterDecorator;
|
|
3
|
-
declare function Param(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
4
|
-
declare function Param(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
5
|
-
declare function Query(): ParameterDecorator;
|
|
6
|
-
declare function Query(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
7
|
-
declare function Query(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
8
|
-
declare function Body(): ParameterDecorator;
|
|
9
|
-
declare function Body(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
10
|
-
declare function Body(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
11
|
-
declare function Headers(): ParameterDecorator;
|
|
12
|
-
declare function Headers(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
13
|
-
declare function Headers(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
14
|
-
declare function Fields(): ParameterDecorator;
|
|
15
|
-
declare function Fields(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
16
|
-
declare function Fields(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
17
|
-
declare function Field(): ParameterDecorator;
|
|
18
|
-
declare function Field(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
19
|
-
declare function Field(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
20
|
-
declare function Files(): ParameterDecorator;
|
|
21
|
-
declare function Files(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
22
|
-
declare function Files(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
23
|
-
declare function File(): ParameterDecorator;
|
|
24
|
-
declare function File(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
25
|
-
declare function File(property: string, ...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
26
|
-
declare function User(...schemaLikes: SchemaLike[]): ParameterDecorator;
|
|
27
|
-
export declare const Arg: {
|
|
28
|
-
param: typeof Param;
|
|
29
|
-
query: typeof Query;
|
|
30
|
-
body: typeof Body;
|
|
31
|
-
headers: typeof Headers;
|
|
32
|
-
fields: typeof Fields;
|
|
33
|
-
field: typeof Field;
|
|
34
|
-
files: typeof Files;
|
|
35
|
-
file: typeof File;
|
|
36
|
-
user: typeof User;
|
|
37
|
-
};
|
|
38
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { SchemaLike } from 'vona-module-a-openapiutils';
|
|
2
|
-
import type { RouteHandlerArgumentType, TypeExtractValue } from '../../types/decorator.ts';
|
|
3
|
-
export declare function createPipesArgumentDecorator(paramType: RouteHandlerArgumentType, extractValue?: TypeExtractValue): (field?: string | SchemaLike, ...schemaLikes: SchemaLike[]) => ParameterDecorator;
|