@wrangled/cli 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/dist/main.js +10 -0
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -126,6 +126,7 @@ const commands = {
126
126
  if (options.format === "json")
127
127
  return printJson({ funnel });
128
128
  printReport(`Funnel by ${funnel.grain}`, funnel, ["period", "currency"], FUNNEL_NUMBERS);
129
+ printLeftOut(funnel.left_out, "sales, revenue_net and roas");
129
130
  },
130
131
  },
131
132
  money: {
@@ -145,6 +146,7 @@ const commands = {
145
146
  }
146
147
  if (money.refund_days.length > 0)
147
148
  console.log(`\nBiggest refund days:\n${renderTable(["date", "currency", "refunds"], money.refund_days)}`);
149
+ printLeftOut(money.left_out, "roas (net still counts it)");
148
150
  },
149
151
  },
150
152
  campaigns: {
@@ -158,6 +160,7 @@ const commands = {
158
160
  return printJson({ campaignResults });
159
161
  const title = campaignResults.channel === null ? "Campaigns, best first" : `${campaignResults.channel} campaigns, best first`;
160
162
  printReport(title, campaignResults, ["channel", "campaign_id", "campaign_name", "currency"], CAMPAIGN_NUMBERS);
163
+ printLeftOut(campaignResults.left_out, "the totals (the rows keep it)");
161
164
  },
162
165
  },
163
166
  "tools list": {
@@ -1447,6 +1450,13 @@ function reportQuery(options, extra) {
1447
1450
  return query.size ? `?${query}` : "";
1448
1451
  }
1449
1452
  /** The rows, then the totals, which are one row per currency. */
1453
+ /** What confirmed leave-out rules took out of `figures`, one line per rule and currency. */
1454
+ function printLeftOut(leftOut, figures) {
1455
+ if (!leftOut?.length)
1456
+ return;
1457
+ const rows = leftOut.flatMap((l) => l.amounts.map((a) => ({ fact: l.fact_id, currency: a.currency, revenue: a.revenue, sales: a.sales, rule: l.summary })));
1458
+ console.log(`\nLeft out of ${figures} by confirmed leave-out rules:\n${renderTable(["fact", "currency", "revenue", "sales", "rule"], rows)}`);
1459
+ }
1450
1460
  function printReport(title, report, labels, numbers) {
1451
1461
  if (report.rows.length === 0)
1452
1462
  return console.log(`No numbers from ${report.from} to ${report.to}.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrangled/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Command-line access to your marketing data warehouse, for people and coding agents",
5
5
  "type": "module",
6
6
  "bin": {