@bisibility/sdk 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -1,3 +1,27 @@
1
+ import type { PublicIdForPrefix } from "./public-id.js";
2
+ export type AlertId = PublicIdForPrefix<"alert">;
3
+ export type ApiKeyId = PublicIdForPrefix<"key">;
4
+ export type AuditId = PublicIdForPrefix<"audit">;
5
+ export type CloudImportJobId = PublicIdForPrefix<"job">;
6
+ export type CompetitorId = PublicIdForPrefix<"comp">;
7
+ export type ConnectionId = PublicIdForPrefix<"conn">;
8
+ export type IngestHookId = PublicIdForPrefix<"hook">;
9
+ export type InviteId = PublicIdForPrefix<"invite">;
10
+ export type KeywordId = PublicIdForPrefix<"kw">;
11
+ export type MembershipId = PublicIdForPrefix<"member">;
12
+ export type MigrationTokenId = PublicIdForPrefix<"mtok">;
13
+ export type NotificationId = PublicIdForPrefix<"notif">;
14
+ export type PersonalAccessTokenId = PublicIdForPrefix<"pat">;
15
+ export type ProjectId = PublicIdForPrefix<"prj">;
16
+ export type RankCheckId = PublicIdForPrefix<"check">;
17
+ export type SavedKeywordId = PublicIdForPrefix<"skw">;
18
+ export type SavedViewId = PublicIdForPrefix<"view">;
19
+ export type SessionId = PublicIdForPrefix<"ses">;
20
+ export type SignalId = PublicIdForPrefix<"sig">;
21
+ export type TagId = PublicIdForPrefix<"tag">;
22
+ export type UserId = PublicIdForPrefix<"usr">;
23
+ export type WebhookId = PublicIdForPrefix<"webhook">;
24
+ export type AlertRuleId = PublicIdForPrefix<"rule">;
1
25
  export type Device = "desktop" | "mobile";
2
26
  export type RankCheckFrequency = "paused" | "manual" | "daily" | "weekly" | "monthly" | "custom_cron";
3
27
  export type JsonObject = Record<string, unknown>;
@@ -31,7 +55,7 @@ export type ProjectWriteMode = "active" | "migration_hold" | "migrated";
31
55
  export interface Project {
32
56
  created_at: string;
33
57
  domain: string;
34
- id: string;
58
+ id: ProjectId;
35
59
  name: string;
36
60
  updated_at: string;
37
61
  write_mode: ProjectWriteMode;
@@ -50,7 +74,7 @@ export interface ProjectDefaults {
50
74
  last_checked_at: string | null;
51
75
  location_key: string;
52
76
  next_check_at: string | null;
53
- project_id: string;
77
+ project_id: ProjectId;
54
78
  serp_depth: number;
55
79
  serp_stop_on_match: boolean;
56
80
  source: "derived" | "explicit" | "fallback";
@@ -87,7 +111,7 @@ export interface ProjectOverview {
87
111
  last_check_at: string | null;
88
112
  next_check_at: string | null;
89
113
  position_distribution: ProjectOverviewPositionDistribution[];
90
- project_id: string;
114
+ project_id: ProjectId;
91
115
  top_10_count: number | null;
92
116
  top_10_delta: number | null;
93
117
  top_100_count: number | null;
@@ -106,12 +130,17 @@ export interface KeywordMatchMarket {
106
130
  location_key: string;
107
131
  }
108
132
  export interface KeywordMatch {
109
- keyword_id: string;
133
+ keyword_id: KeywordId;
110
134
  latest_position: number | null;
111
135
  market: KeywordMatchMarket;
112
136
  /** Trimmed, lowercase request text used to match this keyword. */
113
137
  matched_text: string;
114
138
  previous_position: number | null;
139
+ /**
140
+ * URL that ranked at `latest_position` in the last completed check, or null when the keyword has
141
+ * no completed check.
142
+ */
143
+ ranking_url: string | null;
115
144
  /** Stored keyword text, which can differ in case and whitespace from matched_text. */
116
145
  text: string;
117
146
  }
@@ -130,7 +159,6 @@ export interface LocationSuggestion {
130
159
  country_code: string;
131
160
  display_name: string;
132
161
  hl: string;
133
- id: string;
134
162
  kind: LocationKind;
135
163
  language_label: string;
136
164
  location_key: string;
@@ -153,7 +181,7 @@ export interface CreateProjectInput {
153
181
  }
154
182
  export interface ApiKey {
155
183
  created_at: string;
156
- id: string;
184
+ id: ApiKeyId;
157
185
  last_used_at: string | null;
158
186
  name: string;
159
187
  prefix: string;
@@ -166,13 +194,13 @@ export interface CreatedApiKey extends ApiKey {
166
194
  export type MembershipRole = "admin" | "auditor" | "member" | "owner" | "viewer";
167
195
  export interface MeProject {
168
196
  domain: string;
169
- id: string;
197
+ id: ProjectId;
170
198
  name: string;
171
199
  role: MembershipRole;
172
200
  }
173
201
  export interface Me {
174
202
  email: string;
175
- id: string;
203
+ id: UserId;
176
204
  name: string;
177
205
  projects: MeProject[];
178
206
  }
@@ -183,7 +211,7 @@ export type PersonalAccessTokenScope = "admin" | "read" | "write";
183
211
  export interface PersonalAccessToken {
184
212
  created_at: string;
185
213
  expires_at: string | null;
186
- id: string;
214
+ id: PersonalAccessTokenId;
187
215
  last_used_at: string | null;
188
216
  name: string;
189
217
  prefix: string;
@@ -205,7 +233,7 @@ export interface Webhook {
205
233
  created_at: string;
206
234
  description: string | null;
207
235
  enabled: boolean;
208
- id: string;
236
+ id: WebhookId;
209
237
  last_delivery_at: string | null;
210
238
  updated_at: string;
211
239
  url: string;
@@ -236,12 +264,12 @@ export interface Keyword {
236
264
  country: string;
237
265
  created_at: string;
238
266
  device: Device;
239
- id: string;
267
+ id: KeywordId;
240
268
  intent: string | null;
241
269
  latest_position: number | null;
242
270
  location: string;
243
271
  previous_position: number | null;
244
- project_id: string;
272
+ project_id: ProjectId;
245
273
  ranking_url: string | null;
246
274
  schedule: KeywordSchedule | null;
247
275
  tags: string[];
@@ -301,24 +329,24 @@ export interface UpdateKeywordInput {
301
329
  }
302
330
  export type KeywordBulkOperation = "add_tags" | "delete" | "remove_tags" | "set_frequency" | "set_target_url";
303
331
  export type KeywordBulkInput = {
304
- keyword_ids: readonly string[];
332
+ keyword_ids: readonly KeywordId[];
305
333
  operation: "add_tags" | "remove_tags";
306
334
  tags: readonly string[];
307
335
  } | {
308
- keyword_ids: readonly string[];
336
+ keyword_ids: readonly KeywordId[];
309
337
  operation: "delete";
310
338
  } | {
311
- keyword_ids: readonly string[];
339
+ keyword_ids: readonly KeywordId[];
312
340
  operation: "set_frequency";
313
341
  frequency?: RankCheckFrequency;
314
342
  schedule?: KeywordScheduleInput;
315
343
  } | {
316
- keyword_ids: readonly string[];
344
+ keyword_ids: readonly KeywordId[];
317
345
  operation: "set_target_url";
318
346
  target_url?: string | null;
319
347
  };
320
348
  export interface KeywordBulkItemResult {
321
- keyword_id: string;
349
+ keyword_id: KeywordId;
322
350
  status: OpenString<"deleted" | "not_found" | "updated">;
323
351
  }
324
352
  export interface KeywordBulkResponse {
@@ -344,7 +372,7 @@ export interface RankedKeywordSuggestion {
344
372
  search_volume: number | null;
345
373
  }
346
374
  export interface RankedKeywordConnection {
347
- id: string;
375
+ id: ConnectionId;
348
376
  label: string;
349
377
  provider: "dataforseo";
350
378
  }
@@ -358,7 +386,7 @@ export interface RankedKeywordSuggestionsResponse {
358
386
  total_count: number | null;
359
387
  }
360
388
  export interface ListRankedKeywordSuggestionsOptions {
361
- connectionId?: string;
389
+ connectionId?: ConnectionId;
362
390
  fresh?: boolean;
363
391
  limit?: number;
364
392
  offset?: number;
@@ -381,7 +409,7 @@ export interface KeywordMetricsRow extends KeywordMetrics {
381
409
  keyword: string;
382
410
  }
383
411
  export interface KeywordResearchConnection {
384
- id: string;
412
+ id: ConnectionId;
385
413
  label: string;
386
414
  provider: string;
387
415
  }
@@ -488,7 +516,7 @@ export interface KeywordResearchResponse {
488
516
  total_count: number;
489
517
  }
490
518
  export interface ResearchKeywordsOptions {
491
- connectionId?: string;
519
+ connectionId?: ConnectionId;
492
520
  estimateOnly?: boolean;
493
521
  fresh?: boolean;
494
522
  includeClickstream?: boolean;
@@ -498,7 +526,7 @@ export interface ResearchKeywordsOptions {
498
526
  seed: string;
499
527
  }
500
528
  export interface GetKeywordMetricsInput {
501
- connection_id?: string;
529
+ connection_id?: ConnectionId;
502
530
  estimate_only?: boolean;
503
531
  fresh?: boolean;
504
532
  include_clickstream?: boolean;
@@ -523,9 +551,9 @@ export type RankHistoryExportRange = "30" | "90" | "all";
523
551
  export type RankHistoryExportGranularity = "daily" | "weekly";
524
552
  export interface RankHistoryExportRow {
525
553
  checked_at: string;
526
- id: string;
554
+ id: RankCheckId;
527
555
  keyword: string;
528
- keyword_id: string;
556
+ keyword_id: KeywordId;
529
557
  position: number | null;
530
558
  previous_position: number | null;
531
559
  ranking_url: string | null;
@@ -533,7 +561,7 @@ export interface RankHistoryExportRow {
533
561
  export type RankHistoryExportResponse = ListResponse<RankHistoryExportRow>;
534
562
  interface RankHistoryExportOptions {
535
563
  granularity?: RankHistoryExportGranularity;
536
- keywordIds?: readonly string[];
564
+ keywordIds?: readonly KeywordId[];
537
565
  range?: RankHistoryExportRange;
538
566
  }
539
567
  export interface ExportRankHistoryJsonOptions extends PaginationOptions, RankHistoryExportOptions {
@@ -545,15 +573,14 @@ export interface ExportRankHistoryCsvOptions extends RankHistoryExportOptions {
545
573
  export type SitemapMonitorStatus = "active" | "disabled" | "pending";
546
574
  export interface SitemapMonitorSnapshot {
547
575
  fetched_at: string;
548
- id: string;
549
576
  sitemap_url: string;
550
577
  url_count: number;
551
578
  }
552
579
  export interface SitemapMonitor {
553
580
  enabled: boolean;
554
- id: string;
581
+ id: ProjectId;
555
582
  latest_snapshot: SitemapMonitorSnapshot | null;
556
- project_id: string;
583
+ project_id: ProjectId;
557
584
  sitemap_url: string | null;
558
585
  status: SitemapMonitorStatus;
559
586
  }
@@ -571,8 +598,8 @@ export interface RankCheck {
571
598
  checked_at: string;
572
599
  cost_cents: number | null;
573
600
  error: string | null;
574
- id: string;
575
- keyword_id: string;
601
+ id: RankCheckId;
602
+ keyword_id: KeywordId;
576
603
  position: number | null;
577
604
  previous_position: number | null;
578
605
  provider: string;
@@ -594,15 +621,7 @@ export type AlertConditionType = "change_pct" | "competitor_overtake" | "enters_
594
621
  export type AlertChannel = "email" | "slack" | "webhook";
595
622
  export type AlertTargetType = "all" | "keyword" | "tag";
596
623
  export type AlertSeverity = "info" | "urgent" | "warning";
597
- export interface AlertRuleTarget {
598
- created_at?: string;
599
- id: string;
600
- keyword_id?: string | null;
601
- rule_id?: string;
602
- tag_id?: string | null;
603
- updated_at?: string;
604
- }
605
- export interface AlertRule {
624
+ interface AlertRuleBase {
606
625
  change_pct?: number | string | null;
607
626
  channel?: string;
608
627
  channels: AlertChannel[];
@@ -610,37 +629,52 @@ export interface AlertRule {
610
629
  condition_type: AlertConditionType;
611
630
  competitor_domain?: string | null;
612
631
  created_at?: string;
613
- created_by_id?: string | null;
614
632
  enabled: boolean;
615
633
  fires?: string;
616
- id: string;
634
+ id: AlertRuleId;
617
635
  name: string;
618
636
  period?: string;
619
- project_id?: string;
637
+ recipient_ids: UserId[];
620
638
  scope?: string;
621
639
  serp_feature?: string | null;
622
640
  severity?: AlertSeverity;
623
641
  status?: OpenString<"active" | "paused">;
624
- target_ids?: string[];
625
- target_type: AlertTargetType;
626
- targets?: AlertRuleTarget[];
627
642
  threshold_position?: number | null;
628
643
  top_n?: number | null;
629
644
  updated_at?: string;
630
645
  }
631
- export interface AlertRuleInput {
646
+ export type AlertRule = (AlertRuleBase & {
647
+ target_ids: KeywordId[];
648
+ target_type: "keyword";
649
+ }) | (AlertRuleBase & {
650
+ target_ids: TagId[];
651
+ target_type: "tag";
652
+ }) | (AlertRuleBase & {
653
+ target_ids: [];
654
+ target_type: "all";
655
+ });
656
+ interface AlertRuleInputBase {
632
657
  change_pct?: number | null;
633
658
  channels?: readonly AlertChannel[];
634
659
  condition_type: AlertConditionType;
635
660
  competitor_domain?: string | null;
636
661
  enabled?: boolean;
637
662
  name: string;
663
+ recipient_ids?: readonly UserId[];
638
664
  serp_feature?: string | null;
639
- target_ids?: readonly string[];
640
- target_type?: AlertTargetType;
641
665
  threshold_position?: number | null;
642
666
  top_n?: number | null;
643
667
  }
668
+ export type AlertRuleInput = (AlertRuleInputBase & {
669
+ target_ids?: readonly [];
670
+ target_type?: "all";
671
+ }) | (AlertRuleInputBase & {
672
+ target_ids: readonly KeywordId[];
673
+ target_type: "keyword";
674
+ }) | (AlertRuleInputBase & {
675
+ target_ids: readonly TagId[];
676
+ target_type: "tag";
677
+ });
644
678
  export type CreateAlertRuleInput = AlertRuleInput;
645
679
  export type UpdateAlertRuleInput = AlertRuleInput;
646
680
  export interface DeleteAlertRuleResponse {
@@ -651,7 +685,7 @@ export interface TriggeredAlert {
651
685
  ctas: string[];
652
686
  current: string;
653
687
  headline: string;
654
- id: string;
688
+ id: AlertId;
655
689
  keyword: string;
656
690
  previous: string;
657
691
  rule: string;
@@ -671,7 +705,7 @@ export type TeamRoleLabel = "Admin" | "Editor" | "Owner" | "Viewer";
671
705
  export interface TeamMember {
672
706
  color: OpenString<"accent" | "blue" | "purple">;
673
707
  email: string;
674
- id: string;
708
+ id: MembershipId;
675
709
  initials: string;
676
710
  name: string;
677
711
  role: TeamRoleLabel;
@@ -680,7 +714,7 @@ export interface TeamMember {
680
714
  export interface TeamInvite {
681
715
  email: string;
682
716
  expires_label: string;
683
- id: string;
717
+ id: InviteId;
684
718
  invited_label: string;
685
719
  role: TeamRoleLabel;
686
720
  role_value: Exclude<TeamRole, "owner">;
@@ -691,26 +725,26 @@ export interface CreateTeamInviteInput {
691
725
  }
692
726
  export interface CreatedTeamInvite {
693
727
  expires_at: string;
694
- id: string;
728
+ id: InviteId;
695
729
  invite_link: string;
696
730
  }
697
731
  export interface RevokedTeamInvite {
698
- id: string;
732
+ id: InviteId;
699
733
  }
700
734
  export type AssignableTeamRole = Exclude<TeamRole, "owner">;
701
735
  export interface UpdateTeamMemberRoleInput {
702
736
  role: AssignableTeamRole;
703
737
  }
704
738
  export interface TeamMemberRoleResult {
705
- id: string;
739
+ id: MembershipId;
706
740
  role: AssignableTeamRole;
707
741
  }
708
742
  export interface TeamMemberMutationResult {
709
- id: string;
743
+ id: MembershipId;
710
744
  }
711
745
  export interface TeamInviteResendResult {
712
746
  expires_at: string;
713
- id: string;
747
+ id: InviteId;
714
748
  invite_link: string;
715
749
  }
716
750
  export type ProviderId = "dataforseo" | "ga4" | "gsc" | "plausible" | "serpapi";
@@ -794,12 +828,12 @@ export interface ProviderConnection {
794
828
  created_at: string;
795
829
  credentials_hash?: string | null;
796
830
  enabled: boolean;
797
- id: string;
831
+ id: ConnectionId;
798
832
  is_primary: boolean;
799
833
  kind: ProviderKind;
800
834
  last_used_at: string | null;
801
835
  priority: number;
802
- project_id: string;
836
+ project_id: ProjectId;
803
837
  provider: OpenString<ProviderId>;
804
838
  status: ProviderStatus;
805
839
  updated_at: string;
@@ -840,8 +874,8 @@ export interface CreateSavedViewInput {
840
874
  export interface SavedView {
841
875
  config: SavedViewConfig;
842
876
  created_at: string;
843
- created_by_id: string | null;
844
- id: string;
877
+ created_by_id: UserId | null;
878
+ id: SavedViewId;
845
879
  name: string;
846
880
  }
847
881
  export interface DeleteSavedViewResponse {
@@ -849,7 +883,7 @@ export interface DeleteSavedViewResponse {
849
883
  }
850
884
  export interface Competitor {
851
885
  domain: string;
852
- id: string;
886
+ id: CompetitorId;
853
887
  initials?: string;
854
888
  label: string | null;
855
889
  }
@@ -863,14 +897,14 @@ export interface RemoveCompetitorResponse {
863
897
  export type CompetitorKind = "Managed" | "You";
864
898
  export interface CompetitorColumn {
865
899
  domain: string;
866
- id?: string;
900
+ id?: CompetitorId;
867
901
  kind: CompetitorKind;
868
902
  label: string;
869
903
  }
870
904
  export interface CompetitorShare {
871
905
  color: string;
872
906
  domain: string;
873
- id?: string;
907
+ id?: CompetitorId;
874
908
  initials: string;
875
909
  kind: CompetitorKind;
876
910
  label: string;
@@ -880,8 +914,11 @@ export interface CompetitorShare {
880
914
  export interface HeadToHeadRow {
881
915
  gap: number | null;
882
916
  keyword: string;
883
- ranks: Record<string, number | null>;
917
+ ranks: CompetitorRankMap;
884
918
  }
919
+ export type CompetitorRankMap = {
920
+ you?: number | null;
921
+ } & Partial<Record<CompetitorId, number | null>>;
885
922
  export interface CompetitorMarket {
886
923
  checked_keyword_count: number;
887
924
  columns: CompetitorColumn[];
@@ -921,7 +958,7 @@ export interface NotificationPreferences {
921
958
  import_in_app: boolean;
922
959
  invite_email: boolean;
923
960
  invite_in_app: boolean;
924
- project_id: string;
961
+ project_id: ProjectId;
925
962
  slack_available?: boolean;
926
963
  webhook_available?: boolean;
927
964
  }
@@ -938,10 +975,8 @@ export interface PageTrafficSnapshot {
938
975
  created_at: string;
939
976
  date: string;
940
977
  engagement_rate: number | null;
941
- id: string;
942
978
  key_events: number | null;
943
979
  path: string;
944
- project_id: string;
945
980
  provider: string;
946
981
  scroll_depth: number | null;
947
982
  sessions: number;
@@ -956,14 +991,14 @@ export interface PageTrafficSnapshotsResponse {
956
991
  total_count: number;
957
992
  }
958
993
  export interface ListSearchPerformanceQueryStatsOptions {
959
- connectionId?: string;
994
+ connectionId?: ConnectionId;
960
995
  endDate: Date | string;
961
996
  limit?: number;
962
997
  query?: string;
963
998
  startDate: Date | string;
964
999
  }
965
1000
  export interface AnalyticsConnection {
966
- id: string;
1001
+ id: ConnectionId;
967
1002
  label: string;
968
1003
  provider: string;
969
1004
  }
@@ -981,7 +1016,7 @@ export interface SearchPerformanceQueryStatsResponse {
981
1016
  }
982
1017
  export type TrafficSyncRunStatus = "succeeded_with_data" | "succeeded_empty" | "deferred_rate_limit" | "failed" | "not_applicable";
983
1018
  export interface TrafficSyncRun {
984
- connection_id: string;
1019
+ connection_id: ConnectionId;
985
1020
  error?: string;
986
1021
  error_class?: string;
987
1022
  provider: string;
@@ -1000,7 +1035,7 @@ export interface TrafficSyncSummary {
1000
1035
  connections: number;
1001
1036
  keyword_snapshots: number;
1002
1037
  page_snapshots: number;
1003
- project_id: string;
1038
+ project_id: ProjectId;
1004
1039
  runs: TrafficSyncRun[];
1005
1040
  skipped: TrafficSyncSkippedConnection[];
1006
1041
  }
@@ -1011,7 +1046,7 @@ export interface CloudImportJob {
1011
1046
  created_at: string | null;
1012
1047
  error: string | null;
1013
1048
  finished_at: string | null;
1014
- id: string | null;
1049
+ id: CloudImportJobId | null;
1015
1050
  progress: number;
1016
1051
  started_at: string | null;
1017
1052
  state: CloudImportState;
@@ -1023,7 +1058,7 @@ export interface ActiveMigrationToken {
1023
1058
  name: string;
1024
1059
  };
1025
1060
  expires_at: string;
1026
- id: string;
1061
+ id: MigrationTokenId;
1027
1062
  scope: MigrationScope;
1028
1063
  single_use: boolean;
1029
1064
  }
@@ -1035,7 +1070,7 @@ export interface MintMigrationTokenInput {
1035
1070
  scope?: MigrationScope;
1036
1071
  }
1037
1072
  export interface RevokedMigrationToken {
1038
- id: string;
1073
+ id: MigrationTokenId;
1039
1074
  revoked_at: string;
1040
1075
  }
1041
1076
  export interface MigrationTokenListMeta extends ListMeta {
@@ -1044,7 +1079,7 @@ export interface MigrationTokenListMeta extends ListMeta {
1044
1079
  export interface MigrationTokenListResponse extends ListResponse<ActiveMigrationToken> {
1045
1080
  meta: MigrationTokenListMeta;
1046
1081
  }
1047
- export type CloudImportSchemaVersion = 1 | 2 | 3;
1082
+ export type CloudImportSchemaVersion = 4;
1048
1083
  export type CloudImportLocation = "Australia" | "Austria" | "Belgium" | "Brazil" | "Canada" | "Denmark" | "Finland" | "France" | "Germany" | "India" | "Ireland" | "Italy" | "Japan" | "Mexico" | "Netherlands" | "New Zealand" | "Norway" | "Poland" | "Portugal" | "Singapore" | "South Africa" | "Spain" | "Sweden" | "Switzerland" | "United Arab Emirates" | "United Kingdom" | "United States";
1049
1084
  export interface CloudImportCompatibility {
1050
1085
  app_version: string;
@@ -1058,121 +1093,92 @@ export interface CloudImportRankingHistory {
1058
1093
  rankingUrl?: string | null;
1059
1094
  }
1060
1095
  export interface CloudImportKeyword {
1061
- country?: CloudImportLocation;
1062
- device?: Device;
1063
- id?: string;
1064
- keyword?: string;
1065
- location?: CloudImportLocation;
1096
+ device: Device;
1097
+ id: KeywordId;
1098
+ keyword: string;
1099
+ location: CloudImportLocation;
1066
1100
  rankingHistory?: CloudImportRankingHistory[];
1067
1101
  tags?: string[];
1068
1102
  target_url?: string | null;
1069
- targetUrl?: string | null;
1070
- text?: string;
1071
1103
  }
1072
1104
  export interface CloudImportCompetitor {
1073
1105
  domain: string;
1106
+ id: CompetitorId;
1074
1107
  label?: string | null;
1075
1108
  }
1076
1109
  export interface CloudImportSavedView {
1077
1110
  config?: unknown;
1111
+ id: SavedViewId;
1078
1112
  name: string;
1079
1113
  surface?: "competitors" | "keywords";
1080
1114
  }
1081
1115
  export type CloudImportAlertChannel = "email" | "slack" | "webhook";
1082
- export type CloudImportAlertConditionType = "change_pct" | "competitor_overtake" | "enters_top_n" | "exits_top_n" | "serp_feature" | "threshold";
1116
+ export type CloudImportAlertConditionType = "change_pct" | "competitor_overtake" | "ctr_drop" | "downtrend" | "enters_top_n" | "exits_top_n" | "position_drop" | "serp_feature" | "threshold" | "url_mismatch";
1083
1117
  export type CloudImportAlertTargetType = "all" | "keyword" | "tag";
1084
- export interface CloudImportAlertRuleTarget {
1118
+ export interface CloudImportKeywordAlertTarget {
1085
1119
  device?: Device;
1086
1120
  keyword?: string;
1087
- keyword_id?: string;
1088
- keywordId?: string;
1121
+ keyword_id: KeywordId;
1089
1122
  location?: CloudImportLocation;
1090
- tag?: string;
1091
- tag_id?: string;
1092
- tagId?: string;
1093
- type?: "keyword" | "tag";
1123
+ type: "keyword";
1094
1124
  }
1125
+ export interface CloudImportTagAlertTarget {
1126
+ tag: string;
1127
+ type: "tag";
1128
+ }
1129
+ export type CloudImportAlertRuleTarget = CloudImportKeywordAlertTarget | CloudImportTagAlertTarget;
1095
1130
  export interface CloudImportAlertRule {
1096
1131
  change_pct?: number | null;
1097
- changePct?: number | null;
1098
1132
  channels?: CloudImportAlertChannel[];
1099
1133
  competitor_domain?: string | null;
1100
- competitorDomain?: string | null;
1101
1134
  condition_type?: CloudImportAlertConditionType;
1102
- conditionType?: CloudImportAlertConditionType;
1135
+ drop_positions?: number | null;
1103
1136
  enabled?: boolean;
1137
+ id: AlertRuleId;
1104
1138
  name: string;
1105
1139
  serp_feature?: string | null;
1106
- serpFeature?: string | null;
1107
1140
  target_type?: CloudImportAlertTargetType;
1108
1141
  targets?: CloudImportAlertRuleTarget[];
1109
- targetType?: CloudImportAlertTargetType;
1110
1142
  threshold_position?: number | null;
1111
- thresholdPosition?: number | null;
1112
1143
  top_n?: number | null;
1113
- topN?: number | null;
1114
1144
  }
1115
1145
  export interface CloudImportNotificationPreference {
1116
1146
  alert_email?: boolean;
1117
1147
  alert_in_app?: boolean;
1118
- alertEmail?: boolean;
1119
- alertInApp?: boolean;
1120
1148
  check_email?: boolean;
1121
1149
  check_in_app?: boolean;
1122
- checkEmail?: boolean;
1123
- checkInApp?: boolean;
1124
1150
  import_email?: boolean;
1125
1151
  import_in_app?: boolean;
1126
- importEmail?: boolean;
1127
- importInApp?: boolean;
1128
1152
  invite_email?: boolean;
1129
1153
  invite_in_app?: boolean;
1130
- inviteEmail?: boolean;
1131
- inviteInApp?: boolean;
1132
- }
1133
- export interface CloudImportTopLevelRankCheck {
1134
- checked_at?: string;
1135
- checkedAt?: string;
1136
- keyword?: string;
1137
- keyword_id?: string;
1138
- keywordId?: string;
1139
- position?: number | null;
1140
- previous_position?: number | null;
1141
- previousPosition?: number | null;
1142
- ranking_url?: string | null;
1143
- rankingUrl?: string | null;
1144
- text?: string;
1154
+ report_email?: boolean;
1145
1155
  }
1146
1156
  export type CloudImportScope = "current" | "history";
1147
1157
  export interface CloudImportPackage {
1148
- alert_rules?: CloudImportAlertRule[];
1149
- alertRules?: CloudImportAlertRule[];
1150
- competitors?: CloudImportCompetitor[];
1151
- exportedAt?: string;
1152
- keywords?: CloudImportKeyword[];
1153
- notification_preferences?: CloudImportNotificationPreference[];
1154
- notificationPreferences?: CloudImportNotificationPreference[];
1155
- projectId?: string;
1156
- rank_checks?: CloudImportTopLevelRankCheck[];
1157
- saved_views?: CloudImportSavedView[];
1158
- savedViews?: CloudImportSavedView[];
1158
+ alert_rules: CloudImportAlertRule[];
1159
+ competitors: CloudImportCompetitor[];
1160
+ exported_at?: string;
1161
+ keywords: CloudImportKeyword[];
1162
+ notification_preferences: CloudImportNotificationPreference[];
1163
+ project_id: ProjectId;
1164
+ saved_views: CloudImportSavedView[];
1159
1165
  scope?: CloudImportScope;
1160
- version?: number;
1161
- [key: string]: unknown;
1166
+ version: CloudImportSchemaVersion;
1162
1167
  }
1163
1168
  export type CloudImportCounts = Record<string, number>;
1164
1169
  export interface CloudImportFinalizeResponse {
1165
1170
  counts: CloudImportCounts;
1166
- job_id: string;
1171
+ job_id: CloudImportJobId;
1167
1172
  state: "done";
1168
1173
  }
1169
1174
  export interface CloudImportSessionCreate {
1170
1175
  chunk_count: number;
1176
+ source_project_id: ProjectId;
1171
1177
  totals?: {
1172
1178
  keywords?: number;
1173
1179
  rank_checks?: number;
1174
1180
  };
1175
- version: 3;
1181
+ version: CloudImportSchemaVersion;
1176
1182
  }
1177
1183
  export interface CloudImportSessionCreateResponse {
1178
1184
  chunk_limits: {
@@ -1180,7 +1186,7 @@ export interface CloudImportSessionCreateResponse {
1180
1186
  max_history_rows: number;
1181
1187
  max_keywords: number;
1182
1188
  };
1183
- session_id: string;
1189
+ session_id: CloudImportJobId;
1184
1190
  state: "receiving";
1185
1191
  }
1186
1192
  export interface CloudImportSourceKeyword {
@@ -1190,15 +1196,10 @@ export interface CloudImportSourceKeyword {
1190
1196
  }
1191
1197
  export interface CloudImportSessionSections {
1192
1198
  alert_rules?: CloudImportAlertRule[];
1193
- alertRules?: CloudImportAlertRule[];
1194
1199
  competitors?: CloudImportCompetitor[];
1195
1200
  notification_preferences?: CloudImportNotificationPreference[];
1196
- notificationPreferences?: CloudImportNotificationPreference[];
1197
1201
  saved_views?: CloudImportSavedView[];
1198
- savedViews?: CloudImportSavedView[];
1199
- source_keyword_ids?: Record<string, CloudImportSourceKeyword>;
1200
- sourceKeywordIds?: Record<string, CloudImportSourceKeyword>;
1201
- [key: string]: unknown;
1202
+ source_keyword_ids?: Partial<Record<KeywordId, CloudImportSourceKeyword>>;
1202
1203
  }
1203
1204
  export interface CloudImportKeywordsChunk {
1204
1205
  checksum: string;
@@ -1226,11 +1227,11 @@ export type SignalSeverity = "critical" | "info" | "warning";
1226
1227
  export interface Signal {
1227
1228
  created_at: string;
1228
1229
  happened_at: string;
1229
- id: string;
1230
- keyword_id: string | null;
1230
+ id: SignalId;
1231
+ keyword_id: KeywordId | null;
1231
1232
  payload: JsonObject | null;
1232
- project_id: string;
1233
- public_id: string;
1233
+ project_id: ProjectId;
1234
+ public_id: SignalId;
1234
1235
  severity: SignalSeverity;
1235
1236
  source: SignalSource;
1236
1237
  type: string;
@@ -1239,7 +1240,7 @@ export interface Signal {
1239
1240
  export interface CreateSignalInput {
1240
1241
  /** ISO-8601 date-time when the signal happened. Defaults to now on the server. */
1241
1242
  happened_at?: string;
1242
- keyword_id?: string;
1243
+ keyword_id?: KeywordId;
1243
1244
  /** JSON object payload. Ingestion rejects serialized payloads above 8KB. */
1244
1245
  payload?: JsonObject;
1245
1246
  severity?: SignalSeverity;
@@ -1361,10 +1362,10 @@ export interface BisibilityClientConfig {
1361
1362
  /** Number of retries after the initial attempt. Defaults to 2; 0 disables retries. */
1362
1363
  maxRetries?: number;
1363
1364
  /**
1364
- * Project id or public id sent as the X-Bisibility-Project header on every request.
1365
+ * Project public ID sent as the X-Bisibility-Project header on every request.
1365
1366
  * Targets personal access token requests at a project on routes without one in the path.
1366
1367
  */
1367
- projectId?: string;
1368
+ projectId?: ProjectId;
1368
1369
  /** Per-attempt timeout in milliseconds. Defaults to 30 seconds; null disables it. */
1369
1370
  timeout?: number | null;
1370
1371
  }