@kubb/plugin-oas 3.0.0-alpha.15 → 3.0.0-alpha.16

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 (76) hide show
  1. package/dist/{OperationGenerator-BqfyX5-8.d.cts → OperationGenerator-B5CoXmjA.d.cts} +22 -20
  2. package/dist/{OperationGenerator-BqfyX5-8.d.ts → OperationGenerator-B5CoXmjA.d.ts} +22 -20
  3. package/dist/{Schema-BgpIlA79.d.cts → Schema-BsgDay0E.d.cts} +1 -12
  4. package/dist/{Schema-ExMIJOhD.d.ts → Schema-Dvt6i_X3.d.ts} +1 -12
  5. package/dist/chunk-2QECZEUD.js +76 -0
  6. package/dist/chunk-2QECZEUD.js.map +1 -0
  7. package/dist/chunk-4OQEPWOG.js +38 -0
  8. package/dist/chunk-4OQEPWOG.js.map +1 -0
  9. package/dist/chunk-7Q5B67MW.cjs +1110 -0
  10. package/dist/chunk-7Q5B67MW.cjs.map +1 -0
  11. package/dist/chunk-7XBQZ7AX.js +1098 -0
  12. package/dist/chunk-7XBQZ7AX.js.map +1 -0
  13. package/dist/{chunk-AAIEMW6V.cjs → chunk-CQDZGAA6.cjs} +28 -798
  14. package/dist/chunk-CQDZGAA6.cjs.map +1 -0
  15. package/dist/{chunk-M3V3WMCW.js → chunk-CYF724QJ.js} +11 -773
  16. package/dist/chunk-CYF724QJ.js.map +1 -0
  17. package/dist/{chunk-PZTS5YZV.js → chunk-D2N6LDLT.js} +15 -13
  18. package/dist/chunk-D2N6LDLT.js.map +1 -0
  19. package/dist/{chunk-I3ZL3GUQ.cjs → chunk-LCPCIS3S.cjs} +19 -17
  20. package/dist/chunk-LCPCIS3S.cjs.map +1 -0
  21. package/dist/chunk-PUFCST25.cjs +84 -0
  22. package/dist/chunk-PUFCST25.cjs.map +1 -0
  23. package/dist/chunk-TYQZ2BD7.cjs +42 -0
  24. package/dist/chunk-TYQZ2BD7.cjs.map +1 -0
  25. package/dist/components.cjs +5 -6
  26. package/dist/components.d.cts +2 -2
  27. package/dist/components.d.ts +2 -2
  28. package/dist/components.js +2 -3
  29. package/dist/generators.cjs +4 -5
  30. package/dist/generators.d.cts +1 -1
  31. package/dist/generators.d.ts +1 -1
  32. package/dist/generators.js +3 -4
  33. package/dist/hooks.cjs +102 -31
  34. package/dist/hooks.cjs.map +1 -1
  35. package/dist/hooks.d.cts +39 -6
  36. package/dist/hooks.d.ts +39 -6
  37. package/dist/hooks.js +92 -20
  38. package/dist/hooks.js.map +1 -1
  39. package/dist/index.cjs +25 -410
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.d.cts +2 -2
  42. package/dist/index.d.ts +2 -2
  43. package/dist/index.js +5 -400
  44. package/dist/index.js.map +1 -1
  45. package/dist/utils.cjs +12 -12
  46. package/dist/utils.cjs.map +1 -1
  47. package/dist/utils.d.cts +2 -2
  48. package/dist/utils.d.ts +2 -2
  49. package/dist/utils.js +2 -3
  50. package/dist/utils.js.map +1 -1
  51. package/package.json +10 -10
  52. package/src/OperationGenerator.ts +11 -15
  53. package/src/SchemaGenerator.ts +14 -5
  54. package/src/components/Schema.tsx +1 -98
  55. package/src/generator.tsx +22 -14
  56. package/src/generators/jsonGenerator.ts +4 -4
  57. package/src/hooks/index.ts +2 -0
  58. package/src/hooks/useOperationManager.ts +76 -29
  59. package/src/hooks/useSchemaManager.ts +76 -0
  60. package/src/utils/getParams.ts +1 -1
  61. package/dist/chunk-2PMRS7PB.cjs +0 -8
  62. package/dist/chunk-2PMRS7PB.cjs.map +0 -1
  63. package/dist/chunk-2V64GHQ4.js +0 -32
  64. package/dist/chunk-2V64GHQ4.js.map +0 -1
  65. package/dist/chunk-4JIFKRM5.js +0 -6
  66. package/dist/chunk-4JIFKRM5.js.map +0 -1
  67. package/dist/chunk-5ULY3TQB.cjs +0 -90
  68. package/dist/chunk-5ULY3TQB.cjs.map +0 -1
  69. package/dist/chunk-AAIEMW6V.cjs.map +0 -1
  70. package/dist/chunk-CFU6KMOB.cjs +0 -38
  71. package/dist/chunk-CFU6KMOB.cjs.map +0 -1
  72. package/dist/chunk-GAPWY2CE.js +0 -84
  73. package/dist/chunk-GAPWY2CE.js.map +0 -1
  74. package/dist/chunk-I3ZL3GUQ.cjs.map +0 -1
  75. package/dist/chunk-M3V3WMCW.js.map +0 -1
  76. package/dist/chunk-PZTS5YZV.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,402 +1,7 @@
1
- import { parseFromConfig } from './chunk-2V64GHQ4.js';
2
- import { jsonGenerator } from './chunk-PZTS5YZV.js';
3
- export { createGenerator, createReactGenerator } from './chunk-PZTS5YZV.js';
4
- import './chunk-4JIFKRM5.js';
5
- import { SchemaGenerator } from './chunk-M3V3WMCW.js';
6
- export { SchemaGenerator, isKeyword, schemaKeywords } from './chunk-M3V3WMCW.js';
7
- import { init_esm_shims, getSchemas } from './chunk-GAPWY2CE.js';
8
- import { createPlugin, FileManager, BaseGenerator } from '@kubb/core';
9
- import transformers from '@kubb/core/transformers';
10
- import path from 'node:path';
11
-
12
- // src/index.ts
13
- init_esm_shims();
14
-
15
- // src/OperationGenerator.ts
16
- init_esm_shims();
17
- var OperationGenerator = class extends BaseGenerator {
18
- #operationsByMethod = {};
19
- get operationsByMethod() {
20
- return this.#operationsByMethod;
21
- }
22
- set operationsByMethod(paths) {
23
- this.#operationsByMethod = paths;
24
- }
25
- #getOptions(operation, method) {
26
- const { override = [] } = this.context;
27
- return override.find(({ pattern, type }) => {
28
- if (type === "tag") {
29
- return !!operation.getTags()[0]?.name.match(pattern);
30
- }
31
- if (type === "operationId") {
32
- return !!operation.getOperationId().match(pattern);
33
- }
34
- if (type === "path") {
35
- return !!operation.path.match(pattern);
36
- }
37
- if (type === "method") {
38
- return !!method.match(pattern);
39
- }
40
- return false;
41
- })?.options || {};
42
- }
43
- /**
44
- *
45
- * @deprecated
46
- */
47
- #isExcluded(operation, method) {
48
- const { exclude = [] } = this.context;
49
- let matched = false;
50
- exclude.forEach(({ pattern, type }) => {
51
- if (type === "tag" && !matched) {
52
- matched = !!operation.getTags()[0]?.name.match(pattern);
53
- }
54
- if (type === "operationId" && !matched) {
55
- matched = !!operation.getOperationId().match(pattern);
56
- }
57
- if (type === "path" && !matched) {
58
- matched = !!operation.path.match(pattern);
59
- }
60
- if (type === "method" && !matched) {
61
- matched = !!method.match(pattern);
62
- }
63
- });
64
- return matched;
65
- }
66
- /**
67
- *
68
- * @deprecated
69
- */
70
- #isIncluded(operation, method) {
71
- const { include = [] } = this.context;
72
- let matched = false;
73
- include.forEach(({ pattern, type }) => {
74
- if (type === "tag" && !matched) {
75
- matched = !!operation.getTags()[0]?.name.match(pattern);
76
- }
77
- if (type === "operationId" && !matched) {
78
- matched = !!operation.getOperationId().match(pattern);
79
- }
80
- if (type === "path" && !matched) {
81
- matched = !!operation.path.match(pattern);
82
- }
83
- if (type === "method" && !matched) {
84
- matched = !!method.match(pattern);
85
- }
86
- });
87
- return matched;
88
- }
89
- getSchemas(operation, {
90
- forStatusCode,
91
- resolveName = (name) => name
92
- } = {}) {
93
- const pathParamsSchema = this.context.oas.getParametersSchema(operation, "path");
94
- const queryParamsSchema = this.context.oas.getParametersSchema(operation, "query");
95
- const headerParamsSchema = this.context.oas.getParametersSchema(operation, "header");
96
- const requestSchema = this.context.oas.getRequestSchema(operation);
97
- const responseStatusCode = forStatusCode || operation.schema.responses && Object.keys(operation.schema.responses).find((key) => key.startsWith("2")) || 200;
98
- const responseSchema = this.context.oas.getResponseSchema(operation, responseStatusCode);
99
- const statusCodes = operation.getResponseStatusCodes().map((statusCode) => {
100
- let name = statusCode;
101
- if (name === "default") {
102
- name = "error";
103
- }
104
- const schema = this.context.oas.getResponseSchema(operation, statusCode);
105
- return {
106
- name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${name}`)),
107
- description: operation.getResponseByStatusCode(statusCode)?.description,
108
- schema,
109
- operation,
110
- operationName: transformers.pascalCase(`${operation.getOperationId()}`),
111
- statusCode: name === "error" ? void 0 : Number(statusCode),
112
- keys: schema?.properties ? Object.keys(schema.properties) : void 0
113
- };
114
- });
115
- return {
116
- pathParams: pathParamsSchema ? {
117
- name: resolveName(transformers.pascalCase(`${operation.getOperationId()} PathParams`)),
118
- operation,
119
- operationName: transformers.pascalCase(`${operation.getOperationId()}`),
120
- schema: pathParamsSchema,
121
- keys: pathParamsSchema.properties ? Object.keys(pathParamsSchema.properties) : void 0
122
- } : void 0,
123
- queryParams: queryParamsSchema ? {
124
- name: resolveName(transformers.pascalCase(`${operation.getOperationId()} QueryParams`)),
125
- operation,
126
- operationName: transformers.pascalCase(`${operation.getOperationId()}`),
127
- schema: queryParamsSchema,
128
- keys: queryParamsSchema.properties ? Object.keys(queryParamsSchema.properties) : []
129
- } : void 0,
130
- headerParams: headerParamsSchema ? {
131
- name: resolveName(transformers.pascalCase(`${operation.getOperationId()} HeaderParams`)),
132
- operation,
133
- operationName: transformers.pascalCase(`${operation.getOperationId()}`),
134
- schema: headerParamsSchema,
135
- keys: headerParamsSchema.properties ? Object.keys(headerParamsSchema.properties) : void 0
136
- } : void 0,
137
- request: requestSchema ? {
138
- name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${operation.method === "get" ? "queryRequest" : "mutationRequest"}`)),
139
- description: operation.schema.requestBody?.description,
140
- operation,
141
- operationName: transformers.pascalCase(`${operation.getOperationId()}`),
142
- schema: requestSchema,
143
- keys: requestSchema.properties ? Object.keys(requestSchema.properties) : void 0,
144
- keysToOmit: requestSchema.properties ? Object.keys(requestSchema.properties).filter((key) => {
145
- const item = requestSchema.properties?.[key];
146
- return item?.readOnly;
147
- }) : void 0
148
- } : void 0,
149
- response: {
150
- name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${operation.method === "get" ? "queryResponse" : "mutationResponse"}`)),
151
- description: operation.getResponseAsJSONSchema(responseStatusCode)?.at(0)?.description,
152
- operation,
153
- operationName: transformers.pascalCase(`${operation.getOperationId()}`),
154
- schema: responseSchema,
155
- statusCode: Number(responseStatusCode),
156
- keys: responseSchema?.properties ? Object.keys(responseSchema.properties) : void 0,
157
- keysToOmit: responseSchema?.properties ? Object.keys(responseSchema.properties).filter((key) => {
158
- const item = responseSchema.properties?.[key];
159
- return item?.writeOnly;
160
- }) : void 0
161
- },
162
- errors: statusCodes.filter((item) => item.statusCode?.toString().startsWith("4") || item.statusCode?.toString().startsWith("5")),
163
- statusCodes
164
- };
165
- }
166
- #methods = ["get", "post", "patch", "put", "delete"];
167
- async build(...generators) {
168
- const { oas } = this.context;
169
- const paths = oas.getPaths();
170
- this.operationsByMethod = Object.entries(paths).reduce((acc, [path2, method]) => {
171
- const methods = Object.keys(method);
172
- methods.forEach((method2) => {
173
- const operation = oas.operation(path2, method2);
174
- if (operation && [this.#methods].some((methods2) => method2 === operation.method)) {
175
- const isExcluded = this.#isExcluded(operation, method2);
176
- const isIncluded = this.context.include ? this.#isIncluded(operation, method2) : true;
177
- if (isIncluded && !isExcluded) {
178
- if (!acc[path2]) {
179
- acc[path2] = {};
180
- }
181
- acc[path2] = {
182
- ...acc[path2],
183
- [method2]: {
184
- operation,
185
- schemas: this.getSchemas(operation)
186
- }
187
- };
188
- }
189
- }
190
- });
191
- return acc;
192
- }, {});
193
- const promises = Object.keys(this.operationsByMethod).reduce((acc, path2) => {
194
- const methods = this.operationsByMethod[path2] ? Object.keys(this.operationsByMethod[path2]) : [];
195
- methods.forEach((method) => {
196
- const { operation } = this.operationsByMethod[path2]?.[method];
197
- const options = this.#getOptions(operation, method);
198
- const methodToCall = this[method];
199
- if (typeof methodToCall === "function") {
200
- const promiseMethod = methodToCall?.call(this, operation, {
201
- ...this.options,
202
- ...options
203
- });
204
- if (promiseMethod) {
205
- acc.push(promiseMethod);
206
- }
207
- }
208
- const promiseOperation = this.operation.call(this, operation, {
209
- ...this.options,
210
- ...options
211
- });
212
- if (promiseOperation) {
213
- acc.push(promiseOperation);
214
- }
215
- generators?.forEach((generator) => {
216
- const promise = generator.operation?.({
217
- instance: this,
218
- operation,
219
- options: {
220
- ...this.options,
221
- ...options
222
- }
223
- });
224
- if (promise) {
225
- acc.push(promise);
226
- }
227
- });
228
- });
229
- return acc;
230
- }, []);
231
- const operations = Object.values(this.operationsByMethod).map((item) => Object.values(item).map((item2) => item2.operation));
232
- promises.push(this.all(operations.flat().filter(Boolean), this.operationsByMethod));
233
- generators?.forEach((generator) => {
234
- const promise = generator.operations?.({
235
- instance: this,
236
- operations: operations.flat().filter(Boolean),
237
- operationsByMethod: this.operationsByMethod,
238
- options: this.options
239
- });
240
- if (promise) {
241
- promises.push(promise);
242
- }
243
- });
244
- const files = await Promise.all(promises);
245
- return files.flat().filter(Boolean);
246
- }
247
- /**
248
- * Operation
249
- */
250
- async operation(operation, options) {
251
- return [];
252
- }
253
- /**
254
- * GET
255
- */
256
- async get(operation, options) {
257
- return [];
258
- }
259
- /**
260
- * POST
261
- */
262
- async post(operation, options) {
263
- return [];
264
- }
265
- /**
266
- * PATCH
267
- */
268
- async patch(operation, options) {
269
- return [];
270
- }
271
- /**
272
- * PUT
273
- */
274
- async put(operation, options) {
275
- return [];
276
- }
277
- /**
278
- * DELETE
279
- */
280
- async delete(operation, options) {
281
- return [];
282
- }
283
- /**
284
- * Combination of GET, POST, PATCH, PUT, DELETE
285
- */
286
- async all(operations, paths) {
287
- return [];
288
- }
289
- };
290
-
291
- // src/plugin.ts
292
- init_esm_shims();
293
- var pluginOasName = "plugin-oas";
294
- var pluginOas = createPlugin((options) => {
295
- const {
296
- output = {
297
- path: "schemas",
298
- export: false,
299
- exportType: "barrelNamed"
300
- },
301
- experimentalFilter: filter,
302
- experimentalSort: sort,
303
- validate = true,
304
- generators = [jsonGenerator],
305
- serverIndex = 0,
306
- contentType,
307
- oasClass
308
- } = options;
309
- const getOas = async ({ config, logger, formatOptions }) => {
310
- try {
311
- const oas = await parseFromConfig(config, formatOptions, oasClass);
312
- if (validate) {
313
- await oas.valdiate();
314
- }
315
- return oas;
316
- } catch (e) {
317
- const error = e;
318
- logger.emit("warning", error?.message);
319
- return parseFromConfig(config, {}, oasClass);
320
- }
321
- };
322
- return {
323
- name: pluginOasName,
324
- output,
325
- options,
326
- context() {
327
- const { config, logger } = this;
328
- return {
329
- getOas(formatOptions) {
330
- return getOas({ config, logger, formatOptions });
331
- },
332
- async getSchemas({ includes } = {}) {
333
- const oas = await this.getOas();
334
- return getSchemas({ oas, contentType, includes });
335
- },
336
- async getBaseURL() {
337
- const oasInstance = await this.getOas();
338
- return oasInstance.api.servers?.at(serverIndex)?.url;
339
- },
340
- contentType
341
- };
342
- },
343
- resolvePath(baseName, pathMode, options2) {
344
- const root = path.resolve(this.config.root, this.config.output.path);
345
- const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path));
346
- if (mode === "single") {
347
- return path.resolve(root, output.path);
348
- }
349
- return path.resolve(root, output.path, baseName);
350
- },
351
- async buildStart() {
352
- if (!output) {
353
- return;
354
- }
355
- const oas = await getOas({
356
- config: this.config,
357
- logger: this.logger,
358
- formatOptions: {
359
- filterSet: filter,
360
- sortSet: sort
361
- }
362
- });
363
- await oas.dereference();
364
- const schemaGenerator = new SchemaGenerator(
365
- {
366
- unknownType: "unknown",
367
- dateType: "date",
368
- transformers: {},
369
- ...this.plugin.options
370
- },
371
- {
372
- oas,
373
- pluginManager: this.pluginManager,
374
- plugin: this.plugin,
375
- contentType,
376
- include: void 0,
377
- override: void 0,
378
- mode: "split",
379
- output: output.path
380
- }
381
- );
382
- const schemaFiles = await schemaGenerator.build(...generators);
383
- await this.addFile(...schemaFiles);
384
- const operationGenerator = new OperationGenerator(this.plugin.options, {
385
- oas,
386
- pluginManager: this.pluginManager,
387
- plugin: this.plugin,
388
- contentType,
389
- exclude: void 0,
390
- include: void 0,
391
- override: void 0,
392
- mode: "split"
393
- });
394
- const operationFiles = await operationGenerator.build(...generators);
395
- await this.addFile(...operationFiles);
396
- }
397
- };
398
- });
399
-
400
- export { OperationGenerator, pluginOas, pluginOasName };
1
+ export { OperationGenerator, SchemaGenerator, isKeyword, pluginOas, pluginOasName, schemaKeywords } from './chunk-7XBQZ7AX.js';
2
+ import './chunk-2QECZEUD.js';
3
+ export { createGenerator, createReactGenerator } from './chunk-D2N6LDLT.js';
4
+ import './chunk-CYF724QJ.js';
5
+ import './chunk-4OQEPWOG.js';
401
6
  //# sourceMappingURL=index.js.map
402
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/OperationGenerator.ts","../src/plugin.ts"],"names":["path","method","methods","item","options"],"mappings":";;;;;;;;;;;;AAAA,cAAA,EAAA,CAAA;;;ACAA,cAAA,EAAA,CAAA;AAgCa,IAAA,kBAAA,GAAN,cAIG,aAA2D,CAAA;AAAA,EACnE,sBAA0C,EAAC,CAAA;AAAA,EAC3C,IAAI,kBAAyC,GAAA;AAC3C,IAAA,OAAO,IAAK,CAAA,mBAAA,CAAA;AAAA,GACd;AAAA,EAEA,IAAI,mBAAmB,KAA2B,EAAA;AAChD,IAAA,IAAA,CAAK,mBAAsB,GAAA,KAAA,CAAA;AAAA,GAC7B;AAAA,EAEA,WAAA,CAAY,WAAsB,MAAuC,EAAA;AACvE,IAAA,MAAM,EAAE,QAAA,GAAW,EAAC,KAAM,IAAK,CAAA,OAAA,CAAA;AAE/B,IAAA,OACE,SAAS,IAAK,CAAA,CAAC,EAAE,OAAA,EAAS,MAAW,KAAA;AACnC,MAAA,IAAI,SAAS,KAAO,EAAA;AAClB,QAAO,OAAA,CAAC,CAAC,SAAU,CAAA,OAAA,GAAU,CAAC,CAAA,EAAG,IAAK,CAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AAAA,OACrD;AAEA,MAAA,IAAI,SAAS,aAAe,EAAA;AAC1B,QAAA,OAAO,CAAC,CAAC,SAAA,CAAU,cAAe,EAAA,CAAE,MAAM,OAAO,CAAA,CAAA;AAAA,OACnD;AAEA,MAAA,IAAI,SAAS,MAAQ,EAAA;AACnB,QAAA,OAAO,CAAC,CAAC,SAAU,CAAA,IAAA,CAAK,MAA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perationGenerator.ts'\nexport { OperationGenerator } from './OperationGenerator.ts'\nexport { pluginOas, pluginOasName } from './plugin.ts'\nexport type {\n GetSchemaGeneratorOptions,\n SchemaGeneratorBuildOptions,\n SchemaGeneratorOptions,\n} from './SchemaGenerator.ts'\nexport type { SchemaMethodResult } from './SchemaGenerator.ts'\nexport { SchemaGenerator } from './SchemaGenerator.ts'\nexport type {\n Schema,\n SchemaKeyword,\n SchemaKeywordBase,\n SchemaKeywordMapper,\n SchemaMapper,\n} from './SchemaMapper.ts'\nexport { isKeyword, schemaKeywords } from './SchemaMapper.ts'\nexport type * from './types.ts'\nexport { createGenerator, createReactGenerator } from './generator.tsx'\nexport type { ReactGeneratorOptions } from './generator.tsx'\nexport type { Generator, GeneratorOptions } from './generator.tsx'\n","import { BaseGenerator, type FileMetaBase } from '@kubb/core'\nimport transformers from '@kubb/core/transformers'\n\nimport type { PluginFactoryOptions, PluginManager } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\n\nimport type { Plugin } from '@kubb/core'\nimport type { HttpMethod, Oas, OasTypes, Operation, contentType } from '@kubb/oas'\nimport type { Generator } from './generator.tsx'\nimport type { Exclude, Include, OperationSchemas, OperationsByMethod, Override } from './types.ts'\n\n/**\n * @deprecated\n */\nexport type GetOperationGeneratorOptions<T extends OperationGenerator<any, any, any>> = T extends OperationGenerator<infer Options, any, any> ? Options : never\n\nexport type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>\n\ntype Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {\n oas: Oas\n exclude: Array<Exclude> | undefined\n include: Array<Include> | undefined\n override: Array<Override<TOptions>> | undefined\n contentType: contentType | undefined\n pluginManager: PluginManager\n /**\n * Current plugin\n */\n plugin: Plugin<TPluginOptions>\n mode: KubbFile.Mode\n}\n\nexport class OperationGenerator<\n TOptions = unknown,\n TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n TFileMeta extends FileMetaBase = FileMetaBase,\n> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {\n #operationsByMethod: OperationsByMethod = {}\n get operationsByMethod(): OperationsByMethod {\n return this.#operationsByMethod\n }\n\n set operationsByMethod(paths: OperationsByMethod) {\n this.#operationsByMethod = paths\n }\n\n #getOptions(operation: Operation, method: HttpMethod): Partial<TOptions> {\n const { override = [] } = this.context\n\n return (\n override.find(({ pattern, type }) => {\n if (type === 'tag') {\n return !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId') {\n return !!operation.getOperationId().match(pattern)\n }\n\n if (type === 'path') {\n return !!operation.path.match(pattern)\n }\n\n if (type === 'method') {\n return !!method.match(pattern)\n }\n\n return false\n })?.options || {}\n )\n }\n\n /**\n *\n * @deprecated\n */\n #isExcluded(operation: Operation, method: HttpMethod): boolean {\n const { exclude = [] } = this.context\n let matched = false\n\n exclude.forEach(({ pattern, type }) => {\n if (type === 'tag' && !matched) {\n matched = !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId' && !matched) {\n matched = !!operation.getOperationId().match(pattern)\n }\n\n if (type === 'path' && !matched) {\n matched = !!operation.path.match(pattern)\n }\n\n if (type === 'method' && !matched) {\n matched = !!method.match(pattern)\n }\n })\n\n return matched\n }\n\n /**\n *\n * @deprecated\n */\n #isIncluded(operation: Operation, method: HttpMethod): boolean {\n const { include = [] } = this.context\n let matched = false\n\n include.forEach(({ pattern, type }) => {\n if (type === 'tag' && !matched) {\n matched = !!operation.getTags()[0]?.name.match(pattern)\n }\n\n if (type === 'operationId' && !matched) {\n matched = !!operation.getOperationId().match(pattern)\n }\n\n if (type === 'path' && !matched) {\n matched = !!operation.path.match(pattern)\n }\n\n if (type === 'method' && !matched) {\n matched = !!method.match(pattern)\n }\n })\n\n return matched\n }\n\n getSchemas(\n operation: Operation,\n {\n forStatusCode,\n resolveName = (name) => name,\n }: {\n forStatusCode?: string | number\n resolveName?: (name: string) => string\n } = {},\n ): OperationSchemas {\n const pathParamsSchema = this.context.oas.getParametersSchema(operation, 'path')\n const queryParamsSchema = this.context.oas.getParametersSchema(operation, 'query')\n const headerParamsSchema = this.context.oas.getParametersSchema(operation, 'header')\n const requestSchema = this.context.oas.getRequestSchema(operation)\n const responseStatusCode =\n forStatusCode || (operation.schema.responses && Object.keys(operation.schema.responses).find((key) => key.startsWith('2'))) || 200\n const responseSchema = this.context.oas.getResponseSchema(operation, responseStatusCode)\n const statusCodes = operation.getResponseStatusCodes().map((statusCode) => {\n let name = statusCode\n if (name === 'default') {\n name = 'error'\n }\n\n const schema = this.context.oas.getResponseSchema(operation, statusCode)\n\n return {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${name}`)),\n description: (operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject)?.description,\n schema,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n statusCode: name === 'error' ? undefined : Number(statusCode),\n keys: schema?.properties ? Object.keys(schema.properties) : undefined,\n }\n })\n\n return {\n pathParams: pathParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} PathParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: pathParamsSchema,\n keys: pathParamsSchema.properties ? Object.keys(pathParamsSchema.properties) : undefined,\n }\n : undefined,\n queryParams: queryParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} QueryParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: queryParamsSchema,\n keys: queryParamsSchema.properties ? Object.keys(queryParamsSchema.properties) : [],\n }\n : undefined,\n headerParams: headerParamsSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} HeaderParams`)),\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: headerParamsSchema,\n keys: headerParamsSchema.properties ? Object.keys(headerParamsSchema.properties) : undefined,\n }\n : undefined,\n request: requestSchema\n ? {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${operation.method === 'get' ? 'queryRequest' : 'mutationRequest'}`)),\n description: (operation.schema.requestBody as OasTypes.RequestBodyObject)?.description,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: requestSchema,\n keys: requestSchema.properties ? Object.keys(requestSchema.properties) : undefined,\n keysToOmit: requestSchema.properties\n ? Object.keys(requestSchema.properties).filter((key) => {\n const item = requestSchema.properties?.[key] as OasTypes.SchemaObject\n\n return item?.readOnly\n })\n : undefined,\n }\n : undefined,\n response: {\n name: resolveName(transformers.pascalCase(`${operation.getOperationId()} ${operation.method === 'get' ? 'queryResponse' : 'mutationResponse'}`)),\n description: operation.getResponseAsJSONSchema(responseStatusCode)?.at(0)?.description,\n operation,\n operationName: transformers.pascalCase(`${operation.getOperationId()}`),\n schema: responseSchema,\n statusCode: Number(responseStatusCode),\n keys: responseSchema?.properties ? Object.keys(responseSchema.properties) : undefined,\n keysToOmit: responseSchema?.properties\n ? Object.keys(responseSchema.properties).filter((key) => {\n const item = responseSchema.properties?.[key] as OasTypes.SchemaObject\n return item?.writeOnly\n })\n : undefined,\n },\n errors: statusCodes.filter((item) => item.statusCode?.toString().startsWith('4') || item.statusCode?.toString().startsWith('5')),\n statusCodes,\n }\n }\n\n #methods = ['get', 'post', 'patch', 'put', 'delete']\n\n async build(...generators: Array<Generator<Extract<TOptions, PluginFactoryOptions>>>): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas } = this.context\n\n const paths = oas.getPaths()\n this.operationsByMethod = Object.entries(paths).reduce((acc, [path, method]) => {\n const methods = Object.keys(method) as HttpMethod[]\n\n methods.forEach((method) => {\n const operation = oas.operation(path, method)\n if (operation && [this.#methods].some((methods) => method === operation.method)) {\n const isExcluded = this.#isExcluded(operation, method)\n const isIncluded = this.context.include ? this.#isIncluded(operation, method) : true\n\n if (isIncluded && !isExcluded) {\n if (!acc[path]) {\n acc[path] = {} as OperationsByMethod['get']\n }\n acc[path] = {\n ...acc[path],\n [method]: {\n operation,\n schemas: this.getSchemas(operation),\n },\n } as OperationsByMethod['get']\n }\n }\n })\n\n return acc\n }, {} as OperationsByMethod)\n\n const promises = Object.keys(this.operationsByMethod).reduce((acc, path) => {\n const methods = this.operationsByMethod[path] ? (Object.keys(this.operationsByMethod[path]!) as HttpMethod[]) : []\n\n methods.forEach((method) => {\n const { operation } = this.operationsByMethod[path]?.[method]!\n const options = this.#getOptions(operation, method)\n\n const methodToCall = this[method as keyof typeof this] as any\n\n if (typeof methodToCall === 'function') {\n const promiseMethod = methodToCall?.call(this, operation, {\n ...this.options,\n ...options,\n })\n\n if (promiseMethod) {\n acc.push(promiseMethod)\n }\n }\n\n const promiseOperation = this.operation.call(this, operation, {\n ...this.options,\n ...options,\n })\n\n if (promiseOperation) {\n acc.push(promiseOperation)\n }\n\n generators?.forEach((generator) => {\n const promise = generator.operation?.({\n instance: this,\n operation,\n options: {\n ...this.options,\n ...options,\n },\n } as any) as Promise<Array<KubbFile.File<TFileMeta>>>\n\n if (promise) {\n acc.push(promise)\n }\n })\n })\n\n return acc\n }, [] as OperationMethodResult<TFileMeta>[])\n\n const operations = Object.values(this.operationsByMethod).map((item) => Object.values(item).map((item) => item.operation))\n\n promises.push(this.all(operations.flat().filter(Boolean), this.operationsByMethod))\n\n generators?.forEach((generator) => {\n const promise = generator.operations?.({\n instance: this,\n operations: operations.flat().filter(Boolean),\n operationsByMethod: this.operationsByMethod,\n options: this.options,\n } as any) as Promise<Array<KubbFile.File<TFileMeta>>>\n\n if (promise) {\n promises.push(promise)\n }\n })\n\n const files = await Promise.all(promises)\n\n // using .flat because operationGenerator[method] can return a array of files or just one file\n return files.flat().filter(Boolean)\n }\n\n /**\n * Operation\n */\n async operation(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * GET\n */\n async get(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * POST\n */\n async post(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n /**\n * PATCH\n */\n async patch(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * PUT\n */\n async put(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * DELETE\n */\n async delete(operation: Operation, options: TOptions): OperationMethodResult<TFileMeta> {\n return []\n }\n\n /**\n * Combination of GET, POST, PATCH, PUT, DELETE\n */\n async all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta> {\n return []\n }\n}\n","import { FileManager, createPlugin } from '@kubb/core'\n\nimport { getSchemas } from './utils/getSchemas.ts'\nimport { parseFromConfig } from './utils/parseFromConfig.ts'\n\nimport path from 'node:path'\nimport type { Config } from '@kubb/core'\nimport type { Logger } from '@kubb/core/logger'\nimport type { Oas } from '@kubb/oas'\nimport type { FormatOptions } from '@kubb/oas/parser'\nimport { OperationGenerator } from './OperationGenerator.ts'\nimport { SchemaGenerator } from './SchemaGenerator.ts'\nimport { jsonGenerator } from './generators'\nimport type { PluginOas } from './types.ts'\n\nexport const pluginOasName = 'plugin-oas' satisfies PluginOas['name']\n\nexport const pluginOas = createPlugin<PluginOas>((options) => {\n const {\n output = {\n path: 'schemas',\n export: false,\n exportType: 'barrelNamed',\n },\n experimentalFilter: filter,\n experimentalSort: sort,\n validate = true,\n generators = [jsonGenerator],\n serverIndex = 0,\n contentType,\n oasClass,\n } = options\n\n const getOas = async ({ config, logger, formatOptions }: { config: Config; logger: Logger; formatOptions?: FormatOptions }): Promise<Oas> => {\n try {\n // needs to be in a different variable or the catch here will not work(return of a promise instead)\n const oas = await parseFromConfig(config, formatOptions, oasClass)\n\n if (validate) {\n await oas.valdiate()\n }\n\n return oas\n } catch (e) {\n const error = e as Error\n\n logger.emit('warning', error?.message)\n return parseFromConfig(config, {}, oasClass)\n }\n }\n\n return {\n name: pluginOasName,\n output,\n options,\n context() {\n const { config, logger } = this\n\n return {\n getOas(formatOptions) {\n return getOas({ config, logger, formatOptions })\n },\n async getSchemas({ includes } = {}) {\n const oas = await this.getOas()\n return getSchemas({ oas, contentType, includes })\n },\n async getBaseURL() {\n const oasInstance = await this.getOas()\n return oasInstance.api.servers?.at(serverIndex)?.url\n },\n contentType,\n }\n },\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n async buildStart() {\n if (!output) {\n return\n }\n\n const oas = await getOas({\n config: this.config,\n logger: this.logger,\n formatOptions: {\n filterSet: filter,\n sortSet: sort,\n },\n })\n await oas.dereference()\n\n const schemaGenerator = new SchemaGenerator(\n {\n unknownType: 'unknown',\n dateType: 'date',\n transformers: {},\n ...this.plugin.options,\n },\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override: undefined,\n mode: 'split',\n output: output.path,\n },\n )\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.addFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude: undefined,\n include: undefined,\n override: undefined,\n mode: 'split',\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n\n await this.addFile(...operationFiles)\n },\n }\n})\n"]}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
package/dist/utils.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkCFU6KMOB_cjs = require('./chunk-CFU6KMOB.cjs');
4
- var chunk5ULY3TQB_cjs = require('./chunk-5ULY3TQB.cjs');
3
+ var chunkPUFCST25_cjs = require('./chunk-PUFCST25.cjs');
4
+ var chunkTYQZ2BD7_cjs = require('./chunk-TYQZ2BD7.cjs');
5
5
  var transformers = require('@kubb/core/transformers');
6
6
  var utils = require('@kubb/core/utils');
7
7
  var oas = require('@kubb/oas');
@@ -11,10 +11,10 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
11
  var transformers__default = /*#__PURE__*/_interopDefault(transformers);
12
12
 
13
13
  // src/utils/index.ts
14
- chunk5ULY3TQB_cjs.init_cjs_shims();
14
+ chunkTYQZ2BD7_cjs.init_cjs_shims();
15
15
 
16
16
  // src/utils/getComments.ts
17
- chunk5ULY3TQB_cjs.init_cjs_shims();
17
+ chunkTYQZ2BD7_cjs.init_cjs_shims();
18
18
  function getComments(operation) {
19
19
  return [
20
20
  operation.getDescription() && `@description ${operation.getDescription()}`,
@@ -25,7 +25,7 @@ function getComments(operation) {
25
25
  }
26
26
 
27
27
  // src/utils/getParams.ts
28
- chunk5ULY3TQB_cjs.init_cjs_shims();
28
+ chunkTYQZ2BD7_cjs.init_cjs_shims();
29
29
  function getASTParams(operationSchema, {
30
30
  typed = false,
31
31
  override
@@ -58,7 +58,7 @@ function getPathParams(operationSchema, options = {}) {
58
58
  }
59
59
 
60
60
  // src/utils/refSorter.ts
61
- chunk5ULY3TQB_cjs.init_cjs_shims();
61
+ chunkTYQZ2BD7_cjs.init_cjs_shims();
62
62
  function refsSorter(a, b) {
63
63
  if (Object.keys(a.import.refs)?.length < Object.keys(b.import.refs)?.length) {
64
64
  return -1;
@@ -69,17 +69,17 @@ function refsSorter(a, b) {
69
69
  return 0;
70
70
  }
71
71
 
72
- Object.defineProperty(exports, "parseFromConfig", {
73
- enumerable: true,
74
- get: function () { return chunkCFU6KMOB_cjs.parseFromConfig; }
75
- });
76
72
  Object.defineProperty(exports, "getSchemaFactory", {
77
73
  enumerable: true,
78
- get: function () { return chunk5ULY3TQB_cjs.getSchemaFactory; }
74
+ get: function () { return chunkPUFCST25_cjs.getSchemaFactory; }
79
75
  });
80
76
  Object.defineProperty(exports, "getSchemas", {
81
77
  enumerable: true,
82
- get: function () { return chunk5ULY3TQB_cjs.getSchemas; }
78
+ get: function () { return chunkPUFCST25_cjs.getSchemas; }
79
+ });
80
+ Object.defineProperty(exports, "parseFromConfig", {
81
+ enumerable: true,
82
+ get: function () { return chunkPUFCST25_cjs.parseFromConfig; }
83
83
  });
84
84
  Object.defineProperty(exports, "isOptional", {
85
85
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/index.ts","../src/utils/getComments.ts","../src/utils/getParams.ts","../src/utils/refSorter.ts"],"names":["init_cjs_shims","URLPath","transformers","isParameterObject","camelCase"],"mappings":";;;;;;;;;;;;;AAAAA,gCAAA,EAAA,CAAA;;;ACAAA,gCAAA,EAAA,CAAA;AAKO,SAAS,YAAY,SAAgC,EAAA;AAC1D,EAAO,OAAA;AAAA,IACL,UAAU,cAAe,EAAA,IAAK,CAAgB,aAAA,EAAA,SAAA,CAAU,gBAAgB,CAAA,CAAA;AAAA,IACxE,UAAU,UAAW,EAAA,IAAK,CAAY,SAAA,EAAA,SAAA,CAAU,YAAY,CAAA,CAAA;AAAA,IAC5D,SAAA,CAAU,QAAQ,CAAS,MAAA,EAAA,IAAIC,cAAQ,SAAU,CAAA,IAAI,EAAE,GAAG,CAAA,CAAA;AAAA,IAC1D,SAAA,CAAU,cAAkB,IAAA,aAAA;AAAA,GAC9B,CACG,MAAO,CAAA,OAAO,CACd,CAAA,GAAA,CAAI,CAAC,IAAS,KAAAC,6BAAA,CAAa,IAAK,CAAA,IAAI,CAAC,CAAA,CAAA;AAC1C,CAAA;;;ACdAF,gCAAA,EAAA,CAAA;AAYO,SAAS,aACd,eACA,EAAA;AAAA,EACE,KAAQ,GAAA,KAAA;AAAA,EACR,QAAA;AACF,CAAA,GAGI,EACiB,EAAA;AACrB,EAAI,IAAA,CAAC,mBAAmB,CAAC,eAAA,CAAgB,OAAO,UAAc,IAAA,CAAC,gBAAgB,IAAM,EAAA;AACnF,IAAA,OAAO,EAAC,CAAA;AAAA,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AAE,CAAA,MAAA,CAAO,IAAI,CAAA,EAAG,MAAS,GAAA,MAAA,CAAO,IAAK,CAAA,CAAA,CAAE,MAAO,CAAA,IAAI,GAAG,MAAQ,EAAA;AAC3E,IAAO,OAAA,CAAA,CAAA,CAAA;AAAA,GACT;AACA,EAAA,IAAI,MAAO,CAAA,IAAA,CAAK,CAAE,CAAA,MAAA,CAAO,IAAI,CAAA,EAAG,MAAS,GAAA,MAAA,CAAO,IAAK,CAAA,CAAA,CAAE,MAAO,CAAA,IAAI,GAAG,MAAQ,EAAA;AAC3E,IAAO,OAAA,CAAA,CAAA;AAAA,GACT;AACA,EAAO,OAAA,CAAA,CAAA;AACT","file":"utils.cjs","sourcesContent":["export { getComments } from './getComments.ts'\nexport { getASTParams, getPathParams } from './getParams.ts'\nexport { getSchemaFactory } from './getSchemaFactory.ts'\nexport type { GetSchemasProps } from './getSchemas.ts'\nexport { getSchemas } from './getSchemas.ts'\nexport { refsSorter } from './refSorter.ts'\nexport { parseFromConfig } from './parseFromConfig.ts'\n\nexport { isOptional } from '@kubb/oas'\n","import transformers from '@kubb/core/transformers'\nimport { URLPath } from '@kubb/core/utils'\n\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `@link ${new URLPath(operation.path).URL}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter(Boolean)\n .map((text) => transformers.trim(text))\n}\n","import { isParameterObject } from '@kubb/oas'\n\nimport type { FunctionParamsAST } from '@kubb/core/utils'\nimport type { OasTypes } from '@kubb/oas'\nimport type { Params } from '@kubb/react/types'\nimport type { OperationSchema } from '../types.ts'\nimport { camelCase } from '@kubb/core/transformers'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n override,\n }: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) {\n return []\n }\n\n return Object.entries(operationSchema.schema.properties).map(([name, schema]: [string, OasTypes.SchemaObject]) => {\n const isParam = isParameterObject(schema)\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: isParam ? schema.required : true,\n type: typed ? `${operationSchema.name}[\"${name}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n acc[camelCase(curr.name)] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n","import type { Refs } from '../types.ts'\n\ntype Generated = { import: { refs: Refs; name: string } }\n\nexport function refsSorter<T extends Generated>(a: T, b: T): number {\n if (Object.keys(a.import.refs)?.length < Object.keys(b.import.refs)?.length) {\n return -1\n }\n if (Object.keys(a.import.refs)?.length > Object.keys(b.import.refs)?.length) {\n return 1\n }\n return 0\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/index.ts","../src/utils/getComments.ts","../src/utils/getParams.ts","../src/utils/refSorter.ts"],"names":["init_cjs_shims","URLPath","transformers","isParameterObject","camelCase"],"mappings":";;;;;;;;;;;;;AAAAA,gCAAA,EAAA,CAAA;;;ACAAA,gCAAA,EAAA,CAAA;AAKO,SAAS,YAAY,SAAgC,EAAA;AAC1D,EAAO,OAAA;AAAA,IACL,UAAU,cAAe,EAAA,IAAK,CAAgB,aAAA,EAAA,SAAA,CAAU,gBAAgB,CAAA,CAAA;AAAA,IACxE,UAAU,UAAW,EAAA,IAAK,CAAY,SAAA,EAAA,SAAA,CAAU,YAAY,CAAA,CAAA;AAAA,IAC5D,SAAA,CAAU,QAAQ,CAAS,MAAA,EAAA,IA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KAAK,IAAS,KAAA;AAClE,IAAI,IAAA,IAAA,CAAK,IAAQ,IAAA,IAAA,CAAK,OAAS,EAAA;AAC7B,MAAA,GAAA,CAAIC,sBAAU,CAAA,IAAA,CAAK,IAAI,CAAC,CAAI,GAAA;AAAA,QAC1B,SAAS,IAAK,CAAA,OAAA;AAAA,QACd,MAAM,IAAK,CAAA,IAAA;AAAA,QACX,QAAA,EAAU,CAAC,IAAK,CAAA,QAAA;AAAA,OAClB,CAAA;AAAA,KACF;AAEA,IAAO,OAAA,GAAA,CAAA;AAAA,GACT,EAAG,EAAY,CAAA,CAAA;AACjB,CAAA;;;ACzDAJ,gCAAA,EAAA,CAAA;AAIO,SAAS,UAAA,CAAgC,GAAM,CAAc,EAAA;AAClE,EAAA,IAAI,MAAO,CAAA,IAAA,CAAK,CAAE,CAAA,MAAA,CAAO,IAAI,CAAA,EAAG,MAAS,GAAA,MAAA,CAAO,IAAK,CAAA,CAAA,CAAE,MAAO,CAAA,IAAI,GAAG,MAAQ,EAAA;AAC3E,IAAO,OAAA,CAAA,CAAA,CAAA;AAAA,GACT;AACA,EAAA,IAAI,MAAO,CAAA,IAAA,CAAK,CAAE,CAAA,MAAA,CAAO,IAAI,CAAA,EAAG,MAAS,GAAA,MAAA,CAAO,IAAK,CAAA,CAAA,CAAE,MAAO,CAAA,IAAI,GAAG,MAAQ,EAAA;AAC3E,IAAO,OAAA,CAAA,CAAA;AAAA,GACT;AACA,EAAO,OAAA,CAAA,CAAA;AACT","file":"utils.cjs","sourcesContent":["export { getComments } from './getComments.ts'\nexport { getASTParams, getPathParams } from './getParams.ts'\nexport { getSchemaFactory } from './getSchemaFactory.ts'\nexport type { GetSchemasProps } from './getSchemas.ts'\nexport { getSchemas } from './getSchemas.ts'\nexport { refsSorter } from './refSorter.ts'\nexport { parseFromConfig } from './parseFromConfig.ts'\n\nexport { isOptional } from '@kubb/oas'\n","import transformers from '@kubb/core/transformers'\nimport { URLPath } from '@kubb/core/utils'\n\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `@link ${new URLPath(operation.path).URL}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter(Boolean)\n .map((text) => transformers.trim(text))\n}\n","import { isParameterObject } from '@kubb/oas'\n\nimport { camelCase } from '@kubb/core/transformers'\nimport type { FunctionParamsAST } from '@kubb/core/utils'\nimport type { OasTypes } from '@kubb/oas'\nimport type { Params } from '@kubb/react/types'\nimport type { OperationSchema } from '../types.ts'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n override,\n }: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) {\n return []\n }\n\n return Object.entries(operationSchema.schema.properties).map(([name, schema]: [string, OasTypes.SchemaObject]) => {\n const isParam = isParameterObject(schema)\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: isParam ? schema.required : true,\n type: typed ? `${operationSchema.name}[\"${name}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n acc[camelCase(curr.name)] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n","import type { Refs } from '../types.ts'\n\ntype Generated = { import: { refs: Refs; name: string } }\n\nexport function refsSorter<T extends Generated>(a: T, b: T): number {\n if (Object.keys(a.import.refs)?.length < Object.keys(b.import.refs)?.length) {\n return -1\n }\n if (Object.keys(a.import.refs)?.length > Object.keys(b.import.refs)?.length) {\n return 1\n }\n return 0\n}\n"]}
package/dist/utils.d.cts CHANGED
@@ -2,8 +2,8 @@ import { Operation, Oas, SchemaObject, OpenAPIV3, OpenAPIV3_1 } from '@kubb/oas'
2
2
  export { isOptional } from '@kubb/oas';
3
3
  import { FunctionParamsAST } from '@kubb/core/utils';
4
4
  import { Params } from '@kubb/react/types';
5
- import { v as OperationSchema, t as Refs } from './OperationGenerator-BqfyX5-8.cjs';
6
- export { z as GetSchemasProps, B as getSchemas } from './OperationGenerator-BqfyX5-8.cjs';
5
+ import { v as OperationSchema, t as Refs } from './OperationGenerator-B5CoXmjA.cjs';
6
+ export { z as GetSchemasProps, B as getSchemas } from './OperationGenerator-B5CoXmjA.cjs';
7
7
  import { FormatOptions } from '@kubb/oas/parser';
8
8
  import { Config } from '@kubb/core';
9
9
  import '@kubb/fs/types';
package/dist/utils.d.ts CHANGED
@@ -2,8 +2,8 @@ import { Operation, Oas, SchemaObject, OpenAPIV3, OpenAPIV3_1 } from '@kubb/oas'
2
2
  export { isOptional } from '@kubb/oas';
3
3
  import { FunctionParamsAST } from '@kubb/core/utils';
4
4
  import { Params } from '@kubb/react/types';
5
- import { v as OperationSchema, t as Refs } from './OperationGenerator-BqfyX5-8.js';
6
- export { z as GetSchemasProps, B as getSchemas } from './OperationGenerator-BqfyX5-8.js';
5
+ import { v as OperationSchema, t as Refs } from './OperationGenerator-B5CoXmjA.js';
6
+ export { z as GetSchemasProps, B as getSchemas } from './OperationGenerator-B5CoXmjA.js';
7
7
  import { FormatOptions } from '@kubb/oas/parser';
8
8
  import { Config } from '@kubb/core';
9
9
  import '@kubb/fs/types';
package/dist/utils.js CHANGED
@@ -1,6 +1,5 @@
1
- export { parseFromConfig } from './chunk-2V64GHQ4.js';
2
- import { init_esm_shims } from './chunk-GAPWY2CE.js';
3
- export { getSchemaFactory, getSchemas } from './chunk-GAPWY2CE.js';
1
+ export { getSchemaFactory, getSchemas, parseFromConfig } from './chunk-2QECZEUD.js';
2
+ import { init_esm_shims } from './chunk-4OQEPWOG.js';
4
3
  import transformers, { camelCase } from '@kubb/core/transformers';
5
4
  import { URLPath } from '@kubb/core/utils';
6
5
  import { isParameterObject } from '@kubb/oas';
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/index.ts","../src/utils/getComments.ts","../src/utils/getParams.ts","../src/utils/refSorter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,cAAA,EAAA,CAAA;;;ACAA,cAAA,EAAA,CAAA;AAKO,SAAS,YAAY,SAAgC,EAAA;AAC1D,EAAO,OAAA;AAAA,IACL,UAAU,cAAe,EAAA,IAAK,CAAgB,aAAA,EAAA,SAAA,CAAU,gBAAgB,CAAA,CAAA;AAAA,IACxE,UAAU,UAAW,EAAA,IAAK,CAAY,SAAA,EAAA,SAAA,CAAU,YAAY,CAAA,CAAA;AAAA,IAC5D,SAAA,CAAU,QAAQ,CAAS,MAAA,EAAA,IAAI,QAAQ,SAAU,CAAA,IAAI,EAAE,GAAG,CAAA,CAAA;AAAA,IAC1D,SAAA,CAAU,cAAkB,IAAA,aAAA;AAAA,GAC9B,CACG,MAAO,CAAA,OAAO,CACd,CAAA,GAAA,CAAI,CAAC,IAAS,KAAA,YAAA,CAAa,IAAK,CAAA,IAAI,CAAC,CAAA,CAAA;AAC1C,CAAA;;;ACdA,cAAA,EAAA,CAAA;AAYO,SAAS,aACd,eACA,EAAA;AAAA,EACE,KAAQ,GAAA,KAAA;AAAA,EACR,QAAA;AACF,CAAA,GAGI,EACiB,EAAA;AACrB,EAAI,IAAA,CAAC,mBAAmB,CAAC,eAAA,CAAgB,OAAO,UAAc,IAAA,CAAC,gBAAgB,IAAM,EAAA;AACnF,IAAA,OAAO,EAAC,CAAA;AAAA,GACV;AAEA,EAAO,OAAA,MAAA,CAAO,OAAQ,CAAA,eAAA,CAAgB,MAAO,CAAA,UAAU,CAAE,CAAA,GAAA,CAAI,CAAC,CAAC,IAAM,EAAA,MAAM,CAAuC,KAAA;AA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,CAAA;AAAA,GACT;AACA,EAAA,IAAI,MAAO,CAAA,IAAA,CAAK,CAAE,CAAA,MAAA,CAAO,IAAI,CAAA,EAAG,MAAS,GAAA,MAAA,CAAO,IAAK,CAAA,CAAA,CAAE,MAAO,CAAA,IAAI,GAAG,MAAQ,EAAA;AAC3E,IAAO,OAAA,CAAA,CAAA;AAAA,GACT;AACA,EAAO,OAAA,CAAA,CAAA;AACT","file":"utils.js","sourcesContent":["export { getComments } from './getComments.ts'\nexport { getASTParams, getPathParams } from './getParams.ts'\nexport { getSchemaFactory } from './getSchemaFactory.ts'\nexport type { GetSchemasProps } from './getSchemas.ts'\nexport { getSchemas } from './getSchemas.ts'\nexport { refsSorter } from './refSorter.ts'\nexport { parseFromConfig } from './parseFromConfig.ts'\n\nexport { isOptional } from '@kubb/oas'\n","import transformers from '@kubb/core/transformers'\nimport { URLPath } from '@kubb/core/utils'\n\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `@link ${new URLPath(operation.path).URL}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter(Boolean)\n .map((text) => transformers.trim(text))\n}\n","import { isParameterObject } from '@kubb/oas'\n\nimport type { FunctionParamsAST } from '@kubb/core/utils'\nimport type { OasTypes } from '@kubb/oas'\nimport type { Params } from '@kubb/react/types'\nimport type { OperationSchema } from '../types.ts'\nimport { camelCase } from '@kubb/core/transformers'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n override,\n }: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) {\n return []\n }\n\n return Object.entries(operationSchema.schema.properties).map(([name, schema]: [string, OasTypes.SchemaObject]) => {\n const isParam = isParameterObject(schema)\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: isParam ? schema.required : true,\n type: typed ? `${operationSchema.name}[\"${name}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n acc[camelCase(curr.name)] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n","import type { Refs } from '../types.ts'\n\ntype Generated = { import: { refs: Refs; name: string } }\n\nexport function refsSorter<T extends Generated>(a: T, b: T): number {\n if (Object.keys(a.import.refs)?.length < Object.keys(b.import.refs)?.length) {\n return -1\n }\n if (Object.keys(a.import.refs)?.length > Object.keys(b.import.refs)?.length) {\n return 1\n }\n return 0\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/index.ts","../src/utils/getComments.ts","../src/utils/getParams.ts","../src/utils/refSorter.ts"],"names":[],"mappings":";;;;;;;;AAAA,cAAA,EAAA,CAAA;;;ACAA,cAAA,EAAA,CAAA;AAKO,SAAS,YAAY,SAAgC,EAAA;AAC1D,EAAO,OAAA;AAAA,IACL,UAAU,cAAe,EAAA,IAAK,CAAgB,aAAA,EAAA,SAAA,CAAU,gBAAgB,CAAA,CAAA;AAAA,IACxE,UAAU,UAAW,EAAA,IAAK,CAAY,SAAA,EAAA,SAAA,CAAU,YAAY,CAAA,CAAA;AAAA,IAC5D,SAAA,CAAU,QAAQ,CAAS,MAAA,EAAA,IAAI,QAAQ,SAAU,CAAA,IAAI,EAAE,GAAG,CAAA,CAAA;AAAA,IAC1D,SAAA,CAAU,cAAkB,IAAA,aAAA;AAAA,GAC9B,CACG,MAAO,CAAA,OAAO,CACd,CAAA,GAAA,CAAI,CAAC,IAAS,KAAA,YAAA,CAAa,IAAK,CAAA,IAAI,C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IAAK,CAAA,IAAA;AAAA,QACX,QAAA,EAAU,CAAC,IAAK,CAAA,QAAA;AAAA,OAClB,CAAA;AAAA,KACF;AAEA,IAAO,OAAA,GAAA,CAAA;AAAA,GACT,EAAG,EAAY,CAAA,CAAA;AACjB,CAAA;;;ACzDA,cAAA,EAAA,CAAA;AAIO,SAAS,UAAA,CAAgC,GAAM,CAAc,EAAA;AAClE,EAAA,IAAI,MAAO,CAAA,IAAA,CAAK,CAAE,CAAA,MAAA,CAAO,IAAI,CAAA,EAAG,MAAS,GAAA,MAAA,CAAO,IAAK,CAAA,CAAA,CAAE,MAAO,CAAA,IAAI,GAAG,MAAQ,EAAA;AAC3E,IAAO,OAAA,CAAA,CAAA,CAAA;AAAA,GACT;AACA,EAAA,IAAI,MAAO,CAAA,IAAA,CAAK,CAAE,CAAA,MAAA,CAAO,IAAI,CAAA,EAAG,MAAS,GAAA,MAAA,CAAO,IAAK,CAAA,CAAA,CAAE,MAAO,CAAA,IAAI,GAAG,MAAQ,EAAA;AAC3E,IAAO,OAAA,CAAA,CAAA;AAAA,GACT;AACA,EAAO,OAAA,CAAA,CAAA;AACT","file":"utils.js","sourcesContent":["export { getComments } from './getComments.ts'\nexport { getASTParams, getPathParams } from './getParams.ts'\nexport { getSchemaFactory } from './getSchemaFactory.ts'\nexport type { GetSchemasProps } from './getSchemas.ts'\nexport { getSchemas } from './getSchemas.ts'\nexport { refsSorter } from './refSorter.ts'\nexport { parseFromConfig } from './parseFromConfig.ts'\n\nexport { isOptional } from '@kubb/oas'\n","import transformers from '@kubb/core/transformers'\nimport { URLPath } from '@kubb/core/utils'\n\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `@link ${new URLPath(operation.path).URL}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter(Boolean)\n .map((text) => transformers.trim(text))\n}\n","import { isParameterObject } from '@kubb/oas'\n\nimport { camelCase } from '@kubb/core/transformers'\nimport type { FunctionParamsAST } from '@kubb/core/utils'\nimport type { OasTypes } from '@kubb/oas'\nimport type { Params } from '@kubb/react/types'\nimport type { OperationSchema } from '../types.ts'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n override,\n }: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) {\n return []\n }\n\n return Object.entries(operationSchema.schema.properties).map(([name, schema]: [string, OasTypes.SchemaObject]) => {\n const isParam = isParameterObject(schema)\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: isParam ? schema.required : true,\n type: typed ? `${operationSchema.name}[\"${name}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n acc[camelCase(curr.name)] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n","import type { Refs } from '../types.ts'\n\ntype Generated = { import: { refs: Refs; name: string } }\n\nexport function refsSorter<T extends Generated>(a: T, b: T): number {\n if (Object.keys(a.import.refs)?.length < Object.keys(b.import.refs)?.length) {\n return -1\n }\n if (Object.keys(a.import.refs)?.length > Object.keys(b.import.refs)?.length) {\n return 1\n }\n return 0\n}\n"]}