@ooneex/cli 1.26.2 → 1.27.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 +178 -157
- package/dist/index.js.map +7 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -33790,18 +33790,30 @@ function getPerformanceGrade(avgLatency, p99Latency, errorRate, reqPerSec) {
|
|
|
33790
33790
|
if (reqPerSec > 1e4)
|
|
33791
33791
|
score = Math.min(100, score + 5);
|
|
33792
33792
|
if (score >= 90) {
|
|
33793
|
-
return {
|
|
33793
|
+
return {
|
|
33794
|
+
label: "A Excellent",
|
|
33795
|
+
message: " Server handles load with low latency and high reliability",
|
|
33796
|
+
color: green
|
|
33797
|
+
};
|
|
33794
33798
|
}
|
|
33795
33799
|
if (score >= 75) {
|
|
33796
33800
|
return { label: "B Good", message: " Server performs well under load with acceptable latency", color: green };
|
|
33797
33801
|
}
|
|
33798
33802
|
if (score >= 60) {
|
|
33799
|
-
return {
|
|
33803
|
+
return {
|
|
33804
|
+
label: "C Fair",
|
|
33805
|
+
message: " Server shows moderate latency or occasional errors under load",
|
|
33806
|
+
color: yellow
|
|
33807
|
+
};
|
|
33800
33808
|
}
|
|
33801
33809
|
if (score >= 40) {
|
|
33802
33810
|
return { label: "D Poor", message: " Server struggles with high latency or significant errors", color: red };
|
|
33803
33811
|
}
|
|
33804
|
-
return {
|
|
33812
|
+
return {
|
|
33813
|
+
label: "F Critical",
|
|
33814
|
+
message: " Server cannot handle the load \u2014 consider scaling or optimization",
|
|
33815
|
+
color: red
|
|
33816
|
+
};
|
|
33805
33817
|
}
|
|
33806
33818
|
|
|
33807
33819
|
class BenchmarkRunCommand {
|
|
@@ -34554,124 +34566,10 @@ class MakeAiCommand {
|
|
|
34554
34566
|
MakeAiCommand = __legacyDecorateClassTS([
|
|
34555
34567
|
decorator9.command()
|
|
34556
34568
|
], MakeAiCommand);
|
|
34557
|
-
// src/commands/
|
|
34569
|
+
// src/commands/MakeAnalyticsCommand.ts
|
|
34558
34570
|
import { join as join10 } from "path";
|
|
34559
34571
|
import { decorator as decorator10 } from "@ooneex/command";
|
|
34560
34572
|
import { TerminalLogger as TerminalLogger9 } from "@ooneex/logger";
|
|
34561
|
-
class MakeBenchmarkCommand {
|
|
34562
|
-
getName() {
|
|
34563
|
-
return "make:benchmark";
|
|
34564
|
-
}
|
|
34565
|
-
getDescription() {
|
|
34566
|
-
return "Generate a new benchmark file";
|
|
34567
|
-
}
|
|
34568
|
-
parseController(content) {
|
|
34569
|
-
const methodMatch = content.match(/@Route\.(get|post|patch|put|delete|options|head)\(/);
|
|
34570
|
-
const method = methodMatch?.[1]?.toUpperCase() ?? "GET";
|
|
34571
|
-
const pathMatch = content.match(/@Route\.\w+\("([^"]+)"/);
|
|
34572
|
-
const path = pathMatch?.[1] ?? "/";
|
|
34573
|
-
const nameMatch = content.match(/name:\s*"([^"]+)"/);
|
|
34574
|
-
const name = nameMatch?.[1] ?? "";
|
|
34575
|
-
const descriptionMatch = content.match(/description:\s*"([^"]+)"/);
|
|
34576
|
-
const description = descriptionMatch?.[1] ?? "";
|
|
34577
|
-
const params = this.parseParams(content);
|
|
34578
|
-
const queries = this.parseAssertBlock(content, "queries");
|
|
34579
|
-
const payload = this.parseAssertBlock(content, "payload");
|
|
34580
|
-
return { name, path, method, description, params, queries, payload };
|
|
34581
|
-
}
|
|
34582
|
-
parseParams(content) {
|
|
34583
|
-
const params = {};
|
|
34584
|
-
const paramsMatch = content.match(/params:\s*\{([^}]*Assert[^}]+)\}/);
|
|
34585
|
-
if (paramsMatch?.[1]) {
|
|
34586
|
-
const keys = paramsMatch[1].matchAll(/(\w+):\s*Assert\(/g);
|
|
34587
|
-
for (const match of keys) {
|
|
34588
|
-
if (match[1]) {
|
|
34589
|
-
params[match[1]] = "";
|
|
34590
|
-
}
|
|
34591
|
-
}
|
|
34592
|
-
}
|
|
34593
|
-
return params;
|
|
34594
|
-
}
|
|
34595
|
-
parseAssertBlock(content, block) {
|
|
34596
|
-
const result = {};
|
|
34597
|
-
const regex = new RegExp(`${block}:\\s*Assert\\(\\{([^}]+)\\}\\)`);
|
|
34598
|
-
const match = content.match(regex);
|
|
34599
|
-
if (match?.[1]) {
|
|
34600
|
-
const fields = match[1].matchAll(/(\w+):\s*"(\w+\??(?:\[\])?)"/g);
|
|
34601
|
-
for (const field of fields) {
|
|
34602
|
-
if (field[1] && field[2]) {
|
|
34603
|
-
const type = field[2].replace("?", "").replace("[]", "");
|
|
34604
|
-
result[field[1]] = type === "number" ? 0 : "";
|
|
34605
|
-
}
|
|
34606
|
-
}
|
|
34607
|
-
}
|
|
34608
|
-
return result;
|
|
34609
|
-
}
|
|
34610
|
-
async run(options) {
|
|
34611
|
-
let { name, module, target } = options;
|
|
34612
|
-
if (!name) {
|
|
34613
|
-
name = await askName({ message: "Enter benchmark name" });
|
|
34614
|
-
}
|
|
34615
|
-
if (!target) {
|
|
34616
|
-
target = await askName({ message: "Enter target controller name (e.g., UpdateStatusController)" });
|
|
34617
|
-
}
|
|
34618
|
-
const targetName = target.replace(/Controller$/, "");
|
|
34619
|
-
if (module) {
|
|
34620
|
-
await ensureModule(module);
|
|
34621
|
-
}
|
|
34622
|
-
const base = module ? join10("modules", module) : ".";
|
|
34623
|
-
const controllersLocalDir = join10(base, "src", "controllers");
|
|
34624
|
-
const controllersDir = join10(process.cwd(), controllersLocalDir);
|
|
34625
|
-
const controllerFilePath = join10(controllersDir, `${targetName}Controller.ts`);
|
|
34626
|
-
const controllerFile = Bun.file(controllerFilePath);
|
|
34627
|
-
if (!await controllerFile.exists()) {
|
|
34628
|
-
const logger2 = new TerminalLogger9;
|
|
34629
|
-
logger2.error(`Controller not found: ${controllerFilePath}`, undefined, {
|
|
34630
|
-
showTimestamp: false,
|
|
34631
|
-
showArrow: false,
|
|
34632
|
-
useSymbol: true
|
|
34633
|
-
});
|
|
34634
|
-
return;
|
|
34635
|
-
}
|
|
34636
|
-
const controllerContent = await controllerFile.text();
|
|
34637
|
-
const routeInfo = this.parseController(controllerContent);
|
|
34638
|
-
const benchmark = {
|
|
34639
|
-
name: routeInfo.name,
|
|
34640
|
-
path: routeInfo.path,
|
|
34641
|
-
method: routeInfo.method,
|
|
34642
|
-
description: routeInfo.description
|
|
34643
|
-
};
|
|
34644
|
-
if (Object.keys(routeInfo.params).length > 0) {
|
|
34645
|
-
benchmark.params = routeInfo.params;
|
|
34646
|
-
}
|
|
34647
|
-
if (Object.keys(routeInfo.queries).length > 0) {
|
|
34648
|
-
benchmark.queries = routeInfo.queries;
|
|
34649
|
-
}
|
|
34650
|
-
if (Object.keys(routeInfo.payload).length > 0) {
|
|
34651
|
-
benchmark.payload = routeInfo.payload;
|
|
34652
|
-
}
|
|
34653
|
-
benchmark.connections = 10;
|
|
34654
|
-
benchmark.duration = 10;
|
|
34655
|
-
const jsonContent = JSON.stringify(benchmark, null, 2);
|
|
34656
|
-
const benchmarkFileName = `${name}.bench.json`;
|
|
34657
|
-
const filePath = join10(controllersDir, benchmarkFileName);
|
|
34658
|
-
await Bun.write(filePath, `${jsonContent}
|
|
34659
|
-
`);
|
|
34660
|
-
const logger = new TerminalLogger9;
|
|
34661
|
-
logger.success(`${join10(controllersLocalDir, benchmarkFileName)} created successfully`, undefined, {
|
|
34662
|
-
showTimestamp: false,
|
|
34663
|
-
showArrow: false,
|
|
34664
|
-
useSymbol: true
|
|
34665
|
-
});
|
|
34666
|
-
}
|
|
34667
|
-
}
|
|
34668
|
-
MakeBenchmarkCommand = __legacyDecorateClassTS([
|
|
34669
|
-
decorator10.command()
|
|
34670
|
-
], MakeBenchmarkCommand);
|
|
34671
|
-
// src/commands/MakeAnalyticsCommand.ts
|
|
34672
|
-
import { join as join11 } from "path";
|
|
34673
|
-
import { decorator as decorator11 } from "@ooneex/command";
|
|
34674
|
-
import { TerminalLogger as TerminalLogger10 } from "@ooneex/logger";
|
|
34675
34573
|
import { toPascalCase as toPascalCase3 } from "@ooneex/utils";
|
|
34676
34574
|
|
|
34677
34575
|
// src/templates/analytics.test.txt
|
|
@@ -34722,28 +34620,28 @@ class MakeAnalyticsCommand {
|
|
|
34722
34620
|
if (module) {
|
|
34723
34621
|
await ensureModule(module);
|
|
34724
34622
|
}
|
|
34725
|
-
const base = module ?
|
|
34726
|
-
const analyticsLocalDir =
|
|
34727
|
-
const analyticsDir =
|
|
34728
|
-
const filePath =
|
|
34623
|
+
const base = module ? join10("modules", module) : ".";
|
|
34624
|
+
const analyticsLocalDir = join10(base, "src", "analytics");
|
|
34625
|
+
const analyticsDir = join10(process.cwd(), analyticsLocalDir);
|
|
34626
|
+
const filePath = join10(analyticsDir, `${name}Analytics.ts`);
|
|
34729
34627
|
await Bun.write(filePath, content);
|
|
34730
34628
|
const testContent = analytics_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
34731
|
-
const testsLocalDir =
|
|
34732
|
-
const testsDir =
|
|
34733
|
-
const testFilePath =
|
|
34629
|
+
const testsLocalDir = join10(base, "tests", "analytics");
|
|
34630
|
+
const testsDir = join10(process.cwd(), testsLocalDir);
|
|
34631
|
+
const testFilePath = join10(testsDir, `${name}Analytics.spec.ts`);
|
|
34734
34632
|
await Bun.write(testFilePath, testContent);
|
|
34735
|
-
const logger = new
|
|
34736
|
-
logger.success(`${
|
|
34633
|
+
const logger = new TerminalLogger9;
|
|
34634
|
+
logger.success(`${join10(analyticsLocalDir, name)}Analytics.ts created successfully`, undefined, {
|
|
34737
34635
|
showTimestamp: false,
|
|
34738
34636
|
showArrow: false,
|
|
34739
34637
|
useSymbol: true
|
|
34740
34638
|
});
|
|
34741
|
-
logger.success(`${
|
|
34639
|
+
logger.success(`${join10(testsLocalDir, name)}Analytics.spec.ts created successfully`, undefined, {
|
|
34742
34640
|
showTimestamp: false,
|
|
34743
34641
|
showArrow: false,
|
|
34744
34642
|
useSymbol: true
|
|
34745
34643
|
});
|
|
34746
|
-
const packageJsonPath =
|
|
34644
|
+
const packageJsonPath = join10(process.cwd(), "package.json");
|
|
34747
34645
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
34748
34646
|
const deps = packageJson.dependencies ?? {};
|
|
34749
34647
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -34758,13 +34656,13 @@ class MakeAnalyticsCommand {
|
|
|
34758
34656
|
}
|
|
34759
34657
|
}
|
|
34760
34658
|
MakeAnalyticsCommand = __legacyDecorateClassTS([
|
|
34761
|
-
|
|
34659
|
+
decorator10.command()
|
|
34762
34660
|
], MakeAnalyticsCommand);
|
|
34763
34661
|
// src/commands/MakeAppCommand.ts
|
|
34764
|
-
import { join as
|
|
34765
|
-
import { decorator as
|
|
34766
|
-
import { TerminalLogger as
|
|
34767
|
-
import { toKebabCase as toKebabCase2, toSnakeCase } from "@ooneex/utils";
|
|
34662
|
+
import { join as join11 } from "path";
|
|
34663
|
+
import { decorator as decorator11 } from "@ooneex/command";
|
|
34664
|
+
import { TerminalLogger as TerminalLogger10 } from "@ooneex/logger";
|
|
34665
|
+
import { random, toKebabCase as toKebabCase2, toSnakeCase } from "@ooneex/utils";
|
|
34768
34666
|
|
|
34769
34667
|
// src/prompts/askDestination.ts
|
|
34770
34668
|
var import_enquirer2 = __toESM(require_enquirer(), 1);
|
|
@@ -35447,6 +35345,13 @@ RESEND_API_KEY=
|
|
|
35447
35345
|
# Secret key for HS256 JWT signing and verification
|
|
35448
35346
|
JWT_SECRET=
|
|
35449
35347
|
|
|
35348
|
+
# =============================================================================
|
|
35349
|
+
# CSRF
|
|
35350
|
+
# =============================================================================
|
|
35351
|
+
|
|
35352
|
+
# Secret key for CSRF token generation and verification
|
|
35353
|
+
CSRF_SECRET=
|
|
35354
|
+
|
|
35450
35355
|
# =============================================================================
|
|
35451
35356
|
# AI
|
|
35452
35357
|
# =============================================================================
|
|
@@ -35916,40 +35821,40 @@ class MakeAppCommand {
|
|
|
35916
35821
|
destination = await askDestination({ message: "Enter destination path", initial: kebabName });
|
|
35917
35822
|
}
|
|
35918
35823
|
const packageContent = package_json_default.replace(/{{NAME}}/g, kebabName);
|
|
35919
|
-
await Bun.write(
|
|
35920
|
-
await Bun.write(
|
|
35921
|
-
await Bun.write(
|
|
35922
|
-
await Bun.write(
|
|
35923
|
-
await Bun.write(
|
|
35924
|
-
await Bun.write(
|
|
35925
|
-
await Bun.write(
|
|
35926
|
-
await Bun.write(
|
|
35927
|
-
await Bun.write(
|
|
35824
|
+
await Bun.write(join11(destination, ".commitlintrc.ts"), _commitlintrc_ts_default);
|
|
35825
|
+
await Bun.write(join11(destination, ".gitignore"), _gitignore_default);
|
|
35826
|
+
await Bun.write(join11(destination, "biome.jsonc"), biome_jsonc_default);
|
|
35827
|
+
await Bun.write(join11(destination, "bunfig.toml"), bunfig_toml_default);
|
|
35828
|
+
await Bun.write(join11(destination, "nx.json"), nx_json_default);
|
|
35829
|
+
await Bun.write(join11(destination, "package.json"), packageContent);
|
|
35830
|
+
await Bun.write(join11(destination, "README.md"), README_md_default.replace(/{{NAME}}/g, kebabName));
|
|
35831
|
+
await Bun.write(join11(destination, "tsconfig.json"), tsconfig_json_default);
|
|
35832
|
+
await Bun.write(join11(destination, ".zed", "settings.json"), zed_settings_json_default);
|
|
35928
35833
|
const makeModuleCommand = new MakeModuleCommand;
|
|
35929
35834
|
await makeModuleCommand.run({
|
|
35930
35835
|
name: "app",
|
|
35931
35836
|
cwd: destination,
|
|
35932
35837
|
silent: true
|
|
35933
35838
|
});
|
|
35934
|
-
const appModulePackagePath =
|
|
35839
|
+
const appModulePackagePath = join11(destination, "modules", "app", "package.json");
|
|
35935
35840
|
const appModulePackageJson = await Bun.file(appModulePackagePath).json();
|
|
35936
35841
|
await Bun.write(appModulePackagePath, JSON.stringify(appModulePackageJson, null, 2));
|
|
35937
|
-
const envContent = env_default.replace(/^DATABASE_URL=/m, 'DATABASE_URL="postgresql://ooneex:ooneex@localhost:5432/ooneex"').replace(/^CACHE_REDIS_URL=/m, 'CACHE_REDIS_URL="redis://localhost:6379"').replace(/^PUBSUB_REDIS_URL=/m, 'PUBSUB_REDIS_URL="redis://localhost:6379"').replace(/^RATE_LIMIT_REDIS_URL=/m, 'RATE_LIMIT_REDIS_URL="redis://localhost:6379"').replace(/^DATABASE_REDIS_URL=/m, 'DATABASE_REDIS_URL="redis://localhost:6379"');
|
|
35938
|
-
await Bun.write(
|
|
35939
|
-
await Bun.write(
|
|
35940
|
-
await Bun.write(
|
|
35842
|
+
const envContent = env_default.replace(/^DATABASE_URL=/m, 'DATABASE_URL="postgresql://ooneex:ooneex@localhost:5432/ooneex"').replace(/^CACHE_REDIS_URL=/m, 'CACHE_REDIS_URL="redis://localhost:6379"').replace(/^PUBSUB_REDIS_URL=/m, 'PUBSUB_REDIS_URL="redis://localhost:6379"').replace(/^RATE_LIMIT_REDIS_URL=/m, 'RATE_LIMIT_REDIS_URL="redis://localhost:6379"').replace(/^DATABASE_REDIS_URL=/m, 'DATABASE_REDIS_URL="redis://localhost:6379"').replace(/^CSRF_SECRET=/m, `CSRF_SECRET="${random.nanoid(20)}"`);
|
|
35843
|
+
await Bun.write(join11(destination, "modules", "app", ".env"), envContent);
|
|
35844
|
+
await Bun.write(join11(destination, "modules", "app", ".env.example"), env_default);
|
|
35845
|
+
await Bun.write(join11(destination, "modules", "app", "src", "index.ts"), index_ts_default);
|
|
35941
35846
|
await makeModuleCommand.run({
|
|
35942
35847
|
name: "shared",
|
|
35943
35848
|
cwd: destination,
|
|
35944
35849
|
silent: true
|
|
35945
35850
|
});
|
|
35946
|
-
await Bun.write(
|
|
35851
|
+
await Bun.write(join11(destination, "modules", "shared", "src", "databases", "SharedDatabase.ts"), app_database_default);
|
|
35947
35852
|
const snakeName = toSnakeCase(name);
|
|
35948
35853
|
const dockerComposeContent = docker_compose_yml_default.replace(/{{NAME}}/g, snakeName);
|
|
35949
|
-
await Bun.write(
|
|
35854
|
+
await Bun.write(join11(destination, "modules", "app", "docker-compose.yml"), dockerComposeContent);
|
|
35950
35855
|
const dockerfileContent = Dockerfile_default.replace(/{{NAME}}/g, snakeName);
|
|
35951
|
-
await Bun.write(
|
|
35952
|
-
await Bun.write(
|
|
35856
|
+
await Bun.write(join11(destination, "modules", "app", "Dockerfile"), dockerfileContent);
|
|
35857
|
+
await Bun.write(join11(destination, "modules", "app", "var", ".gitkeep"), "");
|
|
35953
35858
|
const gitInit = Bun.spawn(["git", "init"], { cwd: destination, stdout: "ignore", stderr: "inherit" });
|
|
35954
35859
|
await gitInit.exited;
|
|
35955
35860
|
const addDeps = Bun.spawn([
|
|
@@ -36011,9 +35916,9 @@ class MakeAppCommand {
|
|
|
36011
35916
|
await addDevDeps.exited;
|
|
36012
35917
|
const huskyInit = Bun.spawn(["bunx", "husky", "init"], { cwd: destination, stdout: "ignore", stderr: "inherit" });
|
|
36013
35918
|
await huskyInit.exited;
|
|
36014
|
-
await Bun.write(
|
|
36015
|
-
await Bun.write(
|
|
36016
|
-
const logger = new
|
|
35919
|
+
await Bun.write(join11(destination, ".husky", "pre-commit"), "lint-staged");
|
|
35920
|
+
await Bun.write(join11(destination, ".husky", "commit-msg"), `bunx commitlint --edit "$1"`);
|
|
35921
|
+
const logger = new TerminalLogger10;
|
|
36017
35922
|
logger.success(`${kebabName} created successfully at ${destination}`, undefined, {
|
|
36018
35923
|
showTimestamp: false,
|
|
36019
35924
|
showArrow: false,
|
|
@@ -36022,8 +35927,122 @@ class MakeAppCommand {
|
|
|
36022
35927
|
}
|
|
36023
35928
|
}
|
|
36024
35929
|
MakeAppCommand = __legacyDecorateClassTS([
|
|
36025
|
-
|
|
35930
|
+
decorator11.command()
|
|
36026
35931
|
], MakeAppCommand);
|
|
35932
|
+
// src/commands/MakeBenchmarkCommand.ts
|
|
35933
|
+
import { join as join12 } from "path";
|
|
35934
|
+
import { decorator as decorator12 } from "@ooneex/command";
|
|
35935
|
+
import { TerminalLogger as TerminalLogger11 } from "@ooneex/logger";
|
|
35936
|
+
class MakeBenchmarkCommand {
|
|
35937
|
+
getName() {
|
|
35938
|
+
return "make:benchmark";
|
|
35939
|
+
}
|
|
35940
|
+
getDescription() {
|
|
35941
|
+
return "Generate a new benchmark file";
|
|
35942
|
+
}
|
|
35943
|
+
parseController(content) {
|
|
35944
|
+
const methodMatch = content.match(/@Route\.(get|post|patch|put|delete|options|head)\(/);
|
|
35945
|
+
const method = methodMatch?.[1]?.toUpperCase() ?? "GET";
|
|
35946
|
+
const pathMatch = content.match(/@Route\.\w+\("([^"]+)"/);
|
|
35947
|
+
const path = pathMatch?.[1] ?? "/";
|
|
35948
|
+
const nameMatch = content.match(/name:\s*"([^"]+)"/);
|
|
35949
|
+
const name = nameMatch?.[1] ?? "";
|
|
35950
|
+
const descriptionMatch = content.match(/description:\s*"([^"]+)"/);
|
|
35951
|
+
const description = descriptionMatch?.[1] ?? "";
|
|
35952
|
+
const params = this.parseParams(content);
|
|
35953
|
+
const queries = this.parseAssertBlock(content, "queries");
|
|
35954
|
+
const payload = this.parseAssertBlock(content, "payload");
|
|
35955
|
+
return { name, path, method, description, params, queries, payload };
|
|
35956
|
+
}
|
|
35957
|
+
parseParams(content) {
|
|
35958
|
+
const params = {};
|
|
35959
|
+
const paramsMatch = content.match(/params:\s*\{([^}]*Assert[^}]+)\}/);
|
|
35960
|
+
if (paramsMatch?.[1]) {
|
|
35961
|
+
const keys = paramsMatch[1].matchAll(/(\w+):\s*Assert\(/g);
|
|
35962
|
+
for (const match of keys) {
|
|
35963
|
+
if (match[1]) {
|
|
35964
|
+
params[match[1]] = "";
|
|
35965
|
+
}
|
|
35966
|
+
}
|
|
35967
|
+
}
|
|
35968
|
+
return params;
|
|
35969
|
+
}
|
|
35970
|
+
parseAssertBlock(content, block) {
|
|
35971
|
+
const result = {};
|
|
35972
|
+
const regex = new RegExp(`${block}:\\s*Assert\\(\\{([^}]+)\\}\\)`);
|
|
35973
|
+
const match = content.match(regex);
|
|
35974
|
+
if (match?.[1]) {
|
|
35975
|
+
const fields = match[1].matchAll(/(\w+):\s*"(\w+\??(?:\[\])?)"/g);
|
|
35976
|
+
for (const field of fields) {
|
|
35977
|
+
if (field[1] && field[2]) {
|
|
35978
|
+
const type = field[2].replace("?", "").replace("[]", "");
|
|
35979
|
+
result[field[1]] = type === "number" ? 0 : "";
|
|
35980
|
+
}
|
|
35981
|
+
}
|
|
35982
|
+
}
|
|
35983
|
+
return result;
|
|
35984
|
+
}
|
|
35985
|
+
async run(options) {
|
|
35986
|
+
let { name, module, target } = options;
|
|
35987
|
+
if (!name) {
|
|
35988
|
+
name = await askName({ message: "Enter benchmark name" });
|
|
35989
|
+
}
|
|
35990
|
+
if (!target) {
|
|
35991
|
+
target = await askName({ message: "Enter target controller name (e.g., UpdateStatusController)" });
|
|
35992
|
+
}
|
|
35993
|
+
const targetName = target.replace(/Controller$/, "");
|
|
35994
|
+
if (module) {
|
|
35995
|
+
await ensureModule(module);
|
|
35996
|
+
}
|
|
35997
|
+
const base = module ? join12("modules", module) : ".";
|
|
35998
|
+
const controllersLocalDir = join12(base, "src", "controllers");
|
|
35999
|
+
const controllersDir = join12(process.cwd(), controllersLocalDir);
|
|
36000
|
+
const controllerFilePath = join12(controllersDir, `${targetName}Controller.ts`);
|
|
36001
|
+
const controllerFile = Bun.file(controllerFilePath);
|
|
36002
|
+
if (!await controllerFile.exists()) {
|
|
36003
|
+
const logger2 = new TerminalLogger11;
|
|
36004
|
+
logger2.error(`Controller not found: ${controllerFilePath}`, undefined, {
|
|
36005
|
+
showTimestamp: false,
|
|
36006
|
+
showArrow: false,
|
|
36007
|
+
useSymbol: true
|
|
36008
|
+
});
|
|
36009
|
+
return;
|
|
36010
|
+
}
|
|
36011
|
+
const controllerContent = await controllerFile.text();
|
|
36012
|
+
const routeInfo = this.parseController(controllerContent);
|
|
36013
|
+
const benchmark = {
|
|
36014
|
+
name: routeInfo.name,
|
|
36015
|
+
path: routeInfo.path,
|
|
36016
|
+
method: routeInfo.method,
|
|
36017
|
+
description: routeInfo.description
|
|
36018
|
+
};
|
|
36019
|
+
if (Object.keys(routeInfo.params).length > 0) {
|
|
36020
|
+
benchmark.params = routeInfo.params;
|
|
36021
|
+
}
|
|
36022
|
+
if (Object.keys(routeInfo.queries).length > 0) {
|
|
36023
|
+
benchmark.queries = routeInfo.queries;
|
|
36024
|
+
}
|
|
36025
|
+
if (Object.keys(routeInfo.payload).length > 0) {
|
|
36026
|
+
benchmark.payload = routeInfo.payload;
|
|
36027
|
+
}
|
|
36028
|
+
benchmark.connections = 10;
|
|
36029
|
+
benchmark.duration = 10;
|
|
36030
|
+
const jsonContent = JSON.stringify(benchmark, null, 2);
|
|
36031
|
+
const benchmarkFileName = `${name}.bench.json`;
|
|
36032
|
+
const filePath = join12(controllersDir, benchmarkFileName);
|
|
36033
|
+
await Bun.write(filePath, `${jsonContent}
|
|
36034
|
+
`);
|
|
36035
|
+
const logger = new TerminalLogger11;
|
|
36036
|
+
logger.success(`${join12(controllersLocalDir, benchmarkFileName)} created successfully`, undefined, {
|
|
36037
|
+
showTimestamp: false,
|
|
36038
|
+
showArrow: false,
|
|
36039
|
+
useSymbol: true
|
|
36040
|
+
});
|
|
36041
|
+
}
|
|
36042
|
+
}
|
|
36043
|
+
MakeBenchmarkCommand = __legacyDecorateClassTS([
|
|
36044
|
+
decorator12.command()
|
|
36045
|
+
], MakeBenchmarkCommand);
|
|
36027
36046
|
// src/commands/MakeCacheCommand.ts
|
|
36028
36047
|
import { join as join13 } from "path";
|
|
36029
36048
|
import { decorator as decorator13 } from "@ooneex/command";
|
|
@@ -38164,9 +38183,11 @@ describe("{{NAME}}Mailer", () => {
|
|
|
38164
38183
|
|
|
38165
38184
|
// src/templates/mailer/mailer.txt
|
|
38166
38185
|
var mailer_default = `import { inject } from "@ooneex/container";
|
|
38186
|
+
import { decorator } from "@ooneex/mailer";
|
|
38167
38187
|
import type { IMailer } from "@ooneex/mailer";
|
|
38168
38188
|
import { type {{NAME}}MailerPropsType, {{NAME}}MailerTemplate } from "./{{NAME}}MailerTemplate";
|
|
38169
38189
|
|
|
38190
|
+
@decorator.mailer()
|
|
38170
38191
|
export class {{NAME}}Mailer implements IMailer {
|
|
38171
38192
|
constructor(
|
|
38172
38193
|
@inject("mailer")
|
|
@@ -50707,4 +50728,4 @@ SeedRunCommand = __legacyDecorateClassTS([
|
|
|
50707
50728
|
// src/index.ts
|
|
50708
50729
|
await run();
|
|
50709
50730
|
|
|
50710
|
-
//# debugId=
|
|
50731
|
+
//# debugId=6FD20A60137D728764756E2164756E21
|