@ainyc/canonry 4.69.0 → 4.69.2
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/assets/agent-workspace/skills/canonry/references/canonry-cli.md +20 -1
- package/assets/assets/{BacklinksPage-BXVoTc3S.js → BacklinksPage-C4PM9i3H.js} +1 -1
- package/assets/assets/{ChartPrimitives-pJRJPd17.js → ChartPrimitives-nxvyoxCn.js} +1 -1
- package/assets/assets/ProjectPage-C-Xn3lJ1.js +6 -0
- package/assets/assets/{RunRow-DPL4FxPl.js → RunRow-DRncrtMo.js} +1 -1
- package/assets/assets/{RunsPage-B4dCG_66.js → RunsPage-cFFewGZB.js} +1 -1
- package/assets/assets/{SettingsPage-D8aWhLsU.js → SettingsPage-BxL_din4.js} +1 -1
- package/assets/assets/{TrafficPage-COZa5_Q_.js → TrafficPage-CKDv33KP.js} +1 -1
- package/assets/assets/{TrafficSourceDetailPage-CN8Cx6YI.js → TrafficSourceDetailPage-yMUcgBbw.js} +1 -1
- package/assets/assets/{extract-error-message-D8g8YXDH.js → extract-error-message-D3DfO_Ep.js} +1 -1
- package/assets/assets/{index-DPO3uDWZ.js → index-mVWwxF_h.js} +86 -86
- package/assets/assets/{server-traffic-0JT1Vbj_.js → server-traffic-D4hR4Sy6.js} +1 -1
- package/assets/assets/{trash-2-_1TgguOP.js → trash-2-DmBrLnSR.js} +1 -1
- package/assets/index.html +1 -1
- package/dist/{chunk-D75O5A27.js → chunk-5FM7QRYD.js} +1558 -1526
- package/dist/{chunk-WQ44ZXGQ.js → chunk-SBYA3LEJ.js} +4 -4
- package/dist/{chunk-B2CH7GBW.js → chunk-WFM2O72W.js} +465 -307
- package/dist/{chunk-YYFBMDLC.js → chunk-ZNWMVYYU.js} +53 -1
- package/dist/cli.js +195 -79
- package/dist/index.js +4 -4
- package/dist/{intelligence-service-IUKD3PMZ.js → intelligence-service-DVVSE3G7.js} +2 -2
- package/dist/mcp.js +2 -2
- package/package.json +9 -9
- package/assets/assets/ProjectPage-CQ1_itHh.js +0 -6
|
@@ -570,12 +570,40 @@ var auditLogEntrySchema = z3.object({
|
|
|
570
570
|
createdAt: z3.string()
|
|
571
571
|
});
|
|
572
572
|
|
|
573
|
+
// ../contracts/src/api-keys.ts
|
|
574
|
+
import { z as z4 } from "zod";
|
|
575
|
+
var apiKeyDtoSchema = z4.object({
|
|
576
|
+
id: z4.string(),
|
|
577
|
+
name: z4.string(),
|
|
578
|
+
/** First 9 chars of the raw token (`cnry_` + 4 hex). Safe to display. */
|
|
579
|
+
keyPrefix: z4.string(),
|
|
580
|
+
scopes: z4.array(z4.string()),
|
|
581
|
+
createdAt: z4.string(),
|
|
582
|
+
lastUsedAt: z4.string().nullable(),
|
|
583
|
+
revokedAt: z4.string().nullable()
|
|
584
|
+
});
|
|
585
|
+
var apiKeyListDtoSchema = z4.object({
|
|
586
|
+
keys: z4.array(apiKeyDtoSchema)
|
|
587
|
+
});
|
|
588
|
+
var createApiKeyRequestSchema = z4.object({
|
|
589
|
+
name: z4.string().min(1).max(100),
|
|
590
|
+
/**
|
|
591
|
+
* Scopes granted to the new key. Omit to default to `['*']` (full access,
|
|
592
|
+
* what `canonry init` writes for the root key). When provided it must be a
|
|
593
|
+
* non-empty list — an empty array would mint a key that can do nothing.
|
|
594
|
+
*/
|
|
595
|
+
scopes: z4.array(z4.string()).min(1).optional()
|
|
596
|
+
});
|
|
597
|
+
var createdApiKeyDtoSchema = apiKeyDtoSchema.extend({
|
|
598
|
+
key: z4.string()
|
|
599
|
+
});
|
|
600
|
+
|
|
573
601
|
// ../contracts/src/config-schema.ts
|
|
574
|
-
import { z as
|
|
602
|
+
import { z as z6 } from "zod";
|
|
575
603
|
|
|
576
604
|
// ../contracts/src/notification.ts
|
|
577
|
-
import { z as
|
|
578
|
-
var notificationEventSchema =
|
|
605
|
+
import { z as z5 } from "zod";
|
|
606
|
+
var notificationEventSchema = z5.enum([
|
|
579
607
|
"citation.lost",
|
|
580
608
|
"citation.gained",
|
|
581
609
|
"run.completed",
|
|
@@ -583,76 +611,76 @@ var notificationEventSchema = z4.enum([
|
|
|
583
611
|
"insight.critical",
|
|
584
612
|
"insight.high"
|
|
585
613
|
]);
|
|
586
|
-
var notificationDtoSchema =
|
|
587
|
-
id:
|
|
588
|
-
projectId:
|
|
589
|
-
channel:
|
|
590
|
-
url:
|
|
591
|
-
urlDisplay:
|
|
592
|
-
urlHost:
|
|
593
|
-
events:
|
|
594
|
-
enabled:
|
|
614
|
+
var notificationDtoSchema = z5.object({
|
|
615
|
+
id: z5.string(),
|
|
616
|
+
projectId: z5.string(),
|
|
617
|
+
channel: z5.literal("webhook"),
|
|
618
|
+
url: z5.string().url(),
|
|
619
|
+
urlDisplay: z5.string(),
|
|
620
|
+
urlHost: z5.string(),
|
|
621
|
+
events: z5.array(notificationEventSchema),
|
|
622
|
+
enabled: z5.boolean().default(true),
|
|
595
623
|
/** Opaque tag identifying the creator (e.g. `"agent"` for Aero webhooks). */
|
|
596
|
-
source:
|
|
597
|
-
webhookSecret:
|
|
598
|
-
createdAt:
|
|
599
|
-
updatedAt:
|
|
624
|
+
source: z5.string().optional(),
|
|
625
|
+
webhookSecret: z5.string().optional(),
|
|
626
|
+
createdAt: z5.string(),
|
|
627
|
+
updatedAt: z5.string()
|
|
600
628
|
});
|
|
601
|
-
var notificationCreateRequestSchema =
|
|
602
|
-
channel:
|
|
603
|
-
url:
|
|
604
|
-
events:
|
|
605
|
-
source:
|
|
629
|
+
var notificationCreateRequestSchema = z5.object({
|
|
630
|
+
channel: z5.literal("webhook"),
|
|
631
|
+
url: z5.string().url(),
|
|
632
|
+
events: z5.array(notificationEventSchema).min(1),
|
|
633
|
+
source: z5.string().optional()
|
|
606
634
|
});
|
|
607
635
|
|
|
608
636
|
// ../contracts/src/config-schema.ts
|
|
609
|
-
var configMetadataSchema =
|
|
610
|
-
name:
|
|
637
|
+
var configMetadataSchema = z6.object({
|
|
638
|
+
name: z6.string().min(1).max(63).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/, {
|
|
611
639
|
message: "Name must be a lowercase slug (letters, numbers, hyphens)"
|
|
612
640
|
}),
|
|
613
|
-
labels:
|
|
641
|
+
labels: z6.record(z6.string(), z6.string()).optional().default({})
|
|
614
642
|
});
|
|
615
|
-
var configScheduleSchema =
|
|
616
|
-
preset:
|
|
617
|
-
cron:
|
|
618
|
-
timezone:
|
|
619
|
-
providers:
|
|
643
|
+
var configScheduleSchema = z6.object({
|
|
644
|
+
preset: z6.string().optional(),
|
|
645
|
+
cron: z6.string().optional(),
|
|
646
|
+
timezone: z6.string().optional().default("UTC"),
|
|
647
|
+
providers: z6.array(providerNameSchema).optional().default([])
|
|
620
648
|
}).refine(
|
|
621
649
|
(data) => data.preset && !data.cron || !data.preset && data.cron,
|
|
622
650
|
{ message: 'Exactly one of "preset" or "cron" must be provided' }
|
|
623
651
|
).optional();
|
|
624
|
-
var configNotificationSchema =
|
|
625
|
-
channel:
|
|
626
|
-
url:
|
|
627
|
-
events:
|
|
628
|
-
});
|
|
629
|
-
var configGoogleSchema =
|
|
630
|
-
gsc:
|
|
631
|
-
propertyUrl:
|
|
652
|
+
var configNotificationSchema = z6.object({
|
|
653
|
+
channel: z6.literal("webhook"),
|
|
654
|
+
url: z6.string().url(),
|
|
655
|
+
events: z6.array(notificationEventSchema).min(1)
|
|
656
|
+
});
|
|
657
|
+
var configGoogleSchema = z6.object({
|
|
658
|
+
gsc: z6.object({
|
|
659
|
+
propertyUrl: z6.string()
|
|
632
660
|
}).optional(),
|
|
633
|
-
syncSchedule:
|
|
634
|
-
preset:
|
|
635
|
-
cron:
|
|
661
|
+
syncSchedule: z6.object({
|
|
662
|
+
preset: z6.string().optional(),
|
|
663
|
+
cron: z6.string().optional()
|
|
636
664
|
}).optional()
|
|
637
665
|
}).optional();
|
|
638
|
-
var configQueryListSchema =
|
|
639
|
-
var configSpecSchema =
|
|
640
|
-
displayName:
|
|
641
|
-
canonicalDomain:
|
|
642
|
-
ownedDomains:
|
|
643
|
-
aliases:
|
|
644
|
-
country:
|
|
645
|
-
language:
|
|
666
|
+
var configQueryListSchema = z6.array(z6.string().min(1));
|
|
667
|
+
var configSpecSchema = z6.object({
|
|
668
|
+
displayName: z6.string().min(1),
|
|
669
|
+
canonicalDomain: z6.string().min(1),
|
|
670
|
+
ownedDomains: z6.array(z6.string().min(1)).optional().default([]),
|
|
671
|
+
aliases: z6.array(z6.string().min(1)).optional().default([]),
|
|
672
|
+
country: z6.string().length(2),
|
|
673
|
+
language: z6.string().min(2),
|
|
646
674
|
queries: configQueryListSchema.optional(),
|
|
647
675
|
keywords: configQueryListSchema.optional(),
|
|
648
|
-
competitors:
|
|
649
|
-
providers:
|
|
650
|
-
locations:
|
|
651
|
-
defaultLocation:
|
|
676
|
+
competitors: z6.array(z6.string().min(1)).optional().default([]),
|
|
677
|
+
providers: z6.array(providerNameSchema).optional().default([]),
|
|
678
|
+
locations: z6.array(locationContextSchema).optional().default([]),
|
|
679
|
+
defaultLocation: z6.string().optional(),
|
|
652
680
|
schedule: configScheduleSchema,
|
|
653
|
-
notifications:
|
|
681
|
+
notifications: z6.array(configNotificationSchema).optional().default([]),
|
|
654
682
|
google: configGoogleSchema,
|
|
655
|
-
autoExtractBacklinks:
|
|
683
|
+
autoExtractBacklinks: z6.boolean().optional().default(false)
|
|
656
684
|
}).superRefine((spec, ctx) => {
|
|
657
685
|
if (spec.queries !== void 0 && spec.keywords !== void 0) {
|
|
658
686
|
ctx.addIssue({
|
|
@@ -677,9 +705,9 @@ var configSpecSchema = z5.object({
|
|
|
677
705
|
});
|
|
678
706
|
}
|
|
679
707
|
});
|
|
680
|
-
var projectConfigSchema =
|
|
681
|
-
apiVersion:
|
|
682
|
-
kind:
|
|
708
|
+
var projectConfigSchema = z6.object({
|
|
709
|
+
apiVersion: z6.literal("canonry/v1"),
|
|
710
|
+
kind: z6.literal("Project"),
|
|
683
711
|
metadata: configMetadataSchema,
|
|
684
712
|
spec: configSpecSchema
|
|
685
713
|
});
|
|
@@ -688,330 +716,330 @@ function resolveConfigSpecQueries(spec) {
|
|
|
688
716
|
}
|
|
689
717
|
|
|
690
718
|
// ../contracts/src/google.ts
|
|
691
|
-
import { z as
|
|
692
|
-
var googleConnectionTypeSchema =
|
|
693
|
-
var googleConnectionDtoSchema =
|
|
694
|
-
id:
|
|
695
|
-
domain:
|
|
719
|
+
import { z as z7 } from "zod";
|
|
720
|
+
var googleConnectionTypeSchema = z7.enum(["gsc", "ga4", "gbp"]);
|
|
721
|
+
var googleConnectionDtoSchema = z7.object({
|
|
722
|
+
id: z7.string(),
|
|
723
|
+
domain: z7.string(),
|
|
696
724
|
connectionType: googleConnectionTypeSchema,
|
|
697
|
-
propertyId:
|
|
698
|
-
sitemapUrl:
|
|
699
|
-
scopes:
|
|
700
|
-
createdAt:
|
|
701
|
-
updatedAt:
|
|
702
|
-
});
|
|
703
|
-
var gscSearchDataDtoSchema =
|
|
704
|
-
date:
|
|
705
|
-
query:
|
|
706
|
-
page:
|
|
707
|
-
country:
|
|
708
|
-
device:
|
|
709
|
-
clicks:
|
|
710
|
-
impressions:
|
|
711
|
-
ctr:
|
|
712
|
-
position:
|
|
713
|
-
});
|
|
714
|
-
var gscPerformanceDailyPointSchema =
|
|
715
|
-
date:
|
|
716
|
-
clicks:
|
|
717
|
-
impressions:
|
|
718
|
-
ctr:
|
|
719
|
-
});
|
|
720
|
-
var gscPerformanceDailyDtoSchema =
|
|
721
|
-
totals:
|
|
722
|
-
clicks:
|
|
723
|
-
impressions:
|
|
724
|
-
ctr:
|
|
725
|
-
days:
|
|
725
|
+
propertyId: z7.string().nullable().optional(),
|
|
726
|
+
sitemapUrl: z7.string().nullable().optional(),
|
|
727
|
+
scopes: z7.array(z7.string()).default([]),
|
|
728
|
+
createdAt: z7.string(),
|
|
729
|
+
updatedAt: z7.string()
|
|
730
|
+
});
|
|
731
|
+
var gscSearchDataDtoSchema = z7.object({
|
|
732
|
+
date: z7.string(),
|
|
733
|
+
query: z7.string(),
|
|
734
|
+
page: z7.string(),
|
|
735
|
+
country: z7.string().nullable().optional(),
|
|
736
|
+
device: z7.string().nullable().optional(),
|
|
737
|
+
clicks: z7.number(),
|
|
738
|
+
impressions: z7.number(),
|
|
739
|
+
ctr: z7.number(),
|
|
740
|
+
position: z7.number()
|
|
741
|
+
});
|
|
742
|
+
var gscPerformanceDailyPointSchema = z7.object({
|
|
743
|
+
date: z7.string(),
|
|
744
|
+
clicks: z7.number(),
|
|
745
|
+
impressions: z7.number(),
|
|
746
|
+
ctr: z7.number()
|
|
747
|
+
});
|
|
748
|
+
var gscPerformanceDailyDtoSchema = z7.object({
|
|
749
|
+
totals: z7.object({
|
|
750
|
+
clicks: z7.number(),
|
|
751
|
+
impressions: z7.number(),
|
|
752
|
+
ctr: z7.number(),
|
|
753
|
+
days: z7.number()
|
|
726
754
|
}),
|
|
727
|
-
daily:
|
|
728
|
-
});
|
|
729
|
-
var gscUrlInspectionDtoSchema =
|
|
730
|
-
id:
|
|
731
|
-
url:
|
|
732
|
-
indexingState:
|
|
733
|
-
verdict:
|
|
734
|
-
coverageState:
|
|
735
|
-
pageFetchState:
|
|
736
|
-
robotsTxtState:
|
|
737
|
-
crawlTime:
|
|
738
|
-
lastCrawlResult:
|
|
739
|
-
isMobileFriendly:
|
|
740
|
-
richResults:
|
|
755
|
+
daily: z7.array(gscPerformanceDailyPointSchema)
|
|
756
|
+
});
|
|
757
|
+
var gscUrlInspectionDtoSchema = z7.object({
|
|
758
|
+
id: z7.string(),
|
|
759
|
+
url: z7.string(),
|
|
760
|
+
indexingState: z7.string().nullable().optional(),
|
|
761
|
+
verdict: z7.string().nullable().optional(),
|
|
762
|
+
coverageState: z7.string().nullable().optional(),
|
|
763
|
+
pageFetchState: z7.string().nullable().optional(),
|
|
764
|
+
robotsTxtState: z7.string().nullable().optional(),
|
|
765
|
+
crawlTime: z7.string().nullable().optional(),
|
|
766
|
+
lastCrawlResult: z7.string().nullable().optional(),
|
|
767
|
+
isMobileFriendly: z7.boolean().nullable().optional(),
|
|
768
|
+
richResults: z7.array(z7.string()).default([]),
|
|
741
769
|
// Spec gap: server has returned `referringUrls` since the GSC inspect
|
|
742
770
|
// route shipped (see google.ts handler at /gsc/inspect + /gsc/inspections),
|
|
743
771
|
// but the schema dropped the field so the generated TS client (and
|
|
744
772
|
// anything else reading from this DTO) lost the data silently. Adding
|
|
745
773
|
// here restores end-to-end visibility.
|
|
746
|
-
referringUrls:
|
|
747
|
-
inspectedAt:
|
|
748
|
-
});
|
|
749
|
-
var indexTransitionSchema =
|
|
750
|
-
var gscDeindexedRowSchema =
|
|
751
|
-
url:
|
|
752
|
-
previousState:
|
|
753
|
-
currentState:
|
|
754
|
-
transitionDate:
|
|
755
|
-
});
|
|
756
|
-
var gscReasonGroupSchema =
|
|
757
|
-
reason:
|
|
758
|
-
count:
|
|
759
|
-
urls:
|
|
760
|
-
});
|
|
761
|
-
var gscCoverageSummaryDtoSchema =
|
|
762
|
-
summary:
|
|
763
|
-
total:
|
|
764
|
-
indexed:
|
|
765
|
-
notIndexed:
|
|
766
|
-
deindexed:
|
|
767
|
-
percentage:
|
|
774
|
+
referringUrls: z7.array(z7.string()).default([]),
|
|
775
|
+
inspectedAt: z7.string()
|
|
776
|
+
});
|
|
777
|
+
var indexTransitionSchema = z7.enum(["stable", "reindexed", "deindexed", "still-missing", "new"]);
|
|
778
|
+
var gscDeindexedRowSchema = z7.object({
|
|
779
|
+
url: z7.string(),
|
|
780
|
+
previousState: z7.string().nullable(),
|
|
781
|
+
currentState: z7.string().nullable(),
|
|
782
|
+
transitionDate: z7.string()
|
|
783
|
+
});
|
|
784
|
+
var gscReasonGroupSchema = z7.object({
|
|
785
|
+
reason: z7.string(),
|
|
786
|
+
count: z7.number(),
|
|
787
|
+
urls: z7.array(gscUrlInspectionDtoSchema).default([])
|
|
788
|
+
});
|
|
789
|
+
var gscCoverageSummaryDtoSchema = z7.object({
|
|
790
|
+
summary: z7.object({
|
|
791
|
+
total: z7.number(),
|
|
792
|
+
indexed: z7.number(),
|
|
793
|
+
notIndexed: z7.number(),
|
|
794
|
+
deindexed: z7.number(),
|
|
795
|
+
percentage: z7.number()
|
|
768
796
|
}),
|
|
769
|
-
lastInspectedAt:
|
|
770
|
-
lastSyncedAt:
|
|
771
|
-
indexed:
|
|
772
|
-
notIndexed:
|
|
773
|
-
deindexed:
|
|
774
|
-
reasonGroups:
|
|
775
|
-
});
|
|
776
|
-
var indexingNotificationDtoSchema =
|
|
777
|
-
url:
|
|
778
|
-
type:
|
|
779
|
-
notifiedAt:
|
|
780
|
-
});
|
|
781
|
-
var indexingRequestResultDtoSchema =
|
|
782
|
-
url:
|
|
783
|
-
type:
|
|
784
|
-
notifiedAt:
|
|
785
|
-
status:
|
|
786
|
-
error:
|
|
787
|
-
});
|
|
788
|
-
var indexingRequestResponseDtoSchema =
|
|
789
|
-
summary:
|
|
790
|
-
total:
|
|
791
|
-
succeeded:
|
|
792
|
-
failed:
|
|
797
|
+
lastInspectedAt: z7.string().nullable(),
|
|
798
|
+
lastSyncedAt: z7.string().nullable(),
|
|
799
|
+
indexed: z7.array(gscUrlInspectionDtoSchema).default([]),
|
|
800
|
+
notIndexed: z7.array(gscUrlInspectionDtoSchema).default([]),
|
|
801
|
+
deindexed: z7.array(gscDeindexedRowSchema).default([]),
|
|
802
|
+
reasonGroups: z7.array(gscReasonGroupSchema).default([])
|
|
803
|
+
});
|
|
804
|
+
var indexingNotificationDtoSchema = z7.object({
|
|
805
|
+
url: z7.string(),
|
|
806
|
+
type: z7.enum(["URL_UPDATED", "URL_DELETED"]),
|
|
807
|
+
notifiedAt: z7.string()
|
|
808
|
+
});
|
|
809
|
+
var indexingRequestResultDtoSchema = z7.object({
|
|
810
|
+
url: z7.string(),
|
|
811
|
+
type: z7.enum(["URL_UPDATED", "URL_DELETED"]),
|
|
812
|
+
notifiedAt: z7.string(),
|
|
813
|
+
status: z7.enum(["success", "error"]),
|
|
814
|
+
error: z7.string().optional()
|
|
815
|
+
});
|
|
816
|
+
var indexingRequestResponseDtoSchema = z7.object({
|
|
817
|
+
summary: z7.object({
|
|
818
|
+
total: z7.number().int().nonnegative(),
|
|
819
|
+
succeeded: z7.number().int().nonnegative(),
|
|
820
|
+
failed: z7.number().int().nonnegative()
|
|
793
821
|
}),
|
|
794
|
-
results:
|
|
795
|
-
});
|
|
796
|
-
var gscCoverageSnapshotDtoSchema =
|
|
797
|
-
date:
|
|
798
|
-
indexed:
|
|
799
|
-
notIndexed:
|
|
800
|
-
reasonBreakdown:
|
|
801
|
-
});
|
|
802
|
-
var gscSiteDtoSchema =
|
|
803
|
-
siteUrl:
|
|
804
|
-
permissionLevel:
|
|
805
|
-
});
|
|
806
|
-
var gscSiteListResponseDtoSchema =
|
|
807
|
-
sites:
|
|
808
|
-
});
|
|
809
|
-
var gscSitemapContentDtoSchema =
|
|
810
|
-
type:
|
|
811
|
-
submitted:
|
|
812
|
-
indexed:
|
|
813
|
-
});
|
|
814
|
-
var gscSitemapDtoSchema =
|
|
815
|
-
path:
|
|
816
|
-
lastSubmitted:
|
|
817
|
-
isPending:
|
|
818
|
-
isSitemapsIndex:
|
|
819
|
-
type:
|
|
820
|
-
lastDownloaded:
|
|
821
|
-
warnings:
|
|
822
|
-
errors:
|
|
823
|
-
contents:
|
|
824
|
-
});
|
|
825
|
-
var gscSitemapListResponseDtoSchema =
|
|
826
|
-
sitemaps:
|
|
822
|
+
results: z7.array(indexingRequestResultDtoSchema).default([])
|
|
823
|
+
});
|
|
824
|
+
var gscCoverageSnapshotDtoSchema = z7.object({
|
|
825
|
+
date: z7.string(),
|
|
826
|
+
indexed: z7.number(),
|
|
827
|
+
notIndexed: z7.number(),
|
|
828
|
+
reasonBreakdown: z7.record(z7.string(), z7.number()).default({})
|
|
829
|
+
});
|
|
830
|
+
var gscSiteDtoSchema = z7.object({
|
|
831
|
+
siteUrl: z7.string(),
|
|
832
|
+
permissionLevel: z7.string()
|
|
833
|
+
});
|
|
834
|
+
var gscSiteListResponseDtoSchema = z7.object({
|
|
835
|
+
sites: z7.array(gscSiteDtoSchema).default([])
|
|
836
|
+
});
|
|
837
|
+
var gscSitemapContentDtoSchema = z7.object({
|
|
838
|
+
type: z7.string(),
|
|
839
|
+
submitted: z7.string(),
|
|
840
|
+
indexed: z7.string()
|
|
841
|
+
});
|
|
842
|
+
var gscSitemapDtoSchema = z7.object({
|
|
843
|
+
path: z7.string(),
|
|
844
|
+
lastSubmitted: z7.string().optional(),
|
|
845
|
+
isPending: z7.boolean().optional(),
|
|
846
|
+
isSitemapsIndex: z7.boolean().optional(),
|
|
847
|
+
type: z7.string().optional(),
|
|
848
|
+
lastDownloaded: z7.string().optional(),
|
|
849
|
+
warnings: z7.string().optional(),
|
|
850
|
+
errors: z7.string().optional(),
|
|
851
|
+
contents: z7.array(gscSitemapContentDtoSchema).optional()
|
|
852
|
+
});
|
|
853
|
+
var gscSitemapListResponseDtoSchema = z7.object({
|
|
854
|
+
sitemaps: z7.array(gscSitemapDtoSchema).default([])
|
|
827
855
|
});
|
|
828
856
|
|
|
829
857
|
// ../contracts/src/gbp.ts
|
|
830
|
-
import { z as
|
|
831
|
-
var gbpAccountDtoSchema =
|
|
858
|
+
import { z as z8 } from "zod";
|
|
859
|
+
var gbpAccountDtoSchema = z8.object({
|
|
832
860
|
/** Resource name, "accounts/{n}". */
|
|
833
|
-
name:
|
|
861
|
+
name: z8.string(),
|
|
834
862
|
/** Human-readable account name, or null when Google omits it. */
|
|
835
|
-
accountName:
|
|
863
|
+
accountName: z8.string().nullable(),
|
|
836
864
|
/** Account type (PERSONAL, LOCATION_GROUP, ORGANIZATION, …) when present. */
|
|
837
|
-
type:
|
|
865
|
+
type: z8.string().nullable(),
|
|
838
866
|
/** The OAuth user's role on the account (OWNER, MANAGER, …) when present. */
|
|
839
|
-
role:
|
|
867
|
+
role: z8.string().nullable()
|
|
840
868
|
});
|
|
841
|
-
var gbpAccountListResponseSchema =
|
|
842
|
-
accounts:
|
|
843
|
-
total:
|
|
869
|
+
var gbpAccountListResponseSchema = z8.object({
|
|
870
|
+
accounts: z8.array(gbpAccountDtoSchema),
|
|
871
|
+
total: z8.number().int().nonnegative()
|
|
844
872
|
});
|
|
845
|
-
var gbpLocationDtoSchema =
|
|
846
|
-
id:
|
|
847
|
-
projectId:
|
|
848
|
-
accountName:
|
|
849
|
-
locationName:
|
|
850
|
-
displayName:
|
|
851
|
-
primaryCategoryDisplayName:
|
|
852
|
-
storefrontAddress:
|
|
853
|
-
websiteUri:
|
|
873
|
+
var gbpLocationDtoSchema = z8.object({
|
|
874
|
+
id: z8.string(),
|
|
875
|
+
projectId: z8.string(),
|
|
876
|
+
accountName: z8.string(),
|
|
877
|
+
locationName: z8.string(),
|
|
878
|
+
displayName: z8.string(),
|
|
879
|
+
primaryCategoryDisplayName: z8.string().nullable(),
|
|
880
|
+
storefrontAddress: z8.string().nullable(),
|
|
881
|
+
websiteUri: z8.string().nullable(),
|
|
854
882
|
// Google Maps Place ID + public Maps link (from location metadata; null when
|
|
855
883
|
// the location is not on Maps). `placeId` is the join key to the Places API.
|
|
856
|
-
placeId:
|
|
857
|
-
mapsUri:
|
|
858
|
-
selected:
|
|
859
|
-
syncedAt:
|
|
860
|
-
createdAt:
|
|
861
|
-
updatedAt:
|
|
884
|
+
placeId: z8.string().nullable(),
|
|
885
|
+
mapsUri: z8.string().nullable(),
|
|
886
|
+
selected: z8.boolean(),
|
|
887
|
+
syncedAt: z8.string().nullable(),
|
|
888
|
+
createdAt: z8.string(),
|
|
889
|
+
updatedAt: z8.string()
|
|
862
890
|
});
|
|
863
|
-
var gbpLocationListResponseSchema =
|
|
864
|
-
locations:
|
|
865
|
-
totalDiscovered:
|
|
866
|
-
totalSelected:
|
|
891
|
+
var gbpLocationListResponseSchema = z8.object({
|
|
892
|
+
locations: z8.array(gbpLocationDtoSchema),
|
|
893
|
+
totalDiscovered: z8.number().int().nonnegative(),
|
|
894
|
+
totalSelected: z8.number().int().nonnegative()
|
|
867
895
|
});
|
|
868
|
-
var gbpDiscoverRequestSchema =
|
|
869
|
-
selectAllNew:
|
|
896
|
+
var gbpDiscoverRequestSchema = z8.object({
|
|
897
|
+
selectAllNew: z8.boolean().default(true),
|
|
870
898
|
/**
|
|
871
899
|
* Discover locations under this specific account ("accounts/{n}"). Omit to
|
|
872
900
|
* use the account the project already tracks, falling back to the first
|
|
873
901
|
* account the OAuth user can see on the very first discover.
|
|
874
902
|
*/
|
|
875
|
-
accountName:
|
|
903
|
+
accountName: z8.string().optional(),
|
|
876
904
|
/**
|
|
877
905
|
* Permit replacing the project's locations when `accountName` names a
|
|
878
906
|
* DIFFERENT account than the one currently tracked. Switching is destructive
|
|
879
907
|
* (it clears the old account's locations + synced data), so it must be opted
|
|
880
908
|
* into explicitly — otherwise a mismatched account is rejected.
|
|
881
909
|
*/
|
|
882
|
-
switchAccount:
|
|
910
|
+
switchAccount: z8.boolean().default(false)
|
|
883
911
|
});
|
|
884
|
-
var gbpLocationSelectionRequestSchema =
|
|
885
|
-
selected:
|
|
912
|
+
var gbpLocationSelectionRequestSchema = z8.object({
|
|
913
|
+
selected: z8.boolean()
|
|
886
914
|
});
|
|
887
|
-
var gbpSyncRequestSchema =
|
|
915
|
+
var gbpSyncRequestSchema = z8.object({
|
|
888
916
|
/** Restrict the sync to specific locations (resource names). Omit = all selected. */
|
|
889
|
-
locationNames:
|
|
890
|
-
daysOfMetrics:
|
|
891
|
-
monthsOfKeywords:
|
|
917
|
+
locationNames: z8.array(z8.string()).optional(),
|
|
918
|
+
daysOfMetrics: z8.number().int().positive().max(540).optional(),
|
|
919
|
+
monthsOfKeywords: z8.number().int().positive().max(18).optional()
|
|
892
920
|
});
|
|
893
|
-
var gbpSyncResponseSchema =
|
|
894
|
-
runId:
|
|
895
|
-
status:
|
|
921
|
+
var gbpSyncResponseSchema = z8.object({
|
|
922
|
+
runId: z8.string(),
|
|
923
|
+
status: z8.string()
|
|
896
924
|
});
|
|
897
|
-
var gbpDailyMetricDtoSchema =
|
|
898
|
-
locationName:
|
|
899
|
-
date:
|
|
900
|
-
metric:
|
|
901
|
-
value:
|
|
925
|
+
var gbpDailyMetricDtoSchema = z8.object({
|
|
926
|
+
locationName: z8.string(),
|
|
927
|
+
date: z8.string(),
|
|
928
|
+
metric: z8.string(),
|
|
929
|
+
value: z8.number().int()
|
|
902
930
|
});
|
|
903
|
-
var gbpDailyMetricListResponseSchema =
|
|
904
|
-
metrics:
|
|
905
|
-
total:
|
|
931
|
+
var gbpDailyMetricListResponseSchema = z8.object({
|
|
932
|
+
metrics: z8.array(gbpDailyMetricDtoSchema),
|
|
933
|
+
total: z8.number().int().nonnegative()
|
|
906
934
|
});
|
|
907
|
-
var gbpKeywordImpressionDtoSchema =
|
|
908
|
-
locationName:
|
|
935
|
+
var gbpKeywordImpressionDtoSchema = z8.object({
|
|
936
|
+
locationName: z8.string(),
|
|
909
937
|
// The Performance API returns one impressions figure per keyword aggregated
|
|
910
938
|
// over the whole requested range — it does NOT break the count down by month.
|
|
911
939
|
// `periodStart`/`periodEnd` (both YYYY-MM, inclusive) record that trailing
|
|
912
940
|
// window so the figure is never mistaken for a single calendar month.
|
|
913
|
-
periodStart:
|
|
914
|
-
periodEnd:
|
|
915
|
-
keyword:
|
|
941
|
+
periodStart: z8.string(),
|
|
942
|
+
periodEnd: z8.string(),
|
|
943
|
+
keyword: z8.string(),
|
|
916
944
|
/** Exact impressions over [periodStart, periodEnd], or null when Google redacted to a threshold. */
|
|
917
|
-
valueCount:
|
|
945
|
+
valueCount: z8.number().int().nullable(),
|
|
918
946
|
/** Privacy floor, or null when an exact value is available. */
|
|
919
|
-
valueThreshold:
|
|
947
|
+
valueThreshold: z8.number().int().nullable()
|
|
920
948
|
});
|
|
921
|
-
var gbpKeywordImpressionListResponseSchema =
|
|
922
|
-
keywords:
|
|
923
|
-
total:
|
|
949
|
+
var gbpKeywordImpressionListResponseSchema = z8.object({
|
|
950
|
+
keywords: z8.array(gbpKeywordImpressionDtoSchema),
|
|
951
|
+
total: z8.number().int().nonnegative(),
|
|
924
952
|
/** Share of returned keywords that are privacy-thresholded (0–100, rounded). */
|
|
925
|
-
thresholdedPct:
|
|
926
|
-
});
|
|
927
|
-
var gbpPlaceActionDtoSchema =
|
|
928
|
-
locationName:
|
|
929
|
-
placeActionLinkName:
|
|
930
|
-
placeActionType:
|
|
931
|
-
uri:
|
|
932
|
-
isPreferred:
|
|
933
|
-
providerType:
|
|
934
|
-
});
|
|
935
|
-
var gbpPlaceActionListResponseSchema =
|
|
936
|
-
placeActions:
|
|
937
|
-
total:
|
|
938
|
-
});
|
|
939
|
-
var gbpLodgingDtoSchema =
|
|
940
|
-
locationName:
|
|
953
|
+
thresholdedPct: z8.number().int().min(0).max(100)
|
|
954
|
+
});
|
|
955
|
+
var gbpPlaceActionDtoSchema = z8.object({
|
|
956
|
+
locationName: z8.string(),
|
|
957
|
+
placeActionLinkName: z8.string(),
|
|
958
|
+
placeActionType: z8.string(),
|
|
959
|
+
uri: z8.string().nullable(),
|
|
960
|
+
isPreferred: z8.boolean(),
|
|
961
|
+
providerType: z8.string().nullable()
|
|
962
|
+
});
|
|
963
|
+
var gbpPlaceActionListResponseSchema = z8.object({
|
|
964
|
+
placeActions: z8.array(gbpPlaceActionDtoSchema),
|
|
965
|
+
total: z8.number().int().nonnegative()
|
|
966
|
+
});
|
|
967
|
+
var gbpLodgingDtoSchema = z8.object({
|
|
968
|
+
locationName: z8.string(),
|
|
941
969
|
/** Count of non-empty top-level attribute groups (0 = empty profile / AEO gap). */
|
|
942
|
-
populatedGroupCount:
|
|
943
|
-
syncedAt:
|
|
970
|
+
populatedGroupCount: z8.number().int().nonnegative(),
|
|
971
|
+
syncedAt: z8.string(),
|
|
944
972
|
/** Raw Lodging resource as Google returned it. */
|
|
945
|
-
attributes:
|
|
973
|
+
attributes: z8.record(z8.string(), z8.unknown())
|
|
946
974
|
});
|
|
947
|
-
var gbpLodgingListResponseSchema =
|
|
948
|
-
lodging:
|
|
949
|
-
total:
|
|
975
|
+
var gbpLodgingListResponseSchema = z8.object({
|
|
976
|
+
lodging: z8.array(gbpLodgingDtoSchema),
|
|
977
|
+
total: z8.number().int().nonnegative()
|
|
950
978
|
});
|
|
951
|
-
var gbpPlaceDetailsDtoSchema =
|
|
952
|
-
locationName:
|
|
953
|
-
placeId:
|
|
979
|
+
var gbpPlaceDetailsDtoSchema = z8.object({
|
|
980
|
+
locationName: z8.string(),
|
|
981
|
+
placeId: z8.string(),
|
|
954
982
|
/** Field-mask SKU tier the snapshot was fetched at ('atmosphere' | 'pro'). */
|
|
955
|
-
tier:
|
|
983
|
+
tier: z8.string(),
|
|
956
984
|
/** Amenities the public listing advertises, derived from `place`. */
|
|
957
|
-
amenities:
|
|
985
|
+
amenities: z8.array(z8.string()),
|
|
958
986
|
/** When this listing was last fetched from Places — advances on every fetch, even when the content is unchanged (this is what the refresh-cadence gate reads). */
|
|
959
|
-
syncedAt:
|
|
987
|
+
syncedAt: z8.string(),
|
|
960
988
|
/** Raw Place Details resource as Google returned it. */
|
|
961
|
-
place:
|
|
989
|
+
place: z8.record(z8.string(), z8.unknown())
|
|
962
990
|
});
|
|
963
|
-
var gbpPlaceDetailsListResponseSchema =
|
|
964
|
-
places:
|
|
965
|
-
total:
|
|
991
|
+
var gbpPlaceDetailsListResponseSchema = z8.object({
|
|
992
|
+
places: z8.array(gbpPlaceDetailsDtoSchema),
|
|
993
|
+
total: z8.number().int().nonnegative()
|
|
966
994
|
});
|
|
967
|
-
var gbpSummaryDtoSchema =
|
|
968
|
-
scope:
|
|
969
|
-
locationName:
|
|
970
|
-
locationCount:
|
|
995
|
+
var gbpSummaryDtoSchema = z8.object({
|
|
996
|
+
scope: z8.object({
|
|
997
|
+
locationName: z8.string().nullable(),
|
|
998
|
+
locationCount: z8.number().int().nonnegative()
|
|
971
999
|
}),
|
|
972
|
-
performance:
|
|
973
|
-
totals:
|
|
974
|
-
recent7d:
|
|
975
|
-
prior7d:
|
|
1000
|
+
performance: z8.object({
|
|
1001
|
+
totals: z8.record(z8.string(), z8.number()),
|
|
1002
|
+
recent7d: z8.record(z8.string(), z8.number()),
|
|
1003
|
+
prior7d: z8.record(z8.string(), z8.number()),
|
|
976
1004
|
// Per-metric % change recent-vs-prior, computed over COMPLETE days only
|
|
977
1005
|
// (the windows anchor to `freshness.dataThroughDate`, never the lagging
|
|
978
1006
|
// tail), so a reporting-lag artifact is never shown as a real delta.
|
|
979
|
-
deltaPct:
|
|
1007
|
+
deltaPct: z8.record(z8.string(), z8.number().nullable())
|
|
980
1008
|
}),
|
|
981
1009
|
// GBP Performance data lags a few days; the most recent stored days can be
|
|
982
1010
|
// not-yet-reported zeros. `freshness` lets every renderer mark the trailing
|
|
983
1011
|
// window as pending instead of treating it as a real decline.
|
|
984
|
-
freshness:
|
|
1012
|
+
freshness: z8.object({
|
|
985
1013
|
/** Latest day with reported (non-zero) activity — the last complete day. Null when there's no data. */
|
|
986
|
-
dataThroughDate:
|
|
1014
|
+
dataThroughDate: z8.string().nullable(),
|
|
987
1015
|
/** Max stored metric date (>= dataThroughDate when Google has emitted not-yet-final zero rows). Null when there's no data. */
|
|
988
|
-
latestStoredDate:
|
|
1016
|
+
latestStoredDate: z8.string().nullable(),
|
|
989
1017
|
/** Calendar days between dataThroughDate and the as-of date — the trailing window still pending/unreported. */
|
|
990
|
-
pendingDays:
|
|
1018
|
+
pendingDays: z8.number().int().nonnegative()
|
|
991
1019
|
}),
|
|
992
1020
|
// Daily series (most recent ~30 days) for the trend charts. Each day carries
|
|
993
1021
|
// every metric present in the window (0 where a metric had no row that day),
|
|
994
1022
|
// and a `pending` flag so the lag tail renders distinct, never as zeros.
|
|
995
|
-
timeseries:
|
|
996
|
-
date:
|
|
997
|
-
pending:
|
|
998
|
-
metrics:
|
|
1023
|
+
timeseries: z8.array(z8.object({
|
|
1024
|
+
date: z8.string(),
|
|
1025
|
+
pending: z8.boolean(),
|
|
1026
|
+
metrics: z8.record(z8.string(), z8.number())
|
|
999
1027
|
})),
|
|
1000
|
-
keywords:
|
|
1001
|
-
total:
|
|
1002
|
-
thresholdedCount:
|
|
1003
|
-
thresholdedPct:
|
|
1028
|
+
keywords: z8.object({
|
|
1029
|
+
total: z8.number().int().nonnegative(),
|
|
1030
|
+
thresholdedCount: z8.number().int().nonnegative(),
|
|
1031
|
+
thresholdedPct: z8.number().int().min(0).max(100)
|
|
1004
1032
|
}),
|
|
1005
|
-
placeActions:
|
|
1006
|
-
total:
|
|
1007
|
-
hasReservationCta:
|
|
1008
|
-
hasBookingCta:
|
|
1009
|
-
hasDirectMerchantCta:
|
|
1033
|
+
placeActions: z8.object({
|
|
1034
|
+
total: z8.number().int().nonnegative(),
|
|
1035
|
+
hasReservationCta: z8.boolean(),
|
|
1036
|
+
hasBookingCta: z8.boolean(),
|
|
1037
|
+
hasDirectMerchantCta: z8.boolean()
|
|
1010
1038
|
}),
|
|
1011
|
-
lodging:
|
|
1012
|
-
lodgingLocationCount:
|
|
1013
|
-
populatedLodgingCount:
|
|
1014
|
-
emptyLodgingCount:
|
|
1039
|
+
lodging: z8.object({
|
|
1040
|
+
lodgingLocationCount: z8.number().int().nonnegative(),
|
|
1041
|
+
populatedLodgingCount: z8.number().int().nonnegative(),
|
|
1042
|
+
emptyLodgingCount: z8.number().int().nonnegative()
|
|
1015
1043
|
})
|
|
1016
1044
|
});
|
|
1017
1045
|
var GBP_METRIC_LABELS = {
|
|
@@ -1086,251 +1114,251 @@ function isRetryableHttpError(err) {
|
|
|
1086
1114
|
}
|
|
1087
1115
|
|
|
1088
1116
|
// ../contracts/src/bing.ts
|
|
1089
|
-
import { z as
|
|
1090
|
-
var bingConnectionDtoSchema =
|
|
1091
|
-
id:
|
|
1092
|
-
domain:
|
|
1093
|
-
siteUrl:
|
|
1094
|
-
createdAt:
|
|
1095
|
-
updatedAt:
|
|
1096
|
-
});
|
|
1097
|
-
var bingUrlInspectionDtoSchema =
|
|
1098
|
-
id:
|
|
1099
|
-
url:
|
|
1100
|
-
httpCode:
|
|
1101
|
-
inIndex:
|
|
1102
|
-
lastCrawledDate:
|
|
1103
|
-
inIndexDate:
|
|
1104
|
-
inspectedAt:
|
|
1117
|
+
import { z as z9 } from "zod";
|
|
1118
|
+
var bingConnectionDtoSchema = z9.object({
|
|
1119
|
+
id: z9.string(),
|
|
1120
|
+
domain: z9.string(),
|
|
1121
|
+
siteUrl: z9.string().nullable().optional(),
|
|
1122
|
+
createdAt: z9.string(),
|
|
1123
|
+
updatedAt: z9.string()
|
|
1124
|
+
});
|
|
1125
|
+
var bingUrlInspectionDtoSchema = z9.object({
|
|
1126
|
+
id: z9.string(),
|
|
1127
|
+
url: z9.string(),
|
|
1128
|
+
httpCode: z9.number().nullable().optional(),
|
|
1129
|
+
inIndex: z9.boolean().nullable().optional(),
|
|
1130
|
+
lastCrawledDate: z9.string().nullable().optional(),
|
|
1131
|
+
inIndexDate: z9.string().nullable().optional(),
|
|
1132
|
+
inspectedAt: z9.string(),
|
|
1105
1133
|
// Fields derived from GetUrlInfo response (more reliable than InIndex)
|
|
1106
|
-
documentSize:
|
|
1107
|
-
anchorCount:
|
|
1108
|
-
discoveryDate:
|
|
1109
|
-
});
|
|
1110
|
-
var bingCoverageSummaryDtoSchema =
|
|
1111
|
-
summary:
|
|
1112
|
-
total:
|
|
1113
|
-
indexed:
|
|
1114
|
-
notIndexed:
|
|
1115
|
-
unknown:
|
|
1116
|
-
percentage:
|
|
1134
|
+
documentSize: z9.number().nullable().optional(),
|
|
1135
|
+
anchorCount: z9.number().nullable().optional(),
|
|
1136
|
+
discoveryDate: z9.string().nullable().optional()
|
|
1137
|
+
});
|
|
1138
|
+
var bingCoverageSummaryDtoSchema = z9.object({
|
|
1139
|
+
summary: z9.object({
|
|
1140
|
+
total: z9.number(),
|
|
1141
|
+
indexed: z9.number(),
|
|
1142
|
+
notIndexed: z9.number(),
|
|
1143
|
+
unknown: z9.number().optional(),
|
|
1144
|
+
percentage: z9.number()
|
|
1117
1145
|
}),
|
|
1118
|
-
lastInspectedAt:
|
|
1119
|
-
indexed:
|
|
1120
|
-
notIndexed:
|
|
1121
|
-
unknown:
|
|
1122
|
-
});
|
|
1123
|
-
var bingKeywordStatsDtoSchema =
|
|
1124
|
-
query:
|
|
1125
|
-
impressions:
|
|
1126
|
-
clicks:
|
|
1127
|
-
ctr:
|
|
1128
|
-
averagePosition:
|
|
1129
|
-
});
|
|
1130
|
-
var bingCoverageSnapshotDtoSchema =
|
|
1131
|
-
date:
|
|
1132
|
-
indexed:
|
|
1133
|
-
notIndexed:
|
|
1134
|
-
unknown:
|
|
1135
|
-
});
|
|
1136
|
-
var bingSubmitResultDtoSchema =
|
|
1137
|
-
url:
|
|
1138
|
-
status:
|
|
1139
|
-
submittedAt:
|
|
1140
|
-
error:
|
|
1141
|
-
});
|
|
1142
|
-
var bingIndexingRequestResponseDtoSchema =
|
|
1143
|
-
summary:
|
|
1144
|
-
total:
|
|
1145
|
-
succeeded:
|
|
1146
|
-
failed:
|
|
1146
|
+
lastInspectedAt: z9.string().nullable(),
|
|
1147
|
+
indexed: z9.array(bingUrlInspectionDtoSchema).default([]),
|
|
1148
|
+
notIndexed: z9.array(bingUrlInspectionDtoSchema).default([]),
|
|
1149
|
+
unknown: z9.array(bingUrlInspectionDtoSchema).default([]).optional()
|
|
1150
|
+
});
|
|
1151
|
+
var bingKeywordStatsDtoSchema = z9.object({
|
|
1152
|
+
query: z9.string(),
|
|
1153
|
+
impressions: z9.number(),
|
|
1154
|
+
clicks: z9.number(),
|
|
1155
|
+
ctr: z9.number(),
|
|
1156
|
+
averagePosition: z9.number()
|
|
1157
|
+
});
|
|
1158
|
+
var bingCoverageSnapshotDtoSchema = z9.object({
|
|
1159
|
+
date: z9.string(),
|
|
1160
|
+
indexed: z9.number(),
|
|
1161
|
+
notIndexed: z9.number(),
|
|
1162
|
+
unknown: z9.number()
|
|
1163
|
+
});
|
|
1164
|
+
var bingSubmitResultDtoSchema = z9.object({
|
|
1165
|
+
url: z9.string(),
|
|
1166
|
+
status: z9.enum(["success", "error"]),
|
|
1167
|
+
submittedAt: z9.string(),
|
|
1168
|
+
error: z9.string().optional()
|
|
1169
|
+
});
|
|
1170
|
+
var bingIndexingRequestResponseDtoSchema = z9.object({
|
|
1171
|
+
summary: z9.object({
|
|
1172
|
+
total: z9.number().int().nonnegative(),
|
|
1173
|
+
succeeded: z9.number().int().nonnegative(),
|
|
1174
|
+
failed: z9.number().int().nonnegative()
|
|
1147
1175
|
}),
|
|
1148
|
-
results:
|
|
1176
|
+
results: z9.array(bingSubmitResultDtoSchema).default([])
|
|
1149
1177
|
});
|
|
1150
|
-
var bingSiteDtoSchema =
|
|
1151
|
-
url:
|
|
1152
|
-
verified:
|
|
1178
|
+
var bingSiteDtoSchema = z9.object({
|
|
1179
|
+
url: z9.string(),
|
|
1180
|
+
verified: z9.boolean()
|
|
1153
1181
|
});
|
|
1154
|
-
var bingSitesResponseDtoSchema =
|
|
1155
|
-
sites:
|
|
1182
|
+
var bingSitesResponseDtoSchema = z9.object({
|
|
1183
|
+
sites: z9.array(bingSiteDtoSchema).default([])
|
|
1156
1184
|
});
|
|
1157
|
-
var bingStatusDtoSchema =
|
|
1158
|
-
connected:
|
|
1159
|
-
domain:
|
|
1160
|
-
siteUrl:
|
|
1161
|
-
createdAt:
|
|
1162
|
-
updatedAt:
|
|
1185
|
+
var bingStatusDtoSchema = z9.object({
|
|
1186
|
+
connected: z9.boolean(),
|
|
1187
|
+
domain: z9.string(),
|
|
1188
|
+
siteUrl: z9.string().nullable(),
|
|
1189
|
+
createdAt: z9.string().nullable(),
|
|
1190
|
+
updatedAt: z9.string().nullable()
|
|
1163
1191
|
});
|
|
1164
|
-
var bingConnectResponseDtoSchema =
|
|
1165
|
-
connected:
|
|
1166
|
-
domain:
|
|
1167
|
-
siteUrl:
|
|
1168
|
-
availableSites:
|
|
1192
|
+
var bingConnectResponseDtoSchema = z9.object({
|
|
1193
|
+
connected: z9.boolean(),
|
|
1194
|
+
domain: z9.string(),
|
|
1195
|
+
siteUrl: z9.string().nullable(),
|
|
1196
|
+
availableSites: z9.array(bingSiteDtoSchema).default([])
|
|
1169
1197
|
});
|
|
1170
|
-
var bingSetSiteResponseDtoSchema =
|
|
1171
|
-
siteUrl:
|
|
1198
|
+
var bingSetSiteResponseDtoSchema = z9.object({
|
|
1199
|
+
siteUrl: z9.string()
|
|
1172
1200
|
});
|
|
1173
1201
|
|
|
1174
1202
|
// ../contracts/src/cdp.ts
|
|
1175
|
-
import { z as
|
|
1176
|
-
var cdpTargetStatusDtoSchema =
|
|
1177
|
-
name:
|
|
1178
|
-
alive:
|
|
1179
|
-
lastUsed:
|
|
1203
|
+
import { z as z10 } from "zod";
|
|
1204
|
+
var cdpTargetStatusDtoSchema = z10.object({
|
|
1205
|
+
name: z10.string(),
|
|
1206
|
+
alive: z10.boolean(),
|
|
1207
|
+
lastUsed: z10.string().nullable()
|
|
1180
1208
|
});
|
|
1181
|
-
var cdpStatusDtoSchema =
|
|
1182
|
-
connected:
|
|
1183
|
-
endpoint:
|
|
1184
|
-
version:
|
|
1185
|
-
browserVersion:
|
|
1186
|
-
targets:
|
|
1209
|
+
var cdpStatusDtoSchema = z10.object({
|
|
1210
|
+
connected: z10.boolean(),
|
|
1211
|
+
endpoint: z10.string(),
|
|
1212
|
+
version: z10.string().optional(),
|
|
1213
|
+
browserVersion: z10.string().optional(),
|
|
1214
|
+
targets: z10.array(cdpTargetStatusDtoSchema).default([])
|
|
1187
1215
|
});
|
|
1188
1216
|
|
|
1189
1217
|
// ../contracts/src/wordpress.ts
|
|
1190
|
-
import { z as
|
|
1191
|
-
var wordpressEnvSchema =
|
|
1192
|
-
var wordpressConnectionDtoSchema =
|
|
1193
|
-
projectName:
|
|
1194
|
-
url:
|
|
1195
|
-
stagingUrl:
|
|
1196
|
-
username:
|
|
1218
|
+
import { z as z11 } from "zod";
|
|
1219
|
+
var wordpressEnvSchema = z11.enum(["live", "staging"]);
|
|
1220
|
+
var wordpressConnectionDtoSchema = z11.object({
|
|
1221
|
+
projectName: z11.string(),
|
|
1222
|
+
url: z11.string(),
|
|
1223
|
+
stagingUrl: z11.string().optional(),
|
|
1224
|
+
username: z11.string(),
|
|
1197
1225
|
defaultEnv: wordpressEnvSchema,
|
|
1198
|
-
createdAt:
|
|
1199
|
-
updatedAt:
|
|
1200
|
-
});
|
|
1201
|
-
var wordpressSiteStatusDtoSchema =
|
|
1202
|
-
url:
|
|
1203
|
-
reachable:
|
|
1204
|
-
pageCount:
|
|
1205
|
-
version:
|
|
1206
|
-
error:
|
|
1207
|
-
plugins:
|
|
1208
|
-
authenticatedUser:
|
|
1209
|
-
id:
|
|
1210
|
-
slug:
|
|
1226
|
+
createdAt: z11.string(),
|
|
1227
|
+
updatedAt: z11.string()
|
|
1228
|
+
});
|
|
1229
|
+
var wordpressSiteStatusDtoSchema = z11.object({
|
|
1230
|
+
url: z11.string(),
|
|
1231
|
+
reachable: z11.boolean(),
|
|
1232
|
+
pageCount: z11.number().nullable().optional(),
|
|
1233
|
+
version: z11.string().nullable().optional(),
|
|
1234
|
+
error: z11.string().nullable().optional(),
|
|
1235
|
+
plugins: z11.array(z11.string()).optional(),
|
|
1236
|
+
authenticatedUser: z11.object({
|
|
1237
|
+
id: z11.number(),
|
|
1238
|
+
slug: z11.string()
|
|
1211
1239
|
}).nullable().optional()
|
|
1212
1240
|
});
|
|
1213
|
-
var wordpressStatusDtoSchema =
|
|
1214
|
-
connected:
|
|
1215
|
-
projectName:
|
|
1241
|
+
var wordpressStatusDtoSchema = z11.object({
|
|
1242
|
+
connected: z11.boolean(),
|
|
1243
|
+
projectName: z11.string(),
|
|
1216
1244
|
defaultEnv: wordpressEnvSchema,
|
|
1217
1245
|
live: wordpressSiteStatusDtoSchema.nullable(),
|
|
1218
1246
|
staging: wordpressSiteStatusDtoSchema.nullable(),
|
|
1219
|
-
adminUrl:
|
|
1220
|
-
});
|
|
1221
|
-
var wordpressPageSummaryDtoSchema =
|
|
1222
|
-
id:
|
|
1223
|
-
slug:
|
|
1224
|
-
title:
|
|
1225
|
-
status:
|
|
1226
|
-
modifiedAt:
|
|
1227
|
-
link:
|
|
1228
|
-
});
|
|
1229
|
-
var wordpressSeoStateDtoSchema =
|
|
1230
|
-
title:
|
|
1231
|
-
description:
|
|
1232
|
-
noindex:
|
|
1233
|
-
writable:
|
|
1234
|
-
writeTargets:
|
|
1235
|
-
});
|
|
1236
|
-
var wordpressSchemaBlockDtoSchema =
|
|
1237
|
-
type:
|
|
1238
|
-
json:
|
|
1247
|
+
adminUrl: z11.string().nullable().optional()
|
|
1248
|
+
});
|
|
1249
|
+
var wordpressPageSummaryDtoSchema = z11.object({
|
|
1250
|
+
id: z11.number(),
|
|
1251
|
+
slug: z11.string(),
|
|
1252
|
+
title: z11.string(),
|
|
1253
|
+
status: z11.string(),
|
|
1254
|
+
modifiedAt: z11.string().nullable().optional(),
|
|
1255
|
+
link: z11.string().nullable().optional()
|
|
1256
|
+
});
|
|
1257
|
+
var wordpressSeoStateDtoSchema = z11.object({
|
|
1258
|
+
title: z11.string().nullable(),
|
|
1259
|
+
description: z11.string().nullable(),
|
|
1260
|
+
noindex: z11.boolean().nullable(),
|
|
1261
|
+
writable: z11.boolean().default(false),
|
|
1262
|
+
writeTargets: z11.array(z11.string()).default([])
|
|
1263
|
+
});
|
|
1264
|
+
var wordpressSchemaBlockDtoSchema = z11.object({
|
|
1265
|
+
type: z11.string(),
|
|
1266
|
+
json: z11.record(z11.string(), z11.unknown())
|
|
1239
1267
|
});
|
|
1240
1268
|
var wordpressPageDetailDtoSchema = wordpressPageSummaryDtoSchema.extend({
|
|
1241
1269
|
env: wordpressEnvSchema,
|
|
1242
|
-
content:
|
|
1270
|
+
content: z11.string(),
|
|
1243
1271
|
seo: wordpressSeoStateDtoSchema,
|
|
1244
|
-
schemaBlocks:
|
|
1272
|
+
schemaBlocks: z11.array(wordpressSchemaBlockDtoSchema).default([])
|
|
1245
1273
|
});
|
|
1246
1274
|
var wordpressDiffPageDtoSchema = wordpressPageDetailDtoSchema.extend({
|
|
1247
|
-
contentHash:
|
|
1248
|
-
contentSnippet:
|
|
1249
|
-
});
|
|
1250
|
-
var wordpressManualAssistDtoSchema =
|
|
1251
|
-
manualRequired:
|
|
1252
|
-
targetUrl:
|
|
1253
|
-
adminUrl:
|
|
1254
|
-
content:
|
|
1255
|
-
nextSteps:
|
|
1256
|
-
});
|
|
1257
|
-
var wordpressAuditIssueDtoSchema =
|
|
1258
|
-
slug:
|
|
1259
|
-
severity:
|
|
1260
|
-
code:
|
|
1275
|
+
contentHash: z11.string(),
|
|
1276
|
+
contentSnippet: z11.string()
|
|
1277
|
+
});
|
|
1278
|
+
var wordpressManualAssistDtoSchema = z11.object({
|
|
1279
|
+
manualRequired: z11.literal(true),
|
|
1280
|
+
targetUrl: z11.string(),
|
|
1281
|
+
adminUrl: z11.string().nullable().optional(),
|
|
1282
|
+
content: z11.string(),
|
|
1283
|
+
nextSteps: z11.array(z11.string()).default([])
|
|
1284
|
+
});
|
|
1285
|
+
var wordpressAuditIssueDtoSchema = z11.object({
|
|
1286
|
+
slug: z11.string(),
|
|
1287
|
+
severity: z11.enum(["high", "medium", "low"]),
|
|
1288
|
+
code: z11.enum([
|
|
1261
1289
|
"noindex",
|
|
1262
1290
|
"missing-seo-title",
|
|
1263
1291
|
"missing-meta-description",
|
|
1264
1292
|
"missing-schema",
|
|
1265
1293
|
"thin-content"
|
|
1266
1294
|
]),
|
|
1267
|
-
message:
|
|
1295
|
+
message: z11.string()
|
|
1268
1296
|
});
|
|
1269
|
-
var wordpressAuditPageDtoSchema =
|
|
1270
|
-
slug:
|
|
1271
|
-
title:
|
|
1272
|
-
status:
|
|
1273
|
-
wordCount:
|
|
1297
|
+
var wordpressAuditPageDtoSchema = z11.object({
|
|
1298
|
+
slug: z11.string(),
|
|
1299
|
+
title: z11.string(),
|
|
1300
|
+
status: z11.string(),
|
|
1301
|
+
wordCount: z11.number(),
|
|
1274
1302
|
seo: wordpressSeoStateDtoSchema,
|
|
1275
|
-
schemaPresent:
|
|
1276
|
-
issues:
|
|
1303
|
+
schemaPresent: z11.boolean(),
|
|
1304
|
+
issues: z11.array(wordpressAuditIssueDtoSchema).default([])
|
|
1277
1305
|
});
|
|
1278
|
-
var wordpressBulkMetaEntryResultDtoSchema =
|
|
1279
|
-
slug:
|
|
1280
|
-
status:
|
|
1281
|
-
error:
|
|
1306
|
+
var wordpressBulkMetaEntryResultDtoSchema = z11.object({
|
|
1307
|
+
slug: z11.string(),
|
|
1308
|
+
status: z11.enum(["applied", "skipped", "manual"]),
|
|
1309
|
+
error: z11.string().optional(),
|
|
1282
1310
|
manualAssist: wordpressManualAssistDtoSchema.optional()
|
|
1283
1311
|
});
|
|
1284
|
-
var wordpressBulkMetaResultDtoSchema =
|
|
1312
|
+
var wordpressBulkMetaResultDtoSchema = z11.object({
|
|
1285
1313
|
env: wordpressEnvSchema,
|
|
1286
|
-
strategy:
|
|
1287
|
-
results:
|
|
1314
|
+
strategy: z11.enum(["plugin", "manual"]),
|
|
1315
|
+
results: z11.array(wordpressBulkMetaEntryResultDtoSchema)
|
|
1288
1316
|
});
|
|
1289
|
-
var wordpressSchemaDeployEntryResultDtoSchema =
|
|
1290
|
-
slug:
|
|
1291
|
-
status:
|
|
1292
|
-
schemasInjected:
|
|
1317
|
+
var wordpressSchemaDeployEntryResultDtoSchema = z11.object({
|
|
1318
|
+
slug: z11.string(),
|
|
1319
|
+
status: z11.enum(["deployed", "stripped", "skipped", "failed"]),
|
|
1320
|
+
schemasInjected: z11.array(z11.string()).optional(),
|
|
1293
1321
|
manualAssist: wordpressManualAssistDtoSchema.optional(),
|
|
1294
|
-
error:
|
|
1322
|
+
error: z11.string().optional()
|
|
1295
1323
|
});
|
|
1296
|
-
var wordpressSchemaDeployResultDtoSchema =
|
|
1324
|
+
var wordpressSchemaDeployResultDtoSchema = z11.object({
|
|
1297
1325
|
env: wordpressEnvSchema,
|
|
1298
|
-
results:
|
|
1326
|
+
results: z11.array(wordpressSchemaDeployEntryResultDtoSchema)
|
|
1299
1327
|
});
|
|
1300
|
-
var wordpressSchemaStatusPageDtoSchema =
|
|
1301
|
-
slug:
|
|
1302
|
-
title:
|
|
1303
|
-
canonrySchemas:
|
|
1304
|
-
thirdPartySchemas:
|
|
1305
|
-
hasCanonrySchema:
|
|
1328
|
+
var wordpressSchemaStatusPageDtoSchema = z11.object({
|
|
1329
|
+
slug: z11.string(),
|
|
1330
|
+
title: z11.string(),
|
|
1331
|
+
canonrySchemas: z11.array(z11.string()),
|
|
1332
|
+
thirdPartySchemas: z11.array(z11.string()),
|
|
1333
|
+
hasCanonrySchema: z11.boolean()
|
|
1306
1334
|
});
|
|
1307
|
-
var wordpressSchemaStatusResultDtoSchema =
|
|
1335
|
+
var wordpressSchemaStatusResultDtoSchema = z11.object({
|
|
1308
1336
|
env: wordpressEnvSchema,
|
|
1309
|
-
pages:
|
|
1337
|
+
pages: z11.array(wordpressSchemaStatusPageDtoSchema)
|
|
1310
1338
|
});
|
|
1311
|
-
var wordpressOnboardStepDtoSchema =
|
|
1312
|
-
name:
|
|
1313
|
-
status:
|
|
1314
|
-
summary:
|
|
1315
|
-
error:
|
|
1339
|
+
var wordpressOnboardStepDtoSchema = z11.object({
|
|
1340
|
+
name: z11.string(),
|
|
1341
|
+
status: z11.enum(["completed", "skipped", "failed"]),
|
|
1342
|
+
summary: z11.string().optional(),
|
|
1343
|
+
error: z11.string().optional()
|
|
1316
1344
|
});
|
|
1317
|
-
var wordpressOnboardResultDtoSchema =
|
|
1318
|
-
projectName:
|
|
1319
|
-
steps:
|
|
1345
|
+
var wordpressOnboardResultDtoSchema = z11.object({
|
|
1346
|
+
projectName: z11.string(),
|
|
1347
|
+
steps: z11.array(wordpressOnboardStepDtoSchema)
|
|
1320
1348
|
});
|
|
1321
|
-
var wordpressDiffDtoSchema =
|
|
1322
|
-
slug:
|
|
1349
|
+
var wordpressDiffDtoSchema = z11.object({
|
|
1350
|
+
slug: z11.string(),
|
|
1323
1351
|
live: wordpressDiffPageDtoSchema,
|
|
1324
1352
|
staging: wordpressDiffPageDtoSchema,
|
|
1325
|
-
hasDifferences:
|
|
1326
|
-
differences:
|
|
1327
|
-
title:
|
|
1328
|
-
slug:
|
|
1329
|
-
content:
|
|
1330
|
-
seoTitle:
|
|
1331
|
-
seoDescription:
|
|
1332
|
-
noindex:
|
|
1333
|
-
schema:
|
|
1353
|
+
hasDifferences: z11.boolean(),
|
|
1354
|
+
differences: z11.object({
|
|
1355
|
+
title: z11.boolean(),
|
|
1356
|
+
slug: z11.boolean(),
|
|
1357
|
+
content: z11.boolean(),
|
|
1358
|
+
seoTitle: z11.boolean(),
|
|
1359
|
+
seoDescription: z11.boolean(),
|
|
1360
|
+
noindex: z11.boolean(),
|
|
1361
|
+
schema: z11.boolean()
|
|
1334
1362
|
})
|
|
1335
1363
|
});
|
|
1336
1364
|
|
|
@@ -1372,42 +1400,42 @@ var LlmCapabilities = {
|
|
|
1372
1400
|
var LLM_CAPABILITIES = Object.values(LlmCapabilities);
|
|
1373
1401
|
|
|
1374
1402
|
// ../contracts/src/settings.ts
|
|
1375
|
-
import { z as
|
|
1376
|
-
var providerSummaryEntryDtoSchema =
|
|
1377
|
-
name:
|
|
1378
|
-
displayName:
|
|
1379
|
-
keyUrl:
|
|
1380
|
-
modelHint:
|
|
1381
|
-
model:
|
|
1403
|
+
import { z as z12 } from "zod";
|
|
1404
|
+
var providerSummaryEntryDtoSchema = z12.object({
|
|
1405
|
+
name: z12.string(),
|
|
1406
|
+
displayName: z12.string().optional(),
|
|
1407
|
+
keyUrl: z12.string().optional(),
|
|
1408
|
+
modelHint: z12.string().optional(),
|
|
1409
|
+
model: z12.string().optional(),
|
|
1382
1410
|
/**
|
|
1383
1411
|
* The adapter's built-in default model. Surfaced so the UI and CLI can show
|
|
1384
1412
|
* the effective model even when no explicit `model` override is configured.
|
|
1385
1413
|
*/
|
|
1386
|
-
defaultModel:
|
|
1387
|
-
configured:
|
|
1414
|
+
defaultModel: z12.string().optional(),
|
|
1415
|
+
configured: z12.boolean(),
|
|
1388
1416
|
quota: providerQuotaPolicySchema.optional(),
|
|
1389
1417
|
/** Whether Vertex AI is configured for this provider (Gemini only). */
|
|
1390
|
-
vertexConfigured:
|
|
1418
|
+
vertexConfigured: z12.boolean().optional()
|
|
1391
1419
|
});
|
|
1392
|
-
var integrationSettingsSummaryDtoSchema =
|
|
1393
|
-
configured:
|
|
1420
|
+
var integrationSettingsSummaryDtoSchema = z12.object({
|
|
1421
|
+
configured: z12.boolean()
|
|
1394
1422
|
});
|
|
1395
|
-
var settingsDtoSchema =
|
|
1396
|
-
providers:
|
|
1423
|
+
var settingsDtoSchema = z12.object({
|
|
1424
|
+
providers: z12.array(providerSummaryEntryDtoSchema).default([]),
|
|
1397
1425
|
google: integrationSettingsSummaryDtoSchema,
|
|
1398
1426
|
bing: integrationSettingsSummaryDtoSchema
|
|
1399
1427
|
});
|
|
1400
1428
|
|
|
1401
1429
|
// ../contracts/src/snapshot.ts
|
|
1402
|
-
import { z as
|
|
1403
|
-
var snapshotAccuracySchema =
|
|
1404
|
-
var snapshotQueryListSchema =
|
|
1405
|
-
var snapshotRequestSchema =
|
|
1406
|
-
companyName:
|
|
1407
|
-
domain:
|
|
1430
|
+
import { z as z13 } from "zod";
|
|
1431
|
+
var snapshotAccuracySchema = z13.enum(["yes", "no", "unknown", "not-mentioned"]);
|
|
1432
|
+
var snapshotQueryListSchema = z13.array(z13.string().min(1));
|
|
1433
|
+
var snapshotRequestSchema = z13.object({
|
|
1434
|
+
companyName: z13.string().min(1),
|
|
1435
|
+
domain: z13.string().min(1),
|
|
1408
1436
|
queries: snapshotQueryListSchema.optional(),
|
|
1409
1437
|
phrases: snapshotQueryListSchema.optional(),
|
|
1410
|
-
competitors:
|
|
1438
|
+
competitors: z13.array(z13.string().min(1)).optional().default([])
|
|
1411
1439
|
}).superRefine((input, ctx) => {
|
|
1412
1440
|
if (input.queries !== void 0 && input.phrases !== void 0) {
|
|
1413
1441
|
ctx.addIssue({
|
|
@@ -1420,155 +1448,155 @@ var snapshotRequestSchema = z12.object({
|
|
|
1420
1448
|
function resolveSnapshotRequestQueries(input) {
|
|
1421
1449
|
return input.queries ?? input.phrases ?? [];
|
|
1422
1450
|
}
|
|
1423
|
-
var snapshotCompetitorEntrySchema =
|
|
1424
|
-
name:
|
|
1425
|
-
count:
|
|
1451
|
+
var snapshotCompetitorEntrySchema = z13.object({
|
|
1452
|
+
name: z13.string(),
|
|
1453
|
+
count: z13.number().int().nonnegative()
|
|
1426
1454
|
});
|
|
1427
|
-
var snapshotAuditFactorSchema =
|
|
1428
|
-
id:
|
|
1429
|
-
name:
|
|
1430
|
-
weight:
|
|
1431
|
-
score:
|
|
1432
|
-
grade:
|
|
1433
|
-
status:
|
|
1434
|
-
findings:
|
|
1435
|
-
type:
|
|
1436
|
-
message:
|
|
1455
|
+
var snapshotAuditFactorSchema = z13.object({
|
|
1456
|
+
id: z13.string(),
|
|
1457
|
+
name: z13.string(),
|
|
1458
|
+
weight: z13.number(),
|
|
1459
|
+
score: z13.number(),
|
|
1460
|
+
grade: z13.string(),
|
|
1461
|
+
status: z13.enum(["pass", "partial", "fail"]),
|
|
1462
|
+
findings: z13.array(z13.object({
|
|
1463
|
+
type: z13.string(),
|
|
1464
|
+
message: z13.string()
|
|
1437
1465
|
})).default([]),
|
|
1438
|
-
recommendations:
|
|
1439
|
-
});
|
|
1440
|
-
var snapshotAuditSchema =
|
|
1441
|
-
url:
|
|
1442
|
-
finalUrl:
|
|
1443
|
-
auditedAt:
|
|
1444
|
-
overallScore:
|
|
1445
|
-
overallGrade:
|
|
1446
|
-
summary:
|
|
1447
|
-
factors:
|
|
1448
|
-
});
|
|
1449
|
-
var snapshotProfileSchema =
|
|
1450
|
-
industry:
|
|
1451
|
-
summary:
|
|
1452
|
-
services:
|
|
1453
|
-
categoryTerms:
|
|
1454
|
-
});
|
|
1455
|
-
var snapshotProviderResultSchema =
|
|
1456
|
-
provider:
|
|
1457
|
-
displayName:
|
|
1458
|
-
model:
|
|
1459
|
-
mentioned:
|
|
1460
|
-
cited:
|
|
1466
|
+
recommendations: z13.array(z13.string()).default([])
|
|
1467
|
+
});
|
|
1468
|
+
var snapshotAuditSchema = z13.object({
|
|
1469
|
+
url: z13.string(),
|
|
1470
|
+
finalUrl: z13.string(),
|
|
1471
|
+
auditedAt: z13.string(),
|
|
1472
|
+
overallScore: z13.number(),
|
|
1473
|
+
overallGrade: z13.string(),
|
|
1474
|
+
summary: z13.string(),
|
|
1475
|
+
factors: z13.array(snapshotAuditFactorSchema).default([])
|
|
1476
|
+
});
|
|
1477
|
+
var snapshotProfileSchema = z13.object({
|
|
1478
|
+
industry: z13.string(),
|
|
1479
|
+
summary: z13.string(),
|
|
1480
|
+
services: z13.array(z13.string()).default([]),
|
|
1481
|
+
categoryTerms: z13.array(z13.string()).default([])
|
|
1482
|
+
});
|
|
1483
|
+
var snapshotProviderResultSchema = z13.object({
|
|
1484
|
+
provider: z13.string(),
|
|
1485
|
+
displayName: z13.string(),
|
|
1486
|
+
model: z13.string().nullable().optional(),
|
|
1487
|
+
mentioned: z13.boolean(),
|
|
1488
|
+
cited: z13.boolean(),
|
|
1461
1489
|
describedAccurately: snapshotAccuracySchema,
|
|
1462
|
-
accuracyNotes:
|
|
1463
|
-
incorrectClaims:
|
|
1464
|
-
recommendedCompetitors:
|
|
1465
|
-
citedDomains:
|
|
1466
|
-
groundingSources:
|
|
1467
|
-
searchQueries:
|
|
1468
|
-
answerText:
|
|
1469
|
-
error:
|
|
1470
|
-
});
|
|
1471
|
-
var snapshotQueryResultSchema =
|
|
1472
|
-
query:
|
|
1473
|
-
providerResults:
|
|
1474
|
-
});
|
|
1475
|
-
var snapshotSummarySchema =
|
|
1476
|
-
totalQueries:
|
|
1477
|
-
totalProviders:
|
|
1478
|
-
totalComparisons:
|
|
1479
|
-
mentionCount:
|
|
1480
|
-
citationCount:
|
|
1481
|
-
topCompetitors:
|
|
1482
|
-
visibilityGap:
|
|
1483
|
-
whatThisMeans:
|
|
1484
|
-
recommendedActions:
|
|
1485
|
-
});
|
|
1486
|
-
var snapshotReportSchema =
|
|
1487
|
-
companyName:
|
|
1488
|
-
domain:
|
|
1489
|
-
homepageUrl:
|
|
1490
|
-
generatedAt:
|
|
1491
|
-
queries:
|
|
1492
|
-
competitors:
|
|
1490
|
+
accuracyNotes: z13.string().nullable().optional(),
|
|
1491
|
+
incorrectClaims: z13.array(z13.string()).default([]),
|
|
1492
|
+
recommendedCompetitors: z13.array(z13.string()).default([]),
|
|
1493
|
+
citedDomains: z13.array(z13.string()).default([]),
|
|
1494
|
+
groundingSources: z13.array(groundingSourceSchema).default([]),
|
|
1495
|
+
searchQueries: z13.array(z13.string()).default([]),
|
|
1496
|
+
answerText: z13.string(),
|
|
1497
|
+
error: z13.string().nullable().optional()
|
|
1498
|
+
});
|
|
1499
|
+
var snapshotQueryResultSchema = z13.object({
|
|
1500
|
+
query: z13.string(),
|
|
1501
|
+
providerResults: z13.array(snapshotProviderResultSchema).default([])
|
|
1502
|
+
});
|
|
1503
|
+
var snapshotSummarySchema = z13.object({
|
|
1504
|
+
totalQueries: z13.number().int().nonnegative(),
|
|
1505
|
+
totalProviders: z13.number().int().nonnegative(),
|
|
1506
|
+
totalComparisons: z13.number().int().nonnegative(),
|
|
1507
|
+
mentionCount: z13.number().int().nonnegative(),
|
|
1508
|
+
citationCount: z13.number().int().nonnegative(),
|
|
1509
|
+
topCompetitors: z13.array(snapshotCompetitorEntrySchema).default([]),
|
|
1510
|
+
visibilityGap: z13.string(),
|
|
1511
|
+
whatThisMeans: z13.array(z13.string()).default([]),
|
|
1512
|
+
recommendedActions: z13.array(z13.string()).default([])
|
|
1513
|
+
});
|
|
1514
|
+
var snapshotReportSchema = z13.object({
|
|
1515
|
+
companyName: z13.string(),
|
|
1516
|
+
domain: z13.string(),
|
|
1517
|
+
homepageUrl: z13.string(),
|
|
1518
|
+
generatedAt: z13.string(),
|
|
1519
|
+
queries: z13.array(z13.string()).default([]),
|
|
1520
|
+
competitors: z13.array(z13.string()).default([]),
|
|
1493
1521
|
profile: snapshotProfileSchema,
|
|
1494
1522
|
audit: snapshotAuditSchema,
|
|
1495
|
-
queryResults:
|
|
1523
|
+
queryResults: z13.array(snapshotQueryResultSchema).default([]),
|
|
1496
1524
|
summary: snapshotSummarySchema
|
|
1497
1525
|
});
|
|
1498
1526
|
|
|
1499
1527
|
// ../contracts/src/schedule.ts
|
|
1500
|
-
import { z as
|
|
1501
|
-
var schedulableRunKindSchema =
|
|
1528
|
+
import { z as z14 } from "zod";
|
|
1529
|
+
var schedulableRunKindSchema = z14.enum(["answer-visibility", "traffic-sync", "gbp-sync", "data-refresh", "backlinks-sync"]);
|
|
1502
1530
|
var SchedulableRunKinds = schedulableRunKindSchema.enum;
|
|
1503
|
-
var scheduleDtoSchema =
|
|
1504
|
-
id:
|
|
1505
|
-
projectId:
|
|
1531
|
+
var scheduleDtoSchema = z14.object({
|
|
1532
|
+
id: z14.string(),
|
|
1533
|
+
projectId: z14.string(),
|
|
1506
1534
|
/** Run kind dispatched when this schedule fires. Defaults to 'answer-visibility' for legacy rows. */
|
|
1507
1535
|
kind: schedulableRunKindSchema,
|
|
1508
|
-
cronExpr:
|
|
1509
|
-
preset:
|
|
1510
|
-
timezone:
|
|
1511
|
-
enabled:
|
|
1512
|
-
providers:
|
|
1536
|
+
cronExpr: z14.string(),
|
|
1537
|
+
preset: z14.string().nullable().optional(),
|
|
1538
|
+
timezone: z14.string().default("UTC"),
|
|
1539
|
+
enabled: z14.boolean().default(true),
|
|
1540
|
+
providers: z14.array(providerNameSchema).default([]),
|
|
1513
1541
|
/** Traffic-source UUID for `kind === 'traffic-sync'` schedules. Null otherwise. */
|
|
1514
|
-
sourceId:
|
|
1515
|
-
lastRunAt:
|
|
1516
|
-
nextRunAt:
|
|
1517
|
-
createdAt:
|
|
1518
|
-
updatedAt:
|
|
1542
|
+
sourceId: z14.string().nullable().optional(),
|
|
1543
|
+
lastRunAt: z14.string().nullable().optional(),
|
|
1544
|
+
nextRunAt: z14.string().nullable().optional(),
|
|
1545
|
+
createdAt: z14.string(),
|
|
1546
|
+
updatedAt: z14.string()
|
|
1519
1547
|
});
|
|
1520
|
-
var scheduleUpsertRequestSchema =
|
|
1548
|
+
var scheduleUpsertRequestSchema = z14.object({
|
|
1521
1549
|
/** Run kind. Defaults to 'answer-visibility' so existing callers don't have to change. */
|
|
1522
1550
|
kind: schedulableRunKindSchema.optional(),
|
|
1523
|
-
preset:
|
|
1524
|
-
cron:
|
|
1525
|
-
timezone:
|
|
1526
|
-
enabled:
|
|
1527
|
-
providers:
|
|
1551
|
+
preset: z14.string().optional(),
|
|
1552
|
+
cron: z14.string().optional(),
|
|
1553
|
+
timezone: z14.string().optional().default("UTC"),
|
|
1554
|
+
enabled: z14.boolean().optional().default(true),
|
|
1555
|
+
providers: z14.array(providerNameSchema).optional().default([]),
|
|
1528
1556
|
/** Required when kind === 'traffic-sync'. Forbidden for other kinds. Validated server-side. */
|
|
1529
|
-
sourceId:
|
|
1557
|
+
sourceId: z14.string().optional()
|
|
1530
1558
|
}).refine(
|
|
1531
1559
|
(data) => data.preset && !data.cron || !data.preset && data.cron,
|
|
1532
1560
|
{ message: 'Exactly one of "preset" or "cron" must be provided' }
|
|
1533
1561
|
);
|
|
1534
1562
|
|
|
1535
1563
|
// ../contracts/src/analytics.ts
|
|
1536
|
-
import { z as
|
|
1537
|
-
var metricsWindowSchema =
|
|
1538
|
-
var trendDirectionSchema =
|
|
1539
|
-
var visibilityMetricModeSchema =
|
|
1564
|
+
import { z as z15 } from "zod";
|
|
1565
|
+
var metricsWindowSchema = z15.enum(["7d", "30d", "90d", "all"]);
|
|
1566
|
+
var trendDirectionSchema = z15.enum(["improving", "declining", "stable"]);
|
|
1567
|
+
var visibilityMetricModeSchema = z15.enum(["mentioned", "cited"]);
|
|
1540
1568
|
var VisibilityMetricModes = visibilityMetricModeSchema.enum;
|
|
1541
|
-
var providerMetricSchema =
|
|
1542
|
-
citationRate:
|
|
1543
|
-
cited:
|
|
1544
|
-
total:
|
|
1545
|
-
mentionRate:
|
|
1546
|
-
mentionedCount:
|
|
1547
|
-
});
|
|
1548
|
-
var timeBucketSchema =
|
|
1549
|
-
startDate:
|
|
1550
|
-
endDate:
|
|
1551
|
-
citationRate:
|
|
1552
|
-
cited:
|
|
1553
|
-
total:
|
|
1554
|
-
queryCount:
|
|
1555
|
-
mentionRate:
|
|
1556
|
-
mentionedCount:
|
|
1557
|
-
byProvider:
|
|
1558
|
-
});
|
|
1559
|
-
var queryChangeEventSchema =
|
|
1560
|
-
date:
|
|
1561
|
-
delta:
|
|
1562
|
-
label:
|
|
1563
|
-
});
|
|
1564
|
-
var brandMetricsDtoSchema =
|
|
1569
|
+
var providerMetricSchema = z15.object({
|
|
1570
|
+
citationRate: z15.number(),
|
|
1571
|
+
cited: z15.number().int(),
|
|
1572
|
+
total: z15.number().int(),
|
|
1573
|
+
mentionRate: z15.number(),
|
|
1574
|
+
mentionedCount: z15.number().int()
|
|
1575
|
+
});
|
|
1576
|
+
var timeBucketSchema = z15.object({
|
|
1577
|
+
startDate: z15.string(),
|
|
1578
|
+
endDate: z15.string(),
|
|
1579
|
+
citationRate: z15.number(),
|
|
1580
|
+
cited: z15.number().int(),
|
|
1581
|
+
total: z15.number().int(),
|
|
1582
|
+
queryCount: z15.number().int(),
|
|
1583
|
+
mentionRate: z15.number(),
|
|
1584
|
+
mentionedCount: z15.number().int(),
|
|
1585
|
+
byProvider: z15.record(z15.string(), providerMetricSchema)
|
|
1586
|
+
});
|
|
1587
|
+
var queryChangeEventSchema = z15.object({
|
|
1588
|
+
date: z15.string(),
|
|
1589
|
+
delta: z15.number().int(),
|
|
1590
|
+
label: z15.string()
|
|
1591
|
+
});
|
|
1592
|
+
var brandMetricsDtoSchema = z15.object({
|
|
1565
1593
|
window: metricsWindowSchema,
|
|
1566
|
-
buckets:
|
|
1594
|
+
buckets: z15.array(timeBucketSchema),
|
|
1567
1595
|
overall: providerMetricSchema,
|
|
1568
|
-
byProvider:
|
|
1596
|
+
byProvider: z15.record(z15.string(), providerMetricSchema),
|
|
1569
1597
|
trend: trendDirectionSchema,
|
|
1570
1598
|
mentionTrend: trendDirectionSchema,
|
|
1571
|
-
queryChanges:
|
|
1599
|
+
queryChanges: z15.array(queryChangeEventSchema)
|
|
1572
1600
|
});
|
|
1573
1601
|
function parseWindow(value) {
|
|
1574
1602
|
if (value === "7d" || value === "30d" || value === "90d" || value === "all") return value;
|
|
@@ -1707,29 +1735,29 @@ function categoryLabel(category) {
|
|
|
1707
1735
|
}
|
|
1708
1736
|
|
|
1709
1737
|
// ../contracts/src/ga.ts
|
|
1710
|
-
import { z as
|
|
1711
|
-
var ga4ConnectionDtoSchema =
|
|
1712
|
-
id:
|
|
1713
|
-
projectId:
|
|
1714
|
-
propertyId:
|
|
1715
|
-
clientEmail:
|
|
1716
|
-
connected:
|
|
1717
|
-
createdAt:
|
|
1718
|
-
updatedAt:
|
|
1719
|
-
});
|
|
1720
|
-
var ga4TrafficSnapshotDtoSchema =
|
|
1721
|
-
date:
|
|
1722
|
-
landingPage:
|
|
1723
|
-
sessions:
|
|
1724
|
-
organicSessions:
|
|
1725
|
-
users:
|
|
1726
|
-
});
|
|
1727
|
-
var ga4SourceDimensionSchema =
|
|
1728
|
-
var ga4AiReferralDtoSchema =
|
|
1729
|
-
source:
|
|
1730
|
-
medium:
|
|
1731
|
-
sessions:
|
|
1732
|
-
users:
|
|
1738
|
+
import { z as z16 } from "zod";
|
|
1739
|
+
var ga4ConnectionDtoSchema = z16.object({
|
|
1740
|
+
id: z16.string(),
|
|
1741
|
+
projectId: z16.string(),
|
|
1742
|
+
propertyId: z16.string(),
|
|
1743
|
+
clientEmail: z16.string(),
|
|
1744
|
+
connected: z16.boolean(),
|
|
1745
|
+
createdAt: z16.string(),
|
|
1746
|
+
updatedAt: z16.string()
|
|
1747
|
+
});
|
|
1748
|
+
var ga4TrafficSnapshotDtoSchema = z16.object({
|
|
1749
|
+
date: z16.string(),
|
|
1750
|
+
landingPage: z16.string(),
|
|
1751
|
+
sessions: z16.number(),
|
|
1752
|
+
organicSessions: z16.number(),
|
|
1753
|
+
users: z16.number()
|
|
1754
|
+
});
|
|
1755
|
+
var ga4SourceDimensionSchema = z16.enum(["session", "first_user", "manual_utm"]);
|
|
1756
|
+
var ga4AiReferralDtoSchema = z16.object({
|
|
1757
|
+
source: z16.string(),
|
|
1758
|
+
medium: z16.string(),
|
|
1759
|
+
sessions: z16.number(),
|
|
1760
|
+
users: z16.number(),
|
|
1733
1761
|
/**
|
|
1734
1762
|
* The winning attribution dimension for this (source, medium) tuple — the
|
|
1735
1763
|
* one with the highest session count. GA4 emits one row per dimension
|
|
@@ -1739,144 +1767,144 @@ var ga4AiReferralDtoSchema = z15.object({
|
|
|
1739
1767
|
*/
|
|
1740
1768
|
sourceDimension: ga4SourceDimensionSchema
|
|
1741
1769
|
});
|
|
1742
|
-
var ga4AiReferralLandingPageDtoSchema =
|
|
1743
|
-
source:
|
|
1744
|
-
medium:
|
|
1770
|
+
var ga4AiReferralLandingPageDtoSchema = z16.object({
|
|
1771
|
+
source: z16.string(),
|
|
1772
|
+
medium: z16.string(),
|
|
1745
1773
|
/**
|
|
1746
1774
|
* The winning attribution dimension for this (source, medium, landingPage)
|
|
1747
1775
|
* tuple — the one with the highest session count.
|
|
1748
1776
|
*/
|
|
1749
1777
|
sourceDimension: ga4SourceDimensionSchema,
|
|
1750
|
-
landingPage:
|
|
1751
|
-
sessions:
|
|
1752
|
-
users:
|
|
1753
|
-
});
|
|
1754
|
-
var ga4SocialReferralDtoSchema =
|
|
1755
|
-
source:
|
|
1756
|
-
medium:
|
|
1757
|
-
sessions:
|
|
1758
|
-
users:
|
|
1778
|
+
landingPage: z16.string(),
|
|
1779
|
+
sessions: z16.number(),
|
|
1780
|
+
users: z16.number()
|
|
1781
|
+
});
|
|
1782
|
+
var ga4SocialReferralDtoSchema = z16.object({
|
|
1783
|
+
source: z16.string(),
|
|
1784
|
+
medium: z16.string(),
|
|
1785
|
+
sessions: z16.number(),
|
|
1786
|
+
users: z16.number(),
|
|
1759
1787
|
/** GA4 default channel group (e.g. 'Organic Social', 'Paid Social') */
|
|
1760
|
-
channelGroup:
|
|
1788
|
+
channelGroup: z16.string()
|
|
1761
1789
|
});
|
|
1762
|
-
var ga4ChannelBucketDtoSchema =
|
|
1763
|
-
sessions:
|
|
1764
|
-
sharePct:
|
|
1765
|
-
sharePctDisplay:
|
|
1790
|
+
var ga4ChannelBucketDtoSchema = z16.object({
|
|
1791
|
+
sessions: z16.number(),
|
|
1792
|
+
sharePct: z16.number(),
|
|
1793
|
+
sharePctDisplay: z16.string()
|
|
1766
1794
|
});
|
|
1767
|
-
var ga4ChannelBreakdownDtoSchema =
|
|
1795
|
+
var ga4ChannelBreakdownDtoSchema = z16.object({
|
|
1768
1796
|
organic: ga4ChannelBucketDtoSchema,
|
|
1769
1797
|
social: ga4ChannelBucketDtoSchema,
|
|
1770
1798
|
direct: ga4ChannelBucketDtoSchema,
|
|
1771
1799
|
ai: ga4ChannelBucketDtoSchema,
|
|
1772
1800
|
other: ga4ChannelBucketDtoSchema
|
|
1773
1801
|
});
|
|
1774
|
-
var ga4TrafficSummaryDtoSchema =
|
|
1775
|
-
totalSessions:
|
|
1776
|
-
totalOrganicSessions:
|
|
1802
|
+
var ga4TrafficSummaryDtoSchema = z16.object({
|
|
1803
|
+
totalSessions: z16.number(),
|
|
1804
|
+
totalOrganicSessions: z16.number(),
|
|
1777
1805
|
/** Direct-channel sessions (sessions with no source — bookmarks, typed URLs, AI-driven traffic with stripped referrer). 0 for legacy rows from before the column was added. */
|
|
1778
|
-
totalDirectSessions:
|
|
1779
|
-
totalUsers:
|
|
1780
|
-
topPages:
|
|
1781
|
-
landingPage:
|
|
1782
|
-
sessions:
|
|
1783
|
-
organicSessions:
|
|
1806
|
+
totalDirectSessions: z16.number(),
|
|
1807
|
+
totalUsers: z16.number(),
|
|
1808
|
+
topPages: z16.array(z16.object({
|
|
1809
|
+
landingPage: z16.string(),
|
|
1810
|
+
sessions: z16.number(),
|
|
1811
|
+
organicSessions: z16.number(),
|
|
1784
1812
|
/** Per-page Direct-channel sessions. 0 for legacy rows. */
|
|
1785
|
-
directSessions:
|
|
1786
|
-
users:
|
|
1813
|
+
directSessions: z16.number(),
|
|
1814
|
+
users: z16.number()
|
|
1787
1815
|
})),
|
|
1788
|
-
aiReferrals:
|
|
1789
|
-
aiReferralLandingPages:
|
|
1816
|
+
aiReferrals: z16.array(ga4AiReferralDtoSchema),
|
|
1817
|
+
aiReferralLandingPages: z16.array(ga4AiReferralLandingPageDtoSchema),
|
|
1790
1818
|
/** Deduped AI session total: MAX(sessions) per date+source+medium across attribution dimensions, then summed. Cross-cutting: can overlap with Direct/Organic/Social via firstUserSource. */
|
|
1791
|
-
aiSessionsDeduped:
|
|
1819
|
+
aiSessionsDeduped: z16.number(),
|
|
1792
1820
|
/** Deduped AI user total: MAX(users) per date+source+medium across attribution dimensions, then summed. */
|
|
1793
|
-
aiUsersDeduped:
|
|
1821
|
+
aiUsersDeduped: z16.number(),
|
|
1794
1822
|
/** AI sessions whose CURRENT sessionSource matched an AI engine. Can overlap with raw Organic/Social/Direct totals; `channelBreakdown` removes those overlaps for display. */
|
|
1795
|
-
aiSessionsBySession:
|
|
1823
|
+
aiSessionsBySession: z16.number(),
|
|
1796
1824
|
/** AI users whose CURRENT sessionSource matched an AI engine. Can overlap with raw Organic/Social/Direct totals. */
|
|
1797
|
-
aiUsersBySession:
|
|
1798
|
-
socialReferrals:
|
|
1825
|
+
aiUsersBySession: z16.number(),
|
|
1826
|
+
socialReferrals: z16.array(ga4SocialReferralDtoSchema),
|
|
1799
1827
|
/** Total social sessions (session-scoped, no cross-dimension dedup needed). */
|
|
1800
|
-
socialSessions:
|
|
1828
|
+
socialSessions: z16.number(),
|
|
1801
1829
|
/** Total social users (session-scoped, no cross-dimension dedup needed). */
|
|
1802
|
-
socialUsers:
|
|
1830
|
+
socialUsers: z16.number(),
|
|
1803
1831
|
/** Five disjoint buckets used for the channel breakdown. Known AI session-source matches are removed from their native GA4 bucket before shares are computed. */
|
|
1804
1832
|
channelBreakdown: ga4ChannelBreakdownDtoSchema,
|
|
1805
1833
|
/** Organic sessions as a percentage of total sessions (0–100, rounded). */
|
|
1806
|
-
organicSharePct:
|
|
1834
|
+
organicSharePct: z16.number(),
|
|
1807
1835
|
/** Deduped AI sessions as a percentage of total sessions (0–100, rounded). Cross-cutting: can overlap with Direct/Organic/Social. */
|
|
1808
|
-
aiSharePct:
|
|
1836
|
+
aiSharePct: z16.number(),
|
|
1809
1837
|
/** Session-source-only AI sessions as a percentage of total sessions (0–100, rounded). Can overlap with raw Organic/Social/Direct totals. */
|
|
1810
|
-
aiSharePctBySession:
|
|
1838
|
+
aiSharePctBySession: z16.number(),
|
|
1811
1839
|
/** Direct-channel sessions as a percentage of total sessions (0–100, rounded). */
|
|
1812
|
-
directSharePct:
|
|
1840
|
+
directSharePct: z16.number(),
|
|
1813
1841
|
/** Social sessions as a percentage of total sessions (0–100, rounded). */
|
|
1814
|
-
socialSharePct:
|
|
1842
|
+
socialSharePct: z16.number(),
|
|
1815
1843
|
/** Display string for organicSharePct: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
|
|
1816
|
-
organicSharePctDisplay:
|
|
1844
|
+
organicSharePctDisplay: z16.string(),
|
|
1817
1845
|
/** Display string for aiSharePct: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
|
|
1818
|
-
aiSharePctDisplay:
|
|
1846
|
+
aiSharePctDisplay: z16.string(),
|
|
1819
1847
|
/** Display string for aiSharePctBySession: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
|
|
1820
|
-
aiSharePctBySessionDisplay:
|
|
1848
|
+
aiSharePctBySessionDisplay: z16.string(),
|
|
1821
1849
|
/** Display string for directSharePct: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
|
|
1822
|
-
directSharePctDisplay:
|
|
1850
|
+
directSharePctDisplay: z16.string(),
|
|
1823
1851
|
/** Display string for socialSharePct: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
|
|
1824
|
-
socialSharePctDisplay:
|
|
1852
|
+
socialSharePctDisplay: z16.string(),
|
|
1825
1853
|
/** Sessions not covered by Organic, Social, Direct, or AI (session) channels — e.g. Referral, Email, Paid Search, Display. Always non-negative; clamped to 0 when the four disjoint channels sum above total (rounding edge). */
|
|
1826
|
-
otherSessions:
|
|
1854
|
+
otherSessions: z16.number(),
|
|
1827
1855
|
/** Other sessions as a percentage of total sessions (0–100, rounded). */
|
|
1828
|
-
otherSharePct:
|
|
1856
|
+
otherSharePct: z16.number(),
|
|
1829
1857
|
/** Display string for otherSharePct: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
|
|
1830
|
-
otherSharePctDisplay:
|
|
1831
|
-
lastSyncedAt:
|
|
1832
|
-
});
|
|
1833
|
-
var ga4StatusDtoSchema =
|
|
1834
|
-
connected:
|
|
1835
|
-
propertyId:
|
|
1836
|
-
clientEmail:
|
|
1837
|
-
authMethod:
|
|
1838
|
-
lastSyncedAt:
|
|
1839
|
-
createdAt:
|
|
1840
|
-
updatedAt:
|
|
1841
|
-
});
|
|
1842
|
-
var ga4SyncResponseDtoSchema =
|
|
1843
|
-
synced:
|
|
1844
|
-
rowCount:
|
|
1845
|
-
aiReferralCount:
|
|
1846
|
-
socialReferralCount:
|
|
1847
|
-
days:
|
|
1848
|
-
syncedAt:
|
|
1858
|
+
otherSharePctDisplay: z16.string(),
|
|
1859
|
+
lastSyncedAt: z16.string().nullable()
|
|
1860
|
+
});
|
|
1861
|
+
var ga4StatusDtoSchema = z16.object({
|
|
1862
|
+
connected: z16.boolean(),
|
|
1863
|
+
propertyId: z16.string().nullable(),
|
|
1864
|
+
clientEmail: z16.string().nullable(),
|
|
1865
|
+
authMethod: z16.enum(["service-account", "oauth"]).nullable(),
|
|
1866
|
+
lastSyncedAt: z16.string().nullable(),
|
|
1867
|
+
createdAt: z16.string().nullable().optional(),
|
|
1868
|
+
updatedAt: z16.string().nullable().optional()
|
|
1869
|
+
});
|
|
1870
|
+
var ga4SyncResponseDtoSchema = z16.object({
|
|
1871
|
+
synced: z16.boolean(),
|
|
1872
|
+
rowCount: z16.number().int().nonnegative(),
|
|
1873
|
+
aiReferralCount: z16.number().int().nonnegative(),
|
|
1874
|
+
socialReferralCount: z16.number().int().nonnegative(),
|
|
1875
|
+
days: z16.number().int().nonnegative(),
|
|
1876
|
+
syncedAt: z16.string(),
|
|
1849
1877
|
/**
|
|
1850
1878
|
* Components that were written this run. Present when `only` is set.
|
|
1851
1879
|
* Always includes `traffic` and `summary` (the share denominator) plus
|
|
1852
1880
|
* the requested channel breakdown — `ai` and/or `social`.
|
|
1853
1881
|
*/
|
|
1854
|
-
syncedComponents:
|
|
1855
|
-
});
|
|
1856
|
-
var ga4AiReferralHistoryEntrySchema =
|
|
1857
|
-
date:
|
|
1858
|
-
source:
|
|
1859
|
-
medium:
|
|
1860
|
-
landingPage:
|
|
1861
|
-
sessions:
|
|
1862
|
-
users:
|
|
1882
|
+
syncedComponents: z16.array(z16.string()).optional()
|
|
1883
|
+
});
|
|
1884
|
+
var ga4AiReferralHistoryEntrySchema = z16.object({
|
|
1885
|
+
date: z16.string(),
|
|
1886
|
+
source: z16.string(),
|
|
1887
|
+
medium: z16.string(),
|
|
1888
|
+
landingPage: z16.string(),
|
|
1889
|
+
sessions: z16.number(),
|
|
1890
|
+
users: z16.number(),
|
|
1863
1891
|
/** Which GA4 dimension this row came from: session (sessionSource), first_user (firstUserSource), or manual_utm (utm_source parameter) */
|
|
1864
1892
|
sourceDimension: ga4SourceDimensionSchema
|
|
1865
1893
|
});
|
|
1866
|
-
var ga4SocialReferralHistoryEntrySchema =
|
|
1867
|
-
date:
|
|
1868
|
-
source:
|
|
1869
|
-
medium:
|
|
1870
|
-
sessions:
|
|
1871
|
-
users:
|
|
1894
|
+
var ga4SocialReferralHistoryEntrySchema = z16.object({
|
|
1895
|
+
date: z16.string(),
|
|
1896
|
+
source: z16.string(),
|
|
1897
|
+
medium: z16.string(),
|
|
1898
|
+
sessions: z16.number(),
|
|
1899
|
+
users: z16.number(),
|
|
1872
1900
|
/** GA4 default channel group (e.g. 'Organic Social', 'Paid Social') */
|
|
1873
|
-
channelGroup:
|
|
1901
|
+
channelGroup: z16.string()
|
|
1874
1902
|
});
|
|
1875
|
-
var ga4SessionHistoryEntrySchema =
|
|
1876
|
-
date:
|
|
1877
|
-
sessions:
|
|
1878
|
-
organicSessions:
|
|
1879
|
-
users:
|
|
1903
|
+
var ga4SessionHistoryEntrySchema = z16.object({
|
|
1904
|
+
date: z16.string(),
|
|
1905
|
+
sessions: z16.number(),
|
|
1906
|
+
organicSessions: z16.number(),
|
|
1907
|
+
users: z16.number()
|
|
1880
1908
|
});
|
|
1881
1909
|
|
|
1882
1910
|
// ../contracts/src/answer-visibility.ts
|
|
@@ -2044,149 +2072,149 @@ function escapeRegExp(value) {
|
|
|
2044
2072
|
}
|
|
2045
2073
|
|
|
2046
2074
|
// ../contracts/src/agent.ts
|
|
2047
|
-
import { z as
|
|
2048
|
-
var agentProviderIdSchema =
|
|
2049
|
-
var agentProviderOptionDtoSchema =
|
|
2075
|
+
import { z as z17 } from "zod";
|
|
2076
|
+
var agentProviderIdSchema = z17.enum(["claude", "openai", "gemini", "zai"]);
|
|
2077
|
+
var agentProviderOptionDtoSchema = z17.object({
|
|
2050
2078
|
/** Stable identifier — what clients pass back as `provider` on the prompt endpoint. */
|
|
2051
2079
|
id: agentProviderIdSchema,
|
|
2052
2080
|
/** Human-readable label for UI pickers, e.g. "Anthropic (Claude)". */
|
|
2053
|
-
label:
|
|
2081
|
+
label: z17.string(),
|
|
2054
2082
|
/** Default model if the caller doesn't pick one. */
|
|
2055
|
-
defaultModel:
|
|
2083
|
+
defaultModel: z17.string(),
|
|
2056
2084
|
/** Whether a usable API key was found (config.yaml or provider env var). */
|
|
2057
|
-
configured:
|
|
2085
|
+
configured: z17.boolean(),
|
|
2058
2086
|
/**
|
|
2059
2087
|
* Where the key resolved from, if any. `null` when `configured === false`.
|
|
2060
2088
|
* Surfaced so the UI can nudge users toward their preferred source of truth.
|
|
2061
2089
|
*/
|
|
2062
|
-
keySource:
|
|
2090
|
+
keySource: z17.enum(["config", "env"]).nullable()
|
|
2063
2091
|
});
|
|
2064
|
-
var agentProvidersResponseDtoSchema =
|
|
2092
|
+
var agentProvidersResponseDtoSchema = z17.object({
|
|
2065
2093
|
/**
|
|
2066
2094
|
* Every provider Aero knows about. `configured === false` entries are
|
|
2067
2095
|
* included so the UI can render them disabled with an onboarding hint.
|
|
2068
2096
|
*/
|
|
2069
|
-
providers:
|
|
2097
|
+
providers: z17.array(agentProviderOptionDtoSchema).default([]),
|
|
2070
2098
|
/**
|
|
2071
2099
|
* Provider Aero auto-picks when no explicit override is passed. Null if
|
|
2072
2100
|
* nothing is configured (install never exchanged a key).
|
|
2073
2101
|
*/
|
|
2074
2102
|
defaultProvider: agentProviderIdSchema.nullable()
|
|
2075
2103
|
});
|
|
2076
|
-
var memorySourceSchema =
|
|
2104
|
+
var memorySourceSchema = z17.enum(["aero", "user", "compaction"]);
|
|
2077
2105
|
var MemorySources = memorySourceSchema.enum;
|
|
2078
2106
|
var AGENT_MEMORY_VALUE_MAX_BYTES = 2 * 1024;
|
|
2079
2107
|
var AGENT_MEMORY_KEY_MAX_LENGTH = 128;
|
|
2080
|
-
var agentMemoryUpsertRequestSchema =
|
|
2081
|
-
key:
|
|
2082
|
-
value:
|
|
2108
|
+
var agentMemoryUpsertRequestSchema = z17.object({
|
|
2109
|
+
key: z17.string().min(1).max(AGENT_MEMORY_KEY_MAX_LENGTH),
|
|
2110
|
+
value: z17.string().min(1)
|
|
2083
2111
|
});
|
|
2084
|
-
var agentMemoryDeleteRequestSchema =
|
|
2085
|
-
key:
|
|
2112
|
+
var agentMemoryDeleteRequestSchema = z17.object({
|
|
2113
|
+
key: z17.string().min(1).max(AGENT_MEMORY_KEY_MAX_LENGTH)
|
|
2086
2114
|
});
|
|
2087
2115
|
|
|
2088
2116
|
// ../contracts/src/backlinks.ts
|
|
2089
|
-
import { z as
|
|
2090
|
-
var ccReleaseSyncStatusSchema =
|
|
2117
|
+
import { z as z18 } from "zod";
|
|
2118
|
+
var ccReleaseSyncStatusSchema = z18.enum(["queued", "downloading", "querying", "ready", "failed"]);
|
|
2091
2119
|
var CcReleaseSyncStatuses = ccReleaseSyncStatusSchema.enum;
|
|
2092
|
-
var ccReleaseSyncDtoSchema =
|
|
2093
|
-
id:
|
|
2094
|
-
release:
|
|
2120
|
+
var ccReleaseSyncDtoSchema = z18.object({
|
|
2121
|
+
id: z18.string(),
|
|
2122
|
+
release: z18.string(),
|
|
2095
2123
|
status: ccReleaseSyncStatusSchema,
|
|
2096
|
-
phaseDetail:
|
|
2097
|
-
vertexPath:
|
|
2098
|
-
edgesPath:
|
|
2099
|
-
vertexSha256:
|
|
2100
|
-
edgesSha256:
|
|
2101
|
-
vertexBytes:
|
|
2102
|
-
edgesBytes:
|
|
2103
|
-
projectsProcessed:
|
|
2104
|
-
domainsDiscovered:
|
|
2105
|
-
downloadStartedAt:
|
|
2106
|
-
downloadFinishedAt:
|
|
2107
|
-
queryStartedAt:
|
|
2108
|
-
queryFinishedAt:
|
|
2109
|
-
error:
|
|
2110
|
-
createdAt:
|
|
2111
|
-
updatedAt:
|
|
2112
|
-
});
|
|
2113
|
-
var backlinkDomainDtoSchema =
|
|
2114
|
-
linkingDomain:
|
|
2115
|
-
numHosts:
|
|
2116
|
-
});
|
|
2117
|
-
var backlinkSummaryDtoSchema =
|
|
2118
|
-
projectId:
|
|
2119
|
-
release:
|
|
2120
|
-
targetDomain:
|
|
2121
|
-
totalLinkingDomains:
|
|
2122
|
-
totalHosts:
|
|
2123
|
-
top10HostsShare:
|
|
2124
|
-
queriedAt:
|
|
2124
|
+
phaseDetail: z18.string().nullable().optional(),
|
|
2125
|
+
vertexPath: z18.string().nullable().optional(),
|
|
2126
|
+
edgesPath: z18.string().nullable().optional(),
|
|
2127
|
+
vertexSha256: z18.string().nullable().optional(),
|
|
2128
|
+
edgesSha256: z18.string().nullable().optional(),
|
|
2129
|
+
vertexBytes: z18.number().int().nullable().optional(),
|
|
2130
|
+
edgesBytes: z18.number().int().nullable().optional(),
|
|
2131
|
+
projectsProcessed: z18.number().int().nullable().optional(),
|
|
2132
|
+
domainsDiscovered: z18.number().int().nullable().optional(),
|
|
2133
|
+
downloadStartedAt: z18.string().nullable().optional(),
|
|
2134
|
+
downloadFinishedAt: z18.string().nullable().optional(),
|
|
2135
|
+
queryStartedAt: z18.string().nullable().optional(),
|
|
2136
|
+
queryFinishedAt: z18.string().nullable().optional(),
|
|
2137
|
+
error: z18.string().nullable().optional(),
|
|
2138
|
+
createdAt: z18.string(),
|
|
2139
|
+
updatedAt: z18.string()
|
|
2140
|
+
});
|
|
2141
|
+
var backlinkDomainDtoSchema = z18.object({
|
|
2142
|
+
linkingDomain: z18.string(),
|
|
2143
|
+
numHosts: z18.number().int()
|
|
2144
|
+
});
|
|
2145
|
+
var backlinkSummaryDtoSchema = z18.object({
|
|
2146
|
+
projectId: z18.string(),
|
|
2147
|
+
release: z18.string(),
|
|
2148
|
+
targetDomain: z18.string(),
|
|
2149
|
+
totalLinkingDomains: z18.number().int(),
|
|
2150
|
+
totalHosts: z18.number().int(),
|
|
2151
|
+
top10HostsShare: z18.string(),
|
|
2152
|
+
queriedAt: z18.string(),
|
|
2125
2153
|
// Populated when the response is filtered (e.g. ?excludeCrawlers=1).
|
|
2126
2154
|
// Counts the rows omitted from totalLinkingDomains/totalHosts so callers
|
|
2127
2155
|
// can show "N hidden" hints without re-deriving them.
|
|
2128
|
-
excludedLinkingDomains:
|
|
2129
|
-
excludedHosts:
|
|
2156
|
+
excludedLinkingDomains: z18.number().int().optional(),
|
|
2157
|
+
excludedHosts: z18.number().int().optional()
|
|
2130
2158
|
});
|
|
2131
|
-
var backlinkListResponseSchema =
|
|
2159
|
+
var backlinkListResponseSchema = z18.object({
|
|
2132
2160
|
summary: backlinkSummaryDtoSchema.nullable(),
|
|
2133
|
-
total:
|
|
2134
|
-
rows:
|
|
2135
|
-
});
|
|
2136
|
-
var backlinkHistoryEntrySchema =
|
|
2137
|
-
release:
|
|
2138
|
-
totalLinkingDomains:
|
|
2139
|
-
totalHosts:
|
|
2140
|
-
top10HostsShare:
|
|
2141
|
-
queriedAt:
|
|
2142
|
-
});
|
|
2143
|
-
var backlinksInstallStatusDtoSchema =
|
|
2144
|
-
duckdbInstalled:
|
|
2145
|
-
duckdbVersion:
|
|
2146
|
-
duckdbSpec:
|
|
2147
|
-
pluginDir:
|
|
2148
|
-
});
|
|
2149
|
-
var backlinksInstallResultDtoSchema =
|
|
2150
|
-
installed:
|
|
2151
|
-
version:
|
|
2152
|
-
path:
|
|
2153
|
-
alreadyPresent:
|
|
2154
|
-
});
|
|
2155
|
-
var ccAvailableReleaseSchema =
|
|
2156
|
-
release:
|
|
2157
|
-
vertexUrl:
|
|
2158
|
-
edgesUrl:
|
|
2159
|
-
vertexBytes:
|
|
2160
|
-
edgesBytes:
|
|
2161
|
-
lastModified:
|
|
2162
|
-
});
|
|
2163
|
-
var ccCachedReleaseSchema =
|
|
2164
|
-
release:
|
|
2161
|
+
total: z18.number().int(),
|
|
2162
|
+
rows: z18.array(backlinkDomainDtoSchema)
|
|
2163
|
+
});
|
|
2164
|
+
var backlinkHistoryEntrySchema = z18.object({
|
|
2165
|
+
release: z18.string(),
|
|
2166
|
+
totalLinkingDomains: z18.number().int(),
|
|
2167
|
+
totalHosts: z18.number().int(),
|
|
2168
|
+
top10HostsShare: z18.string(),
|
|
2169
|
+
queriedAt: z18.string()
|
|
2170
|
+
});
|
|
2171
|
+
var backlinksInstallStatusDtoSchema = z18.object({
|
|
2172
|
+
duckdbInstalled: z18.boolean(),
|
|
2173
|
+
duckdbVersion: z18.string().nullable().optional(),
|
|
2174
|
+
duckdbSpec: z18.string(),
|
|
2175
|
+
pluginDir: z18.string()
|
|
2176
|
+
});
|
|
2177
|
+
var backlinksInstallResultDtoSchema = z18.object({
|
|
2178
|
+
installed: z18.boolean(),
|
|
2179
|
+
version: z18.string(),
|
|
2180
|
+
path: z18.string(),
|
|
2181
|
+
alreadyPresent: z18.boolean()
|
|
2182
|
+
});
|
|
2183
|
+
var ccAvailableReleaseSchema = z18.object({
|
|
2184
|
+
release: z18.string(),
|
|
2185
|
+
vertexUrl: z18.string(),
|
|
2186
|
+
edgesUrl: z18.string(),
|
|
2187
|
+
vertexBytes: z18.number().int().nullable(),
|
|
2188
|
+
edgesBytes: z18.number().int().nullable(),
|
|
2189
|
+
lastModified: z18.string().nullable()
|
|
2190
|
+
});
|
|
2191
|
+
var ccCachedReleaseSchema = z18.object({
|
|
2192
|
+
release: z18.string(),
|
|
2165
2193
|
syncStatus: ccReleaseSyncStatusSchema.nullable(),
|
|
2166
|
-
bytes:
|
|
2167
|
-
lastUsedAt:
|
|
2194
|
+
bytes: z18.number().int(),
|
|
2195
|
+
lastUsedAt: z18.string().nullable()
|
|
2168
2196
|
});
|
|
2169
2197
|
|
|
2170
2198
|
// ../contracts/src/composites.ts
|
|
2171
|
-
import { z as
|
|
2172
|
-
var searchHitKindSchema =
|
|
2173
|
-
var projectSearchSnapshotHitSchema =
|
|
2174
|
-
kind:
|
|
2175
|
-
id:
|
|
2176
|
-
runId:
|
|
2177
|
-
query:
|
|
2178
|
-
provider:
|
|
2179
|
-
model:
|
|
2199
|
+
import { z as z19 } from "zod";
|
|
2200
|
+
var searchHitKindSchema = z19.enum(["snapshot", "insight"]);
|
|
2201
|
+
var projectSearchSnapshotHitSchema = z19.object({
|
|
2202
|
+
kind: z19.literal("snapshot"),
|
|
2203
|
+
id: z19.string(),
|
|
2204
|
+
runId: z19.string(),
|
|
2205
|
+
query: z19.string(),
|
|
2206
|
+
provider: z19.string(),
|
|
2207
|
+
model: z19.string().nullable(),
|
|
2180
2208
|
citationState: citationStateSchema,
|
|
2181
|
-
matchedField:
|
|
2182
|
-
snippet:
|
|
2183
|
-
createdAt:
|
|
2184
|
-
});
|
|
2185
|
-
var projectSearchInsightHitSchema =
|
|
2186
|
-
kind:
|
|
2187
|
-
id:
|
|
2188
|
-
runId:
|
|
2189
|
-
type:
|
|
2209
|
+
matchedField: z19.enum(["answerText", "citedDomains", "searchQueries", "query"]),
|
|
2210
|
+
snippet: z19.string(),
|
|
2211
|
+
createdAt: z19.string()
|
|
2212
|
+
});
|
|
2213
|
+
var projectSearchInsightHitSchema = z19.object({
|
|
2214
|
+
kind: z19.literal("insight"),
|
|
2215
|
+
id: z19.string(),
|
|
2216
|
+
runId: z19.string().nullable(),
|
|
2217
|
+
type: z19.enum([
|
|
2190
2218
|
"regression",
|
|
2191
2219
|
"gain",
|
|
2192
2220
|
"opportunity",
|
|
@@ -2202,29 +2230,29 @@ var projectSearchInsightHitSchema = z18.object({
|
|
|
2202
2230
|
"gbp-metric-drop",
|
|
2203
2231
|
"gbp-keyword-drop"
|
|
2204
2232
|
]),
|
|
2205
|
-
severity:
|
|
2206
|
-
title:
|
|
2207
|
-
query:
|
|
2208
|
-
provider:
|
|
2209
|
-
matchedField:
|
|
2210
|
-
snippet:
|
|
2211
|
-
dismissed:
|
|
2212
|
-
createdAt:
|
|
2213
|
-
});
|
|
2214
|
-
var projectSearchHitSchema =
|
|
2233
|
+
severity: z19.enum(["critical", "high", "medium", "low"]),
|
|
2234
|
+
title: z19.string(),
|
|
2235
|
+
query: z19.string(),
|
|
2236
|
+
provider: z19.string(),
|
|
2237
|
+
matchedField: z19.enum(["title", "query", "recommendation", "cause"]),
|
|
2238
|
+
snippet: z19.string(),
|
|
2239
|
+
dismissed: z19.boolean(),
|
|
2240
|
+
createdAt: z19.string()
|
|
2241
|
+
});
|
|
2242
|
+
var projectSearchHitSchema = z19.discriminatedUnion("kind", [
|
|
2215
2243
|
projectSearchSnapshotHitSchema,
|
|
2216
2244
|
projectSearchInsightHitSchema
|
|
2217
2245
|
]);
|
|
2218
|
-
var projectSearchResponseSchema =
|
|
2219
|
-
query:
|
|
2220
|
-
totalHits:
|
|
2221
|
-
truncated:
|
|
2222
|
-
hits:
|
|
2246
|
+
var projectSearchResponseSchema = z19.object({
|
|
2247
|
+
query: z19.string(),
|
|
2248
|
+
totalHits: z19.number().int().nonnegative(),
|
|
2249
|
+
truncated: z19.boolean(),
|
|
2250
|
+
hits: z19.array(projectSearchHitSchema)
|
|
2223
2251
|
});
|
|
2224
2252
|
|
|
2225
2253
|
// ../contracts/src/content.ts
|
|
2226
|
-
import { z as
|
|
2227
|
-
var contentActionSchema =
|
|
2254
|
+
import { z as z20 } from "zod";
|
|
2255
|
+
var contentActionSchema = z20.enum(["create", "expand", "refresh", "add-schema"]);
|
|
2228
2256
|
var ContentActions = contentActionSchema.enum;
|
|
2229
2257
|
function contentActionLabel(action) {
|
|
2230
2258
|
switch (action) {
|
|
@@ -2238,9 +2266,9 @@ function contentActionLabel(action) {
|
|
|
2238
2266
|
return "Add schema";
|
|
2239
2267
|
}
|
|
2240
2268
|
}
|
|
2241
|
-
var demandSourceSchema =
|
|
2269
|
+
var demandSourceSchema = z20.enum(["gsc", "competitor-evidence", "both"]);
|
|
2242
2270
|
var DemandSources = demandSourceSchema.enum;
|
|
2243
|
-
var actionConfidenceSchema =
|
|
2271
|
+
var actionConfidenceSchema = z20.enum(["high", "medium", "low"]);
|
|
2244
2272
|
var ActionConfidences = actionConfidenceSchema.enum;
|
|
2245
2273
|
function actionConfidenceLabel(confidence) {
|
|
2246
2274
|
switch (confidence) {
|
|
@@ -2252,7 +2280,7 @@ function actionConfidenceLabel(confidence) {
|
|
|
2252
2280
|
return "Low";
|
|
2253
2281
|
}
|
|
2254
2282
|
}
|
|
2255
|
-
var pageTypeSchema =
|
|
2283
|
+
var pageTypeSchema = z20.enum([
|
|
2256
2284
|
"blog-post",
|
|
2257
2285
|
"comparison",
|
|
2258
2286
|
"listicle",
|
|
@@ -2261,7 +2289,7 @@ var pageTypeSchema = z19.enum([
|
|
|
2261
2289
|
"glossary"
|
|
2262
2290
|
]);
|
|
2263
2291
|
var PageTypes = pageTypeSchema.enum;
|
|
2264
|
-
var contentActionStateSchema =
|
|
2292
|
+
var contentActionStateSchema = z20.enum([
|
|
2265
2293
|
"proposed",
|
|
2266
2294
|
"briefed",
|
|
2267
2295
|
"payload-generated",
|
|
@@ -2271,136 +2299,136 @@ var contentActionStateSchema = z19.enum([
|
|
|
2271
2299
|
"dismissed"
|
|
2272
2300
|
]);
|
|
2273
2301
|
var ContentActionStates = contentActionStateSchema.enum;
|
|
2274
|
-
var ourBestPageSchema =
|
|
2275
|
-
url:
|
|
2276
|
-
gscImpressions:
|
|
2277
|
-
gscClicks:
|
|
2302
|
+
var ourBestPageSchema = z20.object({
|
|
2303
|
+
url: z20.string(),
|
|
2304
|
+
gscImpressions: z20.number().nonnegative(),
|
|
2305
|
+
gscClicks: z20.number().nonnegative(),
|
|
2278
2306
|
// Null when the page came from the inventory fallback (no GSC ranking data).
|
|
2279
|
-
gscAvgPosition:
|
|
2280
|
-
organicSessions:
|
|
2307
|
+
gscAvgPosition: z20.number().nonnegative().nullable(),
|
|
2308
|
+
organicSessions: z20.number().nonnegative()
|
|
2281
2309
|
});
|
|
2282
|
-
var winningCompetitorSchema =
|
|
2283
|
-
domain:
|
|
2284
|
-
url:
|
|
2285
|
-
title:
|
|
2286
|
-
citationCount:
|
|
2310
|
+
var winningCompetitorSchema = z20.object({
|
|
2311
|
+
domain: z20.string(),
|
|
2312
|
+
url: z20.string(),
|
|
2313
|
+
title: z20.string(),
|
|
2314
|
+
citationCount: z20.number().int().nonnegative()
|
|
2287
2315
|
});
|
|
2288
|
-
var scoreBreakdownSchema =
|
|
2289
|
-
demand:
|
|
2290
|
-
competitor:
|
|
2291
|
-
absence:
|
|
2292
|
-
gapSeverity:
|
|
2316
|
+
var scoreBreakdownSchema = z20.object({
|
|
2317
|
+
demand: z20.number(),
|
|
2318
|
+
competitor: z20.number(),
|
|
2319
|
+
absence: z20.number(),
|
|
2320
|
+
gapSeverity: z20.number()
|
|
2293
2321
|
});
|
|
2294
|
-
var existingActionRefSchema =
|
|
2295
|
-
actionId:
|
|
2322
|
+
var existingActionRefSchema = z20.object({
|
|
2323
|
+
actionId: z20.string(),
|
|
2296
2324
|
state: contentActionStateSchema,
|
|
2297
|
-
lastUpdated:
|
|
2325
|
+
lastUpdated: z20.string()
|
|
2298
2326
|
});
|
|
2299
|
-
var contentTargetRowDtoSchema =
|
|
2300
|
-
targetRef:
|
|
2301
|
-
query:
|
|
2327
|
+
var contentTargetRowDtoSchema = z20.object({
|
|
2328
|
+
targetRef: z20.string(),
|
|
2329
|
+
query: z20.string(),
|
|
2302
2330
|
action: contentActionSchema,
|
|
2303
2331
|
ourBestPage: ourBestPageSchema.nullable(),
|
|
2304
2332
|
winningCompetitor: winningCompetitorSchema.nullable(),
|
|
2305
|
-
score:
|
|
2333
|
+
score: z20.number(),
|
|
2306
2334
|
scoreBreakdown: scoreBreakdownSchema,
|
|
2307
|
-
drivers:
|
|
2335
|
+
drivers: z20.array(z20.string()),
|
|
2308
2336
|
demandSource: demandSourceSchema,
|
|
2309
2337
|
actionConfidence: actionConfidenceSchema,
|
|
2310
2338
|
existingAction: existingActionRefSchema.nullable()
|
|
2311
2339
|
});
|
|
2312
|
-
var contentTargetsResponseDtoSchema =
|
|
2313
|
-
targets:
|
|
2314
|
-
contextMetrics:
|
|
2315
|
-
totalAiReferralSessions:
|
|
2316
|
-
latestRunId:
|
|
2317
|
-
runTimestamp:
|
|
2340
|
+
var contentTargetsResponseDtoSchema = z20.object({
|
|
2341
|
+
targets: z20.array(contentTargetRowDtoSchema),
|
|
2342
|
+
contextMetrics: z20.object({
|
|
2343
|
+
totalAiReferralSessions: z20.number().int().nonnegative(),
|
|
2344
|
+
latestRunId: z20.string(),
|
|
2345
|
+
runTimestamp: z20.string()
|
|
2318
2346
|
})
|
|
2319
2347
|
});
|
|
2320
|
-
var contentTargetDismissalDtoSchema =
|
|
2321
|
-
targetRef:
|
|
2322
|
-
addressedUrl:
|
|
2323
|
-
note:
|
|
2324
|
-
dismissedAt:
|
|
2348
|
+
var contentTargetDismissalDtoSchema = z20.object({
|
|
2349
|
+
targetRef: z20.string(),
|
|
2350
|
+
addressedUrl: z20.string().nullable(),
|
|
2351
|
+
note: z20.string().nullable(),
|
|
2352
|
+
dismissedAt: z20.string()
|
|
2325
2353
|
});
|
|
2326
|
-
var contentTargetDismissalsResponseDtoSchema =
|
|
2327
|
-
dismissals:
|
|
2354
|
+
var contentTargetDismissalsResponseDtoSchema = z20.object({
|
|
2355
|
+
dismissals: z20.array(contentTargetDismissalDtoSchema)
|
|
2328
2356
|
});
|
|
2329
|
-
var contentTargetDismissRequestSchema =
|
|
2330
|
-
targetRef:
|
|
2357
|
+
var contentTargetDismissRequestSchema = z20.object({
|
|
2358
|
+
targetRef: z20.string().min(1),
|
|
2331
2359
|
/** URL of the page the user wrote that addresses this recommendation. Stored verbatim for the audit trail; not currently used to suppress the slug-token matcher. */
|
|
2332
|
-
addressedUrl:
|
|
2360
|
+
addressedUrl: z20.string().url().optional(),
|
|
2333
2361
|
/** Free-form note (e.g. "covered in our Q1 content sprint"). 500 char cap is the API surface limit; the DB column is unbounded. */
|
|
2334
|
-
note:
|
|
2362
|
+
note: z20.string().max(500).optional()
|
|
2335
2363
|
});
|
|
2336
|
-
var recommendationExplanationDtoSchema =
|
|
2337
|
-
targetRef:
|
|
2364
|
+
var recommendationExplanationDtoSchema = z20.object({
|
|
2365
|
+
targetRef: z20.string(),
|
|
2338
2366
|
/** Version of the prompt template used. Bumping the version invalidates the cache forward without touching the table. */
|
|
2339
|
-
promptVersion:
|
|
2367
|
+
promptVersion: z20.string(),
|
|
2340
2368
|
/** Provider that produced the explanation (e.g. "claude", "gemini"). */
|
|
2341
|
-
provider:
|
|
2369
|
+
provider: z20.string(),
|
|
2342
2370
|
/** Model id within that provider (e.g. "claude-sonnet-4-6"). */
|
|
2343
|
-
model:
|
|
2371
|
+
model: z20.string(),
|
|
2344
2372
|
/** Markdown-formatted rationale + recommended next steps. */
|
|
2345
|
-
responseText:
|
|
2373
|
+
responseText: z20.string(),
|
|
2346
2374
|
/** Estimated cost in millicents (1/100 of a cent). 0 when unknown. */
|
|
2347
|
-
costMillicents:
|
|
2348
|
-
generatedAt:
|
|
2375
|
+
costMillicents: z20.number().int().nonnegative(),
|
|
2376
|
+
generatedAt: z20.string()
|
|
2349
2377
|
});
|
|
2350
|
-
var recommendationExplainRequestSchema =
|
|
2378
|
+
var recommendationExplainRequestSchema = z20.object({
|
|
2351
2379
|
/**
|
|
2352
2380
|
* Optional provider override (e.g. "claude" to force Claude even if
|
|
2353
2381
|
* the project's default is Gemini). Falls through to project default
|
|
2354
2382
|
* → auto-detect when omitted.
|
|
2355
2383
|
*/
|
|
2356
|
-
provider:
|
|
2384
|
+
provider: z20.string().optional(),
|
|
2357
2385
|
/**
|
|
2358
2386
|
* Optional model override within the chosen provider. Falls through to
|
|
2359
2387
|
* the `analyze`-tier default model when omitted.
|
|
2360
2388
|
*/
|
|
2361
|
-
model:
|
|
2389
|
+
model: z20.string().optional(),
|
|
2362
2390
|
/**
|
|
2363
2391
|
* Force a fresh LLM call even if a cached explanation exists for the
|
|
2364
2392
|
* current prompt version. Use sparingly — defeats the cache.
|
|
2365
2393
|
*/
|
|
2366
|
-
forceRefresh:
|
|
2367
|
-
});
|
|
2368
|
-
var contentGroundingSourceSchema = z19.object({
|
|
2369
|
-
uri: z19.string(),
|
|
2370
|
-
title: z19.string(),
|
|
2371
|
-
domain: z19.string(),
|
|
2372
|
-
isOurDomain: z19.boolean(),
|
|
2373
|
-
isCompetitor: z19.boolean(),
|
|
2374
|
-
citationCount: z19.number().int().nonnegative(),
|
|
2375
|
-
providers: z19.array(providerNameSchema)
|
|
2376
|
-
});
|
|
2377
|
-
var contentSourceRowDtoSchema = z19.object({
|
|
2378
|
-
query: z19.string(),
|
|
2379
|
-
groundingSources: z19.array(contentGroundingSourceSchema)
|
|
2380
|
-
});
|
|
2381
|
-
var contentSourcesResponseDtoSchema = z19.object({
|
|
2382
|
-
sources: z19.array(contentSourceRowDtoSchema),
|
|
2383
|
-
latestRunId: z19.string()
|
|
2394
|
+
forceRefresh: z20.boolean().optional()
|
|
2384
2395
|
});
|
|
2385
|
-
var
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2396
|
+
var contentGroundingSourceSchema = z20.object({
|
|
2397
|
+
uri: z20.string(),
|
|
2398
|
+
title: z20.string(),
|
|
2399
|
+
domain: z20.string(),
|
|
2400
|
+
isOurDomain: z20.boolean(),
|
|
2401
|
+
isCompetitor: z20.boolean(),
|
|
2402
|
+
citationCount: z20.number().int().nonnegative(),
|
|
2403
|
+
providers: z20.array(providerNameSchema)
|
|
2404
|
+
});
|
|
2405
|
+
var contentSourceRowDtoSchema = z20.object({
|
|
2406
|
+
query: z20.string(),
|
|
2407
|
+
groundingSources: z20.array(contentGroundingSourceSchema)
|
|
2408
|
+
});
|
|
2409
|
+
var contentSourcesResponseDtoSchema = z20.object({
|
|
2410
|
+
sources: z20.array(contentSourceRowDtoSchema),
|
|
2411
|
+
latestRunId: z20.string()
|
|
2412
|
+
});
|
|
2413
|
+
var contentGapRowDtoSchema = z20.object({
|
|
2414
|
+
query: z20.string(),
|
|
2415
|
+
competitorDomains: z20.array(z20.string()),
|
|
2416
|
+
competitorCount: z20.number().int().nonnegative(),
|
|
2417
|
+
missRate: z20.number().min(0).max(1),
|
|
2418
|
+
lastSeenInRunId: z20.string()
|
|
2419
|
+
});
|
|
2420
|
+
var contentGapsResponseDtoSchema = z20.object({
|
|
2421
|
+
gaps: z20.array(contentGapRowDtoSchema),
|
|
2422
|
+
latestRunId: z20.string()
|
|
2395
2423
|
});
|
|
2396
2424
|
|
|
2397
2425
|
// ../contracts/src/doctor.ts
|
|
2398
|
-
import { z as
|
|
2399
|
-
var checkStatusSchema =
|
|
2426
|
+
import { z as z21 } from "zod";
|
|
2427
|
+
var checkStatusSchema = z21.enum(["ok", "warn", "fail", "skipped"]);
|
|
2400
2428
|
var CheckStatuses = checkStatusSchema.enum;
|
|
2401
|
-
var checkScopeSchema =
|
|
2429
|
+
var checkScopeSchema = z21.enum(["global", "project"]);
|
|
2402
2430
|
var CheckScopes = checkScopeSchema.enum;
|
|
2403
|
-
var checkCategorySchema =
|
|
2431
|
+
var checkCategorySchema = z21.enum([
|
|
2404
2432
|
"auth",
|
|
2405
2433
|
"config",
|
|
2406
2434
|
"providers",
|
|
@@ -2411,31 +2439,31 @@ var checkCategorySchema = z20.enum([
|
|
|
2411
2439
|
"agent"
|
|
2412
2440
|
]);
|
|
2413
2441
|
var CheckCategories = checkCategorySchema.enum;
|
|
2414
|
-
var checkResultSchema =
|
|
2415
|
-
id:
|
|
2442
|
+
var checkResultSchema = z21.object({
|
|
2443
|
+
id: z21.string(),
|
|
2416
2444
|
category: checkCategorySchema,
|
|
2417
2445
|
scope: checkScopeSchema,
|
|
2418
|
-
title:
|
|
2446
|
+
title: z21.string(),
|
|
2419
2447
|
status: checkStatusSchema,
|
|
2420
|
-
code:
|
|
2421
|
-
summary:
|
|
2422
|
-
remediation:
|
|
2423
|
-
details:
|
|
2424
|
-
durationMs:
|
|
2448
|
+
code: z21.string().describe('Stable machine-readable code (e.g. "google.token.refresh-failed"). Use this for filtering and remediation logic.'),
|
|
2449
|
+
summary: z21.string(),
|
|
2450
|
+
remediation: z21.string().nullable().optional().describe('Operator-facing next step. Null when status is "ok" or no specific remediation applies.'),
|
|
2451
|
+
details: z21.record(z21.string(), z21.unknown()).optional().describe("Structured context \u2014 principal email, redirect URI, missing scopes, etc. Stable per check id."),
|
|
2452
|
+
durationMs: z21.number().int().nonnegative().describe("How long the check took to execute.")
|
|
2425
2453
|
});
|
|
2426
|
-
var doctorReportSchema =
|
|
2454
|
+
var doctorReportSchema = z21.object({
|
|
2427
2455
|
scope: checkScopeSchema,
|
|
2428
|
-
project:
|
|
2429
|
-
generatedAt:
|
|
2430
|
-
durationMs:
|
|
2431
|
-
summary:
|
|
2432
|
-
total:
|
|
2433
|
-
ok:
|
|
2434
|
-
warn:
|
|
2435
|
-
fail:
|
|
2436
|
-
skipped:
|
|
2456
|
+
project: z21.string().nullable().describe('Project name when scope is "project", null otherwise.'),
|
|
2457
|
+
generatedAt: z21.string().describe("ISO-8601 timestamp when this doctor run started."),
|
|
2458
|
+
durationMs: z21.number().int().nonnegative(),
|
|
2459
|
+
summary: z21.object({
|
|
2460
|
+
total: z21.number().int().nonnegative(),
|
|
2461
|
+
ok: z21.number().int().nonnegative(),
|
|
2462
|
+
warn: z21.number().int().nonnegative(),
|
|
2463
|
+
fail: z21.number().int().nonnegative(),
|
|
2464
|
+
skipped: z21.number().int().nonnegative()
|
|
2437
2465
|
}),
|
|
2438
|
-
checks:
|
|
2466
|
+
checks: z21.array(checkResultSchema)
|
|
2439
2467
|
});
|
|
2440
2468
|
function summarizeCheckResults(results) {
|
|
2441
2469
|
const summary = { total: results.length, ok: 0, warn: 0, fail: 0, skipped: 0 };
|
|
@@ -2581,52 +2609,52 @@ function normalizeUrlPath(input) {
|
|
|
2581
2609
|
}
|
|
2582
2610
|
|
|
2583
2611
|
// ../contracts/src/citations.ts
|
|
2584
|
-
import { z as
|
|
2585
|
-
var citationCoverageProviderSchema =
|
|
2586
|
-
provider:
|
|
2612
|
+
import { z as z22 } from "zod";
|
|
2613
|
+
var citationCoverageProviderSchema = z22.object({
|
|
2614
|
+
provider: z22.string(),
|
|
2587
2615
|
citationState: citationStateSchema,
|
|
2588
|
-
cited:
|
|
2589
|
-
mentioned:
|
|
2590
|
-
runId:
|
|
2591
|
-
runCreatedAt:
|
|
2592
|
-
});
|
|
2593
|
-
var citationCoverageRowSchema =
|
|
2594
|
-
queryId:
|
|
2595
|
-
query:
|
|
2596
|
-
providers:
|
|
2597
|
-
citedCount:
|
|
2598
|
-
mentionedCount:
|
|
2599
|
-
totalProviders:
|
|
2600
|
-
});
|
|
2601
|
-
var competitorGapRowSchema =
|
|
2602
|
-
queryId:
|
|
2603
|
-
query:
|
|
2604
|
-
provider:
|
|
2605
|
-
citingCompetitors:
|
|
2606
|
-
runId:
|
|
2607
|
-
runCreatedAt:
|
|
2608
|
-
});
|
|
2609
|
-
var citationVisibilitySummarySchema =
|
|
2610
|
-
providersConfigured:
|
|
2611
|
-
providersCiting:
|
|
2612
|
-
providersMentioning:
|
|
2613
|
-
totalQueries:
|
|
2616
|
+
cited: z22.boolean(),
|
|
2617
|
+
mentioned: z22.boolean(),
|
|
2618
|
+
runId: z22.string(),
|
|
2619
|
+
runCreatedAt: z22.string()
|
|
2620
|
+
});
|
|
2621
|
+
var citationCoverageRowSchema = z22.object({
|
|
2622
|
+
queryId: z22.string(),
|
|
2623
|
+
query: z22.string(),
|
|
2624
|
+
providers: z22.array(citationCoverageProviderSchema),
|
|
2625
|
+
citedCount: z22.number().int().nonnegative(),
|
|
2626
|
+
mentionedCount: z22.number().int().nonnegative(),
|
|
2627
|
+
totalProviders: z22.number().int().nonnegative()
|
|
2628
|
+
});
|
|
2629
|
+
var competitorGapRowSchema = z22.object({
|
|
2630
|
+
queryId: z22.string(),
|
|
2631
|
+
query: z22.string(),
|
|
2632
|
+
provider: z22.string(),
|
|
2633
|
+
citingCompetitors: z22.array(z22.string()),
|
|
2634
|
+
runId: z22.string(),
|
|
2635
|
+
runCreatedAt: z22.string()
|
|
2636
|
+
});
|
|
2637
|
+
var citationVisibilitySummarySchema = z22.object({
|
|
2638
|
+
providersConfigured: z22.number().int().nonnegative(),
|
|
2639
|
+
providersCiting: z22.number().int().nonnegative(),
|
|
2640
|
+
providersMentioning: z22.number().int().nonnegative(),
|
|
2641
|
+
totalQueries: z22.number().int().nonnegative(),
|
|
2614
2642
|
// Cross-tab buckets — each tracked query with at least one snapshot lands
|
|
2615
2643
|
// in exactly one of these. Queries with zero snapshots are not counted in
|
|
2616
2644
|
// any bucket; (sum of buckets) ≤ totalQueries.
|
|
2617
|
-
queriesCitedAndMentioned:
|
|
2618
|
-
queriesCitedOnly:
|
|
2619
|
-
queriesMentionedOnly:
|
|
2620
|
-
queriesInvisible:
|
|
2621
|
-
latestRunId:
|
|
2622
|
-
latestRunAt:
|
|
2623
|
-
});
|
|
2624
|
-
var citationVisibilityResponseSchema =
|
|
2645
|
+
queriesCitedAndMentioned: z22.number().int().nonnegative(),
|
|
2646
|
+
queriesCitedOnly: z22.number().int().nonnegative(),
|
|
2647
|
+
queriesMentionedOnly: z22.number().int().nonnegative(),
|
|
2648
|
+
queriesInvisible: z22.number().int().nonnegative(),
|
|
2649
|
+
latestRunId: z22.string().nullable(),
|
|
2650
|
+
latestRunAt: z22.string().nullable()
|
|
2651
|
+
});
|
|
2652
|
+
var citationVisibilityResponseSchema = z22.object({
|
|
2625
2653
|
summary: citationVisibilitySummarySchema,
|
|
2626
|
-
byQuery:
|
|
2627
|
-
competitorGaps:
|
|
2628
|
-
status:
|
|
2629
|
-
reason:
|
|
2654
|
+
byQuery: z22.array(citationCoverageRowSchema),
|
|
2655
|
+
competitorGaps: z22.array(competitorGapRowSchema),
|
|
2656
|
+
status: z22.enum(["ready", "no-data"]),
|
|
2657
|
+
reason: z22.enum(["no-runs-yet", "no-queries"]).optional()
|
|
2630
2658
|
});
|
|
2631
2659
|
function emptyCitationVisibility(reason) {
|
|
2632
2660
|
return {
|
|
@@ -2653,46 +2681,46 @@ function citationStateToCited(state) {
|
|
|
2653
2681
|
}
|
|
2654
2682
|
|
|
2655
2683
|
// ../contracts/src/report.ts
|
|
2656
|
-
import { z as
|
|
2657
|
-
var providerLocationTreatmentSchema =
|
|
2684
|
+
import { z as z23 } from "zod";
|
|
2685
|
+
var providerLocationTreatmentSchema = z23.enum([
|
|
2658
2686
|
"prompt",
|
|
2659
2687
|
"request-param",
|
|
2660
2688
|
"browser-geo",
|
|
2661
2689
|
"ignored"
|
|
2662
2690
|
]);
|
|
2663
|
-
var reportMetaLocationSchema =
|
|
2691
|
+
var reportMetaLocationSchema = z23.object({
|
|
2664
2692
|
/** Human-readable label as configured on the project (e.g. "michigan"). */
|
|
2665
|
-
label:
|
|
2693
|
+
label: z23.string(),
|
|
2666
2694
|
/** Resolved city/region/country from the project's `LocationContext`. */
|
|
2667
|
-
city:
|
|
2668
|
-
region:
|
|
2669
|
-
country:
|
|
2695
|
+
city: z23.string(),
|
|
2696
|
+
region: z23.string(),
|
|
2697
|
+
country: z23.string(),
|
|
2670
2698
|
/**
|
|
2671
2699
|
* Other locations configured on the project that did NOT power this report.
|
|
2672
2700
|
* When non-empty, callers should make clear that the report is location-scoped:
|
|
2673
2701
|
* a separate sweep is needed to see how AI engines respond from each one.
|
|
2674
2702
|
*/
|
|
2675
|
-
otherConfiguredLabels:
|
|
2703
|
+
otherConfiguredLabels: z23.array(z23.string())
|
|
2676
2704
|
});
|
|
2677
|
-
var reportProviderLocationHandlingSchema =
|
|
2705
|
+
var reportProviderLocationHandlingSchema = z23.object({
|
|
2678
2706
|
/** Provider name (matches `query_snapshots.provider`). */
|
|
2679
|
-
provider:
|
|
2707
|
+
provider: z23.string(),
|
|
2680
2708
|
/** How this provider applied the configured location during this run. */
|
|
2681
2709
|
treatment: providerLocationTreatmentSchema,
|
|
2682
2710
|
/** One-sentence explanation suitable for the report. */
|
|
2683
|
-
description:
|
|
2711
|
+
description: z23.string()
|
|
2684
2712
|
});
|
|
2685
|
-
var reportMetaSchema =
|
|
2713
|
+
var reportMetaSchema = z23.object({
|
|
2686
2714
|
/** ISO timestamp the report was generated (server clock). */
|
|
2687
|
-
generatedAt:
|
|
2715
|
+
generatedAt: z23.string(),
|
|
2688
2716
|
/** Project the report covers. */
|
|
2689
|
-
project:
|
|
2690
|
-
id:
|
|
2691
|
-
name:
|
|
2692
|
-
displayName:
|
|
2693
|
-
canonicalDomain:
|
|
2694
|
-
country:
|
|
2695
|
-
language:
|
|
2717
|
+
project: z23.object({
|
|
2718
|
+
id: z23.string(),
|
|
2719
|
+
name: z23.string(),
|
|
2720
|
+
displayName: z23.string(),
|
|
2721
|
+
canonicalDomain: z23.string(),
|
|
2722
|
+
country: z23.string(),
|
|
2723
|
+
language: z23.string()
|
|
2696
2724
|
}),
|
|
2697
2725
|
/**
|
|
2698
2726
|
* The location that powered the latest visibility run, when one was set.
|
|
@@ -2707,24 +2735,24 @@ var reportMetaSchema = z22.object({
|
|
|
2707
2735
|
* each provider's answer — some providers append it to the prompt, some
|
|
2708
2736
|
* pass it as a structured request field, and some (CDP) ignore it.
|
|
2709
2737
|
*/
|
|
2710
|
-
providerLocationHandling:
|
|
2738
|
+
providerLocationHandling: z23.array(reportProviderLocationHandlingSchema),
|
|
2711
2739
|
/** Earliest data point referenced by the report (ISO date). */
|
|
2712
|
-
periodStart:
|
|
2740
|
+
periodStart: z23.string().nullable(),
|
|
2713
2741
|
/** Latest data point referenced by the report (ISO date). */
|
|
2714
|
-
periodEnd:
|
|
2742
|
+
periodEnd: z23.string().nullable()
|
|
2715
2743
|
});
|
|
2716
|
-
var reportExecutiveSummarySchema =
|
|
2744
|
+
var reportExecutiveSummarySchema = z23.object({
|
|
2717
2745
|
/**
|
|
2718
2746
|
* 0..100 — share of tracked queries that were cited by at least one
|
|
2719
2747
|
* provider in the latest run. "Cited" means the project's domain appeared
|
|
2720
2748
|
* in the source list / grounding the AI used to answer. Computed per-query
|
|
2721
2749
|
* (not per-(query × provider)) so the rate is invariant to provider count.
|
|
2722
2750
|
*/
|
|
2723
|
-
citationRate:
|
|
2751
|
+
citationRate: z23.number(),
|
|
2724
2752
|
/** Numerator of `citationRate` — distinct tracked queries cited by ≥1 provider in the latest run. */
|
|
2725
|
-
citedQueryCount:
|
|
2753
|
+
citedQueryCount: z23.number(),
|
|
2726
2754
|
/** Denominator of `citationRate` — total tracked queries. */
|
|
2727
|
-
totalQueryCount:
|
|
2755
|
+
totalQueryCount: z23.number(),
|
|
2728
2756
|
/**
|
|
2729
2757
|
* 0..100 — share of tracked queries where the project's brand or domain
|
|
2730
2758
|
* appeared in at least one provider's answer text in the latest run.
|
|
@@ -2732,68 +2760,68 @@ var reportExecutiveSummarySchema = z22.object({
|
|
|
2732
2760
|
* the prose without citing your domain in its sources, and vice versa.
|
|
2733
2761
|
* Same per-query denominator as `citationRate` for consistency.
|
|
2734
2762
|
*/
|
|
2735
|
-
mentionRate:
|
|
2763
|
+
mentionRate: z23.number(),
|
|
2736
2764
|
/** Numerator of `mentionRate` — distinct tracked queries mentioned in ≥1 provider's answer text. */
|
|
2737
|
-
mentionedQueryCount:
|
|
2765
|
+
mentionedQueryCount: z23.number(),
|
|
2738
2766
|
/** Compared to the previous run: 'up' | 'down' | 'flat' | 'unknown' (no prior run). */
|
|
2739
|
-
trend:
|
|
2767
|
+
trend: z23.enum(["up", "down", "flat", "unknown"]),
|
|
2740
2768
|
/** Total tracked queries. */
|
|
2741
|
-
queryCount:
|
|
2769
|
+
queryCount: z23.number(),
|
|
2742
2770
|
/** Total tracked competitors. */
|
|
2743
|
-
competitorCount:
|
|
2771
|
+
competitorCount: z23.number(),
|
|
2744
2772
|
/** Number of providers in the latest run. */
|
|
2745
|
-
providerCount:
|
|
2773
|
+
providerCount: z23.number(),
|
|
2746
2774
|
/** GSC totals across the most-recent sync window. Null when GSC is not connected. */
|
|
2747
|
-
gsc:
|
|
2748
|
-
clicks:
|
|
2749
|
-
impressions:
|
|
2750
|
-
ctr:
|
|
2751
|
-
avgPosition:
|
|
2752
|
-
periodStart:
|
|
2753
|
-
periodEnd:
|
|
2775
|
+
gsc: z23.object({
|
|
2776
|
+
clicks: z23.number(),
|
|
2777
|
+
impressions: z23.number(),
|
|
2778
|
+
ctr: z23.number(),
|
|
2779
|
+
avgPosition: z23.number(),
|
|
2780
|
+
periodStart: z23.string(),
|
|
2781
|
+
periodEnd: z23.string()
|
|
2754
2782
|
}).nullable(),
|
|
2755
2783
|
/** GA4 totals across the most-recent sync period. Null when GA4 is not connected. */
|
|
2756
|
-
ga:
|
|
2757
|
-
sessions:
|
|
2758
|
-
users:
|
|
2759
|
-
periodStart:
|
|
2760
|
-
periodEnd:
|
|
2784
|
+
ga: z23.object({
|
|
2785
|
+
sessions: z23.number(),
|
|
2786
|
+
users: z23.number(),
|
|
2787
|
+
periodStart: z23.string(),
|
|
2788
|
+
periodEnd: z23.string()
|
|
2761
2789
|
}).nullable(),
|
|
2762
2790
|
/** Top 3-5 findings, each rendered as a single-sentence narrative. */
|
|
2763
|
-
findings:
|
|
2764
|
-
title:
|
|
2765
|
-
detail:
|
|
2766
|
-
tone:
|
|
2791
|
+
findings: z23.array(z23.object({
|
|
2792
|
+
title: z23.string(),
|
|
2793
|
+
detail: z23.string(),
|
|
2794
|
+
tone: z23.enum(["positive", "caution", "negative", "neutral"])
|
|
2767
2795
|
}))
|
|
2768
2796
|
});
|
|
2769
|
-
var citationCellSchema =
|
|
2770
|
-
citationState:
|
|
2771
|
-
answerMentioned:
|
|
2772
|
-
model:
|
|
2797
|
+
var citationCellSchema = z23.object({
|
|
2798
|
+
citationState: z23.enum(["cited", "not-cited", "pending"]),
|
|
2799
|
+
answerMentioned: z23.boolean().nullable(),
|
|
2800
|
+
model: z23.string().nullable()
|
|
2773
2801
|
});
|
|
2774
|
-
var citationScorecardSchema =
|
|
2775
|
-
queries:
|
|
2776
|
-
providers:
|
|
2802
|
+
var citationScorecardSchema = z23.object({
|
|
2803
|
+
queries: z23.array(z23.string()),
|
|
2804
|
+
providers: z23.array(z23.string()),
|
|
2777
2805
|
/** matrix[queryIndex][providerIndex] — null when no snapshot exists for the pair. */
|
|
2778
|
-
matrix:
|
|
2806
|
+
matrix: z23.array(z23.array(citationCellSchema.nullable())),
|
|
2779
2807
|
/** Per-provider citation rate (0..100). */
|
|
2780
|
-
providerRates:
|
|
2781
|
-
provider:
|
|
2782
|
-
citedCount:
|
|
2783
|
-
totalCount:
|
|
2784
|
-
citationRate:
|
|
2808
|
+
providerRates: z23.array(z23.object({
|
|
2809
|
+
provider: z23.string(),
|
|
2810
|
+
citedCount: z23.number(),
|
|
2811
|
+
totalCount: z23.number(),
|
|
2812
|
+
citationRate: z23.number()
|
|
2785
2813
|
}))
|
|
2786
2814
|
});
|
|
2787
|
-
var competitorRowSchema =
|
|
2788
|
-
domain:
|
|
2815
|
+
var competitorRowSchema = z23.object({
|
|
2816
|
+
domain: z23.string(),
|
|
2789
2817
|
/** Number of (query × provider) pairs that cited this competitor. */
|
|
2790
|
-
citationCount:
|
|
2818
|
+
citationCount: z23.number(),
|
|
2791
2819
|
/** Out-of count for the same denominator. */
|
|
2792
|
-
totalCount:
|
|
2820
|
+
totalCount: z23.number(),
|
|
2793
2821
|
/** 'High' | 'Moderate' | 'Low' | 'None' — from buildPortfolioProject pressure logic. */
|
|
2794
|
-
pressureLabel:
|
|
2822
|
+
pressureLabel: z23.enum(["High", "Moderate", "Low", "None"]),
|
|
2795
2823
|
/** Distinct queries on which this competitor was cited. */
|
|
2796
|
-
citedQueries:
|
|
2824
|
+
citedQueries: z23.array(z23.string()),
|
|
2797
2825
|
/**
|
|
2798
2826
|
* Citation share 0..100. Numerator = this competitor's `citationCount`.
|
|
2799
2827
|
* Denominator = sum of `citationCount` across all competitors plus the
|
|
@@ -2801,30 +2829,30 @@ var competitorRowSchema = z22.object({
|
|
|
2801
2829
|
* slots in the snapshot. Distinct from the project-level Mention Share
|
|
2802
2830
|
* gauge — that one is brand-in-answer-text, this one is domain-in-source-list.
|
|
2803
2831
|
*/
|
|
2804
|
-
sharePct:
|
|
2832
|
+
sharePct: z23.number(),
|
|
2805
2833
|
/**
|
|
2806
2834
|
* URLs from the latest run's grounding sources whose host matches this
|
|
2807
2835
|
* competitor's domain, with the queries each URL was cited for. Empty
|
|
2808
2836
|
* when no grounding-source data is available (e.g. no `rawResponse` JSON
|
|
2809
2837
|
* stored for the snapshots).
|
|
2810
2838
|
*/
|
|
2811
|
-
theirCitedPages:
|
|
2839
|
+
theirCitedPages: z23.array(z23.object({ url: z23.string(), citedFor: z23.array(z23.string()) }))
|
|
2812
2840
|
});
|
|
2813
|
-
var competitorLandscapeSchema =
|
|
2841
|
+
var competitorLandscapeSchema = z23.object({
|
|
2814
2842
|
/** Project's own citation count (for the bar chart comparing project vs competitors). */
|
|
2815
|
-
projectCitationCount:
|
|
2816
|
-
competitors:
|
|
2843
|
+
projectCitationCount: z23.number(),
|
|
2844
|
+
competitors: z23.array(competitorRowSchema)
|
|
2817
2845
|
});
|
|
2818
|
-
var mentionRowSchema =
|
|
2819
|
-
domain:
|
|
2846
|
+
var mentionRowSchema = z23.object({
|
|
2847
|
+
domain: z23.string(),
|
|
2820
2848
|
/** Number of (query × provider) pairs whose answer text mentioned this competitor's brand or domain. */
|
|
2821
|
-
mentionCount:
|
|
2849
|
+
mentionCount: z23.number(),
|
|
2822
2850
|
/** Out-of count for the same denominator (snapshots that had answer text). */
|
|
2823
|
-
totalCount:
|
|
2851
|
+
totalCount: z23.number(),
|
|
2824
2852
|
/** 'High' | 'Moderate' | 'Low' | 'None' — mention frequency tier (mirrors CompetitorRow.pressureLabel). */
|
|
2825
|
-
pressureLabel:
|
|
2853
|
+
pressureLabel: z23.enum(["High", "Moderate", "Low", "None"]),
|
|
2826
2854
|
/** Distinct queries on which this competitor was mentioned. */
|
|
2827
|
-
mentionedQueries:
|
|
2855
|
+
mentionedQueries: z23.array(z23.string()),
|
|
2828
2856
|
/**
|
|
2829
2857
|
* Mention share 0..100. Numerator = this competitor's `mentionCount`.
|
|
2830
2858
|
* Denominator = sum of `mentionCount` across all competitors plus the
|
|
@@ -2832,129 +2860,129 @@ var mentionRowSchema = z22.object({
|
|
|
2832
2860
|
* mention. Per-competitor split of the same head-to-head measure the
|
|
2833
2861
|
* project's hero `MentionShareDto` gauge headlines.
|
|
2834
2862
|
*/
|
|
2835
|
-
sharePct:
|
|
2863
|
+
sharePct: z23.number()
|
|
2836
2864
|
});
|
|
2837
|
-
var mentionLandscapeSchema =
|
|
2865
|
+
var mentionLandscapeSchema = z23.object({
|
|
2838
2866
|
/** Project's own mention count (for the bar chart comparing project vs competitors). */
|
|
2839
|
-
projectMentionCount:
|
|
2867
|
+
projectMentionCount: z23.number(),
|
|
2840
2868
|
/** Snapshots considered — those with non-empty answerText. Drives the totalCount denominator. */
|
|
2841
|
-
totalAnswerSnapshots:
|
|
2842
|
-
competitors:
|
|
2869
|
+
totalAnswerSnapshots: z23.number(),
|
|
2870
|
+
competitors: z23.array(mentionRowSchema)
|
|
2843
2871
|
});
|
|
2844
|
-
var aiSourceCategoryBucketSchema =
|
|
2872
|
+
var aiSourceCategoryBucketSchema = z23.object({
|
|
2845
2873
|
/** Category slug from packages/contracts/src/source-categories. */
|
|
2846
|
-
category:
|
|
2874
|
+
category: z23.string(),
|
|
2847
2875
|
/** Display label. */
|
|
2848
|
-
label:
|
|
2876
|
+
label: z23.string(),
|
|
2849
2877
|
/** Number of citations falling in this category. */
|
|
2850
|
-
count:
|
|
2878
|
+
count: z23.number(),
|
|
2851
2879
|
/** 0..100 share of total citations. */
|
|
2852
|
-
sharePct:
|
|
2880
|
+
sharePct: z23.number()
|
|
2853
2881
|
});
|
|
2854
|
-
var aiSourceOriginSchema =
|
|
2855
|
-
categories:
|
|
2882
|
+
var aiSourceOriginSchema = z23.object({
|
|
2883
|
+
categories: z23.array(aiSourceCategoryBucketSchema),
|
|
2856
2884
|
/** Top 20 source domains by citation count (excluding the project's own domain). */
|
|
2857
|
-
topDomains:
|
|
2858
|
-
domain:
|
|
2859
|
-
count:
|
|
2885
|
+
topDomains: z23.array(z23.object({
|
|
2886
|
+
domain: z23.string(),
|
|
2887
|
+
count: z23.number(),
|
|
2860
2888
|
/** True when the domain is one of the project's tracked competitors. */
|
|
2861
|
-
isCompetitor:
|
|
2889
|
+
isCompetitor: z23.boolean()
|
|
2862
2890
|
}))
|
|
2863
2891
|
});
|
|
2864
|
-
var gscQueryRowSchema =
|
|
2865
|
-
query:
|
|
2866
|
-
clicks:
|
|
2867
|
-
impressions:
|
|
2868
|
-
ctr:
|
|
2869
|
-
avgPosition:
|
|
2892
|
+
var gscQueryRowSchema = z23.object({
|
|
2893
|
+
query: z23.string(),
|
|
2894
|
+
clicks: z23.number(),
|
|
2895
|
+
impressions: z23.number(),
|
|
2896
|
+
ctr: z23.number(),
|
|
2897
|
+
avgPosition: z23.number(),
|
|
2870
2898
|
/** Heuristic categorization: 'brand' | 'lead-gen' | 'industry' | 'other'. */
|
|
2871
|
-
category:
|
|
2872
|
-
});
|
|
2873
|
-
var gscSectionSchema =
|
|
2874
|
-
periodStart:
|
|
2875
|
-
periodEnd:
|
|
2876
|
-
totalClicks:
|
|
2877
|
-
totalImpressions:
|
|
2878
|
-
ctr:
|
|
2879
|
-
avgPosition:
|
|
2880
|
-
topQueries:
|
|
2881
|
-
categoryBreakdown:
|
|
2882
|
-
category:
|
|
2883
|
-
clicks:
|
|
2884
|
-
impressions:
|
|
2885
|
-
sharePct:
|
|
2899
|
+
category: z23.enum(["brand", "lead-gen", "industry", "other"])
|
|
2900
|
+
});
|
|
2901
|
+
var gscSectionSchema = z23.object({
|
|
2902
|
+
periodStart: z23.string(),
|
|
2903
|
+
periodEnd: z23.string(),
|
|
2904
|
+
totalClicks: z23.number(),
|
|
2905
|
+
totalImpressions: z23.number(),
|
|
2906
|
+
ctr: z23.number(),
|
|
2907
|
+
avgPosition: z23.number(),
|
|
2908
|
+
topQueries: z23.array(gscQueryRowSchema),
|
|
2909
|
+
categoryBreakdown: z23.array(z23.object({
|
|
2910
|
+
category: z23.enum(["brand", "lead-gen", "industry", "other"]),
|
|
2911
|
+
clicks: z23.number(),
|
|
2912
|
+
impressions: z23.number(),
|
|
2913
|
+
sharePct: z23.number()
|
|
2886
2914
|
})),
|
|
2887
|
-
trend:
|
|
2915
|
+
trend: z23.array(z23.object({ date: z23.string(), clicks: z23.number(), impressions: z23.number() })),
|
|
2888
2916
|
/**
|
|
2889
2917
|
* Tracked AEO queries that have no GSC impressions in the report window.
|
|
2890
2918
|
* Surfaces queries that may not represent real search demand.
|
|
2891
2919
|
*/
|
|
2892
|
-
trackedButNoGsc:
|
|
2920
|
+
trackedButNoGsc: z23.array(z23.string()),
|
|
2893
2921
|
/**
|
|
2894
2922
|
* GSC top queries (sorted by impressions desc) that are not tracked as
|
|
2895
2923
|
* AEO queries — the candidate set for adding to the AEO project.
|
|
2896
2924
|
*/
|
|
2897
|
-
gscButNotTracked:
|
|
2898
|
-
});
|
|
2899
|
-
var gaTrafficSectionSchema =
|
|
2900
|
-
totalSessions:
|
|
2901
|
-
totalUsers:
|
|
2902
|
-
totalOrganicSessions:
|
|
2903
|
-
periodStart:
|
|
2904
|
-
periodEnd:
|
|
2905
|
-
topLandingPages:
|
|
2906
|
-
page:
|
|
2907
|
-
sessions:
|
|
2908
|
-
users:
|
|
2909
|
-
organicSessions:
|
|
2925
|
+
gscButNotTracked: z23.array(z23.string())
|
|
2926
|
+
});
|
|
2927
|
+
var gaTrafficSectionSchema = z23.object({
|
|
2928
|
+
totalSessions: z23.number(),
|
|
2929
|
+
totalUsers: z23.number(),
|
|
2930
|
+
totalOrganicSessions: z23.number(),
|
|
2931
|
+
periodStart: z23.string(),
|
|
2932
|
+
periodEnd: z23.string(),
|
|
2933
|
+
topLandingPages: z23.array(z23.object({
|
|
2934
|
+
page: z23.string(),
|
|
2935
|
+
sessions: z23.number(),
|
|
2936
|
+
users: z23.number(),
|
|
2937
|
+
organicSessions: z23.number()
|
|
2910
2938
|
})),
|
|
2911
|
-
channelBreakdown:
|
|
2912
|
-
channel:
|
|
2913
|
-
sessions:
|
|
2914
|
-
sharePct:
|
|
2939
|
+
channelBreakdown: z23.array(z23.object({
|
|
2940
|
+
channel: z23.string(),
|
|
2941
|
+
sessions: z23.number(),
|
|
2942
|
+
sharePct: z23.number()
|
|
2915
2943
|
}))
|
|
2916
2944
|
});
|
|
2917
|
-
var socialReferralSectionSchema =
|
|
2918
|
-
totalSessions:
|
|
2919
|
-
organicSessions:
|
|
2920
|
-
paidSessions:
|
|
2921
|
-
channels:
|
|
2922
|
-
channelGroup:
|
|
2923
|
-
sessions:
|
|
2924
|
-
sharePct:
|
|
2945
|
+
var socialReferralSectionSchema = z23.object({
|
|
2946
|
+
totalSessions: z23.number(),
|
|
2947
|
+
organicSessions: z23.number(),
|
|
2948
|
+
paidSessions: z23.number(),
|
|
2949
|
+
channels: z23.array(z23.object({
|
|
2950
|
+
channelGroup: z23.string(),
|
|
2951
|
+
sessions: z23.number(),
|
|
2952
|
+
sharePct: z23.number()
|
|
2925
2953
|
})),
|
|
2926
|
-
topCampaigns:
|
|
2927
|
-
source:
|
|
2928
|
-
medium:
|
|
2929
|
-
sessions:
|
|
2954
|
+
topCampaigns: z23.array(z23.object({
|
|
2955
|
+
source: z23.string(),
|
|
2956
|
+
medium: z23.string(),
|
|
2957
|
+
sessions: z23.number()
|
|
2930
2958
|
}))
|
|
2931
2959
|
});
|
|
2932
|
-
var aiReferralSectionSchema =
|
|
2933
|
-
totalSessions:
|
|
2934
|
-
totalUsers:
|
|
2935
|
-
bySource:
|
|
2936
|
-
source:
|
|
2937
|
-
sessions:
|
|
2938
|
-
users:
|
|
2939
|
-
sharePct:
|
|
2960
|
+
var aiReferralSectionSchema = z23.object({
|
|
2961
|
+
totalSessions: z23.number(),
|
|
2962
|
+
totalUsers: z23.number(),
|
|
2963
|
+
bySource: z23.array(z23.object({
|
|
2964
|
+
source: z23.string(),
|
|
2965
|
+
sessions: z23.number(),
|
|
2966
|
+
users: z23.number(),
|
|
2967
|
+
sharePct: z23.number()
|
|
2940
2968
|
})),
|
|
2941
|
-
trend:
|
|
2942
|
-
topLandingPages:
|
|
2943
|
-
page:
|
|
2944
|
-
sessions:
|
|
2945
|
-
users:
|
|
2969
|
+
trend: z23.array(z23.object({ date: z23.string(), sessions: z23.number() })),
|
|
2970
|
+
topLandingPages: z23.array(z23.object({
|
|
2971
|
+
page: z23.string(),
|
|
2972
|
+
sessions: z23.number(),
|
|
2973
|
+
users: z23.number()
|
|
2946
2974
|
}))
|
|
2947
2975
|
});
|
|
2948
|
-
var serverActivitySectionSchema =
|
|
2976
|
+
var serverActivitySectionSchema = z23.object({
|
|
2949
2977
|
/** ISO8601 inclusive lower bound of the report window (default: 7 days). */
|
|
2950
|
-
windowStart:
|
|
2978
|
+
windowStart: z23.string(),
|
|
2951
2979
|
/** ISO8601 inclusive upper bound. */
|
|
2952
|
-
windowEnd:
|
|
2953
|
-
hasData:
|
|
2980
|
+
windowEnd: z23.string(),
|
|
2981
|
+
hasData: z23.boolean(),
|
|
2954
2982
|
/** Last-7d total verified crawler hits, with prior 7d for delta. */
|
|
2955
|
-
verifiedCrawlerHits:
|
|
2983
|
+
verifiedCrawlerHits: z23.object({ current: z23.number(), prior: z23.number(), deltaPct: z23.number().nullable() }),
|
|
2956
2984
|
/** Last-7d total unverified crawler hits, separated from verified trust metrics. */
|
|
2957
|
-
unverifiedCrawlerHits:
|
|
2985
|
+
unverifiedCrawlerHits: z23.object({ current: z23.number(), prior: z23.number(), deltaPct: z23.number().nullable() }),
|
|
2958
2986
|
/**
|
|
2959
2987
|
* Last-7d on-demand per-user fetches from AI surfaces (ChatGPT-User,
|
|
2960
2988
|
* Perplexity-User, MistralAI-User). Disjoint from `verifiedCrawlerHits` /
|
|
@@ -2963,19 +2991,19 @@ var serverActivitySectionSchema = z22.object({
|
|
|
2963
2991
|
* because the operational question for user-fetch is "is this happening?"
|
|
2964
2992
|
* not "is this a confirmed bot identity?"
|
|
2965
2993
|
*/
|
|
2966
|
-
aiUserFetchHits:
|
|
2994
|
+
aiUserFetchHits: z23.object({ current: z23.number(), prior: z23.number(), deltaPct: z23.number().nullable() }),
|
|
2967
2995
|
/** Last-7d AI-referral sessions (sessionized from server-side request evidence). */
|
|
2968
|
-
referralArrivals:
|
|
2996
|
+
referralArrivals: z23.object({ current: z23.number(), prior: z23.number(), deltaPct: z23.number().nullable() }),
|
|
2969
2997
|
/** Per-AI-operator breakdown (OpenAI, Anthropic, Google AI, Perplexity, …). */
|
|
2970
|
-
byOperator:
|
|
2971
|
-
operator:
|
|
2972
|
-
verifiedHits:
|
|
2998
|
+
byOperator: z23.array(z23.object({
|
|
2999
|
+
operator: z23.string(),
|
|
3000
|
+
verifiedHits: z23.number(),
|
|
2973
3001
|
/** Shown to agency audience only: claimed-bot UA, source IP not in a published range. */
|
|
2974
|
-
unverifiedHits:
|
|
3002
|
+
unverifiedHits: z23.number(),
|
|
2975
3003
|
/** Per-user fetches from this operator's AI surface (ChatGPT-User, …). */
|
|
2976
|
-
userFetchHits:
|
|
2977
|
-
referralArrivals:
|
|
2978
|
-
deltaPct:
|
|
3004
|
+
userFetchHits: z23.number(),
|
|
3005
|
+
referralArrivals: z23.number(),
|
|
3006
|
+
deltaPct: z23.number().nullable()
|
|
2979
3007
|
})),
|
|
2980
3008
|
/**
|
|
2981
3009
|
* Top crawled paths (verified only, last-7d). Path-level citation cross-reference
|
|
@@ -2985,84 +3013,84 @@ var serverActivitySectionSchema = z22.object({
|
|
|
2985
3013
|
* citation evidence can extend this entry with a `citationState` field without
|
|
2986
3014
|
* breaking the contract.
|
|
2987
3015
|
*/
|
|
2988
|
-
topCrawledPaths:
|
|
2989
|
-
path:
|
|
2990
|
-
verifiedHits:
|
|
3016
|
+
topCrawledPaths: z23.array(z23.object({
|
|
3017
|
+
path: z23.string(),
|
|
3018
|
+
verifiedHits: z23.number(),
|
|
2991
3019
|
/** How many distinct AI operators crawled this path in the window. */
|
|
2992
|
-
distinctOperators:
|
|
3020
|
+
distinctOperators: z23.number()
|
|
2993
3021
|
})),
|
|
2994
3022
|
/** AI products that sent ≥1 session in the window (referral by destination). */
|
|
2995
|
-
referralProducts:
|
|
2996
|
-
product:
|
|
2997
|
-
arrivals:
|
|
2998
|
-
distinctLandingPaths:
|
|
3023
|
+
referralProducts: z23.array(z23.object({
|
|
3024
|
+
product: z23.string(),
|
|
3025
|
+
arrivals: z23.number(),
|
|
3026
|
+
distinctLandingPaths: z23.number()
|
|
2999
3027
|
})),
|
|
3000
3028
|
/** Daily trend, last 14d for sparkline / chart rendering. */
|
|
3001
|
-
dailyTrend:
|
|
3002
|
-
date:
|
|
3003
|
-
verifiedCrawlerHits:
|
|
3004
|
-
userFetchHits:
|
|
3005
|
-
referralArrivals:
|
|
3029
|
+
dailyTrend: z23.array(z23.object({
|
|
3030
|
+
date: z23.string(),
|
|
3031
|
+
verifiedCrawlerHits: z23.number(),
|
|
3032
|
+
userFetchHits: z23.number(),
|
|
3033
|
+
referralArrivals: z23.number()
|
|
3006
3034
|
})),
|
|
3007
3035
|
/**
|
|
3008
3036
|
* Top landing paths for AI-referral sessions (last-7d).
|
|
3009
3037
|
* Complements `topCrawledPaths` (what bots fetch) with what humans actually land on.
|
|
3010
3038
|
*/
|
|
3011
|
-
topReferralLandingPaths:
|
|
3012
|
-
path:
|
|
3013
|
-
arrivals:
|
|
3014
|
-
distinctProducts:
|
|
3039
|
+
topReferralLandingPaths: z23.array(z23.object({
|
|
3040
|
+
path: z23.string(),
|
|
3041
|
+
arrivals: z23.number(),
|
|
3042
|
+
distinctProducts: z23.number()
|
|
3015
3043
|
}))
|
|
3016
3044
|
});
|
|
3017
|
-
var indexingHealthSectionSchema =
|
|
3045
|
+
var indexingHealthSectionSchema = z23.object({
|
|
3018
3046
|
/** Source: 'google' | 'bing' | null when neither is connected. */
|
|
3019
|
-
provider:
|
|
3020
|
-
total:
|
|
3021
|
-
indexed:
|
|
3022
|
-
notIndexed:
|
|
3047
|
+
provider: z23.enum(["google", "bing"]).nullable(),
|
|
3048
|
+
total: z23.number(),
|
|
3049
|
+
indexed: z23.number(),
|
|
3050
|
+
notIndexed: z23.number(),
|
|
3023
3051
|
/** Google-only — pages explicitly marked as deindexed. Bing reports 'unknown' instead. */
|
|
3024
|
-
deindexed:
|
|
3052
|
+
deindexed: z23.number(),
|
|
3025
3053
|
/** Bing-only — pages with no inspection data yet. */
|
|
3026
|
-
unknown:
|
|
3054
|
+
unknown: z23.number(),
|
|
3027
3055
|
/** 0..100. */
|
|
3028
|
-
indexedPct:
|
|
3056
|
+
indexedPct: z23.number()
|
|
3029
3057
|
});
|
|
3030
|
-
var citationsTrendPointSchema =
|
|
3058
|
+
var citationsTrendPointSchema = z23.object({
|
|
3031
3059
|
/** Run ID — anchor for cross-section linking. */
|
|
3032
|
-
runId:
|
|
3060
|
+
runId: z23.string(),
|
|
3033
3061
|
/** ISO timestamp when the run finished (or createdAt fallback). */
|
|
3034
|
-
date:
|
|
3062
|
+
date: z23.string(),
|
|
3035
3063
|
/**
|
|
3036
3064
|
* 0..100 — same per-query unique-cited definition as
|
|
3037
3065
|
* `ReportExecutiveSummary.citationRate`. Stable across runs with different
|
|
3038
3066
|
* provider counts so the trend line measures real movement rather than
|
|
3039
3067
|
* provider-count variance.
|
|
3040
3068
|
*/
|
|
3041
|
-
citationRate:
|
|
3069
|
+
citationRate: z23.number(),
|
|
3042
3070
|
/** Numerator of `citationRate` for this run. */
|
|
3043
|
-
citedQueryCount:
|
|
3071
|
+
citedQueryCount: z23.number(),
|
|
3044
3072
|
/** Denominator of `citationRate` for this run. */
|
|
3045
|
-
totalQueryCount:
|
|
3073
|
+
totalQueryCount: z23.number(),
|
|
3046
3074
|
/** 0..100 — same per-query unique-mentioned definition as `ReportExecutiveSummary.mentionRate`. */
|
|
3047
|
-
mentionRate:
|
|
3075
|
+
mentionRate: z23.number(),
|
|
3048
3076
|
/** Numerator of `mentionRate` for this run. */
|
|
3049
|
-
mentionedQueryCount:
|
|
3077
|
+
mentionedQueryCount: z23.number(),
|
|
3050
3078
|
/**
|
|
3051
3079
|
* Per-provider rates for the same run. Each provider's rate is per-pair
|
|
3052
3080
|
* within that provider (`cited / scanned`), so it remains comparable
|
|
3053
3081
|
* between providers in the same run.
|
|
3054
3082
|
*/
|
|
3055
|
-
providerRates:
|
|
3056
|
-
});
|
|
3057
|
-
var reportInsightSchema =
|
|
3058
|
-
id:
|
|
3059
|
-
type:
|
|
3060
|
-
severity:
|
|
3061
|
-
title:
|
|
3062
|
-
query:
|
|
3063
|
-
provider:
|
|
3064
|
-
recommendation:
|
|
3065
|
-
createdAt:
|
|
3083
|
+
providerRates: z23.array(z23.object({ provider: z23.string(), citationRate: z23.number() }))
|
|
3084
|
+
});
|
|
3085
|
+
var reportInsightSchema = z23.object({
|
|
3086
|
+
id: z23.string(),
|
|
3087
|
+
type: z23.enum(["regression", "gain", "opportunity"]),
|
|
3088
|
+
severity: z23.enum(["critical", "high", "medium", "low"]),
|
|
3089
|
+
title: z23.string(),
|
|
3090
|
+
query: z23.string(),
|
|
3091
|
+
provider: z23.string(),
|
|
3092
|
+
recommendation: z23.string().nullable(),
|
|
3093
|
+
createdAt: z23.string(),
|
|
3066
3094
|
/**
|
|
3067
3095
|
* How many times this insight fired across recent runs for the same
|
|
3068
3096
|
* `(query, provider, type)` tuple. Always ≥ 1. Insights returned by the
|
|
@@ -3070,57 +3098,57 @@ var reportInsightSchema = z22.object({
|
|
|
3070
3098
|
* surfacing the multiplicity. Use it directly instead of grouping again
|
|
3071
3099
|
* client-side — counts derived from raw insight rows will overcount.
|
|
3072
3100
|
*/
|
|
3073
|
-
instanceCount:
|
|
3101
|
+
instanceCount: z23.number()
|
|
3074
3102
|
});
|
|
3075
|
-
var recommendedNextStepSchema =
|
|
3103
|
+
var recommendedNextStepSchema = z23.object({
|
|
3076
3104
|
/** 'immediate' | 'short-term' | 'medium-term' — bucketed by severity heuristic. */
|
|
3077
|
-
horizon:
|
|
3078
|
-
title:
|
|
3079
|
-
rationale:
|
|
3105
|
+
horizon: z23.enum(["immediate", "short-term", "medium-term"]),
|
|
3106
|
+
title: z23.string(),
|
|
3107
|
+
rationale: z23.string()
|
|
3080
3108
|
});
|
|
3081
|
-
var reportRateDeltaSchema =
|
|
3109
|
+
var reportRateDeltaSchema = z23.object({
|
|
3082
3110
|
/** Current value (0..100 for rates, raw count otherwise). When `window`
|
|
3083
3111
|
* is present this is the average over the last `window` checks. */
|
|
3084
|
-
current:
|
|
3112
|
+
current: z23.number(),
|
|
3085
3113
|
/** Prior value compared against. When `window` is present this is the
|
|
3086
3114
|
* average over the prior `window` checks before that. */
|
|
3087
|
-
prior:
|
|
3115
|
+
prior: z23.number(),
|
|
3088
3116
|
/** Absolute delta (current − prior). Negative = decrease. */
|
|
3089
|
-
deltaAbs:
|
|
3117
|
+
deltaAbs: z23.number(),
|
|
3090
3118
|
/**
|
|
3091
3119
|
* Direction tag for tone mapping. Threshold is metric-specific (3pp for
|
|
3092
3120
|
* rates, 0.5 for counts) so small noise lands as 'flat' rather than
|
|
3093
3121
|
* flipping up/down each run.
|
|
3094
3122
|
*/
|
|
3095
|
-
direction:
|
|
3123
|
+
direction: z23.enum(["up", "down", "flat"]),
|
|
3096
3124
|
/**
|
|
3097
3125
|
* How many points went into each side of the average. Omitted (or 1)
|
|
3098
3126
|
* means point-to-point (legacy "since last check"). Higher values mean
|
|
3099
3127
|
* a rolling-average comparison — renderers should label it as
|
|
3100
3128
|
* "vs prior N checks" when this is ≥ 2.
|
|
3101
3129
|
*/
|
|
3102
|
-
window:
|
|
3130
|
+
window: z23.number().optional()
|
|
3103
3131
|
});
|
|
3104
|
-
var reportProviderMovementSchema =
|
|
3105
|
-
provider:
|
|
3106
|
-
current:
|
|
3107
|
-
prior:
|
|
3108
|
-
deltaAbs:
|
|
3109
|
-
direction:
|
|
3132
|
+
var reportProviderMovementSchema = z23.object({
|
|
3133
|
+
provider: z23.string(),
|
|
3134
|
+
current: z23.number(),
|
|
3135
|
+
prior: z23.number(),
|
|
3136
|
+
deltaAbs: z23.number(),
|
|
3137
|
+
direction: z23.enum(["up", "down", "flat"])
|
|
3110
3138
|
});
|
|
3111
|
-
var whatsChangedSectionSchema =
|
|
3139
|
+
var whatsChangedSectionSchema = z23.object({
|
|
3112
3140
|
/**
|
|
3113
3141
|
* False when there's no prior run (or fewer than the trend baseline),
|
|
3114
3142
|
* meaning all per-metric deltas will be null. Renderers use this to swap
|
|
3115
3143
|
* in a "establishing baseline" fallback rather than rendering empty
|
|
3116
3144
|
* delta tiles.
|
|
3117
3145
|
*/
|
|
3118
|
-
enoughHistory:
|
|
3146
|
+
enoughHistory: z23.boolean(),
|
|
3119
3147
|
/**
|
|
3120
3148
|
* One-sentence narrative summary suitable as a section subtitle.
|
|
3121
3149
|
* Always present — even on baseline, narrates whatever signal exists.
|
|
3122
3150
|
*/
|
|
3123
|
-
headline:
|
|
3151
|
+
headline: z23.string(),
|
|
3124
3152
|
/** Citation rate delta vs the prior completed run. Null when no prior run. */
|
|
3125
3153
|
citationRate: reportRateDeltaSchema.nullable(),
|
|
3126
3154
|
/** Mention rate delta vs the prior completed run. Null when no prior run. */
|
|
@@ -3143,24 +3171,24 @@ var whatsChangedSectionSchema = z22.object({
|
|
|
3143
3171
|
* when no prior run. Sorted by |deltaAbs| desc — providers with the
|
|
3144
3172
|
* biggest swing first.
|
|
3145
3173
|
*/
|
|
3146
|
-
providerMovements:
|
|
3174
|
+
providerMovements: z23.array(reportProviderMovementSchema),
|
|
3147
3175
|
/**
|
|
3148
3176
|
* Top wins this period — gains surfaced by the intelligence engine.
|
|
3149
3177
|
* Capped at 5; sourced from `insights` filtered to `type: 'gain'`.
|
|
3150
3178
|
*/
|
|
3151
|
-
wins:
|
|
3179
|
+
wins: z23.array(reportInsightSchema),
|
|
3152
3180
|
/**
|
|
3153
3181
|
* Top regressions this period — citations or mentions lost. Capped at 5;
|
|
3154
3182
|
* sourced from `insights` filtered to `type: 'regression'`.
|
|
3155
3183
|
*/
|
|
3156
|
-
regressions:
|
|
3157
|
-
});
|
|
3158
|
-
var reportAudienceSchema =
|
|
3159
|
-
var reportActionAudienceSchema =
|
|
3160
|
-
var reportActionHorizonSchema =
|
|
3161
|
-
var reportActionConfidenceSchema =
|
|
3162
|
-
var reportToneSchema =
|
|
3163
|
-
var reportActionCategorySchema =
|
|
3184
|
+
regressions: z23.array(reportInsightSchema)
|
|
3185
|
+
});
|
|
3186
|
+
var reportAudienceSchema = z23.enum(["agency", "client"]);
|
|
3187
|
+
var reportActionAudienceSchema = z23.enum(["agency", "client", "both"]);
|
|
3188
|
+
var reportActionHorizonSchema = z23.enum(["immediate", "short-term", "medium-term"]);
|
|
3189
|
+
var reportActionConfidenceSchema = z23.enum(["high", "medium", "low"]);
|
|
3190
|
+
var reportToneSchema = z23.enum(["positive", "caution", "negative", "neutral"]);
|
|
3191
|
+
var reportActionCategorySchema = z23.enum([
|
|
3164
3192
|
"content",
|
|
3165
3193
|
"competitors",
|
|
3166
3194
|
"provider",
|
|
@@ -3169,23 +3197,23 @@ var reportActionCategorySchema = z22.enum([
|
|
|
3169
3197
|
"location",
|
|
3170
3198
|
"monitoring"
|
|
3171
3199
|
]);
|
|
3172
|
-
var reportActionPlanItemSchema =
|
|
3200
|
+
var reportActionPlanItemSchema = z23.object({
|
|
3173
3201
|
/** Which report audience should see this action. `both` renders in both modes. */
|
|
3174
3202
|
audience: reportActionAudienceSchema,
|
|
3175
3203
|
/** Stable sort priority. Lower numbers render earlier. */
|
|
3176
|
-
priority:
|
|
3204
|
+
priority: z23.number(),
|
|
3177
3205
|
/** When this should be tackled. */
|
|
3178
3206
|
horizon: reportActionHorizonSchema,
|
|
3179
3207
|
category: reportActionCategorySchema,
|
|
3180
|
-
title:
|
|
3208
|
+
title: z23.string(),
|
|
3181
3209
|
/** Direct next step written as an operator/client-friendly imperative. */
|
|
3182
|
-
action:
|
|
3210
|
+
action: z23.string(),
|
|
3183
3211
|
/** Why this matters. Keep each entry concise and evidence-backed. */
|
|
3184
|
-
why:
|
|
3212
|
+
why: z23.array(z23.string()),
|
|
3185
3213
|
/** Specific observations that justify the action. */
|
|
3186
|
-
evidence:
|
|
3214
|
+
evidence: z23.array(z23.string()),
|
|
3187
3215
|
/** What should move if the action worked. */
|
|
3188
|
-
successMetric:
|
|
3216
|
+
successMetric: z23.string(),
|
|
3189
3217
|
/** Confidence in the recommendation based on the available evidence. */
|
|
3190
3218
|
confidence: reportActionConfidenceSchema,
|
|
3191
3219
|
/**
|
|
@@ -3197,23 +3225,23 @@ var reportActionPlanItemSchema = z22.object({
|
|
|
3197
3225
|
* load. Actions sourced from other signals (competitor gaps, indexing
|
|
3198
3226
|
* issues, etc.) omit this and use their own dismiss flows.
|
|
3199
3227
|
*/
|
|
3200
|
-
targetRef:
|
|
3228
|
+
targetRef: z23.string().optional()
|
|
3201
3229
|
});
|
|
3202
|
-
var reportClientSummarySchema =
|
|
3203
|
-
headline:
|
|
3204
|
-
overview:
|
|
3205
|
-
actionItems:
|
|
3206
|
-
confidenceNotes:
|
|
3230
|
+
var reportClientSummarySchema = z23.object({
|
|
3231
|
+
headline: z23.string(),
|
|
3232
|
+
overview: z23.string(),
|
|
3233
|
+
actionItems: z23.array(reportActionPlanItemSchema),
|
|
3234
|
+
confidenceNotes: z23.array(z23.string())
|
|
3207
3235
|
});
|
|
3208
|
-
var reportAgencyDiagnosticSchema =
|
|
3209
|
-
title:
|
|
3210
|
-
detail:
|
|
3211
|
-
severity:
|
|
3212
|
-
evidence:
|
|
3236
|
+
var reportAgencyDiagnosticSchema = z23.object({
|
|
3237
|
+
title: z23.string(),
|
|
3238
|
+
detail: z23.string(),
|
|
3239
|
+
severity: z23.enum(["positive", "caution", "negative", "neutral"]),
|
|
3240
|
+
evidence: z23.array(z23.string())
|
|
3213
3241
|
});
|
|
3214
|
-
var reportAgencyDiagnosticsSchema =
|
|
3215
|
-
priorities:
|
|
3216
|
-
diagnostics:
|
|
3242
|
+
var reportAgencyDiagnosticsSchema = z23.object({
|
|
3243
|
+
priorities: z23.array(reportActionPlanItemSchema),
|
|
3244
|
+
diagnostics: z23.array(reportAgencyDiagnosticSchema)
|
|
3217
3245
|
});
|
|
3218
3246
|
function reportActionTone(action) {
|
|
3219
3247
|
if (action.horizon === "immediate") return "negative";
|
|
@@ -3271,7 +3299,7 @@ function reportConfidenceLabel(confidence) {
|
|
|
3271
3299
|
return "Low";
|
|
3272
3300
|
}
|
|
3273
3301
|
}
|
|
3274
|
-
var projectReportDtoSchema =
|
|
3302
|
+
var projectReportDtoSchema = z23.object({
|
|
3275
3303
|
meta: reportMetaSchema,
|
|
3276
3304
|
executiveSummary: reportExecutiveSummarySchema,
|
|
3277
3305
|
citationScorecard: citationScorecardSchema,
|
|
@@ -3285,16 +3313,16 @@ var projectReportDtoSchema = z22.object({
|
|
|
3285
3313
|
/** Server-side log-evidence visibility (crawls + click-through sessions). Null when no traffic source connected. */
|
|
3286
3314
|
serverActivity: serverActivitySectionSchema.nullable(),
|
|
3287
3315
|
indexingHealth: indexingHealthSectionSchema.nullable(),
|
|
3288
|
-
citationsTrend:
|
|
3316
|
+
citationsTrend: z23.array(citationsTrendPointSchema),
|
|
3289
3317
|
/**
|
|
3290
3318
|
* Trend-focused "what's changed" summary for the report's act 2. Always
|
|
3291
3319
|
* present; renderers gate empty/baseline states via `enoughHistory`.
|
|
3292
3320
|
*/
|
|
3293
3321
|
whatsChanged: whatsChangedSectionSchema,
|
|
3294
|
-
insights:
|
|
3295
|
-
recommendedNextSteps:
|
|
3322
|
+
insights: z23.array(reportInsightSchema),
|
|
3323
|
+
recommendedNextSteps: z23.array(recommendedNextStepSchema),
|
|
3296
3324
|
/** Canonical structured actions shared by the client and agency render modes. */
|
|
3297
|
-
actionPlan:
|
|
3325
|
+
actionPlan: z23.array(reportActionPlanItemSchema),
|
|
3298
3326
|
/** Polished client-facing summary and action shortlist. */
|
|
3299
3327
|
clientSummary: reportClientSummarySchema,
|
|
3300
3328
|
/** Technical, evidence-oriented operator diagnostics for agency mode. */
|
|
@@ -3304,17 +3332,17 @@ var projectReportDtoSchema = z22.object({
|
|
|
3304
3332
|
* intelligence layer (`buildContentTargetRows`). Empty when no run has
|
|
3305
3333
|
* produced candidate queries with demand or competitor signal.
|
|
3306
3334
|
*/
|
|
3307
|
-
contentOpportunities:
|
|
3335
|
+
contentOpportunities: z23.array(contentTargetRowDtoSchema),
|
|
3308
3336
|
/**
|
|
3309
3337
|
* Queries where competitors were cited but the project was not. Sourced
|
|
3310
3338
|
* from `buildContentGapRows`. Empty until the first answer-visibility run.
|
|
3311
3339
|
*/
|
|
3312
|
-
contentGaps:
|
|
3340
|
+
contentGaps: z23.array(contentGapRowDtoSchema),
|
|
3313
3341
|
/**
|
|
3314
3342
|
* Per-query grounding source map (own + competitor cited URLs). Sourced
|
|
3315
3343
|
* from `buildContentSourceRows`. Empty until the first answer-visibility run.
|
|
3316
3344
|
*/
|
|
3317
|
-
groundingSources:
|
|
3345
|
+
groundingSources: z23.array(contentSourceRowDtoSchema)
|
|
3318
3346
|
});
|
|
3319
3347
|
|
|
3320
3348
|
// ../contracts/src/report-dedup.ts
|
|
@@ -3385,10 +3413,10 @@ function dedupeReportOpportunities(report) {
|
|
|
3385
3413
|
}
|
|
3386
3414
|
|
|
3387
3415
|
// ../contracts/src/skills.ts
|
|
3388
|
-
import { z as
|
|
3389
|
-
var codingAgentSchema =
|
|
3416
|
+
import { z as z24 } from "zod";
|
|
3417
|
+
var codingAgentSchema = z24.enum(["claude", "codex"]);
|
|
3390
3418
|
var CodingAgents = codingAgentSchema.enum;
|
|
3391
|
-
var skillsClientSchema =
|
|
3419
|
+
var skillsClientSchema = z24.enum(["claude", "codex", "all"]);
|
|
3392
3420
|
var SkillsClients = skillsClientSchema.enum;
|
|
3393
3421
|
var SKILL_MANIFEST_FILENAME = ".canonry-skill-manifest.json";
|
|
3394
3422
|
function classifySkillFile(params) {
|
|
@@ -3406,8 +3434,8 @@ function coerceSkillManifest(parsed) {
|
|
|
3406
3434
|
}
|
|
3407
3435
|
|
|
3408
3436
|
// ../contracts/src/traffic.ts
|
|
3409
|
-
import { z as
|
|
3410
|
-
var trafficSourceTypeSchema =
|
|
3437
|
+
import { z as z25 } from "zod";
|
|
3438
|
+
var trafficSourceTypeSchema = z25.enum([
|
|
3411
3439
|
"cloud-run",
|
|
3412
3440
|
"wordpress",
|
|
3413
3441
|
"cloudflare",
|
|
@@ -3415,7 +3443,7 @@ var trafficSourceTypeSchema = z24.enum([
|
|
|
3415
3443
|
"generic-log"
|
|
3416
3444
|
]);
|
|
3417
3445
|
var TrafficSourceTypes = trafficSourceTypeSchema.enum;
|
|
3418
|
-
var trafficAdapterCapabilitySchema =
|
|
3446
|
+
var trafficAdapterCapabilitySchema = z25.enum([
|
|
3419
3447
|
"raw-request-events",
|
|
3420
3448
|
"aggregate-request-metrics",
|
|
3421
3449
|
"request-url",
|
|
@@ -3426,219 +3454,219 @@ var trafficAdapterCapabilitySchema = z24.enum([
|
|
|
3426
3454
|
"cursor-pull"
|
|
3427
3455
|
]);
|
|
3428
3456
|
var TrafficAdapterCapabilities = trafficAdapterCapabilitySchema.enum;
|
|
3429
|
-
var trafficEvidenceKindSchema =
|
|
3457
|
+
var trafficEvidenceKindSchema = z25.enum(["raw-request", "aggregate-bucket"]);
|
|
3430
3458
|
var TrafficEvidenceKinds = trafficEvidenceKindSchema.enum;
|
|
3431
|
-
var trafficEventConfidenceSchema =
|
|
3459
|
+
var trafficEventConfidenceSchema = z25.enum(["observed", "provider-aggregated", "inferred"]);
|
|
3432
3460
|
var TrafficEventConfidences = trafficEventConfidenceSchema.enum;
|
|
3433
|
-
var trafficProviderResourceSchema =
|
|
3434
|
-
type:
|
|
3435
|
-
labels:
|
|
3461
|
+
var trafficProviderResourceSchema = z25.object({
|
|
3462
|
+
type: z25.string().nullable(),
|
|
3463
|
+
labels: z25.record(z25.string(), z25.string())
|
|
3436
3464
|
});
|
|
3437
|
-
var normalizedTrafficRequestSchema =
|
|
3465
|
+
var normalizedTrafficRequestSchema = z25.object({
|
|
3438
3466
|
sourceType: trafficSourceTypeSchema,
|
|
3439
|
-
evidenceKind:
|
|
3440
|
-
confidence:
|
|
3441
|
-
eventId:
|
|
3442
|
-
observedAt:
|
|
3443
|
-
method:
|
|
3444
|
-
requestUrl:
|
|
3445
|
-
host:
|
|
3446
|
-
path:
|
|
3447
|
-
queryString:
|
|
3448
|
-
status:
|
|
3449
|
-
userAgent:
|
|
3450
|
-
remoteIp:
|
|
3451
|
-
referer:
|
|
3452
|
-
latencyMs:
|
|
3453
|
-
requestSizeBytes:
|
|
3454
|
-
responseSizeBytes:
|
|
3467
|
+
evidenceKind: z25.literal(TrafficEvidenceKinds["raw-request"]),
|
|
3468
|
+
confidence: z25.literal(TrafficEventConfidences.observed),
|
|
3469
|
+
eventId: z25.string().min(1),
|
|
3470
|
+
observedAt: z25.string().min(1),
|
|
3471
|
+
method: z25.string().nullable(),
|
|
3472
|
+
requestUrl: z25.string().nullable(),
|
|
3473
|
+
host: z25.string().nullable(),
|
|
3474
|
+
path: z25.string().min(1),
|
|
3475
|
+
queryString: z25.string().nullable(),
|
|
3476
|
+
status: z25.number().int().nullable(),
|
|
3477
|
+
userAgent: z25.string().nullable(),
|
|
3478
|
+
remoteIp: z25.string().nullable(),
|
|
3479
|
+
referer: z25.string().nullable(),
|
|
3480
|
+
latencyMs: z25.number().nullable(),
|
|
3481
|
+
requestSizeBytes: z25.number().int().nullable(),
|
|
3482
|
+
responseSizeBytes: z25.number().int().nullable(),
|
|
3455
3483
|
providerResource: trafficProviderResourceSchema,
|
|
3456
|
-
providerLabels:
|
|
3484
|
+
providerLabels: z25.record(z25.string(), z25.string())
|
|
3457
3485
|
});
|
|
3458
|
-
var normalizedTrafficPullPageSchema =
|
|
3459
|
-
events:
|
|
3460
|
-
rawEntryCount:
|
|
3461
|
-
skippedEntryCount:
|
|
3462
|
-
nextPageToken:
|
|
3463
|
-
filter:
|
|
3486
|
+
var normalizedTrafficPullPageSchema = z25.object({
|
|
3487
|
+
events: z25.array(normalizedTrafficRequestSchema),
|
|
3488
|
+
rawEntryCount: z25.number().int().nonnegative(),
|
|
3489
|
+
skippedEntryCount: z25.number().int().nonnegative(),
|
|
3490
|
+
nextPageToken: z25.string().optional(),
|
|
3491
|
+
filter: z25.string()
|
|
3464
3492
|
});
|
|
3465
|
-
var trafficSourceStatusSchema =
|
|
3493
|
+
var trafficSourceStatusSchema = z25.enum(["connected", "paused", "error", "archived"]);
|
|
3466
3494
|
var TrafficSourceStatuses = trafficSourceStatusSchema.enum;
|
|
3467
|
-
var trafficSourceAuthModeSchema =
|
|
3495
|
+
var trafficSourceAuthModeSchema = z25.enum(["oauth", "service-account"]);
|
|
3468
3496
|
var TrafficSourceAuthModes = trafficSourceAuthModeSchema.enum;
|
|
3469
|
-
var verificationStatusSchema =
|
|
3497
|
+
var verificationStatusSchema = z25.enum(["verified", "claimed_unverified", "unknown_ai_like"]);
|
|
3470
3498
|
var VerificationStatuses = verificationStatusSchema.enum;
|
|
3471
|
-
var cloudRunSourceConfigSchema =
|
|
3472
|
-
gcpProjectId:
|
|
3473
|
-
serviceName:
|
|
3474
|
-
location:
|
|
3499
|
+
var cloudRunSourceConfigSchema = z25.object({
|
|
3500
|
+
gcpProjectId: z25.string().min(1),
|
|
3501
|
+
serviceName: z25.string().nullable().optional(),
|
|
3502
|
+
location: z25.string().nullable().optional(),
|
|
3475
3503
|
authMode: trafficSourceAuthModeSchema
|
|
3476
3504
|
});
|
|
3477
|
-
var wordpressTrafficSourceConfigSchema =
|
|
3478
|
-
baseUrl:
|
|
3479
|
-
username:
|
|
3505
|
+
var wordpressTrafficSourceConfigSchema = z25.object({
|
|
3506
|
+
baseUrl: z25.string().url(),
|
|
3507
|
+
username: z25.string().min(1)
|
|
3480
3508
|
});
|
|
3481
|
-
var vercelTrafficEnvironmentSchema =
|
|
3509
|
+
var vercelTrafficEnvironmentSchema = z25.enum(["production", "preview"]);
|
|
3482
3510
|
var VercelTrafficEnvironments = vercelTrafficEnvironmentSchema.enum;
|
|
3483
|
-
var vercelTrafficSourceConfigSchema =
|
|
3511
|
+
var vercelTrafficSourceConfigSchema = z25.object({
|
|
3484
3512
|
/** Vercel project id (e.g. `prj_...`). */
|
|
3485
|
-
projectId:
|
|
3513
|
+
projectId: z25.string().min(1),
|
|
3486
3514
|
/** Vercel team or account id: the org that owns the project. */
|
|
3487
|
-
teamId:
|
|
3515
|
+
teamId: z25.string().min(1),
|
|
3488
3516
|
environment: vercelTrafficEnvironmentSchema
|
|
3489
3517
|
});
|
|
3490
|
-
var trafficSourceDtoSchema =
|
|
3491
|
-
id:
|
|
3492
|
-
projectId:
|
|
3518
|
+
var trafficSourceDtoSchema = z25.object({
|
|
3519
|
+
id: z25.string(),
|
|
3520
|
+
projectId: z25.string(),
|
|
3493
3521
|
sourceType: trafficSourceTypeSchema,
|
|
3494
|
-
displayName:
|
|
3522
|
+
displayName: z25.string(),
|
|
3495
3523
|
status: trafficSourceStatusSchema,
|
|
3496
|
-
lastSyncedAt:
|
|
3497
|
-
lastCursor:
|
|
3498
|
-
lastError:
|
|
3499
|
-
archivedAt:
|
|
3500
|
-
config:
|
|
3501
|
-
createdAt:
|
|
3502
|
-
updatedAt:
|
|
3503
|
-
});
|
|
3504
|
-
var trafficConnectCloudRunRequestSchema =
|
|
3505
|
-
gcpProjectId:
|
|
3506
|
-
serviceName:
|
|
3507
|
-
location:
|
|
3508
|
-
displayName:
|
|
3524
|
+
lastSyncedAt: z25.string().nullable(),
|
|
3525
|
+
lastCursor: z25.string().nullable(),
|
|
3526
|
+
lastError: z25.string().nullable(),
|
|
3527
|
+
archivedAt: z25.string().nullable(),
|
|
3528
|
+
config: z25.record(z25.string(), z25.unknown()),
|
|
3529
|
+
createdAt: z25.string(),
|
|
3530
|
+
updatedAt: z25.string()
|
|
3531
|
+
});
|
|
3532
|
+
var trafficConnectCloudRunRequestSchema = z25.object({
|
|
3533
|
+
gcpProjectId: z25.string().min(1),
|
|
3534
|
+
serviceName: z25.string().min(1).optional(),
|
|
3535
|
+
location: z25.string().min(1).optional(),
|
|
3536
|
+
displayName: z25.string().min(1).optional(),
|
|
3509
3537
|
/** Service-account JSON content (string). When omitted, defaults to OAuth via `canonry google connect <project> --type ga4` flow. */
|
|
3510
|
-
keyJson:
|
|
3538
|
+
keyJson: z25.string().optional()
|
|
3511
3539
|
});
|
|
3512
|
-
var trafficConnectWordpressRequestSchema =
|
|
3513
|
-
baseUrl:
|
|
3514
|
-
username:
|
|
3540
|
+
var trafficConnectWordpressRequestSchema = z25.object({
|
|
3541
|
+
baseUrl: z25.string().url(),
|
|
3542
|
+
username: z25.string().min(1),
|
|
3515
3543
|
/** WordPress Application Password (the same auth used by the content client). */
|
|
3516
|
-
applicationPassword:
|
|
3517
|
-
displayName:
|
|
3544
|
+
applicationPassword: z25.string().min(1),
|
|
3545
|
+
displayName: z25.string().min(1).optional()
|
|
3518
3546
|
});
|
|
3519
|
-
var trafficConnectVercelRequestSchema =
|
|
3547
|
+
var trafficConnectVercelRequestSchema = z25.object({
|
|
3520
3548
|
/** Vercel project id (e.g. `prj_...`) — from the Vercel dashboard or `.vercel/project.json`. */
|
|
3521
|
-
projectId:
|
|
3549
|
+
projectId: z25.string().min(1),
|
|
3522
3550
|
/** Vercel team or account id: the org that owns the project ("orgId" in .vercel/project.json). */
|
|
3523
|
-
teamId:
|
|
3551
|
+
teamId: z25.string().min(1),
|
|
3524
3552
|
/** Vercel personal access token. Stored in `~/.canonry/config.yaml`, never the DB. */
|
|
3525
|
-
token:
|
|
3553
|
+
token: z25.string().min(1),
|
|
3526
3554
|
/** Which deployment environment's request logs to pull. Default: `production`. */
|
|
3527
3555
|
environment: vercelTrafficEnvironmentSchema.optional(),
|
|
3528
|
-
displayName:
|
|
3556
|
+
displayName: z25.string().min(1).optional()
|
|
3529
3557
|
});
|
|
3530
|
-
var trafficSyncResponseSchema =
|
|
3531
|
-
sourceId:
|
|
3532
|
-
runId:
|
|
3533
|
-
syncedAt:
|
|
3534
|
-
pulledEvents:
|
|
3558
|
+
var trafficSyncResponseSchema = z25.object({
|
|
3559
|
+
sourceId: z25.string(),
|
|
3560
|
+
runId: z25.string(),
|
|
3561
|
+
syncedAt: z25.string(),
|
|
3562
|
+
pulledEvents: z25.number().int().nonnegative(),
|
|
3535
3563
|
/** Self-traffic events (Canonry's own tooling) dropped before rollup. */
|
|
3536
|
-
selfTrafficExcluded:
|
|
3537
|
-
crawlerHits:
|
|
3538
|
-
aiUserFetchHits:
|
|
3539
|
-
aiReferralHits:
|
|
3540
|
-
unknownHits:
|
|
3541
|
-
crawlerBucketRows:
|
|
3542
|
-
aiUserFetchBucketRows:
|
|
3543
|
-
aiReferralBucketRows:
|
|
3544
|
-
sampleRows:
|
|
3545
|
-
windowStart:
|
|
3546
|
-
windowEnd:
|
|
3547
|
-
});
|
|
3548
|
-
var trafficBackfillRequestSchema =
|
|
3564
|
+
selfTrafficExcluded: z25.number().int().nonnegative(),
|
|
3565
|
+
crawlerHits: z25.number().int().nonnegative(),
|
|
3566
|
+
aiUserFetchHits: z25.number().int().nonnegative(),
|
|
3567
|
+
aiReferralHits: z25.number().int().nonnegative(),
|
|
3568
|
+
unknownHits: z25.number().int().nonnegative(),
|
|
3569
|
+
crawlerBucketRows: z25.number().int().nonnegative(),
|
|
3570
|
+
aiUserFetchBucketRows: z25.number().int().nonnegative(),
|
|
3571
|
+
aiReferralBucketRows: z25.number().int().nonnegative(),
|
|
3572
|
+
sampleRows: z25.number().int().nonnegative(),
|
|
3573
|
+
windowStart: z25.string(),
|
|
3574
|
+
windowEnd: z25.string()
|
|
3575
|
+
});
|
|
3576
|
+
var trafficBackfillRequestSchema = z25.object({
|
|
3549
3577
|
/** Lookback window in days. Capped server-side at the upstream log retention ceiling (Cloud Logging _Default = 30d). Default: 30. */
|
|
3550
|
-
days:
|
|
3578
|
+
days: z25.number().int().positive().optional()
|
|
3551
3579
|
});
|
|
3552
|
-
var trafficResetRequestSchema =
|
|
3553
|
-
advanceToNow:
|
|
3580
|
+
var trafficResetRequestSchema = z25.object({
|
|
3581
|
+
advanceToNow: z25.literal(true)
|
|
3554
3582
|
});
|
|
3555
|
-
var trafficBackfillResponseSchema =
|
|
3556
|
-
sourceId:
|
|
3557
|
-
runId:
|
|
3583
|
+
var trafficBackfillResponseSchema = z25.object({
|
|
3584
|
+
sourceId: z25.string(),
|
|
3585
|
+
runId: z25.string(),
|
|
3558
3586
|
status: runStatusSchema,
|
|
3559
|
-
windowStart:
|
|
3560
|
-
windowEnd:
|
|
3587
|
+
windowStart: z25.string(),
|
|
3588
|
+
windowEnd: z25.string(),
|
|
3561
3589
|
/** Days actually used after server-side clamping (≤ requested). */
|
|
3562
|
-
daysRequested:
|
|
3563
|
-
daysApplied:
|
|
3590
|
+
daysRequested: z25.number().int().positive(),
|
|
3591
|
+
daysApplied: z25.number().int().positive()
|
|
3564
3592
|
});
|
|
3565
|
-
var trafficSourceTotalsSchema =
|
|
3566
|
-
crawlerHits:
|
|
3567
|
-
aiUserFetchHits:
|
|
3568
|
-
aiReferralHits:
|
|
3569
|
-
sampleCount:
|
|
3593
|
+
var trafficSourceTotalsSchema = z25.object({
|
|
3594
|
+
crawlerHits: z25.number().int().nonnegative(),
|
|
3595
|
+
aiUserFetchHits: z25.number().int().nonnegative(),
|
|
3596
|
+
aiReferralHits: z25.number().int().nonnegative(),
|
|
3597
|
+
sampleCount: z25.number().int().nonnegative()
|
|
3570
3598
|
});
|
|
3571
|
-
var trafficSourceListResponseSchema =
|
|
3572
|
-
sources:
|
|
3599
|
+
var trafficSourceListResponseSchema = z25.object({
|
|
3600
|
+
sources: z25.array(trafficSourceDtoSchema)
|
|
3573
3601
|
});
|
|
3574
3602
|
var trafficSourceDetailDtoSchema = trafficSourceDtoSchema.extend({
|
|
3575
3603
|
totals24h: trafficSourceTotalsSchema,
|
|
3576
|
-
latestRun:
|
|
3577
|
-
runId:
|
|
3604
|
+
latestRun: z25.object({
|
|
3605
|
+
runId: z25.string(),
|
|
3578
3606
|
status: runStatusSchema,
|
|
3579
|
-
startedAt:
|
|
3580
|
-
finishedAt:
|
|
3581
|
-
error:
|
|
3607
|
+
startedAt: z25.string().nullable(),
|
|
3608
|
+
finishedAt: z25.string().nullable(),
|
|
3609
|
+
error: z25.string().nullable()
|
|
3582
3610
|
}).nullable()
|
|
3583
3611
|
});
|
|
3584
|
-
var trafficStatusResponseSchema =
|
|
3585
|
-
sources:
|
|
3612
|
+
var trafficStatusResponseSchema = z25.object({
|
|
3613
|
+
sources: z25.array(trafficSourceDetailDtoSchema)
|
|
3586
3614
|
});
|
|
3587
|
-
var trafficEventKindSchema =
|
|
3615
|
+
var trafficEventKindSchema = z25.enum(["crawler", "ai-user-fetch", "ai-referral"]);
|
|
3588
3616
|
var TrafficEventKinds = trafficEventKindSchema.enum;
|
|
3589
|
-
var trafficCrawlerEventEntrySchema =
|
|
3590
|
-
kind:
|
|
3591
|
-
sourceId:
|
|
3592
|
-
tsHour:
|
|
3593
|
-
botId:
|
|
3594
|
-
operator:
|
|
3595
|
-
verificationStatus:
|
|
3596
|
-
pathNormalized:
|
|
3597
|
-
status:
|
|
3598
|
-
hits:
|
|
3599
|
-
});
|
|
3600
|
-
var trafficAiUserFetchEventEntrySchema =
|
|
3601
|
-
kind:
|
|
3602
|
-
sourceId:
|
|
3603
|
-
tsHour:
|
|
3604
|
-
botId:
|
|
3605
|
-
operator:
|
|
3606
|
-
verificationStatus:
|
|
3607
|
-
pathNormalized:
|
|
3608
|
-
status:
|
|
3609
|
-
hits:
|
|
3610
|
-
});
|
|
3611
|
-
var trafficAiReferralEventEntrySchema =
|
|
3612
|
-
kind:
|
|
3613
|
-
sourceId:
|
|
3614
|
-
tsHour:
|
|
3615
|
-
product:
|
|
3616
|
-
operator:
|
|
3617
|
-
sourceDomain:
|
|
3618
|
-
evidenceType:
|
|
3619
|
-
landingPathNormalized:
|
|
3620
|
-
status:
|
|
3621
|
-
hits:
|
|
3622
|
-
});
|
|
3623
|
-
var trafficEventEntrySchema =
|
|
3617
|
+
var trafficCrawlerEventEntrySchema = z25.object({
|
|
3618
|
+
kind: z25.literal(TrafficEventKinds.crawler),
|
|
3619
|
+
sourceId: z25.string(),
|
|
3620
|
+
tsHour: z25.string(),
|
|
3621
|
+
botId: z25.string(),
|
|
3622
|
+
operator: z25.string(),
|
|
3623
|
+
verificationStatus: z25.string(),
|
|
3624
|
+
pathNormalized: z25.string(),
|
|
3625
|
+
status: z25.number().int(),
|
|
3626
|
+
hits: z25.number().int().nonnegative()
|
|
3627
|
+
});
|
|
3628
|
+
var trafficAiUserFetchEventEntrySchema = z25.object({
|
|
3629
|
+
kind: z25.literal(TrafficEventKinds["ai-user-fetch"]),
|
|
3630
|
+
sourceId: z25.string(),
|
|
3631
|
+
tsHour: z25.string(),
|
|
3632
|
+
botId: z25.string(),
|
|
3633
|
+
operator: z25.string(),
|
|
3634
|
+
verificationStatus: z25.string(),
|
|
3635
|
+
pathNormalized: z25.string(),
|
|
3636
|
+
status: z25.number().int(),
|
|
3637
|
+
hits: z25.number().int().nonnegative()
|
|
3638
|
+
});
|
|
3639
|
+
var trafficAiReferralEventEntrySchema = z25.object({
|
|
3640
|
+
kind: z25.literal(TrafficEventKinds["ai-referral"]),
|
|
3641
|
+
sourceId: z25.string(),
|
|
3642
|
+
tsHour: z25.string(),
|
|
3643
|
+
product: z25.string(),
|
|
3644
|
+
operator: z25.string(),
|
|
3645
|
+
sourceDomain: z25.string(),
|
|
3646
|
+
evidenceType: z25.string(),
|
|
3647
|
+
landingPathNormalized: z25.string(),
|
|
3648
|
+
status: z25.number().int(),
|
|
3649
|
+
hits: z25.number().int().nonnegative()
|
|
3650
|
+
});
|
|
3651
|
+
var trafficEventEntrySchema = z25.discriminatedUnion("kind", [
|
|
3624
3652
|
trafficCrawlerEventEntrySchema,
|
|
3625
3653
|
trafficAiUserFetchEventEntrySchema,
|
|
3626
3654
|
trafficAiReferralEventEntrySchema
|
|
3627
3655
|
]);
|
|
3628
|
-
var trafficEventsResponseSchema =
|
|
3629
|
-
windowStart:
|
|
3630
|
-
windowEnd:
|
|
3631
|
-
totals:
|
|
3632
|
-
crawlerHits:
|
|
3633
|
-
aiUserFetchHits:
|
|
3634
|
-
aiReferralHits:
|
|
3656
|
+
var trafficEventsResponseSchema = z25.object({
|
|
3657
|
+
windowStart: z25.string(),
|
|
3658
|
+
windowEnd: z25.string(),
|
|
3659
|
+
totals: z25.object({
|
|
3660
|
+
crawlerHits: z25.number().int().nonnegative(),
|
|
3661
|
+
aiUserFetchHits: z25.number().int().nonnegative(),
|
|
3662
|
+
aiReferralHits: z25.number().int().nonnegative()
|
|
3635
3663
|
}),
|
|
3636
|
-
events:
|
|
3664
|
+
events: z25.array(trafficEventEntrySchema)
|
|
3637
3665
|
});
|
|
3638
3666
|
|
|
3639
3667
|
// ../contracts/src/discovery.ts
|
|
3640
|
-
import { z as
|
|
3641
|
-
var discoveryBucketSchema =
|
|
3668
|
+
import { z as z26 } from "zod";
|
|
3669
|
+
var discoveryBucketSchema = z26.enum(["cited", "aspirational", "wasted-surface"]);
|
|
3642
3670
|
var DiscoveryBuckets = discoveryBucketSchema.enum;
|
|
3643
3671
|
var DEFAULT_DISCOVERY_PROMOTE_BUCKETS = [
|
|
3644
3672
|
DiscoveryBuckets.cited,
|
|
@@ -3646,7 +3674,7 @@ var DEFAULT_DISCOVERY_PROMOTE_BUCKETS = [
|
|
|
3646
3674
|
];
|
|
3647
3675
|
var DISCOVERY_PROMOTE_COMPETITOR_CAP = 20;
|
|
3648
3676
|
var DISCOVERY_PROMOTE_COMPETITOR_MIN_HITS = 2;
|
|
3649
|
-
var discoveryCompetitorTypeSchema =
|
|
3677
|
+
var discoveryCompetitorTypeSchema = z26.enum([
|
|
3650
3678
|
"direct-competitor",
|
|
3651
3679
|
"ota-aggregator",
|
|
3652
3680
|
"editorial-media",
|
|
@@ -3657,11 +3685,11 @@ var DiscoveryCompetitorTypes = discoveryCompetitorTypeSchema.enum;
|
|
|
3657
3685
|
var DEFAULT_DISCOVERY_PROMOTE_COMPETITOR_TYPES = [
|
|
3658
3686
|
DiscoveryCompetitorTypes["direct-competitor"]
|
|
3659
3687
|
];
|
|
3660
|
-
var discoverySessionStatusSchema =
|
|
3688
|
+
var discoverySessionStatusSchema = z26.enum(["queued", "seeding", "probing", "completed", "failed"]);
|
|
3661
3689
|
var DiscoverySessionStatuses = discoverySessionStatusSchema.enum;
|
|
3662
|
-
var discoveryCompetitorMapEntrySchema =
|
|
3663
|
-
domain:
|
|
3664
|
-
hits:
|
|
3690
|
+
var discoveryCompetitorMapEntrySchema = z26.object({
|
|
3691
|
+
domain: z26.string().min(1),
|
|
3692
|
+
hits: z26.number().int().positive(),
|
|
3665
3693
|
/**
|
|
3666
3694
|
* Domain classification from the session's post-probe AI classification
|
|
3667
3695
|
* pass. Defaults to `unknown` so competitor maps persisted before
|
|
@@ -3670,43 +3698,43 @@ var discoveryCompetitorMapEntrySchema = z25.object({
|
|
|
3670
3698
|
*/
|
|
3671
3699
|
competitorType: discoveryCompetitorTypeSchema.default("unknown")
|
|
3672
3700
|
});
|
|
3673
|
-
var discoveryProbeDtoSchema =
|
|
3674
|
-
id:
|
|
3675
|
-
sessionId:
|
|
3676
|
-
projectId:
|
|
3677
|
-
query:
|
|
3701
|
+
var discoveryProbeDtoSchema = z26.object({
|
|
3702
|
+
id: z26.string(),
|
|
3703
|
+
sessionId: z26.string(),
|
|
3704
|
+
projectId: z26.string(),
|
|
3705
|
+
query: z26.string(),
|
|
3678
3706
|
bucket: discoveryBucketSchema.nullable().default(null),
|
|
3679
3707
|
citationState: citationStateSchema,
|
|
3680
|
-
citedDomains:
|
|
3681
|
-
createdAt:
|
|
3708
|
+
citedDomains: z26.array(z26.string()).default([]),
|
|
3709
|
+
createdAt: z26.string()
|
|
3682
3710
|
});
|
|
3683
|
-
var discoverySessionDtoSchema =
|
|
3684
|
-
id:
|
|
3685
|
-
projectId:
|
|
3711
|
+
var discoverySessionDtoSchema = z26.object({
|
|
3712
|
+
id: z26.string(),
|
|
3713
|
+
projectId: z26.string(),
|
|
3686
3714
|
status: discoverySessionStatusSchema,
|
|
3687
|
-
icpDescription:
|
|
3688
|
-
seedProvider:
|
|
3689
|
-
seedCountRaw:
|
|
3690
|
-
seedCount:
|
|
3691
|
-
dedupThreshold:
|
|
3692
|
-
probeCount:
|
|
3693
|
-
citedCount:
|
|
3694
|
-
aspirationalCount:
|
|
3695
|
-
wastedCount:
|
|
3696
|
-
competitorMap:
|
|
3697
|
-
error:
|
|
3698
|
-
startedAt:
|
|
3699
|
-
finishedAt:
|
|
3700
|
-
createdAt:
|
|
3715
|
+
icpDescription: z26.string().nullable().optional(),
|
|
3716
|
+
seedProvider: z26.string().nullable().optional(),
|
|
3717
|
+
seedCountRaw: z26.number().int().nullable().optional(),
|
|
3718
|
+
seedCount: z26.number().int().nullable().optional(),
|
|
3719
|
+
dedupThreshold: z26.number().nullable().optional(),
|
|
3720
|
+
probeCount: z26.number().int().nullable().optional(),
|
|
3721
|
+
citedCount: z26.number().int().nullable().default(null),
|
|
3722
|
+
aspirationalCount: z26.number().int().nullable().default(null),
|
|
3723
|
+
wastedCount: z26.number().int().nullable().default(null),
|
|
3724
|
+
competitorMap: z26.array(discoveryCompetitorMapEntrySchema).default([]),
|
|
3725
|
+
error: z26.string().nullable().optional(),
|
|
3726
|
+
startedAt: z26.string().nullable().optional(),
|
|
3727
|
+
finishedAt: z26.string().nullable().optional(),
|
|
3728
|
+
createdAt: z26.string()
|
|
3701
3729
|
});
|
|
3702
3730
|
var discoverySessionDetailDtoSchema = discoverySessionDtoSchema.extend({
|
|
3703
|
-
probes:
|
|
3731
|
+
probes: z26.array(discoveryProbeDtoSchema).default([])
|
|
3704
3732
|
});
|
|
3705
3733
|
var DISCOVERY_MAX_PROBES_CAP = 500;
|
|
3706
|
-
var discoveryRunRequestSchema =
|
|
3707
|
-
icpDescription:
|
|
3708
|
-
dedupThreshold:
|
|
3709
|
-
maxProbes:
|
|
3734
|
+
var discoveryRunRequestSchema = z26.object({
|
|
3735
|
+
icpDescription: z26.string().min(1).optional(),
|
|
3736
|
+
dedupThreshold: z26.number().min(0).max(1).optional(),
|
|
3737
|
+
maxProbes: z26.number().int().positive().max(DISCOVERY_MAX_PROBES_CAP).optional(),
|
|
3710
3738
|
/**
|
|
3711
3739
|
* Optional override of the project's location labels, constraining seed
|
|
3712
3740
|
* generation to a subset of the configured service areas. Each label must
|
|
@@ -3714,39 +3742,39 @@ var discoveryRunRequestSchema = z25.object({
|
|
|
3714
3742
|
* `resolveLocations`). Omitted means "use every project location" — a
|
|
3715
3743
|
* project with no locations is unaffected.
|
|
3716
3744
|
*/
|
|
3717
|
-
locations:
|
|
3745
|
+
locations: z26.array(z26.string().min(1)).optional()
|
|
3718
3746
|
});
|
|
3719
|
-
var discoveryPromoteRequestSchema =
|
|
3720
|
-
buckets:
|
|
3721
|
-
includeCompetitors:
|
|
3722
|
-
competitorTypes:
|
|
3747
|
+
var discoveryPromoteRequestSchema = z26.object({
|
|
3748
|
+
buckets: z26.array(discoveryBucketSchema).min(1).optional(),
|
|
3749
|
+
includeCompetitors: z26.boolean().optional(),
|
|
3750
|
+
competitorTypes: z26.array(discoveryCompetitorTypeSchema).min(1).optional()
|
|
3723
3751
|
});
|
|
3724
|
-
var discoveryPromotePreviewSchema =
|
|
3725
|
-
sessionId:
|
|
3726
|
-
projectId:
|
|
3752
|
+
var discoveryPromotePreviewSchema = z26.object({
|
|
3753
|
+
sessionId: z26.string(),
|
|
3754
|
+
projectId: z26.string(),
|
|
3727
3755
|
status: discoverySessionStatusSchema,
|
|
3728
|
-
queriesByBucket:
|
|
3729
|
-
cited:
|
|
3730
|
-
aspirational:
|
|
3731
|
-
"wasted-surface":
|
|
3756
|
+
queriesByBucket: z26.object({
|
|
3757
|
+
cited: z26.array(z26.string()),
|
|
3758
|
+
aspirational: z26.array(z26.string()),
|
|
3759
|
+
"wasted-surface": z26.array(z26.string())
|
|
3732
3760
|
}),
|
|
3733
|
-
suggestedCompetitors:
|
|
3734
|
-
});
|
|
3735
|
-
var discoveryPromoteResultSchema =
|
|
3736
|
-
sessionId:
|
|
3737
|
-
projectId:
|
|
3738
|
-
promoted:
|
|
3739
|
-
queries:
|
|
3740
|
-
competitors:
|
|
3761
|
+
suggestedCompetitors: z26.array(discoveryCompetitorMapEntrySchema)
|
|
3762
|
+
});
|
|
3763
|
+
var discoveryPromoteResultSchema = z26.object({
|
|
3764
|
+
sessionId: z26.string(),
|
|
3765
|
+
projectId: z26.string(),
|
|
3766
|
+
promoted: z26.object({
|
|
3767
|
+
queries: z26.array(z26.string()),
|
|
3768
|
+
competitors: z26.array(z26.string())
|
|
3741
3769
|
}),
|
|
3742
|
-
skipped:
|
|
3743
|
-
queries:
|
|
3744
|
-
competitors:
|
|
3770
|
+
skipped: z26.object({
|
|
3771
|
+
queries: z26.array(z26.string()),
|
|
3772
|
+
competitors: z26.array(z26.string())
|
|
3745
3773
|
})
|
|
3746
3774
|
});
|
|
3747
|
-
var queryProvenanceSchema =
|
|
3748
|
-
|
|
3749
|
-
|
|
3775
|
+
var queryProvenanceSchema = z26.union([
|
|
3776
|
+
z26.literal("cli"),
|
|
3777
|
+
z26.string().regex(/^discovery:.+$/)
|
|
3750
3778
|
]);
|
|
3751
3779
|
|
|
3752
3780
|
// ../contracts/src/embeddings.ts
|
|
@@ -3920,6 +3948,10 @@ var AI_PROVIDER_INFRA_DOMAINS = [
|
|
|
3920
3948
|
|
|
3921
3949
|
export {
|
|
3922
3950
|
__export,
|
|
3951
|
+
apiKeyDtoSchema,
|
|
3952
|
+
apiKeyListDtoSchema,
|
|
3953
|
+
createApiKeyRequestSchema,
|
|
3954
|
+
createdApiKeyDtoSchema,
|
|
3923
3955
|
providerQuotaPolicySchema,
|
|
3924
3956
|
ProviderNames,
|
|
3925
3957
|
isBrowserProvider,
|