posthog-node 5.73.1 → 6.0.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/MIGRATION.md +556 -0
- package/README.md +3 -1
- package/dist/ai-capture/routing.d.ts +0 -3
- package/dist/ai-capture/routing.d.ts.map +1 -1
- package/dist/ai-capture/routing.js +2 -14
- package/dist/ai-capture/routing.mjs +1 -4
- package/dist/capture-lane/lane.d.ts +109 -0
- package/dist/capture-lane/lane.d.ts.map +1 -0
- package/dist/capture-lane/lane.js +308 -0
- package/dist/capture-lane/lane.mjs +270 -0
- package/dist/capture-lane/limits.d.ts +7 -0
- package/dist/capture-lane/limits.d.ts.map +1 -0
- package/dist/{capture-v1/config.js → capture-lane/limits.js} +13 -11
- package/dist/capture-lane/limits.mjs +4 -0
- package/dist/capture-lane/settings.d.ts +30 -0
- package/dist/capture-lane/settings.d.ts.map +1 -0
- package/dist/capture-lane/settings.js +100 -0
- package/dist/capture-lane/settings.mjs +47 -0
- package/dist/capture-v1/compression.d.ts +18 -0
- package/dist/capture-v1/compression.d.ts.map +1 -0
- package/dist/capture-v1/compression.js +70 -0
- package/dist/capture-v1/compression.mjs +26 -0
- package/dist/capture-v1/errors.d.ts +23 -7
- package/dist/capture-v1/errors.d.ts.map +1 -1
- package/dist/capture-v1/errors.js +37 -8
- package/dist/capture-v1/errors.mjs +29 -6
- package/dist/capture-v1/sender.d.ts +63 -23
- package/dist/capture-v1/sender.d.ts.map +1 -1
- package/dist/capture-v1/sender.js +281 -74
- package/dist/capture-v1/sender.mjs +275 -77
- package/dist/capture-v1/serialize.d.ts +28 -0
- package/dist/capture-v1/serialize.d.ts.map +1 -0
- package/dist/capture-v1/serialize.js +82 -0
- package/dist/capture-v1/serialize.mjs +38 -0
- package/dist/capture-v1/transform.d.ts +10 -25
- package/dist/capture-v1/transform.d.ts.map +1 -1
- package/dist/capture-v1/transform.js +33 -64
- package/dist/capture-v1/transform.mjs +28 -53
- package/dist/capture-v1/types.d.ts +16 -14
- package/dist/capture-v1/types.d.ts.map +1 -1
- package/dist/capture-v1/types.js +27 -1
- package/dist/capture-v1/types.mjs +3 -1
- package/dist/capture-v1/uuid.d.ts +9 -0
- package/dist/capture-v1/uuid.d.ts.map +1 -0
- package/dist/capture-v1/uuid.js +75 -0
- package/dist/capture-v1/uuid.mjs +34 -0
- package/dist/client.d.ts +201 -94
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +485 -246
- package/dist/client.mjs +485 -246
- package/dist/compression.node.d.ts +13 -0
- package/dist/compression.node.d.ts.map +1 -0
- package/dist/{capture-v1/routing.js → compression.node.js} +23 -16
- package/dist/compression.node.mjs +18 -0
- package/dist/entrypoints/index.node.d.ts +2 -0
- package/dist/entrypoints/index.node.d.ts.map +1 -1
- package/dist/entrypoints/index.node.js +11 -4
- package/dist/entrypoints/index.node.mjs +4 -0
- package/dist/event-defaults.d.ts +46 -0
- package/dist/event-defaults.d.ts.map +1 -0
- package/dist/event-defaults.js +141 -0
- package/dist/event-defaults.mjs +79 -0
- package/dist/exports.d.ts +3 -0
- package/dist/exports.d.ts.map +1 -1
- package/dist/exports.js +22 -11
- package/dist/exports.mjs +1 -0
- package/dist/extensions/context/context.d.ts +0 -1
- package/dist/extensions/context/context.d.ts.map +1 -1
- package/dist/extensions/context/context.js +4 -3
- package/dist/extensions/context/context.mjs +4 -3
- package/dist/extensions/context/event-context.d.ts.map +1 -1
- package/dist/extensions/context/event-context.js +3 -0
- package/dist/extensions/context/event-context.mjs +3 -0
- package/dist/extensions/context/types.d.ts +9 -1
- package/dist/extensions/context/types.d.ts.map +1 -1
- package/dist/extensions/error-tracking/index.d.ts +1 -1
- package/dist/extensions/error-tracking/index.d.ts.map +1 -1
- package/dist/extensions/error-tracking/index.js +71 -7
- package/dist/extensions/error-tracking/index.mjs +75 -11
- package/dist/extensions/express.d.ts +8 -0
- package/dist/extensions/express.d.ts.map +1 -1
- package/dist/extensions/express.js +3 -3
- package/dist/extensions/express.mjs +4 -4
- package/dist/extensions/fetch-request.d.ts.map +1 -1
- package/dist/extensions/fetch-request.js +2 -2
- package/dist/extensions/fetch-request.mjs +3 -3
- package/dist/extensions/nestjs.d.ts.map +1 -1
- package/dist/extensions/nestjs.js +7 -4
- package/dist/extensions/nestjs.mjs +8 -5
- package/dist/extensions/tracing-headers.d.ts +7 -0
- package/dist/extensions/tracing-headers.d.ts.map +1 -1
- package/dist/extensions/tracing-headers.js +11 -1
- package/dist/extensions/tracing-headers.mjs +9 -2
- package/dist/feature-flag-evaluations.d.ts +5 -5
- package/dist/feature-flag-evaluations.d.ts.map +1 -1
- package/dist/feature-flag-evaluations.js +16 -9
- package/dist/feature-flag-evaluations.mjs +16 -9
- package/dist/flag-events.d.ts +1 -1
- package/dist/flag-events.d.ts.map +1 -1
- package/dist/flag-events.js +2 -2
- package/dist/flag-events.mjs +2 -2
- package/dist/flags-response.d.ts +2 -0
- package/dist/flags-response.d.ts.map +1 -1
- package/dist/flags-response.js +6 -0
- package/dist/flags-response.mjs +4 -1
- package/dist/types.d.ts +192 -27
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.mjs +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +5 -4
- package/src/ai-capture/routing.ts +0 -6
- package/src/capture-lane/lane.ts +414 -0
- package/src/capture-lane/limits.ts +8 -0
- package/src/capture-lane/settings.ts +119 -0
- package/src/capture-v1/compression.ts +50 -0
- package/src/capture-v1/errors.ts +50 -11
- package/src/capture-v1/sender.ts +405 -111
- package/src/capture-v1/serialize.ts +77 -0
- package/src/capture-v1/transform.ts +59 -92
- package/src/capture-v1/types.ts +19 -15
- package/src/capture-v1/uuid.ts +53 -0
- package/src/client.ts +885 -446
- package/src/compression.node.ts +30 -0
- package/src/entrypoints/index.node.ts +6 -0
- package/src/event-defaults.ts +177 -0
- package/src/exports.ts +3 -0
- package/src/extensions/context/context.ts +4 -4
- package/src/extensions/context/event-context.ts +3 -1
- package/src/extensions/context/types.ts +10 -1
- package/src/extensions/error-tracking/index.ts +51 -7
- package/src/extensions/express.ts +12 -3
- package/src/extensions/fetch-request.ts +7 -3
- package/src/extensions/nestjs.ts +9 -5
- package/src/extensions/tracing-headers.ts +26 -7
- package/src/feature-flag-evaluations.ts +31 -23
- package/src/flag-events.ts +5 -2
- package/src/flags-response.ts +6 -1
- package/src/types.ts +212 -44
- package/src/version.ts +1 -1
- package/dist/ai-capture/batching.d.ts +0 -11
- package/dist/ai-capture/batching.d.ts.map +0 -1
- package/dist/ai-capture/batching.js +0 -77
- package/dist/ai-capture/batching.mjs +0 -36
- package/dist/capture-v1/config.d.ts +0 -11
- package/dist/capture-v1/config.d.ts.map +0 -1
- package/dist/capture-v1/config.mjs +0 -8
- package/dist/capture-v1/routing.d.ts +0 -21
- package/dist/capture-v1/routing.d.ts.map +0 -1
- package/dist/capture-v1/routing.mjs +0 -7
- package/src/ai-capture/batching.ts +0 -47
- package/src/capture-v1/config.ts +0 -18
- package/src/capture-v1/routing.ts +0 -28
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
eventByteSize: ()=>eventByteSize,
|
|
32
|
-
partitionAiBatch: ()=>partitionAiBatch
|
|
33
|
-
});
|
|
34
|
-
const core_namespaceObject = require("@posthog/core");
|
|
35
|
-
const external_routing_js_namespaceObject = require("./routing.js");
|
|
36
|
-
const encoder = new TextEncoder();
|
|
37
|
-
function eventByteSize(message) {
|
|
38
|
-
return encoder.encode((0, core_namespaceObject.safeJsonStringify)(message)).length;
|
|
39
|
-
}
|
|
40
|
-
function partitionAiBatch(messages, maxEventBytes = external_routing_js_namespaceObject.AI_MAX_EVENT_BYTES, targetBatchBytes = external_routing_js_namespaceObject.AI_BATCH_TARGET_BYTES) {
|
|
41
|
-
const batches = [];
|
|
42
|
-
const dropped = [];
|
|
43
|
-
let current = [];
|
|
44
|
-
let currentBytes = 0;
|
|
45
|
-
for (const message of messages){
|
|
46
|
-
if (void 0 === message) continue;
|
|
47
|
-
const bytes = eventByteSize(message);
|
|
48
|
-
if (bytes > maxEventBytes) {
|
|
49
|
-
dropped.push({
|
|
50
|
-
event: 'string' == typeof message.event ? message.event : 'unknown',
|
|
51
|
-
bytes
|
|
52
|
-
});
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
if (current.length > 0 && currentBytes + bytes > targetBatchBytes) {
|
|
56
|
-
batches.push(current);
|
|
57
|
-
current = [];
|
|
58
|
-
currentBytes = 0;
|
|
59
|
-
}
|
|
60
|
-
current.push(message);
|
|
61
|
-
currentBytes += bytes;
|
|
62
|
-
}
|
|
63
|
-
if (current.length > 0) batches.push(current);
|
|
64
|
-
return {
|
|
65
|
-
batches,
|
|
66
|
-
dropped
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
exports.eventByteSize = __webpack_exports__.eventByteSize;
|
|
70
|
-
exports.partitionAiBatch = __webpack_exports__.partitionAiBatch;
|
|
71
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
72
|
-
"eventByteSize",
|
|
73
|
-
"partitionAiBatch"
|
|
74
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
75
|
-
Object.defineProperty(exports, '__esModule', {
|
|
76
|
-
value: true
|
|
77
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { safeJsonStringify } from "@posthog/core";
|
|
2
|
-
import { AI_BATCH_TARGET_BYTES, AI_MAX_EVENT_BYTES } from "./routing.mjs";
|
|
3
|
-
const encoder = new TextEncoder();
|
|
4
|
-
function eventByteSize(message) {
|
|
5
|
-
return encoder.encode(safeJsonStringify(message)).length;
|
|
6
|
-
}
|
|
7
|
-
function partitionAiBatch(messages, maxEventBytes = AI_MAX_EVENT_BYTES, targetBatchBytes = AI_BATCH_TARGET_BYTES) {
|
|
8
|
-
const batches = [];
|
|
9
|
-
const dropped = [];
|
|
10
|
-
let current = [];
|
|
11
|
-
let currentBytes = 0;
|
|
12
|
-
for (const message of messages){
|
|
13
|
-
if (void 0 === message) continue;
|
|
14
|
-
const bytes = eventByteSize(message);
|
|
15
|
-
if (bytes > maxEventBytes) {
|
|
16
|
-
dropped.push({
|
|
17
|
-
event: 'string' == typeof message.event ? message.event : 'unknown',
|
|
18
|
-
bytes
|
|
19
|
-
});
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
if (current.length > 0 && currentBytes + bytes > targetBatchBytes) {
|
|
23
|
-
batches.push(current);
|
|
24
|
-
current = [];
|
|
25
|
-
currentBytes = 0;
|
|
26
|
-
}
|
|
27
|
-
current.push(message);
|
|
28
|
-
currentBytes += bytes;
|
|
29
|
-
}
|
|
30
|
-
if (current.length > 0) batches.push(current);
|
|
31
|
-
return {
|
|
32
|
-
batches,
|
|
33
|
-
dropped
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export { eventByteSize, partitionAiBatch };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** Capture submission mode: `v0` is the legacy `/batch/` endpoint, `v1` is `/i/v1/analytics/events`. */
|
|
2
|
-
export type CaptureMode = 'v0' | 'v1';
|
|
3
|
-
/**
|
|
4
|
-
* Resolve the effective capture mode from the `POSTHOG_CAPTURE_MODE` environment
|
|
5
|
-
* variable (guarded for edge / no-`process` runtimes). The default is `v0`, so
|
|
6
|
-
* existing users are unaffected unless they explicitly opt in. Capture V1 is
|
|
7
|
-
* intentionally env-var-only during the transition — there is no public option,
|
|
8
|
-
* so nothing on the API surface has to be removed when v1 becomes the default.
|
|
9
|
-
*/
|
|
10
|
-
export declare function resolveCaptureMode(): CaptureMode;
|
|
11
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/capture-v1/config.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,CAAA;AAMrC;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,CAGhD"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
function isCaptureMode(value) {
|
|
2
|
-
return 'v0' === value || 'v1' === value;
|
|
3
|
-
}
|
|
4
|
-
function resolveCaptureMode() {
|
|
5
|
-
const envMode = "u" > typeof process ? process.env?.POSTHOG_CAPTURE_MODE : void 0;
|
|
6
|
-
return isCaptureMode(envMode) ? envMode : 'v0';
|
|
7
|
-
}
|
|
8
|
-
export { resolveCaptureMode };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { PostHogEventProperties } from '@posthog/core';
|
|
2
|
-
/**
|
|
3
|
-
* Queue route for events eligible for Capture V1 (everything except `$ai_*`). Its queue is the
|
|
4
|
-
* historical {@link PostHogPersistedProperty.Queue}, so v0 mode is byte-identical to before.
|
|
5
|
-
*/
|
|
6
|
-
export declare const ANALYTICS_ROUTE = "analytics";
|
|
7
|
-
/**
|
|
8
|
-
* Queue route for `$ai_*` events, kept on the legacy (v0) transport in v1 mode and isolated on
|
|
9
|
-
* its own queue so a v0 failure can't re-send events already accepted on the V1 route. This route
|
|
10
|
-
* will later host a dedicated v1 AI-events transport once that endpoint exists — segregating it
|
|
11
|
-
* now means no re-plumbing then.
|
|
12
|
-
*/
|
|
13
|
-
export declare const AI_ROUTE = "ai";
|
|
14
|
-
/**
|
|
15
|
-
* True for events that must keep using the legacy (v0) submitter even when the
|
|
16
|
-
* client is in v1 mode. Today that is only `$ai_*` events: the dedicated AI
|
|
17
|
-
* ingestion path has no v1 form, so they stay on v0 until AI v1 is designed.
|
|
18
|
-
* The check runs on the post-`before_send` event name.
|
|
19
|
-
*/
|
|
20
|
-
export declare function isLegacyOnlyEvent(message: PostHogEventProperties): boolean;
|
|
21
|
-
//# sourceMappingURL=routing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/capture-v1/routing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAK3D;;;GAGG;AACH,eAAO,MAAM,eAAe,cAAc,CAAA;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,OAAO,CAAA;AAE5B;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAE1E"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const AI_EVENT_PREFIX = '$ai_';
|
|
2
|
-
const ANALYTICS_ROUTE = 'analytics';
|
|
3
|
-
const AI_ROUTE = 'ai';
|
|
4
|
-
function isLegacyOnlyEvent(message) {
|
|
5
|
-
return 'string' == typeof message.event && message.event.startsWith(AI_EVENT_PREFIX);
|
|
6
|
-
}
|
|
7
|
-
export { AI_ROUTE, ANALYTICS_ROUTE, isLegacyOnlyEvent };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { PostHogEventProperties, safeJsonStringify } from '@posthog/core'
|
|
2
|
-
|
|
3
|
-
import { AI_BATCH_TARGET_BYTES, AI_MAX_EVENT_BYTES } from './routing'
|
|
4
|
-
|
|
5
|
-
const encoder = new TextEncoder()
|
|
6
|
-
|
|
7
|
-
export type AiBatchPartition = {
|
|
8
|
-
batches: PostHogEventProperties[][]
|
|
9
|
-
dropped: { event: string; bytes: number }[]
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function eventByteSize(message: PostHogEventProperties): number {
|
|
13
|
-
return encoder.encode(safeJsonStringify(message)).length
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function partitionAiBatch(
|
|
17
|
-
messages: (PostHogEventProperties | undefined)[],
|
|
18
|
-
maxEventBytes: number = AI_MAX_EVENT_BYTES,
|
|
19
|
-
targetBatchBytes: number = AI_BATCH_TARGET_BYTES
|
|
20
|
-
): AiBatchPartition {
|
|
21
|
-
const batches: PostHogEventProperties[][] = []
|
|
22
|
-
const dropped: { event: string; bytes: number }[] = []
|
|
23
|
-
let current: PostHogEventProperties[] = []
|
|
24
|
-
let currentBytes = 0
|
|
25
|
-
|
|
26
|
-
for (const message of messages) {
|
|
27
|
-
if (message === undefined) {
|
|
28
|
-
continue
|
|
29
|
-
}
|
|
30
|
-
const bytes = eventByteSize(message)
|
|
31
|
-
if (bytes > maxEventBytes) {
|
|
32
|
-
dropped.push({ event: typeof message.event === 'string' ? message.event : 'unknown', bytes })
|
|
33
|
-
continue
|
|
34
|
-
}
|
|
35
|
-
if (current.length > 0 && currentBytes + bytes > targetBatchBytes) {
|
|
36
|
-
batches.push(current)
|
|
37
|
-
current = []
|
|
38
|
-
currentBytes = 0
|
|
39
|
-
}
|
|
40
|
-
current.push(message)
|
|
41
|
-
currentBytes += bytes
|
|
42
|
-
}
|
|
43
|
-
if (current.length > 0) {
|
|
44
|
-
batches.push(current)
|
|
45
|
-
}
|
|
46
|
-
return { batches, dropped }
|
|
47
|
-
}
|
package/src/capture-v1/config.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/** Capture submission mode: `v0` is the legacy `/batch/` endpoint, `v1` is `/i/v1/analytics/events`. */
|
|
2
|
-
export type CaptureMode = 'v0' | 'v1'
|
|
3
|
-
|
|
4
|
-
function isCaptureMode(value: unknown): value is CaptureMode {
|
|
5
|
-
return value === 'v0' || value === 'v1'
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Resolve the effective capture mode from the `POSTHOG_CAPTURE_MODE` environment
|
|
10
|
-
* variable (guarded for edge / no-`process` runtimes). The default is `v0`, so
|
|
11
|
-
* existing users are unaffected unless they explicitly opt in. Capture V1 is
|
|
12
|
-
* intentionally env-var-only during the transition — there is no public option,
|
|
13
|
-
* so nothing on the API surface has to be removed when v1 becomes the default.
|
|
14
|
-
*/
|
|
15
|
-
export function resolveCaptureMode(): CaptureMode {
|
|
16
|
-
const envMode = typeof process !== 'undefined' ? process.env?.POSTHOG_CAPTURE_MODE : undefined
|
|
17
|
-
return isCaptureMode(envMode) ? envMode : 'v0'
|
|
18
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { PostHogEventProperties } from '@posthog/core'
|
|
2
|
-
|
|
3
|
-
/** Event-name prefix for AI analytics events, which have no Capture V1 form yet. */
|
|
4
|
-
const AI_EVENT_PREFIX = '$ai_'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Queue route for events eligible for Capture V1 (everything except `$ai_*`). Its queue is the
|
|
8
|
-
* historical {@link PostHogPersistedProperty.Queue}, so v0 mode is byte-identical to before.
|
|
9
|
-
*/
|
|
10
|
-
export const ANALYTICS_ROUTE = 'analytics'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Queue route for `$ai_*` events, kept on the legacy (v0) transport in v1 mode and isolated on
|
|
14
|
-
* its own queue so a v0 failure can't re-send events already accepted on the V1 route. This route
|
|
15
|
-
* will later host a dedicated v1 AI-events transport once that endpoint exists — segregating it
|
|
16
|
-
* now means no re-plumbing then.
|
|
17
|
-
*/
|
|
18
|
-
export const AI_ROUTE = 'ai'
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* True for events that must keep using the legacy (v0) submitter even when the
|
|
22
|
-
* client is in v1 mode. Today that is only `$ai_*` events: the dedicated AI
|
|
23
|
-
* ingestion path has no v1 form, so they stay on v0 until AI v1 is designed.
|
|
24
|
-
* The check runs on the post-`before_send` event name.
|
|
25
|
-
*/
|
|
26
|
-
export function isLegacyOnlyEvent(message: PostHogEventProperties): boolean {
|
|
27
|
-
return typeof message.event === 'string' && message.event.startsWith(AI_EVENT_PREFIX)
|
|
28
|
-
}
|