@zuplo/cli 7.7.8 → 7.7.10
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/node_modules/@posthog/core/dist/error-tracking/parsers/base.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/error-tracking/parsers/base.js +19 -2
- package/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs +19 -2
- package/node_modules/@posthog/core/dist/index.d.ts +7 -0
- package/node_modules/@posthog/core/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/index.js +82 -21
- package/node_modules/@posthog/core/dist/index.mjs +4 -0
- package/node_modules/@posthog/core/dist/logs/index.d.ts +3 -2
- package/node_modules/@posthog/core/dist/logs/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/logs/index.js +28 -22
- package/node_modules/@posthog/core/dist/logs/index.mjs +29 -23
- package/node_modules/@posthog/core/dist/logs/logs-utils.js +1 -1
- package/node_modules/@posthog/core/dist/logs/logs-utils.mjs +2 -2
- package/node_modules/@posthog/core/dist/logs/types.d.ts +2 -2
- package/node_modules/@posthog/core/dist/metrics/index.d.ts +5 -2
- package/node_modules/@posthog/core/dist/metrics/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/metrics/index.js +28 -14
- package/node_modules/@posthog/core/dist/metrics/index.mjs +29 -15
- package/node_modules/@posthog/core/dist/metrics/metrics-utils.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/metrics/metrics-utils.js +1 -2
- package/node_modules/@posthog/core/dist/metrics/metrics-utils.mjs +2 -3
- package/node_modules/@posthog/core/dist/metrics/types.d.ts +7 -0
- package/node_modules/@posthog/core/dist/metrics/types.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +32 -4
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.js +68 -20
- package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +68 -20
- package/node_modules/@posthog/core/dist/traces/config.d.ts +13 -0
- package/node_modules/@posthog/core/dist/traces/config.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/config.js +101 -0
- package/node_modules/@posthog/core/dist/traces/config.mjs +63 -0
- package/node_modules/@posthog/core/dist/traces/context.d.ts +18 -0
- package/node_modules/@posthog/core/dist/traces/context.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/context.js +53 -0
- package/node_modules/@posthog/core/dist/traces/context.mjs +15 -0
- package/node_modules/@posthog/core/dist/traces/ids.d.ts +12 -0
- package/node_modules/@posthog/core/dist/traces/ids.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/ids.js +92 -0
- package/node_modules/@posthog/core/dist/traces/ids.mjs +42 -0
- package/node_modules/@posthog/core/dist/traces/index.d.ts +150 -0
- package/node_modules/@posthog/core/dist/traces/index.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/index.js +552 -0
- package/node_modules/@posthog/core/dist/traces/index.mjs +514 -0
- package/node_modules/@posthog/core/dist/traces/otlp.d.ts +24 -0
- package/node_modules/@posthog/core/dist/traces/otlp.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/otlp.js +158 -0
- package/node_modules/@posthog/core/dist/traces/otlp.mjs +108 -0
- package/node_modules/@posthog/core/dist/traces/sanitize.d.ts +32 -0
- package/node_modules/@posthog/core/dist/traces/sanitize.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/sanitize.js +93 -0
- package/node_modules/@posthog/core/dist/traces/sanitize.mjs +43 -0
- package/node_modules/@posthog/core/dist/traces/span.d.ts +198 -0
- package/node_modules/@posthog/core/dist/traces/span.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/span.js +538 -0
- package/node_modules/@posthog/core/dist/traces/span.mjs +467 -0
- package/node_modules/@posthog/core/dist/traces/traceparent.d.ts +51 -0
- package/node_modules/@posthog/core/dist/traces/traceparent.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/traceparent.js +116 -0
- package/node_modules/@posthog/core/dist/traces/traceparent.mjs +63 -0
- package/node_modules/@posthog/core/dist/traces/types.d.ts +114 -0
- package/node_modules/@posthog/core/dist/traces/types.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/types.js +18 -0
- package/node_modules/@posthog/core/dist/traces/types.mjs +1 -0
- package/node_modules/@posthog/core/dist/utils/backoff.d.ts +23 -0
- package/node_modules/@posthog/core/dist/utils/backoff.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/utils/backoff.js +65 -0
- package/node_modules/@posthog/core/dist/utils/backoff.mjs +14 -0
- package/node_modules/@posthog/core/dist/utils/flush-timer.d.ts +26 -0
- package/node_modules/@posthog/core/dist/utils/flush-timer.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/utils/flush-timer.js +67 -0
- package/node_modules/@posthog/core/dist/utils/flush-timer.mjs +29 -0
- package/node_modules/@posthog/core/dist/utils/index.d.ts +1 -0
- package/node_modules/@posthog/core/dist/utils/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/utils/index.js +22 -2
- package/node_modules/@posthog/core/dist/utils/index.mjs +8 -1
- package/node_modules/@posthog/core/dist/utils/json-utils.d.ts +7 -0
- package/node_modules/@posthog/core/dist/utils/json-utils.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/utils/json-utils.js +27 -0
- package/node_modules/@posthog/core/dist/utils/json-utils.mjs +25 -1
- package/node_modules/@posthog/core/dist/utils/otlp-resource.d.ts +13 -2
- package/node_modules/@posthog/core/dist/utils/otlp-resource.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/utils/otlp-resource.js +34 -7
- package/node_modules/@posthog/core/dist/utils/otlp-resource.mjs +26 -2
- package/node_modules/@posthog/core/dist/utils/retry-after.d.ts +55 -0
- package/node_modules/@posthog/core/dist/utils/retry-after.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/utils/retry-after.js +95 -0
- package/node_modules/@posthog/core/dist/utils/retry-after.mjs +50 -0
- package/node_modules/@posthog/core/package.json +3 -3
- package/node_modules/@posthog/core/src/error-tracking/parsers/base.spec.ts +77 -7
- package/node_modules/@posthog/core/src/error-tracking/parsers/base.ts +42 -19
- package/node_modules/@posthog/core/src/index.ts +18 -0
- package/node_modules/@posthog/core/src/logs/index.spec.ts +490 -2
- package/node_modules/@posthog/core/src/logs/index.ts +63 -31
- package/node_modules/@posthog/core/src/logs/logs-utils.ts +2 -2
- package/node_modules/@posthog/core/src/logs/types.ts +2 -2
- package/node_modules/@posthog/core/src/metrics/index.spec.ts +304 -0
- package/node_modules/@posthog/core/src/metrics/index.ts +53 -16
- package/node_modules/@posthog/core/src/metrics/metrics-utils.ts +2 -3
- package/node_modules/@posthog/core/src/metrics/types.ts +10 -2
- package/node_modules/@posthog/core/src/posthog-core-stateless.ts +157 -38
- package/node_modules/@posthog/core/src/traces/config.spec.ts +271 -0
- package/node_modules/@posthog/core/src/traces/config.ts +142 -0
- package/node_modules/@posthog/core/src/traces/context.ts +30 -0
- package/node_modules/@posthog/core/src/traces/ids.spec.ts +115 -0
- package/node_modules/@posthog/core/src/traces/ids.ts +75 -0
- package/node_modules/@posthog/core/src/traces/index.spec.ts +3269 -0
- package/node_modules/@posthog/core/src/traces/index.ts +1063 -0
- package/node_modules/@posthog/core/src/traces/live-spans.spec.ts +69 -0
- package/node_modules/@posthog/core/src/traces/otlp.spec.ts +368 -0
- package/node_modules/@posthog/core/src/traces/otlp.ts +191 -0
- package/node_modules/@posthog/core/src/traces/sanitize.ts +116 -0
- package/node_modules/@posthog/core/src/traces/span.spec.ts +1123 -0
- package/node_modules/@posthog/core/src/traces/span.ts +844 -0
- package/node_modules/@posthog/core/src/traces/traceparent.spec.ts +184 -0
- package/node_modules/@posthog/core/src/traces/traceparent.ts +172 -0
- package/node_modules/@posthog/core/src/traces/types.ts +140 -0
- package/node_modules/@posthog/core/src/utils/backoff.ts +44 -0
- package/node_modules/@posthog/core/src/utils/flush-timer.ts +50 -0
- package/node_modules/@posthog/core/src/utils/index.ts +8 -0
- package/node_modules/@posthog/core/src/utils/json-utils.ts +33 -0
- package/node_modules/@posthog/core/src/utils/otlp-resource.spec.ts +55 -9
- package/node_modules/@posthog/core/src/utils/otlp-resource.ts +45 -4
- package/node_modules/@posthog/core/src/utils/retry-after.ts +135 -0
- package/node_modules/@posthog/types/dist/index.d.ts +1 -0
- package/node_modules/@posthog/types/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/posthog-config.d.ts +29 -9
- package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/traces.d.ts +387 -0
- package/node_modules/@posthog/types/dist/traces.d.ts.map +1 -0
- package/node_modules/@posthog/types/dist/traces.js +18 -0
- package/node_modules/@posthog/types/dist/traces.mjs +1 -0
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/index.ts +19 -0
- package/node_modules/@posthog/types/src/posthog-config.ts +29 -9
- package/node_modules/@posthog/types/src/traces.ts +429 -0
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-7ZX347IG.js → chunk-JTYJUJYO.js} +3 -3
- package/node_modules/@zuplo/runtime/out/esm/chunk-JTYJUJYO.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-M3VFT3HF.js +410 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-M3VFT3HF.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +3 -3
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +20 -1
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/package.json +11 -11
- package/node_modules/@zuplo/runtime/out/esm/chunk-7ZX347IG.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-DRQ5CMVC.js +0 -410
- package/node_modules/@zuplo/runtime/out/esm/chunk-DRQ5CMVC.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-DRQ5CMVC.js.LEGAL.txt → chunk-M3VFT3HF.js.LEGAL.txt} +0 -0
|
@@ -120,7 +120,32 @@ function toJsonSafeValue(value) {
|
|
|
120
120
|
};
|
|
121
121
|
return convert(value, 0);
|
|
122
122
|
}
|
|
123
|
+
function assignUserAttributes(target, source) {
|
|
124
|
+
if (!source) return target;
|
|
125
|
+
let keys = [];
|
|
126
|
+
try {
|
|
127
|
+
keys = Object.keys(source);
|
|
128
|
+
} catch {
|
|
129
|
+
keys = [];
|
|
130
|
+
}
|
|
131
|
+
for (const key of keys){
|
|
132
|
+
let value;
|
|
133
|
+
try {
|
|
134
|
+
value = source[key];
|
|
135
|
+
} catch {
|
|
136
|
+
value = UNSERIALIZABLE_VALUE;
|
|
137
|
+
}
|
|
138
|
+
Object.defineProperty(target, key, {
|
|
139
|
+
value,
|
|
140
|
+
enumerable: true,
|
|
141
|
+
writable: true,
|
|
142
|
+
configurable: true
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return target;
|
|
146
|
+
}
|
|
123
147
|
__webpack_require__.d(__webpack_exports__, {
|
|
148
|
+
assignUserAttributes: ()=>assignUserAttributes,
|
|
124
149
|
sanitizeString: ()=>sanitizeString,
|
|
125
150
|
toJsonSafeValue: ()=>toJsonSafeValue
|
|
126
151
|
}, {
|
|
@@ -139,6 +164,7 @@ exports.MAX_JSON_SAFE_VALUE_ITEMS = __webpack_exports__.MAX_JSON_SAFE_VALUE_ITEM
|
|
|
139
164
|
exports.MAX_JSON_SAFE_VALUE_NODES = __webpack_exports__.MAX_JSON_SAFE_VALUE_NODES;
|
|
140
165
|
exports.TRUNCATED_VALUE = __webpack_exports__.TRUNCATED_VALUE;
|
|
141
166
|
exports.UNSERIALIZABLE_VALUE = __webpack_exports__.UNSERIALIZABLE_VALUE;
|
|
167
|
+
exports.assignUserAttributes = __webpack_exports__.assignUserAttributes;
|
|
142
168
|
exports.sanitizeString = __webpack_exports__.sanitizeString;
|
|
143
169
|
exports.toJsonSafeValue = __webpack_exports__.toJsonSafeValue;
|
|
144
170
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -149,6 +175,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
149
175
|
"MAX_JSON_SAFE_VALUE_NODES",
|
|
150
176
|
"TRUNCATED_VALUE",
|
|
151
177
|
"UNSERIALIZABLE_VALUE",
|
|
178
|
+
"assignUserAttributes",
|
|
152
179
|
"sanitizeString",
|
|
153
180
|
"toJsonSafeValue"
|
|
154
181
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
@@ -91,4 +91,28 @@ function toJsonSafeValue(value) {
|
|
|
91
91
|
};
|
|
92
92
|
return convert(value, 0);
|
|
93
93
|
}
|
|
94
|
-
|
|
94
|
+
function assignUserAttributes(target, source) {
|
|
95
|
+
if (!source) return target;
|
|
96
|
+
let keys = [];
|
|
97
|
+
try {
|
|
98
|
+
keys = Object.keys(source);
|
|
99
|
+
} catch {
|
|
100
|
+
keys = [];
|
|
101
|
+
}
|
|
102
|
+
for (const key of keys){
|
|
103
|
+
let value;
|
|
104
|
+
try {
|
|
105
|
+
value = source[key];
|
|
106
|
+
} catch {
|
|
107
|
+
value = UNSERIALIZABLE_VALUE;
|
|
108
|
+
}
|
|
109
|
+
Object.defineProperty(target, key, {
|
|
110
|
+
value,
|
|
111
|
+
enumerable: true,
|
|
112
|
+
writable: true,
|
|
113
|
+
configurable: true
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return target;
|
|
117
|
+
}
|
|
118
|
+
export { CIRCULAR_VALUE, FUNCTION_VALUE, MAX_JSON_SAFE_VALUE_DEPTH, MAX_JSON_SAFE_VALUE_ITEMS, MAX_JSON_SAFE_VALUE_NODES, TRUNCATED_VALUE, UNSERIALIZABLE_VALUE, assignUserAttributes, sanitizeString, toJsonSafeValue };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { OtlpKeyValue } from '@posthog/types';
|
|
2
|
+
import type { Logger } from '../types';
|
|
1
3
|
/**
|
|
2
|
-
* Shape the logs and
|
|
4
|
+
* Shape the logs, metrics and traces resolved configs share for resource
|
|
3
5
|
* attribution. Generic over the attribute value type so each signal keeps its
|
|
4
6
|
* own value union.
|
|
5
7
|
*/
|
|
@@ -10,7 +12,7 @@ export interface OtlpResourceConfig<TAttributeValue> {
|
|
|
10
12
|
resourceAttributes?: Record<string, TAttributeValue>;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
|
-
* OTLP resource attributes shared by the logs and
|
|
15
|
+
* OTLP resource attributes shared by the logs, metrics and traces envelopes.
|
|
14
16
|
*
|
|
15
17
|
* User `resourceAttributes` are spread first, then SDK-controlled keys on top so
|
|
16
18
|
* a stray user key can't clobber the ingestion-attribution ones; the dedicated
|
|
@@ -20,6 +22,15 @@ export interface OtlpResourceConfig<TAttributeValue> {
|
|
|
20
22
|
* @internal Shared within this SDK; not part of the stable public API.
|
|
21
23
|
*/
|
|
22
24
|
export declare function buildOtlpResourceAttributes<TAttributeValue>(config: OtlpResourceConfig<TAttributeValue>, sdkName: string, sdkVersion: string): Record<string, TAttributeValue | string>;
|
|
25
|
+
/**
|
|
26
|
+
* Encodes resource attributes for an OTLP envelope. The SDK-set keys are
|
|
27
|
+
* encoded on a traversal budget of their own, after the user's: a user
|
|
28
|
+
* attribute large enough to exhaust the shared budget would otherwise cost the
|
|
29
|
+
* resource its `service.name`, which ingestion attributes every record by.
|
|
30
|
+
*
|
|
31
|
+
* @internal Shared within this SDK; not part of the stable public API.
|
|
32
|
+
*/
|
|
33
|
+
export declare function toOtlpResourceKeyValueList(attributes: Record<string, unknown>, logger?: Logger): OtlpKeyValue[];
|
|
23
34
|
/**
|
|
24
35
|
* Normalizes a natively-detected OS name against the table above.
|
|
25
36
|
* Unrecognized names pass through: a wrong-looking value beats dropping an OS
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otlp-resource.d.ts","sourceRoot":"","sources":["../../src/utils/otlp-resource.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,kBAAkB,CAAC,eAAe;IACjD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CACrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,eAAe,EACzD,MAAM,EAAE,kBAAkB,CAAC,eAAe,CAAC,EAC3C,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"otlp-resource.d.ts","sourceRoot":"","sources":["../../src/utils/otlp-resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAItC;;;;GAIG;AACH,MAAM,WAAW,kBAAkB,CAAC,eAAe;IACjD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CACrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,eAAe,EACzD,MAAM,EAAE,kBAAkB,CAAC,eAAe,CAAC,EAC3C,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC,CAY1C;AAWD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,EAAE,CAU/G;AA+BD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAK5E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMlH"}
|
|
@@ -27,9 +27,17 @@ var __webpack_require__ = {};
|
|
|
27
27
|
})();
|
|
28
28
|
var __webpack_exports__ = {};
|
|
29
29
|
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
buildOtlpResourceAttributes: ()=>buildOtlpResourceAttributes,
|
|
32
|
+
normalizeOsName: ()=>normalizeOsName,
|
|
33
|
+
osResourceAttributes: ()=>osResourceAttributes,
|
|
34
|
+
toOtlpResourceKeyValueList: ()=>toOtlpResourceKeyValueList
|
|
35
|
+
});
|
|
36
|
+
const external_json_utils_js_namespaceObject = require("./json-utils.js");
|
|
37
|
+
const external_otlp_any_value_js_namespaceObject = require("./otlp-any-value.js");
|
|
30
38
|
function buildOtlpResourceAttributes(config, sdkName, sdkVersion) {
|
|
31
39
|
return {
|
|
32
|
-
...config.resourceAttributes,
|
|
40
|
+
...(0, external_json_utils_js_namespaceObject.assignUserAttributes)({}, config.resourceAttributes),
|
|
33
41
|
'service.name': config.serviceName || 'unknown_service',
|
|
34
42
|
...config.environment && {
|
|
35
43
|
'deployment.environment': config.environment
|
|
@@ -41,15 +49,37 @@ function buildOtlpResourceAttributes(config, sdkName, sdkVersion) {
|
|
|
41
49
|
'telemetry.sdk.version': sdkVersion
|
|
42
50
|
};
|
|
43
51
|
}
|
|
52
|
+
const SDK_RESOURCE_KEYS = [
|
|
53
|
+
'service.name',
|
|
54
|
+
'deployment.environment',
|
|
55
|
+
'service.version',
|
|
56
|
+
'telemetry.sdk.name',
|
|
57
|
+
'telemetry.sdk.version'
|
|
58
|
+
];
|
|
59
|
+
function toOtlpResourceKeyValueList(attributes, logger) {
|
|
60
|
+
const user = (0, external_json_utils_js_namespaceObject.assignUserAttributes)({}, attributes);
|
|
61
|
+
const sdk = {};
|
|
62
|
+
for (const key of SDK_RESOURCE_KEYS)if (Object.prototype.hasOwnProperty.call(user, key)) {
|
|
63
|
+
sdk[key] = user[key];
|
|
64
|
+
delete user[key];
|
|
65
|
+
}
|
|
66
|
+
return [
|
|
67
|
+
...(0, external_otlp_any_value_js_namespaceObject.toOtlpKeyValueList)(user, logger),
|
|
68
|
+
...(0, external_otlp_any_value_js_namespaceObject.toOtlpKeyValueList)(sdk, logger)
|
|
69
|
+
];
|
|
70
|
+
}
|
|
44
71
|
const OS_NAMES = {
|
|
45
72
|
darwin: 'macOS',
|
|
46
73
|
win32: 'Windows',
|
|
74
|
+
cygwin: 'Windows',
|
|
47
75
|
linux: 'Linux',
|
|
48
76
|
android: 'Android',
|
|
49
77
|
freebsd: 'FreeBSD',
|
|
50
78
|
openbsd: 'OpenBSD',
|
|
79
|
+
netbsd: 'NetBSD',
|
|
51
80
|
sunos: 'SunOS',
|
|
52
81
|
aix: 'AIX',
|
|
82
|
+
haiku: 'Haiku',
|
|
53
83
|
'Mac OS X': 'macOS'
|
|
54
84
|
};
|
|
55
85
|
function normalizeOsName(name) {
|
|
@@ -67,18 +97,15 @@ function osResourceAttributes(name, version) {
|
|
|
67
97
|
} : {}
|
|
68
98
|
};
|
|
69
99
|
}
|
|
70
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
71
|
-
buildOtlpResourceAttributes: ()=>buildOtlpResourceAttributes,
|
|
72
|
-
normalizeOsName: ()=>normalizeOsName,
|
|
73
|
-
osResourceAttributes: ()=>osResourceAttributes
|
|
74
|
-
});
|
|
75
100
|
exports.buildOtlpResourceAttributes = __webpack_exports__.buildOtlpResourceAttributes;
|
|
76
101
|
exports.normalizeOsName = __webpack_exports__.normalizeOsName;
|
|
77
102
|
exports.osResourceAttributes = __webpack_exports__.osResourceAttributes;
|
|
103
|
+
exports.toOtlpResourceKeyValueList = __webpack_exports__.toOtlpResourceKeyValueList;
|
|
78
104
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
79
105
|
"buildOtlpResourceAttributes",
|
|
80
106
|
"normalizeOsName",
|
|
81
|
-
"osResourceAttributes"
|
|
107
|
+
"osResourceAttributes",
|
|
108
|
+
"toOtlpResourceKeyValueList"
|
|
82
109
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
83
110
|
Object.defineProperty(exports, '__esModule', {
|
|
84
111
|
value: true
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { assignUserAttributes } from "./json-utils.mjs";
|
|
2
|
+
import { toOtlpKeyValueList } from "./otlp-any-value.mjs";
|
|
1
3
|
function buildOtlpResourceAttributes(config, sdkName, sdkVersion) {
|
|
2
4
|
return {
|
|
3
|
-
...config.resourceAttributes,
|
|
5
|
+
...assignUserAttributes({}, config.resourceAttributes),
|
|
4
6
|
'service.name': config.serviceName || 'unknown_service',
|
|
5
7
|
...config.environment && {
|
|
6
8
|
'deployment.environment': config.environment
|
|
@@ -12,15 +14,37 @@ function buildOtlpResourceAttributes(config, sdkName, sdkVersion) {
|
|
|
12
14
|
'telemetry.sdk.version': sdkVersion
|
|
13
15
|
};
|
|
14
16
|
}
|
|
17
|
+
const SDK_RESOURCE_KEYS = [
|
|
18
|
+
'service.name',
|
|
19
|
+
'deployment.environment',
|
|
20
|
+
'service.version',
|
|
21
|
+
'telemetry.sdk.name',
|
|
22
|
+
'telemetry.sdk.version'
|
|
23
|
+
];
|
|
24
|
+
function toOtlpResourceKeyValueList(attributes, logger) {
|
|
25
|
+
const user = assignUserAttributes({}, attributes);
|
|
26
|
+
const sdk = {};
|
|
27
|
+
for (const key of SDK_RESOURCE_KEYS)if (Object.prototype.hasOwnProperty.call(user, key)) {
|
|
28
|
+
sdk[key] = user[key];
|
|
29
|
+
delete user[key];
|
|
30
|
+
}
|
|
31
|
+
return [
|
|
32
|
+
...toOtlpKeyValueList(user, logger),
|
|
33
|
+
...toOtlpKeyValueList(sdk, logger)
|
|
34
|
+
];
|
|
35
|
+
}
|
|
15
36
|
const OS_NAMES = {
|
|
16
37
|
darwin: 'macOS',
|
|
17
38
|
win32: 'Windows',
|
|
39
|
+
cygwin: 'Windows',
|
|
18
40
|
linux: 'Linux',
|
|
19
41
|
android: 'Android',
|
|
20
42
|
freebsd: 'FreeBSD',
|
|
21
43
|
openbsd: 'OpenBSD',
|
|
44
|
+
netbsd: 'NetBSD',
|
|
22
45
|
sunos: 'SunOS',
|
|
23
46
|
aix: 'AIX',
|
|
47
|
+
haiku: 'Haiku',
|
|
24
48
|
'Mac OS X': 'macOS'
|
|
25
49
|
};
|
|
26
50
|
function normalizeOsName(name) {
|
|
@@ -38,4 +62,4 @@ function osResourceAttributes(name, version) {
|
|
|
38
62
|
} : {}
|
|
39
63
|
};
|
|
40
64
|
}
|
|
41
|
-
export { buildOtlpResourceAttributes, normalizeOsName, osResourceAttributes };
|
|
65
|
+
export { buildOtlpResourceAttributes, normalizeOsName, osResourceAttributes, toOtlpResourceKeyValueList };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Longest `Retry-After` the SDK will wait. A rate-limit window can legitimately
|
|
3
|
+
* be long, but nothing upstream of the SDK bounds this header — it is as likely
|
|
4
|
+
* to come from a proxy or CDN as from PostHog — and an unbounded value would
|
|
5
|
+
* strand a queue for hours, so the wait is capped and the retry happens early.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MAX_RETRY_AFTER_MS: number;
|
|
8
|
+
/**
|
|
9
|
+
* `Retry-After` as milliseconds from now. The header is either delta-seconds or
|
|
10
|
+
* an HTTP-date; anything else, a date already in the past, or a non-positive
|
|
11
|
+
* delta yields `undefined` so the caller keeps its own backoff. The result is
|
|
12
|
+
* capped at `MAX_RETRY_AFTER_MS`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseRetryAfterMs(value: unknown, now?: number): number | undefined;
|
|
15
|
+
/** The part of an export outcome the window reads. */
|
|
16
|
+
export type RetryAfterOutcome = {
|
|
17
|
+
kind: 'ok' | 'retry-later' | 'too-large' | 'fatal';
|
|
18
|
+
retryAfterMs?: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The wait an ingestion endpoint asked for, shared by the logs, metrics and
|
|
22
|
+
* traces export queues.
|
|
23
|
+
*
|
|
24
|
+
* Held as an absolute deadline rather than a duration, so a timer armed while
|
|
25
|
+
* the wait is already part-served counts down the remainder instead of
|
|
26
|
+
* restarting it.
|
|
27
|
+
*/
|
|
28
|
+
export declare class RetryAfterWindow {
|
|
29
|
+
private _until;
|
|
30
|
+
private _installedAt;
|
|
31
|
+
/**
|
|
32
|
+
* Folds one export outcome into the window.
|
|
33
|
+
*
|
|
34
|
+
* A refusal naming a longer wait than the one being served pushes the
|
|
35
|
+
* deadline out, but never past `MAX_RETRY_AFTER_MS` from where the window was
|
|
36
|
+
* first installed. That ceiling is the SDK's own policy rather than OTLP's,
|
|
37
|
+
* which asks for the header to be honoured and names no cap: a host flushing
|
|
38
|
+
* faster than the window is long would otherwise refresh the deadline forever
|
|
39
|
+
* and never recover, since logs gates its size trigger and `onReconnect` on
|
|
40
|
+
* the window and metrics re-arms its timer from it. The cost is that a wait
|
|
41
|
+
* longer than the ceiling is served short.
|
|
42
|
+
*
|
|
43
|
+
* The deadline is never pulled in, so a shorter header cannot cut a wait the
|
|
44
|
+
* endpoint already asked for.
|
|
45
|
+
*/
|
|
46
|
+
record(outcome: RetryAfterOutcome): void;
|
|
47
|
+
/**
|
|
48
|
+
* Milliseconds left of the wait, `0` when none is open. Closes a window it
|
|
49
|
+
* finds spent, so a later backward clock step cannot bring it back.
|
|
50
|
+
*/
|
|
51
|
+
remainingMs(): number;
|
|
52
|
+
isOpen(): boolean;
|
|
53
|
+
reset(): void;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=retry-after.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-after.d.ts","sourceRoot":"","sources":["../../src/utils/retry-after.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,QAAa,CAAA;AAS5C;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,GAAE,MAAmB,GAAG,MAAM,GAAG,SAAS,CAuB9F;AAED,sDAAsD;AACtD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,IAAI,GAAG,aAAa,GAAG,WAAW,GAAG,OAAO,CAAA;IAClD,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED;;;;;;;GAOG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAI;IAClB,OAAO,CAAC,YAAY,CAAI;IAExB;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IA8BxC;;;OAGG;IACH,WAAW,IAAI,MAAM;IAarB,MAAM,IAAI,OAAO;IAIjB,KAAK,IAAI,IAAI;CAId"}
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
const MAX_RETRY_AFTER_MS = 300000;
|
|
31
|
+
const CLOCK_STEP_TOLERANCE_MS = 5000;
|
|
32
|
+
function parseRetryAfterMs(value, now = Date.now()) {
|
|
33
|
+
if ('string' != typeof value || !value) return;
|
|
34
|
+
const raw = value.trim();
|
|
35
|
+
const trimmed = /^\d+\s*,/.test(raw) ? raw.slice(0, raw.indexOf(',')).trim() : raw;
|
|
36
|
+
const seconds = /^\d+$/.test(trimmed) ? Number(trimmed) : 0 / 0;
|
|
37
|
+
if (!Number.isFinite(seconds) && /^[+-]?[\d.]+$/.test(trimmed)) return;
|
|
38
|
+
const ms = Number.isFinite(seconds) ? 1000 * seconds : Date.parse(trimmed) - now;
|
|
39
|
+
if (!Number.isFinite(ms) || ms <= 0) return;
|
|
40
|
+
return Math.min(ms, MAX_RETRY_AFTER_MS);
|
|
41
|
+
}
|
|
42
|
+
class RetryAfterWindow {
|
|
43
|
+
record(outcome) {
|
|
44
|
+
if ('too-large' === outcome.kind) return;
|
|
45
|
+
if ('retry-later' !== outcome.kind) return void this.reset();
|
|
46
|
+
if (!outcome.retryAfterMs) return;
|
|
47
|
+
const open = this.isOpen();
|
|
48
|
+
const now = Date.now();
|
|
49
|
+
const asked = Math.min(outcome.retryAfterMs, MAX_RETRY_AFTER_MS);
|
|
50
|
+
if (!open) {
|
|
51
|
+
this._installedAt = now;
|
|
52
|
+
this._until = now + asked;
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this._until = Math.max(this._until, Math.min(now + asked, this._installedAt + MAX_RETRY_AFTER_MS));
|
|
56
|
+
}
|
|
57
|
+
remainingMs() {
|
|
58
|
+
const now = Date.now();
|
|
59
|
+
if (now < this._installedAt - CLOCK_STEP_TOLERANCE_MS) {
|
|
60
|
+
this.reset();
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
const remaining = Math.min(MAX_RETRY_AFTER_MS, Math.max(0, this._until - now));
|
|
64
|
+
if (0 === remaining) this.reset();
|
|
65
|
+
return remaining;
|
|
66
|
+
}
|
|
67
|
+
isOpen() {
|
|
68
|
+
return this.remainingMs() > 0;
|
|
69
|
+
}
|
|
70
|
+
reset() {
|
|
71
|
+
this._until = 0;
|
|
72
|
+
this._installedAt = 0;
|
|
73
|
+
}
|
|
74
|
+
constructor(){
|
|
75
|
+
this._until = 0;
|
|
76
|
+
this._installedAt = 0;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
80
|
+
RetryAfterWindow: ()=>RetryAfterWindow,
|
|
81
|
+
parseRetryAfterMs: ()=>parseRetryAfterMs
|
|
82
|
+
}, {
|
|
83
|
+
MAX_RETRY_AFTER_MS: MAX_RETRY_AFTER_MS
|
|
84
|
+
});
|
|
85
|
+
exports.MAX_RETRY_AFTER_MS = __webpack_exports__.MAX_RETRY_AFTER_MS;
|
|
86
|
+
exports.RetryAfterWindow = __webpack_exports__.RetryAfterWindow;
|
|
87
|
+
exports.parseRetryAfterMs = __webpack_exports__.parseRetryAfterMs;
|
|
88
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
89
|
+
"MAX_RETRY_AFTER_MS",
|
|
90
|
+
"RetryAfterWindow",
|
|
91
|
+
"parseRetryAfterMs"
|
|
92
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
93
|
+
Object.defineProperty(exports, '__esModule', {
|
|
94
|
+
value: true
|
|
95
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const MAX_RETRY_AFTER_MS = 300000;
|
|
2
|
+
const CLOCK_STEP_TOLERANCE_MS = 5000;
|
|
3
|
+
function parseRetryAfterMs(value, now = Date.now()) {
|
|
4
|
+
if ('string' != typeof value || !value) return;
|
|
5
|
+
const raw = value.trim();
|
|
6
|
+
const trimmed = /^\d+\s*,/.test(raw) ? raw.slice(0, raw.indexOf(',')).trim() : raw;
|
|
7
|
+
const seconds = /^\d+$/.test(trimmed) ? Number(trimmed) : 0 / 0;
|
|
8
|
+
if (!Number.isFinite(seconds) && /^[+-]?[\d.]+$/.test(trimmed)) return;
|
|
9
|
+
const ms = Number.isFinite(seconds) ? 1000 * seconds : Date.parse(trimmed) - now;
|
|
10
|
+
if (!Number.isFinite(ms) || ms <= 0) return;
|
|
11
|
+
return Math.min(ms, MAX_RETRY_AFTER_MS);
|
|
12
|
+
}
|
|
13
|
+
class RetryAfterWindow {
|
|
14
|
+
record(outcome) {
|
|
15
|
+
if ('too-large' === outcome.kind) return;
|
|
16
|
+
if ('retry-later' !== outcome.kind) return void this.reset();
|
|
17
|
+
if (!outcome.retryAfterMs) return;
|
|
18
|
+
const open = this.isOpen();
|
|
19
|
+
const now = Date.now();
|
|
20
|
+
const asked = Math.min(outcome.retryAfterMs, MAX_RETRY_AFTER_MS);
|
|
21
|
+
if (!open) {
|
|
22
|
+
this._installedAt = now;
|
|
23
|
+
this._until = now + asked;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
this._until = Math.max(this._until, Math.min(now + asked, this._installedAt + MAX_RETRY_AFTER_MS));
|
|
27
|
+
}
|
|
28
|
+
remainingMs() {
|
|
29
|
+
const now = Date.now();
|
|
30
|
+
if (now < this._installedAt - CLOCK_STEP_TOLERANCE_MS) {
|
|
31
|
+
this.reset();
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
const remaining = Math.min(MAX_RETRY_AFTER_MS, Math.max(0, this._until - now));
|
|
35
|
+
if (0 === remaining) this.reset();
|
|
36
|
+
return remaining;
|
|
37
|
+
}
|
|
38
|
+
isOpen() {
|
|
39
|
+
return this.remainingMs() > 0;
|
|
40
|
+
}
|
|
41
|
+
reset() {
|
|
42
|
+
this._until = 0;
|
|
43
|
+
this._installedAt = 0;
|
|
44
|
+
}
|
|
45
|
+
constructor(){
|
|
46
|
+
this._until = 0;
|
|
47
|
+
this._installedAt = 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export { MAX_RETRY_AFTER_MS, RetryAfterWindow, parseRetryAfterMs };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.53.2",
|
|
4
4
|
"bugs": {
|
|
5
5
|
"url": "https://github.com/PostHog/posthog-js/issues"
|
|
6
6
|
},
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@posthog/types": "^1.
|
|
73
|
+
"@posthog/types": "^1.411.1"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@rslib/core": "0.23.2",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"lint:fix": "oxlint --report-unused-disable-directives-severity error src --fix",
|
|
85
85
|
"build": "rslib build",
|
|
86
86
|
"dev": "rslib build -w",
|
|
87
|
-
"test:unit": "vitest run",
|
|
87
|
+
"test:unit": "NODE_OPTIONS=--expose-gc vitest run",
|
|
88
88
|
"package": "pnpm pack --out $PACKAGE_DEST/%s.tgz"
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -1,21 +1,47 @@
|
|
|
1
1
|
import { createFrame } from './base'
|
|
2
2
|
import { createDefaultStackParser } from './index'
|
|
3
3
|
|
|
4
|
-
describe('createFrame', () => {
|
|
5
|
-
const platform = 'web:javascript'
|
|
6
|
-
|
|
4
|
+
describe.each(['web:javascript', 'hermes'] as const)('createFrame (%s)', (platform) => {
|
|
7
5
|
it('marks ordinary browser frames as in_app', () => {
|
|
8
6
|
const frame = createFrame(platform, 'https://example.com/app.js', 'doThing', 1, 2)
|
|
9
7
|
expect(frame.in_app).toBe(true)
|
|
10
8
|
})
|
|
11
9
|
|
|
12
|
-
it(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
it.each([
|
|
11
|
+
['Safari masking an extension content script', 'webkit-masked-url://hidden/'],
|
|
12
|
+
['an Android in-app browser bridge', 'iabjs://navigation_performance_logger_android'],
|
|
13
|
+
['a Chromium extension content script', 'chrome-extension://abcdef/content.js'],
|
|
14
|
+
['a Firefox extension content script', 'moz-extension://abcdef/content.js'],
|
|
15
|
+
['a Safari extension, which the parser prefixes with a bare scheme', 'safari-extension:abcdef/content.js'],
|
|
16
|
+
['a Safari web extension', 'safari-web-extension:abcdef/content.js'],
|
|
17
|
+
['an extension with a mixed-case scheme', 'CHROME-Extension://abcdef/content.js'],
|
|
18
|
+
['an unknown container scheme', 'other-bridge://injected.js'],
|
|
19
|
+
['an inline data URL', 'data:text/javascript,void 0'],
|
|
20
|
+
])('does not mark a frame the container injected as in_app: %s', (_name, filename) => {
|
|
21
|
+
const frame = createFrame(platform, filename, 'doThing', 1, 2)
|
|
16
22
|
expect(frame.in_app).toBe(false)
|
|
17
23
|
})
|
|
18
24
|
|
|
25
|
+
it.each([
|
|
26
|
+
['a script served over http', 'http://localhost:8000/app.js'],
|
|
27
|
+
['a Cordova or Electron app served from disk', 'file:///android_asset/www/app.js'],
|
|
28
|
+
['a worker the page created from a blob', 'blob:https://example.com/6b0b0e6a'],
|
|
29
|
+
['a Capacitor webview', 'capacitor://localhost/app.js'],
|
|
30
|
+
['an Ionic webview', 'ionic://localhost/app.js'],
|
|
31
|
+
['a script with a mixed-case scheme', 'HTTPS://example.com/app.js'],
|
|
32
|
+
['a webpack source frame', 'webpack:///./src/App.js'],
|
|
33
|
+
['an Angular JIT component', 'ng:///CheckoutComponent.js'],
|
|
34
|
+
['a custom app scheme, as an Electron or React Native shell serves', 'app://checkout.js'],
|
|
35
|
+
['a bundler-rewritten dev frame', 'webpack-internal:///./src/App.js'],
|
|
36
|
+
['a React Native release bundle, which has no scheme', 'index.android.bundle'],
|
|
37
|
+
['an absolute path with no scheme', '/data/user/0/com.example/files/index.bundle'],
|
|
38
|
+
['a Windows path with backslashes', 'C:\\app\\index.bundle'],
|
|
39
|
+
['a Windows path with forward slashes', 'C:/app/index.bundle'],
|
|
40
|
+
])("still marks the app's own code as in_app: %s", (_name, filename) => {
|
|
41
|
+
const frame = createFrame(platform, filename, 'doThing', 1, 2)
|
|
42
|
+
expect(frame.in_app).toBe(true)
|
|
43
|
+
})
|
|
44
|
+
|
|
19
45
|
it('keeps the masked frame rather than discarding it', () => {
|
|
20
46
|
const frame = createFrame(platform, 'webkit-masked-url://hidden/', 'someFn', 3, 4)
|
|
21
47
|
expect(frame).toMatchObject({
|
|
@@ -70,6 +96,50 @@ describe('createDefaultStackParser in_app classification', () => {
|
|
|
70
96
|
])
|
|
71
97
|
})
|
|
72
98
|
|
|
99
|
+
it('demotes the bridge frames an Android in-app browser serves from its own scheme', () => {
|
|
100
|
+
const frames = parse(
|
|
101
|
+
'Error: Error invoking postMessage: Java object is gone\n' +
|
|
102
|
+
' at sendDataToNative (iabjs://navigation_performance_logger_android:1:10198)\n' +
|
|
103
|
+
' at sendJsBlockingTimeMessage (iabjs://navigation_performance_logger_android:1:14668)'
|
|
104
|
+
)
|
|
105
|
+
expect(frames.map((f) => [f.function, f.in_app])).toEqual([
|
|
106
|
+
['sendJsBlockingTimeMessage', false],
|
|
107
|
+
['sendDataToNative', false],
|
|
108
|
+
])
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it.each([
|
|
112
|
+
' at CheckoutComponent_Template (ng:///CheckoutComponent.js:10:5)',
|
|
113
|
+
'CheckoutComponent_Template@ng:///CheckoutComponent.js:10:5',
|
|
114
|
+
])('keeps Angular JIT application frames as in_app: %s', (stackLine) => {
|
|
115
|
+
const frames = parse(`Error: template failed\n${stackLine}`)
|
|
116
|
+
expect(frames).toEqual([
|
|
117
|
+
expect.objectContaining({
|
|
118
|
+
filename: 'ng:///CheckoutComponent.js',
|
|
119
|
+
function: 'CheckoutComponent_Template',
|
|
120
|
+
lineno: 10,
|
|
121
|
+
colno: 5,
|
|
122
|
+
in_app: true,
|
|
123
|
+
}),
|
|
124
|
+
])
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it.each([
|
|
128
|
+
'webkit-masked-url://hidden/',
|
|
129
|
+
'<anonymous>',
|
|
130
|
+
'iabjs://navigation_performance_logger_android',
|
|
131
|
+
'chrome-extension://abcdef/content.js',
|
|
132
|
+
'moz-extension://abcdef/content.js',
|
|
133
|
+
])('retains injected frames without demoting the calling app frame: %s', (filename) => {
|
|
134
|
+
const frames = parse(
|
|
135
|
+
`Error: boom\n at injected (${filename}:1:2)\n at checkout (https://example.com/app.js:10:5)`
|
|
136
|
+
)
|
|
137
|
+
expect(frames.map((frame) => [frame.filename, frame.in_app])).toEqual([
|
|
138
|
+
['https://example.com/app.js', true],
|
|
139
|
+
[filename, false],
|
|
140
|
+
])
|
|
141
|
+
})
|
|
142
|
+
|
|
73
143
|
it("keeps the page's own eval'd code as in_app", () => {
|
|
74
144
|
// V8 attributes eval'd code to the script that called eval; the chrome parser already
|
|
75
145
|
// rewrites these frames to that URL, so they must not be caught by the <anonymous> rule.
|