vona-module-a-openapi 5.0.67 → 5.0.69
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 +0 -35
- package/dist/service/openapi.d.ts +0 -3
- package/dist/types/formProvider.d.ts +18 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/openapi.d.ts +6 -0
- package/dist/types/resource.d.ts +2 -0
- package/dist/types/resourceMeta.d.ts +33 -0
- package/dist/types/rest.d.ts +6 -6
- package/dist/types/tableProvider.d.ts +8 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -84,7 +84,6 @@ BeanOpenapi = __decorate([Bean(), BeanInfo({
|
|
|
84
84
|
})], BeanOpenapi);
|
|
85
85
|
|
|
86
86
|
const __ArgumentTypes = ['param', 'query', 'body', 'headers', 'fields', 'field', 'files', 'file'];
|
|
87
|
-
const symbolJsxRenderTranslated = Symbol('symbolJsxRenderTranslated');
|
|
88
87
|
let ServiceOpenapi = class ServiceOpenapi extends BeanBase {
|
|
89
88
|
async clearAllCaches() {
|
|
90
89
|
const cacheOpenapiSchema = this.bean.summer.cache(beanFullNameFromOnionName('a-openapi:json', 'summerCache'));
|
|
@@ -148,8 +147,6 @@ let ServiceOpenapi = class ServiceOpenapi extends BeanBase {
|
|
|
148
147
|
}
|
|
149
148
|
// errorMessage
|
|
150
149
|
this._translateErrorMessages(schema);
|
|
151
|
-
// jsxRender
|
|
152
|
-
this._translateJsxRenders(schema);
|
|
153
150
|
// properties
|
|
154
151
|
const properties = cast(schema).properties;
|
|
155
152
|
if (properties && typeof properties === 'object') {
|
|
@@ -185,38 +182,6 @@ let ServiceOpenapi = class ServiceOpenapi extends BeanBase {
|
|
|
185
182
|
}, error, scope);
|
|
186
183
|
}
|
|
187
184
|
}
|
|
188
|
-
_translateJsxRenders(obj) {
|
|
189
|
-
this._translateJsxRendersInner(obj.rest);
|
|
190
|
-
this._translateJsxRendersInner(obj.rest?.table);
|
|
191
|
-
this._translateJsxRendersInner(obj.rest?.form);
|
|
192
|
-
}
|
|
193
|
-
_translateJsxRendersInner(obj) {
|
|
194
|
-
if (!obj) return;
|
|
195
|
-
for (const key in obj) {
|
|
196
|
-
obj[key] = this._translateJsxRender(obj[key]);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
_translateJsxRender(component) {
|
|
200
|
-
if (typeof component !== 'object' || !component.$$typeof) return component;
|
|
201
|
-
if (component[symbolJsxRenderTranslated] === true) return component;
|
|
202
|
-
const componentNew = {};
|
|
203
|
-
componentNew[symbolJsxRenderTranslated] = true;
|
|
204
|
-
componentNew.$$typeof = 'zova-jsx';
|
|
205
|
-
componentNew.type = typeof component.type === 'function' ? component.type() : component.type;
|
|
206
|
-
componentNew.key = component.key;
|
|
207
|
-
componentNew.props = {
|
|
208
|
-
...component.props
|
|
209
|
-
};
|
|
210
|
-
const children = componentNew.props.children;
|
|
211
|
-
if (children) {
|
|
212
|
-
if (Array.isArray(children)) {
|
|
213
|
-
componentNew.props.children = children.map(item => this._translateJsxRender(item));
|
|
214
|
-
} else if (typeof children === 'object' && !children.toJSON) {
|
|
215
|
-
componentNew.props.children = this._translateJsxRender(children);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
return componentNew;
|
|
219
|
-
}
|
|
220
185
|
collectRegistry() {
|
|
221
186
|
const registry = new OpenAPIRegistry();
|
|
222
187
|
// securitySchemes
|
|
@@ -9,9 +9,6 @@ export declare class ServiceOpenapi extends BeanBase {
|
|
|
9
9
|
translate(apiObj: OpenAPIObject30 | OpenAPIObject31, generateJsonScene: TypeGenerateJsonScene): void;
|
|
10
10
|
private _translateSchema;
|
|
11
11
|
private _translateErrorMessages;
|
|
12
|
-
private _translateJsxRenders;
|
|
13
|
-
private _translateJsxRendersInner;
|
|
14
|
-
private _translateJsxRender;
|
|
15
12
|
collectRegistry(): OpenAPIRegistry;
|
|
16
13
|
collectController(registry: OpenAPIRegistry, moduleName: string, controller: Constructable, actionKey?: string): void;
|
|
17
14
|
private _registerControllerAction;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TypeBehaviorRecordSelectorKeys, TypeBehaviorRecordSelectorKeysStrict } from './behavior.ts';
|
|
2
|
+
import type { TypeComponentRecordSelectorKeysStrict } from './component.ts';
|
|
3
|
+
import type { TypeFormFieldRenderComponentProvider } from './rest.ts';
|
|
4
|
+
export interface IFormProviderBehaviors {
|
|
5
|
+
formField?: TypeBehaviorRecordSelectorKeysStrict<'formField'>;
|
|
6
|
+
formFieldModel?: TypeBehaviorRecordSelectorKeys<'formFieldModel'>;
|
|
7
|
+
formFieldLayout?: TypeBehaviorRecordSelectorKeys<'formFieldLayout'>;
|
|
8
|
+
}
|
|
9
|
+
export interface IFormProviderComponents {
|
|
10
|
+
formField?: TypeComponentRecordSelectorKeysStrict<'formField'>;
|
|
11
|
+
text?: TypeFormFieldRenderComponentProvider;
|
|
12
|
+
password?: TypeFormFieldRenderComponentProvider;
|
|
13
|
+
currency?: TypeFormFieldRenderComponentProvider;
|
|
14
|
+
}
|
|
15
|
+
export interface IFormProvider {
|
|
16
|
+
components?: IFormProviderComponents;
|
|
17
|
+
behaviors?: IFormProviderBehaviors;
|
|
18
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,4 +5,9 @@ export * from './captcha.ts';
|
|
|
5
5
|
export * from './component.ts';
|
|
6
6
|
export * from './date.ts';
|
|
7
7
|
export * from './decorator.ts';
|
|
8
|
+
export * from './formProvider.ts';
|
|
9
|
+
export * from './openapi.ts';
|
|
10
|
+
export * from './resource.ts';
|
|
11
|
+
export * from './resourceMeta.ts';
|
|
8
12
|
export * from './rest.ts';
|
|
13
|
+
export * from './tableProvider.ts';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { TypeComponentRecordSelectorKeysStrict, TypeResourceActionRowRecord, TypeResourceActionTableRecord } from 'vona-module-a-openapi';
|
|
2
|
+
import type { IFormProvider } from './formProvider.ts';
|
|
3
|
+
import type { ITableProvider } from './tableProvider.ts';
|
|
4
|
+
export interface IOpenapiOptionsResourceMeta {
|
|
5
|
+
permissions?: IOpenapiOptionsResourceMetaPermissions;
|
|
6
|
+
provider?: IOpenapiOptionsResourceMetaProvider;
|
|
7
|
+
form?: IOpenapiOptionsResourceMetaForm;
|
|
8
|
+
table?: IOpenapiOptionsResourceMetaTable;
|
|
9
|
+
}
|
|
10
|
+
export interface IOpenapiOptionsResourceMetaForm {
|
|
11
|
+
provider?: IFormProvider;
|
|
12
|
+
}
|
|
13
|
+
export interface IOpenapiOptionsResourceMetaTable {
|
|
14
|
+
provider?: ITableProvider;
|
|
15
|
+
}
|
|
16
|
+
export interface IOpenapiOptionsResourceMetaPermissions {
|
|
17
|
+
table?: TypeOpenApiOptionsRestResourcePermissionsTable;
|
|
18
|
+
row?: TypeOpenApiOptionsRestResourcePermissionsRow;
|
|
19
|
+
}
|
|
20
|
+
export type TypeOpenApiOptionsRestResourcePermissionsTable = {
|
|
21
|
+
[key in keyof TypeResourceActionTableRecord]?: boolean;
|
|
22
|
+
};
|
|
23
|
+
export type TypeOpenApiOptionsRestResourcePermissionsRow = {
|
|
24
|
+
[key in keyof TypeResourceActionRowRecord]?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export interface IOpenapiOptionsResourceMetaProvider {
|
|
27
|
+
components?: IOpenapiOptionsResourceMetaProviderComponents;
|
|
28
|
+
}
|
|
29
|
+
export interface IOpenapiOptionsResourceMetaProviderComponents {
|
|
30
|
+
restPage?: TypeComponentRecordSelectorKeysStrict<'restPage'>;
|
|
31
|
+
table?: TypeComponentRecordSelectorKeysStrict<'table'>;
|
|
32
|
+
form?: TypeComponentRecordSelectorKeysStrict<'form'>;
|
|
33
|
+
}
|
package/dist/types/rest.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ZodOpenAPIMetadata } from '@cabloy/zod-to-openapi';
|
|
2
2
|
import type { CurrencyOptions } from '@zhennann/currency';
|
|
3
3
|
import type { ILocaleMagic } from 'vona';
|
|
4
|
-
import type {
|
|
4
|
+
import type { IOpenapiOptions } from 'vona-module-a-openapiutils';
|
|
5
5
|
import type { z } from 'zod';
|
|
6
6
|
import type { TypeResourceActionRowRecordRender } from './actions.ts';
|
|
7
7
|
import type { ISchemaObjectExtensionFieldCaptcha } from './captcha.ts';
|
|
@@ -10,8 +10,8 @@ import type { TypeDateFormat } from './date.ts';
|
|
|
10
10
|
import 'openapi3-ts/oas30';
|
|
11
11
|
import 'openapi3-ts/oas31';
|
|
12
12
|
export type HTMLInputElementType = 'text' | 'password' | 'number' | 'file' | 'hidden' | 'tel' | 'email';
|
|
13
|
-
export type
|
|
14
|
-
export type
|
|
13
|
+
export type TypeFormFieldOnSetDisplayValue = (value: any) => any;
|
|
14
|
+
export type TypeFormFieldDisplayValueUpdateTiming = 'input' | 'change';
|
|
15
15
|
export interface ISchemaObjectExtensionFieldRestProps {
|
|
16
16
|
visible?: boolean;
|
|
17
17
|
order?: number;
|
|
@@ -25,8 +25,8 @@ export interface ISchemaObjectExtensionFieldRestProps {
|
|
|
25
25
|
header?: TypeRenderComponentJsx | string;
|
|
26
26
|
footer?: TypeRenderComponentJsx | string;
|
|
27
27
|
displayValue?: any;
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
displayValueUpdateTiming?: TypeFormFieldDisplayValueUpdateTiming;
|
|
29
|
+
onSetDisplayValue?: TypeFormFieldOnSetDisplayValue;
|
|
30
30
|
class?: any;
|
|
31
31
|
placeholder?: string;
|
|
32
32
|
readonly?: boolean;
|
|
@@ -81,5 +81,5 @@ export type TypeEntityOptionsFields<T extends {}, More extends string | undefine
|
|
|
81
81
|
[key in ((keyof T) | (More extends string ? More : never))]?: TypeOpenapiMetadata | z.ZodType;
|
|
82
82
|
};
|
|
83
83
|
export type TypeControllerOptionsActions<T extends {}> = {
|
|
84
|
-
[key in (keyof T)]?:
|
|
84
|
+
[key in (keyof T)]?: IOpenapiOptions;
|
|
85
85
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TypeTableCellRenderComponentProvider } from './rest.ts';
|
|
2
|
+
export interface ITableProviderComponents {
|
|
3
|
+
actionView?: TypeTableCellRenderComponentProvider;
|
|
4
|
+
currency?: TypeTableCellRenderComponentProvider;
|
|
5
|
+
}
|
|
6
|
+
export interface ITableProvider {
|
|
7
|
+
components?: ITableProviderComponents;
|
|
8
|
+
}
|