@enactprotocol/shared 2.0.0 → 2.0.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.
Files changed (88) hide show
  1. package/dist/config.d.ts +164 -0
  2. package/dist/config.d.ts.map +1 -0
  3. package/dist/config.js +386 -0
  4. package/dist/config.js.map +1 -0
  5. package/dist/constants.d.ts +17 -0
  6. package/dist/constants.d.ts.map +1 -0
  7. package/dist/constants.js +26 -0
  8. package/dist/constants.js.map +1 -0
  9. package/dist/execution/command.d.ts +102 -0
  10. package/dist/execution/command.d.ts.map +1 -0
  11. package/dist/execution/command.js +262 -0
  12. package/dist/execution/command.js.map +1 -0
  13. package/dist/execution/index.d.ts +12 -0
  14. package/dist/execution/index.d.ts.map +1 -0
  15. package/dist/execution/index.js +17 -0
  16. package/dist/execution/index.js.map +1 -0
  17. package/dist/execution/runtime.d.ts +82 -0
  18. package/dist/execution/runtime.d.ts.map +1 -0
  19. package/dist/execution/runtime.js +273 -0
  20. package/dist/execution/runtime.js.map +1 -0
  21. package/dist/execution/types.d.ts +306 -0
  22. package/dist/execution/types.d.ts.map +1 -0
  23. package/dist/execution/types.js +14 -0
  24. package/dist/execution/types.js.map +1 -0
  25. package/dist/execution/validation.d.ts +43 -0
  26. package/dist/execution/validation.d.ts.map +1 -0
  27. package/dist/execution/validation.js +430 -0
  28. package/dist/execution/validation.js.map +1 -0
  29. package/dist/index.d.ts +21 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +49 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/manifest/index.d.ts +7 -0
  34. package/dist/manifest/index.d.ts.map +1 -0
  35. package/dist/manifest/index.js +10 -0
  36. package/dist/manifest/index.js.map +1 -0
  37. package/dist/manifest/loader.d.ts +76 -0
  38. package/dist/manifest/loader.d.ts.map +1 -0
  39. package/dist/manifest/loader.js +146 -0
  40. package/dist/manifest/loader.js.map +1 -0
  41. package/dist/manifest/parser.d.ts +64 -0
  42. package/dist/manifest/parser.d.ts.map +1 -0
  43. package/dist/manifest/parser.js +135 -0
  44. package/dist/manifest/parser.js.map +1 -0
  45. package/dist/manifest/validator.d.ts +95 -0
  46. package/dist/manifest/validator.d.ts.map +1 -0
  47. package/dist/manifest/validator.js +258 -0
  48. package/dist/manifest/validator.js.map +1 -0
  49. package/dist/paths.d.ts +57 -0
  50. package/dist/paths.d.ts.map +1 -0
  51. package/dist/paths.js +93 -0
  52. package/dist/paths.js.map +1 -0
  53. package/dist/registry.d.ts +73 -0
  54. package/dist/registry.d.ts.map +1 -0
  55. package/dist/registry.js +147 -0
  56. package/dist/registry.js.map +1 -0
  57. package/dist/resolver.d.ts +89 -0
  58. package/dist/resolver.d.ts.map +1 -0
  59. package/dist/resolver.js +282 -0
  60. package/dist/resolver.js.map +1 -0
  61. package/dist/types/index.d.ts +6 -0
  62. package/dist/types/index.d.ts.map +1 -0
  63. package/dist/types/index.js +5 -0
  64. package/dist/types/index.js.map +1 -0
  65. package/dist/types/manifest.d.ts +201 -0
  66. package/dist/types/manifest.d.ts.map +1 -0
  67. package/dist/types/manifest.js +13 -0
  68. package/dist/types/manifest.js.map +1 -0
  69. package/dist/types.d.ts +5 -0
  70. package/dist/types.d.ts.map +1 -0
  71. package/dist/types.js +5 -0
  72. package/dist/types.js.map +1 -0
  73. package/dist/utils/fs.d.ts +105 -0
  74. package/dist/utils/fs.d.ts.map +1 -0
  75. package/dist/utils/fs.js +233 -0
  76. package/dist/utils/fs.js.map +1 -0
  77. package/dist/utils/logger.d.ts +112 -0
  78. package/dist/utils/logger.d.ts.map +1 -0
  79. package/dist/utils/logger.js +232 -0
  80. package/dist/utils/logger.js.map +1 -0
  81. package/dist/utils/version.d.ts +62 -0
  82. package/dist/utils/version.d.ts.map +1 -0
  83. package/dist/utils/version.js +259 -0
  84. package/dist/utils/version.js.map +1 -0
  85. package/package.json +2 -2
  86. package/src/config.ts +36 -2
  87. package/src/index.ts +1 -0
  88. package/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,105 @@
1
+ /**
2
+ * @enactprotocol/shared - File system helpers
3
+ *
4
+ * Provides utilities for common filesystem operations.
5
+ */
6
+ /**
7
+ * Ensure a directory exists, creating it if necessary
8
+ */
9
+ export declare function ensureDir(dirPath: string): void;
10
+ /**
11
+ * Ensure the parent directory of a file exists
12
+ */
13
+ export declare function ensureParentDir(filePath: string): void;
14
+ /**
15
+ * Check if a path exists
16
+ */
17
+ export declare function pathExists(path: string): boolean;
18
+ /**
19
+ * Check if a path is a directory
20
+ */
21
+ export declare function isDirectory(path: string): boolean;
22
+ /**
23
+ * Check if a path is a file
24
+ */
25
+ export declare function isFile(path: string): boolean;
26
+ /**
27
+ * Read and parse a JSON file
28
+ * @throws Error if file doesn't exist or isn't valid JSON
29
+ */
30
+ export declare function readJsonFile<T = unknown>(filePath: string): T;
31
+ /**
32
+ * Try to read and parse a JSON file
33
+ * @returns The parsed JSON or null if file doesn't exist or is invalid
34
+ */
35
+ export declare function tryReadJsonFile<T = unknown>(filePath: string): T | null;
36
+ /**
37
+ * Write data to a JSON file with formatting
38
+ */
39
+ export declare function writeJsonFile(filePath: string, data: unknown, options?: {
40
+ indent?: number | undefined;
41
+ }): void;
42
+ /**
43
+ * Read a text file
44
+ */
45
+ export declare function readTextFile(filePath: string): string;
46
+ /**
47
+ * Try to read a text file
48
+ * @returns The file content or null if file doesn't exist
49
+ */
50
+ export declare function tryReadTextFile(filePath: string): string | null;
51
+ /**
52
+ * Write content to a text file
53
+ */
54
+ export declare function writeTextFile(filePath: string, content: string): void;
55
+ /**
56
+ * Copy a file
57
+ */
58
+ export declare function copyFile(src: string, dest: string): void;
59
+ /**
60
+ * Copy a directory recursively
61
+ */
62
+ export declare function copyDir(src: string, dest: string): void;
63
+ /**
64
+ * Remove a file or directory
65
+ */
66
+ export declare function remove(path: string): void;
67
+ /**
68
+ * List directory contents
69
+ */
70
+ export declare function listDir(dirPath: string): string[];
71
+ /**
72
+ * List directory entries with types
73
+ */
74
+ export declare function listDirEntries(dirPath: string): Array<{
75
+ name: string;
76
+ type: "file" | "directory" | "unknown";
77
+ path: string;
78
+ }>;
79
+ /**
80
+ * Find files matching a pattern in a directory (non-recursive)
81
+ */
82
+ export declare function findFiles(dirPath: string, pattern: RegExp | string): string[];
83
+ /**
84
+ * Find files recursively
85
+ */
86
+ export declare function findFilesRecursive(dirPath: string, pattern?: RegExp | string): string[];
87
+ /**
88
+ * Get file stats
89
+ */
90
+ export declare function getStats(path: string): {
91
+ size: number;
92
+ isFile: boolean;
93
+ isDirectory: boolean;
94
+ created: Date;
95
+ modified: Date;
96
+ } | null;
97
+ /**
98
+ * Get file size in bytes
99
+ */
100
+ export declare function getFileSize(filePath: string): number | null;
101
+ /**
102
+ * Touch a file (create if not exists, update mtime if exists)
103
+ */
104
+ export declare function touchFile(filePath: string): void;
105
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAI/C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGtD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMjD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAM5C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,CAG7D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,IAA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M,EAAE,CA4BvF;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,IAAI,CAAC;IACd,QAAQ,EAAE,IAAI,CAAC;CAChB,GAAG,IAAI,CAaP;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG3D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAQhD"}
@@ -0,0 +1,233 @@
1
+ /**
2
+ * @enactprotocol/shared - File system helpers
3
+ *
4
+ * Provides utilities for common filesystem operations.
5
+ */
6
+ import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync, } from "node:fs";
7
+ import { dirname, join } from "node:path";
8
+ /**
9
+ * Ensure a directory exists, creating it if necessary
10
+ */
11
+ export function ensureDir(dirPath) {
12
+ if (!existsSync(dirPath)) {
13
+ mkdirSync(dirPath, { recursive: true });
14
+ }
15
+ }
16
+ /**
17
+ * Ensure the parent directory of a file exists
18
+ */
19
+ export function ensureParentDir(filePath) {
20
+ const parentDir = dirname(filePath);
21
+ ensureDir(parentDir);
22
+ }
23
+ /**
24
+ * Check if a path exists
25
+ */
26
+ export function pathExists(path) {
27
+ return existsSync(path);
28
+ }
29
+ /**
30
+ * Check if a path is a directory
31
+ */
32
+ export function isDirectory(path) {
33
+ try {
34
+ return existsSync(path) && statSync(path).isDirectory();
35
+ }
36
+ catch {
37
+ return false;
38
+ }
39
+ }
40
+ /**
41
+ * Check if a path is a file
42
+ */
43
+ export function isFile(path) {
44
+ try {
45
+ return existsSync(path) && statSync(path).isFile();
46
+ }
47
+ catch {
48
+ return false;
49
+ }
50
+ }
51
+ /**
52
+ * Read and parse a JSON file
53
+ * @throws Error if file doesn't exist or isn't valid JSON
54
+ */
55
+ export function readJsonFile(filePath) {
56
+ const content = readFileSync(filePath, "utf-8");
57
+ return JSON.parse(content);
58
+ }
59
+ /**
60
+ * Try to read and parse a JSON file
61
+ * @returns The parsed JSON or null if file doesn't exist or is invalid
62
+ */
63
+ export function tryReadJsonFile(filePath) {
64
+ try {
65
+ return readJsonFile(filePath);
66
+ }
67
+ catch {
68
+ return null;
69
+ }
70
+ }
71
+ /**
72
+ * Write data to a JSON file with formatting
73
+ */
74
+ export function writeJsonFile(filePath, data, options) {
75
+ const indent = options?.indent ?? 2;
76
+ ensureParentDir(filePath);
77
+ writeFileSync(filePath, `${JSON.stringify(data, null, indent)}\n`, "utf-8");
78
+ }
79
+ /**
80
+ * Read a text file
81
+ */
82
+ export function readTextFile(filePath) {
83
+ return readFileSync(filePath, "utf-8");
84
+ }
85
+ /**
86
+ * Try to read a text file
87
+ * @returns The file content or null if file doesn't exist
88
+ */
89
+ export function tryReadTextFile(filePath) {
90
+ try {
91
+ return readTextFile(filePath);
92
+ }
93
+ catch {
94
+ return null;
95
+ }
96
+ }
97
+ /**
98
+ * Write content to a text file
99
+ */
100
+ export function writeTextFile(filePath, content) {
101
+ ensureParentDir(filePath);
102
+ writeFileSync(filePath, content, "utf-8");
103
+ }
104
+ /**
105
+ * Copy a file
106
+ */
107
+ export function copyFile(src, dest) {
108
+ ensureParentDir(dest);
109
+ copyFileSync(src, dest);
110
+ }
111
+ /**
112
+ * Copy a directory recursively
113
+ */
114
+ export function copyDir(src, dest) {
115
+ ensureDir(dest);
116
+ const entries = readdirSync(src, { withFileTypes: true });
117
+ for (const entry of entries) {
118
+ const srcPath = join(src, entry.name);
119
+ const destPath = join(dest, entry.name);
120
+ if (entry.isDirectory()) {
121
+ copyDir(srcPath, destPath);
122
+ }
123
+ else {
124
+ copyFile(srcPath, destPath);
125
+ }
126
+ }
127
+ }
128
+ /**
129
+ * Remove a file or directory
130
+ */
131
+ export function remove(path) {
132
+ if (existsSync(path)) {
133
+ rmSync(path, { recursive: true, force: true });
134
+ }
135
+ }
136
+ /**
137
+ * List directory contents
138
+ */
139
+ export function listDir(dirPath) {
140
+ if (!existsSync(dirPath)) {
141
+ return [];
142
+ }
143
+ return readdirSync(dirPath);
144
+ }
145
+ /**
146
+ * List directory entries with types
147
+ */
148
+ export function listDirEntries(dirPath) {
149
+ if (!existsSync(dirPath)) {
150
+ return [];
151
+ }
152
+ const entries = readdirSync(dirPath, { withFileTypes: true });
153
+ return entries.map((entry) => ({
154
+ name: entry.name,
155
+ type: entry.isDirectory() ? "directory" : entry.isFile() ? "file" : "unknown",
156
+ path: join(dirPath, entry.name),
157
+ }));
158
+ }
159
+ /**
160
+ * Find files matching a pattern in a directory (non-recursive)
161
+ */
162
+ export function findFiles(dirPath, pattern) {
163
+ const entries = listDir(dirPath);
164
+ const regex = typeof pattern === "string" ? new RegExp(pattern) : pattern;
165
+ return entries
166
+ .filter((name) => regex.test(name) && isFile(join(dirPath, name)))
167
+ .map((name) => join(dirPath, name));
168
+ }
169
+ /**
170
+ * Find files recursively
171
+ */
172
+ export function findFilesRecursive(dirPath, pattern) {
173
+ const results = [];
174
+ if (!existsSync(dirPath)) {
175
+ return results;
176
+ }
177
+ const regex = pattern !== undefined ? (typeof pattern === "string" ? new RegExp(pattern) : pattern) : null;
178
+ function walk(dir) {
179
+ const entries = readdirSync(dir, { withFileTypes: true });
180
+ for (const entry of entries) {
181
+ const fullPath = join(dir, entry.name);
182
+ if (entry.isDirectory()) {
183
+ walk(fullPath);
184
+ }
185
+ else if (entry.isFile()) {
186
+ if (!regex || regex.test(entry.name)) {
187
+ results.push(fullPath);
188
+ }
189
+ }
190
+ }
191
+ }
192
+ walk(dirPath);
193
+ return results;
194
+ }
195
+ /**
196
+ * Get file stats
197
+ */
198
+ export function getStats(path) {
199
+ try {
200
+ const stats = statSync(path);
201
+ return {
202
+ size: stats.size,
203
+ isFile: stats.isFile(),
204
+ isDirectory: stats.isDirectory(),
205
+ created: stats.birthtime,
206
+ modified: stats.mtime,
207
+ };
208
+ }
209
+ catch {
210
+ return null;
211
+ }
212
+ }
213
+ /**
214
+ * Get file size in bytes
215
+ */
216
+ export function getFileSize(filePath) {
217
+ const stats = getStats(filePath);
218
+ return stats?.isFile ? stats.size : null;
219
+ }
220
+ /**
221
+ * Touch a file (create if not exists, update mtime if exists)
222
+ */
223
+ export function touchFile(filePath) {
224
+ ensureParentDir(filePath);
225
+ if (existsSync(filePath)) {
226
+ // Update access and modification time by rewriting the file
227
+ writeFileSync(filePath, readFileSync(filePath));
228
+ }
229
+ else {
230
+ writeFileSync(filePath, "", "utf-8");
231
+ }
232
+ }
233
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,YAAY,EACZ,UAAU,EACV,SAAS,EACT,YAAY,EACZ,WAAW,EACX,MAAM,EACN,QAAQ,EACR,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpC,SAAS,CAAC,SAAS,CAAC,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,IAAI,CAA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IAAY;IAOnC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC7B,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE;YACtB,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE;YAChC,OAAO,EAAE,KAAK,CAAC,SAAS;YACxB,QAAQ,EAAE,KAAK,CAAC,KAAK;SACtB,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,OAAO,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,QAAgB;IACxC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1B,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzB,4DAA4D;QAC5D,aAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClD,CAAC;SAAM,CAAC;QACN,aAAa,CAAC,QAAQ,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;AACH,CAAC"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * @enactprotocol/shared - Logger utility
3
+ *
4
+ * Provides structured logging with level filtering and
5
+ * configurable output formats (console with colors or JSON).
6
+ */
7
+ export type LogLevel = "debug" | "info" | "warn" | "error" | "silent";
8
+ export interface LogEntry {
9
+ timestamp: string;
10
+ level: LogLevel;
11
+ message: string;
12
+ context?: Record<string, unknown> | undefined;
13
+ }
14
+ export interface LoggerOptions {
15
+ /** Minimum level to output */
16
+ level?: LogLevel;
17
+ /** Output format: 'console' for colored output, 'json' for structured */
18
+ format?: "console" | "json";
19
+ /** Enable colors in console output */
20
+ colors?: boolean;
21
+ /** Custom output function (defaults to console) */
22
+ output?: (text: string) => void;
23
+ /** Custom error output function (defaults to console.error) */
24
+ errorOutput?: (text: string) => void;
25
+ /** Prefix for log messages */
26
+ prefix?: string;
27
+ }
28
+ /**
29
+ * Logger class with level filtering and structured output
30
+ */
31
+ export declare class Logger {
32
+ private level;
33
+ private format;
34
+ private colors;
35
+ private output;
36
+ private errorOutput;
37
+ private prefix;
38
+ constructor(options?: LoggerOptions);
39
+ /**
40
+ * Check if a level should be logged
41
+ */
42
+ shouldLog(level: LogLevel): boolean;
43
+ /**
44
+ * Set the minimum log level
45
+ */
46
+ setLevel(level: LogLevel): void;
47
+ /**
48
+ * Get the current log level
49
+ */
50
+ getLevel(): LogLevel;
51
+ /**
52
+ * Set the output format
53
+ */
54
+ setFormat(format: "console" | "json"): void;
55
+ /**
56
+ * Enable or disable colors
57
+ */
58
+ setColors(enabled: boolean): void;
59
+ /**
60
+ * Set the prefix for log messages
61
+ */
62
+ setPrefix(prefix: string): void;
63
+ /**
64
+ * Create a child logger with a prefix
65
+ */
66
+ child(prefix: string): Logger;
67
+ /**
68
+ * Log a debug message
69
+ */
70
+ debug(message: string, context?: Record<string, unknown>): void;
71
+ /**
72
+ * Log an info message
73
+ */
74
+ info(message: string, context?: Record<string, unknown>): void;
75
+ /**
76
+ * Log a warning message
77
+ */
78
+ warn(message: string, context?: Record<string, unknown>): void;
79
+ /**
80
+ * Log an error message
81
+ */
82
+ error(message: string, context?: Record<string, unknown>): void;
83
+ /**
84
+ * Core logging method
85
+ */
86
+ private log;
87
+ /**
88
+ * Format entry as JSON
89
+ */
90
+ private formatJson;
91
+ /**
92
+ * Format entry for console with colors
93
+ */
94
+ private formatConsole;
95
+ }
96
+ /**
97
+ * Get the default logger instance
98
+ */
99
+ export declare function getLogger(): Logger;
100
+ /**
101
+ * Configure the default logger
102
+ */
103
+ export declare function configureLogger(options: LoggerOptions): void;
104
+ /**
105
+ * Create a new logger with the given options
106
+ */
107
+ export declare function createLogger(options?: LoggerOptions): Logger;
108
+ export declare const debug: (message: string, context?: Record<string, unknown>) => void;
109
+ export declare const info: (message: string, context?: Record<string, unknown>) => void;
110
+ export declare const warn: (message: string, context?: Record<string, unknown>) => void;
111
+ export declare const error: (message: string, context?: Record<string, unknown>) => void;
112
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtE,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAC/C;AAED,MAAM,WAAW,aAAa;IAC5B,8BAA8B;IAC9B,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,yEAAyE;IACzE,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC5B,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mDAAmD;IACnD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,+DAA+D;IAC/D,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAuCD;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAA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AAa,GAAG,IAAI,CAE5D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAE5D;AAGD,eAAO,MAAM,KAAK,GAAI,SAAS,MAAM,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,SACjC,CAAC;AACxC,eAAO,MAAM,IAAI,GAAI,SAAS,MAAM,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,SACjC,CAAC;AACvC,eAAO,MAAM,IAAI,GAAI,SAAS,MAAM,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,SACjC,CAAC;AACvC,eAAO,MAAM,KAAK,GAAI,SAAS,MAAM,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,SACjC,CAAC"}
@@ -0,0 +1,232 @@
1
+ /**
2
+ * @enactprotocol/shared - Logger utility
3
+ *
4
+ * Provides structured logging with level filtering and
5
+ * configurable output formats (console with colors or JSON).
6
+ */
7
+ /** Level priorities (higher = more severe) */
8
+ const LEVEL_PRIORITY = {
9
+ debug: 0,
10
+ info: 1,
11
+ warn: 2,
12
+ error: 3,
13
+ silent: 4,
14
+ };
15
+ /** ANSI color codes */
16
+ const COLORS = {
17
+ reset: "\x1b[0m",
18
+ dim: "\x1b[2m",
19
+ bold: "\x1b[1m",
20
+ red: "\x1b[31m",
21
+ yellow: "\x1b[33m",
22
+ blue: "\x1b[34m",
23
+ cyan: "\x1b[36m",
24
+ gray: "\x1b[90m",
25
+ };
26
+ /** Level display colors */
27
+ const LEVEL_COLORS = {
28
+ debug: COLORS.gray,
29
+ info: COLORS.blue,
30
+ warn: COLORS.yellow,
31
+ error: COLORS.red,
32
+ };
33
+ /** Level labels for output */
34
+ const LEVEL_LABELS = {
35
+ debug: "DEBUG",
36
+ info: "INFO",
37
+ warn: "WARN",
38
+ error: "ERROR",
39
+ };
40
+ /**
41
+ * Logger class with level filtering and structured output
42
+ */
43
+ export class Logger {
44
+ level;
45
+ format;
46
+ colors;
47
+ output;
48
+ errorOutput;
49
+ prefix;
50
+ constructor(options = {}) {
51
+ this.level = options.level ?? "info";
52
+ this.format = options.format ?? "console";
53
+ this.colors = options.colors ?? true;
54
+ this.output = options.output ?? console.log;
55
+ this.errorOutput = options.errorOutput ?? console.error;
56
+ this.prefix = options.prefix ?? "";
57
+ }
58
+ /**
59
+ * Check if a level should be logged
60
+ */
61
+ shouldLog(level) {
62
+ return LEVEL_PRIORITY[level] >= LEVEL_PRIORITY[this.level];
63
+ }
64
+ /**
65
+ * Set the minimum log level
66
+ */
67
+ setLevel(level) {
68
+ this.level = level;
69
+ }
70
+ /**
71
+ * Get the current log level
72
+ */
73
+ getLevel() {
74
+ return this.level;
75
+ }
76
+ /**
77
+ * Set the output format
78
+ */
79
+ setFormat(format) {
80
+ this.format = format;
81
+ }
82
+ /**
83
+ * Enable or disable colors
84
+ */
85
+ setColors(enabled) {
86
+ this.colors = enabled;
87
+ }
88
+ /**
89
+ * Set the prefix for log messages
90
+ */
91
+ setPrefix(prefix) {
92
+ this.prefix = prefix;
93
+ }
94
+ /**
95
+ * Create a child logger with a prefix
96
+ */
97
+ child(prefix) {
98
+ const childPrefix = this.prefix ? `${this.prefix}:${prefix}` : prefix;
99
+ return new Logger({
100
+ level: this.level,
101
+ format: this.format,
102
+ colors: this.colors,
103
+ output: this.output,
104
+ errorOutput: this.errorOutput,
105
+ prefix: childPrefix,
106
+ });
107
+ }
108
+ /**
109
+ * Log a debug message
110
+ */
111
+ debug(message, context) {
112
+ this.log("debug", message, context);
113
+ }
114
+ /**
115
+ * Log an info message
116
+ */
117
+ info(message, context) {
118
+ this.log("info", message, context);
119
+ }
120
+ /**
121
+ * Log a warning message
122
+ */
123
+ warn(message, context) {
124
+ this.log("warn", message, context);
125
+ }
126
+ /**
127
+ * Log an error message
128
+ */
129
+ error(message, context) {
130
+ this.log("error", message, context);
131
+ }
132
+ /**
133
+ * Core logging method
134
+ */
135
+ log(level, message, context) {
136
+ if (!this.shouldLog(level)) {
137
+ return;
138
+ }
139
+ const entry = {
140
+ timestamp: new Date().toISOString(),
141
+ level,
142
+ message: this.prefix ? `[${this.prefix}] ${message}` : message,
143
+ context,
144
+ };
145
+ const formatted = this.format === "json" ? this.formatJson(entry) : this.formatConsole(entry);
146
+ // Use error output for warn/error levels
147
+ if (level === "warn" || level === "error") {
148
+ this.errorOutput(formatted);
149
+ }
150
+ else {
151
+ this.output(formatted);
152
+ }
153
+ }
154
+ /**
155
+ * Format entry as JSON
156
+ */
157
+ formatJson(entry) {
158
+ const obj = {
159
+ timestamp: entry.timestamp,
160
+ level: entry.level,
161
+ message: entry.message,
162
+ };
163
+ if (entry.context && Object.keys(entry.context).length > 0) {
164
+ obj.context = entry.context;
165
+ }
166
+ return JSON.stringify(obj);
167
+ }
168
+ /**
169
+ * Format entry for console with colors
170
+ */
171
+ formatConsole(entry) {
172
+ const parts = [];
173
+ // Timestamp (dim)
174
+ if (this.colors) {
175
+ parts.push(`${COLORS.dim}${entry.timestamp}${COLORS.reset}`);
176
+ }
177
+ else {
178
+ parts.push(entry.timestamp);
179
+ }
180
+ // Level label with color (only active levels, not silent)
181
+ const level = entry.level;
182
+ const label = LEVEL_LABELS[level];
183
+ if (this.colors) {
184
+ const color = LEVEL_COLORS[level];
185
+ parts.push(`${color}${label.padEnd(5)}${COLORS.reset}`);
186
+ }
187
+ else {
188
+ parts.push(label.padEnd(5));
189
+ }
190
+ // Message
191
+ parts.push(entry.message);
192
+ // Context (if any)
193
+ if (entry.context && Object.keys(entry.context).length > 0) {
194
+ const contextStr = JSON.stringify(entry.context);
195
+ if (this.colors) {
196
+ parts.push(`${COLORS.dim}${contextStr}${COLORS.reset}`);
197
+ }
198
+ else {
199
+ parts.push(contextStr);
200
+ }
201
+ }
202
+ return parts.join(" ");
203
+ }
204
+ }
205
+ /**
206
+ * Default logger instance
207
+ */
208
+ let defaultLogger = new Logger();
209
+ /**
210
+ * Get the default logger instance
211
+ */
212
+ export function getLogger() {
213
+ return defaultLogger;
214
+ }
215
+ /**
216
+ * Configure the default logger
217
+ */
218
+ export function configureLogger(options) {
219
+ defaultLogger = new Logger(options);
220
+ }
221
+ /**
222
+ * Create a new logger with the given options
223
+ */
224
+ export function createLogger(options) {
225
+ return new Logger(options);
226
+ }
227
+ // Convenience exports for quick logging
228
+ export const debug = (message, context) => defaultLogger.debug(message, context);
229
+ export const info = (message, context) => defaultLogger.info(message, context);
230
+ export const warn = (message, context) => defaultLogger.warn(message, context);
231
+ export const error = (message, context) => defaultLogger.error(message, context);
232
+ //# sourceMappingURL=logger.js.map