@kubb/plugin-oas 2.21.0 → 2.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-NIW3BYXF.js → chunk-57Y7UOGB.js} +3 -3
- package/dist/{chunk-NIW3BYXF.js.map → chunk-57Y7UOGB.js.map} +1 -1
- package/dist/{chunk-PSE6BVVE.js → chunk-CJJZ6M7Y.js} +2 -2
- package/dist/{chunk-5RQSHNR5.cjs → chunk-EK4FFPC4.cjs} +21 -21
- package/dist/{chunk-OD3SN2E7.cjs → chunk-QOZUM4SQ.cjs} +3 -3
- package/dist/{chunk-OD3SN2E7.cjs.map → chunk-QOZUM4SQ.cjs.map} +1 -1
- package/dist/{chunk-SRJ6I3CB.js → chunk-SJ6UVWXR.js} +2 -2
- package/dist/{chunk-Y3ERH6OV.cjs → chunk-U7CCHXIN.cjs} +23 -23
- package/dist/{chunk-IP3FZPIH.cjs → chunk-WTJWAVHQ.cjs} +3 -3
- package/dist/{chunk-6ORMGOKP.js → chunk-Y2YMFPIK.js} +3 -3
- package/dist/components.cjs +5 -5
- package/dist/components.js +3 -3
- package/dist/hooks.cjs +13 -13
- package/dist/hooks.js +3 -3
- package/dist/index.cjs +20 -20
- package/dist/index.js +3 -3
- package/dist/utils.cjs +8 -8
- package/dist/utils.js +2 -2
- package/package.json +10 -10
- /package/dist/{chunk-PSE6BVVE.js.map → chunk-CJJZ6M7Y.js.map} +0 -0
- /package/dist/{chunk-5RQSHNR5.cjs.map → chunk-EK4FFPC4.cjs.map} +0 -0
- /package/dist/{chunk-SRJ6I3CB.js.map → chunk-SJ6UVWXR.js.map} +0 -0
- /package/dist/{chunk-Y3ERH6OV.cjs.map → chunk-U7CCHXIN.cjs.map} +0 -0
- /package/dist/{chunk-IP3FZPIH.cjs.map → chunk-WTJWAVHQ.cjs.map} +0 -0
- /package/dist/{chunk-6ORMGOKP.js.map → chunk-Y2YMFPIK.js.map} +0 -0
|
@@ -35,9 +35,9 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
35
35
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
36
36
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
37
37
|
|
|
38
|
-
// ../../node_modules/.pnpm/tsup@8.1.0_@microsoft+api-extractor@7.47.0_@types+node@20.14.
|
|
38
|
+
// ../../node_modules/.pnpm/tsup@8.1.0_@microsoft+api-extractor@7.47.0_@types+node@20.14.9__postcss@8.4.38_ts-node@10.9.2_e4wj7wuzn7kxi3mm64msznmrum/node_modules/tsup/assets/esm_shims.js
|
|
39
39
|
var init_esm_shims = __esm({
|
|
40
|
-
"../../node_modules/.pnpm/tsup@8.1.0_@microsoft+api-extractor@7.47.0_@types+node@20.14.
|
|
40
|
+
"../../node_modules/.pnpm/tsup@8.1.0_@microsoft+api-extractor@7.47.0_@types+node@20.14.9__postcss@8.4.38_ts-node@10.9.2_e4wj7wuzn7kxi3mm64msznmrum/node_modules/tsup/assets/esm_shims.js"() {
|
|
41
41
|
"use strict";
|
|
42
42
|
}
|
|
43
43
|
});
|
|
@@ -98,4 +98,4 @@ export {
|
|
|
98
98
|
getSchemas,
|
|
99
99
|
getSchemaFactory
|
|
100
100
|
};
|
|
101
|
-
//# sourceMappingURL=chunk-
|
|
101
|
+
//# sourceMappingURL=chunk-57Y7UOGB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.1.0_@microsoft+api-extractor@7.47.0_@types+node@20.14.
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.1.0_@microsoft+api-extractor@7.47.0_@types+node@20.14.9__postcss@8.4.38_ts-node@10.9.2_e4wj7wuzn7kxi3mm64msznmrum/node_modules/tsup/assets/esm_shims.js","../src/utils/getSchemas.ts","../src/utils/getSchemaFactory.ts"],"sourcesContent":["// Shim globals in esm bundle\nimport { fileURLToPath } from 'url'\nimport path from 'path'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","import type { Oas, OasTypes, contentType } from '@kubb/oas'\n\ntype Mode = 'schemas' | 'responses' | 'requestBodies'\n\nexport type GetSchemasProps = {\n oas: Oas\n contentType?: contentType\n includes?: Mode[]\n}\n\nexport function getSchemas({ oas, contentType, includes = ['schemas', 'requestBodies', 'responses'] }: GetSchemasProps): Record<string, OasTypes.SchemaObject> {\n const components = oas.getDefinition().components\n\n let schemas: Record<string, OasTypes.SchemaObject> = {}\n\n if (includes.includes('schemas')) {\n schemas = {\n ...schemas,\n ...((components?.schemas as Record<string, OasTypes.SchemaObject>) || {}),\n }\n }\n\n const requestBodies = components?.requestBodies || {}\n if (includes.includes('responses')) {\n const responses = components?.responses || {}\n\n Object.entries(responses).forEach(([name, response]: [string, OasTypes.ResponseObject]) => {\n if (response.content && !schemas[name]) {\n const firstContentType = Object.keys(response.content)[0] || 'application/json'\n schemas[name] = response.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n if (includes.includes('requestBodies')) {\n Object.entries(requestBodies).forEach(([name, request]: [string, OasTypes.RequestBodyObject]) => {\n if (request.content && !schemas[name]) {\n const firstContentType = Object.keys(request.content)[0] || 'application/json'\n schemas[name] = request.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n return schemas\n}\n","import { isOpenApiV3_1Document } from '@kubb/oas'\n\nimport type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'\n\n/**\n * Make it possible to narrow down the schema based on a specific version(3 or 3.1)\n */\ntype SchemaResult<TWithRef extends boolean = false> =\n | {\n schema?: (TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.0'\n }\n | {\n schema?: (TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.1'\n }\n\nexport function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef> {\n return (schema?: SchemaObject) => {\n const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'\n\n return {\n schema,\n version,\n } as SchemaResult<TWithRef>\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAUO,SAAS,WAAW,EAAE,KAAK,aAAa,WAAW,CAAC,WAAW,iBAAiB,WAAW,EAAE,GAA2D;AAC7J,QAAM,aAAa,IAAI,cAAc,EAAE;AAEvC,MAAI,UAAiD,CAAC;AAEtD,MAAI,SAAS,SAAS,SAAS,GAAG;AAChC,cAAU;AAAA,MACR,GAAG;AAAA,MACH,GAAK,YAAY,WAAqD,CAAC;AAAA,IACzE;AAAA,EACF;AAEA,QAAM,gBAAgB,YAAY,iBAAiB,CAAC;AACpD,MAAI,SAAS,SAAS,WAAW,GAAG;AAClC,UAAM,YAAY,YAAY,aAAa,CAAC;AAE5C,WAAO,QAAQ,SAAS,EAAE,QAAQ,CAAC,CAAC,MAAM,QAAQ,MAAyC;AACzF,UAAI,SAAS,WAAW,CAAC,QAAQ,IAAI,GAAG;AACtC,cAAM,mBAAmB,OAAO,KAAK,SAAS,OAAO,EAAE,CAAC,KAAK;AAC7D,gBAAQ,IAAI,IAAI,SAAS,UAAU,eAAe,gBAAgB,GAAG;AAAA,MACvE;AAAA,IACF,CAAC;AAAA,EACH;AAEA,MAAI,SAAS,SAAS,eAAe,GAAG;AACtC,WAAO,QAAQ,aAAa,EAAE,QAAQ,CAAC,CAAC,MAAM,OAAO,MAA4C;AAC/F,UAAI,QAAQ,WAAW,CAAC,QAAQ,IAAI,GAAG;AACrC,cAAM,mBAAmB,OAAO,KAAK,QAAQ,OAAO,EAAE,CAAC,KAAK;AAC5D,gBAAQ,IAAI,IAAI,QAAQ,UAAU,eAAe,gBAAgB,GAAG;AAAA,MACtE;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;;;AC5CA;AAAA,SAAS,6BAA6B;AAuB/B,SAAS,iBAAmD,KAA6D;AAC9H,SAAO,CAAC,WAA0B;AAChC,UAAM,UAAU,sBAAsB,IAAI,GAAG,IAAI,QAAQ;AAEzD,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getSchemaFactory,
|
|
6
6
|
getSchemas,
|
|
7
7
|
init_esm_shims
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-57Y7UOGB.js";
|
|
9
9
|
|
|
10
10
|
// src/SchemaMapper.ts
|
|
11
11
|
init_esm_shims();
|
|
@@ -692,4 +692,4 @@ export {
|
|
|
692
692
|
isKeyword,
|
|
693
693
|
SchemaGenerator
|
|
694
694
|
};
|
|
695
|
-
//# sourceMappingURL=chunk-
|
|
695
|
+
//# sourceMappingURL=chunk-CJJZ6M7Y.js.map
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkQOZUM4SQcjs = require('./chunk-QOZUM4SQ.cjs');
|
|
9
9
|
|
|
10
10
|
// src/SchemaMapper.ts
|
|
11
|
-
|
|
11
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
12
12
|
var schemaKeywords = {
|
|
13
13
|
any: "any",
|
|
14
14
|
strict: "strict",
|
|
@@ -60,7 +60,7 @@ function isKeyword(meta, keyword) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// src/SchemaGenerator.ts
|
|
63
|
-
|
|
63
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
64
64
|
var _core = require('@kubb/core');
|
|
65
65
|
var _transformers = require('@kubb/core/transformers'); var _transformers2 = _interopRequireDefault(_transformers);
|
|
66
66
|
var _utils = require('@kubb/core/utils');
|
|
@@ -70,11 +70,11 @@ var _usedAliasNames, _SchemaGenerator_instances, getUsedEnumNames_fn, getOptions
|
|
|
70
70
|
var _SchemaGenerator = class _SchemaGenerator extends _core.Generator {
|
|
71
71
|
constructor() {
|
|
72
72
|
super(...arguments);
|
|
73
|
-
|
|
73
|
+
_chunkQOZUM4SQcjs.__privateAdd.call(void 0, this, _SchemaGenerator_instances);
|
|
74
74
|
// Collect the types of all referenced schemas, so we can export them later
|
|
75
75
|
this.refs = {};
|
|
76
76
|
// Keep track of already used type aliases
|
|
77
|
-
|
|
77
|
+
_chunkQOZUM4SQcjs.__privateAdd.call(void 0, this, _usedAliasNames, {});
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* Creates a type node from a given schema.
|
|
@@ -82,8 +82,8 @@ var _SchemaGenerator = class _SchemaGenerator extends _core.Generator {
|
|
|
82
82
|
* optionally adds a union with null.
|
|
83
83
|
*/
|
|
84
84
|
parse(props) {
|
|
85
|
-
const options =
|
|
86
|
-
const defaultSchemas =
|
|
85
|
+
const options = _chunkQOZUM4SQcjs.__privateMethod.call(void 0, this, _SchemaGenerator_instances, getOptions_fn).call(this, props);
|
|
86
|
+
const defaultSchemas = _chunkQOZUM4SQcjs.__privateMethod.call(void 0, this, _SchemaGenerator_instances, parseSchemaObject_fn).call(this, props);
|
|
87
87
|
const schemas = _optionalChain([options, 'access', _ => _.transformers, 'optionalAccess', _2 => _2.schema, 'optionalCall', _3 => _3(props, defaultSchemas)]) || defaultSchemas || [];
|
|
88
88
|
return _remeda.uniqueWith.call(void 0, schemas, _remeda.isDeepEqual);
|
|
89
89
|
}
|
|
@@ -200,9 +200,9 @@ var _SchemaGenerator = class _SchemaGenerator extends _core.Generator {
|
|
|
200
200
|
}
|
|
201
201
|
async build() {
|
|
202
202
|
const { oas, contentType, include } = this.context;
|
|
203
|
-
const schemas =
|
|
203
|
+
const schemas = _chunkQOZUM4SQcjs.getSchemas.call(void 0, { oas, contentType, includes: include });
|
|
204
204
|
const promises = Object.entries(schemas).reduce((acc, [name, schema]) => {
|
|
205
|
-
const options =
|
|
205
|
+
const options = _chunkQOZUM4SQcjs.__privateMethod.call(void 0, this, _SchemaGenerator_instances, getOptions_fn).call(this, { name });
|
|
206
206
|
const promiseOperation = this.schema.call(this, name, schema, {
|
|
207
207
|
...this.options,
|
|
208
208
|
...options
|
|
@@ -219,7 +219,7 @@ var _SchemaGenerator = class _SchemaGenerator extends _core.Generator {
|
|
|
219
219
|
_usedAliasNames = new WeakMap();
|
|
220
220
|
_SchemaGenerator_instances = new WeakSet();
|
|
221
221
|
getUsedEnumNames_fn = function(props) {
|
|
222
|
-
const options =
|
|
222
|
+
const options = _chunkQOZUM4SQcjs.__privateMethod.call(void 0, this, _SchemaGenerator_instances, getOptions_fn).call(this, props);
|
|
223
223
|
return options.usedEnumNames || {};
|
|
224
224
|
};
|
|
225
225
|
getOptions_fn = function({ name }) {
|
|
@@ -235,7 +235,7 @@ getOptions_fn = function({ name }) {
|
|
|
235
235
|
};
|
|
236
236
|
};
|
|
237
237
|
getUnknownReturn_fn = function(props) {
|
|
238
|
-
const options =
|
|
238
|
+
const options = _chunkQOZUM4SQcjs.__privateMethod.call(void 0, this, _SchemaGenerator_instances, getOptions_fn).call(this, props);
|
|
239
239
|
if (options.unknownType === "any") {
|
|
240
240
|
return schemaKeywords.any;
|
|
241
241
|
}
|
|
@@ -269,7 +269,7 @@ parseProperties_fn = function({ schema, name }) {
|
|
|
269
269
|
}).reduce((acc, curr) => ({ ...acc, ...curr }), {});
|
|
270
270
|
let additionalPropertiesSchemas = [];
|
|
271
271
|
if (additionalProperties) {
|
|
272
|
-
additionalPropertiesSchemas = additionalProperties === true ? [{ keyword:
|
|
272
|
+
additionalPropertiesSchemas = additionalProperties === true ? [{ keyword: _chunkQOZUM4SQcjs.__privateMethod.call(void 0, this, _SchemaGenerator_instances, getUnknownReturn_fn).call(this, { schema, name }) }] : this.parse({ schema: additionalProperties, parentName: name });
|
|
273
273
|
}
|
|
274
274
|
return [
|
|
275
275
|
{
|
|
@@ -287,7 +287,7 @@ parseProperties_fn = function({ schema, name }) {
|
|
|
287
287
|
getRefAlias_fn = function(obj) {
|
|
288
288
|
const { $ref } = obj;
|
|
289
289
|
let ref = this.refs[$ref];
|
|
290
|
-
const originalName = _utils.getUniqueName.call(void 0, $ref.replace(/.+\//, ""),
|
|
290
|
+
const originalName = _utils.getUniqueName.call(void 0, $ref.replace(/.+\//, ""), _chunkQOZUM4SQcjs.__privateGet.call(void 0, this, _usedAliasNames));
|
|
291
291
|
const propertyName = this.context.pluginManager.resolveName({
|
|
292
292
|
name: originalName,
|
|
293
293
|
pluginKey: this.context.plugin.key,
|
|
@@ -324,7 +324,7 @@ getRefAlias_fn = function(obj) {
|
|
|
324
324
|
];
|
|
325
325
|
};
|
|
326
326
|
getParsedSchemaObject_fn = function(schema) {
|
|
327
|
-
const parsedSchema =
|
|
327
|
+
const parsedSchema = _chunkQOZUM4SQcjs.getSchemaFactory.call(void 0, this.context.oas)(schema);
|
|
328
328
|
return parsedSchema;
|
|
329
329
|
};
|
|
330
330
|
/**
|
|
@@ -332,9 +332,9 @@ getParsedSchemaObject_fn = function(schema) {
|
|
|
332
332
|
* schema and returns the appropriate type.
|
|
333
333
|
*/
|
|
334
334
|
parseSchemaObject_fn = function({ schema: _schema, name, parentName }) {
|
|
335
|
-
const options =
|
|
336
|
-
const unknownReturn =
|
|
337
|
-
const { schema, version } =
|
|
335
|
+
const options = _chunkQOZUM4SQcjs.__privateMethod.call(void 0, this, _SchemaGenerator_instances, getOptions_fn).call(this, { schema: _schema, name });
|
|
336
|
+
const unknownReturn = _chunkQOZUM4SQcjs.__privateMethod.call(void 0, this, _SchemaGenerator_instances, getUnknownReturn_fn).call(this, { schema: _schema, name });
|
|
337
|
+
const { schema, version } = _chunkQOZUM4SQcjs.__privateMethod.call(void 0, this, _SchemaGenerator_instances, getParsedSchemaObject_fn).call(this, _schema);
|
|
338
338
|
const resolvedName = this.context.pluginManager.resolveName({
|
|
339
339
|
name: `${parentName || ""} ${name}`,
|
|
340
340
|
pluginKey: this.context.plugin.key,
|
|
@@ -401,7 +401,7 @@ parseSchemaObject_fn = function({ schema: _schema, name, parentName }) {
|
|
|
401
401
|
}
|
|
402
402
|
if (_oas.isReference.call(void 0, schema)) {
|
|
403
403
|
return [
|
|
404
|
-
...
|
|
404
|
+
..._chunkQOZUM4SQcjs.__privateMethod.call(void 0, this, _SchemaGenerator_instances, getRefAlias_fn).call(this, schema),
|
|
405
405
|
nullable && { keyword: schemaKeywords.nullable },
|
|
406
406
|
{
|
|
407
407
|
keyword: schemaKeywords.schema,
|
|
@@ -475,7 +475,7 @@ parseSchemaObject_fn = function({ schema: _schema, name, parentName }) {
|
|
|
475
475
|
return [and, ...baseItems];
|
|
476
476
|
}
|
|
477
477
|
if (schema.enum) {
|
|
478
|
-
const enumName = _utils.getUniqueName.call(void 0, _transformers.pascalCase.call(void 0, [parentName, name, options.enumSuffix].join(" ")),
|
|
478
|
+
const enumName = _utils.getUniqueName.call(void 0, _transformers.pascalCase.call(void 0, [parentName, name, options.enumSuffix].join(" ")), _chunkQOZUM4SQcjs.__privateMethod.call(void 0, this, _SchemaGenerator_instances, getUsedEnumNames_fn).call(this, { schema, name }));
|
|
479
479
|
const typeName = this.context.pluginManager.resolveName({
|
|
480
480
|
name: enumName,
|
|
481
481
|
pluginKey: this.context.plugin.key,
|
|
@@ -664,7 +664,7 @@ parseSchemaObject_fn = function({ schema: _schema, name, parentName }) {
|
|
|
664
664
|
];
|
|
665
665
|
}
|
|
666
666
|
if (schema.properties || schema.additionalProperties) {
|
|
667
|
-
return [...
|
|
667
|
+
return [..._chunkQOZUM4SQcjs.__privateMethod.call(void 0, this, _SchemaGenerator_instances, parseProperties_fn).call(this, { schema, name }), ...baseItems];
|
|
668
668
|
}
|
|
669
669
|
if (schema.type) {
|
|
670
670
|
if (Array.isArray(schema.type)) {
|
|
@@ -692,4 +692,4 @@ var SchemaGenerator = _SchemaGenerator;
|
|
|
692
692
|
|
|
693
693
|
|
|
694
694
|
exports.schemaKeywords = schemaKeywords; exports.isKeyword = isKeyword; exports.SchemaGenerator = SchemaGenerator;
|
|
695
|
-
//# sourceMappingURL=chunk-
|
|
695
|
+
//# sourceMappingURL=chunk-EK4FFPC4.cjs.map
|
|
@@ -35,9 +35,9 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
35
35
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
36
36
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
37
37
|
|
|
38
|
-
// ../../node_modules/.pnpm/tsup@8.1.0_@microsoft+api-extractor@7.47.0_@types+node@20.14.
|
|
38
|
+
// ../../node_modules/.pnpm/tsup@8.1.0_@microsoft+api-extractor@7.47.0_@types+node@20.14.9__postcss@8.4.38_ts-node@10.9.2_e4wj7wuzn7kxi3mm64msznmrum/node_modules/tsup/assets/cjs_shims.js
|
|
39
39
|
var init_cjs_shims = __esm({
|
|
40
|
-
"../../node_modules/.pnpm/tsup@8.1.0_@microsoft+api-extractor@7.47.0_@types+node@20.14.
|
|
40
|
+
"../../node_modules/.pnpm/tsup@8.1.0_@microsoft+api-extractor@7.47.0_@types+node@20.14.9__postcss@8.4.38_ts-node@10.9.2_e4wj7wuzn7kxi3mm64msznmrum/node_modules/tsup/assets/cjs_shims.js"() {
|
|
41
41
|
"use strict";
|
|
42
42
|
}
|
|
43
43
|
});
|
|
@@ -98,4 +98,4 @@ function getSchemaFactory(oas) {
|
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
exports.__commonJS = __commonJS; exports.__toESM = __toESM; exports.__privateGet = __privateGet; exports.__privateAdd = __privateAdd; exports.__privateSet = __privateSet; exports.__privateMethod = __privateMethod; exports.init_cjs_shims = init_cjs_shims; exports.getSchemas = getSchemas; exports.getSchemaFactory = getSchemaFactory;
|
|
101
|
-
//# sourceMappingURL=chunk-
|
|
101
|
+
//# sourceMappingURL=chunk-QOZUM4SQ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.1.0_@microsoft+api-extractor@7.47.0_@types+node@20.14.
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.1.0_@microsoft+api-extractor@7.47.0_@types+node@20.14.9__postcss@8.4.38_ts-node@10.9.2_e4wj7wuzn7kxi3mm64msznmrum/node_modules/tsup/assets/cjs_shims.js","../src/utils/getSchemas.ts","../src/utils/getSchemaFactory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAUO,SAAS,WAAW,EAAE,KAAK,aAAa,WAAW,CAAC,WAAW,iBAAiB,WAAW,EAAE,GAA2D;AAC7J,QAAM,aAAa,IAAI,cAAc,EAAE;AAEvC,MAAI,UAAiD,CAAC;AAEtD,MAAI,SAAS,SAAS,SAAS,GAAG;AAChC,cAAU;AAAA,MACR,GAAG;AAAA,MACH,GAAK,YAAY,WAAqD,CAAC;AAAA,IACzE;AAAA,EACF;AAEA,QAAM,gBAAgB,YAAY,iBAAiB,CAAC;AACpD,MAAI,SAAS,SAAS,WAAW,GAAG;AAClC,UAAM,YAAY,YAAY,aAAa,CAAC;AAE5C,WAAO,QAAQ,SAAS,EAAE,QAAQ,CAAC,CAAC,MAAM,QAAQ,MAAyC;AACzF,UAAI,SAAS,WAAW,CAAC,QAAQ,IAAI,GAAG;AACtC,cAAM,mBAAmB,OAAO,KAAK,SAAS,OAAO,EAAE,CAAC,KAAK;AAC7D,gBAAQ,IAAI,IAAI,SAAS,UAAU,eAAe,gBAAgB,GAAG;AAAA,MACvE;AAAA,IACF,CAAC;AAAA,EACH;AAEA,MAAI,SAAS,SAAS,eAAe,GAAG;AACtC,WAAO,QAAQ,aAAa,EAAE,QAAQ,CAAC,CAAC,MAAM,OAAO,MAA4C;AAC/F,UAAI,QAAQ,WAAW,CAAC,QAAQ,IAAI,GAAG;AACrC,cAAM,mBAAmB,OAAO,KAAK,QAAQ,OAAO,EAAE,CAAC,KAAK;AAC5D,gBAAQ,IAAI,IAAI,QAAQ,UAAU,eAAe,gBAAgB,GAAG;AAAA,MACtE;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;;;AC5CA;AAAA,SAAS,6BAA6B;AAuB/B,SAAS,iBAAmD,KAA6D;AAC9H,SAAO,CAAC,WAA0B;AAChC,UAAM,UAAU,sBAAsB,IAAI,GAAG,IAAI,QAAQ;AAEzD,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () =>\n typeof document === 'undefined'\n ? new URL('file:' + __filename).href\n : (document.currentScript && document.currentScript.src) ||\n new URL('main.js', document.baseURI).href\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","import type { Oas, OasTypes, contentType } from '@kubb/oas'\n\ntype Mode = 'schemas' | 'responses' | 'requestBodies'\n\nexport type GetSchemasProps = {\n oas: Oas\n contentType?: contentType\n includes?: Mode[]\n}\n\nexport function getSchemas({ oas, contentType, includes = ['schemas', 'requestBodies', 'responses'] }: GetSchemasProps): Record<string, OasTypes.SchemaObject> {\n const components = oas.getDefinition().components\n\n let schemas: Record<string, OasTypes.SchemaObject> = {}\n\n if (includes.includes('schemas')) {\n schemas = {\n ...schemas,\n ...((components?.schemas as Record<string, OasTypes.SchemaObject>) || {}),\n }\n }\n\n const requestBodies = components?.requestBodies || {}\n if (includes.includes('responses')) {\n const responses = components?.responses || {}\n\n Object.entries(responses).forEach(([name, response]: [string, OasTypes.ResponseObject]) => {\n if (response.content && !schemas[name]) {\n const firstContentType = Object.keys(response.content)[0] || 'application/json'\n schemas[name] = response.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n if (includes.includes('requestBodies')) {\n Object.entries(requestBodies).forEach(([name, request]: [string, OasTypes.RequestBodyObject]) => {\n if (request.content && !schemas[name]) {\n const firstContentType = Object.keys(request.content)[0] || 'application/json'\n schemas[name] = request.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n return schemas\n}\n","import { isOpenApiV3_1Document } from '@kubb/oas'\n\nimport type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'\n\n/**\n * Make it possible to narrow down the schema based on a specific version(3 or 3.1)\n */\ntype SchemaResult<TWithRef extends boolean = false> =\n | {\n schema?: (TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.0'\n }\n | {\n schema?: (TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.1'\n }\n\nexport function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef> {\n return (schema?: SchemaObject) => {\n const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'\n\n return {\n schema,\n version,\n } as SchemaResult<TWithRef>\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_esm_shims
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-57Y7UOGB.js";
|
|
4
4
|
|
|
5
5
|
// src/utils/parseFromConfig.ts
|
|
6
6
|
init_esm_shims();
|
|
@@ -31,4 +31,4 @@ function parseFromConfig(config, options = {}) {
|
|
|
31
31
|
export {
|
|
32
32
|
parseFromConfig
|
|
33
33
|
};
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-SJ6UVWXR.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkEK4FFPC4cjs = require('./chunk-EK4FFPC4.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkQOZUM4SQcjs = require('./chunk-QOZUM4SQ.cjs');
|
|
10
10
|
|
|
11
11
|
// ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
|
|
12
|
-
var require_react_production_min =
|
|
12
|
+
var require_react_production_min = _chunkQOZUM4SQcjs.__commonJS.call(void 0, {
|
|
13
13
|
"../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js"(exports) {
|
|
14
14
|
"use strict";
|
|
15
|
-
|
|
15
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
16
16
|
var l = Symbol.for("react.element");
|
|
17
17
|
var n = Symbol.for("react.portal");
|
|
18
18
|
var p = Symbol.for("react.fragment");
|
|
@@ -283,10 +283,10 @@ var require_react_production_min = _chunkOD3SN2E7cjs.__commonJS.call(void 0, {
|
|
|
283
283
|
});
|
|
284
284
|
|
|
285
285
|
// ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js
|
|
286
|
-
var require_react_development =
|
|
286
|
+
var require_react_development = _chunkQOZUM4SQcjs.__commonJS.call(void 0, {
|
|
287
287
|
"../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js"(exports, module) {
|
|
288
288
|
"use strict";
|
|
289
|
-
|
|
289
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
290
290
|
if (process.env.NODE_ENV !== "production") {
|
|
291
291
|
(function() {
|
|
292
292
|
"use strict";
|
|
@@ -2158,10 +2158,10 @@ var require_react_development = _chunkOD3SN2E7cjs.__commonJS.call(void 0, {
|
|
|
2158
2158
|
});
|
|
2159
2159
|
|
|
2160
2160
|
// ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
2161
|
-
var require_react =
|
|
2161
|
+
var require_react = _chunkQOZUM4SQcjs.__commonJS.call(void 0, {
|
|
2162
2162
|
"../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"(exports, module) {
|
|
2163
2163
|
"use strict";
|
|
2164
|
-
|
|
2164
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
2165
2165
|
if (process.env.NODE_ENV === "production") {
|
|
2166
2166
|
module.exports = require_react_production_min();
|
|
2167
2167
|
} else {
|
|
@@ -2171,10 +2171,10 @@ var require_react = _chunkOD3SN2E7cjs.__commonJS.call(void 0, {
|
|
|
2171
2171
|
});
|
|
2172
2172
|
|
|
2173
2173
|
// ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js
|
|
2174
|
-
var require_react_jsx_runtime_production_min =
|
|
2174
|
+
var require_react_jsx_runtime_production_min = _chunkQOZUM4SQcjs.__commonJS.call(void 0, {
|
|
2175
2175
|
"../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js"(exports) {
|
|
2176
2176
|
"use strict";
|
|
2177
|
-
|
|
2177
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
2178
2178
|
var f = require_react();
|
|
2179
2179
|
var k = Symbol.for("react.element");
|
|
2180
2180
|
var l = Symbol.for("react.fragment");
|
|
@@ -2197,10 +2197,10 @@ var require_react_jsx_runtime_production_min = _chunkOD3SN2E7cjs.__commonJS.call
|
|
|
2197
2197
|
});
|
|
2198
2198
|
|
|
2199
2199
|
// ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js
|
|
2200
|
-
var require_react_jsx_runtime_development =
|
|
2200
|
+
var require_react_jsx_runtime_development = _chunkQOZUM4SQcjs.__commonJS.call(void 0, {
|
|
2201
2201
|
"../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js"(exports) {
|
|
2202
2202
|
"use strict";
|
|
2203
|
-
|
|
2203
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
2204
2204
|
if (process.env.NODE_ENV !== "production") {
|
|
2205
2205
|
(function() {
|
|
2206
2206
|
"use strict";
|
|
@@ -3091,10 +3091,10 @@ var require_react_jsx_runtime_development = _chunkOD3SN2E7cjs.__commonJS.call(vo
|
|
|
3091
3091
|
});
|
|
3092
3092
|
|
|
3093
3093
|
// ../../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js
|
|
3094
|
-
var require_jsx_runtime =
|
|
3094
|
+
var require_jsx_runtime = _chunkQOZUM4SQcjs.__commonJS.call(void 0, {
|
|
3095
3095
|
"../../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js"(exports, module) {
|
|
3096
3096
|
"use strict";
|
|
3097
|
-
|
|
3097
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
3098
3098
|
if (process.env.NODE_ENV === "production") {
|
|
3099
3099
|
module.exports = require_react_jsx_runtime_production_min();
|
|
3100
3100
|
} else {
|
|
@@ -3104,8 +3104,8 @@ var require_jsx_runtime = _chunkOD3SN2E7cjs.__commonJS.call(void 0, {
|
|
|
3104
3104
|
});
|
|
3105
3105
|
|
|
3106
3106
|
// src/components/Operation.tsx
|
|
3107
|
-
|
|
3108
|
-
var import_jsx_runtime =
|
|
3107
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
3108
|
+
var import_jsx_runtime = _chunkQOZUM4SQcjs.__toESM.call(void 0, require_jsx_runtime(), 1);
|
|
3109
3109
|
var _react = require('@kubb/react');
|
|
3110
3110
|
var OperationContext = _react.createContext.call(void 0, {});
|
|
3111
3111
|
function Operation({ operation, children }) {
|
|
@@ -3114,13 +3114,13 @@ function Operation({ operation, children }) {
|
|
|
3114
3114
|
Operation.Context = OperationContext;
|
|
3115
3115
|
|
|
3116
3116
|
// src/hooks/useSchema.ts
|
|
3117
|
-
|
|
3117
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
3118
3118
|
|
|
3119
3119
|
|
|
3120
3120
|
// src/components/Schema.tsx
|
|
3121
|
-
|
|
3121
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
3122
3122
|
|
|
3123
|
-
var import_jsx_runtime2 =
|
|
3123
|
+
var import_jsx_runtime2 = _chunkQOZUM4SQcjs.__toESM.call(void 0, require_jsx_runtime(), 1);
|
|
3124
3124
|
var SchemaContext = _react.createContext.call(void 0, {
|
|
3125
3125
|
name: "unknown",
|
|
3126
3126
|
tree: []
|
|
@@ -3182,7 +3182,7 @@ Schema.File = function({ output, isTypeOnly, children }) {
|
|
|
3182
3182
|
Schema.Imports = ({ isTypeOnly }) => {
|
|
3183
3183
|
const { tree } = useSchema();
|
|
3184
3184
|
const { path: root } = _react.useFile.call(void 0, );
|
|
3185
|
-
const refs =
|
|
3185
|
+
const refs = _chunkEK4FFPC4cjs.SchemaGenerator.deepSearch(tree, _chunkEK4FFPC4cjs.schemaKeywords.ref);
|
|
3186
3186
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: _optionalChain([refs, 'optionalAccess', _ => _.map, 'call', _2 => _2((item, i) => {
|
|
3187
3187
|
if (!item.args.path) {
|
|
3188
3188
|
return void 0;
|
|
@@ -3199,9 +3199,9 @@ function useSchema() {
|
|
|
3199
3199
|
}
|
|
3200
3200
|
|
|
3201
3201
|
// src/components/Oas.tsx
|
|
3202
|
-
|
|
3202
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
3203
3203
|
|
|
3204
|
-
var import_jsx_runtime3 =
|
|
3204
|
+
var import_jsx_runtime3 = _chunkQOZUM4SQcjs.__toESM.call(void 0, require_jsx_runtime(), 1);
|
|
3205
3205
|
var OasContext = _react.createContext.call(void 0, {});
|
|
3206
3206
|
function Oas({ oas, children, operations, generator }) {
|
|
3207
3207
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(OasContext.Provider, { value: { oas, generator, operations }, children });
|
|
@@ -3262,4 +3262,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
3262
3262
|
* LICENSE file in the root directory of this source tree.
|
|
3263
3263
|
*)
|
|
3264
3264
|
*/
|
|
3265
|
-
//# sourceMappingURL=chunk-
|
|
3265
|
+
//# sourceMappingURL=chunk-U7CCHXIN.cjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkQOZUM4SQcjs = require('./chunk-QOZUM4SQ.cjs');
|
|
4
4
|
|
|
5
5
|
// src/utils/parseFromConfig.ts
|
|
6
|
-
|
|
6
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
7
7
|
var _path = require('path');
|
|
8
8
|
var _utils = require('@kubb/core/utils');
|
|
9
9
|
var _parser = require('@kubb/oas/parser');
|
|
@@ -31,4 +31,4 @@ function parseFromConfig(config, options = {}) {
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
exports.parseFromConfig = parseFromConfig;
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-WTJWAVHQ.cjs.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SchemaGenerator,
|
|
3
3
|
schemaKeywords
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CJJZ6M7Y.js";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__toESM,
|
|
8
8
|
init_esm_shims
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-57Y7UOGB.js";
|
|
10
10
|
|
|
11
11
|
// ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
|
|
12
12
|
var require_react_production_min = __commonJS({
|
|
@@ -3262,4 +3262,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
3262
3262
|
* LICENSE file in the root directory of this source tree.
|
|
3263
3263
|
*)
|
|
3264
3264
|
*/
|
|
3265
|
-
//# sourceMappingURL=chunk-
|
|
3265
|
+
//# sourceMappingURL=chunk-Y2YMFPIK.js.map
|
package/dist/components.cjs
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
5
|
+
var _chunkU7CCHXINcjs = require('./chunk-U7CCHXIN.cjs');
|
|
6
|
+
require('./chunk-EK4FFPC4.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkQOZUM4SQcjs = require('./chunk-QOZUM4SQ.cjs');
|
|
10
10
|
|
|
11
11
|
// src/components/index.ts
|
|
12
|
-
|
|
12
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.Oas =
|
|
17
|
+
exports.Oas = _chunkU7CCHXINcjs.Oas; exports.Operation = _chunkU7CCHXINcjs.Operation; exports.Schema = _chunkU7CCHXINcjs.Schema;
|
|
18
18
|
//# sourceMappingURL=components.cjs.map
|
package/dist/components.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
Oas,
|
|
3
3
|
Operation,
|
|
4
4
|
Schema
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-Y2YMFPIK.js";
|
|
6
|
+
import "./chunk-CJJZ6M7Y.js";
|
|
7
7
|
import {
|
|
8
8
|
init_esm_shims
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-57Y7UOGB.js";
|
|
10
10
|
|
|
11
11
|
// src/components/index.ts
|
|
12
12
|
init_esm_shims();
|
package/dist/hooks.cjs
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
5
|
+
var _chunkU7CCHXINcjs = require('./chunk-U7CCHXIN.cjs');
|
|
6
|
+
require('./chunk-EK4FFPC4.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkQOZUM4SQcjs = require('./chunk-QOZUM4SQ.cjs');
|
|
10
10
|
|
|
11
11
|
// src/hooks/index.ts
|
|
12
|
-
|
|
12
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
13
13
|
|
|
14
14
|
// src/hooks/useOas.ts
|
|
15
|
-
|
|
15
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
16
16
|
var _react = require('@kubb/react');
|
|
17
17
|
function useOas() {
|
|
18
|
-
const { oas } = _react.useContext.call(void 0,
|
|
18
|
+
const { oas } = _react.useContext.call(void 0, _chunkU7CCHXINcjs.Oas.Context);
|
|
19
19
|
if (!oas) {
|
|
20
20
|
throw new Error("Oas is not defined");
|
|
21
21
|
}
|
|
@@ -23,10 +23,10 @@ function useOas() {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// src/hooks/useOperation.ts
|
|
26
|
-
|
|
26
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
27
27
|
|
|
28
28
|
function useOperation() {
|
|
29
|
-
const { operation } = _react.useContext.call(void 0,
|
|
29
|
+
const { operation } = _react.useContext.call(void 0, _chunkU7CCHXINcjs.Operation.Context);
|
|
30
30
|
if (!operation) {
|
|
31
31
|
throw new Error("Operation is not defined");
|
|
32
32
|
}
|
|
@@ -34,11 +34,11 @@ function useOperation() {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
// src/hooks/useOperationManager.ts
|
|
37
|
-
|
|
37
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
38
38
|
|
|
39
39
|
function useOperationManager() {
|
|
40
40
|
const { plugin, pluginManager } = _react.useApp.call(void 0, );
|
|
41
|
-
const { generator } = _react.useContext.call(void 0,
|
|
41
|
+
const { generator } = _react.useContext.call(void 0, _chunkU7CCHXINcjs.Oas.Context);
|
|
42
42
|
if (!generator) {
|
|
43
43
|
throw new Error(`'generator' is not defined`);
|
|
44
44
|
}
|
|
@@ -139,10 +139,10 @@ function useOperationManager() {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
// src/hooks/useOperations.ts
|
|
142
|
-
|
|
142
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
143
143
|
|
|
144
144
|
function useOperations({ method, path } = {}) {
|
|
145
|
-
const { operations } = _react.useContext.call(void 0,
|
|
145
|
+
const { operations } = _react.useContext.call(void 0, _chunkU7CCHXINcjs.Oas.Context);
|
|
146
146
|
if (!operations) {
|
|
147
147
|
throw new Error("Operations is not defined");
|
|
148
148
|
}
|
|
@@ -161,5 +161,5 @@ function useOperations({ method, path } = {}) {
|
|
|
161
161
|
|
|
162
162
|
|
|
163
163
|
|
|
164
|
-
exports.useOas = useOas; exports.useOperation = useOperation; exports.useOperationManager = useOperationManager; exports.useOperations = useOperations; exports.useSchema =
|
|
164
|
+
exports.useOas = useOas; exports.useOperation = useOperation; exports.useOperationManager = useOperationManager; exports.useOperations = useOperations; exports.useSchema = _chunkU7CCHXINcjs.useSchema;
|
|
165
165
|
//# sourceMappingURL=hooks.cjs.map
|
package/dist/hooks.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
Oas,
|
|
3
3
|
Operation,
|
|
4
4
|
useSchema
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-Y2YMFPIK.js";
|
|
6
|
+
import "./chunk-CJJZ6M7Y.js";
|
|
7
7
|
import {
|
|
8
8
|
init_esm_shims
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-57Y7UOGB.js";
|
|
10
10
|
|
|
11
11
|
// src/hooks/index.ts
|
|
12
12
|
init_esm_shims();
|
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkWTJWAVHQcjs = require('./chunk-WTJWAVHQ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkEK4FFPC4cjs = require('./chunk-EK4FFPC4.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -13,13 +13,13 @@ var _chunk5RQSHNR5cjs = require('./chunk-5RQSHNR5.cjs');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkQOZUM4SQcjs = require('./chunk-QOZUM4SQ.cjs');
|
|
17
17
|
|
|
18
18
|
// src/index.ts
|
|
19
|
-
|
|
19
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
20
20
|
|
|
21
21
|
// src/plugin.ts
|
|
22
|
-
|
|
22
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
23
23
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
24
24
|
var _core = require('@kubb/core');
|
|
25
25
|
var _transformers = require('@kubb/core/transformers'); var _transformers2 = _interopRequireDefault(_transformers);
|
|
@@ -35,7 +35,7 @@ var pluginOas = _core.createPlugin.call(void 0, (options) => {
|
|
|
35
35
|
} = options;
|
|
36
36
|
const getOas = async ({ config, logger, formatOptions }) => {
|
|
37
37
|
try {
|
|
38
|
-
const oas = await
|
|
38
|
+
const oas = await _chunkWTJWAVHQcjs.parseFromConfig.call(void 0, config, formatOptions);
|
|
39
39
|
if (validate) {
|
|
40
40
|
await oas.valdiate();
|
|
41
41
|
}
|
|
@@ -43,7 +43,7 @@ var pluginOas = _core.createPlugin.call(void 0, (options) => {
|
|
|
43
43
|
} catch (e) {
|
|
44
44
|
const error = e;
|
|
45
45
|
logger.emit("warning", _optionalChain([error, 'optionalAccess', _ => _.message]));
|
|
46
|
-
return
|
|
46
|
+
return _chunkWTJWAVHQcjs.parseFromConfig.call(void 0, config);
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
return {
|
|
@@ -57,7 +57,7 @@ var pluginOas = _core.createPlugin.call(void 0, (options) => {
|
|
|
57
57
|
},
|
|
58
58
|
async getSchemas({ includes } = {}) {
|
|
59
59
|
const oas = await this.getOas();
|
|
60
|
-
return
|
|
60
|
+
return _chunkQOZUM4SQcjs.getSchemas.call(void 0, { oas, contentType, includes });
|
|
61
61
|
},
|
|
62
62
|
async getBaseURL() {
|
|
63
63
|
const oasInstance = await this.getOas();
|
|
@@ -96,7 +96,7 @@ var pluginOas = _core.createPlugin.call(void 0, (options) => {
|
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
await oas.dereference();
|
|
99
|
-
const schemas =
|
|
99
|
+
const schemas = _chunkQOZUM4SQcjs.getSchemas.call(void 0, { oas, contentType });
|
|
100
100
|
const mapSchema = async ([name, schema]) => {
|
|
101
101
|
const resolvedPath = this.resolvePath({
|
|
102
102
|
baseName: `${name}.json`,
|
|
@@ -126,21 +126,21 @@ var pluginOas = _core.createPlugin.call(void 0, (options) => {
|
|
|
126
126
|
});
|
|
127
127
|
|
|
128
128
|
// src/OperationGenerator.ts
|
|
129
|
-
|
|
129
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
var _operationsByMethod, _OperationGenerator_instances, getOptions_fn, isExcluded_fn, isIncluded_fn, methods_get;
|
|
133
133
|
var OperationGenerator = class extends _core.Generator {
|
|
134
134
|
constructor() {
|
|
135
135
|
super(...arguments);
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
_chunkQOZUM4SQcjs.__privateAdd.call(void 0, this, _OperationGenerator_instances);
|
|
137
|
+
_chunkQOZUM4SQcjs.__privateAdd.call(void 0, this, _operationsByMethod, {});
|
|
138
138
|
}
|
|
139
139
|
get operationsByMethod() {
|
|
140
|
-
return
|
|
140
|
+
return _chunkQOZUM4SQcjs.__privateGet.call(void 0, this, _operationsByMethod);
|
|
141
141
|
}
|
|
142
142
|
set operationsByMethod(paths) {
|
|
143
|
-
|
|
143
|
+
_chunkQOZUM4SQcjs.__privateSet.call(void 0, this, _operationsByMethod, paths);
|
|
144
144
|
}
|
|
145
145
|
getSchemas(operation, { forStatusCode, resolveName = (name) => name } = {}) {
|
|
146
146
|
const pathParamsSchema = this.context.oas.getParametersSchema(operation, "path");
|
|
@@ -223,9 +223,9 @@ var OperationGenerator = class extends _core.Generator {
|
|
|
223
223
|
const methods = Object.keys(method);
|
|
224
224
|
methods.forEach((method2) => {
|
|
225
225
|
const operation = oas.operation(path2, method2);
|
|
226
|
-
if (operation &&
|
|
227
|
-
const isExcluded =
|
|
228
|
-
const isIncluded = this.context.include ?
|
|
226
|
+
if (operation && _chunkQOZUM4SQcjs.__privateGet.call(void 0, this, _OperationGenerator_instances, methods_get)[method2]) {
|
|
227
|
+
const isExcluded = _chunkQOZUM4SQcjs.__privateMethod.call(void 0, this, _OperationGenerator_instances, isExcluded_fn).call(this, operation, method2);
|
|
228
|
+
const isIncluded = this.context.include ? _chunkQOZUM4SQcjs.__privateMethod.call(void 0, this, _OperationGenerator_instances, isIncluded_fn).call(this, operation, method2) : true;
|
|
229
229
|
if (isIncluded && !isExcluded) {
|
|
230
230
|
if (!acc[path2]) {
|
|
231
231
|
acc[path2] = {};
|
|
@@ -246,8 +246,8 @@ var OperationGenerator = class extends _core.Generator {
|
|
|
246
246
|
const methods = this.operationsByMethod[path2] ? Object.keys(this.operationsByMethod[path2]) : [];
|
|
247
247
|
methods.forEach((method) => {
|
|
248
248
|
const { operation } = _optionalChain([this, 'access', _37 => _37.operationsByMethod, 'access', _38 => _38[path2], 'optionalAccess', _39 => _39[method]]);
|
|
249
|
-
const options =
|
|
250
|
-
const promiseMethod = _optionalChain([
|
|
249
|
+
const options = _chunkQOZUM4SQcjs.__privateMethod.call(void 0, this, _OperationGenerator_instances, getOptions_fn).call(this, operation, method);
|
|
250
|
+
const promiseMethod = _optionalChain([_chunkQOZUM4SQcjs.__privateGet.call(void 0, this, _OperationGenerator_instances, methods_get), 'access', _40 => _40[method], 'optionalAccess', _41 => _41.call, 'call', _42 => _42(this, operation, {
|
|
251
251
|
...this.options,
|
|
252
252
|
...options
|
|
253
253
|
})]);
|
|
@@ -402,5 +402,5 @@ var src_default = definePluginDefault;
|
|
|
402
402
|
|
|
403
403
|
|
|
404
404
|
|
|
405
|
-
exports.OperationGenerator = OperationGenerator; exports.SchemaGenerator =
|
|
405
|
+
exports.OperationGenerator = OperationGenerator; exports.SchemaGenerator = _chunkEK4FFPC4cjs.SchemaGenerator; exports.default = src_default; exports.isKeyword = _chunkEK4FFPC4cjs.isKeyword; exports.pluginOas = pluginOas; exports.pluginOasName = pluginOasName; exports.schemaKeywords = _chunkEK4FFPC4cjs.schemaKeywords;
|
|
406
406
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseFromConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SJ6UVWXR.js";
|
|
4
4
|
import {
|
|
5
5
|
SchemaGenerator,
|
|
6
6
|
isKeyword,
|
|
7
7
|
schemaKeywords
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CJJZ6M7Y.js";
|
|
9
9
|
import {
|
|
10
10
|
__privateAdd,
|
|
11
11
|
__privateGet,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
__privateSet,
|
|
14
14
|
getSchemas,
|
|
15
15
|
init_esm_shims
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-57Y7UOGB.js";
|
|
17
17
|
|
|
18
18
|
// src/index.ts
|
|
19
19
|
init_esm_shims();
|
package/dist/utils.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkWTJWAVHQcjs = require('./chunk-WTJWAVHQ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkQOZUM4SQcjs = require('./chunk-QOZUM4SQ.cjs');
|
|
9
9
|
|
|
10
10
|
// src/utils/index.ts
|
|
11
|
-
|
|
11
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
12
12
|
|
|
13
13
|
// src/utils/getComments.ts
|
|
14
|
-
|
|
14
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
15
15
|
var _transformers = require('@kubb/core/transformers'); var _transformers2 = _interopRequireDefault(_transformers);
|
|
16
16
|
var _utils = require('@kubb/core/utils');
|
|
17
17
|
function getComments(operation) {
|
|
@@ -24,7 +24,7 @@ function getComments(operation) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// src/utils/getGroupedByTagFiles.ts
|
|
27
|
-
|
|
27
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
28
28
|
var _path = require('path');
|
|
29
29
|
var _core = require('@kubb/core');
|
|
30
30
|
|
|
@@ -69,7 +69,7 @@ async function getGroupedByTagFiles({ logger, files, plugin, template, exportAs,
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
// src/utils/getParams.ts
|
|
72
|
-
|
|
72
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
73
73
|
var _oas = require('@kubb/oas');
|
|
74
74
|
function getASTParams(operationSchema, {
|
|
75
75
|
typed = false,
|
|
@@ -103,7 +103,7 @@ function getPathParams(operationSchema, options = {}) {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
// src/utils/refSorter.ts
|
|
106
|
-
|
|
106
|
+
_chunkQOZUM4SQcjs.init_cjs_shims.call(void 0, );
|
|
107
107
|
function refsSorter(a, b) {
|
|
108
108
|
if (_optionalChain([Object, 'access', _10 => _10.keys, 'call', _11 => _11(a.import.refs), 'optionalAccess', _12 => _12.length]) < _optionalChain([Object, 'access', _13 => _13.keys, 'call', _14 => _14(b.import.refs), 'optionalAccess', _15 => _15.length])) {
|
|
109
109
|
return -1;
|
|
@@ -122,5 +122,5 @@ function refsSorter(a, b) {
|
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
|
|
125
|
-
exports.getASTParams = getASTParams; exports.getComments = getComments; exports.getGroupedByTagFiles = getGroupedByTagFiles; exports.getPathParams = getPathParams; exports.getSchemaFactory =
|
|
125
|
+
exports.getASTParams = getASTParams; exports.getComments = getComments; exports.getGroupedByTagFiles = getGroupedByTagFiles; exports.getPathParams = getPathParams; exports.getSchemaFactory = _chunkQOZUM4SQcjs.getSchemaFactory; exports.getSchemas = _chunkQOZUM4SQcjs.getSchemas; exports.parseFromConfig = _chunkWTJWAVHQcjs.parseFromConfig; exports.refsSorter = refsSorter;
|
|
126
126
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/utils.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseFromConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SJ6UVWXR.js";
|
|
4
4
|
import {
|
|
5
5
|
getSchemaFactory,
|
|
6
6
|
getSchemas,
|
|
7
7
|
init_esm_shims
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-57Y7UOGB.js";
|
|
9
9
|
|
|
10
10
|
// src/utils/index.ts
|
|
11
11
|
init_esm_shims();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-oas",
|
|
3
|
-
"version": "2.21.
|
|
3
|
+
"version": "2.21.2",
|
|
4
4
|
"description": "Generator swagger",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
],
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@stoplight/yaml": "^4.3.0",
|
|
70
|
-
"remeda": "^2.2.
|
|
71
|
-
"@kubb/core": "2.21.
|
|
72
|
-
"@kubb/fs": "2.21.
|
|
73
|
-
"@kubb/oas": "2.21.
|
|
74
|
-
"@kubb/react": "2.21.
|
|
70
|
+
"remeda": "^2.2.1",
|
|
71
|
+
"@kubb/core": "2.21.2",
|
|
72
|
+
"@kubb/fs": "2.21.2",
|
|
73
|
+
"@kubb/oas": "2.21.2",
|
|
74
|
+
"@kubb/react": "2.21.2"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/react": "^18.3.3",
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
"react": "^18.3.1",
|
|
80
80
|
"tsup": "^8.1.0",
|
|
81
81
|
"typescript": "^5.5.2",
|
|
82
|
-
"@kubb/config-biome": "2.21.
|
|
83
|
-
"@kubb/config-ts": "2.21.
|
|
84
|
-
"@kubb/config-tsup": "2.21.
|
|
82
|
+
"@kubb/config-biome": "2.21.2",
|
|
83
|
+
"@kubb/config-ts": "2.21.2",
|
|
84
|
+
"@kubb/config-tsup": "2.21.2"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
|
-
"@kubb/react": "2.21.
|
|
87
|
+
"@kubb/react": "2.21.2"
|
|
88
88
|
},
|
|
89
89
|
"engines": {
|
|
90
90
|
"node": ">=18"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|