@ainyc/canonry 3.2.2 → 3.2.5

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.
@@ -62,7 +62,7 @@ import {
62
62
  visibilityStateFromAnswerMentioned,
63
63
  windowCutoff,
64
64
  wordpressEnvSchema
65
- } from "./chunk-TBFRAJU2.js";
65
+ } from "./chunk-PS7JRDL3.js";
66
66
  import {
67
67
  IntelligenceService,
68
68
  agentMemory,
@@ -100,7 +100,7 @@ import {
100
100
  runs,
101
101
  schedules,
102
102
  usageCounters
103
- } from "./chunk-UQH5SKM2.js";
103
+ } from "./chunk-ZCPZOVVE.js";
104
104
 
105
105
  // src/telemetry.ts
106
106
  import crypto from "crypto";
@@ -8695,6 +8695,7 @@ function gaLog(level, action, ctx) {
8695
8695
  stream.write(JSON.stringify(entry) + "\n");
8696
8696
  }
8697
8697
  function formatSharePct(numerator, total) {
8698
+ if (numerator > 0 && total <= 0) return "\u2014";
8698
8699
  if (total <= 0 || numerator <= 0) return "0%";
8699
8700
  const pct = numerator / total * 100;
8700
8701
  const rounded = Math.round(pct);
@@ -8895,10 +8896,10 @@ async function ga4Routes(app, opts) {
8895
8896
  if (only !== void 0 && !validOnlyValues.includes(only)) {
8896
8897
  throw validationError(`Invalid "only" value "${only}". Must be one of: ${validOnlyValues.join(", ")}`);
8897
8898
  }
8898
- const syncTraffic = !only || only === "traffic";
8899
+ const syncTraffic = true;
8900
+ const syncSummary = true;
8899
8901
  const syncAi = !only || only === "ai";
8900
8902
  const syncSocial = !only || only === "social";
8901
- const syncSummary = !only;
8902
8903
  const startedAt = (/* @__PURE__ */ new Date()).toISOString();
8903
8904
  const runId = crypto16.randomUUID();
8904
8905
  app.db.insert(runs).values({
@@ -9021,7 +9022,12 @@ async function ga4Routes(app, opts) {
9021
9022
  }
9022
9023
  });
9023
9024
  app.db.update(runs).set({ status: RunStatuses.completed, finishedAt: now }).where(eq20(runs.id, runId)).run();
9024
- const syncedComponents = only ? [only, ...only !== "social" && only !== "ai" && only !== "traffic" ? [] : []] : void 0;
9025
+ const syncedComponents = only ? [
9026
+ ...syncTraffic ? ["traffic"] : [],
9027
+ ...syncSummary ? ["summary"] : [],
9028
+ ...syncAi ? ["ai"] : [],
9029
+ ...syncSocial ? ["social"] : []
9030
+ ] : void 0;
9025
9031
  gaLog("info", "sync.complete", {
9026
9032
  projectId: project.id,
9027
9033
  runId,
@@ -1342,15 +1342,15 @@ var ga4TrafficSummaryDtoSchema = z12.object({
1342
1342
  directSharePct: z12.number(),
1343
1343
  /** Social sessions as a percentage of total sessions (0–100, rounded). */
1344
1344
  socialSharePct: z12.number(),
1345
- /** Display string for organicSharePct ('10%' or '<1%' when there are sessions but the rounded pct is 0). */
1345
+ /** Display string for organicSharePct: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
1346
1346
  organicSharePctDisplay: z12.string(),
1347
- /** Display string for aiSharePct ('5%' or '<1%' when there are sessions but the rounded pct is 0). */
1347
+ /** Display string for aiSharePct: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
1348
1348
  aiSharePctDisplay: z12.string(),
1349
- /** Display string for aiSharePctBySession ('5%' or '<1%' when there are sessions but the rounded pct is 0). */
1349
+ /** Display string for aiSharePctBySession: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
1350
1350
  aiSharePctBySessionDisplay: z12.string(),
1351
- /** Display string for directSharePct ('20%' or '<1%' when there are sessions but the rounded pct is 0). */
1351
+ /** Display string for directSharePct: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
1352
1352
  directSharePctDisplay: z12.string(),
1353
- /** Display string for socialSharePct ('15%' or '<1%' when there are sessions but the rounded pct is 0). */
1353
+ /** Display string for socialSharePct: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
1354
1354
  socialSharePctDisplay: z12.string(),
1355
1355
  lastSyncedAt: z12.string().nullable()
1356
1356
  });