@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
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { isValidSpanId, isValidTraceId } from "./ids.mjs";
|
|
2
|
+
const TRACEPARENT_RE = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;
|
|
3
|
+
function parseTraceparent(value) {
|
|
4
|
+
const fields = matchTraceparent(value);
|
|
5
|
+
return fields && {
|
|
6
|
+
traceId: fields.traceId,
|
|
7
|
+
spanId: fields.spanId,
|
|
8
|
+
flags: definedFlags(fields.flags)
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function definedFlags(flags) {
|
|
12
|
+
return 0x01 & parseInt(flags, 16) ? TRACE_FLAGS_SAMPLED : TRACE_FLAGS_UNSAMPLED;
|
|
13
|
+
}
|
|
14
|
+
function matchTraceparent(value) {
|
|
15
|
+
if ('string' != typeof value) return;
|
|
16
|
+
const match = TRACEPARENT_RE.exec(value.trim());
|
|
17
|
+
if (!match) return;
|
|
18
|
+
const [, version, traceId, spanId, flags, trailing] = match;
|
|
19
|
+
if ('ff' === version) return;
|
|
20
|
+
if ('00' === version && trailing) return;
|
|
21
|
+
if (!isValidTraceId(traceId) || !isValidSpanId(spanId)) return;
|
|
22
|
+
return {
|
|
23
|
+
version,
|
|
24
|
+
traceId,
|
|
25
|
+
spanId,
|
|
26
|
+
flags
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function normalizeTraceparent(value) {
|
|
30
|
+
return matchTraceparent(value) && value.trim();
|
|
31
|
+
}
|
|
32
|
+
function traceparentHeader(value) {
|
|
33
|
+
return Array.isArray(value) && 1 === value.length ? value[0] : value;
|
|
34
|
+
}
|
|
35
|
+
const TRACE_FLAGS_SAMPLED = '01';
|
|
36
|
+
const TRACE_FLAGS_UNSAMPLED = '00';
|
|
37
|
+
function formatTraceparent(traceId, spanId, flags = TRACE_FLAGS_SAMPLED) {
|
|
38
|
+
return `00-${traceId}-${spanId}-${flags}`;
|
|
39
|
+
}
|
|
40
|
+
const TRACESTATE_MAX_MEMBERS = 32;
|
|
41
|
+
const TRACESTATE_MAX_LENGTH = 512;
|
|
42
|
+
function sanitizeTracestate(value) {
|
|
43
|
+
if ('string' != typeof value) return;
|
|
44
|
+
const trimmed = value.trim();
|
|
45
|
+
if (!trimmed) return;
|
|
46
|
+
if (/[^\x20-\x7e\t]/.test(trimmed)) return;
|
|
47
|
+
const members = trimmed.split(',');
|
|
48
|
+
if (members.length > TRACESTATE_MAX_MEMBERS) return;
|
|
49
|
+
for (const member of members)if (member.trim() && !member.includes('=')) return;
|
|
50
|
+
if (trimmed.length <= TRACESTATE_MAX_LENGTH) return trimmed;
|
|
51
|
+
return trimToLength(members);
|
|
52
|
+
}
|
|
53
|
+
const TRACESTATE_LARGE_MEMBER_LENGTH = 128;
|
|
54
|
+
function trimToLength(members) {
|
|
55
|
+
const kept = [
|
|
56
|
+
...members
|
|
57
|
+
];
|
|
58
|
+
const joinedLength = ()=>kept.reduce((total, member)=>total + member.length, 0) + kept.length - 1;
|
|
59
|
+
for(let index = kept.length - 1; index >= 0 && joinedLength() > TRACESTATE_MAX_LENGTH; index--)if (kept[index].length > TRACESTATE_LARGE_MEMBER_LENGTH) kept.splice(index, 1);
|
|
60
|
+
while(kept.length && joinedLength() > TRACESTATE_MAX_LENGTH)kept.pop();
|
|
61
|
+
return kept.length ? kept.join(',') : void 0;
|
|
62
|
+
}
|
|
63
|
+
export { TRACE_FLAGS_SAMPLED, formatTraceparent, normalizeTraceparent, parseTraceparent, sanitizeTracestate, traceparentHeader };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export type { Span, SpanAttributes, SpanAttributeValue, SpanKind, SpanStatusCode, SpanTimeInput, StartSpanOptions, TracesConfig, BeforeSpanSendFn, OtlpSpan, OtlpSpanEvent, OtlpSpanKeyValue, OtlpSpanStatus, OtlpTracesPayload, } from '@posthog/types';
|
|
2
|
+
import type { BeforeSpanSendFn, OtlpTracesPayload, Span, SpanAttributes, SpanRecord as HookSpanRecord, TracesConfig } from '@posthog/types';
|
|
3
|
+
/** Same tagged outcome shape as `SendLogsBatchOutcome` — one policy for all three signals. */
|
|
4
|
+
export type SendTracesBatchOutcome = {
|
|
5
|
+
kind: 'ok';
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'retry-later';
|
|
8
|
+
error: unknown;
|
|
9
|
+
retryAfterMs?: number;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'too-large';
|
|
12
|
+
/**
|
|
13
|
+
* True when the SDK measured the body itself rather than the endpoint
|
|
14
|
+
* refusing it, so the caller can split this drain without lowering the
|
|
15
|
+
* batch size it keeps between them.
|
|
16
|
+
*/
|
|
17
|
+
measuredLocally?: boolean;
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'fatal';
|
|
20
|
+
error: unknown;
|
|
21
|
+
};
|
|
22
|
+
/** The minimal host surface `PostHogTraces` depends on; `PostHogCoreStateless` satisfies it structurally. */
|
|
23
|
+
export interface TracesHost {
|
|
24
|
+
readonly isDisabled: boolean;
|
|
25
|
+
readonly optedOut: boolean;
|
|
26
|
+
_sendTracesBatch(payload: OtlpTracesPayload): Promise<SendTracesBatchOutcome>;
|
|
27
|
+
getLibraryId(): string;
|
|
28
|
+
getLibraryVersion(): string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* PostHog context snapshotted onto every span at start, so traces join back to
|
|
32
|
+
* persons and sessions. Each SDK fills the fields that apply to it; absent
|
|
33
|
+
* fields add no attribute. Internal to `@posthog/core`.
|
|
34
|
+
*
|
|
35
|
+
* @internal Exposed for cross-package use within this SDK; not part of the stable public API.
|
|
36
|
+
*/
|
|
37
|
+
export interface TraceSdkContext {
|
|
38
|
+
distinctId?: string;
|
|
39
|
+
sessionId?: string;
|
|
40
|
+
/** Web-only — current page URL. */
|
|
41
|
+
currentUrl?: string;
|
|
42
|
+
/** Mobile-only — current screen / view name. */
|
|
43
|
+
screenName?: string;
|
|
44
|
+
/** Mobile-only — app foreground/background state. */
|
|
45
|
+
appState?: 'foreground' | 'background';
|
|
46
|
+
}
|
|
47
|
+
export interface SpanEventRecord {
|
|
48
|
+
name: string;
|
|
49
|
+
/** ms epoch. */
|
|
50
|
+
timestamp: number;
|
|
51
|
+
attributes?: SpanAttributes;
|
|
52
|
+
/**
|
|
53
|
+
* How many of this event's attributes the cap discarded.
|
|
54
|
+
*
|
|
55
|
+
* Unlike the span-level counts, this one is carried on an object a
|
|
56
|
+
* `beforeSpanSend` hook holds: the public event type omits it, so a hook that
|
|
57
|
+
* rebuilds its events returns them without it. Events have no identity to
|
|
58
|
+
* match a rebuilt array back against, so what a hook drops here stays dropped.
|
|
59
|
+
*/
|
|
60
|
+
droppedAttributesCount?: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A finished span as the SDK carries it, which is the hook-visible record plus
|
|
64
|
+
* the fields no hook may rewrite. Declaring only the additions keeps the shared
|
|
65
|
+
* half from drifting; a field added here rather than to the public record is a
|
|
66
|
+
* field `beforeSpanSend` cannot see, and so cannot corrupt.
|
|
67
|
+
*/
|
|
68
|
+
export interface SpanRecord extends HookSpanRecord {
|
|
69
|
+
/** The hook-visible event plus the SDK's own per-event drop count. */
|
|
70
|
+
events: SpanEventRecord[];
|
|
71
|
+
traceState?: string;
|
|
72
|
+
/** The W3C trace-flags byte this span propagates, e.g. `01` sampled. */
|
|
73
|
+
traceFlags: string;
|
|
74
|
+
/** True when the parent came from a `traceparent` header rather than a local handle. */
|
|
75
|
+
parentIsRemote: boolean;
|
|
76
|
+
droppedAttributesCount?: number;
|
|
77
|
+
droppedEventsCount?: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Tracks which span is active, so spans nest without manual parent plumbing. The
|
|
81
|
+
* mechanism is platform-specific and stays out of core: node injects an
|
|
82
|
+
* `AsyncLocalStorage` implementation over the synchronous default.
|
|
83
|
+
*/
|
|
84
|
+
export interface SpanContextManager {
|
|
85
|
+
/** The active span, or `undefined` when none is active. */
|
|
86
|
+
active(): Span | undefined;
|
|
87
|
+
/** Run `fn` with `span` active for its (synchronous and async) duration. */
|
|
88
|
+
with<T>(span: Span, fn: () => T): T;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Fields `PostHogTraces` needs resolved at runtime. The host SDK applies its own
|
|
92
|
+
* defaults and hands the resolved config to the constructor.
|
|
93
|
+
*
|
|
94
|
+
* @internal Exposed for cross-package use within this SDK; not part of the stable public API.
|
|
95
|
+
*/
|
|
96
|
+
export interface ResolvedTracesConfig extends TracesConfig {
|
|
97
|
+
flushIntervalMs: number;
|
|
98
|
+
maxExportBatchSize: number;
|
|
99
|
+
/**
|
|
100
|
+
* Bound on the in-memory export queue. On overflow the *incoming* span is
|
|
101
|
+
* dropped rather than queued ones, whose children may already have shipped.
|
|
102
|
+
*/
|
|
103
|
+
maxQueueSize: number;
|
|
104
|
+
beforeSpanSend: BeforeSpanSendFn[];
|
|
105
|
+
maxAttributesPerSpan: number;
|
|
106
|
+
maxEventsPerSpan: number;
|
|
107
|
+
maxAttributesPerEvent: number;
|
|
108
|
+
maxAttributeValueLength: number;
|
|
109
|
+
/** Bound on spans started but not yet ended. At the bound `startSpan` returns a no-op handle. */
|
|
110
|
+
maxLiveSpans: number;
|
|
111
|
+
/** How long a span may stay live before it stops being accounted for and can never export. */
|
|
112
|
+
maxSpanAgeMs: number;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts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,CAAA;CACrB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
16
|
+
Object.defineProperty(exports, '__esModule', {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Doublings the retry delay may grow by before it stops growing. */
|
|
2
|
+
export declare const MAX_FLUSH_BACKOFF_EXPONENT = 6;
|
|
3
|
+
/**
|
|
4
|
+
* Ceiling on the SDK's own retry delay, which the logs and traces contracts
|
|
5
|
+
* both state as "exponential backoff capped at ~30s". A host that configured a
|
|
6
|
+
* longer flush interval keeps it: the cap is there to stop the doubling running
|
|
7
|
+
* away, not to flush more often than asked.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MAX_FLUSH_BACKOFF_MS = 30000;
|
|
10
|
+
/** A multiplier in `[1 - JITTER, 1 + JITTER]`, drawn once per failure by the caller. */
|
|
11
|
+
export declare function drawJitter(): number;
|
|
12
|
+
/** No jitter, for the delay a queue uses when nothing has failed. */
|
|
13
|
+
export declare const NO_JITTER = 1;
|
|
14
|
+
/**
|
|
15
|
+
* The delay before retrying an export, `baseMs` doubled once per failure past
|
|
16
|
+
* the first and capped at `maxMs`.
|
|
17
|
+
*
|
|
18
|
+
* `jitter` is applied to the SDK's own delay only. A `Retry-After` the endpoint
|
|
19
|
+
* sent is a floor underneath it, applied by the caller: spreading a fleet must
|
|
20
|
+
* never move a retry earlier than the endpoint asked for.
|
|
21
|
+
*/
|
|
22
|
+
export declare function backoffDelayMs(baseMs: number, failures: number, jitter: number, maxMs?: number): number;
|
|
23
|
+
//# sourceMappingURL=backoff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backoff.d.ts","sourceRoot":"","sources":["../../src/utils/backoff.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,eAAO,MAAM,0BAA0B,IAAI,CAAA;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,QAAS,CAAA;AAa1C,wFAAwF;AACxF,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,qEAAqE;AACrE,eAAO,MAAM,SAAS,IAAI,CAAA;AAE1B;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAKvG"}
|
|
@@ -0,0 +1,65 @@
|
|
|
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_FLUSH_BACKOFF_EXPONENT = 6;
|
|
31
|
+
const MAX_FLUSH_BACKOFF_MS = 30000;
|
|
32
|
+
const JITTER = 0.25;
|
|
33
|
+
function drawJitter() {
|
|
34
|
+
return 1 - JITTER + Math.random() * JITTER * 2;
|
|
35
|
+
}
|
|
36
|
+
const NO_JITTER = 1;
|
|
37
|
+
function backoffDelayMs(baseMs, failures, jitter, maxMs) {
|
|
38
|
+
const exponent = Math.min(Math.max(0, failures - 1), MAX_FLUSH_BACKOFF_EXPONENT);
|
|
39
|
+
const delay = baseMs * 2 ** exponent;
|
|
40
|
+
const capped = void 0 === maxMs ? delay : Math.min(delay, Math.max(maxMs, baseMs));
|
|
41
|
+
return Math.round(capped * jitter);
|
|
42
|
+
}
|
|
43
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
44
|
+
backoffDelayMs: ()=>backoffDelayMs,
|
|
45
|
+
drawJitter: ()=>drawJitter
|
|
46
|
+
}, {
|
|
47
|
+
MAX_FLUSH_BACKOFF_EXPONENT: MAX_FLUSH_BACKOFF_EXPONENT,
|
|
48
|
+
MAX_FLUSH_BACKOFF_MS: MAX_FLUSH_BACKOFF_MS,
|
|
49
|
+
NO_JITTER: NO_JITTER
|
|
50
|
+
});
|
|
51
|
+
exports.MAX_FLUSH_BACKOFF_EXPONENT = __webpack_exports__.MAX_FLUSH_BACKOFF_EXPONENT;
|
|
52
|
+
exports.MAX_FLUSH_BACKOFF_MS = __webpack_exports__.MAX_FLUSH_BACKOFF_MS;
|
|
53
|
+
exports.NO_JITTER = __webpack_exports__.NO_JITTER;
|
|
54
|
+
exports.backoffDelayMs = __webpack_exports__.backoffDelayMs;
|
|
55
|
+
exports.drawJitter = __webpack_exports__.drawJitter;
|
|
56
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
57
|
+
"MAX_FLUSH_BACKOFF_EXPONENT",
|
|
58
|
+
"MAX_FLUSH_BACKOFF_MS",
|
|
59
|
+
"NO_JITTER",
|
|
60
|
+
"backoffDelayMs",
|
|
61
|
+
"drawJitter"
|
|
62
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
63
|
+
Object.defineProperty(exports, '__esModule', {
|
|
64
|
+
value: true
|
|
65
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const MAX_FLUSH_BACKOFF_EXPONENT = 6;
|
|
2
|
+
const MAX_FLUSH_BACKOFF_MS = 30000;
|
|
3
|
+
const JITTER = 0.25;
|
|
4
|
+
function drawJitter() {
|
|
5
|
+
return 1 - JITTER + Math.random() * JITTER * 2;
|
|
6
|
+
}
|
|
7
|
+
const NO_JITTER = 1;
|
|
8
|
+
function backoffDelayMs(baseMs, failures, jitter, maxMs) {
|
|
9
|
+
const exponent = Math.min(Math.max(0, failures - 1), MAX_FLUSH_BACKOFF_EXPONENT);
|
|
10
|
+
const delay = baseMs * 2 ** exponent;
|
|
11
|
+
const capped = void 0 === maxMs ? delay : Math.min(delay, Math.max(maxMs, baseMs));
|
|
12
|
+
return Math.round(capped * jitter);
|
|
13
|
+
}
|
|
14
|
+
export { MAX_FLUSH_BACKOFF_EXPONENT, MAX_FLUSH_BACKOFF_MS, NO_JITTER, backoffDelayMs, drawJitter };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pending flush timer of an export queue, and when it is due.
|
|
3
|
+
*
|
|
4
|
+
* The queues arm this from two kinds of place: one that must not push a pending
|
|
5
|
+
* flush further out (every capture reaches it), and one that must not pull a
|
|
6
|
+
* flush back in front of a wait the endpoint asked for. Holding the deadline
|
|
7
|
+
* next to the handle is what lets the second kind compare against the first.
|
|
8
|
+
*/
|
|
9
|
+
export declare class FlushTimer {
|
|
10
|
+
private readonly _onFire;
|
|
11
|
+
private _timer?;
|
|
12
|
+
private _firesAt;
|
|
13
|
+
/** @param _onFire runs when the timer elapses, after the handle is released. */
|
|
14
|
+
constructor(_onFire: () => void);
|
|
15
|
+
/** Whether a flush is already scheduled. */
|
|
16
|
+
get pending(): boolean;
|
|
17
|
+
/** Schedules a flush in `delayMs`, replacing any timer already pending. */
|
|
18
|
+
arm(delayMs: number): void;
|
|
19
|
+
/**
|
|
20
|
+
* Arms only if it moves the flush later, so a timer armed for a longer wait
|
|
21
|
+
* survives a caller asking for a shorter one.
|
|
22
|
+
*/
|
|
23
|
+
armNoEarlierThan(delayMs: number): void;
|
|
24
|
+
clear(): void;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=flush-timer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flush-timer.d.ts","sourceRoot":"","sources":["../../src/utils/flush-timer.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,qBAAa,UAAU;IAKT,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJpC,OAAO,CAAC,MAAM,CAAC,CAAmC;IAClD,OAAO,CAAC,QAAQ,CAAI;IAEpB,gFAAgF;gBACnD,OAAO,EAAE,MAAM,IAAI;IAEhD,4CAA4C;IAC5C,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,2EAA2E;IAC3E,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAS1B;;;OAGG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAOvC,KAAK,IAAI,IAAI;CAMd"}
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
FlushTimer: ()=>FlushTimer
|
|
32
|
+
});
|
|
33
|
+
const external_index_js_namespaceObject = require("./index.js");
|
|
34
|
+
class FlushTimer {
|
|
35
|
+
constructor(_onFire){
|
|
36
|
+
this._onFire = _onFire;
|
|
37
|
+
this._firesAt = 0;
|
|
38
|
+
}
|
|
39
|
+
get pending() {
|
|
40
|
+
return !!this._timer;
|
|
41
|
+
}
|
|
42
|
+
arm(delayMs) {
|
|
43
|
+
this.clear();
|
|
44
|
+
this._firesAt = Date.now() + delayMs;
|
|
45
|
+
this._timer = (0, external_index_js_namespaceObject.safeSetTimeout)(()=>{
|
|
46
|
+
this._timer = void 0;
|
|
47
|
+
this._onFire();
|
|
48
|
+
}, delayMs);
|
|
49
|
+
}
|
|
50
|
+
armNoEarlierThan(delayMs) {
|
|
51
|
+
if (this._timer && Date.now() + delayMs <= this._firesAt) return;
|
|
52
|
+
this.arm(delayMs);
|
|
53
|
+
}
|
|
54
|
+
clear() {
|
|
55
|
+
if (this._timer) {
|
|
56
|
+
clearTimeout(this._timer);
|
|
57
|
+
this._timer = void 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.FlushTimer = __webpack_exports__.FlushTimer;
|
|
62
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
63
|
+
"FlushTimer"
|
|
64
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
65
|
+
Object.defineProperty(exports, '__esModule', {
|
|
66
|
+
value: true
|
|
67
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { safeSetTimeout } from "./index.mjs";
|
|
2
|
+
class FlushTimer {
|
|
3
|
+
constructor(_onFire){
|
|
4
|
+
this._onFire = _onFire;
|
|
5
|
+
this._firesAt = 0;
|
|
6
|
+
}
|
|
7
|
+
get pending() {
|
|
8
|
+
return !!this._timer;
|
|
9
|
+
}
|
|
10
|
+
arm(delayMs) {
|
|
11
|
+
this.clear();
|
|
12
|
+
this._firesAt = Date.now() + delayMs;
|
|
13
|
+
this._timer = safeSetTimeout(()=>{
|
|
14
|
+
this._timer = void 0;
|
|
15
|
+
this._onFire();
|
|
16
|
+
}, delayMs);
|
|
17
|
+
}
|
|
18
|
+
armNoEarlierThan(delayMs) {
|
|
19
|
+
if (this._timer && Date.now() + delayMs <= this._firesAt) return;
|
|
20
|
+
this.arm(delayMs);
|
|
21
|
+
}
|
|
22
|
+
clear() {
|
|
23
|
+
if (this._timer) {
|
|
24
|
+
clearTimeout(this._timer);
|
|
25
|
+
this._timer = void 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export { FlushTimer };
|
|
@@ -39,6 +39,7 @@ export interface RetriableOptions {
|
|
|
39
39
|
export declare function retriable<T>(fn: () => Promise<T>, props: RetriableOptions): Promise<T>;
|
|
40
40
|
export declare function currentTimestamp(): number;
|
|
41
41
|
export declare function currentISOTime(): string;
|
|
42
|
+
export declare function trySafe<T>(fn: () => T): T | undefined;
|
|
42
43
|
export declare function safeSetTimeout(fn: () => void, timeout: number): any;
|
|
43
44
|
export declare function raceWithTimeout<T>(promise: Promise<T>, timeoutMs: number, onTimeout?: () => void): Promise<T | void>;
|
|
44
45
|
export declare const isPromise: (obj: any) => obj is Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,yBAAyB,CAAA;AAGvC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,UAAU,CAAA;AACxB,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AAEnC,eAAO,MAAM,aAAa,SAAS,CAAA;AAEnC,eAAO,MAAM,UAAU,QAAoE,CAAA;AAE3F,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE3D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,GAAG,MAAM,CAE9E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAQtE;AAED,wBAAgB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,WAAW,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,CAAC,EAAE,CAAC,CAStF"}
|
|
@@ -86,6 +86,7 @@ var __webpack_exports__ = {};
|
|
|
86
86
|
var __rspack_reexport = {};
|
|
87
87
|
for(const __rspack_import_key in _bot_detection__rspack_import_1)if ([
|
|
88
88
|
"UUID_REGEX",
|
|
89
|
+
"trySafe",
|
|
89
90
|
"currentTimestamp",
|
|
90
91
|
"getEventUuid",
|
|
91
92
|
"createNamedError",
|
|
@@ -110,6 +111,7 @@ var __webpack_exports__ = {};
|
|
|
110
111
|
var __rspack_reexport = {};
|
|
111
112
|
for(const __rspack_import_key in _browser_utils__rspack_import_2)if ([
|
|
112
113
|
"UUID_REGEX",
|
|
114
|
+
"trySafe",
|
|
113
115
|
"currentTimestamp",
|
|
114
116
|
"getEventUuid",
|
|
115
117
|
"createNamedError",
|
|
@@ -134,6 +136,7 @@ var __webpack_exports__ = {};
|
|
|
134
136
|
var __rspack_reexport = {};
|
|
135
137
|
for(const __rspack_import_key in _bucketed_rate_limiter__rspack_import_3)if ([
|
|
136
138
|
"UUID_REGEX",
|
|
139
|
+
"trySafe",
|
|
137
140
|
"currentTimestamp",
|
|
138
141
|
"getEventUuid",
|
|
139
142
|
"createNamedError",
|
|
@@ -159,6 +162,7 @@ var __webpack_exports__ = {};
|
|
|
159
162
|
var __rspack_reexport = {};
|
|
160
163
|
for(const __rspack_import_key in _number_utils__rspack_import_5)if ([
|
|
161
164
|
"UUID_REGEX",
|
|
165
|
+
"trySafe",
|
|
162
166
|
"currentTimestamp",
|
|
163
167
|
"getEventUuid",
|
|
164
168
|
"createNamedError",
|
|
@@ -183,6 +187,7 @@ var __webpack_exports__ = {};
|
|
|
183
187
|
var __rspack_reexport = {};
|
|
184
188
|
for(const __rspack_import_key in _string_utils__rspack_import_6)if ([
|
|
185
189
|
"UUID_REGEX",
|
|
190
|
+
"trySafe",
|
|
186
191
|
"currentTimestamp",
|
|
187
192
|
"getEventUuid",
|
|
188
193
|
"createNamedError",
|
|
@@ -206,6 +211,7 @@ var __webpack_exports__ = {};
|
|
|
206
211
|
var __rspack_reexport = {};
|
|
207
212
|
for(const __rspack_import_key in _type_utils__rspack_import_0)if ([
|
|
208
213
|
"UUID_REGEX",
|
|
214
|
+
"trySafe",
|
|
209
215
|
"currentTimestamp",
|
|
210
216
|
"getEventUuid",
|
|
211
217
|
"createNamedError",
|
|
@@ -230,6 +236,7 @@ var __webpack_exports__ = {};
|
|
|
230
236
|
var __rspack_reexport = {};
|
|
231
237
|
for(const __rspack_import_key in _promise_queue__rspack_import_7)if ([
|
|
232
238
|
"UUID_REGEX",
|
|
239
|
+
"trySafe",
|
|
233
240
|
"currentTimestamp",
|
|
234
241
|
"getEventUuid",
|
|
235
242
|
"createNamedError",
|
|
@@ -254,6 +261,7 @@ var __webpack_exports__ = {};
|
|
|
254
261
|
var __rspack_reexport = {};
|
|
255
262
|
for(const __rspack_import_key in _logger__rspack_import_8)if ([
|
|
256
263
|
"UUID_REGEX",
|
|
264
|
+
"trySafe",
|
|
257
265
|
"currentTimestamp",
|
|
258
266
|
"getEventUuid",
|
|
259
267
|
"createNamedError",
|
|
@@ -278,6 +286,7 @@ var __webpack_exports__ = {};
|
|
|
278
286
|
var __rspack_reexport = {};
|
|
279
287
|
for(const __rspack_import_key in _user_agent_utils__rspack_import_9)if ([
|
|
280
288
|
"UUID_REGEX",
|
|
289
|
+
"trySafe",
|
|
281
290
|
"currentTimestamp",
|
|
282
291
|
"getEventUuid",
|
|
283
292
|
"createNamedError",
|
|
@@ -302,6 +311,7 @@ var __webpack_exports__ = {};
|
|
|
302
311
|
var __rspack_reexport = {};
|
|
303
312
|
for(const __rspack_import_key in _webview_app_utils__rspack_import_10)if ([
|
|
304
313
|
"UUID_REGEX",
|
|
314
|
+
"trySafe",
|
|
305
315
|
"currentTimestamp",
|
|
306
316
|
"getEventUuid",
|
|
307
317
|
"createNamedError",
|
|
@@ -379,6 +389,13 @@ var __webpack_exports__ = {};
|
|
|
379
389
|
function currentISOTime() {
|
|
380
390
|
return new Date().toISOString();
|
|
381
391
|
}
|
|
392
|
+
function trySafe(fn) {
|
|
393
|
+
try {
|
|
394
|
+
return fn();
|
|
395
|
+
} catch {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
382
399
|
function safeSetTimeout(fn, timeout) {
|
|
383
400
|
const t = setTimeout(fn, timeout);
|
|
384
401
|
t?.unref && t?.unref();
|
|
@@ -432,7 +449,8 @@ var __webpack_exports__ = {};
|
|
|
432
449
|
retriable: ()=>retriable,
|
|
433
450
|
safeSetTimeout: ()=>safeSetTimeout,
|
|
434
451
|
stripUrlHash: ()=>stripUrlHash,
|
|
435
|
-
toJsonSafeValue: ()=>_json_utils__rspack_import_4.toJsonSafeValue
|
|
452
|
+
toJsonSafeValue: ()=>_json_utils__rspack_import_4.toJsonSafeValue,
|
|
453
|
+
trySafe: ()=>trySafe
|
|
436
454
|
}, {
|
|
437
455
|
STRING_FORMAT: STRING_FORMAT,
|
|
438
456
|
UUID_REGEX: UUID_REGEX,
|
|
@@ -457,6 +475,7 @@ exports.retriable = __webpack_exports__.retriable;
|
|
|
457
475
|
exports.safeSetTimeout = __webpack_exports__.safeSetTimeout;
|
|
458
476
|
exports.stripUrlHash = __webpack_exports__.stripUrlHash;
|
|
459
477
|
exports.toJsonSafeValue = __webpack_exports__.toJsonSafeValue;
|
|
478
|
+
exports.trySafe = __webpack_exports__.trySafe;
|
|
460
479
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
461
480
|
"STRING_FORMAT",
|
|
462
481
|
"UUID_REGEX",
|
|
@@ -475,7 +494,8 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
475
494
|
"retriable",
|
|
476
495
|
"safeSetTimeout",
|
|
477
496
|
"stripUrlHash",
|
|
478
|
-
"toJsonSafeValue"
|
|
497
|
+
"toJsonSafeValue",
|
|
498
|
+
"trySafe"
|
|
479
499
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
480
500
|
Object.defineProperty(exports, '__esModule', {
|
|
481
501
|
value: true
|
|
@@ -66,6 +66,13 @@ function currentTimestamp() {
|
|
|
66
66
|
function currentISOTime() {
|
|
67
67
|
return new Date().toISOString();
|
|
68
68
|
}
|
|
69
|
+
function trySafe(fn) {
|
|
70
|
+
try {
|
|
71
|
+
return fn();
|
|
72
|
+
} catch {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
69
76
|
function safeSetTimeout(fn, timeout) {
|
|
70
77
|
const t = setTimeout(fn, timeout);
|
|
71
78
|
t?.unref && t?.unref();
|
|
@@ -105,4 +112,4 @@ function allSettled(promises) {
|
|
|
105
112
|
}))));
|
|
106
113
|
}
|
|
107
114
|
export { toJsonSafeValue } from "./json-utils.mjs";
|
|
108
|
-
export { STRING_FORMAT, UUID_REGEX, allSettled, assert, createNamedError, currentISOTime, currentTimestamp, getEventUuid, getFetch, isPromise, isUrl, isValidUUID, raceWithTimeout, removeTrailingSlash, retriable, safeSetTimeout, stripUrlHash };
|
|
115
|
+
export { STRING_FORMAT, UUID_REGEX, allSettled, assert, createNamedError, currentISOTime, currentTimestamp, getEventUuid, getFetch, isPromise, isUrl, isValidUUID, raceWithTimeout, removeTrailingSlash, retriable, safeSetTimeout, stripUrlHash, trySafe };
|
|
@@ -18,4 +18,11 @@ export declare function sanitizeString(value: string): string;
|
|
|
18
18
|
* The limits keep pathological values from causing unbounded recursion or traversal.
|
|
19
19
|
*/
|
|
20
20
|
export declare function toJsonSafeValue(value: unknown): unknown;
|
|
21
|
+
/**
|
|
22
|
+
* Copies caller-supplied attributes onto `target`, own enumerable keys only.
|
|
23
|
+
*
|
|
24
|
+
* Read key by key rather than spread: a getter over a disposed resource or a
|
|
25
|
+
* revoked proxy throws on the read itself, before the encoder's guards see it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function assignUserAttributes<T extends Record<string, any>>(target: T, source: Record<string, unknown> | undefined): T;
|
|
21
28
|
//# sourceMappingURL=json-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-utils.d.ts","sourceRoot":"","sources":["../../src/utils/json-utils.ts"],"names":[],"mappings":"AAAA;sEACsE;AACtE,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAC3C,eAAO,MAAM,yBAAyB,OAAQ,CAAA;AAC9C,eAAO,MAAM,yBAAyB,QAAS,CAAA;AAC/C,eAAO,MAAM,cAAc,eAAe,CAAA;AAC1C,eAAO,MAAM,eAAe,gBAAgB,CAAA;AAC5C,eAAO,MAAM,oBAAoB,qBAAqB,CAAA;AACtD,eAAO,MAAM,cAAc,eAAe,CAAA;AAW1C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAiBpD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CA2GvD"}
|
|
1
|
+
{"version":3,"file":"json-utils.d.ts","sourceRoot":"","sources":["../../src/utils/json-utils.ts"],"names":[],"mappings":"AAAA;sEACsE;AACtE,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAC3C,eAAO,MAAM,yBAAyB,OAAQ,CAAA;AAC9C,eAAO,MAAM,yBAAyB,QAAS,CAAA;AAC/C,eAAO,MAAM,cAAc,eAAe,CAAA;AAC1C,eAAO,MAAM,eAAe,gBAAgB,CAAA;AAC5C,eAAO,MAAM,oBAAoB,qBAAqB,CAAA;AACtD,eAAO,MAAM,cAAc,eAAe,CAAA;AAW1C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAiBpD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CA2GvD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAChE,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC1C,CAAC,CAsBH"}
|