@kubb/plugin-cypress 4.4.1 → 4.5.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.
@@ -1,4 +1,4 @@
1
- import { n as PluginCypress, o as HttpMethod, r as OperationSchemas } from "./types-bObu7JjR.cjs";
1
+ import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-C36mkyaA.cjs";
2
2
  import { KubbNode } from "@kubb/react-fabric/types";
3
3
 
4
4
  //#region src/components/Request.d.ts
@@ -1,4 +1,4 @@
1
- import { n as PluginCypress, o as HttpMethod, r as OperationSchemas } from "./types-dtu1Ew7p.js";
1
+ import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-Da3VNOH7.js";
2
2
  import { KubbNode } from "@kubb/react-fabric/types";
3
3
 
4
4
  //#region src/components/Request.d.ts
@@ -1,8 +1,8 @@
1
1
  import { t as Request } from "./components-Cs-85WSv.js";
2
- import { createReactGenerator } from "@kubb/plugin-oas";
3
2
  import { pluginTsName } from "@kubb/plugin-ts";
4
- import { usePlugin, usePluginManager } from "@kubb/core/hooks";
3
+ import { usePluginManager } from "@kubb/core/hooks";
5
4
  import { URLPath } from "@kubb/core/utils";
5
+ import { createReactGenerator } from "@kubb/plugin-oas/generators";
6
6
  import { useOas, useOperationManager } from "@kubb/plugin-oas/hooks";
7
7
  import { getBanner, getFooter } from "@kubb/plugin-oas/utils";
8
8
  import { File } from "@kubb/react-fabric";
@@ -11,11 +11,11 @@ import { jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
11
11
  //#region src/generators/cypressGenerator.tsx
12
12
  const cypressGenerator = createReactGenerator({
13
13
  name: "cypress",
14
- Operation({ operation }) {
15
- const { options: { output, baseURL, dataReturnType } } = usePlugin();
14
+ Operation({ operation, generator, plugin }) {
15
+ const { options: { output, baseURL, dataReturnType } } = plugin;
16
16
  const pluginManager = usePluginManager();
17
17
  const oas = useOas();
18
- const { getSchemas, getName, getFile } = useOperationManager();
18
+ const { getSchemas, getName, getFile } = useOperationManager(generator);
19
19
  const request = {
20
20
  name: getName(operation, { type: "function" }),
21
21
  file: getFile(operation)
@@ -66,4 +66,4 @@ const cypressGenerator = createReactGenerator({
66
66
 
67
67
  //#endregion
68
68
  export { cypressGenerator as t };
69
- //# sourceMappingURL=generators-CfF-r6zR.js.map
69
+ //# sourceMappingURL=generators-CRS7mkLj.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators-CRS7mkLj.js","names":[],"sources":["../src/generators/cypressGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { URLPath } from '@kubb/core/utils'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Request } from '../components'\nimport type { PluginCypress } from '../types'\n\nexport const cypressGenerator = createReactGenerator<PluginCypress>({\n name: 'cypress',\n Operation({ operation, generator, plugin }) {\n const {\n options: { output, baseURL, dataReturnType },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const request = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={request.file.baseName}\n path={request.file.path}\n meta={request.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={request.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <Request\n name={request.name}\n dataReturnType={dataReturnType}\n typeSchemas={type.schemas}\n method={operation.method}\n baseURL={baseURL}\n url={new URLPath(operation.path).toURLPath()}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,mBAAmB,qBAAoC;CAClE,MAAM;CACN,UAAU,EAAE,WAAW,WAAW,UAAU;EAC1C,MAAM,EACJ,SAAS,EAAE,QAAQ,SAAS,qBAC1B;EACJ,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,YAAY,SAAS,YAAY,oBAAoB,UAAU;EAEvE,MAAM,UAAU;GACd,MAAM,QAAQ,WAAW,EAAE,MAAM,YAAY,CAAC;GAC9C,MAAM,QAAQ,UAAU;GACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAAC,aAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,qBAAC;GACC,UAAU,QAAQ,KAAK;GACvB,MAAM,QAAQ,KAAK;GACnB,MAAM,QAAQ,KAAK;GACnB,QAAQ,UAAU;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,QAAQ,UAAU;IAAE;IAAK;IAAQ,CAAC;cAElC,oBAAC,KAAK;IACJ,MAAM;KACJ,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,YAAY;KACzB,KAAK,QAAQ,aAAa;KAC1B,KAAK,QAAQ,cAAc;KAC3B,GAAI,KAAK,QAAQ,aAAa,KAAK,SAAS,KAAK,KAAK,IAAI,EAAE;KAC7D,CAAC,OAAO,QAAQ;IACjB,MAAM,QAAQ,KAAK;IACnB,MAAM,KAAK,KAAK;IAChB;KACA,EACF,oBAAC;IACC,MAAM,QAAQ;IACE;IAChB,aAAa,KAAK;IAClB,QAAQ,UAAU;IACT;IACT,KAAK,IAAI,QAAQ,UAAU,KAAK,CAAC,WAAW;KAC5C;IACG;;CAGZ,CAAC"}
@@ -1,12 +1,12 @@
1
1
  const require_components = require('./components-CDWcq6eX.cjs');
2
- let __kubb_plugin_oas = require("@kubb/plugin-oas");
3
- __kubb_plugin_oas = require_components.__toESM(__kubb_plugin_oas);
4
2
  let __kubb_plugin_ts = require("@kubb/plugin-ts");
5
3
  __kubb_plugin_ts = require_components.__toESM(__kubb_plugin_ts);
6
4
  let __kubb_core_hooks = require("@kubb/core/hooks");
7
5
  __kubb_core_hooks = require_components.__toESM(__kubb_core_hooks);
8
6
  let __kubb_core_utils = require("@kubb/core/utils");
9
7
  __kubb_core_utils = require_components.__toESM(__kubb_core_utils);
8
+ let __kubb_plugin_oas_generators = require("@kubb/plugin-oas/generators");
9
+ __kubb_plugin_oas_generators = require_components.__toESM(__kubb_plugin_oas_generators);
10
10
  let __kubb_plugin_oas_hooks = require("@kubb/plugin-oas/hooks");
11
11
  __kubb_plugin_oas_hooks = require_components.__toESM(__kubb_plugin_oas_hooks);
12
12
  let __kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
@@ -17,13 +17,13 @@ let __kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
17
17
  __kubb_react_fabric_jsx_runtime = require_components.__toESM(__kubb_react_fabric_jsx_runtime);
18
18
 
19
19
  //#region src/generators/cypressGenerator.tsx
20
- const cypressGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
20
+ const cypressGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
21
21
  name: "cypress",
22
- Operation({ operation }) {
23
- const { options: { output, baseURL, dataReturnType } } = (0, __kubb_core_hooks.usePlugin)();
22
+ Operation({ operation, generator, plugin }) {
23
+ const { options: { output, baseURL, dataReturnType } } = plugin;
24
24
  const pluginManager = (0, __kubb_core_hooks.usePluginManager)();
25
25
  const oas = (0, __kubb_plugin_oas_hooks.useOas)();
26
- const { getSchemas, getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)();
26
+ const { getSchemas, getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)(generator);
27
27
  const request = {
28
28
  name: getName(operation, { type: "function" }),
29
29
  file: getFile(operation)
@@ -79,4 +79,4 @@ Object.defineProperty(exports, 'cypressGenerator', {
79
79
  return cypressGenerator;
80
80
  }
81
81
  });
82
- //# sourceMappingURL=generators-CKKLK5ah.cjs.map
82
+ //# sourceMappingURL=generators-UzSX0BDU.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators-UzSX0BDU.cjs","names":["pluginTsName","File","Request","URLPath"],"sources":["../src/generators/cypressGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { URLPath } from '@kubb/core/utils'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Request } from '../components'\nimport type { PluginCypress } from '../types'\n\nexport const cypressGenerator = createReactGenerator<PluginCypress>({\n name: 'cypress',\n Operation({ operation, generator, plugin }) {\n const {\n options: { output, baseURL, dataReturnType },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const request = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={request.file.baseName}\n path={request.file.path}\n meta={request.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={request.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <Request\n name={request.name}\n dataReturnType={dataReturnType}\n typeSchemas={type.schemas}\n method={operation.method}\n baseURL={baseURL}\n url={new URLPath(operation.path).toURLPath()}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,MAAa,0EAAuD;CAClE,MAAM;CACN,UAAU,EAAE,WAAW,WAAW,UAAU;EAC1C,MAAM,EACJ,SAAS,EAAE,QAAQ,SAAS,qBAC1B;EACJ,MAAM,yDAAkC;EAExC,MAAM,2CAAc;EACpB,MAAM,EAAE,YAAY,SAAS,6DAAgC,UAAU;EAEvE,MAAM,UAAU;GACd,MAAM,QAAQ,WAAW,EAAE,MAAM,YAAY,CAAC;GAC9C,MAAM,QAAQ,UAAU;GACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACA,8BAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAACA,8BAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,0DAACC;GACC,UAAU,QAAQ,KAAK;GACvB,MAAM,QAAQ,KAAK;GACnB,MAAM,QAAQ,KAAK;GACnB,+CAAkB;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,+CAAkB;IAAE;IAAK;IAAQ,CAAC;cAElC,yDAACA,yBAAK;IACJ,MAAM;KACJ,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,YAAY;KACzB,KAAK,QAAQ,aAAa;KAC1B,KAAK,QAAQ,cAAc;KAC3B,GAAI,KAAK,QAAQ,aAAa,KAAK,SAAS,KAAK,KAAK,IAAI,EAAE;KAC7D,CAAC,OAAO,QAAQ;IACjB,MAAM,QAAQ,KAAK;IACnB,MAAM,KAAK,KAAK;IAChB;KACA,EACF,yDAACC;IACC,MAAM,QAAQ;IACE;IAChB,aAAa,KAAK;IAClB,QAAQ,UAAU;IACT;IACT,KAAK,IAAIC,0BAAQ,UAAU,KAAK,CAAC,WAAW;KAC5C;IACG;;CAGZ,CAAC"}
@@ -1,4 +1,4 @@
1
1
  require('./components-CDWcq6eX.cjs');
2
- const require_generators = require('./generators-CKKLK5ah.cjs');
2
+ const require_generators = require('./generators-UzSX0BDU.cjs');
3
3
 
4
4
  exports.cypressGenerator = require_generators.cypressGenerator;
@@ -1,4 +1,4 @@
1
- import { i as ReactGenerator, n as PluginCypress } from "./types-bObu7JjR.cjs";
1
+ import { n as PluginCypress, r as ReactGenerator } from "./types-C36mkyaA.cjs";
2
2
 
3
3
  //#region src/generators/cypressGenerator.d.ts
4
4
  declare const cypressGenerator: ReactGenerator<PluginCypress>;
@@ -1,4 +1,4 @@
1
- import { i as ReactGenerator, n as PluginCypress } from "./types-dtu1Ew7p.js";
1
+ import { n as PluginCypress, r as ReactGenerator } from "./types-Da3VNOH7.js";
2
2
 
3
3
  //#region src/generators/cypressGenerator.d.ts
4
4
  declare const cypressGenerator: ReactGenerator<PluginCypress>;
@@ -1,4 +1,4 @@
1
1
  import "./components-Cs-85WSv.js";
2
- import { t as cypressGenerator } from "./generators-CfF-r6zR.js";
2
+ import { t as cypressGenerator } from "./generators-CRS7mkLj.js";
3
3
 
4
4
  export { cypressGenerator };
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  const require_components = require('./components-CDWcq6eX.cjs');
2
- const require_generators = require('./generators-CKKLK5ah.cjs');
2
+ const require_generators = require('./generators-UzSX0BDU.cjs');
3
3
  let node_path = require("node:path");
4
4
  node_path = require_components.__toESM(node_path);
5
5
  let __kubb_core = require("@kubb/core");
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-bObu7JjR.cjs";
1
+ import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-C36mkyaA.cjs";
2
2
 
3
3
  //#region src/plugin.d.ts
4
4
  declare const pluginCypressName = "plugin-cypress";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-dtu1Ew7p.js";
1
+ import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-Da3VNOH7.js";
2
2
 
3
3
  //#region src/plugin.d.ts
4
4
  declare const pluginCypressName = "plugin-cypress";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./components-Cs-85WSv.js";
2
- import { t as cypressGenerator } from "./generators-CfF-r6zR.js";
2
+ import { t as cypressGenerator } from "./generators-CRS7mkLj.js";
3
3
  import path from "node:path";
4
4
  import { PluginManager, createPlugin, getBarrelFiles, getMode } from "@kubb/core";
5
5
  import { camelCase } from "@kubb/core/transformers";
@@ -1,4 +1,3 @@
1
- import { Fabric, FileManager } from "@kubb/react-fabric";
2
1
  import * as OasTypes from "oas/types";
3
2
  import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
4
3
  import { Operation, Operation as Operation$1 } from "oas/operation";
@@ -6,6 +5,7 @@ import { OpenAPIV3 } from "openapi-types";
6
5
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
7
6
  import BaseOas from "oas";
8
7
  import { KubbFile } from "@kubb/fabric-core/types";
8
+ import { Fabric, FileManager } from "@kubb/react-fabric";
9
9
  import { ConsolaInstance, LogLevel } from "consola";
10
10
  import { KubbNode } from "@kubb/react-fabric/types";
11
11
 
@@ -556,170 +556,6 @@ type FileMetaBase = {
556
556
  pluginKey?: Plugin['key'];
557
557
  };
558
558
  //#endregion
559
- //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
560
- type ReactGenerator<TOptions extends PluginFactoryOptions> = {
561
- name: string;
562
- type: 'react';
563
- Operations: (props: OperationsProps<TOptions>) => KubbNode;
564
- Operation: (props: OperationProps<TOptions>) => KubbNode;
565
- Schema: (props: SchemaProps$1<TOptions>) => KubbNode;
566
- };
567
- //#endregion
568
- //#region ../plugin-oas/src/generators/types.d.ts
569
- type OperationsProps<TOptions extends PluginFactoryOptions> = {
570
- /**
571
- * @deprecated
572
- */
573
- instance: Omit<OperationGenerator<TOptions>, 'build'>;
574
- options: TOptions['resolvedOptions'];
575
- operations: Array<Operation$1>;
576
- };
577
- type OperationProps<TOptions extends PluginFactoryOptions> = {
578
- /**
579
- * @deprecated
580
- */
581
- instance: Omit<OperationGenerator<TOptions>, 'build'>;
582
- options: TOptions['resolvedOptions'];
583
- operation: Operation$1;
584
- };
585
- type SchemaProps$1<TOptions extends PluginFactoryOptions> = {
586
- instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
587
- options: TOptions['resolvedOptions'];
588
- schema: {
589
- name: string;
590
- tree: Array<Schema>;
591
- value: SchemaObject$1;
592
- };
593
- };
594
- type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
595
- //#endregion
596
- //#region ../plugin-oas/src/generators/createGenerator.d.ts
597
- type CoreGenerator<TOptions extends PluginFactoryOptions> = {
598
- name: string;
599
- type: 'core';
600
- operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
601
- operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
602
- schema: (props: SchemaProps$1<TOptions>) => Promise<KubbFile.File[]>;
603
- };
604
- //#endregion
605
- //#region ../plugin-oas/src/types.d.ts
606
- type ResolvePathOptions = {
607
- pluginKey?: Plugin['key'];
608
- group?: {
609
- tag?: string;
610
- path?: string;
611
- };
612
- type?: ResolveNameParams['type'];
613
- };
614
- /**
615
- * `propertyName` is the ref name + resolved with the nameResolver
616
- * @example import { Pet } from './Pet'
617
- *
618
- * `originalName` is the original name used(in PascalCase), only used to remove duplicates
619
- *
620
- * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
621
- * @example import a type(plugin-ts) for a mock file(swagger-faker)
622
- */
623
- type Ref = {
624
- propertyName: string;
625
- originalName: string;
626
- path: KubbFile.OptionalPath;
627
- pluginKey?: Plugin['key'];
628
- };
629
- type Refs = Record<string, Ref>;
630
- type OperationSchema = {
631
- /**
632
- * Converted name, contains already `PathParams`, `QueryParams`, ...
633
- */
634
- name: string;
635
- schema: SchemaObject$1;
636
- operation?: Operation$1;
637
- /**
638
- * OperationName in PascalCase, only being used in OperationGenerator
639
- */
640
- operationName: string;
641
- description?: string;
642
- statusCode?: number;
643
- keys?: string[];
644
- keysToOmit?: string[];
645
- withData?: boolean;
646
- };
647
- type OperationSchemas = {
648
- pathParams?: OperationSchema & {
649
- keysToOmit?: never;
650
- };
651
- queryParams?: OperationSchema & {
652
- keysToOmit?: never;
653
- };
654
- headerParams?: OperationSchema & {
655
- keysToOmit?: never;
656
- };
657
- request?: OperationSchema;
658
- response: OperationSchema;
659
- responses: Array<OperationSchema>;
660
- statusCodes?: Array<OperationSchema>;
661
- errors?: Array<OperationSchema>;
662
- };
663
- type ByTag = {
664
- type: 'tag';
665
- pattern: string | RegExp;
666
- };
667
- type ByOperationId = {
668
- type: 'operationId';
669
- pattern: string | RegExp;
670
- };
671
- type ByPath = {
672
- type: 'path';
673
- pattern: string | RegExp;
674
- };
675
- type ByMethod = {
676
- type: 'method';
677
- pattern: HttpMethod | RegExp;
678
- };
679
- type BySchemaName = {
680
- type: 'schemaName';
681
- pattern: string | RegExp;
682
- };
683
- type ByContentType = {
684
- type: 'contentType';
685
- pattern: string | RegExp;
686
- };
687
- type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
688
- type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
689
- type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
690
- options: Partial<TOptions>;
691
- };
692
- //#endregion
693
- //#region ../plugin-oas/src/OperationGenerator.d.ts
694
- type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
695
- fabric: Fabric;
696
- oas: Oas;
697
- exclude: Array<Exclude$1> | undefined;
698
- include: Array<Include> | undefined;
699
- override: Array<Override<TOptions>> | undefined;
700
- contentType: contentType | undefined;
701
- pluginManager: PluginManager;
702
- /**
703
- * Current plugin
704
- */
705
- plugin: Plugin<TPluginOptions>;
706
- mode: KubbFile.Mode;
707
- };
708
- declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
709
- #private;
710
- getSchemas(operation: Operation$1, {
711
- resolveName
712
- }?: {
713
- resolveName?: (name: string) => string;
714
- }): OperationSchemas;
715
- getOperations(): Promise<Array<{
716
- path: string;
717
- method: HttpMethod;
718
- operation: Operation$1;
719
- }>>;
720
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
721
- }
722
- //#endregion
723
559
  //#region ../plugin-oas/src/SchemaMapper.d.ts
724
560
  type SchemaKeywordMapper = {
725
561
  object: {
@@ -937,8 +773,96 @@ type Schema = {
937
773
  keyword: string;
938
774
  } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
939
775
  //#endregion
776
+ //#region ../plugin-oas/src/types.d.ts
777
+ type ResolvePathOptions = {
778
+ pluginKey?: Plugin['key'];
779
+ group?: {
780
+ tag?: string;
781
+ path?: string;
782
+ };
783
+ type?: ResolveNameParams['type'];
784
+ };
785
+ /**
786
+ * `propertyName` is the ref name + resolved with the nameResolver
787
+ * @example import { Pet } from './Pet'
788
+ *
789
+ * `originalName` is the original name used(in PascalCase), only used to remove duplicates
790
+ *
791
+ * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
792
+ * @example import a type(plugin-ts) for a mock file(swagger-faker)
793
+ */
794
+ type Ref = {
795
+ propertyName: string;
796
+ originalName: string;
797
+ path: KubbFile.OptionalPath;
798
+ pluginKey?: Plugin['key'];
799
+ };
800
+ type Refs = Record<string, Ref>;
801
+ type OperationSchema = {
802
+ /**
803
+ * Converted name, contains already `PathParams`, `QueryParams`, ...
804
+ */
805
+ name: string;
806
+ schema: SchemaObject$1;
807
+ operation?: Operation$1;
808
+ /**
809
+ * OperationName in PascalCase, only being used in OperationGenerator
810
+ */
811
+ operationName: string;
812
+ description?: string;
813
+ statusCode?: number;
814
+ keys?: string[];
815
+ keysToOmit?: string[];
816
+ withData?: boolean;
817
+ };
818
+ type OperationSchemas = {
819
+ pathParams?: OperationSchema & {
820
+ keysToOmit?: never;
821
+ };
822
+ queryParams?: OperationSchema & {
823
+ keysToOmit?: never;
824
+ };
825
+ headerParams?: OperationSchema & {
826
+ keysToOmit?: never;
827
+ };
828
+ request?: OperationSchema;
829
+ response: OperationSchema;
830
+ responses: Array<OperationSchema>;
831
+ statusCodes?: Array<OperationSchema>;
832
+ errors?: Array<OperationSchema>;
833
+ };
834
+ type ByTag = {
835
+ type: 'tag';
836
+ pattern: string | RegExp;
837
+ };
838
+ type ByOperationId = {
839
+ type: 'operationId';
840
+ pattern: string | RegExp;
841
+ };
842
+ type ByPath = {
843
+ type: 'path';
844
+ pattern: string | RegExp;
845
+ };
846
+ type ByMethod = {
847
+ type: 'method';
848
+ pattern: HttpMethod | RegExp;
849
+ };
850
+ type BySchemaName = {
851
+ type: 'schemaName';
852
+ pattern: string | RegExp;
853
+ };
854
+ type ByContentType = {
855
+ type: 'contentType';
856
+ pattern: string | RegExp;
857
+ };
858
+ type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
859
+ type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
860
+ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
861
+ options: Partial<TOptions>;
862
+ };
863
+ //#endregion
940
864
  //#region ../plugin-oas/src/SchemaGenerator.d.ts
941
- type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
865
+ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
942
866
  fabric: Fabric;
943
867
  oas: Oas;
944
868
  pluginManager: PluginManager;
@@ -971,15 +895,15 @@ type SchemaGeneratorOptions = {
971
895
  * TODO TODO add docs
972
896
  * @beta
973
897
  */
974
- schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined;
898
+ schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Schema[] | undefined;
975
899
  };
976
900
  };
977
- type SchemaProps = {
901
+ type SchemaProps$1 = {
978
902
  schemaObject?: SchemaObject$1;
979
903
  name?: string;
980
904
  parentName?: string;
981
905
  };
982
- declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
906
+ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
983
907
  #private;
984
908
  refs: Refs;
985
909
  /**
@@ -987,16 +911,86 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
987
911
  * Delegates to getBaseTypeFromSchema internally and
988
912
  * optionally adds a union with null.
989
913
  */
990
- parse(props: SchemaProps): Schema[];
991
- deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
992
- find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
914
+ parse(props: SchemaProps$1): Schema[];
993
915
  static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
994
- static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
995
916
  static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
996
917
  static combineObjects(tree: Schema[] | undefined): Schema[];
997
918
  build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
998
919
  }
999
920
  //#endregion
921
+ //#region ../plugin-oas/src/generators/createGenerator.d.ts
922
+ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
923
+ name: string;
924
+ type: 'core';
925
+ operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
926
+ operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
927
+ schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
928
+ };
929
+ //#endregion
930
+ //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
931
+ type ReactGenerator<TOptions extends PluginFactoryOptions> = {
932
+ name: string;
933
+ type: 'react';
934
+ Operations: (props: OperationsProps<TOptions>) => KubbNode;
935
+ Operation: (props: OperationProps<TOptions>) => KubbNode;
936
+ Schema: (props: SchemaProps<TOptions>) => KubbNode;
937
+ };
938
+ //#endregion
939
+ //#region ../plugin-oas/src/generators/types.d.ts
940
+ type OperationsProps<TOptions extends PluginFactoryOptions> = {
941
+ config: Config;
942
+ generator: Omit<OperationGenerator<TOptions>, 'build'>;
943
+ plugin: Plugin<TOptions>;
944
+ operations: Array<Operation$1>;
945
+ };
946
+ type OperationProps<TOptions extends PluginFactoryOptions> = {
947
+ config: Config;
948
+ generator: Omit<OperationGenerator<TOptions>, 'build'>;
949
+ plugin: Plugin<TOptions>;
950
+ operation: Operation$1;
951
+ };
952
+ type SchemaProps<TOptions extends PluginFactoryOptions> = {
953
+ config: Config;
954
+ generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
955
+ plugin: Plugin<TOptions>;
956
+ schema: {
957
+ name: string;
958
+ tree: Array<Schema>;
959
+ value: SchemaObject$1;
960
+ };
961
+ };
962
+ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
963
+ //#endregion
964
+ //#region ../plugin-oas/src/OperationGenerator.d.ts
965
+ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
966
+ fabric: Fabric;
967
+ oas: Oas;
968
+ exclude: Array<Exclude$1> | undefined;
969
+ include: Array<Include> | undefined;
970
+ override: Array<Override<TOptions>> | undefined;
971
+ contentType: contentType | undefined;
972
+ pluginManager: PluginManager;
973
+ /**
974
+ * Current plugin
975
+ */
976
+ plugin: Plugin<TPluginOptions>;
977
+ mode: KubbFile.Mode;
978
+ };
979
+ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
980
+ #private;
981
+ getSchemas(operation: Operation$1, {
982
+ resolveName
983
+ }?: {
984
+ resolveName?: (name: string) => string;
985
+ }): OperationSchemas;
986
+ getOperations(): Promise<Array<{
987
+ path: string;
988
+ method: HttpMethod;
989
+ operation: Operation$1;
990
+ }>>;
991
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
992
+ }
993
+ //#endregion
1000
994
  //#region src/types.d.ts
1001
995
  type Options$1 = {
1002
996
  /**
@@ -1052,5 +1046,5 @@ type ResolvedOptions = {
1052
1046
  };
1053
1047
  type PluginCypress = PluginFactoryOptions<'plugin-cypress', Options$1, ResolvedOptions, never, ResolvePathOptions>;
1054
1048
  //#endregion
1055
- export { UserPluginWithLifeCycle as a, ReactGenerator as i, PluginCypress as n, HttpMethod as o, OperationSchemas as r, Options$1 as t };
1056
- //# sourceMappingURL=types-dtu1Ew7p.d.ts.map
1049
+ export { UserPluginWithLifeCycle as a, OperationSchemas as i, PluginCypress as n, HttpMethod as o, ReactGenerator as r, Options$1 as t };
1050
+ //# sourceMappingURL=types-C36mkyaA.d.cts.map
@@ -1,3 +1,4 @@
1
+ import { Fabric, FileManager } from "@kubb/react-fabric";
1
2
  import * as OasTypes from "oas/types";
2
3
  import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
3
4
  import { Operation, Operation as Operation$1 } from "oas/operation";
@@ -5,7 +6,6 @@ import { OpenAPIV3 } from "openapi-types";
5
6
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
6
7
  import BaseOas from "oas";
7
8
  import { KubbFile } from "@kubb/fabric-core/types";
8
- import { Fabric, FileManager } from "@kubb/react-fabric";
9
9
  import { ConsolaInstance, LogLevel } from "consola";
10
10
  import { KubbNode } from "@kubb/react-fabric/types";
11
11
 
@@ -556,170 +556,6 @@ type FileMetaBase = {
556
556
  pluginKey?: Plugin['key'];
557
557
  };
558
558
  //#endregion
559
- //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
560
- type ReactGenerator<TOptions extends PluginFactoryOptions> = {
561
- name: string;
562
- type: 'react';
563
- Operations: (props: OperationsProps<TOptions>) => KubbNode;
564
- Operation: (props: OperationProps<TOptions>) => KubbNode;
565
- Schema: (props: SchemaProps$1<TOptions>) => KubbNode;
566
- };
567
- //#endregion
568
- //#region ../plugin-oas/src/generators/types.d.ts
569
- type OperationsProps<TOptions extends PluginFactoryOptions> = {
570
- /**
571
- * @deprecated
572
- */
573
- instance: Omit<OperationGenerator<TOptions>, 'build'>;
574
- options: TOptions['resolvedOptions'];
575
- operations: Array<Operation$1>;
576
- };
577
- type OperationProps<TOptions extends PluginFactoryOptions> = {
578
- /**
579
- * @deprecated
580
- */
581
- instance: Omit<OperationGenerator<TOptions>, 'build'>;
582
- options: TOptions['resolvedOptions'];
583
- operation: Operation$1;
584
- };
585
- type SchemaProps$1<TOptions extends PluginFactoryOptions> = {
586
- instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
587
- options: TOptions['resolvedOptions'];
588
- schema: {
589
- name: string;
590
- tree: Array<Schema>;
591
- value: SchemaObject$1;
592
- };
593
- };
594
- type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
595
- //#endregion
596
- //#region ../plugin-oas/src/generators/createGenerator.d.ts
597
- type CoreGenerator<TOptions extends PluginFactoryOptions> = {
598
- name: string;
599
- type: 'core';
600
- operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
601
- operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
602
- schema: (props: SchemaProps$1<TOptions>) => Promise<KubbFile.File[]>;
603
- };
604
- //#endregion
605
- //#region ../plugin-oas/src/types.d.ts
606
- type ResolvePathOptions = {
607
- pluginKey?: Plugin['key'];
608
- group?: {
609
- tag?: string;
610
- path?: string;
611
- };
612
- type?: ResolveNameParams['type'];
613
- };
614
- /**
615
- * `propertyName` is the ref name + resolved with the nameResolver
616
- * @example import { Pet } from './Pet'
617
- *
618
- * `originalName` is the original name used(in PascalCase), only used to remove duplicates
619
- *
620
- * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
621
- * @example import a type(plugin-ts) for a mock file(swagger-faker)
622
- */
623
- type Ref = {
624
- propertyName: string;
625
- originalName: string;
626
- path: KubbFile.OptionalPath;
627
- pluginKey?: Plugin['key'];
628
- };
629
- type Refs = Record<string, Ref>;
630
- type OperationSchema = {
631
- /**
632
- * Converted name, contains already `PathParams`, `QueryParams`, ...
633
- */
634
- name: string;
635
- schema: SchemaObject$1;
636
- operation?: Operation$1;
637
- /**
638
- * OperationName in PascalCase, only being used in OperationGenerator
639
- */
640
- operationName: string;
641
- description?: string;
642
- statusCode?: number;
643
- keys?: string[];
644
- keysToOmit?: string[];
645
- withData?: boolean;
646
- };
647
- type OperationSchemas = {
648
- pathParams?: OperationSchema & {
649
- keysToOmit?: never;
650
- };
651
- queryParams?: OperationSchema & {
652
- keysToOmit?: never;
653
- };
654
- headerParams?: OperationSchema & {
655
- keysToOmit?: never;
656
- };
657
- request?: OperationSchema;
658
- response: OperationSchema;
659
- responses: Array<OperationSchema>;
660
- statusCodes?: Array<OperationSchema>;
661
- errors?: Array<OperationSchema>;
662
- };
663
- type ByTag = {
664
- type: 'tag';
665
- pattern: string | RegExp;
666
- };
667
- type ByOperationId = {
668
- type: 'operationId';
669
- pattern: string | RegExp;
670
- };
671
- type ByPath = {
672
- type: 'path';
673
- pattern: string | RegExp;
674
- };
675
- type ByMethod = {
676
- type: 'method';
677
- pattern: HttpMethod | RegExp;
678
- };
679
- type BySchemaName = {
680
- type: 'schemaName';
681
- pattern: string | RegExp;
682
- };
683
- type ByContentType = {
684
- type: 'contentType';
685
- pattern: string | RegExp;
686
- };
687
- type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
688
- type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
689
- type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
690
- options: Partial<TOptions>;
691
- };
692
- //#endregion
693
- //#region ../plugin-oas/src/OperationGenerator.d.ts
694
- type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
695
- fabric: Fabric;
696
- oas: Oas;
697
- exclude: Array<Exclude$1> | undefined;
698
- include: Array<Include> | undefined;
699
- override: Array<Override<TOptions>> | undefined;
700
- contentType: contentType | undefined;
701
- pluginManager: PluginManager;
702
- /**
703
- * Current plugin
704
- */
705
- plugin: Plugin<TPluginOptions>;
706
- mode: KubbFile.Mode;
707
- };
708
- declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
709
- #private;
710
- getSchemas(operation: Operation$1, {
711
- resolveName
712
- }?: {
713
- resolveName?: (name: string) => string;
714
- }): OperationSchemas;
715
- getOperations(): Promise<Array<{
716
- path: string;
717
- method: HttpMethod;
718
- operation: Operation$1;
719
- }>>;
720
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
721
- }
722
- //#endregion
723
559
  //#region ../plugin-oas/src/SchemaMapper.d.ts
724
560
  type SchemaKeywordMapper = {
725
561
  object: {
@@ -937,8 +773,96 @@ type Schema = {
937
773
  keyword: string;
938
774
  } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
939
775
  //#endregion
776
+ //#region ../plugin-oas/src/types.d.ts
777
+ type ResolvePathOptions = {
778
+ pluginKey?: Plugin['key'];
779
+ group?: {
780
+ tag?: string;
781
+ path?: string;
782
+ };
783
+ type?: ResolveNameParams['type'];
784
+ };
785
+ /**
786
+ * `propertyName` is the ref name + resolved with the nameResolver
787
+ * @example import { Pet } from './Pet'
788
+ *
789
+ * `originalName` is the original name used(in PascalCase), only used to remove duplicates
790
+ *
791
+ * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
792
+ * @example import a type(plugin-ts) for a mock file(swagger-faker)
793
+ */
794
+ type Ref = {
795
+ propertyName: string;
796
+ originalName: string;
797
+ path: KubbFile.OptionalPath;
798
+ pluginKey?: Plugin['key'];
799
+ };
800
+ type Refs = Record<string, Ref>;
801
+ type OperationSchema = {
802
+ /**
803
+ * Converted name, contains already `PathParams`, `QueryParams`, ...
804
+ */
805
+ name: string;
806
+ schema: SchemaObject$1;
807
+ operation?: Operation$1;
808
+ /**
809
+ * OperationName in PascalCase, only being used in OperationGenerator
810
+ */
811
+ operationName: string;
812
+ description?: string;
813
+ statusCode?: number;
814
+ keys?: string[];
815
+ keysToOmit?: string[];
816
+ withData?: boolean;
817
+ };
818
+ type OperationSchemas = {
819
+ pathParams?: OperationSchema & {
820
+ keysToOmit?: never;
821
+ };
822
+ queryParams?: OperationSchema & {
823
+ keysToOmit?: never;
824
+ };
825
+ headerParams?: OperationSchema & {
826
+ keysToOmit?: never;
827
+ };
828
+ request?: OperationSchema;
829
+ response: OperationSchema;
830
+ responses: Array<OperationSchema>;
831
+ statusCodes?: Array<OperationSchema>;
832
+ errors?: Array<OperationSchema>;
833
+ };
834
+ type ByTag = {
835
+ type: 'tag';
836
+ pattern: string | RegExp;
837
+ };
838
+ type ByOperationId = {
839
+ type: 'operationId';
840
+ pattern: string | RegExp;
841
+ };
842
+ type ByPath = {
843
+ type: 'path';
844
+ pattern: string | RegExp;
845
+ };
846
+ type ByMethod = {
847
+ type: 'method';
848
+ pattern: HttpMethod | RegExp;
849
+ };
850
+ type BySchemaName = {
851
+ type: 'schemaName';
852
+ pattern: string | RegExp;
853
+ };
854
+ type ByContentType = {
855
+ type: 'contentType';
856
+ pattern: string | RegExp;
857
+ };
858
+ type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
859
+ type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
860
+ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
861
+ options: Partial<TOptions>;
862
+ };
863
+ //#endregion
940
864
  //#region ../plugin-oas/src/SchemaGenerator.d.ts
941
- type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
865
+ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
942
866
  fabric: Fabric;
943
867
  oas: Oas;
944
868
  pluginManager: PluginManager;
@@ -971,15 +895,15 @@ type SchemaGeneratorOptions = {
971
895
  * TODO TODO add docs
972
896
  * @beta
973
897
  */
974
- schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined;
898
+ schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Schema[] | undefined;
975
899
  };
976
900
  };
977
- type SchemaProps = {
901
+ type SchemaProps$1 = {
978
902
  schemaObject?: SchemaObject$1;
979
903
  name?: string;
980
904
  parentName?: string;
981
905
  };
982
- declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
906
+ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
983
907
  #private;
984
908
  refs: Refs;
985
909
  /**
@@ -987,16 +911,86 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
987
911
  * Delegates to getBaseTypeFromSchema internally and
988
912
  * optionally adds a union with null.
989
913
  */
990
- parse(props: SchemaProps): Schema[];
991
- deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
992
- find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
914
+ parse(props: SchemaProps$1): Schema[];
993
915
  static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
994
- static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
995
916
  static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
996
917
  static combineObjects(tree: Schema[] | undefined): Schema[];
997
918
  build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
998
919
  }
999
920
  //#endregion
921
+ //#region ../plugin-oas/src/generators/createGenerator.d.ts
922
+ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
923
+ name: string;
924
+ type: 'core';
925
+ operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
926
+ operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
927
+ schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
928
+ };
929
+ //#endregion
930
+ //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
931
+ type ReactGenerator<TOptions extends PluginFactoryOptions> = {
932
+ name: string;
933
+ type: 'react';
934
+ Operations: (props: OperationsProps<TOptions>) => KubbNode;
935
+ Operation: (props: OperationProps<TOptions>) => KubbNode;
936
+ Schema: (props: SchemaProps<TOptions>) => KubbNode;
937
+ };
938
+ //#endregion
939
+ //#region ../plugin-oas/src/generators/types.d.ts
940
+ type OperationsProps<TOptions extends PluginFactoryOptions> = {
941
+ config: Config;
942
+ generator: Omit<OperationGenerator<TOptions>, 'build'>;
943
+ plugin: Plugin<TOptions>;
944
+ operations: Array<Operation$1>;
945
+ };
946
+ type OperationProps<TOptions extends PluginFactoryOptions> = {
947
+ config: Config;
948
+ generator: Omit<OperationGenerator<TOptions>, 'build'>;
949
+ plugin: Plugin<TOptions>;
950
+ operation: Operation$1;
951
+ };
952
+ type SchemaProps<TOptions extends PluginFactoryOptions> = {
953
+ config: Config;
954
+ generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
955
+ plugin: Plugin<TOptions>;
956
+ schema: {
957
+ name: string;
958
+ tree: Array<Schema>;
959
+ value: SchemaObject$1;
960
+ };
961
+ };
962
+ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
963
+ //#endregion
964
+ //#region ../plugin-oas/src/OperationGenerator.d.ts
965
+ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
966
+ fabric: Fabric;
967
+ oas: Oas;
968
+ exclude: Array<Exclude$1> | undefined;
969
+ include: Array<Include> | undefined;
970
+ override: Array<Override<TOptions>> | undefined;
971
+ contentType: contentType | undefined;
972
+ pluginManager: PluginManager;
973
+ /**
974
+ * Current plugin
975
+ */
976
+ plugin: Plugin<TPluginOptions>;
977
+ mode: KubbFile.Mode;
978
+ };
979
+ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
980
+ #private;
981
+ getSchemas(operation: Operation$1, {
982
+ resolveName
983
+ }?: {
984
+ resolveName?: (name: string) => string;
985
+ }): OperationSchemas;
986
+ getOperations(): Promise<Array<{
987
+ path: string;
988
+ method: HttpMethod;
989
+ operation: Operation$1;
990
+ }>>;
991
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
992
+ }
993
+ //#endregion
1000
994
  //#region src/types.d.ts
1001
995
  type Options$1 = {
1002
996
  /**
@@ -1052,5 +1046,5 @@ type ResolvedOptions = {
1052
1046
  };
1053
1047
  type PluginCypress = PluginFactoryOptions<'plugin-cypress', Options$1, ResolvedOptions, never, ResolvePathOptions>;
1054
1048
  //#endregion
1055
- export { UserPluginWithLifeCycle as a, ReactGenerator as i, PluginCypress as n, HttpMethod as o, OperationSchemas as r, Options$1 as t };
1056
- //# sourceMappingURL=types-bObu7JjR.d.cts.map
1049
+ export { UserPluginWithLifeCycle as a, OperationSchemas as i, PluginCypress as n, HttpMethod as o, ReactGenerator as r, Options$1 as t };
1050
+ //# sourceMappingURL=types-Da3VNOH7.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-cypress",
3
- "version": "4.4.1",
3
+ "version": "4.5.1",
4
4
  "description": "Cypress test generator plugin for Kubb, creating end-to-end tests from OpenAPI specifications for automated API testing.",
5
5
  "keywords": [
6
6
  "cypress",
@@ -74,15 +74,15 @@
74
74
  }
75
75
  ],
76
76
  "dependencies": {
77
- "@kubb/react-fabric": "0.2.10",
78
- "@kubb/core": "4.4.1",
79
- "@kubb/oas": "4.4.1",
80
- "@kubb/plugin-oas": "4.4.1",
81
- "@kubb/plugin-ts": "4.4.1"
77
+ "@kubb/react-fabric": "0.2.14",
78
+ "@kubb/core": "4.5.1",
79
+ "@kubb/oas": "4.5.1",
80
+ "@kubb/plugin-oas": "4.5.1",
81
+ "@kubb/plugin-ts": "4.5.1"
82
82
  },
83
83
  "devDependencies": {},
84
84
  "peerDependencies": {
85
- "@kubb/react-fabric": "0.2.10"
85
+ "@kubb/react-fabric": "0.2.14"
86
86
  },
87
87
  "engines": {
88
88
  "node": ">=20"
@@ -1,6 +1,6 @@
1
- import { usePlugin, usePluginManager } from '@kubb/core/hooks'
1
+ import { usePluginManager } from '@kubb/core/hooks'
2
2
  import { URLPath } from '@kubb/core/utils'
3
- import { createReactGenerator } from '@kubb/plugin-oas'
3
+ import { createReactGenerator } from '@kubb/plugin-oas/generators'
4
4
  import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
5
5
  import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
6
6
  import { pluginTsName } from '@kubb/plugin-ts'
@@ -10,14 +10,14 @@ import type { PluginCypress } from '../types'
10
10
 
11
11
  export const cypressGenerator = createReactGenerator<PluginCypress>({
12
12
  name: 'cypress',
13
- Operation({ operation }) {
13
+ Operation({ operation, generator, plugin }) {
14
14
  const {
15
15
  options: { output, baseURL, dataReturnType },
16
- } = usePlugin<PluginCypress>()
16
+ } = plugin
17
17
  const pluginManager = usePluginManager()
18
18
 
19
19
  const oas = useOas()
20
- const { getSchemas, getName, getFile } = useOperationManager()
20
+ const { getSchemas, getName, getFile } = useOperationManager(generator)
21
21
 
22
22
  const request = {
23
23
  name: getName(operation, { type: 'function' }),
package/src/types.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { Group, Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
2
2
 
3
3
  import type { contentType, Oas } from '@kubb/oas'
4
- import type { Exclude, Generator, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas'
4
+ import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas'
5
+ import type { Generator } from '@kubb/plugin-oas/generators'
5
6
 
6
7
  export type Options = {
7
8
  /**
@@ -1 +0,0 @@
1
- {"version":3,"file":"generators-CKKLK5ah.cjs","names":["pluginTsName","File","Request","URLPath"],"sources":["../src/generators/cypressGenerator.tsx"],"sourcesContent":["import { usePlugin, usePluginManager } from '@kubb/core/hooks'\nimport { URLPath } from '@kubb/core/utils'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Request } from '../components'\nimport type { PluginCypress } from '../types'\n\nexport const cypressGenerator = createReactGenerator<PluginCypress>({\n name: 'cypress',\n Operation({ operation }) {\n const {\n options: { output, baseURL, dataReturnType },\n } = usePlugin<PluginCypress>()\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const request = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={request.file.baseName}\n path={request.file.path}\n meta={request.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={request.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <Request\n name={request.name}\n dataReturnType={dataReturnType}\n typeSchemas={type.schemas}\n method={operation.method}\n baseURL={baseURL}\n url={new URLPath(operation.path).toURLPath()}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,MAAa,+DAAuD;CAClE,MAAM;CACN,UAAU,EAAE,aAAa;EACvB,MAAM,EACJ,SAAS,EAAE,QAAQ,SAAS,uDACA;EAC9B,MAAM,yDAAkC;EAExC,MAAM,2CAAc;EACpB,MAAM,EAAE,YAAY,SAAS,8DAAiC;EAE9D,MAAM,UAAU;GACd,MAAM,QAAQ,WAAW,EAAE,MAAM,YAAY,CAAC;GAC9C,MAAM,QAAQ,UAAU;GACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACA,8BAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAACA,8BAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,0DAACC;GACC,UAAU,QAAQ,KAAK;GACvB,MAAM,QAAQ,KAAK;GACnB,MAAM,QAAQ,KAAK;GACnB,+CAAkB;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,+CAAkB;IAAE;IAAK;IAAQ,CAAC;cAElC,yDAACA,yBAAK;IACJ,MAAM;KACJ,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,YAAY;KACzB,KAAK,QAAQ,aAAa;KAC1B,KAAK,QAAQ,cAAc;KAC3B,GAAI,KAAK,QAAQ,aAAa,KAAK,SAAS,KAAK,KAAK,IAAI,EAAE;KAC7D,CAAC,OAAO,QAAQ;IACjB,MAAM,QAAQ,KAAK;IACnB,MAAM,KAAK,KAAK;IAChB;KACA,EACF,yDAACC;IACC,MAAM,QAAQ;IACE;IAChB,aAAa,KAAK;IAClB,QAAQ,UAAU;IACT;IACT,KAAK,IAAIC,0BAAQ,UAAU,KAAK,CAAC,WAAW;KAC5C;IACG;;CAGZ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generators-CfF-r6zR.js","names":[],"sources":["../src/generators/cypressGenerator.tsx"],"sourcesContent":["import { usePlugin, usePluginManager } from '@kubb/core/hooks'\nimport { URLPath } from '@kubb/core/utils'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Request } from '../components'\nimport type { PluginCypress } from '../types'\n\nexport const cypressGenerator = createReactGenerator<PluginCypress>({\n name: 'cypress',\n Operation({ operation }) {\n const {\n options: { output, baseURL, dataReturnType },\n } = usePlugin<PluginCypress>()\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const request = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={request.file.baseName}\n path={request.file.path}\n meta={request.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={request.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <Request\n name={request.name}\n dataReturnType={dataReturnType}\n typeSchemas={type.schemas}\n method={operation.method}\n baseURL={baseURL}\n url={new URLPath(operation.path).toURLPath()}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,mBAAmB,qBAAoC;CAClE,MAAM;CACN,UAAU,EAAE,aAAa;EACvB,MAAM,EACJ,SAAS,EAAE,QAAQ,SAAS,qBAC1B,WAA0B;EAC9B,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,YAAY,SAAS,YAAY,qBAAqB;EAE9D,MAAM,UAAU;GACd,MAAM,QAAQ,WAAW,EAAE,MAAM,YAAY,CAAC;GAC9C,MAAM,QAAQ,UAAU;GACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAAC,aAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,qBAAC;GACC,UAAU,QAAQ,KAAK;GACvB,MAAM,QAAQ,KAAK;GACnB,MAAM,QAAQ,KAAK;GACnB,QAAQ,UAAU;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,QAAQ,UAAU;IAAE;IAAK;IAAQ,CAAC;cAElC,oBAAC,KAAK;IACJ,MAAM;KACJ,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,YAAY;KACzB,KAAK,QAAQ,aAAa;KAC1B,KAAK,QAAQ,cAAc;KAC3B,GAAI,KAAK,QAAQ,aAAa,KAAK,SAAS,KAAK,KAAK,IAAI,EAAE;KAC7D,CAAC,OAAO,QAAQ;IACjB,MAAM,QAAQ,KAAK;IACnB,MAAM,KAAK,KAAK;IAChB;KACA,EACF,oBAAC;IACC,MAAM,QAAQ;IACE;IAChB,aAAa,KAAK;IAClB,QAAQ,UAAU;IACT;IACT,KAAK,IAAI,QAAQ,UAAU,KAAK,CAAC,WAAW;KAC5C;IACG;;CAGZ,CAAC"}