@ahoo-wang/fetcher-generator 2.8.0 → 2.8.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/dist/index.js CHANGED
@@ -1,117 +1,117 @@
1
- import { Scope as ce, VariableDeclarationKind as v, Project as ge } from "ts-morph";
2
- import { ContentTypeValues as S, combineURLs as w } from "@ahoo-wang/fetcher";
3
- import { ResourceAttributionPathSpec as F } from "@ahoo-wang/fetcher-wow";
4
- import { parse as k } from "yaml";
5
- import { readFile as le } from "fs";
6
- import { join as pe, relative as ue } from "path";
7
- function T(r) {
8
- return r.$ref.split("/").pop();
9
- }
10
- function R(r, e) {
11
- const t = T(r);
1
+ import { Scope as ue, VariableDeclarationKind as O, Project as le } from "ts-morph";
2
+ import { ContentTypeValues as S, combineURLs as v } from "@ahoo-wang/fetcher";
3
+ import { ResourceAttributionPathSpec as _ } from "@ahoo-wang/fetcher-wow";
4
+ import { parse as Q } from "yaml";
5
+ import { readFile as pe } from "fs";
6
+ import { join as me, relative as de } from "path";
7
+ function $(o) {
8
+ return o.$ref.split("/").pop();
9
+ }
10
+ function E(o, e) {
11
+ const t = $(o);
12
12
  return e.schemas?.[t];
13
13
  }
14
- function L(r, e) {
15
- const t = T(r);
14
+ function U(o, e) {
15
+ const t = $(o);
16
16
  return e.requestBodies?.[t];
17
17
  }
18
- function Q(r, e) {
19
- const t = T(r);
18
+ function J(o, e) {
19
+ const t = $(o);
20
20
  return e.parameters?.[t];
21
21
  }
22
- function I(r, e) {
22
+ function I(o, e) {
23
23
  return {
24
- key: T(r),
25
- schema: R(r, e)
24
+ key: $(o),
25
+ schema: E(o, e)
26
26
  };
27
27
  }
28
- const _ = /[-_\s.]+/;
29
- function U(r) {
30
- return Array.isArray(r) ? r.flatMap((e) => G(e.split(_))) : G(r.split(_));
28
+ const G = /[-_\s.]+/;
29
+ function V(o) {
30
+ return Array.isArray(o) ? o.flatMap((e) => W(e.split(G))) : W(o.split(G));
31
31
  }
32
- function G(r) {
33
- return r.flatMap((e) => {
32
+ function W(o) {
33
+ return o.flatMap((e) => {
34
34
  if (e.length === 0)
35
35
  return [];
36
36
  const t = [];
37
37
  let n = "";
38
- for (let o = 0; o < e.length; o++) {
39
- const s = e[o], i = /[A-Z]/.test(s), a = o > 0 && /[a-z]/.test(e[o - 1]);
40
- i && a && n ? (t.push(n), n = s) : n += s;
38
+ for (let r = 0; r < e.length; r++) {
39
+ const i = e[r], s = /[A-Z]/.test(i), a = r > 0 && /[a-z]/.test(e[r - 1]);
40
+ s && a && n ? (t.push(n), n = i) : n += i;
41
41
  }
42
42
  return n && t.push(n), t;
43
43
  });
44
44
  }
45
- function A(r) {
46
- return r === "" || r.length === 0 ? "" : U(r).filter((t) => t.length > 0).map((t) => {
47
- const n = t.charAt(0), o = t.slice(1);
48
- return (/[a-zA-Z]/.test(n) ? n.toUpperCase() : n) + o.toLowerCase();
45
+ function x(o) {
46
+ return o === "" || o.length === 0 ? "" : V(o).filter((t) => t.length > 0).map((t) => {
47
+ const n = t.charAt(0), r = t.slice(1);
48
+ return (/[a-zA-Z]/.test(n) ? n.toUpperCase() : n) + r.toLowerCase();
49
49
  }).join("");
50
50
  }
51
- function h(r) {
52
- const e = A(r);
51
+ function h(o) {
52
+ const e = x(o);
53
53
  return e.charAt(0).toLowerCase() + e.slice(1);
54
54
  }
55
- function me(r) {
56
- return r === "" || Array.isArray(r) && r.length === 0 ? "" : U(r).filter((t) => t.length > 0).map((t) => t.toUpperCase()).join("_");
55
+ function fe(o) {
56
+ return o === "" || Array.isArray(o) && o.length === 0 ? "" : V(o).filter((t) => t.length > 0).map((t) => t.toUpperCase()).join("_");
57
57
  }
58
- function g(r) {
59
- return !!(r && typeof r == "object" && "$ref" in r);
58
+ function g(o) {
59
+ return !!(o && typeof o == "object" && "$ref" in o);
60
60
  }
61
- function b(r, e) {
61
+ function M(o, e) {
62
62
  if (e && !g(e) && e.content)
63
- return e.content[r]?.schema;
63
+ return e.content[o]?.schema;
64
64
  }
65
- function J(r) {
66
- return b(S.APPLICATION_JSON, r);
65
+ function K(o) {
66
+ return M(S.APPLICATION_JSON, o);
67
67
  }
68
- function de(r) {
69
- return b(S.TEXT_EVENT_STREAM, r);
68
+ function he(o) {
69
+ return M(S.TEXT_EVENT_STREAM, o);
70
70
  }
71
- function fe(r) {
72
- return b("*/*", r);
71
+ function ye(o) {
72
+ return M("*/*", o);
73
73
  }
74
- const he = [
74
+ const xe = [
75
75
  "string",
76
76
  "number",
77
77
  "integer",
78
78
  "boolean",
79
79
  "null"
80
80
  ];
81
- function q(r) {
82
- return Array.isArray(r) ? !0 : he.includes(r);
81
+ function q(o) {
82
+ return Array.isArray(o) ? !0 : xe.includes(o);
83
83
  }
84
- function O(r) {
85
- return r.type === "array";
84
+ function N(o) {
85
+ return o.type === "array";
86
86
  }
87
- function ye(r) {
88
- return Array.isArray(r.enum) && r.enum.length > 0;
87
+ function Ae(o) {
88
+ return Array.isArray(o.enum) && o.enum.length > 0;
89
89
  }
90
- function V(r) {
91
- return Array.isArray(r.anyOf) && r.anyOf.length > 0;
90
+ function H(o) {
91
+ return Array.isArray(o.anyOf) && o.anyOf.length > 0;
92
92
  }
93
- function K(r) {
94
- return Array.isArray(r.oneOf) && r.oneOf.length > 0;
93
+ function Y(o) {
94
+ return Array.isArray(o.oneOf) && o.oneOf.length > 0;
95
95
  }
96
- function xe(r) {
97
- return V(r) || K(r);
96
+ function Ce(o) {
97
+ return H(o) || Y(o);
98
98
  }
99
- function Ae(r) {
100
- return Array.isArray(r.allOf) && r.allOf.length > 0;
99
+ function Pe(o) {
100
+ return Array.isArray(o.allOf) && o.allOf.length > 0;
101
101
  }
102
- function W(r) {
103
- return V(r) || K(r) || Ae(r);
102
+ function z(o) {
103
+ return H(o) || Y(o) || Pe(o);
104
104
  }
105
- function z(r) {
106
- return r.includes("|") || r.includes("&") ? `(${r})[]` : `${r}[]`;
105
+ function L(o) {
106
+ return o.includes("|") || o.includes("&") ? `(${o})[]` : `${o}[]`;
107
107
  }
108
- function Ce(r) {
109
- return r.type !== "object" ? !1 : r.properties ? Object.keys(r.properties).length === 0 : !0;
108
+ function $e(o) {
109
+ return o.type !== "object" ? !1 : o.properties ? Object.keys(o.properties).length === 0 : !0;
110
110
  }
111
- function C(r) {
112
- if (Array.isArray(r))
113
- return r.map((e) => C(e)).join(" | ");
114
- switch (r) {
111
+ function A(o) {
112
+ if (Array.isArray(o))
113
+ return o.map((e) => A(e)).join(" | ");
114
+ switch (o) {
115
115
  case "string":
116
116
  return "string";
117
117
  case "number":
@@ -125,69 +125,69 @@ function C(r) {
125
125
  return "any";
126
126
  }
127
127
  }
128
- function H(r) {
128
+ function X(o) {
129
129
  return [
130
- { method: "get", operation: r.get },
131
- { method: "put", operation: r.put },
132
- { method: "post", operation: r.post },
133
- { method: "delete", operation: r.delete },
134
- { method: "options", operation: r.options },
135
- { method: "head", operation: r.head },
136
- { method: "patch", operation: r.patch },
137
- { method: "trace", operation: r.trace }
130
+ { method: "get", operation: o.get },
131
+ { method: "put", operation: o.put },
132
+ { method: "post", operation: o.post },
133
+ { method: "delete", operation: o.delete },
134
+ { method: "options", operation: o.options },
135
+ { method: "head", operation: o.head },
136
+ { method: "patch", operation: o.patch },
137
+ { method: "trace", operation: o.trace }
138
138
  ].filter(({ operation: e }) => e !== void 0);
139
139
  }
140
- function M(r) {
141
- return r.responses[200];
140
+ function j(o) {
141
+ return o.responses[200];
142
142
  }
143
- function B(r) {
144
- const e = M(r);
145
- return J(e);
143
+ function B(o) {
144
+ const e = j(o);
145
+ return K(e);
146
146
  }
147
- function Pe(r, e) {
148
- return r.parameters ? r.parameters.map((t) => g(t) ? Q(t, e) : t).filter((t) => t.in === "path") : [];
147
+ function Ie(o, e) {
148
+ return o.parameters ? o.parameters.map((t) => g(t) ? J(t, e) : t).filter((t) => t.in === "path") : [];
149
149
  }
150
- const $e = "string";
151
- function Y(r) {
152
- return !r.schema || g(r.schema) || !r.schema.type || !q(r.schema.type) ? $e : C(r.schema.type);
150
+ const Te = "string";
151
+ function Z(o) {
152
+ return !o.schema || g(o.schema) || !o.schema.type || !q(o.schema.type) ? Te : A(o.schema.type);
153
153
  }
154
- function X(r) {
155
- return r.startsWith("http://") || r.startsWith("https://") ? Te(r) : Ie(r);
154
+ function ee(o) {
155
+ return o.startsWith("http://") || o.startsWith("https://") ? Se(o) : ve(o);
156
156
  }
157
- async function Te(r) {
158
- return await (await fetch(r)).text();
157
+ async function Se(o) {
158
+ return await (await fetch(o)).text();
159
159
  }
160
- function Ie(r) {
160
+ function ve(o) {
161
161
  return new Promise((e, t) => {
162
- le(r, "utf-8", (n, o) => {
163
- n ? t(n) : e(o);
162
+ pe(o, "utf-8", (n, r) => {
163
+ n ? t(n) : e(r);
164
164
  });
165
165
  });
166
166
  }
167
- async function Ee(r) {
168
- const e = await X(r);
169
- switch (Z(e)) {
167
+ async function Ee(o) {
168
+ const e = await ee(o);
169
+ switch (te(e)) {
170
170
  case "json":
171
171
  return JSON.parse(e);
172
172
  case "yaml":
173
- return k(e);
173
+ return Q(e);
174
174
  default:
175
- throw new Error(`Unsupported file format: ${r}`);
175
+ throw new Error(`Unsupported file format: ${o}`);
176
176
  }
177
177
  }
178
- async function Se(r) {
179
- const e = await X(r);
180
- switch (Z(e)) {
178
+ async function we(o) {
179
+ const e = await ee(o);
180
+ switch (te(e)) {
181
181
  case "json":
182
182
  return JSON.parse(e);
183
183
  case "yaml":
184
- return k(e);
184
+ return Q(e);
185
185
  default:
186
- throw new Error(`Unsupported file format: ${r}`);
186
+ throw new Error(`Unsupported file format: ${o}`);
187
187
  }
188
188
  }
189
- function Z(r) {
190
- const e = r.trimStart();
189
+ function te(o) {
190
+ const e = o.trimStart();
191
191
  if (e.startsWith("{") || e.startsWith("["))
192
192
  return "json";
193
193
  if (e.startsWith("-") || e.startsWith("%YAML"))
@@ -200,67 +200,100 @@ function Z(r) {
200
200
  }
201
201
  throw new Error("Unable to infer file format");
202
202
  }
203
- const ee = "types.ts", we = "@";
204
- function Re(r) {
205
- return w(r.path, ee);
203
+ const ne = "types.ts", Re = "@";
204
+ function Oe(o) {
205
+ return v(o.path, ne);
206
206
  }
207
- function te(r, e, t) {
208
- const n = w(e, t), o = r.getSourceFile(n);
209
- return o || r.createSourceFile(n, "", {
207
+ function oe(o, e, t) {
208
+ const n = v(e, t), r = o.getSourceFile(n);
209
+ return r || o.createSourceFile(n, "", {
210
210
  overwrite: !0
211
211
  });
212
212
  }
213
- function P(r, e, t) {
214
- let n = r.getImportDeclaration(
215
- (o) => o.getModuleSpecifierValue() === e
213
+ function C(o, e, t) {
214
+ let n = o.getImportDeclaration(
215
+ (r) => r.getModuleSpecifierValue() === e
216
216
  );
217
- n || (n = r.addImportDeclaration({
217
+ n || (n = o.addImportDeclaration({
218
218
  moduleSpecifier: e
219
- })), t.forEach((o) => {
219
+ })), t.forEach((r) => {
220
220
  n.getNamedImports().some(
221
- (i) => i.getName() === o
222
- ) || n.addNamedImport(o);
221
+ (s) => s.getName() === r
222
+ ) || n.addNamedImport(r);
223
223
  });
224
224
  }
225
- function f(r, e, t) {
226
- if (t.path.startsWith(we)) {
227
- P(r, t.path, [t.name]);
225
+ function f(o, e, t) {
226
+ if (t.path.startsWith(Re)) {
227
+ C(o, t.path, [t.name]);
228
228
  return;
229
229
  }
230
- const n = r.getDirectoryPath(), o = pe(e, t.path, ee);
231
- let s = ue(n, o);
232
- s = s.replace(/\.ts$/, ""), s.startsWith(".") || (s = "./" + s), P(r, s, [t.name]);
230
+ const n = o.getDirectoryPath(), r = me(e, t.path, ne);
231
+ let i = de(n, r);
232
+ i = i.replace(/\.ts$/, ""), i.startsWith(".") || (i = "./" + i), C(o, i, [t.name]);
233
233
  }
234
- function E(r, e, t, n) {
235
- r.path !== n.path && f(e, t, n);
234
+ function T(o, e, t, n) {
235
+ o.path !== n.path && f(e, t, n);
236
236
  }
237
- function ve(r, e) {
238
- const t = [r, e].filter(
239
- (n) => n !== void 0 && n.length > 0
237
+ function Ne(o) {
238
+ if (!Array.isArray(o))
239
+ return;
240
+ const e = o.filter(
241
+ (t) => typeof t == "string" && t.length > 0
240
242
  );
241
- return t.length > 0 ? t.join(`
243
+ return e.length > 0 ? e.join(`
242
244
  `) : void 0;
243
245
  }
244
- function x(r, e, t) {
245
- const n = ve(e, t);
246
- n && r.addJsDoc({
247
- description: n
248
- });
246
+ function w(o, e) {
247
+ const t = Ne(e);
248
+ t && o.addJsDoc(t);
249
+ }
250
+ function R(o, e) {
251
+ const t = [
252
+ e.title,
253
+ e.description
254
+ ];
255
+ e.format && t.push(`- format: ${e.format}`), k(t, e, "default"), k(t, e, "example"), De(t, e), be(t, e), Me(t, e), w(o, t);
256
+ }
257
+ function k(o, e, t) {
258
+ const n = e[t];
259
+ if (n) {
260
+ if (typeof n != "object") {
261
+ o.push(`- ${t}: \`${n}\``);
262
+ return;
263
+ }
264
+ o.push(`- ${t}: `), o.push("```json"), o.push(JSON.stringify(n)), o.push("```");
265
+ }
249
266
  }
250
- function Oe(r) {
251
- const e = r.split(".");
267
+ function De(o, e) {
268
+ const t = ["- Numeric Constraints"];
269
+ 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
+ ` - exclusiveMinimum: ${e.exclusiveMinimum}`
271
+ ), e.exclusiveMaximum !== void 0 && t.push(
272
+ ` - exclusiveMaximum: ${e.exclusiveMaximum}`
273
+ ), e.multipleOf !== void 0 && t.push(` - multipleOf: ${e.multipleOf}`), t.length !== 1 && o.push(...t);
274
+ }
275
+ function be(o, e) {
276
+ const t = ["- String Constraints"];
277
+ 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
+ }
279
+ function Me(o, e) {
280
+ const t = ["- Array Constraints"];
281
+ 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
+ }
283
+ function qe(o) {
284
+ const e = o.split(".");
252
285
  return e.length != 2 || e[0].length === 0 || e[1].length === 0 ? null : e;
253
286
  }
254
- function Ne(r) {
255
- const e = Oe(r.name);
287
+ function je(o) {
288
+ const e = qe(o.name);
256
289
  return e ? {
257
- tag: r,
290
+ tag: o,
258
291
  contextAlias: e[0],
259
292
  aggregateName: e[1]
260
293
  } : null;
261
294
  }
262
- function De(r) {
263
- const e = r?.map((n) => Ne(n)).filter((n) => n !== null);
295
+ function Fe(o) {
296
+ const e = o?.map((n) => je(n)).filter((n) => n !== null);
264
297
  if (!e)
265
298
  return /* @__PURE__ */ new Map();
266
299
  const t = /* @__PURE__ */ new Map();
@@ -272,20 +305,20 @@ function De(r) {
272
305
  });
273
306
  }), t;
274
307
  }
275
- function be(r) {
276
- if (!r)
308
+ function _e(o) {
309
+ if (!o)
277
310
  return null;
278
- const e = r.split(".");
311
+ const e = o.split(".");
279
312
  return e.length != 3 ? null : e[2];
280
313
  }
281
- const qe = "#/components/responses/wow.CommandOk", Me = "#/components/parameters/wow.id";
282
- class je {
314
+ const Ge = "#/components/responses/wow.CommandOk", We = "#/components/parameters/wow.id";
315
+ class ze {
283
316
  /**
284
317
  * Creates a new AggregateResolver instance.
285
318
  * @param openAPI - The OpenAPI specification to resolve aggregates from
286
319
  */
287
320
  constructor(e) {
288
- this.openAPI = e, this.aggregates = De(e.tags), this.build();
321
+ this.openAPI = e, this.aggregates = Fe(e.tags), this.build();
289
322
  }
290
323
  aggregates;
291
324
  /**
@@ -294,9 +327,9 @@ class je {
294
327
  */
295
328
  build() {
296
329
  for (const [e, t] of Object.entries(this.openAPI.paths)) {
297
- const n = H(t);
298
- for (const o of n)
299
- this.commands(e, o), this.state(o.operation), this.events(o.operation), this.fields(o.operation);
330
+ const n = X(t);
331
+ for (const r of n)
332
+ this.commands(e, r), this.state(r.operation), this.events(r.operation), this.fields(r.operation);
300
333
  }
301
334
  }
302
335
  /**
@@ -309,8 +342,8 @@ class je {
309
342
  if (!t.state || !t.fields)
310
343
  continue;
311
344
  const n = t.aggregate.contextAlias;
312
- let o = e.get(n);
313
- o || (o = /* @__PURE__ */ new Set(), e.set(n, o)), o.add(t);
345
+ let r = e.get(n);
346
+ r || (r = /* @__PURE__ */ new Set(), e.set(n, r)), r.add(t);
314
347
  }
315
348
  return e;
316
349
  }
@@ -323,40 +356,40 @@ class je {
323
356
  const n = t.operation;
324
357
  if (n.operationId === "wow.command.send")
325
358
  return;
326
- const o = be(n.operationId);
327
- if (!o)
359
+ const r = _e(n.operationId);
360
+ if (!r)
328
361
  return;
329
- const s = M(n);
330
- if (!s || !g(s) || s.$ref !== qe || !n.requestBody)
362
+ const i = j(n);
363
+ if (!i || !g(i) || i.$ref !== Ge || !n.requestBody)
331
364
  return;
332
- const i = n.parameters ?? [], a = i.filter((m) => g(m) && m.$ref === Me).at(0), c = i.filter(
365
+ const s = n.parameters ?? [], a = s.filter((m) => g(m) && m.$ref === We).at(0), c = s.filter(
333
366
  (m) => !g(m) && m.in === "path"
334
367
  );
335
368
  if (a) {
336
- const m = Q(
369
+ const m = J(
337
370
  a,
338
371
  this.openAPI.components
339
372
  );
340
373
  c.push(m);
341
374
  }
342
- const p = n.requestBody.content[S.APPLICATION_JSON].schema, u = I(
343
- p,
375
+ const l = n.requestBody.content[S.APPLICATION_JSON].schema, p = I(
376
+ l,
344
377
  this.openAPI.components
345
378
  );
346
- u.schema.title = u.schema.title || n.summary, u.schema.description = u.schema.description || n.description;
347
- const ae = {
348
- name: o,
379
+ p.schema.title = p.schema.title || n.summary, p.schema.description = p.schema.description || n.description;
380
+ const ge = {
381
+ name: r,
349
382
  method: t.method,
350
383
  path: e,
351
384
  pathParameters: c,
352
385
  summary: n.summary,
353
386
  description: n.description,
354
- schema: u,
387
+ schema: p,
355
388
  operation: n
356
389
  };
357
390
  n.tags?.forEach((m) => {
358
- const j = this.aggregates.get(m);
359
- j && j.commands.set(o, ae);
391
+ const F = this.aggregates.get(m);
392
+ F && F.commands.set(r, ge);
360
393
  });
361
394
  }
362
395
  /**
@@ -373,9 +406,9 @@ class je {
373
406
  t,
374
407
  this.openAPI.components
375
408
  );
376
- e.tags?.forEach((o) => {
377
- const s = this.aggregates.get(o);
378
- s && (s.state = n);
409
+ e.tags?.forEach((r) => {
410
+ const i = this.aggregates.get(r);
411
+ i && (i.state = n);
379
412
  });
380
413
  }
381
414
  /**
@@ -391,23 +424,23 @@ class je {
391
424
  const n = t?.items;
392
425
  if (!g(n))
393
426
  return;
394
- const s = R(
427
+ const i = E(
395
428
  n,
396
429
  this.openAPI.components
397
- ).properties.body.items.anyOf.map((i) => {
398
- const a = i.title, c = i.properties.name.const, l = i.properties.body, p = I(
399
- l,
430
+ ).properties.body.items.anyOf.map((s) => {
431
+ const a = s.title, c = s.properties.name.const, u = s.properties.body, l = I(
432
+ u,
400
433
  this.openAPI.components
401
434
  );
402
- return p.schema.title = p.schema.title || i.title, {
435
+ return l.schema.title = l.schema.title || s.title, {
403
436
  title: a,
404
437
  name: c,
405
- schema: p
438
+ schema: l
406
439
  };
407
440
  });
408
- e.tags?.forEach((i) => {
409
- const a = this.aggregates.get(i);
410
- a && s.forEach((c) => {
441
+ e.tags?.forEach((s) => {
442
+ const a = this.aggregates.get(s);
443
+ a && i.forEach((c) => {
411
444
  a.events.set(c.name, c);
412
445
  });
413
446
  });
@@ -419,20 +452,20 @@ class je {
419
452
  fields(e) {
420
453
  if (!this.openAPI.components || !e.operationId?.endsWith(".snapshot.count"))
421
454
  return;
422
- const n = L(
455
+ const n = U(
423
456
  e.requestBody,
424
457
  this.openAPI.components
425
- ).content[S.APPLICATION_JSON].schema, s = R(
458
+ ).content[S.APPLICATION_JSON].schema, i = E(
426
459
  n,
427
460
  this.openAPI.components
428
- ).properties?.field, i = I(s, this.openAPI.components);
461
+ ).properties?.field, s = I(i, this.openAPI.components);
429
462
  e.tags?.forEach((a) => {
430
463
  const c = this.aggregates.get(a);
431
- c && (c.fields = i);
464
+ c && (c.fields = s);
432
465
  });
433
466
  }
434
467
  }
435
- const $ = "@ahoo-wang/fetcher-wow", Fe = {
468
+ const P = "@ahoo-wang/fetcher-wow", Le = {
436
469
  "wow.command.CommandResult": "CommandResult",
437
470
  "wow.MessageHeaderSqlType": "MessageHeaderSqlType",
438
471
  "wow.api.BindingError": "BindingError",
@@ -461,32 +494,32 @@ const $ = "@ahoo-wang/fetcher-wow", Fe = {
461
494
  "wow.openapi.BatchResult": "BatchResult",
462
495
  "wow.messaging.CompensationTarget": "CompensationTarget"
463
496
  };
464
- function d(r) {
465
- if (!r)
497
+ function d(o) {
498
+ if (!o)
466
499
  return { name: "", path: "/" };
467
- const e = Fe[r];
500
+ const e = Le[o];
468
501
  if (e)
469
- return { name: e, path: $ };
470
- const t = r.split(".");
502
+ return { name: e, path: P };
503
+ const t = o.split(".");
471
504
  let n = -1;
472
505
  for (let c = 0; c < t.length; c++)
473
506
  if (t[c] && /^[A-Z]/.test(t[c])) {
474
507
  n = c;
475
508
  break;
476
509
  }
477
- const o = t.slice(0, n), s = o.length > 0 ? `/${o.join("/")}` : "/", i = t.slice(n);
478
- return { name: A(i), path: s };
510
+ const r = t.slice(0, n), i = r.length > 0 ? `/${r.join("/")}` : "/", s = t.slice(n);
511
+ return { name: x(s), path: i };
479
512
  }
480
- function y(r) {
481
- const e = T(r);
513
+ function y(o) {
514
+ const e = $(o);
482
515
  return d(e);
483
516
  }
484
- class _e {
517
+ class Be {
485
518
  constructor(e) {
486
519
  this.context = e;
487
520
  }
488
521
  getOrCreateSourceFile(e) {
489
- const t = Re(e);
522
+ const t = Oe(e);
490
523
  return this.context.getOrCreateSourceFile(t);
491
524
  }
492
525
  /**
@@ -504,19 +537,19 @@ class _e {
504
537
  return;
505
538
  }
506
539
  const t = this.stateAggregatedTypeNames(), n = this.filterSchemas(e, t);
507
- this.context.logger.progress(`Generating models for ${n.length} schemas`), n.forEach((o, s) => {
540
+ this.context.logger.progress(`Generating models for ${n.length} schemas`), n.forEach((r, i) => {
508
541
  this.context.logger.progressWithCount(
509
- s + 1,
542
+ i + 1,
510
543
  n.length,
511
- `Processing schema: ${o.key}`,
544
+ `Processing schema: ${r.key}`,
512
545
  2
513
- ), this.generateKeyedSchema(o);
546
+ ), this.generateKeyedSchema(r);
514
547
  }), this.context.logger.success("Model generation completed");
515
548
  }
516
549
  filterSchemas(e, t) {
517
- return Object.entries(e).map(([n, o]) => ({
550
+ return Object.entries(e).map(([n, r]) => ({
518
551
  key: n,
519
- schema: o
552
+ schema: r
520
553
  })).filter((n) => !this.isWowSchema(n.key, t));
521
554
  }
522
555
  isWowSchema(e, t) {
@@ -539,9 +572,9 @@ class _e {
539
572
  for (const t of this.context.contextAggregates.values())
540
573
  for (const n of t)
541
574
  this.aggregatedSchemaSuffix.forEach(
542
- (o) => {
543
- const s = d(n.state.key), i = A(s.name) + o;
544
- e.add(i);
575
+ (r) => {
576
+ const i = d(n.state.key), s = x(i.name) + r;
577
+ e.add(s);
545
578
  }
546
579
  );
547
580
  return e;
@@ -561,33 +594,33 @@ class _e {
561
594
  * 4. Type alias processing
562
595
  */
563
596
  generateKeyedSchema({ key: e, schema: t }) {
564
- const n = d(e), o = this.getOrCreateSourceFile(n), s = this.process(n, o, t);
565
- s && x(s, t.title, t.description);
597
+ const n = d(e), r = this.getOrCreateSourceFile(n), i = this.process(n, r, t);
598
+ i && R(i, t);
566
599
  }
567
600
  process(e, t, n) {
568
- if (ye(n))
601
+ if (Ae(n))
569
602
  return t.addEnum({
570
603
  name: e.name,
571
604
  isExported: !0,
572
- members: n.enum.filter((s) => typeof s == "string" && s.length > 0).map((s) => ({
573
- name: me(s),
574
- initializer: `'${s}'`
605
+ members: n.enum.filter((i) => typeof i == "string" && i.length > 0).map((i) => ({
606
+ name: fe(i),
607
+ initializer: `'${i}'`
575
608
  }))
576
609
  });
577
- if (O(n) && g(n.items)) {
578
- const s = y(n.items);
579
- return E(
610
+ if (N(n) && g(n.items)) {
611
+ const i = y(n.items);
612
+ return T(
580
613
  e,
581
614
  t,
582
615
  this.context.outputDir,
583
- s
616
+ i
584
617
  ), t.addTypeAlias({
585
618
  name: e.name,
586
- type: z(s.name),
619
+ type: L(i.name),
587
620
  isExported: !0
588
621
  });
589
622
  }
590
- const o = t.addInterface({
623
+ const r = t.addInterface({
591
624
  name: e.name,
592
625
  isExported: !0
593
626
  });
@@ -595,28 +628,28 @@ class _e {
595
628
  t,
596
629
  e,
597
630
  n,
598
- o
599
- ) : (W(n) && (n.anyOf || n.oneOf || n.allOf).forEach((i) => {
600
- if (g(i)) {
601
- const a = y(i);
602
- E(
631
+ r
632
+ ) : (z(n) && (n.anyOf || n.oneOf || n.allOf).forEach((s) => {
633
+ if (g(s)) {
634
+ const a = y(s);
635
+ T(
603
636
  e,
604
637
  t,
605
638
  this.context.outputDir,
606
639
  a
607
- ), o.addExtends(a.name);
640
+ ), r.addExtends(a.name);
608
641
  return;
609
642
  }
610
643
  this.processInterface(
611
644
  t,
612
645
  e,
613
- i,
614
- o
646
+ s,
647
+ r
615
648
  );
616
- }), o);
649
+ }), r);
617
650
  }
618
651
  processObject(e, t, n) {
619
- const o = e.addInterface({
652
+ const r = e.addInterface({
620
653
  name: t.name,
621
654
  isExported: !0
622
655
  });
@@ -624,87 +657,87 @@ class _e {
624
657
  e,
625
658
  t,
626
659
  n,
627
- o
660
+ r
628
661
  );
629
662
  }
630
- processInterface(e, t, n, o) {
631
- for (const [s, i] of Object.entries(n.properties)) {
663
+ processInterface(e, t, n, r) {
664
+ for (const [i, s] of Object.entries(n.properties)) {
632
665
  const a = this.resolvePropertyType(
633
666
  t,
634
667
  e,
635
- s,
636
- i
668
+ i,
669
+ s
637
670
  );
638
- let c = o.getProperty(s);
639
- c ? c.setType(a) : c = o.addProperty({
640
- name: s,
671
+ let c = r.getProperty(i);
672
+ c ? c.setType(a) : c = r.addProperty({
673
+ name: i,
641
674
  type: a
642
- }), g(i) || x(c, i.title, i.description);
675
+ }), g(s) || R(c, s);
643
676
  }
644
- return o;
677
+ return r;
645
678
  }
646
- resolvePropertyType(e, t, n, o) {
647
- if (g(o)) {
648
- const s = y(o);
649
- return E(
679
+ resolvePropertyType(e, t, n, r) {
680
+ if (g(r)) {
681
+ const i = y(r);
682
+ return T(
650
683
  e,
651
684
  t,
652
685
  this.context.outputDir,
653
- s
654
- ), s.name;
686
+ i
687
+ ), i.name;
655
688
  }
656
- if (o.const)
657
- return `'${o.const}'`;
658
- if (O(o)) {
659
- const s = this.resolvePropertyType(
689
+ if (r.const)
690
+ return `'${r.const}'`;
691
+ if (N(r)) {
692
+ const i = this.resolvePropertyType(
660
693
  e,
661
694
  t,
662
695
  n,
663
- o.items
696
+ r.items
664
697
  );
665
- return z(s);
698
+ return L(i);
666
699
  }
667
- if (o.type && q(o.type))
668
- return C(o.type);
669
- if (W(o))
700
+ if (r.type && q(r.type))
701
+ return A(r.type);
702
+ if (z(r))
670
703
  return this.resolvePropertyCompositionType(
671
704
  e,
672
705
  t,
673
- o
706
+ r
674
707
  );
675
- if (o.type === "object" && o.properties) {
676
- const s = {
708
+ if (r.type === "object" && r.properties) {
709
+ const i = {
677
710
  path: e.path,
678
- name: `${e.name}${A(n)}`
679
- }, i = this.processObject(
711
+ name: `${e.name}${x(n)}`
712
+ }, s = this.processObject(
680
713
  t,
681
- s,
682
- o
714
+ i,
715
+ r
683
716
  );
684
- return x(i, o.title, o.description), s.name;
717
+ return R(s, r), i.name;
685
718
  }
686
719
  return "any";
687
720
  }
688
721
  resolvePropertyCompositionType(e, t, n) {
689
- const o = n.anyOf || n.oneOf || n.allOf, s = /* @__PURE__ */ new Set();
690
- o.forEach((a) => {
722
+ const r = n.anyOf || n.oneOf || n.allOf, i = /* @__PURE__ */ new Set();
723
+ r.forEach((a) => {
691
724
  if (g(a)) {
692
725
  const c = y(a);
693
- E(
726
+ T(
694
727
  e,
695
728
  t,
696
729
  this.context.outputDir,
697
730
  c
698
- ), s.add(c.name);
731
+ ), i.add(c.name);
699
732
  return;
700
733
  }
701
- s.add(C(a.type ?? "string"));
734
+ i.add(A(a.type ?? "string"));
702
735
  });
703
- const i = xe(n) ? "|" : "&";
704
- return Array.from(s).join(i);
736
+ const s = Ce(n) ? "|" : "&";
737
+ return Array.from(i).join(s);
705
738
  }
706
739
  }
707
- const Ge = "@ahoo-wang/fetcher-decorator", We = [
740
+ const ke = "@ahoo-wang/fetcher-decorator", Qe = [
708
741
  "type ApiMetadata",
709
742
  "type ApiMetadataCapable",
710
743
  "type ParameterRequest",
@@ -718,19 +751,19 @@ const Ge = "@ahoo-wang/fetcher-decorator", We = [
718
751
  "attribute",
719
752
  "path",
720
753
  "autoGeneratedError"
721
- ], ze = {
754
+ ], Ue = {
722
755
  type: "Promise<Response>",
723
756
  metadata: "{resultExtractor: ResultExtractors.Response }"
724
- }, N = `{
757
+ }, D = `{
725
758
  headers: { Accept: ContentTypeValues.TEXT_EVENT_STREAM },
726
759
  resultExtractor: JsonEventStreamResultExtractor,
727
760
  }`;
728
- function ne(r) {
729
- P(r, Ge, We);
761
+ function re(o) {
762
+ C(o, ke, Qe);
730
763
  }
731
- function oe(r, e, t = []) {
764
+ function ie(o, e, t = []) {
732
765
  return e.addClass({
733
- name: r,
766
+ name: o,
734
767
  isExported: !0,
735
768
  decorators: [
736
769
  {
@@ -740,41 +773,41 @@ function oe(r, e, t = []) {
740
773
  ]
741
774
  });
742
775
  }
743
- function re(r, e) {
744
- r.addImplements("ApiMetadataCapable"), r.addConstructor({
776
+ function se(o, e) {
777
+ o.addImplements("ApiMetadataCapable"), o.addConstructor({
745
778
  parameters: [
746
779
  {
747
780
  name: "apiMetadata",
748
781
  type: "ApiMetadata",
749
782
  hasQuestionToken: e === void 0,
750
- scope: ce.Public,
783
+ scope: ue.Public,
751
784
  isReadonly: !0,
752
785
  initializer: e
753
786
  }
754
787
  ]
755
788
  });
756
789
  }
757
- const Be = "@ahoo-wang/fetcher-eventstream";
758
- function se(r) {
759
- P(r, Be, ["JsonEventStreamResultExtractor", "type JsonServerSentEventStream"]);
790
+ const Je = "@ahoo-wang/fetcher-eventstream";
791
+ function ae(o) {
792
+ C(o, Je, ["JsonEventStreamResultExtractor", "type JsonServerSentEventStream"]);
760
793
  }
761
- function ke(r) {
794
+ function Ve(o) {
762
795
  let e = 0, t = 0;
763
- return r.commands.forEach((n) => {
764
- n.path.startsWith(F.TENANT) && (e += 1), n.path.startsWith(F.OWNER) && (t += 1);
796
+ return o.commands.forEach((n) => {
797
+ n.path.startsWith(_.TENANT) && (e += 1), n.path.startsWith(_.OWNER) && (t += 1);
765
798
  }), e === 0 && t === 0 ? "ResourceAttributionPathSpec.NONE" : e > t ? "ResourceAttributionPathSpec.TENANT" : "ResourceAttributionPathSpec.OWNER";
766
799
  }
767
- function ie(r, e, t, n) {
768
- const o = `${t.contextAlias}/${t.aggregateName}/${n}.ts`;
769
- return te(r, e, o);
800
+ function ce(o, e, t, n) {
801
+ const r = `${t.contextAlias}/${t.aggregateName}/${n}.ts`;
802
+ return oe(o, e, r);
770
803
  }
771
- function Le(r, e) {
772
- return `${A(r.aggregateName)}${e}`;
804
+ function Ke(o, e) {
805
+ return `${x(o.aggregateName)}${e}`;
773
806
  }
774
- function D(r) {
775
- return r === "delete" ? "del" : r;
807
+ function b(o) {
808
+ return o === "delete" ? "del" : o;
776
809
  }
777
- class Qe {
810
+ class He {
778
811
  /**
779
812
  * Creates a new ApiClientGenerator instance.
780
813
  * @param context - The generation context containing OpenAPI spec and configuration
@@ -783,7 +816,7 @@ class Qe {
783
816
  this.context = e, this.apiMetadataCtorInitializer = this.context.currentContextAlias ? `{basePath:'${this.context.currentContextAlias}'}` : void 0;
784
817
  }
785
818
  defaultParameterRequestType = "ParameterRequest";
786
- defaultReturnType = ze;
819
+ defaultReturnType = Ue;
787
820
  apiMetadataCtorInitializer;
788
821
  /**
789
822
  * Generates API client classes for all valid tags in the OpenAPI specification.
@@ -810,14 +843,14 @@ class Qe {
810
843
  `Generating ${t.size} API client classes`
811
844
  );
812
845
  let n = 0;
813
- for (const [o, s] of t) {
846
+ for (const [r, i] of t) {
814
847
  n++, this.context.logger.progressWithCount(
815
848
  n,
816
849
  t.size,
817
- `Generating API client for tag: ${o}`
850
+ `Generating API client for tag: ${r}`
818
851
  );
819
- const i = e.get(o);
820
- this.generateApiClient(i, s);
852
+ const s = e.get(r);
853
+ this.generateApiClient(s, i);
821
854
  }
822
855
  }
823
856
  /**
@@ -827,7 +860,7 @@ class Qe {
827
860
  */
828
861
  createApiClientFile(e) {
829
862
  let t = e.path;
830
- return this.context.currentContextAlias && (t = w(this.context.currentContextAlias, t)), t = w(t, `${e.name}ApiClient.ts`), this.context.logger.info(`Creating API client file: ${t}`), this.context.getOrCreateSourceFile(t);
863
+ return this.context.currentContextAlias && (t = v(this.context.currentContextAlias, t)), t = v(t, `${e.name}ApiClient.ts`), this.context.logger.info(`Creating API client file: ${t}`), this.context.getOrCreateSourceFile(t);
831
864
  }
832
865
  /**
833
866
  * Generates a single API client class for the given tag and operations.
@@ -839,16 +872,16 @@ class Qe {
839
872
  this.context.logger.info(
840
873
  `Generating API client class: ${n.name}ApiClient with ${t.size} operations`
841
874
  );
842
- const o = this.createApiClientFile(n);
843
- ne(o), se(o);
844
- const s = oe(
875
+ const r = this.createApiClientFile(n);
876
+ re(r), ae(r);
877
+ const i = ie(
845
878
  n.name + "ApiClient",
846
- o
879
+ r
847
880
  );
848
- x(s, e.description), re(s, this.apiMetadataCtorInitializer), this.context.logger.info(
881
+ w(i, [e.description]), se(i, this.apiMetadataCtorInitializer), this.context.logger.info(
849
882
  `Processing ${t.size} operations for ${n.name}ApiClient`
850
- ), t.forEach((i) => {
851
- this.processOperation(e, o, s, i);
883
+ ), t.forEach((s) => {
884
+ this.processOperation(e, r, i, s);
852
885
  }), this.context.logger.success(
853
886
  `Completed API client: ${n.name}ApiClient`
854
887
  );
@@ -861,10 +894,10 @@ class Qe {
861
894
  */
862
895
  getMethodName(e, t) {
863
896
  const n = t.operationId.split(".");
864
- for (let o = n.length - 1; o >= 0; o--) {
865
- const s = h(n.slice(o));
866
- if (!e.getMethod(s))
867
- return s;
897
+ for (let r = n.length - 1; r >= 0; r--) {
898
+ const i = h(n.slice(r));
899
+ if (!e.getMethod(i))
900
+ return i;
868
901
  }
869
902
  return h(n);
870
903
  }
@@ -882,7 +915,7 @@ class Qe {
882
915
  let n;
883
916
  if (g(t.requestBody) ? (this.context.logger.info(
884
917
  `Extracting request body from reference for operation: ${t.operationId}`
885
- ), n = L(
918
+ ), n = U(
886
919
  t.requestBody,
887
920
  this.context.openAPI.components
888
921
  )) : n = t.requestBody, !n)
@@ -894,16 +927,16 @@ class Qe {
894
927
  `Detected multipart/form-data content for operation ${t.operationId}, using ParameterRequest<FormData>`
895
928
  ), "ParameterRequest<FormData>";
896
929
  if (n.content["application/json"]) {
897
- const o = n.content["application/json"].schema;
898
- if (g(o)) {
899
- const s = y(o);
930
+ const r = n.content["application/json"].schema;
931
+ if (g(r)) {
932
+ const i = y(r);
900
933
  this.context.logger.info(
901
- `Adding import for request body model: ${s.name} from ${s.path}`
902
- ), f(e, this.context.outputDir, s);
903
- const i = `ParameterRequest<${s.name}>`;
934
+ `Adding import for request body model: ${i.name} from ${i.path}`
935
+ ), f(e, this.context.outputDir, i);
936
+ const s = `ParameterRequest<${i.name}>`;
904
937
  return this.context.logger.info(
905
- `Resolved request type for operation ${t.operationId}: ${i}`
906
- ), i;
938
+ `Resolved request type for operation ${t.operationId}: ${s}`
939
+ ), s;
907
940
  }
908
941
  }
909
942
  return this.context.logger.info(
@@ -918,15 +951,15 @@ class Qe {
918
951
  * @returns Array of parameter declarations
919
952
  */
920
953
  resolveParameters(e, t, n) {
921
- const o = Pe(n, this.context.openAPI.components).filter((a) => !this.context.isIgnoreApiClientPathParameters(
954
+ const r = Ie(n, this.context.openAPI.components).filter((a) => !this.context.isIgnoreApiClientPathParameters(
922
955
  e.name,
923
956
  a.name
924
957
  ));
925
958
  this.context.logger.info(
926
- `Found ${o.length} path parameters for operation ${n.operationId}`
959
+ `Found ${r.length} path parameters for operation ${n.operationId}`
927
960
  );
928
- const s = o.map((a) => {
929
- const c = Y(a);
961
+ const i = r.map((a) => {
962
+ const c = Z(a);
930
963
  return this.context.logger.info(
931
964
  `Adding path parameter: ${a.name} (type: ${c})`
932
965
  ), {
@@ -940,11 +973,11 @@ class Qe {
940
973
  }
941
974
  ]
942
975
  };
943
- }), i = this.resolveRequestType(t, n);
944
- return this.context.logger.info(`Adding httpRequest parameter: ${i}`), s.push({
976
+ }), s = this.resolveRequestType(t, n);
977
+ return this.context.logger.info(`Adding httpRequest parameter: ${s}`), i.push({
945
978
  name: "httpRequest",
946
- hasQuestionToken: i === this.defaultParameterRequestType,
947
- type: `${i}`,
979
+ hasQuestionToken: s === this.defaultParameterRequestType,
980
+ type: `${s}`,
948
981
  decorators: [
949
982
  {
950
983
  name: "request",
@@ -953,7 +986,7 @@ class Qe {
953
986
  ]
954
987
  }), this.context.logger.info(
955
988
  "Adding attributes parameter: Record<string, any>"
956
- ), s.push({
989
+ ), i.push({
957
990
  name: "attributes",
958
991
  hasQuestionToken: !0,
959
992
  type: "Record<string, any>",
@@ -963,7 +996,7 @@ class Qe {
963
996
  arguments: []
964
997
  }
965
998
  ]
966
- }), s;
999
+ }), i;
967
1000
  }
968
1001
  /**
969
1002
  * Resolves the return type for a schema.
@@ -974,20 +1007,20 @@ class Qe {
974
1007
  resolveSchemaReturnType(e, t) {
975
1008
  const n = "Promise<any>";
976
1009
  if (g(t)) {
977
- const o = y(t);
1010
+ const r = y(t);
978
1011
  this.context.logger.info(
979
- `Adding import for response model: ${o.name} from ${o.path}`
980
- ), f(e, this.context.outputDir, o);
981
- const s = `Promise<${o.name}>`;
982
- return this.context.logger.info(`Resolved reference return type: ${s}`), s;
1012
+ `Adding import for response model: ${r.name} from ${r.path}`
1013
+ ), f(e, this.context.outputDir, r);
1014
+ const i = `Promise<${r.name}>`;
1015
+ return this.context.logger.info(`Resolved reference return type: ${i}`), i;
983
1016
  }
984
1017
  if (!t.type)
985
1018
  return this.context.logger.info(
986
1019
  `Schema has no type, using default return type: ${n}`
987
1020
  ), n;
988
1021
  if (q(t.type)) {
989
- const s = `Promise<${C(t.type)}>`;
990
- return this.context.logger.info(`Resolved primitive return type: ${s}`), s;
1022
+ const i = `Promise<${A(t.type)}>`;
1023
+ return this.context.logger.info(`Resolved primitive return type: ${i}`), i;
991
1024
  }
992
1025
  return this.context.logger.info(
993
1026
  `Using default return type: ${n}`
@@ -1000,45 +1033,45 @@ class Qe {
1000
1033
  * @returns Object containing type and optional stream flag
1001
1034
  */
1002
1035
  resolveReturnType(e, t) {
1003
- const n = M(t);
1036
+ const n = j(t);
1004
1037
  if (!n)
1005
1038
  return this.context.logger.info(
1006
1039
  `No OK response found for operation ${t.operationId}, using default return type: ${this.defaultReturnType.type}`
1007
1040
  ), this.defaultReturnType;
1008
- const o = J(n) || fe(n);
1009
- if (o) {
1010
- const i = this.resolveSchemaReturnType(e, o);
1041
+ const r = K(n) || ye(n);
1042
+ if (r) {
1043
+ const s = this.resolveSchemaReturnType(e, r);
1011
1044
  return this.context.logger.info(
1012
- `Resolved JSON/wildcard response return type for operation ${t.operationId}: ${i}`
1045
+ `Resolved JSON/wildcard response return type for operation ${t.operationId}: ${s}`
1013
1046
  ), {
1014
- type: i
1047
+ type: s
1015
1048
  };
1016
1049
  }
1017
- const s = de(n);
1018
- if (s) {
1019
- if (g(s)) {
1020
- const a = R(
1021
- s,
1050
+ const i = he(n);
1051
+ if (i) {
1052
+ if (g(i)) {
1053
+ const a = E(
1054
+ i,
1022
1055
  this.context.openAPI.components
1023
1056
  );
1024
- if (O(a) && g(a.items)) {
1057
+ if (N(a) && g(a.items)) {
1025
1058
  const c = y(a.items);
1026
1059
  this.context.logger.info(
1027
1060
  `Adding import for event stream model: ${c.name} from ${c.path}`
1028
1061
  ), f(e, this.context.outputDir, c);
1029
- const p = `Promise<JsonServerSentEventStream<${c.name.includes("ServerSentEvent") ? `${c.name}['data']` : c.name}>>`;
1062
+ const l = `Promise<JsonServerSentEventStream<${c.name.includes("ServerSentEvent") ? `${c.name}['data']` : c.name}>>`;
1030
1063
  return this.context.logger.info(
1031
- `Resolved event stream return type for operation ${t.operationId}: ${p}`
1064
+ `Resolved event stream return type for operation ${t.operationId}: ${l}`
1032
1065
  ), {
1033
- type: p,
1034
- metadata: N
1066
+ type: l,
1067
+ metadata: D
1035
1068
  };
1036
1069
  }
1037
1070
  }
1038
- const i = "Promise<JsonServerSentEventStream<any>>";
1071
+ const s = "Promise<JsonServerSentEventStream<any>>";
1039
1072
  return this.context.logger.info(
1040
- `Resolved generic event stream return type for operation ${t.operationId}: ${i}`
1041
- ), { type: i, metadata: N };
1073
+ `Resolved generic event stream return type for operation ${t.operationId}: ${s}`
1074
+ ), { type: s, metadata: D };
1042
1075
  }
1043
1076
  return this.context.logger.info(
1044
1077
  `Using default return type for operation ${t.operationId}: ${this.defaultReturnType.type}`
@@ -1051,40 +1084,42 @@ class Qe {
1051
1084
  * @param apiClientClass - The client class to add the method to
1052
1085
  * @param operation - The operation to process
1053
1086
  */
1054
- processOperation(e, t, n, o) {
1087
+ processOperation(e, t, n, r) {
1055
1088
  this.context.logger.info(
1056
- `Processing operation: ${o.operation.operationId} (${o.method} ${o.path})`
1089
+ `Processing operation: ${r.operation.operationId} (${r.method} ${r.path})`
1057
1090
  );
1058
- const s = this.getMethodName(n, o.operation);
1059
- this.context.logger.info(`Generated method name: ${s}`);
1060
- const i = this.resolveParameters(
1091
+ const i = this.getMethodName(n, r.operation);
1092
+ this.context.logger.info(`Generated method name: ${i}`);
1093
+ const s = this.resolveParameters(
1061
1094
  e,
1062
1095
  t,
1063
- o.operation
1064
- ), a = this.resolveReturnType(t, o.operation), c = a.metadata ? {
1065
- name: D(o.method),
1066
- arguments: [`'${o.path}'`, a.metadata]
1096
+ r.operation
1097
+ ), a = this.resolveReturnType(t, r.operation), c = a.metadata ? {
1098
+ name: b(r.method),
1099
+ arguments: [`'${r.path}'`, a.metadata]
1067
1100
  } : {
1068
- name: D(o.method),
1069
- arguments: [`'${o.path}'`]
1101
+ name: b(r.method),
1102
+ arguments: [`'${r.path}'`]
1070
1103
  };
1071
1104
  this.context.logger.info(
1072
- `Creating method with ${i.length} parameters, return type: ${a.type}`
1105
+ `Creating method with ${s.length} parameters, return type: ${a.type}`
1073
1106
  );
1074
- const l = n.addMethod({
1075
- name: s,
1107
+ const u = n.addMethod({
1108
+ name: i,
1076
1109
  decorators: [c],
1077
- parameters: i,
1110
+ parameters: s,
1078
1111
  returnType: a.type,
1079
1112
  statements: [
1080
- `throw autoGeneratedError(${i.map((p) => p.name).join(",")});`
1113
+ `throw autoGeneratedError(${s.map((l) => l.name).join(",")});`
1081
1114
  ]
1082
1115
  });
1083
- x(
1084
- l,
1085
- o.operation.summary,
1086
- o.operation.description
1087
- ), this.context.logger.success(`Operation method generated: ${s}`);
1116
+ w(
1117
+ u,
1118
+ [
1119
+ r.operation.summary,
1120
+ r.operation.description
1121
+ ]
1122
+ ), this.context.logger.success(`Operation method generated: ${i}`);
1088
1123
  }
1089
1124
  /**
1090
1125
  * Groups operations by their tags for client generation.
@@ -1095,25 +1130,25 @@ class Qe {
1095
1130
  this.context.logger.info("Grouping operations by API client tags");
1096
1131
  const t = /* @__PURE__ */ new Map();
1097
1132
  let n = 0;
1098
- for (const [o, s] of Object.entries(this.context.openAPI.paths)) {
1099
- const i = H(s).filter(
1133
+ for (const [r, i] of Object.entries(this.context.openAPI.paths)) {
1134
+ const s = X(i).filter(
1100
1135
  (a) => {
1101
1136
  if (!a.operation.operationId)
1102
1137
  return !1;
1103
1138
  const c = a.operation.tags;
1104
- return !c || c.length == 0 ? !1 : c.every((l) => e.has(l));
1139
+ return !c || c.length == 0 ? !1 : c.every((u) => e.has(u));
1105
1140
  }
1106
1141
  );
1107
1142
  this.context.logger.info(
1108
- `Path ${o}: found ${i.length} valid operations`
1143
+ `Path ${r}: found ${s.length} valid operations`
1109
1144
  );
1110
- for (const a of i)
1145
+ for (const a of s)
1111
1146
  a.operation.tags.forEach((c) => {
1112
- const l = {
1147
+ const u = {
1113
1148
  ...a,
1114
- path: o
1149
+ path: r
1115
1150
  };
1116
- t.has(c) || t.set(c, /* @__PURE__ */ new Set()), t.get(c).add(l), n++;
1151
+ t.has(c) || t.set(c, /* @__PURE__ */ new Set()), t.get(c).add(u), n++;
1117
1152
  });
1118
1153
  }
1119
1154
  return this.context.logger.info(
@@ -1131,9 +1166,9 @@ class Qe {
1131
1166
  );
1132
1167
  const e = /* @__PURE__ */ new Map(), t = this.context.openAPI.tags?.length || 0;
1133
1168
  let n = 0;
1134
- return this.context.openAPI.tags?.forEach((o) => {
1135
- o.name != "wow" && o.name != "Actuator" && !this.isAggregateTag(o) ? (e.set(o.name, o), n++, this.context.logger.info(`Included API client tag: ${o.name}`)) : this.context.logger.info(
1136
- `Excluded tag: ${o.name} (wow/Actuator/aggregate)`
1169
+ return this.context.openAPI.tags?.forEach((r) => {
1170
+ r.name != "wow" && r.name != "Actuator" && !this.isAggregateTag(r) ? (e.set(r.name, r), n++, this.context.logger.info(`Included API client tag: ${r.name}`)) : this.context.logger.info(
1171
+ `Excluded tag: ${r.name} (wow/Actuator/aggregate)`
1137
1172
  );
1138
1173
  }), this.context.logger.info(
1139
1174
  `Resolved ${n} API client tags from ${t} total tags`
@@ -1147,7 +1182,7 @@ class Qe {
1147
1182
  return !1;
1148
1183
  }
1149
1184
  }
1150
- class Ue {
1185
+ class Ye {
1151
1186
  /**
1152
1187
  * Creates a new CommandClientGenerator instance.
1153
1188
  * @param context - The generation context containing OpenAPI spec and project details
@@ -1162,7 +1197,7 @@ class Ue {
1162
1197
  */
1163
1198
  generate() {
1164
1199
  const e = Array.from(this.context.contextAggregates.values()).reduce(
1165
- (n, o) => n + o.size,
1200
+ (n, r) => n + r.size,
1166
1201
  0
1167
1202
  );
1168
1203
  this.context.logger.info("--- Generating Command Clients ---"), this.context.logger.progress(
@@ -1170,12 +1205,12 @@ class Ue {
1170
1205
  );
1171
1206
  let t = 0;
1172
1207
  for (const [, n] of this.context.contextAggregates)
1173
- n.forEach((o) => {
1208
+ n.forEach((r) => {
1174
1209
  t++, this.context.logger.progressWithCount(
1175
1210
  t,
1176
1211
  e,
1177
- `Processing command client for aggregate: ${o.aggregate.aggregateName}`
1178
- ), this.processAggregate(o);
1212
+ `Processing command client for aggregate: ${r.aggregate.aggregateName}`
1213
+ ), this.processAggregate(r);
1179
1214
  });
1180
1215
  this.context.logger.success("Command client generation completed");
1181
1216
  }
@@ -1187,7 +1222,7 @@ class Ue {
1187
1222
  this.context.logger.info(
1188
1223
  `Processing command client for aggregate: ${e.aggregate.aggregateName} in context: ${e.aggregate.contextAlias}`
1189
1224
  );
1190
- const t = ie(
1225
+ const t = ce(
1191
1226
  this.context.project,
1192
1227
  this.context.outputDir,
1193
1228
  e.aggregate,
@@ -1198,7 +1233,7 @@ class Ue {
1198
1233
  ), this.processCommandEndpointPaths(t, e), this.context.logger.info(
1199
1234
  `Creating default command client options: ${this.defaultCommandClientOptionsName}`
1200
1235
  ), t.addVariableStatement({
1201
- declarationKind: v.Const,
1236
+ declarationKind: O.Const,
1202
1237
  declarations: [
1203
1238
  {
1204
1239
  name: this.defaultCommandClientOptionsName,
@@ -1210,9 +1245,9 @@ class Ue {
1210
1245
  ],
1211
1246
  isExported: !1
1212
1247
  }), this.context.logger.info(
1213
- `Adding imports from ${$}: CommandRequest, CommandResult, CommandResultEventStream, DeleteAggregate, RecoverAggregate`
1248
+ `Adding imports from ${P}: CommandRequest, CommandResult, CommandResultEventStream, DeleteAggregate, RecoverAggregate`
1214
1249
  ), t.addImportDeclaration({
1215
- moduleSpecifier: $,
1250
+ moduleSpecifier: P,
1216
1251
  namedImports: [
1217
1252
  "CommandRequest",
1218
1253
  "CommandResult",
@@ -1223,11 +1258,11 @@ class Ue {
1223
1258
  isTypeOnly: !0
1224
1259
  }), this.context.logger.info(
1225
1260
  "Adding import from @ahoo-wang/fetcher-eventstream: JsonEventStreamResultExtractor"
1226
- ), se(t), this.context.logger.info(
1261
+ ), ae(t), this.context.logger.info(
1227
1262
  "Adding import from @ahoo-wang/fetcher: ContentTypeValues"
1228
- ), P(t, "@ahoo-wang/fetcher", ["ContentTypeValues"]), this.context.logger.info(
1263
+ ), C(t, "@ahoo-wang/fetcher", ["ContentTypeValues"]), this.context.logger.info(
1229
1264
  "Adding imports from @ahoo-wang/fetcher-decorator: ApiMetadata types and decorators"
1230
- ), ne(t), this.context.logger.info("Generating standard command client class"), this.processCommandClient(t, e), this.context.logger.info("Generating stream command client class"), this.processCommandClient(t, e, !0), this.context.logger.success(
1265
+ ), re(t), this.context.logger.info("Generating standard command client class"), this.processCommandClient(t, e), this.context.logger.info("Generating stream command client class"), this.processCommandClient(t, e, !0), this.context.logger.success(
1231
1266
  `Command client generation completed for aggregate: ${e.aggregate.aggregateName}`
1232
1267
  );
1233
1268
  }
@@ -1238,12 +1273,12 @@ class Ue {
1238
1273
  const n = e.addEnum({
1239
1274
  name: this.commandEndpointPathsName
1240
1275
  });
1241
- t.commands.forEach((o) => {
1276
+ t.commands.forEach((r) => {
1242
1277
  this.context.logger.info(
1243
- `Adding command endpoint: ${o.name.toUpperCase()} = '${o.path}'`
1278
+ `Adding command endpoint: ${r.name.toUpperCase()} = '${r.path}'`
1244
1279
  ), n.addMember({
1245
- name: o.name.toUpperCase(),
1246
- initializer: `'${o.path}'`
1280
+ name: r.name.toUpperCase(),
1281
+ initializer: `'${r.path}'`
1247
1282
  });
1248
1283
  }), this.context.logger.success(
1249
1284
  `Command endpoint paths enum created with ${t.commands.size} entries`
@@ -1253,49 +1288,49 @@ class Ue {
1253
1288
  return `${this.commandEndpointPathsName}.${e.name.toUpperCase()}`;
1254
1289
  }
1255
1290
  processCommandClient(e, t, n = !1) {
1256
- let o = "CommandClient", s = [], i = "Promise<CommandResult>";
1257
- n && (o = "Stream" + o, s = [
1291
+ let r = "CommandClient", i = [], s = "Promise<CommandResult>";
1292
+ n && (r = "Stream" + r, i = [
1258
1293
  "''",
1259
- N
1260
- ], i = "Promise<CommandResultEventStream>");
1261
- const a = Le(
1294
+ D
1295
+ ], s = "Promise<CommandResultEventStream>");
1296
+ const a = Ke(
1262
1297
  t.aggregate,
1263
- o
1264
- ), c = oe(a, e, s);
1265
- re(c, this.defaultCommandClientOptionsName), t.commands.forEach((l) => {
1266
- this.processCommandMethod(t, e, c, l, i);
1298
+ r
1299
+ ), c = ie(a, e, i);
1300
+ se(c, this.defaultCommandClientOptionsName), t.commands.forEach((u) => {
1301
+ this.processCommandMethod(t, e, c, u, s);
1267
1302
  });
1268
1303
  }
1269
1304
  resolveParameters(e, t, n) {
1270
- const o = d(n.schema.key);
1305
+ const r = d(n.schema.key);
1271
1306
  this.context.logger.info(
1272
- `Adding import for command model: ${o.name} from path: ${o.path}`
1273
- ), f(t, this.context.outputDir, o);
1274
- const s = n.pathParameters.filter((i) => !this.context.isIgnoreCommandClientPathParameters(
1307
+ `Adding import for command model: ${r.name} from path: ${r.path}`
1308
+ ), f(t, this.context.outputDir, r);
1309
+ const i = n.pathParameters.filter((s) => !this.context.isIgnoreCommandClientPathParameters(
1275
1310
  e.name,
1276
- i.name
1277
- )).map((i) => {
1278
- const a = Y(i);
1311
+ s.name
1312
+ )).map((s) => {
1313
+ const a = Z(s);
1279
1314
  return this.context.logger.info(
1280
- `Adding path parameter: ${i.name} (type: ${a})`
1315
+ `Adding path parameter: ${s.name} (type: ${a})`
1281
1316
  ), {
1282
- name: i.name,
1317
+ name: s.name,
1283
1318
  type: a,
1284
1319
  hasQuestionToken: !1,
1285
1320
  decorators: [
1286
1321
  {
1287
1322
  name: "path",
1288
- arguments: [`'${i.name}'`]
1323
+ arguments: [`'${s.name}'`]
1289
1324
  }
1290
1325
  ]
1291
1326
  };
1292
1327
  });
1293
1328
  return this.context.logger.info(
1294
- `Adding command request parameter: commandRequest (type: CommandRequest<${o.name}>)`
1295
- ), s.push({
1329
+ `Adding command request parameter: commandRequest (type: CommandRequest<${r.name}>)`
1330
+ ), i.push({
1296
1331
  name: "commandRequest",
1297
- hasQuestionToken: Ce(n.schema.schema),
1298
- type: `CommandRequest<${o.name}>`,
1332
+ hasQuestionToken: $e(n.schema.schema),
1333
+ type: `CommandRequest<${r.name}>`,
1299
1334
  decorators: [
1300
1335
  {
1301
1336
  name: "request",
@@ -1304,7 +1339,7 @@ class Ue {
1304
1339
  ]
1305
1340
  }), this.context.logger.info(
1306
1341
  "Adding attributes parameter: attributes (type: Record<string, any>)"
1307
- ), s.push({
1342
+ ), i.push({
1308
1343
  name: "attributes",
1309
1344
  hasQuestionToken: !0,
1310
1345
  type: "Record<string, any>",
@@ -1314,36 +1349,36 @@ class Ue {
1314
1349
  arguments: []
1315
1350
  }
1316
1351
  ]
1317
- }), s;
1352
+ }), i;
1318
1353
  }
1319
- processCommandMethod(e, t, n, o, s) {
1354
+ processCommandMethod(e, t, n, r, i) {
1320
1355
  this.context.logger.info(
1321
- `Generating command method: ${h(o.name)} for command: ${o.name}`
1356
+ `Generating command method: ${h(r.name)} for command: ${r.name}`
1322
1357
  ), this.context.logger.info(
1323
- `Command method details: HTTP ${o.method}, path: ${o.path}, return type: ${s}`
1358
+ `Command method details: HTTP ${r.method}, path: ${r.path}, return type: ${i}`
1324
1359
  );
1325
- const i = this.resolveParameters(e.aggregate.tag, t, o), a = n.addMethod({
1326
- name: h(o.name),
1360
+ const s = this.resolveParameters(e.aggregate.tag, t, r), a = n.addMethod({
1361
+ name: h(r.name),
1327
1362
  decorators: [
1328
1363
  {
1329
- name: D(o.method),
1330
- arguments: [`${this.getEndpointPath(o)}`]
1364
+ name: b(r.method),
1365
+ arguments: [`${this.getEndpointPath(r)}`]
1331
1366
  }
1332
1367
  ],
1333
- parameters: i,
1334
- returnType: s,
1368
+ parameters: s,
1369
+ returnType: i,
1335
1370
  statements: [
1336
- `throw autoGeneratedError(${i.map((c) => c.name).join(",")});`
1371
+ `throw autoGeneratedError(${s.map((c) => c.name).join(",")});`
1337
1372
  ]
1338
1373
  });
1339
- (o.summary || o.description) && this.context.logger.info(
1340
- `Adding JSDoc documentation for method: ${h(o.name)}`
1341
- ), x(a, o.summary, o.description), this.context.logger.success(
1342
- `Command method generated: ${h(o.name)}`
1374
+ (r.summary || r.description) && this.context.logger.info(
1375
+ `Adding JSDoc documentation for method: ${h(r.name)}`
1376
+ ), w(a, [r.summary, r.description]), this.context.logger.success(
1377
+ `Command method generated: ${h(r.name)}`
1343
1378
  );
1344
1379
  }
1345
1380
  }
1346
- class Je {
1381
+ class Xe {
1347
1382
  /**
1348
1383
  * Creates a new QueryClientGenerator instance.
1349
1384
  * @param context - The generation context containing OpenAPI spec and project details
@@ -1356,7 +1391,7 @@ class Je {
1356
1391
  */
1357
1392
  generate() {
1358
1393
  const e = Array.from(this.context.contextAggregates.values()).reduce(
1359
- (n, o) => n + o.size,
1394
+ (n, r) => n + r.size,
1360
1395
  0
1361
1396
  );
1362
1397
  this.context.logger.info("--- Generating Query Clients ---"), this.context.logger.progress(
@@ -1364,12 +1399,12 @@ class Je {
1364
1399
  );
1365
1400
  let t = 0;
1366
1401
  for (const [, n] of this.context.contextAggregates)
1367
- n.forEach((o) => {
1402
+ n.forEach((r) => {
1368
1403
  t++, this.context.logger.progressWithCount(
1369
1404
  t,
1370
1405
  e,
1371
- `Processing query client for aggregate: ${o.aggregate.aggregateName}`
1372
- ), this.processQueryClient(o);
1406
+ `Processing query client for aggregate: ${r.aggregate.aggregateName}`
1407
+ ), this.processQueryClient(r);
1373
1408
  });
1374
1409
  this.context.logger.success("Query client generation completed");
1375
1410
  }
@@ -1380,7 +1415,7 @@ class Je {
1380
1415
  * @returns The source file for the client
1381
1416
  */
1382
1417
  createClientFilePath(e, t) {
1383
- return ie(
1418
+ return ce(
1384
1419
  this.context.project,
1385
1420
  this.context.outputDir,
1386
1421
  e,
@@ -1399,9 +1434,9 @@ class Je {
1399
1434
  this.context.logger.info(
1400
1435
  `Processing query client for aggregate: ${e.aggregate.aggregateName} in context: ${e.aggregate.contextAlias}`
1401
1436
  ), this.context.logger.info(
1402
- `Adding imports from ${$}: QueryClientFactory, QueryClientOptions, ResourceAttributionPathSpec`
1437
+ `Adding imports from ${P}: QueryClientFactory, QueryClientOptions, ResourceAttributionPathSpec`
1403
1438
  ), t.addImportDeclaration({
1404
- moduleSpecifier: $,
1439
+ moduleSpecifier: P,
1405
1440
  namedImports: [
1406
1441
  "QueryClientFactory",
1407
1442
  "QueryClientOptions",
@@ -1412,7 +1447,7 @@ class Je {
1412
1447
  this.context.logger.info(
1413
1448
  `Creating default query client options: ${n}`
1414
1449
  ), t.addVariableStatement({
1415
- declarationKind: v.Const,
1450
+ declarationKind: O.Const,
1416
1451
  declarations: [
1417
1452
  {
1418
1453
  name: n,
@@ -1420,40 +1455,40 @@ class Je {
1420
1455
  initializer: `{
1421
1456
  contextAlias: '${e.aggregate.contextAlias}',
1422
1457
  aggregateName: '${e.aggregate.aggregateName}',
1423
- resourceAttribution: ${ke(e)},
1458
+ resourceAttribution: ${Ve(e)},
1424
1459
  }`
1425
1460
  }
1426
1461
  ],
1427
1462
  isExported: !1
1428
1463
  });
1429
- const o = [];
1464
+ const r = [];
1430
1465
  this.context.logger.info(
1431
1466
  `Processing ${e.events.size} domain events for aggregate: ${e.aggregate.aggregateName}`
1432
1467
  );
1433
- for (const p of e.events.values()) {
1434
- const u = d(p.schema.key);
1468
+ for (const l of e.events.values()) {
1469
+ const p = d(l.schema.key);
1435
1470
  this.context.logger.info(
1436
- `Adding import for event model: ${u.name} from path: ${u.path}`
1437
- ), f(t, this.context.outputDir, u), o.push(u);
1471
+ `Adding import for event model: ${p.name} from path: ${p.path}`
1472
+ ), f(t, this.context.outputDir, p), r.push(p);
1438
1473
  }
1439
- const s = "DOMAIN_EVENT_TYPES", i = o.map((p) => p.name).join(" | ");
1474
+ const i = "DOMAIN_EVENT_TYPES", s = r.map((l) => l.name).join(" | ");
1440
1475
  this.context.logger.info(
1441
- `Creating domain event types union: ${s} = ${i}`
1476
+ `Creating domain event types union: ${i} = ${s}`
1442
1477
  ), t.addTypeAlias({
1443
- name: s,
1444
- type: i
1478
+ name: i,
1479
+ type: s
1445
1480
  });
1446
- const a = `${h(e.aggregate.aggregateName)}QueryClientFactory`, c = d(e.state.key), l = d(e.fields.key);
1481
+ const a = `${h(e.aggregate.aggregateName)}QueryClientFactory`, c = d(e.state.key), u = d(e.fields.key);
1447
1482
  this.context.logger.info(
1448
1483
  `Adding import for state model: ${c.name} from path: ${c.path}`
1449
1484
  ), f(t, this.context.outputDir, c), this.context.logger.info(
1450
- `Adding import for fields model: ${l.name} from path: ${l.path}`
1451
- ), f(t, this.context.outputDir, l), this.context.logger.info(`Creating query client factory: ${a}`), t.addVariableStatement({
1452
- declarationKind: v.Const,
1485
+ `Adding import for fields model: ${u.name} from path: ${u.path}`
1486
+ ), f(t, this.context.outputDir, u), this.context.logger.info(`Creating query client factory: ${a}`), t.addVariableStatement({
1487
+ declarationKind: O.Const,
1453
1488
  declarations: [
1454
1489
  {
1455
1490
  name: a,
1456
- initializer: `new QueryClientFactory<${c.name}, ${l.name} | string, ${s}>(${n})`
1491
+ initializer: `new QueryClientFactory<${c.name}, ${u.name} | string, ${i}>(${n})`
1457
1492
  }
1458
1493
  ],
1459
1494
  isExported: !0
@@ -1462,13 +1497,13 @@ class Je {
1462
1497
  );
1463
1498
  }
1464
1499
  }
1465
- class Ve {
1500
+ class Ze {
1466
1501
  /**
1467
1502
  * Creates a new ClientGenerator instance.
1468
1503
  * @param context - The generation context containing OpenAPI spec and project details
1469
1504
  */
1470
1505
  constructor(e) {
1471
- this.context = e, this.queryClientGenerator = new Je(e), this.commandClientGenerator = new Ue(e), this.apiClientGenerator = new Qe(e);
1506
+ this.context = e, this.queryClientGenerator = new Xe(e), this.commandClientGenerator = new Ye(e), this.apiClientGenerator = new He(e);
1472
1507
  }
1473
1508
  queryClientGenerator;
1474
1509
  commandClientGenerator;
@@ -1507,7 +1542,7 @@ class Ve {
1507
1542
  );
1508
1543
  }
1509
1544
  }
1510
- class Ke {
1545
+ class et {
1511
1546
  /** The ts-morph project instance used for code generation */
1512
1547
  project;
1513
1548
  /** The OpenAPI specification object */
@@ -1525,7 +1560,7 @@ class Ke {
1525
1560
  this.project = e.project, this.openAPI = e.openAPI, this.outputDir = e.outputDir, this.contextAggregates = e.contextAggregates, this.logger = e.logger, this.config = e.config ?? {}, this.currentContextAlias = this.openAPI.info["x-wow-context-alias"];
1526
1561
  }
1527
1562
  getOrCreateSourceFile(e) {
1528
- return te(this.project, this.outputDir, e);
1563
+ return oe(this.project, this.outputDir, e);
1529
1564
  }
1530
1565
  isIgnoreApiClientPathParameters(e, t) {
1531
1566
  return (this.config.apiClients?.[e]?.ignorePathParameters ?? this.defaultIgnorePathParameters).includes(t);
@@ -1534,14 +1569,14 @@ class Ke {
1534
1569
  return this.defaultIgnorePathParameters.includes(t);
1535
1570
  }
1536
1571
  }
1537
- const He = "./fetcher-generator.config.json";
1538
- class ot {
1572
+ const tt = "./fetcher-generator.config.json";
1573
+ class ct {
1539
1574
  /**
1540
1575
  * Creates a new CodeGenerator instance.
1541
1576
  * @param options - Configuration options for code generation
1542
1577
  */
1543
1578
  constructor(e) {
1544
- this.options = e, this.project = new ge({ tsConfigFilePath: this.options.tsConfigFilePath }), this.options.logger.info("Project instance created with tsConfigFilePath: ", this.options.tsConfigFilePath);
1579
+ this.options = e, this.project = new le({ tsConfigFilePath: this.options.tsConfigFilePath }), this.options.logger.info("Project instance created with tsConfigFilePath: ", this.options.tsConfigFilePath);
1545
1580
  }
1546
1581
  project;
1547
1582
  /**
@@ -1555,26 +1590,26 @@ class ot {
1555
1590
  ), 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");
1556
1591
  const e = await Ee(this.options.inputPath);
1557
1592
  this.options.logger.info("OpenAPI specification parsed successfully"), this.options.logger.info("Resolving bounded context aggregates");
1558
- const n = new je(e).resolve();
1593
+ const n = new ze(e).resolve();
1559
1594
  this.options.logger.info(
1560
1595
  `Resolved ${n.size} bounded context aggregates`
1561
1596
  );
1562
- const o = this.options.configPath ?? He;
1563
- let s = {};
1597
+ const r = this.options.configPath ?? tt;
1598
+ let i = {};
1564
1599
  try {
1565
- this.options.logger.info("Parsing configuration file:", o), s = await Se(o);
1566
- } catch (l) {
1567
- this.options.logger.info("Configuration file parsing failed ", l);
1600
+ this.options.logger.info("Parsing configuration file:", r), i = await we(r);
1601
+ } catch (u) {
1602
+ this.options.logger.info("Configuration file parsing failed ", u);
1568
1603
  }
1569
- const i = new Ke({
1604
+ const s = new et({
1570
1605
  openAPI: e,
1571
1606
  project: this.project,
1572
1607
  outputDir: this.options.outputDir,
1573
1608
  contextAggregates: n,
1574
1609
  logger: this.options.logger,
1575
- config: s
1610
+ config: i
1576
1611
  });
1577
- this.options.logger.info("Generating models"), new _e(i).generate(), this.options.logger.info("Models generated successfully"), this.options.logger.info("Generating clients"), new Ve(i).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");
1612
+ this.options.logger.info("Generating models"), new Be(s).generate(), this.options.logger.info("Models generated successfully"), this.options.logger.info("Generating clients"), new Ze(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");
1578
1613
  }
1579
1614
  /**
1580
1615
  * Generates index.ts files for all subdirectories in the output directory.
@@ -1609,39 +1644,39 @@ class ot {
1609
1644
  this.options.logger.info(`Generating index for directory: ${t}`);
1610
1645
  const n = e.getSourceFiles().filter(
1611
1646
  (a) => a.getBaseName().endsWith(".ts") && a.getBaseName() !== "index.ts"
1612
- ), o = e.getDirectories();
1647
+ ), r = e.getDirectories();
1613
1648
  if (this.options.logger.info(
1614
- `Found ${n.length} TypeScript files and ${o.length} subdirectories in ${t}`
1615
- ), n.length === 0 && o.length === 0) {
1649
+ `Found ${n.length} TypeScript files and ${r.length} subdirectories in ${t}`
1650
+ ), n.length === 0 && r.length === 0) {
1616
1651
  this.options.logger.info(
1617
1652
  `No files or subdirectories to export in ${t}, skipping index generation`
1618
1653
  );
1619
1654
  return;
1620
1655
  }
1621
- const s = `${t}/index.ts`;
1622
- this.options.logger.info(`Creating/updating index file: ${s}`);
1623
- const i = this.project.getSourceFile(s) || this.project.createSourceFile(s, "", { overwrite: !0 });
1624
- i.removeText();
1656
+ const i = `${t}/index.ts`;
1657
+ this.options.logger.info(`Creating/updating index file: ${i}`);
1658
+ const s = this.project.getSourceFile(i) || this.project.createSourceFile(i, "", { overwrite: !0 });
1659
+ s.removeText();
1625
1660
  for (const a of n) {
1626
1661
  const c = `./${a.getBaseNameWithoutExtension()}`;
1627
- this.options.logger.info(`Adding export for file: ${c}`), i.addExportDeclaration({
1662
+ this.options.logger.info(`Adding export for file: ${c}`), s.addExportDeclaration({
1628
1663
  moduleSpecifier: c,
1629
1664
  isTypeOnly: !1,
1630
1665
  namedExports: []
1631
1666
  });
1632
1667
  }
1633
- for (const a of o) {
1668
+ for (const a of r) {
1634
1669
  const c = `./${a.getBaseName()}`;
1635
1670
  this.options.logger.info(
1636
1671
  `Adding export for subdirectory: ${c}`
1637
- ), i.addExportDeclaration({
1672
+ ), s.addExportDeclaration({
1638
1673
  moduleSpecifier: c,
1639
1674
  isTypeOnly: !1,
1640
1675
  namedExports: []
1641
1676
  });
1642
1677
  }
1643
1678
  this.options.logger.info(
1644
- `Index file generated for ${t} with ${n.length + o.length} exports`
1679
+ `Index file generated for ${t} with ${n.length + r.length} exports`
1645
1680
  );
1646
1681
  }
1647
1682
  optimizeSourceFiles() {
@@ -1654,7 +1689,7 @@ class ot {
1654
1689
  }
1655
1690
  }
1656
1691
  export {
1657
- ot as CodeGenerator,
1658
- He as DEFAULT_CONFIG_PATH
1692
+ ct as CodeGenerator,
1693
+ tt as DEFAULT_CONFIG_PATH
1659
1694
  };
1660
1695
  //# sourceMappingURL=index.js.map