@kubb/plugin-oas 3.0.0-alpha.2 → 3.0.0-alpha.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.
Files changed (101) hide show
  1. package/README.md +13 -4
  2. package/dist/OperationGenerator-CHXolL0o.d.cts +553 -0
  3. package/dist/OperationGenerator-CHXolL0o.d.ts +553 -0
  4. package/dist/Schema-Ch0dHkM5.d.ts +22 -0
  5. package/dist/Schema-ClNodlyP.d.cts +22 -0
  6. package/dist/chunk-6UWOTOZJ.cjs +92 -0
  7. package/dist/chunk-6UWOTOZJ.cjs.map +1 -0
  8. package/dist/chunk-AZKUU24F.js +700 -0
  9. package/dist/chunk-AZKUU24F.js.map +1 -0
  10. package/dist/chunk-DFQJ57GH.js +45 -0
  11. package/dist/chunk-DFQJ57GH.js.map +1 -0
  12. package/dist/chunk-GF26SDHQ.js +28 -0
  13. package/dist/chunk-GF26SDHQ.js.map +1 -0
  14. package/dist/chunk-HP5WAFBU.cjs +48 -0
  15. package/dist/chunk-HP5WAFBU.cjs.map +1 -0
  16. package/dist/chunk-JNGUNN72.cjs +708 -0
  17. package/dist/chunk-JNGUNN72.cjs.map +1 -0
  18. package/dist/chunk-PADR76WZ.cjs +4 -0
  19. package/dist/chunk-PADR76WZ.cjs.map +1 -0
  20. package/dist/chunk-R47XMJ32.js +3 -0
  21. package/dist/chunk-R47XMJ32.js.map +1 -0
  22. package/dist/{chunk-Y4V7HHX7.js → chunk-THGCWF2O.js} +8 -13
  23. package/dist/{chunk-Y4V7HHX7.js.map → chunk-THGCWF2O.js.map} +1 -1
  24. package/dist/chunk-TRA5BTWI.js +88 -0
  25. package/dist/chunk-TRA5BTWI.js.map +1 -0
  26. package/dist/chunk-UO57DZPV.cjs +36 -0
  27. package/dist/chunk-UO57DZPV.cjs.map +1 -0
  28. package/dist/chunk-ZWHQ54JM.cjs +32 -0
  29. package/dist/chunk-ZWHQ54JM.cjs.map +1 -0
  30. package/dist/components.cjs +20 -17
  31. package/dist/components.cjs.map +1 -1
  32. package/dist/components.d.cts +12 -8
  33. package/dist/components.d.ts +12 -8
  34. package/dist/components.js +3 -17
  35. package/dist/components.js.map +1 -1
  36. package/dist/generators.cjs +14 -0
  37. package/dist/generators.cjs.map +1 -0
  38. package/dist/generators.d.cts +10 -0
  39. package/dist/generators.d.ts +10 -0
  40. package/dist/generators.js +5 -0
  41. package/dist/generators.js.map +1 -0
  42. package/dist/hooks.cjs +101 -57
  43. package/dist/hooks.cjs.map +1 -1
  44. package/dist/hooks.d.cts +40 -8
  45. package/dist/hooks.d.ts +40 -8
  46. package/dist/hooks.js +90 -53
  47. package/dist/hooks.js.map +1 -1
  48. package/dist/index.cjs +283 -261
  49. package/dist/index.cjs.map +1 -1
  50. package/dist/index.d.cts +6 -77
  51. package/dist/index.d.ts +6 -77
  52. package/dist/index.js +235 -240
  53. package/dist/index.js.map +1 -1
  54. package/dist/utils.cjs +32 -87
  55. package/dist/utils.cjs.map +1 -1
  56. package/dist/utils.d.cts +7 -41
  57. package/dist/utils.d.ts +7 -41
  58. package/dist/utils.js +8 -86
  59. package/dist/utils.js.map +1 -1
  60. package/package.json +20 -14
  61. package/src/OperationGenerator.ts +75 -43
  62. package/src/SchemaGenerator.ts +44 -18
  63. package/src/SchemaMapper.ts +1 -1
  64. package/src/components/Oas.tsx +9 -3
  65. package/src/components/Operation.tsx +1 -1
  66. package/src/components/Schema.tsx +2 -102
  67. package/src/generator.tsx +133 -0
  68. package/src/generators/index.ts +1 -0
  69. package/src/generators/jsonGenerator.ts +32 -0
  70. package/src/hooks/index.ts +2 -0
  71. package/src/hooks/useOperationManager.ts +76 -28
  72. package/src/hooks/useSchemaManager.ts +77 -0
  73. package/src/index.ts +3 -9
  74. package/src/plugin.ts +64 -47
  75. package/src/types.ts +23 -12
  76. package/src/utils/getParams.ts +2 -2
  77. package/src/utils/index.ts +2 -2
  78. package/dist/OperationGenerator-CeM_9pxW.d.cts +0 -60
  79. package/dist/OperationGenerator-DhUhvRJE.d.ts +0 -60
  80. package/dist/Schema-DefwBJMc.d.ts +0 -35
  81. package/dist/Schema-an5hOrjZ.d.cts +0 -35
  82. package/dist/SchemaMapper-CsBQ6eEx.d.cts +0 -248
  83. package/dist/SchemaMapper-CsBQ6eEx.d.ts +0 -248
  84. package/dist/chunk-CJXRFYEF.cjs +0 -698
  85. package/dist/chunk-CJXRFYEF.cjs.map +0 -1
  86. package/dist/chunk-DRLYORTT.cjs +0 -3265
  87. package/dist/chunk-DRLYORTT.cjs.map +0 -1
  88. package/dist/chunk-K6KUETAI.js +0 -698
  89. package/dist/chunk-K6KUETAI.js.map +0 -1
  90. package/dist/chunk-LEACSHKT.js +0 -3265
  91. package/dist/chunk-LEACSHKT.js.map +0 -1
  92. package/dist/chunk-P42X362U.cjs +0 -101
  93. package/dist/chunk-P42X362U.cjs.map +0 -1
  94. package/dist/chunk-QLJIL3U5.cjs +0 -35
  95. package/dist/chunk-QLJIL3U5.cjs.map +0 -1
  96. package/dist/chunk-UB552H4J.js +0 -101
  97. package/dist/chunk-UB552H4J.js.map +0 -1
  98. package/dist/types-Dte3MA6H.d.cts +0 -143
  99. package/dist/types-Dte3MA6H.d.ts +0 -143
  100. package/src/utils/getGroupedByTagFiles.ts +0 -82
  101. package/src/utils/refSorter.ts +0 -13
@@ -1,60 +0,0 @@
1
- import { FileMetaBase, PluginFactoryOptions, Generator, PluginManager, Plugin } from '@kubb/core';
2
- import * as KubbFile from '@kubb/fs/types';
3
- import { Operation, Oas, contentType } from '@kubb/oas';
4
- import { g as OperationsByMethod, f as OperationSchemas, E as Exclude, I as Include, b as Override } from './types-Dte3MA6H.cjs';
5
-
6
- type GetOperationGeneratorOptions<T extends OperationGenerator<any, any, any>> = T extends OperationGenerator<infer Options, any, any> ? Options : never;
7
- type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
8
- type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
9
- oas: Oas;
10
- exclude: Array<Exclude> | undefined;
11
- include: Array<Include> | undefined;
12
- override: Array<Override<TOptions>> | undefined;
13
- contentType: contentType | undefined;
14
- pluginManager: PluginManager;
15
- /**
16
- * Current plugin
17
- */
18
- plugin: Plugin<TPluginOptions>;
19
- mode: KubbFile.Mode;
20
- };
21
- declare abstract class OperationGenerator<TOptions = unknown, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends Generator<TOptions, Context<TOptions, TPluginOptions>> {
22
- #private;
23
- get operationsByMethod(): OperationsByMethod;
24
- set operationsByMethod(paths: OperationsByMethod);
25
- getSchemas(operation: Operation, { forStatusCode, resolveName }?: {
26
- forStatusCode?: string | number;
27
- resolveName?: (name: string) => string;
28
- }): OperationSchemas;
29
- build(): Promise<Array<KubbFile.File<TFileMeta>>>;
30
- /**
31
- * Operation
32
- */
33
- operation(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
34
- /**
35
- * GET
36
- */
37
- get(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
38
- /**
39
- * POST
40
- */
41
- post(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
42
- /**
43
- * PATCH
44
- */
45
- patch(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
46
- /**
47
- * PUT
48
- */
49
- put(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
50
- /**
51
- * DELETE
52
- */
53
- delete(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
54
- /**
55
- * Combination of GET, POST, PATCH, PUT, DELETE
56
- */
57
- all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta>;
58
- }
59
-
60
- export { type GetOperationGeneratorOptions as G, type OperationMethodResult as O, OperationGenerator as a };
@@ -1,60 +0,0 @@
1
- import { FileMetaBase, PluginFactoryOptions, Generator, PluginManager, Plugin } from '@kubb/core';
2
- import * as KubbFile from '@kubb/fs/types';
3
- import { Operation, Oas, contentType } from '@kubb/oas';
4
- import { g as OperationsByMethod, f as OperationSchemas, E as Exclude, I as Include, b as Override } from './types-Dte3MA6H.js';
5
-
6
- type GetOperationGeneratorOptions<T extends OperationGenerator<any, any, any>> = T extends OperationGenerator<infer Options, any, any> ? Options : never;
7
- type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
8
- type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
9
- oas: Oas;
10
- exclude: Array<Exclude> | undefined;
11
- include: Array<Include> | undefined;
12
- override: Array<Override<TOptions>> | undefined;
13
- contentType: contentType | undefined;
14
- pluginManager: PluginManager;
15
- /**
16
- * Current plugin
17
- */
18
- plugin: Plugin<TPluginOptions>;
19
- mode: KubbFile.Mode;
20
- };
21
- declare abstract class OperationGenerator<TOptions = unknown, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends Generator<TOptions, Context<TOptions, TPluginOptions>> {
22
- #private;
23
- get operationsByMethod(): OperationsByMethod;
24
- set operationsByMethod(paths: OperationsByMethod);
25
- getSchemas(operation: Operation, { forStatusCode, resolveName }?: {
26
- forStatusCode?: string | number;
27
- resolveName?: (name: string) => string;
28
- }): OperationSchemas;
29
- build(): Promise<Array<KubbFile.File<TFileMeta>>>;
30
- /**
31
- * Operation
32
- */
33
- operation(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
34
- /**
35
- * GET
36
- */
37
- get(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
38
- /**
39
- * POST
40
- */
41
- post(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
42
- /**
43
- * PATCH
44
- */
45
- patch(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
46
- /**
47
- * PUT
48
- */
49
- put(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
50
- /**
51
- * DELETE
52
- */
53
- delete(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta>;
54
- /**
55
- * Combination of GET, POST, PATCH, PUT, DELETE
56
- */
57
- all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta>;
58
- }
59
-
60
- export { type GetOperationGeneratorOptions as G, type OperationMethodResult as O, OperationGenerator as a };
@@ -1,35 +0,0 @@
1
- import * as react from 'react';
2
- import { ReactNode } from 'react';
3
- import * as KubbFile from '@kubb/fs/types';
4
- import { SchemaObject } from '@kubb/oas';
5
- import { KubbNode } from '@kubb/react';
6
- import { S as Schema$1 } from './SchemaMapper-CsBQ6eEx.js';
7
-
8
- type SchemaContextProps = {
9
- name: string;
10
- schema?: SchemaObject;
11
- tree: Array<Schema$1>;
12
- };
13
- type Props = {
14
- name: string;
15
- value?: SchemaObject;
16
- tree?: Array<Schema$1>;
17
- children?: KubbNode;
18
- };
19
- declare function Schema({ name, value, tree, children }: Props): KubbNode;
20
- declare namespace Schema {
21
- var File: ({ output, isTypeOnly, children }: FileProps) => ReactNode;
22
- var Imports: ({ isTypeOnly, extName }: SchemaImportsProps) => ReactNode;
23
- var Context: react.Context<SchemaContextProps>;
24
- }
25
- type FileProps = {
26
- isTypeOnly?: boolean;
27
- output: string | undefined;
28
- children?: KubbNode;
29
- };
30
- type SchemaImportsProps = {
31
- isTypeOnly?: boolean;
32
- extName?: KubbFile.Extname;
33
- };
34
-
35
- export { Schema as S, type SchemaContextProps as a };
@@ -1,35 +0,0 @@
1
- import * as react from 'react';
2
- import { ReactNode } from 'react';
3
- import * as KubbFile from '@kubb/fs/types';
4
- import { SchemaObject } from '@kubb/oas';
5
- import { KubbNode } from '@kubb/react';
6
- import { S as Schema$1 } from './SchemaMapper-CsBQ6eEx.cjs';
7
-
8
- type SchemaContextProps = {
9
- name: string;
10
- schema?: SchemaObject;
11
- tree: Array<Schema$1>;
12
- };
13
- type Props = {
14
- name: string;
15
- value?: SchemaObject;
16
- tree?: Array<Schema$1>;
17
- children?: KubbNode;
18
- };
19
- declare function Schema({ name, value, tree, children }: Props): KubbNode;
20
- declare namespace Schema {
21
- var File: ({ output, isTypeOnly, children }: FileProps) => ReactNode;
22
- var Imports: ({ isTypeOnly, extName }: SchemaImportsProps) => ReactNode;
23
- var Context: react.Context<SchemaContextProps>;
24
- }
25
- type FileProps = {
26
- isTypeOnly?: boolean;
27
- output: string | undefined;
28
- children?: KubbNode;
29
- };
30
- type SchemaImportsProps = {
31
- isTypeOnly?: boolean;
32
- extName?: KubbFile.Extname;
33
- };
34
-
35
- export { Schema as S, type SchemaContextProps as a };
@@ -1,248 +0,0 @@
1
- import * as KubbFile from '@kubb/fs/types';
2
-
3
- type SchemaKeywordMapper = {
4
- object: {
5
- keyword: 'object';
6
- args: {
7
- properties: {
8
- [x: string]: Schema[];
9
- };
10
- additionalProperties: Schema[];
11
- strict?: boolean;
12
- };
13
- };
14
- strict: {
15
- keyword: 'strict';
16
- };
17
- url: {
18
- keyword: 'url';
19
- };
20
- readOnly: {
21
- keyword: 'readOnly';
22
- };
23
- uuid: {
24
- keyword: 'uuid';
25
- };
26
- email: {
27
- keyword: 'email';
28
- };
29
- firstName: {
30
- keyword: 'firstName';
31
- };
32
- lastName: {
33
- keyword: 'lastName';
34
- };
35
- phone: {
36
- keyword: 'phone';
37
- };
38
- password: {
39
- keyword: 'password';
40
- };
41
- date: {
42
- keyword: 'date';
43
- args: {
44
- type?: 'date' | 'string';
45
- };
46
- };
47
- time: {
48
- keyword: 'time';
49
- args: {
50
- type?: 'date' | 'string';
51
- };
52
- };
53
- datetime: {
54
- keyword: 'datetime';
55
- args: {
56
- offset?: boolean;
57
- local?: boolean;
58
- };
59
- };
60
- tuple: {
61
- keyword: 'tuple';
62
- args: {
63
- items: Schema[];
64
- min?: number;
65
- max?: number;
66
- };
67
- };
68
- array: {
69
- keyword: 'array';
70
- args: {
71
- items: Schema[];
72
- min?: number;
73
- max?: number;
74
- };
75
- };
76
- enum: {
77
- keyword: 'enum';
78
- args: {
79
- name: string;
80
- typeName: string;
81
- asConst: boolean;
82
- items: Array<{
83
- name: string | number;
84
- format: 'string' | 'number';
85
- value?: string | number;
86
- }>;
87
- };
88
- };
89
- and: {
90
- keyword: 'and';
91
- args: Schema[];
92
- };
93
- const: {
94
- keyword: 'const';
95
- args: {
96
- name: string | number;
97
- format: 'string' | 'number';
98
- value?: string | number;
99
- };
100
- };
101
- union: {
102
- keyword: 'union';
103
- args: Schema[];
104
- };
105
- ref: {
106
- keyword: 'ref';
107
- args: {
108
- name: string;
109
- path: KubbFile.OptionalPath;
110
- isTypeOnly?: boolean;
111
- };
112
- };
113
- matches: {
114
- keyword: 'matches';
115
- args?: string;
116
- };
117
- boolean: {
118
- keyword: 'boolean';
119
- };
120
- default: {
121
- keyword: 'default';
122
- args: string | number | boolean;
123
- };
124
- string: {
125
- keyword: 'string';
126
- };
127
- integer: {
128
- keyword: 'integer';
129
- };
130
- number: {
131
- keyword: 'number';
132
- };
133
- max: {
134
- keyword: 'max';
135
- args: number;
136
- };
137
- min: {
138
- keyword: 'min';
139
- args: number;
140
- };
141
- describe: {
142
- keyword: 'describe';
143
- args: string;
144
- };
145
- example: {
146
- keyword: 'example';
147
- args: string;
148
- };
149
- deprecated: {
150
- keyword: 'deprecated';
151
- };
152
- optional: {
153
- keyword: 'optional';
154
- };
155
- undefined: {
156
- keyword: 'undefined';
157
- };
158
- nullish: {
159
- keyword: 'nullish';
160
- };
161
- nullable: {
162
- keyword: 'nullable';
163
- };
164
- null: {
165
- keyword: 'null';
166
- };
167
- any: {
168
- keyword: 'any';
169
- };
170
- unknown: {
171
- keyword: 'unknown';
172
- };
173
- blob: {
174
- keyword: 'blob';
175
- };
176
- schema: {
177
- keyword: 'schema';
178
- args: {
179
- type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
180
- format?: string;
181
- };
182
- };
183
- name: {
184
- keyword: 'name';
185
- args: string;
186
- };
187
- catchall: {
188
- keyword: 'catchall';
189
- };
190
- };
191
- declare const schemaKeywords: {
192
- any: "any";
193
- strict: "strict";
194
- unknown: "unknown";
195
- number: "number";
196
- integer: "integer";
197
- string: "string";
198
- boolean: "boolean";
199
- undefined: "undefined";
200
- nullable: "nullable";
201
- null: "null";
202
- nullish: "nullish";
203
- array: "array";
204
- tuple: "tuple";
205
- enum: "enum";
206
- union: "union";
207
- datetime: "datetime";
208
- date: "date";
209
- email: "email";
210
- uuid: "uuid";
211
- url: "url";
212
- default: "default";
213
- const: "const";
214
- and: "and";
215
- describe: "describe";
216
- min: "min";
217
- max: "max";
218
- optional: "optional";
219
- readOnly: "readOnly";
220
- object: "object";
221
- ref: "ref";
222
- matches: "matches";
223
- firstName: "firstName";
224
- lastName: "lastName";
225
- password: "password";
226
- phone: "phone";
227
- blob: "blob";
228
- deprecated: "deprecated";
229
- example: "example";
230
- schema: "schema";
231
- catchall: "catchall";
232
- time: "time";
233
- name: "name";
234
- };
235
- type SchemaKeyword = keyof SchemaKeywordMapper;
236
- type SchemaMapper<T = string | null | undefined> = {
237
- [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined;
238
- };
239
- type SchemaKeywordBase<T> = {
240
- keyword: SchemaKeyword;
241
- args: T;
242
- };
243
- type Schema = {
244
- keyword: string;
245
- } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
246
- declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
247
-
248
- export { type Schema as S, type SchemaKeywordMapper as a, type SchemaKeyword as b, type SchemaKeywordBase as c, type SchemaMapper as d, isKeyword as i, schemaKeywords as s };
@@ -1,248 +0,0 @@
1
- import * as KubbFile from '@kubb/fs/types';
2
-
3
- type SchemaKeywordMapper = {
4
- object: {
5
- keyword: 'object';
6
- args: {
7
- properties: {
8
- [x: string]: Schema[];
9
- };
10
- additionalProperties: Schema[];
11
- strict?: boolean;
12
- };
13
- };
14
- strict: {
15
- keyword: 'strict';
16
- };
17
- url: {
18
- keyword: 'url';
19
- };
20
- readOnly: {
21
- keyword: 'readOnly';
22
- };
23
- uuid: {
24
- keyword: 'uuid';
25
- };
26
- email: {
27
- keyword: 'email';
28
- };
29
- firstName: {
30
- keyword: 'firstName';
31
- };
32
- lastName: {
33
- keyword: 'lastName';
34
- };
35
- phone: {
36
- keyword: 'phone';
37
- };
38
- password: {
39
- keyword: 'password';
40
- };
41
- date: {
42
- keyword: 'date';
43
- args: {
44
- type?: 'date' | 'string';
45
- };
46
- };
47
- time: {
48
- keyword: 'time';
49
- args: {
50
- type?: 'date' | 'string';
51
- };
52
- };
53
- datetime: {
54
- keyword: 'datetime';
55
- args: {
56
- offset?: boolean;
57
- local?: boolean;
58
- };
59
- };
60
- tuple: {
61
- keyword: 'tuple';
62
- args: {
63
- items: Schema[];
64
- min?: number;
65
- max?: number;
66
- };
67
- };
68
- array: {
69
- keyword: 'array';
70
- args: {
71
- items: Schema[];
72
- min?: number;
73
- max?: number;
74
- };
75
- };
76
- enum: {
77
- keyword: 'enum';
78
- args: {
79
- name: string;
80
- typeName: string;
81
- asConst: boolean;
82
- items: Array<{
83
- name: string | number;
84
- format: 'string' | 'number';
85
- value?: string | number;
86
- }>;
87
- };
88
- };
89
- and: {
90
- keyword: 'and';
91
- args: Schema[];
92
- };
93
- const: {
94
- keyword: 'const';
95
- args: {
96
- name: string | number;
97
- format: 'string' | 'number';
98
- value?: string | number;
99
- };
100
- };
101
- union: {
102
- keyword: 'union';
103
- args: Schema[];
104
- };
105
- ref: {
106
- keyword: 'ref';
107
- args: {
108
- name: string;
109
- path: KubbFile.OptionalPath;
110
- isTypeOnly?: boolean;
111
- };
112
- };
113
- matches: {
114
- keyword: 'matches';
115
- args?: string;
116
- };
117
- boolean: {
118
- keyword: 'boolean';
119
- };
120
- default: {
121
- keyword: 'default';
122
- args: string | number | boolean;
123
- };
124
- string: {
125
- keyword: 'string';
126
- };
127
- integer: {
128
- keyword: 'integer';
129
- };
130
- number: {
131
- keyword: 'number';
132
- };
133
- max: {
134
- keyword: 'max';
135
- args: number;
136
- };
137
- min: {
138
- keyword: 'min';
139
- args: number;
140
- };
141
- describe: {
142
- keyword: 'describe';
143
- args: string;
144
- };
145
- example: {
146
- keyword: 'example';
147
- args: string;
148
- };
149
- deprecated: {
150
- keyword: 'deprecated';
151
- };
152
- optional: {
153
- keyword: 'optional';
154
- };
155
- undefined: {
156
- keyword: 'undefined';
157
- };
158
- nullish: {
159
- keyword: 'nullish';
160
- };
161
- nullable: {
162
- keyword: 'nullable';
163
- };
164
- null: {
165
- keyword: 'null';
166
- };
167
- any: {
168
- keyword: 'any';
169
- };
170
- unknown: {
171
- keyword: 'unknown';
172
- };
173
- blob: {
174
- keyword: 'blob';
175
- };
176
- schema: {
177
- keyword: 'schema';
178
- args: {
179
- type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
180
- format?: string;
181
- };
182
- };
183
- name: {
184
- keyword: 'name';
185
- args: string;
186
- };
187
- catchall: {
188
- keyword: 'catchall';
189
- };
190
- };
191
- declare const schemaKeywords: {
192
- any: "any";
193
- strict: "strict";
194
- unknown: "unknown";
195
- number: "number";
196
- integer: "integer";
197
- string: "string";
198
- boolean: "boolean";
199
- undefined: "undefined";
200
- nullable: "nullable";
201
- null: "null";
202
- nullish: "nullish";
203
- array: "array";
204
- tuple: "tuple";
205
- enum: "enum";
206
- union: "union";
207
- datetime: "datetime";
208
- date: "date";
209
- email: "email";
210
- uuid: "uuid";
211
- url: "url";
212
- default: "default";
213
- const: "const";
214
- and: "and";
215
- describe: "describe";
216
- min: "min";
217
- max: "max";
218
- optional: "optional";
219
- readOnly: "readOnly";
220
- object: "object";
221
- ref: "ref";
222
- matches: "matches";
223
- firstName: "firstName";
224
- lastName: "lastName";
225
- password: "password";
226
- phone: "phone";
227
- blob: "blob";
228
- deprecated: "deprecated";
229
- example: "example";
230
- schema: "schema";
231
- catchall: "catchall";
232
- time: "time";
233
- name: "name";
234
- };
235
- type SchemaKeyword = keyof SchemaKeywordMapper;
236
- type SchemaMapper<T = string | null | undefined> = {
237
- [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined;
238
- };
239
- type SchemaKeywordBase<T> = {
240
- keyword: SchemaKeyword;
241
- args: T;
242
- };
243
- type Schema = {
244
- keyword: string;
245
- } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
246
- declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
247
-
248
- export { type Schema as S, type SchemaKeywordMapper as a, type SchemaKeyword as b, type SchemaKeywordBase as c, type SchemaMapper as d, isKeyword as i, schemaKeywords as s };