@adwait12345/telemetry-core 0.1.0 → 0.1.3
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/index.d.mts +28 -4
- package/dist/index.d.ts +28 -4
- package/dist/index.js +898 -73
- package/dist/index.mjs +886 -73
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -65,6 +65,18 @@ interface TelemetryConfig {
|
|
|
65
65
|
* This is required since these requests originate from the server and cannot pass domain validation checks via Origin.
|
|
66
66
|
*/
|
|
67
67
|
serverSecret?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Fully custom Authorization header value.
|
|
70
|
+
* Overrides the default "Bearer {serverSecret}" format.
|
|
71
|
+
* e.g. "Token mytoken" or "Basic dXNlcjpwYXNz"
|
|
72
|
+
*/
|
|
73
|
+
authorizationHeader?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Additional custom headers to send with every telemetry request.
|
|
76
|
+
* These are merged on top of the defaults and can override them.
|
|
77
|
+
* e.g. { "x-workspace-id": "abc123" }
|
|
78
|
+
*/
|
|
79
|
+
headers?: Record<string, string>;
|
|
68
80
|
}
|
|
69
81
|
/** Payload sent to the Telemetry server-side tracking endpoint */
|
|
70
82
|
interface ServerTrackPayload {
|
|
@@ -108,7 +120,7 @@ declare function extractAutomationHeaders(headers: Record<string, string | strin
|
|
|
108
120
|
* Known bot definitions with categories and detection metadata.
|
|
109
121
|
* Order matters — more specific patterns are listed first.
|
|
110
122
|
*/
|
|
111
|
-
type BotCategory = "ai-crawler" | "search" | "
|
|
123
|
+
type BotCategory = "ai-crawler" | "ai-assistant" | "search" | "seo" | "advertising" | "monitor" | "preview" | "webhook" | "feed" | "ecommerce" | "verification" | "analytics" | "social" | "accessibility" | "scraper" | "unknown";
|
|
112
124
|
interface BotDefinition {
|
|
113
125
|
/** Human-readable name shown in the dashboard */
|
|
114
126
|
name: string;
|
|
@@ -123,18 +135,30 @@ interface BotDefinition {
|
|
|
123
135
|
verifiable: boolean;
|
|
124
136
|
}
|
|
125
137
|
declare const AI_BOTS: BotDefinition[];
|
|
138
|
+
declare const AI_ASSISTANT_BOTS: BotDefinition[];
|
|
126
139
|
declare const SEARCH_BOTS: BotDefinition[];
|
|
140
|
+
declare const SEO_BOTS: BotDefinition[];
|
|
141
|
+
declare const ADVERTISING_BOTS: BotDefinition[];
|
|
142
|
+
declare const MONITOR_BOTS: BotDefinition[];
|
|
143
|
+
declare const PREVIEW_BOTS: BotDefinition[];
|
|
144
|
+
declare const WEBHOOK_BOTS: BotDefinition[];
|
|
145
|
+
declare const FEED_BOTS: BotDefinition[];
|
|
146
|
+
declare const ECOMMERCE_BOTS: BotDefinition[];
|
|
147
|
+
declare const VERIFICATION_BOTS: BotDefinition[];
|
|
148
|
+
declare const ANALYTICS_BOTS: BotDefinition[];
|
|
149
|
+
declare const SOCIAL_BOTS: BotDefinition[];
|
|
150
|
+
declare const ACCESSIBILITY_BOTS: BotDefinition[];
|
|
127
151
|
declare const GENERIC_BOTS: BotDefinition[];
|
|
128
|
-
/** All known bots —
|
|
152
|
+
/** All known bots — ordered from most specific to most generic */
|
|
129
153
|
declare const ALL_BOTS: BotDefinition[];
|
|
130
154
|
|
|
131
155
|
/**
|
|
132
156
|
* Sends a server-side payload to the Telemetry backend.
|
|
133
|
-
*
|
|
157
|
+
* Automatically retries on transient failures with exponential backoff.
|
|
134
158
|
*
|
|
135
159
|
* @param payload The data to track.
|
|
136
160
|
* @param config The Telemetry configuration.
|
|
137
161
|
*/
|
|
138
162
|
declare function sendToTelemetry(payload: ServerTrackPayload, config: TelemetryConfig): Promise<void>;
|
|
139
163
|
|
|
140
|
-
export { AI_BOTS, ALL_BOTS, type BotCategory, type BotDefinition, type BotDetectionResult, type DetectionConfidence, type DetectionMethod, GENERIC_BOTS, type NormalizedRequest, SEARCH_BOTS, type ServerTrackPayload, type TelemetryConfig, detectBot, extractAutomationHeaders, sendToTelemetry };
|
|
164
|
+
export { ACCESSIBILITY_BOTS, ADVERTISING_BOTS, AI_ASSISTANT_BOTS, AI_BOTS, ALL_BOTS, ANALYTICS_BOTS, type BotCategory, type BotDefinition, type BotDetectionResult, type DetectionConfidence, type DetectionMethod, ECOMMERCE_BOTS, FEED_BOTS, GENERIC_BOTS, MONITOR_BOTS, type NormalizedRequest, PREVIEW_BOTS, SEARCH_BOTS, SEO_BOTS, SOCIAL_BOTS, type ServerTrackPayload, type TelemetryConfig, VERIFICATION_BOTS, WEBHOOK_BOTS, detectBot, extractAutomationHeaders, sendToTelemetry };
|
package/dist/index.d.ts
CHANGED
|
@@ -65,6 +65,18 @@ interface TelemetryConfig {
|
|
|
65
65
|
* This is required since these requests originate from the server and cannot pass domain validation checks via Origin.
|
|
66
66
|
*/
|
|
67
67
|
serverSecret?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Fully custom Authorization header value.
|
|
70
|
+
* Overrides the default "Bearer {serverSecret}" format.
|
|
71
|
+
* e.g. "Token mytoken" or "Basic dXNlcjpwYXNz"
|
|
72
|
+
*/
|
|
73
|
+
authorizationHeader?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Additional custom headers to send with every telemetry request.
|
|
76
|
+
* These are merged on top of the defaults and can override them.
|
|
77
|
+
* e.g. { "x-workspace-id": "abc123" }
|
|
78
|
+
*/
|
|
79
|
+
headers?: Record<string, string>;
|
|
68
80
|
}
|
|
69
81
|
/** Payload sent to the Telemetry server-side tracking endpoint */
|
|
70
82
|
interface ServerTrackPayload {
|
|
@@ -108,7 +120,7 @@ declare function extractAutomationHeaders(headers: Record<string, string | strin
|
|
|
108
120
|
* Known bot definitions with categories and detection metadata.
|
|
109
121
|
* Order matters — more specific patterns are listed first.
|
|
110
122
|
*/
|
|
111
|
-
type BotCategory = "ai-crawler" | "search" | "
|
|
123
|
+
type BotCategory = "ai-crawler" | "ai-assistant" | "search" | "seo" | "advertising" | "monitor" | "preview" | "webhook" | "feed" | "ecommerce" | "verification" | "analytics" | "social" | "accessibility" | "scraper" | "unknown";
|
|
112
124
|
interface BotDefinition {
|
|
113
125
|
/** Human-readable name shown in the dashboard */
|
|
114
126
|
name: string;
|
|
@@ -123,18 +135,30 @@ interface BotDefinition {
|
|
|
123
135
|
verifiable: boolean;
|
|
124
136
|
}
|
|
125
137
|
declare const AI_BOTS: BotDefinition[];
|
|
138
|
+
declare const AI_ASSISTANT_BOTS: BotDefinition[];
|
|
126
139
|
declare const SEARCH_BOTS: BotDefinition[];
|
|
140
|
+
declare const SEO_BOTS: BotDefinition[];
|
|
141
|
+
declare const ADVERTISING_BOTS: BotDefinition[];
|
|
142
|
+
declare const MONITOR_BOTS: BotDefinition[];
|
|
143
|
+
declare const PREVIEW_BOTS: BotDefinition[];
|
|
144
|
+
declare const WEBHOOK_BOTS: BotDefinition[];
|
|
145
|
+
declare const FEED_BOTS: BotDefinition[];
|
|
146
|
+
declare const ECOMMERCE_BOTS: BotDefinition[];
|
|
147
|
+
declare const VERIFICATION_BOTS: BotDefinition[];
|
|
148
|
+
declare const ANALYTICS_BOTS: BotDefinition[];
|
|
149
|
+
declare const SOCIAL_BOTS: BotDefinition[];
|
|
150
|
+
declare const ACCESSIBILITY_BOTS: BotDefinition[];
|
|
127
151
|
declare const GENERIC_BOTS: BotDefinition[];
|
|
128
|
-
/** All known bots —
|
|
152
|
+
/** All known bots — ordered from most specific to most generic */
|
|
129
153
|
declare const ALL_BOTS: BotDefinition[];
|
|
130
154
|
|
|
131
155
|
/**
|
|
132
156
|
* Sends a server-side payload to the Telemetry backend.
|
|
133
|
-
*
|
|
157
|
+
* Automatically retries on transient failures with exponential backoff.
|
|
134
158
|
*
|
|
135
159
|
* @param payload The data to track.
|
|
136
160
|
* @param config The Telemetry configuration.
|
|
137
161
|
*/
|
|
138
162
|
declare function sendToTelemetry(payload: ServerTrackPayload, config: TelemetryConfig): Promise<void>;
|
|
139
163
|
|
|
140
|
-
export { AI_BOTS, ALL_BOTS, type BotCategory, type BotDefinition, type BotDetectionResult, type DetectionConfidence, type DetectionMethod, GENERIC_BOTS, type NormalizedRequest, SEARCH_BOTS, type ServerTrackPayload, type TelemetryConfig, detectBot, extractAutomationHeaders, sendToTelemetry };
|
|
164
|
+
export { ACCESSIBILITY_BOTS, ADVERTISING_BOTS, AI_ASSISTANT_BOTS, AI_BOTS, ALL_BOTS, ANALYTICS_BOTS, type BotCategory, type BotDefinition, type BotDetectionResult, type DetectionConfidence, type DetectionMethod, ECOMMERCE_BOTS, FEED_BOTS, GENERIC_BOTS, MONITOR_BOTS, type NormalizedRequest, PREVIEW_BOTS, SEARCH_BOTS, SEO_BOTS, SOCIAL_BOTS, type ServerTrackPayload, type TelemetryConfig, VERIFICATION_BOTS, WEBHOOK_BOTS, detectBot, extractAutomationHeaders, sendToTelemetry };
|