@ahoo-wang/fetcher-generator 3.0.9 → 3.1.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,78 +1,78 @@
1
- import { Scope as he, VariableDeclarationKind as O, Project as ye } from "ts-morph";
2
- import { ContentTypeValues as T, combineURLs as v } from "@ahoo-wang/fetcher";
1
+ import { Scope as he, VariableDeclarationKind as D, Project as ye } from "ts-morph";
2
+ import { ContentTypeValues as v, combineURLs as I } from "@ahoo-wang/fetcher";
3
3
  import { ResourceAttributionPathSpec as k } from "@ahoo-wang/fetcher-wow";
4
4
  import { parse as H } from "yaml";
5
5
  import { readFile as xe } from "fs";
6
6
  import { join as Ae, relative as Ce } from "path";
7
- function C(n) {
8
- return n.$ref.split("/").pop();
7
+ function C(o) {
8
+ return o.$ref.split("/").pop();
9
9
  }
10
- function I(n, e) {
11
- const t = C(n);
10
+ function E(o, e) {
11
+ const t = C(o);
12
12
  return e.schemas?.[t];
13
13
  }
14
- function K(n, e) {
15
- const t = C(n);
14
+ function K(o, e) {
15
+ const t = C(o);
16
16
  return e.requestBodies?.[t];
17
17
  }
18
- function Y(n, e) {
19
- const t = C(n);
18
+ function Y(o, e) {
19
+ const t = C(o);
20
20
  return e.parameters?.[t];
21
21
  }
22
- function P(n, e) {
22
+ function P(o, e) {
23
23
  return {
24
- key: C(n),
25
- schema: I(n, e)
24
+ key: C(o),
25
+ schema: E(o, e)
26
26
  };
27
27
  }
28
28
  const Pe = /[-_\s.]+/;
29
- function N(n) {
30
- return n.split(Pe);
29
+ function N(o) {
30
+ return o.split(Pe);
31
31
  }
32
- function X(n) {
33
- return Array.isArray(n) ? n.flatMap((e) => z(N(e))) : z(N(n));
32
+ function X(o) {
33
+ return Array.isArray(o) ? o.flatMap((e) => z(N(e))) : z(N(o));
34
34
  }
35
- function z(n) {
36
- return n.flatMap((e) => {
35
+ function z(o) {
36
+ return o.flatMap((e) => {
37
37
  if (e.length === 0)
38
38
  return [];
39
39
  const t = [];
40
- let o = "";
40
+ let n = "";
41
41
  for (let r = 0; r < e.length; r++) {
42
42
  const i = e[r], s = /[A-Z]/.test(i), a = r > 0 && /[a-z]/.test(e[r - 1]);
43
- s && a && o ? (t.push(o), o = i) : o += i;
43
+ s && a && n ? (t.push(n), n = i) : n += i;
44
44
  }
45
- return o && t.push(o), t;
45
+ return n && t.push(n), t;
46
46
  });
47
47
  }
48
- function S(n) {
49
- return n === "" || n.length === 0 ? "" : X(n).filter((t) => t.length > 0).map((t) => {
50
- const o = t.charAt(0), r = t.slice(1);
51
- return (/[a-zA-Z]/.test(o) ? o.toUpperCase() : o) + r.toLowerCase();
48
+ function R(o) {
49
+ return o === "" || o.length === 0 ? "" : X(o).filter((t) => t.length > 0).map((t) => {
50
+ const n = t.charAt(0), r = t.slice(1);
51
+ return (/[a-zA-Z]/.test(n) ? n.toUpperCase() : n) + r.toLowerCase();
52
52
  }).join("");
53
53
  }
54
- function f(n) {
55
- const e = S(n);
54
+ function f(o) {
55
+ const e = R(o);
56
56
  return e.charAt(0).toLowerCase() + e.slice(1);
57
57
  }
58
- function Z(n) {
59
- return n === "" || Array.isArray(n) && n.length === 0 ? "" : X(n).filter((t) => t.length > 0).map((t) => t.toUpperCase()).join("_");
58
+ function Z(o) {
59
+ return o === "" || Array.isArray(o) && o.length === 0 ? "" : X(o).filter((t) => t.length > 0).map((t) => t.toUpperCase()).join("_");
60
60
  }
61
- function g(n) {
62
- return !!(n && typeof n == "object" && "$ref" in n);
61
+ function g(o) {
62
+ return !!(o && typeof o == "object" && "$ref" in o);
63
63
  }
64
- function G(n, e) {
64
+ function G(o, e) {
65
65
  if (e && !g(e) && e.content)
66
- return e.content[n]?.schema;
66
+ return e.content[o]?.schema;
67
67
  }
68
- function ee(n) {
69
- return G(T.APPLICATION_JSON, n);
68
+ function ee(o) {
69
+ return G(v.APPLICATION_JSON, o);
70
70
  }
71
- function $e(n) {
72
- return G(T.TEXT_EVENT_STREAM, n);
71
+ function $e(o) {
72
+ return G(v.TEXT_EVENT_STREAM, o);
73
73
  }
74
- function Te(n) {
75
- return G("*/*", n);
74
+ function Te(o) {
75
+ return G("*/*", o);
76
76
  }
77
77
  const ve = [
78
78
  "string",
@@ -81,46 +81,46 @@ const ve = [
81
81
  "boolean",
82
82
  "null"
83
83
  ];
84
- function te(n) {
85
- return Array.isArray(n) ? !0 : ve.includes(n);
84
+ function te(o) {
85
+ return Array.isArray(o) ? !0 : ve.includes(o);
86
86
  }
87
- function L(n) {
88
- return Array.isArray(n.enum) && n.enum.length > 0;
87
+ function L(o) {
88
+ return Array.isArray(o.enum) && o.enum.length > 0;
89
89
  }
90
- function D(n) {
91
- return n.type === "object" && !!n.properties;
90
+ function $(o) {
91
+ return o.type === "object" && !!o.properties;
92
92
  }
93
- function M(n) {
94
- return n.type === "array" && !!n.items;
93
+ function M(o) {
94
+ return o.type === "array" && !!o.items;
95
95
  }
96
- function Ie(n) {
97
- return Array.isArray(n.anyOf) && n.anyOf.length > 0;
96
+ function Ie(o) {
97
+ return Array.isArray(o.anyOf) && o.anyOf.length > 0;
98
98
  }
99
- function Ee(n) {
100
- return Array.isArray(n.oneOf) && n.oneOf.length > 0;
99
+ function Ee(o) {
100
+ return Array.isArray(o.oneOf) && o.oneOf.length > 0;
101
101
  }
102
- function b(n) {
103
- return Array.isArray(n.allOf) && n.allOf.length > 0;
102
+ function b(o) {
103
+ return Array.isArray(o.allOf) && o.allOf.length > 0;
104
104
  }
105
- function B(n) {
106
- return Ie(n) || Ee(n) || b(n);
105
+ function B(o) {
106
+ return Ie(o) || Ee(o) || b(o);
107
107
  }
108
- function Se(n) {
109
- return n.includes("|") || n.includes("&") ? `(${n})[]` : `${n}[]`;
108
+ function Se(o) {
109
+ return o.includes("|") || o.includes("&") ? `(${o})[]` : `${o}[]`;
110
110
  }
111
- function Re(n) {
112
- return n.type === "object" && !n.properties && n.additionalProperties !== void 0;
111
+ function Re(o) {
112
+ return o.type === "object" && !o.properties && o.additionalProperties !== void 0;
113
113
  }
114
- function we(n) {
115
- return n.type !== "object" ? !1 : n.properties ? Object.keys(n.properties).length === 0 : !0;
114
+ function we(o) {
115
+ return o.type !== "object" ? !1 : o.properties ? Object.keys(o.properties).length === 0 : !0;
116
116
  }
117
- function De(n) {
118
- return n.readOnly === !0;
117
+ function Oe(o) {
118
+ return o.readOnly === !0;
119
119
  }
120
- function R(n) {
121
- if (Array.isArray(n))
122
- return n.map((e) => R(e)).join(" | ");
123
- switch (n) {
120
+ function w(o) {
121
+ if (Array.isArray(o))
122
+ return o.map((e) => w(e)).join(" | ");
123
+ switch (o) {
124
124
  case "string":
125
125
  return "string";
126
126
  case "number":
@@ -134,86 +134,92 @@ function R(n) {
134
134
  return "any";
135
135
  }
136
136
  }
137
- function Oe(n, e) {
138
- return n.operation.operationId && e.operation.operationId ? n.operation.operationId.localeCompare(
137
+ function De(o) {
138
+ if (!$(o))
139
+ return [];
140
+ const e = o.required || [];
141
+ return Object.keys(o.properties).filter((t) => !e.includes(t));
142
+ }
143
+ function Ne(o, e) {
144
+ return o.operation.operationId && e.operation.operationId ? o.operation.operationId.localeCompare(
139
145
  e.operation.operationId
140
- ) : n.path && e.path ? n.path.localeCompare(e.path) : n.method && e.method ? n.method.localeCompare(e.method) : 0;
146
+ ) : o.path && e.path ? o.path.localeCompare(e.path) : o.method && e.method ? o.method.localeCompare(e.method) : 0;
141
147
  }
142
- function ne(n) {
148
+ function ne(o) {
143
149
  const e = [];
144
- for (const [t, o] of Object.entries(n))
145
- oe(o).forEach((r) => {
150
+ for (const [t, n] of Object.entries(o))
151
+ oe(n).forEach((r) => {
146
152
  e.push({
147
153
  method: r.method,
148
154
  operation: r.operation,
149
155
  path: t
150
156
  });
151
157
  });
152
- return e.sort(Oe);
158
+ return e.sort(Ne);
153
159
  }
154
- function oe(n) {
160
+ function oe(o) {
155
161
  return [
156
- { method: "get", operation: n.get },
157
- { method: "put", operation: n.put },
158
- { method: "post", operation: n.post },
159
- { method: "delete", operation: n.delete },
160
- { method: "options", operation: n.options },
161
- { method: "head", operation: n.head },
162
- { method: "patch", operation: n.patch },
163
- { method: "trace", operation: n.trace }
162
+ { method: "get", operation: o.get },
163
+ { method: "put", operation: o.put },
164
+ { method: "post", operation: o.post },
165
+ { method: "delete", operation: o.delete },
166
+ { method: "options", operation: o.options },
167
+ { method: "head", operation: o.head },
168
+ { method: "patch", operation: o.patch },
169
+ { method: "trace", operation: o.trace }
164
170
  ].filter(({ operation: e }) => e !== void 0);
165
171
  }
166
- function _(n) {
167
- return n.responses[200];
172
+ function _(o) {
173
+ return o.responses[200];
168
174
  }
169
- function U(n) {
170
- const e = _(n);
175
+ function U(o) {
176
+ const e = _(o);
171
177
  return ee(e);
172
178
  }
173
- function Ne(n, e) {
174
- return n.parameters ? n.parameters.map((t) => g(t) ? Y(t, e) : t).filter((t) => t.in === "path") : [];
179
+ function Me(o, e) {
180
+ return o.parameters ? o.parameters.map((t) => g(t) ? Y(t, e) : t).filter((t) => t.in === "path") : [];
175
181
  }
176
- const Me = "string";
177
- function re(n) {
178
- return !n.schema || g(n.schema) || !n.schema.type || !te(n.schema.type) ? Me : R(n.schema.type);
182
+ const be = "string";
183
+ function re(o) {
184
+ return !o.schema || g(o.schema) || !o.schema.type || !te(o.schema.type) ? be : w(o.schema.type);
179
185
  }
180
- function ie(n) {
181
- return n.startsWith("http://") || n.startsWith("https://") ? be(n) : qe(n);
186
+ function ie(o) {
187
+ return o.startsWith("http://") || o.startsWith("https://") ? qe(o) : Fe(o);
182
188
  }
183
- async function be(n) {
184
- return await (await fetch(n)).text();
189
+ async function qe(o) {
190
+ return await (await fetch(o)).text();
185
191
  }
186
- function qe(n) {
192
+ function Fe(o) {
187
193
  return new Promise((e, t) => {
188
- xe(n, "utf-8", (o, r) => {
189
- o ? t(o) : e(r);
194
+ xe(o, "utf-8", (n, r) => {
195
+ n ? t(n) : e(r);
190
196
  });
191
197
  });
192
198
  }
193
- async function Fe(n) {
194
- const e = await ie(n);
199
+ async function je(o) {
200
+ const e = await ie(o);
195
201
  switch (se(e)) {
196
202
  case "json":
197
203
  return JSON.parse(e);
198
204
  case "yaml":
199
205
  return H(e);
200
206
  default:
201
- throw new Error(`Unsupported file format: ${n}`);
207
+ throw new Error(`Unsupported file format: ${o}`);
202
208
  }
203
209
  }
204
- async function je(n) {
205
- const e = await ie(n);
210
+ async function Ge(o) {
211
+ const e = await ie(o);
206
212
  switch (se(e)) {
207
213
  case "json":
208
214
  return JSON.parse(e);
209
215
  case "yaml":
210
216
  return H(e);
211
217
  default:
212
- throw new Error(`Unsupported file format: ${n}`);
218
+ throw new Error(`Unsupported file format: ${o}`);
213
219
  }
214
220
  }
215
- function se(n) {
216
- const e = n.trimStart();
221
+ function se(o) {
222
+ const e = o.trimStart();
217
223
  if (e.startsWith("{") || e.startsWith("["))
218
224
  return "json";
219
225
  if (e.startsWith("-") || e.startsWith("%YAML"))
@@ -226,129 +232,129 @@ function se(n) {
226
232
  }
227
233
  throw new Error("Unable to infer file format");
228
234
  }
229
- const ae = "types.ts", Ge = "@";
230
- function _e(n) {
231
- return v(n.path, ae);
235
+ const ae = "types.ts", _e = "@";
236
+ function We(o) {
237
+ return I(o.path, ae);
232
238
  }
233
- function ce(n, e, t) {
234
- const o = v(e, t), r = n.getSourceFile(o);
235
- return r || n.createSourceFile(o, "", {
239
+ function ce(o, e, t) {
240
+ const n = I(e, t), r = o.getSourceFile(n);
241
+ return r || o.createSourceFile(n, "", {
236
242
  overwrite: !0
237
243
  });
238
244
  }
239
- function x(n, e, t) {
240
- let o = n.getImportDeclaration(
245
+ function x(o, e, t) {
246
+ let n = o.getImportDeclaration(
241
247
  (r) => r.getModuleSpecifierValue() === e
242
248
  );
243
- o || (o = n.addImportDeclaration({
249
+ n || (n = o.addImportDeclaration({
244
250
  moduleSpecifier: e
245
251
  })), t.forEach((r) => {
246
- o.getNamedImports().some(
252
+ n.getNamedImports().some(
247
253
  (s) => s.getName() === r
248
- ) || o.addNamedImport(r);
254
+ ) || n.addNamedImport(r);
249
255
  });
250
256
  }
251
- function m(n, e, t) {
252
- if (t.path.startsWith(Ge)) {
253
- x(n, t.path, [t.name]);
257
+ function d(o, e, t) {
258
+ if (t.path.startsWith(_e)) {
259
+ x(o, t.path, [t.name]);
254
260
  return;
255
261
  }
256
- const o = n.getDirectoryPath(), r = Ae(e, t.path, ae);
257
- let i = Ce(o, r);
258
- i = i.replace(/\.ts$/, ""), i.startsWith(".") || (i = "./" + i), x(n, i, [t.name]);
262
+ const n = o.getDirectoryPath(), r = Ae(e, t.path, ae);
263
+ let i = Ce(n, r);
264
+ i = i.replace(/\.ts$/, ""), i.startsWith(".") || (i = "./" + i), x(o, i, [t.name]);
259
265
  }
260
- function We(n, e, t, o) {
261
- n.path !== o.path && m(e, t, o);
266
+ function ke(o, e, t, n) {
267
+ o.path !== n.path && d(e, t, n);
262
268
  }
263
- function ge(n, e = `
269
+ function ge(o, e = `
264
270
  `) {
265
- if (!Array.isArray(n))
271
+ if (!Array.isArray(o))
266
272
  return;
267
- const t = n.filter(
268
- (o) => typeof o == "string" && o.length > 0
273
+ const t = o.filter(
274
+ (n) => typeof n == "string" && n.length > 0
269
275
  );
270
276
  return t.length > 0 ? t.join(e) : void 0;
271
277
  }
272
- function E(n, e) {
278
+ function S(o, e) {
273
279
  const t = ge(e);
274
- t && n.addJsDoc(t);
280
+ t && o.addJsDoc(t);
275
281
  }
276
- function pe(n, e) {
282
+ function pe(o, e) {
277
283
  const t = [
278
- n.title,
279
- n.description
284
+ o.title,
285
+ o.description
280
286
  ];
281
- return e && t.push(`- key: ${e}`), n.format && t.push(`- format: ${n.format}`), J(t, n, "default"), J(t, n, "example"), ke(t, n), ze(t, n), Le(t, n), t;
287
+ return e && t.push(`- key: ${e}`), o.format && t.push(`- format: ${o.format}`), J(t, o, "default"), J(t, o, "example"), ze(t, o), Le(t, o), Be(t, o), t;
282
288
  }
283
- function Q(n, e, t) {
284
- const o = pe(e, t);
285
- E(n, o);
289
+ function Q(o, e, t) {
290
+ const n = pe(e, t);
291
+ S(o, n);
286
292
  }
287
- function J(n, e, t) {
288
- const o = e[t];
289
- if (o) {
290
- if (typeof o != "object") {
291
- n.push(`- ${t}: \`${o}\``);
293
+ function J(o, e, t) {
294
+ const n = e[t];
295
+ if (n) {
296
+ if (typeof n != "object") {
297
+ o.push(`- ${t}: \`${n}\``);
292
298
  return;
293
299
  }
294
- n.push(`- ${t}: `), n.push("```json"), n.push(JSON.stringify(o)), n.push("```");
300
+ o.push(`- ${t}: `), o.push("```json"), o.push(JSON.stringify(n)), o.push("```");
295
301
  }
296
302
  }
297
- function ke(n, e) {
303
+ function ze(o, e) {
298
304
  const t = ["- Numeric Constraints"];
299
305
  e.minimum !== void 0 && t.push(` - minimum: ${e.minimum}`), e.maximum !== void 0 && t.push(` - maximum: ${e.maximum}`), e.exclusiveMinimum !== void 0 && t.push(
300
306
  ` - exclusiveMinimum: ${e.exclusiveMinimum}`
301
307
  ), e.exclusiveMaximum !== void 0 && t.push(
302
308
  ` - exclusiveMaximum: ${e.exclusiveMaximum}`
303
- ), e.multipleOf !== void 0 && t.push(` - multipleOf: ${e.multipleOf}`), t.length !== 1 && n.push(...t);
309
+ ), e.multipleOf !== void 0 && t.push(` - multipleOf: ${e.multipleOf}`), t.length !== 1 && o.push(...t);
304
310
  }
305
- function ze(n, e) {
311
+ function Le(o, e) {
306
312
  const t = ["- String Constraints"];
307
- 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 && n.push(...t);
313
+ 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);
308
314
  }
309
- function Le(n, e) {
315
+ function Be(o, e) {
310
316
  const t = ["- Array Constraints"];
311
- 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 && n.push(...t);
317
+ 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);
312
318
  }
313
- function Be(n) {
314
- const e = n.split(".");
319
+ function Ue(o) {
320
+ const e = o.split(".");
315
321
  return e.length != 2 || e[0].length === 0 || e[1].length === 0 ? null : e;
316
322
  }
317
- function Ue(n) {
318
- const e = Be(n.name);
323
+ function Qe(o) {
324
+ const e = Ue(o.name);
319
325
  return e ? {
320
- tag: n,
326
+ tag: o,
321
327
  contextAlias: e[0],
322
328
  aggregateName: e[1]
323
329
  } : null;
324
330
  }
325
- function Qe(n) {
326
- const e = n?.map((o) => Ue(o)).filter((o) => o !== null);
331
+ function Je(o) {
332
+ const e = o?.map((n) => Qe(n)).filter((n) => n !== null);
327
333
  if (!e)
328
334
  return /* @__PURE__ */ new Map();
329
335
  const t = /* @__PURE__ */ new Map();
330
- return e.forEach((o) => {
331
- t.set(o.tag.name, {
332
- aggregate: o,
336
+ return e.forEach((n) => {
337
+ t.set(n.tag.name, {
338
+ aggregate: n,
333
339
  commands: /* @__PURE__ */ new Map(),
334
340
  events: /* @__PURE__ */ new Map()
335
341
  });
336
342
  }), t;
337
343
  }
338
- function Je(n) {
339
- if (!n)
344
+ function Ve(o) {
345
+ if (!o)
340
346
  return null;
341
- const e = n.split(".");
347
+ const e = o.split(".");
342
348
  return e.length != 3 ? null : e[2];
343
349
  }
344
- const Ve = "#/components/responses/wow.CommandOk", He = "#/components/parameters/wow.id";
345
- class Ke {
350
+ const He = "#/components/responses/wow.CommandOk", Ke = "#/components/parameters/wow.id";
351
+ class Ye {
346
352
  /**
347
353
  * Creates a new AggregateResolver instance.
348
354
  * @param openAPI - The OpenAPI specification to resolve aggregates from
349
355
  */
350
356
  constructor(e) {
351
- this.openAPI = e, this.aggregates = Qe(e.tags), this.build();
357
+ this.openAPI = e, this.aggregates = Je(e.tags), this.build();
352
358
  }
353
359
  aggregates;
354
360
  /**
@@ -369,9 +375,9 @@ class Ke {
369
375
  for (const t of this.aggregates.values()) {
370
376
  if (!t.state || !t.fields)
371
377
  continue;
372
- const o = t.aggregate.contextAlias;
373
- let r = e.get(o);
374
- r || (r = /* @__PURE__ */ new Set(), e.set(o, r)), r.add(t);
378
+ const n = t.aggregate.contextAlias;
379
+ let r = e.get(n);
380
+ r || (r = /* @__PURE__ */ new Set(), e.set(n, r)), r.add(t);
375
381
  }
376
382
  return e;
377
383
  }
@@ -381,16 +387,16 @@ class Ke {
381
387
  * @param methodOperation - The HTTP method and operation details
382
388
  */
383
389
  commands(e, t) {
384
- const o = t.operation;
385
- if (o.operationId === "wow.command.send")
390
+ const n = t.operation;
391
+ if (n.operationId === "wow.command.send")
386
392
  return;
387
- const r = Je(o.operationId);
393
+ const r = Ve(n.operationId);
388
394
  if (!r)
389
395
  return;
390
- const i = _(o);
391
- if (!i || !g(i) || i.$ref !== Ve || !o.requestBody)
396
+ const i = _(n);
397
+ if (!i || !g(i) || i.$ref !== He || !n.requestBody)
392
398
  return;
393
- const s = o.parameters ?? [], a = s.filter((l) => g(l) && l.$ref === He).at(0), c = s.filter(
399
+ const s = n.parameters ?? [], a = s.filter((l) => g(l) && l.$ref === Ke).at(0), c = s.filter(
394
400
  (l) => !g(l) && l.in === "path"
395
401
  );
396
402
  if (a) {
@@ -400,22 +406,22 @@ class Ke {
400
406
  );
401
407
  c.push(l);
402
408
  }
403
- const p = o.requestBody.content[T.APPLICATION_JSON].schema, y = P(
409
+ const p = n.requestBody.content[v.APPLICATION_JSON].schema, y = P(
404
410
  p,
405
411
  this.openAPI.components
406
412
  );
407
- y.schema.title = y.schema.title || o.summary, y.schema.description = y.schema.description || o.description;
413
+ y.schema.title = y.schema.title || n.summary, y.schema.description = y.schema.description || n.description;
408
414
  const fe = {
409
415
  name: r,
410
416
  method: t.method,
411
417
  path: e,
412
418
  pathParameters: c,
413
- summary: o.summary,
414
- description: o.description,
419
+ summary: n.summary,
420
+ description: n.description,
415
421
  schema: y,
416
- operation: o
422
+ operation: n
417
423
  };
418
- o.tags?.forEach((l) => {
424
+ n.tags?.forEach((l) => {
419
425
  const W = this.aggregates.get(l);
420
426
  W && W.commands.set(r, fe);
421
427
  });
@@ -430,13 +436,13 @@ class Ke {
430
436
  const t = U(e);
431
437
  if (!g(t))
432
438
  return;
433
- const o = P(
439
+ const n = P(
434
440
  t,
435
441
  this.openAPI.components
436
442
  );
437
443
  e.tags?.forEach((r) => {
438
444
  const i = this.aggregates.get(r);
439
- i && (i.state = o);
445
+ i && (i.state = n);
440
446
  });
441
447
  }
442
448
  /**
@@ -449,11 +455,11 @@ class Ke {
449
455
  const t = U(e);
450
456
  if (g(t))
451
457
  return;
452
- const o = t?.items;
453
- if (!g(o))
458
+ const n = t?.items;
459
+ if (!g(n))
454
460
  return;
455
- const i = I(
456
- o,
461
+ const i = E(
462
+ n,
457
463
  this.openAPI.components
458
464
  ).properties.body.items.anyOf.map((s) => {
459
465
  const a = s.title, c = s.properties.name.const, u = s.properties.body, p = P(
@@ -480,11 +486,11 @@ class Ke {
480
486
  fields(e) {
481
487
  if (!this.openAPI.components || !e.operationId?.endsWith(".snapshot.count"))
482
488
  return;
483
- const o = K(
489
+ const n = K(
484
490
  e.requestBody,
485
491
  this.openAPI.components
486
- ).content[T.APPLICATION_JSON].schema, i = I(
487
- o,
492
+ ).content[v.APPLICATION_JSON].schema, i = E(
493
+ n,
488
494
  this.openAPI.components
489
495
  ).properties?.field, s = P(i, this.openAPI.components);
490
496
  e.tags?.forEach((a) => {
@@ -493,7 +499,7 @@ class Ke {
493
499
  });
494
500
  }
495
501
  }
496
- const A = "@ahoo-wang/fetcher-wow", Ye = {
502
+ const A = "@ahoo-wang/fetcher-wow", Xe = {
497
503
  "wow.command.CommandResult": "CommandResult",
498
504
  "wow.command.CommandResultArray": "CommandResultArray",
499
505
  "wow.MessageHeaderSqlType": "MessageHeaderSqlType",
@@ -523,32 +529,32 @@ const A = "@ahoo-wang/fetcher-wow", Ye = {
523
529
  "wow.openapi.BatchResult": "BatchResult",
524
530
  "wow.messaging.CompensationTarget": "CompensationTarget"
525
531
  };
526
- function d(n) {
527
- if (!n)
532
+ function m(o) {
533
+ if (!o)
528
534
  return { name: "", path: "/" };
529
- const e = Ye[n];
535
+ const e = Xe[o];
530
536
  if (e)
531
537
  return { name: e, path: A };
532
- const t = n.split(".");
533
- let o = -1;
538
+ const t = o.split(".");
539
+ let n = -1;
534
540
  for (let c = 0; c < t.length; c++)
535
541
  if (t[c] && /^[A-Z]/.test(t[c])) {
536
- o = c;
542
+ n = c;
537
543
  break;
538
544
  }
539
- const r = t.slice(0, o), i = r.length > 0 ? `/${r.join("/")}` : "/", s = t.slice(o);
540
- return { name: S(s), path: i };
545
+ const r = t.slice(0, n), i = r.length > 0 ? `/${r.join("/")}` : "/", s = t.slice(n);
546
+ return { name: R(s), path: i };
541
547
  }
542
- function $(n) {
543
- const e = C(n);
544
- return d(e);
548
+ function T(o) {
549
+ const e = C(o);
550
+ return m(e);
545
551
  }
546
- function w(n) {
547
- return `${Z(n)}_BOUNDED_CONTEXT_ALIAS`;
552
+ function O(o) {
553
+ return `${Z(o)}_BOUNDED_CONTEXT_ALIAS`;
548
554
  }
549
- class Xe {
550
- constructor(e, t, o, r) {
551
- this.modelInfo = e, this.sourceFile = t, this.keySchema = o, this.outputDir = r;
555
+ class Ze {
556
+ constructor(e, t, n, r) {
557
+ this.modelInfo = e, this.sourceFile = t, this.keySchema = n, this.outputDir = r;
552
558
  }
553
559
  generate() {
554
560
  const e = this.process();
@@ -556,11 +562,11 @@ class Xe {
556
562
  }
557
563
  process() {
558
564
  const { schema: e } = this.keySchema;
559
- return L(e) ? this.processEnum(e) : D(e) ? this.processInterface(e) : M(e) ? this.processArray(e) : b(e) ? this.processIntersection(e) : B(e) ? this.processComposition(e) : this.processTypeAlias(e);
565
+ return L(e) ? this.processEnum(e) : $(e) ? this.processInterface(e) : M(e) ? this.processArray(e) : b(e) ? this.processIntersection(e) : B(e) ? this.processComposition(e) : this.processTypeAlias(e);
560
566
  }
561
567
  resolveReference(e) {
562
- const t = $(e);
563
- return We(
568
+ const t = T(e);
569
+ return ke(
564
570
  this.modelInfo,
565
571
  this.sourceFile,
566
572
  this.outputDir,
@@ -574,7 +580,7 @@ class Xe {
574
580
  }
575
581
  resolvePropertyDefinitions(e) {
576
582
  const { properties: t } = e;
577
- return Object.entries(t).map(([o, r]) => {
583
+ return Object.entries(t).map(([n, r]) => {
578
584
  const i = this.resolveType(r);
579
585
  if (!g(r)) {
580
586
  const s = pe(r), a = ge(s, `
@@ -584,20 +590,20 @@ class Xe {
584
590
  /**
585
591
  * ${a}
586
592
  */
587
- ${o}: ${i}
593
+ ${n}: ${i}
588
594
  `;
589
595
  }
590
- return `${o}: ${i}`;
596
+ return `${n}: ${i}`;
591
597
  });
592
598
  }
593
599
  resolveObjectType(e) {
594
600
  const t = [];
595
- if (D(e)) {
601
+ if ($(e)) {
596
602
  const r = this.resolvePropertyDefinitions(e);
597
603
  t.push(...r);
598
604
  }
599
- const o = this.resolveAdditionalProperties(e);
600
- return o && t.push(o), t.length === 0 ? "Record<string, any>" : `{
605
+ const n = this.resolveAdditionalProperties(e);
606
+ return n && t.push(n), t.length === 0 ? "Record<string, any>" : `{
601
607
  ${t.join(`;
602
608
  `)};
603
609
  }`;
@@ -615,14 +621,14 @@ class Xe {
615
621
  if (L(e))
616
622
  return e.enum.map((t) => `'${t}'`).join(" | ");
617
623
  if (B(e)) {
618
- const o = (e.oneOf || e.anyOf || e.allOf || []).map((i) => this.resolveType(i)), r = b(e) ? " & " : " | ";
619
- return `(${o.join(r)})`;
624
+ const n = (e.oneOf || e.anyOf || e.allOf || []).map((i) => this.resolveType(i)), r = b(e) ? " & " : " | ";
625
+ return `(${n.join(r)})`;
620
626
  }
621
627
  if (M(e)) {
622
628
  const t = this.resolveType(e.items);
623
629
  return Se(t);
624
630
  }
625
- return e.type === "object" ? this.resolveObjectType(e) : e.type ? R(e.type) : "any";
631
+ return e.type === "object" ? this.resolveObjectType(e) : e.type ? w(e.type) : "any";
626
632
  }
627
633
  processEnum(e) {
628
634
  return this.sourceFile.addEnum({
@@ -634,21 +640,21 @@ class Xe {
634
640
  }))
635
641
  });
636
642
  }
637
- addPropertyToInterface(e, t, o) {
638
- const r = this.resolveType(o);
643
+ addPropertyToInterface(e, t, n) {
644
+ const r = this.resolveType(n);
639
645
  let i = e.getProperty(t);
640
646
  i ? i.setType(r) : i = e.addProperty({
641
647
  name: t,
642
648
  type: r,
643
- isReadonly: De(o)
644
- }), Q(i, o);
649
+ isReadonly: Oe(n)
650
+ }), Q(i, n);
645
651
  }
646
652
  processInterface(e) {
647
653
  const t = this.sourceFile.addInterface({
648
654
  name: this.modelInfo.name,
649
655
  isExported: !0
650
- }), o = e.properties || {};
651
- return Object.entries(o).forEach(([r, i]) => {
656
+ }), n = e.properties || {};
657
+ return Object.entries(n).forEach(([r, i]) => {
652
658
  this.addPropertyToInterface(t, r, i);
653
659
  }), e.additionalProperties && t.addIndexSignature({
654
660
  keyName: "key",
@@ -678,13 +684,13 @@ class Xe {
678
684
  name: this.modelInfo.name,
679
685
  isExported: !0
680
686
  });
681
- return e.allOf.forEach((o) => {
682
- if (g(o)) {
683
- const r = this.resolveType(o);
687
+ return e.allOf.forEach((n) => {
688
+ if (g(n)) {
689
+ const r = this.resolveType(n);
684
690
  t.addExtends(r);
685
691
  return;
686
692
  }
687
- D(o) && Object.entries(o.properties).forEach(
693
+ $(n) && Object.entries(n.properties).forEach(
688
694
  ([r, i]) => {
689
695
  this.addPropertyToInterface(
690
696
  t,
@@ -703,12 +709,12 @@ class Xe {
703
709
  });
704
710
  }
705
711
  }
706
- class Ze {
712
+ class et {
707
713
  constructor(e) {
708
714
  this.context = e;
709
715
  }
710
716
  getOrCreateSourceFile(e) {
711
- const t = _e(e);
717
+ const t = We(e);
712
718
  return this.context.getOrCreateSourceFile(t);
713
719
  }
714
720
  /**
@@ -725,29 +731,29 @@ class Ze {
725
731
  this.context.logger.info("No schemas found in OpenAPI specification");
726
732
  return;
727
733
  }
728
- const t = this.stateAggregatedTypeNames(), o = this.filterSchemas(e, t);
729
- this.context.logger.progress(`Generating models for ${o.length} schemas`), o.forEach((r, i) => {
734
+ const t = this.stateAggregatedTypeNames(), n = this.filterSchemas(e, t);
735
+ this.context.logger.progress(`Generating models for ${n.length} schemas`), n.forEach((r, i) => {
730
736
  this.context.logger.progressWithCount(
731
737
  i + 1,
732
- o.length,
738
+ n.length,
733
739
  `Processing schema: ${r.key}`,
734
740
  2
735
741
  ), this.generateKeyedSchema(r);
736
742
  }), this.context.logger.success("Model generation completed");
737
743
  }
738
744
  filterSchemas(e, t) {
739
- return Object.entries(e).map(([o, r]) => ({
740
- key: o,
745
+ return Object.entries(e).map(([n, r]) => ({
746
+ key: n,
741
747
  schema: r
742
- })).filter((o) => !this.isWowSchema(o.key, t));
748
+ })).filter((n) => !this.isWowSchema(n.key, t));
743
749
  }
744
750
  isWowSchema(e, t) {
745
751
  if (e !== "wow.api.query.PagedList" && e.startsWith("wow.api.query.") && e.endsWith("PagedList"))
746
752
  return !1;
747
753
  if (e.startsWith("wow.") || e.endsWith("AggregatedCondition") || e.endsWith("AggregatedDomainEventStream") || e.endsWith("AggregatedDomainEventStreamPagedList") || e.endsWith("AggregatedDomainEventStreamServerSentEventNonNullData") || e.endsWith("AggregatedListQuery") || e.endsWith("AggregatedPagedQuery") || e.endsWith("AggregatedSingleQuery"))
748
754
  return !0;
749
- const o = d(e);
750
- return t.has(o.name);
755
+ const n = m(e);
756
+ return t.has(n.name);
751
757
  }
752
758
  aggregatedSchemaSuffix = [
753
759
  "MaterializedSnapshot",
@@ -760,12 +766,12 @@ class Ze {
760
766
  ];
761
767
  stateAggregatedTypeNames() {
762
768
  const e = /* @__PURE__ */ new Set();
763
- for (const [t, o] of this.context.contextAggregates) {
769
+ for (const [t, n] of this.context.contextAggregates) {
764
770
  this.generateBoundedContext(t);
765
- for (const r of o)
771
+ for (const r of n)
766
772
  this.aggregatedSchemaSuffix.forEach(
767
773
  (i) => {
768
- const s = d(r.state.key), a = S(s.name) + i;
774
+ const s = m(r.state.key), a = R(s.name) + i;
769
775
  e.add(a);
770
776
  }
771
777
  );
@@ -785,19 +791,19 @@ class Ze {
785
791
  * 4. Type alias processing
786
792
  */
787
793
  generateKeyedSchema(e) {
788
- const t = d(e.key), o = this.getOrCreateSourceFile(t);
789
- new Xe(t, o, e, this.context.outputDir).generate();
794
+ const t = m(e.key), n = this.getOrCreateSourceFile(t);
795
+ new Ze(t, n, e, this.context.outputDir).generate();
790
796
  }
791
797
  generateBoundedContext(e) {
792
798
  const t = `${e}/boundedContext.ts`;
793
799
  this.context.logger.info(`Creating bounded context file: ${t}`);
794
- const o = this.context.getOrCreateSourceFile(t), r = w(e);
795
- o.addStatements(
800
+ const n = this.context.getOrCreateSourceFile(t), r = O(e);
801
+ n.addStatements(
796
802
  `export const ${r} = '${e}';`
797
803
  );
798
804
  }
799
805
  }
800
- const et = "@ahoo-wang/fetcher-decorator", tt = [
806
+ const tt = "@ahoo-wang/fetcher-decorator", nt = [
801
807
  "type ApiMetadata",
802
808
  "type ApiMetadataCapable",
803
809
  "type ParameterRequest",
@@ -811,7 +817,7 @@ const et = "@ahoo-wang/fetcher-decorator", tt = [
811
817
  "attribute",
812
818
  "path",
813
819
  "autoGeneratedError"
814
- ], nt = {
820
+ ], ot = {
815
821
  type: "Promise<Response>",
816
822
  metadata: "{resultExtractor: ResultExtractors.Response }"
817
823
  }, V = {
@@ -821,14 +827,14 @@ const et = "@ahoo-wang/fetcher-decorator", tt = [
821
827
  headers: { Accept: ContentTypeValues.TEXT_EVENT_STREAM },
822
828
  resultExtractor: JsonEventStreamResultExtractor,
823
829
  }`;
824
- function ue(n) {
825
- x(n, et, tt);
830
+ function ue(o) {
831
+ x(o, tt, nt);
826
832
  }
827
- function F(n, e, t = [], o = [], r) {
833
+ function F(o, e, t = [], n = [], r) {
828
834
  return e.addClass({
829
- name: n,
835
+ name: o,
830
836
  isExported: !0,
831
- typeParameters: o,
837
+ typeParameters: n,
832
838
  extends: r,
833
839
  decorators: [
834
840
  {
@@ -838,8 +844,8 @@ function F(n, e, t = [], o = [], r) {
838
844
  ]
839
845
  });
840
846
  }
841
- function le(n, e) {
842
- n.addImplements("ApiMetadataCapable"), n.addConstructor({
847
+ function le(o, e) {
848
+ o.addImplements("ApiMetadataCapable"), o.addConstructor({
843
849
  parameters: [
844
850
  {
845
851
  name: "apiMetadata",
@@ -852,54 +858,54 @@ function le(n, e) {
852
858
  ]
853
859
  });
854
860
  }
855
- const ot = "@ahoo-wang/fetcher-eventstream";
856
- function de(n) {
857
- x(n, ot, [
861
+ const rt = "@ahoo-wang/fetcher-eventstream";
862
+ function me(o) {
863
+ x(o, rt, [
858
864
  "JsonEventStreamResultExtractor",
859
865
  "type JsonServerSentEventStream"
860
866
  ]);
861
867
  }
862
- function rt(n) {
868
+ function it(o) {
863
869
  let e = 0, t = 0;
864
- return n.commands.forEach((o) => {
865
- o.path.startsWith(k.TENANT) && (e += 1), o.path.startsWith(k.OWNER) && (t += 1);
870
+ return o.commands.forEach((n) => {
871
+ n.path.startsWith(k.TENANT) && (e += 1), n.path.startsWith(k.OWNER) && (t += 1);
866
872
  }), e === 0 && t === 0 ? "ResourceAttributionPathSpec.NONE" : e > t ? "ResourceAttributionPathSpec.TENANT" : "ResourceAttributionPathSpec.OWNER";
867
873
  }
868
- function me(n, e, t, o) {
869
- const r = `${t.contextAlias}/${t.aggregateName}/${o}.ts`;
870
- return ce(n, e, r);
874
+ function de(o, e, t, n) {
875
+ const r = `${t.contextAlias}/${t.aggregateName}/${n}.ts`;
876
+ return ce(o, e, r);
871
877
  }
872
- function h(n, e) {
873
- return `${S(n.aggregateName)}${e}`;
878
+ function h(o, e) {
879
+ return `${R(o.aggregateName)}${e}`;
874
880
  }
875
- function j(n) {
876
- return n === "delete" ? "del" : n;
881
+ function j(o) {
882
+ return o === "delete" ? "del" : o;
877
883
  }
878
- const it = "x-fetcher-method";
879
- function st(n, e) {
880
- const t = n[it];
884
+ const st = "x-fetcher-method";
885
+ function at(o, e) {
886
+ const t = o[st];
881
887
  if (t)
882
888
  return t;
883
- if (!n.operationId)
889
+ if (!o.operationId)
884
890
  return;
885
- const o = N(n.operationId);
886
- for (let r = o.length - 1; r >= 0; r--) {
887
- const i = f(o.slice(r));
891
+ const n = N(o.operationId);
892
+ for (let r = n.length - 1; r >= 0; r--) {
893
+ const i = f(n.slice(r));
888
894
  if (!e(i))
889
895
  return i;
890
896
  }
891
- return f(o);
897
+ return f(n);
892
898
  }
893
- class at {
899
+ class ct {
894
900
  /**
895
901
  * Creates a new ApiClientGenerator instance.
896
902
  * @param context - The generation context containing OpenAPI spec and configuration
897
903
  */
898
904
  constructor(e) {
899
- this.context = e, this.apiMetadataCtorInitializer = this.context.currentContextAlias ? `{basePath:${w(this.context.currentContextAlias)}}` : void 0;
905
+ this.context = e, this.apiMetadataCtorInitializer = this.context.currentContextAlias ? `{basePath:${O(this.context.currentContextAlias)}}` : void 0;
900
906
  }
901
907
  defaultParameterRequestType = "ParameterRequest";
902
- defaultReturnType = nt;
908
+ defaultReturnType = ot;
903
909
  apiMetadataCtorInitializer;
904
910
  /**
905
911
  * Generates API client classes for all valid tags in the OpenAPI specification.
@@ -925,10 +931,10 @@ class at {
925
931
  this.context.logger.info(
926
932
  `Generating ${t.size} API client classes`
927
933
  );
928
- let o = 0;
934
+ let n = 0;
929
935
  for (const [r, i] of t) {
930
- o++, this.context.logger.progressWithCount(
931
- o,
936
+ n++, this.context.logger.progressWithCount(
937
+ n,
932
938
  t.size,
933
939
  `Generating API client for tag: ${r}`
934
940
  );
@@ -943,7 +949,7 @@ class at {
943
949
  */
944
950
  createApiClientFile(e) {
945
951
  let t = e.path;
946
- 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);
952
+ return this.context.currentContextAlias && (t = I(this.context.currentContextAlias, t)), t = I(t, `${e.name}ApiClient.ts`), this.context.logger.info(`Creating API client file: ${t}`), this.context.getOrCreateSourceFile(t);
947
953
  }
948
954
  /**
949
955
  * Generates a single API client class for the given tag and operations.
@@ -951,22 +957,22 @@ class at {
951
957
  * @param operations - Set of operations for this client
952
958
  */
953
959
  generateApiClient(e, t) {
954
- const o = d(e.name);
960
+ const n = m(e.name);
955
961
  this.context.logger.info(
956
- `Generating API client class: ${o.name}ApiClient with ${t.size} operations`
962
+ `Generating API client class: ${n.name}ApiClient with ${t.size} operations`
957
963
  );
958
- const r = this.createApiClientFile(o);
959
- ue(r), de(r);
964
+ const r = this.createApiClientFile(n);
965
+ ue(r), me(r);
960
966
  const i = F(
961
- o.name + "ApiClient",
967
+ n.name + "ApiClient",
962
968
  r
963
969
  );
964
- E(i, [e.description]), le(i, this.apiMetadataCtorInitializer), this.context.logger.info(
965
- `Processing ${t.size} operations for ${o.name}ApiClient`
970
+ S(i, [e.description]), le(i, this.apiMetadataCtorInitializer), this.context.logger.info(
971
+ `Processing ${t.size} operations for ${n.name}ApiClient`
966
972
  ), t.forEach((s) => {
967
973
  this.processOperation(e, r, i, s);
968
974
  }), this.context.logger.success(
969
- `Completed API client: ${o.name}ApiClient`
975
+ `Completed API client: ${n.name}ApiClient`
970
976
  );
971
977
  }
972
978
  /**
@@ -976,10 +982,10 @@ class at {
976
982
  * @returns A unique camelCase method name
977
983
  */
978
984
  getMethodName(e, t) {
979
- const o = st(t, (r) => e.getMethod(r) !== void 0);
980
- if (!o)
985
+ const n = at(t, (r) => e.getMethod(r) !== void 0);
986
+ if (!n)
981
987
  throw new Error(`Unable to resolve method name for apiClientClass:${e.getName()}.`);
982
- return o;
988
+ return n;
983
989
  }
984
990
  /**
985
991
  * Resolves the request type for an operation based on its request body.
@@ -992,27 +998,27 @@ class at {
992
998
  return this.context.logger.info(
993
999
  `No request body found for operation ${t.operationId}, using default: ${this.defaultParameterRequestType}`
994
1000
  ), this.defaultParameterRequestType;
995
- let o;
1001
+ let n;
996
1002
  if (g(t.requestBody) ? (this.context.logger.info(
997
1003
  `Extracting request body from reference for operation: ${t.operationId}`
998
- ), o = K(
1004
+ ), n = K(
999
1005
  t.requestBody,
1000
1006
  this.context.openAPI.components
1001
- )) : o = t.requestBody, !o)
1007
+ )) : n = t.requestBody, !n)
1002
1008
  return this.context.logger.info(
1003
1009
  `Request body extraction failed for operation ${t.operationId}, using default: ${this.defaultParameterRequestType}`
1004
1010
  ), this.defaultParameterRequestType;
1005
- if (o.content["multipart/form-data"])
1011
+ if (n.content["multipart/form-data"])
1006
1012
  return this.context.logger.info(
1007
1013
  `Detected multipart/form-data content for operation ${t.operationId}, using ParameterRequest<FormData>`
1008
1014
  ), "ParameterRequest<FormData>";
1009
- if (o.content["application/json"]) {
1010
- const r = o.content["application/json"].schema;
1015
+ if (n.content["application/json"]) {
1016
+ const r = n.content["application/json"].schema;
1011
1017
  if (g(r)) {
1012
- const i = $(r);
1018
+ const i = T(r);
1013
1019
  this.context.logger.info(
1014
1020
  `Adding import for request body model: ${i.name} from ${i.path}`
1015
- ), m(e, this.context.outputDir, i);
1021
+ ), d(e, this.context.outputDir, i);
1016
1022
  const s = `ParameterRequest<${i.name}>`;
1017
1023
  return this.context.logger.info(
1018
1024
  `Resolved request type for operation ${t.operationId}: ${s}`
@@ -1030,13 +1036,13 @@ class at {
1030
1036
  * @param operation - The operation to resolve parameters for
1031
1037
  * @returns Array of parameter declarations
1032
1038
  */
1033
- resolveParameters(e, t, o) {
1034
- const r = Ne(o, this.context.openAPI.components).filter((a) => !this.context.isIgnoreApiClientPathParameters(
1039
+ resolveParameters(e, t, n) {
1040
+ const r = Me(n, this.context.openAPI.components).filter((a) => !this.context.isIgnoreApiClientPathParameters(
1035
1041
  e.name,
1036
1042
  a.name
1037
1043
  ));
1038
1044
  this.context.logger.info(
1039
- `Found ${r.length} path parameters for operation ${o.operationId}`
1045
+ `Found ${r.length} path parameters for operation ${n.operationId}`
1040
1046
  );
1041
1047
  const i = r.map((a) => {
1042
1048
  const c = re(a);
@@ -1053,7 +1059,7 @@ class at {
1053
1059
  }
1054
1060
  ]
1055
1061
  };
1056
- }), s = this.resolveRequestType(t, o);
1062
+ }), s = this.resolveRequestType(t, n);
1057
1063
  return this.context.logger.info(`Adding httpRequest parameter: ${s}`), i.push({
1058
1064
  name: "httpRequest",
1059
1065
  hasQuestionToken: s === this.defaultParameterRequestType,
@@ -1085,26 +1091,26 @@ class at {
1085
1091
  * @returns The resolved return type string
1086
1092
  */
1087
1093
  resolveSchemaReturnType(e, t) {
1088
- const o = "Promise<any>";
1094
+ const n = "Promise<any>";
1089
1095
  if (g(t)) {
1090
- const r = $(t);
1096
+ const r = T(t);
1091
1097
  this.context.logger.info(
1092
1098
  `Adding import for response model: ${r.name} from ${r.path}`
1093
- ), m(e, this.context.outputDir, r);
1099
+ ), d(e, this.context.outputDir, r);
1094
1100
  const i = `Promise<${r.name}>`;
1095
1101
  return this.context.logger.info(`Resolved reference return type: ${i}`), i;
1096
1102
  }
1097
1103
  if (!t.type)
1098
1104
  return this.context.logger.info(
1099
- `Schema has no type, using default return type: ${o}`
1100
- ), o;
1105
+ `Schema has no type, using default return type: ${n}`
1106
+ ), n;
1101
1107
  if (te(t.type)) {
1102
- const i = `Promise<${R(t.type)}>`;
1108
+ const i = `Promise<${w(t.type)}>`;
1103
1109
  return this.context.logger.info(`Resolved primitive return type: ${i}`), i;
1104
1110
  }
1105
1111
  return this.context.logger.info(
1106
- `Using default return type: ${o}`
1107
- ), o;
1112
+ `Using default return type: ${n}`
1113
+ ), n;
1108
1114
  }
1109
1115
  /**
1110
1116
  * Resolves the return type for an operation based on its responses.
@@ -1113,12 +1119,12 @@ class at {
1113
1119
  * @returns Object containing type and optional stream flag
1114
1120
  */
1115
1121
  resolveReturnType(e, t) {
1116
- const o = _(t);
1117
- if (!o)
1122
+ const n = _(t);
1123
+ if (!n)
1118
1124
  return this.context.logger.info(
1119
1125
  `No OK response found for operation ${t.operationId}, using default return type: ${this.defaultReturnType.type}`
1120
1126
  ), this.defaultReturnType;
1121
- const r = ee(o) || Te(o);
1127
+ const r = ee(n) || Te(n);
1122
1128
  if (r) {
1123
1129
  const s = this.resolveSchemaReturnType(e, r);
1124
1130
  return this.context.logger.info(
@@ -1128,18 +1134,18 @@ class at {
1128
1134
  metadata: s === V.type ? V.metadata : void 0
1129
1135
  };
1130
1136
  }
1131
- const i = $e(o);
1137
+ const i = $e(n);
1132
1138
  if (i) {
1133
1139
  if (g(i)) {
1134
- const a = I(
1140
+ const a = E(
1135
1141
  i,
1136
1142
  this.context.openAPI.components
1137
1143
  );
1138
1144
  if (M(a) && g(a.items)) {
1139
- const c = $(a.items);
1145
+ const c = T(a.items);
1140
1146
  this.context.logger.info(
1141
1147
  `Adding import for event stream model: ${c.name} from ${c.path}`
1142
- ), m(e, this.context.outputDir, c);
1148
+ ), d(e, this.context.outputDir, c);
1143
1149
  const p = `Promise<JsonServerSentEventStream<${c.name.includes("ServerSentEvent") ? `${c.name}['data']` : c.name}>>`;
1144
1150
  return this.context.logger.info(
1145
1151
  `Resolved event stream return type for operation ${t.operationId}: ${p}`
@@ -1165,11 +1171,11 @@ class at {
1165
1171
  * @param apiClientClass - The client class to add the method to
1166
1172
  * @param operation - The operation to process
1167
1173
  */
1168
- processOperation(e, t, o, r) {
1174
+ processOperation(e, t, n, r) {
1169
1175
  this.context.logger.info(
1170
1176
  `Processing operation: ${r.operation.operationId} (${r.method} ${r.path})`
1171
1177
  );
1172
- const i = this.getMethodName(o, r.operation);
1178
+ const i = this.getMethodName(n, r.operation);
1173
1179
  this.context.logger.info(`Generated method name: ${i}`);
1174
1180
  const s = this.resolveParameters(
1175
1181
  e,
@@ -1185,7 +1191,7 @@ class at {
1185
1191
  this.context.logger.info(
1186
1192
  `Creating method with ${s.length} parameters, return type: ${a.type}`
1187
1193
  );
1188
- const u = o.addMethod({
1194
+ const u = n.addMethod({
1189
1195
  name: i,
1190
1196
  decorators: [c],
1191
1197
  parameters: s,
@@ -1194,7 +1200,7 @@ class at {
1194
1200
  `throw autoGeneratedError(${s.map((p) => p.name).join(",")});`
1195
1201
  ]
1196
1202
  });
1197
- E(
1203
+ S(
1198
1204
  u,
1199
1205
  [
1200
1206
  r.operation.summary,
@@ -1211,7 +1217,7 @@ class at {
1211
1217
  */
1212
1218
  groupOperations(e) {
1213
1219
  this.context.logger.info("Grouping operations by API client tags");
1214
- const t = /* @__PURE__ */ new Map(), o = ne(this.context.openAPI.paths).filter(
1220
+ const t = /* @__PURE__ */ new Map(), n = ne(this.context.openAPI.paths).filter(
1215
1221
  (i) => {
1216
1222
  if (!i.operation.operationId)
1217
1223
  return !1;
@@ -1220,7 +1226,7 @@ class at {
1220
1226
  }
1221
1227
  );
1222
1228
  let r = 0;
1223
- for (const i of o)
1229
+ for (const i of n)
1224
1230
  i.operation.tags.forEach((s) => {
1225
1231
  t.has(s) || t.set(s, /* @__PURE__ */ new Set()), t.get(s).add(i), r++;
1226
1232
  });
@@ -1250,24 +1256,24 @@ class at {
1250
1256
  });
1251
1257
  });
1252
1258
  });
1253
- let o = 0;
1259
+ let n = 0;
1254
1260
  return this.context.openAPI.tags?.forEach((r) => {
1255
1261
  this.shouldIgnoreTag(r.name) ? this.context.logger.info(
1256
1262
  `Excluded tag: ${r.name} (wow/Actuator/aggregate)`
1257
- ) : (e.set(r.name, r), o++, this.context.logger.info(`Included API client tag: ${r.name}`));
1263
+ ) : (e.set(r.name, r), n++, this.context.logger.info(`Included API client tag: ${r.name}`));
1258
1264
  }), this.context.logger.info(
1259
- `Resolved ${o} API client tags from ${t} total tags`
1265
+ `Resolved ${n} API client tags from ${t} total tags`
1260
1266
  ), e;
1261
1267
  }
1262
1268
  isAggregateTag(e) {
1263
1269
  for (const t of this.context.contextAggregates.values())
1264
- for (const o of t)
1265
- if (o.aggregate.tag.name === e)
1270
+ for (const n of t)
1271
+ if (n.aggregate.tag.name === e)
1266
1272
  return !0;
1267
1273
  return !1;
1268
1274
  }
1269
1275
  }
1270
- class ct {
1276
+ class gt {
1271
1277
  /**
1272
1278
  * Creates a new CommandClientGenerator instance.
1273
1279
  * @param context - The generation context containing OpenAPI spec and project details
@@ -1283,13 +1289,13 @@ class ct {
1283
1289
  generate() {
1284
1290
  const e = Array.from(
1285
1291
  this.context.contextAggregates.values()
1286
- ).reduce((o, r) => o + r.size, 0);
1292
+ ).reduce((n, r) => n + r.size, 0);
1287
1293
  this.context.logger.info("--- Generating Command Clients ---"), this.context.logger.progress(
1288
1294
  `Generating command clients for ${e} aggregates`
1289
1295
  );
1290
1296
  let t = 0;
1291
- for (const [, o] of this.context.contextAggregates)
1292
- o.forEach((r) => {
1297
+ for (const [, n] of this.context.contextAggregates)
1298
+ n.forEach((r) => {
1293
1299
  t++, this.context.logger.progressWithCount(
1294
1300
  t,
1295
1301
  e,
@@ -1306,7 +1312,7 @@ class ct {
1306
1312
  this.context.logger.info(
1307
1313
  `Processing command client for aggregate: ${e.aggregate.aggregateName} in context: ${e.aggregate.contextAlias}`
1308
1314
  );
1309
- const t = me(
1315
+ const t = de(
1310
1316
  this.context.project,
1311
1317
  this.context.outputDir,
1312
1318
  e.aggregate,
@@ -1315,17 +1321,17 @@ class ct {
1315
1321
  this.context.logger.info(
1316
1322
  `Processing command endpoint paths for ${e.commands.size} commands`
1317
1323
  );
1318
- const o = this.processCommandEndpointPaths(t, e);
1319
- this.context.logger.info(
1324
+ const n = this.processCommandEndpointPaths(t, e);
1325
+ this.processCommandTypes(t, e), this.context.logger.info(
1320
1326
  `Creating default command client options: ${this.defaultCommandClientOptionsName}`
1321
1327
  ), t.addVariableStatement({
1322
- declarationKind: O.Const,
1328
+ declarationKind: D.Const,
1323
1329
  declarations: [
1324
1330
  {
1325
1331
  name: this.defaultCommandClientOptionsName,
1326
1332
  type: "ApiMetadata",
1327
1333
  initializer: `{
1328
- basePath: ${w(e.aggregate.contextAlias)}
1334
+ basePath: ${O(e.aggregate.contextAlias)}
1329
1335
  }`
1330
1336
  }
1331
1337
  ],
@@ -1344,11 +1350,11 @@ class ct {
1344
1350
  isTypeOnly: !0
1345
1351
  }), this.context.logger.info(
1346
1352
  "Adding import from @ahoo-wang/fetcher-eventstream: JsonEventStreamResultExtractor"
1347
- ), de(t), this.context.logger.info(
1353
+ ), me(t), this.context.logger.info(
1348
1354
  "Adding import from @ahoo-wang/fetcher: ContentTypeValues"
1349
1355
  ), x(t, "@ahoo-wang/fetcher", ["ContentTypeValues"]), this.context.logger.info(
1350
1356
  "Adding imports from @ahoo-wang/fetcher-decorator: ApiMetadata types and decorators"
1351
- ), ue(t), this.context.logger.info("Generating standard command client class"), this.processCommandClient(t, e, o), this.context.logger.info("Generating stream command client class"), this.processStreamCommandClient(t, e), this.context.logger.success(
1357
+ ), ue(t), this.context.logger.info("Generating standard command client class"), this.processCommandClient(t, e, n), this.context.logger.info("Generating stream command client class"), this.processStreamCommandClient(t, e), this.context.logger.success(
1352
1358
  `Command client generation completed for aggregate: ${e.aggregate.aggregateName}`
1353
1359
  );
1354
1360
  }
@@ -1356,14 +1362,14 @@ class ct {
1356
1362
  return h(e, this.commandEndpointPathsSuffix);
1357
1363
  }
1358
1364
  processCommandEndpointPaths(e, t) {
1359
- const o = this.resolveAggregateCommandEndpointPathsName(
1365
+ const n = this.resolveAggregateCommandEndpointPathsName(
1360
1366
  t.aggregate
1361
1367
  );
1362
1368
  this.context.logger.info(
1363
- `Creating command endpoint paths enum: ${o}`
1369
+ `Creating command endpoint paths enum: ${n}`
1364
1370
  );
1365
1371
  const r = e.addEnum({
1366
- name: o,
1372
+ name: n,
1367
1373
  isExported: !0
1368
1374
  });
1369
1375
  return t.commands.forEach((i) => {
@@ -1375,12 +1381,32 @@ class ct {
1375
1381
  });
1376
1382
  }), this.context.logger.success(
1377
1383
  `Command endpoint paths enum created with ${t.commands.size} entries`
1378
- ), o;
1384
+ ), n;
1385
+ }
1386
+ resolveCommandTypeName(e) {
1387
+ const t = m(e.schema.key);
1388
+ return [t, t.name + "Command"];
1389
+ }
1390
+ resolveCommandType(e, t) {
1391
+ const [n, r] = this.resolveCommandTypeName(t);
1392
+ d(e, this.context.outputDir, n);
1393
+ let i = `${n.name}`;
1394
+ const s = De(t.schema.schema).map((a) => `'${a}'`).join(" | ");
1395
+ s !== "" && (i = `PartialBy<${i},${s}>`), i = `RemoveReadonlyFields<${i}>`, e.addTypeAlias({
1396
+ name: r,
1397
+ type: `${i}`,
1398
+ isExported: !0
1399
+ });
1400
+ }
1401
+ processCommandTypes(e, t) {
1402
+ t.commands.forEach((n) => {
1403
+ this.resolveCommandType(e, n);
1404
+ });
1379
1405
  }
1380
1406
  getEndpointPath(e, t) {
1381
1407
  return `${e}.${t.name.toUpperCase()}`;
1382
1408
  }
1383
- processCommandClient(e, t, o) {
1409
+ processCommandClient(e, t, n) {
1384
1410
  const r = h(
1385
1411
  t.aggregate,
1386
1412
  "CommandClient"
@@ -1393,15 +1419,14 @@ class ct {
1393
1419
  le(i, this.defaultCommandClientOptionsName), t.commands.forEach((s) => {
1394
1420
  this.processCommandMethod(
1395
1421
  t,
1396
- e,
1397
1422
  i,
1398
1423
  s,
1399
- o
1424
+ n
1400
1425
  );
1401
1426
  });
1402
1427
  }
1403
1428
  processStreamCommandClient(e, t) {
1404
- const o = h(
1429
+ const n = h(
1405
1430
  t.aggregate,
1406
1431
  "CommandClient"
1407
1432
  ), r = h(
@@ -1413,7 +1438,7 @@ class ct {
1413
1438
  e,
1414
1439
  ["''", q],
1415
1440
  [],
1416
- `${o}<CommandResultEventStream>`
1441
+ `${n}<CommandResultEventStream>`
1417
1442
  ).addConstructor({
1418
1443
  parameters: [
1419
1444
  {
@@ -1425,12 +1450,12 @@ class ct {
1425
1450
  statements: "super(apiMetadata);"
1426
1451
  });
1427
1452
  }
1428
- resolveParameters(e, t, o) {
1429
- const r = d(o.schema.key);
1453
+ resolveParameters(e, t) {
1454
+ const [n, r] = this.resolveCommandTypeName(t);
1430
1455
  this.context.logger.info(
1431
- `Adding import for command model: ${r.name} from path: ${r.path}`
1432
- ), m(t, this.context.outputDir, r);
1433
- const i = o.pathParameters.filter((s) => !this.context.isIgnoreCommandClientPathParameters(
1456
+ `Adding import for command model: ${n.name} from path: ${n.path}`
1457
+ );
1458
+ const i = t.pathParameters.filter((s) => !this.context.isIgnoreCommandClientPathParameters(
1434
1459
  e.name,
1435
1460
  s.name
1436
1461
  )).map((s) => {
@@ -1450,11 +1475,11 @@ class ct {
1450
1475
  };
1451
1476
  });
1452
1477
  return this.context.logger.info(
1453
- `Adding command request parameter: commandRequest (type: CommandRequest<${r.name}>)`
1478
+ `Adding command request parameter: commandRequest (type: CommandRequest<${r}>)`
1454
1479
  ), i.push({
1455
1480
  name: "commandRequest",
1456
- hasQuestionToken: we(o.schema.schema),
1457
- type: `CommandRequest<${r.name}>`,
1481
+ hasQuestionToken: we(t.schema.schema),
1482
+ type: `CommandRequest<${r}>`,
1458
1483
  decorators: [
1459
1484
  {
1460
1485
  name: "request",
@@ -1475,41 +1500,40 @@ class ct {
1475
1500
  ]
1476
1501
  }), i;
1477
1502
  }
1478
- processCommandMethod(e, t, o, r, i) {
1503
+ processCommandMethod(e, t, n, r) {
1479
1504
  this.context.logger.info(
1480
- `Generating command method: ${f(r.name)} for command: ${r.name}`
1505
+ `Generating command method: ${f(n.name)} for command: ${n.name}`
1481
1506
  ), this.context.logger.info(
1482
- `Command method details: HTTP ${r.method}, path: ${r.path}`
1507
+ `Command method details: HTTP ${n.method}, path: ${n.path}`
1483
1508
  );
1484
- const s = this.resolveParameters(
1509
+ const i = this.resolveParameters(
1485
1510
  e.aggregate.tag,
1486
- t,
1487
- r
1488
- ), a = o.addMethod({
1489
- name: f(r.name),
1511
+ n
1512
+ ), s = t.addMethod({
1513
+ name: f(n.name),
1490
1514
  decorators: [
1491
1515
  {
1492
- name: j(r.method),
1493
- arguments: [`${this.getEndpointPath(i, r)}`]
1516
+ name: j(n.method),
1517
+ arguments: [`${this.getEndpointPath(r, n)}`]
1494
1518
  }
1495
1519
  ],
1496
- parameters: s,
1520
+ parameters: i,
1497
1521
  returnType: "Promise<R>",
1498
- statements: `throw autoGeneratedError(${s.map((c) => c.name).join(",")});`
1522
+ statements: `throw autoGeneratedError(${i.map((a) => a.name).join(",")});`
1499
1523
  });
1500
1524
  this.context.logger.info(
1501
- `Adding JSDoc documentation for method: ${f(r.name)}`
1502
- ), E(a, [
1503
- r.summary,
1504
- r.description,
1505
- `- operationId: \`${r.operation.operationId}\``,
1506
- `- path: \`${r.path}\``
1525
+ `Adding JSDoc documentation for method: ${f(n.name)}`
1526
+ ), S(s, [
1527
+ n.summary,
1528
+ n.description,
1529
+ `- operationId: \`${n.operation.operationId}\``,
1530
+ `- path: \`${n.path}\``
1507
1531
  ]), this.context.logger.success(
1508
- `Command method generated: ${f(r.name)}`
1532
+ `Command method generated: ${f(n.name)}`
1509
1533
  );
1510
1534
  }
1511
1535
  }
1512
- class gt {
1536
+ class pt {
1513
1537
  /**
1514
1538
  * Creates a new QueryClientGenerator instance.
1515
1539
  * @param context - The generation context containing OpenAPI spec and project details
@@ -1524,15 +1548,15 @@ class gt {
1524
1548
  */
1525
1549
  generate() {
1526
1550
  const e = Array.from(this.context.contextAggregates.values()).reduce(
1527
- (o, r) => o + r.size,
1551
+ (n, r) => n + r.size,
1528
1552
  0
1529
1553
  );
1530
1554
  this.context.logger.info("--- Generating Query Clients ---"), this.context.logger.progress(
1531
1555
  `Generating query clients for ${e} aggregates`
1532
1556
  );
1533
1557
  let t = 0;
1534
- for (const [, o] of this.context.contextAggregates)
1535
- o.forEach((r) => {
1558
+ for (const [, n] of this.context.contextAggregates)
1559
+ n.forEach((r) => {
1536
1560
  t++, this.context.logger.progressWithCount(
1537
1561
  t,
1538
1562
  e,
@@ -1548,7 +1572,7 @@ class gt {
1548
1572
  * @returns The source file for the client
1549
1573
  */
1550
1574
  createClientFilePath(e, t) {
1551
- return me(
1575
+ return de(
1552
1576
  this.context.project,
1553
1577
  this.context.outputDir,
1554
1578
  e,
@@ -1576,35 +1600,35 @@ class gt {
1576
1600
  "ResourceAttributionPathSpec"
1577
1601
  ]
1578
1602
  });
1579
- const o = "DEFAULT_QUERY_CLIENT_OPTIONS";
1603
+ const n = "DEFAULT_QUERY_CLIENT_OPTIONS";
1580
1604
  this.context.logger.info(
1581
- `Creating default query client options: ${o}`
1605
+ `Creating default query client options: ${n}`
1582
1606
  ), t.addVariableStatement({
1583
- declarationKind: O.Const,
1607
+ declarationKind: D.Const,
1584
1608
  declarations: [
1585
1609
  {
1586
- name: o,
1610
+ name: n,
1587
1611
  type: "QueryClientOptions",
1588
1612
  initializer: `{
1589
- contextAlias: ${w(e.aggregate.contextAlias)},
1613
+ contextAlias: ${O(e.aggregate.contextAlias)},
1590
1614
  aggregateName: '${e.aggregate.aggregateName}',
1591
- resourceAttribution: ${rt(e)},
1615
+ resourceAttribution: ${it(e)},
1592
1616
  }`
1593
1617
  }
1594
1618
  ],
1595
1619
  isExported: !1
1596
1620
  }), this.processAggregateDomainEventTypes(e, t);
1597
- const r = this.processAggregateDomainEventType(e, t), i = `${f(e.aggregate.aggregateName)}QueryClientFactory`, s = d(e.state.key), a = d(e.fields.key);
1621
+ const r = this.processAggregateDomainEventType(e, t), i = `${f(e.aggregate.aggregateName)}QueryClientFactory`, s = m(e.state.key), a = m(e.fields.key);
1598
1622
  this.context.logger.info(
1599
1623
  `Adding import for state model: ${s.name} from path: ${s.path}`
1600
- ), m(t, this.context.outputDir, s), this.context.logger.info(
1624
+ ), d(t, this.context.outputDir, s), this.context.logger.info(
1601
1625
  `Adding import for fields model: ${a.name} from path: ${a.path}`
1602
- ), m(t, this.context.outputDir, a), this.context.logger.info(`Creating query client factory: ${i}`), t.addVariableStatement({
1603
- declarationKind: O.Const,
1626
+ ), d(t, this.context.outputDir, a), this.context.logger.info(`Creating query client factory: ${i}`), t.addVariableStatement({
1627
+ declarationKind: D.Const,
1604
1628
  declarations: [
1605
1629
  {
1606
1630
  name: i,
1607
- initializer: `new QueryClientFactory<${s.name}, ${a.name} | string, ${r}>(${o})`
1631
+ initializer: `new QueryClientFactory<${s.name}, ${a.name} | string, ${r}>(${n})`
1608
1632
  }
1609
1633
  ],
1610
1634
  isExported: !0
@@ -1613,17 +1637,17 @@ class gt {
1613
1637
  );
1614
1638
  }
1615
1639
  processAggregateDomainEventType(e, t) {
1616
- const o = [];
1640
+ const n = [];
1617
1641
  this.context.logger.info(
1618
1642
  `Processing ${e.events.size} domain events for aggregate: ${e.aggregate.aggregateName}`
1619
1643
  );
1620
1644
  for (const s of e.events.values()) {
1621
- const a = d(s.schema.key);
1645
+ const a = m(s.schema.key);
1622
1646
  this.context.logger.info(
1623
1647
  `Adding import for event model: ${a.name} from path: ${a.path}`
1624
- ), m(t, this.context.outputDir, a), o.push(a);
1648
+ ), d(t, this.context.outputDir, a), n.push(a);
1625
1649
  }
1626
- const r = h(e.aggregate, this.domainEventTypeSuffix), i = o.map((s) => s.name).join(" | ");
1650
+ const r = h(e.aggregate, this.domainEventTypeSuffix), i = n.map((s) => s.name).join(" | ");
1627
1651
  return this.context.logger.info(
1628
1652
  `Creating domain event types union: ${r} = ${i}`
1629
1653
  ), t.addTypeAlias({
@@ -1633,8 +1657,8 @@ class gt {
1633
1657
  }), r;
1634
1658
  }
1635
1659
  processAggregateDomainEventTypes(e, t) {
1636
- const o = h(e.aggregate, this.domainEventTypeMapTitleSuffix), r = t.addEnum({
1637
- name: o,
1660
+ const n = h(e.aggregate, this.domainEventTypeMapTitleSuffix), r = t.addEnum({
1661
+ name: n,
1638
1662
  isExported: !0
1639
1663
  });
1640
1664
  for (const i of e.events.values())
@@ -1644,13 +1668,13 @@ class gt {
1644
1668
  });
1645
1669
  }
1646
1670
  }
1647
- class pt {
1671
+ class ut {
1648
1672
  /**
1649
1673
  * Creates a new ClientGenerator instance.
1650
1674
  * @param context - The generation context containing OpenAPI spec and project details
1651
1675
  */
1652
1676
  constructor(e) {
1653
- this.context = e, this.queryClientGenerator = new gt(e), this.commandClientGenerator = new ct(e), this.apiClientGenerator = new at(e);
1677
+ this.context = e, this.queryClientGenerator = new pt(e), this.commandClientGenerator = new gt(e), this.apiClientGenerator = new ct(e);
1654
1678
  }
1655
1679
  queryClientGenerator;
1656
1680
  commandClientGenerator;
@@ -1673,7 +1697,7 @@ class pt {
1673
1697
  this.queryClientGenerator.generate(), this.commandClientGenerator.generate(), this.apiClientGenerator.generate(), this.context.logger.success("Client generation completed");
1674
1698
  }
1675
1699
  }
1676
- class ut {
1700
+ class lt {
1677
1701
  /** The ts-morph project instance used for code generation */
1678
1702
  project;
1679
1703
  /** The OpenAPI specification object */
@@ -1700,8 +1724,8 @@ class ut {
1700
1724
  return this.defaultIgnorePathParameters.includes(t);
1701
1725
  }
1702
1726
  }
1703
- const lt = "./fetcher-generator.config.json";
1704
- class At {
1727
+ const mt = "./fetcher-generator.config.json";
1728
+ class Ct {
1705
1729
  /**
1706
1730
  * Creates a new CodeGenerator instance with the specified options.
1707
1731
  *
@@ -1737,28 +1761,28 @@ class At {
1737
1761
  this.options.logger.info(
1738
1762
  "Starting code generation from OpenAPI specification"
1739
1763
  ), 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");
1740
- const e = await Fe(this.options.inputPath);
1764
+ const e = await je(this.options.inputPath);
1741
1765
  this.options.logger.info("OpenAPI specification parsed successfully"), this.options.logger.info("Resolving bounded context aggregates");
1742
- const o = new Ke(e).resolve();
1766
+ const n = new Ye(e).resolve();
1743
1767
  this.options.logger.info(
1744
- `Resolved ${o.size} bounded context aggregates`
1768
+ `Resolved ${n.size} bounded context aggregates`
1745
1769
  );
1746
- const r = this.options.configPath ?? lt;
1770
+ const r = this.options.configPath ?? mt;
1747
1771
  let i = {};
1748
1772
  try {
1749
- this.options.logger.info(`Parsing configuration file: ${r}`), i = await je(r);
1773
+ this.options.logger.info(`Parsing configuration file: ${r}`), i = await Ge(r);
1750
1774
  } catch (p) {
1751
1775
  this.options.logger.info(`Configuration file parsing failed: ${p}`);
1752
1776
  }
1753
- const s = new ut({
1777
+ const s = new lt({
1754
1778
  openAPI: e,
1755
1779
  project: this.project,
1756
1780
  outputDir: this.options.outputDir,
1757
- contextAggregates: o,
1781
+ contextAggregates: n,
1758
1782
  logger: this.options.logger,
1759
1783
  config: i
1760
1784
  });
1761
- this.options.logger.info("Generating models"), new Ze(s).generate(), this.options.logger.info("Models generated successfully"), this.options.logger.info("Generating clients"), new pt(s).generate(), this.options.logger.info("Clients generated successfully");
1785
+ this.options.logger.info("Generating models"), new et(s).generate(), this.options.logger.info("Models generated successfully"), this.options.logger.info("Generating clients"), new ut(s).generate(), this.options.logger.info("Clients generated successfully");
1762
1786
  const u = this.project.getDirectory(this.options.outputDir);
1763
1787
  if (!u) {
1764
1788
  this.options.logger.info("Output directory not found.");
@@ -1791,8 +1815,8 @@ class At {
1791
1815
  processDirectory(e) {
1792
1816
  const t = e.getDirectories();
1793
1817
  this.options.logger.info(`Processing ${t.length} subdirectories`);
1794
- for (const o of t)
1795
- this.options.logger.info(`Processing subdirectory: ${o.getPath()}`), this.generateIndexForDirectory(o), this.processDirectory(o);
1818
+ for (const n of t)
1819
+ this.options.logger.info(`Processing subdirectory: ${n.getPath()}`), this.generateIndexForDirectory(n), this.processDirectory(n);
1796
1820
  }
1797
1821
  /**
1798
1822
  * Generates an index.ts file for a specific directory.
@@ -1804,12 +1828,12 @@ class At {
1804
1828
  generateIndexForDirectory(e) {
1805
1829
  const t = e.getPath();
1806
1830
  this.options.logger.info(`Generating index for directory: ${t}`);
1807
- const o = e.getSourceFiles().filter(
1831
+ const n = e.getSourceFiles().filter(
1808
1832
  (a) => a.getBaseName().endsWith(".ts") && a.getBaseName() !== "index.ts"
1809
1833
  ), r = e.getDirectories();
1810
1834
  if (this.options.logger.info(
1811
- `Found ${o.length} TypeScript files and ${r.length} subdirectories in ${t}`
1812
- ), o.length === 0 && r.length === 0) {
1835
+ `Found ${n.length} TypeScript files and ${r.length} subdirectories in ${t}`
1836
+ ), n.length === 0 && r.length === 0) {
1813
1837
  this.options.logger.info(
1814
1838
  `No files or subdirectories to export in ${t}, skipping index generation`
1815
1839
  );
@@ -1817,7 +1841,7 @@ class At {
1817
1841
  }
1818
1842
  const i = `${t}/index.ts`, s = this.project.getSourceFile(i) || this.project.createSourceFile(i, "", { overwrite: !0 });
1819
1843
  s.removeText();
1820
- for (const a of o) {
1844
+ for (const a of n) {
1821
1845
  const c = `./${a.getBaseNameWithoutExtension()}`;
1822
1846
  s.addExportDeclaration({
1823
1847
  moduleSpecifier: c,
@@ -1834,7 +1858,7 @@ class At {
1834
1858
  });
1835
1859
  }
1836
1860
  this.options.logger.info(
1837
- `Index file generated for ${t} with ${o.length + r.length} exports`
1861
+ `Index file generated for ${t} with ${n.length + r.length} exports`
1838
1862
  );
1839
1863
  }
1840
1864
  /**
@@ -1847,15 +1871,15 @@ class At {
1847
1871
  const t = e.getDescendantSourceFiles();
1848
1872
  this.options.logger.info(
1849
1873
  `Optimizing ${t.length} source files in ${e.getPath()}`
1850
- ), t.forEach((o, r) => {
1874
+ ), t.forEach((n, r) => {
1851
1875
  this.options.logger.info(
1852
- `Optimizing file [${o.getFilePath()}] - ${r + 1}/${t.length}`
1853
- ), o.formatText(), o.organizeImports(), o.fixMissingImports();
1876
+ `Optimizing file [${n.getFilePath()}] - ${r + 1}/${t.length}`
1877
+ ), n.formatText(), n.organizeImports(), n.fixMissingImports();
1854
1878
  }), this.options.logger.info("All source files optimized");
1855
1879
  }
1856
1880
  }
1857
1881
  export {
1858
- At as CodeGenerator,
1859
- lt as DEFAULT_CONFIG_PATH
1882
+ Ct as CodeGenerator,
1883
+ mt as DEFAULT_CONFIG_PATH
1860
1884
  };
1861
1885
  //# sourceMappingURL=index.js.map