adorn-api 1.0.16 → 1.0.17
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/progress.d.ts +15 -0
- package/dist/cli/progress.d.ts.map +1 -1
- package/dist/cli.cjs +60 -8
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +60 -9
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/progress.d.ts
CHANGED
|
@@ -90,11 +90,26 @@ export declare class Spinner {
|
|
|
90
90
|
private frames;
|
|
91
91
|
private interval?;
|
|
92
92
|
private message;
|
|
93
|
+
private current;
|
|
94
|
+
private total;
|
|
95
|
+
private customStatus?;
|
|
93
96
|
constructor(message?: string);
|
|
94
97
|
/**
|
|
95
98
|
* Start the spinner.
|
|
96
99
|
*/
|
|
97
100
|
start(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Set progress counters.
|
|
103
|
+
*/
|
|
104
|
+
setProgress(current: number, total: number): void;
|
|
105
|
+
/**
|
|
106
|
+
* Set a custom status message (overrides counters).
|
|
107
|
+
*/
|
|
108
|
+
setStatus(status: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* Clear the custom status message.
|
|
111
|
+
*/
|
|
112
|
+
clearStatus(): void;
|
|
98
113
|
/**
|
|
99
114
|
* Stop the spinner with a completion message.
|
|
100
115
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/cli/progress.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WA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aAAa,CAAC,EAAE,MAAM,GAAG,IAAI;CAMnC"}
|
package/dist/cli.cjs
CHANGED
|
@@ -26,6 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
// src/cli.ts
|
|
27
27
|
var import_node_fs6 = require("fs");
|
|
28
28
|
var import_node_path6 = require("path");
|
|
29
|
+
var import_node_url = require("url");
|
|
29
30
|
|
|
30
31
|
// src/compiler/runner/createProgram.ts
|
|
31
32
|
var import_typescript = __toESM(require("typescript"), 1);
|
|
@@ -994,7 +995,7 @@ function handleMetalOrmWrapper(type, ctx) {
|
|
|
994
995
|
required: ["id"]
|
|
995
996
|
};
|
|
996
997
|
if (wrapperName === "ManyToManyCollection" && typeArgs?.[1]) {
|
|
997
|
-
wrapperRel.pivot = typeArgs[1];
|
|
998
|
+
wrapperRel.pivot = ctx.checker.typeToString(typeArgs[1]);
|
|
998
999
|
}
|
|
999
1000
|
return {
|
|
1000
1001
|
type: "array",
|
|
@@ -1004,7 +1005,7 @@ function handleMetalOrmWrapper(type, ctx) {
|
|
|
1004
1005
|
}
|
|
1005
1006
|
const items = targetType ? typeToJsonSchema(targetType, ctx) : {};
|
|
1006
1007
|
if (wrapperName === "ManyToManyCollection" && typeArgs?.[1]) {
|
|
1007
|
-
wrapperRel.pivot = typeArgs[1];
|
|
1008
|
+
wrapperRel.pivot = ctx.checker.typeToString(typeArgs[1]);
|
|
1008
1009
|
}
|
|
1009
1010
|
return {
|
|
1010
1011
|
type: "array",
|
|
@@ -2499,6 +2500,9 @@ var Spinner = class {
|
|
|
2499
2500
|
frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u28B0", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
2500
2501
|
interval;
|
|
2501
2502
|
message;
|
|
2503
|
+
current = 0;
|
|
2504
|
+
total = 0;
|
|
2505
|
+
customStatus;
|
|
2502
2506
|
constructor(message = "") {
|
|
2503
2507
|
this.message = message;
|
|
2504
2508
|
}
|
|
@@ -2509,10 +2513,35 @@ var Spinner = class {
|
|
|
2509
2513
|
let frameIndex = 0;
|
|
2510
2514
|
this.interval = setInterval(() => {
|
|
2511
2515
|
const frame = this.frames[frameIndex];
|
|
2512
|
-
|
|
2516
|
+
if (this.customStatus) {
|
|
2517
|
+
import_node_process.default.stdout.write(`\r${frame} ${this.customStatus}`);
|
|
2518
|
+
} else if (this.total > 0) {
|
|
2519
|
+
import_node_process.default.stdout.write(`\r${frame} ${this.message} (${this.current}/${this.total})`);
|
|
2520
|
+
} else {
|
|
2521
|
+
import_node_process.default.stdout.write(`\r${frame} ${this.message}`);
|
|
2522
|
+
}
|
|
2513
2523
|
frameIndex = (frameIndex + 1) % this.frames.length;
|
|
2514
2524
|
}, 80);
|
|
2515
2525
|
}
|
|
2526
|
+
/**
|
|
2527
|
+
* Set progress counters.
|
|
2528
|
+
*/
|
|
2529
|
+
setProgress(current, total) {
|
|
2530
|
+
this.current = current;
|
|
2531
|
+
this.total = total;
|
|
2532
|
+
}
|
|
2533
|
+
/**
|
|
2534
|
+
* Set a custom status message (overrides counters).
|
|
2535
|
+
*/
|
|
2536
|
+
setStatus(status) {
|
|
2537
|
+
this.customStatus = status;
|
|
2538
|
+
}
|
|
2539
|
+
/**
|
|
2540
|
+
* Clear the custom status message.
|
|
2541
|
+
*/
|
|
2542
|
+
clearStatus() {
|
|
2543
|
+
this.customStatus = void 0;
|
|
2544
|
+
}
|
|
2516
2545
|
/**
|
|
2517
2546
|
* Stop the spinner with a completion message.
|
|
2518
2547
|
*/
|
|
@@ -2521,7 +2550,7 @@ var Spinner = class {
|
|
|
2521
2550
|
clearInterval(this.interval);
|
|
2522
2551
|
this.interval = void 0;
|
|
2523
2552
|
}
|
|
2524
|
-
import_node_process.default.stdout.write("\r" + " ".repeat(
|
|
2553
|
+
import_node_process.default.stdout.write("\r" + " ".repeat(60) + "\r");
|
|
2525
2554
|
if (completedMessage) {
|
|
2526
2555
|
import_node_process.default.stdout.write(completedMessage + "\n");
|
|
2527
2556
|
}
|
|
@@ -3288,7 +3317,25 @@ var SchemaGraph = class {
|
|
|
3288
3317
|
// src/cli.ts
|
|
3289
3318
|
var import_typescript13 = __toESM(require("typescript"), 1);
|
|
3290
3319
|
var import_node_process2 = __toESM(require("process"), 1);
|
|
3291
|
-
var
|
|
3320
|
+
var import_meta2 = {};
|
|
3321
|
+
var ADORN_VERSION = (() => {
|
|
3322
|
+
try {
|
|
3323
|
+
const localPkgPath = (0, import_node_path6.resolve)(import_node_process2.default.cwd(), "package.json");
|
|
3324
|
+
try {
|
|
3325
|
+
const localPkg = JSON.parse((0, import_node_fs6.readFileSync)(localPkgPath, "utf-8"));
|
|
3326
|
+
if (localPkg.bin?.["adorn-api"] || localPkg.name === "adorn-api") {
|
|
3327
|
+
return localPkg.version ?? "0.0.0";
|
|
3328
|
+
}
|
|
3329
|
+
} catch {
|
|
3330
|
+
}
|
|
3331
|
+
const cliDir = (0, import_node_path6.dirname)((0, import_node_url.fileURLToPath)(import_meta2.url));
|
|
3332
|
+
const bundledPkgPath = (0, import_node_path6.resolve)(cliDir, "..", "package.json");
|
|
3333
|
+
const bundledPkg = JSON.parse((0, import_node_fs6.readFileSync)(bundledPkgPath, "utf-8"));
|
|
3334
|
+
return bundledPkg.version ?? "0.0.0";
|
|
3335
|
+
} catch {
|
|
3336
|
+
return "0.0.0";
|
|
3337
|
+
}
|
|
3338
|
+
})();
|
|
3292
3339
|
function log(msg, options) {
|
|
3293
3340
|
if (options?.indent) {
|
|
3294
3341
|
import_node_process2.default.stdout.write(" " + msg + "\n");
|
|
@@ -3481,10 +3528,15 @@ async function buildCommand(args) {
|
|
|
3481
3528
|
}
|
|
3482
3529
|
}
|
|
3483
3530
|
progress.startPhase("openapi", "Generating OpenAPI schema");
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3531
|
+
const openapiSpinner = new Spinner("Processing schemas");
|
|
3532
|
+
if (!quiet) openapiSpinner.start();
|
|
3533
|
+
let processedControllers = 0;
|
|
3534
|
+
let processedOperations = 0;
|
|
3487
3535
|
const openapi = generateOpenAPI(controllers, checker, { title: "API", version: "1.0.0" });
|
|
3536
|
+
if (!quiet) {
|
|
3537
|
+
openapiSpinner.setStatus(`Processed ${controllers.length} controllers, ${totalOperations} operations`);
|
|
3538
|
+
}
|
|
3539
|
+
if (!quiet) openapiSpinner.stop();
|
|
3488
3540
|
const schemaCount = Object.keys(openapi.components?.schemas || {}).length;
|
|
3489
3541
|
let splitEnabled = false;
|
|
3490
3542
|
if (!noSplit && schemaCount >= splitThreshold) {
|