@kubb/plugin-oas 3.16.1 → 3.16.3
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/Oas-CuqAnIw-.js +60 -0
- package/dist/Oas-CuqAnIw-.js.map +1 -0
- package/dist/Oas-Cv_pyXRM.cjs +78 -0
- package/dist/Oas-Cv_pyXRM.cjs.map +1 -0
- package/dist/OperationGenerator-CgbXErhW.d.cts +900 -0
- package/dist/OperationGenerator-OtLcGk2y.d.ts +900 -0
- package/dist/Schema-DJshqHto.d.cts +38 -0
- package/dist/Schema-DOXGUW1m.d.ts +38 -0
- package/dist/SchemaGenerator-8205BXCp.cjs +942 -0
- package/dist/SchemaGenerator-8205BXCp.cjs.map +1 -0
- package/dist/SchemaGenerator-B8Io6kky.js +930 -0
- package/dist/SchemaGenerator-B8Io6kky.js.map +1 -0
- package/dist/SchemaMapper-BaZQKrQB.js +54 -0
- package/dist/SchemaMapper-BaZQKrQB.js.map +1 -0
- package/dist/SchemaMapper-BiagBQN4.d.cts +388 -0
- package/dist/SchemaMapper-C2J2d3o4.d.ts +388 -0
- package/dist/SchemaMapper-D8J0V9Pj.cjs +66 -0
- package/dist/SchemaMapper-D8J0V9Pj.cjs.map +1 -0
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/components.cjs +4 -19
- package/dist/components.d.cts +42 -35
- package/dist/components.d.ts +42 -35
- package/dist/components.js +3 -3
- package/dist/generators-BhLMlRNk.js +137 -0
- package/dist/generators-BhLMlRNk.js.map +1 -0
- package/dist/generators-DLH2kvlh.cjs +155 -0
- package/dist/generators-DLH2kvlh.cjs.map +1 -0
- package/dist/generators.cjs +4 -13
- package/dist/generators.d.cts +5 -7
- package/dist/generators.d.ts +5 -7
- package/dist/generators.js +5 -5
- package/dist/getFooter-BChY2kC1.cjs +43 -0
- package/dist/getFooter-BChY2kC1.cjs.map +1 -0
- package/dist/getFooter-T7_pZ6f8.js +31 -0
- package/dist/getFooter-T7_pZ6f8.js.map +1 -0
- package/dist/getSchemas-D8mP129c.cjs +67 -0
- package/dist/getSchemas-D8mP129c.cjs.map +1 -0
- package/dist/getSchemas-WoSBIxG8.js +55 -0
- package/dist/getSchemas-WoSBIxG8.js.map +1 -0
- package/dist/hooks.cjs +213 -195
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +91 -86
- package/dist/hooks.d.ts +91 -86
- package/dist/hooks.js +212 -193
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +280 -344
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -10
- package/dist/index.d.ts +7 -10
- package/dist/index.js +274 -318
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +802 -737
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +12 -11
- package/dist/mocks.d.ts +12 -11
- package/dist/mocks.js +802 -735
- package/dist/mocks.js.map +1 -1
- package/dist/parseFromConfig-CMNGsef2.cjs +33 -0
- package/dist/parseFromConfig-CMNGsef2.cjs.map +1 -0
- package/dist/parseFromConfig-yAiFK03V.js +27 -0
- package/dist/parseFromConfig-yAiFK03V.js.map +1 -0
- package/dist/utils.cjs +58 -74
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +96 -42
- package/dist/utils.d.ts +96 -42
- package/dist/utils.js +47 -46
- package/dist/utils.js.map +1 -1
- package/package.json +28 -36
- package/src/SchemaGenerator.ts +6 -1
- package/src/components/Operation.tsx +1 -2
- package/src/mocks/schemas.ts +39 -0
- package/src/utils/getBanner.ts +5 -5
- package/src/utils/getFooter.ts +4 -4
- package/dist/OperationGenerator-C7NPZtOM.d.ts +0 -288
- package/dist/OperationGenerator-DJE2XQ83.d.cts +0 -288
- package/dist/Schema-AjebpeVY.d.ts +0 -32
- package/dist/Schema-M6983FL1.d.cts +0 -32
- package/dist/SchemaMapper-B21ZmWag.d.cts +0 -275
- package/dist/SchemaMapper-B21ZmWag.d.ts +0 -275
- package/dist/chunk-6S7YFY6F.js +0 -33
- package/dist/chunk-6S7YFY6F.js.map +0 -1
- package/dist/chunk-76E35IZ2.js +0 -56
- package/dist/chunk-76E35IZ2.js.map +0 -1
- package/dist/chunk-7RFNM43R.cjs +0 -41
- package/dist/chunk-7RFNM43R.cjs.map +0 -1
- package/dist/chunk-DTD4ZUDA.cjs +0 -36
- package/dist/chunk-DTD4ZUDA.cjs.map +0 -1
- package/dist/chunk-G3FDK7YW.js +0 -35
- package/dist/chunk-G3FDK7YW.js.map +0 -1
- package/dist/chunk-JNN4JPWK.js +0 -28
- package/dist/chunk-JNN4JPWK.js.map +0 -1
- package/dist/chunk-MBX66JAT.js +0 -93
- package/dist/chunk-MBX66JAT.js.map +0 -1
- package/dist/chunk-NFLZLRQS.cjs +0 -869
- package/dist/chunk-NFLZLRQS.cjs.map +0 -1
- package/dist/chunk-P2VXWGXZ.js +0 -862
- package/dist/chunk-P2VXWGXZ.js.map +0 -1
- package/dist/chunk-PORSNYI5.js +0 -47
- package/dist/chunk-PORSNYI5.js.map +0 -1
- package/dist/chunk-QJMOOF2A.cjs +0 -97
- package/dist/chunk-QJMOOF2A.cjs.map +0 -1
- package/dist/chunk-YWMMI3MO.cjs +0 -59
- package/dist/chunk-YWMMI3MO.cjs.map +0 -1
- package/dist/chunk-Z2NREI4X.cjs +0 -32
- package/dist/chunk-Z2NREI4X.cjs.map +0 -1
- package/dist/chunk-ZVFL3NXX.cjs +0 -50
- package/dist/chunk-ZVFL3NXX.cjs.map +0 -1
- package/dist/components.cjs.map +0 -1
- package/dist/components.js.map +0 -1
- package/dist/generators.cjs.map +0 -1
- package/dist/generators.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/parseFromConfig.ts"],"names":["Oas","api","parse","yaml","merge","URLPath","resolve"],"mappings":";;;;;;;;;;;;AAUO,SAAS,eAAA,CAAgB,MAAgB,EAAA,QAAA,GAAuBA,OAAmB,EAAA;AACxF,EAAI,IAAA,MAAA,IAAU,OA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["import { resolve } from 'node:path'\n\nimport { URLPath } from '@kubb/core/utils'\n\nimport { merge, parse } from '@kubb/oas'\n\nimport type { Config } from '@kubb/core'\nimport { Oas, type OasTypes } from '@kubb/oas'\nimport yaml from '@stoplight/yaml'\n\nexport function parseFromConfig(config: Config, oasClass: typeof Oas = Oas): Promise<Oas> {\n if ('data' in config.input) {\n if (typeof config.input.data === 'object') {\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n return parse(api, { oasClass })\n }\n\n try {\n const api: string = yaml.parse(config.input.data as string) as string\n\n return parse(api, { oasClass })\n } catch (_e) {\n /* empty */\n }\n\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n\n return parse(api, { oasClass })\n }\n\n if (Array.isArray(config.input)) {\n return merge(\n config.input.map((input) => input.path),\n { oasClass },\n )\n }\n\n if (new URLPath(config.input.path).isURL) {\n return parse(config.input.path, { oasClass })\n }\n\n return parse(resolve(config.root, config.input.path), { oasClass })\n}\n"]}
|
package/dist/chunk-DTD4ZUDA.cjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@kubb/core');
|
|
4
|
-
var remeda = require('remeda');
|
|
5
|
-
|
|
6
|
-
// src/utils/getBanner.ts
|
|
7
|
-
function getBanner({ output, oas, config }) {
|
|
8
|
-
let banner = "";
|
|
9
|
-
if (config?.output?.defaultBanner !== false && config) {
|
|
10
|
-
const { title, description, version } = oas.api?.info || {};
|
|
11
|
-
banner = core.getDefaultBanner({ title, description, version, config });
|
|
12
|
-
}
|
|
13
|
-
if (!output.banner) {
|
|
14
|
-
return banner;
|
|
15
|
-
}
|
|
16
|
-
if (remeda.isFunction(output.banner)) {
|
|
17
|
-
return `${output.banner(oas)}
|
|
18
|
-
${banner}`;
|
|
19
|
-
}
|
|
20
|
-
return `${output.banner}
|
|
21
|
-
${banner}`;
|
|
22
|
-
}
|
|
23
|
-
function getFooter({ output, oas }) {
|
|
24
|
-
if (!output.footer) {
|
|
25
|
-
return void 0;
|
|
26
|
-
}
|
|
27
|
-
if (remeda.isFunction(output.footer)) {
|
|
28
|
-
return output.footer(oas);
|
|
29
|
-
}
|
|
30
|
-
return output.footer;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
exports.getBanner = getBanner;
|
|
34
|
-
exports.getFooter = getFooter;
|
|
35
|
-
//# sourceMappingURL=chunk-DTD4ZUDA.cjs.map
|
|
36
|
-
//# sourceMappingURL=chunk-DTD4ZUDA.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/getBanner.ts","../src/utils/getFooter.ts"],"names":["getDefaultBanner","isFunction"],"mappings":";;;;;;AAUO,SAAS,SAAU,CAAA,EAAE,MAAQ,EAAA,GAAA,EAAK,QAAiB,EAAA;AACxD,EAAA,IAAI,MAAS,GAAA,EAAA;AACb,EAAA,IAAI,MAAQ,EAAA,MAAA,EAAQ,aAAkB,KAAA,KAAA,IAAS,MAAQ,EAAA;AACrD,IAAM,MAAA,EAAE,OAAO,WAAa,EAAA,OAAA,KAAY,GAAI,CAAA,GAAA,EAAK,QAAQ,EAAC;AAE1D,IAAA,MAAA,GAASA,sBAAiB,EAAE,KAAA,EAAO,WAAa,EAAA,OAAA,EAAS,QAAQ,CAAA;AAAA;AAGnE,EAAI,IAAA,CAAC,OAAO,MAAQ,EAAA;AAClB,IAAO,OAAA,MAAA;AAAA;AAGT,EAAI,IAAAC,iBAAA,CAAW,MAAO,CAAA,MAAM,CAAG,EAAA;AAC7B,IAAA,OAAO,CAAG,EAAA,MAAA,CAAO,MAAO,CAAA,GAAG,CAAC;AAAA,EAAK,MAAM,CAAA,CAAA;AAAA;AAGzC,EAAO,OAAA,CAAA,EAAG,OAAO,MAAM;AAAA,EAAK,MAAM,CAAA,CAAA;AACpC;AClBO,SAAS,SAAU,CAAA,EAAE,MAAQ,EAAA,GAAA,EAAc,EAAA;AAChD,EAAI,IAAA,CAAC,OAAO,MAAQ,EAAA;AAClB,IAAO,OAAA,MAAA;AAAA;AAGT,EAAIA,IAAAA,iBAAAA,CAAW,MAAO,CAAA,MAAM,CAAG,EAAA;AAC7B,IAAO,OAAA,MAAA,CAAO,OAAO,GAAG,CAAA;AAAA;AAG1B,EAAA,OAAO,MAAO,CAAA,MAAA;AAChB","file":"chunk-DTD4ZUDA.cjs","sourcesContent":["import { getDefaultBanner, type Config, type Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props = {\n oas: Oas\n output: Output<Oas>\n config?: Config\n}\n\nexport function getBanner({ output, oas, config }: Props) {\n let banner = ''\n if (config?.output?.defaultBanner !== false && config) {\n const { title, description, version } = oas.api?.info || {}\n\n banner = getDefaultBanner({ title, description, version, config })\n }\n\n if (!output.banner) {\n return banner\n }\n\n if (isFunction(output.banner)) {\n return `${output.banner(oas)}\\n${banner}`\n }\n\n return `${output.banner}\\n${banner}`\n}\n","import type { Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props = {\n oas: Oas\n output: Output<Oas>\n}\n\nexport function getFooter({ output, oas }: Props) {\n if (!output.footer) {\n return undefined\n }\n\n if (isFunction(output.footer)) {\n return output.footer(oas)\n }\n\n return output.footer\n}\n"]}
|
package/dist/chunk-G3FDK7YW.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'path';
|
|
2
|
-
import { URLPath } from '@kubb/core/utils';
|
|
3
|
-
import { Oas, parse, merge } from '@kubb/oas';
|
|
4
|
-
import yaml from '@stoplight/yaml';
|
|
5
|
-
|
|
6
|
-
// src/utils/parseFromConfig.ts
|
|
7
|
-
function parseFromConfig(config, oasClass = Oas) {
|
|
8
|
-
if ("data" in config.input) {
|
|
9
|
-
if (typeof config.input.data === "object") {
|
|
10
|
-
const api2 = JSON.parse(JSON.stringify(config.input.data));
|
|
11
|
-
return parse(api2, { oasClass });
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
const api2 = yaml.parse(config.input.data);
|
|
15
|
-
return parse(api2, { oasClass });
|
|
16
|
-
} catch (_e) {
|
|
17
|
-
}
|
|
18
|
-
const api = JSON.parse(JSON.stringify(config.input.data));
|
|
19
|
-
return parse(api, { oasClass });
|
|
20
|
-
}
|
|
21
|
-
if (Array.isArray(config.input)) {
|
|
22
|
-
return merge(
|
|
23
|
-
config.input.map((input) => input.path),
|
|
24
|
-
{ oasClass }
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
if (new URLPath(config.input.path).isURL) {
|
|
28
|
-
return parse(config.input.path, { oasClass });
|
|
29
|
-
}
|
|
30
|
-
return parse(resolve(config.root, config.input.path), { oasClass });
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { parseFromConfig };
|
|
34
|
-
//# sourceMappingURL=chunk-G3FDK7YW.js.map
|
|
35
|
-
//# sourceMappingURL=chunk-G3FDK7YW.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/parseFromConfig.ts"],"names":["api"],"mappings":";;;;;;AAUO,SAAS,eAAA,CAAgB,MAAgB,EAAA,QAAA,GAAuB,GAAmB,EAAA;AACxF,EAAI,IAAA,MAAA,IAAU,OAAO,KAAO,EAAA;AAC1B,IAAA,IAAI,OAAO,MAAA,CAAO,KAAM,CAAA,IAAA,KAAS,QAAU,EAAA;AACzC,MAAMA,MAAAA,IAAAA,GAA4B,KAAK,KAAM,CAAA,IAAA,CAAK,UAAU,MAAO,CAAA,KAAA,CAAM,IAAI,CAAC,CAAA;AAC9E,MAAA,OAAO,KAAMA,CAAAA,IAAAA,EAAK,EAAE,QAAA,EAAU,CAAA;AAAA;AAGhC,IAAI,IAAA;AACF,MAAA,MAAMA,IAAc,GAAA,IAAA,CAAK,KAAM,CAAA,MAAA,CAAO,MAAM,IAAc,CAAA;AAE1D,MAAA,OAAO,KAAMA,CAAAA,IAAAA,EAAK,EAAE,QAAA,EAAU,CAAA;AAAA,aACvB,EAAI,EAAA;AAAA;AAIb,IAAM,MAAA,GAAA,GAA4B,KAAK,KAAM,CAAA,IAAA,CAAK,UAAU,MAAO,CAAA,KAAA,CAAM,IAAI,CAAC,CAAA;AAE9E,IAAA,OAAO,KAAM,CAAA,GAAA,EAAK,EAAE,QAAA,EAAU,CAAA;AAAA;AAGhC,EAAA,IAAI,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,KAAK,CAAG,EAAA;AAC/B,IAAO,OAAA,KAAA;AAAA,MACL,OAAO,KAAM,CAAA,GAAA,CAAI,CAAC,KAAA,KAAU,MAAM,IAAI,CAAA;AAAA,MACtC,EAAE,QAAS;AAAA,KACb;AAAA;AAGF,EAAA,IAAI,IAAI,OAAQ,CAAA,MAAA,CAAO,KAAM,CAAA,IAAI,EAAE,KAAO,EAAA;AACxC,IAAA,OAAO,MAAM,MAAO,CAAA,KAAA,CAAM,IAAM,EAAA,EAAE,UAAU,CAAA;AAAA;AAG9C,EAAO,OAAA,KAAA,CAAM,OAAQ,CAAA,MAAA,CAAO,IAAM,EAAA,MAAA,CAAO,MAAM,IAAI,CAAA,EAAG,EAAE,QAAA,EAAU,CAAA;AACpE","file":"chunk-G3FDK7YW.js","sourcesContent":["import { resolve } from 'node:path'\n\nimport { URLPath } from '@kubb/core/utils'\n\nimport { merge, parse } from '@kubb/oas'\n\nimport type { Config } from '@kubb/core'\nimport { Oas, type OasTypes } from '@kubb/oas'\nimport yaml from '@stoplight/yaml'\n\nexport function parseFromConfig(config: Config, oasClass: typeof Oas = Oas): Promise<Oas> {\n if ('data' in config.input) {\n if (typeof config.input.data === 'object') {\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n return parse(api, { oasClass })\n }\n\n try {\n const api: string = yaml.parse(config.input.data as string) as string\n\n return parse(api, { oasClass })\n } catch (_e) {\n /* empty */\n }\n\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n\n return parse(api, { oasClass })\n }\n\n if (Array.isArray(config.input)) {\n return merge(\n config.input.map((input) => input.path),\n { oasClass },\n )\n }\n\n if (new URLPath(config.input.path).isURL) {\n return parse(config.input.path, { oasClass })\n }\n\n return parse(resolve(config.root, config.input.path), { oasClass })\n}\n"]}
|
package/dist/chunk-JNN4JPWK.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { createContext } from '@kubb/react';
|
|
2
|
-
import { jsx } from '@kubb/react/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
// src/components/Operation.tsx
|
|
5
|
-
var OperationContext = createContext({});
|
|
6
|
-
function Operation({ operation, children }) {
|
|
7
|
-
return /* @__PURE__ */ jsx(OperationContext.Provider, { value: { operation }, children });
|
|
8
|
-
}
|
|
9
|
-
Operation.Context = OperationContext;
|
|
10
|
-
var SchemaContext = createContext({
|
|
11
|
-
name: "unknown",
|
|
12
|
-
tree: []
|
|
13
|
-
});
|
|
14
|
-
function Schema({ name, schemaObject, tree = [], children }) {
|
|
15
|
-
return /* @__PURE__ */ jsx(SchemaContext.Provider, { value: { name, schemaObject, tree }, children });
|
|
16
|
-
}
|
|
17
|
-
Schema.Context = SchemaContext;
|
|
18
|
-
var OasContext = createContext({});
|
|
19
|
-
function Oas({ oas, children, operations, generator }) {
|
|
20
|
-
return /* @__PURE__ */ jsx(OasContext.Provider, { value: { oas, generator, operations }, children });
|
|
21
|
-
}
|
|
22
|
-
Oas.Context = OasContext;
|
|
23
|
-
Oas.Operation = Operation;
|
|
24
|
-
Oas.Schema = Schema;
|
|
25
|
-
|
|
26
|
-
export { Oas, Operation, Schema };
|
|
27
|
-
//# sourceMappingURL=chunk-JNN4JPWK.js.map
|
|
28
|
-
//# sourceMappingURL=chunk-JNN4JPWK.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Operation.tsx","../src/components/Schema.tsx","../src/components/Oas.tsx"],"names":["createContext","jsx"],"mappings":";;;;AAcA,IAAM,gBAAA,GAAmB,aAAqC,CAAA,EAAE,CAAA;AAEzD,SAAS,SAAU,CAAA,EAAE,SAAW,EAAA,QAAA,EAAmB,EAAA;AACxD,EAAO,uBAAA,GAAA,CAAC,iBAAiB,QAAjB,EAAA,EAA0B,OAAO,EAAE,SAAA,IAAc,QAAS,EAAA,CAAA;AACpE;AAEA,SAAA,CAAU,OAAU,GAAA,gBAAA;ACApB,IAAM,gBAAgBA,aAAkC,CAAA;AAAA,EACtD,IAAM,EAAA,SAAA;AAAA,EACN,MAAM;AACR,CAAC,CAAA;AAWM,SAAS,MAAA,CAAO,EAAE,IAAM,EAAA,YAAA,EAAc,OAAO,EAAC,EAAG,UAAmB,EAAA;AACzE,EAAO,uBAAAC,GAAC,CAAA,aAAA,CAAc,QAAd,EAAA,EAAuB,KAAO,EAAA,EAAE,IAAM,EAAA,YAAA,EAAc,IAAK,EAAA,EAAI,QAAS,EAAA,CAAA;AAChF;AAEA,MAAA,CAAO,OAAU,GAAA,aAAA;ACVjB,IAAM,UAAA,GAAaD,aAA+B,CAAA,EAAE,CAAA;AAE7C,SAAS,IAAI,EAAE,GAAA,EAAK,QAAU,EAAA,UAAA,EAAY,WAAoB,EAAA;AACnE,EAAO,uBAAAC,GAAC,CAAA,UAAA,CAAW,QAAX,EAAA,EAAoB,KAAO,EAAA,EAAE,GAAK,EAAA,SAAA,EAAW,UAAW,EAAA,EAAI,QAAS,EAAA,CAAA;AAC/E;AAEA,GAAA,CAAI,OAAU,GAAA,UAAA;AACd,GAAA,CAAI,SAAY,GAAA,SAAA;AAChB,GAAA,CAAI,MAAS,GAAA,MAAA","file":"chunk-JNN4JPWK.js","sourcesContent":["import { createContext } from '@kubb/react'\n\nimport type { Operation as OperationType } from '@kubb/oas'\nimport type { KubbNode } from '@kubb/react/types'\n\ntype Props = {\n operation: OperationType\n children?: KubbNode\n}\n\ntype OperationContextProps = {\n operation?: OperationType\n}\n\nconst OperationContext = createContext<OperationContextProps>({})\n\nexport function Operation({ operation, children }: Props) {\n return <OperationContext.Provider value={{ operation }}>{children}</OperationContext.Provider>\n}\n\nOperation.Context = OperationContext\n","import { createContext } from '@kubb/react'\n\nimport type { SchemaObject } from '@kubb/oas'\nimport type { Key, KubbNode } from '@kubb/react/types'\nimport type { Schema as SchemaType } from '../SchemaMapper.ts'\n\nexport type SchemaContextProps = {\n name: string\n schemaObject?: SchemaObject\n tree: Array<SchemaType>\n}\n\ntype Props = {\n key?: Key\n name: string\n schemaObject?: SchemaObject\n tree?: Array<SchemaType>\n children?: KubbNode\n}\n\nconst SchemaContext = createContext<SchemaContextProps>({\n name: 'unknown',\n tree: [],\n})\n\n/**\n * Provides schema-related context to descendant components.\n *\n * Wraps its children with a context containing the schema name, optional schema object, and an optional schema type tree.\n *\n * @param name - The name of the schema.\n * @param schemaObject - The schema object to provide in context, if available.\n * @param tree - An array representing the schema type hierarchy.\n */\nexport function Schema({ name, schemaObject, tree = [], children }: Props) {\n return <SchemaContext.Provider value={{ name, schemaObject, tree }}>{children}</SchemaContext.Provider>\n}\n\nSchema.Context = SchemaContext\n","import { createContext } from '@kubb/react'\n\nimport { Operation } from './Operation.tsx'\nimport { Schema } from './Schema.tsx'\n\nimport type { Oas as OasType, Operation as OperationType } from '@kubb/oas'\nimport type { KubbNode } from '@kubb/react/types'\nimport type { OperationGenerator } from '../OperationGenerator.ts'\n\ntype Props = {\n oas: OasType\n operations?: OperationType[]\n /**\n * @deprecated\n */\n generator?: Omit<OperationGenerator, 'build'>\n children?: KubbNode\n}\n\ntype OasContextProps = {\n oas?: OasType\n operations?: OperationType[]\n /**\n * @deprecated\n */\n generator?: Omit<OperationGenerator, 'build'>\n}\n\nconst OasContext = createContext<OasContextProps>({})\n\nexport function Oas({ oas, children, operations, generator }: Props) {\n return <OasContext.Provider value={{ oas, generator, operations }}>{children}</OasContext.Provider>\n}\n\nOas.Context = OasContext\nOas.Operation = Operation\nOas.Schema = Schema\n"]}
|
package/dist/chunk-MBX66JAT.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { getFooter, getBanner } from './chunk-6S7YFY6F.js';
|
|
2
|
-
import { Oas } from './chunk-JNN4JPWK.js';
|
|
3
|
-
import { camelCase } from '@kubb/core/transformers';
|
|
4
|
-
import { createRoot, App } from '@kubb/react';
|
|
5
|
-
import { jsx } from '@kubb/react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
function createGenerator(parseOptions) {
|
|
8
|
-
return parseOptions;
|
|
9
|
-
}
|
|
10
|
-
function createReactGenerator(parseOptions) {
|
|
11
|
-
return {
|
|
12
|
-
...parseOptions,
|
|
13
|
-
async operations({ instance, options, operations }) {
|
|
14
|
-
if (!parseOptions.Operations) {
|
|
15
|
-
return [];
|
|
16
|
-
}
|
|
17
|
-
const { pluginManager, oas, plugin, mode } = instance.context;
|
|
18
|
-
const root = createRoot({
|
|
19
|
-
logger: pluginManager.logger
|
|
20
|
-
});
|
|
21
|
-
const Component = parseOptions.Operations.bind(this);
|
|
22
|
-
root.render(
|
|
23
|
-
/* @__PURE__ */ jsx(App, { pluginManager, plugin, mode, children: /* @__PURE__ */ jsx(Oas, { oas, operations, generator: instance, children: /* @__PURE__ */ jsx(Component, { operations, instance, options }) }) })
|
|
24
|
-
);
|
|
25
|
-
return root.files;
|
|
26
|
-
},
|
|
27
|
-
async operation({ instance, operation, options }) {
|
|
28
|
-
if (!parseOptions.Operation) {
|
|
29
|
-
return [];
|
|
30
|
-
}
|
|
31
|
-
const { pluginManager, oas, plugin, mode } = instance.context;
|
|
32
|
-
const root = createRoot({
|
|
33
|
-
logger: pluginManager.logger
|
|
34
|
-
});
|
|
35
|
-
const Component = parseOptions.Operation.bind(this);
|
|
36
|
-
root.render(
|
|
37
|
-
/* @__PURE__ */ jsx(App, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ jsx(Oas, { oas, operations: [operation], generator: instance, children: /* @__PURE__ */ jsx(Oas.Operation, { operation, children: /* @__PURE__ */ jsx(Component, { operation, options, instance }) }) }) })
|
|
38
|
-
);
|
|
39
|
-
return root.files;
|
|
40
|
-
},
|
|
41
|
-
async schema({ instance, schema, options }) {
|
|
42
|
-
if (!parseOptions.Schema) {
|
|
43
|
-
return [];
|
|
44
|
-
}
|
|
45
|
-
const { pluginManager, oas, plugin, mode } = instance.context;
|
|
46
|
-
const Component = parseOptions.Schema.bind(this);
|
|
47
|
-
const root = createRoot({
|
|
48
|
-
logger: pluginManager.logger
|
|
49
|
-
});
|
|
50
|
-
root.render(
|
|
51
|
-
/* @__PURE__ */ jsx(App, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ jsx(Oas, { oas, children: /* @__PURE__ */ jsx(Oas.Schema, { name: schema.name, schemaObject: schema.value, tree: schema.tree, children: /* @__PURE__ */ jsx(Component, { schema, options, instance }) }) }) })
|
|
52
|
-
);
|
|
53
|
-
return root.files;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// src/generators/jsonGenerator.ts
|
|
59
|
-
var jsonGenerator = createGenerator({
|
|
60
|
-
name: "plugin-oas",
|
|
61
|
-
async schema({ schema, instance }) {
|
|
62
|
-
const { pluginManager, plugin } = instance.context;
|
|
63
|
-
const file = pluginManager.getFile({
|
|
64
|
-
name: camelCase(schema.name),
|
|
65
|
-
extname: ".json",
|
|
66
|
-
mode: "split",
|
|
67
|
-
pluginKey: plugin.key
|
|
68
|
-
});
|
|
69
|
-
return [
|
|
70
|
-
{
|
|
71
|
-
...file,
|
|
72
|
-
sources: [
|
|
73
|
-
{
|
|
74
|
-
name: camelCase(schema.name),
|
|
75
|
-
isExportable: false,
|
|
76
|
-
isIndexable: false,
|
|
77
|
-
value: JSON.stringify(schema.value)
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
banner: getBanner({
|
|
81
|
-
oas: instance.context.oas,
|
|
82
|
-
output: plugin.options.output,
|
|
83
|
-
config: pluginManager.config
|
|
84
|
-
}),
|
|
85
|
-
format: getFooter({ oas: instance.context.oas, output: plugin.options.output })
|
|
86
|
-
}
|
|
87
|
-
];
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
export { createGenerator, createReactGenerator, jsonGenerator };
|
|
92
|
-
//# sourceMappingURL=chunk-MBX66JAT.js.map
|
|
93
|
-
//# sourceMappingURL=chunk-MBX66JAT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generator.tsx","../src/generators/jsonGenerator.ts"],"names":[],"mappings":";;;;;;AAyCO,SAAS,gBAAuD,YAA+D,EAAA;AACpI,EAAO,OAAA,YAAA;AACT;AAgBO,SAAS,qBAA4D,YAAoE,EAAA;AAC9I,EAAO,OAAA;AAAA,IACL,GAAG,YAAA;AAAA,IACH,MAAM,UAAW,CAAA,EAAE,QAAU,EAAA,OAAA,EAAS,YAAc,EAAA;AAClD,MAAI,IAAA,CAAC,aAAa,UAAY,EAAA;AAC5B,QAAA,OAAO,EAAC;AAAA;AAGV,MAAA,MAAM,EAAE,aAAe,EAAA,GAAA,EAAK,MAAQ,EAAA,IAAA,KAAS,QAAS,CAAA,OAAA;AACtD,MAAA,MAAM,OAAO,UAAW,CAAA;AAAA,QACtB,QAAQ,aAAc,CAAA;AAAA,OACvB,CAAA;AACD,MAAA,MAAM,SAAY,GAAA,YAAA,CAAa,UAAW,CAAA,IAAA,CAAK,IAAI,CAAA;AAEnD,MAAK,IAAA,CAAA,MAAA;AAAA,4BACF,GAAI,EAAA,EAAA,aAAA,EAA8B,MAAgB,EAAA,IAAA,EACjD,8BAAC,GAAI,EAAA,EAAA,GAAA,EAAU,UAAwB,EAAA,SAAA,EAAW,UAChD,QAAC,kBAAA,GAAA,CAAA,SAAA,EAAA,EAAU,YAAwB,QAAoB,EAAA,OAAA,EAAkB,GAC3E,CACF,EAAA;AAAA,OACF;AACA,MAAA,OAAO,IAAK,CAAA,KAAA;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AAA,CAAK,SAAU,CAAA,MAAA,CAAO,KAAK;AAAA;AACpC,SACF;AAAA,QACA,QAAQ,SAAU,CAAA;AAAA,UAChB,GAAA,EAAK,SAAS,OAAQ,CAAA,GAAA;AAAA,UACtB,MAAA,EAAQ,OAAO,OAAQ,CAAA,MAAA;AAAA,UACvB,QAAQ,aAAc,CAAA;AAAA,SACvB,CAAA;AAAA,QACD,MAAA,EAAQ,SAAU,CAAA,EAAE,GAAK,EAAA,QAAA,CAAS,OAAQ,CAAA,GAAA,EAAK,MAAQ,EAAA,MAAA,CAAO,OAAQ,CAAA,MAAA,EAAQ;AAAA;AAChF,KACF;AAAA;AAEJ,CAAC","file":"chunk-MBX66JAT.js","sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { App, createRoot } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\nimport { Oas } from './components/Oas.tsx'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\nimport type { Schema } from './SchemaMapper.ts'\n\ntype OperationsProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operations: Array<Operation>\n}\n\ntype OperationProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operation: Operation\n}\n\ntype SchemaProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n schema: {\n name: string\n tree: Array<Schema>\n value: SchemaObject\n }\n}\n\nexport type GeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions> {\n return parseOptions\n}\n\nexport type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (this: ReactGeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => KubbNode\n Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode\n Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode\n}\n\n/****\n * Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.\n *\n * The returned generator exposes async methods for generating files from operations, a single operation, or a schema, using the corresponding React components if provided. If a component is not defined, the method returns an empty array.\n *\n * @returns A generator object with async methods for operations, operation, and schema file generation.\n */\nexport function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions> {\n return {\n ...parseOptions,\n async operations({ instance, options, operations }) {\n if (!parseOptions.Operations) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n const Component = parseOptions.Operations.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={instance}>\n <Component operations={operations} instance={instance} options={options} />\n </Oas>\n </App>,\n )\n return root.files\n },\n async operation({ instance, operation, options }) {\n if (!parseOptions.Operation) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n const Component = parseOptions.Operation.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={instance}>\n <Oas.Operation operation={operation}>\n <Component operation={operation} options={options} instance={instance} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n return root.files\n },\n async schema({ instance, schema, options }) {\n if (!parseOptions.Schema) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n\n const Component = parseOptions.Schema.bind(this)\n const root = createRoot({\n logger: pluginManager.logger,\n })\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={schema.name} schemaObject={schema.value} tree={schema.tree}>\n <Component schema={schema} options={options} instance={instance} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n return root.files\n },\n }\n}\n","import { camelCase } from '@kubb/core/transformers'\nimport { createGenerator } from '../generator.tsx'\nimport type { PluginOas } from '../types.ts'\nimport { getBanner } from '../utils/getBanner.ts'\nimport { getFooter } from '../utils/getFooter.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, instance }) {\n const { pluginManager, plugin } = instance.context\n const file = pluginManager.getFile({\n name: camelCase(schema.name),\n extname: '.json',\n mode: 'split',\n pluginKey: plugin.key,\n })\n\n return [\n {\n ...file,\n sources: [\n {\n name: camelCase(schema.name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema.value),\n },\n ],\n banner: getBanner({\n oas: instance.context.oas,\n output: plugin.options.output,\n config: pluginManager.config,\n }),\n format: getFooter({ oas: instance.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"]}
|