@flareapp/js 1.2.1 → 2.0.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 CHANGED
@@ -1,30 +1,33 @@
1
- # @flareapp/js
2
-
3
- ## 1.2.0
4
-
5
- This is the **final v1 release**. Subsequent work ships under v2.
6
-
7
- ### Added
8
- - Reports are now mapped to the Flare v2 wire format on egress. The mapper sits at the `Api.report()` boundary; the public API and the `beforeSubmit` hook still see the v1 `Report` shape.
9
-
10
- ### Changed
11
- - Default `reportingUrl` now points to the new ingestion endpoint: `https://ingress.flareapp.io/v1/errors`. Consumers with allowlist firewall rules on outbound HTTP must add this host to their allowlist. Consumers passing a custom `reportingUrl` to `flare.configure({...})` are unaffected.
12
- - HTTP response is now treated as success on status `200`, `201`, or `204` (previously only `204`).
13
- - Headers updated: `Accept: application/json` and `X-Flare-Client-Version: 1` added; `X-Requested-With` removed. `X-Api-Token` and `X-Report-Browser-Extension-Errors` retained.
14
- - Stack frames omit the `class` field when empty (previously emitted as `""`). The field is still emitted when populated.
15
-
16
- ### Fixed
17
- - `cookie` context collector preserves `=` characters inside cookie values (previously truncated base64-padded values at the first `=`).
18
- - Global error and unhandled-rejection handlers attach via `addEventListener`, so user code reassigning `window.onerror` no longer detaches Flare's handlers.
19
- - Non-Error rejection reasons (strings, plain objects, Symbols) now produce reports instead of being silently dropped.
20
- - `flatJsonStringify` decycles via a `WeakSet` of ancestor objects: real cycles become the literal `'[Circular]'`; non-cyclic shared sub-objects are preserved without recursion blowup.
21
- - `createStackTrace` wraps `ErrorStackParser.parse` in `try/catch`. Parser failures resolve to a single fallback frame instead of dropping the report.
22
-
23
- ### Internal
24
- - New `mapToV2Wire(report, config)` pure function in `src/api/mapToV2Wire.ts`.
25
- - New `glowsToEvents(glows)` helper in `src/util/glowsToEvents.ts`.
26
- - `Api.report()` signature changed from `(report, url, key, reportBrowserExtensionErrors)` to `(report, config)`. This is internal — it is not part of the package's public exports.
27
-
28
- ## 1.1.0
29
-
30
- Prior history is in git.
1
+ ## 2.0.0
2
+
3
+ ### Breaking changes
4
+
5
+ - **Endpoint changed.** SDK now POSTs to `https://ingress.flareapp.io/v1/errors`. Success response is `201 Created`. Auth header is `x-api-token`.
6
+ - **Wire format reshaped to match the server's canonical schema.**
7
+ - `Report` uses camelCase top-level fields (`exceptionClass`, `seenAtUnixNano`, `sourcemapVersionId`, `isLog`, `level`, `attributes`, `events`).
8
+ - `StackFrame` uses camelCase (`lineNumber`, `columnNumber`, `codeSnippet`, `isApplicationFrame`).
9
+ - `Context` is gone. User context is set via `addContext(name, value)` and `addContextGroup(group, value)`; both write into the flat `attributes` map under `context.custom` and `context.<group>`.
10
+ - Glows ride along as `php_glow`-typed entries in `events[]`.
11
+ - **`report()` second argument** is now an `Attributes` map (was a freeform context object). The third argument (solution provider parameters) is removed.
12
+ - **Config keys renamed:** `reportingUrl` `ingestUrl`, `sourcemapVersion` `sourcemapVersionId`.
13
+ - **Deprecated trailing setters removed:** `flare.beforeEvaluate = …`, `flare.beforeSubmit = …`, `flare.stage = …`. Use `flare.configure({ … })`.
14
+ - **`reportMessage` signature changed:** `reportMessage(message, level?, attributes?)`. The old `'Log INFO'` regex is gone, pass `level` directly.
15
+ - **Solutions API removed:** `registerSolutionProvider`, `Solution`, `SolutionProvider`, `SolutionProviderExtraParameters` are all deleted.
16
+ - **`flare.config` is now `Readonly<Config>`** and `flare.glows` is `readonly Glow[]`. Direct property mutation no longer works; use `configure()`.
17
+
18
+ ### New
19
+
20
+ - **URL redaction.** Sensitive query-string parameters (`password`, `token`, `secret`, `authorization`, etc.) are automatically replaced with `[redacted]` in `url.full`, `url.query`, and `flare.entry_point.value` attributes. Configurable via `urlDenylist` (custom regex) and `replaceDefaultUrlDenylist` (boolean) config options.
21
+ - `DEFAULT_URL_DENYLIST`, `redactFullPath`, and `resolveDenylist` are exported for direct use by framework adapters.
22
+ - `setEntryPoint({ identifier?, name?, type? })` — mutable global setter for the entry-point handler. SPA framework adapters call this on every navigation.
23
+ - `setSdkInfo({ name, version })` — overridable SDK identity (default `@flareapp/js` + client version). Integrations override it.
24
+ - `setFramework({ name, version? })` host framework attribution (e.g. React, Vue).
25
+ - `code` field auto-populated from `error.code` when present (string, ≤64 chars).
26
+ - Non-`Error` values passed to `report()` are coerced to `Error` instead of silently failing.
27
+ - Browser context attributes (`url.full`, `url.query`, `browser.user_agent`, `browser.viewport.*`, cookies, request data) are auto-collected on each report.
28
+ - New exported types: `SpanEvent`, `EntryPointHandler`, `Framework`, `SdkInfo`, `OverriddenGrouping`, `Attributes`, `AttributeValue`.
29
+ - **`sampleRate` config option.** Number between `0` and `1` (default `1`). Controls what fraction of errors are reported. Applies to `report()`, `reportMessage()`, and `reportUnhandledRejection()`.
30
+
31
+ ### Notes
32
+
33
+ - `seenAtUnixNano` is now real nanoseconds (`Date.now() * 1_000_000`).
package/README.md CHANGED
@@ -1,9 +1,30 @@
1
- # The JavaScript client for Flare to catch frontend errors
1
+ # @flareapp/js
2
2
 
3
- Read the JavaScript error tracking section in [the Flare documentation](https://flareapp.io/docs/javascript-error-tracking/installation) for more information.
3
+ The core JavaScript/TypeScript client for [Flare](https://flareapp.io) error tracking. Captures frontend errors, parses
4
+ stack traces, collects browser context, and reports everything to the Flare backend.
4
5
 
5
- React plugin: https://www.npmjs.com/package/@flareapp/react
6
+ ## Installation
6
7
 
7
- Vue plugin: https://www.npmjs.com/package/@flareapp/vue
8
+ ```bash
9
+ npm install @flareapp/js
10
+ ```
8
11
 
9
- Webpack plugin: https://www.npmjs.com/package/@flareapp/flare-webpack-plugin-sourcemap
12
+ ## Quick start
13
+
14
+ ```js
15
+ import { flare } from '@flareapp/js';
16
+
17
+ flare.light('YOUR_FLARE_API_KEY');
18
+ ```
19
+
20
+ That is all you need. The client automatically listens for uncaught exceptions and unhandled promise rejections,
21
+ collects browser context, and sends error reports to Flare.
22
+
23
+ ## Documentation
24
+
25
+ Full documentation on configuration, hooks, context, breadcrumbs, solution providers, and more is available
26
+ at [flareapp.io/docs/javascript/general/installation](https://flareapp.io/docs/javascript/general/installation).
27
+
28
+ ## License
29
+
30
+ The MIT License (MIT). Please see [License File](../../LICENSE.md) for more information.