vona-module-a-openapi 5.1.4 → 5.1.6

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 (65) hide show
  1. package/dist/bean/bean.openapi.d.ts.map +1 -1
  2. package/dist/index.js.map +1 -1
  3. package/dist/service/openapi.d.ts.map +1 -1
  4. package/dist/types/decorator.d.ts.map +1 -1
  5. package/dist/types/formMeta.d.ts +9 -0
  6. package/dist/types/formMeta.d.ts.map +1 -0
  7. package/dist/types/index.d.ts +3 -13
  8. package/dist/types/index.d.ts.map +1 -1
  9. package/dist/types/order.d.ts +8 -0
  10. package/dist/types/order.d.ts.map +1 -0
  11. package/dist/types/permissions.d.ts +6 -6
  12. package/dist/types/permissions.d.ts.map +1 -1
  13. package/dist/types/rest.d.ts +23 -60
  14. package/dist/types/rest.d.ts.map +1 -1
  15. package/dist/types/zovaJsx.d.ts +2 -0
  16. package/dist/types/zovaJsx.d.ts.map +1 -0
  17. package/package.json +6 -5
  18. package/src/bean/bean.openapi.ts +42 -11
  19. package/src/service/openapi.ts +114 -24
  20. package/src/types/decorator.ts +4 -1
  21. package/src/types/formMeta.ts +9 -0
  22. package/src/types/index.ts +3 -13
  23. package/src/types/order.ts +9 -0
  24. package/src/types/permissions.ts +6 -6
  25. package/src/types/rest.ts +32 -87
  26. package/src/types/zovaJsx.ts +6 -0
  27. package/dist/types/actions.d.ts +0 -18
  28. package/dist/types/actions.d.ts.map +0 -1
  29. package/dist/types/behavior.d.ts +0 -11
  30. package/dist/types/behavior.d.ts.map +0 -1
  31. package/dist/types/captcha.d.ts +0 -5
  32. package/dist/types/captcha.d.ts.map +0 -1
  33. package/dist/types/component.d.ts +0 -14
  34. package/dist/types/component.d.ts.map +0 -1
  35. package/dist/types/date.d.ts +0 -5
  36. package/dist/types/date.d.ts.map +0 -1
  37. package/dist/types/formProvider.d.ts +0 -19
  38. package/dist/types/formProvider.d.ts.map +0 -1
  39. package/dist/types/openapi.d.ts +0 -7
  40. package/dist/types/openapi.d.ts.map +0 -1
  41. package/dist/types/resourceMeta.d.ts +0 -32
  42. package/dist/types/resourceMeta.d.ts.map +0 -1
  43. package/dist/types/resourcePicker.d.ts +0 -11
  44. package/dist/types/resourcePicker.d.ts.map +0 -1
  45. package/dist/types/select.d.ts +0 -16
  46. package/dist/types/select.d.ts.map +0 -1
  47. package/dist/types/tableProvider.d.ts +0 -9
  48. package/dist/types/tableProvider.d.ts.map +0 -1
  49. package/dist/types/textarea.d.ts +0 -11
  50. package/dist/types/textarea.d.ts.map +0 -1
  51. package/dist/types/toggle.d.ts +0 -4
  52. package/dist/types/toggle.d.ts.map +0 -1
  53. package/src/types/actions.ts +0 -18
  54. package/src/types/behavior.ts +0 -11
  55. package/src/types/captcha.ts +0 -5
  56. package/src/types/component.ts +0 -14
  57. package/src/types/date.ts +0 -25
  58. package/src/types/formProvider.ts +0 -21
  59. package/src/types/openapi.ts +0 -7
  60. package/src/types/resourceMeta.ts +0 -38
  61. package/src/types/resourcePicker.ts +0 -11
  62. package/src/types/select.ts +0 -16
  63. package/src/types/tableProvider.ts +0 -10
  64. package/src/types/textarea.ts +0 -10
  65. package/src/types/toggle.ts +0 -3
@@ -1,8 +1,23 @@
1
- import type { OpenAPIObject as OpenAPIObject30, SchemaObject as SchemaObject30, SecurityRequirementObject } from 'openapi3-ts/oas30';
2
- import type { OpenAPIObject as OpenAPIObject31, SchemaObject as SchemaObject31 } from 'openapi3-ts/oas31';
1
+ import type {
2
+ OpenAPIObject as OpenAPIObject30,
3
+ SchemaObject as SchemaObject30,
4
+ SecurityRequirementObject,
5
+ } from 'openapi3-ts/oas30';
6
+ import type {
7
+ OpenAPIObject as OpenAPIObject31,
8
+ SchemaObject as SchemaObject31,
9
+ } from 'openapi3-ts/oas31';
3
10
  import type { Constructable, IDecoratorBeanOptionsBase } from 'vona';
4
- import type { IOpenapiHeader, IOpenapiOptions, TypeGenerateJsonScene } from 'vona-module-a-openapiutils';
5
- import type { IDecoratorControllerOptions, RequestMappingMetadata, TypeRequestMethod } from 'vona-module-a-web';
11
+ import type {
12
+ IOpenapiHeader,
13
+ IOpenapiOptions,
14
+ TypeGenerateJsonScene,
15
+ } from 'vona-module-a-openapiutils';
16
+ import type {
17
+ IDecoratorControllerOptions,
18
+ RequestMappingMetadata,
19
+ TypeRequestMethod,
20
+ } from 'vona-module-a-web';
6
21
 
7
22
  import * as ModuleInfo from '@cabloy/module-info';
8
23
  import { isEmptyObject, isNil } from '@cabloy/utils';
@@ -12,7 +27,12 @@ import { getInnerTypeName } from '@cabloy/zod-query';
12
27
  import { OpenAPIRegistry } from '@cabloy/zod-to-openapi';
13
28
  import { appMetadata, appResource, BeanBase, cast } from 'vona';
14
29
  import { Service } from 'vona-module-a-bean';
15
- import { $schema, bodySchemaWrapperDefault, SymbolOpenApiOptions, SymbolRouteHandlersArgumentsMeta } from 'vona-module-a-openapiutils';
30
+ import {
31
+ $schema,
32
+ bodySchemaWrapperDefault,
33
+ SymbolOpenApiOptions,
34
+ SymbolRouteHandlersArgumentsMeta,
35
+ } from 'vona-module-a-openapiutils';
16
36
  import { SymbolRequestMappingHandler } from 'vona-module-a-web';
17
37
  import { z } from 'zod';
18
38
 
@@ -22,7 +42,10 @@ const __ArgumentTypes = ['param', 'query', 'body', 'headers', 'fields', 'field',
22
42
 
23
43
  @Service()
24
44
  export class ServiceOpenapi extends BeanBase {
25
- public translate(apiObj: OpenAPIObject30 | OpenAPIObject31, generateJsonScene: TypeGenerateJsonScene) {
45
+ public translate(
46
+ apiObj: OpenAPIObject30 | OpenAPIObject31,
47
+ generateJsonScene: TypeGenerateJsonScene,
48
+ ) {
26
49
  // paths
27
50
  if (apiObj.paths) {
28
51
  for (const key in apiObj.paths) {
@@ -89,7 +112,10 @@ export class ServiceOpenapi extends BeanBase {
89
112
  // items
90
113
  const items = cast<SchemaObject30 | SchemaObject31>(schema).items;
91
114
  if (items && typeof items === 'object') {
92
- cast<SchemaObject30 | SchemaObject31>(schema).items = this._translateSchema(items, generateJsonScene);
115
+ cast<SchemaObject30 | SchemaObject31>(schema).items = this._translateSchema(
116
+ items,
117
+ generateJsonScene,
118
+ );
93
119
  }
94
120
  // ok
95
121
  return schema;
@@ -140,12 +166,21 @@ export class ServiceOpenapi extends BeanBase {
140
166
  }
141
167
  // controller
142
168
  for (const controller of this.bean.onion.controller.getOnionsEnabledCached()) {
143
- this.collectController(registry, controller.beanOptions.module, controller.beanOptions.beanClass);
169
+ this.collectController(
170
+ registry,
171
+ controller.beanOptions.module,
172
+ controller.beanOptions.beanClass,
173
+ );
144
174
  }
145
175
  return registry;
146
176
  }
147
177
 
148
- public collectController(registry: OpenAPIRegistry, moduleName: string, controller: Constructable, actionKey?: string) {
178
+ public collectController(
179
+ registry: OpenAPIRegistry,
180
+ moduleName: string,
181
+ controller: Constructable,
182
+ actionKey?: string,
183
+ ) {
149
184
  // info
150
185
  const info = ModuleInfo.parseInfo(moduleName)!;
151
186
  // controller options
@@ -154,7 +189,10 @@ export class ServiceOpenapi extends BeanBase {
154
189
  const controllerBeanFullName = beanOptions.beanFullName;
155
190
  const controllerOptions = beanOptions.options as IDecoratorControllerOptions;
156
191
  const controllerPath = controllerOptions.path;
157
- const controllerOpenApiOptions = appMetadata.getMetadata<IOpenapiOptions>(SymbolOpenApiOptions, controller);
192
+ const controllerOpenApiOptions = appMetadata.getMetadata<IOpenapiOptions>(
193
+ SymbolOpenApiOptions,
194
+ controller,
195
+ );
158
196
  if (controllerOpenApiOptions?.exclude) return;
159
197
  // descs
160
198
  const descs = Object.getOwnPropertyDescriptors(controller.prototype);
@@ -192,30 +230,50 @@ export class ServiceOpenapi extends BeanBase {
192
230
  const app = this.app;
193
231
 
194
232
  // action options: should not extend controllerOpenApiOptions
195
- const actionOpenApiOptions = appMetadata.getMetadata<IOpenapiOptions>(SymbolOpenApiOptions, controller.prototype, actionKey);
233
+ const actionOpenApiOptions = appMetadata.getMetadata<IOpenapiOptions>(
234
+ SymbolOpenApiOptions,
235
+ controller.prototype,
236
+ actionKey,
237
+ );
196
238
  if (actionOpenApiOptions?.exclude) return;
197
239
 
198
240
  // actionPath/actionMethod
199
- if (!appMetadata.hasMetadata(SymbolRequestMappingHandler, controller.prototype, actionKey)) return;
200
- const handlerMetadata = appMetadata.getMetadata<RequestMappingMetadata>(SymbolRequestMappingHandler, controller.prototype, actionKey)!;
241
+ if (!appMetadata.hasMetadata(SymbolRequestMappingHandler, controller.prototype, actionKey))
242
+ return;
243
+ const handlerMetadata = appMetadata.getMetadata<RequestMappingMetadata>(
244
+ SymbolRequestMappingHandler,
245
+ controller.prototype,
246
+ actionKey,
247
+ )!;
201
248
  const actionPath: string = handlerMetadata.path || '';
202
249
  const actionMethod: TypeRequestMethod = handlerMetadata.method || 'get';
203
250
 
204
251
  // routePath
205
- const routePath = app.util.combineApiPathControllerAndAction(info.relativeName, controllerPath, actionPath, true, true);
252
+ const routePath = app.util.combineApiPathControllerAndAction(
253
+ info.relativeName,
254
+ controllerPath,
255
+ actionPath,
256
+ true,
257
+ true,
258
+ );
206
259
  // :id -> {id}
207
260
  const routePath2 = routePath.replace(/:([^/]+)/g, '{$1}');
208
261
 
209
262
  // tags
210
263
  let tags: string[] | undefined = actionOpenApiOptions?.tags ?? controllerOpenApiOptions?.tags;
211
264
  if (!tags || tags.length === 0) {
212
- tags = [toUpperCaseFirstChar(this.app.util.combineResourceName(beanOptions.name, info.relativeName, true, true))];
265
+ tags = [
266
+ toUpperCaseFirstChar(
267
+ this.app.util.combineResourceName(beanOptions.name, info.relativeName, true, true),
268
+ ),
269
+ ];
213
270
  }
214
271
  // operationId
215
272
  let operationId = actionOpenApiOptions?.operationId ?? actionKey;
216
273
  operationId = `${tags[0]}_${operationId}`;
217
274
  // security
218
- const _public: boolean | undefined = actionOpenApiOptions?.public ?? controllerOpenApiOptions?.public;
275
+ const _public: boolean | undefined =
276
+ actionOpenApiOptions?.public ?? controllerOpenApiOptions?.public;
219
277
  let security: SecurityRequirementObject[] | undefined;
220
278
  if (!_public) {
221
279
  security = [
@@ -233,7 +291,13 @@ export class ServiceOpenapi extends BeanBase {
233
291
  security,
234
292
  description: actionOpenApiOptions?.description as string,
235
293
  summary: actionOpenApiOptions?.summary as string,
236
- request: this._collectRequest(info, controller, actionKey, actionOpenApiOptions, controllerOpenApiOptions),
294
+ request: this._collectRequest(
295
+ info,
296
+ controller,
297
+ actionKey,
298
+ actionOpenApiOptions,
299
+ controllerOpenApiOptions,
300
+ ),
237
301
  responses: this._collectResponses(controller, actionKey, actionOpenApiOptions),
238
302
  });
239
303
  }
@@ -246,7 +310,12 @@ export class ServiceOpenapi extends BeanBase {
246
310
  controllerOpenApiOptions: IOpenapiOptions | undefined,
247
311
  ) {
248
312
  // meta
249
- const argsMeta = this._prepareArgsMeta(controller, actionKey, actionOpenApiOptions, controllerOpenApiOptions);
313
+ const argsMeta = this._prepareArgsMeta(
314
+ controller,
315
+ actionKey,
316
+ actionOpenApiOptions,
317
+ controllerOpenApiOptions,
318
+ );
250
319
  if (!argsMeta) return;
251
320
  // args
252
321
  const argsMapWithField: any = {};
@@ -302,7 +371,9 @@ export class ServiceOpenapi extends BeanBase {
302
371
  if (!schema) continue;
303
372
  // check schema
304
373
  if (getInnerTypeName(schema) === 'any') {
305
- throw new Error(`Invalid Openapi argument type: ${info.relativeName}:${controller.name}.${actionKey}#${argumentType}`);
374
+ throw new Error(
375
+ `Invalid Openapi argument type: ${info.relativeName}:${controller.name}.${actionKey}#${argumentType}`,
376
+ );
306
377
  }
307
378
  // record
308
379
  if (argumentType === 'body') {
@@ -326,11 +397,20 @@ export class ServiceOpenapi extends BeanBase {
326
397
  return request;
327
398
  }
328
399
 
329
- private _collectResponses(controller: Constructable, actionKey: string, actionOpenApiOptions: IOpenapiOptions | undefined) {
400
+ private _collectResponses(
401
+ controller: Constructable,
402
+ actionKey: string,
403
+ actionOpenApiOptions: IOpenapiOptions | undefined,
404
+ ) {
330
405
  // contentType
331
406
  const contentType = actionOpenApiOptions?.contentType || 'application/json';
332
407
  // body schema
333
- const bodySchema = this._parseBodySchema(controller, actionKey, actionOpenApiOptions, contentType);
408
+ const bodySchema = this._parseBodySchema(
409
+ controller,
410
+ actionKey,
411
+ actionOpenApiOptions,
412
+ contentType,
413
+ );
334
414
  // response
335
415
  const response = {
336
416
  description: '',
@@ -345,7 +425,12 @@ export class ServiceOpenapi extends BeanBase {
345
425
  return responses;
346
426
  }
347
427
 
348
- private _parseBodySchema(controller: Constructable, actionKey: string, actionOpenApiOptions: IOpenapiOptions | undefined, contentType: string) {
428
+ private _parseBodySchema(
429
+ controller: Constructable,
430
+ actionKey: string,
431
+ actionOpenApiOptions: IOpenapiOptions | undefined,
432
+ contentType: string,
433
+ ) {
349
434
  // bodySchema
350
435
  let bodySchema: z.ZodType;
351
436
  if (actionOpenApiOptions?.bodySchema) {
@@ -368,7 +453,11 @@ export class ServiceOpenapi extends BeanBase {
368
453
  controllerOpenApiOptions: IOpenapiOptions | undefined,
369
454
  ) {
370
455
  // meta
371
- let argsMeta = appMetadata.getMetadata<RouteHandlerArgumentMetaDecorator[]>(SymbolRouteHandlersArgumentsMeta, controller.prototype, actionKey);
456
+ let argsMeta = appMetadata.getMetadata<RouteHandlerArgumentMetaDecorator[]>(
457
+ SymbolRouteHandlersArgumentsMeta,
458
+ controller.prototype,
459
+ actionKey,
460
+ );
372
461
  // headers
373
462
  const objHeaders = Object.assign(
374
463
  {} as any,
@@ -383,7 +472,8 @@ export class ServiceOpenapi extends BeanBase {
383
472
  argHeaders = { type: 'headers', field: undefined, schema: z.object(objHeaders) } as any;
384
473
  argsMeta.push(argHeaders!);
385
474
  } else {
386
- if (!(argHeaders.schema as any).extend) throw new Error(`headers schema is not valid: ${actionKey}`);
475
+ if (!(argHeaders.schema as any).extend)
476
+ throw new Error(`headers schema is not valid: ${actionKey}`);
387
477
  argHeaders.schema = (argHeaders.schema as any).extend(objHeaders);
388
478
  }
389
479
  return argsMeta;
@@ -42,4 +42,7 @@ export type RouteHandlerArgumentType =
42
42
  | 'string'
43
43
  | 'user';
44
44
 
45
- export type TypeExtractValue = (ctx: VonaContext, argMeta: RouteHandlerArgumentMetaDecorator) => Promise<any>;
45
+ export type TypeExtractValue = (
46
+ ctx: VonaContext,
47
+ argMeta: RouteHandlerArgumentMetaDecorator,
48
+ ) => Promise<any>;
@@ -0,0 +1,9 @@
1
+ export type TypeFormMode = 'view' | 'edit';
2
+ export type TypeEditMode = 'create' | 'update';
3
+ export type TypeFormScene = 'view' | 'create' | 'edit';
4
+
5
+ export interface IFormMeta {
6
+ formMode: TypeFormMode;
7
+ editMode?: TypeEditMode;
8
+ formScene?: TypeFormScene;
9
+ }
@@ -1,20 +1,10 @@
1
1
  import '@cabloy/zod-query';
2
2
 
3
- export * from './actions.ts';
4
- export * from './behavior.ts';
5
- export * from './captcha.ts';
6
- export * from './component.ts';
7
- export * from './date.ts';
8
3
  export * from './decorator.ts';
9
- export * from './formProvider.ts';
10
- export * from './openapi.ts';
11
4
  export * from './permissions.ts';
12
5
  export * from './resource.ts';
13
- export * from './resourceMeta.ts';
14
- export * from './resourcePicker.ts';
15
6
  export * from './rest.ts';
16
- export * from './select.ts';
17
7
  export * from './table.ts';
18
- export * from './tableProvider.ts';
19
- export * from './textarea.ts';
20
- export * from './toggle.ts';
8
+ export * from './formMeta.ts';
9
+ export * from './zovaJsx.ts';
10
+ export * from './order.ts';
@@ -0,0 +1,9 @@
1
+ import type { TypeSchemaScene } from './rest.ts';
2
+
3
+ export type TypeSchemaOrderLevel = 'core' | 'business' | 'max';
4
+
5
+ export interface ISchemaOrderParams {
6
+ order: number;
7
+ level?: TypeSchemaOrderLevel;
8
+ scene?: TypeSchemaScene;
9
+ }
@@ -1,14 +1,14 @@
1
1
  import type { IRoleIdRecord, IRoleNameRecord } from 'vona-module-a-user';
2
2
 
3
- export interface IOpenapiActionRecord {
4
- create: boolean;
5
- view: boolean;
6
- update: boolean;
7
- delete: boolean;
3
+ export interface IResourceTableActionRecord {
4
+ create: never;
5
+ view: never;
6
+ update: never;
7
+ delete: never;
8
8
  }
9
9
 
10
10
  export type IOpenapiPermissionModeActionActions = {
11
- [K in keyof IOpenapiActionRecord]?: IOpenapiActionRecord[K];
11
+ [K in keyof IResourceTableActionRecord]?: boolean; // IResourceTableActionRecord[K];
12
12
  };
13
13
 
14
14
  export interface IOpenapiPermissions {
package/src/types/rest.ts CHANGED
@@ -1,79 +1,52 @@
1
- import type { ZodOpenAPIMetadata } from '@cabloy/zod-to-openapi';
2
- import type { CurrencyOptions } from '@zhennann/currency';
3
- import type { ILocaleMagic } from 'vona';
4
- import type { IOpenapiOptions } from 'vona-module-a-openapiutils';
5
- import type { z } from 'zod';
1
+ import type { OpenApiOptions } from '@cabloy/zod-to-openapi/dist/zod-extensions.js';
2
+ import type { SchemaObject } from 'openapi3-ts/oas31';
6
3
 
7
- import type { TypeResourceActionRowRecordRender } from './actions.ts';
8
- import type { ICaptchaOptions } from './captcha.ts';
9
- import type { IComponentRecord, ITableCellComponentRecord } from './component.ts';
10
- import type { TypeDateFormat } from './date.ts';
11
- import type { IResourcePickerOptions } from './resourcePicker.ts';
12
- import type { ISelectOptions } from './select.ts';
13
- import type { ITextareaOptions } from './textarea.ts';
14
- import type { IToggleOptions } from './toggle.ts';
15
4
  import 'openapi3-ts/oas30';
16
5
  import 'openapi3-ts/oas31';
17
-
18
- export type HTMLInputElementType = 'text' | 'password' | 'number' | 'file' | 'hidden' | 'tel' | 'email';
19
-
20
- export type TypeFormFieldOnSetDisplayValue = (value: any) => any;
21
- export type TypeFormFieldDisplayValueUpdateTiming = 'input' | 'change';
6
+ import type { ILocaleMagic } from 'vona';
7
+ import type { IOpenapiOptions } from 'vona-module-a-openapiutils';
8
+ import type { core, z } from 'zod';
22
9
 
23
10
  export interface ISchemaObjectExtensionFieldRestProps {
24
- customKey?: string;
11
+ //
12
+ fieldSource?: string;
25
13
  visible?: boolean;
26
14
  order?: number;
27
- //
28
- classContainer?: any;
29
- label?: string | false;
30
- inline?: boolean;
31
- bordered?: boolean;
32
- floating?: boolean;
33
- iconPrefix?: string;
34
- iconSuffix?: string;
35
- header?: TypeRenderComponentJsx | string;
36
- footer?: TypeRenderComponentJsx | string;
37
- //
38
- displayValue?: any;
39
- displayValueUpdateTiming?: TypeFormFieldDisplayValueUpdateTiming;
40
- onSetDisplayValue?: TypeFormFieldOnSetDisplayValue;
41
15
  disableNotifyChanged?: boolean;
42
- class?: any;
43
- placeholder?: string;
44
16
  readonly?: boolean;
45
- inputType?: HTMLInputElementType;
46
- //
47
- captcha?: ICaptchaOptions;
48
- currency?: CurrencyOptions;
49
- dateFormat?: TypeDateFormat;
50
- toggle?: IToggleOptions;
51
- select?: ISelectOptions;
52
- textarea?: ITextareaOptions;
53
- resourcePicker?: IResourcePickerOptions;
54
17
  }
55
18
 
56
19
  export interface ISchemaObjectExtensionFieldRest extends ISchemaObjectExtensionFieldRestProps {
57
- render?: TypeRenderComponentPreset;
58
- table?: ISchemaObjectExtensionFieldRestScene;
59
- form?: ISchemaObjectExtensionFieldRestScene;
60
- filter?: ISchemaObjectExtensionFieldRestScene;
20
+ 'render'?: TypeRenderComponent;
21
+ 'table'?: ISchemaObjectExtensionFieldRestScene;
22
+ 'form'?: ISchemaObjectExtensionFieldRestScene;
23
+ 'form-view'?: ISchemaObjectExtensionFieldRestScene;
24
+ 'form-create'?: ISchemaObjectExtensionFieldRestScene;
25
+ 'filter'?: ISchemaObjectExtensionFieldRestScene;
61
26
  }
62
27
 
63
28
  export interface ISchemaObjectExtensionFieldRestScene extends ISchemaObjectExtensionFieldRestProps {
64
29
  render?: TypeRenderComponent;
65
30
  }
66
31
 
67
- export interface ISchemaObjectExtensionField {
32
+ export interface ISchemaObjectExtensionField extends Omit<SchemaObject, 'title' | 'description'> {
68
33
  rest?: ISchemaObjectExtensionFieldRest;
34
+ title?: string | ILocaleMagic;
35
+ description?: string | ILocaleMagic;
69
36
  }
70
37
 
71
- declare module 'openapi3-ts/oas30' {
72
- export interface SchemaObject extends ISchemaObjectExtensionField {}
73
- }
74
-
75
- declare module 'openapi3-ts/oas31' {
76
- export interface SchemaObject extends ISchemaObjectExtensionField {}
38
+ declare module 'zod' {
39
+ interface ZodType<
40
+ out Output = unknown,
41
+ out Input = unknown,
42
+ out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<
43
+ Output,
44
+ Input
45
+ >,
46
+ > extends core.$ZodType<Output, Input, Internals> {
47
+ openapi(metadata: ISchemaObjectExtensionField, options?: OpenApiOptions): this;
48
+ openapi(refId: string, metadata?: ISchemaObjectExtensionField, options?: OpenApiOptions): this;
49
+ }
77
50
  }
78
51
 
79
52
  export interface TypeRenderComponentJsxProps {
@@ -91,41 +64,13 @@ export interface TypeRenderComponentJsx {
91
64
  props?: TypeRenderComponentJsxProps;
92
65
  }
93
66
 
94
- export type TypeSchemaScene = 'table' | 'form' | 'filter';
95
-
96
- export type TypeRenderComponentPreset =
97
- | keyof TypeResourceActionRowRecordRender
98
- | 'text'
99
- | 'captcha'
100
- | 'currency'
101
- | 'date'
102
- | 'dateRange'
103
- | 'textarea'
104
- | 'select'
105
- | 'checkbox'
106
- | 'radio'
107
- | 'switch'
108
- | 'image'
109
- | 'file'
110
- | 'color'
111
- | 'password'
112
- | 'email'
113
- | 'url';
114
- export type TypeRenderComponent = TypeRenderComponentPreset | TypeRenderComponentJsx;
67
+ export type TypeSchemaScene = 'table' | TypeFormSchemaScene;
68
+ export type TypeFormSchemaScene = 'form' | 'form-view' | 'form-create' | 'filter';
115
69
 
116
- // form
117
- export type TypeFormFieldRenderComponentProvider = keyof IComponentRecord | 'input' | 'textarea' | 'select';
118
-
119
- // table
120
- export type TypeTableCellRenderComponentProvider = keyof IComponentRecord | keyof ITableCellComponentRecord | 'text';
121
-
122
- export type TypeOpenapiMetadata<T extends z.ZodType = z.ZodType> = Omit<Partial<ZodOpenAPIMetadata<z.input<T>>>, 'title' | 'description'> & {
123
- title?: string | ILocaleMagic;
124
- description?: string | ILocaleMagic;
125
- };
70
+ export type TypeRenderComponent = TypeRenderComponentJsx | string;
126
71
 
127
72
  export type TypeEntityOptionsFields<T extends {}, More extends string | undefined = never> = {
128
- [key in keyof T | (More extends string ? More : never)]?: TypeOpenapiMetadata | z.ZodType;
73
+ [key in keyof T | (More extends string ? More : never)]?: ISchemaObjectExtensionField | z.ZodType;
129
74
  };
130
75
 
131
76
  export type TypeControllerOptionsActions<T extends {}> = {
@@ -0,0 +1,6 @@
1
+ export type ZovaJsxComponentType =
2
+ | 'zova-jsx:event'
3
+ | 'zova-jsx:component'
4
+ | 'zova-jsx:block'
5
+ | 'zova-jsx:actionBulk'
6
+ | 'zova-jsx:actionRow';
@@ -1,18 +0,0 @@
1
- export interface IResourceActionTableOptions {
2
- }
3
- export interface IResourceActionRowOptions {
4
- }
5
- export interface TypeResourceActionTableRecord {
6
- create: IResourceActionTableOptions;
7
- operationsTable: IResourceActionTableOptions;
8
- }
9
- export interface TypeResourceActionRowRecord {
10
- view: IResourceActionRowOptions;
11
- update: IResourceActionRowOptions;
12
- delete: IResourceActionRowOptions;
13
- operationsRow: IResourceActionRowOptions;
14
- }
15
- export type TypeResourceActionRowRecordRender = {
16
- [key in keyof TypeResourceActionRowRecord as `action${Capitalize<key>}`]: TypeResourceActionRowRecord[key];
17
- };
18
- //# sourceMappingURL=actions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/types/actions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,2BAA2B;CAAG;AAC/C,MAAM,WAAW,yBAAyB;CAAG;AAE7C,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,2BAA2B,CAAC;IACpC,eAAe,EAAE,2BAA2B,CAAC;CAC9C;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,yBAAyB,CAAC;IAChC,MAAM,EAAE,yBAAyB,CAAC;IAClC,MAAM,EAAE,yBAAyB,CAAC;IAClC,aAAa,EAAE,yBAAyB,CAAC;CAC1C;AAED,MAAM,MAAM,iCAAiC,GAAG;KAC7C,GAAG,IAAI,MAAM,2BAA2B,IAAI,SAAS,UAAU,CAAC,GAAG,CAAC,EAAE,GAAG,2BAA2B,CAAC,GAAG,CAAC;CAC3G,CAAC"}
@@ -1,11 +0,0 @@
1
- export interface IBehaviorRecord {
2
- }
3
- export type TypeBehaviorRecordSelector<PREFIX extends string> = {
4
- [K in keyof IBehaviorRecord as K extends `${string}:${PREFIX}${string}` ? K : never]: IBehaviorRecord[K];
5
- };
6
- export type TypeBehaviorRecordSelectorKeys<PREFIX extends string> = keyof TypeBehaviorRecordSelector<PREFIX>;
7
- export type TypeBehaviorRecordSelectorStrict<PREFIX extends string> = {
8
- [K in keyof IBehaviorRecord as K extends `${string}:${PREFIX}` ? K : never]: IBehaviorRecord[K];
9
- };
10
- export type TypeBehaviorRecordSelectorKeysStrict<PREFIX extends string> = keyof TypeBehaviorRecordSelectorStrict<PREFIX>;
11
- //# sourceMappingURL=behavior.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"behavior.d.ts","sourceRoot":"","sources":["../../src/types/behavior.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AAEnC,MAAM,MAAM,0BAA0B,CAAC,MAAM,SAAS,MAAM,IAAI;KAC7D,CAAC,IAAI,MAAM,eAAe,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK,GAAG,eAAe,CAAC,CAAC,CAAC;CACzG,CAAC;AACF,MAAM,MAAM,8BAA8B,CAAC,MAAM,SAAS,MAAM,IAAI,MAAM,0BAA0B,CAAC,MAAM,CAAC,CAAC;AAE7G,MAAM,MAAM,gCAAgC,CAAC,MAAM,SAAS,MAAM,IAAI;KACnE,CAAC,IAAI,MAAM,eAAe,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK,GAAG,eAAe,CAAC,CAAC,CAAC;CAChG,CAAC;AACF,MAAM,MAAM,oCAAoC,CAAC,MAAM,SAAS,MAAM,IAAI,MAAM,gCAAgC,CAAC,MAAM,CAAC,CAAC"}
@@ -1,5 +0,0 @@
1
- import type { ICaptchaSceneRecord } from 'vona-module-a-captcha';
2
- export interface ICaptchaOptions {
3
- scene?: keyof ICaptchaSceneRecord;
4
- }
5
- //# sourceMappingURL=captcha.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"captcha.d.ts","sourceRoot":"","sources":["../../src/types/captcha.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,mBAAmB,CAAC;CACnC"}
@@ -1,14 +0,0 @@
1
- export interface IComponentRecord {
2
- }
3
- export interface ITableCellComponentRecord {
4
- }
5
- export type TypeComponentRecordSelector<PREFIX extends string> = {
6
- [K in keyof IComponentRecord as K extends `${string}:${PREFIX}${string}` ? K : never]: IComponentRecord[K];
7
- };
8
- export type TypeComponentRecordSelectorKeys<PREFIX extends string> = keyof TypeComponentRecordSelector<PREFIX>;
9
- export type TypeComponentRecordSelectorStrict<PREFIX extends string> = {
10
- [K in keyof IComponentRecord as K extends `${string}:${PREFIX}` ? K : never]: IComponentRecord[K];
11
- };
12
- export type TypeComponentRecordSelectorKeysStrict<PREFIX extends string> = keyof TypeComponentRecordSelectorStrict<PREFIX>;
13
- export type TypeComponentLayoutRecord = TypeComponentRecordSelector<'layout'>;
14
- //# sourceMappingURL=component.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/types/component.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;CAAG;AACpC,MAAM,WAAW,yBAAyB;CAAG;AAE7C,MAAM,MAAM,2BAA2B,CAAC,MAAM,SAAS,MAAM,IAAI;KAC9D,CAAC,IAAI,MAAM,gBAAgB,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK,GAAG,gBAAgB,CAAC,CAAC,CAAC;CAC3G,CAAC;AACF,MAAM,MAAM,+BAA+B,CAAC,MAAM,SAAS,MAAM,IAAI,MAAM,2BAA2B,CAAC,MAAM,CAAC,CAAC;AAE/G,MAAM,MAAM,iCAAiC,CAAC,MAAM,SAAS,MAAM,IAAI;KACpE,CAAC,IAAI,MAAM,gBAAgB,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK,GAAG,gBAAgB,CAAC,CAAC,CAAC;CAClG,CAAC;AACF,MAAM,MAAM,qCAAqC,CAAC,MAAM,SAAS,MAAM,IAAI,MAAM,iCAAiC,CAAC,MAAM,CAAC,CAAC;AAE3H,MAAM,MAAM,yBAAyB,GAAG,2BAA2B,CAAC,QAAQ,CAAC,CAAC"}
@@ -1,5 +0,0 @@
1
- export type TypeDateFormatPreset = 'DATE_SHORT' | 'DATE_MED' | 'DATE_MED_WITH_WEEKDAY' | 'DATE_FULL' | 'DATE_HUGE' | 'TIME_SIMPLE' | 'TIME_WITH_SECONDS' | 'TIME_WITH_SHORT_OFFSET' | 'TIME_WITH_LONG_OFFSET' | 'TIME_24_SIMPLE' | 'TIME_24_WITH_SECONDS' | 'TIME_24_WITH_SHORT_OFFSET' | 'TIME_24_WITH_LONG_OFFSET' | 'DATETIME_SHORT' | 'DATETIME_MED' | 'DATETIME_MED_WITH_WEEKDAY' | 'DATETIME_FULL' | 'DATETIME_HUGE' | 'DATETIME_SHORT_WITH_SECONDS' | 'DATETIME_MED_WITH_SECONDS' | 'DATETIME_FULL_WITH_SECONDS' | 'DATETIME_HUGE_WITH_SECONDS';
2
- export type TypeDateFormat = {
3
- preset: TypeDateFormatPreset;
4
- } | string;
5
- //# sourceMappingURL=date.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/types/date.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAC5B,YAAY,GACZ,UAAU,GACV,uBAAuB,GACvB,WAAW,GACX,WAAW,GACX,aAAa,GACb,mBAAmB,GACnB,wBAAwB,GACxB,uBAAuB,GACvB,gBAAgB,GAChB,sBAAsB,GACtB,2BAA2B,GAC3B,0BAA0B,GAC1B,gBAAgB,GAChB,cAAc,GACd,2BAA2B,GAC3B,eAAe,GACf,eAAe,GACf,6BAA6B,GAC7B,2BAA2B,GAC3B,4BAA4B,GAC5B,4BAA4B,CAAC;AAEjC,MAAM,MAAM,cAAc,GAAG;IAAE,MAAM,EAAE,oBAAoB,CAAA;CAAE,GAAG,MAAM,CAAC"}
@@ -1,19 +0,0 @@
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
- }
19
- //# sourceMappingURL=formProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formProvider.d.ts","sourceRoot":"","sources":["../../src/types/formProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,oCAAoC,EAAE,MAAM,eAAe,CAAC;AAC1G,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,WAAW,CAAC;AAEtE,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,oCAAoC,CAAC,WAAW,CAAC,CAAC;IAC9D,cAAc,CAAC,EAAE,8BAA8B,CAAC,gBAAgB,CAAC,CAAC;IAClE,eAAe,CAAC,EAAE,8BAA8B,CAAC,iBAAiB,CAAC,CAAC;CACrE;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,EAAE,qCAAqC,CAAC,WAAW,CAAC,CAAC;IAC/D,IAAI,CAAC,EAAE,oCAAoC,CAAC;IAC5C,QAAQ,CAAC,EAAE,oCAAoC,CAAC;IAChD,QAAQ,CAAC,EAAE,oCAAoC,CAAC;CACjD;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,SAAS,CAAC,EAAE,sBAAsB,CAAC;CACpC"}
@@ -1,7 +0,0 @@
1
- import type { IOpenapiOptionsResourceMeta } from './resourceMeta.ts';
2
- declare module 'vona-module-a-openapiutils' {
3
- interface IOpenapiOptions {
4
- resourceMeta?: IOpenapiOptionsResourceMeta;
5
- }
6
- }
7
- //# sourceMappingURL=openapi.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/types/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,QAAQ,4BAA4B,CAAC;IAC1C,UAAiB,eAAe;QAC9B,YAAY,CAAC,EAAE,2BAA2B,CAAC;KAC5C;CACF"}
@@ -1,32 +0,0 @@
1
- import type { IOpenapiPermissions, TypeComponentRecordSelectorKeysStrict, TypeRenderComponentJsx } from 'vona-module-a-openapi';
2
- import type { IFormProvider } from './formProvider.ts';
3
- import type { ITableProvider } from './tableProvider.ts';
4
- export type TypeOpenapiPermissions = IOpenapiPermissions | boolean;
5
- export interface IOpenapiOptionsResourceMeta {
6
- /**
7
- * false: disallow
8
- * true: public
9
- * undefined: by api
10
- * IOpenapiPermissions: specific
11
- */
12
- permissions?: TypeOpenapiPermissions;
13
- provider?: IOpenapiOptionsResourceMetaProvider;
14
- form?: IOpenapiOptionsResourceMetaForm;
15
- table?: IOpenapiOptionsResourceMetaTable;
16
- }
17
- export interface IOpenapiOptionsResourceMetaForm {
18
- provider?: IFormProvider;
19
- }
20
- export interface IOpenapiOptionsResourceMetaTable {
21
- provider?: ITableProvider;
22
- }
23
- export interface IOpenapiOptionsResourceMetaProvider {
24
- components?: IOpenapiOptionsResourceMetaProviderComponents;
25
- }
26
- export interface IOpenapiOptionsResourceMetaProviderComponents {
27
- restPage?: TypeComponentRecordSelectorKeysStrict<'restPage'> | TypeRenderComponentJsx;
28
- restPageEntry?: TypeComponentRecordSelectorKeysStrict<'restPageEntry'> | TypeRenderComponentJsx;
29
- table?: TypeComponentRecordSelectorKeysStrict<'table'>;
30
- form?: TypeComponentRecordSelectorKeysStrict<'form'>;
31
- }
32
- //# sourceMappingURL=resourceMeta.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resourceMeta.d.ts","sourceRoot":"","sources":["../../src/types/resourceMeta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,qCAAqC,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEhI,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,GAAG,OAAO,CAAC;AAEnE,MAAM,WAAW,2BAA2B;IAC1C;;;;;OAKG;IACH,WAAW,CAAC,EAAE,sBAAsB,CAAC;IACrC,QAAQ,CAAC,EAAE,mCAAmC,CAAC;IAC/C,IAAI,CAAC,EAAE,+BAA+B,CAAC;IACvC,KAAK,CAAC,EAAE,gCAAgC,CAAC;CAC1C;AAED,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B;AAED,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,WAAW,mCAAmC;IAClD,UAAU,CAAC,EAAE,6CAA6C,CAAC;CAC5D;AAED,MAAM,WAAW,6CAA6C;IAC5D,QAAQ,CAAC,EAAE,qCAAqC,CAAC,UAAU,CAAC,GAAG,sBAAsB,CAAC;IACtF,aAAa,CAAC,EAAE,qCAAqC,CAAC,eAAe,CAAC,GAAG,sBAAsB,CAAC;IAChG,KAAK,CAAC,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;IACvD,IAAI,CAAC,EAAE,qCAAqC,CAAC,MAAM,CAAC,CAAC;CACtD"}