posthog-node 5.40.0 → 5.41.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.
Files changed (41) hide show
  1. package/LICENSE +2 -2
  2. package/dist/capture-v1/config.d.ts +11 -0
  3. package/dist/capture-v1/config.d.ts.map +1 -0
  4. package/dist/capture-v1/config.js +42 -0
  5. package/dist/capture-v1/config.mjs +8 -0
  6. package/dist/capture-v1/errors.d.ts +32 -0
  7. package/dist/capture-v1/errors.d.ts.map +1 -0
  8. package/dist/capture-v1/errors.js +49 -0
  9. package/dist/capture-v1/errors.mjs +15 -0
  10. package/dist/capture-v1/routing.d.ts +21 -0
  11. package/dist/capture-v1/routing.d.ts.map +1 -0
  12. package/dist/capture-v1/routing.js +47 -0
  13. package/dist/capture-v1/routing.mjs +7 -0
  14. package/dist/capture-v1/sender.d.ts +70 -0
  15. package/dist/capture-v1/sender.d.ts.map +1 -0
  16. package/dist/capture-v1/sender.js +222 -0
  17. package/dist/capture-v1/sender.mjs +188 -0
  18. package/dist/capture-v1/transform.d.ts +34 -0
  19. package/dist/capture-v1/transform.d.ts.map +1 -0
  20. package/dist/capture-v1/transform.js +142 -0
  21. package/dist/capture-v1/transform.mjs +99 -0
  22. package/dist/capture-v1/types.d.ts +50 -0
  23. package/dist/capture-v1/types.d.ts.map +1 -0
  24. package/dist/capture-v1/types.js +18 -0
  25. package/dist/capture-v1/types.mjs +0 -0
  26. package/dist/client.d.ts +22 -1
  27. package/dist/client.d.ts.map +1 -1
  28. package/dist/client.js +42 -0
  29. package/dist/client.mjs +43 -1
  30. package/dist/version.d.ts +1 -1
  31. package/dist/version.js +1 -1
  32. package/dist/version.mjs +1 -1
  33. package/package.json +2 -2
  34. package/src/capture-v1/config.ts +18 -0
  35. package/src/capture-v1/errors.ts +52 -0
  36. package/src/capture-v1/routing.ts +28 -0
  37. package/src/capture-v1/sender.ts +298 -0
  38. package/src/capture-v1/transform.ts +159 -0
  39. package/src/capture-v1/types.ts +55 -0
  40. package/src/client.ts +77 -0
  41. package/src/version.ts +1 -1
@@ -0,0 +1,188 @@
1
+ import { gzipCompress, safeJsonStringify, safeSetTimeout, uuidv7 } from "@posthog/core";
2
+ import { CaptureV1Error } from "./errors.mjs";
3
+ import { buildV1Batch } from "./transform.mjs";
4
+ const V1_ANALYTICS_PATH = '/i/v1/analytics/events';
5
+ const DEFAULT_MAX_BACKOFF_MS = 30000;
6
+ const RETRYABLE_STATUSES = new Set([
7
+ 408,
8
+ 500,
9
+ 502,
10
+ 503,
11
+ 504
12
+ ]);
13
+ class V1CaptureSender {
14
+ constructor(config, hooks){
15
+ this.config = config;
16
+ this.maxBackoffMs = config.maxBackoffMs ?? DEFAULT_MAX_BACKOFF_MS;
17
+ this.fetchFn = hooks.fetch;
18
+ this.onError = hooks.onError;
19
+ this.now = hooks.now ?? Date.now;
20
+ this.sleep = hooks.sleep ?? ((ms)=>new Promise((resolve)=>safeSetTimeout(resolve, ms)));
21
+ this.generateRequestId = hooks.generateRequestId ?? uuidv7;
22
+ this.compress = hooks.compress ?? gzipCompress;
23
+ }
24
+ async sendV1Batch(messages) {
25
+ if (0 === messages.length) return;
26
+ const requestId = this.generateRequestId();
27
+ const createdAt = new Date(this.now()).toISOString();
28
+ const { batch } = buildV1Batch(messages, {
29
+ createdAt,
30
+ historicalMigration: this.config.historicalMigration
31
+ });
32
+ const url = `${this.config.host}${V1_ANALYTICS_PATH}`;
33
+ const drops = [];
34
+ let pending = batch;
35
+ const maxAttempts = Math.max(1, this.config.maxAttempts);
36
+ for(let attempt = 1; attempt <= maxAttempts; attempt++){
37
+ const isLastAttempt = attempt === maxAttempts;
38
+ const payload = safeJsonStringify({
39
+ created_at: createdAt,
40
+ ...this.config.historicalMigration ? {
41
+ historical_migration: true
42
+ } : {},
43
+ batch: pending
44
+ });
45
+ let response;
46
+ try {
47
+ response = await this.sendOnce(url, payload, attempt, requestId);
48
+ } catch (transportError) {
49
+ if (isLastAttempt) return this.surfaceBatchFailure(requestId, drops, pending, transportError);
50
+ await this.sleep(this.backoffDelay(attempt));
51
+ continue;
52
+ }
53
+ const { status } = response;
54
+ if (status < 200 || status >= 300) {
55
+ if (!isLastAttempt && RETRYABLE_STATUSES.has(status)) {
56
+ const retryAfterMs = this.parseRetryAfter(response);
57
+ await this.cancelBody(response);
58
+ await this.sleep(this.backoffDelay(attempt, retryAfterMs));
59
+ continue;
60
+ }
61
+ const httpError = await this.buildHttpError(response, status);
62
+ return this.surfaceBatchFailure(requestId, drops, pending, httpError);
63
+ }
64
+ let parsed;
65
+ try {
66
+ parsed = await this.parseResponse(response);
67
+ } catch {
68
+ return this.surfaceBatchFailure(requestId, drops, pending, new Error(`Capture V1 returned an unparseable ${status} response body`));
69
+ }
70
+ const retryable = this.classify(pending, parsed, drops);
71
+ if (0 === retryable.length) return this.surfacePartialDrops(requestId, drops);
72
+ if (isLastAttempt) return void this.onError(new CaptureV1Error({
73
+ requestId,
74
+ drops,
75
+ retryExhausted: retryable.map((event)=>event.uuid)
76
+ }));
77
+ pending = retryable;
78
+ const retryAfterMs = this.parseRetryAfter(response);
79
+ await this.sleep(this.backoffDelay(attempt, retryAfterMs));
80
+ }
81
+ }
82
+ async sendOnce(url, payload, attempt, requestId) {
83
+ const headers = this.buildHeaders(attempt, requestId);
84
+ let body = payload;
85
+ if (this.config.compressionEnabled) {
86
+ const compressed = await this.compress(payload, this.config.isDebug);
87
+ if (null !== compressed) {
88
+ body = compressed;
89
+ headers['Content-Encoding'] = 'gzip';
90
+ }
91
+ }
92
+ const controller = new AbortController();
93
+ const timer = safeSetTimeout(()=>controller.abort(), this.config.requestTimeoutMs);
94
+ try {
95
+ return await this.fetchFn(url, {
96
+ method: 'POST',
97
+ headers,
98
+ body,
99
+ signal: controller.signal
100
+ });
101
+ } finally{
102
+ clearTimeout(timer);
103
+ }
104
+ }
105
+ buildHeaders(attempt, requestId) {
106
+ const sdkInfo = `${this.config.libraryId}/${this.config.libraryVersion}`;
107
+ const headers = {
108
+ 'Content-Type': 'application/json',
109
+ Authorization: `Bearer ${this.config.apiKey}`,
110
+ 'PostHog-Sdk-Info': sdkInfo,
111
+ 'PostHog-Attempt': String(attempt),
112
+ 'PostHog-Request-Id': requestId,
113
+ 'PostHog-Request-Timestamp': new Date(this.now()).toISOString()
114
+ };
115
+ if (this.config.userAgent) headers['User-Agent'] = this.config.userAgent;
116
+ return headers;
117
+ }
118
+ classify(pending, parsed, drops) {
119
+ const results = parsed.results ?? {};
120
+ const retryable = [];
121
+ for (const event of pending){
122
+ const result = results[event.uuid];
123
+ if (result) {
124
+ if ('drop' === result.result) drops.push({
125
+ uuid: event.uuid,
126
+ details: result.details ?? void 0
127
+ });
128
+ else if ('retry' === result.result) retryable.push(event);
129
+ }
130
+ }
131
+ return retryable;
132
+ }
133
+ backoffDelay(attempt, retryAfterMs) {
134
+ const exponential = Math.min(this.config.initialRetryDelayMs * 2 ** (attempt - 1), this.maxBackoffMs);
135
+ if (void 0 === retryAfterMs) return exponential;
136
+ return Math.max(exponential, Math.min(retryAfterMs, this.maxBackoffMs));
137
+ }
138
+ parseRetryAfter(response) {
139
+ const raw = response.headers?.get('Retry-After');
140
+ if (!raw) return;
141
+ const trimmed = raw.trim();
142
+ if (/^\d+$/.test(trimmed)) {
143
+ const seconds = parseInt(trimmed, 10);
144
+ return Number.isFinite(seconds) && seconds > 0 ? 1000 * seconds : void 0;
145
+ }
146
+ const dateMs = Date.parse(trimmed);
147
+ if (Number.isNaN(dateMs)) return;
148
+ const delta = dateMs - this.now();
149
+ return delta > 0 ? delta : void 0;
150
+ }
151
+ async parseResponse(response) {
152
+ const text = await response.text();
153
+ const parsed = JSON.parse(text);
154
+ if ('object' != typeof parsed || null === parsed || Array.isArray(parsed)) throw new Error('unexpected response shape');
155
+ const results = parsed.results;
156
+ if (void 0 !== results && ('object' != typeof results || null === results || Array.isArray(results))) throw new Error('unexpected results shape');
157
+ return {
158
+ results: results ?? {}
159
+ };
160
+ }
161
+ async buildHttpError(response, status) {
162
+ let bodyText = '';
163
+ try {
164
+ bodyText = (await response.text()).slice(0, 512);
165
+ } catch {}
166
+ const suffix = bodyText ? `: ${bodyText}` : '';
167
+ return new Error(`Capture V1 request failed with HTTP ${status}${suffix}`);
168
+ }
169
+ surfaceBatchFailure(requestId, drops, pending, cause) {
170
+ this.onError(new CaptureV1Error({
171
+ requestId,
172
+ drops,
173
+ retryExhausted: pending.map((event)=>event.uuid),
174
+ cause
175
+ }));
176
+ }
177
+ surfacePartialDrops(requestId, drops) {
178
+ if (drops.length > 0) this.onError(new CaptureV1Error({
179
+ requestId,
180
+ drops,
181
+ retryExhausted: []
182
+ }));
183
+ }
184
+ async cancelBody(response) {
185
+ await response.body?.cancel()?.catch(()=>{});
186
+ }
187
+ }
188
+ export { V1CaptureSender };
@@ -0,0 +1,34 @@
1
+ import type { JsonType, PostHogEventProperties } from '@posthog/core';
2
+ import type { V1Batch, V1Event } from './types';
3
+ /**
4
+ * Coerce a value to a boolean the way the capture server does, or return
5
+ * `undefined` if it cannot be coerced (the option is then omitted so the server
6
+ * falls back to its default). Accepts native booleans, the strings
7
+ * `"true"`/`"1"`/`"false"`/`"0"` (trimmed, case-insensitive), and any number
8
+ * (nonzero -> true).
9
+ */
10
+ export declare function coerceBool(value: JsonType): boolean | undefined;
11
+ /**
12
+ * Accept only a native string, else return `undefined` (the option is then
13
+ * omitted). The backend's `product_tour_id` is `Option<String>`, so numbers,
14
+ * booleans, objects, and arrays are dropped rather than coerced — matching
15
+ * posthog-go, posthog-rs, and posthog-python exactly.
16
+ */
17
+ export declare function coerceString(value: JsonType): string | undefined;
18
+ /**
19
+ * Transform one already-normalized queued message into a Capture V1 wire event.
20
+ *
21
+ * The input message is never mutated (events may be retried or handed to
22
+ * callbacks): a fresh `properties` map is built. Sentinel properties are lifted
23
+ * out of `properties` (deleting the copy) into the typed `options` object and
24
+ * the top-level `session_id`/`window_id` fields; `$lib`/`$lib_version` are
25
+ * stripped (the server injects them from `PostHog-Sdk-Info`); top-level
26
+ * `$set`/`$set_once` are relocated into `properties`.
27
+ */
28
+ export declare function buildV1Event(message: PostHogEventProperties): V1Event;
29
+ /** Build a Capture V1 batch envelope from already-normalized queued messages. */
30
+ export declare function buildV1Batch(messages: PostHogEventProperties[], { createdAt, historicalMigration }: {
31
+ createdAt: string;
32
+ historicalMigration?: boolean;
33
+ }): V1Batch;
34
+ //# sourceMappingURL=transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/capture-v1/transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAErE,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAkB,MAAM,SAAS,CAAA;AAE/D;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,CAiB/D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAEhE;AAqDD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CA0CrE;AAED,iFAAiF;AACjF,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,sBAAsB,EAAE,EAClC,EAAE,SAAS,EAAE,mBAAmB,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAAE,GACvF,OAAO,CAST"}
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ buildV1Batch: ()=>buildV1Batch,
28
+ buildV1Event: ()=>buildV1Event,
29
+ coerceBool: ()=>coerceBool,
30
+ coerceString: ()=>coerceString
31
+ });
32
+ function coerceBool(value) {
33
+ if ('boolean' == typeof value) return value;
34
+ if ('number' == typeof value) return 0 !== value;
35
+ if ('string' == typeof value) {
36
+ const normalized = value.trim().toLowerCase();
37
+ if ('true' === normalized || '1' === normalized) return true;
38
+ if ('false' === normalized || '0' === normalized) return false;
39
+ }
40
+ }
41
+ function coerceString(value) {
42
+ return 'string' == typeof value ? value : void 0;
43
+ }
44
+ const OPTION_SENTINELS = [
45
+ {
46
+ property: '$cookieless_mode',
47
+ optionKey: 'cookieless_mode',
48
+ coerce: coerceBool
49
+ },
50
+ {
51
+ property: '$ignore_sent_at',
52
+ optionKey: 'disable_skew_correction',
53
+ coerce: coerceBool
54
+ },
55
+ {
56
+ property: '$process_person_profile',
57
+ optionKey: 'process_person_profile',
58
+ coerce: coerceBool
59
+ },
60
+ {
61
+ property: '$product_tour_id',
62
+ optionKey: 'product_tour_id',
63
+ coerce: coerceString
64
+ }
65
+ ];
66
+ const TOPLEVEL_SENTINELS = [
67
+ {
68
+ property: '$session_id',
69
+ field: 'session_id'
70
+ },
71
+ {
72
+ property: '$window_id',
73
+ field: 'window_id'
74
+ }
75
+ ];
76
+ function isRecord(value) {
77
+ return 'object' == typeof value && null !== value && !Array.isArray(value);
78
+ }
79
+ function toRfc3339(timestamp) {
80
+ if ('string' == typeof timestamp) {
81
+ const asDate = new Date(timestamp);
82
+ return Number.isNaN(asDate.getTime()) ? new Date().toISOString() : timestamp;
83
+ }
84
+ if (timestamp instanceof Date) return Number.isNaN(timestamp.getTime()) ? new Date().toISOString() : timestamp.toISOString();
85
+ const asDate = null == timestamp ? new Date() : new Date(timestamp);
86
+ return Number.isNaN(asDate.getTime()) ? new Date().toISOString() : asDate.toISOString();
87
+ }
88
+ function relocateInto(properties, key, value) {
89
+ if (void 0 !== value && !(key in properties)) properties[key] = value;
90
+ }
91
+ function buildV1Event(message) {
92
+ const sourceProperties = isRecord(message.properties) ? message.properties : {};
93
+ const properties = {
94
+ ...sourceProperties
95
+ };
96
+ const options = {};
97
+ for (const { property, optionKey, coerce } of OPTION_SENTINELS)if (property in properties) {
98
+ const coerced = coerce(properties[property]);
99
+ if (void 0 !== coerced) options[optionKey] = coerced;
100
+ delete properties[property];
101
+ }
102
+ const topLevel = {};
103
+ for (const { property, field } of TOPLEVEL_SENTINELS)if (property in properties) {
104
+ const value = properties[property];
105
+ if ('string' == typeof value) topLevel[field] = value;
106
+ delete properties[property];
107
+ }
108
+ delete properties.$lib;
109
+ delete properties.$lib_version;
110
+ relocateInto(properties, '$set', message.$set);
111
+ relocateInto(properties, '$set_once', message.$set_once);
112
+ return {
113
+ event: String(message.event ?? ''),
114
+ uuid: String(message.uuid ?? ''),
115
+ distinct_id: String(message.distinct_id ?? ''),
116
+ timestamp: toRfc3339(message.timestamp),
117
+ ...topLevel,
118
+ options,
119
+ properties
120
+ };
121
+ }
122
+ function buildV1Batch(messages, { createdAt, historicalMigration }) {
123
+ const batch = {
124
+ created_at: createdAt,
125
+ batch: messages.map(buildV1Event)
126
+ };
127
+ if (historicalMigration) batch.historical_migration = true;
128
+ return batch;
129
+ }
130
+ exports.buildV1Batch = __webpack_exports__.buildV1Batch;
131
+ exports.buildV1Event = __webpack_exports__.buildV1Event;
132
+ exports.coerceBool = __webpack_exports__.coerceBool;
133
+ exports.coerceString = __webpack_exports__.coerceString;
134
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
135
+ "buildV1Batch",
136
+ "buildV1Event",
137
+ "coerceBool",
138
+ "coerceString"
139
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
140
+ Object.defineProperty(exports, '__esModule', {
141
+ value: true
142
+ });
@@ -0,0 +1,99 @@
1
+ function coerceBool(value) {
2
+ if ('boolean' == typeof value) return value;
3
+ if ('number' == typeof value) return 0 !== value;
4
+ if ('string' == typeof value) {
5
+ const normalized = value.trim().toLowerCase();
6
+ if ('true' === normalized || '1' === normalized) return true;
7
+ if ('false' === normalized || '0' === normalized) return false;
8
+ }
9
+ }
10
+ function coerceString(value) {
11
+ return 'string' == typeof value ? value : void 0;
12
+ }
13
+ const OPTION_SENTINELS = [
14
+ {
15
+ property: '$cookieless_mode',
16
+ optionKey: 'cookieless_mode',
17
+ coerce: coerceBool
18
+ },
19
+ {
20
+ property: '$ignore_sent_at',
21
+ optionKey: 'disable_skew_correction',
22
+ coerce: coerceBool
23
+ },
24
+ {
25
+ property: '$process_person_profile',
26
+ optionKey: 'process_person_profile',
27
+ coerce: coerceBool
28
+ },
29
+ {
30
+ property: '$product_tour_id',
31
+ optionKey: 'product_tour_id',
32
+ coerce: coerceString
33
+ }
34
+ ];
35
+ const TOPLEVEL_SENTINELS = [
36
+ {
37
+ property: '$session_id',
38
+ field: 'session_id'
39
+ },
40
+ {
41
+ property: '$window_id',
42
+ field: 'window_id'
43
+ }
44
+ ];
45
+ function isRecord(value) {
46
+ return 'object' == typeof value && null !== value && !Array.isArray(value);
47
+ }
48
+ function toRfc3339(timestamp) {
49
+ if ('string' == typeof timestamp) {
50
+ const asDate = new Date(timestamp);
51
+ return Number.isNaN(asDate.getTime()) ? new Date().toISOString() : timestamp;
52
+ }
53
+ if (timestamp instanceof Date) return Number.isNaN(timestamp.getTime()) ? new Date().toISOString() : timestamp.toISOString();
54
+ const asDate = null == timestamp ? new Date() : new Date(timestamp);
55
+ return Number.isNaN(asDate.getTime()) ? new Date().toISOString() : asDate.toISOString();
56
+ }
57
+ function relocateInto(properties, key, value) {
58
+ if (void 0 !== value && !(key in properties)) properties[key] = value;
59
+ }
60
+ function buildV1Event(message) {
61
+ const sourceProperties = isRecord(message.properties) ? message.properties : {};
62
+ const properties = {
63
+ ...sourceProperties
64
+ };
65
+ const options = {};
66
+ for (const { property, optionKey, coerce } of OPTION_SENTINELS)if (property in properties) {
67
+ const coerced = coerce(properties[property]);
68
+ if (void 0 !== coerced) options[optionKey] = coerced;
69
+ delete properties[property];
70
+ }
71
+ const topLevel = {};
72
+ for (const { property, field } of TOPLEVEL_SENTINELS)if (property in properties) {
73
+ const value = properties[property];
74
+ if ('string' == typeof value) topLevel[field] = value;
75
+ delete properties[property];
76
+ }
77
+ delete properties.$lib;
78
+ delete properties.$lib_version;
79
+ relocateInto(properties, '$set', message.$set);
80
+ relocateInto(properties, '$set_once', message.$set_once);
81
+ return {
82
+ event: String(message.event ?? ''),
83
+ uuid: String(message.uuid ?? ''),
84
+ distinct_id: String(message.distinct_id ?? ''),
85
+ timestamp: toRfc3339(message.timestamp),
86
+ ...topLevel,
87
+ options,
88
+ properties
89
+ };
90
+ }
91
+ function buildV1Batch(messages, { createdAt, historicalMigration }) {
92
+ const batch = {
93
+ created_at: createdAt,
94
+ batch: messages.map(buildV1Event)
95
+ };
96
+ if (historicalMigration) batch.historical_migration = true;
97
+ return batch;
98
+ }
99
+ export { buildV1Batch, buildV1Event, coerceBool, coerceString };
@@ -0,0 +1,50 @@
1
+ import type { PostHogEventProperties } from '@posthog/core';
2
+ /**
3
+ * Typed `options` object on a Capture V1 event. Legacy `$`-prefixed sentinel
4
+ * properties are lifted here (renamed + strictly typed) by the transform.
5
+ * Always serialized as an object (`{}` when empty), never `null`.
6
+ */
7
+ export interface V1EventOptions {
8
+ cookieless_mode?: boolean;
9
+ disable_skew_correction?: boolean;
10
+ process_person_profile?: boolean;
11
+ product_tour_id?: string;
12
+ }
13
+ /**
14
+ * A single event in a Capture V1 batch (`POST /i/v1/analytics/events`).
15
+ * `session_id`/`window_id` are promoted from the `$session_id`/`$window_id`
16
+ * sentinels; there is no top-level `api_key`.
17
+ */
18
+ export interface V1Event {
19
+ event: string;
20
+ uuid: string;
21
+ distinct_id: string;
22
+ timestamp: string;
23
+ session_id?: string;
24
+ window_id?: string;
25
+ options: V1EventOptions;
26
+ properties: PostHogEventProperties;
27
+ }
28
+ /**
29
+ * The Capture V1 batch envelope. Unlike v0 there is no `api_key` (Bearer auth)
30
+ * and no `sent_at`. `historical_migration` is omitted when false.
31
+ */
32
+ export interface V1Batch {
33
+ created_at: string;
34
+ historical_migration?: boolean;
35
+ batch: V1Event[];
36
+ }
37
+ /**
38
+ * Per-event result codes in a v1 2xx response body. Unknown strings are
39
+ * tolerated as terminal success for forward compatibility.
40
+ */
41
+ export type V1ResultCode = 'ok' | 'warning' | 'drop' | 'retry';
42
+ export interface V1EventResult {
43
+ result: V1ResultCode | string;
44
+ details?: string | null;
45
+ }
46
+ /** Shape of a v1 2xx response body: a per-uuid map of results. */
47
+ export interface V1BatchResponse {
48
+ results: Record<string, V1EventResult>;
49
+ }
50
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/capture-v1/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAE3D;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,cAAc,CAAA;IACvB,UAAU,EAAE,sBAAsB,CAAA;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,KAAK,EAAE,OAAO,EAAE,CAAA;CACjB;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;AAE9D,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,YAAY,GAAG,MAAM,CAAA;IAC7B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB;AAED,kEAAkE;AAClE,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CACvC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.r = (exports1)=>{
5
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
6
+ value: 'Module'
7
+ });
8
+ Object.defineProperty(exports1, '__esModule', {
9
+ value: true
10
+ });
11
+ };
12
+ })();
13
+ var __webpack_exports__ = {};
14
+ __webpack_require__.r(__webpack_exports__);
15
+ for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
16
+ Object.defineProperty(exports, '__esModule', {
17
+ value: true
18
+ });
File without changes
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { FeatureFlagValue, JsonType, PostHogCaptureOptions, PostHogCoreStateless, PostHogEventProperties, PostHogFetchOptions, PostHogFetchResponse, PostHogFlagsAndPayloadsResponse, PostHogPersistedProperty } from '@posthog/core';
1
+ import { FeatureFlagValue, JsonType, PostHogCaptureOptions, PostHogCoreStateless, PostHogEventProperties, PostHogFetchOptions, PostHogFetchResponse, PostHogFlagsAndPayloadsResponse, PostHogPersistedProperty, RetriableOptions } from '@posthog/core';
2
2
  import { AllFlagsOptions, EventMessage, FeatureFlagResult, FlagEvaluationOptions, GroupIdentifyMessage, IdentifyMessage, IPostHog, OverrideFeatureFlagsOptions, PostHogOptions, SetPersonPropertiesMessage, UnsetPersonPropertiesMessage } from './types';
3
3
  import { FeatureFlagEvaluations, FlagCalledEventParams } from './feature-flag-evaluations';
4
4
  import ErrorTracking from './extensions/error-tracking';
@@ -14,6 +14,8 @@ export declare abstract class PostHogBackendClient extends PostHogCoreStateless
14
14
  private maxCacheSize;
15
15
  readonly options: PostHogOptions;
16
16
  protected readonly context?: IPostHogContext;
17
+ private readonly captureMode;
18
+ private _v1Sender?;
17
19
  private _flagOverrides?;
18
20
  private _payloadOverrides?;
19
21
  distinctIdHasSentFlagCalls: Record<string, Set<string>>;
@@ -117,6 +119,25 @@ export declare abstract class PostHogBackendClient extends PostHogCoreStateless
117
119
  * @returns Promise resolving to the fetch response
118
120
  */
119
121
  fetch(url: string, options: PostHogFetchOptions): Promise<PostHogFetchResponse>;
122
+ /**
123
+ * Route an event to its queue. In v1 mode `$ai_*` events go to the isolated {@link AI_ROUTE}
124
+ * (legacy transport) and everything else to {@link ANALYTICS_ROUTE} (Capture V1); in v0 mode
125
+ * every event stays on {@link ANALYTICS_ROUTE}, which maps to the historical queue. Routing runs
126
+ * on the post-`before_send`, normalized event name (core calls this after `processBeforeEnqueue`).
127
+ */
128
+ protected getQueueRouteKey(message: PostHogEventProperties): string;
129
+ protected persistedQueueKeyForRoute(route: string): PostHogPersistedProperty;
130
+ protected getActiveQueueRoutes(): string[];
131
+ /**
132
+ * Capture submission seam shared by the batched (`_flush`) and immediate (`sendImmediate`)
133
+ * paths. Events are routed to homogeneous per-route queues at enqueue time, so a batch here is
134
+ * never mixed: the {@link AI_ROUTE} (and all of v0 mode) uses the legacy `/batch/` transport,
135
+ * which throws so `_flush` can shrink/persist/retry its own queue; the {@link ANALYTICS_ROUTE}
136
+ * in v1 mode uses the Capture V1 endpoint. Because the routes flush independently, a v0/AI leg
137
+ * failure can never re-send analytics events already accepted on the V1 leg.
138
+ */
139
+ protected sendBatch(batchMessages: (PostHogEventProperties | undefined)[], retryOptions?: Partial<RetriableOptions>, route?: string): Promise<void>;
140
+ private getV1Sender;
120
141
  /**
121
142
  * Get the library version from package.json.
122
143
  *
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAGhB,QAAQ,EACR,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,+BAA+B,EAE/B,wBAAwB,EAGzB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,eAAe,EACf,YAAY,EAIZ,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,QAAQ,EACR,2BAA2B,EAC3B,cAAc,EAEd,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,SAAS,CAAA;AAChB,OAAO,EAEL,sBAAsB,EAEtB,qBAAqB,EACtB,MAAM,4BAA4B,CAAA;AAOnC,OAAO,aAAa,MAAM,6BAA6B,CAAA;AAEvD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAyBzF;;GAEG;AACH,wBAAgB,iCAAiC,IAAI,IAAI,CAExD;AA6CD,8BAAsB,oBAAqB,SAAQ,oBAAqB,YAAW,QAAQ;IACzF,OAAO,CAAC,cAAc,CAA6B;IAEnD,OAAO,CAAC,kBAAkB,CAAC,CAAoB;IAC/C,SAAS,CAAC,aAAa,EAAE,aAAa,CAAA;IACtC,OAAO,CAAC,YAAY,CAAQ;IAC5B,SAAgB,OAAO,EAAE,cAAc,CAAA;IACvC,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