@ahoo-wang/fetcher-generator 3.12.21 → 3.13.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/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -18
- package/dist/index.js.map +1 -1
- package/dist/model/wowTypeMapping.d.ts +1 -0
- package/dist/model/wowTypeMapping.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import { Scope as Ce, VariableDeclarationKind as O, Project as Pe } from "ts-mor
|
|
|
2
2
|
import { ContentTypeValues as E, combineURLs as I } from "@ahoo-wang/fetcher";
|
|
3
3
|
import { ResourceAttributionPathSpec as L } from "@ahoo-wang/fetcher-wow";
|
|
4
4
|
import { parse as Y } from "yaml";
|
|
5
|
-
import { readFile as
|
|
6
|
-
import { join as
|
|
5
|
+
import { readFile as Te } from "fs";
|
|
6
|
+
import { join as $e, relative as ve, sep as Ee } from "path";
|
|
7
7
|
function P(n) {
|
|
8
8
|
return n.$ref.split("/").pop();
|
|
9
9
|
}
|
|
@@ -19,7 +19,7 @@ function Z(n, e) {
|
|
|
19
19
|
const t = P(n);
|
|
20
20
|
return e.parameters?.[t];
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function T(n, e) {
|
|
23
23
|
return {
|
|
24
24
|
key: P(n),
|
|
25
25
|
schema: S(n, e)
|
|
@@ -97,7 +97,7 @@ const De = "x-enum-text";
|
|
|
97
97
|
function Ne(n) {
|
|
98
98
|
return n[De];
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function $(n) {
|
|
101
101
|
return n.type === "object" && !!n.properties;
|
|
102
102
|
}
|
|
103
103
|
function R(n) {
|
|
@@ -149,7 +149,7 @@ function D(n) {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
function _e(n) {
|
|
152
|
-
if (
|
|
152
|
+
if (!$(n))
|
|
153
153
|
return [];
|
|
154
154
|
const e = n.required || [];
|
|
155
155
|
return Object.keys(n.properties).filter((t) => !e.includes(t));
|
|
@@ -205,7 +205,7 @@ async function ze(n) {
|
|
|
205
205
|
}
|
|
206
206
|
function Le(n) {
|
|
207
207
|
return new Promise((e, t) => {
|
|
208
|
-
|
|
208
|
+
Te(n, "utf-8", (o, r) => {
|
|
209
209
|
o ? t(o) : e(r);
|
|
210
210
|
});
|
|
211
211
|
});
|
|
@@ -273,7 +273,7 @@ function m(n, e, t) {
|
|
|
273
273
|
A(n, t.path, [t.name]);
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
|
-
const o = n.getDirectoryPath(), r =
|
|
276
|
+
const o = n.getDirectoryPath(), r = $e(e, t.path, ue);
|
|
277
277
|
let i = ve(o, r);
|
|
278
278
|
i = i.replace(/\.ts$/, ""), i = i.split(Ee).join("/"), i.startsWith(".") || (i = "./" + i), A(n, i, [t.name]);
|
|
279
279
|
}
|
|
@@ -427,7 +427,7 @@ class st {
|
|
|
427
427
|
);
|
|
428
428
|
c.push(u);
|
|
429
429
|
}
|
|
430
|
-
const g = o.requestBody.content[E.APPLICATION_JSON].schema, d =
|
|
430
|
+
const g = o.requestBody.content[E.APPLICATION_JSON].schema, d = T(
|
|
431
431
|
g,
|
|
432
432
|
this.openAPI.components
|
|
433
433
|
);
|
|
@@ -457,7 +457,7 @@ class st {
|
|
|
457
457
|
const t = V(e);
|
|
458
458
|
if (!p(t))
|
|
459
459
|
return;
|
|
460
|
-
const o =
|
|
460
|
+
const o = T(
|
|
461
461
|
t,
|
|
462
462
|
this.openAPI.components
|
|
463
463
|
);
|
|
@@ -483,7 +483,7 @@ class st {
|
|
|
483
483
|
o,
|
|
484
484
|
this.openAPI.components
|
|
485
485
|
).properties.body.items.anyOf.map((s) => {
|
|
486
|
-
const a = s.title, c = s.properties.name.const, h = s.properties.body, g =
|
|
486
|
+
const a = s.title, c = s.properties.name.const, h = s.properties.body, g = T(
|
|
487
487
|
h,
|
|
488
488
|
this.openAPI.components
|
|
489
489
|
);
|
|
@@ -513,7 +513,7 @@ class st {
|
|
|
513
513
|
).content[E.APPLICATION_JSON].schema, i = S(
|
|
514
514
|
o,
|
|
515
515
|
this.openAPI.components
|
|
516
|
-
).properties?.field, s =
|
|
516
|
+
).properties?.field, s = T(i, this.openAPI.components);
|
|
517
517
|
e.tags?.forEach((a) => {
|
|
518
518
|
const c = this.aggregates.get(a);
|
|
519
519
|
c && (c.fields = s);
|
|
@@ -529,6 +529,7 @@ const x = "@ahoo-wang/fetcher-wow", at = {
|
|
|
529
529
|
"wow.api.RecoverableType": "RecoverableType",
|
|
530
530
|
"wow.api.command.DefaultDeleteAggregate": "DeleteAggregate",
|
|
531
531
|
"wow.api.command.DefaultRecoverAggregate": "RecoverAggregate",
|
|
532
|
+
"wow.api.abac.DefaultApplyResourceTags": "ApplyResourceTags",
|
|
532
533
|
"wow.api.messaging.FunctionInfoData": "FunctionInfo",
|
|
533
534
|
"wow.api.messaging.FunctionKind": "FunctionKind",
|
|
534
535
|
"wow.api.modeling.AggregateId": "AggregateId",
|
|
@@ -585,7 +586,7 @@ class ct {
|
|
|
585
586
|
}
|
|
586
587
|
process() {
|
|
587
588
|
const { schema: e } = this.keySchema;
|
|
588
|
-
return J(e) ? this.processEnum(e) :
|
|
589
|
+
return J(e) ? this.processEnum(e) : $(e) ? this.processInterface(e) : R(e) ? this.processArray(e) : q(e) ? this.processIntersection(e) : Q(e) ? this.processComposition(e) : this.processTypeAlias(e);
|
|
589
590
|
}
|
|
590
591
|
resolveReference(e) {
|
|
591
592
|
const t = v(e);
|
|
@@ -619,7 +620,7 @@ class ct {
|
|
|
619
620
|
}
|
|
620
621
|
resolveObjectType(e) {
|
|
621
622
|
const t = [];
|
|
622
|
-
if (
|
|
623
|
+
if ($(e)) {
|
|
623
624
|
const r = this.resolvePropertyDefinitions(e);
|
|
624
625
|
t.push(...r);
|
|
625
626
|
}
|
|
@@ -727,7 +728,7 @@ class ct {
|
|
|
727
728
|
t.addExtends(r);
|
|
728
729
|
return;
|
|
729
730
|
}
|
|
730
|
-
|
|
731
|
+
$(o) && Object.entries(o.properties).forEach(
|
|
731
732
|
([r, i]) => {
|
|
732
733
|
this.addPropertyToInterface(
|
|
733
734
|
t,
|
|
@@ -1590,7 +1591,7 @@ class Pt {
|
|
|
1590
1591
|
);
|
|
1591
1592
|
}
|
|
1592
1593
|
}
|
|
1593
|
-
class
|
|
1594
|
+
class Tt {
|
|
1594
1595
|
/**
|
|
1595
1596
|
* Creates a new QueryClientGenerator instance.
|
|
1596
1597
|
* @param context - The generation context containing OpenAPI spec and project details
|
|
@@ -1739,13 +1740,13 @@ class $t {
|
|
|
1739
1740
|
});
|
|
1740
1741
|
}
|
|
1741
1742
|
}
|
|
1742
|
-
class
|
|
1743
|
+
class $t {
|
|
1743
1744
|
/**
|
|
1744
1745
|
* Creates a new ClientGenerator instance.
|
|
1745
1746
|
* @param context - The generation context containing OpenAPI spec and project details
|
|
1746
1747
|
*/
|
|
1747
1748
|
constructor(e) {
|
|
1748
|
-
this.context = e, this.queryClientGenerator = new
|
|
1749
|
+
this.context = e, this.queryClientGenerator = new Tt(e), this.commandClientGenerator = new Pt(e), this.apiClientGenerator = new Ct(e);
|
|
1749
1750
|
}
|
|
1750
1751
|
queryClientGenerator;
|
|
1751
1752
|
commandClientGenerator;
|
|
@@ -1855,7 +1856,7 @@ class Ot {
|
|
|
1855
1856
|
logger: this.options.logger,
|
|
1856
1857
|
config: s
|
|
1857
1858
|
});
|
|
1858
|
-
this.options.logger.info("Generating models"), new pt(a).generate(), this.options.logger.info("Models generated successfully"), this.options.logger.info("Generating clients"), new
|
|
1859
|
+
this.options.logger.info("Generating models"), new pt(a).generate(), this.options.logger.info("Models generated successfully"), this.options.logger.info("Generating clients"), new $t(a).generate(), this.options.logger.info("Clients generated successfully");
|
|
1859
1860
|
const g = this.project.getDirectory(this.options.outputDir);
|
|
1860
1861
|
if (!g) {
|
|
1861
1862
|
this.options.logger.info("Output directory not found.");
|