@kubb/plugin-oas 2.19.0 → 2.19.1
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-P25U53FI.js → chunk-2ET4YKQY.js} +3 -3
- package/dist/{chunk-P25U53FI.js.map → chunk-2ET4YKQY.js.map} +1 -1
- package/dist/{chunk-7BOENSFI.js → chunk-BQKBWVDS.js} +2 -2
- package/dist/{chunk-GVD6HGYS.cjs → chunk-ILFKN72Y.cjs} +3 -3
- package/dist/{chunk-E5W7GRE5.cjs → chunk-KZAW64ZQ.cjs} +27 -27
- package/dist/{chunk-AF4LOGVP.js → chunk-L6JC24QP.js} +2 -2
- package/dist/{chunk-BNNQAPTT.js → chunk-NY2RUVI5.js} +3 -3
- package/dist/{chunk-QJS4KZ57.cjs → chunk-W34TDAOS.cjs} +3 -3
- package/dist/{chunk-QJS4KZ57.cjs.map → chunk-W34TDAOS.cjs.map} +1 -1
- package/dist/{chunk-DHEHSIP5.cjs → chunk-Y2SDFI4S.cjs} +23 -23
- 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 +23 -23
- package/dist/index.js +3 -3
- package/dist/utils.cjs +8 -8
- package/dist/utils.js +2 -2
- package/package.json +9 -9
- /package/dist/{chunk-7BOENSFI.js.map → chunk-BQKBWVDS.js.map} +0 -0
- /package/dist/{chunk-GVD6HGYS.cjs.map → chunk-ILFKN72Y.cjs.map} +0 -0
- /package/dist/{chunk-E5W7GRE5.cjs.map → chunk-KZAW64ZQ.cjs.map} +0 -0
- /package/dist/{chunk-AF4LOGVP.js.map → chunk-L6JC24QP.js.map} +0 -0
- /package/dist/{chunk-BNNQAPTT.js.map → chunk-NY2RUVI5.js.map} +0 -0
- /package/dist/{chunk-DHEHSIP5.cjs.map → chunk-Y2SDFI4S.cjs.map} +0 -0
|
@@ -49,9 +49,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
49
49
|
return method;
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
// ../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.
|
|
52
|
+
// ../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.8_@types+node@20.12.12__postcss@8.4.38_ts-node@10.9._lowhwmpkdo6u62s3emggnwdcfy/node_modules/tsup/assets/esm_shims.js
|
|
53
53
|
var init_esm_shims = __esm({
|
|
54
|
-
"../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.
|
|
54
|
+
"../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.8_@types+node@20.12.12__postcss@8.4.38_ts-node@10.9._lowhwmpkdo6u62s3emggnwdcfy/node_modules/tsup/assets/esm_shims.js"() {
|
|
55
55
|
"use strict";
|
|
56
56
|
}
|
|
57
57
|
});
|
|
@@ -112,4 +112,4 @@ export {
|
|
|
112
112
|
getSchemas,
|
|
113
113
|
getSchemaFactory
|
|
114
114
|
};
|
|
115
|
-
//# sourceMappingURL=chunk-
|
|
115
|
+
//# sourceMappingURL=chunk-2ET4YKQY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.8_@types+node@20.12.12__postcss@8.4.38_ts-node@10.9._lowhwmpkdo6u62s3emggnwdcfy/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-2ET4YKQY.js";
|
|
9
9
|
|
|
10
10
|
// src/SchemaMapper.ts
|
|
11
11
|
init_esm_shims();
|
|
@@ -693,4 +693,4 @@ export {
|
|
|
693
693
|
isKeyword,
|
|
694
694
|
SchemaGenerator
|
|
695
695
|
};
|
|
696
|
-
//# sourceMappingURL=chunk-
|
|
696
|
+
//# sourceMappingURL=chunk-BQKBWVDS.js.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 _chunkW34TDAOScjs = require('./chunk-W34TDAOS.cjs');
|
|
4
4
|
|
|
5
5
|
// src/utils/parseFromConfig.ts
|
|
6
|
-
|
|
6
|
+
_chunkW34TDAOScjs.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-ILFKN72Y.cjs.map
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkW34TDAOScjs = require('./chunk-W34TDAOS.cjs');
|
|
9
9
|
|
|
10
10
|
// src/SchemaMapper.ts
|
|
11
|
-
|
|
11
|
+
_chunkW34TDAOScjs.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
|
+
_chunkW34TDAOScjs.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,27 +70,27 @@ var _usedAliasNames, _getUsedEnumNames, getUsedEnumNames_fn, _getOptions, getOpt
|
|
|
70
70
|
var _SchemaGenerator = class _SchemaGenerator extends _core.Generator {
|
|
71
71
|
constructor() {
|
|
72
72
|
super(...arguments);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
_chunkW34TDAOScjs.__privateAdd.call(void 0, this, _getUsedEnumNames);
|
|
74
|
+
_chunkW34TDAOScjs.__privateAdd.call(void 0, this, _getOptions);
|
|
75
|
+
_chunkW34TDAOScjs.__privateAdd.call(void 0, this, _getUnknownReturn);
|
|
76
76
|
/**
|
|
77
77
|
* Recursively creates a type literal with the given props.
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
_chunkW34TDAOScjs.__privateAdd.call(void 0, this, _parseProperties);
|
|
80
80
|
/**
|
|
81
81
|
* Create a type alias for the schema referenced by the given ReferenceObject
|
|
82
82
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
_chunkW34TDAOScjs.__privateAdd.call(void 0, this, _getRefAlias);
|
|
84
|
+
_chunkW34TDAOScjs.__privateAdd.call(void 0, this, _getParsedSchemaObject);
|
|
85
85
|
/**
|
|
86
86
|
* This is the very core of the OpenAPI to TS conversion - it takes a
|
|
87
87
|
* schema and returns the appropriate type.
|
|
88
88
|
*/
|
|
89
|
-
|
|
89
|
+
_chunkW34TDAOScjs.__privateAdd.call(void 0, this, _parseSchemaObject);
|
|
90
90
|
// Collect the types of all referenced schemas, so we can export them later
|
|
91
91
|
this.refs = {};
|
|
92
92
|
// Keep track of already used type aliases
|
|
93
|
-
|
|
93
|
+
_chunkW34TDAOScjs.__privateAdd.call(void 0, this, _usedAliasNames, {});
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* Creates a type node from a given schema.
|
|
@@ -98,8 +98,8 @@ var _SchemaGenerator = class _SchemaGenerator extends _core.Generator {
|
|
|
98
98
|
* optionally adds a union with null.
|
|
99
99
|
*/
|
|
100
100
|
parse(props) {
|
|
101
|
-
const options =
|
|
102
|
-
const defaultSchemas =
|
|
101
|
+
const options = _chunkW34TDAOScjs.__privateMethod.call(void 0, this, _getOptions, getOptions_fn).call(this, props);
|
|
102
|
+
const defaultSchemas = _chunkW34TDAOScjs.__privateMethod.call(void 0, this, _parseSchemaObject, parseSchemaObject_fn).call(this, props);
|
|
103
103
|
const schemas = _optionalChain([options, 'access', _ => _.transformers, 'optionalAccess', _2 => _2.schema, 'optionalCall', _3 => _3(props, defaultSchemas)]) || defaultSchemas || [];
|
|
104
104
|
return _remeda.uniqueWith.call(void 0, schemas, _remeda.isDeepEqual);
|
|
105
105
|
}
|
|
@@ -216,9 +216,9 @@ var _SchemaGenerator = class _SchemaGenerator extends _core.Generator {
|
|
|
216
216
|
}
|
|
217
217
|
async build() {
|
|
218
218
|
const { oas, contentType, include } = this.context;
|
|
219
|
-
const schemas =
|
|
219
|
+
const schemas = _chunkW34TDAOScjs.getSchemas.call(void 0, { oas, contentType, includes: include });
|
|
220
220
|
const promises = Object.entries(schemas).reduce((acc, [name, schema]) => {
|
|
221
|
-
const options =
|
|
221
|
+
const options = _chunkW34TDAOScjs.__privateMethod.call(void 0, this, _getOptions, getOptions_fn).call(this, { name });
|
|
222
222
|
const promiseOperation = this.schema.call(this, name, schema, {
|
|
223
223
|
...this.options,
|
|
224
224
|
...options
|
|
@@ -235,7 +235,7 @@ var _SchemaGenerator = class _SchemaGenerator extends _core.Generator {
|
|
|
235
235
|
_usedAliasNames = new WeakMap();
|
|
236
236
|
_getUsedEnumNames = new WeakSet();
|
|
237
237
|
getUsedEnumNames_fn = function(props) {
|
|
238
|
-
const options =
|
|
238
|
+
const options = _chunkW34TDAOScjs.__privateMethod.call(void 0, this, _getOptions, getOptions_fn).call(this, props);
|
|
239
239
|
return options.usedEnumNames || {};
|
|
240
240
|
};
|
|
241
241
|
_getOptions = new WeakSet();
|
|
@@ -253,7 +253,7 @@ getOptions_fn = function({ name }) {
|
|
|
253
253
|
};
|
|
254
254
|
_getUnknownReturn = new WeakSet();
|
|
255
255
|
getUnknownReturn_fn = function(props) {
|
|
256
|
-
const options =
|
|
256
|
+
const options = _chunkW34TDAOScjs.__privateMethod.call(void 0, this, _getOptions, getOptions_fn).call(this, props);
|
|
257
257
|
if (options.unknownType === "any") {
|
|
258
258
|
return schemaKeywords.any;
|
|
259
259
|
}
|
|
@@ -285,7 +285,7 @@ parseProperties_fn = function({ schema, name }) {
|
|
|
285
285
|
}).reduce((acc, curr) => ({ ...acc, ...curr }), {});
|
|
286
286
|
let additionalPropertiesSchemas = [];
|
|
287
287
|
if (additionalProperties) {
|
|
288
|
-
additionalPropertiesSchemas = additionalProperties === true ? [{ keyword:
|
|
288
|
+
additionalPropertiesSchemas = additionalProperties === true ? [{ keyword: _chunkW34TDAOScjs.__privateMethod.call(void 0, this, _getUnknownReturn, getUnknownReturn_fn).call(this, { schema, name }) }] : this.parse({ schema: additionalProperties, parentName: name });
|
|
289
289
|
}
|
|
290
290
|
return [
|
|
291
291
|
{
|
|
@@ -301,7 +301,7 @@ _getRefAlias = new WeakSet();
|
|
|
301
301
|
getRefAlias_fn = function(obj) {
|
|
302
302
|
const { $ref } = obj;
|
|
303
303
|
let ref = this.refs[$ref];
|
|
304
|
-
const originalName = _utils.getUniqueName.call(void 0, $ref.replace(/.+\//, ""),
|
|
304
|
+
const originalName = _utils.getUniqueName.call(void 0, $ref.replace(/.+\//, ""), _chunkW34TDAOScjs.__privateGet.call(void 0, this, _usedAliasNames));
|
|
305
305
|
const propertyName = this.context.pluginManager.resolveName({
|
|
306
306
|
name: originalName,
|
|
307
307
|
pluginKey: this.context.plugin.key,
|
|
@@ -339,14 +339,14 @@ getRefAlias_fn = function(obj) {
|
|
|
339
339
|
};
|
|
340
340
|
_getParsedSchemaObject = new WeakSet();
|
|
341
341
|
getParsedSchemaObject_fn = function(schema) {
|
|
342
|
-
const parsedSchema =
|
|
342
|
+
const parsedSchema = _chunkW34TDAOScjs.getSchemaFactory.call(void 0, this.context.oas)(schema);
|
|
343
343
|
return parsedSchema;
|
|
344
344
|
};
|
|
345
345
|
_parseSchemaObject = new WeakSet();
|
|
346
346
|
parseSchemaObject_fn = function({ schema: _schema, name, parentName }) {
|
|
347
|
-
const options =
|
|
348
|
-
const unknownReturn =
|
|
349
|
-
const { schema, version } =
|
|
347
|
+
const options = _chunkW34TDAOScjs.__privateMethod.call(void 0, this, _getOptions, getOptions_fn).call(this, { schema: _schema, name });
|
|
348
|
+
const unknownReturn = _chunkW34TDAOScjs.__privateMethod.call(void 0, this, _getUnknownReturn, getUnknownReturn_fn).call(this, { schema: _schema, name });
|
|
349
|
+
const { schema, version } = _chunkW34TDAOScjs.__privateMethod.call(void 0, this, _getParsedSchemaObject, getParsedSchemaObject_fn).call(this, _schema);
|
|
350
350
|
const resolvedName = this.context.pluginManager.resolveName({
|
|
351
351
|
name: `${parentName || ""} ${name}`,
|
|
352
352
|
pluginKey: this.context.plugin.key,
|
|
@@ -413,7 +413,7 @@ parseSchemaObject_fn = function({ schema: _schema, name, parentName }) {
|
|
|
413
413
|
}
|
|
414
414
|
if (_oas.isReference.call(void 0, schema)) {
|
|
415
415
|
return [
|
|
416
|
-
...
|
|
416
|
+
..._chunkW34TDAOScjs.__privateMethod.call(void 0, this, _getRefAlias, getRefAlias_fn).call(this, schema),
|
|
417
417
|
nullable && { keyword: schemaKeywords.nullable },
|
|
418
418
|
{
|
|
419
419
|
keyword: schemaKeywords.schema,
|
|
@@ -487,7 +487,7 @@ parseSchemaObject_fn = function({ schema: _schema, name, parentName }) {
|
|
|
487
487
|
return [and, ...baseItems];
|
|
488
488
|
}
|
|
489
489
|
if (schema.enum) {
|
|
490
|
-
const enumName = _utils.getUniqueName.call(void 0, _transformers.pascalCase.call(void 0, [parentName, name, options.enumSuffix].join(" ")),
|
|
490
|
+
const enumName = _utils.getUniqueName.call(void 0, _transformers.pascalCase.call(void 0, [parentName, name, options.enumSuffix].join(" ")), _chunkW34TDAOScjs.__privateMethod.call(void 0, this, _getUsedEnumNames, getUsedEnumNames_fn).call(this, { schema, name }));
|
|
491
491
|
const typeName = this.context.pluginManager.resolveName({
|
|
492
492
|
name: enumName,
|
|
493
493
|
pluginKey: this.context.plugin.key,
|
|
@@ -665,7 +665,7 @@ parseSchemaObject_fn = function({ schema: _schema, name, parentName }) {
|
|
|
665
665
|
];
|
|
666
666
|
}
|
|
667
667
|
if (schema.properties || schema.additionalProperties) {
|
|
668
|
-
return [...
|
|
668
|
+
return [..._chunkW34TDAOScjs.__privateMethod.call(void 0, this, _parseProperties, parseProperties_fn).call(this, { schema, name }), ...baseItems];
|
|
669
669
|
}
|
|
670
670
|
if (schema.type) {
|
|
671
671
|
if (Array.isArray(schema.type)) {
|
|
@@ -693,4 +693,4 @@ var SchemaGenerator = _SchemaGenerator;
|
|
|
693
693
|
|
|
694
694
|
|
|
695
695
|
exports.schemaKeywords = schemaKeywords; exports.isKeyword = isKeyword; exports.SchemaGenerator = SchemaGenerator;
|
|
696
|
-
//# sourceMappingURL=chunk-
|
|
696
|
+
//# sourceMappingURL=chunk-KZAW64ZQ.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_esm_shims
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2ET4YKQY.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-L6JC24QP.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SchemaGenerator,
|
|
3
3
|
schemaKeywords
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BQKBWVDS.js";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__toESM,
|
|
8
8
|
init_esm_shims
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2ET4YKQY.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({
|
|
@@ -3291,4 +3291,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
3291
3291
|
* LICENSE file in the root directory of this source tree.
|
|
3292
3292
|
*)
|
|
3293
3293
|
*/
|
|
3294
|
-
//# sourceMappingURL=chunk-
|
|
3294
|
+
//# sourceMappingURL=chunk-NY2RUVI5.js.map
|
|
@@ -49,9 +49,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
49
49
|
return method;
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
// ../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.
|
|
52
|
+
// ../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.8_@types+node@20.12.12__postcss@8.4.38_ts-node@10.9._lowhwmpkdo6u62s3emggnwdcfy/node_modules/tsup/assets/cjs_shims.js
|
|
53
53
|
var init_cjs_shims = __esm({
|
|
54
|
-
"../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.
|
|
54
|
+
"../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.8_@types+node@20.12.12__postcss@8.4.38_ts-node@10.9._lowhwmpkdo6u62s3emggnwdcfy/node_modules/tsup/assets/cjs_shims.js"() {
|
|
55
55
|
"use strict";
|
|
56
56
|
}
|
|
57
57
|
});
|
|
@@ -112,4 +112,4 @@ function getSchemaFactory(oas) {
|
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
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;
|
|
115
|
-
//# sourceMappingURL=chunk-
|
|
115
|
+
//# sourceMappingURL=chunk-W34TDAOS.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.8_@types+node@20.12.12__postcss@8.4.38_ts-node@10.9._lowhwmpkdo6u62s3emggnwdcfy/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,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 _chunkKZAW64ZQcjs = require('./chunk-KZAW64ZQ.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkW34TDAOScjs = require('./chunk-W34TDAOS.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 = _chunkW34TDAOScjs.__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
|
+
_chunkW34TDAOScjs.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");
|
|
@@ -309,10 +309,10 @@ var require_react_production_min = _chunkQJS4KZ57cjs.__commonJS.call(void 0, {
|
|
|
309
309
|
});
|
|
310
310
|
|
|
311
311
|
// ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js
|
|
312
|
-
var require_react_development =
|
|
312
|
+
var require_react_development = _chunkW34TDAOScjs.__commonJS.call(void 0, {
|
|
313
313
|
"../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js"(exports, module) {
|
|
314
314
|
"use strict";
|
|
315
|
-
|
|
315
|
+
_chunkW34TDAOScjs.init_cjs_shims.call(void 0, );
|
|
316
316
|
if (process.env.NODE_ENV !== "production") {
|
|
317
317
|
(function() {
|
|
318
318
|
"use strict";
|
|
@@ -2184,10 +2184,10 @@ var require_react_development = _chunkQJS4KZ57cjs.__commonJS.call(void 0, {
|
|
|
2184
2184
|
});
|
|
2185
2185
|
|
|
2186
2186
|
// ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
2187
|
-
var require_react =
|
|
2187
|
+
var require_react = _chunkW34TDAOScjs.__commonJS.call(void 0, {
|
|
2188
2188
|
"../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"(exports, module) {
|
|
2189
2189
|
"use strict";
|
|
2190
|
-
|
|
2190
|
+
_chunkW34TDAOScjs.init_cjs_shims.call(void 0, );
|
|
2191
2191
|
if (process.env.NODE_ENV === "production") {
|
|
2192
2192
|
module.exports = require_react_production_min();
|
|
2193
2193
|
} else {
|
|
@@ -2197,10 +2197,10 @@ var require_react = _chunkQJS4KZ57cjs.__commonJS.call(void 0, {
|
|
|
2197
2197
|
});
|
|
2198
2198
|
|
|
2199
2199
|
// ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js
|
|
2200
|
-
var require_react_jsx_runtime_production_min =
|
|
2200
|
+
var require_react_jsx_runtime_production_min = _chunkW34TDAOScjs.__commonJS.call(void 0, {
|
|
2201
2201
|
"../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js"(exports) {
|
|
2202
2202
|
"use strict";
|
|
2203
|
-
|
|
2203
|
+
_chunkW34TDAOScjs.init_cjs_shims.call(void 0, );
|
|
2204
2204
|
var f = require_react();
|
|
2205
2205
|
var k = Symbol.for("react.element");
|
|
2206
2206
|
var l = Symbol.for("react.fragment");
|
|
@@ -2226,10 +2226,10 @@ var require_react_jsx_runtime_production_min = _chunkQJS4KZ57cjs.__commonJS.call
|
|
|
2226
2226
|
});
|
|
2227
2227
|
|
|
2228
2228
|
// ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js
|
|
2229
|
-
var require_react_jsx_runtime_development =
|
|
2229
|
+
var require_react_jsx_runtime_development = _chunkW34TDAOScjs.__commonJS.call(void 0, {
|
|
2230
2230
|
"../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js"(exports) {
|
|
2231
2231
|
"use strict";
|
|
2232
|
-
|
|
2232
|
+
_chunkW34TDAOScjs.init_cjs_shims.call(void 0, );
|
|
2233
2233
|
if (process.env.NODE_ENV !== "production") {
|
|
2234
2234
|
(function() {
|
|
2235
2235
|
"use strict";
|
|
@@ -3120,10 +3120,10 @@ var require_react_jsx_runtime_development = _chunkQJS4KZ57cjs.__commonJS.call(vo
|
|
|
3120
3120
|
});
|
|
3121
3121
|
|
|
3122
3122
|
// ../../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js
|
|
3123
|
-
var require_jsx_runtime =
|
|
3123
|
+
var require_jsx_runtime = _chunkW34TDAOScjs.__commonJS.call(void 0, {
|
|
3124
3124
|
"../../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js"(exports, module) {
|
|
3125
3125
|
"use strict";
|
|
3126
|
-
|
|
3126
|
+
_chunkW34TDAOScjs.init_cjs_shims.call(void 0, );
|
|
3127
3127
|
if (process.env.NODE_ENV === "production") {
|
|
3128
3128
|
module.exports = require_react_jsx_runtime_production_min();
|
|
3129
3129
|
} else {
|
|
@@ -3133,8 +3133,8 @@ var require_jsx_runtime = _chunkQJS4KZ57cjs.__commonJS.call(void 0, {
|
|
|
3133
3133
|
});
|
|
3134
3134
|
|
|
3135
3135
|
// src/components/Operation.tsx
|
|
3136
|
-
|
|
3137
|
-
var import_jsx_runtime =
|
|
3136
|
+
_chunkW34TDAOScjs.init_cjs_shims.call(void 0, );
|
|
3137
|
+
var import_jsx_runtime = _chunkW34TDAOScjs.__toESM.call(void 0, require_jsx_runtime(), 1);
|
|
3138
3138
|
var _react = require('@kubb/react');
|
|
3139
3139
|
var OperationContext = _react.createContext.call(void 0, {});
|
|
3140
3140
|
function Operation({ operation, children }) {
|
|
@@ -3143,13 +3143,13 @@ function Operation({ operation, children }) {
|
|
|
3143
3143
|
Operation.Context = OperationContext;
|
|
3144
3144
|
|
|
3145
3145
|
// src/hooks/useSchema.ts
|
|
3146
|
-
|
|
3146
|
+
_chunkW34TDAOScjs.init_cjs_shims.call(void 0, );
|
|
3147
3147
|
|
|
3148
3148
|
|
|
3149
3149
|
// src/components/Schema.tsx
|
|
3150
|
-
|
|
3150
|
+
_chunkW34TDAOScjs.init_cjs_shims.call(void 0, );
|
|
3151
3151
|
|
|
3152
|
-
var import_jsx_runtime2 =
|
|
3152
|
+
var import_jsx_runtime2 = _chunkW34TDAOScjs.__toESM.call(void 0, require_jsx_runtime(), 1);
|
|
3153
3153
|
var SchemaContext = _react.createContext.call(void 0, {
|
|
3154
3154
|
name: "unknown",
|
|
3155
3155
|
tree: []
|
|
@@ -3211,7 +3211,7 @@ Schema.File = function({ output, isTypeOnly, children }) {
|
|
|
3211
3211
|
Schema.Imports = ({ isTypeOnly }) => {
|
|
3212
3212
|
const { tree } = useSchema();
|
|
3213
3213
|
const { path: root } = _react.useFile.call(void 0, );
|
|
3214
|
-
const refs =
|
|
3214
|
+
const refs = _chunkKZAW64ZQcjs.SchemaGenerator.deepSearch(tree, _chunkKZAW64ZQcjs.schemaKeywords.ref);
|
|
3215
3215
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: _optionalChain([refs, 'optionalAccess', _ => _.map, 'call', _2 => _2((item, i) => {
|
|
3216
3216
|
if (!item.args.path) {
|
|
3217
3217
|
return void 0;
|
|
@@ -3228,9 +3228,9 @@ function useSchema() {
|
|
|
3228
3228
|
}
|
|
3229
3229
|
|
|
3230
3230
|
// src/components/Oas.tsx
|
|
3231
|
-
|
|
3231
|
+
_chunkW34TDAOScjs.init_cjs_shims.call(void 0, );
|
|
3232
3232
|
|
|
3233
|
-
var import_jsx_runtime3 =
|
|
3233
|
+
var import_jsx_runtime3 = _chunkW34TDAOScjs.__toESM.call(void 0, require_jsx_runtime(), 1);
|
|
3234
3234
|
var OasContext = _react.createContext.call(void 0, {});
|
|
3235
3235
|
function Oas({ oas, children, operations, generator }) {
|
|
3236
3236
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(OasContext.Provider, { value: { oas, generator, operations }, children });
|
|
@@ -3291,4 +3291,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
3291
3291
|
* LICENSE file in the root directory of this source tree.
|
|
3292
3292
|
*)
|
|
3293
3293
|
*/
|
|
3294
|
-
//# sourceMappingURL=chunk-
|
|
3294
|
+
//# sourceMappingURL=chunk-Y2SDFI4S.cjs.map
|
package/dist/components.cjs
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
5
|
+
var _chunkY2SDFI4Scjs = require('./chunk-Y2SDFI4S.cjs');
|
|
6
|
+
require('./chunk-KZAW64ZQ.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkW34TDAOScjs = require('./chunk-W34TDAOS.cjs');
|
|
10
10
|
|
|
11
11
|
// src/components/index.ts
|
|
12
|
-
|
|
12
|
+
_chunkW34TDAOScjs.init_cjs_shims.call(void 0, );
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.Oas =
|
|
17
|
+
exports.Oas = _chunkY2SDFI4Scjs.Oas; exports.Operation = _chunkY2SDFI4Scjs.Operation; exports.Schema = _chunkY2SDFI4Scjs.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-NY2RUVI5.js";
|
|
6
|
+
import "./chunk-BQKBWVDS.js";
|
|
7
7
|
import {
|
|
8
8
|
init_esm_shims
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2ET4YKQY.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 _chunkY2SDFI4Scjs = require('./chunk-Y2SDFI4S.cjs');
|
|
6
|
+
require('./chunk-KZAW64ZQ.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkW34TDAOScjs = require('./chunk-W34TDAOS.cjs');
|
|
10
10
|
|
|
11
11
|
// src/hooks/index.ts
|
|
12
|
-
|
|
12
|
+
_chunkW34TDAOScjs.init_cjs_shims.call(void 0, );
|
|
13
13
|
|
|
14
14
|
// src/hooks/useOas.ts
|
|
15
|
-
|
|
15
|
+
_chunkW34TDAOScjs.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, _chunkY2SDFI4Scjs.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
|
+
_chunkW34TDAOScjs.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, _chunkY2SDFI4Scjs.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
|
+
_chunkW34TDAOScjs.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, _chunkY2SDFI4Scjs.Oas.Context);
|
|
42
42
|
if (!generator) {
|
|
43
43
|
throw new Error(`'generator' is not defined`);
|
|
44
44
|
}
|
|
@@ -126,10 +126,10 @@ function useOperationManager() {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
// src/hooks/useOperations.ts
|
|
129
|
-
|
|
129
|
+
_chunkW34TDAOScjs.init_cjs_shims.call(void 0, );
|
|
130
130
|
|
|
131
131
|
function useOperations({ method, path } = {}) {
|
|
132
|
-
const { operations } = _react.useContext.call(void 0,
|
|
132
|
+
const { operations } = _react.useContext.call(void 0, _chunkY2SDFI4Scjs.Oas.Context);
|
|
133
133
|
if (!operations) {
|
|
134
134
|
throw new Error("Operations is not defined");
|
|
135
135
|
}
|
|
@@ -148,5 +148,5 @@ function useOperations({ method, path } = {}) {
|
|
|
148
148
|
|
|
149
149
|
|
|
150
150
|
|
|
151
|
-
exports.useOas = useOas; exports.useOperation = useOperation; exports.useOperationManager = useOperationManager; exports.useOperations = useOperations; exports.useSchema =
|
|
151
|
+
exports.useOas = useOas; exports.useOperation = useOperation; exports.useOperationManager = useOperationManager; exports.useOperations = useOperations; exports.useSchema = _chunkY2SDFI4Scjs.useSchema;
|
|
152
152
|
//# 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-NY2RUVI5.js";
|
|
6
|
+
import "./chunk-BQKBWVDS.js";
|
|
7
7
|
import {
|
|
8
8
|
init_esm_shims
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2ET4YKQY.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 _chunkILFKN72Ycjs = require('./chunk-ILFKN72Y.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkKZAW64ZQcjs = require('./chunk-KZAW64ZQ.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -13,13 +13,13 @@ var _chunkE5W7GRE5cjs = require('./chunk-E5W7GRE5.cjs');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkW34TDAOScjs = require('./chunk-W34TDAOS.cjs');
|
|
17
17
|
|
|
18
18
|
// src/index.ts
|
|
19
|
-
|
|
19
|
+
_chunkW34TDAOScjs.init_cjs_shims.call(void 0, );
|
|
20
20
|
|
|
21
21
|
// src/plugin.ts
|
|
22
|
-
|
|
22
|
+
_chunkW34TDAOScjs.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 _chunkILFKN72Ycjs.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 _chunkILFKN72Ycjs.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 _chunkW34TDAOScjs.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 = _chunkW34TDAOScjs.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,32 +126,32 @@ var pluginOas = _core.createPlugin.call(void 0, (options) => {
|
|
|
126
126
|
});
|
|
127
127
|
|
|
128
128
|
// src/OperationGenerator.ts
|
|
129
|
-
|
|
129
|
+
_chunkW34TDAOScjs.init_cjs_shims.call(void 0, );
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
var _operationsByMethod, _getOptions, getOptions_fn, _isExcluded, isExcluded_fn, _isIncluded, isIncluded_fn, _methods, methods_get;
|
|
133
133
|
var OperationGenerator = class extends _core.Generator {
|
|
134
134
|
constructor() {
|
|
135
135
|
super(...arguments);
|
|
136
|
-
|
|
136
|
+
_chunkW34TDAOScjs.__privateAdd.call(void 0, this, _getOptions);
|
|
137
137
|
/**
|
|
138
138
|
*
|
|
139
139
|
* @deprecated
|
|
140
140
|
*/
|
|
141
|
-
|
|
141
|
+
_chunkW34TDAOScjs.__privateAdd.call(void 0, this, _isExcluded);
|
|
142
142
|
/**
|
|
143
143
|
*
|
|
144
144
|
* @deprecated
|
|
145
145
|
*/
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
_chunkW34TDAOScjs.__privateAdd.call(void 0, this, _isIncluded);
|
|
147
|
+
_chunkW34TDAOScjs.__privateAdd.call(void 0, this, _methods);
|
|
148
|
+
_chunkW34TDAOScjs.__privateAdd.call(void 0, this, _operationsByMethod, {});
|
|
149
149
|
}
|
|
150
150
|
get operationsByMethod() {
|
|
151
|
-
return
|
|
151
|
+
return _chunkW34TDAOScjs.__privateGet.call(void 0, this, _operationsByMethod);
|
|
152
152
|
}
|
|
153
153
|
set operationsByMethod(paths) {
|
|
154
|
-
|
|
154
|
+
_chunkW34TDAOScjs.__privateSet.call(void 0, this, _operationsByMethod, paths);
|
|
155
155
|
}
|
|
156
156
|
getSchemas(operation, forStatusCode) {
|
|
157
157
|
const pathParamsSchema = this.context.oas.getParametersSchema(operation, "path");
|
|
@@ -234,9 +234,9 @@ var OperationGenerator = class extends _core.Generator {
|
|
|
234
234
|
const methods = Object.keys(method);
|
|
235
235
|
methods.forEach((method2) => {
|
|
236
236
|
const operation = oas.operation(path2, method2);
|
|
237
|
-
if (operation &&
|
|
238
|
-
const isExcluded =
|
|
239
|
-
const isIncluded = this.context.include ?
|
|
237
|
+
if (operation && _chunkW34TDAOScjs.__privateGet.call(void 0, this, _methods, methods_get)[method2]) {
|
|
238
|
+
const isExcluded = _chunkW34TDAOScjs.__privateMethod.call(void 0, this, _isExcluded, isExcluded_fn).call(this, operation, method2);
|
|
239
|
+
const isIncluded = this.context.include ? _chunkW34TDAOScjs.__privateMethod.call(void 0, this, _isIncluded, isIncluded_fn).call(this, operation, method2) : true;
|
|
240
240
|
if (isIncluded && !isExcluded) {
|
|
241
241
|
if (!acc[path2]) {
|
|
242
242
|
acc[path2] = {};
|
|
@@ -257,8 +257,8 @@ var OperationGenerator = class extends _core.Generator {
|
|
|
257
257
|
const methods = this.operationsByMethod[path2] ? Object.keys(this.operationsByMethod[path2]) : [];
|
|
258
258
|
methods.forEach((method) => {
|
|
259
259
|
const { operation } = _optionalChain([this, 'access', _37 => _37.operationsByMethod, 'access', _38 => _38[path2], 'optionalAccess', _39 => _39[method]]);
|
|
260
|
-
const options =
|
|
261
|
-
const promiseMethod = _optionalChain([
|
|
260
|
+
const options = _chunkW34TDAOScjs.__privateMethod.call(void 0, this, _getOptions, getOptions_fn).call(this, operation, method);
|
|
261
|
+
const promiseMethod = _optionalChain([_chunkW34TDAOScjs.__privateGet.call(void 0, this, _methods, methods_get), 'access', _40 => _40[method], 'optionalAccess', _41 => _41.call, 'call', _42 => _42(this, operation, {
|
|
262
262
|
...this.options,
|
|
263
263
|
...options
|
|
264
264
|
})]);
|
|
@@ -408,5 +408,5 @@ var src_default = definePluginDefault;
|
|
|
408
408
|
|
|
409
409
|
|
|
410
410
|
|
|
411
|
-
exports.OperationGenerator = OperationGenerator; exports.SchemaGenerator =
|
|
411
|
+
exports.OperationGenerator = OperationGenerator; exports.SchemaGenerator = _chunkKZAW64ZQcjs.SchemaGenerator; exports.default = src_default; exports.isKeyword = _chunkKZAW64ZQcjs.isKeyword; exports.pluginOas = pluginOas; exports.pluginOasName = pluginOasName; exports.schemaKeywords = _chunkKZAW64ZQcjs.schemaKeywords;
|
|
412
412
|
//# 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-L6JC24QP.js";
|
|
4
4
|
import {
|
|
5
5
|
SchemaGenerator,
|
|
6
6
|
isKeyword,
|
|
7
7
|
schemaKeywords
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BQKBWVDS.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-2ET4YKQY.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 _chunkILFKN72Ycjs = require('./chunk-ILFKN72Y.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkW34TDAOScjs = require('./chunk-W34TDAOS.cjs');
|
|
9
9
|
|
|
10
10
|
// src/utils/index.ts
|
|
11
|
-
|
|
11
|
+
_chunkW34TDAOScjs.init_cjs_shims.call(void 0, );
|
|
12
12
|
|
|
13
13
|
// src/utils/getComments.ts
|
|
14
|
-
|
|
14
|
+
_chunkW34TDAOScjs.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
|
+
_chunkW34TDAOScjs.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
|
+
_chunkW34TDAOScjs.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
|
+
_chunkW34TDAOScjs.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 = _chunkW34TDAOScjs.getSchemaFactory; exports.getSchemas = _chunkW34TDAOScjs.getSchemas; exports.parseFromConfig = _chunkILFKN72Ycjs.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-L6JC24QP.js";
|
|
4
4
|
import {
|
|
5
5
|
getSchemaFactory,
|
|
6
6
|
getSchemas,
|
|
7
7
|
init_esm_shims
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2ET4YKQY.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.19.
|
|
3
|
+
"version": "2.19.1",
|
|
4
4
|
"description": "Generator swagger",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -68,10 +68,10 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@stoplight/yaml": "^4.3.0",
|
|
70
70
|
"remeda": "^1.61.0",
|
|
71
|
-
"@kubb/core": "2.19.
|
|
72
|
-
"@kubb/fs": "2.19.
|
|
73
|
-
"@kubb/oas": "2.19.
|
|
74
|
-
"@kubb/react": "2.19.
|
|
71
|
+
"@kubb/core": "2.19.1",
|
|
72
|
+
"@kubb/fs": "2.19.1",
|
|
73
|
+
"@kubb/oas": "2.19.1",
|
|
74
|
+
"@kubb/react": "2.19.1"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/react": "^18.3.2",
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
"react": "^18.3.1",
|
|
80
80
|
"tsup": "^8.0.2",
|
|
81
81
|
"typescript": "^5.4.5",
|
|
82
|
-
"@kubb/config-biome": "2.19.
|
|
83
|
-
"@kubb/config-ts": "2.19.
|
|
84
|
-
"@kubb/config-tsup": "2.19.
|
|
82
|
+
"@kubb/config-biome": "2.19.1",
|
|
83
|
+
"@kubb/config-ts": "2.19.1",
|
|
84
|
+
"@kubb/config-tsup": "2.19.1"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
|
-
"@kubb/react": "2.19.
|
|
87
|
+
"@kubb/react": "2.19.1"
|
|
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
|