@fixback/sdk-core 0.2.0 → 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.
Files changed (68) hide show
  1. package/README.md +28 -9
  2. package/{src/annotation.ts → dist/annotation.d.ts} +36 -47
  3. package/dist/anonymous-id.d.ts +23 -0
  4. package/dist/anonymous-id.js +39 -0
  5. package/dist/anonymous-id.js.map +1 -0
  6. package/dist/auto-capture.d.ts +129 -0
  7. package/dist/auto-capture.js +210 -0
  8. package/dist/auto-capture.js.map +1 -0
  9. package/{src/backoff.ts → dist/backoff.d.ts} +17 -52
  10. package/dist/boot.d.ts +148 -0
  11. package/dist/boot.js +113 -0
  12. package/dist/boot.js.map +1 -0
  13. package/dist/breadcrumb.d.ts +133 -0
  14. package/dist/connect.d.ts +110 -0
  15. package/dist/connect.js +147 -0
  16. package/dist/connect.js.map +1 -0
  17. package/dist/env.d.ts +37 -0
  18. package/dist/env.js +83 -0
  19. package/dist/env.js.map +1 -0
  20. package/dist/fingerprint.d.ts +39 -0
  21. package/dist/fingerprint.js +10 -15
  22. package/dist/fingerprint.js.map +1 -1
  23. package/dist/http.d.ts +51 -0
  24. package/dist/http.js +42 -0
  25. package/dist/http.js.map +1 -0
  26. package/dist/index.d.ts +28 -0
  27. package/dist/index.js +115 -3
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +1057 -0
  30. package/dist/index.mjs.map +7 -0
  31. package/dist/options.d.ts +82 -0
  32. package/dist/options.js +22 -0
  33. package/dist/options.js.map +1 -0
  34. package/dist/release.d.ts +19 -0
  35. package/dist/release.js +36 -0
  36. package/dist/release.js.map +1 -0
  37. package/dist/scrub.d.ts +62 -0
  38. package/dist/stack.d.ts +51 -0
  39. package/dist/stack.js +97 -0
  40. package/dist/stack.js.map +1 -0
  41. package/dist/trace/buffer.d.ts +121 -0
  42. package/dist/trace/buffer.js +230 -0
  43. package/dist/trace/buffer.js.map +1 -0
  44. package/dist/trace/console-args.d.ts +60 -0
  45. package/dist/trace/console-args.js +189 -0
  46. package/dist/trace/console-args.js.map +1 -0
  47. package/dist/trace/console.d.ts +42 -0
  48. package/dist/trace/console.js +71 -0
  49. package/dist/trace/console.js.map +1 -0
  50. package/dist/trace/crumbs.d.ts +88 -0
  51. package/dist/trace/crumbs.js +164 -0
  52. package/dist/trace/crumbs.js.map +1 -0
  53. package/dist/trace/source.d.ts +30 -0
  54. package/dist/trace/source.js +59 -0
  55. package/dist/trace/source.js.map +1 -0
  56. package/dist/version.d.ts +13 -0
  57. package/dist/version.js +17 -0
  58. package/dist/version.js.map +1 -0
  59. package/dist/wire.d.ts +101 -0
  60. package/package.json +12 -8
  61. package/src/backoff.test.ts +0 -94
  62. package/src/breadcrumb.ts +0 -169
  63. package/src/fingerprint.test.ts +0 -96
  64. package/src/fingerprint.ts +0 -112
  65. package/src/index.ts +0 -63
  66. package/src/scrub.test.ts +0 -215
  67. package/src/scrub.ts +0 -226
  68. package/src/wire.ts +0 -116
package/src/wire.ts DELETED
@@ -1,116 +0,0 @@
1
- /**
2
- * The shared **ingest wire shapes** (ADR-0028) — the value contract a captured
3
- * report carries to `POST /api/ingest/feedback`, shared by every Fixback capture
4
- * SDK so they all speak the same shape.
5
- *
6
- * Like the rest of the core these are runtime-agnostic value types: the browser
7
- * and (future) backend SDKs both assemble a {@link ReportContent} from what they
8
- * captured. Keep them in lock-step with the server: the JSON `payload` part the
9
- * ingest controller parses (`apps/api/src/ingest/ingest.controller.ts`) and the
10
- * `SubmissionContent` it maps to (`apps/api/src/ingest/reporter-identity.ts`).
11
- * Each SDK keeps vendoring its own transport envelope (ticket #47) — the core
12
- * carries the pure content shape, not the multipart envelope.
13
- */
14
-
15
- import type { Annotation } from "./annotation";
16
- import type { Breadcrumb } from "./breadcrumb";
17
-
18
- /**
19
- * Where a Feedback came from — a human in the overlay (`reporter`, the default) or
20
- * a runtime error the SDK captured (`error`, ADR-0025: covers both an uncaught
21
- * crash and a manual capture, on any runtime). Mirrors the server's
22
- * `FEEDBACK_SOURCES`; the server derives trust independently and ignores anything
23
- * else the client claims.
24
- */
25
- export type FeedbackSource = "reporter" | "error";
26
-
27
- /**
28
- * The **Platform** a Feedback was captured on (ADR-0025): `browser` (the web SDK),
29
- * `node` (the backend SDK), or `expo` (the mobile SDK). Additive — future runtimes
30
- * become new values. Mirrors the server's `PLATFORMS` (`@fixback/shared`) by value;
31
- * the server stamps it from the ingest route, so it is **not** carried on
32
- * {@link ReportContent} (the client never declares its own platform).
33
- */
34
- export type Platform = "browser" | "node" | "expo";
35
-
36
- /** The capture environment recorded alongside a report. */
37
- export interface CaptureEnvironment {
38
- readonly viewportWidth?: number;
39
- readonly viewportHeight?: number;
40
- readonly browser?: string;
41
- readonly sdkVersion?: string;
42
- /**
43
- * The host app's **Release** — the build identifier the builder configured at
44
- * `init` (#117, ADR-0024). Uploaded sourcemaps are keyed by it, so the server
45
- * can symbolicate this session's stack traces against the exact build that
46
- * produced them. Omitted when the Project doesn't set one.
47
- */
48
- readonly release?: string;
49
- }
50
-
51
- /**
52
- * One structured frame of a captured stack trace (#117, ADR-0024), top of stack
53
- * first — the server's `errorFrames` wire shape. `file` is the scrubbed script
54
- * URL; `line`/`column` are 1-based as browsers report them.
55
- */
56
- export interface CapturedFrame {
57
- readonly file: string;
58
- readonly line: number;
59
- readonly column: number | null;
60
- readonly function: string | null;
61
- }
62
-
63
- /**
64
- * The JSON content of a feedback submission — the object serialised into the
65
- * multipart `payload` part next to the `key` and identity evidence. Every field
66
- * is optional: none of it feeds the server's trust decision, so a submission may
67
- * carry any subset. `annotation` is the structured `{ element?, region?, marks? }`
68
- * (spec §D); the screenshot is a separate binary part, never part of this JSON.
69
- */
70
- export interface ReportContent {
71
- readonly comment?: string;
72
- /**
73
- * The Reporter's self-provided display **name / email** (spec §F), captured in the
74
- * invite onboarding step and riding along with every submission so a Member sees
75
- * who reported an Issue. **Display only, never a trust signal** — the server derives
76
- * the tier from identity evidence alone and ignores these. Omitted when the Reporter
77
- * gave none (a Public/anonymous visitor).
78
- */
79
- readonly reporterName?: string;
80
- readonly reporterEmail?: string;
81
- readonly url?: string;
82
- readonly environment?: CaptureEnvironment;
83
- readonly annotation?: Annotation;
84
- /** The masked breadcrumb trace buffer that rode on this report (spec §C). */
85
- readonly trace?: readonly Breadcrumb[];
86
- /**
87
- * Provenance (spec §D/§E). Omitted for a manual report — the transport stamps the
88
- * `reporter` default on the wire; set to `error` by the SDK's error capture.
89
- */
90
- readonly source?: FeedbackSource;
91
- /**
92
- * For `source: error` only — whether the error was **handled** (ADR-0025):
93
- * `false` = an uncaught crash, `true` = a manual capture. Set by the backend SDK
94
- * (`@fixback/node`), which distinguishes the two; the browser SDK captures only
95
- * uncaught errors and leaves it unset.
96
- */
97
- readonly handled?: boolean;
98
- /**
99
- * The deploy **Environment** the SDK was configured with (ADR-0025) —
100
- * `production` / `staging` / … — distinct from {@link CaptureEnvironment.release}
101
- * (a build version). Named apart from `environment` (the capture bag above) to
102
- * avoid the collision. Set by the backend SDK; unset by the browser SDK for now.
103
- */
104
- readonly deployEnvironment?: string;
105
- /** For `source: error` only — the SDK's per-session error fingerprint (spec §E). */
106
- readonly errorSignature?: string;
107
- /** For `source: error` only — the running occurrence count within the session (spec §E). */
108
- readonly occurrences?: number;
109
- /**
110
- * For `source: error` only — the captured error's parsed stack frames (#117,
111
- * ADR-0024), top of stack first, capped client-side. The analysis worker
112
- * matches them against the release's uploaded sourcemaps to write the Issue's
113
- * Code-area pointer.
114
- */
115
- readonly errorFrames?: readonly CapturedFrame[];
116
- }