@tumbaland/frontend-core 1.2.0 → 1.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.
package/dist/apiClient.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getCorrelationId, getSessionId } from '@tumbaland/components';
1
+ import { getCorrelationId, getSessionId } from './monitoring';
2
2
  function appendParams(path, params) {
3
3
  if (!params)
4
4
  return path;
@@ -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';
@@ -1,4 +1,4 @@
1
- import { getCorrelationId, getSessionId } from '@tumbaland/components';
1
+ import { getCorrelationId, getSessionId } from './monitoring';
2
2
  const AUTH_CACHE_TTL = 5 * 60 * 1000;
3
3
  function authHeaders() {
4
4
  return {
@@ -1,4 +1,4 @@
1
- import { getCorrelationId, getSessionId } from '@tumbaland/components';
1
+ import { getCorrelationId, getSessionId } from './monitoring';
2
2
  function groupHeaders() {
3
3
  return {
4
4
  'Content-Type': 'application/json',
package/dist/index.d.ts CHANGED
@@ -5,3 +5,5 @@ export type { AuthServiceConfig, AuthService } from './authService';
5
5
  export { createGroupService } from './groupService';
6
6
  export type { GroupServiceConfig, GroupService } from './groupService';
7
7
  export type { User, AuthResponse, Group, ApiResponse } from './types';
8
+ export { initMonitoring, captureException, captureMessage, setUser, setTag, startTransaction, recordMetric, initWebVitals, flushLogs, initConsoleInterception, generateCorrelationId, getCorrelationId, getSessionId, logger } from './monitoring';
9
+ export type { MonitoringConfig } from './monitoring';
package/dist/index.js CHANGED
@@ -2,3 +2,5 @@
2
2
  export { createApiClient, ApiError } from './apiClient';
3
3
  export { createAuthService } from './authService';
4
4
  export { createGroupService } from './groupService';
5
+ // Monitoring: headless logging, error capture, correlation IDs, and web-vitals
6
+ export { initMonitoring, captureException, captureMessage, setUser, setTag, startTransaction, recordMetric, initWebVitals, flushLogs, initConsoleInterception, generateCorrelationId, getCorrelationId, getSessionId, logger } from './monitoring';
@@ -0,0 +1,2 @@
1
+ export declare const queueLog: (logData: any) => void;
2
+ export declare const flushLogs: () => Promise<void>;
@@ -0,0 +1,89 @@
1
+ // Batch logging system for efficient log transmission
2
+ import { getMonitoringConfig } from './config';
3
+ // Log batching for better performance
4
+ let logBatch = [];
5
+ let batchTimeout = null;
6
+ const BATCH_SIZE = 10;
7
+ const BATCH_INTERVAL = 5000; // 5 seconds
8
+ // Send batched logs
9
+ const sendBatch = async () => {
10
+ if (logBatch.length === 0)
11
+ return;
12
+ const config = getMonitoringConfig();
13
+ if (!config.elkUrl)
14
+ return;
15
+ const batchToSend = [...logBatch];
16
+ logBatch = [];
17
+ try {
18
+ const response = await fetch(config.elkUrl, {
19
+ method: 'POST',
20
+ headers: {
21
+ 'Content-Type': 'application/json',
22
+ },
23
+ body: JSON.stringify(batchToSend),
24
+ });
25
+ if (!response.ok) {
26
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
27
+ }
28
+ }
29
+ catch (error) {
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.
33
+ const originalWarn = console.warn;
34
+ console.warn = () => { }; // Temporarily disable console.warn
35
+ try {
36
+ originalWarn('Failed to send log batch, dropping logs:', error);
37
+ // Optional: log failed batch to console in development
38
+ if (config.isDevelopment) {
39
+ batchToSend.forEach(log => {
40
+ originalWarn('📝 [DROPPED LOG]:', JSON.stringify(log));
41
+ });
42
+ }
43
+ }
44
+ finally {
45
+ console.warn = originalWarn; // Restore original console.warn
46
+ }
47
+ }
48
+ };
49
+ // Queue log for batching
50
+ export const queueLog = (logData) => {
51
+ logBatch.push(logData);
52
+ // Send immediately if batch is full
53
+ if (logBatch.length >= BATCH_SIZE) {
54
+ if (batchTimeout) {
55
+ clearTimeout(batchTimeout);
56
+ batchTimeout = null;
57
+ }
58
+ sendBatch();
59
+ return;
60
+ }
61
+ // Schedule batch send
62
+ if (!batchTimeout) {
63
+ batchTimeout = setTimeout(() => {
64
+ batchTimeout = null;
65
+ sendBatch();
66
+ }, BATCH_INTERVAL);
67
+ }
68
+ };
69
+ // Flush logs before page unload
70
+ export const flushLogs = async () => {
71
+ if (batchTimeout) {
72
+ clearTimeout(batchTimeout);
73
+ batchTimeout = null;
74
+ }
75
+ await sendBatch();
76
+ };
77
+ // Set up page unload handler
78
+ if (typeof window !== 'undefined') {
79
+ window.addEventListener('beforeunload', () => {
80
+ // Synchronous flush for critical logs - use sendBeacon for reliable delivery during page unload
81
+ const config = getMonitoringConfig();
82
+ if (logBatch.length > 0 && navigator.sendBeacon && config.elkUrl) {
83
+ // Use sendBeacon for reliable delivery during page unload
84
+ const blob = new Blob([JSON.stringify(logBatch)], { type: 'application/json' });
85
+ navigator.sendBeacon(config.elkUrl, blob);
86
+ logBatch = [];
87
+ }
88
+ });
89
+ }
@@ -0,0 +1,16 @@
1
+ export interface MonitoringConfig {
2
+ isDevelopment: boolean;
3
+ service: string;
4
+ component: string;
5
+ elkUrl?: string;
6
+ captureConsoleLevels?: ('debug' | 'info' | 'warn' | 'error')[];
7
+ }
8
+ export declare const isInterceptingConsole: () => boolean;
9
+ export declare const getMonitoringConfig: () => MonitoringConfig;
10
+ export declare const updateMonitoringConfig: (config: Partial<MonitoringConfig>) => void;
11
+ export declare const initMonitoring: (environment?: string, options?: {
12
+ service?: string;
13
+ component?: string;
14
+ elkUrl?: string;
15
+ captureConsoleLevels?: ("debug" | "info" | "warn" | "error")[];
16
+ }) => void;
@@ -0,0 +1,53 @@
1
+ // Global monitoring configuration
2
+ let monitoringConfig = {
3
+ isDevelopment: false,
4
+ service: 'frontend',
5
+ component: 'frontend'
6
+ };
7
+ // Flag to prevent recursive console interception
8
+ export const isInterceptingConsole = () => {
9
+ return typeof window !== 'undefined' && window._monitoringInterceptingConsole === true;
10
+ };
11
+ // Get current monitoring configuration
12
+ export const getMonitoringConfig = () => monitoringConfig;
13
+ // Update monitoring configuration
14
+ export const updateMonitoringConfig = (config) => {
15
+ monitoringConfig = { ...monitoringConfig, ...config };
16
+ };
17
+ // Initialize local monitoring (no remote services)
18
+ export const initMonitoring = (environment = 'development', options = {}) => {
19
+ const { service = 'frontend', component = 'frontend', elkUrl, captureConsoleLevels = ['error', 'warn'] // Default to error and warn only
20
+ } = options;
21
+ // Update global config
22
+ updateMonitoringConfig({
23
+ isDevelopment: environment === 'development',
24
+ service,
25
+ component,
26
+ elkUrl
27
+ });
28
+ console.log(`📊 Local monitoring initialized (${environment} mode) for ${service}/${component}`);
29
+ console.log(`📝 Console interception enabled for levels: ${captureConsoleLevels.join(', ')}`);
30
+ // Initialize console interception and error handlers after modules are loaded
31
+ Promise.all([
32
+ import('./console'),
33
+ import('./errors')
34
+ ]).then(([{ initConsoleInterception }, { captureException, captureMessage }]) => {
35
+ // Initialize console interception with capture function
36
+ initConsoleInterception(captureConsoleLevels, captureMessage);
37
+ // Set up global error handlers
38
+ if (typeof window !== 'undefined') {
39
+ window.addEventListener('error', (event) => {
40
+ captureException(event.error || new Error(event.message), {
41
+ filename: event.filename,
42
+ lineno: event.lineno,
43
+ colno: event.colno
44
+ });
45
+ });
46
+ window.addEventListener('unhandledrejection', (event) => {
47
+ captureException(new Error(`Unhandled promise rejection: ${event.reason}`), {
48
+ type: 'unhandledrejection'
49
+ });
50
+ });
51
+ }
52
+ });
53
+ };
@@ -0,0 +1,3 @@
1
+ type CaptureMessageFn = (message: string, level: 'debug' | 'info' | 'warn' | 'error', context?: any) => void;
2
+ export declare const initConsoleInterception: (captureConsoleLevels?: ("debug" | "info" | "warn" | "error")[], captureMessageFn?: CaptureMessageFn) => void;
3
+ export {};
@@ -0,0 +1,40 @@
1
+ // Console interception for automatic log capture
2
+ import { isInterceptingConsole } from './config';
3
+ // Initialize console interception
4
+ export const initConsoleInterception = (captureConsoleLevels = ['error', 'warn'], captureMessageFn) => {
5
+ // If no capture function provided, skip interception
6
+ if (!captureMessageFn)
7
+ return;
8
+ // Helper function to conditionally intercept console methods
9
+ const interceptConsole = (methodName, level) => {
10
+ if (!captureConsoleLevels.includes(level))
11
+ return;
12
+ const originalMethod = console[methodName];
13
+ console[methodName] = (...args) => {
14
+ // Call original console method
15
+ originalMethod.apply(console, args);
16
+ // Prevent recursive interception by checking the global flag
17
+ if (isInterceptingConsole())
18
+ return;
19
+ // Send to logging API with recursion protection
20
+ try {
21
+ const message = args.map(arg => typeof arg === 'object' ? JSON.stringify(arg) : String(arg)).join(' ');
22
+ // Set interception flag to prevent recursion during capture
23
+ window._monitoringInterceptingConsole = true;
24
+ captureMessageFn(message, level, {
25
+ source: `console.${methodName}`,
26
+ args: args
27
+ });
28
+ }
29
+ finally {
30
+ window._monitoringInterceptingConsole = false;
31
+ }
32
+ };
33
+ };
34
+ // Intercept console methods based on configuration
35
+ interceptConsole('error', 'error');
36
+ interceptConsole('warn', 'warn');
37
+ interceptConsole('log', 'info');
38
+ interceptConsole('info', 'info');
39
+ interceptConsole('debug', 'debug');
40
+ };
@@ -0,0 +1,12 @@
1
+ export declare const captureException: (error: Error, context?: any, options?: {
2
+ isDevelopment?: boolean;
3
+ service?: string;
4
+ component?: string;
5
+ elkUrl?: string;
6
+ }) => Promise<void>;
7
+ export declare const captureMessage: (message: string, level?: "debug" | "info" | "warn" | "error", context?: any, options?: {
8
+ isDevelopment?: boolean;
9
+ service?: string;
10
+ component?: string;
11
+ elkUrl?: string;
12
+ }) => Promise<void>;
@@ -0,0 +1,67 @@
1
+ // Error and message tracking
2
+ import { getMonitoringConfig, isInterceptingConsole } from './config';
3
+ import { queueLog } from './batch';
4
+ import { getCorrelationId, getSessionId } from './utils';
5
+ // Error tracking with local ELK logging
6
+ export const captureException = async (error, context, options = {}) => {
7
+ const config = { ...getMonitoringConfig(), ...options };
8
+ const errorData = {
9
+ timestamp: new Date().toISOString(),
10
+ level: 'error',
11
+ service: config.service,
12
+ component: config.component,
13
+ message: error.message,
14
+ stack: error.stack,
15
+ userAgent: typeof navigator !== 'undefined' ? navigator.userAgent : undefined,
16
+ url: typeof window !== 'undefined' ? window.location.href : undefined,
17
+ context: context || {},
18
+ correlationId: getCorrelationId(),
19
+ sessionId: getSessionId()
20
+ };
21
+ // Always log to console for development
22
+ if (config.isDevelopment) {
23
+ const originalIsIntercepting = isInterceptingConsole();
24
+ window._monitoringInterceptingConsole = true;
25
+ try {
26
+ console.error('🚨 Frontend Error:', errorData);
27
+ }
28
+ finally {
29
+ window._monitoringInterceptingConsole = originalIsIntercepting;
30
+ }
31
+ }
32
+ // Send to local ELK stack if available (batched)
33
+ if (config.elkUrl) {
34
+ queueLog(errorData);
35
+ }
36
+ };
37
+ export const captureMessage = async (message, level = 'info', context, options = {}) => {
38
+ const config = { ...getMonitoringConfig(), ...options };
39
+ const logData = {
40
+ timestamp: new Date().toISOString(),
41
+ level: level.toLowerCase(),
42
+ service: config.service,
43
+ component: config.component,
44
+ message,
45
+ url: typeof window !== 'undefined' ? window.location.href : undefined,
46
+ userAgent: typeof navigator !== 'undefined' ? navigator.userAgent : undefined,
47
+ context: context || {},
48
+ correlationId: getCorrelationId(),
49
+ sessionId: getSessionId()
50
+ };
51
+ // Always log to console for development
52
+ if (config.isDevelopment) {
53
+ const originalIsIntercepting = isInterceptingConsole();
54
+ window._monitoringInterceptingConsole = true;
55
+ try {
56
+ const logLevel = level.toUpperCase();
57
+ console.log(`[${logLevel}] ${message}`, context || '');
58
+ }
59
+ finally {
60
+ window._monitoringInterceptingConsole = originalIsIntercepting;
61
+ }
62
+ }
63
+ // Send to local ELK stack if available (batched)
64
+ if (config.elkUrl) {
65
+ queueLog(logData);
66
+ }
67
+ };
@@ -0,0 +1,9 @@
1
+ export { initMonitoring } from './config';
2
+ export { captureException, captureMessage } from './errors';
3
+ export { setUser, setTag } from './performance';
4
+ export { startTransaction, recordMetric, initWebVitals } from './performance';
5
+ export { flushLogs } from './batch';
6
+ export { initConsoleInterception } from './console';
7
+ export { generateCorrelationId, getCorrelationId, getSessionId } from './utils';
8
+ export { logger } from './logger';
9
+ export type { MonitoringConfig } from './config';
@@ -0,0 +1,17 @@
1
+ // Main monitoring exports - modular architecture
2
+ // Configuration and initialization
3
+ export { initMonitoring } from './config';
4
+ // Error and message tracking
5
+ export { captureException, captureMessage } from './errors';
6
+ // User and tag tracking
7
+ export { setUser, setTag } from './performance';
8
+ // Performance monitoring
9
+ export { startTransaction, recordMetric, initWebVitals } from './performance';
10
+ // Batch logging utilities
11
+ export { flushLogs } from './batch';
12
+ // Console interception (for advanced usage)
13
+ export { initConsoleInterception } from './console';
14
+ // Correlation ID utilities
15
+ export { generateCorrelationId, getCorrelationId, getSessionId } from './utils';
16
+ // Small ergonomic logger wrapping captureMessage/captureException
17
+ export { logger } from './logger';
@@ -0,0 +1,6 @@
1
+ export declare const logger: {
2
+ debug: (message: string, context?: Record<string, unknown>) => Promise<void>;
3
+ info: (message: string, context?: Record<string, unknown>) => Promise<void>;
4
+ warn: (message: string, context?: Record<string, unknown>) => Promise<void>;
5
+ error: (message: string, error?: unknown, context?: Record<string, unknown>) => void;
6
+ };
@@ -0,0 +1,18 @@
1
+ // Small frontend logger — routes through the same captureMessage/captureException
2
+ // pipeline as console interception, but as an explicit call so it's captured
3
+ // regardless of the per-app captureConsoleLevels configuration (which usually only
4
+ // intercepts 'error'/'warn'), and carries structured context instead of a string blob.
5
+ import { captureException, captureMessage } from './errors';
6
+ export const logger = {
7
+ debug: (message, context) => captureMessage(message, 'debug', context),
8
+ info: (message, context) => captureMessage(message, 'info', context),
9
+ warn: (message, context) => captureMessage(message, 'warn', context),
10
+ error: (message, error, context) => {
11
+ if (error instanceof Error) {
12
+ captureException(error, { message, ...context });
13
+ }
14
+ else {
15
+ captureMessage(message, 'error', error !== undefined ? { error, ...context } : context);
16
+ }
17
+ }
18
+ };
@@ -0,0 +1,24 @@
1
+ export declare const setUser: (user: {
2
+ id: string;
3
+ email?: string;
4
+ username?: string;
5
+ }, options?: {
6
+ isDevelopment?: boolean;
7
+ }) => void;
8
+ export declare const setTag: (key: string, value: string, options?: {
9
+ isDevelopment?: boolean;
10
+ }) => void;
11
+ export declare const startTransaction: (name: string, op: string, options?: {
12
+ isDevelopment?: boolean;
13
+ }) => {
14
+ finish: () => void;
15
+ };
16
+ export declare const recordMetric: (name: string, value: number | {
17
+ value: number;
18
+ id?: string;
19
+ }, unit?: string, options?: {
20
+ isDevelopment?: boolean;
21
+ }) => void;
22
+ export declare const initWebVitals: (options?: {
23
+ isDevelopment?: boolean;
24
+ }) => Promise<void>;
@@ -0,0 +1,118 @@
1
+ // Performance monitoring utilities
2
+ import { getMonitoringConfig, isInterceptingConsole } from './config';
3
+ // Web vitals will be loaded dynamically
4
+ let webVitals = null;
5
+ // User tracking (local storage only)
6
+ export const setUser = (user, options = {}) => {
7
+ const config = { ...getMonitoringConfig(), ...options };
8
+ if (config.isDevelopment) {
9
+ const originalIsIntercepting = isInterceptingConsole();
10
+ window._monitoringInterceptingConsole = true;
11
+ try {
12
+ console.log('👤 User set:', user);
13
+ }
14
+ finally {
15
+ window._monitoringInterceptingConsole = originalIsIntercepting;
16
+ }
17
+ }
18
+ // Could store in localStorage for persistence if needed
19
+ };
20
+ export const setTag = (key, value, options = {}) => {
21
+ const config = { ...getMonitoringConfig(), ...options };
22
+ if (config.isDevelopment) {
23
+ const originalIsIntercepting = isInterceptingConsole();
24
+ window._monitoringInterceptingConsole = true;
25
+ try {
26
+ console.log(`🏷️ Tag set: ${key} = ${value}`);
27
+ }
28
+ finally {
29
+ window._monitoringInterceptingConsole = originalIsIntercepting;
30
+ }
31
+ }
32
+ // Store tags locally if needed for context
33
+ };
34
+ // Performance monitoring utilities (local only)
35
+ export const startTransaction = (name, op, options = {}) => {
36
+ const config = { ...getMonitoringConfig(), ...options };
37
+ const startTime = Date.now();
38
+ if (config.isDevelopment) {
39
+ const originalIsIntercepting = isInterceptingConsole();
40
+ window._monitoringInterceptingConsole = true;
41
+ try {
42
+ console.log(`⏱️ Transaction started: ${name} (${op})`);
43
+ }
44
+ finally {
45
+ window._monitoringInterceptingConsole = originalIsIntercepting;
46
+ }
47
+ }
48
+ return {
49
+ finish: () => {
50
+ const duration = Date.now() - startTime;
51
+ recordMetric(`${name}_duration`, duration, 'ms', { isDevelopment: config.isDevelopment });
52
+ if (config.isDevelopment) {
53
+ const originalIsIntercepting = isInterceptingConsole();
54
+ window._monitoringInterceptingConsole = true;
55
+ try {
56
+ console.log(`✅ Transaction finished: ${name} (${duration}ms)`);
57
+ }
58
+ finally {
59
+ window._monitoringInterceptingConsole = originalIsIntercepting;
60
+ }
61
+ }
62
+ }
63
+ };
64
+ };
65
+ export const recordMetric = (name, value, unit = 'ms', options = {}) => {
66
+ const config = { ...getMonitoringConfig(), ...options };
67
+ // Handle both number and metric object formats
68
+ const metricValue = typeof value === 'number' ? value : value.value;
69
+ // Always log to console for development with better formatting
70
+ if (config.isDevelopment) {
71
+ const originalIsIntercepting = isInterceptingConsole();
72
+ window._monitoringInterceptingConsole = true;
73
+ try {
74
+ const formattedValue = unit === 'ms' ? `${metricValue.toFixed(2)}ms` : `${metricValue}${unit}`;
75
+ console.log(`📊 Performance: ${name} = ${formattedValue}`);
76
+ }
77
+ finally {
78
+ window._monitoringInterceptingConsole = originalIsIntercepting;
79
+ }
80
+ }
81
+ // Note: Sentry performance measurement removed due to API changes
82
+ // Can be re-added when Sentry API is updated
83
+ };
84
+ // Basic performance observer for web vitals
85
+ export const initWebVitals = async (options = {}) => {
86
+ const config = { ...getMonitoringConfig(), ...options };
87
+ if (config.isDevelopment) {
88
+ const originalIsIntercepting = isInterceptingConsole();
89
+ window._monitoringInterceptingConsole = true;
90
+ try {
91
+ console.log('📊 Web Vitals monitoring initialized (development mode)');
92
+ }
93
+ finally {
94
+ window._monitoringInterceptingConsole = originalIsIntercepting;
95
+ }
96
+ try {
97
+ // Dynamic import of web-vitals
98
+ const webVitalsModule = await import('web-vitals');
99
+ webVitals = webVitalsModule;
100
+ // Use the new web-vitals API (v5+)
101
+ webVitals.onCLS((metric) => recordMetric('CLS', metric, 'unitless', { isDevelopment: config.isDevelopment }));
102
+ webVitals.onFCP((metric) => recordMetric('FCP', metric, 'ms', { isDevelopment: config.isDevelopment }));
103
+ webVitals.onLCP((metric) => recordMetric('LCP', metric, 'ms', { isDevelopment: config.isDevelopment }));
104
+ webVitals.onTTFB((metric) => recordMetric('TTFB', metric, 'ms', { isDevelopment: config.isDevelopment }));
105
+ // Note: FID is deprecated in web-vitals v5
106
+ }
107
+ catch (e) {
108
+ const originalIsIntercepting = isInterceptingConsole();
109
+ window._monitoringInterceptingConsole = true;
110
+ try {
111
+ console.warn('Web Vitals library not available - install web-vitals package');
112
+ }
113
+ finally {
114
+ window._monitoringInterceptingConsole = originalIsIntercepting;
115
+ }
116
+ }
117
+ }
118
+ };
@@ -0,0 +1,3 @@
1
+ export declare const generateCorrelationId: () => string;
2
+ export declare const getSessionId: () => string;
3
+ export declare const getCorrelationId: () => string;
@@ -0,0 +1,25 @@
1
+ // Utility functions for monitoring
2
+ // Generate correlation ID using crypto.randomUUID()
3
+ export const generateCorrelationId = () => {
4
+ return crypto.randomUUID();
5
+ };
6
+ // Get or create a session ID (persistent across the user's session)
7
+ let sessionId = null;
8
+ export const getSessionId = () => {
9
+ if (!sessionId) {
10
+ sessionId = generateCorrelationId();
11
+ }
12
+ return sessionId;
13
+ };
14
+ // Get correlation ID from server-set meta tag or generate request-specific ID
15
+ export const getCorrelationId = () => {
16
+ // Try to get from server-set meta tag first (proxy-generated)
17
+ if (typeof document !== 'undefined') {
18
+ const metaTag = document.querySelector('meta[name="x-correlation-id"]');
19
+ if (metaTag && metaTag.getAttribute('content')) {
20
+ return metaTag.getAttribute('content');
21
+ }
22
+ }
23
+ // Fallback: generate per-request correlation ID
24
+ return generateCorrelationId();
25
+ };
@@ -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.0",
3
+ "version": "1.3.0",
4
4
  "description": "Shared frontend auth/group/API-client logic for Tumbaland frontends",
5
5
  "author": "Tumbaland",
6
6
  "license": "MIT",
@@ -14,14 +14,16 @@
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
  },
20
21
  "dependencies": {
21
- "@tumbaland/components": "*"
22
+ "web-vitals": "^5.3.0"
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
  }