@ahoo-wang/fetcher-generator 3.1.2 → 3.1.3
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.js +1 -1
- package/dist/client/commandClientGenerator.d.ts.map +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -24
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -242,7 +242,7 @@ function ce(o, e, t) {
|
|
|
242
242
|
overwrite: !0
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function A(o, e, t) {
|
|
246
246
|
let n = o.getImportDeclaration(
|
|
247
247
|
(r) => r.getModuleSpecifierValue() === e
|
|
248
248
|
);
|
|
@@ -256,12 +256,12 @@ function x(o, e, t) {
|
|
|
256
256
|
}
|
|
257
257
|
function d(o, e, t) {
|
|
258
258
|
if (t.path.startsWith(_e)) {
|
|
259
|
-
|
|
259
|
+
A(o, t.path, [t.name]);
|
|
260
260
|
return;
|
|
261
261
|
}
|
|
262
262
|
const n = o.getDirectoryPath(), r = Ae(e, t.path, ae);
|
|
263
263
|
let i = Ce(n, r);
|
|
264
|
-
i = i.replace(/\.ts$/, ""), i.startsWith(".") || (i = "./" + i),
|
|
264
|
+
i = i.replace(/\.ts$/, ""), i.startsWith(".") || (i = "./" + i), A(o, i, [t.name]);
|
|
265
265
|
}
|
|
266
266
|
function ke(o, e, t, n) {
|
|
267
267
|
o.path !== n.path && d(e, t, n);
|
|
@@ -275,7 +275,7 @@ function ge(o, e = `
|
|
|
275
275
|
);
|
|
276
276
|
return t.length > 0 ? t.join(e) : void 0;
|
|
277
277
|
}
|
|
278
|
-
function
|
|
278
|
+
function C(o, e) {
|
|
279
279
|
const t = ge(e);
|
|
280
280
|
t && o.addJsDoc(t);
|
|
281
281
|
}
|
|
@@ -288,11 +288,11 @@ function W(o, e) {
|
|
|
288
288
|
}
|
|
289
289
|
function ze(o, e, t) {
|
|
290
290
|
const n = W(e, t);
|
|
291
|
-
|
|
291
|
+
C(o, n);
|
|
292
292
|
}
|
|
293
293
|
function Le(o, e, t) {
|
|
294
294
|
const n = W(e, t);
|
|
295
|
-
pe(n, "schema", e),
|
|
295
|
+
pe(n, "schema", e), C(o, n);
|
|
296
296
|
}
|
|
297
297
|
function Q(o, e, t) {
|
|
298
298
|
const n = e[t];
|
|
@@ -413,11 +413,11 @@ class Ze {
|
|
|
413
413
|
);
|
|
414
414
|
c.push(l);
|
|
415
415
|
}
|
|
416
|
-
const p = n.requestBody.content[I.APPLICATION_JSON].schema,
|
|
416
|
+
const p = n.requestBody.content[I.APPLICATION_JSON].schema, x = $(
|
|
417
417
|
p,
|
|
418
418
|
this.openAPI.components
|
|
419
419
|
);
|
|
420
|
-
|
|
420
|
+
x.schema.title = x.schema.title || n.summary, x.schema.description = x.schema.description || n.description;
|
|
421
421
|
const fe = {
|
|
422
422
|
name: r,
|
|
423
423
|
method: t.method,
|
|
@@ -425,7 +425,7 @@ class Ze {
|
|
|
425
425
|
pathParameters: c,
|
|
426
426
|
summary: n.summary,
|
|
427
427
|
description: n.description,
|
|
428
|
-
schema:
|
|
428
|
+
schema: x,
|
|
429
429
|
operation: n
|
|
430
430
|
};
|
|
431
431
|
n.tags?.forEach((l) => {
|
|
@@ -506,7 +506,7 @@ class Ze {
|
|
|
506
506
|
});
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
|
-
const
|
|
509
|
+
const y = "@ahoo-wang/fetcher-wow", et = {
|
|
510
510
|
"wow.command.CommandResult": "CommandResult",
|
|
511
511
|
"wow.command.CommandResultArray": "CommandResultArray",
|
|
512
512
|
"wow.MessageHeaderSqlType": "MessageHeaderSqlType",
|
|
@@ -541,7 +541,7 @@ function m(o) {
|
|
|
541
541
|
return { name: "", path: "/" };
|
|
542
542
|
const e = et[o];
|
|
543
543
|
if (e)
|
|
544
|
-
return { name: e, path:
|
|
544
|
+
return { name: e, path: y };
|
|
545
545
|
const t = o.split(".");
|
|
546
546
|
let n = -1;
|
|
547
547
|
for (let c = 0; c < t.length; c++)
|
|
@@ -835,7 +835,7 @@ const ot = "@ahoo-wang/fetcher-decorator", rt = [
|
|
|
835
835
|
resultExtractor: JsonEventStreamResultExtractor,
|
|
836
836
|
}`;
|
|
837
837
|
function ue(o) {
|
|
838
|
-
|
|
838
|
+
A(o, ot, rt);
|
|
839
839
|
}
|
|
840
840
|
function F(o, e, t = [], n = [], r) {
|
|
841
841
|
return e.addClass({
|
|
@@ -867,7 +867,7 @@ function le(o, e) {
|
|
|
867
867
|
}
|
|
868
868
|
const st = "@ahoo-wang/fetcher-eventstream";
|
|
869
869
|
function me(o) {
|
|
870
|
-
|
|
870
|
+
A(o, st, [
|
|
871
871
|
"JsonEventStreamResultExtractor",
|
|
872
872
|
"type JsonServerSentEventStream"
|
|
873
873
|
]);
|
|
@@ -974,7 +974,7 @@ class pt {
|
|
|
974
974
|
n.name + "ApiClient",
|
|
975
975
|
r
|
|
976
976
|
);
|
|
977
|
-
|
|
977
|
+
C(i, [e.description]), le(i, this.apiMetadataCtorInitializer), this.context.logger.info(
|
|
978
978
|
`Processing ${t.size} operations for ${n.name}ApiClient`
|
|
979
979
|
), t.forEach((s) => {
|
|
980
980
|
this.processOperation(e, r, i, s);
|
|
@@ -1207,7 +1207,7 @@ class pt {
|
|
|
1207
1207
|
`throw autoGeneratedError(${s.map((p) => p.name).join(",")});`
|
|
1208
1208
|
]
|
|
1209
1209
|
});
|
|
1210
|
-
|
|
1210
|
+
C(
|
|
1211
1211
|
u,
|
|
1212
1212
|
[
|
|
1213
1213
|
r.operation.summary,
|
|
@@ -1344,22 +1344,23 @@ class ut {
|
|
|
1344
1344
|
],
|
|
1345
1345
|
isExported: !1
|
|
1346
1346
|
}), this.context.logger.info(
|
|
1347
|
-
`Adding imports from ${
|
|
1347
|
+
`Adding imports from ${y}: CommandRequest, CommandResult, CommandResultEventStream, CommandBody, DeleteAggregateCommand, RecoverAggregateCommand`
|
|
1348
1348
|
), t.addImportDeclaration({
|
|
1349
|
-
moduleSpecifier:
|
|
1349
|
+
moduleSpecifier: y,
|
|
1350
1350
|
namedImports: [
|
|
1351
1351
|
"CommandRequest",
|
|
1352
1352
|
"CommandResult",
|
|
1353
1353
|
"CommandResultEventStream",
|
|
1354
|
-
"
|
|
1355
|
-
"
|
|
1354
|
+
"CommandBody",
|
|
1355
|
+
"DeleteAggregateCommand",
|
|
1356
|
+
"RecoverAggregateCommand"
|
|
1356
1357
|
],
|
|
1357
1358
|
isTypeOnly: !0
|
|
1358
1359
|
}), this.context.logger.info(
|
|
1359
1360
|
"Adding import from @ahoo-wang/fetcher-eventstream: JsonEventStreamResultExtractor"
|
|
1360
1361
|
), me(t), this.context.logger.info(
|
|
1361
1362
|
"Adding import from @ahoo-wang/fetcher: ContentTypeValues"
|
|
1362
|
-
),
|
|
1363
|
+
), A(t, "@ahoo-wang/fetcher", ["ContentTypeValues"]), this.context.logger.info(
|
|
1363
1364
|
"Adding imports from @ahoo-wang/fetcher-decorator: ApiMetadata types and decorators"
|
|
1364
1365
|
), 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(
|
|
1365
1366
|
`Command client generation completed for aggregate: ${e.aggregate.aggregateName}`
|
|
@@ -1396,10 +1397,12 @@ class ut {
|
|
|
1396
1397
|
}
|
|
1397
1398
|
resolveCommandType(e, t) {
|
|
1398
1399
|
const [n, r] = this.resolveCommandTypeName(t);
|
|
1400
|
+
if (n.path === y)
|
|
1401
|
+
return;
|
|
1399
1402
|
d(e, this.context.outputDir, n);
|
|
1400
1403
|
let i = `${n.name}`;
|
|
1401
1404
|
const s = Oe(t.schema.schema).map((a) => `'${a}'`).join(" | ");
|
|
1402
|
-
s !== "" && (i = `PartialBy<${i},${s}>`), i = `
|
|
1405
|
+
s !== "" && (i = `PartialBy<${i},${s}>`), i = `CommandBody<${i}>`, e.addTypeAlias({
|
|
1403
1406
|
name: r,
|
|
1404
1407
|
type: `${i}`,
|
|
1405
1408
|
isExported: !0
|
|
@@ -1530,7 +1533,7 @@ class ut {
|
|
|
1530
1533
|
});
|
|
1531
1534
|
this.context.logger.info(
|
|
1532
1535
|
`Adding JSDoc documentation for method: ${f(n.name)}`
|
|
1533
|
-
),
|
|
1536
|
+
), C(s, [
|
|
1534
1537
|
n.summary,
|
|
1535
1538
|
n.description,
|
|
1536
1539
|
`- operationId: \`${n.operation.operationId}\``,
|
|
@@ -1598,9 +1601,9 @@ class lt {
|
|
|
1598
1601
|
this.context.logger.info(
|
|
1599
1602
|
`Processing query client for aggregate: ${e.aggregate.aggregateName} in context: ${e.aggregate.contextAlias}`
|
|
1600
1603
|
), this.context.logger.info(
|
|
1601
|
-
`Adding imports from ${
|
|
1604
|
+
`Adding imports from ${y}: QueryClientFactory, QueryClientOptions, ResourceAttributionPathSpec`
|
|
1602
1605
|
), t.addImportDeclaration({
|
|
1603
|
-
moduleSpecifier:
|
|
1606
|
+
moduleSpecifier: y,
|
|
1604
1607
|
namedImports: [
|
|
1605
1608
|
"QueryClientFactory",
|
|
1606
1609
|
"QueryClientOptions",
|