posthog-node 5.74.0 → 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 +456 -228
- package/dist/client.mjs +455 -227
- 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/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/types.d.ts +191 -27
- package/dist/types.d.ts.map +1 -1
- 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 +845 -422
- 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/flag-events.ts +5 -2
- package/src/types.ts +211 -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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as zlib from 'node:zlib';
|
|
2
|
+
import type { CaptureCompressor } from './capture-v1/compression';
|
|
3
|
+
type ZlibCompress = typeof zlib.gzip;
|
|
4
|
+
/** The zlib functions the compressor uses; `zstdCompress` exists from Node 22.15. */
|
|
5
|
+
export interface ZlibCodecs {
|
|
6
|
+
gzip: ZlibCompress;
|
|
7
|
+
deflate: ZlibCompress;
|
|
8
|
+
zstdCompress?: ZlibCompress;
|
|
9
|
+
}
|
|
10
|
+
export declare function createZlibCompressor(codecs?: ZlibCodecs): CaptureCompressor;
|
|
11
|
+
export declare const zlibCompressor: CaptureCompressor;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=compression.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compression.node.d.ts","sourceRoot":"","sources":["../src/compression.node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAGjC,OAAO,KAAK,EAAgB,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE/E,KAAK,YAAY,GAAG,OAAO,IAAI,CAAC,IAAI,CAAA;AAEpC,qFAAqF;AACrF,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,EAAE,YAAY,CAAA;IACrB,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B;AAED,wBAAgB,oBAAoB,CAAC,MAAM,GAAE,UAA+B,GAAG,iBAAiB,CAa/F;AAED,eAAO,MAAM,cAAc,mBAAyB,CAAA"}
|
|
@@ -27,25 +27,32 @@ var __webpack_require__ = {};
|
|
|
27
27
|
})();
|
|
28
28
|
var __webpack_exports__ = {};
|
|
29
29
|
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
const AI_EVENT_PREFIX = '$ai_';
|
|
31
|
-
const ANALYTICS_ROUTE = 'analytics';
|
|
32
|
-
const AI_ROUTE = 'ai';
|
|
33
|
-
function isLegacyOnlyEvent(message) {
|
|
34
|
-
return 'string' == typeof message.event && message.event.startsWith(AI_EVENT_PREFIX);
|
|
35
|
-
}
|
|
36
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
AI_ROUTE: AI_ROUTE,
|
|
40
|
-
ANALYTICS_ROUTE: ANALYTICS_ROUTE
|
|
31
|
+
createZlibCompressor: ()=>createZlibCompressor,
|
|
32
|
+
zlibCompressor: ()=>zlibCompressor
|
|
41
33
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
const external_node_zlib_namespaceObject = require("node:zlib");
|
|
35
|
+
const external_node_util_namespaceObject = require("node:util");
|
|
36
|
+
function createZlibCompressor(codecs = external_node_zlib_namespaceObject) {
|
|
37
|
+
const compressors = {
|
|
38
|
+
gzip: (0, external_node_util_namespaceObject.promisify)(codecs.gzip),
|
|
39
|
+
deflate: (0, external_node_util_namespaceObject.promisify)(codecs.deflate),
|
|
40
|
+
zstd: 'function' == typeof codecs.zstdCompress ? (0, external_node_util_namespaceObject.promisify)(codecs.zstdCompress) : void 0
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
supports: (codec)=>void 0 !== compressors[codec],
|
|
44
|
+
async compress (payload, codec) {
|
|
45
|
+
const compress = compressors[codec];
|
|
46
|
+
return compress ? new Uint8Array(await compress(payload)) : null;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const zlibCompressor = createZlibCompressor();
|
|
51
|
+
exports.createZlibCompressor = __webpack_exports__.createZlibCompressor;
|
|
52
|
+
exports.zlibCompressor = __webpack_exports__.zlibCompressor;
|
|
45
53
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"isLegacyOnlyEvent"
|
|
54
|
+
"createZlibCompressor",
|
|
55
|
+
"zlibCompressor"
|
|
49
56
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
50
57
|
Object.defineProperty(exports, '__esModule', {
|
|
51
58
|
value: true
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as __rspack_external_node_zlib_95aae9d4 from "node:zlib";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
function createZlibCompressor(codecs = __rspack_external_node_zlib_95aae9d4) {
|
|
4
|
+
const compressors = {
|
|
5
|
+
gzip: promisify(codecs.gzip),
|
|
6
|
+
deflate: promisify(codecs.deflate),
|
|
7
|
+
zstd: 'function' == typeof codecs.zstdCompress ? promisify(codecs.zstdCompress) : void 0
|
|
8
|
+
};
|
|
9
|
+
return {
|
|
10
|
+
supports: (codec)=>void 0 !== compressors[codec],
|
|
11
|
+
async compress (payload, codec) {
|
|
12
|
+
const compress = compressors[codec];
|
|
13
|
+
return compress ? new Uint8Array(await compress(payload)) : null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const zlibCompressor = createZlibCompressor();
|
|
18
|
+
export { createZlibCompressor, zlibCompressor };
|
|
@@ -4,9 +4,11 @@ import { PostHogBackendClient } from '../client';
|
|
|
4
4
|
import { ErrorTracking as CoreErrorTracking } from '@posthog/core';
|
|
5
5
|
import type { SpanContextManager } from '@posthog/core';
|
|
6
6
|
import { PostHogContext } from '../extensions/context/context';
|
|
7
|
+
import type { CaptureCompressor } from '../capture-v1/compression';
|
|
7
8
|
export declare class PostHog extends PostHogBackendClient {
|
|
8
9
|
getLibraryId(): string;
|
|
9
10
|
protected compressPayload(payload: string): Promise<PostHogFetchBodyBytes | null>;
|
|
11
|
+
protected captureCompressor(): CaptureCompressor;
|
|
10
12
|
protected initializeContext(): PostHogContext;
|
|
11
13
|
protected initializeSpanContextManager(): SpanContextManager;
|
|
12
14
|
protected hostResourceAttributes(): Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../../src/entrypoints/index.node.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAM1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../../src/entrypoints/index.node.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAM1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAE9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAKlE,qBAAa,OAAQ,SAAQ,oBAAoB;IAC/C,YAAY,IAAI,MAAM,CAErB;IAED,UAAmB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAEzF;IAED,UAAmB,iBAAiB,IAAI,iBAAiB,CAExD;IAED,SAAS,CAAC,iBAAiB,IAAI,cAAc,CAE5C;IAED,UAAmB,4BAA4B,IAAI,kBAAkB,CAEpE;IAED,UAAmB,sBAAsB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAElE;IAED,UAAmB,4BAA4B,IAAI,iBAAiB,CAAC,sBAAsB,CAgB1F;CACF"}
|
|
@@ -3,6 +3,9 @@ var __webpack_modules__ = {
|
|
|
3
3
|
"../client" (module) {
|
|
4
4
|
module.exports = require("../client.js");
|
|
5
5
|
},
|
|
6
|
+
"../compression.node" (module) {
|
|
7
|
+
module.exports = require("../compression.node.js");
|
|
8
|
+
},
|
|
6
9
|
"../exports" (module) {
|
|
7
10
|
module.exports = require("../exports.js");
|
|
8
11
|
},
|
|
@@ -92,14 +95,18 @@ var __webpack_exports__ = {};
|
|
|
92
95
|
var _posthog_core__rspack_import_5 = __webpack_require__("@posthog/core");
|
|
93
96
|
var _extensions_context_context__rspack_import_6 = __webpack_require__("../extensions/context/context");
|
|
94
97
|
var _extensions_context_span_context_node__rspack_import_7 = __webpack_require__("../extensions/context/span-context.node");
|
|
95
|
-
var
|
|
96
|
-
var
|
|
98
|
+
var _compression_node__rspack_import_8 = __webpack_require__("../compression.node");
|
|
99
|
+
var _gzip_node__rspack_import_9 = __webpack_require__("../gzip.node");
|
|
100
|
+
var _host_os_node__rspack_import_10 = __webpack_require__("../host-os.node");
|
|
97
101
|
class PostHog extends _client__rspack_import_4.PostHogBackendClient {
|
|
98
102
|
getLibraryId() {
|
|
99
103
|
return 'posthog-node';
|
|
100
104
|
}
|
|
101
105
|
compressPayload(payload) {
|
|
102
|
-
return (0,
|
|
106
|
+
return (0, _gzip_node__rspack_import_9.gzipCompress)(payload, this.isDebug);
|
|
107
|
+
}
|
|
108
|
+
captureCompressor() {
|
|
109
|
+
return _compression_node__rspack_import_8.zlibCompressor;
|
|
103
110
|
}
|
|
104
111
|
initializeContext() {
|
|
105
112
|
return new _extensions_context_context__rspack_import_6.PostHogContext();
|
|
@@ -108,7 +115,7 @@ var __webpack_exports__ = {};
|
|
|
108
115
|
return new _extensions_context_span_context_node__rspack_import_7.AsyncLocalStorageSpanContextManager();
|
|
109
116
|
}
|
|
110
117
|
hostResourceAttributes() {
|
|
111
|
-
return (0,
|
|
118
|
+
return (0, _host_os_node__rspack_import_10.hostOsResourceAttributes)();
|
|
112
119
|
}
|
|
113
120
|
createErrorPropertiesBuilder() {
|
|
114
121
|
return new _posthog_core__rspack_import_5.ErrorTracking.ErrorPropertiesBuilder([
|
|
@@ -5,6 +5,7 @@ import { PostHogBackendClient } from "../client.mjs";
|
|
|
5
5
|
import { ErrorTracking } from "@posthog/core";
|
|
6
6
|
import { PostHogContext } from "../extensions/context/context.mjs";
|
|
7
7
|
import { AsyncLocalStorageSpanContextManager } from "../extensions/context/span-context.node.mjs";
|
|
8
|
+
import { zlibCompressor } from "../compression.node.mjs";
|
|
8
9
|
import { gzipCompress } from "../gzip.node.mjs";
|
|
9
10
|
import { hostOsResourceAttributes } from "../host-os.node.mjs";
|
|
10
11
|
export * from "../exports.mjs";
|
|
@@ -15,6 +16,9 @@ class PostHog extends PostHogBackendClient {
|
|
|
15
16
|
compressPayload(payload) {
|
|
16
17
|
return gzipCompress(payload, this.isDebug);
|
|
17
18
|
}
|
|
19
|
+
captureCompressor() {
|
|
20
|
+
return zlibCompressor;
|
|
21
|
+
}
|
|
18
22
|
initializeContext() {
|
|
19
23
|
return new PostHogContext();
|
|
20
24
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type JsonType, type PostHogEventProperties } from '@posthog/core';
|
|
2
|
+
/** One layer of default values, or nothing. */
|
|
3
|
+
export type DefaultsLayer = Readonly<Record<string, unknown>> | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* A property is unset when its key is missing or its value is `undefined`; `null` is a value.
|
|
6
|
+
* `$lib` and `$lib_version` are unset unless they hold a non-empty string.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isUnsetProperty(properties: PostHogEventProperties, key: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Fill the SDK's own `$lib` and `$lib_version`, after every other layer. When no layer set
|
|
11
|
+
* `$lib`, both get the SDK's values, replacing a lone `$lib_version`. When `$lib` is the SDK's
|
|
12
|
+
* own name, only a missing `$lib_version` is filled. Any other `$lib` keeps the pair as set.
|
|
13
|
+
*/
|
|
14
|
+
export declare function fillLibraryProperties(properties: PostHogEventProperties, libraryId: string, libraryVersion: string): void;
|
|
15
|
+
/** An option is unset when its key is missing or its value is `undefined` or `null`. */
|
|
16
|
+
export declare function isUnsetOption(options: Record<string, unknown>, key: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Fill the properties the event left unset from each layer in turn, highest layer first, so a
|
|
19
|
+
* value from an earlier layer is never replaced. A layer's `$lib` or `$lib_version` counts only
|
|
20
|
+
* when it is a non-empty string. `$set`, `$set_once`, `$groups` and `$group_set`
|
|
21
|
+
* fill one level deep when both values are objects without their own `toJSON`. Keys in `skipKeys` are never filled.
|
|
22
|
+
*/
|
|
23
|
+
export declare function fillProperties(properties: PostHogEventProperties, layers: readonly DefaultsLayer[], skipKeys?: readonly string[]): void;
|
|
24
|
+
/** Fill the options the event left unset from each layer in turn, highest layer first. */
|
|
25
|
+
export declare function fillOptions(options: Record<string, JsonType>, layers: readonly DefaultsLayer[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* Set `process_person_profile` on an identify-style event from the call alone, so no layered
|
|
28
|
+
* `false` makes it personless: the call's option, else its legacy `$process_person_profile`, else
|
|
29
|
+
* `true` unless the distinct id is SDK-generated. Read `callerLegacyValue` before any layer fills
|
|
30
|
+
* properties, since a filled value looks like the caller's.
|
|
31
|
+
*/
|
|
32
|
+
export declare function fillIdentifyStylePersonProfile(event: string, options: Record<string, JsonType>, callerLegacyValue: JsonType | undefined, hasDistinctId: boolean): void;
|
|
33
|
+
/**
|
|
34
|
+
* Remove `$process_person_profile` from an identify-style event whose option is set, after every
|
|
35
|
+
* fill. The option already wins when the event is sent, and a `beforeSend` hook that drops
|
|
36
|
+
* `options` must not bring back a layered `false`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function dropIdentifyStyleLegacyPersonProfile(event: string, options: Record<string, JsonType>, properties: PostHogEventProperties): void;
|
|
39
|
+
/**
|
|
40
|
+
* An object whose inner keys can be filled. A value with its own `toJSON` is sent as it encodes
|
|
41
|
+
* itself, which can hide some of its fields, so copying its entries would bypass that encoding.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isMergeableObject(value: unknown): value is Record<string, unknown>;
|
|
44
|
+
/** A shallow copy of a layer read at capture time, or undefined when it is not an object. */
|
|
45
|
+
export declare function snapshotLayer(layer: unknown): Record<string, unknown> | undefined;
|
|
46
|
+
//# sourceMappingURL=event-defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-defaults.d.ts","sourceRoot":"","sources":["../src/event-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC5B,MAAM,eAAe,CAAA;AAQtB,+CAA+C;AAC/C,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAA;AAUzE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,sBAAsB,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAExF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,sBAAsB,EAClC,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,GACrB,IAAI,CAON;AAED,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAEpF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,sBAAsB,EAClC,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,QAAQ,GAAE,SAAS,MAAM,EAAO,GAC/B,IAAI,CAiBN;AAED,0FAA0F;AAC1F,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,CAWrG;AAYD;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACjC,iBAAiB,EAAE,QAAQ,GAAG,SAAS,EACvC,aAAa,EAAE,OAAO,GACrB,IAAI,CASN;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACjC,UAAU,EAAE,sBAAsB,GACjC,IAAI,CAIN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWlF;AAaD,6FAA6F;AAC7F,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAEjF"}
|
|
@@ -0,0 +1,141 @@
|
|
|
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
|
+
dropIdentifyStyleLegacyPersonProfile: ()=>dropIdentifyStyleLegacyPersonProfile,
|
|
32
|
+
fillIdentifyStylePersonProfile: ()=>fillIdentifyStylePersonProfile,
|
|
33
|
+
fillLibraryProperties: ()=>fillLibraryProperties,
|
|
34
|
+
fillOptions: ()=>fillOptions,
|
|
35
|
+
fillProperties: ()=>fillProperties,
|
|
36
|
+
isMergeableObject: ()=>isMergeableObject,
|
|
37
|
+
isUnsetOption: ()=>isUnsetOption,
|
|
38
|
+
isUnsetProperty: ()=>isUnsetProperty,
|
|
39
|
+
snapshotLayer: ()=>snapshotLayer
|
|
40
|
+
});
|
|
41
|
+
const core_namespaceObject = require("@posthog/core");
|
|
42
|
+
const NESTED_FILL_PROPERTIES = new Set([
|
|
43
|
+
'$set',
|
|
44
|
+
'$set_once',
|
|
45
|
+
'$groups',
|
|
46
|
+
'$group_set'
|
|
47
|
+
]);
|
|
48
|
+
const LIBRARY_PROPERTIES = new Set([
|
|
49
|
+
'$lib',
|
|
50
|
+
'$lib_version'
|
|
51
|
+
]);
|
|
52
|
+
function isPresentString(value) {
|
|
53
|
+
return 'string' == typeof value && value.length > 0;
|
|
54
|
+
}
|
|
55
|
+
function isUnsetValue(key, value) {
|
|
56
|
+
return LIBRARY_PROPERTIES.has(key) ? !isPresentString(value) : void 0 === value;
|
|
57
|
+
}
|
|
58
|
+
function isUnsetProperty(properties, key) {
|
|
59
|
+
return isUnsetValue(key, properties[key]);
|
|
60
|
+
}
|
|
61
|
+
function fillLibraryProperties(properties, libraryId, libraryVersion) {
|
|
62
|
+
if (isUnsetProperty(properties, '$lib')) {
|
|
63
|
+
properties.$lib = libraryId;
|
|
64
|
+
properties.$lib_version = libraryVersion;
|
|
65
|
+
} else if (properties.$lib === libraryId && isUnsetProperty(properties, '$lib_version')) properties.$lib_version = libraryVersion;
|
|
66
|
+
}
|
|
67
|
+
function isUnsetOption(options, key) {
|
|
68
|
+
return void 0 === options[key] || null === options[key];
|
|
69
|
+
}
|
|
70
|
+
function fillProperties(properties, layers, skipKeys = []) {
|
|
71
|
+
for (const layer of layers)if (layer) for (const [key, value] of Object.entries(layer)){
|
|
72
|
+
if (isUnsetValue(key, value) || skipKeys.includes(key)) continue;
|
|
73
|
+
const existing = properties[key];
|
|
74
|
+
if (isUnsetValue(key, existing)) properties[key] = value;
|
|
75
|
+
else if (NESTED_FILL_PROPERTIES.has(key) && isMergeableObject(existing) && isMergeableObject(value)) properties[key] = fillNested(existing, value);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function fillOptions(options, layers) {
|
|
79
|
+
for (const layer of layers)if (layer) {
|
|
80
|
+
for (const [key, value] of Object.entries(layer))if (void 0 !== value && isUnsetOption(options, key)) options[key] = value;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const IDENTIFY_STYLE_EVENTS = new Set([
|
|
84
|
+
'$identify',
|
|
85
|
+
'$create_alias',
|
|
86
|
+
'$merge_dangerously',
|
|
87
|
+
'$groupidentify',
|
|
88
|
+
'$set',
|
|
89
|
+
'$set_once'
|
|
90
|
+
]);
|
|
91
|
+
function fillIdentifyStylePersonProfile(event, options, callerLegacyValue, hasDistinctId) {
|
|
92
|
+
if (!IDENTIFY_STYLE_EVENTS.has(event) || !isUnsetOption(options, 'process_person_profile')) return;
|
|
93
|
+
if (null != callerLegacyValue) options.process_person_profile = callerLegacyValue;
|
|
94
|
+
else if (hasDistinctId) options.process_person_profile = true;
|
|
95
|
+
}
|
|
96
|
+
function dropIdentifyStyleLegacyPersonProfile(event, options, properties) {
|
|
97
|
+
if (IDENTIFY_STYLE_EVENTS.has(event) && !isUnsetOption(options, 'process_person_profile')) delete properties[core_namespaceObject.EVENT_OPTION_LEGACY_PROPERTIES.process_person_profile];
|
|
98
|
+
}
|
|
99
|
+
function isMergeableObject(value) {
|
|
100
|
+
if (!(0, core_namespaceObject.isPlainObject)(value)) return false;
|
|
101
|
+
try {
|
|
102
|
+
return 'function' != typeof value.toJSON;
|
|
103
|
+
} catch {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function fillNested(existing, defaults) {
|
|
108
|
+
const filled = {
|
|
109
|
+
...existing
|
|
110
|
+
};
|
|
111
|
+
for (const [key, value] of Object.entries(defaults))if (void 0 === filled[key] && void 0 !== value) filled[key] = value;
|
|
112
|
+
return filled;
|
|
113
|
+
}
|
|
114
|
+
function snapshotLayer(layer) {
|
|
115
|
+
return (0, core_namespaceObject.isPlainObject)(layer) ? {
|
|
116
|
+
...layer
|
|
117
|
+
} : void 0;
|
|
118
|
+
}
|
|
119
|
+
exports.dropIdentifyStyleLegacyPersonProfile = __webpack_exports__.dropIdentifyStyleLegacyPersonProfile;
|
|
120
|
+
exports.fillIdentifyStylePersonProfile = __webpack_exports__.fillIdentifyStylePersonProfile;
|
|
121
|
+
exports.fillLibraryProperties = __webpack_exports__.fillLibraryProperties;
|
|
122
|
+
exports.fillOptions = __webpack_exports__.fillOptions;
|
|
123
|
+
exports.fillProperties = __webpack_exports__.fillProperties;
|
|
124
|
+
exports.isMergeableObject = __webpack_exports__.isMergeableObject;
|
|
125
|
+
exports.isUnsetOption = __webpack_exports__.isUnsetOption;
|
|
126
|
+
exports.isUnsetProperty = __webpack_exports__.isUnsetProperty;
|
|
127
|
+
exports.snapshotLayer = __webpack_exports__.snapshotLayer;
|
|
128
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
129
|
+
"dropIdentifyStyleLegacyPersonProfile",
|
|
130
|
+
"fillIdentifyStylePersonProfile",
|
|
131
|
+
"fillLibraryProperties",
|
|
132
|
+
"fillOptions",
|
|
133
|
+
"fillProperties",
|
|
134
|
+
"isMergeableObject",
|
|
135
|
+
"isUnsetOption",
|
|
136
|
+
"isUnsetProperty",
|
|
137
|
+
"snapshotLayer"
|
|
138
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
139
|
+
Object.defineProperty(exports, '__esModule', {
|
|
140
|
+
value: true
|
|
141
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { EVENT_OPTION_LEGACY_PROPERTIES, isPlainObject } from "@posthog/core";
|
|
2
|
+
const NESTED_FILL_PROPERTIES = new Set([
|
|
3
|
+
'$set',
|
|
4
|
+
'$set_once',
|
|
5
|
+
'$groups',
|
|
6
|
+
'$group_set'
|
|
7
|
+
]);
|
|
8
|
+
const LIBRARY_PROPERTIES = new Set([
|
|
9
|
+
'$lib',
|
|
10
|
+
'$lib_version'
|
|
11
|
+
]);
|
|
12
|
+
function isPresentString(value) {
|
|
13
|
+
return 'string' == typeof value && value.length > 0;
|
|
14
|
+
}
|
|
15
|
+
function isUnsetValue(key, value) {
|
|
16
|
+
return LIBRARY_PROPERTIES.has(key) ? !isPresentString(value) : void 0 === value;
|
|
17
|
+
}
|
|
18
|
+
function isUnsetProperty(properties, key) {
|
|
19
|
+
return isUnsetValue(key, properties[key]);
|
|
20
|
+
}
|
|
21
|
+
function fillLibraryProperties(properties, libraryId, libraryVersion) {
|
|
22
|
+
if (isUnsetProperty(properties, '$lib')) {
|
|
23
|
+
properties.$lib = libraryId;
|
|
24
|
+
properties.$lib_version = libraryVersion;
|
|
25
|
+
} else if (properties.$lib === libraryId && isUnsetProperty(properties, '$lib_version')) properties.$lib_version = libraryVersion;
|
|
26
|
+
}
|
|
27
|
+
function isUnsetOption(options, key) {
|
|
28
|
+
return void 0 === options[key] || null === options[key];
|
|
29
|
+
}
|
|
30
|
+
function fillProperties(properties, layers, skipKeys = []) {
|
|
31
|
+
for (const layer of layers)if (layer) for (const [key, value] of Object.entries(layer)){
|
|
32
|
+
if (isUnsetValue(key, value) || skipKeys.includes(key)) continue;
|
|
33
|
+
const existing = properties[key];
|
|
34
|
+
if (isUnsetValue(key, existing)) properties[key] = value;
|
|
35
|
+
else if (NESTED_FILL_PROPERTIES.has(key) && isMergeableObject(existing) && isMergeableObject(value)) properties[key] = fillNested(existing, value);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function fillOptions(options, layers) {
|
|
39
|
+
for (const layer of layers)if (layer) {
|
|
40
|
+
for (const [key, value] of Object.entries(layer))if (void 0 !== value && isUnsetOption(options, key)) options[key] = value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const IDENTIFY_STYLE_EVENTS = new Set([
|
|
44
|
+
'$identify',
|
|
45
|
+
'$create_alias',
|
|
46
|
+
'$merge_dangerously',
|
|
47
|
+
'$groupidentify',
|
|
48
|
+
'$set',
|
|
49
|
+
'$set_once'
|
|
50
|
+
]);
|
|
51
|
+
function fillIdentifyStylePersonProfile(event, options, callerLegacyValue, hasDistinctId) {
|
|
52
|
+
if (!IDENTIFY_STYLE_EVENTS.has(event) || !isUnsetOption(options, 'process_person_profile')) return;
|
|
53
|
+
if (null != callerLegacyValue) options.process_person_profile = callerLegacyValue;
|
|
54
|
+
else if (hasDistinctId) options.process_person_profile = true;
|
|
55
|
+
}
|
|
56
|
+
function dropIdentifyStyleLegacyPersonProfile(event, options, properties) {
|
|
57
|
+
if (IDENTIFY_STYLE_EVENTS.has(event) && !isUnsetOption(options, 'process_person_profile')) delete properties[EVENT_OPTION_LEGACY_PROPERTIES.process_person_profile];
|
|
58
|
+
}
|
|
59
|
+
function isMergeableObject(value) {
|
|
60
|
+
if (!isPlainObject(value)) return false;
|
|
61
|
+
try {
|
|
62
|
+
return 'function' != typeof value.toJSON;
|
|
63
|
+
} catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function fillNested(existing, defaults) {
|
|
68
|
+
const filled = {
|
|
69
|
+
...existing
|
|
70
|
+
};
|
|
71
|
+
for (const [key, value] of Object.entries(defaults))if (void 0 === filled[key] && void 0 !== value) filled[key] = value;
|
|
72
|
+
return filled;
|
|
73
|
+
}
|
|
74
|
+
function snapshotLayer(layer) {
|
|
75
|
+
return isPlainObject(layer) ? {
|
|
76
|
+
...layer
|
|
77
|
+
} : void 0;
|
|
78
|
+
}
|
|
79
|
+
export { dropIdentifyStyleLegacyPersonProfile, fillIdentifyStylePersonProfile, fillLibraryProperties, fillOptions, fillProperties, isMergeableObject, isUnsetOption, isUnsetProperty, snapshotLayer };
|
package/dist/exports.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export * from './extensions/fetch-request';
|
|
|
4
4
|
export * from './types';
|
|
5
5
|
export { enrichCurrentSpan } from './extensions/context/listeners';
|
|
6
6
|
export { FeatureFlagEvaluations } from './feature-flag-evaluations';
|
|
7
|
+
export { CaptureError } from './capture-v1/errors';
|
|
8
|
+
export type { CaptureDroppedEvent, CaptureErrorParams } from './capture-v1/errors';
|
|
9
|
+
export type { CaptureEndpoint } from './capture-v1/types';
|
|
7
10
|
export { EmailError } from './emails/errors';
|
|
8
11
|
export type { EmailErrorName } from './emails/errors';
|
|
9
12
|
export type { CodeEmailForm, EmailAttachment, EmailDeliveryStatus, EmailPreferences, EmailReactElement, Emails, EmailStatus, EmailTracking, EmailWarning, GetEmailResponse, SendCodeEmailOptions, SendEmailBase, SendEmailOptions, SendEmailResponse, SendEmailResult, SendTemplateEmailOptions, SetEmailPreferencesOptions, SetEmailPreferencesResponse, TemplateEmailForm, } from './emails/types';
|
package/dist/exports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACrD,YAAY,EACV,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,EACN,WAAW,EACX,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,0BAA0B,EAC1B,2BAA2B,EAC3B,iBAAiB,GAClB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EACV,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,kCAAkC,CAAA;AAIzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAI/E,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAInG,YAAY,EACV,IAAI,EACJ,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,YAAY,GACb,MAAM,eAAe,CAAA;AAKtB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,GACP,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAClF,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACrD,YAAY,EACV,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,EACN,WAAW,EACX,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,0BAA0B,EAC1B,2BAA2B,EAC3B,iBAAiB,GAClB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EACV,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,kCAAkC,CAAA;AAIzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAI/E,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAInG,YAAY,EACV,IAAI,EACJ,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,YAAY,GACb,MAAM,eAAe,CAAA;AAKtB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,GACP,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/exports.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
+
"./capture-v1/errors" (module) {
|
|
4
|
+
module.exports = require("./capture-v1/errors.js");
|
|
5
|
+
},
|
|
3
6
|
"./emails/errors" (module) {
|
|
4
7
|
module.exports = require("./emails/errors.js");
|
|
5
8
|
},
|
|
@@ -80,6 +83,7 @@ var __webpack_exports__ = {};
|
|
|
80
83
|
"readPostHogCookie",
|
|
81
84
|
"cookieStoreFromHeader",
|
|
82
85
|
"getPostHogCookieName",
|
|
86
|
+
"CaptureError",
|
|
83
87
|
"default",
|
|
84
88
|
"cookieStateToProperties",
|
|
85
89
|
"serializePostHogCookie",
|
|
@@ -97,6 +101,7 @@ var __webpack_exports__ = {};
|
|
|
97
101
|
"readPostHogCookie",
|
|
98
102
|
"cookieStoreFromHeader",
|
|
99
103
|
"getPostHogCookieName",
|
|
104
|
+
"CaptureError",
|
|
100
105
|
"default",
|
|
101
106
|
"cookieStateToProperties",
|
|
102
107
|
"serializePostHogCookie",
|
|
@@ -114,6 +119,7 @@ var __webpack_exports__ = {};
|
|
|
114
119
|
"readPostHogCookie",
|
|
115
120
|
"cookieStoreFromHeader",
|
|
116
121
|
"getPostHogCookieName",
|
|
122
|
+
"CaptureError",
|
|
117
123
|
"default",
|
|
118
124
|
"cookieStateToProperties",
|
|
119
125
|
"serializePostHogCookie",
|
|
@@ -131,6 +137,7 @@ var __webpack_exports__ = {};
|
|
|
131
137
|
"readPostHogCookie",
|
|
132
138
|
"cookieStoreFromHeader",
|
|
133
139
|
"getPostHogCookieName",
|
|
140
|
+
"CaptureError",
|
|
134
141
|
"default",
|
|
135
142
|
"cookieStateToProperties",
|
|
136
143
|
"serializePostHogCookie",
|
|
@@ -142,22 +149,25 @@ var __webpack_exports__ = {};
|
|
|
142
149
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
143
150
|
var _extensions_context_listeners__rspack_import_4 = __webpack_require__("./extensions/context/listeners");
|
|
144
151
|
var _feature_flag_evaluations__rspack_import_5 = __webpack_require__("./feature-flag-evaluations");
|
|
145
|
-
var
|
|
146
|
-
var
|
|
152
|
+
var _capture_v1_errors__rspack_import_6 = __webpack_require__("./capture-v1/errors");
|
|
153
|
+
var _emails_errors__rspack_import_7 = __webpack_require__("./emails/errors");
|
|
154
|
+
var _posthog_core__rspack_import_8 = __webpack_require__("@posthog/core");
|
|
147
155
|
__webpack_require__.d(__webpack_exports__, {
|
|
148
|
-
|
|
149
|
-
|
|
156
|
+
CaptureError: ()=>_capture_v1_errors__rspack_import_6.CaptureError,
|
|
157
|
+
EmailError: ()=>_emails_errors__rspack_import_7.EmailError,
|
|
158
|
+
FeatureFlagError: ()=>_posthog_core__rspack_import_8.FeatureFlagError,
|
|
150
159
|
FeatureFlagEvaluations: ()=>_feature_flag_evaluations__rspack_import_5.FeatureFlagEvaluations,
|
|
151
|
-
cookieStateToProperties: ()=>
|
|
152
|
-
cookieStoreFromHeader: ()=>
|
|
160
|
+
cookieStateToProperties: ()=>_posthog_core__rspack_import_8.cookieStateToProperties,
|
|
161
|
+
cookieStoreFromHeader: ()=>_posthog_core__rspack_import_8.cookieStoreFromHeader,
|
|
153
162
|
enrichCurrentSpan: ()=>_extensions_context_listeners__rspack_import_4.enrichCurrentSpan,
|
|
154
|
-
getPostHogCookieName: ()=>
|
|
155
|
-
parsePostHogCookie: ()=>
|
|
156
|
-
readPostHogCookie: ()=>
|
|
157
|
-
serializePostHogCookie: ()=>
|
|
158
|
-
uuidv7: ()=>
|
|
163
|
+
getPostHogCookieName: ()=>_posthog_core__rspack_import_8.getPostHogCookieName,
|
|
164
|
+
parsePostHogCookie: ()=>_posthog_core__rspack_import_8.parsePostHogCookie,
|
|
165
|
+
readPostHogCookie: ()=>_posthog_core__rspack_import_8.readPostHogCookie,
|
|
166
|
+
serializePostHogCookie: ()=>_posthog_core__rspack_import_8.serializePostHogCookie,
|
|
167
|
+
uuidv7: ()=>_posthog_core__rspack_import_8.uuidv7
|
|
159
168
|
});
|
|
160
169
|
})();
|
|
170
|
+
exports.CaptureError = __webpack_exports__.CaptureError;
|
|
161
171
|
exports.EmailError = __webpack_exports__.EmailError;
|
|
162
172
|
exports.FeatureFlagError = __webpack_exports__.FeatureFlagError;
|
|
163
173
|
exports.FeatureFlagEvaluations = __webpack_exports__.FeatureFlagEvaluations;
|
|
@@ -170,6 +180,7 @@ exports.readPostHogCookie = __webpack_exports__.readPostHogCookie;
|
|
|
170
180
|
exports.serializePostHogCookie = __webpack_exports__.serializePostHogCookie;
|
|
171
181
|
exports.uuidv7 = __webpack_exports__.uuidv7;
|
|
172
182
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
183
|
+
"CaptureError",
|
|
173
184
|
"EmailError",
|
|
174
185
|
"FeatureFlagError",
|
|
175
186
|
"FeatureFlagEvaluations",
|
package/dist/exports.mjs
CHANGED
|
@@ -4,5 +4,6 @@ export * from "./extensions/fetch-request.mjs";
|
|
|
4
4
|
export * from "./types.mjs";
|
|
5
5
|
export { enrichCurrentSpan } from "./extensions/context/listeners.mjs";
|
|
6
6
|
export { FeatureFlagEvaluations } from "./feature-flag-evaluations.mjs";
|
|
7
|
+
export { CaptureError } from "./capture-v1/errors.mjs";
|
|
7
8
|
export { EmailError } from "./emails/errors.mjs";
|
|
8
9
|
export { FeatureFlagError, cookieStateToProperties, cookieStoreFromHeader, getPostHogCookieName, parsePostHogCookie, readPostHogCookie, serializePostHogCookie, uuidv7 } from "@posthog/core";
|
|
@@ -4,7 +4,6 @@ export declare class PostHogContext implements IPostHogContext {
|
|
|
4
4
|
constructor();
|
|
5
5
|
get(): ContextData | undefined;
|
|
6
6
|
run<T>(context: ContextData, fn: () => T, options?: ContextOptions): T;
|
|
7
|
-
enter(context: ContextData, options?: ContextOptions): void;
|
|
8
7
|
private resolve;
|
|
9
8
|
}
|
|
10
9
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/extensions/context/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAGtE,qBAAa,cAAe,YAAW,eAAe;IACpD,OAAO,CAAC,OAAO,CAAgC;IAE/C,cAEC;IAED,GAAG,IAAI,WAAW,GAAG,SAAS,CAG7B;IAED,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,CAAC,CAErE;IAED,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/extensions/context/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAGtE,qBAAa,cAAe,YAAW,eAAe;IACpD,OAAO,CAAC,OAAO,CAAgC;IAE/C,cAEC;IAED,GAAG,IAAI,WAAW,GAAG,SAAS,CAG7B;IAED,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,CAAC,CAErE;IAED,OAAO,CAAC,OAAO;CAuBhB"}
|
|
@@ -43,9 +43,6 @@ class PostHogContext {
|
|
|
43
43
|
run(context, fn, options) {
|
|
44
44
|
return this.storage.run(this.resolve(context, options), fn);
|
|
45
45
|
}
|
|
46
|
-
enter(context, options) {
|
|
47
|
-
this.storage.enterWith(this.resolve(context, options));
|
|
48
|
-
}
|
|
49
46
|
resolve(context, options) {
|
|
50
47
|
const current = this.get();
|
|
51
48
|
if (options?.fresh === true) return (0, external_lifetime_js_namespaceObject.inheritContextLifetime)(void 0, {
|
|
@@ -57,6 +54,10 @@ class PostHogContext {
|
|
|
57
54
|
properties: {
|
|
58
55
|
...current?.properties || {},
|
|
59
56
|
...context.properties || {}
|
|
57
|
+
},
|
|
58
|
+
options: {
|
|
59
|
+
...current?.options || {},
|
|
60
|
+
...context.options || {}
|
|
60
61
|
}
|
|
61
62
|
}, options?.signal);
|
|
62
63
|
}
|
|
@@ -11,9 +11,6 @@ class PostHogContext {
|
|
|
11
11
|
run(context, fn, options) {
|
|
12
12
|
return this.storage.run(this.resolve(context, options), fn);
|
|
13
13
|
}
|
|
14
|
-
enter(context, options) {
|
|
15
|
-
this.storage.enterWith(this.resolve(context, options));
|
|
16
|
-
}
|
|
17
14
|
resolve(context, options) {
|
|
18
15
|
const current = this.get();
|
|
19
16
|
if (options?.fresh === true) return inheritContextLifetime(void 0, {
|
|
@@ -25,6 +22,10 @@ class PostHogContext {
|
|
|
25
22
|
properties: {
|
|
26
23
|
...current?.properties || {},
|
|
27
24
|
...context.properties || {}
|
|
25
|
+
},
|
|
26
|
+
options: {
|
|
27
|
+
...current?.options || {},
|
|
28
|
+
...context.options || {}
|
|
28
29
|
}
|
|
29
30
|
}, options?.signal);
|
|
30
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-context.d.ts","sourceRoot":"","sources":["../../../src/extensions/context/event-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAK1C,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"event-context.d.ts","sourceRoot":"","sources":["../../../src/extensions/context/event-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAK1C,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,YAAY,CAK5G;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAE/G"}
|