oazapfts 7.0.0-beta.2 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var m=(i,c,o)=>new Promise((a,t)=>{var l=e=>{try{n(o.next(e))}catch(s){t(s)}},u=e=>{try{n(o.throw(e))}catch(s){t(s)}},n=e=>e.done?a(e.value):Promise.resolve(e.value).then(l,u);n((o=o.apply(i,c)).next())});const f=require("fs/promises"),h=require("minimist"),v=require("path"),r=require("./index.cjs");function S(i){return m(this,null,function*(){const{include:c,exclude:o,optimistic:a,useEnumType:t,mergeReadWriteOnly:l,useUnknown:u,argumentStyle:n,help:e,version:s}=i,[p,d]=i._;if(e&&(y(),process.exit(0)),s){const x=JSON.parse(yield f.readFile(v.join(__dirname,"..","package.json"),"utf8"));console.log(x.version),process.exit(0)}p||(y(),process.exit(1)),n!==void 0&&!r.oazapftsArgumentStyleOptions.includes(n)&&(console.error(`--argumentStyle should be one of <${r.oazapftsArgumentStyleOptions.join(" | ")}>, but got "${n}"`),process.exit(1));const g=yield r.generateSource(p,{include:c,exclude:o,optimistic:a,useEnumType:t,useUnknown:u,mergeReadWriteOnly:l,argumentStyle:n});d?yield f.writeFile(d,g):console.log(g)})}function y(){console.error(`
2
+ "use strict";var m=(i,c,o)=>new Promise((l,t)=>{var u=e=>{try{n(o.next(e))}catch(s){t(s)}},a=e=>{try{n(o.throw(e))}catch(s){t(s)}},n=e=>e.done?l(e.value):Promise.resolve(e.value).then(u,a);n((o=o.apply(i,c)).next())});const y=require("fs/promises"),h=require("minimist"),v=require("path"),r=require("./index-BTckgXdX.cjs");function S(i){return m(this,null,function*(){const{include:c,exclude:o,optimistic:l,useEnumType:t,mergeReadWriteOnly:u,useUnknown:a,argumentStyle:n,help:e,version:s}=i,[p,d]=i._;if(e&&(f(),process.exit(0)),s){const x=JSON.parse(yield y.readFile(v.join(__dirname,"..","package.json"),"utf8"));console.log(x.version),process.exit(0)}p||(f(),process.exit(1)),n!==void 0&&!r.argumentStyleOptions.includes(n)&&(console.error(`--argumentStyle should be one of <${r.argumentStyleOptions.join(" | ")}>, but got "${n}"`),process.exit(1));const g=yield r.generateSource(p,{include:c,exclude:o,optimistic:l,useEnumType:t,useUnknown:a,mergeReadWriteOnly:u,argumentStyle:n});d?yield y.writeFile(d,g):console.log(g)})}function f(){console.error(`
3
3
  Usage:
4
4
  oazapfts <spec> [filename]
5
5
 
@@ -12,6 +12,6 @@
12
12
  --useEnumType
13
13
  --useUnknown
14
14
  --mergeReadWriteOnly
15
- --argumentStyle=<${r.oazapftsArgumentStyleOptions.join(" | ")}> (default: positional)
15
+ --argumentStyle=<${r.argumentStyleOptions.join(" | ")}> (default: positional)
16
16
  `)}S(h(process.argv.slice(2),{alias:{h:"help",v:"version",i:"include",e:"exclude"},boolean:["help","version","optimistic","useEnumType","mergeReadWriteOnly","useUnknown"],string:["argumentStyle"]})).catch(i=>{console.error(i),process.exit(1)});
17
17
  //# sourceMappingURL=cli.cjs.map
package/dist/cli.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.cjs","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { readFile, writeFile } from \"fs/promises\";\nimport minimist, { type ParsedArgs } from \"minimist\";\nimport { join } from \"path\";\n\nimport { generateSource, oazapftsArgumentStyleOptions } from \"./\";\n\nasync function run(argv: ParsedArgs) {\n const {\n include,\n exclude,\n optimistic,\n useEnumType,\n mergeReadWriteOnly,\n useUnknown,\n argumentStyle,\n help,\n version,\n } = argv;\n const [spec, dest] = argv._;\n\n if (help) {\n printUsage();\n process.exit(0);\n }\n\n if (version) {\n const pkg = JSON.parse(\n await readFile(join(__dirname, \"..\", \"package.json\"), \"utf8\"),\n );\n console.log(pkg.version);\n process.exit(0);\n }\n\n if (!spec) {\n printUsage();\n process.exit(1);\n }\n\n if (\n argumentStyle !== undefined &&\n !oazapftsArgumentStyleOptions.includes(argumentStyle)\n ) {\n console.error(\n `--argumentStyle should be one of <${oazapftsArgumentStyleOptions.join(\n \" | \",\n )}>, but got \"${argumentStyle}\"`,\n );\n process.exit(1);\n }\n\n const code = await generateSource(spec, {\n include,\n exclude,\n optimistic,\n useEnumType,\n useUnknown,\n mergeReadWriteOnly,\n argumentStyle,\n });\n\n if (dest) await writeFile(dest, code);\n else console.log(code);\n}\n\nfunction printUsage() {\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 --help, -h\n --version, -v\n --optimistic\n --useEnumType\n --useUnknown\n --mergeReadWriteOnly\n --argumentStyle=<${oazapftsArgumentStyleOptions.join(\" | \")}> (default: positional)\n`);\n}\n\nrun(\n minimist(process.argv.slice(2), {\n alias: {\n h: \"help\",\n v: \"version\",\n i: \"include\",\n e: \"exclude\",\n },\n boolean: [\n \"help\",\n \"version\",\n \"optimistic\",\n \"useEnumType\",\n \"mergeReadWriteOnly\",\n \"useUnknown\",\n ],\n string: [\"argumentStyle\"],\n }),\n).catch((error) => {\n console.error(error);\n process.exit(1);\n});\n"],"names":["run","argv","__async","include","exclude","optimistic","useEnumType","mergeReadWriteOnly","useUnknown","argumentStyle","help","version","spec","dest","printUsage","pkg","readFile","join","oazapftsArgumentStyleOptions","code","generateSource","writeFile","minimist","error"],"mappings":";0TAQA,SAAeA,EAAIC,EAAkB,QAAAC,EAAA,sBACnC,KAAM,CACJ,QAAAC,EACA,QAAAC,EACA,WAAAC,EACA,YAAAC,EACA,mBAAAC,EACA,WAAAC,EACA,cAAAC,EACA,KAAAC,EACA,QAAAC,CAAA,EACEV,EACE,CAACW,EAAMC,CAAI,EAAIZ,EAAK,EAO1B,GALIS,IACFI,EAAA,EACA,QAAQ,KAAK,CAAC,GAGZH,EAAS,CACX,MAAMI,EAAM,KAAK,MACf,MAAMC,EAAAA,SAASC,EAAAA,KAAK,UAAW,KAAM,cAAc,EAAG,MAAM,CAAA,EAE9D,QAAQ,IAAIF,EAAI,OAAO,EACvB,QAAQ,KAAK,CAAC,CAChB,CAEKH,IACHE,EAAA,EACA,QAAQ,KAAK,CAAC,GAIdL,IAAkB,QAClB,CAACS,EAAAA,6BAA6B,SAAST,CAAa,IAEpD,QAAQ,MACN,qCAAqCS,EAAAA,6BAA6B,KAChE,KAAA,CACD,eAAeT,CAAa,GAAA,EAE/B,QAAQ,KAAK,CAAC,GAGhB,MAAMU,EAAO,MAAMC,EAAAA,eAAeR,EAAM,CACtC,QAAAT,EACA,QAAAC,EACA,WAAAC,EACA,YAAAC,EACA,WAAAE,EACA,mBAAAD,EACA,cAAAE,CAAA,CACD,EAEGI,EAAM,MAAMQ,YAAUR,EAAMM,CAAI,EAC/B,QAAQ,IAAIA,CAAI,CACvB,GAEA,SAASL,GAAa,CACpB,QAAQ,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAaOI,EAAAA,6BAA6B,KAAK,KAAK,CAAC;AAAA,CAC9D,CACD,CAEAlB,EACEsB,EAAS,QAAQ,KAAK,MAAM,CAAC,EAAG,CAC9B,MAAO,CACL,EAAG,OACH,EAAG,UACH,EAAG,UACH,EAAG,SAAA,EAEL,QAAS,CACP,OACA,UACA,aACA,cACA,qBACA,YAAA,EAEF,OAAQ,CAAC,eAAe,CAAA,CACzB,CACH,EAAE,MAAOC,GAAU,CACjB,QAAQ,MAAMA,CAAK,EACnB,QAAQ,KAAK,CAAC,CAChB,CAAC"}
1
+ {"version":3,"file":"cli.cjs","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { readFile, writeFile } from \"fs/promises\";\nimport minimist, { type ParsedArgs } from \"minimist\";\nimport { join } from \"path\";\n\nimport { generateSource } from \"./\";\nimport { argumentStyleOptions } from \"./generate/generateClientMethod\";\n\nasync function run(argv: ParsedArgs) {\n const {\n include,\n exclude,\n optimistic,\n useEnumType,\n mergeReadWriteOnly,\n useUnknown,\n argumentStyle,\n help,\n version,\n } = argv;\n const [spec, dest] = argv._;\n\n if (help) {\n printUsage();\n process.exit(0);\n }\n\n if (version) {\n const pkg = JSON.parse(\n await readFile(join(__dirname, \"..\", \"package.json\"), \"utf8\"),\n );\n console.log(pkg.version);\n process.exit(0);\n }\n\n if (!spec) {\n printUsage();\n process.exit(1);\n }\n\n if (\n argumentStyle !== undefined &&\n !argumentStyleOptions.includes(argumentStyle)\n ) {\n console.error(\n `--argumentStyle should be one of <${argumentStyleOptions.join(\n \" | \",\n )}>, but got \"${argumentStyle}\"`,\n );\n process.exit(1);\n }\n\n const code = await generateSource(spec, {\n include,\n exclude,\n optimistic,\n useEnumType,\n useUnknown,\n mergeReadWriteOnly,\n argumentStyle,\n });\n\n if (dest) await writeFile(dest, code);\n else console.log(code);\n}\n\nfunction printUsage() {\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 --help, -h\n --version, -v\n --optimistic\n --useEnumType\n --useUnknown\n --mergeReadWriteOnly\n --argumentStyle=<${argumentStyleOptions.join(\" | \")}> (default: positional)\n`);\n}\n\nrun(\n minimist(process.argv.slice(2), {\n alias: {\n h: \"help\",\n v: \"version\",\n i: \"include\",\n e: \"exclude\",\n },\n boolean: [\n \"help\",\n \"version\",\n \"optimistic\",\n \"useEnumType\",\n \"mergeReadWriteOnly\",\n \"useUnknown\",\n ],\n string: [\"argumentStyle\"],\n }),\n).catch((error) => {\n console.error(error);\n process.exit(1);\n});\n"],"names":["run","argv","__async","include","exclude","optimistic","useEnumType","mergeReadWriteOnly","useUnknown","argumentStyle","help","version","spec","dest","printUsage","pkg","readFile","join","argumentStyleOptions","code","generateSource","writeFile","minimist","error"],"mappings":";mUASA,SAAeA,EAAIC,EAAkB,QAAAC,EAAA,sBACnC,KAAM,CACJ,QAAAC,EACA,QAAAC,EACA,WAAAC,EACA,YAAAC,E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ist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { readFile as y, writeFile as v } from "fs/promises";
3
3
  import x from "minimist";
4
4
  import { join as h } from "path";
5
- import { oazapftsArgumentStyleOptions as i, generateSource as w } from "./index.js";
5
+ import { a as i, g as w } from "./index-0o7BUGZA.js";
6
6
  async function S(e) {
7
7
  const {
8
8
  include: c,
@@ -14,7 +14,7 @@ async function S(e) {
14
14
  argumentStyle: o,
15
15
  help: d,
16
16
  version: g
17
- } = e, [n, t] = e._;
17
+ } = e, [n, s] = e._;
18
18
  if (d && (r(), process.exit(0)), g) {
19
19
  const f = JSON.parse(
20
20
  await y(h(__dirname, "..", "package.json"), "utf8")
@@ -26,7 +26,7 @@ async function S(e) {
26
26
  " | "
27
27
  )}>, but got "${o}"`
28
28
  ), process.exit(1));
29
- const s = await w(n, {
29
+ const t = await w(n, {
30
30
  include: c,
31
31
  exclude: l,
32
32
  optimistic: a,
@@ -35,7 +35,7 @@ async function S(e) {
35
35
  mergeReadWriteOnly: p,
36
36
  argumentStyle: o
37
37
  });
38
- t ? await v(t, s) : console.log(s);
38
+ s ? await v(s, t) : console.log(t);
39
39
  }
40
40
  function r() {
41
41
  console.error(`
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { readFile, writeFile } from \"fs/promises\";\nimport minimist, { type ParsedArgs } from \"minimist\";\nimport { join } from \"path\";\n\nimport { generateSource, oazapftsArgumentStyleOptions } from \"./\";\n\nasync function run(argv: ParsedArgs) {\n const {\n include,\n exclude,\n optimistic,\n useEnumType,\n mergeReadWriteOnly,\n useUnknown,\n argumentStyle,\n help,\n version,\n } = argv;\n const [spec, dest] = argv._;\n\n if (help) {\n printUsage();\n process.exit(0);\n }\n\n if (version) {\n const pkg = JSON.parse(\n await readFile(join(__dirname, \"..\", \"package.json\"), \"utf8\"),\n );\n console.log(pkg.version);\n process.exit(0);\n }\n\n if (!spec) {\n printUsage();\n process.exit(1);\n }\n\n if (\n argumentStyle !== undefined &&\n !oazapftsArgumentStyleOptions.includes(argumentStyle)\n ) {\n console.error(\n `--argumentStyle should be one of <${oazapftsArgumentStyleOptions.join(\n \" | \",\n )}>, but got \"${argumentStyle}\"`,\n );\n process.exit(1);\n }\n\n const code = await generateSource(spec, {\n include,\n exclude,\n optimistic,\n useEnumType,\n useUnknown,\n mergeReadWriteOnly,\n argumentStyle,\n });\n\n if (dest) await writeFile(dest, code);\n else console.log(code);\n}\n\nfunction printUsage() {\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 --help, -h\n --version, -v\n --optimistic\n --useEnumType\n --useUnknown\n --mergeReadWriteOnly\n --argumentStyle=<${oazapftsArgumentStyleOptions.join(\" | \")}> (default: positional)\n`);\n}\n\nrun(\n minimist(process.argv.slice(2), {\n alias: {\n h: \"help\",\n v: \"version\",\n i: \"include\",\n e: \"exclude\",\n },\n boolean: [\n \"help\",\n \"version\",\n \"optimistic\",\n \"useEnumType\",\n \"mergeReadWriteOnly\",\n \"useUnknown\",\n ],\n string: [\"argumentStyle\"],\n }),\n).catch((error) => {\n console.error(error);\n process.exit(1);\n});\n"],"names":["run","argv","include","exclude","optimistic","useEnumType","mergeReadWriteOnly","useUnknown","argumentStyle","help","version","spec","dest","printUsage","pkg","readFile","join","oazapftsArgumentStyleOptions","code","generateSource","writeFile","minimist","error"],"mappings":";;;;;AAQA,eAAeA,EAAIC,GAAkB;AACnC,QAAM;AAAA,IACJ,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,MAAAC;AAAA,IACA,SAAAC;AAAA,EAAA,IACET,GACE,CAACU,GAAMC,CAAI,IAAIX,EAAK;AAO1B,MALIQ,MACFI,EAAA,GACA,QAAQ,KAAK,C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}
1
+ {"version":3,"file":"cli.js","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { readFile, writeFile } from \"fs/promises\";\nimport minimist, { type ParsedArgs } from \"minimist\";\nimport { join } from \"path\";\n\nimport { generateSource } from \"./\";\nimport { argumentStyleOptions } from \"./generate/generateClientMethod\";\n\nasync function run(argv: ParsedArgs) {\n const {\n include,\n exclude,\n optimistic,\n useEnumType,\n mergeReadWriteOnly,\n useUnknown,\n argumentStyle,\n help,\n version,\n } = argv;\n const [spec, dest] = argv._;\n\n if (help) {\n printUsage();\n process.exit(0);\n }\n\n if (version) {\n const pkg = JSON.parse(\n await readFile(join(__dirname, \"..\", \"package.json\"), \"utf8\"),\n );\n console.log(pkg.version);\n process.exit(0);\n }\n\n if (!spec) {\n printUsage();\n process.exit(1);\n }\n\n if (\n argumentStyle !== undefined &&\n !argumentStyleOptions.includes(argumentStyle)\n ) {\n console.error(\n `--argumentStyle should be one of <${argumentStyleOptions.join(\n \" | \",\n )}>, but got \"${argumentStyle}\"`,\n );\n process.exit(1);\n }\n\n const code = await generateSource(spec, {\n include,\n exclude,\n optimistic,\n useEnumType,\n useUnknown,\n mergeReadWriteOnly,\n argumentStyle,\n });\n\n if (dest) await writeFile(dest, code);\n else console.log(code);\n}\n\nfunction printUsage() {\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 --help, -h\n --version, -v\n --optimistic\n --useEnumType\n --useUnknown\n --mergeReadWriteOnly\n --argumentStyle=<${argumentStyleOptions.join(\" | \")}> (default: positional)\n`);\n}\n\nrun(\n minimist(process.argv.slice(2), {\n alias: {\n h: \"help\",\n v: \"version\",\n i: \"include\",\n e: \"exclude\",\n },\n boolean: [\n \"help\",\n \"version\",\n \"optimistic\",\n \"useEnumType\",\n \"mergeReadWriteOnly\",\n \"useUnknown\",\n ],\n string: [\"argumentStyle\"],\n }),\n).catch((error) => {\n console.error(error);\n process.exit(1);\n});\n"],"names":["run","argv","include","exclude","optimistic","useEnumType","mergeReadWriteOnly","useUnknown","argumentStyle","help","version","spec","dest","printUsage","pkg","readFile","join","argumentStyleOptions","code","generateSource","writeFile","minimist","error"],"mappings":";;;;;AASA,eAAeA,EAAIC,GAAkB;AACnC,QAAM;AAAA,IACJ,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,MAAAC;AAAA,IACA,SAAAC;AAAA,EAAA,IACET,GACE,CAACU,GAAMC,CAAI,IAAIX,EAAK;AAO1B,MALIQ,MACFI,EAAA,GACA,QAAQ,KAAK,CAAC,IAGZH,GAAS;AACX,UAAMI,IAAM,KAAK;AAAA,MACf,MAAMC,EAASC,EAAK,WAAW,MAAM,cAAc,GAAG,MAAM;AAAA,IAAA;AAE9D,YAAQ,IAAIF,EAAI,OAAO,GACvB,QAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,EAAKH,MACHE,EAAA,GACA,QAAQ,KAAK,CAAC,IAIdL,MAAkB,UAClB,CAACS,EAAqB,SAAST,CAAa,MAE5C,QAAQ;AAAA,IACN,qCAAqCS,EAAqB;AAAA,MACxD;AAAA,IAAA,CACD,eAAeT,CAAa;AAAA,EAAA,GAE/B,QAAQ,KAAK,CAAC;AAGhB,QAAMU,IAAO,MAAMC,EAAeR,GAAM;AAAA,IACtC,SAAAT;AAAA,IACA,SAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAE;AAAA,IACA,oBAAAD;AAAA,IACA,eAAAE;AAAA,EAAA,CACD;AAED,EAAII,IAAM,MAAMQ,EAAUR,GAAMM,CAAI,IAC/B,QAAQ,IAAIA,CAAI;AACvB;AAEA,SAASL,IAAa;AACpB,UAAQ,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAaOI,EAAqB,KAAK,KAAK,CAAC;AAAA,CACtD;AACD;AAEAjB;AAAA,EACEqB,EAAS,QAAQ,KAAK,MAAM,CAAC,GAAG;AAAA,IAC9B,OAAO;AAAA,MACL,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,IAAA;AAAA,IAEL,SAAS;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,QAAQ,CAAC,eAAe;AAAA,EAAA,CACzB;AACH,EAAE,MAAM,CAACC,MAAU;AACjB,UAAQ,MAAMA,CAAK,GACnB,QAAQ,KAAK,CAAC;AAChB,CAAC;"}
@@ -0,0 +1,572 @@
1
+ import r from "typescript";
2
+ import f from "lodash";
3
+ const C = {
4
+ readOnly: "Read",
5
+ writeOnly: "Write"
6
+ };
7
+ function I(e) {
8
+ return e ? C[e] : "";
9
+ }
10
+ function P(e, t = !1, n) {
11
+ let i = f.camelCase(e) + I(n);
12
+ return t && (i = f.upperFirst(i)), K(i) ? i : "$" + i;
13
+ }
14
+ const a = r.factory, w = a.createToken(r.SyntaxKind.QuestionToken);
15
+ function d(e) {
16
+ if (e)
17
+ return e === !0 ? w : e;
18
+ }
19
+ const u = {
20
+ any: a.createKeywordTypeNode(r.SyntaxKind.AnyKeyword),
21
+ number: a.createKeywordTypeNode(r.SyntaxKind.NumberKeyword),
22
+ integer: a.createKeywordTypeNode(r.SyntaxKind.NumberKeyword),
23
+ object: a.createKeywordTypeNode(r.SyntaxKind.ObjectKeyword),
24
+ string: a.createKeywordTypeNode(r.SyntaxKind.StringKeyword),
25
+ boolean: a.createKeywordTypeNode(r.SyntaxKind.BooleanKeyword),
26
+ undefined: a.createKeywordTypeNode(r.SyntaxKind.UndefinedKeyword),
27
+ void: a.createKeywordTypeNode(r.SyntaxKind.VoidKeyword),
28
+ never: a.createKeywordTypeNode(r.SyntaxKind.NeverKeyword),
29
+ null: a.createLiteralTypeNode(a.createNull()),
30
+ unknown: a.createKeywordTypeNode(r.SyntaxKind.UnknownKeyword)
31
+ };
32
+ function v(e) {
33
+ return u[e];
34
+ }
35
+ const M = {
36
+ async: a.createModifier(r.SyntaxKind.AsyncKeyword),
37
+ export: a.createModifier(r.SyntaxKind.ExportKeyword)
38
+ };
39
+ function y(e) {
40
+ switch (typeof e) {
41
+ case "string":
42
+ return a.createStringLiteral(e);
43
+ case "boolean":
44
+ return e ? a.createTrue() : a.createFalse();
45
+ case "number":
46
+ return String(e).charAt(0) === "-" ? a.createPrefixUnaryExpression(
47
+ r.SyntaxKind.MinusToken,
48
+ a.createNumericLiteral(String(-e))
49
+ ) : a.createNumericLiteral(String(e));
50
+ }
51
+ }
52
+ function x(e) {
53
+ const t = e.map(
54
+ (n) => n === null ? u.null : a.createLiteralTypeNode(y(n))
55
+ );
56
+ return t.length > 1 ? a.createUnionTypeNode(t) : t[0];
57
+ }
58
+ function j({
59
+ modifiers: e,
60
+ name: t,
61
+ typeParameters: n,
62
+ type: i
63
+ }) {
64
+ return a.createTypeAliasDeclaration(
65
+ e,
66
+ t,
67
+ n,
68
+ i
69
+ );
70
+ }
71
+ function V({
72
+ modifiers: e,
73
+ name: t,
74
+ typeParameters: n,
75
+ type: i,
76
+ inheritedNodeNames: o
77
+ }) {
78
+ const c = o ? [
79
+ a.createHeritageClause(
80
+ r.SyntaxKind.ExtendsKeyword,
81
+ o.map((s) => {
82
+ const p = typeof s == "string" ? s : s.escapedText.toString();
83
+ return a.createExpressionWithTypeArguments(
84
+ a.createIdentifier(
85
+ P(p, !0)
86
+ ),
87
+ void 0
88
+ );
89
+ })
90
+ )
91
+ ] : [];
92
+ return a.createInterfaceDeclaration(
93
+ e,
94
+ t,
95
+ n,
96
+ c,
97
+ i.members
98
+ );
99
+ }
100
+ function m(e) {
101
+ return typeof e == "string" ? a.createIdentifier(e) : e;
102
+ }
103
+ function N(e, {
104
+ typeArgs: t,
105
+ args: n
106
+ } = {}) {
107
+ return a.createCallExpression(m(e), t, n);
108
+ }
109
+ function z(e, t) {
110
+ return N(
111
+ a.createPropertyAccessExpression(a.createThis(), e),
112
+ t
113
+ );
114
+ }
115
+ function b(e) {
116
+ return a.createObjectLiteralExpression(
117
+ e.map(
118
+ ([t, n]) => h(t, m(n))
119
+ ),
120
+ !0
121
+ );
122
+ }
123
+ function h(e, t) {
124
+ return r.isIdentifier(t) && t.text === e ? a.createShorthandPropertyAssignment(e) : a.createPropertyAssignment(L(e), t);
125
+ }
126
+ function U(...e) {
127
+ return a.createBlock(e, !0);
128
+ }
129
+ function D(e, t, {
130
+ modifiers: n,
131
+ typeParameters: i,
132
+ type: o,
133
+ equalsGreaterThanToken: c
134
+ } = {}) {
135
+ return a.createArrowFunction(
136
+ n,
137
+ i,
138
+ e,
139
+ o,
140
+ c,
141
+ t
142
+ );
143
+ }
144
+ function $(e, {
145
+ modifiers: t,
146
+ asteriskToken: n,
147
+ typeParameters: i,
148
+ type: o
149
+ }, c, s) {
150
+ return a.createFunctionDeclaration(
151
+ t,
152
+ n,
153
+ e,
154
+ i,
155
+ c,
156
+ o,
157
+ s
158
+ );
159
+ }
160
+ function q({
161
+ modifiers: e,
162
+ name: t,
163
+ typeParameters: n,
164
+ heritageClauses: i,
165
+ members: o
166
+ }) {
167
+ return a.createClassDeclaration(
168
+ e,
169
+ t,
170
+ n,
171
+ i,
172
+ o
173
+ );
174
+ }
175
+ function B({
176
+ modifiers: e,
177
+ parameters: t,
178
+ body: n
179
+ }) {
180
+ return a.createConstructorDeclaration(e, t, n);
181
+ }
182
+ function _(e, {
183
+ modifiers: t,
184
+ asteriskToken: n,
185
+ questionToken: i,
186
+ typeParameters: o,
187
+ type: c
188
+ } = {}, s = [], p) {
189
+ return a.createMethodDeclaration(
190
+ t,
191
+ n,
192
+ e,
193
+ d(i),
194
+ o,
195
+ s,
196
+ c,
197
+ p
198
+ );
199
+ }
200
+ function g(e, {
201
+ modifiers: t,
202
+ dotDotDotToken: n,
203
+ questionToken: i,
204
+ type: o,
205
+ initializer: c
206
+ }) {
207
+ return a.createParameterDeclaration(
208
+ t,
209
+ n,
210
+ e,
211
+ d(i),
212
+ o,
213
+ c
214
+ );
215
+ }
216
+ function L(e) {
217
+ return typeof e == "string" ? K(e) ? a.createIdentifier(e) : a.createStringLiteral(e) : e;
218
+ }
219
+ function k({
220
+ modifiers: e,
221
+ name: t,
222
+ questionToken: n,
223
+ type: i
224
+ }) {
225
+ return a.createPropertySignature(
226
+ e,
227
+ L(t),
228
+ d(n),
229
+ i
230
+ );
231
+ }
232
+ function H(e, {
233
+ modifiers: t,
234
+ indexName: n = "key",
235
+ indexType: i = u.string
236
+ } = {}) {
237
+ return a.createIndexSignature(
238
+ t,
239
+ [g(n, { type: i })],
240
+ e
241
+ );
242
+ }
243
+ function E(e) {
244
+ return a.createObjectBindingPattern(
245
+ e.map(
246
+ ({ dotDotDotToken: t, propertyName: n, name: i, initializer: o }) => a.createBindingElement(
247
+ t,
248
+ n,
249
+ i,
250
+ o
251
+ )
252
+ )
253
+ );
254
+ }
255
+ function F(e, t) {
256
+ return t.length ? a.createTemplateExpression(
257
+ a.createTemplateHead(e),
258
+ t.map(
259
+ ({ expression: n, literal: i }, o) => a.createTemplateSpan(
260
+ n,
261
+ o === t.length - 1 ? a.createTemplateTail(i) : a.createTemplateMiddle(i)
262
+ )
263
+ )
264
+ ) : a.createStringLiteral(e);
265
+ }
266
+ function O(e, t, n) {
267
+ const i = e.find(
268
+ (o) => o.kind === t && (!n || n(o))
269
+ );
270
+ if (!i) throw new Error(`Node not found: ${t}`);
271
+ return i;
272
+ }
273
+ function S(e) {
274
+ return r.isIdentifier(e) ? e.escapedText : r.isLiteralExpression(e) ? e.text : "";
275
+ }
276
+ function A(e) {
277
+ const t = r.getNameOfDeclaration(e.declarationList.declarations[0]);
278
+ return t ? S(t) : "";
279
+ }
280
+ function Q(e, t) {
281
+ const n = O(
282
+ e,
283
+ r.SyntaxKind.VariableStatement,
284
+ (o) => A(o) === t
285
+ ), [i] = n.declarationList.declarations;
286
+ if (!i) throw new Error(`Missing ${t} declaration`);
287
+ return i;
288
+ }
289
+ function W(e, t, n) {
290
+ const i = e.properties.find(
291
+ (o) => r.isPropertyAssignment(o) && S(o.name) === t
292
+ );
293
+ if (i && r.isPropertyAssignment(i))
294
+ Object.assign(i, { initializer: n });
295
+ else
296
+ throw new Error(`No such property: ${t}`);
297
+ }
298
+ function R(e) {
299
+ return (t) => (n) => {
300
+ function i(o) {
301
+ const c = e(o, t);
302
+ return c || r.visitEachChild(o, i, t);
303
+ }
304
+ return r.visitNode(n, i);
305
+ };
306
+ }
307
+ function Y(e, ...t) {
308
+ return r.transform(e, t.map(R)).transformed[0];
309
+ }
310
+ function G(e, ...t) {
311
+ return a.createNodeArray([...e, ...t]);
312
+ }
313
+ function J(e, t) {
314
+ return t ? r.addSyntheticLeadingComment(
315
+ e,
316
+ r.SyntaxKind.MultiLineCommentTrivia,
317
+ `*
318
+ * ${t.replace(/\n/g, `
319
+ * `)}
320
+ `,
321
+ !0
322
+ ) : e;
323
+ }
324
+ const T = r.createPrinter({
325
+ newLine: r.NewLineKind.LineFeed
326
+ });
327
+ function X(e) {
328
+ const t = r.createSourceFile(
329
+ "someFileName.ts",
330
+ "",
331
+ r.ScriptTarget.Latest,
332
+ /*setParentNodes*/
333
+ !1,
334
+ r.ScriptKind.TS
335
+ );
336
+ return T.printNode(r.EmitHint.Unspecified, e, t);
337
+ }
338
+ function Z(e) {
339
+ const t = r.createSourceFile(
340
+ "someFileName.ts",
341
+ "",
342
+ r.ScriptTarget.Latest,
343
+ /*setParentNodes*/
344
+ !1,
345
+ r.ScriptKind.TS
346
+ );
347
+ return e.map((n) => T.printNode(r.EmitHint.Unspecified, n, t)).join(`
348
+ `);
349
+ }
350
+ function ee(e) {
351
+ return T.printFile(e);
352
+ }
353
+ function K(e) {
354
+ if (!e.length || e.trim() !== e) return !1;
355
+ const t = r.parseIsolatedEntityName(e, r.ScriptTarget.Latest);
356
+ return !!t && t.kind === r.SyntaxKind.Identifier && r.identifierToKeywordKind(t) === void 0;
357
+ }
358
+ function te(e, t) {
359
+ return r.factory.updateVariableDeclaration(
360
+ e,
361
+ t.name || e.name,
362
+ t.exclamationToken || e.exclamationToken,
363
+ t.type || e.type,
364
+ t.initializer || e.initializer
365
+ );
366
+ }
367
+ function re(e, t) {
368
+ return r.factory.updateFunctionDeclaration(
369
+ e,
370
+ t.modifiers || e.modifiers,
371
+ t.asteriskToken || e.asteriskToken,
372
+ t.name || e.name,
373
+ t.typeParameters || e.typeParameters,
374
+ t.parameters || e.parameters,
375
+ t.type || e.type,
376
+ t.body || e.body
377
+ );
378
+ }
379
+ const pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
380
+ __proto__: null,
381
+ addComment: J,
382
+ appendNodes: G,
383
+ block: U,
384
+ changePropertyValue: W,
385
+ createArrowFunction: D,
386
+ createCall: N,
387
+ createClassDeclaration: q,
388
+ createConstructor: B,
389
+ createEnumTypeNode: x,
390
+ createFunctionDeclaration: $,
391
+ createIndexSignature: H,
392
+ createInterfaceAliasDeclaration: V,
393
+ createKeywordType: v,
394
+ createLiteral: y,
395
+ createMethod: _,
396
+ createMethodCall: z,
397
+ createObjectBinding: E,
398
+ createObjectLiteral: b,
399
+ createParameter: g,
400
+ createPropertyAssignment: h,
401
+ createPropertySignature: k,
402
+ createQuestionToken: d,
403
+ createTemplateString: F,
404
+ createTypeAliasDeclaration: j,
405
+ findFirstVariableDeclaration: Q,
406
+ findNode: O,
407
+ getFirstDeclarationName: A,
408
+ getName: S,
409
+ isValidIdentifier: K,
410
+ keywordType: u,
411
+ modifier: M,
412
+ printFile: ee,
413
+ printNode: X,
414
+ printNodes: Z,
415
+ questionToken: w,
416
+ toExpression: m,
417
+ transform: Y,
418
+ updateFunctionDeclaration: re,
419
+ updateVariableDeclaration: te
420
+ }, Symbol.toStringTag, { value: "Module" })), l = r.factory;
421
+ function ne(e) {
422
+ const t = e.split(/{([\s\S]+?)}/g), n = f.chunk(t.slice(1), 2);
423
+ return F(
424
+ t[0],
425
+ n.map(([i, o]) => ({
426
+ expression: l.createIdentifier(i),
427
+ literal: o
428
+ }))
429
+ );
430
+ }
431
+ function ae(e, t) {
432
+ const n = [
433
+ g(
434
+ E(
435
+ Object.entries(t || {}).map(([i, o]) => ({
436
+ name: i,
437
+ initializer: y(o.default)
438
+ }))
439
+ ),
440
+ {
441
+ type: l.createTypeLiteralNode(
442
+ Object.entries(t || {}).map(([i, o]) => k({
443
+ name: i,
444
+ type: o.enum ? x(o.enum) : l.createUnionTypeNode([
445
+ u.string,
446
+ u.number,
447
+ u.boolean
448
+ ])
449
+ }))
450
+ )
451
+ }
452
+ )
453
+ ];
454
+ return D(n, ne(e));
455
+ }
456
+ function ie(e) {
457
+ return e.variables ? ae(e.url, e.variables) : l.createStringLiteral(e.url);
458
+ }
459
+ function oe(e) {
460
+ if (!e) return "/";
461
+ const { url: t, variables: n } = e;
462
+ return n ? t.replace(
463
+ /\{(.+?)\}/g,
464
+ (i, o) => n[o] ? String(n[o].default) : i
465
+ ) : t;
466
+ }
467
+ function ce(e) {
468
+ return oe(e?.[0]);
469
+ }
470
+ function se(e, t) {
471
+ return e.description ? f.camelCase(e.description.replace(/\W+/, " ")) : `server${t + 1}`;
472
+ }
473
+ function ue(e) {
474
+ return b(
475
+ e.map((t, n) => [
476
+ se(t, n),
477
+ ie(t)
478
+ ])
479
+ );
480
+ }
481
+ function ye(e) {
482
+ return r.factory.createVariableStatement(
483
+ [r.factory.createModifier(r.SyntaxKind.ExportKeyword)],
484
+ r.factory.createVariableDeclarationList(
485
+ [
486
+ r.factory.createVariableDeclaration(
487
+ "servers",
488
+ void 0,
489
+ void 0,
490
+ ue(e)
491
+ )
492
+ ],
493
+ r.NodeFlags.Const
494
+ )
495
+ );
496
+ }
497
+ function me(e, t = {}) {
498
+ const n = f.cloneDeep(e);
499
+ return {
500
+ opts: t,
501
+ spec: n,
502
+ // Template parts
503
+ banner: `DO NOT MODIFY - This file has been generated using oazapfts.
504
+ See https://www.npmjs.com/package/oazapfts`,
505
+ imports: [
506
+ [{ namespace: "Oazapfts" }, { from: "@oazapfts/runtime" }],
507
+ [{ namespace: "QS" }, { from: "@oazapfts/runtime/query" }]
508
+ ],
509
+ defaults: { baseUrl: ce(n.servers), headers: {} },
510
+ servers: n.servers || [],
511
+ init: fe(),
512
+ // Internal state
513
+ discriminatingSchemas: /* @__PURE__ */ new Set(),
514
+ aliases: [],
515
+ enumAliases: [],
516
+ enumRefs: {},
517
+ refs: {},
518
+ refsOnlyMode: /* @__PURE__ */ new Map(),
519
+ typeAliases: {}
520
+ };
521
+ }
522
+ function fe() {
523
+ return [
524
+ r.factory.createVariableStatement(
525
+ void 0,
526
+ r.factory.createVariableDeclarationList(
527
+ [
528
+ r.factory.createVariableDeclaration(
529
+ "oazapfts",
530
+ void 0,
531
+ void 0,
532
+ r.factory.createCallExpression(
533
+ r.factory.createPropertyAccessExpression(
534
+ r.factory.createIdentifier("Oazapfts"),
535
+ "runtime"
536
+ ),
537
+ void 0,
538
+ [r.factory.createIdentifier("defaults")]
539
+ )
540
+ )
541
+ ],
542
+ r.NodeFlags.Const
543
+ )
544
+ )
545
+ ];
546
+ }
547
+ export {
548
+ F as a,
549
+ j as b,
550
+ N as c,
551
+ y as d,
552
+ k as e,
553
+ H as f,
554
+ x as g,
555
+ g as h,
556
+ K as i,
557
+ E as j,
558
+ u as k,
559
+ b as l,
560
+ M as m,
561
+ h as n,
562
+ J as o,
563
+ $ as p,
564
+ U as q,
565
+ ye as r,
566
+ me as s,
567
+ P as t,
568
+ re as u,
569
+ ee as v,
570
+ pe as w
571
+ };
572
+ //# sourceMappingURL=context-j-dMIA6M.js.map