hvp-shared 2.0.1 → 2.1.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/index.d.ts CHANGED
@@ -5,3 +5,4 @@
5
5
  export * from './types';
6
6
  export * from './constants';
7
7
  export * from './validation';
8
+ export { debugLog } from './utils/debug-logger';
package/dist/index.js CHANGED
@@ -18,6 +18,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
18
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.debugLog = void 0;
21
22
  __exportStar(require("./types"), exports);
22
23
  __exportStar(require("./constants"), exports);
23
24
  __exportStar(require("./validation"), exports);
25
+ var debug_logger_1 = require("./utils/debug-logger");
26
+ Object.defineProperty(exports, "debugLog", { enumerable: true, get: function () { return debug_logger_1.debugLog; } });
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Debug Logger for Shared Code
3
+ *
4
+ * Simple console.log wrapper - shared code is pure, no persistence needed.
5
+ * For full debugging with persistence, use the debugLog from backend or frontend.
6
+ *
7
+ * Enable in Node: DEBUG_LOG_ENABLED=true
8
+ * Enable in Browser: localStorage.setItem('DEBUG_LOG_ENABLED', 'true')
9
+ *
10
+ * @example
11
+ * import { debugLog } from 'hvp-shared';
12
+ *
13
+ * function validateRFC(value: string) {
14
+ * debugLog('validateRFC', { value }, 'input');
15
+ * // ... validation logic
16
+ * }
17
+ */
18
+ /**
19
+ * Log debug data (sync, console.log only)
20
+ */
21
+ export declare function debugLog(functionName: string, data: unknown, context?: string): void;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ /**
3
+ * Debug Logger for Shared Code
4
+ *
5
+ * Simple console.log wrapper - shared code is pure, no persistence needed.
6
+ * For full debugging with persistence, use the debugLog from backend or frontend.
7
+ *
8
+ * Enable in Node: DEBUG_LOG_ENABLED=true
9
+ * Enable in Browser: localStorage.setItem('DEBUG_LOG_ENABLED', 'true')
10
+ *
11
+ * @example
12
+ * import { debugLog } from 'hvp-shared';
13
+ *
14
+ * function validateRFC(value: string) {
15
+ * debugLog('validateRFC', { value }, 'input');
16
+ * // ... validation logic
17
+ * }
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.debugLog = debugLog;
21
+ /**
22
+ * Check if debug logging is enabled
23
+ */
24
+ function isEnabled() {
25
+ // Node.js
26
+ if (typeof process !== 'undefined' && process.env) {
27
+ return process.env.DEBUG_LOG_ENABLED === 'true';
28
+ }
29
+ // Browser
30
+ if (typeof localStorage !== 'undefined') {
31
+ try {
32
+ return localStorage.getItem('DEBUG_LOG_ENABLED') === 'true';
33
+ }
34
+ catch {
35
+ return false;
36
+ }
37
+ }
38
+ return false;
39
+ }
40
+ /**
41
+ * Log debug data (sync, console.log only)
42
+ */
43
+ function debugLog(functionName, data, context = 'default') {
44
+ if (!isEnabled())
45
+ return;
46
+ const time = new Date().toISOString().slice(11, 23);
47
+ console.log(`[DEBUG ${time}] ${functionName} (${context})`, data);
48
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "2.0.1",
3
+ "version": "2.1.1",
4
4
  "description": "Shared types and utilities for HVP backend and frontend",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",