@ainyc/canonry 4.11.1 → 4.12.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.
@@ -12,7 +12,7 @@ import {
12
12
  queryGenerateRequestSchema,
13
13
  runTriggerRequestSchema,
14
14
  scheduleUpsertRequestSchema
15
- } from "./chunk-565T7PMC.js";
15
+ } from "./chunk-YDGT5CAY.js";
16
16
 
17
17
  // src/config.ts
18
18
  import fs from "fs";
@@ -753,6 +753,21 @@ var ApiClient = class {
753
753
  const qs = params ? "?" + new URLSearchParams(params).toString() : "";
754
754
  return this.request("GET", `/projects/${encodeURIComponent(project)}/ga/session-history${qs}`);
755
755
  }
756
+ // Traffic — server-side ingestion
757
+ async trafficConnectCloudRun(project, body) {
758
+ return this.request(
759
+ "POST",
760
+ `/projects/${encodeURIComponent(project)}/traffic/connect/cloud-run`,
761
+ body
762
+ );
763
+ }
764
+ async trafficSync(project, sourceId, body) {
765
+ return this.request(
766
+ "POST",
767
+ `/projects/${encodeURIComponent(project)}/traffic/sources/${encodeURIComponent(sourceId)}/sync`,
768
+ body ?? {}
769
+ );
770
+ }
756
771
  async wordpressConnect(project, body) {
757
772
  return this.request("POST", `/projects/${encodeURIComponent(project)}/wordpress/connect`, body);
758
773
  }
@@ -87,7 +87,8 @@ var runKindSchema = z2.enum([
87
87
  "ga-sync",
88
88
  "bing-inspect",
89
89
  "bing-inspect-sitemap",
90
- "backlink-extract"
90
+ "backlink-extract",
91
+ "traffic-sync"
91
92
  ]);
92
93
  var RunKinds = runKindSchema.enum;
93
94
  var runTriggerSchema = z2.enum(["manual", "scheduled", "config-apply"]);
@@ -2184,6 +2185,52 @@ var normalizedTrafficPullPageSchema = z20.object({
2184
2185
  nextPageToken: z20.string().optional(),
2185
2186
  filter: z20.string()
2186
2187
  });
2188
+ var trafficSourceStatusSchema = z20.enum(["connected", "paused", "error", "archived"]);
2189
+ var TrafficSourceStatuses = trafficSourceStatusSchema.enum;
2190
+ var trafficSourceAuthModeSchema = z20.enum(["oauth", "service-account"]);
2191
+ var TrafficSourceAuthModes = trafficSourceAuthModeSchema.enum;
2192
+ var cloudRunSourceConfigSchema = z20.object({
2193
+ gcpProjectId: z20.string().min(1),
2194
+ serviceName: z20.string().nullable().optional(),
2195
+ location: z20.string().nullable().optional(),
2196
+ authMode: trafficSourceAuthModeSchema
2197
+ });
2198
+ var trafficSourceDtoSchema = z20.object({
2199
+ id: z20.string(),
2200
+ projectId: z20.string(),
2201
+ sourceType: trafficSourceTypeSchema,
2202
+ displayName: z20.string(),
2203
+ status: trafficSourceStatusSchema,
2204
+ lastSyncedAt: z20.string().nullable(),
2205
+ lastCursor: z20.string().nullable(),
2206
+ lastError: z20.string().nullable(),
2207
+ archivedAt: z20.string().nullable(),
2208
+ config: z20.record(z20.string(), z20.unknown()),
2209
+ createdAt: z20.string(),
2210
+ updatedAt: z20.string()
2211
+ });
2212
+ var trafficConnectCloudRunRequestSchema = z20.object({
2213
+ gcpProjectId: z20.string().min(1),
2214
+ serviceName: z20.string().min(1).optional(),
2215
+ location: z20.string().min(1).optional(),
2216
+ displayName: z20.string().min(1).optional(),
2217
+ /** Service-account JSON content (string). When omitted, defaults to OAuth via `canonry google connect <project> --type ga4` flow. */
2218
+ keyJson: z20.string().optional()
2219
+ });
2220
+ var trafficSyncResponseSchema = z20.object({
2221
+ sourceId: z20.string(),
2222
+ runId: z20.string(),
2223
+ syncedAt: z20.string(),
2224
+ pulledEvents: z20.number().int().nonnegative(),
2225
+ crawlerHits: z20.number().int().nonnegative(),
2226
+ aiReferralHits: z20.number().int().nonnegative(),
2227
+ unknownHits: z20.number().int().nonnegative(),
2228
+ crawlerBucketRows: z20.number().int().nonnegative(),
2229
+ aiReferralBucketRows: z20.number().int().nonnegative(),
2230
+ sampleRows: z20.number().int().nonnegative(),
2231
+ windowStart: z20.string(),
2232
+ windowEnd: z20.string()
2233
+ });
2187
2234
 
2188
2235
  export {
2189
2236
  __export,
@@ -2274,5 +2321,10 @@ export {
2274
2321
  dedupeReportOpportunities,
2275
2322
  CodingAgents,
2276
2323
  skillsClientSchema,
2277
- SkillsClients
2324
+ SkillsClients,
2325
+ TrafficSourceTypes,
2326
+ TrafficEvidenceKinds,
2327
+ TrafficEventConfidences,
2328
+ TrafficSourceStatuses,
2329
+ TrafficSourceAuthModes
2278
2330
  };