gangtise-openapi-cli 0.10.6 → 0.10.7

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/src/cli.js CHANGED
@@ -86,7 +86,7 @@ async function printData(data, format, output, cache) {
86
86
  }
87
87
  if (normalized && typeof normalized === "object" && !Array.isArray(normalized)) {
88
88
  const meta = normalized;
89
- if (typeof meta.total === "number") {
89
+ if (typeof meta.total === "number" && format !== "json") {
90
90
  const listLen = Array.isArray(meta.list) ? meta.list.length : 0;
91
91
  process.stderr.write(`Total: ${meta.total}, showing: ${listLen}\n`);
92
92
  }
@@ -446,9 +446,25 @@ fundamental.command("main-business").requiredOption("--security-code <code>").op
446
446
  const client = await createClient();
447
447
  await printData(await client.call("fundamental.main-business", { securityCode: options.securityCode, startDate: options.startDate, endDate: options.endDate, breakdown: options.breakdown, periodList: maybeArray(options.period), fieldList: maybeArray(options.field) }), parseFormat(options.format), options.output);
448
448
  });
449
- fundamental.command("valuation-analysis").requiredOption("--security-code <code>").addOption(new Option("--indicator <name>", "Indicator").choices(["peTtm", "pbMrq", "peg", "psTtm", "pcfTtm", "em"]).makeOptionMandatory()).option("--start-date <date>").option("--end-date <date>").option("--limit <number>").option("--field <field>", "Field", collectList, []).option("--format <format>", "Output format", "table").option("--output <path>").action(async (options) => {
450
- const client = await createClient();
451
- await printData(await client.call("fundamental.valuation-analysis", { securityCode: options.securityCode, indicator: options.indicator, startDate: options.startDate, endDate: options.endDate, limit: options.limit ? Number(options.limit) : undefined, fieldList: maybeArray(options.field) }), parseFormat(options.format), options.output);
449
+ fundamental.command("valuation-analysis").requiredOption("--security-code <code>").addOption(new Option("--indicator <name>", "Indicator").choices(["peTtm", "pbMrq", "peg", "psTtm", "pcfTtm", "em"]).makeOptionMandatory()).option("--start-date <date>").option("--end-date <date>").option("--limit <number>").option("--field <field>", "Field", collectList, []).option("--skip-null", "Drop rows where value or percentileRank is null").option("--format <format>", "Output format", "table").option("--output <path>").action(async (options) => {
450
+ const client = await createClient();
451
+ let data = await client.call("fundamental.valuation-analysis", { securityCode: options.securityCode, indicator: options.indicator, startDate: options.startDate, endDate: options.endDate, limit: options.limit ? Number(options.limit) : undefined, fieldList: maybeArray(options.field) });
452
+ if (options.skipNull) {
453
+ const normalized = await normalizeRows(data);
454
+ if (normalized && typeof normalized === "object" && !Array.isArray(normalized)) {
455
+ const rec = normalized;
456
+ if (Array.isArray(rec.list)) {
457
+ const filtered = rec.list.filter((row) => {
458
+ if (!row || typeof row !== "object")
459
+ return false;
460
+ const r = row;
461
+ return r.value != null && r.percentileRank != null;
462
+ });
463
+ data = { ...rec, list: filtered, total: filtered.length };
464
+ }
465
+ }
466
+ }
467
+ await printData(data, parseFormat(options.format), options.output);
452
468
  });
453
469
  fundamental.command("earning-forecast").requiredOption("--security-code <code>").option("--start-date <date>", "Start date (default: 1 year before end-date)").option("--end-date <date>", "End date (default: today)").option("--consensus <name>", "Consensus indicator: netIncome/netIncomeYoy/eps/pe/bps/pb/peg/roe/ps", collectList, []).option("--format <format>", "Output format", "table").option("--output <path>").action(async (options) => {
454
470
  const client = await createClient();
@@ -1,2 +1,2 @@
1
1
  // Auto-generated — DO NOT EDIT
2
- export const CLI_VERSION = "0.10.6";
2
+ export const CLI_VERSION = "0.10.7";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gangtise-openapi-cli",
3
- "version": "0.10.6",
3
+ "version": "0.10.7",
4
4
  "description": "CLI for Gangtise OpenAPI",
5
5
  "license": "MIT",
6
6
  "repository": {