@ahoo-wang/fetcher-generator 2.10.8 → 2.11.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/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Scope as le, VariableDeclarationKind as O, Project as pe } from "ts-morph";
2
2
  import { ContentTypeValues as E, combineURLs as v } from "@ahoo-wang/fetcher";
3
3
  import { ResourceAttributionPathSpec as W } from "@ahoo-wang/fetcher-wow";
4
- import { parse as V } from "yaml";
4
+ import { parse as J } from "yaml";
5
5
  import { readFile as me } from "fs";
6
6
  import { join as de, relative as fe } from "path";
7
7
  function $(o) {
@@ -11,11 +11,11 @@ function S(o, e) {
11
11
  const t = $(o);
12
12
  return e.schemas?.[t];
13
13
  }
14
- function K(o, e) {
14
+ function V(o, e) {
15
15
  const t = $(o);
16
16
  return e.requestBodies?.[t];
17
17
  }
18
- function H(o, e) {
18
+ function K(o, e) {
19
19
  const t = $(o);
20
20
  return e.parameters?.[t];
21
21
  }
@@ -25,11 +25,14 @@ function I(o, e) {
25
25
  schema: S(o, e)
26
26
  };
27
27
  }
28
- const z = /[-_\s.]+/;
29
- function q(o) {
30
- return Array.isArray(o) ? o.flatMap((e) => L(e.split(z))) : L(o.split(z));
28
+ const he = /[-_\s.]+/;
29
+ function N(o) {
30
+ return o.split(he);
31
31
  }
32
- function L(o) {
32
+ function H(o) {
33
+ return Array.isArray(o) ? o.flatMap((e) => z(N(e))) : z(N(o));
34
+ }
35
+ function z(o) {
33
36
  return o.flatMap((e) => {
34
37
  if (e.length === 0)
35
38
  return [];
@@ -43,7 +46,7 @@ function L(o) {
43
46
  });
44
47
  }
45
48
  function x(o) {
46
- return o === "" || o.length === 0 ? "" : q(o).filter((t) => t.length > 0).map((t) => {
49
+ return o === "" || o.length === 0 ? "" : H(o).filter((t) => t.length > 0).map((t) => {
47
50
  const n = t.charAt(0), r = t.slice(1);
48
51
  return (/[a-zA-Z]/.test(n) ? n.toUpperCase() : n) + r.toLowerCase();
49
52
  }).join("");
@@ -52,8 +55,8 @@ function h(o) {
52
55
  const e = x(o);
53
56
  return e.charAt(0).toLowerCase() + e.slice(1);
54
57
  }
55
- function he(o) {
56
- return o === "" || Array.isArray(o) && o.length === 0 ? "" : q(o).filter((t) => t.length > 0).map((t) => t.toUpperCase()).join("_");
58
+ function ye(o) {
59
+ return o === "" || Array.isArray(o) && o.length === 0 ? "" : H(o).filter((t) => t.length > 0).map((t) => t.toUpperCase()).join("_");
57
60
  }
58
61
  function g(o) {
59
62
  return !!(o && typeof o == "object" && "$ref" in o);
@@ -65,13 +68,13 @@ function j(o, e) {
65
68
  function Y(o) {
66
69
  return j(E.APPLICATION_JSON, o);
67
70
  }
68
- function ye(o) {
71
+ function xe(o) {
69
72
  return j(E.TEXT_EVENT_STREAM, o);
70
73
  }
71
- function xe(o) {
74
+ function Ae(o) {
72
75
  return j("*/*", o);
73
76
  }
74
- const Ae = [
77
+ const Ce = [
75
78
  "string",
76
79
  "number",
77
80
  "integer",
@@ -79,12 +82,12 @@ const Ae = [
79
82
  "null"
80
83
  ];
81
84
  function _(o) {
82
- return Array.isArray(o) ? !0 : Ae.includes(o);
85
+ return Array.isArray(o) ? !0 : Ce.includes(o);
83
86
  }
84
- function N(o) {
87
+ function D(o) {
85
88
  return o.type === "array";
86
89
  }
87
- function Ce(o) {
90
+ function Pe(o) {
88
91
  return Array.isArray(o.enum) && o.enum.length > 0;
89
92
  }
90
93
  function X(o) {
@@ -93,19 +96,19 @@ function X(o) {
93
96
  function Z(o) {
94
97
  return Array.isArray(o.oneOf) && o.oneOf.length > 0;
95
98
  }
96
- function Pe(o) {
99
+ function $e(o) {
97
100
  return X(o) || Z(o);
98
101
  }
99
- function $e(o) {
102
+ function Ie(o) {
100
103
  return Array.isArray(o.allOf) && o.allOf.length > 0;
101
104
  }
102
- function B(o) {
103
- return X(o) || Z(o) || $e(o);
105
+ function L(o) {
106
+ return X(o) || Z(o) || Ie(o);
104
107
  }
105
108
  function k(o) {
106
109
  return o.includes("|") || o.includes("&") ? `(${o})[]` : `${o}[]`;
107
110
  }
108
- function Ie(o) {
111
+ function Te(o) {
109
112
  return o.type !== "object" ? !1 : o.properties ? Object.keys(o.properties).length === 0 : !0;
110
113
  }
111
114
  function A(o) {
@@ -125,7 +128,7 @@ function A(o) {
125
128
  return "any";
126
129
  }
127
130
  }
128
- function D(o) {
131
+ function M(o) {
129
132
  return [
130
133
  { method: "get", operation: o.get },
131
134
  { method: "put", operation: o.put },
@@ -140,48 +143,48 @@ function D(o) {
140
143
  function F(o) {
141
144
  return o.responses[200];
142
145
  }
143
- function U(o) {
146
+ function B(o) {
144
147
  const e = F(o);
145
148
  return Y(e);
146
149
  }
147
- function Te(o, e) {
148
- return o.parameters ? o.parameters.map((t) => g(t) ? H(t, e) : t).filter((t) => t.in === "path") : [];
150
+ function Ee(o, e) {
151
+ return o.parameters ? o.parameters.map((t) => g(t) ? K(t, e) : t).filter((t) => t.in === "path") : [];
149
152
  }
150
- const Ee = "string";
153
+ const ve = "string";
151
154
  function ee(o) {
152
- return !o.schema || g(o.schema) || !o.schema.type || !_(o.schema.type) ? Ee : A(o.schema.type);
155
+ return !o.schema || g(o.schema) || !o.schema.type || !_(o.schema.type) ? ve : A(o.schema.type);
153
156
  }
154
157
  function te(o) {
155
- return o.startsWith("http://") || o.startsWith("https://") ? ve(o) : Se(o);
158
+ return o.startsWith("http://") || o.startsWith("https://") ? Se(o) : Re(o);
156
159
  }
157
- async function ve(o) {
160
+ async function Se(o) {
158
161
  return await (await fetch(o)).text();
159
162
  }
160
- function Se(o) {
163
+ function Re(o) {
161
164
  return new Promise((e, t) => {
162
165
  me(o, "utf-8", (n, r) => {
163
166
  n ? t(n) : e(r);
164
167
  });
165
168
  });
166
169
  }
167
- async function Re(o) {
170
+ async function we(o) {
168
171
  const e = await te(o);
169
172
  switch (ne(e)) {
170
173
  case "json":
171
174
  return JSON.parse(e);
172
175
  case "yaml":
173
- return V(e);
176
+ return J(e);
174
177
  default:
175
178
  throw new Error(`Unsupported file format: ${o}`);
176
179
  }
177
180
  }
178
- async function we(o) {
181
+ async function Oe(o) {
179
182
  const e = await te(o);
180
183
  switch (ne(e)) {
181
184
  case "json":
182
185
  return JSON.parse(e);
183
186
  case "yaml":
184
- return V(e);
187
+ return J(e);
185
188
  default:
186
189
  throw new Error(`Unsupported file format: ${o}`);
187
190
  }
@@ -200,8 +203,8 @@ function ne(o) {
200
203
  }
201
204
  throw new Error("Unable to infer file format");
202
205
  }
203
- const oe = "types.ts", Oe = "@";
204
- function Ne(o) {
206
+ const oe = "types.ts", Ne = "@";
207
+ function De(o) {
205
208
  return v(o.path, oe);
206
209
  }
207
210
  function re(o, e, t) {
@@ -223,7 +226,7 @@ function C(o, e, t) {
223
226
  });
224
227
  }
225
228
  function f(o, e, t) {
226
- if (t.path.startsWith(Oe)) {
229
+ if (t.path.startsWith(Ne)) {
227
230
  C(o, t.path, [t.name]);
228
231
  return;
229
232
  }
@@ -234,7 +237,7 @@ function f(o, e, t) {
234
237
  function T(o, e, t, n) {
235
238
  o.path !== n.path && f(e, t, n);
236
239
  }
237
- function De(o) {
240
+ function Me(o) {
238
241
  if (!Array.isArray(o))
239
242
  return;
240
243
  const e = o.filter(
@@ -244,7 +247,7 @@ function De(o) {
244
247
  `) : void 0;
245
248
  }
246
249
  function R(o, e) {
247
- const t = De(e);
250
+ const t = Me(e);
248
251
  t && o.addJsDoc(t);
249
252
  }
250
253
  function w(o, e) {
@@ -252,9 +255,9 @@ function w(o, e) {
252
255
  e.title,
253
256
  e.description
254
257
  ];
255
- e.format && t.push(`- format: ${e.format}`), Q(t, e, "default"), Q(t, e, "example"), Me(t, e), be(t, e), qe(t, e), R(o, t);
258
+ e.format && t.push(`- format: ${e.format}`), U(t, e, "default"), U(t, e, "example"), be(t, e), qe(t, e), je(t, e), R(o, t);
256
259
  }
257
- function Q(o, e, t) {
260
+ function U(o, e, t) {
258
261
  const n = e[t];
259
262
  if (n) {
260
263
  if (typeof n != "object") {
@@ -264,7 +267,7 @@ function Q(o, e, t) {
264
267
  o.push(`- ${t}: `), o.push("```json"), o.push(JSON.stringify(n)), o.push("```");
265
268
  }
266
269
  }
267
- function Me(o, e) {
270
+ function be(o, e) {
268
271
  const t = ["- Numeric Constraints"];
269
272
  e.minimum !== void 0 && t.push(` - minimum: ${e.minimum}`), e.maximum !== void 0 && t.push(` - maximum: ${e.maximum}`), e.exclusiveMinimum !== void 0 && t.push(
270
273
  ` - exclusiveMinimum: ${e.exclusiveMinimum}`
@@ -272,28 +275,28 @@ function Me(o, e) {
272
275
  ` - exclusiveMaximum: ${e.exclusiveMaximum}`
273
276
  ), e.multipleOf !== void 0 && t.push(` - multipleOf: ${e.multipleOf}`), t.length !== 1 && o.push(...t);
274
277
  }
275
- function be(o, e) {
278
+ function qe(o, e) {
276
279
  const t = ["- String Constraints"];
277
280
  e.minLength !== void 0 && t.push(` - minLength: ${e.minLength}`), e.maxLength !== void 0 && t.push(` - maxLength: ${e.maxLength}`), e.pattern !== void 0 && t.push(` - pattern: ${e.pattern}`), t.length !== 1 && o.push(...t);
278
281
  }
279
- function qe(o, e) {
282
+ function je(o, e) {
280
283
  const t = ["- Array Constraints"];
281
284
  e.minItems !== void 0 && t.push(` - minItems: ${e.minItems}`), e.maxItems !== void 0 && t.push(` - maxItems: ${e.maxItems}`), e.uniqueItems !== void 0 && t.push(` - uniqueItems: ${e.uniqueItems}`), t.length !== 1 && o.push(...t);
282
285
  }
283
- function je(o) {
286
+ function _e(o) {
284
287
  const e = o.split(".");
285
288
  return e.length != 2 || e[0].length === 0 || e[1].length === 0 ? null : e;
286
289
  }
287
- function _e(o) {
288
- const e = je(o.name);
290
+ function Fe(o) {
291
+ const e = _e(o.name);
289
292
  return e ? {
290
293
  tag: o,
291
294
  contextAlias: e[0],
292
295
  aggregateName: e[1]
293
296
  } : null;
294
297
  }
295
- function Fe(o) {
296
- const e = o?.map((n) => _e(n)).filter((n) => n !== null);
298
+ function Ge(o) {
299
+ const e = o?.map((n) => Fe(n)).filter((n) => n !== null);
297
300
  if (!e)
298
301
  return /* @__PURE__ */ new Map();
299
302
  const t = /* @__PURE__ */ new Map();
@@ -305,20 +308,20 @@ function Fe(o) {
305
308
  });
306
309
  }), t;
307
310
  }
308
- function Ge(o) {
311
+ function We(o) {
309
312
  if (!o)
310
313
  return null;
311
314
  const e = o.split(".");
312
315
  return e.length != 3 ? null : e[2];
313
316
  }
314
- const We = "#/components/responses/wow.CommandOk", ze = "#/components/parameters/wow.id";
315
- class Le {
317
+ const ze = "#/components/responses/wow.CommandOk", Le = "#/components/parameters/wow.id";
318
+ class ke {
316
319
  /**
317
320
  * Creates a new AggregateResolver instance.
318
321
  * @param openAPI - The OpenAPI specification to resolve aggregates from
319
322
  */
320
323
  constructor(e) {
321
- this.openAPI = e, this.aggregates = Fe(e.tags), this.build();
324
+ this.openAPI = e, this.aggregates = Ge(e.tags), this.build();
322
325
  }
323
326
  aggregates;
324
327
  /**
@@ -327,7 +330,7 @@ class Le {
327
330
  */
328
331
  build() {
329
332
  for (const [e, t] of Object.entries(this.openAPI.paths)) {
330
- const n = D(t);
333
+ const n = M(t);
331
334
  for (const r of n)
332
335
  this.commands(e, r), this.state(r.operation), this.events(r.operation), this.fields(r.operation);
333
336
  }
@@ -356,17 +359,17 @@ class Le {
356
359
  const n = t.operation;
357
360
  if (n.operationId === "wow.command.send")
358
361
  return;
359
- const r = Ge(n.operationId);
362
+ const r = We(n.operationId);
360
363
  if (!r)
361
364
  return;
362
365
  const i = F(n);
363
- if (!i || !g(i) || i.$ref !== We || !n.requestBody)
366
+ if (!i || !g(i) || i.$ref !== ze || !n.requestBody)
364
367
  return;
365
- const s = n.parameters ?? [], a = s.filter((m) => g(m) && m.$ref === ze).at(0), c = s.filter(
368
+ const s = n.parameters ?? [], a = s.filter((m) => g(m) && m.$ref === Le).at(0), c = s.filter(
366
369
  (m) => !g(m) && m.in === "path"
367
370
  );
368
371
  if (a) {
369
- const m = H(
372
+ const m = K(
370
373
  a,
371
374
  this.openAPI.components
372
375
  );
@@ -399,7 +402,7 @@ class Le {
399
402
  state(e) {
400
403
  if (!e.operationId?.endsWith(".snapshot_state.single"))
401
404
  return;
402
- const t = U(e);
405
+ const t = B(e);
403
406
  if (!g(t))
404
407
  return;
405
408
  const n = I(
@@ -418,7 +421,7 @@ class Le {
418
421
  events(e) {
419
422
  if (!this.openAPI.components || !e.operationId?.endsWith(".event.list_query"))
420
423
  return;
421
- const t = U(e);
424
+ const t = B(e);
422
425
  if (g(t))
423
426
  return;
424
427
  const n = t?.items;
@@ -452,7 +455,7 @@ class Le {
452
455
  fields(e) {
453
456
  if (!this.openAPI.components || !e.operationId?.endsWith(".snapshot.count"))
454
457
  return;
455
- const n = K(
458
+ const n = V(
456
459
  e.requestBody,
457
460
  this.openAPI.components
458
461
  ).content[E.APPLICATION_JSON].schema, i = S(
@@ -514,12 +517,12 @@ function y(o) {
514
517
  const e = $(o);
515
518
  return d(e);
516
519
  }
517
- class ke {
520
+ class Ue {
518
521
  constructor(e) {
519
522
  this.context = e;
520
523
  }
521
524
  getOrCreateSourceFile(e) {
522
- const t = Ne(e);
525
+ const t = De(e);
523
526
  return this.context.getOrCreateSourceFile(t);
524
527
  }
525
528
  /**
@@ -598,16 +601,16 @@ class ke {
598
601
  i && w(i, t);
599
602
  }
600
603
  process(e, t, n) {
601
- if (Ce(n))
604
+ if (Pe(n))
602
605
  return t.addEnum({
603
606
  name: e.name,
604
607
  isExported: !0,
605
608
  members: n.enum.filter((i) => typeof i == "string" && i.length > 0).map((i) => ({
606
- name: he(i),
609
+ name: ye(i),
607
610
  initializer: `'${i}'`
608
611
  }))
609
612
  });
610
- if (N(n) && g(n.items)) {
613
+ if (D(n) && g(n.items)) {
611
614
  const i = y(n.items);
612
615
  return T(
613
616
  e,
@@ -629,7 +632,7 @@ class ke {
629
632
  e,
630
633
  n,
631
634
  r
632
- ) : (B(n) && (n.anyOf || n.oneOf || n.allOf).forEach((s) => {
635
+ ) : (L(n) && (n.anyOf || n.oneOf || n.allOf).forEach((s) => {
633
636
  if (g(s)) {
634
637
  const a = y(s);
635
638
  T(
@@ -688,7 +691,7 @@ class ke {
688
691
  }
689
692
  if (r.const)
690
693
  return `'${r.const}'`;
691
- if (N(r)) {
694
+ if (D(r)) {
692
695
  const i = this.resolvePropertyType(
693
696
  e,
694
697
  t,
@@ -699,7 +702,7 @@ class ke {
699
702
  }
700
703
  if (r.type && _(r.type))
701
704
  return A(r.type);
702
- if (B(r))
705
+ if (L(r))
703
706
  return this.resolvePropertyCompositionType(
704
707
  e,
705
708
  t,
@@ -733,11 +736,11 @@ class ke {
733
736
  }
734
737
  i.add(A(a.type ?? "string"));
735
738
  });
736
- const s = Pe(n) ? "|" : "&";
739
+ const s = $e(n) ? "|" : "&";
737
740
  return Array.from(i).join(s);
738
741
  }
739
742
  }
740
- const Ue = "@ahoo-wang/fetcher-decorator", Qe = [
743
+ const Qe = "@ahoo-wang/fetcher-decorator", Je = [
741
744
  "type ApiMetadata",
742
745
  "type ApiMetadataCapable",
743
746
  "type ParameterRequest",
@@ -751,18 +754,18 @@ const Ue = "@ahoo-wang/fetcher-decorator", Qe = [
751
754
  "attribute",
752
755
  "path",
753
756
  "autoGeneratedError"
754
- ], Je = {
757
+ ], Ve = {
755
758
  type: "Promise<Response>",
756
759
  metadata: "{resultExtractor: ResultExtractors.Response }"
757
- }, J = {
760
+ }, Q = {
758
761
  type: "Promise<string>",
759
762
  metadata: "{resultExtractor: ResultExtractors.Text }"
760
- }, M = `{
763
+ }, b = `{
761
764
  headers: { Accept: ContentTypeValues.TEXT_EVENT_STREAM },
762
765
  resultExtractor: JsonEventStreamResultExtractor,
763
766
  }`;
764
767
  function ie(o) {
765
- C(o, Ue, Qe);
768
+ C(o, Qe, Je);
766
769
  }
767
770
  function se(o, e, t = []) {
768
771
  return e.addClass({
@@ -790,11 +793,11 @@ function ae(o, e) {
790
793
  ]
791
794
  });
792
795
  }
793
- const Ve = "@ahoo-wang/fetcher-eventstream";
796
+ const Ke = "@ahoo-wang/fetcher-eventstream";
794
797
  function ce(o) {
795
- C(o, Ve, ["JsonEventStreamResultExtractor", "type JsonServerSentEventStream"]);
798
+ C(o, Ke, ["JsonEventStreamResultExtractor", "type JsonServerSentEventStream"]);
796
799
  }
797
- function Ke(o) {
800
+ function He(o) {
798
801
  let e = 0, t = 0;
799
802
  return o.commands.forEach((n) => {
800
803
  n.path.startsWith(W.TENANT) && (e += 1), n.path.startsWith(W.OWNER) && (t += 1);
@@ -804,20 +807,20 @@ function ge(o, e, t, n) {
804
807
  const r = `${t.contextAlias}/${t.aggregateName}/${n}.ts`;
805
808
  return re(o, e, r);
806
809
  }
807
- function He(o, e) {
810
+ function Ye(o, e) {
808
811
  return `${x(o.aggregateName)}${e}`;
809
812
  }
810
- function b(o) {
813
+ function q(o) {
811
814
  return o === "delete" ? "del" : o;
812
815
  }
813
- const Ye = "x-fetcher-method";
814
- function Xe(o, e) {
815
- const t = o[Ye];
816
+ const Xe = "x-fetcher-method";
817
+ function Ze(o, e) {
818
+ const t = o[Xe];
816
819
  if (t)
817
820
  return t;
818
821
  if (!o.operationId)
819
822
  return;
820
- const n = q(o.operationId);
823
+ const n = N(o.operationId);
821
824
  for (let r = n.length - 1; r >= 0; r--) {
822
825
  const i = h(n.slice(r));
823
826
  if (!e(i))
@@ -825,7 +828,7 @@ function Xe(o, e) {
825
828
  }
826
829
  return h(n);
827
830
  }
828
- class Ze {
831
+ class et {
829
832
  /**
830
833
  * Creates a new ApiClientGenerator instance.
831
834
  * @param context - The generation context containing OpenAPI spec and configuration
@@ -834,7 +837,7 @@ class Ze {
834
837
  this.context = e, this.apiMetadataCtorInitializer = this.context.currentContextAlias ? `{basePath:'${this.context.currentContextAlias}'}` : void 0;
835
838
  }
836
839
  defaultParameterRequestType = "ParameterRequest";
837
- defaultReturnType = Je;
840
+ defaultReturnType = Ve;
838
841
  apiMetadataCtorInitializer;
839
842
  /**
840
843
  * Generates API client classes for all valid tags in the OpenAPI specification.
@@ -911,7 +914,7 @@ class Ze {
911
914
  * @returns A unique camelCase method name
912
915
  */
913
916
  getMethodName(e, t) {
914
- const n = Xe(t, (r) => e.getMethod(r) !== void 0);
917
+ const n = Ze(t, (r) => e.getMethod(r) !== void 0);
915
918
  if (!n)
916
919
  throw new Error(`Unable to resolve method name for apiClientClass:${e.getName()}.`);
917
920
  return n;
@@ -930,7 +933,7 @@ class Ze {
930
933
  let n;
931
934
  if (g(t.requestBody) ? (this.context.logger.info(
932
935
  `Extracting request body from reference for operation: ${t.operationId}`
933
- ), n = K(
936
+ ), n = V(
934
937
  t.requestBody,
935
938
  this.context.openAPI.components
936
939
  )) : n = t.requestBody, !n)
@@ -966,7 +969,7 @@ class Ze {
966
969
  * @returns Array of parameter declarations
967
970
  */
968
971
  resolveParameters(e, t, n) {
969
- const r = Te(n, this.context.openAPI.components).filter((a) => !this.context.isIgnoreApiClientPathParameters(
972
+ const r = Ee(n, this.context.openAPI.components).filter((a) => !this.context.isIgnoreApiClientPathParameters(
970
973
  e.name,
971
974
  a.name
972
975
  ));
@@ -1053,24 +1056,24 @@ class Ze {
1053
1056
  return this.context.logger.info(
1054
1057
  `No OK response found for operation ${t.operationId}, using default return type: ${this.defaultReturnType.type}`
1055
1058
  ), this.defaultReturnType;
1056
- const r = Y(n) || xe(n);
1059
+ const r = Y(n) || Ae(n);
1057
1060
  if (r) {
1058
1061
  const s = this.resolveSchemaReturnType(e, r);
1059
1062
  return this.context.logger.info(
1060
1063
  `Resolved JSON/wildcard response return type for operation ${t.operationId}: ${s}`
1061
1064
  ), {
1062
1065
  type: s,
1063
- metadata: s === J.type ? J.metadata : void 0
1066
+ metadata: s === Q.type ? Q.metadata : void 0
1064
1067
  };
1065
1068
  }
1066
- const i = ye(n);
1069
+ const i = xe(n);
1067
1070
  if (i) {
1068
1071
  if (g(i)) {
1069
1072
  const a = S(
1070
1073
  i,
1071
1074
  this.context.openAPI.components
1072
1075
  );
1073
- if (N(a) && g(a.items)) {
1076
+ if (D(a) && g(a.items)) {
1074
1077
  const c = y(a.items);
1075
1078
  this.context.logger.info(
1076
1079
  `Adding import for event stream model: ${c.name} from ${c.path}`
@@ -1080,14 +1083,14 @@ class Ze {
1080
1083
  `Resolved event stream return type for operation ${t.operationId}: ${l}`
1081
1084
  ), {
1082
1085
  type: l,
1083
- metadata: M
1086
+ metadata: b
1084
1087
  };
1085
1088
  }
1086
1089
  }
1087
1090
  const s = "Promise<JsonServerSentEventStream<any>>";
1088
1091
  return this.context.logger.info(
1089
1092
  `Resolved generic event stream return type for operation ${t.operationId}: ${s}`
1090
- ), { type: s, metadata: M };
1093
+ ), { type: s, metadata: b };
1091
1094
  }
1092
1095
  return this.context.logger.info(
1093
1096
  `Using default return type for operation ${t.operationId}: ${this.defaultReturnType.type}`
@@ -1111,10 +1114,10 @@ class Ze {
1111
1114
  t,
1112
1115
  r.operation
1113
1116
  ), a = this.resolveReturnType(t, r.operation), c = a.metadata ? {
1114
- name: b(r.method),
1117
+ name: q(r.method),
1115
1118
  arguments: [`'${r.path}'`, a.metadata]
1116
1119
  } : {
1117
- name: b(r.method),
1120
+ name: q(r.method),
1118
1121
  arguments: [`'${r.path}'`]
1119
1122
  };
1120
1123
  this.context.logger.info(
@@ -1148,7 +1151,7 @@ class Ze {
1148
1151
  const t = /* @__PURE__ */ new Map();
1149
1152
  let n = 0;
1150
1153
  for (const [r, i] of Object.entries(this.context.openAPI.paths)) {
1151
- const s = D(i).filter(
1154
+ const s = M(i).filter(
1152
1155
  (a) => {
1153
1156
  if (!a.operation.operationId)
1154
1157
  return !1;
@@ -1186,7 +1189,7 @@ class Ze {
1186
1189
  );
1187
1190
  const e = /* @__PURE__ */ new Map(), t = this.context.openAPI.tags?.length || 0;
1188
1191
  for (const r of Object.values(this.context.openAPI.paths))
1189
- D(r).forEach((i) => {
1192
+ M(r).forEach((i) => {
1190
1193
  i.operation.tags?.forEach((s) => {
1191
1194
  !this.shouldIgnoreTag(s) && !e.has(s) && e.set(s, {
1192
1195
  name: s,
@@ -1211,7 +1214,7 @@ class Ze {
1211
1214
  return !1;
1212
1215
  }
1213
1216
  }
1214
- class et {
1217
+ class tt {
1215
1218
  /**
1216
1219
  * Creates a new CommandClientGenerator instance.
1217
1220
  * @param context - The generation context containing OpenAPI spec and project details
@@ -1320,9 +1323,9 @@ class et {
1320
1323
  let r = "CommandClient", i = [], s = "Promise<CommandResult>";
1321
1324
  n && (r = "Stream" + r, i = [
1322
1325
  "''",
1323
- M
1326
+ b
1324
1327
  ], s = "Promise<CommandResultEventStream>");
1325
- const a = He(
1328
+ const a = Ye(
1326
1329
  t.aggregate,
1327
1330
  r
1328
1331
  ), c = se(a, e, i);
@@ -1358,7 +1361,7 @@ class et {
1358
1361
  `Adding command request parameter: commandRequest (type: CommandRequest<${r.name}>)`
1359
1362
  ), i.push({
1360
1363
  name: "commandRequest",
1361
- hasQuestionToken: Ie(n.schema.schema),
1364
+ hasQuestionToken: Te(n.schema.schema),
1362
1365
  type: `CommandRequest<${r.name}>`,
1363
1366
  decorators: [
1364
1367
  {
@@ -1390,7 +1393,7 @@ class et {
1390
1393
  name: h(r.name),
1391
1394
  decorators: [
1392
1395
  {
1393
- name: b(r.method),
1396
+ name: q(r.method),
1394
1397
  arguments: [`${this.getEndpointPath(r)}`]
1395
1398
  }
1396
1399
  ],
@@ -1407,7 +1410,7 @@ class et {
1407
1410
  );
1408
1411
  }
1409
1412
  }
1410
- class tt {
1413
+ class nt {
1411
1414
  /**
1412
1415
  * Creates a new QueryClientGenerator instance.
1413
1416
  * @param context - The generation context containing OpenAPI spec and project details
@@ -1484,7 +1487,7 @@ class tt {
1484
1487
  initializer: `{
1485
1488
  contextAlias: '${e.aggregate.contextAlias}',
1486
1489
  aggregateName: '${e.aggregate.aggregateName}',
1487
- resourceAttribution: ${Ke(e)},
1490
+ resourceAttribution: ${He(e)},
1488
1491
  }`
1489
1492
  }
1490
1493
  ],
@@ -1526,13 +1529,13 @@ class tt {
1526
1529
  );
1527
1530
  }
1528
1531
  }
1529
- class nt {
1532
+ class ot {
1530
1533
  /**
1531
1534
  * Creates a new ClientGenerator instance.
1532
1535
  * @param context - The generation context containing OpenAPI spec and project details
1533
1536
  */
1534
1537
  constructor(e) {
1535
- this.context = e, this.queryClientGenerator = new tt(e), this.commandClientGenerator = new et(e), this.apiClientGenerator = new Ze(e);
1538
+ this.context = e, this.queryClientGenerator = new nt(e), this.commandClientGenerator = new tt(e), this.apiClientGenerator = new et(e);
1536
1539
  }
1537
1540
  queryClientGenerator;
1538
1541
  commandClientGenerator;
@@ -1571,7 +1574,7 @@ class nt {
1571
1574
  );
1572
1575
  }
1573
1576
  }
1574
- class ot {
1577
+ class rt {
1575
1578
  /** The ts-morph project instance used for code generation */
1576
1579
  project;
1577
1580
  /** The OpenAPI specification object */
@@ -1598,8 +1601,8 @@ class ot {
1598
1601
  return this.defaultIgnorePathParameters.includes(t);
1599
1602
  }
1600
1603
  }
1601
- const rt = "./fetcher-generator.config.json";
1602
- class lt {
1604
+ const it = "./fetcher-generator.config.json";
1605
+ class pt {
1603
1606
  /**
1604
1607
  * Creates a new CodeGenerator instance.
1605
1608
  * @param options - Configuration options for code generation
@@ -1617,20 +1620,20 @@ class lt {
1617
1620
  this.options.logger.info(
1618
1621
  "Starting code generation from OpenAPI specification"
1619
1622
  ), this.options.logger.info(`Input path: ${this.options.inputPath}`), this.options.logger.info(`Output directory: ${this.options.outputDir}`), this.options.logger.info("Parsing OpenAPI specification");
1620
- const e = await Re(this.options.inputPath);
1623
+ const e = await we(this.options.inputPath);
1621
1624
  this.options.logger.info("OpenAPI specification parsed successfully"), this.options.logger.info("Resolving bounded context aggregates");
1622
- const n = new Le(e).resolve();
1625
+ const n = new ke(e).resolve();
1623
1626
  this.options.logger.info(
1624
1627
  `Resolved ${n.size} bounded context aggregates`
1625
1628
  );
1626
- const r = this.options.configPath ?? rt;
1629
+ const r = this.options.configPath ?? it;
1627
1630
  let i = {};
1628
1631
  try {
1629
- this.options.logger.info("Parsing configuration file:", r), i = await we(r);
1632
+ this.options.logger.info("Parsing configuration file:", r), i = await Oe(r);
1630
1633
  } catch (u) {
1631
1634
  this.options.logger.info("Configuration file parsing failed ", u);
1632
1635
  }
1633
- const s = new ot({
1636
+ const s = new rt({
1634
1637
  openAPI: e,
1635
1638
  project: this.project,
1636
1639
  outputDir: this.options.outputDir,
@@ -1638,7 +1641,7 @@ class lt {
1638
1641
  logger: this.options.logger,
1639
1642
  config: i
1640
1643
  });
1641
- this.options.logger.info("Generating models"), new ke(s).generate(), this.options.logger.info("Models generated successfully"), this.options.logger.info("Generating clients"), new nt(s).generate(), this.options.logger.info("Clients generated successfully"), this.options.logger.info("Generating index files"), this.generateIndex(), this.options.logger.info("Index files generated successfully"), this.options.logger.info("Optimizing source files"), this.optimizeSourceFiles(), this.options.logger.info("Source files optimized successfully"), this.options.logger.info("Saving project to disk"), await this.project.save(), this.options.logger.info("Code generation completed successfully");
1644
+ this.options.logger.info("Generating models"), new Ue(s).generate(), this.options.logger.info("Models generated successfully"), this.options.logger.info("Generating clients"), new ot(s).generate(), this.options.logger.info("Clients generated successfully"), this.options.logger.info("Generating index files"), this.generateIndex(), this.options.logger.info("Index files generated successfully"), this.options.logger.info("Optimizing source files"), this.optimizeSourceFiles(), this.options.logger.info("Source files optimized successfully"), this.options.logger.info("Saving project to disk"), await this.project.save(), this.options.logger.info("Code generation completed successfully");
1642
1645
  }
1643
1646
  /**
1644
1647
  * Generates index.ts files for all subdirectories in the output directory.
@@ -1718,7 +1721,7 @@ class lt {
1718
1721
  }
1719
1722
  }
1720
1723
  export {
1721
- lt as CodeGenerator,
1722
- rt as DEFAULT_CONFIG_PATH
1724
+ pt as CodeGenerator,
1725
+ it as DEFAULT_CONFIG_PATH
1723
1726
  };
1724
1727
  //# sourceMappingURL=index.js.map