@bisibility/sdk 0.3.1 → 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,7 +130,7 @@ 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. */
@@ -135,7 +159,6 @@ export interface LocationSuggestion {
135
159
  country_code: string;
136
160
  display_name: string;
137
161
  hl: string;
138
- id: string;
139
162
  kind: LocationKind;
140
163
  language_label: string;
141
164
  location_key: string;
@@ -158,7 +181,7 @@ export interface CreateProjectInput {
158
181
  }
159
182
  export interface ApiKey {
160
183
  created_at: string;
161
- id: string;
184
+ id: ApiKeyId;
162
185
  last_used_at: string | null;
163
186
  name: string;
164
187
  prefix: string;
@@ -171,13 +194,13 @@ export interface CreatedApiKey extends ApiKey {
171
194
  export type MembershipRole = "admin" | "auditor" | "member" | "owner" | "viewer";
172
195
  export interface MeProject {
173
196
  domain: string;
174
- id: string;
197
+ id: ProjectId;
175
198
  name: string;
176
199
  role: MembershipRole;
177
200
  }
178
201
  export interface Me {
179
202
  email: string;
180
- id: string;
203
+ id: UserId;
181
204
  name: string;
182
205
  projects: MeProject[];
183
206
  }
@@ -188,7 +211,7 @@ export type PersonalAccessTokenScope = "admin" | "read" | "write";
188
211
  export interface PersonalAccessToken {
189
212
  created_at: string;
190
213
  expires_at: string | null;
191
- id: string;
214
+ id: PersonalAccessTokenId;
192
215
  last_used_at: string | null;
193
216
  name: string;
194
217
  prefix: string;
@@ -210,7 +233,7 @@ export interface Webhook {
210
233
  created_at: string;
211
234
  description: string | null;
212
235
  enabled: boolean;
213
- id: string;
236
+ id: WebhookId;
214
237
  last_delivery_at: string | null;
215
238
  updated_at: string;
216
239
  url: string;
@@ -241,12 +264,12 @@ export interface Keyword {
241
264
  country: string;
242
265
  created_at: string;
243
266
  device: Device;
244
- id: string;
267
+ id: KeywordId;
245
268
  intent: string | null;
246
269
  latest_position: number | null;
247
270
  location: string;
248
271
  previous_position: number | null;
249
- project_id: string;
272
+ project_id: ProjectId;
250
273
  ranking_url: string | null;
251
274
  schedule: KeywordSchedule | null;
252
275
  tags: string[];
@@ -306,24 +329,24 @@ export interface UpdateKeywordInput {
306
329
  }
307
330
  export type KeywordBulkOperation = "add_tags" | "delete" | "remove_tags" | "set_frequency" | "set_target_url";
308
331
  export type KeywordBulkInput = {
309
- keyword_ids: readonly string[];
332
+ keyword_ids: readonly KeywordId[];
310
333
  operation: "add_tags" | "remove_tags";
311
334
  tags: readonly string[];
312
335
  } | {
313
- keyword_ids: readonly string[];
336
+ keyword_ids: readonly KeywordId[];
314
337
  operation: "delete";
315
338
  } | {
316
- keyword_ids: readonly string[];
339
+ keyword_ids: readonly KeywordId[];
317
340
  operation: "set_frequency";
318
341
  frequency?: RankCheckFrequency;
319
342
  schedule?: KeywordScheduleInput;
320
343
  } | {
321
- keyword_ids: readonly string[];
344
+ keyword_ids: readonly KeywordId[];
322
345
  operation: "set_target_url";
323
346
  target_url?: string | null;
324
347
  };
325
348
  export interface KeywordBulkItemResult {
326
- keyword_id: string;
349
+ keyword_id: KeywordId;
327
350
  status: OpenString<"deleted" | "not_found" | "updated">;
328
351
  }
329
352
  export interface KeywordBulkResponse {
@@ -349,7 +372,7 @@ export interface RankedKeywordSuggestion {
349
372
  search_volume: number | null;
350
373
  }
351
374
  export interface RankedKeywordConnection {
352
- id: string;
375
+ id: ConnectionId;
353
376
  label: string;
354
377
  provider: "dataforseo";
355
378
  }
@@ -363,7 +386,7 @@ export interface RankedKeywordSuggestionsResponse {
363
386
  total_count: number | null;
364
387
  }
365
388
  export interface ListRankedKeywordSuggestionsOptions {
366
- connectionId?: string;
389
+ connectionId?: ConnectionId;
367
390
  fresh?: boolean;
368
391
  limit?: number;
369
392
  offset?: number;
@@ -386,7 +409,7 @@ export interface KeywordMetricsRow extends KeywordMetrics {
386
409
  keyword: string;
387
410
  }
388
411
  export interface KeywordResearchConnection {
389
- id: string;
412
+ id: ConnectionId;
390
413
  label: string;
391
414
  provider: string;
392
415
  }
@@ -493,7 +516,7 @@ export interface KeywordResearchResponse {
493
516
  total_count: number;
494
517
  }
495
518
  export interface ResearchKeywordsOptions {
496
- connectionId?: string;
519
+ connectionId?: ConnectionId;
497
520
  estimateOnly?: boolean;
498
521
  fresh?: boolean;
499
522
  includeClickstream?: boolean;
@@ -503,7 +526,7 @@ export interface ResearchKeywordsOptions {
503
526
  seed: string;
504
527
  }
505
528
  export interface GetKeywordMetricsInput {
506
- connection_id?: string;
529
+ connection_id?: ConnectionId;
507
530
  estimate_only?: boolean;
508
531
  fresh?: boolean;
509
532
  include_clickstream?: boolean;
@@ -528,9 +551,9 @@ export type RankHistoryExportRange = "30" | "90" | "all";
528
551
  export type RankHistoryExportGranularity = "daily" | "weekly";
529
552
  export interface RankHistoryExportRow {
530
553
  checked_at: string;
531
- id: string;
554
+ id: RankCheckId;
532
555
  keyword: string;
533
- keyword_id: string;
556
+ keyword_id: KeywordId;
534
557
  position: number | null;
535
558
  previous_position: number | null;
536
559
  ranking_url: string | null;
@@ -538,7 +561,7 @@ export interface RankHistoryExportRow {
538
561
  export type RankHistoryExportResponse = ListResponse<RankHistoryExportRow>;
539
562
  interface RankHistoryExportOptions {
540
563
  granularity?: RankHistoryExportGranularity;
541
- keywordIds?: readonly string[];
564
+ keywordIds?: readonly KeywordId[];
542
565
  range?: RankHistoryExportRange;
543
566
  }
544
567
  export interface ExportRankHistoryJsonOptions extends PaginationOptions, RankHistoryExportOptions {
@@ -550,15 +573,14 @@ export interface ExportRankHistoryCsvOptions extends RankHistoryExportOptions {
550
573
  export type SitemapMonitorStatus = "active" | "disabled" | "pending";
551
574
  export interface SitemapMonitorSnapshot {
552
575
  fetched_at: string;
553
- id: string;
554
576
  sitemap_url: string;
555
577
  url_count: number;
556
578
  }
557
579
  export interface SitemapMonitor {
558
580
  enabled: boolean;
559
- id: string;
581
+ id: ProjectId;
560
582
  latest_snapshot: SitemapMonitorSnapshot | null;
561
- project_id: string;
583
+ project_id: ProjectId;
562
584
  sitemap_url: string | null;
563
585
  status: SitemapMonitorStatus;
564
586
  }
@@ -576,8 +598,8 @@ export interface RankCheck {
576
598
  checked_at: string;
577
599
  cost_cents: number | null;
578
600
  error: string | null;
579
- id: string;
580
- keyword_id: string;
601
+ id: RankCheckId;
602
+ keyword_id: KeywordId;
581
603
  position: number | null;
582
604
  previous_position: number | null;
583
605
  provider: string;
@@ -599,15 +621,7 @@ export type AlertConditionType = "change_pct" | "competitor_overtake" | "enters_
599
621
  export type AlertChannel = "email" | "slack" | "webhook";
600
622
  export type AlertTargetType = "all" | "keyword" | "tag";
601
623
  export type AlertSeverity = "info" | "urgent" | "warning";
602
- export interface AlertRuleTarget {
603
- created_at?: string;
604
- id: string;
605
- keyword_id?: string | null;
606
- rule_id?: string;
607
- tag_id?: string | null;
608
- updated_at?: string;
609
- }
610
- export interface AlertRule {
624
+ interface AlertRuleBase {
611
625
  change_pct?: number | string | null;
612
626
  channel?: string;
613
627
  channels: AlertChannel[];
@@ -615,37 +629,52 @@ export interface AlertRule {
615
629
  condition_type: AlertConditionType;
616
630
  competitor_domain?: string | null;
617
631
  created_at?: string;
618
- created_by_id?: string | null;
619
632
  enabled: boolean;
620
633
  fires?: string;
621
- id: string;
634
+ id: AlertRuleId;
622
635
  name: string;
623
636
  period?: string;
624
- project_id?: string;
637
+ recipient_ids: UserId[];
625
638
  scope?: string;
626
639
  serp_feature?: string | null;
627
640
  severity?: AlertSeverity;
628
641
  status?: OpenString<"active" | "paused">;
629
- target_ids?: string[];
630
- target_type: AlertTargetType;
631
- targets?: AlertRuleTarget[];
632
642
  threshold_position?: number | null;
633
643
  top_n?: number | null;
634
644
  updated_at?: string;
635
645
  }
636
- 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 {
637
657
  change_pct?: number | null;
638
658
  channels?: readonly AlertChannel[];
639
659
  condition_type: AlertConditionType;
640
660
  competitor_domain?: string | null;
641
661
  enabled?: boolean;
642
662
  name: string;
663
+ recipient_ids?: readonly UserId[];
643
664
  serp_feature?: string | null;
644
- target_ids?: readonly string[];
645
- target_type?: AlertTargetType;
646
665
  threshold_position?: number | null;
647
666
  top_n?: number | null;
648
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
+ });
649
678
  export type CreateAlertRuleInput = AlertRuleInput;
650
679
  export type UpdateAlertRuleInput = AlertRuleInput;
651
680
  export interface DeleteAlertRuleResponse {
@@ -656,7 +685,7 @@ export interface TriggeredAlert {
656
685
  ctas: string[];
657
686
  current: string;
658
687
  headline: string;
659
- id: string;
688
+ id: AlertId;
660
689
  keyword: string;
661
690
  previous: string;
662
691
  rule: string;
@@ -676,7 +705,7 @@ export type TeamRoleLabel = "Admin" | "Editor" | "Owner" | "Viewer";
676
705
  export interface TeamMember {
677
706
  color: OpenString<"accent" | "blue" | "purple">;
678
707
  email: string;
679
- id: string;
708
+ id: MembershipId;
680
709
  initials: string;
681
710
  name: string;
682
711
  role: TeamRoleLabel;
@@ -685,7 +714,7 @@ export interface TeamMember {
685
714
  export interface TeamInvite {
686
715
  email: string;
687
716
  expires_label: string;
688
- id: string;
717
+ id: InviteId;
689
718
  invited_label: string;
690
719
  role: TeamRoleLabel;
691
720
  role_value: Exclude<TeamRole, "owner">;
@@ -696,26 +725,26 @@ export interface CreateTeamInviteInput {
696
725
  }
697
726
  export interface CreatedTeamInvite {
698
727
  expires_at: string;
699
- id: string;
728
+ id: InviteId;
700
729
  invite_link: string;
701
730
  }
702
731
  export interface RevokedTeamInvite {
703
- id: string;
732
+ id: InviteId;
704
733
  }
705
734
  export type AssignableTeamRole = Exclude<TeamRole, "owner">;
706
735
  export interface UpdateTeamMemberRoleInput {
707
736
  role: AssignableTeamRole;
708
737
  }
709
738
  export interface TeamMemberRoleResult {
710
- id: string;
739
+ id: MembershipId;
711
740
  role: AssignableTeamRole;
712
741
  }
713
742
  export interface TeamMemberMutationResult {
714
- id: string;
743
+ id: MembershipId;
715
744
  }
716
745
  export interface TeamInviteResendResult {
717
746
  expires_at: string;
718
- id: string;
747
+ id: InviteId;
719
748
  invite_link: string;
720
749
  }
721
750
  export type ProviderId = "dataforseo" | "ga4" | "gsc" | "plausible" | "serpapi";
@@ -799,12 +828,12 @@ export interface ProviderConnection {
799
828
  created_at: string;
800
829
  credentials_hash?: string | null;
801
830
  enabled: boolean;
802
- id: string;
831
+ id: ConnectionId;
803
832
  is_primary: boolean;
804
833
  kind: ProviderKind;
805
834
  last_used_at: string | null;
806
835
  priority: number;
807
- project_id: string;
836
+ project_id: ProjectId;
808
837
  provider: OpenString<ProviderId>;
809
838
  status: ProviderStatus;
810
839
  updated_at: string;
@@ -845,8 +874,8 @@ export interface CreateSavedViewInput {
845
874
  export interface SavedView {
846
875
  config: SavedViewConfig;
847
876
  created_at: string;
848
- created_by_id: string | null;
849
- id: string;
877
+ created_by_id: UserId | null;
878
+ id: SavedViewId;
850
879
  name: string;
851
880
  }
852
881
  export interface DeleteSavedViewResponse {
@@ -854,7 +883,7 @@ export interface DeleteSavedViewResponse {
854
883
  }
855
884
  export interface Competitor {
856
885
  domain: string;
857
- id: string;
886
+ id: CompetitorId;
858
887
  initials?: string;
859
888
  label: string | null;
860
889
  }
@@ -868,14 +897,14 @@ export interface RemoveCompetitorResponse {
868
897
  export type CompetitorKind = "Managed" | "You";
869
898
  export interface CompetitorColumn {
870
899
  domain: string;
871
- id?: string;
900
+ id?: CompetitorId;
872
901
  kind: CompetitorKind;
873
902
  label: string;
874
903
  }
875
904
  export interface CompetitorShare {
876
905
  color: string;
877
906
  domain: string;
878
- id?: string;
907
+ id?: CompetitorId;
879
908
  initials: string;
880
909
  kind: CompetitorKind;
881
910
  label: string;
@@ -885,8 +914,11 @@ export interface CompetitorShare {
885
914
  export interface HeadToHeadRow {
886
915
  gap: number | null;
887
916
  keyword: string;
888
- ranks: Record<string, number | null>;
917
+ ranks: CompetitorRankMap;
889
918
  }
919
+ export type CompetitorRankMap = {
920
+ you?: number | null;
921
+ } & Partial<Record<CompetitorId, number | null>>;
890
922
  export interface CompetitorMarket {
891
923
  checked_keyword_count: number;
892
924
  columns: CompetitorColumn[];
@@ -926,7 +958,7 @@ export interface NotificationPreferences {
926
958
  import_in_app: boolean;
927
959
  invite_email: boolean;
928
960
  invite_in_app: boolean;
929
- project_id: string;
961
+ project_id: ProjectId;
930
962
  slack_available?: boolean;
931
963
  webhook_available?: boolean;
932
964
  }
@@ -943,10 +975,8 @@ export interface PageTrafficSnapshot {
943
975
  created_at: string;
944
976
  date: string;
945
977
  engagement_rate: number | null;
946
- id: string;
947
978
  key_events: number | null;
948
979
  path: string;
949
- project_id: string;
950
980
  provider: string;
951
981
  scroll_depth: number | null;
952
982
  sessions: number;
@@ -961,14 +991,14 @@ export interface PageTrafficSnapshotsResponse {
961
991
  total_count: number;
962
992
  }
963
993
  export interface ListSearchPerformanceQueryStatsOptions {
964
- connectionId?: string;
994
+ connectionId?: ConnectionId;
965
995
  endDate: Date | string;
966
996
  limit?: number;
967
997
  query?: string;
968
998
  startDate: Date | string;
969
999
  }
970
1000
  export interface AnalyticsConnection {
971
- id: string;
1001
+ id: ConnectionId;
972
1002
  label: string;
973
1003
  provider: string;
974
1004
  }
@@ -986,7 +1016,7 @@ export interface SearchPerformanceQueryStatsResponse {
986
1016
  }
987
1017
  export type TrafficSyncRunStatus = "succeeded_with_data" | "succeeded_empty" | "deferred_rate_limit" | "failed" | "not_applicable";
988
1018
  export interface TrafficSyncRun {
989
- connection_id: string;
1019
+ connection_id: ConnectionId;
990
1020
  error?: string;
991
1021
  error_class?: string;
992
1022
  provider: string;
@@ -1005,7 +1035,7 @@ export interface TrafficSyncSummary {
1005
1035
  connections: number;
1006
1036
  keyword_snapshots: number;
1007
1037
  page_snapshots: number;
1008
- project_id: string;
1038
+ project_id: ProjectId;
1009
1039
  runs: TrafficSyncRun[];
1010
1040
  skipped: TrafficSyncSkippedConnection[];
1011
1041
  }
@@ -1016,7 +1046,7 @@ export interface CloudImportJob {
1016
1046
  created_at: string | null;
1017
1047
  error: string | null;
1018
1048
  finished_at: string | null;
1019
- id: string | null;
1049
+ id: CloudImportJobId | null;
1020
1050
  progress: number;
1021
1051
  started_at: string | null;
1022
1052
  state: CloudImportState;
@@ -1028,7 +1058,7 @@ export interface ActiveMigrationToken {
1028
1058
  name: string;
1029
1059
  };
1030
1060
  expires_at: string;
1031
- id: string;
1061
+ id: MigrationTokenId;
1032
1062
  scope: MigrationScope;
1033
1063
  single_use: boolean;
1034
1064
  }
@@ -1040,7 +1070,7 @@ export interface MintMigrationTokenInput {
1040
1070
  scope?: MigrationScope;
1041
1071
  }
1042
1072
  export interface RevokedMigrationToken {
1043
- id: string;
1073
+ id: MigrationTokenId;
1044
1074
  revoked_at: string;
1045
1075
  }
1046
1076
  export interface MigrationTokenListMeta extends ListMeta {
@@ -1049,7 +1079,7 @@ export interface MigrationTokenListMeta extends ListMeta {
1049
1079
  export interface MigrationTokenListResponse extends ListResponse<ActiveMigrationToken> {
1050
1080
  meta: MigrationTokenListMeta;
1051
1081
  }
1052
- export type CloudImportSchemaVersion = 1 | 2 | 3;
1082
+ export type CloudImportSchemaVersion = 4;
1053
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";
1054
1084
  export interface CloudImportCompatibility {
1055
1085
  app_version: string;
@@ -1063,121 +1093,92 @@ export interface CloudImportRankingHistory {
1063
1093
  rankingUrl?: string | null;
1064
1094
  }
1065
1095
  export interface CloudImportKeyword {
1066
- country?: CloudImportLocation;
1067
- device?: Device;
1068
- id?: string;
1069
- keyword?: string;
1070
- location?: CloudImportLocation;
1096
+ device: Device;
1097
+ id: KeywordId;
1098
+ keyword: string;
1099
+ location: CloudImportLocation;
1071
1100
  rankingHistory?: CloudImportRankingHistory[];
1072
1101
  tags?: string[];
1073
1102
  target_url?: string | null;
1074
- targetUrl?: string | null;
1075
- text?: string;
1076
1103
  }
1077
1104
  export interface CloudImportCompetitor {
1078
1105
  domain: string;
1106
+ id: CompetitorId;
1079
1107
  label?: string | null;
1080
1108
  }
1081
1109
  export interface CloudImportSavedView {
1082
1110
  config?: unknown;
1111
+ id: SavedViewId;
1083
1112
  name: string;
1084
1113
  surface?: "competitors" | "keywords";
1085
1114
  }
1086
1115
  export type CloudImportAlertChannel = "email" | "slack" | "webhook";
1087
- 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";
1088
1117
  export type CloudImportAlertTargetType = "all" | "keyword" | "tag";
1089
- export interface CloudImportAlertRuleTarget {
1118
+ export interface CloudImportKeywordAlertTarget {
1090
1119
  device?: Device;
1091
1120
  keyword?: string;
1092
- keyword_id?: string;
1093
- keywordId?: string;
1121
+ keyword_id: KeywordId;
1094
1122
  location?: CloudImportLocation;
1095
- tag?: string;
1096
- tag_id?: string;
1097
- tagId?: string;
1098
- type?: "keyword" | "tag";
1123
+ type: "keyword";
1124
+ }
1125
+ export interface CloudImportTagAlertTarget {
1126
+ tag: string;
1127
+ type: "tag";
1099
1128
  }
1129
+ export type CloudImportAlertRuleTarget = CloudImportKeywordAlertTarget | CloudImportTagAlertTarget;
1100
1130
  export interface CloudImportAlertRule {
1101
1131
  change_pct?: number | null;
1102
- changePct?: number | null;
1103
1132
  channels?: CloudImportAlertChannel[];
1104
1133
  competitor_domain?: string | null;
1105
- competitorDomain?: string | null;
1106
1134
  condition_type?: CloudImportAlertConditionType;
1107
- conditionType?: CloudImportAlertConditionType;
1135
+ drop_positions?: number | null;
1108
1136
  enabled?: boolean;
1137
+ id: AlertRuleId;
1109
1138
  name: string;
1110
1139
  serp_feature?: string | null;
1111
- serpFeature?: string | null;
1112
1140
  target_type?: CloudImportAlertTargetType;
1113
1141
  targets?: CloudImportAlertRuleTarget[];
1114
- targetType?: CloudImportAlertTargetType;
1115
1142
  threshold_position?: number | null;
1116
- thresholdPosition?: number | null;
1117
1143
  top_n?: number | null;
1118
- topN?: number | null;
1119
1144
  }
1120
1145
  export interface CloudImportNotificationPreference {
1121
1146
  alert_email?: boolean;
1122
1147
  alert_in_app?: boolean;
1123
- alertEmail?: boolean;
1124
- alertInApp?: boolean;
1125
1148
  check_email?: boolean;
1126
1149
  check_in_app?: boolean;
1127
- checkEmail?: boolean;
1128
- checkInApp?: boolean;
1129
1150
  import_email?: boolean;
1130
1151
  import_in_app?: boolean;
1131
- importEmail?: boolean;
1132
- importInApp?: boolean;
1133
1152
  invite_email?: boolean;
1134
1153
  invite_in_app?: boolean;
1135
- inviteEmail?: boolean;
1136
- inviteInApp?: boolean;
1137
- }
1138
- export interface CloudImportTopLevelRankCheck {
1139
- checked_at?: string;
1140
- checkedAt?: string;
1141
- keyword?: string;
1142
- keyword_id?: string;
1143
- keywordId?: string;
1144
- position?: number | null;
1145
- previous_position?: number | null;
1146
- previousPosition?: number | null;
1147
- ranking_url?: string | null;
1148
- rankingUrl?: string | null;
1149
- text?: string;
1154
+ report_email?: boolean;
1150
1155
  }
1151
1156
  export type CloudImportScope = "current" | "history";
1152
1157
  export interface CloudImportPackage {
1153
- alert_rules?: CloudImportAlertRule[];
1154
- alertRules?: CloudImportAlertRule[];
1155
- competitors?: CloudImportCompetitor[];
1156
- exportedAt?: string;
1157
- keywords?: CloudImportKeyword[];
1158
- notification_preferences?: CloudImportNotificationPreference[];
1159
- notificationPreferences?: CloudImportNotificationPreference[];
1160
- projectId?: string;
1161
- rank_checks?: CloudImportTopLevelRankCheck[];
1162
- saved_views?: CloudImportSavedView[];
1163
- 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[];
1164
1165
  scope?: CloudImportScope;
1165
- version?: number;
1166
- [key: string]: unknown;
1166
+ version: CloudImportSchemaVersion;
1167
1167
  }
1168
1168
  export type CloudImportCounts = Record<string, number>;
1169
1169
  export interface CloudImportFinalizeResponse {
1170
1170
  counts: CloudImportCounts;
1171
- job_id: string;
1171
+ job_id: CloudImportJobId;
1172
1172
  state: "done";
1173
1173
  }
1174
1174
  export interface CloudImportSessionCreate {
1175
1175
  chunk_count: number;
1176
+ source_project_id: ProjectId;
1176
1177
  totals?: {
1177
1178
  keywords?: number;
1178
1179
  rank_checks?: number;
1179
1180
  };
1180
- version: 3;
1181
+ version: CloudImportSchemaVersion;
1181
1182
  }
1182
1183
  export interface CloudImportSessionCreateResponse {
1183
1184
  chunk_limits: {
@@ -1185,7 +1186,7 @@ export interface CloudImportSessionCreateResponse {
1185
1186
  max_history_rows: number;
1186
1187
  max_keywords: number;
1187
1188
  };
1188
- session_id: string;
1189
+ session_id: CloudImportJobId;
1189
1190
  state: "receiving";
1190
1191
  }
1191
1192
  export interface CloudImportSourceKeyword {
@@ -1195,15 +1196,10 @@ export interface CloudImportSourceKeyword {
1195
1196
  }
1196
1197
  export interface CloudImportSessionSections {
1197
1198
  alert_rules?: CloudImportAlertRule[];
1198
- alertRules?: CloudImportAlertRule[];
1199
1199
  competitors?: CloudImportCompetitor[];
1200
1200
  notification_preferences?: CloudImportNotificationPreference[];
1201
- notificationPreferences?: CloudImportNotificationPreference[];
1202
1201
  saved_views?: CloudImportSavedView[];
1203
- savedViews?: CloudImportSavedView[];
1204
- source_keyword_ids?: Record<string, CloudImportSourceKeyword>;
1205
- sourceKeywordIds?: Record<string, CloudImportSourceKeyword>;
1206
- [key: string]: unknown;
1202
+ source_keyword_ids?: Partial<Record<KeywordId, CloudImportSourceKeyword>>;
1207
1203
  }
1208
1204
  export interface CloudImportKeywordsChunk {
1209
1205
  checksum: string;
@@ -1231,11 +1227,11 @@ export type SignalSeverity = "critical" | "info" | "warning";
1231
1227
  export interface Signal {
1232
1228
  created_at: string;
1233
1229
  happened_at: string;
1234
- id: string;
1235
- keyword_id: string | null;
1230
+ id: SignalId;
1231
+ keyword_id: KeywordId | null;
1236
1232
  payload: JsonObject | null;
1237
- project_id: string;
1238
- public_id: string;
1233
+ project_id: ProjectId;
1234
+ public_id: SignalId;
1239
1235
  severity: SignalSeverity;
1240
1236
  source: SignalSource;
1241
1237
  type: string;
@@ -1244,7 +1240,7 @@ export interface Signal {
1244
1240
  export interface CreateSignalInput {
1245
1241
  /** ISO-8601 date-time when the signal happened. Defaults to now on the server. */
1246
1242
  happened_at?: string;
1247
- keyword_id?: string;
1243
+ keyword_id?: KeywordId;
1248
1244
  /** JSON object payload. Ingestion rejects serialized payloads above 8KB. */
1249
1245
  payload?: JsonObject;
1250
1246
  severity?: SignalSeverity;
@@ -1366,10 +1362,10 @@ export interface BisibilityClientConfig {
1366
1362
  /** Number of retries after the initial attempt. Defaults to 2; 0 disables retries. */
1367
1363
  maxRetries?: number;
1368
1364
  /**
1369
- * 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.
1370
1366
  * Targets personal access token requests at a project on routes without one in the path.
1371
1367
  */
1372
- projectId?: string;
1368
+ projectId?: ProjectId;
1373
1369
  /** Per-attempt timeout in milliseconds. Defaults to 30 seconds; null disables it. */
1374
1370
  timeout?: number | null;
1375
1371
  }