@bugmail-js/core 0.1.5 → 0.1.6

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/LICENSE CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  MIT License
2
3
 
3
4
  Copyright (c) 2025 MarcorpAI
package/README.md CHANGED
@@ -29,7 +29,7 @@ const client = new BugMailCoreClient({
29
29
  });
30
30
 
31
31
  await client.captureException(new Error('Test error'), {
32
- headers: { 'X-Bugmail-Api-Key': 'YOUR_PROJECT_API_KEY' },
32
+ headers: { 'x-bugmail-api-key': 'YOUR_PROJECT_API_KEY' },
33
33
  payload: {
34
34
  error: { name: 'Error', message: 'Test error', stack: '...' },
35
35
  context: { url: '/test', environment: 'development' }
@@ -47,7 +47,7 @@ API reference (important parts)
47
47
  - `captureException(error, context)`
48
48
  - `error` — Error object or any serializable value
49
49
  - `context` — optional object: `{ headers, payload, user, breadcrumbs }`
50
- - Include `headers: { 'X-Bugmail-Api-Key': '<YOUR_PROJECT_API_KEY>' }`
50
+ - Include `headers: { 'x-bugmail-api-key': '<YOUR_PROJECT_API_KEY>' }`
51
51
 
52
52
  - `BreadcrumbTracker`
53
53
  - `new BreadcrumbTracker({ maxBreadcrumbs })`
@@ -67,7 +67,8 @@ Integration notes
67
67
  Backend integration & headers
68
68
 
69
69
  - Ingestion endpoint: `POST {baseUrl}/api/sdk/v1/errors`
70
- - Auth header: `x-bugmail-api-key: <YOUR_PROJECT_API_KEY>` (case-insensitive)
70
+ - Auth header: `x-bugmail-api-key: <YOUR_PROJECT_API_KEY>`
71
+ - Note: HTTP header names are case-insensitive; use the canonical lowercase form above for consistency.
71
72
  - Typical payload shape:
72
73
 
73
74
  ```
@@ -40,10 +40,10 @@ export class BugMailCoreClient {
40
40
  if (!fetchFn) {
41
41
  // In Node environments where fetch is not global, try dynamic import at runtime only
42
42
  try {
43
- // Use require-like dynamic import only in Node; bundlers should not include node-fetch for browser builds
44
- if (typeof process !== 'undefined' && process.versions && process.versions.node) {
45
- // Construct the module name at runtime to avoid bundlers statically
46
- // resolving/including `node-fetch` in browser builds (Vite/Rollup).
43
+ // Check if we're actually in Node.js (not a browser with process polyfill)
44
+ // typeof window === 'undefined' is a reliable check for Node vs Browser
45
+ if (typeof window === 'undefined' && typeof process !== 'undefined' && process.versions && process.versions.node) {
46
+ // Only import node-fetch in actual Node.js environments
47
47
  const nodeFetchName = 'node' + '-fetch';
48
48
  fetchFn = (await import(nodeFetchName)).default;
49
49
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bugmail-js/core",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "exports": {