@tumbaland/frontend-core 1.2.1 → 1.3.1

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/dist/apiClient.js CHANGED
@@ -14,6 +14,8 @@ function appendParams(path, params) {
14
14
  return `${path}${path.includes('?') ? '&' : '?'}${query}`;
15
15
  }
16
16
  export class ApiError extends Error {
17
+ status;
18
+ body;
17
19
  constructor(status, message, body) {
18
20
  super(message);
19
21
  this.name = 'ApiError';
@@ -27,15 +27,17 @@ const sendBatch = async () => {
27
27
  }
28
28
  }
29
29
  catch (error) {
30
- // Log error without triggering console interception to prevent recursion
30
+ // Log error without triggering console interception to prevent recursion.
31
+ // Must call originalWarn (not console.warn) below — console.warn is the
32
+ // no-op we're about to install for the duration of this block.
31
33
  const originalWarn = console.warn;
32
34
  console.warn = () => { }; // Temporarily disable console.warn
33
35
  try {
34
- console.warn('Failed to send log batch, dropping logs:', error);
36
+ originalWarn('Failed to send log batch, dropping logs:', error);
35
37
  // Optional: log failed batch to console in development
36
38
  if (config.isDevelopment) {
37
39
  batchToSend.forEach(log => {
38
- console.warn('📝 [DROPPED LOG]:', JSON.stringify(log));
40
+ originalWarn('📝 [DROPPED LOG]:', JSON.stringify(log));
39
41
  });
40
42
  }
41
43
  }
@@ -2,9 +2,7 @@
2
2
  // This jsdom environment doesn't provide a working localStorage (window.localStorage
3
3
  // is undefined here) — polyfill it with a simple in-memory Storage.
4
4
  class MemoryStorage {
5
- constructor() {
6
- this.store = new Map();
7
- }
5
+ store = new Map();
8
6
  get length() {
9
7
  return this.store.size;
10
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tumbaland/frontend-core",
3
- "version": "1.2.1",
3
+ "version": "1.3.1",
4
4
  "description": "Shared frontend auth/group/API-client logic for Tumbaland frontends",
5
5
  "author": "Tumbaland",
6
6
  "license": "MIT",
@@ -10,10 +10,11 @@
10
10
  "dist"
11
11
  ],
12
12
  "scripts": {
13
- "build": "tsc",
13
+ "build": "tsc -p tsconfig.build.json",
14
14
  "release": "standard-version && npm run build && npm publish --access public",
15
15
  "release:beta": "standard-version --prerelease beta && npm run build && npm publish --access public --tag beta",
16
16
  "test": "vitest run",
17
+ "test:coverage": "vitest run --coverage",
17
18
  "lint": "eslint .",
18
19
  "typecheck": "tsc --noEmit"
19
20
  },
@@ -22,6 +23,7 @@
22
23
  },
23
24
  "devDependencies": {
24
25
  "@types/node": "^26.1.0",
26
+ "@vitest/coverage-v8": "^4.1.10",
25
27
  "standard-version": "^9.5.0",
26
28
  "typescript": "^6.0.3"
27
29
  }