oazapfts 6.3.0 → 6.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.cjs","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport fs from \"fs\";\nimport minimist from \"minimist\";\n\nimport { generateSource, Opts, optsArgumentStyles } from \"./\";\n\nconst argv = minimist(process.argv.slice(2), {\n alias: {\n i: \"include\",\n e: \"exclude\",\n },\n boolean: [\"optimistic\", \"useEnumType\", \"mergeReadWriteOnly\", \"useUnknown\"],\n string: [\"argumentStyle\"],\n});\n\nasync function generate(spec: string, dest: string, opts: Opts) {\n const code = await generateSource(spec, opts);\n if (dest) fs.writeFileSync(dest, code);\n else console.log(code);\n}\n\nconst {\n include,\n exclude,\n optimistic,\n useEnumType,\n mergeReadWriteOnly,\n useUnknown,\n argumentStyle,\n} = argv;\nconst [spec, dest] = argv._;\nif (!spec) {\n console.error(`\n Usage:\n oazapfts <spec> [filename]\n\n Options:\n --exclude, -e <tag to exclude>\n --include, -i <tag to include>\n --optimistic\n --useEnumType\n --useUnknown\n --mergeReadWriteOnly\n --argumentStyle=<${optsArgumentStyles.join(\" | \")}> (default: positional)\n`);\n process.exit(1);\n}\n\nif (\n argumentStyle !== undefined &&\n !optsArgumentStyles.includes(argumentStyle)\n) {\n console.error(\n `--argumentStyle should be one of <${optsArgumentStyles.join(\n \" | \",\n )}>, but got \"${argumentStyle}\"`,\n );\n process.exit(1);\n}\n\ngenerate(spec, dest, {\n include,\n exclude,\n optimistic,\n useEnumType,\n useUnknown,\n mergeReadWriteOnly,\n argumentStyle,\n});\n"],"names":["argv","minimist","generate","spec","dest","opts","__async","code","generateSource","fs","include","exclude","optimistic","useEnumType","mergeReadWriteOnly","useUnknown","argumentStyle","optsArgumentStyles"],"mappings":";+RAOMA,EAAOC,EAAS,QAAQ,KAAK,MAAM,CAAC,EAAG,CAC3C,MAAO,CACL,EAAG,UACH,EAAG,SACL,EACA,QAAS,CAAC,aAAc,cAAe,qBAAsB,YAAY,EACzE,OAAQ,CAAC,eAAe,CAC1B,CAAC,EAED,SAAeC,EAASC,EAAcC,EAAcC,EAAY,QAAAC,EAAA,sBAC9D,MAAMC,EAAO,MAAMC,iBAAeL,EAAME,CAAI,EACxCD,EAAMK,EAAG,cAAcL,EAAMG,CAAI,EAChC,QAAQ,IAAIA,CAAI,CACvB,GAEA,KAAM,CACJ,QAAAG,EACA,QAAAC,EACA,WAAAC,EACA,YAAAC,EACA,mBAAAC,EACA,WAAAC,EACA,cAAAC,CACF,EAAIhB,EACE,CAACG,EAAMC,CAAI,EAAIJ,EAAK,EACrBG,IACH,QAAQ,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAWOc,EAAA,mBAAmB,KAAK,KAAK,CAAC;AAAA,CACpD,EACC,QAAQ,KAAK,CAAC,GAIdD,IAAkB,QAClB,CAACC,EAAmB,mBAAA,SAASD,CAAa,IAElC,QAAA,MACN,qCAAqCC,EAAAA,mBAAmB,KACtD,KAAA,CACD,eAAeD,CAAa,GAC/B,EACA,QAAQ,KAAK,CAAC,GAGhBd,EAASC,EAAMC,EAAM,CACnB,QAAAM,EACA,QAAAC,EACA,WAAAC,EACA,YAAAC,EACA,WAAAE,EACA,mBAAAD,EACA,cAAAE,CACF,CAAC"}
1
+ {"version":3,"file":"cli.cjs","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport fs from \"fs\";\nimport minimist from \"minimist\";\n\nimport { generateSource, Opts, optsArgumentStyles } from \"./\";\n\nconst argv = minimist(process.argv.slice(2), {\n alias: {\n i: \"include\",\n e: \"exclude\",\n },\n boolean: [\"optimistic\", \"useEnumType\", \"mergeReadWriteOnly\", \"useUnknown\"],\n string: [\"argumentStyle\"],\n});\n\nasync function generate(spec: string, dest: string, opts: Opts) {\n const code = await generateSource(spec, opts);\n if (dest) fs.writeFileSync(dest, code);\n else console.log(code);\n}\n\nconst {\n include,\n exclude,\n optimistic,\n useEnumType,\n mergeReadWriteOnly,\n useUnknown,\n argumentStyle,\n} = argv;\nconst [spec, dest] = argv._;\nif (!spec) {\n console.error(`\n Usage:\n oazapfts <spec> [filename]\n\n Options:\n --exclude, -e <tag to exclude>\n --include, -i <tag to include>\n --optimistic\n --useEnumType\n --useUnknown\n --mergeReadWriteOnly\n --argumentStyle=<${optsArgumentStyles.join(\" | \")}> (default: positional)\n`);\n process.exit(1);\n}\n\nif (\n argumentStyle !== undefined &&\n !optsArgumentStyles.includes(argumentStyle)\n) {\n console.error(\n `--argumentStyle should be one of <${optsArgumentStyles.join(\n \" | \",\n )}>, but got \"${argumentStyle}\"`,\n );\n process.exit(1);\n}\n\ngenerate(spec, dest, {\n include,\n exclude,\n optimistic,\n useEnumType,\n useUnknown,\n mergeReadWriteOnly,\n argumentStyle,\n});\n"],"names":["argv","minimist","generate","spec","dest","opts","__async","code","generateSource","fs","include","exclude","optimistic","useEnumType","mergeReadWriteOnly","useUnknown","argumentStyle","optsArgumentStyles"],"mappings":";+RAOMA,EAAOC,EAAS,QAAQ,KAAK,MAAM,CAAC,EAAG,CAC3C,MAAO,CACL,EAAG,UACH,EAAG,SAAA,EAEL,QAAS,CAAC,aAAc,cAAe,qBAAsB,YAAY,EACzE,OAAQ,CAAC,eAAe,CAC1B,CAAC,EAED,SAAeC,EAASC,EAAcC,EAAcC,EAAY,QAAAC,EAAA,sBAC9D,MAAMC,EAAO,MAAMC,iBAAeL,EAAME,CAAI,EACxCD,EAAMK,EAAG,cAAcL,EAAMG,CAAI,EAChC,QAAQ,IAAIA,CAAI,CACvB,GAEA,KAAM,CACJ,QAAAG,EACA,QAAAC,EACA,WAAAC,EACA,YAAAC,EACA,mBAAAC,EACA,WAAAC,EACA,cAAAC,CACF,EAAIhB,EACE,CAACG,EAAMC,CAAI,EAAIJ,EAAK,EACrBG,IACH,QAAQ,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAWOc,EAAAA,mBAAmB,KAAK,KAAK,CAAC;AAAA,CACpD,EACC,QAAQ,KAAK,CAAC,GAIdD,IAAkB,QAClB,CAACC,EAAAA,mBAAmB,SAASD,CAAa,IAE1C,QAAQ,MACN,qCAAqCC,EAAAA,mBAAmB,KACtD,KAAA,CACD,eAAeD,CAAa,GAAA,EAE/B,QAAQ,KAAK,CAAC,GAGhBd,EAASC,EAAMC,EAAM,CACnB,QAAAM,EACA,QAAAC,EACA,WAAAC,EACA,YAAAC,EACA,WAAAE,EACA,mBAAAD,EACA,cAAAE,CACF,CAAC"}
package/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport fs from \"fs\";\nimport minimist from \"minimist\";\n\nimport { generateSource, Opts, optsArgumentStyles } from \"./\";\n\nconst argv = minimist(process.argv.slice(2), {\n alias: {\n i: \"include\",\n e: \"exclude\",\n },\n boolean: [\"optimistic\", \"useEnumType\", \"mergeReadWriteOnly\", \"useUnknown\"],\n string: [\"argumentStyle\"],\n});\n\nasync function generate(spec: string, dest: string, opts: Opts) {\n const code = await generateSource(spec, opts);\n if (dest) fs.writeFileSync(dest, code);\n else console.log(code);\n}\n\nconst {\n include,\n exclude,\n optimistic,\n useEnumType,\n mergeReadWriteOnly,\n useUnknown,\n argumentStyle,\n} = argv;\nconst [spec, dest] = argv._;\nif (!spec) {\n console.error(`\n Usage:\n oazapfts <spec> [filename]\n\n Options:\n --exclude, -e <tag to exclude>\n --include, -i <tag to include>\n --optimistic\n --useEnumType\n --useUnknown\n --mergeReadWriteOnly\n --argumentStyle=<${optsArgumentStyles.join(\" | \")}> (default: positional)\n`);\n process.exit(1);\n}\n\nif (\n argumentStyle !== undefined &&\n !optsArgumentStyles.includes(argumentStyle)\n) {\n console.error(\n `--argumentStyle should be one of <${optsArgumentStyles.join(\n \" | \",\n )}>, but got \"${argumentStyle}\"`,\n );\n process.exit(1);\n}\n\ngenerate(spec, dest, {\n include,\n exclude,\n optimistic,\n useEnumType,\n useUnknown,\n mergeReadWriteOnly,\n argumentStyle,\n});\n"],"names":["argv","minimist","generate","spec","dest","opts","code","generateSource","fs","include","exclude","optimistic","useEnumType","mergeReadWriteOnly","useUnknown","argumentStyle","optsArgumentStyles"],"mappings":";;;;AAOA,MAAMA,IAAOC,EAAS,QAAQ,KAAK,MAAM,CAAC,GAAG;AAAA,EAC3C,OAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAAA,EACA,SAAS,CAAC,cAAc,eAAe,sBAAsB,YAAY;AAAA,EACzE,QAAQ,CAAC,eAAe;AAC1B,CAAC;AAED,eAAeC,EAASC,GAAcC,GAAcC,GAAY;AAC9D,QAAMC,IAAO,MAAMC,EAAeJ,GAAME,CAAI;AAC5C,EAAID,IAAMI,EAAG,cAAcJ,GAAME,CAAI,IAChC,QAAQ,IAAIA,CAAI;AACvB;AAEA,MAAM;AAAA,EACJ,SAAAG;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AACF,IAAIf,GACE,CAACG,GAAMC,CAAI,IAAIJ,EAAK;AACrBG,MACH,QAAQ,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAWOa,EAAmB,KAAK,KAAK,CAAC;AAAA,CACpD,GACC,QAAQ,KAAK,CAAC;AAIdD,MAAkB,UAClB,CAACC,EAAmB,SAASD,CAAa,MAElC,QAAA;AAAA,EACN,qCAAqCC,EAAmB;AAAA,IACtD;AAAA,EAAA,CACD,eAAeD,CAAa;AAC/B,GACA,QAAQ,KAAK,CAAC;AAGhBb,EAASC,GAAMC,GAAM;AAAA,EACnB,SAAAK;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAE;AAAA,EACA,oBAAAD;AAAA,EACA,eAAAE;AACF,CAAC;"}
1
+ {"version":3,"file":"cli.js","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport fs from \"fs\";\nimport minimist from \"minimist\";\n\nimport { generateSource, Opts, optsArgumentStyles } from \"./\";\n\nconst argv = minimist(process.argv.slice(2), {\n alias: {\n i: \"include\",\n e: \"exclude\",\n },\n boolean: [\"optimistic\", \"useEnumType\", \"mergeReadWriteOnly\", \"useUnknown\"],\n string: [\"argumentStyle\"],\n});\n\nasync function generate(spec: string, dest: string, opts: Opts) {\n const code = await generateSource(spec, opts);\n if (dest) fs.writeFileSync(dest, code);\n else console.log(code);\n}\n\nconst {\n include,\n exclude,\n optimistic,\n useEnumType,\n mergeReadWriteOnly,\n useUnknown,\n argumentStyle,\n} = argv;\nconst [spec, dest] = argv._;\nif (!spec) {\n console.error(`\n Usage:\n oazapfts <spec> [filename]\n\n Options:\n --exclude, -e <tag to exclude>\n --include, -i <tag to include>\n --optimistic\n --useEnumType\n --useUnknown\n --mergeReadWriteOnly\n --argumentStyle=<${optsArgumentStyles.join(\" | \")}> (default: positional)\n`);\n process.exit(1);\n}\n\nif (\n argumentStyle !== undefined &&\n !optsArgumentStyles.includes(argumentStyle)\n) {\n console.error(\n `--argumentStyle should be one of <${optsArgumentStyles.join(\n \" | \",\n )}>, but got \"${argumentStyle}\"`,\n );\n process.exit(1);\n}\n\ngenerate(spec, dest, {\n include,\n exclude,\n optimistic,\n useEnumType,\n useUnknown,\n mergeReadWriteOnly,\n argumentStyle,\n});\n"],"names":["argv","minimist","generate","spec","dest","opts","code","generateSource","fs","include","exclude","optimistic","useEnumType","mergeReadWriteOnly","useUnknown","argumentStyle","optsArgumentStyles"],"mappings":";;;;AAOA,MAAMA,IAAOC,EAAS,QAAQ,KAAK,MAAM,CAAC,GAAG;AAAA,EAC3C,OAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,EAAA;AAAA,EAEL,SAAS,CAAC,cAAc,eAAe,sBAAsB,YAAY;AAAA,EACzE,QAAQ,CAAC,eAAe;AAC1B,CAAC;AAED,eAAeC,EAASC,GAAcC,GAAcC,GAAY;AAC9D,QAAMC,IAAO,MAAMC,EAAeJ,GAAME,CAAI;AAC5C,EAAID,IAAMI,EAAG,cAAcJ,GAAME,CAAI,IAChC,QAAQ,IAAIA,CAAI;AACvB;AAEA,MAAM;AAAA,EACJ,SAAAG;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AACF,IAAIf,GACE,CAACG,GAAMC,CAAI,IAAIJ,EAAK;AACrBG,MACH,QAAQ,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAWOa,EAAmB,KAAK,KAAK,CAAC;AAAA,CACpD,GACC,QAAQ,KAAK,CAAC;AAIdD,MAAkB,UAClB,CAACC,EAAmB,SAASD,CAAa,MAE1C,QAAQ;AAAA,EACN,qCAAqCC,EAAmB;AAAA,IACtD;AAAA,EAAA,CACD,eAAeD,CAAa;AAAA,GAE/B,QAAQ,KAAK,CAAC;AAGhBb,EAASC,GAAMC,GAAM;AAAA,EACnB,SAAAK;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAE;AAAA,EACA,oBAAAD;AAAA,EACA,eAAAE;AACF,CAAC;"}
package/generate.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("lodash");require("typescript");const e=require("./tscodegen-BLknMY2_.cjs");exports.addComment=e.addComment;exports.appendNodes=e.appendNodes;exports.block=e.block;exports.callOazapftsFunction=e.callOazapftsFunction;exports.callQsFunction=e.callQsFunction;exports.changePropertyValue=e.changePropertyValue;exports.createArrowFunction=e.createArrowFunction;exports.createCall=e.createCall;exports.createClassDeclaration=e.createClassDeclaration;exports.createConstructor=e.createConstructor;exports.createEnumTypeNode=e.createEnumTypeNode;exports.createFunctionDeclaration=e.createFunctionDeclaration;exports.createIndexSignature=e.createIndexSignature;exports.createInterfaceAliasDeclaration=e.createInterfaceAliasDeclaration;exports.createKeywordType=e.createKeywordType;exports.createLiteral=e.createLiteral;exports.createMethod=e.createMethod;exports.createMethodCall=e.createMethodCall;exports.createObjectBinding=e.createObjectBinding;exports.createObjectLiteral=e.createObjectLiteral;exports.createParameter=e.createParameter;exports.createPropertyAssignment=e.createPropertyAssignment;exports.createPropertySignature=e.createPropertySignature;exports.createQuestionToken=e.createQuestionToken;exports.createTemplateString=e.createTemplateString;exports.createTypeAliasDeclaration=e.createTypeAliasDeclaration;exports.createUrlExpression=e.createUrlExpression;exports.default=e.ApiGenerator;exports.defaultBaseUrl=e.defaultBaseUrl;exports.findFirstVariableDeclaration=e.findFirstVariableDeclaration;exports.findNode=e.findNode;exports.getBodyFormatter=e.getBodyFormatter;exports.getFirstDeclarationName=e.getFirstDeclarationName;exports.getFormatter=e.getFormatter;exports.getName=e.getName;exports.getOperationIdentifier=e.getOperationIdentifier;exports.getOperationName=e.getOperationName;exports.getReferenceName=e.getReferenceName;exports.isJsonMimeType=e.isJsonMimeType;exports.isMimeType=e.isMimeType;exports.isNullable=e.isNullable;exports.isReference=e.isReference;exports.isValidIdentifier=e.isValidIdentifier;exports.keywordType=e.keywordType;exports.modifier=e.modifier;exports.printFile=e.printFile;exports.printNode=e.printNode;exports.printNodes=e.printNodes;exports.questionToken=e.questionToken;exports.refPathToPropertyPath=e.refPathToPropertyPath;exports.supportDeepObjects=e.supportDeepObjects;exports.toExpression=e.toExpression;exports.toIdentifier=e.toIdentifier;exports.verbs=e.verbs;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("lodash");require("typescript");const e=require("./tscodegen-pfm_MWoH.cjs");exports.addComment=e.addComment;exports.appendNodes=e.appendNodes;exports.block=e.block;exports.callOazapftsFunction=e.callOazapftsFunction;exports.callQsFunction=e.callQsFunction;exports.changePropertyValue=e.changePropertyValue;exports.createArrowFunction=e.createArrowFunction;exports.createCall=e.createCall;exports.createClassDeclaration=e.createClassDeclaration;exports.createConstructor=e.createConstructor;exports.createEnumTypeNode=e.createEnumTypeNode;exports.createFunctionDeclaration=e.createFunctionDeclaration;exports.createIndexSignature=e.createIndexSignature;exports.createInterfaceAliasDeclaration=e.createInterfaceAliasDeclaration;exports.createKeywordType=e.createKeywordType;exports.createLiteral=e.createLiteral;exports.createMethod=e.createMethod;exports.createMethodCall=e.createMethodCall;exports.createObjectBinding=e.createObjectBinding;exports.createObjectLiteral=e.createObjectLiteral;exports.createParameter=e.createParameter;exports.createPropertyAssignment=e.createPropertyAssignment;exports.createPropertySignature=e.createPropertySignature;exports.createQuestionToken=e.createQuestionToken;exports.createTemplateString=e.createTemplateString;exports.createTypeAliasDeclaration=e.createTypeAliasDeclaration;exports.createUrlExpression=e.createUrlExpression;exports.default=e.ApiGenerator;exports.defaultBaseUrl=e.defaultBaseUrl;exports.findFirstVariableDeclaration=e.findFirstVariableDeclaration;exports.findNode=e.findNode;exports.getBodyFormatter=e.getBodyFormatter;exports.getFirstDeclarationName=e.getFirstDeclarationName;exports.getFormatter=e.getFormatter;exports.getName=e.getName;exports.getOperationIdentifier=e.getOperationIdentifier;exports.getOperationName=e.getOperationName;exports.getReferenceName=e.getReferenceName;exports.isJsonMimeType=e.isJsonMimeType;exports.isMimeType=e.isMimeType;exports.isNullable=e.isNullable;exports.isReference=e.isReference;exports.isValidIdentifier=e.isValidIdentifier;exports.keywordType=e.keywordType;exports.modifier=e.modifier;exports.printFile=e.printFile;exports.printNode=e.printNode;exports.printNodes=e.printNodes;exports.questionToken=e.questionToken;exports.refPathToPropertyPath=e.refPathToPropertyPath;exports.supportDeepObjects=e.supportDeepObjects;exports.toExpression=e.toExpression;exports.toIdentifier=e.toIdentifier;exports.verbs=e.verbs;
2
2
  //# sourceMappingURL=generate.cjs.map
package/generate.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "lodash";
2
2
  import "typescript";
3
- import { Y as r, X as i, H as o, m as n, l as c, W as l, I as p, D as d, K as m, L as u, y as f, J as g, P as y, B as N, u as T, x as F, M as b, E as D, Q as P, F as O, N as h, G as C, O as I, n as k, R as x, z as A, k as M, A as j, a0 as w, V as B, S as E, g as S, U as V, b as L, T as Q, c as R, d as U, h as q, a as v, i as z, e as J, f as K, $ as G, o as H, w as W, p as X, Z as Y, _ as Z, q as _, r as $, s as ee, C as ae, j as te, v as se } from "./tscodegen-BSr1G7_b.js";
3
+ import { Y as r, X as i, H as o, m as n, l as c, W as l, I as p, D as d, K as m, L as u, y as f, J as g, P as y, B as N, u as T, x as F, M as b, E as D, Q as P, F as O, N as h, G as C, O as I, n as k, R as x, z as A, k as M, A as j, a0 as w, V as B, S as E, g as S, U as V, b as L, T as Q, c as R, d as U, h as q, a as v, i as z, e as J, f as K, $ as G, o as H, w as W, p as X, Z as Y, _ as Z, q as _, r as $, s as ee, C as ae, j as te, v as se } from "./tscodegen-BjtNU8_R.js";
4
4
  export {
5
5
  r as addComment,
6
6
  i as appendNodes,
package/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var u=(e,t,r)=>new Promise((s,i)=>{var a=n=>{try{o(r.next(n))}catch(c){i(c)}},p=n=>{try{o(r.throw(n))}catch(c){i(c)}},o=n=>n.done?s(n.value):Promise.resolve(n.value).then(a,p);o((r=r.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./tscodegen-BLknMY2_.cjs"),v=require("@apidevtools/swagger-parser"),A=require("swagger2openapi"),S=["positional","object"];function g(e,t,r){return new l.ApiGenerator(e,t,r).generateApi()}function d(e){return l.printFile(e)}function b(r){return u(this,arguments,function*(e,t={}){var{doc:s,isConverted:i}=yield f(e);const a=g(s,t,i),{title:p,version:o}=s.info,n=["$&",p,o].filter(Boolean).join(`
1
+ "use strict";var u=(e,t,r)=>new Promise((s,i)=>{var a=n=>{try{o(r.next(n))}catch(c){i(c)}},p=n=>{try{o(r.throw(n))}catch(c){i(c)}},o=n=>n.done?s(n.value):Promise.resolve(n.value).then(a,p);o((r=r.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./tscodegen-pfm_MWoH.cjs"),v=require("@apidevtools/swagger-parser"),A=require("swagger2openapi"),S=["positional","object"];function g(e,t,r){return new l.ApiGenerator(e,t,r).generateApi()}function d(e){return l.printFile(e)}function b(r){return u(this,arguments,function*(e,t={}){const{doc:s,isConverted:i}=yield f(e),a=g(s,t,i),{title:p,version:o}=s.info,n=["$&",p,o].filter(Boolean).join(`
2
2
  * `);return d(a).replace(/^\/\*\*/,n)})}function y(e){return"openapi"in e&&e.openapi.startsWith("3")}function f(e){return u(this,null,function*(){const t=yield v.bundle(e);return y(t)?{doc:t,isConverted:!1}:{doc:(yield A.convertObj(t,{})).openapi,isConverted:!0}})}exports.cg=l.tscodegen;exports.generateAst=g;exports.generateSource=b;exports.optsArgumentStyles=S;exports.parseSpec=f;exports.printAst=d;
3
3
  //# sourceMappingURL=index.cjs.map
package/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import * as cg from \"./tscodegen\";\nimport ApiGenerator from \"./generate\";\nimport ts from \"typescript\";\nimport SwaggerParser from \"@apidevtools/swagger-parser\";\nimport converter from \"swagger2openapi\";\nimport { OpenAPI, OpenAPIV3 } from \"openapi-types\";\n\nexport { cg };\n\nexport const optsArgumentStyles = [\"positional\", \"object\"];\nexport type Opts = {\n include?: string[];\n exclude?: string[];\n optimistic?: boolean;\n unionUndefined?: boolean;\n useEnumType?: boolean;\n mergeReadWriteOnly?: boolean;\n useUnknown?: boolean;\n argumentStyle?: (typeof optsArgumentStyles)[number];\n};\n\nexport function generateAst(\n doc: OpenAPIV3.Document,\n opts: Opts,\n isConverted: boolean,\n) {\n return new ApiGenerator(doc, opts, isConverted).generateApi();\n}\n\nexport function printAst(ast: ts.SourceFile) {\n return cg.printFile(ast);\n}\n\nexport async function generateSource(spec: string, opts: Opts = {}) {\n var { doc, isConverted } = await parseSpec(spec);\n const ast = generateAst(doc, opts, isConverted);\n const { title, version } = doc.info;\n const preamble = [\"$&\", title, version].filter(Boolean).join(\"\\n * \");\n const src = printAst(ast);\n return src.replace(/^\\/\\*\\*/, preamble);\n}\n\nfunction isOpenApiV3(doc: OpenAPI.Document): doc is OpenAPIV3.Document {\n return \"openapi\" in doc && doc.openapi.startsWith(\"3\");\n}\n\nexport async function parseSpec(spec: string) {\n const doc = await SwaggerParser.bundle(spec);\n if (isOpenApiV3(doc)) {\n return {\n doc,\n isConverted: false,\n };\n } else {\n const converted = await converter.convertObj(doc, {});\n return {\n doc: converted.openapi as OpenAPIV3.Document,\n isConverted: true,\n };\n }\n}\n"],"names":["optsArgumentStyles","generateAst","doc","opts","isConverted","ApiGenerator","printAst","ast","cg.printFile","generateSource","_0","__async","spec","parseSpec","title","version","preamble","isOpenApiV3","SwaggerParser","converter"],"mappings":"+YASaA,EAAqB,CAAC,aAAc,QAAQ,EAYzC,SAAAC,EACdC,EACAC,EACAC,EACA,CACA,OAAO,IAAIC,EAAa,aAAAH,EAAKC,EAAMC,CAAW,EAAE,YAAY,CAC9D,CAEO,SAASE,EAASC,EAAoB,CACpC,OAAAC,EAAAA,UAAaD,CAAG,CACzB,CAEA,SAAsBE,EAAeC,EAA+B,QAAAC,EAAA,yBAA/BC,EAAcT,EAAa,GAAI,CAClE,GAAI,CAAE,IAAAD,EAAK,YAAAE,CAAgB,EAAA,MAAMS,EAAUD,CAAI,EAC/C,MAAML,EAAMN,EAAYC,EAAKC,EAAMC,CAAW,EACxC,CAAE,MAAAU,EAAO,QAAAC,CAAQ,EAAIb,EAAI,KACzBc,EAAW,CAAC,KAAMF,EAAOC,CAAO,EAAE,OAAO,OAAO,EAAE,KAAK;AAAA,IAAO,EAE7D,OADKT,EAASC,CAAG,EACb,QAAQ,UAAWS,CAAQ,CACxC,GAEA,SAASC,EAAYf,EAAkD,CACrE,MAAO,YAAaA,GAAOA,EAAI,QAAQ,WAAW,GAAG,CACvD,CAEA,SAAsBW,EAAUD,EAAc,QAAAD,EAAA,sBAC5C,MAAMT,EAAM,MAAMgB,EAAc,OAAON,CAAI,EACvC,OAAAK,EAAYf,CAAG,EACV,CACL,IAAAA,EACA,YAAa,EACf,EAGO,CACL,KAFgB,MAAMiB,EAAU,WAAWjB,EAAK,CAAA,CAAE,GAEnC,QACf,YAAa,EACf,CAEJ"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import * as cg from \"./tscodegen\";\nimport ApiGenerator from \"./generate\";\nimport ts from \"typescript\";\nimport SwaggerParser from \"@apidevtools/swagger-parser\";\nimport converter from \"swagger2openapi\";\nimport { OpenAPI, OpenAPIV3 } from \"openapi-types\";\n\nexport { cg };\n\nexport const optsArgumentStyles = [\"positional\", \"object\"];\nexport type Opts = {\n include?: string[];\n exclude?: string[];\n optimistic?: boolean;\n unionUndefined?: boolean;\n useEnumType?: boolean;\n mergeReadWriteOnly?: boolean;\n useUnknown?: boolean;\n argumentStyle?: (typeof optsArgumentStyles)[number];\n};\n\nexport function generateAst(\n doc: OpenAPIV3.Document,\n opts: Opts,\n isConverted: boolean,\n) {\n return new ApiGenerator(doc, opts, isConverted).generateApi();\n}\n\nexport function printAst(ast: ts.SourceFile) {\n return cg.printFile(ast);\n}\n\nexport async function generateSource(\n spec: string,\n opts: Opts = {},\n): Promise<string> {\n const { doc, isConverted } = await parseSpec(spec);\n const ast = generateAst(doc, opts, isConverted);\n const { title, version } = doc.info;\n const preamble = [\"$&\", title, version].filter(Boolean).join(\"\\n * \");\n const src = printAst(ast);\n return src.replace(/^\\/\\*\\*/, preamble);\n}\n\nfunction isOpenApiV3(doc: OpenAPI.Document): doc is OpenAPIV3.Document {\n return \"openapi\" in doc && doc.openapi.startsWith(\"3\");\n}\n\nexport async function parseSpec(spec: string) {\n const doc = await SwaggerParser.bundle(spec);\n if (isOpenApiV3(doc)) {\n return {\n doc,\n isConverted: false,\n };\n } else {\n const converted = await converter.convertObj(doc, {});\n return {\n doc: converted.openapi as OpenAPIV3.Document,\n isConverted: true,\n };\n }\n}\n"],"names":["optsArgumentStyles","generateAst","doc","opts","isConverted","ApiGenerator","printAst","ast","cg.printFile","generateSource","_0","__async","spec","parseSpec","title","version","preamble","isOpenApiV3","SwaggerParser","converter"],"mappings":"+YASaA,EAAqB,CAAC,aAAc,QAAQ,EAYlD,SAASC,EACdC,EACAC,EACAC,EACA,CACA,OAAO,IAAIC,EAAAA,aAAaH,EAAKC,EAAMC,CAAW,EAAE,YAAA,CAClD,CAEO,SAASE,EAASC,EAAoB,CAC3C,OAAOC,EAAAA,UAAaD,CAAG,CACzB,CAEA,SAAsBE,EACpBC,EAEiB,QAAAC,EAAA,yBAFjBC,EACAT,EAAa,GACI,CACjB,KAAM,CAAE,IAAAD,EAAK,YAAAE,CAAA,EAAgB,MAAMS,EAAUD,CAAI,EAC3CL,EAAMN,EAAYC,EAAKC,EAAMC,CAAW,EACxC,CAAE,MAAAU,EAAO,QAAAC,CAAA,EAAYb,EAAI,KACzBc,EAAW,CAAC,KAAMF,EAAOC,CAAO,EAAE,OAAO,OAAO,EAAE,KAAK;AAAA,IAAO,EAEpE,OADYT,EAASC,CAAG,EACb,QAAQ,UAAWS,CAAQ,CACxC,GAEA,SAASC,EAAYf,EAAkD,CACrE,MAAO,YAAaA,GAAOA,EAAI,QAAQ,WAAW,GAAG,CACvD,CAEA,SAAsBW,EAAUD,EAAc,QAAAD,EAAA,sBAC5C,MAAMT,EAAM,MAAMgB,EAAc,OAAON,CAAI,EAC3C,OAAIK,EAAYf,CAAG,EACV,CACL,IAAAA,EACA,YAAa,EAAA,EAIR,CACL,KAFgB,MAAMiB,EAAU,WAAWjB,EAAK,CAAA,CAAE,GAEnC,QACf,YAAa,EAAA,CAGnB"}
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { A as c, p } from "./tscodegen-BSr1G7_b.js";
2
- import { t as x } from "./tscodegen-BSr1G7_b.js";
1
+ import { A as c, p } from "./tscodegen-BjtNU8_R.js";
2
+ import { t as x } from "./tscodegen-BjtNU8_R.js";
3
3
  import u from "@apidevtools/swagger-parser";
4
4
  import f from "swagger2openapi";
5
5
  const S = ["positional", "object"];
@@ -10,17 +10,16 @@ function m(e) {
10
10
  return p(e);
11
11
  }
12
12
  async function j(e, t = {}) {
13
- var { doc: n, isConverted: r } = await d(e);
14
- const o = l(n, t, r), { title: i, version: s } = n.info, a = ["$&", i, s].filter(Boolean).join(`
13
+ const { doc: n, isConverted: r } = await v(e), o = l(n, t, r), { title: i, version: s } = n.info, a = ["$&", i, s].filter(Boolean).join(`
15
14
  * `);
16
15
  return m(o).replace(/^\/\*\*/, a);
17
16
  }
18
- function v(e) {
17
+ function d(e) {
19
18
  return "openapi" in e && e.openapi.startsWith("3");
20
19
  }
21
- async function d(e) {
20
+ async function v(e) {
22
21
  const t = await u.bundle(e);
23
- return v(t) ? {
22
+ return d(t) ? {
24
23
  doc: t,
25
24
  isConverted: !1
26
25
  } : {
@@ -33,7 +32,7 @@ export {
33
32
  l as generateAst,
34
33
  j as generateSource,
35
34
  S as optsArgumentStyles,
36
- d as parseSpec,
35
+ v as parseSpec,
37
36
  m as printAst
38
37
  };
39
38
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import * as cg from \"./tscodegen\";\nimport ApiGenerator from \"./generate\";\nimport ts from \"typescript\";\nimport SwaggerParser from \"@apidevtools/swagger-parser\";\nimport converter from \"swagger2openapi\";\nimport { OpenAPI, OpenAPIV3 } from \"openapi-types\";\n\nexport { cg };\n\nexport const optsArgumentStyles = [\"positional\", \"object\"];\nexport type Opts = {\n include?: string[];\n exclude?: string[];\n optimistic?: boolean;\n unionUndefined?: boolean;\n useEnumType?: boolean;\n mergeReadWriteOnly?: boolean;\n useUnknown?: boolean;\n argumentStyle?: (typeof optsArgumentStyles)[number];\n};\n\nexport function generateAst(\n doc: OpenAPIV3.Document,\n opts: Opts,\n isConverted: boolean,\n) {\n return new ApiGenerator(doc, opts, isConverted).generateApi();\n}\n\nexport function printAst(ast: ts.SourceFile) {\n return cg.printFile(ast);\n}\n\nexport async function generateSource(spec: string, opts: Opts = {}) {\n var { doc, isConverted } = await parseSpec(spec);\n const ast = generateAst(doc, opts, isConverted);\n const { title, version } = doc.info;\n const preamble = [\"$&\", title, version].filter(Boolean).join(\"\\n * \");\n const src = printAst(ast);\n return src.replace(/^\\/\\*\\*/, preamble);\n}\n\nfunction isOpenApiV3(doc: OpenAPI.Document): doc is OpenAPIV3.Document {\n return \"openapi\" in doc && doc.openapi.startsWith(\"3\");\n}\n\nexport async function parseSpec(spec: string) {\n const doc = await SwaggerParser.bundle(spec);\n if (isOpenApiV3(doc)) {\n return {\n doc,\n isConverted: false,\n };\n } else {\n const converted = await converter.convertObj(doc, {});\n return {\n doc: converted.openapi as OpenAPIV3.Document,\n isConverted: true,\n };\n }\n}\n"],"names":["optsArgumentStyles","generateAst","doc","opts","isConverted","ApiGenerator","printAst","ast","cg.printFile","generateSource","spec","parseSpec","title","version","preamble","isOpenApiV3","SwaggerParser","converter"],"mappings":";;;;AASa,MAAAA,IAAqB,CAAC,cAAc,QAAQ;AAYzC,SAAAC,EACdC,GACAC,GACAC,GACA;AACA,SAAO,IAAIC,EAAaH,GAAKC,GAAMC,CAAW,EAAE,YAAY;AAC9D;AAEO,SAASE,EAASC,GAAoB;AACpC,SAAAC,EAAaD,CAAG;AACzB;AAEA,eAAsBE,EAAeC,GAAcP,IAAa,IAAI;AAClE,MAAI,EAAE,KAAAD,GAAK,aAAAE,EAAgB,IAAA,MAAMO,EAAUD,CAAI;AAC/C,QAAMH,IAAMN,EAAYC,GAAKC,GAAMC,CAAW,GACxC,EAAE,OAAAQ,GAAO,SAAAC,EAAQ,IAAIX,EAAI,MACzBY,IAAW,CAAC,MAAMF,GAAOC,CAAO,EAAE,OAAO,OAAO,EAAE,KAAK;AAAA,IAAO;AAE7D,SADKP,EAASC,CAAG,EACb,QAAQ,WAAWO,CAAQ;AACxC;AAEA,SAASC,EAAYb,GAAkD;AACrE,SAAO,aAAaA,KAAOA,EAAI,QAAQ,WAAW,GAAG;AACvD;AAEA,eAAsBS,EAAUD,GAAc;AAC5C,QAAMR,IAAM,MAAMc,EAAc,OAAON,CAAI;AACvC,SAAAK,EAAYb,CAAG,IACV;AAAA,IACL,KAAAA;AAAA,IACA,aAAa;AAAA,EACf,IAGO;AAAA,IACL,MAFgB,MAAMe,EAAU,WAAWf,GAAK,CAAA,CAAE,GAEnC;AAAA,IACf,aAAa;AAAA,EACf;AAEJ;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import * as cg from \"./tscodegen\";\nimport ApiGenerator from \"./generate\";\nimport ts from \"typescript\";\nimport SwaggerParser from \"@apidevtools/swagger-parser\";\nimport converter from \"swagger2openapi\";\nimport { OpenAPI, OpenAPIV3 } from \"openapi-types\";\n\nexport { cg };\n\nexport const optsArgumentStyles = [\"positional\", \"object\"];\nexport type Opts = {\n include?: string[];\n exclude?: string[];\n optimistic?: boolean;\n unionUndefined?: boolean;\n useEnumType?: boolean;\n mergeReadWriteOnly?: boolean;\n useUnknown?: boolean;\n argumentStyle?: (typeof optsArgumentStyles)[number];\n};\n\nexport function generateAst(\n doc: OpenAPIV3.Document,\n opts: Opts,\n isConverted: boolean,\n) {\n return new ApiGenerator(doc, opts, isConverted).generateApi();\n}\n\nexport function printAst(ast: ts.SourceFile) {\n return cg.printFile(ast);\n}\n\nexport async function generateSource(\n spec: string,\n opts: Opts = {},\n): Promise<string> {\n const { doc, isConverted } = await parseSpec(spec);\n const ast = generateAst(doc, opts, isConverted);\n const { title, version } = doc.info;\n const preamble = [\"$&\", title, version].filter(Boolean).join(\"\\n * \");\n const src = printAst(ast);\n return src.replace(/^\\/\\*\\*/, preamble);\n}\n\nfunction isOpenApiV3(doc: OpenAPI.Document): doc is OpenAPIV3.Document {\n return \"openapi\" in doc && doc.openapi.startsWith(\"3\");\n}\n\nexport async function parseSpec(spec: string) {\n const doc = await SwaggerParser.bundle(spec);\n if (isOpenApiV3(doc)) {\n return {\n doc,\n isConverted: false,\n };\n } else {\n const converted = await converter.convertObj(doc, {});\n return {\n doc: converted.openapi as OpenAPIV3.Document,\n isConverted: true,\n };\n }\n}\n"],"names":["optsArgumentStyles","generateAst","doc","opts","isConverted","ApiGenerator","printAst","ast","cg.printFile","generateSource","spec","parseSpec","title","version","preamble","isOpenApiV3","SwaggerParser","converter"],"mappings":";;;;AASO,MAAMA,IAAqB,CAAC,cAAc,QAAQ;AAYlD,SAASC,EACdC,GACAC,GACAC,GACA;AACA,SAAO,IAAIC,EAAaH,GAAKC,GAAMC,CAAW,EAAE,YAAA;AAClD;AAEO,SAASE,EAASC,GAAoB;AAC3C,SAAOC,EAAaD,CAAG;AACzB;AAEA,eAAsBE,EACpBC,GACAP,IAAa,IACI;AACjB,QAAM,EAAE,KAAAD,GAAK,aAAAE,EAAA,IAAgB,MAAMO,EAAUD,CAAI,GAC3CH,IAAMN,EAAYC,GAAKC,GAAMC,CAAW,GACxC,EAAE,OAAAQ,GAAO,SAAAC,EAAA,IAAYX,EAAI,MACzBY,IAAW,CAAC,MAAMF,GAAOC,CAAO,EAAE,OAAO,OAAO,EAAE,KAAK;AAAA,IAAO;AAEpE,SADYP,EAASC,CAAG,EACb,QAAQ,WAAWO,CAAQ;AACxC;AAEA,SAASC,EAAYb,GAAkD;AACrE,SAAO,aAAaA,KAAOA,EAAI,QAAQ,WAAW,GAAG;AACvD;AAEA,eAAsBS,EAAUD,GAAc;AAC5C,QAAMR,IAAM,MAAMc,EAAc,OAAON,CAAI;AAC3C,SAAIK,EAAYb,CAAG,IACV;AAAA,IACL,KAAAA;AAAA,IACA,aAAa;AAAA,EAAA,IAIR;AAAA,IACL,MAFgB,MAAMe,EAAU,WAAWf,GAAK,CAAA,CAAE,GAEnC;AAAA,IACf,aAAa;AAAA,EAAA;AAGnB;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oazapfts",
3
- "version": "6.3.0",
3
+ "version": "6.3.2",
4
4
  "description": "OpenApi TypeScript client generator",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -46,21 +46,20 @@
46
46
  ]
47
47
  },
48
48
  "devDependencies": {
49
- "@types/lodash": "^4.17.17",
49
+ "@types/lodash": "^4.17.21",
50
50
  "@types/minimist": "^1.2.5",
51
- "@types/node": "^22.15.23",
52
- "@types/tapable": "^2.2.7"
51
+ "@types/tapable": "^2.3.0"
53
52
  },
54
53
  "peerDependencies": {
55
54
  "@oazapfts/runtime": "*"
56
55
  },
57
56
  "dependencies": {
58
- "@apidevtools/swagger-parser": "^10.1.1",
57
+ "@apidevtools/swagger-parser": "^12.1.0",
59
58
  "lodash": "^4.17.21",
60
59
  "minimist": "^1.2.8",
61
60
  "swagger2openapi": "^7.0.8",
62
- "tapable": "^2.2.2",
63
- "typescript": "^5.8.3"
61
+ "tapable": "^2.3.0",
62
+ "typescript": "^5.9.3"
64
63
  },
65
64
  "keywords": [
66
65
  "openapi",
@@ -1,8 +1,8 @@
1
1
  import c from "typescript";
2
- import b from "lodash";
2
+ import T from "lodash";
3
3
  const U = c.factory;
4
4
  function Ae(t) {
5
- const e = t.split(/{([\s\S]+?)}/g), n = b.chunk(e.slice(1), 2);
5
+ const e = t.split(/{([\s\S]+?)}/g), n = T.chunk(e.slice(1), 2);
6
6
  return te(
7
7
  e[0],
8
8
  n.map(([i, r]) => ({
@@ -51,7 +51,7 @@ function Le(t) {
51
51
  return U.createStringLiteral(ke(t[0]));
52
52
  }
53
53
  function Pe(t, e) {
54
- return t.description ? b.camelCase(t.description.replace(/\W+/, " ")) : `server${e + 1}`;
54
+ return t.description ? T.camelCase(t.description.replace(/\W+/, " ")) : `server${e + 1}`;
55
55
  }
56
56
  function Re(t) {
57
57
  return ee(
@@ -110,7 +110,7 @@ function qe({
110
110
  return e && t === "deepObject" ? "deep" : e ? "explode" : t === "spaceDelimited" ? "space" : t === "pipeDelimited" ? "pipe" : "form";
111
111
  }
112
112
  function Ce(t) {
113
- if (t && !t.match(/[^\w\s]/) && (t = b.camelCase(t), Q(t)))
113
+ if (t && !t.match(/[^\w\s]/) && (t = T.camelCase(t), Q(t)))
114
114
  return t;
115
115
  }
116
116
  function De(t, e, n) {
@@ -149,8 +149,8 @@ function Ve(t) {
149
149
  return t ? Me[t] : "";
150
150
  }
151
151
  function w(t, e = !1, n) {
152
- let i = b.camelCase(t) + Ve(n);
153
- return e && (i = b.upperFirst(i)), Q(i) ? i : "$" + i;
152
+ let i = T.camelCase(t) + Ve(n);
153
+ return e && (i = T.upperFirst(i)), Q(i) ? i : "$" + i;
154
154
  }
155
155
  function _e(t, e) {
156
156
  const n = [], i = t.replace(
@@ -235,7 +235,7 @@ class st {
235
235
  }
236
236
  resolve(e) {
237
237
  if (!O(e)) return e;
238
- const n = e.$ref, i = le(n), r = b.get(this.spec, i);
238
+ const n = e.$ref, i = le(n), r = T.get(this.spec, i);
239
239
  if (typeof r > "u")
240
240
  throw new Error(`Can't find ${i}`);
241
241
  return r;
@@ -276,7 +276,7 @@ class st {
276
276
  const r = i ? this.findAvailableRef(e.$ref + "Base") : e.$ref;
277
277
  if (!this.refs[r]) {
278
278
  let s = this.resolve(e);
279
- typeof s != "boolean" && i && (s = b.cloneDeep(s), delete s.discriminator);
279
+ typeof s != "boolean" && i && (s = T.cloneDeep(s), delete s.discriminator);
280
280
  const u = typeof s != "boolean" && s.title || ze(r), f = w(u, !0);
281
281
  if (this.isTrueEnum(s, u))
282
282
  return this.getTypeFromSchema(s, u);
@@ -296,35 +296,35 @@ class st {
296
296
  );
297
297
  const { readOnly: m, writeOnly: g } = this.checkSchemaOnlyMode(s);
298
298
  if (m) {
299
- const T = this.getUniqueAlias(
299
+ const S = this.getUniqueAlias(
300
300
  w(u, !0, "readOnly")
301
301
  );
302
302
  this.refs[r].readOnly = o.createTypeReferenceNode(
303
- T,
303
+ S,
304
304
  void 0
305
305
  );
306
306
  const N = this.getTypeFromSchema(s, u, "readOnly");
307
307
  this.aliases.push(
308
308
  M({
309
309
  modifiers: [P.export],
310
- name: T,
310
+ name: S,
311
311
  type: N
312
312
  })
313
313
  );
314
314
  }
315
315
  if (g) {
316
- const T = this.getUniqueAlias(
316
+ const S = this.getUniqueAlias(
317
317
  w(u, !0, "writeOnly")
318
318
  );
319
319
  this.refs[r].writeOnly = o.createTypeReferenceNode(
320
- T,
320
+ S,
321
321
  void 0
322
322
  );
323
323
  const N = this.getTypeFromSchema(s, u, "writeOnly");
324
324
  this.aliases.push(
325
325
  M({
326
326
  modifiers: [P.export],
327
- name: T,
327
+ name: S,
328
328
  type: N
329
329
  })
330
330
  );
@@ -380,8 +380,10 @@ class st {
380
380
  );
381
381
  } else
382
382
  return o.createUnionTypeNode(
383
- e.map(
384
- (r) => this.getTypeFromSchema(r, void 0, i)
383
+ T.uniq(
384
+ e.map(
385
+ (r) => this.getTypeFromSchema(r, void 0, i)
386
+ )
385
387
  )
386
388
  );
387
389
  }
@@ -416,8 +418,8 @@ class st {
416
418
  e.oneOf.map(
417
419
  (s) => (
418
420
  // ensure that base properties from the schema are included in the oneOf variants
419
- b.mergeWith({}, r, s, (u, f) => {
420
- if (b.isArray(u))
421
+ T.mergeWith({}, r, s, (u, f) => {
422
+ if (T.isArray(u))
421
423
  return u.concat(f);
422
424
  })
423
425
  )
@@ -440,23 +442,15 @@ class st {
440
442
  const r = [];
441
443
  for (const s of e.allOf)
442
444
  if (O(s) && this.discriminatingSchemas.has(s.$ref)) {
443
- const f = this.resolve(s).discriminator, p = Object.entries(f.mapping || {}).find(
444
- ([, l]) => l === e["x-component-ref-path"]
445
- );
446
- if (p) {
447
- const [l] = p;
448
- r.push(
449
- o.createTypeLiteralNode([
450
- x({
451
- name: f.propertyName,
452
- type: o.createLiteralTypeNode(
453
- o.createStringLiteral(l)
454
- )
455
- })
456
- ])
457
- );
458
- }
459
- r.push(
445
+ const f = this.resolve(s).discriminator, p = Object.entries(f.mapping ?? {}).filter(([, l]) => l === e["x-component-ref-path"]).map(([l]) => l);
446
+ p.length > 0 && r.push(
447
+ o.createTypeLiteralNode([
448
+ x({
449
+ name: f.propertyName,
450
+ type: this.getTypeFromEnum(p)
451
+ })
452
+ ])
453
+ ), r.push(
460
454
  this.getRefAlias(
461
455
  s,
462
456
  i,
@@ -559,7 +553,7 @@ class st {
559
553
  throw new Error(
560
554
  "cannot get enum from boolean schema. schema must be an object"
561
555
  );
562
- const r = (e.title || b.upperFirst(n)).split(/[^A-Za-z0-9$_]/g).map((g) => b.upperFirst(g)).join(""), s = this.getEnumValuesString(
556
+ const r = (e.title || T.upperFirst(n)).split(/[^A-Za-z0-9$_]/g).map((g) => T.upperFirst(g)).join(""), s = this.getEnumValuesString(
563
557
  e.enum ? e.enum : []
564
558
  ), u = this.getEnumUniqueAlias(r, s);
565
559
  if (this.enumRefs[r] && r === u)
@@ -571,9 +565,9 @@ class st {
571
565
  if (p.length !== f.length)
572
566
  throw new Error("enum names must have the same length as enum values");
573
567
  }
574
- const l = f.map((g, T) => {
568
+ const l = f.map((g, S) => {
575
569
  if (e.type === "number" || e.type === "integer") {
576
- const N = p ? p[T] : String(g);
570
+ const N = p ? p[S] : String(g);
577
571
  return o.createEnumMember(
578
572
  o.createIdentifier(w(N, !0)),
579
573
  q(g)
@@ -644,7 +638,7 @@ class st {
644
638
  const l = e[p], m = n && n.includes(p);
645
639
  let g = this.getTypeFromSchema(l, p, r);
646
640
  !m && this.opts.unionUndefined && (g = o.createUnionTypeNode([g, h.undefined]));
647
- const T = x({
641
+ const S = x({
648
642
  questionToken: !m,
649
643
  name: p,
650
644
  type: g
@@ -652,14 +646,14 @@ class st {
652
646
  if (typeof l != "boolean" && "description" in l && l.description) {
653
647
  const N = l.description.replace("*/", "*\\/");
654
648
  c.addSyntheticLeadingComment(
655
- T,
649
+ S,
656
650
  c.SyntaxKind.MultiLineCommentTrivia,
657
651
  // Ensures it is formatted like a JSDoc comment: /** description here */
658
652
  `* ${N} `,
659
653
  !0
660
654
  );
661
655
  }
662
- return T;
656
+ return S;
663
657
  });
664
658
  if (i) {
665
659
  const p = i === !0 ? this.getEmptySchemaType() : this.getTypeFromSchema(i, void 0, r);
@@ -799,7 +793,7 @@ export const servers = {};
799
793
  if (!$e.includes(l)) return;
800
794
  const m = f[p], {
801
795
  operationId: g,
802
- requestBody: T,
796
+ requestBody: S,
803
797
  responses: N,
804
798
  summary: xe,
805
799
  description: ve,
@@ -816,25 +810,25 @@ export const servers = {};
816
810
  (j) => j.name === d.name && j.in === d.in
817
811
  ) || B.push(d);
818
812
  const k = this.isConverted ? He(B) : B, J = /* @__PURE__ */ new Map();
819
- b.sortBy(k, "name.length").forEach((d) => {
820
- const S = w(d.name), E = [...J.values()].includes(S) ? b.upperFirst(d.in) : "";
821
- J.set(d, S + E);
813
+ T.sortBy(k, "name.length").forEach((d) => {
814
+ const b = w(d.name), E = [...J.values()].includes(b) ? T.upperFirst(d.in) : "";
815
+ J.set(d, b + E);
822
816
  });
823
817
  const A = (d) => {
824
- const S = J.get(d);
825
- if (!S) throw new Error(`Can't find parameter: ${d.name}`);
826
- return S;
818
+ const b = J.get(d);
819
+ if (!b) throw new Error(`Can't find parameter: ${d.name}`);
820
+ return b;
827
821
  }, L = [];
828
822
  let K, v;
829
823
  switch (this.opts.argumentStyle ?? "positional") {
830
824
  case "positional":
831
- const [d, S] = b.partition(k, "required"), j = d.map(
825
+ const [d, b] = T.partition(k, "required"), j = d.map(
832
826
  (y) => F(A(this.resolve(y)), {
833
827
  type: this.getTypeFromParameter(y)
834
828
  })
835
829
  );
836
- if (L.push(...j), T) {
837
- K = this.resolve(T);
830
+ if (L.push(...j), S) {
831
+ K = this.resolve(S);
838
832
  const y = this.getSchemaFromContent(K.content), I = this.getTypeFromSchema(
839
833
  y,
840
834
  void 0,
@@ -849,15 +843,15 @@ export const servers = {};
849
843
  })
850
844
  );
851
845
  }
852
- S.length && L.push(
846
+ b.length && L.push(
853
847
  F(
854
848
  H(
855
- S.map((y) => this.resolve(y)).map((y) => ({ name: A(y) }))
849
+ b.map((y) => this.resolve(y)).map((y) => ({ name: A(y) }))
856
850
  ),
857
851
  {
858
852
  initializer: o.createObjectLiteralExpression(),
859
853
  type: o.createTypeLiteralNode(
860
- S.map(
854
+ b.map(
861
855
  (y) => x({
862
856
  name: A(this.resolve(y)),
863
857
  questionToken: !0,
@@ -877,8 +871,8 @@ export const servers = {};
877
871
  type: this.getTypeFromParameter(y)
878
872
  })
879
873
  );
880
- if (T) {
881
- K = this.resolve(T);
874
+ if (S) {
875
+ K = this.resolve(S);
882
876
  const y = this.getSchemaFromContent(K.content), I = this.getTypeFromSchema(
883
877
  y,
884
878
  void 0,
@@ -921,10 +915,10 @@ export const servers = {};
921
915
  const G = this.getResponseType(N), se = k.filter((d) => d.in === "query"), oe = k.filter((d) => d.in === "header");
922
916
  let ae;
923
917
  if (se.length) {
924
- const d = b.groupBy(se, qe);
918
+ const d = T.groupBy(se, qe);
925
919
  ae = pe(
926
920
  "query",
927
- Object.entries(d).map(([S, j]) => pe(S, [
921
+ Object.entries(d).map(([b, j]) => pe(b, [
928
922
  ee(
929
923
  j.map((E) => [E.name, A(E)])
930
924
  )
@@ -969,9 +963,9 @@ export const servers = {};
969
963
  );
970
964
  const ce = [Fe];
971
965
  if ($.length) {
972
- const d = Ue(K), S = o.createObjectLiteralExpression($, !0);
966
+ const d = Ue(K), b = o.createObjectLiteralExpression($, !0);
973
967
  ce.push(
974
- d ? z(d, [S]) : S
968
+ d ? z(d, [b]) : b
975
969
  );
976
970
  }
977
971
  r.push(
@@ -1445,4 +1439,4 @@ export {
1445
1439
  V as y,
1446
1440
  M as z
1447
1441
  };
1448
- //# sourceMappingURL=tscodegen-BSr1G7_b.js.map
1442
+ //# sourceMappingURL=tscodegen-BjtNU8_R.js.map