@sypnia/telemetry 0.0.0-stage → 0.3.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/CHANGELOG.md +20 -0
- package/LICENSE +21 -0
- package/README.md +36 -2
- package/dist/api-DJWXTLo4.d.ts +283 -0
- package/dist/browser/index.d.ts +13 -0
- package/dist/browser/index.js +3 -0
- package/dist/chunk-2RMEOMSD.js +51 -0
- package/dist/chunk-LBKUMS7U.js +25 -0
- package/dist/chunk-P5DK2OU7.js +225 -0
- package/dist/chunk-UPXOW6QR.js +323 -0
- package/dist/chunk-WUAOTFVV.js +27 -0
- package/dist/chunk-YGXX6CWT.js +2444 -0
- package/dist/config-CrnrvvEQ.d.ts +46 -0
- package/dist/index-BQbAXVDI.d.ts +340 -0
- package/dist/next/client.d.ts +16 -0
- package/dist/next/client.js +34 -0
- package/dist/next/index.d.ts +67 -0
- package/dist/next/index.js +298 -0
- package/dist/next/opennext.d.ts +72 -0
- package/dist/next/opennext.js +55 -0
- package/dist/next/server.d.ts +48 -0
- package/dist/next/server.js +37 -0
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +1849 -0
- package/dist/recorder-IZ3QHWYA.js +1200 -0
- package/dist/route-names-7DRTESKN.js +2 -0
- package/dist/routes-UZDLSWQN.js +35 -0
- package/dist/start-TW6OBKK7.js +2 -0
- package/package.json +103 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.3.0 (2026-11-17)
|
|
4
|
+
|
|
5
|
+
Anonymous visitors (docs: https://telemetry.docs.sypnia.com/sdks/anonymous-visitors).
|
|
6
|
+
|
|
7
|
+
- `init({ anonymousRoutes, anonymous })` in the browser: public routes observed without identity. On them `identify()` is kept in memory and never sent; events carry `anon: true`, `person` and `account` null, no device id, and the route as the address; the session lives in this tab's `sessionStorage` (`sypnia:anon`), with no cookie and nothing in `localStorage`; custom properties, click labels and error messages are scrubbed of e-mails and runs of 6 or more digits, and numbers of 9 or more digits are dropped; replays and page snapshots are off unless `anonymous.replay` (then every text is masked). `anonymous.hideClickText` sends no click label or context there.
|
|
8
|
+
- Anonymous routes are observed even when `allowRoutes` does not list them; `ignoreRoutes` still wins.
|
|
9
|
+
- From an anonymous route to a signed-in one in the same tab, the session goes on; identity applies from then on, never to earlier events. A signed-in person who opens an anonymous route gets a separate session there.
|
|
10
|
+
- Node and Next.js: `init({ anonymousRoutes })` and `withSypnia({ server: { anonymousRoutes } })`. Requests of those routes are traced with `sypnia.anonymous = true`, and `identify()` is ignored in them.
|
|
11
|
+
|
|
12
|
+
## 0.2.0 (2026-11-17)
|
|
13
|
+
|
|
14
|
+
First release of `@sypnia/telemetry`, the one package for Sypnia Telemetry's JavaScript SDKs.
|
|
15
|
+
|
|
16
|
+
- Subpaths `browser`, `node`, `next`, `next/client`, `next/server` and `next/opennext`, built from the same sources as `@sypnia/browser` 0.1.2, `@sypnia/node` 0.1.2 and `@sypnia/next` 0.1.3, with the same API.
|
|
17
|
+
- One build with shared chunks: `next/client` and `browser` share one SDK instance, and the Node SDK that `next/server` starts is the one `node` exports.
|
|
18
|
+
- Default ingest endpoint: `https://telemetry.ingest.sypnia.com` (was `https://ingest.sypnia.com`, still served by the same engine). Default API for releases and source maps: `https://telemetry.api.sypnia.com` (was `https://api.sypnia.com`).
|
|
19
|
+
- The SDK reports itself as `@sypnia/telemetry/browser` and `@sypnia/telemetry/node`, version 0.2.0.
|
|
20
|
+
- `next` is an optional peer dependency.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sypnia
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @sypnia/telemetry
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Sypnia Telemetry for JavaScript: errors, sessions, replays, page performance and traces, for the browser, Node servers and Next.js, in one package. Each runtime is a subpath; install once, import what you use.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @sypnia/telemetry
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
| Import | For |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `@sypnia/telemetry/browser` | Anything that runs in a browser |
|
|
12
|
+
| `@sypnia/telemetry/node` | Node servers, queues and functions (SQS, Lambda) |
|
|
13
|
+
| `@sypnia/telemetry/next` | `withSypnia` for `next.config.ts` (source maps at build) |
|
|
14
|
+
| `@sypnia/telemetry/next/client` | `instrumentation-client.ts` |
|
|
15
|
+
| `@sypnia/telemetry/next/server` | `instrumentation.ts` |
|
|
16
|
+
| `@sypnia/telemetry/next/opennext` | Next.js on AWS Lambda with OpenNext |
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
// next.config.ts
|
|
20
|
+
import { withSypnia } from '@sypnia/telemetry/next';
|
|
21
|
+
export default withSypnia({}, { project: process.env.SYPNIA_PROJECT_KEY, service: 'shop-web' });
|
|
22
|
+
|
|
23
|
+
// instrumentation.ts
|
|
24
|
+
export { register, onRequestError } from '@sypnia/telemetry/next/server';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
// A Node server: imported first in your entry file
|
|
29
|
+
import { init } from '@sypnia/telemetry/node';
|
|
30
|
+
init({ project: process.env.SYPNIA_PROJECT_KEY, service: 'shop-api' });
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Events go to `https://telemetry.ingest.sypnia.com` unless you set `endpoint` (a self-hosted engine). Source maps and releases go to `https://telemetry.api.sypnia.com` unless `SYPNIA_BASE_URL` says otherwise. `next` is an optional peer: only the `next/*` subpaths need it.
|
|
34
|
+
|
|
35
|
+
Docs: [telemetry.docs.sypnia.com/sdks](https://telemetry.docs.sypnia.com/sdks). It replaces `@sypnia/browser`, `@sypnia/node` and `@sypnia/next`, which stay published until their users move.
|
|
36
|
+
|
|
37
|
+
MIT licensed.
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The events the browser SDK sends, as `spec/events.schema.json` (version 1)
|
|
3
|
+
* defines them. Field names are short on purpose: a browser sends thousands.
|
|
4
|
+
*/
|
|
5
|
+
declare const SCHEMA_VERSION: 1;
|
|
6
|
+
type DeviceClass = 'mobile' | 'tablet' | 'desktop';
|
|
7
|
+
type NavigationKind = 'load' | 'push' | 'replace' | 'traverse';
|
|
8
|
+
type VitalName = 'LCP' | 'INP' | 'CLS' | 'TTFB' | 'FCP';
|
|
9
|
+
type VitalRating = 'good' | 'needs-improvement' | 'poor';
|
|
10
|
+
type VitalKind = 'image' | 'text' | 'pointer' | 'keyboard';
|
|
11
|
+
type ErrorSource = 'window' | 'promise' | 'boundary' | 'manual';
|
|
12
|
+
/** 1: the default rules (typed input masked). 2: `maskAllText` (every text of the page masked too). */
|
|
13
|
+
type MaskPolicy = 1 | 2;
|
|
14
|
+
declare const CLICK_ROLES: readonly ["button", "link", "tab", "menuitem", "option", "checkbox", "radio", "switch", "select", "input", "textarea", "row", "cell", "heading", "image", "icon", "text", "other"];
|
|
15
|
+
type ClickRole = (typeof CLICK_ROLES)[number];
|
|
16
|
+
type ValidityReason = 'valueMissing' | 'typeMismatch' | 'patternMismatch' | 'tooShort' | 'tooLong' | 'rangeUnderflow' | 'rangeOverflow' | 'stepMismatch' | 'badInput' | 'customError';
|
|
17
|
+
interface PersonRef {
|
|
18
|
+
id: string;
|
|
19
|
+
}
|
|
20
|
+
interface AccountRef {
|
|
21
|
+
id: string;
|
|
22
|
+
}
|
|
23
|
+
/** Fields of every browser event. */
|
|
24
|
+
interface EventBase {
|
|
25
|
+
v: typeof SCHEMA_VERSION;
|
|
26
|
+
type: string;
|
|
27
|
+
ts: number;
|
|
28
|
+
sid: string;
|
|
29
|
+
/** The device id. Not sent from an anonymous route (docs: sdks/anonymous-visitors). */
|
|
30
|
+
did?: string;
|
|
31
|
+
env: string;
|
|
32
|
+
ver: string | null;
|
|
33
|
+
person: PersonRef | null;
|
|
34
|
+
account: AccountRef | null;
|
|
35
|
+
url: string;
|
|
36
|
+
route: string;
|
|
37
|
+
dev: DeviceClass;
|
|
38
|
+
vw: number;
|
|
39
|
+
vh: number;
|
|
40
|
+
lang: string | null;
|
|
41
|
+
/** Sent from an anonymous route: no person, no account, no device id. */
|
|
42
|
+
anon?: true;
|
|
43
|
+
}
|
|
44
|
+
interface SessionStartEvent extends EventBase {
|
|
45
|
+
type: 'session_start';
|
|
46
|
+
ua: string;
|
|
47
|
+
ref: string | null;
|
|
48
|
+
sw: number;
|
|
49
|
+
sh: number;
|
|
50
|
+
tz: string;
|
|
51
|
+
}
|
|
52
|
+
interface IdentifyEvent extends Omit<EventBase, 'person' | 'account'> {
|
|
53
|
+
type: 'identify';
|
|
54
|
+
person: {
|
|
55
|
+
id: string;
|
|
56
|
+
name: string | null;
|
|
57
|
+
email: string | null;
|
|
58
|
+
};
|
|
59
|
+
account: {
|
|
60
|
+
id: string;
|
|
61
|
+
name: string | null;
|
|
62
|
+
} | null;
|
|
63
|
+
}
|
|
64
|
+
interface PageViewEvent extends EventBase {
|
|
65
|
+
type: 'page_view';
|
|
66
|
+
nav: NavigationKind;
|
|
67
|
+
from: string | null;
|
|
68
|
+
}
|
|
69
|
+
interface PageLeaveEvent extends EventBase {
|
|
70
|
+
type: 'page_leave';
|
|
71
|
+
dur: number;
|
|
72
|
+
scroll: number;
|
|
73
|
+
}
|
|
74
|
+
/** What was clicked, in words and in position. Never the value of a field. */
|
|
75
|
+
interface ClickFields {
|
|
76
|
+
sel: string;
|
|
77
|
+
tag: string;
|
|
78
|
+
txt: string | null;
|
|
79
|
+
crole?: ClickRole;
|
|
80
|
+
ctx: string | null;
|
|
81
|
+
href: string | null;
|
|
82
|
+
x: number;
|
|
83
|
+
y: number;
|
|
84
|
+
rx: number;
|
|
85
|
+
ry: number;
|
|
86
|
+
ex: number;
|
|
87
|
+
ey: number;
|
|
88
|
+
ew: number;
|
|
89
|
+
eh: number;
|
|
90
|
+
}
|
|
91
|
+
interface ClickEvent extends EventBase, ClickFields {
|
|
92
|
+
type: 'click';
|
|
93
|
+
}
|
|
94
|
+
interface RageClickEvent extends EventBase, ClickFields {
|
|
95
|
+
type: 'rage_click';
|
|
96
|
+
/** How many clicks the burst had. */
|
|
97
|
+
n: number;
|
|
98
|
+
}
|
|
99
|
+
interface DeadClickEvent extends EventBase, ClickFields {
|
|
100
|
+
type: 'dead_click';
|
|
101
|
+
/** How long the SDK waited, always 1,000. */
|
|
102
|
+
n: 1000;
|
|
103
|
+
}
|
|
104
|
+
interface VitalEvent extends EventBase {
|
|
105
|
+
type: 'vital';
|
|
106
|
+
name: VitalName;
|
|
107
|
+
value: number;
|
|
108
|
+
rating: VitalRating;
|
|
109
|
+
sel?: string;
|
|
110
|
+
kind?: VitalKind;
|
|
111
|
+
}
|
|
112
|
+
interface RequestEvent extends EventBase {
|
|
113
|
+
type: 'request';
|
|
114
|
+
method: string;
|
|
115
|
+
host: string | null;
|
|
116
|
+
path: string;
|
|
117
|
+
status: number;
|
|
118
|
+
dur: number;
|
|
119
|
+
tid: string;
|
|
120
|
+
span: string;
|
|
121
|
+
code?: string;
|
|
122
|
+
msg?: string;
|
|
123
|
+
}
|
|
124
|
+
interface ErrorEvent extends EventBase {
|
|
125
|
+
type: 'error';
|
|
126
|
+
name: string;
|
|
127
|
+
msg: string;
|
|
128
|
+
stack: string | null;
|
|
129
|
+
digest: string | null;
|
|
130
|
+
src: ErrorSource;
|
|
131
|
+
fp: string;
|
|
132
|
+
}
|
|
133
|
+
type CustomProps = Record<string, string | number | boolean | null>;
|
|
134
|
+
interface CustomEvent extends EventBase {
|
|
135
|
+
type: 'custom';
|
|
136
|
+
name: string;
|
|
137
|
+
props?: CustomProps;
|
|
138
|
+
}
|
|
139
|
+
interface FormInvalidEvent extends EventBase {
|
|
140
|
+
type: 'form_invalid';
|
|
141
|
+
field: string | null;
|
|
142
|
+
ctx: string | null;
|
|
143
|
+
reason: ValidityReason | null;
|
|
144
|
+
sel: string;
|
|
145
|
+
}
|
|
146
|
+
interface ReplayChunkEvent extends EventBase {
|
|
147
|
+
type: 'replay_chunk';
|
|
148
|
+
seq: number;
|
|
149
|
+
bytes: number;
|
|
150
|
+
mask: MaskPolicy;
|
|
151
|
+
full?: boolean;
|
|
152
|
+
}
|
|
153
|
+
type ReplayGapReason = 'rejected' | 'failed' | 'overflow' | 'limit';
|
|
154
|
+
interface ReplayGapEvent extends EventBase {
|
|
155
|
+
type: 'replay_gap';
|
|
156
|
+
seq: number;
|
|
157
|
+
reason: ReplayGapReason;
|
|
158
|
+
mask: MaskPolicy;
|
|
159
|
+
}
|
|
160
|
+
type SnapshotSkipReason = 'too_big' | 'upload_failed' | 'limit';
|
|
161
|
+
interface PageSnapshotEvent extends EventBase {
|
|
162
|
+
type: 'page_snapshot';
|
|
163
|
+
bytes: number;
|
|
164
|
+
mask: MaskPolicy;
|
|
165
|
+
skipped?: SnapshotSkipReason;
|
|
166
|
+
}
|
|
167
|
+
type SypniaEvent = SessionStartEvent | IdentifyEvent | PageViewEvent | PageLeaveEvent | ClickEvent | RageClickEvent | DeadClickEvent | VitalEvent | RequestEvent | ErrorEvent | CustomEvent | FormInvalidEvent | ReplayChunkEvent | ReplayGapEvent | PageSnapshotEvent;
|
|
168
|
+
|
|
169
|
+
/** A route or address in a list: a string matches the start (routes: the route and everything under it). */
|
|
170
|
+
type Pattern = string | RegExp;
|
|
171
|
+
/** What `init` takes (docs: sdks/browser#initoptions). */
|
|
172
|
+
interface InitOptions {
|
|
173
|
+
/** The project's ingest key, `spk_…`. Without it the SDK does nothing and prints one warning. */
|
|
174
|
+
project: string;
|
|
175
|
+
/** Where to send: a self-hosted engine's base URL, or a path on your own domain proxied to it. */
|
|
176
|
+
endpoint?: string;
|
|
177
|
+
/** 1 to 40 characters. `production` by default. */
|
|
178
|
+
environment?: string;
|
|
179
|
+
/** Up to 40 characters: the short git commit. */
|
|
180
|
+
release?: string;
|
|
181
|
+
/** `false` turns the SDK into a no-op. */
|
|
182
|
+
enabled?: boolean;
|
|
183
|
+
/** Prints every event, and every decision not to send one, to the console. */
|
|
184
|
+
debug?: boolean;
|
|
185
|
+
/** Paths where the SDK captures nothing at all. */
|
|
186
|
+
ignoreRoutes?: Pattern[];
|
|
187
|
+
/** When set, the only paths where the SDK captures anything (`ignoreRoutes` still applies inside them). */
|
|
188
|
+
allowRoutes?: Pattern[];
|
|
189
|
+
/**
|
|
190
|
+
* Public pages observed without identity (docs: sdks/anonymous-visitors):
|
|
191
|
+
* no `identify`, no device id, a session of this tab only, scrubbed text,
|
|
192
|
+
* no replay. Observed even when `allowRoutes` does not list them.
|
|
193
|
+
*/
|
|
194
|
+
anonymousRoutes?: Pattern[];
|
|
195
|
+
anonymous?: AnonymousOptions;
|
|
196
|
+
/** Your own way to turn a path into a route. */
|
|
197
|
+
routeFor?: (pathname: string) => string;
|
|
198
|
+
/** Treats the hash as the path, for apps that route with `#/checkout`. */
|
|
199
|
+
hashRouting?: boolean;
|
|
200
|
+
capture?: CaptureOptions;
|
|
201
|
+
/** Addresses outside your origin whose calls are recorded and receive the trace headers. */
|
|
202
|
+
traceTargets?: Pattern[];
|
|
203
|
+
/** Addresses outside your origin whose calls are recorded without any header. */
|
|
204
|
+
recordTargets?: Pattern[];
|
|
205
|
+
/** Calls that are never recorded. */
|
|
206
|
+
ignoreRequests?: Pattern[];
|
|
207
|
+
/** Errors whose message matches are not sent. */
|
|
208
|
+
ignoreErrors?: Pattern[];
|
|
209
|
+
/** Script addresses that are your code although they are served from another origin. */
|
|
210
|
+
appFrames?: Pattern[];
|
|
211
|
+
/** Masks every text in replays and snapshots, and sends no click label, context or field name. */
|
|
212
|
+
maskAllText?: boolean;
|
|
213
|
+
/** Elements to mask, on top of `[data-sypnia-mask]`. */
|
|
214
|
+
maskSelector?: string;
|
|
215
|
+
/** Elements to leave out of replays, on top of `[data-sypnia-block]`, frames (`iframe`, `frame`, `object`, `embed`) and `video`. */
|
|
216
|
+
blockSelector?: string;
|
|
217
|
+
/** `false` never loads the recorder. */
|
|
218
|
+
replay?: false | {
|
|
219
|
+
blockedRoutes?: Pattern[];
|
|
220
|
+
};
|
|
221
|
+
/** Page snapshots for click maps. */
|
|
222
|
+
snapshots?: boolean;
|
|
223
|
+
/** Called with each event before it is queued: return it, changed or not, or `null` to drop it. */
|
|
224
|
+
beforeSend?: (event: SypniaEvent) => SypniaEvent | null;
|
|
225
|
+
}
|
|
226
|
+
/** How anonymous routes are observed (docs: sdks/anonymous-visitors#what-changes-on-an-anonymous-route). */
|
|
227
|
+
interface AnonymousOptions {
|
|
228
|
+
/** Replays and page snapshots on anonymous routes, with every text masked. `false` by default. */
|
|
229
|
+
replay?: boolean;
|
|
230
|
+
/** No label and no context with clicks and form errors on anonymous routes. `false` by default. */
|
|
231
|
+
hideClickText?: boolean;
|
|
232
|
+
}
|
|
233
|
+
interface CaptureOptions {
|
|
234
|
+
errors?: boolean;
|
|
235
|
+
clicks?: boolean;
|
|
236
|
+
requests?: boolean;
|
|
237
|
+
requestFailureDetail?: boolean;
|
|
238
|
+
vitals?: boolean;
|
|
239
|
+
forms?: boolean;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* The public functions (docs: sdks/browser#the-functions-you-call). One SDK
|
|
244
|
+
* per document: the runtime lives on `window`, so every bundle of a page
|
|
245
|
+
* shares it. None of these functions throws, and all of them do nothing on
|
|
246
|
+
* the server, before `init`, with `enabled: false` or after `optOut()`.
|
|
247
|
+
*/
|
|
248
|
+
|
|
249
|
+
type IdentifyInput = {
|
|
250
|
+
person: {
|
|
251
|
+
id: string | number;
|
|
252
|
+
name?: string | null;
|
|
253
|
+
email?: string | null;
|
|
254
|
+
};
|
|
255
|
+
account?: {
|
|
256
|
+
id: string | number;
|
|
257
|
+
name?: string | null;
|
|
258
|
+
} | null;
|
|
259
|
+
} | null;
|
|
260
|
+
/** Says who the person is, and their account; `identify(null)` when they sign out. */
|
|
261
|
+
declare function identify(who: IdentifyInput): void;
|
|
262
|
+
/** Sends a custom event: something that matters in your app and that Sypnia cannot see by itself. */
|
|
263
|
+
declare function track(name: string, props?: CustomProps): void;
|
|
264
|
+
/** Reports an error your code caught. */
|
|
265
|
+
declare function reportError(error: unknown, info?: {
|
|
266
|
+
source?: 'manual' | 'boundary';
|
|
267
|
+
digest?: string;
|
|
268
|
+
}): void;
|
|
269
|
+
/** Sends what is waiting now. */
|
|
270
|
+
declare function flush(): Promise<void>;
|
|
271
|
+
/** The current session's id, 32 hex characters, or null. */
|
|
272
|
+
declare function getSessionId(): string | null;
|
|
273
|
+
/** Stops everything for this browser and remembers it (`localStorage`, `sypnia:off`). */
|
|
274
|
+
declare function optOut(): void;
|
|
275
|
+
/** Undoes `optOut`. */
|
|
276
|
+
declare function optIn(): void;
|
|
277
|
+
/**
|
|
278
|
+
* For framework integrations: a navigation was announced before the address
|
|
279
|
+
* changed (Next.js' `onRouterTransitionStart`). Apps do not call it.
|
|
280
|
+
*/
|
|
281
|
+
declare function notifyNavigation(url: string, kind: 'push' | 'replace' | 'traverse'): void;
|
|
282
|
+
|
|
283
|
+
export { type CaptureOptions as C, type InitOptions as I, type Pattern as P, type SypniaEvent as S, type CustomProps as a, optOut as b, flush as f, getSessionId as g, identify as i, notifyNavigation as n, optIn as o, reportError as r, track as t };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { I as InitOptions } from '../api-DJWXTLo4.js';
|
|
2
|
+
export { C as CaptureOptions, a as CustomProps, P as Pattern, S as SypniaEvent, f as flush, g as getSessionId, i as identify, n as notifyNavigation, o as optIn, b as optOut, r as reportError, t as track } from '../api-DJWXTLo4.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `@sypnia/browser`: errors, sessions, replay, page performance, failing API
|
|
6
|
+
* calls, and rage and dead clicks, with nothing a person types ever leaving
|
|
7
|
+
* their browser (docs: sdks/browser).
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** Starts the SDK. Call it once, as early as your app starts. A second call does nothing. */
|
|
11
|
+
declare function init(options: InitOptions): void;
|
|
12
|
+
|
|
13
|
+
export { InitOptions, init };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { pathnameOf, routeOf } from './chunk-P5DK2OU7.js';
|
|
2
|
+
|
|
3
|
+
// ../next/src/route-names.ts
|
|
4
|
+
var STATIC = 0;
|
|
5
|
+
var DYNAMIC = 1;
|
|
6
|
+
var CATCH_ALL = 2;
|
|
7
|
+
var OPTIONAL_CATCH_ALL = 3;
|
|
8
|
+
function kindOf(segment) {
|
|
9
|
+
if (/^\[\[\.\.\.[^\]]+\]\]$/.test(segment)) return OPTIONAL_CATCH_ALL;
|
|
10
|
+
if (/^\[\.\.\.[^\]]+\]$/.test(segment)) return CATCH_ALL;
|
|
11
|
+
if (/^\[[^\]]+\]$/.test(segment)) return DYNAMIC;
|
|
12
|
+
return STATIC;
|
|
13
|
+
}
|
|
14
|
+
function escape(text) {
|
|
15
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
16
|
+
}
|
|
17
|
+
function compile(route) {
|
|
18
|
+
const segments = route.split("/").filter(Boolean);
|
|
19
|
+
const kinds = segments.map(kindOf);
|
|
20
|
+
let source = "";
|
|
21
|
+
segments.forEach((segment, index) => {
|
|
22
|
+
const kind = kinds[index];
|
|
23
|
+
if (kind === OPTIONAL_CATCH_ALL) source += "(?:/.+)?";
|
|
24
|
+
else if (kind === CATCH_ALL) source += "/.+";
|
|
25
|
+
else if (kind === DYNAMIC) source += "/[^/]+";
|
|
26
|
+
else source += `/${escape(segment)}`;
|
|
27
|
+
});
|
|
28
|
+
return { route, kinds, pattern: new RegExp(`^${source || "/"}$`) };
|
|
29
|
+
}
|
|
30
|
+
function compareNames(a, b) {
|
|
31
|
+
const length = Math.max(a.kinds.length, b.kinds.length);
|
|
32
|
+
for (let i = 0; i < length; i++) {
|
|
33
|
+
const left = a.kinds[i];
|
|
34
|
+
const right = b.kinds[i];
|
|
35
|
+
if (left === void 0) return -1;
|
|
36
|
+
if (right === void 0) return 1;
|
|
37
|
+
if (left !== right) return left - right;
|
|
38
|
+
}
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
function routeNamer(routes, basePath = "") {
|
|
42
|
+
const compiled = routes.map(compile).sort(compareNames);
|
|
43
|
+
return (pathname) => {
|
|
44
|
+
let path = pathnameOf(pathname);
|
|
45
|
+
if (basePath && (path === basePath || path.startsWith(`${basePath}/`))) path = path.slice(basePath.length) || "/";
|
|
46
|
+
const found = compiled.find((name) => name.pattern.test(path === "/" ? "/" : path));
|
|
47
|
+
return found ? found.route : routeOf(path);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { routeNamer };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { deserializePatterns } from './chunk-WUAOTFVV.js';
|
|
2
|
+
|
|
3
|
+
// ../next/src/start.ts
|
|
4
|
+
var NEXT_INTERNALS = ["/_next/static", "/_next/image", "/_next/webpack-hmr", "/__nextjs_original-stack-frame"];
|
|
5
|
+
async function startNode(config, dir = process.cwd()) {
|
|
6
|
+
const [sdk, routes] = await Promise.all([import('./node/index.js'), import('./routes-UZDLSWQN.js')]);
|
|
7
|
+
const routeFor = routes.loadRouteResolver(config.distDir, config.basePath, dir) ?? (config.routes?.length ? (await import('./route-names-7DRTESKN.js')).routeNamer(config.routes, config.basePath) : null);
|
|
8
|
+
const { ignoreRoutes, allowRoutes, anonymousRoutes, ...server } = config.server;
|
|
9
|
+
sdk.init({
|
|
10
|
+
...server,
|
|
11
|
+
ignoreRoutes: [...NEXT_INTERNALS, ...deserializePatterns(ignoreRoutes) ?? []],
|
|
12
|
+
...allowRoutes ? { allowRoutes: deserializePatterns(allowRoutes) ?? [] } : {},
|
|
13
|
+
...anonymousRoutes ? { anonymousRoutes: deserializePatterns(anonymousRoutes) ?? [] } : {},
|
|
14
|
+
project: config.project,
|
|
15
|
+
endpoint: config.endpoint,
|
|
16
|
+
service: config.service,
|
|
17
|
+
environment: config.environment,
|
|
18
|
+
...config.release ? { release: config.release } : {},
|
|
19
|
+
debug: config.debug,
|
|
20
|
+
...routeFor ? { routeFor } : {}
|
|
21
|
+
});
|
|
22
|
+
return sdk;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { startNode };
|