@interfere/types 6.0.0 → 8.1.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/data/frame.d.mts +2 -1
- package/dist/data/frame.d.mts.map +1 -1
- package/dist/data/frame.mjs +3 -2
- package/dist/data/frame.mjs.map +1 -1
- package/dist/data/session.d.mts +1 -1
- package/dist/data/session.mjs +1 -1
- package/dist/data/session.mjs.map +1 -1
- package/dist/data/source-maps.d.mts +3 -9
- package/dist/data/source-maps.d.mts.map +1 -1
- package/dist/data/source-maps.mjs +4 -3
- package/dist/data/source-maps.mjs.map +1 -1
- package/dist/events/error.d.mts +5 -4
- package/dist/events/error.d.mts.map +1 -1
- package/dist/events/error.mjs +1 -1
- package/dist/events/error.mjs.map +1 -1
- package/dist/events/pageleave.d.mts +1 -1
- package/dist/events/pageleave.mjs +1 -1
- package/dist/events/pageleave.mjs.map +1 -1
- package/dist/events/pageview.d.mts +1 -1
- package/dist/events/pageview.mjs +1 -1
- package/dist/events/pageview.mjs.map +1 -1
- package/dist/integrations/index.d.mts +4 -20
- package/dist/integrations/index.d.mts.map +1 -1
- package/dist/integrations/index.mjs +6 -8
- package/dist/integrations/index.mjs.map +1 -1
- package/dist/integrations/platforms/github.d.mts +3 -8
- package/dist/integrations/platforms/github.d.mts.map +1 -1
- package/dist/integrations/platforms/github.mjs +3 -5
- package/dist/integrations/platforms/github.mjs.map +1 -1
- package/dist/integrations/platforms/vercel.d.mts +2 -24
- package/dist/integrations/platforms/vercel.d.mts.map +1 -1
- package/dist/integrations/platforms/vercel.mjs +3 -5
- package/dist/integrations/platforms/vercel.mjs.map +1 -1
- package/dist/releases/definition.d.mts +3 -3
- package/dist/releases/definition.mjs +1 -1
- package/dist/releases/definition.mjs.map +1 -1
- package/dist/sdk/env.d.mts +3 -7
- package/dist/sdk/env.d.mts.map +1 -1
- package/dist/sdk/env.mjs +2 -2
- package/dist/sdk/env.mjs.map +1 -1
- package/dist/sdk/envelope.d.mts +14 -171
- package/dist/sdk/envelope.d.mts.map +1 -1
- package/dist/sdk/envelope.mjs +6 -8
- package/dist/sdk/envelope.mjs.map +1 -1
- package/dist/sdk/errors.d.mts +2 -1
- package/dist/sdk/errors.d.mts.map +1 -1
- package/dist/sdk/errors.mjs +40 -5
- package/dist/sdk/errors.mjs.map +1 -1
- package/dist/sdk/geo.d.mts +10 -0
- package/dist/sdk/geo.d.mts.map +1 -0
- package/dist/sdk/geo.mjs +17 -0
- package/dist/sdk/geo.mjs.map +1 -0
- package/dist/sdk/identify.d.mts +23 -2
- package/dist/sdk/identify.d.mts.map +1 -1
- package/dist/sdk/identify.mjs +17 -2
- package/dist/sdk/identify.mjs.map +1 -1
- package/dist/sdk/plugins/context/browser.d.mts +1 -1
- package/dist/sdk/plugins/context/browser.mjs +1 -1
- package/dist/sdk/plugins/context/browser.mjs.map +1 -1
- package/dist/sdk/plugins/context/edge.d.mts +1 -1
- package/dist/sdk/plugins/context/edge.mjs +1 -1
- package/dist/sdk/plugins/context/edge.mjs.map +1 -1
- package/dist/sdk/plugins/context/next.d.mts +4 -4
- package/dist/sdk/plugins/context/next.mjs +1 -1
- package/dist/sdk/plugins/context/next.mjs.map +1 -1
- package/dist/sdk/plugins/payload/errors.d.mts +4 -2
- package/dist/sdk/plugins/payload/errors.d.mts.map +1 -1
- package/dist/sdk/plugins/payload/errors.mjs +1 -1
- package/dist/sdk/plugins/payload/errors.mjs.map +1 -1
- package/dist/sdk/plugins/payload/page-events.d.mts +1 -1
- package/dist/sdk/plugins/payload/page-events.mjs +1 -1
- package/dist/sdk/plugins/payload/page-events.mjs.map +1 -1
- package/dist/sdk/plugins/payload/rage-click.d.mts +1 -1
- package/dist/sdk/plugins/payload/rage-click.mjs +1 -1
- package/dist/sdk/plugins/payload/rage-click.mjs.map +1 -1
- package/dist/sdk/plugins/payload/replay.d.mts +1 -1
- package/dist/sdk/plugins/payload/replay.mjs +1 -1
- package/dist/sdk/plugins/payload/replay.mjs.map +1 -1
- package/dist/sdk/runtime.d.mts +3 -6
- package/dist/sdk/runtime.d.mts.map +1 -1
- package/dist/sdk/runtime.mjs +2 -6
- package/dist/sdk/runtime.mjs.map +1 -1
- package/dist/util/omit-undefined.d.mts +5 -0
- package/dist/util/omit-undefined.d.mts.map +1 -0
- package/dist/util/omit-undefined.mjs +8 -0
- package/dist/util/omit-undefined.mjs.map +1 -0
- package/package.json +8 -8
- package/dist/auth/public-token.d.mts +0 -9
- package/dist/auth/public-token.d.mts.map +0 -1
- package/dist/auth/public-token.mjs +0 -7
- package/dist/auth/public-token.mjs.map +0 -1
- package/dist/data/surface.d.mts +0 -7
- package/dist/data/surface.d.mts.map +0 -1
- package/dist/data/surface.mjs +0 -4
- package/dist/data/surface.mjs.map +0 -1
- package/dist/events/identify.d.mts +0 -13
- package/dist/events/identify.d.mts.map +0 -1
- package/dist/events/identify.mjs +0 -11
- package/dist/events/identify.mjs.map +0 -1
- package/dist/events/rage-click.d.mts +0 -17
- package/dist/events/rage-click.d.mts.map +0 -1
- package/dist/events/rage-click.mjs +0 -15
- package/dist/events/rage-click.mjs.map +0 -1
- package/dist/events/replay-chunk.d.mts +0 -16
- package/dist/events/replay-chunk.d.mts.map +0 -1
- package/dist/events/replay-chunk.mjs +0 -14
- package/dist/events/replay-chunk.mjs.map +0 -1
- package/dist/events/session-summary.d.mts +0 -15
- package/dist/events/session-summary.d.mts.map +0 -1
- package/dist/events/session-summary.mjs +0 -13
- package/dist/events/session-summary.mjs.map +0 -1
- package/dist/events/ui-event.d.mts +0 -11
- package/dist/events/ui-event.d.mts.map +0 -1
- package/dist/events/ui-event.mjs +0 -9
- package/dist/events/ui-event.mjs.map +0 -1
- package/dist/sdk/capture.d.mts +0 -8
- package/dist/sdk/capture.d.mts.map +0 -1
- package/dist/sdk/capture.mjs +0 -12
- package/dist/sdk/capture.mjs.map +0 -1
- package/dist/sdk/config.d.mts +0 -183
- package/dist/sdk/config.d.mts.map +0 -1
- package/dist/sdk/config.mjs +0 -71
- package/dist/sdk/config.mjs.map +0 -1
- package/dist/sdk/packages.d.mts +0 -7
- package/dist/sdk/packages.d.mts.map +0 -1
- package/dist/sdk/packages.mjs +0 -9
- package/dist/sdk/packages.mjs.map +0 -1
- package/dist/sdk/plugins/lib/schemas.d.mts +0 -22
- package/dist/sdk/plugins/lib/schemas.d.mts.map +0 -1
- package/dist/sdk/plugins/lib/schemas.mjs +0 -1
- package/dist/sdk/plugins/payload/ai-summary.d.mts +0 -13
- package/dist/sdk/plugins/payload/ai-summary.d.mts.map +0 -1
- package/dist/sdk/plugins/payload/ai-summary.mjs +0 -11
- package/dist/sdk/plugins/payload/ai-summary.mjs.map +0 -1
package/dist/sdk/envelope.d.mts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { z } from "zod
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
|
|
3
3
|
//#region src/sdk/envelope.d.ts
|
|
4
|
-
declare const envelopeVersion: z.ZodUnion<readonly [z.ZodLiteral<0>]>;
|
|
5
|
-
type EnvelopeVersion = z.infer<typeof envelopeVersion>;
|
|
6
4
|
/**
|
|
7
5
|
* Indicates how the sessionId was resolved on the server.
|
|
8
6
|
*
|
|
@@ -12,10 +10,10 @@ type EnvelopeVersion = z.infer<typeof envelopeVersion>;
|
|
|
12
10
|
* - "client": Session ID was set on the client (browser SDK)
|
|
13
11
|
*/
|
|
14
12
|
declare const sessionSourceSchema: z.ZodOptional<z.ZodEnum<{
|
|
15
|
-
header: "header";
|
|
16
13
|
async_context: "async_context";
|
|
17
|
-
fallback: "fallback";
|
|
18
14
|
client: "client";
|
|
15
|
+
fallback: "fallback";
|
|
16
|
+
header: "header";
|
|
19
17
|
}>>;
|
|
20
18
|
type SessionSource = z.infer<typeof sessionSourceSchema>;
|
|
21
19
|
declare const envelopeContextSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -75,15 +73,15 @@ declare const envelopeContextSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
75
73
|
}>>;
|
|
76
74
|
routePath: z.ZodOptional<z.ZodString>;
|
|
77
75
|
routeType: z.ZodOptional<z.ZodEnum<{
|
|
78
|
-
render: "render";
|
|
79
|
-
route: "route";
|
|
80
76
|
action: "action";
|
|
81
77
|
middleware: "middleware";
|
|
82
78
|
proxy: "proxy";
|
|
79
|
+
render: "render";
|
|
80
|
+
route: "route";
|
|
83
81
|
}>>;
|
|
84
82
|
routerKind: z.ZodOptional<z.ZodEnum<{
|
|
85
|
-
"Pages Router": "Pages Router";
|
|
86
83
|
"App Router": "App Router";
|
|
84
|
+
"Pages Router": "Pages Router";
|
|
87
85
|
}>>;
|
|
88
86
|
runtime: z.ZodLiteral<"nextjs">;
|
|
89
87
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -150,15 +148,15 @@ declare const envelopeSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
150
148
|
}>>;
|
|
151
149
|
routePath: z.ZodOptional<z.ZodString>;
|
|
152
150
|
routeType: z.ZodOptional<z.ZodEnum<{
|
|
153
|
-
render: "render";
|
|
154
|
-
route: "route";
|
|
155
151
|
action: "action";
|
|
156
152
|
middleware: "middleware";
|
|
157
153
|
proxy: "proxy";
|
|
154
|
+
render: "render";
|
|
155
|
+
route: "route";
|
|
158
156
|
}>>;
|
|
159
157
|
routerKind: z.ZodOptional<z.ZodEnum<{
|
|
160
|
-
"Pages Router": "Pages Router";
|
|
161
158
|
"App Router": "App Router";
|
|
159
|
+
"Pages Router": "Pages Router";
|
|
162
160
|
}>>;
|
|
163
161
|
runtime: z.ZodLiteral<"nextjs">;
|
|
164
162
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -173,15 +171,15 @@ declare const envelopeSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
173
171
|
releaseId: z.ZodNullable<z.ZodString>;
|
|
174
172
|
runtime: z.ZodNullable<z.ZodEnum<{
|
|
175
173
|
browser: "browser";
|
|
176
|
-
node: "node";
|
|
177
174
|
edge: "edge";
|
|
175
|
+
node: "node";
|
|
178
176
|
}>>;
|
|
179
177
|
sessionId: z.ZodNullable<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>;
|
|
180
178
|
sessionSource: z.ZodOptional<z.ZodEnum<{
|
|
181
|
-
header: "header";
|
|
182
179
|
async_context: "async_context";
|
|
183
|
-
fallback: "fallback";
|
|
184
180
|
client: "client";
|
|
181
|
+
fallback: "fallback";
|
|
182
|
+
header: "header";
|
|
185
183
|
}>>;
|
|
186
184
|
uuid: z.ZodUUID;
|
|
187
185
|
v: z.ZodUnion<readonly [z.ZodLiteral<0>]>;
|
|
@@ -201,6 +199,7 @@ declare const envelopeSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
201
199
|
lineNumber: z.ZodOptional<z.ZodNumber>;
|
|
202
200
|
columnNumber: z.ZodOptional<z.ZodNumber>;
|
|
203
201
|
source: z.ZodOptional<z.ZodString>;
|
|
202
|
+
debugId: z.ZodOptional<z.ZodString>;
|
|
204
203
|
}, z.core.$strip>>;
|
|
205
204
|
}, z.core.$strip>>;
|
|
206
205
|
}, z.core.$strip>;
|
|
@@ -249,161 +248,5 @@ type Envelope<T extends EventType | undefined = undefined> = T extends EventType
|
|
|
249
248
|
type: T;
|
|
250
249
|
}> : EnvelopeBase;
|
|
251
250
|
type EnvelopePayload<T extends EventType> = Envelope<T>["payload"];
|
|
252
|
-
declare const stampedEnvelopeSchema: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
|
|
253
|
-
buildId: z.ZodString;
|
|
254
|
-
clientTs: z.ZodInt;
|
|
255
|
-
context: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
256
|
-
runtime: z.ZodLiteral<"browser">;
|
|
257
|
-
browser: z.ZodNullable<z.ZodObject<{
|
|
258
|
-
language: z.ZodOptional<z.ZodString>;
|
|
259
|
-
timezone: z.ZodOptional<z.ZodString>;
|
|
260
|
-
display: z.ZodObject<{
|
|
261
|
-
screen: z.ZodObject<{
|
|
262
|
-
height: z.ZodNumber;
|
|
263
|
-
width: z.ZodNumber;
|
|
264
|
-
orientation: z.ZodOptional<z.ZodString>;
|
|
265
|
-
}, z.core.$strip>;
|
|
266
|
-
}, z.core.$strip>;
|
|
267
|
-
}, z.core.$strip>>;
|
|
268
|
-
device: z.ZodNullable<z.ZodObject<{
|
|
269
|
-
browser: z.ZodObject<{
|
|
270
|
-
major: z.ZodOptional<z.ZodString>;
|
|
271
|
-
name: z.ZodOptional<z.ZodString>;
|
|
272
|
-
type: z.ZodOptional<z.ZodString>;
|
|
273
|
-
version: z.ZodOptional<z.ZodString>;
|
|
274
|
-
}, z.core.$strip>;
|
|
275
|
-
cpu: z.ZodObject<{
|
|
276
|
-
architecture: z.ZodOptional<z.ZodString>;
|
|
277
|
-
}, z.core.$strip>;
|
|
278
|
-
device: z.ZodObject<{
|
|
279
|
-
model: z.ZodOptional<z.ZodString>;
|
|
280
|
-
type: z.ZodOptional<z.ZodString>;
|
|
281
|
-
vendor: z.ZodOptional<z.ZodString>;
|
|
282
|
-
}, z.core.$strip>;
|
|
283
|
-
engine: z.ZodObject<{
|
|
284
|
-
name: z.ZodOptional<z.ZodString>;
|
|
285
|
-
version: z.ZodOptional<z.ZodString>;
|
|
286
|
-
}, z.core.$strip>;
|
|
287
|
-
os: z.ZodObject<{
|
|
288
|
-
name: z.ZodOptional<z.ZodString>;
|
|
289
|
-
version: z.ZodOptional<z.ZodString>;
|
|
290
|
-
}, z.core.$strip>;
|
|
291
|
-
ua: z.ZodString;
|
|
292
|
-
}, z.core.$strip>>;
|
|
293
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
294
|
-
errorDigest: z.ZodOptional<z.ZodString>;
|
|
295
|
-
renderSource: z.ZodOptional<z.ZodEnum<{
|
|
296
|
-
"react-server-components": "react-server-components";
|
|
297
|
-
"react-server-components-payload": "react-server-components-payload";
|
|
298
|
-
"server-rendering": "server-rendering";
|
|
299
|
-
}>>;
|
|
300
|
-
renderType: z.ZodOptional<z.ZodEnum<{
|
|
301
|
-
dynamic: "dynamic";
|
|
302
|
-
"dynamic-resume": "dynamic-resume";
|
|
303
|
-
}>>;
|
|
304
|
-
requestMethod: z.ZodOptional<z.ZodString>;
|
|
305
|
-
requestPath: z.ZodOptional<z.ZodString>;
|
|
306
|
-
revalidateReason: z.ZodOptional<z.ZodEnum<{
|
|
307
|
-
"on-demand": "on-demand";
|
|
308
|
-
stale: "stale";
|
|
309
|
-
}>>;
|
|
310
|
-
routePath: z.ZodOptional<z.ZodString>;
|
|
311
|
-
routeType: z.ZodOptional<z.ZodEnum<{
|
|
312
|
-
render: "render";
|
|
313
|
-
route: "route";
|
|
314
|
-
action: "action";
|
|
315
|
-
middleware: "middleware";
|
|
316
|
-
proxy: "proxy";
|
|
317
|
-
}>>;
|
|
318
|
-
routerKind: z.ZodOptional<z.ZodEnum<{
|
|
319
|
-
"Pages Router": "Pages Router";
|
|
320
|
-
"App Router": "App Router";
|
|
321
|
-
}>>;
|
|
322
|
-
runtime: z.ZodLiteral<"nextjs">;
|
|
323
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
324
|
-
runtime: z.ZodLiteral<"edge">;
|
|
325
|
-
}, z.core.$strip>], "runtime">>;
|
|
326
|
-
environment: z.ZodNullable<z.ZodEnum<{
|
|
327
|
-
development: "development";
|
|
328
|
-
preview: "preview";
|
|
329
|
-
production: "production";
|
|
330
|
-
}>>;
|
|
331
|
-
producerVersion: z.ZodOptional<z.ZodString>;
|
|
332
|
-
releaseId: z.ZodNullable<z.ZodString>;
|
|
333
|
-
runtime: z.ZodNullable<z.ZodEnum<{
|
|
334
|
-
browser: "browser";
|
|
335
|
-
node: "node";
|
|
336
|
-
edge: "edge";
|
|
337
|
-
}>>;
|
|
338
|
-
sessionId: z.ZodNullable<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>;
|
|
339
|
-
sessionSource: z.ZodOptional<z.ZodEnum<{
|
|
340
|
-
header: "header";
|
|
341
|
-
async_context: "async_context";
|
|
342
|
-
fallback: "fallback";
|
|
343
|
-
client: "client";
|
|
344
|
-
}>>;
|
|
345
|
-
uuid: z.ZodUUID;
|
|
346
|
-
v: z.ZodUnion<readonly [z.ZodLiteral<0>]>;
|
|
347
|
-
}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
348
|
-
payload: z.ZodObject<{
|
|
349
|
-
exceptions: z.ZodArray<z.ZodObject<{
|
|
350
|
-
type: z.ZodString;
|
|
351
|
-
value: z.ZodString;
|
|
352
|
-
mechanism: z.ZodOptional<z.ZodObject<{
|
|
353
|
-
type: z.ZodString;
|
|
354
|
-
handled: z.ZodBoolean;
|
|
355
|
-
synthetic: z.ZodOptional<z.ZodBoolean>;
|
|
356
|
-
}, z.core.$strip>>;
|
|
357
|
-
frames: z.ZodArray<z.ZodObject<{
|
|
358
|
-
fileName: z.ZodOptional<z.ZodString>;
|
|
359
|
-
functionName: z.ZodOptional<z.ZodString>;
|
|
360
|
-
lineNumber: z.ZodOptional<z.ZodNumber>;
|
|
361
|
-
columnNumber: z.ZodOptional<z.ZodNumber>;
|
|
362
|
-
source: z.ZodOptional<z.ZodString>;
|
|
363
|
-
}, z.core.$strip>>;
|
|
364
|
-
}, z.core.$strip>>;
|
|
365
|
-
}, z.core.$strip>;
|
|
366
|
-
type: z.ZodLiteral<"error">;
|
|
367
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
368
|
-
payload: z.ZodObject<{
|
|
369
|
-
url: z.ZodString;
|
|
370
|
-
title: z.ZodOptional<z.ZodString>;
|
|
371
|
-
}, z.core.$strip>;
|
|
372
|
-
type: z.ZodLiteral<"pageview">;
|
|
373
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
374
|
-
payload: z.ZodObject<{
|
|
375
|
-
url: z.ZodString;
|
|
376
|
-
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
377
|
-
}, z.core.$strip>;
|
|
378
|
-
type: z.ZodLiteral<"pageleave">;
|
|
379
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
380
|
-
payload: z.ZodObject<{
|
|
381
|
-
event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
382
|
-
}, z.core.$strip>;
|
|
383
|
-
type: z.ZodLiteral<"ui_event">;
|
|
384
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
385
|
-
payload: z.ZodObject<{
|
|
386
|
-
ts: z.ZodNumber;
|
|
387
|
-
count: z.ZodNumber;
|
|
388
|
-
events: z.ZodArray<z.ZodString>;
|
|
389
|
-
first_event_ts: z.ZodOptional<z.ZodNumber>;
|
|
390
|
-
last_event_ts: z.ZodOptional<z.ZodNumber>;
|
|
391
|
-
}, z.core.$strip>;
|
|
392
|
-
type: z.ZodLiteral<"replay_chunk">;
|
|
393
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
394
|
-
payload: z.ZodObject<{
|
|
395
|
-
count: z.ZodNumber;
|
|
396
|
-
timeWindow: z.ZodNumber;
|
|
397
|
-
selector: z.ZodString;
|
|
398
|
-
text: z.ZodString;
|
|
399
|
-
x: z.ZodNumber;
|
|
400
|
-
y: z.ZodNumber;
|
|
401
|
-
timestamp: z.ZodNumber;
|
|
402
|
-
}, z.core.$strip>;
|
|
403
|
-
type: z.ZodLiteral<"rage_click">;
|
|
404
|
-
}, z.core.$strip>], "type">>, z.ZodObject<{
|
|
405
|
-
surfaceSlug: z.ZodString;
|
|
406
|
-
}, z.core.$strip>>;
|
|
407
|
-
type StampedEnvelope = z.infer<typeof stampedEnvelopeSchema>;
|
|
408
251
|
//#endregion
|
|
409
|
-
export { Envelope, EnvelopeContext, EnvelopePayload,
|
|
252
|
+
export { Envelope, EnvelopeContext, EnvelopePayload, EventType, SessionSource, envelopeContextSchema, envelopeSchema, sessionSourceSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelope.d.mts","names":[],"sources":["../../src/sdk/envelope.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"envelope.d.mts","names":[],"sources":["../../src/sdk/envelope.ts"],"mappings":";;;;;AA0BA;;;;;;cAAa,mBAAA,EAAmB,CAAA,CAAA,WAAA,CAAA,CAAA,CAAA,OAAA;;;;;;KAIpB,aAAA,GAAgB,CAAA,CAAE,KAAA,QAAa,mBAAA;AAAA,cAE9B,qBAAA,EAAqB,CAAA,CAAA,qBAAA,EAAA,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAMtB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;AAAA,cAgBhC,cAAA,EAAc,CAAA,CAAA,eAAA,CAAA,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6BtB,YAAA,GAAe,CAAA,CAAE,KAAA,QAAa,cAAA;AAAA,KAEvB,SAAA,GAAY,YAAA;AAAA,KAEZ,QAAA,WAAmB,SAAA,4BAC7B,CAAA,SAAU,SAAA,GAAY,OAAA,CAAQ,YAAA;EAAgB,IAAA,EAAM,CAAA;AAAA,KAAO,YAAA;AAAA,KAEjD,eAAA,WAA0B,SAAA,IAAa,QAAA,CAAS,CAAA"}
|
package/dist/sdk/envelope.mjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { z } from "zod
|
|
2
|
-
import { errorEnvelopePayloadSchema } from "#sdk/plugins/payload/errors";
|
|
3
|
-
import { pageleavePayloadSchema, pageviewPayloadSchema, uiEventPayloadSchema } from "#sdk/plugins/payload/page-events";
|
|
4
|
-
import { rageClickPayloadSchema } from "#sdk/plugins/payload/rage-click";
|
|
5
|
-
import { envSchema, runtimeSchema } from "#sdk/runtime";
|
|
1
|
+
import { z } from "zod";
|
|
6
2
|
import { sessionIdSchema } from "#data/session";
|
|
7
|
-
import { surfaceSlugSchema } from "#data/surface";
|
|
8
3
|
import { browserContextSchema } from "#sdk/plugins/context/browser";
|
|
9
4
|
import { edgeContextSchema } from "#sdk/plugins/context/edge";
|
|
10
5
|
import { nextjsContextSchema } from "#sdk/plugins/context/next";
|
|
6
|
+
import { errorEnvelopePayloadSchema } from "#sdk/plugins/payload/errors";
|
|
7
|
+
import { pageleavePayloadSchema, pageviewPayloadSchema, uiEventPayloadSchema } from "#sdk/plugins/payload/page-events";
|
|
8
|
+
import { rageClickPayloadSchema } from "#sdk/plugins/payload/rage-click";
|
|
11
9
|
import { replayChunkPayloadSchema } from "#sdk/plugins/payload/replay";
|
|
10
|
+
import { envSchema, runtimeSchema } from "#sdk/runtime";
|
|
12
11
|
//#region src/sdk/envelope.ts
|
|
13
12
|
const envelopeVersion = z.union([z.literal(0)]);
|
|
14
13
|
/**
|
|
@@ -68,6 +67,5 @@ const envelopeSchema = z.object({
|
|
|
68
67
|
type: z.literal("rage_click")
|
|
69
68
|
})
|
|
70
69
|
]));
|
|
71
|
-
const stampedEnvelopeSchema = z.intersection(envelopeSchema, z.object({ surfaceSlug: surfaceSlugSchema }));
|
|
72
70
|
//#endregion
|
|
73
|
-
export { envelopeContextSchema, envelopeSchema, sessionSourceSchema
|
|
71
|
+
export { envelopeContextSchema, envelopeSchema, sessionSourceSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelope.mjs","names":[],"sources":["../../src/sdk/envelope.ts"],"sourcesContent":["import { z } from \"zod
|
|
1
|
+
{"version":3,"file":"envelope.mjs","names":[],"sources":["../../src/sdk/envelope.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { sessionIdSchema } from \"#data/session\";\nimport { browserContextSchema } from \"#sdk/plugins/context/browser\";\nimport { edgeContextSchema } from \"#sdk/plugins/context/edge\";\nimport { nextjsContextSchema } from \"#sdk/plugins/context/next\";\nimport { errorEnvelopePayloadSchema } from \"#sdk/plugins/payload/errors\";\nimport {\n pageleavePayloadSchema,\n pageviewPayloadSchema,\n uiEventPayloadSchema,\n} from \"#sdk/plugins/payload/page-events\";\nimport { rageClickPayloadSchema } from \"#sdk/plugins/payload/rage-click\";\nimport { replayChunkPayloadSchema } from \"#sdk/plugins/payload/replay\";\nimport { envSchema, runtimeSchema } from \"#sdk/runtime\";\n\nconst envelopeVersion = z.union([z.literal(0)]);\n\n/**\n * Indicates how the sessionId was resolved on the server.\n *\n * - \"header\": Extracted from x-interfere-request header (ideal case)\n * - \"async_context\": Retrieved from AsyncLocalStorage context\n * - \"fallback\": Generated as server-side fallback (breaks session continuity)\n * - \"client\": Session ID was set on the client (browser SDK)\n */\nexport const sessionSourceSchema = z\n .enum([\"header\", \"async_context\", \"fallback\", \"client\"])\n .optional();\n\nexport type SessionSource = z.infer<typeof sessionSourceSchema>;\n\nexport const envelopeContextSchema = z.discriminatedUnion(\"runtime\", [\n browserContextSchema,\n nextjsContextSchema,\n edgeContextSchema,\n]);\n\nexport type EnvelopeContext = z.infer<typeof envelopeContextSchema>;\n\nconst envelopeHeadersSchema = z.object({\n buildId: z.string(),\n clientTs: z.int(),\n context: envelopeContextSchema.optional(),\n environment: envSchema,\n producerVersion: z.string().optional(),\n releaseId: z.string().nullable(),\n runtime: runtimeSchema,\n sessionId: sessionIdSchema.nullable(),\n sessionSource: sessionSourceSchema,\n uuid: z.uuidv7(),\n v: envelopeVersion,\n});\n\nexport const envelopeSchema = envelopeHeadersSchema.and(\n z.discriminatedUnion(\"type\", [\n z.object({\n payload: errorEnvelopePayloadSchema,\n type: z.literal(\"error\"),\n }),\n z.object({\n payload: pageviewPayloadSchema,\n type: z.literal(\"pageview\"),\n }),\n z.object({\n payload: pageleavePayloadSchema,\n type: z.literal(\"pageleave\"),\n }),\n z.object({\n payload: uiEventPayloadSchema,\n type: z.literal(\"ui_event\"),\n }),\n z.object({\n payload: replayChunkPayloadSchema,\n type: z.literal(\"replay_chunk\"),\n }),\n z.object({\n payload: rageClickPayloadSchema,\n type: z.literal(\"rage_click\"),\n }),\n ])\n);\n\ntype EnvelopeBase = z.infer<typeof envelopeSchema>;\n\nexport type EventType = EnvelopeBase[\"type\"];\n\nexport type Envelope<T extends EventType | undefined = undefined> =\n T extends EventType ? Extract<EnvelopeBase, { type: T }> : EnvelopeBase;\n\nexport type EnvelopePayload<T extends EventType> = Envelope<T>[\"payload\"];\n"],"mappings":";;;;;;;;;;;AAgBA,MAAM,kBAAkB,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;;;;;;;;;AAU/C,MAAa,sBAAsB,EAChC,KAAK;CAAC;CAAU;CAAiB;CAAY;CAAS,CAAC,CACvD,UAAU;AAIb,MAAa,wBAAwB,EAAE,mBAAmB,WAAW;CACnE;CACA;CACA;CACD,CAAC;AAkBF,MAAa,iBAdiB,EAAE,OAAO;CACrC,SAAS,EAAE,QAAQ;CACnB,UAAU,EAAE,KAAK;CACjB,SAAS,sBAAsB,UAAU;CACzC,aAAa;CACb,iBAAiB,EAAE,QAAQ,CAAC,UAAU;CACtC,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,SAAS;CACT,WAAW,gBAAgB,UAAU;CACrC,eAAe;CACf,MAAM,EAAE,QAAQ;CAChB,GAAG;CACJ,CAAC,CAEkD,IAClD,EAAE,mBAAmB,QAAQ;CAC3B,EAAE,OAAO;EACP,SAAS;EACT,MAAM,EAAE,QAAQ,QAAQ;EACzB,CAAC;CACF,EAAE,OAAO;EACP,SAAS;EACT,MAAM,EAAE,QAAQ,WAAW;EAC5B,CAAC;CACF,EAAE,OAAO;EACP,SAAS;EACT,MAAM,EAAE,QAAQ,YAAY;EAC7B,CAAC;CACF,EAAE,OAAO;EACP,SAAS;EACT,MAAM,EAAE,QAAQ,WAAW;EAC5B,CAAC;CACF,EAAE,OAAO;EACP,SAAS;EACT,MAAM,EAAE,QAAQ,eAAe;EAChC,CAAC;CACF,EAAE,OAAO;EACP,SAAS;EACT,MAAM,EAAE,QAAQ,aAAa;EAC9B,CAAC;CACH,CAAC,CACH"}
|
package/dist/sdk/errors.d.mts
CHANGED
|
@@ -3,5 +3,6 @@ import { ErrorMechanism, ExceptionValue } from "#sdk/plugins/payload/errors";
|
|
|
3
3
|
//#region src/sdk/errors.d.ts
|
|
4
4
|
declare function toError(error: unknown): Error;
|
|
5
5
|
declare function toExceptions(error: Error, mechanism: ErrorMechanism): ExceptionValue[];
|
|
6
|
+
declare function extractFilenameFromStack(stack: string): string | null;
|
|
6
7
|
//#endregion
|
|
7
|
-
export { toError, toExceptions };
|
|
8
|
+
export { extractFilenameFromStack, toError, toExceptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.mts","names":[],"sources":["../../src/sdk/errors.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"errors.d.mts","names":[],"sources":["../../src/sdk/errors.ts"],"mappings":";;;iBAegB,OAAA,CAAQ,KAAA,YAAiB,KAAA;AAAA,iBAYzB,YAAA,CACd,KAAA,EAAO,KAAA,EACP,SAAA,EAAW,cAAA,GACV,cAAA;AAAA,iBAwDa,wBAAA,CAAyB,KAAA"}
|
package/dist/sdk/errors.mjs
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { parse } from "error-stack-parser-es";
|
|
2
2
|
//#region src/sdk/errors.ts
|
|
3
3
|
const MAX_CAUSE_DEPTH = 5;
|
|
4
|
+
const PAREN_FILE_RE = /\((.+?)(?::\d+){1,2}\)/;
|
|
5
|
+
const AT_FILE_RE = /at\s+(.+?)(?::\d+){1,2}$/;
|
|
6
|
+
const SPIDERMONKEY_RE = /(?:^|@)((?:https?:\/\/|\/).+?)(?::\d+){1,2}$/;
|
|
7
|
+
const BARE_FILE_RE = /(?:^|@)(.+?)(?::\d+){1,2}$/;
|
|
4
8
|
function toError(error) {
|
|
5
9
|
if (error instanceof Error) return error;
|
|
6
10
|
if (typeof error === "string") return new Error(error);
|
|
7
11
|
return new Error(String(error));
|
|
8
12
|
}
|
|
9
13
|
function toExceptions(error, mechanism) {
|
|
14
|
+
const debugIdMap = getDebugIdMap();
|
|
10
15
|
const exceptions = [];
|
|
11
16
|
let current = error;
|
|
12
17
|
for (let depth = 0; current && depth < MAX_CAUSE_DEPTH; depth += 1) {
|
|
@@ -14,20 +19,50 @@ function toExceptions(error, mechanism) {
|
|
|
14
19
|
type: current.name,
|
|
15
20
|
value: current.message,
|
|
16
21
|
mechanism: depth === 0 ? mechanism : void 0,
|
|
17
|
-
frames: parse(current, { allowEmpty: true }).map(normalizeFrame)
|
|
22
|
+
frames: parse(current, { allowEmpty: true }).map((frame) => normalizeFrame(frame, debugIdMap))
|
|
18
23
|
});
|
|
19
24
|
current = current.cause instanceof Error ? current.cause : void 0;
|
|
20
25
|
}
|
|
21
26
|
return exceptions;
|
|
22
27
|
}
|
|
23
|
-
|
|
28
|
+
let cachedDebugIdMap;
|
|
29
|
+
let cachedDebugIdCount = 0;
|
|
30
|
+
function getDebugIdMap() {
|
|
31
|
+
const registry = globalThis["_debugIds"];
|
|
32
|
+
if (!registry) return /* @__PURE__ */ new Map();
|
|
33
|
+
const entries = Object.keys(registry);
|
|
34
|
+
if (cachedDebugIdMap && entries.length === cachedDebugIdCount) return cachedDebugIdMap;
|
|
35
|
+
const map = /* @__PURE__ */ new Map();
|
|
36
|
+
for (const stackKey of entries) {
|
|
37
|
+
const debugId = registry[stackKey];
|
|
38
|
+
if (!debugId) continue;
|
|
39
|
+
const filename = extractFilenameFromStack(stackKey);
|
|
40
|
+
if (filename) map.set(filename, debugId);
|
|
41
|
+
}
|
|
42
|
+
cachedDebugIdMap = map;
|
|
43
|
+
cachedDebugIdCount = entries.length;
|
|
44
|
+
return map;
|
|
45
|
+
}
|
|
46
|
+
function extractFilenameFromStack(stack) {
|
|
47
|
+
const lines = stack.split("\n");
|
|
48
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
49
|
+
const line = lines[i];
|
|
50
|
+
if (!line) continue;
|
|
51
|
+
const match = line.match(PAREN_FILE_RE) ?? line.match(AT_FILE_RE) ?? line.match(SPIDERMONKEY_RE) ?? line.match(BARE_FILE_RE);
|
|
52
|
+
if (match?.[1]) return match[1].trim();
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
function normalizeFrame(frame, debugIdMap) {
|
|
57
|
+
const fileName = typeof frame.fileName === "string" ? frame.fileName : void 0;
|
|
24
58
|
return {
|
|
25
|
-
fileName
|
|
59
|
+
fileName,
|
|
26
60
|
functionName: typeof frame.functionName === "string" ? frame.functionName : void 0,
|
|
27
61
|
lineNumber: typeof frame.lineNumber === "number" ? frame.lineNumber : void 0,
|
|
28
62
|
columnNumber: typeof frame.columnNumber === "number" ? frame.columnNumber : void 0,
|
|
29
|
-
source: typeof frame.source === "string" ? frame.source : void 0
|
|
63
|
+
source: typeof frame.source === "string" ? frame.source : void 0,
|
|
64
|
+
debugId: fileName ? debugIdMap.get(fileName) : void 0
|
|
30
65
|
};
|
|
31
66
|
}
|
|
32
67
|
//#endregion
|
|
33
|
-
export { toError, toExceptions };
|
|
68
|
+
export { extractFilenameFromStack, toError, toExceptions };
|
package/dist/sdk/errors.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.mjs","names":[],"sources":["../../src/sdk/errors.ts"],"sourcesContent":["import { parse } from \"error-stack-parser-es\";\n\nimport type { IngestedFrame } from \"#data/frame\";\nimport type {\n ErrorMechanism,\n ExceptionValue,\n} from \"#sdk/plugins/payload/errors\";\n\nconst MAX_CAUSE_DEPTH = 5;\n\nexport function toError(error: unknown): Error {\n if (error instanceof Error) {\n return error;\n }\n\n if (typeof error === \"string\") {\n return new Error(error);\n }\n\n return new Error(String(error));\n}\n\nexport function toExceptions(\n error: Error,\n mechanism: ErrorMechanism\n): ExceptionValue[] {\n const exceptions: ExceptionValue[] = [];\n let current: Error | undefined = error;\n\n for (let depth = 0; current && depth < MAX_CAUSE_DEPTH; depth += 1) {\n exceptions.push({\n type: current.name,\n value: current.message,\n mechanism: depth === 0 ? mechanism : undefined,\n frames: parse(current, { allowEmpty: true }).map(normalizeFrame),\n });\n\n current = current.cause instanceof Error ? current.cause : undefined;\n }\n\n return exceptions;\n}\n\nfunction normalizeFrame(frame: {\n
|
|
1
|
+
{"version":3,"file":"errors.mjs","names":[],"sources":["../../src/sdk/errors.ts"],"sourcesContent":["import { parse } from \"error-stack-parser-es\";\n\nimport type { IngestedFrame } from \"#data/frame\";\nimport type {\n ErrorMechanism,\n ExceptionValue,\n} from \"#sdk/plugins/payload/errors\";\n\nconst MAX_CAUSE_DEPTH = 5;\n\nconst PAREN_FILE_RE = /\\((.+?)(?::\\d+){1,2}\\)/;\nconst AT_FILE_RE = /at\\s+(.+?)(?::\\d+){1,2}$/;\nconst SPIDERMONKEY_RE = /(?:^|@)((?:https?:\\/\\/|\\/).+?)(?::\\d+){1,2}$/;\nconst BARE_FILE_RE = /(?:^|@)(.+?)(?::\\d+){1,2}$/;\n\nexport function toError(error: unknown): Error {\n if (error instanceof Error) {\n return error;\n }\n\n if (typeof error === \"string\") {\n return new Error(error);\n }\n\n return new Error(String(error));\n}\n\nexport function toExceptions(\n error: Error,\n mechanism: ErrorMechanism\n): ExceptionValue[] {\n const debugIdMap = getDebugIdMap();\n const exceptions: ExceptionValue[] = [];\n let current: Error | undefined = error;\n\n for (let depth = 0; current && depth < MAX_CAUSE_DEPTH; depth += 1) {\n exceptions.push({\n type: current.name,\n value: current.message,\n mechanism: depth === 0 ? mechanism : undefined,\n frames: parse(current, { allowEmpty: true }).map((frame) =>\n normalizeFrame(frame, debugIdMap)\n ),\n });\n\n current = current.cause instanceof Error ? current.cause : undefined;\n }\n\n return exceptions;\n}\n\nlet cachedDebugIdMap: Map<string, string> | undefined;\nlet cachedDebugIdCount = 0;\n\nfunction getDebugIdMap(): Map<string, string> {\n const registry = (globalThis as Record<string, unknown>)[\"_debugIds\"] as\n | Record<string, string>\n | undefined;\n\n if (!registry) {\n return new Map();\n }\n\n const entries = Object.keys(registry);\n if (cachedDebugIdMap && entries.length === cachedDebugIdCount) {\n return cachedDebugIdMap;\n }\n\n const map = new Map<string, string>();\n for (const stackKey of entries) {\n const debugId = registry[stackKey];\n if (!debugId) {\n continue;\n }\n\n const filename = extractFilenameFromStack(stackKey);\n if (filename) {\n map.set(filename, debugId);\n }\n }\n\n cachedDebugIdMap = map;\n cachedDebugIdCount = entries.length;\n return map;\n}\n\nexport function extractFilenameFromStack(stack: string): string | null {\n const lines = stack.split(\"\\n\");\n for (let i = lines.length - 1; i >= 0; i--) {\n const line = lines[i];\n if (!line) {\n continue;\n }\n const match =\n line.match(PAREN_FILE_RE) ??\n line.match(AT_FILE_RE) ??\n line.match(SPIDERMONKEY_RE) ??\n line.match(BARE_FILE_RE);\n\n if (match?.[1]) {\n return match[1].trim();\n }\n }\n return null;\n}\n\nfunction normalizeFrame(\n frame: {\n fileName?: unknown;\n functionName?: unknown;\n lineNumber?: unknown;\n columnNumber?: unknown;\n source?: unknown;\n },\n debugIdMap: Map<string, string>\n): IngestedFrame {\n const fileName =\n typeof frame.fileName === \"string\" ? frame.fileName : undefined;\n\n return {\n fileName,\n functionName:\n typeof frame.functionName === \"string\" ? frame.functionName : undefined,\n lineNumber:\n typeof frame.lineNumber === \"number\" ? frame.lineNumber : undefined,\n columnNumber:\n typeof frame.columnNumber === \"number\" ? frame.columnNumber : undefined,\n source: typeof frame.source === \"string\" ? frame.source : undefined,\n debugId: fileName ? debugIdMap.get(fileName) : undefined,\n };\n}\n"],"mappings":";;AAQA,MAAM,kBAAkB;AAExB,MAAM,gBAAgB;AACtB,MAAM,aAAa;AACnB,MAAM,kBAAkB;AACxB,MAAM,eAAe;AAErB,SAAgB,QAAQ,OAAuB;AAC7C,KAAI,iBAAiB,MACnB,QAAO;AAGT,KAAI,OAAO,UAAU,SACnB,QAAO,IAAI,MAAM,MAAM;AAGzB,QAAO,IAAI,MAAM,OAAO,MAAM,CAAC;;AAGjC,SAAgB,aACd,OACA,WACkB;CAClB,MAAM,aAAa,eAAe;CAClC,MAAM,aAA+B,EAAE;CACvC,IAAI,UAA6B;AAEjC,MAAK,IAAI,QAAQ,GAAG,WAAW,QAAQ,iBAAiB,SAAS,GAAG;AAClE,aAAW,KAAK;GACd,MAAM,QAAQ;GACd,OAAO,QAAQ;GACf,WAAW,UAAU,IAAI,YAAY,KAAA;GACrC,QAAQ,MAAM,SAAS,EAAE,YAAY,MAAM,CAAC,CAAC,KAAK,UAChD,eAAe,OAAO,WAAW,CAClC;GACF,CAAC;AAEF,YAAU,QAAQ,iBAAiB,QAAQ,QAAQ,QAAQ,KAAA;;AAG7D,QAAO;;AAGT,IAAI;AACJ,IAAI,qBAAqB;AAEzB,SAAS,gBAAqC;CAC5C,MAAM,WAAY,WAAuC;AAIzD,KAAI,CAAC,SACH,wBAAO,IAAI,KAAK;CAGlB,MAAM,UAAU,OAAO,KAAK,SAAS;AACrC,KAAI,oBAAoB,QAAQ,WAAW,mBACzC,QAAO;CAGT,MAAM,sBAAM,IAAI,KAAqB;AACrC,MAAK,MAAM,YAAY,SAAS;EAC9B,MAAM,UAAU,SAAS;AACzB,MAAI,CAAC,QACH;EAGF,MAAM,WAAW,yBAAyB,SAAS;AACnD,MAAI,SACF,KAAI,IAAI,UAAU,QAAQ;;AAI9B,oBAAmB;AACnB,sBAAqB,QAAQ;AAC7B,QAAO;;AAGT,SAAgB,yBAAyB,OAA8B;CACrE,MAAM,QAAQ,MAAM,MAAM,KAAK;AAC/B,MAAK,IAAI,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK;EAC1C,MAAM,OAAO,MAAM;AACnB,MAAI,CAAC,KACH;EAEF,MAAM,QACJ,KAAK,MAAM,cAAc,IACzB,KAAK,MAAM,WAAW,IACtB,KAAK,MAAM,gBAAgB,IAC3B,KAAK,MAAM,aAAa;AAE1B,MAAI,QAAQ,GACV,QAAO,MAAM,GAAG,MAAM;;AAG1B,QAAO;;AAGT,SAAS,eACP,OAOA,YACe;CACf,MAAM,WACJ,OAAO,MAAM,aAAa,WAAW,MAAM,WAAW,KAAA;AAExD,QAAO;EACL;EACA,cACE,OAAO,MAAM,iBAAiB,WAAW,MAAM,eAAe,KAAA;EAChE,YACE,OAAO,MAAM,eAAe,WAAW,MAAM,aAAa,KAAA;EAC5D,cACE,OAAO,MAAM,iBAAiB,WAAW,MAAM,eAAe,KAAA;EAChE,QAAQ,OAAO,MAAM,WAAW,WAAW,MAAM,SAAS,KAAA;EAC1D,SAAS,WAAW,WAAW,IAAI,SAAS,GAAG,KAAA;EAChD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/sdk/geo.d.ts
|
|
4
|
+
declare const cloudflareTraceSchema: z.ZodObject<{
|
|
5
|
+
loc: z.ZodString;
|
|
6
|
+
}, z.core.$loose>;
|
|
7
|
+
type CloudflareTrace = z.infer<typeof cloudflareTraceSchema>;
|
|
8
|
+
declare function extractCountryHeader(request: Request): string | null;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { CloudflareTrace, cloudflareTraceSchema, extractCountryHeader };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geo.d.mts","names":[],"sources":["../../src/sdk/geo.ts"],"mappings":";;;cAEa,qBAAA,EAAqB,CAAA,CAAA,SAAA;;;KAItB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;AAAA,iBAQ7B,oBAAA,CAAqB,OAAA,EAAS,OAAA"}
|
package/dist/sdk/geo.mjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/sdk/geo.ts
|
|
3
|
+
const cloudflareTraceSchema = z.object({ loc: z.string().length(2) }).passthrough();
|
|
4
|
+
const GEO_COUNTRY_HEADERS = [
|
|
5
|
+
"cf-ipcountry",
|
|
6
|
+
"x-vercel-ip-country",
|
|
7
|
+
"x-country-code"
|
|
8
|
+
];
|
|
9
|
+
function extractCountryHeader(request) {
|
|
10
|
+
for (const header of GEO_COUNTRY_HEADERS) {
|
|
11
|
+
const value = request.headers.get(header);
|
|
12
|
+
if (value && value.length === 2) return value.toUpperCase();
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { cloudflareTraceSchema, extractCountryHeader };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geo.mjs","names":[],"sources":["../../src/sdk/geo.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const cloudflareTraceSchema = z\n .object({ loc: z.string().length(2) })\n .passthrough();\n\nexport type CloudflareTrace = z.infer<typeof cloudflareTraceSchema>;\n\nconst GEO_COUNTRY_HEADERS = [\n \"cf-ipcountry\",\n \"x-vercel-ip-country\",\n \"x-country-code\",\n] as const;\n\nexport function extractCountryHeader(request: Request): string | null {\n for (const header of GEO_COUNTRY_HEADERS) {\n const value = request.headers.get(header);\n if (value && value.length === 2) {\n return value.toUpperCase();\n }\n }\n return null;\n}\n"],"mappings":";;AAEA,MAAa,wBAAwB,EAClC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CACrC,aAAa;AAIhB,MAAM,sBAAsB;CAC1B;CACA;CACA;CACD;AAED,SAAgB,qBAAqB,SAAiC;AACpE,MAAK,MAAM,UAAU,qBAAqB;EACxC,MAAM,QAAQ,QAAQ,QAAQ,IAAI,OAAO;AACzC,MAAI,SAAS,MAAM,WAAW,EAC5B,QAAO,MAAM,aAAa;;AAG9B,QAAO"}
|
package/dist/sdk/identify.d.mts
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
|
-
import { z } from "zod
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
|
|
3
3
|
//#region src/sdk/identify.d.ts
|
|
4
|
+
declare const identifySourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5
|
+
type: z.ZodLiteral<"clerk">;
|
|
6
|
+
name: z.ZodLiteral<"Clerk">;
|
|
7
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
8
|
+
type: z.ZodLiteral<"auth0">;
|
|
9
|
+
name: z.ZodLiteral<"Auth0">;
|
|
10
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
11
|
+
type: z.ZodLiteral<"custom">;
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
}, z.core.$strip>], "type">;
|
|
14
|
+
type IdentifySource = z.infer<typeof identifySourceSchema>;
|
|
4
15
|
declare const identifyParamsSchema: z.ZodObject<{
|
|
5
16
|
avatar: z.ZodOptional<z.ZodString>;
|
|
6
17
|
email: z.ZodOptional<z.ZodString>;
|
|
7
18
|
identifier: z.ZodString;
|
|
8
19
|
name: z.ZodOptional<z.ZodString>;
|
|
20
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
21
|
+
type: z.ZodLiteral<"clerk">;
|
|
22
|
+
name: z.ZodLiteral<"Clerk">;
|
|
23
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
24
|
+
type: z.ZodLiteral<"auth0">;
|
|
25
|
+
name: z.ZodLiteral<"Auth0">;
|
|
26
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
27
|
+
type: z.ZodLiteral<"custom">;
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
}, z.core.$strip>], "type">;
|
|
9
30
|
traits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
10
31
|
}, z.core.$strip>;
|
|
11
32
|
type IdentifyParams = z.infer<typeof identifyParamsSchema>;
|
|
12
33
|
//#endregion
|
|
13
|
-
export { IdentifyParams, identifyParamsSchema };
|
|
34
|
+
export { IdentifyParams, IdentifySource, identifyParamsSchema, identifySourceSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identify.d.mts","names":[],"sources":["../../src/sdk/identify.ts"],"mappings":";;;cAEa,oBAAA,EAAoB,CAAA,CAAA,SAAA
|
|
1
|
+
{"version":3,"file":"identify.d.mts","names":[],"sources":["../../src/sdk/identify.ts"],"mappings":";;;cAEa,oBAAA,EAAoB,CAAA,CAAA,qBAAA,EAAA,CAAA,CAAA,SAAA;;;;;;;;;;KAMrB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA;AAAA,cAE/B,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;KASrB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA"}
|
package/dist/sdk/identify.mjs
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
|
-
import { z } from "zod
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
//#region src/sdk/identify.ts
|
|
3
|
+
const identifySourceSchema = z.discriminatedUnion("type", [
|
|
4
|
+
z.object({
|
|
5
|
+
type: z.literal("clerk"),
|
|
6
|
+
name: z.literal("Clerk")
|
|
7
|
+
}),
|
|
8
|
+
z.object({
|
|
9
|
+
type: z.literal("auth0"),
|
|
10
|
+
name: z.literal("Auth0")
|
|
11
|
+
}),
|
|
12
|
+
z.object({
|
|
13
|
+
type: z.literal("custom"),
|
|
14
|
+
name: z.string()
|
|
15
|
+
})
|
|
16
|
+
]);
|
|
3
17
|
const identifyParamsSchema = z.object({
|
|
4
18
|
avatar: z.string().optional(),
|
|
5
19
|
email: z.string().optional(),
|
|
6
20
|
identifier: z.string(),
|
|
7
21
|
name: z.string().optional(),
|
|
22
|
+
source: identifySourceSchema,
|
|
8
23
|
traits: z.record(z.string(), z.unknown()).optional()
|
|
9
24
|
});
|
|
10
25
|
//#endregion
|
|
11
|
-
export { identifyParamsSchema };
|
|
26
|
+
export { identifyParamsSchema, identifySourceSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identify.mjs","names":[],"sources":["../../src/sdk/identify.ts"],"sourcesContent":["import { z } from \"zod
|
|
1
|
+
{"version":3,"file":"identify.mjs","names":[],"sources":["../../src/sdk/identify.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const identifySourceSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"clerk\"), name: z.literal(\"Clerk\") }),\n z.object({ type: z.literal(\"auth0\"), name: z.literal(\"Auth0\") }),\n z.object({ type: z.literal(\"custom\"), name: z.string() }),\n]);\n\nexport type IdentifySource = z.infer<typeof identifySourceSchema>;\n\nexport const identifyParamsSchema = z.object({\n avatar: z.string().optional(),\n email: z.string().optional(),\n identifier: z.string(),\n name: z.string().optional(),\n source: identifySourceSchema,\n traits: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport type IdentifyParams = z.infer<typeof identifyParamsSchema>;\n"],"mappings":";;AAEA,MAAa,uBAAuB,EAAE,mBAAmB,QAAQ;CAC/D,EAAE,OAAO;EAAE,MAAM,EAAE,QAAQ,QAAQ;EAAE,MAAM,EAAE,QAAQ,QAAQ;EAAE,CAAC;CAChE,EAAE,OAAO;EAAE,MAAM,EAAE,QAAQ,QAAQ;EAAE,MAAM,EAAE,QAAQ,QAAQ;EAAE,CAAC;CAChE,EAAE,OAAO;EAAE,MAAM,EAAE,QAAQ,SAAS;EAAE,MAAM,EAAE,QAAQ;EAAE,CAAC;CAC1D,CAAC;AAIF,MAAa,uBAAuB,EAAE,OAAO;CAC3C,QAAQ,EAAE,QAAQ,CAAC,UAAU;CAC7B,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,YAAY,EAAE,QAAQ;CACtB,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,QAAQ;CACR,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC,UAAU;CACrD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.mjs","names":[],"sources":["../../../../src/sdk/plugins/context/browser.ts"],"sourcesContent":["import { z } from \"zod
|
|
1
|
+
{"version":3,"file":"browser.mjs","names":[],"sources":["../../../../src/sdk/plugins/context/browser.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const deviceMetadataSchema = z.object({\n browser: z.object({\n major: z.string().optional(),\n name: z.string().optional(),\n type: z.string().optional(),\n version: z.string().optional(),\n }),\n cpu: z.object({\n architecture: z.string().optional(),\n }),\n device: z.object({\n model: z.string().optional(),\n type: z.string().optional(),\n vendor: z.string().optional(),\n }),\n engine: z.object({\n name: z.string().optional(),\n version: z.string().optional(),\n }),\n os: z.object({\n name: z.string().optional(),\n version: z.string().optional(),\n }),\n ua: z.string(),\n});\n\nexport type DeviceMetadata = z.infer<typeof deviceMetadataSchema>;\n\nconst browserMetadataSchema = z.object({\n language: z.string().optional(),\n timezone: z.string().optional(),\n display: z.object({\n screen: z.object({\n height: z.number(),\n width: z.number(),\n orientation: z.string().optional(),\n }),\n }),\n});\n\nexport type BrowserMetadata = z.infer<typeof browserMetadataSchema>;\n\nexport const browserContextSchema = z.object({\n runtime: z.literal(\"browser\"),\n browser: browserMetadataSchema.nullable(),\n device: deviceMetadataSchema.nullable(),\n});\n\nexport type BrowserContext = z.infer<typeof browserContextSchema>;\n"],"mappings":";;AAEA,MAAa,uBAAuB,EAAE,OAAO;CAC3C,SAAS,EAAE,OAAO;EAChB,OAAO,EAAE,QAAQ,CAAC,UAAU;EAC5B,MAAM,EAAE,QAAQ,CAAC,UAAU;EAC3B,MAAM,EAAE,QAAQ,CAAC,UAAU;EAC3B,SAAS,EAAE,QAAQ,CAAC,UAAU;EAC/B,CAAC;CACF,KAAK,EAAE,OAAO,EACZ,cAAc,EAAE,QAAQ,CAAC,UAAU,EACpC,CAAC;CACF,QAAQ,EAAE,OAAO;EACf,OAAO,EAAE,QAAQ,CAAC,UAAU;EAC5B,MAAM,EAAE,QAAQ,CAAC,UAAU;EAC3B,QAAQ,EAAE,QAAQ,CAAC,UAAU;EAC9B,CAAC;CACF,QAAQ,EAAE,OAAO;EACf,MAAM,EAAE,QAAQ,CAAC,UAAU;EAC3B,SAAS,EAAE,QAAQ,CAAC,UAAU;EAC/B,CAAC;CACF,IAAI,EAAE,OAAO;EACX,MAAM,EAAE,QAAQ,CAAC,UAAU;EAC3B,SAAS,EAAE,QAAQ,CAAC,UAAU;EAC/B,CAAC;CACF,IAAI,EAAE,QAAQ;CACf,CAAC;AAIF,MAAM,wBAAwB,EAAE,OAAO;CACrC,UAAU,EAAE,QAAQ,CAAC,UAAU;CAC/B,UAAU,EAAE,QAAQ,CAAC,UAAU;CAC/B,SAAS,EAAE,OAAO,EAChB,QAAQ,EAAE,OAAO;EACf,QAAQ,EAAE,QAAQ;EAClB,OAAO,EAAE,QAAQ;EACjB,aAAa,EAAE,QAAQ,CAAC,UAAU;EACnC,CAAC,EACH,CAAC;CACH,CAAC;AAIF,MAAa,uBAAuB,EAAE,OAAO;CAC3C,SAAS,EAAE,QAAQ,UAAU;CAC7B,SAAS,sBAAsB,UAAU;CACzC,QAAQ,qBAAqB,UAAU;CACxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge.mjs","names":[],"sources":["../../../../src/sdk/plugins/context/edge.ts"],"sourcesContent":["import { z } from \"zod
|
|
1
|
+
{"version":3,"file":"edge.mjs","names":[],"sources":["../../../../src/sdk/plugins/context/edge.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const edgeContextSchema = z.object({\n runtime: z.literal(\"edge\"),\n});\n\nexport type EdgeContext = z.infer<typeof edgeContextSchema>;\n"],"mappings":";;AAEA,MAAa,oBAAoB,EAAE,OAAO,EACxC,SAAS,EAAE,QAAQ,OAAO,EAC3B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from "zod
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
|
|
3
3
|
//#region src/sdk/plugins/context/next.d.ts
|
|
4
4
|
declare const nextjsContextSchema: z.ZodObject<{
|
|
@@ -20,15 +20,15 @@ declare const nextjsContextSchema: z.ZodObject<{
|
|
|
20
20
|
}>>;
|
|
21
21
|
routePath: z.ZodOptional<z.ZodString>;
|
|
22
22
|
routeType: z.ZodOptional<z.ZodEnum<{
|
|
23
|
-
render: "render";
|
|
24
|
-
route: "route";
|
|
25
23
|
action: "action";
|
|
26
24
|
middleware: "middleware";
|
|
27
25
|
proxy: "proxy";
|
|
26
|
+
render: "render";
|
|
27
|
+
route: "route";
|
|
28
28
|
}>>;
|
|
29
29
|
routerKind: z.ZodOptional<z.ZodEnum<{
|
|
30
|
-
"Pages Router": "Pages Router";
|
|
31
30
|
"App Router": "App Router";
|
|
31
|
+
"Pages Router": "Pages Router";
|
|
32
32
|
}>>;
|
|
33
33
|
runtime: z.ZodLiteral<"nextjs">;
|
|
34
34
|
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.mjs","names":[],"sources":["../../../../src/sdk/plugins/context/next.ts"],"sourcesContent":["import { z } from \"zod
|
|
1
|
+
{"version":3,"file":"next.mjs","names":[],"sources":["../../../../src/sdk/plugins/context/next.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const nextjsContextSchema = z.object({\n errorDigest: z.string().optional(),\n renderSource: z\n .enum([\n \"react-server-components\",\n \"react-server-components-payload\",\n \"server-rendering\",\n ])\n .optional(),\n renderType: z.enum([\"dynamic\", \"dynamic-resume\"]).optional(),\n requestMethod: z.string().optional(),\n requestPath: z.string().optional(),\n revalidateReason: z.enum([\"on-demand\", \"stale\"]).optional(),\n routePath: z.string().optional(),\n routeType: z\n .enum([\"render\", \"route\", \"action\", \"middleware\", \"proxy\"])\n .optional(),\n routerKind: z.enum([\"Pages Router\", \"App Router\"]).optional(),\n runtime: z.literal(\"nextjs\"),\n});\n\nexport type NextjsContext = z.infer<typeof nextjsContextSchema>;\n"],"mappings":";;AAEA,MAAa,sBAAsB,EAAE,OAAO;CAC1C,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,cAAc,EACX,KAAK;EACJ;EACA;EACA;EACD,CAAC,CACD,UAAU;CACb,YAAY,EAAE,KAAK,CAAC,WAAW,iBAAiB,CAAC,CAAC,UAAU;CAC5D,eAAe,EAAE,QAAQ,CAAC,UAAU;CACpC,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,kBAAkB,EAAE,KAAK,CAAC,aAAa,QAAQ,CAAC,CAAC,UAAU;CAC3D,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,WAAW,EACR,KAAK;EAAC;EAAU;EAAS;EAAU;EAAc;EAAQ,CAAC,CAC1D,UAAU;CACb,YAAY,EAAE,KAAK,CAAC,gBAAgB,aAAa,CAAC,CAAC,UAAU;CAC7D,SAAS,EAAE,QAAQ,SAAS;CAC7B,CAAC"}
|