@ahoo-wang/fetcher-generator 2.16.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/queryClientGenerator.d.ts +1 -0
- package/dist/client/queryClientGenerator.d.ts.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -14
- package/dist/index.js.map +1 -1
- package/dist/model/typeGenerator.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -99,11 +99,11 @@ function ve(n) {
|
|
|
99
99
|
function Ie(n) {
|
|
100
100
|
return Array.isArray(n.oneOf) && n.oneOf.length > 0;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function M(n) {
|
|
103
103
|
return Array.isArray(n.allOf) && n.allOf.length > 0;
|
|
104
104
|
}
|
|
105
105
|
function L(n) {
|
|
106
|
-
return ve(n) || Ie(n) ||
|
|
106
|
+
return ve(n) || Ie(n) || M(n);
|
|
107
107
|
}
|
|
108
108
|
function Ee(n) {
|
|
109
109
|
return n.includes("|") || n.includes("&") ? `(${n})[]` : `${n}[]`;
|
|
@@ -175,19 +175,19 @@ function oe(n) {
|
|
|
175
175
|
return !n.schema || g(n.schema) || !n.schema.type || !ee(n.schema.type) ? Oe : R(n.schema.type);
|
|
176
176
|
}
|
|
177
177
|
function re(n) {
|
|
178
|
-
return n.startsWith("http://") || n.startsWith("https://") ? Ne(n) :
|
|
178
|
+
return n.startsWith("http://") || n.startsWith("https://") ? Ne(n) : Me(n);
|
|
179
179
|
}
|
|
180
180
|
async function Ne(n) {
|
|
181
181
|
return await (await fetch(n)).text();
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function Me(n) {
|
|
184
184
|
return new Promise((e, t) => {
|
|
185
185
|
ye(n, "utf-8", (o, r) => {
|
|
186
186
|
o ? t(o) : e(r);
|
|
187
187
|
});
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
|
-
async function
|
|
190
|
+
async function be(n) {
|
|
191
191
|
const e = await re(n);
|
|
192
192
|
switch (ie(e)) {
|
|
193
193
|
case "json":
|
|
@@ -550,7 +550,7 @@ class Ke {
|
|
|
550
550
|
}
|
|
551
551
|
process() {
|
|
552
552
|
const { schema: e } = this.keySchema;
|
|
553
|
-
return z(e) ? this.processEnum(e) : w(e) ? this.processInterface(e) : N(e) ? this.processArray(e) :
|
|
553
|
+
return z(e) ? this.processEnum(e) : w(e) ? this.processInterface(e) : N(e) ? this.processArray(e) : M(e) ? this.processIntersection(e) : L(e) ? this.processComposition(e) : this.processTypeAlias(e);
|
|
554
554
|
}
|
|
555
555
|
resolveReference(e) {
|
|
556
556
|
const t = $(e);
|
|
@@ -609,7 +609,7 @@ class Ke {
|
|
|
609
609
|
if (z(e))
|
|
610
610
|
return e.enum.map((t) => `'${t}'`).join(" | ");
|
|
611
611
|
if (L(e)) {
|
|
612
|
-
const o = (e.oneOf || e.anyOf || e.allOf || []).map((i) => this.resolveType(i)), r =
|
|
612
|
+
const o = (e.oneOf || e.anyOf || e.allOf || []).map((i) => this.resolveType(i)), r = M(e) ? " & " : " | ";
|
|
613
613
|
return `(${o.join(r)})`;
|
|
614
614
|
}
|
|
615
615
|
if (N(e)) {
|
|
@@ -634,7 +634,7 @@ class Ke {
|
|
|
634
634
|
i ? i.setType(r) : i = e.addProperty({
|
|
635
635
|
name: t,
|
|
636
636
|
type: r
|
|
637
|
-
}),
|
|
637
|
+
}), Q(i, o);
|
|
638
638
|
}
|
|
639
639
|
processInterface(e) {
|
|
640
640
|
const t = this.sourceFile.addInterface({
|
|
@@ -810,7 +810,7 @@ const Xe = "@ahoo-wang/fetcher-decorator", Ze = [
|
|
|
810
810
|
}, J = {
|
|
811
811
|
type: "Promise<string>",
|
|
812
812
|
metadata: "{resultExtractor: ResultExtractors.Text }"
|
|
813
|
-
},
|
|
813
|
+
}, b = `{
|
|
814
814
|
headers: { Accept: ContentTypeValues.TEXT_EVENT_STREAM },
|
|
815
815
|
resultExtractor: JsonEventStreamResultExtractor,
|
|
816
816
|
}`;
|
|
@@ -1138,14 +1138,14 @@ class it {
|
|
|
1138
1138
|
`Resolved event stream return type for operation ${t.operationId}: ${p}`
|
|
1139
1139
|
), {
|
|
1140
1140
|
type: p,
|
|
1141
|
-
metadata:
|
|
1141
|
+
metadata: b
|
|
1142
1142
|
};
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
|
1145
1145
|
const s = "Promise<JsonServerSentEventStream<any>>";
|
|
1146
1146
|
return this.context.logger.info(
|
|
1147
1147
|
`Resolved generic event stream return type for operation ${t.operationId}: ${s}`
|
|
1148
|
-
), { type: s, metadata:
|
|
1148
|
+
), { type: s, metadata: b };
|
|
1149
1149
|
}
|
|
1150
1150
|
return this.context.logger.info(
|
|
1151
1151
|
`Using default return type for operation ${t.operationId}: ${this.defaultReturnType.type}`
|
|
@@ -1404,7 +1404,7 @@ class st {
|
|
|
1404
1404
|
q(
|
|
1405
1405
|
r,
|
|
1406
1406
|
e,
|
|
1407
|
-
["''",
|
|
1407
|
+
["''", b],
|
|
1408
1408
|
[],
|
|
1409
1409
|
`${o}<CommandResultEventStream>`
|
|
1410
1410
|
).addConstructor({
|
|
@@ -1511,6 +1511,7 @@ class at {
|
|
|
1511
1511
|
this.context = e;
|
|
1512
1512
|
}
|
|
1513
1513
|
domainEventTypeSuffix = "DomainEventType";
|
|
1514
|
+
domainEventTypeMapTitleSuffix = "DomainEventTypeMapTitle";
|
|
1514
1515
|
/**
|
|
1515
1516
|
* Generates query client classes for all aggregates.
|
|
1516
1517
|
*/
|
|
@@ -1625,7 +1626,7 @@ class at {
|
|
|
1625
1626
|
}), r;
|
|
1626
1627
|
}
|
|
1627
1628
|
processAggregateDomainEventTypes(e, t) {
|
|
1628
|
-
const o = h(e.aggregate, this.
|
|
1629
|
+
const o = h(e.aggregate, this.domainEventTypeMapTitleSuffix), r = t.addEnum({
|
|
1629
1630
|
name: o,
|
|
1630
1631
|
isExported: !0
|
|
1631
1632
|
});
|
|
@@ -1729,7 +1730,7 @@ class yt {
|
|
|
1729
1730
|
this.options.logger.info(
|
|
1730
1731
|
"Starting code generation from OpenAPI specification"
|
|
1731
1732
|
), 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");
|
|
1732
|
-
const e = await
|
|
1733
|
+
const e = await be(this.options.inputPath);
|
|
1733
1734
|
this.options.logger.info("OpenAPI specification parsed successfully"), this.options.logger.info("Resolving bounded context aggregates");
|
|
1734
1735
|
const o = new Ve(e).resolve();
|
|
1735
1736
|
this.options.logger.info(
|