@bisibility/sdk 0.1.0 → 0.1.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/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type Device = "desktop" | "mobile";
2
- export type RankCheckFrequency = "paused" | "manual" | "daily" | "weekly" | "custom_cron";
2
+ export type RankCheckFrequency = "paused" | "manual" | "daily" | "weekly" | "monthly" | "custom_cron";
3
3
  export type JsonObject = Record<string, unknown>;
4
4
  export type RequestHeaders = HeadersInit;
5
5
  export interface ProblemDetails {
@@ -27,7 +27,7 @@ export interface PaginationOptions {
27
27
  cursor?: string;
28
28
  limit?: number;
29
29
  }
30
- export type ProjectWriteMode = "active" | "migration_hold";
30
+ export type ProjectWriteMode = "active" | "migration_hold" | "migrated";
31
31
  export interface Project {
32
32
  created_at: string;
33
33
  domain: string;
@@ -67,13 +67,32 @@ export interface ProjectDefaultsPatch {
67
67
  timezone?: string;
68
68
  }
69
69
  export type TrackingScope = "city" | "country";
70
+ export type LocationKind = "city" | "country" | "region";
71
+ export interface LocationSuggestion {
72
+ city_name: string | null;
73
+ country_code: string;
74
+ display_name: string;
75
+ hl: string;
76
+ id: string;
77
+ kind: LocationKind;
78
+ language_label: string;
79
+ location_key: string;
80
+ region_code: string | null;
81
+ region_name: string | null;
82
+ }
83
+ export type LocationSuggestionsResponse = ListResponse<LocationSuggestion>;
84
+ export interface SearchLocationsOptions {
85
+ country?: string;
86
+ limit?: number;
87
+ q: string;
88
+ }
70
89
  export interface CreateProjectInput {
71
90
  /** Initial rank-check schedule defaults for the project. */
72
91
  defaults?: ProjectDefaultsPatch;
73
92
  domain: string;
74
93
  name: string;
75
94
  /** Location granularity for rank tracking. Defaults to "country" on the server. */
76
- trackingScope?: TrackingScope;
95
+ tracking_scope?: TrackingScope;
77
96
  }
78
97
  export interface ApiKey {
79
98
  created_at: string;
@@ -120,7 +139,7 @@ export interface CreatedPersonalAccessToken extends PersonalAccessToken {
120
139
  }
121
140
  export interface CreateMyTokenInput {
122
141
  /** Days until the token expires, or null for no expiry. Defaults to null. */
123
- expiresInDays?: 30 | 90 | 365 | null;
142
+ expires_in_days?: 30 | 90 | 365 | null;
124
143
  name: string;
125
144
  /** Token scope. Defaults to "read" on the server. */
126
145
  scope?: PersonalAccessTokenScope;
@@ -176,10 +195,10 @@ export interface Keyword {
176
195
  updated_at: string;
177
196
  }
178
197
  export interface KeywordScheduleInput {
179
- autoSchedule?: boolean;
180
- cronExpression: string | null;
198
+ auto_schedule?: boolean;
199
+ cron_expression: string | null;
181
200
  frequency: RankCheckFrequency;
182
- jitterMinutes?: number;
201
+ jitter_minutes?: number;
183
202
  timezone?: string;
184
203
  }
185
204
  export interface CreateKeywordInput {
@@ -262,6 +281,157 @@ export interface ListKeywordsOptions extends PaginationOptions {
262
281
  tag?: string;
263
282
  topic?: string;
264
283
  }
284
+ export interface RankedKeywordSuggestion {
285
+ already_tracked: boolean;
286
+ estimated_traffic: number | null;
287
+ keyword: string;
288
+ position: number | null;
289
+ search_volume: number | null;
290
+ }
291
+ export interface RankedKeywordConnection {
292
+ id: string;
293
+ label: string;
294
+ provider: "dataforseo";
295
+ }
296
+ export interface RankedKeywordSuggestionsResponse {
297
+ cached: boolean;
298
+ connections: RankedKeywordConnection[];
299
+ cost_cents: number;
300
+ fetched_at: string;
301
+ offset: number;
302
+ rows: RankedKeywordSuggestion[];
303
+ total_count: number | null;
304
+ }
305
+ export interface ListRankedKeywordSuggestionsOptions {
306
+ connectionId?: string;
307
+ fresh?: boolean;
308
+ limit?: number;
309
+ offset?: number;
310
+ }
311
+ export type KeywordMetricsIntent = "informational" | "commercial" | "transactional" | "navigational" | "unknown";
312
+ export interface KeywordMonthlyTrend {
313
+ month: number;
314
+ search_volume: number | null;
315
+ year: number;
316
+ }
317
+ export interface KeywordMetrics {
318
+ competition: number | null;
319
+ cpc_cents: number | null;
320
+ difficulty: number | null;
321
+ intent: KeywordMetricsIntent | null;
322
+ monthly_trend: KeywordMonthlyTrend[];
323
+ search_volume: number | null;
324
+ }
325
+ export interface KeywordMetricsRow extends KeywordMetrics {
326
+ keyword: string;
327
+ }
328
+ export interface KeywordResearchConnection {
329
+ id: string;
330
+ label: string;
331
+ provider: string;
332
+ }
333
+ export type KeywordResearchMode = "auto" | "related" | "suggestions" | "ideas";
334
+ export type KeywordResearchResultLimit = 100 | 300 | 500;
335
+ export type KeywordResearchSource = "related" | "suggestion" | "idea";
336
+ export type KeywordResearchSourceReason = "budget_exhausted" | "cost_limit" | "in_progress" | "needs_reauth" | "no_source" | "previous_source_failed" | "provider_error" | "rate_limited" | "result_limit" | "unsupported_location";
337
+ export type KeywordResearchSourceStatus = "ok" | "failed" | "skipped";
338
+ export interface KeywordResearchRow extends KeywordMetricsRow {
339
+ already_tracked: boolean;
340
+ source: KeywordResearchSource;
341
+ }
342
+ export interface KeywordResearchSourceDiagnostic {
343
+ cached: boolean;
344
+ cost_cents: number;
345
+ reason?: KeywordResearchSourceReason;
346
+ returned: number;
347
+ source: KeywordResearchSource;
348
+ status: KeywordResearchSourceStatus;
349
+ }
350
+ export interface KeywordResearchResponse {
351
+ cached: boolean;
352
+ connections: KeywordResearchConnection[];
353
+ cost_cents: number;
354
+ estimate?: boolean;
355
+ fetched_at: string;
356
+ provider: string;
357
+ rows: KeywordResearchRow[];
358
+ sources: KeywordResearchSourceDiagnostic[];
359
+ total_count: number;
360
+ }
361
+ export interface ResearchKeywordsOptions {
362
+ connectionId?: string;
363
+ estimateOnly?: boolean;
364
+ fresh?: boolean;
365
+ includeClickstream?: boolean;
366
+ maxCostCents?: number;
367
+ mode?: KeywordResearchMode;
368
+ resultLimit?: KeywordResearchResultLimit;
369
+ seed: string;
370
+ }
371
+ export interface GetKeywordMetricsInput {
372
+ connection_id?: string;
373
+ estimate_only?: boolean;
374
+ fresh?: boolean;
375
+ include_clickstream?: boolean;
376
+ /** One to 700 keyword strings. */
377
+ keywords: readonly string[];
378
+ max_cost_cents?: number;
379
+ }
380
+ export interface KeywordMetricsResponse {
381
+ cached_count: number;
382
+ connections: KeywordResearchConnection[];
383
+ cost_cents: number;
384
+ estimate?: boolean;
385
+ estimated_cost_cents?: number;
386
+ fetched_at: string;
387
+ fetched_count: number;
388
+ fetched_count_estimate?: number;
389
+ provider: string;
390
+ rows: KeywordMetricsRow[];
391
+ total_count: number;
392
+ }
393
+ export type RankHistoryExportRange = "30" | "90" | "all";
394
+ export type RankHistoryExportGranularity = "daily" | "weekly";
395
+ export interface RankHistoryExportRow {
396
+ checked_at: string;
397
+ id: string;
398
+ keyword: string;
399
+ keyword_id: string;
400
+ position: number | null;
401
+ previous_position: number | null;
402
+ ranking_url: string | null;
403
+ }
404
+ export type RankHistoryExportResponse = ListResponse<RankHistoryExportRow>;
405
+ interface RankHistoryExportOptions {
406
+ granularity?: RankHistoryExportGranularity;
407
+ keywordIds?: readonly string[];
408
+ range?: RankHistoryExportRange;
409
+ }
410
+ export interface ExportRankHistoryJsonOptions extends PaginationOptions, RankHistoryExportOptions {
411
+ format?: "json";
412
+ }
413
+ export interface ExportRankHistoryCsvOptions extends RankHistoryExportOptions {
414
+ format: "csv";
415
+ }
416
+ export type SitemapMonitorStatus = "active" | "disabled" | "pending";
417
+ export interface SitemapMonitorSnapshot {
418
+ fetched_at: string;
419
+ id: string;
420
+ sitemap_url: string;
421
+ url_count: number;
422
+ }
423
+ export interface SitemapMonitor {
424
+ enabled: boolean;
425
+ id: string;
426
+ latest_snapshot: SitemapMonitorSnapshot | null;
427
+ project_id: string;
428
+ sitemap_url: string | null;
429
+ status: SitemapMonitorStatus;
430
+ }
431
+ export type SitemapMonitorListResponse = ListResponse<SitemapMonitor>;
432
+ export interface UpdateSitemapMonitorInput {
433
+ enabled: boolean;
434
+ }
265
435
  export type RankCheckStatus = "completed" | "failed" | "running";
266
436
  export interface RankCheckAttempt {
267
437
  message: string;
@@ -360,6 +530,13 @@ export interface TriggeredAlert {
360
530
  unread: boolean;
361
531
  when: string;
362
532
  }
533
+ export interface TriggeredAlertMuteResult {
534
+ muted: true;
535
+ snoozed_until: string | null;
536
+ }
537
+ export interface TriggeredAlertsReadResult {
538
+ updated: number;
539
+ }
363
540
  export type TeamRole = "admin" | "member" | "owner" | "viewer";
364
541
  export type TeamRoleLabel = "Admin" | "Editor" | "Owner" | "Viewer";
365
542
  export interface TeamMember {
@@ -391,6 +568,22 @@ export interface CreatedTeamInvite {
391
568
  export interface RevokedTeamInvite {
392
569
  id: string;
393
570
  }
571
+ export type AssignableTeamRole = Exclude<TeamRole, "owner">;
572
+ export interface UpdateTeamMemberRoleInput {
573
+ role: AssignableTeamRole;
574
+ }
575
+ export interface TeamMemberRoleResult {
576
+ id: string;
577
+ role: AssignableTeamRole;
578
+ }
579
+ export interface TeamMemberMutationResult {
580
+ id: string;
581
+ }
582
+ export interface TeamInviteResendResult {
583
+ expires_at: string;
584
+ id: string;
585
+ invite_link: string;
586
+ }
394
587
  export type ProviderId = "dataforseo" | "ga4" | "gsc" | "plausible" | "serpapi";
395
588
  export type ProviderKind = "analytics" | "enrichment" | "serp";
396
589
  export type ProviderStatus = OpenString<"connected" | "optional" | "planned" | "ready">;
@@ -604,6 +797,84 @@ export interface NotificationPreferences {
604
797
  webhook_available?: boolean;
605
798
  }
606
799
  export type UpdateNotificationPreferencesInput = Partial<Pick<NotificationPreferences, "alert_email" | "alert_in_app" | "alert_slack" | "alert_webhook" | "check_email" | "check_in_app" | "import_email" | "import_in_app" | "invite_email" | "invite_in_app">>;
800
+ export interface ListTrafficSnapshotsOptions {
801
+ endDate: Date | string;
802
+ limit?: number;
803
+ offset?: number;
804
+ paths?: readonly string[];
805
+ startDate: Date | string;
806
+ }
807
+ export interface PageTrafficSnapshot {
808
+ bounce_rate: number | null;
809
+ created_at: string;
810
+ date: string;
811
+ engagement_rate: number | null;
812
+ id: string;
813
+ key_events: number | null;
814
+ path: string;
815
+ project_id: string;
816
+ provider: string;
817
+ scroll_depth: number | null;
818
+ sessions: number;
819
+ updated_at: string;
820
+ visit_duration_seconds: number | null;
821
+ visitors: number | null;
822
+ window_days: number;
823
+ }
824
+ export interface PageTrafficSnapshotsResponse {
825
+ offset: number;
826
+ rows: PageTrafficSnapshot[];
827
+ total_count: number;
828
+ }
829
+ export interface ListSearchPerformanceQueryStatsOptions {
830
+ connectionId?: string;
831
+ endDate: Date | string;
832
+ limit?: number;
833
+ query?: string;
834
+ startDate: Date | string;
835
+ }
836
+ export interface AnalyticsConnection {
837
+ id: string;
838
+ label: string;
839
+ provider: string;
840
+ }
841
+ export interface SearchPerformanceQueryStat {
842
+ clicks: number;
843
+ ctr: number;
844
+ impressions: number;
845
+ page?: string | null;
846
+ position: number;
847
+ query: string;
848
+ }
849
+ export interface SearchPerformanceQueryStatsResponse {
850
+ connection: AnalyticsConnection;
851
+ rows: SearchPerformanceQueryStat[];
852
+ }
853
+ export type TrafficSyncRunStatus = "succeeded_with_data" | "succeeded_empty" | "deferred_rate_limit" | "failed" | "not_applicable";
854
+ export interface TrafficSyncRun {
855
+ connection_id: string;
856
+ error?: string;
857
+ error_class?: string;
858
+ provider: string;
859
+ rows_fetched: number;
860
+ rows_matched: number;
861
+ rows_upserted: number;
862
+ status: TrafficSyncRunStatus;
863
+ truncated: boolean;
864
+ }
865
+ export type TrafficSyncSkippedReason = "no_capability" | "rate_limited";
866
+ export interface TrafficSyncSkippedConnection {
867
+ provider: string;
868
+ reason: TrafficSyncSkippedReason;
869
+ }
870
+ export interface TrafficSyncSummary {
871
+ connections: number;
872
+ keyword_snapshots: number;
873
+ page_snapshots: number;
874
+ project_id: string;
875
+ runs: TrafficSyncRun[];
876
+ skipped: TrafficSyncSkippedConnection[];
877
+ }
607
878
  export type MigrationScope = "full" | "keywords";
608
879
  export type CloudImportState = "done" | "failed" | "idle" | "importing" | "receiving";
609
880
  export interface CloudImportJob {
@@ -644,6 +915,182 @@ export interface MigrationTokenListMeta extends ListMeta {
644
915
  export interface MigrationTokenListResponse extends ListResponse<ActiveMigrationToken> {
645
916
  meta: MigrationTokenListMeta;
646
917
  }
918
+ export type CloudImportSchemaVersion = 1 | 2 | 3;
919
+ 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";
920
+ export interface CloudImportCompatibility {
921
+ app_version: string;
922
+ latest_migration: string | null;
923
+ schema_versions_supported: CloudImportSchemaVersion[];
924
+ }
925
+ export interface CloudImportRankingHistory {
926
+ checkedAt: string;
927
+ position?: number | null;
928
+ previousPosition?: number | null;
929
+ rankingUrl?: string | null;
930
+ }
931
+ export interface CloudImportKeyword {
932
+ country?: CloudImportLocation;
933
+ device?: Device;
934
+ id?: string;
935
+ keyword?: string;
936
+ location?: CloudImportLocation;
937
+ rankingHistory?: CloudImportRankingHistory[];
938
+ tags?: string[];
939
+ target_url?: string | null;
940
+ targetUrl?: string | null;
941
+ text?: string;
942
+ }
943
+ export interface CloudImportCompetitor {
944
+ domain: string;
945
+ label?: string | null;
946
+ }
947
+ export interface CloudImportSavedView {
948
+ config?: unknown;
949
+ name: string;
950
+ surface?: "competitors" | "keywords";
951
+ }
952
+ export type CloudImportAlertChannel = "email" | "slack" | "webhook";
953
+ export type CloudImportAlertConditionType = "change_pct" | "competitor_overtake" | "enters_top_n" | "exits_top_n" | "serp_feature" | "threshold";
954
+ export type CloudImportAlertTargetType = "all" | "keyword" | "tag";
955
+ export interface CloudImportAlertRuleTarget {
956
+ device?: Device;
957
+ keyword?: string;
958
+ keyword_id?: string;
959
+ keywordId?: string;
960
+ location?: CloudImportLocation;
961
+ tag?: string;
962
+ tag_id?: string;
963
+ tagId?: string;
964
+ type?: "keyword" | "tag";
965
+ }
966
+ export interface CloudImportAlertRule {
967
+ change_pct?: number | null;
968
+ changePct?: number | null;
969
+ channels?: CloudImportAlertChannel[];
970
+ competitor_domain?: string | null;
971
+ competitorDomain?: string | null;
972
+ condition_type?: CloudImportAlertConditionType;
973
+ conditionType?: CloudImportAlertConditionType;
974
+ enabled?: boolean;
975
+ name: string;
976
+ serp_feature?: string | null;
977
+ serpFeature?: string | null;
978
+ target_type?: CloudImportAlertTargetType;
979
+ targets?: CloudImportAlertRuleTarget[];
980
+ targetType?: CloudImportAlertTargetType;
981
+ threshold_position?: number | null;
982
+ thresholdPosition?: number | null;
983
+ top_n?: number | null;
984
+ topN?: number | null;
985
+ }
986
+ export interface CloudImportNotificationPreference {
987
+ alert_email?: boolean;
988
+ alert_in_app?: boolean;
989
+ alertEmail?: boolean;
990
+ alertInApp?: boolean;
991
+ check_email?: boolean;
992
+ check_in_app?: boolean;
993
+ checkEmail?: boolean;
994
+ checkInApp?: boolean;
995
+ import_email?: boolean;
996
+ import_in_app?: boolean;
997
+ importEmail?: boolean;
998
+ importInApp?: boolean;
999
+ invite_email?: boolean;
1000
+ invite_in_app?: boolean;
1001
+ inviteEmail?: boolean;
1002
+ inviteInApp?: boolean;
1003
+ }
1004
+ export interface CloudImportTopLevelRankCheck {
1005
+ checked_at?: string;
1006
+ checkedAt?: string;
1007
+ keyword?: string;
1008
+ keyword_id?: string;
1009
+ keywordId?: string;
1010
+ position?: number | null;
1011
+ previous_position?: number | null;
1012
+ previousPosition?: number | null;
1013
+ ranking_url?: string | null;
1014
+ rankingUrl?: string | null;
1015
+ text?: string;
1016
+ }
1017
+ export type CloudImportScope = "current" | "history";
1018
+ export interface CloudImportPackage {
1019
+ alert_rules?: CloudImportAlertRule[];
1020
+ alertRules?: CloudImportAlertRule[];
1021
+ competitors?: CloudImportCompetitor[];
1022
+ exportedAt?: string;
1023
+ keywords?: CloudImportKeyword[];
1024
+ notification_preferences?: CloudImportNotificationPreference[];
1025
+ notificationPreferences?: CloudImportNotificationPreference[];
1026
+ projectId?: string;
1027
+ rank_checks?: CloudImportTopLevelRankCheck[];
1028
+ saved_views?: CloudImportSavedView[];
1029
+ savedViews?: CloudImportSavedView[];
1030
+ scope?: CloudImportScope;
1031
+ version?: number;
1032
+ [key: string]: unknown;
1033
+ }
1034
+ export type CloudImportCounts = Record<string, number>;
1035
+ export interface CloudImportFinalizeResponse {
1036
+ counts: CloudImportCounts;
1037
+ job_id: string;
1038
+ state: "done";
1039
+ }
1040
+ export interface CloudImportSessionCreate {
1041
+ chunk_count: number;
1042
+ totals?: {
1043
+ keywords?: number;
1044
+ rank_checks?: number;
1045
+ };
1046
+ version: 3;
1047
+ }
1048
+ export interface CloudImportSessionCreateResponse {
1049
+ chunk_limits: {
1050
+ max_body_bytes: number;
1051
+ max_history_rows: number;
1052
+ max_keywords: number;
1053
+ };
1054
+ session_id: string;
1055
+ state: "receiving";
1056
+ }
1057
+ export interface CloudImportSourceKeyword {
1058
+ device: Device;
1059
+ location: CloudImportLocation;
1060
+ text: string;
1061
+ }
1062
+ export interface CloudImportSessionSections {
1063
+ alert_rules?: CloudImportAlertRule[];
1064
+ alertRules?: CloudImportAlertRule[];
1065
+ competitors?: CloudImportCompetitor[];
1066
+ notification_preferences?: CloudImportNotificationPreference[];
1067
+ notificationPreferences?: CloudImportNotificationPreference[];
1068
+ saved_views?: CloudImportSavedView[];
1069
+ savedViews?: CloudImportSavedView[];
1070
+ source_keyword_ids?: Record<string, CloudImportSourceKeyword>;
1071
+ sourceKeywordIds?: Record<string, CloudImportSourceKeyword>;
1072
+ [key: string]: unknown;
1073
+ }
1074
+ export interface CloudImportKeywordsChunk {
1075
+ checksum: string;
1076
+ keywords: CloudImportKeyword[];
1077
+ kind: "keywords";
1078
+ }
1079
+ export interface CloudImportSectionsChunk {
1080
+ checksum: string;
1081
+ kind: "sections";
1082
+ sections: CloudImportSessionSections;
1083
+ }
1084
+ export type CloudImportUploadChunk = CloudImportKeywordsChunk | CloudImportSectionsChunk;
1085
+ export interface UploadCloudImportChunkOptions extends RequestOptions {
1086
+ /** Set to "gzip" when the JSON chunk body is gzip compressed. */
1087
+ contentEncoding?: "gzip";
1088
+ }
1089
+ export interface CloudImportChunkResponse {
1090
+ chunk_count: number;
1091
+ chunks_received: number;
1092
+ state: "receiving";
1093
+ }
647
1094
  export type SignalSource = "api" | "cms" | "deploy" | "manual" | "rank_tracker" | "search_analytics" | "search_engine_status" | "sitemap" | "url_inspection";
648
1095
  export type CreateSignalSource = "api" | "cms" | "deploy";
649
1096
  export type SignalSeverity = "critical" | "info" | "warning";
@@ -774,19 +1221,23 @@ export interface RequestOptions {
774
1221
  headers?: RequestHeaders;
775
1222
  idempotencyKey?: string;
776
1223
  signal?: AbortSignal;
777
- /** Milliseconds before the request is aborted. Composed with any user-provided signal. */
778
- timeout?: number;
1224
+ /** Milliseconds before the request is aborted. Null disables the timeout. */
1225
+ timeout?: number | null;
779
1226
  }
780
1227
  export interface BisibilityClientConfig {
781
1228
  apiKey?: string;
782
1229
  baseUrl?: string | URL;
783
1230
  fetch?: FetchLike;
784
1231
  headers?: RequestHeaders;
1232
+ /** Number of retries after the initial attempt. Defaults to 2; 0 disables retries. */
1233
+ maxRetries?: number;
785
1234
  /**
786
1235
  * Project id or public id sent as the X-Bisibility-Project header on every request.
787
1236
  * Targets personal access token requests at a project on routes without one in the path.
788
1237
  */
789
1238
  projectId?: string;
1239
+ /** Per-attempt timeout in milliseconds. Defaults to 30 seconds; null disables it. */
1240
+ timeout?: number | null;
790
1241
  }
791
1242
  export type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
792
1243
  export {};