@ahoo-wang/fetcher-generator 3.3.3 → 3.3.6

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/index.js CHANGED
@@ -25,7 +25,7 @@ function $(n, e) {
25
25
  schema: S(n, e)
26
26
  };
27
27
  }
28
- const Te = /[-_'\s.]+/;
28
+ const Te = /[-_'\s./?;:,()[\]{}|\\]+/;
29
29
  function O(n) {
30
30
  return n.split(Te);
31
31
  }
@@ -823,7 +823,9 @@ class it {
823
823
  o.addStatements(`export const ${r} = '${e}';`);
824
824
  }
825
825
  }
826
- const st = "@ahoo-wang/fetcher-decorator", at = [
826
+ const st = "@ahoo-wang/fetcher", at = [
827
+ "ResultExtractors"
828
+ ], ct = "@ahoo-wang/fetcher-decorator", pt = [
827
829
  "type ApiMetadata",
828
830
  "type ApiMetadataCapable",
829
831
  "type ParameterRequest",
@@ -837,7 +839,7 @@ const st = "@ahoo-wang/fetcher-decorator", at = [
837
839
  "attribute",
838
840
  "path",
839
841
  "autoGeneratedError"
840
- ], ct = {
842
+ ], gt = {
841
843
  type: "Promise<Response>",
842
844
  metadata: "{resultExtractor: ResultExtractors.Response }"
843
845
  }, H = {
@@ -847,9 +849,12 @@ const st = "@ahoo-wang/fetcher-decorator", at = [
847
849
  headers: { Accept: ContentTypeValues.TEXT_EVENT_STREAM },
848
850
  resultExtractor: JsonEventStreamResultExtractor,
849
851
  }`;
850
- function le(n) {
852
+ function ut(n) {
851
853
  A(n, st, at);
852
854
  }
855
+ function le(n) {
856
+ A(n, ct, pt);
857
+ }
853
858
  function j(n, e, t = [], o = [], r) {
854
859
  return e.addClass({
855
860
  name: n,
@@ -878,14 +883,14 @@ function me(n, e) {
878
883
  ]
879
884
  });
880
885
  }
881
- const pt = "@ahoo-wang/fetcher-eventstream";
886
+ const lt = "@ahoo-wang/fetcher-eventstream";
882
887
  function de(n) {
883
- A(n, pt, [
888
+ A(n, lt, [
884
889
  "JsonEventStreamResultExtractor",
885
890
  "type JsonServerSentEventStream"
886
891
  ]);
887
892
  }
888
- function gt(n) {
893
+ function mt(n) {
889
894
  let e = 0, t = 0;
890
895
  return n.commands.forEach((o) => {
891
896
  o.path.startsWith(L.TENANT) && (e += 1), o.path.startsWith(L.OWNER) && (t += 1);
@@ -901,9 +906,9 @@ function y(n, e) {
901
906
  function _(n) {
902
907
  return n === "delete" ? "del" : n;
903
908
  }
904
- const ut = "x-fetcher-method";
905
- function lt(n, e) {
906
- const t = n[ut];
909
+ const dt = "x-fetcher-method";
910
+ function ft(n, e) {
911
+ const t = n[dt];
907
912
  if (t)
908
913
  return t;
909
914
  if (!n.operationId)
@@ -916,7 +921,7 @@ function lt(n, e) {
916
921
  }
917
922
  return f(o);
918
923
  }
919
- class mt {
924
+ class ht {
920
925
  /**
921
926
  * Creates a new ApiClientGenerator instance.
922
927
  * @param context - The generation context containing OpenAPI spec and configuration
@@ -925,7 +930,7 @@ class mt {
925
930
  this.context = e, this.apiMetadataCtorInitializer = this.context.currentContextAlias ? `{basePath:${D(this.context.currentContextAlias)}}` : void 0;
926
931
  }
927
932
  defaultParameterRequestType = "ParameterRequest";
928
- defaultReturnType = ct;
933
+ defaultReturnType = gt;
929
934
  apiMetadataCtorInitializer;
930
935
  /**
931
936
  * Generates API client classes for all valid tags in the OpenAPI specification.
@@ -982,7 +987,7 @@ class mt {
982
987
  `Generating API client class: ${o.name}ApiClient with ${t.size} operations`
983
988
  );
984
989
  const r = this.createApiClientFile(o);
985
- le(r), de(r);
990
+ ut(r), le(r), de(r);
986
991
  const i = j(
987
992
  o.name + "ApiClient",
988
993
  r
@@ -1002,7 +1007,7 @@ class mt {
1002
1007
  * @returns A unique camelCase method name
1003
1008
  */
1004
1009
  getMethodName(e, t) {
1005
- const o = lt(t, (r) => e.getMethod(r) !== void 0);
1010
+ const o = ft(t, (r) => e.getMethod(r) !== void 0);
1006
1011
  if (!o)
1007
1012
  throw new Error(
1008
1013
  `Unable to resolve method name for apiClientClass:${e.getName()}.`
@@ -1295,7 +1300,7 @@ class mt {
1295
1300
  return !1;
1296
1301
  }
1297
1302
  }
1298
- class dt {
1303
+ class yt {
1299
1304
  /**
1300
1305
  * Creates a new CommandClientGenerator instance.
1301
1306
  * @param context - The generation context containing OpenAPI spec and project details
@@ -1567,7 +1572,7 @@ class dt {
1567
1572
  );
1568
1573
  }
1569
1574
  }
1570
- class ft {
1575
+ class xt {
1571
1576
  /**
1572
1577
  * Creates a new QueryClientGenerator instance.
1573
1578
  * @param context - The generation context containing OpenAPI spec and project details
@@ -1645,7 +1650,7 @@ class ft {
1645
1650
  initializer: `{
1646
1651
  contextAlias: ${D(e.aggregate.contextAlias)},
1647
1652
  aggregateName: '${e.aggregate.aggregateName}',
1648
- resourceAttribution: ${gt(e)},
1653
+ resourceAttribution: ${mt(e)},
1649
1654
  }`
1650
1655
  }
1651
1656
  ],
@@ -1716,13 +1721,13 @@ class ft {
1716
1721
  });
1717
1722
  }
1718
1723
  }
1719
- class ht {
1724
+ class At {
1720
1725
  /**
1721
1726
  * Creates a new ClientGenerator instance.
1722
1727
  * @param context - The generation context containing OpenAPI spec and project details
1723
1728
  */
1724
1729
  constructor(e) {
1725
- this.context = e, this.queryClientGenerator = new ft(e), this.commandClientGenerator = new dt(e), this.apiClientGenerator = new mt(e);
1730
+ this.context = e, this.queryClientGenerator = new xt(e), this.commandClientGenerator = new yt(e), this.apiClientGenerator = new ht(e);
1726
1731
  }
1727
1732
  queryClientGenerator;
1728
1733
  commandClientGenerator;
@@ -1745,7 +1750,7 @@ class ht {
1745
1750
  this.queryClientGenerator.generate(), this.commandClientGenerator.generate(), this.apiClientGenerator.generate(), this.context.logger.success("Client generation completed");
1746
1751
  }
1747
1752
  }
1748
- class yt {
1753
+ class Ct {
1749
1754
  /** The ts-morph project instance used for code generation */
1750
1755
  project;
1751
1756
  /** The OpenAPI specification object */
@@ -1772,8 +1777,8 @@ class yt {
1772
1777
  return this.defaultIgnorePathParameters.includes(t);
1773
1778
  }
1774
1779
  }
1775
- const xt = "./fetcher-generator.config.json";
1776
- class It {
1780
+ const Pt = "./fetcher-generator.config.json";
1781
+ class Rt {
1777
1782
  /**
1778
1783
  * Creates a new CodeGenerator instance with the specified options.
1779
1784
  *
@@ -1817,14 +1822,14 @@ class It {
1817
1822
  this.options.logger.info(
1818
1823
  `Resolved ${r.size} bounded context aggregates`
1819
1824
  );
1820
- const i = this.options.configPath ?? xt;
1825
+ const i = this.options.configPath ?? Pt;
1821
1826
  let s = {};
1822
1827
  try {
1823
1828
  this.options.logger.info(`Parsing configuration file: ${i}`), s = await ke(i);
1824
1829
  } catch (d) {
1825
1830
  this.options.logger.info(`Configuration file parsing failed: ${d}`);
1826
1831
  }
1827
- const a = new yt({
1832
+ const a = new Ct({
1828
1833
  openAPI: t,
1829
1834
  project: this.project,
1830
1835
  outputDir: this.options.outputDir,
@@ -1832,7 +1837,7 @@ class It {
1832
1837
  logger: this.options.logger,
1833
1838
  config: s
1834
1839
  });
1835
- this.options.logger.info("Generating models"), new it(a).generate(), this.options.logger.info("Models generated successfully"), this.options.logger.info("Generating clients"), new ht(a).generate(), this.options.logger.info("Clients generated successfully");
1840
+ this.options.logger.info("Generating models"), new it(a).generate(), this.options.logger.info("Models generated successfully"), this.options.logger.info("Generating clients"), new At(a).generate(), this.options.logger.info("Clients generated successfully");
1836
1841
  const g = this.project.getDirectory(this.options.outputDir);
1837
1842
  if (!g) {
1838
1843
  this.options.logger.info("Output directory not found.");
@@ -1929,7 +1934,7 @@ class It {
1929
1934
  }
1930
1935
  }
1931
1936
  export {
1932
- It as CodeGenerator,
1933
- xt as DEFAULT_CONFIG_PATH
1937
+ Rt as CodeGenerator,
1938
+ Pt as DEFAULT_CONFIG_PATH
1934
1939
  };
1935
1940
  //# sourceMappingURL=index.js.map