@flareapp/core 2.6.0 → 2.8.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/dist/index.cjs +1137 -560
- package/dist/index.d.cts +188 -453
- package/dist/index.d.mts +188 -453
- package/dist/index.mjs +1097 -537
- package/dist/urlAttributes-B9BlkrfW.d.mts +452 -0
- package/dist/urlAttributes-CNGTgOJp.cjs +551 -0
- package/dist/urlAttributes-CvOw6tU3.d.cts +452 -0
- package/dist/urlAttributes-D3gCx23B.mjs +383 -0
- package/dist/util/index.cjs +24 -0
- package/dist/util/index.d.cts +2 -0
- package/dist/util/index.d.mts +2 -0
- package/dist/util/index.mjs +3 -0
- package/package.json +16 -2
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
//#region src/env/index.ts
|
|
2
|
+
const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.8.0" : "?";
|
|
3
|
+
const KEY = typeof FLARE_JS_KEY === "undefined" ? "" : FLARE_JS_KEY;
|
|
4
|
+
const SOURCEMAP_VERSION = typeof FLARE_SOURCEMAP_VERSION === "undefined" ? "" : FLARE_SOURCEMAP_VERSION;
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/util/assert.ts
|
|
8
|
+
function assert(value, message, debug) {
|
|
9
|
+
if (debug && !value) console.error(`Flare JavaScript client v${CLIENT_VERSION}: ${message}`);
|
|
10
|
+
return !!value;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/util/assertKey.ts
|
|
15
|
+
function assertKey(key, debug) {
|
|
16
|
+
return assert(key, "The client was not yet initialised with an API key. Run client.light('<flare-project-key>') when you initialise your app. If you are running in dev mode and didn't run the light command on purpose, you can ignore this error.", debug);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/util/statelessRegExp.ts
|
|
21
|
+
function withoutStatefulFlags(pattern) {
|
|
22
|
+
if (!pattern) return;
|
|
23
|
+
return pattern.global || pattern.sticky ? new RegExp(pattern.source, pattern.flags.replace(/[gy]/g, "")) : pattern;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/util/componentMatcher.ts
|
|
28
|
+
/**
|
|
29
|
+
* Built once so a mount costs one name resolution and one match. Strings match exactly, regexes by
|
|
30
|
+
* `test()`.
|
|
31
|
+
*/
|
|
32
|
+
function createComponentMatcher(option) {
|
|
33
|
+
if (option === true) return () => true;
|
|
34
|
+
if (!option || option.length === 0) return () => false;
|
|
35
|
+
const names = new Set(option.filter((entry) => typeof entry === "string"));
|
|
36
|
+
const patterns = option.filter((entry) => entry instanceof RegExp).map((pattern) => withoutStatefulFlags(pattern));
|
|
37
|
+
return (name) => names.has(name) || patterns.some((pattern) => pattern.test(name));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/util/convertToError.ts
|
|
42
|
+
function convertToError(error) {
|
|
43
|
+
if (error instanceof Error) return error;
|
|
44
|
+
if (typeof error === "string") return new Error(error);
|
|
45
|
+
if (typeof error === "object" && error !== null) {
|
|
46
|
+
const obj = error;
|
|
47
|
+
const message = typeof obj.message === "string" ? obj.message : String(error);
|
|
48
|
+
const converted = new Error(message);
|
|
49
|
+
if (typeof obj.stack === "string") converted.stack = obj.stack;
|
|
50
|
+
if (typeof obj.name === "string") converted.name = obj.name;
|
|
51
|
+
return converted;
|
|
52
|
+
}
|
|
53
|
+
return new Error(String(error));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/util/createIdentityTagger.ts
|
|
58
|
+
/**
|
|
59
|
+
* A per-package SDK/framework identity tagger. Holds its own WeakSet guards, so each Flare instance
|
|
60
|
+
* (singleton or injected renderer) gets each of the two tags at most once.
|
|
61
|
+
*
|
|
62
|
+
* `frameworkName` is `FrameworkName` rather than `string` because those are the exact values the backend
|
|
63
|
+
* recognises, so a first-party package cannot invent one. A host app that needs its own name calls
|
|
64
|
+
* `setFramework` directly.
|
|
65
|
+
*/
|
|
66
|
+
function createIdentityTagger(config) {
|
|
67
|
+
const sdkTagged = /* @__PURE__ */ new WeakSet();
|
|
68
|
+
const frameworkTagged = /* @__PURE__ */ new WeakSet();
|
|
69
|
+
return {
|
|
70
|
+
registerSdkIdentity(flare) {
|
|
71
|
+
if (sdkTagged.has(flare)) return;
|
|
72
|
+
sdkTagged.add(flare);
|
|
73
|
+
flare.setSdkInfo({
|
|
74
|
+
name: config.sdkName,
|
|
75
|
+
version: config.sdkVersion
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
tagFramework(flare, frameworkVersion) {
|
|
79
|
+
if (frameworkTagged.has(flare)) return;
|
|
80
|
+
frameworkTagged.add(flare);
|
|
81
|
+
flare.setFramework(frameworkVersion === void 0 ? { name: config.frameworkName } : {
|
|
82
|
+
name: config.frameworkName,
|
|
83
|
+
version: frameworkVersion
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/util/extractCode.ts
|
|
91
|
+
const MAX_CODE_LENGTH = 64;
|
|
92
|
+
function extractCode(error) {
|
|
93
|
+
const code = error.code;
|
|
94
|
+
if (typeof code !== "string" || code.length === 0) return;
|
|
95
|
+
return code.slice(0, MAX_CODE_LENGTH);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/util/traversalBudget.ts
|
|
100
|
+
/**
|
|
101
|
+
* Cycle detection only tracks the ancestor path, so a value holding the same child under two keys is not
|
|
102
|
+
* a cycle but still costs 2^depth to walk. Host data (glows, addContext, span attributes) reaches that
|
|
103
|
+
* shape through any object graph shared by reference.
|
|
104
|
+
*
|
|
105
|
+
* The node cap only bounds that walk if EVERY visited node is charged, primitive leaves included. It used
|
|
106
|
+
* to charge containers only, so 15 shared objects over an array of 1000 strings walked ~17M uncharged
|
|
107
|
+
* strings before the cap fired: 1.2s and 1GB. Callers must spend before their leaf branches return, not
|
|
108
|
+
* after. We do not memoize instead: a value shared under two keys is not a cycle and must not read as one.
|
|
109
|
+
*/
|
|
110
|
+
const MAX_TRAVERSAL_DEPTH = 24;
|
|
111
|
+
const MAX_TRAVERSAL_NODES = 5e4;
|
|
112
|
+
function createTraversalBudget(nodes = MAX_TRAVERSAL_NODES) {
|
|
113
|
+
return { remaining: nodes };
|
|
114
|
+
}
|
|
115
|
+
/** Consumes one node. False once the budget is spent: stop descending. */
|
|
116
|
+
function spendNode(budget) {
|
|
117
|
+
if (budget.remaining <= 0) return false;
|
|
118
|
+
budget.remaining--;
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
/** Marks where a walk stopped, so a truncated payload does not read as a complete one. */
|
|
122
|
+
const TRUNCATED = "[truncated: too large]";
|
|
123
|
+
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/util/safeClone.ts
|
|
126
|
+
/**
|
|
127
|
+
* One JSON-safe recursive clone shared by flatJsonStringify (json mode) and vue serializeProps
|
|
128
|
+
* (display mode). Cycles become "[Circular]", a BigInt its decimal string, and a throwing getter
|
|
129
|
+
* "[Getter threw]" in both modes. json mode passes functions / symbols / non-plain objects through
|
|
130
|
+
* (so JSON.stringify still drops functions and calls Date.toJSON); display mode replaces them with
|
|
131
|
+
* placeholders and applies the depth / array / key / string caps and the key denylist.
|
|
132
|
+
*/
|
|
133
|
+
function safeClone(value, options) {
|
|
134
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
135
|
+
const budget = createTraversalBudget();
|
|
136
|
+
const depthCap = options.mode === "display" ? options.maxDepth : MAX_TRAVERSAL_DEPTH;
|
|
137
|
+
function walk(node, depth) {
|
|
138
|
+
if (!spendNode(budget)) return TRUNCATED;
|
|
139
|
+
if (node === null) return null;
|
|
140
|
+
const type = typeof node;
|
|
141
|
+
if (type === "bigint") return node.toString();
|
|
142
|
+
if (type === "function") return options.mode === "display" ? "[Function]" : node;
|
|
143
|
+
if (type === "symbol") return options.mode === "display" ? "[Symbol]" : node;
|
|
144
|
+
if (type === "string") return options.mode === "display" ? truncate(node, options.stringCap) : node;
|
|
145
|
+
if (type !== "object") return node;
|
|
146
|
+
if (seen.has(node)) return "[Circular]";
|
|
147
|
+
if (Array.isArray(node)) {
|
|
148
|
+
if (depth > depthCap) return options.mode === "display" ? "[Array]" : TRUNCATED;
|
|
149
|
+
seen.add(node);
|
|
150
|
+
const cap = options.mode === "display" ? options.arrayCap : Infinity;
|
|
151
|
+
const result = (node.length > cap ? node.slice(0, cap) : node).map((item) => walk(item, depth + 1));
|
|
152
|
+
if (node.length > cap) result.push(`[… ${node.length - cap} more items]`);
|
|
153
|
+
seen.delete(node);
|
|
154
|
+
return result;
|
|
155
|
+
}
|
|
156
|
+
if (!isPlainObject(node)) return options.mode === "display" ? "[Object]" : node;
|
|
157
|
+
if (depth > depthCap) return options.mode === "display" ? "[Object]" : TRUNCATED;
|
|
158
|
+
seen.add(node);
|
|
159
|
+
const result = {};
|
|
160
|
+
const keys = Object.keys(node);
|
|
161
|
+
const keyCap = options.mode === "display" ? options.objectKeyCap : Infinity;
|
|
162
|
+
const limitedKeys = keys.length > keyCap ? keys.slice(0, keyCap) : keys;
|
|
163
|
+
for (const key of limitedKeys) {
|
|
164
|
+
if (options.mode === "display" && options.denylist.test(key)) {
|
|
165
|
+
result[key] = "[redacted]";
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
result[key] = walk(node[key], depth + 1);
|
|
170
|
+
} catch {
|
|
171
|
+
result[key] = "[Getter threw]";
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (keys.length > keyCap) result["…"] = `[${keys.length - keyCap} more keys]`;
|
|
175
|
+
seen.delete(node);
|
|
176
|
+
return result;
|
|
177
|
+
}
|
|
178
|
+
return walk(value, 0);
|
|
179
|
+
}
|
|
180
|
+
function truncate(value, max) {
|
|
181
|
+
if (value.length <= max) return value;
|
|
182
|
+
return `${value.slice(0, max)}…[truncated ${value.length - max} chars]`;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Literal object / null prototypes only. Class instances may have side-effecting getters or
|
|
186
|
+
* non-enumerable internals we should not traverse, so they are left to the caller's mode policy.
|
|
187
|
+
*/
|
|
188
|
+
function isPlainObject(value) {
|
|
189
|
+
if (value === null || typeof value !== "object") return false;
|
|
190
|
+
const proto = Object.getPrototypeOf(value);
|
|
191
|
+
return proto === Object.prototype || proto === null;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/util/flatJsonStringify.ts
|
|
196
|
+
/**
|
|
197
|
+
* JSON.stringify hardened for untrusted glow / addContext data: cycles become "[Circular]", a BigInt
|
|
198
|
+
* its decimal string, and a throwing getter "[Getter threw]", each of which would otherwise throw and
|
|
199
|
+
* drop the whole report.
|
|
200
|
+
*/
|
|
201
|
+
function flatJsonStringify(json) {
|
|
202
|
+
return JSON.stringify(safeClone(json, { mode: "json" }));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/util/glowsToEvents.ts
|
|
207
|
+
function glowsToEvents(glows) {
|
|
208
|
+
return glows.map((glow) => ({
|
|
209
|
+
type: "php_glow",
|
|
210
|
+
startTimeUnixNano: Math.round(glow.microtime * 1e9),
|
|
211
|
+
endTimeUnixNano: null,
|
|
212
|
+
attributes: {
|
|
213
|
+
"glow.name": String(glow.name),
|
|
214
|
+
"glow.level": glow.messageLevel,
|
|
215
|
+
"glow.context": glow.metaData ?? {}
|
|
216
|
+
}
|
|
217
|
+
}));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/util/now.ts
|
|
222
|
+
function now() {
|
|
223
|
+
return Math.round(Date.now() / 1e3);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/util/redactUrl.ts
|
|
228
|
+
const DEFAULT_URL_DENYLIST = /password|passwd|pwd|token|secret|authorization|\bauth\b|bearer|oauth|credentials?|cookie|api[-_]?key|private[-_]?key|session|csrf|xsrf|\bpin\b|\bssn\b|card[-_]?number|\bcvv\b/i;
|
|
229
|
+
function resolveDenylist(custom, replaceDefault = false, defaultDenylist = DEFAULT_URL_DENYLIST) {
|
|
230
|
+
if (!custom) return defaultDenylist;
|
|
231
|
+
if (replaceDefault) {
|
|
232
|
+
const safeFlags = custom.flags.replace(/[gy]/g, "");
|
|
233
|
+
return new RegExp(custom.source, safeFlags);
|
|
234
|
+
}
|
|
235
|
+
const flags = unionFlags(defaultDenylist.flags, custom.flags);
|
|
236
|
+
return new RegExp(`(?:${defaultDenylist.source})|(?:${custom.source})`, flags);
|
|
237
|
+
}
|
|
238
|
+
function unionFlags(a, b) {
|
|
239
|
+
const merged = /* @__PURE__ */ new Set();
|
|
240
|
+
for (const flag of a + b) {
|
|
241
|
+
if (flag === "g" || flag === "y") continue;
|
|
242
|
+
merged.add(flag);
|
|
243
|
+
}
|
|
244
|
+
return [...merged].join("");
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Strips userinfo (`user:pass@`) from an absolute URL and replaces query-string values whose key
|
|
248
|
+
* matches `denylist` with `[redacted]`. Path segments are left untouched.
|
|
249
|
+
*/
|
|
250
|
+
function redactUrlQuery(fullPath, denylist = DEFAULT_URL_DENYLIST) {
|
|
251
|
+
const url = stripUserinfo(fullPath);
|
|
252
|
+
const queryStart = url.indexOf("?");
|
|
253
|
+
if (queryStart === -1) return url;
|
|
254
|
+
const hashStart = url.indexOf("#", queryStart);
|
|
255
|
+
const queryEnd = hashStart === -1 ? url.length : hashStart;
|
|
256
|
+
const prefix = url.slice(0, queryStart + 1);
|
|
257
|
+
const queryString = url.slice(queryStart + 1, queryEnd);
|
|
258
|
+
const suffix = url.slice(queryEnd);
|
|
259
|
+
return `${prefix}${queryString.split("&").map((pair) => {
|
|
260
|
+
if (pair === "") return pair;
|
|
261
|
+
const eq = pair.indexOf("=");
|
|
262
|
+
const rawKey = eq === -1 ? pair : pair.slice(0, eq);
|
|
263
|
+
const decodedKey = safeDecode(rawKey);
|
|
264
|
+
if (!denylist.test(decodedKey)) return pair;
|
|
265
|
+
return eq === -1 ? rawKey : `${rawKey}=[redacted]`;
|
|
266
|
+
}).join("&")}${suffix}`;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Value-side mirror of `redactUrlQuery`: a new object where any value whose key matches `denylist`
|
|
270
|
+
* becomes `[redacted]`. Null-prototype result so a `__proto__` key is stored, not swallowed.
|
|
271
|
+
*/
|
|
272
|
+
function redactObjectValues(obj, denylist = DEFAULT_URL_DENYLIST) {
|
|
273
|
+
const result = Object.create(null);
|
|
274
|
+
for (const key of Object.keys(obj)) result[key] = denylist.test(key) ? "[redacted]" : obj[key];
|
|
275
|
+
return result;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Removes userinfo (`user:pass@`) from an absolute URL's authority only. A path or query can legally
|
|
279
|
+
* contain `@`, so only the authority (after `scheme://`, up to the first `/`, `?`, `#`) is inspected.
|
|
280
|
+
*/
|
|
281
|
+
function stripUserinfo(url) {
|
|
282
|
+
const schemeMatch = /^[a-z][a-z0-9+.-]*:\/\//i.exec(url);
|
|
283
|
+
if (!schemeMatch) return url;
|
|
284
|
+
const authorityStart = schemeMatch[0].length;
|
|
285
|
+
const rest = url.slice(authorityStart);
|
|
286
|
+
const delimiter = /[/?#]/.exec(rest);
|
|
287
|
+
const authorityEnd = delimiter ? authorityStart + delimiter.index : url.length;
|
|
288
|
+
const authority = url.slice(authorityStart, authorityEnd);
|
|
289
|
+
const at = authority.lastIndexOf("@");
|
|
290
|
+
if (at === -1) return url;
|
|
291
|
+
return url.slice(0, authorityStart) + authority.slice(at + 1) + url.slice(authorityEnd);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* decodeURIComponent throws on malformed escape sequences (`%E0`, lone `%`, etc). Falls back to the
|
|
295
|
+
* raw key in that case rather than aborting the whole redaction pass.
|
|
296
|
+
*/
|
|
297
|
+
function safeDecode(value) {
|
|
298
|
+
try {
|
|
299
|
+
return decodeURIComponent(value);
|
|
300
|
+
} catch {
|
|
301
|
+
return value;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/util/rejection.ts
|
|
307
|
+
/** Best-effort human-readable description of an arbitrary rejection reason. */
|
|
308
|
+
function describeRejectionReason(reason) {
|
|
309
|
+
if (typeof reason === "string") return reason;
|
|
310
|
+
if (reason && typeof reason === "object") {
|
|
311
|
+
const message = reason.message;
|
|
312
|
+
if (typeof message === "string" && message) return message;
|
|
313
|
+
try {
|
|
314
|
+
return JSON.stringify(reason);
|
|
315
|
+
} catch {
|
|
316
|
+
return "Unhandled promise rejection (non-serializable reason)";
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return String(reason);
|
|
320
|
+
}
|
|
321
|
+
function hasStack(reason) {
|
|
322
|
+
return !!reason && typeof reason === "object" && typeof reason.stack === "string";
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Routes by whether `reason` carries a stack: stack-bearing reasons go to `reportSilently`, stackless
|
|
326
|
+
* ones to `reportUnhandledRejection`.
|
|
327
|
+
* The `.catch` is what stops a transport failure from surfacing as a second unhandled rejection.
|
|
328
|
+
* `reportSilently` is assumed async and left unwrapped, so a synchronous throw there still propagates.
|
|
329
|
+
*/
|
|
330
|
+
function routeRejection(reporter, reason) {
|
|
331
|
+
if (reason instanceof Error) {
|
|
332
|
+
reporter.reportSilently(reason);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
if (hasStack(reason)) {
|
|
336
|
+
const error = new Error(describeRejectionReason(reason));
|
|
337
|
+
error.stack = reason.stack;
|
|
338
|
+
reporter.reportSilently(error);
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
Promise.resolve(reporter.reportUnhandledRejection(describeRejectionReason(reason))).catch(() => {});
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
//#endregion
|
|
345
|
+
//#region src/util/toCustomContext.ts
|
|
346
|
+
/** Wraps a framework payload as the `context.custom` attribute a report expects. */
|
|
347
|
+
function toCustomContext(framework, payload) {
|
|
348
|
+
return { "context.custom": { [framework]: payload } };
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
//#endregion
|
|
352
|
+
//#region src/util/urlAttributes.ts
|
|
353
|
+
/** Well past any routable URL, but short enough that an inline `data:` payload cannot ride along. */
|
|
354
|
+
const MAX_URL_LENGTH = 2048;
|
|
355
|
+
function truncateUrl(url) {
|
|
356
|
+
return url.length <= MAX_URL_LENGTH ? url : `${url.slice(0, MAX_URL_LENGTH)}…[truncated]`;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Builds the OTel `url.*` attributes for one absolute URL.
|
|
360
|
+
*
|
|
361
|
+
* Redacts the URL first and splits it after, so `url.full` and `url.query` always show the same
|
|
362
|
+
* redacted values.
|
|
363
|
+
*
|
|
364
|
+
* Leaves out `url.query` when there is no query string. Returns only `url.full` when the URL cannot
|
|
365
|
+
* be parsed, for example a relative one.
|
|
366
|
+
*/
|
|
367
|
+
function urlAttributes(url, denylist = DEFAULT_URL_DENYLIST) {
|
|
368
|
+
const full = truncateUrl(redactUrlQuery(url, denylist));
|
|
369
|
+
const attributes = { "url.full": full };
|
|
370
|
+
let parsed;
|
|
371
|
+
try {
|
|
372
|
+
parsed = new URL(full);
|
|
373
|
+
} catch {
|
|
374
|
+
return attributes;
|
|
375
|
+
}
|
|
376
|
+
attributes["url.scheme"] = parsed.protocol.slice(0, -1);
|
|
377
|
+
attributes["url.path"] = parsed.pathname;
|
|
378
|
+
if (parsed.search) attributes["url.query"] = parsed.search.slice(1);
|
|
379
|
+
return attributes;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
//#endregion
|
|
383
|
+
export { withoutStatefulFlags as C, KEY as D, CLIENT_VERSION as E, SOURCEMAP_VERSION as O, createComponentMatcher as S, assert as T, createTraversalBudget as _, routeRejection as a, createIdentityTagger as b, redactUrlQuery as c, now as d, glowsToEvents as f, TRUNCATED as g, MAX_TRAVERSAL_DEPTH as h, describeRejectionReason as i, resolveDenylist as l, safeClone as m, urlAttributes as n, DEFAULT_URL_DENYLIST as o, flatJsonStringify as p, toCustomContext as r, redactObjectValues as s, MAX_URL_LENGTH as t, safeDecode as u, spendNode as v, assertKey as w, convertToError as x, extractCode as y };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_urlAttributes = require('../urlAttributes-CNGTgOJp.cjs');
|
|
3
|
+
|
|
4
|
+
exports.DEFAULT_URL_DENYLIST = require_urlAttributes.DEFAULT_URL_DENYLIST;
|
|
5
|
+
exports.MAX_URL_LENGTH = require_urlAttributes.MAX_URL_LENGTH;
|
|
6
|
+
exports.assert = require_urlAttributes.assert;
|
|
7
|
+
exports.assertKey = require_urlAttributes.assertKey;
|
|
8
|
+
exports.convertToError = require_urlAttributes.convertToError;
|
|
9
|
+
exports.createComponentMatcher = require_urlAttributes.createComponentMatcher;
|
|
10
|
+
exports.createIdentityTagger = require_urlAttributes.createIdentityTagger;
|
|
11
|
+
exports.describeRejectionReason = require_urlAttributes.describeRejectionReason;
|
|
12
|
+
exports.extractCode = require_urlAttributes.extractCode;
|
|
13
|
+
exports.flatJsonStringify = require_urlAttributes.flatJsonStringify;
|
|
14
|
+
exports.glowsToEvents = require_urlAttributes.glowsToEvents;
|
|
15
|
+
exports.now = require_urlAttributes.now;
|
|
16
|
+
exports.redactObjectValues = require_urlAttributes.redactObjectValues;
|
|
17
|
+
exports.redactUrlQuery = require_urlAttributes.redactUrlQuery;
|
|
18
|
+
exports.resolveDenylist = require_urlAttributes.resolveDenylist;
|
|
19
|
+
exports.routeRejection = require_urlAttributes.routeRejection;
|
|
20
|
+
exports.safeClone = require_urlAttributes.safeClone;
|
|
21
|
+
exports.safeDecode = require_urlAttributes.safeDecode;
|
|
22
|
+
exports.toCustomContext = require_urlAttributes.toCustomContext;
|
|
23
|
+
exports.urlAttributes = require_urlAttributes.urlAttributes;
|
|
24
|
+
exports.withoutStatefulFlags = require_urlAttributes.withoutStatefulFlags;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as createComponentMatcher, S as ProfileComponentsOption, T as assert, _ as flatJsonStringify, a as SafeCloneOptions, b as createIdentityTagger, c as describeRejectionReason, d as redactObjectValues, f as redactUrlQuery, g as glowsToEvents, h as now, i as withoutStatefulFlags, l as routeRejection, m as safeDecode, n as urlAttributes, o as safeClone, p as resolveDenylist, r as toCustomContext, s as RejectionReporter, t as MAX_URL_LENGTH, u as DEFAULT_URL_DENYLIST, v as extractCode, w as assertKey, x as convertToError, y as SdkTaggable } from "../urlAttributes-CvOw6tU3.cjs";
|
|
2
|
+
export { DEFAULT_URL_DENYLIST, MAX_URL_LENGTH, ProfileComponentsOption, RejectionReporter, SafeCloneOptions, SdkTaggable, assert, assertKey, convertToError, createComponentMatcher, createIdentityTagger, describeRejectionReason, extractCode, flatJsonStringify, glowsToEvents, now, redactObjectValues, redactUrlQuery, resolveDenylist, routeRejection, safeClone, safeDecode, toCustomContext, urlAttributes, withoutStatefulFlags };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as createComponentMatcher, S as ProfileComponentsOption, T as assert, _ as flatJsonStringify, a as SafeCloneOptions, b as createIdentityTagger, c as describeRejectionReason, d as redactObjectValues, f as redactUrlQuery, g as glowsToEvents, h as now, i as withoutStatefulFlags, l as routeRejection, m as safeDecode, n as urlAttributes, o as safeClone, p as resolveDenylist, r as toCustomContext, s as RejectionReporter, t as MAX_URL_LENGTH, u as DEFAULT_URL_DENYLIST, v as extractCode, w as assertKey, x as convertToError, y as SdkTaggable } from "../urlAttributes-B9BlkrfW.mjs";
|
|
2
|
+
export { DEFAULT_URL_DENYLIST, MAX_URL_LENGTH, ProfileComponentsOption, RejectionReporter, SafeCloneOptions, SdkTaggable, assert, assertKey, convertToError, createComponentMatcher, createIdentityTagger, describeRejectionReason, extractCode, flatJsonStringify, glowsToEvents, now, redactObjectValues, redactUrlQuery, resolveDenylist, routeRejection, safeClone, safeDecode, toCustomContext, urlAttributes, withoutStatefulFlags };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { C as withoutStatefulFlags, S as createComponentMatcher, T as assert, a as routeRejection, b as createIdentityTagger, c as redactUrlQuery, d as now, f as glowsToEvents, i as describeRejectionReason, l as resolveDenylist, m as safeClone, n as urlAttributes, o as DEFAULT_URL_DENYLIST, p as flatJsonStringify, r as toCustomContext, s as redactObjectValues, t as MAX_URL_LENGTH, u as safeDecode, w as assertKey, x as convertToError, y as extractCode } from "../urlAttributes-D3gCx23B.mjs";
|
|
2
|
+
|
|
3
|
+
export { DEFAULT_URL_DENYLIST, MAX_URL_LENGTH, assert, assertKey, convertToError, createComponentMatcher, createIdentityTagger, describeRejectionReason, extractCode, flatJsonStringify, glowsToEvents, now, redactObjectValues, redactUrlQuery, resolveDenylist, routeRejection, safeClone, safeDecode, toCustomContext, urlAttributes, withoutStatefulFlags };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flareapp/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Environment-agnostic core for the Flare JS SDK",
|
|
5
5
|
"homepage": "https://flareapp.io",
|
|
6
6
|
"bugs": {
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
"name": "Spatie",
|
|
16
16
|
"email": "info@spatie.be"
|
|
17
17
|
},
|
|
18
|
+
"contributors": [
|
|
19
|
+
"Dries Heyninck <dries@spatie.be>"
|
|
20
|
+
],
|
|
18
21
|
"files": [
|
|
19
22
|
"dist"
|
|
20
23
|
],
|
|
@@ -31,11 +34,21 @@
|
|
|
31
34
|
"types": "./dist/index.d.cts",
|
|
32
35
|
"default": "./dist/index.cjs"
|
|
33
36
|
}
|
|
37
|
+
},
|
|
38
|
+
"./util": {
|
|
39
|
+
"import": {
|
|
40
|
+
"types": "./dist/util/index.d.mts",
|
|
41
|
+
"default": "./dist/util/index.mjs"
|
|
42
|
+
},
|
|
43
|
+
"require": {
|
|
44
|
+
"types": "./dist/util/index.d.cts",
|
|
45
|
+
"default": "./dist/util/index.cjs"
|
|
46
|
+
}
|
|
34
47
|
}
|
|
35
48
|
},
|
|
36
49
|
"scripts": {
|
|
37
50
|
"prepublishOnly": "npm run build",
|
|
38
|
-
"build": "tsdown src/index.ts --format cjs,esm --dts --env.FLARE_JS_CLIENT_VERSION=$(node -p \"require('./package.json').version\") --clean",
|
|
51
|
+
"build": "tsdown src/index.ts src/util/index.ts --format cjs,esm --dts --env.FLARE_JS_CLIENT_VERSION=$(node -p \"require('./package.json').version\") --clean",
|
|
39
52
|
"test": "vitest run",
|
|
40
53
|
"typescript": "tsc --noEmit",
|
|
41
54
|
"release": "release-it"
|
|
@@ -44,6 +57,7 @@
|
|
|
44
57
|
"error-stack-parser": "^2.0.2"
|
|
45
58
|
},
|
|
46
59
|
"devDependencies": {
|
|
60
|
+
"@flareapp/test-helpers": "*",
|
|
47
61
|
"jsdom": "^26.1.0",
|
|
48
62
|
"tsdown": "^0.20.3",
|
|
49
63
|
"typescript": "^5.7.0",
|