likec4 1.52.0 → 1.53.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.
Files changed (36) hide show
  1. package/__app__/src/likec4.js +34 -48
  2. package/__app__/src/routes/index.js +7 -0
  3. package/__app__/src/routes/single.js +30 -18
  4. package/__app__/src/style.css +1 -1
  5. package/__app__/src/vendors.js +2065 -2809
  6. package/config/schema.json +56 -0
  7. package/dist/THIRD-PARTY-LICENSES.md +10 -2
  8. package/dist/_chunks/filesystem.mjs +70 -68
  9. package/dist/_chunks/index.d.mts +10 -1
  10. package/dist/_chunks/index2.d.mts +76 -4
  11. package/dist/_chunks/libs/@hono/mcp.mjs +1 -1
  12. package/dist/_chunks/libs/@logtape/logtape.d.mts +1021 -0
  13. package/dist/_chunks/libs/@logtape/logtape.mjs +4 -6
  14. package/dist/_chunks/libs/@modelcontextprotocol/sdk.d.mts +1 -1
  15. package/dist/_chunks/libs/@nanostores/react.d.mts +5 -5
  16. package/dist/_chunks/libs/destr.mjs +1 -0
  17. package/dist/_chunks/libs/fast-equals.mjs +1 -1
  18. package/dist/_chunks/libs/langium.mjs +1 -1
  19. package/dist/_chunks/libs/remeda.mjs +2 -2
  20. package/dist/_chunks/libs/tinyrainbow.mjs +1 -1
  21. package/dist/_chunks/libs/unstorage.mjs +1 -0
  22. package/dist/_chunks/node.mjs +1 -0
  23. package/dist/_chunks/sequence.mjs +1 -1
  24. package/dist/_chunks/src.mjs +14 -12
  25. package/dist/_chunks/src2.mjs +46 -46
  26. package/dist/cli/index.mjs +164 -84
  27. package/dist/index.d.mts +16 -819
  28. package/dist/index.mjs +1 -1
  29. package/dist/vite-plugin/index.mjs +1 -1
  30. package/dist/vite-plugin/internal.mjs +1 -1
  31. package/package.json +34 -33
  32. package/react/index.d.mts +24 -20
  33. package/react/index.mjs +969 -1728
  34. package/vite-plugin-modules.d.ts +5 -0
  35. package/dist/_chunks/LikeC4.mjs +0 -1
  36. package/dist/_chunks/libs/boxen.d.mts +0 -1
@@ -0,0 +1,1021 @@
1
+ //#region ../../node_modules/.pnpm/@logtape+logtape@2.0.4/node_modules/@logtape/logtape/dist/level.d.ts
2
+ //#region src/level.d.ts
3
+ declare const logLevels: readonly ["trace", "debug", "info", "warning", "error", "fatal"];
4
+ /**
5
+ * The severity level of a {@link LogRecord}.
6
+ */
7
+ type LogLevel = typeof logLevels[number];
8
+ /**
9
+ * Lists all available log levels with the order of their severity.
10
+ * The `"trace"` level goes first, and the `"fatal"` level goes last.
11
+ * @returns A new copy of the array of log levels.
12
+ * @since 1.0.0
13
+ */
14
+ //#endregion
15
+ //#region ../../node_modules/.pnpm/@logtape+logtape@2.0.4/node_modules/@logtape/logtape/dist/record.d.ts
16
+ //#region src/record.d.ts
17
+ /**
18
+ * A log record.
19
+ */
20
+ interface LogRecord {
21
+ /**
22
+ * The category of the logger that produced the log record.
23
+ */
24
+ readonly category: readonly string[];
25
+ /**
26
+ * The log level.
27
+ */
28
+ readonly level: LogLevel;
29
+ /**
30
+ * The log message. This is the result of substituting the message template
31
+ * with the values. The number of elements in this array is always odd,
32
+ * with the message template values interleaved between the substitution
33
+ * values.
34
+ */
35
+ readonly message: readonly unknown[];
36
+ /**
37
+ * The raw log message. This is the original message template without any
38
+ * further processing. It can be either:
39
+ *
40
+ * - A string without any substitutions if the log record was created with
41
+ * a method call syntax, e.g., "Hello, {name}!" for
42
+ * `logger.info("Hello, {name}!", { name })`.
43
+ * - A template string array if the log record was created with a tagged
44
+ * template literal syntax, e.g., `["Hello, ", "!"]` for
45
+ * ``logger.info`Hello, ${name}!```.
46
+ *
47
+ * @since 0.6.0
48
+ */
49
+ readonly rawMessage: string | TemplateStringsArray;
50
+ /**
51
+ * The timestamp of the log record in milliseconds since the Unix epoch.
52
+ */
53
+ readonly timestamp: number;
54
+ /**
55
+ * The extra properties of the log record.
56
+ */
57
+ readonly properties: Record<string, unknown>;
58
+ } //# sourceMappingURL=record.d.ts.map
59
+ //#endregion
60
+ //#endregion
61
+ //#region ../../node_modules/.pnpm/@logtape+logtape@2.0.4/node_modules/@logtape/logtape/dist/logger.d.ts
62
+ /**
63
+ * A logger interface. It provides methods to log messages at different
64
+ * severity levels.
65
+ *
66
+ * ```typescript
67
+ * const logger = getLogger("category");
68
+ * logger.trace `A trace message with ${value}`
69
+ * logger.debug `A debug message with ${value}.`;
70
+ * logger.info `An info message with ${value}.`;
71
+ * logger.warn `A warning message with ${value}.`;
72
+ * logger.error `An error message with ${value}.`;
73
+ * logger.fatal `A fatal error message with ${value}.`;
74
+ * ```
75
+ */
76
+ interface Logger {
77
+ /**
78
+ * The category of the logger. It is an array of strings.
79
+ */
80
+ readonly category: readonly string[];
81
+ /**
82
+ * The logger with the supercategory of the current logger. If the current
83
+ * logger is the root logger, this is `null`.
84
+ */
85
+ readonly parent: Logger | null;
86
+ /**
87
+ * Get a child logger with the given subcategory.
88
+ *
89
+ * ```typescript
90
+ * const logger = getLogger("category");
91
+ * const subLogger = logger.getChild("sub-category");
92
+ * ```
93
+ *
94
+ * The above code is equivalent to:
95
+ *
96
+ * ```typescript
97
+ * const logger = getLogger("category");
98
+ * const subLogger = getLogger(["category", "sub-category"]);
99
+ * ```
100
+ *
101
+ * @param subcategory The subcategory.
102
+ * @returns The child logger.
103
+ */
104
+ getChild(subcategory: string | readonly [string] | readonly [string, ...string[]]): Logger;
105
+ /**
106
+ * Get a logger with contextual properties. This is useful for
107
+ * log multiple messages with the shared set of properties.
108
+ *
109
+ * ```typescript
110
+ * const logger = getLogger("category");
111
+ * const ctx = logger.with({ foo: 123, bar: "abc" });
112
+ * ctx.info("A message with {foo} and {bar}.");
113
+ * ctx.warn("Another message with {foo}, {bar}, and {baz}.", { baz: true });
114
+ * ```
115
+ *
116
+ * The above code is equivalent to:
117
+ *
118
+ * ```typescript
119
+ * const logger = getLogger("category");
120
+ * logger.info("A message with {foo} and {bar}.", { foo: 123, bar: "abc" });
121
+ * logger.warn(
122
+ * "Another message with {foo}, {bar}, and {baz}.",
123
+ * { foo: 123, bar: "abc", baz: true },
124
+ * );
125
+ * ```
126
+ *
127
+ * @param properties
128
+ * @returns
129
+ * @since 0.5.0
130
+ */
131
+ with(properties: Record<string, unknown>): Logger;
132
+ /**
133
+ * Log a trace message. Use this as a template string prefix.
134
+ *
135
+ * ```typescript
136
+ * logger.trace `A trace message with ${value}.`;
137
+ * ```
138
+ *
139
+ * @param message The message template strings array.
140
+ * @param values The message template values.
141
+ * @since 0.12.0
142
+ */
143
+ trace(message: TemplateStringsArray, ...values: readonly unknown[]): void;
144
+ /**
145
+ * Log a trace message with properties.
146
+ *
147
+ * ```typescript
148
+ * logger.trace('A trace message with {value}.', { value });
149
+ * ```
150
+ *
151
+ * If the properties are expensive to compute, you can pass a callback that
152
+ * returns the properties:
153
+ *
154
+ * ```typescript
155
+ * logger.trace(
156
+ * 'A trace message with {value}.',
157
+ * () => ({ value: expensiveComputation() })
158
+ * );
159
+ * ```
160
+ *
161
+ * @param message The message template. Placeholders to be replaced with
162
+ * `values` are indicated by keys in curly braces (e.g.,
163
+ * `{value}`).
164
+ * @param properties The values to replace placeholders with. For lazy
165
+ * evaluation, this can be a callback that returns the
166
+ * properties.
167
+ * @since 0.12.0
168
+ */
169
+ trace(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
170
+ /**
171
+ * Log a trace message with properties computed asynchronously.
172
+ *
173
+ * Use this when the properties require async operations to compute:
174
+ *
175
+ * ```typescript
176
+ * await logger.trace(
177
+ * 'A trace message with {value}.',
178
+ * async () => ({ value: await fetchValue() })
179
+ * );
180
+ * ```
181
+ *
182
+ * @param message The message template. Placeholders to be replaced with
183
+ * `values` are indicated by keys in curly braces (e.g.,
184
+ * `{value}`).
185
+ * @param properties An async callback that returns the properties.
186
+ * @returns A promise that resolves when the log is written.
187
+ * @since 2.0.0
188
+ */
189
+ trace(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
190
+ /**
191
+ * Log a trace values with no message. This is useful when you
192
+ * want to log properties without a message, e.g., when you want to log
193
+ * the context of a request or an operation.
194
+ *
195
+ * ```typescript
196
+ * logger.trace({ method: 'GET', url: '/api/v1/resource' });
197
+ * ```
198
+ *
199
+ * Note that this is a shorthand for:
200
+ *
201
+ * ```typescript
202
+ * logger.trace('{*}', { method: 'GET', url: '/api/v1/resource' });
203
+ * ```
204
+ *
205
+ * If the properties are expensive to compute, you cannot use this shorthand
206
+ * and should use the following syntax instead:
207
+ *
208
+ * ```typescript
209
+ * logger.trace('{*}', () => ({
210
+ * method: expensiveMethod(),
211
+ * url: expensiveUrl(),
212
+ * }));
213
+ * ```
214
+ *
215
+ * @param properties The values to log. Note that this does not take
216
+ * a callback.
217
+ * @since 0.12.0
218
+ */
219
+ trace(properties: Record<string, unknown>): void;
220
+ /**
221
+ * Lazily log a trace message. Use this when the message values are expensive
222
+ * to compute and should only be computed if the message is actually logged.
223
+ *
224
+ * ```typescript
225
+ * logger.trace(l => l`A trace message with ${expensiveValue()}.`);
226
+ * ```
227
+ *
228
+ * @param callback A callback that returns the message template prefix.
229
+ * @throws {TypeError} If no log record was made inside the callback.
230
+ * @since 0.12.0
231
+ */
232
+ trace(callback: LogCallback): void;
233
+ /**
234
+ * Log a debug message. Use this as a template string prefix.
235
+ *
236
+ * ```typescript
237
+ * logger.debug `A debug message with ${value}.`;
238
+ * ```
239
+ *
240
+ * @param message The message template strings array.
241
+ * @param values The message template values.
242
+ */
243
+ debug(message: TemplateStringsArray, ...values: readonly unknown[]): void;
244
+ /**
245
+ * Log a debug message with properties.
246
+ *
247
+ * ```typescript
248
+ * logger.debug('A debug message with {value}.', { value });
249
+ * ```
250
+ *
251
+ * If the properties are expensive to compute, you can pass a callback that
252
+ * returns the properties:
253
+ *
254
+ * ```typescript
255
+ * logger.debug(
256
+ * 'A debug message with {value}.',
257
+ * () => ({ value: expensiveComputation() })
258
+ * );
259
+ * ```
260
+ *
261
+ * @param message The message template. Placeholders to be replaced with
262
+ * `values` are indicated by keys in curly braces (e.g.,
263
+ * `{value}`).
264
+ * @param properties The values to replace placeholders with. For lazy
265
+ * evaluation, this can be a callback that returns the
266
+ * properties.
267
+ */
268
+ debug(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
269
+ /**
270
+ * Log a debug message with properties computed asynchronously.
271
+ *
272
+ * Use this when the properties require async operations to compute:
273
+ *
274
+ * ```typescript
275
+ * await logger.debug(
276
+ * 'A debug message with {value}.',
277
+ * async () => ({ value: await fetchValue() })
278
+ * );
279
+ * ```
280
+ *
281
+ * @param message The message template. Placeholders to be replaced with
282
+ * `values` are indicated by keys in curly braces (e.g.,
283
+ * `{value}`).
284
+ * @param properties An async callback that returns the properties.
285
+ * @returns A promise that resolves when the log is written.
286
+ * @since 2.0.0
287
+ */
288
+ debug(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
289
+ /**
290
+ * Log a debug values with no message. This is useful when you
291
+ * want to log properties without a message, e.g., when you want to log
292
+ * the context of a request or an operation.
293
+ *
294
+ * ```typescript
295
+ * logger.debug({ method: 'GET', url: '/api/v1/resource' });
296
+ * ```
297
+ *
298
+ * Note that this is a shorthand for:
299
+ *
300
+ * ```typescript
301
+ * logger.debug('{*}', { method: 'GET', url: '/api/v1/resource' });
302
+ * ```
303
+ *
304
+ * If the properties are expensive to compute, you cannot use this shorthand
305
+ * and should use the following syntax instead:
306
+ *
307
+ * ```typescript
308
+ * logger.debug('{*}', () => ({
309
+ * method: expensiveMethod(),
310
+ * url: expensiveUrl(),
311
+ * }));
312
+ * ```
313
+ *
314
+ * @param properties The values to log. Note that this does not take
315
+ * a callback.
316
+ * @since 0.11.0
317
+ */
318
+ debug(properties: Record<string, unknown>): void;
319
+ /**
320
+ * Lazily log a debug message. Use this when the message values are expensive
321
+ * to compute and should only be computed if the message is actually logged.
322
+ *
323
+ * ```typescript
324
+ * logger.debug(l => l`A debug message with ${expensiveValue()}.`);
325
+ * ```
326
+ *
327
+ * @param callback A callback that returns the message template prefix.
328
+ * @throws {TypeError} If no log record was made inside the callback.
329
+ */
330
+ debug(callback: LogCallback): void;
331
+ /**
332
+ * Log an informational message. Use this as a template string prefix.
333
+ *
334
+ * ```typescript
335
+ * logger.info `An info message with ${value}.`;
336
+ * ```
337
+ *
338
+ * @param message The message template strings array.
339
+ * @param values The message template values.
340
+ */
341
+ info(message: TemplateStringsArray, ...values: readonly unknown[]): void;
342
+ /**
343
+ * Log an informational message with properties.
344
+ *
345
+ * ```typescript
346
+ * logger.info('An info message with {value}.', { value });
347
+ * ```
348
+ *
349
+ * If the properties are expensive to compute, you can pass a callback that
350
+ * returns the properties:
351
+ *
352
+ * ```typescript
353
+ * logger.info(
354
+ * 'An info message with {value}.',
355
+ * () => ({ value: expensiveComputation() })
356
+ * );
357
+ * ```
358
+ *
359
+ * @param message The message template. Placeholders to be replaced with
360
+ * `values` are indicated by keys in curly braces (e.g.,
361
+ * `{value}`).
362
+ * @param properties The values to replace placeholders with. For lazy
363
+ * evaluation, this can be a callback that returns the
364
+ * properties.
365
+ */
366
+ info(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
367
+ /**
368
+ * Log an informational message with properties computed asynchronously.
369
+ *
370
+ * Use this when the properties require async operations to compute:
371
+ *
372
+ * ```typescript
373
+ * await logger.info(
374
+ * 'An info message with {value}.',
375
+ * async () => ({ value: await fetchValue() })
376
+ * );
377
+ * ```
378
+ *
379
+ * @param message The message template. Placeholders to be replaced with
380
+ * `values` are indicated by keys in curly braces (e.g.,
381
+ * `{value}`).
382
+ * @param properties An async callback that returns the properties.
383
+ * @returns A promise that resolves when the log is written.
384
+ * @since 2.0.0
385
+ */
386
+ info(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
387
+ /**
388
+ * Log an informational values with no message. This is useful when you
389
+ * want to log properties without a message, e.g., when you want to log
390
+ * the context of a request or an operation.
391
+ *
392
+ * ```typescript
393
+ * logger.info({ method: 'GET', url: '/api/v1/resource' });
394
+ * ```
395
+ *
396
+ * Note that this is a shorthand for:
397
+ *
398
+ * ```typescript
399
+ * logger.info('{*}', { method: 'GET', url: '/api/v1/resource' });
400
+ * ```
401
+ *
402
+ * If the properties are expensive to compute, you cannot use this shorthand
403
+ * and should use the following syntax instead:
404
+ *
405
+ * ```typescript
406
+ * logger.info('{*}', () => ({
407
+ * method: expensiveMethod(),
408
+ * url: expensiveUrl(),
409
+ * }));
410
+ * ```
411
+ *
412
+ * @param properties The values to log. Note that this does not take
413
+ * a callback.
414
+ * @since 0.11.0
415
+ */
416
+ info(properties: Record<string, unknown>): void;
417
+ /**
418
+ * Lazily log an informational message. Use this when the message values are
419
+ * expensive to compute and should only be computed if the message is actually
420
+ * logged.
421
+ *
422
+ * ```typescript
423
+ * logger.info(l => l`An info message with ${expensiveValue()}.`);
424
+ * ```
425
+ *
426
+ * @param callback A callback that returns the message template prefix.
427
+ * @throws {TypeError} If no log record was made inside the callback.
428
+ */
429
+ info(callback: LogCallback): void;
430
+ /**
431
+ * Log a warning.
432
+ *
433
+ * This overload is a shorthand for logging an {@link Error} instance as a
434
+ * structured property.
435
+ *
436
+ * ```typescript
437
+ * logger.warn(new Error("Oops"));
438
+ * ```
439
+ *
440
+ * Note that this uses `{error.message}` as the default message template.
441
+ * If you want to include the stack trace in text output, include `{error}`
442
+ * in the message template instead.
443
+ *
444
+ * @param error The error to log.
445
+ * @since 2.0.0
446
+ */
447
+ warn(error: Error): void;
448
+ /**
449
+ * Log a warning message with an {@link Error}.
450
+ *
451
+ * ```typescript
452
+ * logger.warn("Failed to do something", new Error("Oops"));
453
+ * ```
454
+ *
455
+ * @param message The message.
456
+ * @param error The error to log.
457
+ * @since 2.0.0
458
+ */
459
+ warn(message: string, error: Error): void;
460
+ /**
461
+ * Log a warning message. Use this as a template string prefix.
462
+ *
463
+ * ```typescript
464
+ * logger.warn `A warning message with ${value}.`;
465
+ * ```
466
+ *
467
+ * @param message The message template strings array.
468
+ * @param values The message template values.
469
+ */
470
+ warn(message: TemplateStringsArray, ...values: readonly unknown[]): void;
471
+ /**
472
+ * Log a warning message with properties.
473
+ *
474
+ * ```typescript
475
+ * logger.warn('A warning message with {value}.', { value });
476
+ * ```
477
+ *
478
+ * If the properties are expensive to compute, you can pass a callback that
479
+ * returns the properties:
480
+ *
481
+ * ```typescript
482
+ * logger.warn(
483
+ * 'A warning message with {value}.',
484
+ * () => ({ value: expensiveComputation() })
485
+ * );
486
+ * ```
487
+ *
488
+ * @param message The message template. Placeholders to be replaced with
489
+ * `values` are indicated by keys in curly braces (e.g.,
490
+ * `{value}`).
491
+ * @param properties The values to replace placeholders with. For lazy
492
+ * evaluation, this can be a callback that returns the
493
+ * properties.
494
+ */
495
+ warn(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
496
+ /**
497
+ * Log a warning message with properties computed asynchronously.
498
+ *
499
+ * Use this when the properties require async operations to compute:
500
+ *
501
+ * ```typescript
502
+ * await logger.warn(
503
+ * 'A warning message with {value}.',
504
+ * async () => ({ value: await fetchValue() })
505
+ * );
506
+ * ```
507
+ *
508
+ * @param message The message template. Placeholders to be replaced with
509
+ * `values` are indicated by keys in curly braces (e.g.,
510
+ * `{value}`).
511
+ * @param properties An async callback that returns the properties.
512
+ * @returns A promise that resolves when the log is written.
513
+ * @since 2.0.0
514
+ */
515
+ warn(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
516
+ /**
517
+ * Log a warning values with no message. This is useful when you
518
+ * want to log properties without a message, e.g., when you want to log
519
+ * the context of a request or an operation.
520
+ *
521
+ * ```typescript
522
+ * logger.warn({ method: 'GET', url: '/api/v1/resource' });
523
+ * ```
524
+ *
525
+ * Note that this is a shorthand for:
526
+ *
527
+ * ```typescript
528
+ * logger.warn('{*}', { method: 'GET', url: '/api/v1/resource' });
529
+ * ```
530
+ *
531
+ * If the properties are expensive to compute, you cannot use this shorthand
532
+ * and should use the following syntax instead:
533
+ *
534
+ * ```typescript
535
+ * logger.warn('{*}', () => ({
536
+ * method: expensiveMethod(),
537
+ * url: expensiveUrl(),
538
+ * }));
539
+ * ```
540
+ *
541
+ * @param properties The values to log. Note that this does not take
542
+ * a callback.
543
+ * @since 0.11.0
544
+ */
545
+ warn(properties: Record<string, unknown>): void;
546
+ /**
547
+ * Lazily log a warning message. Use this when the message values are
548
+ * expensive to compute and should only be computed if the message is actually
549
+ * logged.
550
+ *
551
+ * ```typescript
552
+ * logger.warn(l => l`A warning message with ${expensiveValue()}.`);
553
+ * ```
554
+ *
555
+ * @param callback A callback that returns the message template prefix.
556
+ * @throws {TypeError} If no log record was made inside the callback.
557
+ */
558
+ warn(callback: LogCallback): void;
559
+ /**
560
+ * Log a warning.
561
+ *
562
+ * This overload is a shorthand for logging an {@link Error} instance as a
563
+ * structured property.
564
+ *
565
+ * ```typescript
566
+ * logger.warning(new Error("Oops"));
567
+ * ```
568
+ *
569
+ * Note that this uses `{error.message}` as the default message template.
570
+ * If you want to include the stack trace in text output, include `{error}`
571
+ * in the message template instead.
572
+ *
573
+ * @param error The error to log.
574
+ * @since 2.0.0
575
+ */
576
+ warning(error: Error): void;
577
+ /**
578
+ * Log a warning message with an {@link Error}.
579
+ *
580
+ * ```typescript
581
+ * logger.warning("Failed to do something", new Error("Oops"));
582
+ * ```
583
+ *
584
+ * @param message The message.
585
+ * @param error The error to log.
586
+ * @since 2.0.0
587
+ */
588
+ warning(message: string, error: Error): void;
589
+ /**
590
+ * Log a warning message. Use this as a template string prefix.
591
+ *
592
+ * ```typescript
593
+ * logger.warning `A warning message with ${value}.`;
594
+ * ```
595
+ *
596
+ * @param message The message template strings array.
597
+ * @param values The message template values.
598
+ * @since 0.12.0
599
+ */
600
+ warning(message: TemplateStringsArray, ...values: readonly unknown[]): void;
601
+ /**
602
+ * Log a warning message with properties.
603
+ *
604
+ * ```typescript
605
+ * logger.warning('A warning message with {value}.', { value });
606
+ * ```
607
+ *
608
+ * If the properties are expensive to compute, you can pass a callback that
609
+ * returns the properties:
610
+ *
611
+ * ```typescript
612
+ * logger.warning(
613
+ * 'A warning message with {value}.',
614
+ * () => ({ value: expensiveComputation() })
615
+ * );
616
+ * ```
617
+ *
618
+ * @param message The message template. Placeholders to be replaced with
619
+ * `values` are indicated by keys in curly braces (e.g.,
620
+ * `{value}`).
621
+ * @param properties The values to replace placeholders with. For lazy
622
+ * evaluation, this can be a callback that returns the
623
+ * properties.
624
+ * @since 0.12.0
625
+ */
626
+ warning(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
627
+ /**
628
+ * Log a warning message with properties computed asynchronously.
629
+ *
630
+ * Use this when the properties require async operations to compute:
631
+ *
632
+ * ```typescript
633
+ * await logger.warning(
634
+ * 'A warning message with {value}.',
635
+ * async () => ({ value: await fetchValue() })
636
+ * );
637
+ * ```
638
+ *
639
+ * @param message The message template. Placeholders to be replaced with
640
+ * `values` are indicated by keys in curly braces (e.g.,
641
+ * `{value}`).
642
+ * @param properties An async callback that returns the properties.
643
+ * @returns A promise that resolves when the log is written.
644
+ * @since 2.0.0
645
+ */
646
+ warning(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
647
+ /**
648
+ * Log a warning values with no message. This is useful when you
649
+ * want to log properties without a message, e.g., when you want to log
650
+ * the context of a request or an operation.
651
+ *
652
+ * ```typescript
653
+ * logger.warning({ method: 'GET', url: '/api/v1/resource' });
654
+ * ```
655
+ *
656
+ * Note that this is a shorthand for:
657
+ *
658
+ * ```typescript
659
+ * logger.warning('{*}', { method: 'GET', url: '/api/v1/resource' });
660
+ * ```
661
+ *
662
+ * If the properties are expensive to compute, you cannot use this shorthand
663
+ * and should use the following syntax instead:
664
+ *
665
+ * ```typescript
666
+ * logger.warning('{*}', () => ({
667
+ * method: expensiveMethod(),
668
+ * url: expensiveUrl(),
669
+ * }));
670
+ * ```
671
+ *
672
+ * @param properties The values to log. Note that this does not take
673
+ * a callback.
674
+ * @since 0.12.0
675
+ */
676
+ warning(properties: Record<string, unknown>): void;
677
+ /**
678
+ * Lazily log a warning message. Use this when the message values are
679
+ * expensive to compute and should only be computed if the message is actually
680
+ * logged.
681
+ *
682
+ * ```typescript
683
+ * logger.warning(l => l`A warning message with ${expensiveValue()}.`);
684
+ * ```
685
+ *
686
+ * @param callback A callback that returns the message template prefix.
687
+ * @throws {TypeError} If no log record was made inside the callback.
688
+ * @since 0.12.0
689
+ */
690
+ warning(callback: LogCallback): void;
691
+ /**
692
+ * Log an error.
693
+ *
694
+ * This overload is a shorthand for logging an {@link Error} instance as a
695
+ * structured property.
696
+ *
697
+ * ```typescript
698
+ * logger.error(new Error("Oops"));
699
+ * ```
700
+ *
701
+ * Note that this uses `{error.message}` as the default message template.
702
+ * If you want to include the stack trace in text output, include `{error}`
703
+ * in the message template instead.
704
+ *
705
+ * @param error The error to log.
706
+ * @since 2.0.0
707
+ */
708
+ error(error: Error): void;
709
+ /**
710
+ * Log an error message with an {@link Error}.
711
+ *
712
+ * ```typescript
713
+ * logger.error("Failed to do something", new Error("Oops"));
714
+ * ```
715
+ *
716
+ * @param message The message.
717
+ * @param error The error to log.
718
+ * @since 2.0.0
719
+ */
720
+ error(message: string, error: Error): void;
721
+ /**
722
+ * Log an error message. Use this as a template string prefix.
723
+ *
724
+ * ```typescript
725
+ * logger.error `An error message with ${value}.`;
726
+ * ```
727
+ *
728
+ * @param message The message template strings array.
729
+ * @param values The message template values.
730
+ */
731
+ error(message: TemplateStringsArray, ...values: readonly unknown[]): void;
732
+ /**
733
+ * Log an error message with properties.
734
+ *
735
+ * ```typescript
736
+ * logger.warn('An error message with {value}.', { value });
737
+ * ```
738
+ *
739
+ * If the properties are expensive to compute, you can pass a callback that
740
+ * returns the properties:
741
+ *
742
+ * ```typescript
743
+ * logger.error(
744
+ * 'An error message with {value}.',
745
+ * () => ({ value: expensiveComputation() })
746
+ * );
747
+ * ```
748
+ *
749
+ * @param message The message template. Placeholders to be replaced with
750
+ * `values` are indicated by keys in curly braces (e.g.,
751
+ * `{value}`).
752
+ * @param properties The values to replace placeholders with. For lazy
753
+ * evaluation, this can be a callback that returns the
754
+ * properties.
755
+ */
756
+ error(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
757
+ /**
758
+ * Log an error message with properties computed asynchronously.
759
+ *
760
+ * Use this when the properties require async operations to compute:
761
+ *
762
+ * ```typescript
763
+ * await logger.error(
764
+ * 'An error message with {value}.',
765
+ * async () => ({ value: await fetchValue() })
766
+ * );
767
+ * ```
768
+ *
769
+ * @param message The message template. Placeholders to be replaced with
770
+ * `values` are indicated by keys in curly braces (e.g.,
771
+ * `{value}`).
772
+ * @param properties An async callback that returns the properties.
773
+ * @returns A promise that resolves when the log is written.
774
+ * @since 2.0.0
775
+ */
776
+ error(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
777
+ /**
778
+ * Log an error values with no message. This is useful when you
779
+ * want to log properties without a message, e.g., when you want to log
780
+ * the context of a request or an operation.
781
+ *
782
+ * ```typescript
783
+ * logger.error({ method: 'GET', url: '/api/v1/resource' });
784
+ * ```
785
+ *
786
+ * Note that this is a shorthand for:
787
+ *
788
+ * ```typescript
789
+ * logger.error('{*}', { method: 'GET', url: '/api/v1/resource' });
790
+ * ```
791
+ *
792
+ * If the properties are expensive to compute, you cannot use this shorthand
793
+ * and should use the following syntax instead:
794
+ *
795
+ * ```typescript
796
+ * logger.error('{*}', () => ({
797
+ * method: expensiveMethod(),
798
+ * url: expensiveUrl(),
799
+ * }));
800
+ * ```
801
+ *
802
+ * @param properties The values to log. Note that this does not take
803
+ * a callback.
804
+ * @since 0.11.0
805
+ */
806
+ error(properties: Record<string, unknown>): void;
807
+ /**
808
+ * Lazily log an error message. Use this when the message values are
809
+ * expensive to compute and should only be computed if the message is actually
810
+ * logged.
811
+ *
812
+ * ```typescript
813
+ * logger.error(l => l`An error message with ${expensiveValue()}.`);
814
+ * ```
815
+ *
816
+ * @param callback A callback that returns the message template prefix.
817
+ * @throws {TypeError} If no log record was made inside the callback.
818
+ */
819
+ error(callback: LogCallback): void;
820
+ /**
821
+ * Log a fatal error.
822
+ *
823
+ * This overload is a shorthand for logging an {@link Error} instance as a
824
+ * structured property.
825
+ *
826
+ * ```typescript
827
+ * logger.fatal(new Error("Oops"));
828
+ * ```
829
+ *
830
+ * Note that this uses `{error.message}` as the default message template.
831
+ * If you want to include the stack trace in text output, include `{error}`
832
+ * in the message template instead.
833
+ *
834
+ * @param error The error to log.
835
+ * @since 2.0.0
836
+ */
837
+ fatal(error: Error): void;
838
+ /**
839
+ * Log a fatal error message with an {@link Error}.
840
+ *
841
+ * ```typescript
842
+ * logger.fatal("Failed to do something", new Error("Oops"));
843
+ * ```
844
+ *
845
+ * @param message The message.
846
+ * @param error The error to log.
847
+ * @since 2.0.0
848
+ */
849
+ fatal(message: string, error: Error): void;
850
+ /**
851
+ * Log a fatal error message. Use this as a template string prefix.
852
+ *
853
+ * ```typescript
854
+ * logger.fatal `A fatal error message with ${value}.`;
855
+ * ```
856
+ *
857
+ * @param message The message template strings array.
858
+ * @param values The message template values.
859
+ */
860
+ fatal(message: TemplateStringsArray, ...values: readonly unknown[]): void;
861
+ /**
862
+ * Log a fatal error message with properties.
863
+ *
864
+ * ```typescript
865
+ * logger.warn('A fatal error message with {value}.', { value });
866
+ * ```
867
+ *
868
+ * If the properties are expensive to compute, you can pass a callback that
869
+ * returns the properties:
870
+ *
871
+ * ```typescript
872
+ * logger.fatal(
873
+ * 'A fatal error message with {value}.',
874
+ * () => ({ value: expensiveComputation() })
875
+ * );
876
+ * ```
877
+ *
878
+ * @param message The message template. Placeholders to be replaced with
879
+ * `values` are indicated by keys in curly braces (e.g.,
880
+ * `{value}`).
881
+ * @param properties The values to replace placeholders with. For lazy
882
+ * evaluation, this can be a callback that returns the
883
+ * properties.
884
+ */
885
+ fatal(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
886
+ /**
887
+ * Log a fatal error message with properties computed asynchronously.
888
+ *
889
+ * Use this when the properties require async operations to compute:
890
+ *
891
+ * ```typescript
892
+ * await logger.fatal(
893
+ * 'A fatal error message with {value}.',
894
+ * async () => ({ value: await fetchValue() })
895
+ * );
896
+ * ```
897
+ *
898
+ * @param message The message template. Placeholders to be replaced with
899
+ * `values` are indicated by keys in curly braces (e.g.,
900
+ * `{value}`).
901
+ * @param properties An async callback that returns the properties.
902
+ * @returns A promise that resolves when the log is written.
903
+ * @since 2.0.0
904
+ */
905
+ fatal(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
906
+ /**
907
+ * Log a fatal error values with no message. This is useful when you
908
+ * want to log properties without a message, e.g., when you want to log
909
+ * the context of a request or an operation.
910
+ *
911
+ * ```typescript
912
+ * logger.fatal({ method: 'GET', url: '/api/v1/resource' });
913
+ * ```
914
+ *
915
+ * Note that this is a shorthand for:
916
+ *
917
+ * ```typescript
918
+ * logger.fatal('{*}', { method: 'GET', url: '/api/v1/resource' });
919
+ * ```
920
+ *
921
+ * If the properties are expensive to compute, you cannot use this shorthand
922
+ * and should use the following syntax instead:
923
+ *
924
+ * ```typescript
925
+ * logger.fatal('{*}', () => ({
926
+ * method: expensiveMethod(),
927
+ * url: expensiveUrl(),
928
+ * }));
929
+ * ```
930
+ *
931
+ * @param properties The values to log. Note that this does not take
932
+ * a callback.
933
+ * @since 0.11.0
934
+ */
935
+ fatal(properties: Record<string, unknown>): void;
936
+ /**
937
+ * Lazily log a fatal error message. Use this when the message values are
938
+ * expensive to compute and should only be computed if the message is actually
939
+ * logged.
940
+ *
941
+ * ```typescript
942
+ * logger.fatal(l => l`A fatal error message with ${expensiveValue()}.`);
943
+ * ```
944
+ *
945
+ * @param callback A callback that returns the message template prefix.
946
+ * @throws {TypeError} If no log record was made inside the callback.
947
+ */
948
+ fatal(callback: LogCallback): void;
949
+ /**
950
+ * Emits a log record with custom fields while using this logger's
951
+ * category.
952
+ *
953
+ * This is a low-level API for integration scenarios where you need full
954
+ * control over the log record, particularly for preserving timestamps
955
+ * from external systems.
956
+ *
957
+ * ```typescript
958
+ * const logger = getLogger(["my-app", "integration"]);
959
+ *
960
+ * // Emit a log with a custom timestamp
961
+ * logger.emit({
962
+ * timestamp: kafkaLog.originalTimestamp,
963
+ * level: "info",
964
+ * message: [kafkaLog.message],
965
+ * rawMessage: kafkaLog.message,
966
+ * properties: {
967
+ * source: "kafka",
968
+ * partition: kafkaLog.partition,
969
+ * offset: kafkaLog.offset,
970
+ * },
971
+ * });
972
+ * ```
973
+ *
974
+ * @param record Log record without category field (category comes from
975
+ * the logger instance)
976
+ * @since 1.1.0
977
+ */
978
+ emit(record: Omit<LogRecord, "category">): void;
979
+ /**
980
+ * Check if a message of the given severity level would be processed by
981
+ * this logger.
982
+ *
983
+ * This is useful for conditionally executing expensive computations
984
+ * before logging, particularly for async operations where lazy
985
+ * evaluation callbacks cannot be used:
986
+ *
987
+ * ```typescript
988
+ * if (logger.isEnabledFor("debug")) {
989
+ * const result = await expensiveAsync();
990
+ * logger.debug("Result: {result}", { result });
991
+ * }
992
+ * ```
993
+ *
994
+ * @param level The log level to check.
995
+ * @returns `true` if a message of the given level would be logged,
996
+ * `false` otherwise.
997
+ * @since 2.0.0
998
+ */
999
+ isEnabledFor(level: LogLevel): boolean;
1000
+ }
1001
+ /**
1002
+ * A logging callback function. It is used to defer the computation of a
1003
+ * message template until it is actually logged.
1004
+ * @param prefix The message template prefix.
1005
+ * @returns The rendered message array.
1006
+ */
1007
+ type LogCallback = (prefix: LogTemplatePrefix) => unknown[];
1008
+ /**
1009
+ * A logging template prefix function. It is used to log a message in
1010
+ * a {@link LogCallback} function.
1011
+ * @param message The message template strings array.
1012
+ * @param values The message template values.
1013
+ * @returns The rendered message array.
1014
+ */
1015
+ type LogTemplatePrefix = (message: TemplateStringsArray, ...values: unknown[]) => unknown[];
1016
+ /**
1017
+ * A function type for logging methods in the {@link Logger} interface.
1018
+ * @since 1.0.0
1019
+ */
1020
+ //#endregion
1021
+ export { Logger as t };