@autter/runtime-next 1.4.0 → 1.6.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/README.md CHANGED
@@ -9,7 +9,8 @@ same-origin relay route, and a React error boundary.
9
9
  npm install @autter/runtime-next
10
10
  ```
11
11
 
12
- Set `AUTTER_RUNTIME_KEY` in your environment. Then three small files.
12
+ Set `AUTTER_RUNTIME_KEY` in your environment. Then one line of
13
+ `next.config` and three small files.
13
14
 
14
15
  The package has two entry points — this split is what keeps the Node
15
16
  OpenTelemetry SDK out of your browser bundle:
@@ -18,10 +19,33 @@ OpenTelemetry SDK out of your browser bundle:
18
19
  `instrumentation.ts`, route handlers, server components.
19
20
  - `@autter/runtime-next/client` — client components: browser tracker +
20
21
  error boundary. Never imports Node code.
22
+ - `@autter/runtime-next/instrumentation` — `onRequestError` for
23
+ `instrumentation.ts`; safe on both the Node and edge runtimes.
24
+
25
+ **`next.config`** — one copy of the Node SDK for `instrumentation.ts` and
26
+ your routes:
27
+
28
+ ```js
29
+ // next.config.mjs
30
+ export default {
31
+ serverExternalPackages: ["@autter/runtime-node"],
32
+ };
33
+ ```
34
+
35
+ Next bundles server dependencies separately into `instrumentation.ts` and
36
+ into each route. Without this line, code in routes, server components and
37
+ server actions (`withRuntimeRequest`, `captureServerException`,
38
+ `runtimeLogger`, `runtimeContext`, …) reaches a copy of the SDK that
39
+ `registerAutter` never started: request summaries are printed to the
40
+ console instead of being exported, and an error `withRuntimeRequest`
41
+ reports is reported a second time by `onRequestError`. Next 14.2:
42
+ `experimental: { serverComponentsExternalPackages: ["@autter/runtime-node"] }`.
21
43
 
22
44
  **1. `instrumentation.ts`** — server tracing/errors:
23
45
 
24
46
  ```ts
47
+ import { autterOnRequestError } from "@autter/runtime-next/instrumentation";
48
+
25
49
  export async function register() {
26
50
  if (process.env.NEXT_RUNTIME === "nodejs") {
27
51
  const { registerAutter } = await import("@autter/runtime-next");
@@ -33,8 +57,49 @@ export async function register() {
33
57
  });
34
58
  }
35
59
  }
60
+
61
+ // Next 15+: errors Next catches in server components, server actions, route
62
+ // handlers and middleware, with their stack (otherwise: stackless 500s).
63
+ export const onRequestError = autterOnRequestError({
64
+ // Edge runtime only (middleware, edge routes): no tracker runs there, so
65
+ // errors go straight to /v1/logs with these options.
66
+ edge: { apiKey: process.env.AUTTER_RUNTIME_KEY, service: "web-app" },
67
+ });
36
68
  ```
37
69
 
70
+ `@autter/runtime-next/instrumentation` is safe to import at the top of
71
+ `instrumentation.ts`, which Next compiles for both runtimes: on the edge,
72
+ bundlers resolve it (through the `edge-light`/`worker` export conditions) to a
73
+ build with no Node imports, and the Node build loads `@autter/runtime-node`
74
+ only inside a `process.env.NEXT_RUNTIME` branch Next removes from edge
75
+ bundles. Without edge errors to report, `export { onRequestError } from
76
+ "@autter/runtime-next/instrumentation"` is enough.
77
+
78
+ On Node the error is recorded on the request span through the
79
+ `registerAutter` tracker — once, even when `withRuntimeRequest` already
80
+ reported it (Next's context is then added to that report). Recorded with
81
+ it: `next.route_path` (the route template: `/blog/[slug]`, `/api/orders`;
82
+ middleware is `/middleware` on Next 15 and `/proxy` on Next 16),
83
+ `next.router_kind`, `next.route_type` (`render`, `route`, `action`,
84
+ `middleware` on Next 15, `proxy` on Next 16), `next.render_source`
85
+ (`react-server-components`, `react-server-components-payload`,
86
+ `server-rendering`), `next.render_type`, `next.revalidate_reason`,
87
+ `next.digest` (matches the `digest` your error boundary sees),
88
+ `http.request.method` and `url.path` without its query string. Headers and
89
+ cookies are never read. Next's control-flow signals (`redirect()`,
90
+ `notFound()`, `forbidden()`, `unauthorized()`, dynamic bailouts) are
91
+ skipped; `capture: true` or a predicate changes that.
92
+
93
+ On the edge runtime, Next calls `onRequestError` inside the function for
94
+ middleware and edge pages; the record goes out with the `edge` options and
95
+ is also handed to the request's `waitUntil`, since Next does not await the
96
+ hook for errors raised while rendering. Edge route handlers
97
+ (`export const runtime = "edge"` in `route.ts`) are the exception: Next
98
+ never calls the hook inside them. Self-hosted (`next start`), the Node
99
+ server reports them instead, so the Node tracker records them with their
100
+ own stack, `next.router_kind` `Pages Router` and `next.route_path` such as
101
+ `/api/orders/route`.
102
+
38
103
  `registerAutter` passes options straight to `initAutterServer`, so the
39
104
  server SDK's defaults apply out of the box: exporters are flushed on
40
105
  process exit (`autoFlush`) and custom attributes are scrubbed for PII
@@ -81,7 +146,9 @@ Also re-exported for convenience: `captureException`, `captureMessage`,
81
146
  `@autter/runtime-next/client`) and `captureServerException`,
82
147
  `captureServerMessage`, `withProcessSpan`, `withLlmCall`, `trackLlmCall`,
83
148
  `instrumentLlmClient`, `emitLlmSelftestTrace` (from the root /
84
- `@autter/runtime-next/server`).
149
+ `@autter/runtime-next/server`), plus the server error hooks for custom
150
+ servers: `autterErrorHandler`, `autterFastifyErrors`, `autterKoa` and
151
+ `captureRequestError`.
85
152
 
86
153
  > Importing the root entry from a client component pulls the Node OTel SDK
87
154
  > into the browser bundle and fails the build (`fs` cannot be resolved).
@@ -103,3 +170,51 @@ See the [operation logging guide](../../docs/OPERATION-LOGGING.md) for measured
103
170
  steps, explicit business outcomes, privacy and flushing. Ordinary error logs
104
171
  are diagnostics; captured exceptions and declared failed outcomes use tracing
105
172
  for issue grouping.
173
+
174
+ ## Requests, coded errors and edge middleware (1.5.0+)
175
+
176
+ Route handlers become request summaries (always kept, request id echoed in
177
+ `x-request-id`); the log flush is handed to Next's `after()` automatically
178
+ (Next 15+, `unstable_after` on 14.2):
179
+
180
+ ```ts
181
+ // app/api/checkout/route.ts
182
+ import { withRuntimeRequest, runtimeContext, defineRuntimeErrors, toClientError } from "@autter/runtime-next";
183
+
184
+ const billing = defineRuntimeErrors("billing", {
185
+ declined: { status: 402, message: "Payment declined", expected: true },
186
+ });
187
+
188
+ export const POST = withRuntimeRequest(async (request) => {
189
+ runtimeContext.set({ plan: "pro" });
190
+ const ok = await charge(await request.json());
191
+ if (!ok) {
192
+ const error = billing.declined();
193
+ return Response.json(toClientError(error, runtimeContext.requestId), { status: 402 });
194
+ }
195
+ return Response.json({ ok: true });
196
+ }, { name: "checkout" });
197
+ ```
198
+
199
+ Everything new in `@autter/runtime-node` 1.5.0 (`runtimeContext`,
200
+ `RuntimeError`, `defineRuntimeErrors`, `runInBackground`, `initAutterLogging`,
201
+ enrichers, sinks, …) is re-exported from `@autter/runtime-next` and
202
+ `/server`. `@autter/runtime-next/client` adds `autterErrorFromResponse`.
203
+
204
+ `middleware.ts` runs on the edge runtime — use `@autter/runtime-next/edge`
205
+ (re-exports [`@autter/runtime-edge`](../runtime-edge)):
206
+
207
+ ```ts
208
+ import { NextResponse } from "next/server";
209
+ import { withAutter } from "@autter/runtime-next/edge";
210
+
211
+ export default withAutter(
212
+ { apiKey: process.env.AUTTER_RUNTIME_KEY, service: "web-middleware" },
213
+ async (request, _event, _ctx, rt) => {
214
+ rt.set({ locale: request.headers.get("accept-language")?.slice(0, 2) });
215
+ return NextResponse.next();
216
+ },
217
+ );
218
+ ```
219
+
220
+ See [Requests, coded errors and background work](../../docs/REQUESTS-AND-ERRORS.md).
@@ -0,0 +1,85 @@
1
+ // src/request-error.ts
2
+ import { captureEdgeException } from "@autter/runtime-edge";
3
+ var CONTROL_FLOW_DIGEST = /^(?:NEXT_REDIRECT|NEXT_NOT_FOUND|NEXT_HTTP_ERROR_FALLBACK|DYNAMIC_SERVER_USAGE|BAILOUT_TO_CLIENT_SIDE_RENDERING)\b/;
4
+ function digestOf(error) {
5
+ try {
6
+ const digest = error?.digest;
7
+ return typeof digest === "string" ? digest : "";
8
+ } catch {
9
+ return "";
10
+ }
11
+ }
12
+ function shouldReport(error, rule) {
13
+ if (rule === true) return true;
14
+ if (rule === false) return false;
15
+ if (typeof rule === "function") {
16
+ try {
17
+ return rule(error) === true;
18
+ } catch {
19
+ return false;
20
+ }
21
+ }
22
+ return !CONTROL_FLOW_DIGEST.test(digestOf(error));
23
+ }
24
+ function requestErrorAttributes(error, request, context) {
25
+ const out = {};
26
+ const put = (key, read, max) => {
27
+ try {
28
+ const value = read();
29
+ if (typeof value === "string" && value) out[key] = value.slice(0, max);
30
+ } catch {
31
+ }
32
+ };
33
+ put("next.route_path", () => context?.routePath, 500);
34
+ put("next.router_kind", () => context?.routerKind, 40);
35
+ put("next.route_type", () => context?.routeType, 40);
36
+ put("next.render_source", () => context?.renderSource, 80);
37
+ put("next.render_type", () => context?.renderType, 40);
38
+ put("next.revalidate_reason", () => context?.revalidateReason, 40);
39
+ put("next.digest", () => digestOf(error), 100);
40
+ put("http.request.method", () => {
41
+ const method = request?.method;
42
+ return typeof method === "string" ? method.toUpperCase() : void 0;
43
+ }, 16);
44
+ put("url.path", () => {
45
+ const path = request?.path;
46
+ return typeof path === "string" ? path.split(/[?#]/)[0] ?? "" : void 0;
47
+ }, 1e3);
48
+ return out;
49
+ }
50
+ var warnedNoEdgeOptions = false;
51
+ function nextWaitUntil() {
52
+ try {
53
+ const store = globalThis[/* @__PURE__ */ Symbol.for("@next/request-context")];
54
+ const context = typeof store?.get === "function" ? store.get() : void 0;
55
+ const waitUntil = context?.waitUntil;
56
+ if (typeof waitUntil !== "function") return void 0;
57
+ return (promise) => waitUntil.call(context, promise);
58
+ } catch {
59
+ return void 0;
60
+ }
61
+ }
62
+ async function reportOnEdge(edge, error, attributes) {
63
+ const options = typeof edge === "function" ? edge() : edge;
64
+ if (!options) {
65
+ if (!warnedNoEdgeOptions) {
66
+ warnedNoEdgeOptions = true;
67
+ console.warn(
68
+ "[autter-runtime] onRequestError ran on the edge runtime without edge options; use autterOnRequestError({ edge: { apiKey, service } }) to report edge errors"
69
+ );
70
+ }
71
+ return;
72
+ }
73
+ const delivery = captureEdgeException(options, error, attributes);
74
+ try {
75
+ nextWaitUntil()?.(delivery);
76
+ } catch {
77
+ }
78
+ await delivery;
79
+ }
80
+
81
+ export {
82
+ shouldReport,
83
+ requestErrorAttributes,
84
+ reportOnEdge
85
+ };
@@ -0,0 +1,227 @@
1
+ // src/server.ts
2
+ import {
3
+ createBrowserRelayFetchHandler,
4
+ initAutterServer,
5
+ withRuntimeRequest as nodeWithRuntimeRequest
6
+ } from "@autter/runtime-node";
7
+
8
+ // package.json
9
+ var package_default = {
10
+ name: "@autter/runtime-next",
11
+ version: "1.6.0",
12
+ description: "One-command Autter Runtime for Next.js: server OTel, request wide events, coded errors, browser tracker, relay route, edge middleware and React error boundary",
13
+ license: "MIT",
14
+ type: "module",
15
+ main: "./dist/index.cjs",
16
+ module: "./dist/index.js",
17
+ types: "./dist/index.d.ts",
18
+ exports: {
19
+ ".": {
20
+ types: "./dist/index.d.ts",
21
+ import: "./dist/index.js",
22
+ require: "./dist/index.cjs"
23
+ },
24
+ "./server": {
25
+ types: "./dist/server.d.ts",
26
+ import: "./dist/server.js",
27
+ require: "./dist/server.cjs"
28
+ },
29
+ "./client": {
30
+ types: "./dist/client.d.ts",
31
+ import: "./dist/client.js",
32
+ require: "./dist/client.cjs"
33
+ },
34
+ "./edge": {
35
+ types: "./dist/edge.d.ts",
36
+ import: "./dist/edge.js",
37
+ require: "./dist/edge.cjs"
38
+ },
39
+ "./instrumentation": {
40
+ types: "./dist/instrumentation.d.ts",
41
+ "edge-light": {
42
+ import: "./dist/instrumentation-edge.js",
43
+ require: "./dist/instrumentation-edge.cjs"
44
+ },
45
+ worker: {
46
+ import: "./dist/instrumentation-edge.js",
47
+ require: "./dist/instrumentation-edge.cjs"
48
+ },
49
+ import: "./dist/instrumentation.js",
50
+ require: "./dist/instrumentation.cjs"
51
+ }
52
+ },
53
+ files: [
54
+ "dist"
55
+ ],
56
+ repository: {
57
+ type: "git",
58
+ url: "https://github.com/Autter-dev/autter-runtime.git",
59
+ directory: "packages/runtime-next"
60
+ },
61
+ scripts: {
62
+ build: `node ../../scripts/ensure-built.mjs runtime-node runtime-edge runtime-browser && node -e "require('node:fs').rmSync('dist',{recursive:true,force:true})" && tsup`,
63
+ test: "npm run build -w @autter/runtime-core && npm run build -w @autter/runtime-node && npm run build -w @autter/runtime-edge && npm run build -w @autter/runtime-browser && npm run build && node --test test/*.test.mjs"
64
+ },
65
+ dependencies: {
66
+ "@autter/runtime-browser": "^1.6.0",
67
+ "@autter/runtime-edge": "^1.1.0",
68
+ "@autter/runtime-node": "^1.6.0"
69
+ },
70
+ peerDependencies: {
71
+ react: ">=18"
72
+ },
73
+ devDependencies: {
74
+ "@types/react": "^18.3.0",
75
+ tsup: "^8.3.5",
76
+ typescript: "^5.7.0"
77
+ },
78
+ engines: {
79
+ node: ">=20"
80
+ },
81
+ publishConfig: {
82
+ access: "public",
83
+ provenance: true
84
+ },
85
+ homepage: "https://github.com/Autter-dev/autter-runtime#readme",
86
+ bugs: "https://github.com/Autter-dev/autter-runtime/issues",
87
+ keywords: [
88
+ "nextjs",
89
+ "error-tracking",
90
+ "telemetry",
91
+ "opentelemetry",
92
+ "react",
93
+ "error-boundary"
94
+ ]
95
+ };
96
+
97
+ // src/server.ts
98
+ import {
99
+ createRuntimeLogger,
100
+ runtimeLogger,
101
+ withRuntimeOperation,
102
+ flushRuntimeLogs,
103
+ runtimeLogStats,
104
+ captureException,
105
+ captureMessage,
106
+ reportOutcome,
107
+ withProcessSpan,
108
+ withLlmCall,
109
+ trackLlmCall,
110
+ instrumentLlmClient,
111
+ emitLlmSelftestTrace,
112
+ makeSafeCapture,
113
+ installAutterAutoFlush,
114
+ redactAttributes,
115
+ runtimeContext,
116
+ runInBackground,
117
+ autterRequests,
118
+ autterFastify,
119
+ autterErrorResponse,
120
+ autterErrorHandler,
121
+ autterFastifyErrors,
122
+ autterKoa,
123
+ captureRequestError,
124
+ RuntimeError,
125
+ defineRuntimeErrors,
126
+ isRuntimeErrorLike,
127
+ toClientError,
128
+ errorAttributes,
129
+ CODE_PATTERN,
130
+ initAutterLogging,
131
+ enrichUserAgent,
132
+ enrichRequestSize,
133
+ enrichEdgeGeo,
134
+ enrichDeployment,
135
+ otlpSink,
136
+ consoleSink,
137
+ fileSink,
138
+ redactText,
139
+ addBreadcrumb
140
+ } from "@autter/runtime-node";
141
+ function registerAutter(options) {
142
+ return initAutterServer({
143
+ distro: { name: "@autter/runtime-next", version: package_default.version },
144
+ ...options
145
+ });
146
+ }
147
+ function createAutterRelayRoute(options) {
148
+ return { POST: createBrowserRelayFetchHandler(options) };
149
+ }
150
+ var after;
151
+ var afterReady = (async () => {
152
+ try {
153
+ const specifier = "next/server";
154
+ const mod = await import(
155
+ /* webpackIgnore: true */
156
+ specifier
157
+ );
158
+ after = mod.after ?? mod.unstable_after ?? null;
159
+ } catch {
160
+ after = null;
161
+ }
162
+ return after;
163
+ })();
164
+ function scheduleAfter(promise) {
165
+ const run = (fn) => {
166
+ if (!fn) return;
167
+ try {
168
+ fn(promise);
169
+ } catch {
170
+ }
171
+ };
172
+ if (after !== void 0) run(after);
173
+ else void afterReady.then(run);
174
+ }
175
+ function withRuntimeRequest(handler, options = {}) {
176
+ return nodeWithRuntimeRequest(handler, {
177
+ ...options,
178
+ waitUntil: options.waitUntil ?? scheduleAfter
179
+ });
180
+ }
181
+
182
+ export {
183
+ registerAutter,
184
+ createAutterRelayRoute,
185
+ withRuntimeRequest,
186
+ createRuntimeLogger,
187
+ runtimeLogger,
188
+ withRuntimeOperation,
189
+ flushRuntimeLogs,
190
+ runtimeLogStats,
191
+ captureException,
192
+ captureMessage,
193
+ reportOutcome,
194
+ withProcessSpan,
195
+ withLlmCall,
196
+ trackLlmCall,
197
+ instrumentLlmClient,
198
+ emitLlmSelftestTrace,
199
+ makeSafeCapture,
200
+ installAutterAutoFlush,
201
+ redactAttributes,
202
+ runtimeContext,
203
+ runInBackground,
204
+ autterRequests,
205
+ autterFastify,
206
+ autterErrorResponse,
207
+ autterErrorHandler,
208
+ autterFastifyErrors,
209
+ autterKoa,
210
+ captureRequestError,
211
+ RuntimeError,
212
+ defineRuntimeErrors,
213
+ isRuntimeErrorLike,
214
+ toClientError,
215
+ errorAttributes,
216
+ CODE_PATTERN,
217
+ initAutterLogging,
218
+ enrichUserAgent,
219
+ enrichRequestSize,
220
+ enrichEdgeGeo,
221
+ enrichDeployment,
222
+ otlpSink,
223
+ consoleSink,
224
+ fileSink,
225
+ redactText,
226
+ addBreadcrumb
227
+ };
package/dist/client.cjs CHANGED
@@ -34,9 +34,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34
34
  var client_exports = {};
35
35
  __export(client_exports, {
36
36
  AutterErrorBoundary: () => AutterErrorBoundary,
37
+ addBreadcrumb: () => import_breadcrumbs.addBreadcrumb,
38
+ autterErrorFromResponse: () => import_runtime_browser2.autterErrorFromResponse,
37
39
  captureException: () => import_runtime_browser2.captureException,
38
40
  captureMessage: () => import_runtime_browser2.captureMessage,
39
41
  captureOutcome: () => import_runtime_browser2.captureOutcome,
42
+ clearBreadcrumbs: () => import_breadcrumbs.clearBreadcrumbs,
43
+ enableBreadcrumbs: () => import_breadcrumbs.enableBreadcrumbs,
40
44
  flush: () => import_runtime_browser2.flush,
41
45
  initAutterBrowser: () => import_runtime_browser2.initAutterBrowser,
42
46
  setContext: () => import_runtime_browser2.setContext,
@@ -45,6 +49,7 @@ __export(client_exports, {
45
49
  });
46
50
  module.exports = __toCommonJS(client_exports);
47
51
  var import_runtime_browser2 = require("@autter/runtime-browser");
52
+ var import_breadcrumbs = require("@autter/runtime-browser/breadcrumbs");
48
53
 
49
54
  // src/error-boundary.ts
50
55
  var React = __toESM(require("react"), 1);
@@ -76,9 +81,13 @@ var AutterErrorBoundary = class extends React.Component {
76
81
  // Annotate the CommonJS export names for ESM import in node:
77
82
  0 && (module.exports = {
78
83
  AutterErrorBoundary,
84
+ addBreadcrumb,
85
+ autterErrorFromResponse,
79
86
  captureException,
80
87
  captureMessage,
81
88
  captureOutcome,
89
+ clearBreadcrumbs,
90
+ enableBreadcrumbs,
82
91
  flush,
83
92
  initAutterBrowser,
84
93
  setContext,
@@ -0,0 +1,30 @@
1
+ export { AutterSeverity, autterErrorFromResponse, captureException, captureMessage, captureOutcome, flush, initAutterBrowser, setContext, setUser, trackEvent } from '@autter/runtime-browser';
2
+ export { Breadcrumb, BreadcrumbInput, BreadcrumbOptions, addBreadcrumb, clearBreadcrumbs, enableBreadcrumbs } from '@autter/runtime-browser/breadcrumbs';
3
+ import * as React from 'react';
4
+
5
+ /**
6
+ * React error boundary that reports render errors to Autter Runtime.
7
+ * React rendering errors do NOT hit `window.onerror`, so the browser
8
+ * tracker alone misses them — wrap your app:
9
+ *
10
+ * <AutterErrorBoundary fallback={<ErrorPage />}>
11
+ * <Application />
12
+ * </AutterErrorBoundary>
13
+ */
14
+ interface AutterErrorBoundaryProps {
15
+ fallback?: React.ReactNode;
16
+ /** Called after the error is reported (e.g. to show a toast). */
17
+ onError?: (error: Error, info: React.ErrorInfo) => void;
18
+ children?: React.ReactNode;
19
+ }
20
+ interface State {
21
+ hasError: boolean;
22
+ }
23
+ declare class AutterErrorBoundary extends React.Component<AutterErrorBoundaryProps, State> {
24
+ state: State;
25
+ static getDerivedStateFromError(): State;
26
+ componentDidCatch(error: Error, info: React.ErrorInfo): void;
27
+ render(): React.ReactNode;
28
+ }
29
+
30
+ export { AutterErrorBoundary, type AutterErrorBoundaryProps };
@@ -0,0 +1,30 @@
1
+ export { AutterSeverity, autterErrorFromResponse, captureException, captureMessage, captureOutcome, flush, initAutterBrowser, setContext, setUser, trackEvent } from '@autter/runtime-browser';
2
+ export { Breadcrumb, BreadcrumbInput, BreadcrumbOptions, addBreadcrumb, clearBreadcrumbs, enableBreadcrumbs } from '@autter/runtime-browser/breadcrumbs';
3
+ import * as React from 'react';
4
+
5
+ /**
6
+ * React error boundary that reports render errors to Autter Runtime.
7
+ * React rendering errors do NOT hit `window.onerror`, so the browser
8
+ * tracker alone misses them — wrap your app:
9
+ *
10
+ * <AutterErrorBoundary fallback={<ErrorPage />}>
11
+ * <Application />
12
+ * </AutterErrorBoundary>
13
+ */
14
+ interface AutterErrorBoundaryProps {
15
+ fallback?: React.ReactNode;
16
+ /** Called after the error is reported (e.g. to show a toast). */
17
+ onError?: (error: Error, info: React.ErrorInfo) => void;
18
+ children?: React.ReactNode;
19
+ }
20
+ interface State {
21
+ hasError: boolean;
22
+ }
23
+ declare class AutterErrorBoundary extends React.Component<AutterErrorBoundaryProps, State> {
24
+ state: State;
25
+ static getDerivedStateFromError(): State;
26
+ componentDidCatch(error: Error, info: React.ErrorInfo): void;
27
+ render(): React.ReactNode;
28
+ }
29
+
30
+ export { AutterErrorBoundary, type AutterErrorBoundaryProps };
package/dist/client.js CHANGED
@@ -12,8 +12,14 @@ import {
12
12
  trackEvent,
13
13
  setUser,
14
14
  setContext,
15
- flush
15
+ flush,
16
+ autterErrorFromResponse
16
17
  } from "@autter/runtime-browser";
18
+ import {
19
+ enableBreadcrumbs,
20
+ addBreadcrumb,
21
+ clearBreadcrumbs
22
+ } from "@autter/runtime-browser/breadcrumbs";
17
23
 
18
24
  // src/error-boundary.ts
19
25
  import * as React from "react";
@@ -44,9 +50,13 @@ var AutterErrorBoundary = class extends React.Component {
44
50
  };
45
51
  export {
46
52
  AutterErrorBoundary,
53
+ addBreadcrumb,
54
+ autterErrorFromResponse,
47
55
  captureException2 as captureException,
48
56
  captureMessage,
49
57
  captureOutcome,
58
+ clearBreadcrumbs,
59
+ enableBreadcrumbs,
50
60
  flush,
51
61
  initAutterBrowser,
52
62
  setContext,
package/dist/edge.cjs ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+
17
+ // src/edge.ts
18
+ var edge_exports = {};
19
+ module.exports = __toCommonJS(edge_exports);
20
+ __reExport(edge_exports, require("@autter/runtime-edge"), module.exports);
@@ -0,0 +1 @@
1
+ export * from '@autter/runtime-edge';
package/dist/edge.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from '@autter/runtime-edge';
package/dist/edge.js ADDED
@@ -0,0 +1,2 @@
1
+ // src/edge.ts
2
+ export * from "@autter/runtime-edge";