@referalli/cli 0.4.11 → 0.4.12

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.
@@ -191,6 +191,13 @@ function consentCheck(c, programs, scope) {
191
191
  ? [{ id, status: 'warn', message: `tracking consent is 'none': ${why}${listed}`, fix: `PUT /v1/org/tracking-consent {"mode":"auto"} (or /settings → Install)` }]
192
192
  : [{ id, status: 'ok', message: `tracking consent: ${c.mode}${listed}` }];
193
193
  }
194
+ /** RF-2 for program-scoped keys (no org read): the same check from each program's effectiveTrackingConsent. */
195
+ function programConsentCheck(programs, scope) {
196
+ if (programs.length === 0 || programs.some((p) => !p.effectiveTrackingConsent))
197
+ return []; // older API
198
+ const orgMode = programs.find((p) => !p.trackingConsent)?.effectiveTrackingConsent ?? 'none';
199
+ return consentCheck({ mode: orgMode }, programs, scope);
200
+ }
194
201
  async function trackingCheck(client, env, programs, scope) {
195
202
  const org = await client.request('GET', '/v1/org');
196
203
  const out = [];
@@ -324,7 +331,7 @@ export function printChecks(out, checks, json) {
324
331
  // What a program-scoped key is refused (the API's programScopedAllows), and the scope an org-wide key needs instead.
325
332
  const ORG_WIDE = {
326
333
  auth: { what: 'auth connections, Atlas sign-ups', scope: 'integrations:read or connections:read' },
327
- tracking: { what: 'tracking token, consent mode, configured token', scope: 'org:read' },
334
+ tracking: { what: 'tracking token, configured token', scope: 'org:read' },
328
335
  health: { what: 'GET /v1/integration-health', scope: 'integrations:read' },
329
336
  payouts: { what: 'payout connections', scope: 'payouts:read' },
330
337
  email: { what: 'email settings', scope: 'org:read' },
@@ -442,6 +449,7 @@ export async function runDoctor(io, client, flags, now = new Date()) {
442
449
  guard('billing', undefined, async () => billingChecks(scope, await billingList, tally)),
443
450
  orgWide('auth', () => authChecks(client, now, programs, scope, tally)),
444
451
  orgWide('tracking', () => trackingCheck(client, io.env, programs, scope)),
452
+ ...(scoped && scope ? [guard('tracking.consent', undefined, async () => programConsentCheck(programs, scope))] : []),
445
453
  orgWide('health', async () => healthChecks(client, scope, await billingList.catch(() => []), tally)),
446
454
  orgWide('payouts', () => payoutChecks(client, programs, apiKey?.livemode !== false)),
447
455
  orgWide('email', () => emailChecks(client, programs)),
@@ -1,2 +1,2 @@
1
1
  /** Kept in step with package.json by test/version.test.ts. */
2
- export declare const VERSION = "0.4.11";
2
+ export declare const VERSION = "0.4.12";
@@ -1,2 +1,2 @@
1
1
  /** Kept in step with package.json by test/version.test.ts. */
2
- export const VERSION = '0.4.11';
2
+ export const VERSION = '0.4.12';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@referalli/cli",
3
- "version": "0.4.11",
3
+ "version": "0.4.12",
4
4
  "description": "The Referalli command line: sign in, forward webhooks to localhost, trigger test events, tail events and API logs.",
5
5
  "license": "MIT",
6
6
  "type": "module",