@pitcher/cli-scripts 2.19.0 → 2.20.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 CHANGED
File without changes
@@ -22,7 +22,9 @@ export interface AnalyticsKpiOpts extends CommonOpts {
22
22
  * org/instance rollups (Django), this hits `clickhouse.pitcher.com` with the
23
23
  * org api-key; the caller inherits the key user's real role. Dates are required
24
24
  * by the server for activity-metric types (inventory counts like
25
- * `total-members` need none) — that validation stays server-side.
25
+ * `total-members` need none) — that validation stays server-side, as does the
26
+ * set of valid `type` values (a bad one comes back as a 400 listing them). There
27
+ * is no aggregate `all` type, so `--type` is required.
26
28
  */
27
29
  export declare function runAnalyticsKpi(opts: AnalyticsKpiOpts, deps?: AnalyticsDeps): Promise<Envelope<unknown>>;
28
30
  export interface AnalyticsEngagementOpts extends CommonOpts {
@@ -32,16 +32,20 @@ export async function runAnalyticsInstance(opts, deps = {}) {
32
32
  * org/instance rollups (Django), this hits `clickhouse.pitcher.com` with the
33
33
  * org api-key; the caller inherits the key user's real role. Dates are required
34
34
  * by the server for activity-metric types (inventory counts like
35
- * `total-members` need none) — that validation stays server-side.
35
+ * `total-members` need none) — that validation stays server-side, as does the
36
+ * set of valid `type` values (a bad one comes back as a 400 listing them). There
37
+ * is no aggregate `all` type, so `--type` is required.
36
38
  */
37
39
  export async function runAnalyticsKpi(opts, deps = {}) {
38
40
  try {
39
41
  if (!opts.instanceId)
40
42
  throw createCliError('VALIDATION', '--instance-id is required for analytics kpi');
43
+ if (!opts.type)
44
+ throw createCliError('VALIDATION', '--type is required for analytics kpi');
41
45
  const client = clickhouseClientFor(opts, deps);
42
46
  const params = {
43
47
  instance_id: opts.instanceId,
44
- type: opts.type || 'all',
48
+ type: opts.type,
45
49
  };
46
50
  if (opts.startDate)
47
51
  params.start_date = opts.startDate;
@@ -376,7 +380,7 @@ export function createAnalyticsCommand() {
376
380
  });
377
381
  withAuthFlags(cmd.command('kpi'))
378
382
  .option('--instance-id <id>', 'Instance ID (required)')
379
- .option('--type <type>', "KPI type, e.g. total-members, total-active-users (default 'all')")
383
+ .option('--type <type>', 'KPI type, e.g. total-members, total-active-users (required)')
380
384
  .option('--start-date <iso>', 'Window start (ISO date; required by the server for activity metrics)')
381
385
  .option('--end-date <iso>', 'Window end (ISO date; required by the server for activity metrics)')
382
386
  .option('--group-ids <csv>', 'Comma-separated distribution-group IDs to scope by')
@@ -25,7 +25,7 @@ export const analyticsTools = [
25
25
  '(inventory counts like total-members do not).',
26
26
  inputShape: {
27
27
  instanceId: z.string().describe('Instance ID (required)'),
28
- type: z.string().optional().describe("KPI type, e.g. total-members, total-active-users (default 'all')"),
28
+ type: z.string().describe('KPI type, e.g. total-members, total-active-users (required)'),
29
29
  startDate: z.string().optional().describe('Window start, ISO date (required by the server for activity metrics)'),
30
30
  endDate: z.string().optional().describe('Window end, ISO date (required by the server for activity metrics)'),
31
31
  groupIds: z.string().optional().describe('Comma-separated distribution-group IDs to scope by'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pitcher/cli-scripts",
3
- "version": "2.19.0",
3
+ "version": "2.20.0",
4
4
  "description": "The Pitcher CLI for various tasks in its ecosystem.",
5
5
  "author": "Pitcher AG",
6
6
  "license": "MIT",