@guren/server 2.10.0 → 2.10.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 (90) hide show
  1. package/dist/DocsViewerServiceProvider-qFCaeiUv.js +77 -0
  2. package/dist/Hash-CzrwKeDp.js +133 -0
  3. package/dist/HttpException-BkS3euNG.js +161 -0
  4. package/dist/Job-BVT813DO.js +441 -0
  5. package/dist/McpServiceProvider-BoAN-UcD.js +367 -0
  6. package/dist/MessageSigner-Bd25ZJAV.js +93 -0
  7. package/dist/Random-DbIJ22KQ.js +191 -0
  8. package/dist/address-D0Iq-XIH.js +20 -0
  9. package/dist/auth/index.js +2 -122
  10. package/dist/auth-C7sVmYgc.js +1954 -0
  11. package/dist/authorization/index.js +2 -38
  12. package/dist/authorization-Dbcuc5ZK.js +610 -0
  13. package/dist/broadcasting/index.js +2 -26
  14. package/dist/broadcasting-Dw-FhyjN.js +1055 -0
  15. package/dist/cache/index.js +2 -17
  16. package/dist/cache/types.d.ts +4 -4
  17. package/dist/cache-BYnZf2FR.js +812 -0
  18. package/dist/client-Dd7vLcqp.js +27 -0
  19. package/dist/console/Output.d.ts +18 -18
  20. package/dist/encryption/index.js +5 -96
  21. package/dist/encryption-fOWQaKqX.js +250 -0
  22. package/dist/endpoint-D-20PiHY.js +46 -0
  23. package/dist/endpoint-D6GIqOpe.js +31 -0
  24. package/dist/errors-quJOkkCn.js +81 -0
  25. package/dist/events/index.js +2 -28
  26. package/dist/events-aIH_bWRx.js +410 -0
  27. package/dist/health/index.js +2 -24
  28. package/dist/health-VWdWXRwh.js +345 -0
  29. package/dist/hot-disposables-WsTX2ySN.js +281 -0
  30. package/dist/hot-reload/testing.d.ts +1 -1
  31. package/dist/i18n/index.js +2 -30
  32. package/dist/i18n-mcWi7LCd.js +617 -0
  33. package/dist/index.js +7495 -7276
  34. package/dist/lambda/index.js +114 -71
  35. package/dist/logging/index.js +2 -24
  36. package/dist/logging-CPaRMuPP.js +518 -0
  37. package/dist/loopback-guard-D0Kc7-xc.js +224 -0
  38. package/dist/mail/index.js +2 -27
  39. package/dist/mail-DfEfSQEr.js +699 -0
  40. package/dist/mcp/index.js +2 -10
  41. package/dist/notifications/index.js +2 -33
  42. package/dist/notifications-BGqmUNZ8.js +759 -0
  43. package/dist/queue/index.js +3 -42
  44. package/dist/queue-CXrRK85G.js +948 -0
  45. package/dist/redis/index.js +672 -642
  46. package/dist/rolldown-runtime-8H4AJuhK.js +14 -0
  47. package/dist/runtime/index.js +472 -616
  48. package/dist/scheduling/index.js +2 -29
  49. package/dist/scheduling-CPiEdtQd.js +839 -0
  50. package/dist/storage/index.js +2 -15
  51. package/dist/storage-tWHMv2H_.js +841 -0
  52. package/dist/support/expiry.js +69 -12
  53. package/dist/trim-slashes-ZJ_VsY5s.js +25 -0
  54. package/dist/vite/index.js +118 -181
  55. package/dist/vite/plugin.d.ts +1 -1
  56. package/dist/vite-dev-server-CpCUqmiC.js +131 -0
  57. package/package.json +6 -5
  58. package/dist/DocsViewerServiceProvider-RUYDFBMW.js +0 -75
  59. package/dist/McpServiceProvider-SL7DUZ4G.js +0 -8
  60. package/dist/chunk-2SC566CD.js +0 -376
  61. package/dist/chunk-2V3YID4H.js +0 -20
  62. package/dist/chunk-3KV5X2FL.js +0 -31
  63. package/dist/chunk-63SKW5PS.js +0 -457
  64. package/dist/chunk-6J6B5KOB.js +0 -425
  65. package/dist/chunk-A5JJ7XTH.js +0 -24
  66. package/dist/chunk-AZOYI43J.js +0 -18
  67. package/dist/chunk-B5E5VBDI.js +0 -115
  68. package/dist/chunk-DAQKYKLH.js +0 -182
  69. package/dist/chunk-DRNPVBAA.js +0 -1002
  70. package/dist/chunk-EI5GYMAT.js +0 -853
  71. package/dist/chunk-H3B23O6T.js +0 -271
  72. package/dist/chunk-HPET6XY5.js +0 -853
  73. package/dist/chunk-HR2KZ3WL.js +0 -616
  74. package/dist/chunk-IOTWFHZU.js +0 -558
  75. package/dist/chunk-K6CUBJX6.js +0 -642
  76. package/dist/chunk-KTNJG7R7.js +0 -911
  77. package/dist/chunk-LAJQCSSF.js +0 -355
  78. package/dist/chunk-LHR6OHI7.js +0 -189
  79. package/dist/chunk-N7PLD7MB.js +0 -729
  80. package/dist/chunk-Q2P6YLRR.js +0 -24
  81. package/dist/chunk-QQKTH5KX.js +0 -114
  82. package/dist/chunk-SFQP6O52.js +0 -126
  83. package/dist/chunk-SQR7277M.js +0 -911
  84. package/dist/chunk-T2FFUU6J.js +0 -484
  85. package/dist/chunk-TVV5YNEC.js +0 -1842
  86. package/dist/chunk-UY3AZSYL.js +0 -14
  87. package/dist/chunk-V4DNC2ER.js +0 -114
  88. package/dist/chunk-VSA3QY5Q.js +0 -274
  89. package/dist/chunk-YSOJKAAU.js +0 -427
  90. package/dist/errors-PUNHAFL2.js +0 -34
@@ -1,558 +0,0 @@
1
- // src/logging/types.ts
2
- var LOG_LEVEL_PRIORITY = {
3
- emergency: 0,
4
- alert: 1,
5
- critical: 2,
6
- error: 3,
7
- warning: 4,
8
- notice: 5,
9
- info: 6,
10
- debug: 7
11
- };
12
-
13
- // src/logging/Logger.ts
14
- var DEFAULT_FILTER_KEYS = [
15
- "password",
16
- "password_confirmation",
17
- "token",
18
- "secret",
19
- "credit_card",
20
- "creditCard",
21
- "card_number",
22
- "cardNumber",
23
- "cvv",
24
- "ssn",
25
- "authorization"
26
- ];
27
- function filterSensitiveData(data, filterKeys, replacement = "[FILTERED]") {
28
- if (filterKeys.length === 0) return data;
29
- const keySet = new Set(filterKeys.map((k) => k.toLowerCase()));
30
- return filterObject(data, keySet, replacement);
31
- }
32
- function filterObject(obj, keySet, replacement) {
33
- const result = {};
34
- for (const [key, value] of Object.entries(obj)) {
35
- if (keySet.has(key.toLowerCase())) {
36
- result[key] = replacement;
37
- } else if (value !== null && typeof value === "object" && !Array.isArray(value)) {
38
- result[key] = filterObject(value, keySet, replacement);
39
- } else if (Array.isArray(value)) {
40
- result[key] = value.map(
41
- (item) => item !== null && typeof item === "object" && !Array.isArray(item) ? filterObject(item, keySet, replacement) : item
42
- );
43
- } else {
44
- result[key] = value;
45
- }
46
- }
47
- return result;
48
- }
49
- var Logger = class _Logger {
50
- channels;
51
- baseContext;
52
- filterKeys;
53
- replacement;
54
- constructor(channels, context = {}, options = {}) {
55
- this.channels = channels;
56
- this.baseContext = context;
57
- this.filterKeys = options.filterKeys ?? DEFAULT_FILTER_KEYS;
58
- this.replacement = options.replacement ?? "[FILTERED]";
59
- }
60
- /**
61
- * Log at emergency level (system is unusable).
62
- */
63
- emergency(message, context = {}) {
64
- this.log("emergency", message, context);
65
- }
66
- /**
67
- * Log at alert level (action must be taken immediately).
68
- */
69
- alert(message, context = {}) {
70
- this.log("alert", message, context);
71
- }
72
- /**
73
- * Log at critical level (critical conditions).
74
- */
75
- critical(message, context = {}) {
76
- this.log("critical", message, context);
77
- }
78
- /**
79
- * Log at error level (error conditions).
80
- */
81
- error(message, context = {}) {
82
- this.log("error", message, context);
83
- }
84
- /**
85
- * Log at warning level (warning conditions).
86
- */
87
- warning(message, context = {}) {
88
- this.log("warning", message, context);
89
- }
90
- /**
91
- * Alias for warning().
92
- */
93
- warn(message, context = {}) {
94
- this.warning(message, context);
95
- }
96
- /**
97
- * Log at notice level (normal but significant conditions).
98
- */
99
- notice(message, context = {}) {
100
- this.log("notice", message, context);
101
- }
102
- /**
103
- * Log at info level (informational messages).
104
- */
105
- info(message, context = {}) {
106
- this.log("info", message, context);
107
- }
108
- /**
109
- * Log at debug level (debug-level messages).
110
- */
111
- debug(message, context = {}) {
112
- this.log("debug", message, context);
113
- }
114
- /**
115
- * Log a message at the specified level.
116
- */
117
- log(level, message, context = {}) {
118
- const merged = { ...this.baseContext, ...context };
119
- const filtered = this.filterKeys.length > 0 ? filterSensitiveData(merged, this.filterKeys, this.replacement) : merged;
120
- const entry = {
121
- level,
122
- message,
123
- context: filtered,
124
- timestamp: /* @__PURE__ */ new Date()
125
- };
126
- for (const channel of this.channels) {
127
- try {
128
- channel.log(entry);
129
- } catch (error) {
130
- console.error("Logging error:", error);
131
- }
132
- }
133
- }
134
- /**
135
- * Create a new logger with additional context.
136
- */
137
- withContext(context) {
138
- return new _Logger(this.channels, { ...this.baseContext, ...context }, {
139
- filterKeys: this.filterKeys,
140
- replacement: this.replacement
141
- });
142
- }
143
- /**
144
- * Create a child logger with additional context (alias for withContext).
145
- */
146
- child(context) {
147
- return this.withContext(context);
148
- }
149
- /**
150
- * Close all channels.
151
- */
152
- async close() {
153
- for (const channel of this.channels) {
154
- if (channel.close) {
155
- await channel.close();
156
- }
157
- }
158
- }
159
- };
160
-
161
- // src/logging/channels/ConsoleChannel.ts
162
- var LEVEL_COLORS = {
163
- emergency: "\x1B[41m\x1B[37m",
164
- // White on red background
165
- alert: "\x1B[41m\x1B[37m",
166
- // White on red background
167
- critical: "\x1B[31m",
168
- // Red
169
- error: "\x1B[31m",
170
- // Red
171
- warning: "\x1B[33m",
172
- // Yellow
173
- notice: "\x1B[36m",
174
- // Cyan
175
- info: "\x1B[32m",
176
- // Green
177
- debug: "\x1B[90m"
178
- // Gray
179
- };
180
- var RESET = "\x1B[0m";
181
- var ConsoleChannel = class {
182
- config;
183
- minLevel;
184
- constructor(config) {
185
- this.config = {
186
- colors: true,
187
- timestamps: true,
188
- format: "text",
189
- ...config
190
- };
191
- this.minLevel = LOG_LEVEL_PRIORITY[this.config.level ?? "debug"];
192
- }
193
- log(entry) {
194
- const entryLevel = LOG_LEVEL_PRIORITY[entry.level];
195
- if (entryLevel > this.minLevel) {
196
- return;
197
- }
198
- const output = this.format(entry);
199
- if (entryLevel <= LOG_LEVEL_PRIORITY.error) {
200
- console.error(output);
201
- } else if (entryLevel <= LOG_LEVEL_PRIORITY.warning) {
202
- console.warn(output);
203
- } else if (entryLevel <= LOG_LEVEL_PRIORITY.info) {
204
- console.info(output);
205
- } else {
206
- console.log(output);
207
- }
208
- }
209
- format(entry) {
210
- if (this.config.format === "json") {
211
- return JSON.stringify({
212
- timestamp: entry.timestamp.toISOString(),
213
- level: entry.level,
214
- message: entry.message,
215
- ...entry.context
216
- });
217
- }
218
- const parts = [];
219
- if (this.config.timestamps) {
220
- const time = entry.timestamp.toISOString();
221
- parts.push(this.config.colors ? `\x1B[90m[${time}]\x1B[0m` : `[${time}]`);
222
- }
223
- const levelStr = entry.level.toUpperCase().padEnd(9);
224
- if (this.config.colors) {
225
- parts.push(`${LEVEL_COLORS[entry.level]}${levelStr}${RESET}`);
226
- } else {
227
- parts.push(levelStr);
228
- }
229
- parts.push(entry.message);
230
- if (Object.keys(entry.context).length > 0) {
231
- const contextStr = JSON.stringify(entry.context);
232
- if (this.config.colors) {
233
- parts.push(`\x1B[90m${contextStr}${RESET}`);
234
- } else {
235
- parts.push(contextStr);
236
- }
237
- }
238
- return parts.join(" ");
239
- }
240
- };
241
-
242
- // src/logging/channels/FileChannel.ts
243
- import * as fs from "fs";
244
- import * as path from "path";
245
- var FileChannel = class {
246
- config;
247
- minLevel;
248
- initialized = false;
249
- constructor(config) {
250
- this.config = {
251
- format: "text",
252
- ...config
253
- };
254
- this.minLevel = LOG_LEVEL_PRIORITY[this.config.level ?? "debug"];
255
- }
256
- log(entry) {
257
- const entryLevel = LOG_LEVEL_PRIORITY[entry.level];
258
- if (entryLevel > this.minLevel) {
259
- return;
260
- }
261
- const line = this.format(entry) + "\n";
262
- this.write(line);
263
- }
264
- write(data) {
265
- if (!this.initialized) {
266
- this.ensureDirectory();
267
- this.initialized = true;
268
- }
269
- fs.appendFileSync(this.config.path, data);
270
- }
271
- ensureDirectory() {
272
- const dir = path.dirname(this.config.path);
273
- if (!fs.existsSync(dir)) {
274
- fs.mkdirSync(dir, { recursive: true });
275
- }
276
- }
277
- format(entry) {
278
- if (this.config.format === "json") {
279
- return JSON.stringify({
280
- timestamp: entry.timestamp.toISOString(),
281
- level: entry.level,
282
- message: entry.message,
283
- ...entry.context
284
- });
285
- }
286
- const timestamp = entry.timestamp.toISOString();
287
- const level = entry.level.toUpperCase().padEnd(9);
288
- const context = Object.keys(entry.context).length > 0 ? " " + JSON.stringify(entry.context) : "";
289
- return `[${timestamp}] ${level} ${entry.message}${context}`;
290
- }
291
- close() {
292
- }
293
- };
294
-
295
- // src/logging/channels/DailyFileChannel.ts
296
- import * as fs2 from "fs";
297
- import * as path2 from "path";
298
- var DailyFileChannel = class {
299
- config;
300
- minLevel;
301
- currentDate = null;
302
- currentFilePath = null;
303
- constructor(config) {
304
- this.config = {
305
- days: 14,
306
- format: "text",
307
- ...config
308
- };
309
- this.minLevel = LOG_LEVEL_PRIORITY[this.config.level ?? "debug"];
310
- }
311
- log(entry) {
312
- const entryLevel = LOG_LEVEL_PRIORITY[entry.level];
313
- if (entryLevel > this.minLevel) {
314
- return;
315
- }
316
- const dateStr = this.getDateString(entry.timestamp);
317
- if (this.currentDate !== dateStr) {
318
- this.rotate(dateStr);
319
- }
320
- const line = this.format(entry) + "\n";
321
- this.write(line);
322
- }
323
- write(data) {
324
- if (this.currentFilePath) {
325
- fs2.appendFileSync(this.currentFilePath, data);
326
- }
327
- }
328
- rotate(dateStr) {
329
- this.currentDate = dateStr;
330
- this.currentFilePath = this.getFilePath(dateStr);
331
- this.ensureDirectory(this.currentFilePath);
332
- this.cleanup();
333
- }
334
- getFilePath(dateStr) {
335
- const { dir, name, ext } = path2.parse(this.config.path);
336
- return path2.join(dir, `${name}-${dateStr}${ext}`);
337
- }
338
- getDateString(date) {
339
- return date.toISOString().split("T")[0];
340
- }
341
- ensureDirectory(filePath) {
342
- const dir = path2.dirname(filePath);
343
- if (!fs2.existsSync(dir)) {
344
- fs2.mkdirSync(dir, { recursive: true });
345
- }
346
- }
347
- cleanup() {
348
- const { dir, name, ext } = path2.parse(this.config.path);
349
- if (!fs2.existsSync(dir)) {
350
- return;
351
- }
352
- const files = fs2.readdirSync(dir);
353
- const pattern = new RegExp(`^${name}-(\\d{4}-\\d{2}-\\d{2})${ext.replace(".", "\\.")}$`);
354
- const cutoff = /* @__PURE__ */ new Date();
355
- cutoff.setDate(cutoff.getDate() - (this.config.days ?? 14));
356
- for (const file of files) {
357
- const match = file.match(pattern);
358
- if (match) {
359
- const fileDate = new Date(match[1]);
360
- if (fileDate < cutoff) {
361
- fs2.unlinkSync(path2.join(dir, file));
362
- }
363
- }
364
- }
365
- }
366
- format(entry) {
367
- if (this.config.format === "json") {
368
- return JSON.stringify({
369
- timestamp: entry.timestamp.toISOString(),
370
- level: entry.level,
371
- message: entry.message,
372
- ...entry.context
373
- });
374
- }
375
- const timestamp = entry.timestamp.toISOString();
376
- const level = entry.level.toUpperCase().padEnd(9);
377
- const context = Object.keys(entry.context).length > 0 ? " " + JSON.stringify(entry.context) : "";
378
- return `[${timestamp}] ${level} ${entry.message}${context}`;
379
- }
380
- close() {
381
- }
382
- };
383
-
384
- // src/logging/LogManager.ts
385
- var LogManager = class {
386
- config;
387
- channelFactories = /* @__PURE__ */ new Map();
388
- channelInstances = /* @__PURE__ */ new Map();
389
- loggers = /* @__PURE__ */ new Map();
390
- loggerOptions;
391
- constructor(config) {
392
- this.config = config;
393
- this.loggerOptions = {
394
- filterKeys: config.filterKeys,
395
- replacement: config.filterReplacement
396
- };
397
- this.registerDefaultDrivers();
398
- }
399
- registerDefaultDrivers() {
400
- this.registerDriver("console", (config) => {
401
- return new ConsoleChannel(config);
402
- });
403
- this.registerDriver("file", (config) => {
404
- return new FileChannel(config);
405
- });
406
- this.registerDriver("daily", (config) => {
407
- return new DailyFileChannel(config);
408
- });
409
- this.registerDriver("stack", (config) => {
410
- return this.createStackChannel(config);
411
- });
412
- }
413
- createStackChannel(config) {
414
- const channels = config.channels.map((name) => this.resolveChannel(name));
415
- return {
416
- log: (entry) => {
417
- for (const channel of channels) {
418
- channel.log(entry);
419
- }
420
- },
421
- close: async () => {
422
- for (const channel of channels) {
423
- if (channel.close) {
424
- await channel.close();
425
- }
426
- }
427
- }
428
- };
429
- }
430
- /**
431
- * Register a custom channel driver.
432
- */
433
- registerDriver(name, factory) {
434
- this.channelFactories.set(name, factory);
435
- }
436
- /**
437
- * Get a logger for a specific channel.
438
- */
439
- channel(name) {
440
- const channelName = name ?? this.config.default;
441
- if (!this.loggers.has(channelName)) {
442
- const channel = this.resolveChannel(channelName);
443
- this.loggers.set(channelName, new Logger([channel], {}, this.loggerOptions));
444
- }
445
- return this.loggers.get(channelName);
446
- }
447
- /**
448
- * Get a logger that writes to multiple channels.
449
- */
450
- stack(channelNames) {
451
- const key = `stack:${channelNames.join(",")}`;
452
- if (!this.loggers.has(key)) {
453
- const channels = channelNames.map((name) => this.resolveChannel(name));
454
- this.loggers.set(key, new Logger(channels, {}, this.loggerOptions));
455
- }
456
- return this.loggers.get(key);
457
- }
458
- resolveChannel(name) {
459
- if (this.channelInstances.has(name)) {
460
- return this.channelInstances.get(name);
461
- }
462
- const config = this.config.channels[name];
463
- if (!config) {
464
- throw new Error(`Log channel [${name}] is not defined`);
465
- }
466
- const factory = this.channelFactories.get(config.driver);
467
- if (!factory) {
468
- throw new Error(`Log driver [${config.driver}] is not supported`);
469
- }
470
- const channel = factory(config);
471
- this.channelInstances.set(name, channel);
472
- return channel;
473
- }
474
- /**
475
- * Create a logger with additional context using the default channel.
476
- */
477
- withContext(context) {
478
- return this.channel().withContext(context);
479
- }
480
- // Convenience methods that delegate to default channel
481
- emergency(message, context) {
482
- this.channel().emergency(message, context);
483
- }
484
- alert(message, context) {
485
- this.channel().alert(message, context);
486
- }
487
- critical(message, context) {
488
- this.channel().critical(message, context);
489
- }
490
- error(message, context) {
491
- this.channel().error(message, context);
492
- }
493
- warning(message, context) {
494
- this.channel().warning(message, context);
495
- }
496
- warn(message, context) {
497
- this.channel().warn(message, context);
498
- }
499
- notice(message, context) {
500
- this.channel().notice(message, context);
501
- }
502
- info(message, context) {
503
- this.channel().info(message, context);
504
- }
505
- debug(message, context) {
506
- this.channel().debug(message, context);
507
- }
508
- /**
509
- * Close all channel instances.
510
- */
511
- async close() {
512
- for (const channel of this.channelInstances.values()) {
513
- if (channel.close) {
514
- await channel.close();
515
- }
516
- }
517
- this.channelInstances.clear();
518
- this.loggers.clear();
519
- }
520
- /**
521
- * Get the default channel name.
522
- */
523
- getDefaultChannel() {
524
- return this.config.default;
525
- }
526
- /**
527
- * Get available channel names.
528
- */
529
- getChannelNames() {
530
- return Object.keys(this.config.channels);
531
- }
532
- };
533
- function createLogManager(config) {
534
- return new LogManager(config);
535
- }
536
- var globalLogManager = null;
537
- function setLogManager(manager) {
538
- globalLogManager = manager;
539
- }
540
- function getLogManager() {
541
- if (!globalLogManager) {
542
- throw new Error("Log manager has not been initialized. Call setLogManager() first.");
543
- }
544
- return globalLogManager;
545
- }
546
-
547
- export {
548
- LOG_LEVEL_PRIORITY,
549
- filterSensitiveData,
550
- Logger,
551
- ConsoleChannel,
552
- FileChannel,
553
- DailyFileChannel,
554
- LogManager,
555
- createLogManager,
556
- setLogManager,
557
- getLogManager
558
- };