@bgord/bun 1.16.5 → 1.17.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/alert-channel-with-logger.adapter.d.ts.map +1 -1
- package/dist/alert-channel-with-logger.adapter.js +9 -1
- package/dist/alert-channel-with-logger.adapter.js.map +1 -1
- package/dist/antivirus-with-logger.adapter.d.ts.map +1 -1
- package/dist/antivirus-with-logger.adapter.js +4 -0
- package/dist/antivirus-with-logger.adapter.js.map +1 -1
- package/dist/cache-file.service.js +2 -2
- package/dist/cache-file.service.js.map +1 -1
- package/dist/certificate-inspector-tls.adapter.js +2 -1
- package/dist/certificate-inspector-tls.adapter.js.map +1 -1
- package/dist/clock-system.adapter.js +1 -1
- package/dist/clock-system.adapter.js.map +1 -1
- package/dist/cron-task-handler-with-logger.strategy.js +2 -2
- package/dist/cron-task-handler-with-logger.strategy.js.map +1 -1
- package/dist/handler-with-logger.strategy.d.ts.map +1 -1
- package/dist/handler-with-logger.strategy.js +2 -0
- package/dist/handler-with-logger.strategy.js.map +1 -1
- package/dist/healthcheck-hono.handler.d.ts +1 -1
- package/dist/healthcheck.handler.js +1 -1
- package/dist/healthcheck.handler.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/job-queue-noop.adapter.d.ts +21 -0
- package/dist/job-queue-noop.adapter.d.ts.map +1 -0
- package/dist/job-queue-noop.adapter.js +22 -0
- package/dist/job-queue-noop.adapter.js.map +1 -0
- package/dist/mailer-with-logger.adapter.d.ts.map +1 -1
- package/dist/mailer-with-logger.adapter.js +15 -2
- package/dist/mailer-with-logger.adapter.js.map +1 -1
- package/dist/pdf-generator-with-logger.adapter.d.ts.map +1 -1
- package/dist/pdf-generator-with-logger.adapter.js +9 -1
- package/dist/pdf-generator-with-logger.adapter.js.map +1 -1
- package/dist/remote-file-storage-with-logger.adapter.d.ts.map +1 -1
- package/dist/remote-file-storage-with-logger.adapter.js +18 -1
- package/dist/remote-file-storage-with-logger.adapter.js.map +1 -1
- package/dist/semaphore.service.js.map +1 -1
- package/dist/sms-with-logger.adapter.d.ts.map +1 -1
- package/dist/sms-with-logger.adapter.js +9 -1
- package/dist/sms-with-logger.adapter.js.map +1 -1
- package/dist/timekeeper-google.adapter.d.ts.map +1 -1
- package/dist/timekeeper-google.adapter.js +2 -1
- package/dist/timekeeper-google.adapter.js.map +1 -1
- package/dist/uptime.service.d.ts +2 -2
- package/dist/uptime.service.d.ts.map +1 -1
- package/dist/uptime.service.js +2 -2
- package/dist/uptime.service.js.map +1 -1
- package/dist/woodchopper.js +1 -1
- package/dist/woodchopper.js.map +1 -1
- package/package.json +12 -12
- package/readme.md +1 -0
- package/src/alert-channel-with-logger.adapter.ts +9 -1
- package/src/antivirus-with-logger.adapter.ts +4 -0
- package/src/cache-file.service.ts +2 -2
- package/src/certificate-inspector-tls.adapter.ts +2 -2
- package/src/clock-system.adapter.ts +1 -1
- package/src/cron-task-handler-with-logger.strategy.ts +2 -2
- package/src/handler-with-logger.strategy.ts +2 -0
- package/src/healthcheck.handler.ts +1 -1
- package/src/index.ts +1 -0
- package/src/job-queue-noop.adapter.ts +37 -0
- package/src/mailer-with-logger.adapter.ts +15 -2
- package/src/pdf-generator-with-logger.adapter.ts +9 -1
- package/src/remote-file-storage-with-logger.adapter.ts +18 -1
- package/src/semaphore.service.ts +1 -1
- package/src/sms-with-logger.adapter.ts +9 -1
- package/src/timekeeper-google.adapter.ts +2 -1
- package/src/uptime.service.ts +3 -6
- package/src/woodchopper.ts +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as tools from "@bgord/tools";
|
|
2
2
|
import type { ClockPort } from "./clock.port";
|
|
3
|
+
import { CorrelationStorage } from "./correlation-storage.service";
|
|
3
4
|
import type { LoggerPort } from "./logger.port";
|
|
4
5
|
import type {
|
|
5
6
|
RemoteFileStoragePort,
|
|
@@ -22,6 +23,7 @@ export class RemoteFileStorageWithLoggerAdapter implements RemoteFileStoragePort
|
|
|
22
23
|
try {
|
|
23
24
|
this.deps.Logger.info({
|
|
24
25
|
message: "Remote file storage put attempt",
|
|
26
|
+
correlationId: CorrelationStorage.get(),
|
|
25
27
|
metadata: { key: input.key },
|
|
26
28
|
...this.base,
|
|
27
29
|
});
|
|
@@ -30,6 +32,7 @@ export class RemoteFileStorageWithLoggerAdapter implements RemoteFileStoragePort
|
|
|
30
32
|
|
|
31
33
|
this.deps.Logger.info({
|
|
32
34
|
message: "Remote file storage put success",
|
|
35
|
+
correlationId: CorrelationStorage.get(),
|
|
33
36
|
metadata: { key: input.key, size: result.size, duration: duration.stop() },
|
|
34
37
|
...this.base,
|
|
35
38
|
});
|
|
@@ -38,6 +41,7 @@ export class RemoteFileStorageWithLoggerAdapter implements RemoteFileStoragePort
|
|
|
38
41
|
} catch (error) {
|
|
39
42
|
this.deps.Logger.error({
|
|
40
43
|
message: "Remote file storage put error",
|
|
44
|
+
correlationId: CorrelationStorage.get(),
|
|
41
45
|
error,
|
|
42
46
|
metadata: { key: input.key, duration: duration.stop() },
|
|
43
47
|
...this.base,
|
|
@@ -51,12 +55,18 @@ export class RemoteFileStorageWithLoggerAdapter implements RemoteFileStoragePort
|
|
|
51
55
|
const duration = new Stopwatch(this.deps);
|
|
52
56
|
|
|
53
57
|
try {
|
|
54
|
-
this.deps.Logger.info({
|
|
58
|
+
this.deps.Logger.info({
|
|
59
|
+
message: "Remote file storage head attempt",
|
|
60
|
+
correlationId: CorrelationStorage.get(),
|
|
61
|
+
metadata: { key },
|
|
62
|
+
...this.base,
|
|
63
|
+
});
|
|
55
64
|
|
|
56
65
|
const result = await this.deps.inner.head(key);
|
|
57
66
|
|
|
58
67
|
this.deps.Logger.info({
|
|
59
68
|
message: "Remote file storage head success",
|
|
69
|
+
correlationId: CorrelationStorage.get(),
|
|
60
70
|
metadata: { key, exists: result.exists, duration: duration.stop() },
|
|
61
71
|
...this.base,
|
|
62
72
|
});
|
|
@@ -65,6 +75,7 @@ export class RemoteFileStorageWithLoggerAdapter implements RemoteFileStoragePort
|
|
|
65
75
|
} catch (error) {
|
|
66
76
|
this.deps.Logger.error({
|
|
67
77
|
message: "Remote file storage head error",
|
|
78
|
+
correlationId: CorrelationStorage.get(),
|
|
68
79
|
error,
|
|
69
80
|
metadata: { key, duration: duration.stop() },
|
|
70
81
|
...this.base,
|
|
@@ -80,6 +91,7 @@ export class RemoteFileStorageWithLoggerAdapter implements RemoteFileStoragePort
|
|
|
80
91
|
try {
|
|
81
92
|
this.deps.Logger.info({
|
|
82
93
|
message: "Remote file storage get stream attempt",
|
|
94
|
+
correlationId: CorrelationStorage.get(),
|
|
83
95
|
metadata: { key },
|
|
84
96
|
...this.base,
|
|
85
97
|
});
|
|
@@ -88,6 +100,7 @@ export class RemoteFileStorageWithLoggerAdapter implements RemoteFileStoragePort
|
|
|
88
100
|
|
|
89
101
|
this.deps.Logger.info({
|
|
90
102
|
message: "Remote file storage get stream success",
|
|
103
|
+
correlationId: CorrelationStorage.get(),
|
|
91
104
|
metadata: { key, duration: duration.stop() },
|
|
92
105
|
...this.base,
|
|
93
106
|
});
|
|
@@ -96,6 +109,7 @@ export class RemoteFileStorageWithLoggerAdapter implements RemoteFileStoragePort
|
|
|
96
109
|
} catch (error) {
|
|
97
110
|
this.deps.Logger.error({
|
|
98
111
|
message: "Remote file storage get stream error",
|
|
112
|
+
correlationId: CorrelationStorage.get(),
|
|
99
113
|
error,
|
|
100
114
|
metadata: { key, duration: duration.stop() },
|
|
101
115
|
...this.base,
|
|
@@ -111,6 +125,7 @@ export class RemoteFileStorageWithLoggerAdapter implements RemoteFileStoragePort
|
|
|
111
125
|
try {
|
|
112
126
|
this.deps.Logger.info({
|
|
113
127
|
message: "Remote file storage delete attempt",
|
|
128
|
+
correlationId: CorrelationStorage.get(),
|
|
114
129
|
metadata: { key },
|
|
115
130
|
...this.base,
|
|
116
131
|
});
|
|
@@ -119,12 +134,14 @@ export class RemoteFileStorageWithLoggerAdapter implements RemoteFileStoragePort
|
|
|
119
134
|
|
|
120
135
|
this.deps.Logger.info({
|
|
121
136
|
message: "Remote file storage delete success",
|
|
137
|
+
correlationId: CorrelationStorage.get(),
|
|
122
138
|
metadata: { key, duration: duration.stop() },
|
|
123
139
|
...this.base,
|
|
124
140
|
});
|
|
125
141
|
} catch (error) {
|
|
126
142
|
this.deps.Logger.error({
|
|
127
143
|
message: "Remote file storage delete error",
|
|
144
|
+
correlationId: CorrelationStorage.get(),
|
|
128
145
|
error,
|
|
129
146
|
metadata: { key, duration: duration.stop() },
|
|
130
147
|
...this.base,
|
package/src/semaphore.service.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as tools from "@bgord/tools";
|
|
2
2
|
import type { ClockPort } from "./clock.port";
|
|
3
|
+
import { CorrelationStorage } from "./correlation-storage.service";
|
|
3
4
|
import type { LoggerPort } from "./logger.port";
|
|
4
5
|
import type { SmsPort } from "./sms.port";
|
|
5
6
|
import { Stopwatch } from "./stopwatch.service";
|
|
@@ -15,18 +16,25 @@ export class SmsWithLoggerAdapter implements SmsPort {
|
|
|
15
16
|
const duration = new Stopwatch(this.deps);
|
|
16
17
|
|
|
17
18
|
try {
|
|
18
|
-
this.deps.Logger.info({
|
|
19
|
+
this.deps.Logger.info({
|
|
20
|
+
message: "SMS attempt",
|
|
21
|
+
correlationId: CorrelationStorage.get(),
|
|
22
|
+
metadata: message.toJSON(),
|
|
23
|
+
...this.base,
|
|
24
|
+
});
|
|
19
25
|
|
|
20
26
|
await this.deps.inner.send(message);
|
|
21
27
|
|
|
22
28
|
this.deps.Logger.info({
|
|
23
29
|
message: "SMS success",
|
|
30
|
+
correlationId: CorrelationStorage.get(),
|
|
24
31
|
metadata: { message: message.toJSON(), duration: duration.stop() },
|
|
25
32
|
...this.base,
|
|
26
33
|
});
|
|
27
34
|
} catch (error) {
|
|
28
35
|
this.deps.Logger.error({
|
|
29
36
|
message: "SMS error",
|
|
37
|
+
correlationId: CorrelationStorage.get(),
|
|
30
38
|
error,
|
|
31
39
|
metadata: { message: message.toJSON(), duration: duration.stop() },
|
|
32
40
|
...this.base,
|
|
@@ -11,7 +11,8 @@ export class TimekeeperGoogleAdapter implements TimekeeperPort {
|
|
|
11
11
|
const date = response.headers.get("Date");
|
|
12
12
|
|
|
13
13
|
if (!date) return null;
|
|
14
|
-
|
|
14
|
+
// biome-ignore lint: lint/style/noRestrictedGlobals
|
|
15
|
+
return tools.Timestamp.fromNumber(new Date(date).getTime());
|
|
15
16
|
} catch {
|
|
16
17
|
return null;
|
|
17
18
|
}
|
package/src/uptime.service.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
2
|
import type { ClockPort } from "./clock.port";
|
|
3
3
|
|
|
4
|
-
export type UptimeResultType = {
|
|
5
|
-
duration: tools.Duration;
|
|
6
|
-
formatted: ReturnType<(typeof tools.DateFormatters)["relative"]>;
|
|
7
|
-
};
|
|
4
|
+
export type UptimeResultType = { duration: tools.Duration; formatted: string };
|
|
8
5
|
|
|
9
6
|
export class Uptime {
|
|
10
7
|
private static readonly rounding = new tools.RoundingToNearestStrategy();
|
|
11
8
|
|
|
12
|
-
static get(
|
|
9
|
+
static get(_clock: ClockPort): UptimeResultType {
|
|
13
10
|
const duration = tools.Duration.Seconds(Uptime.rounding.round(process.uptime()));
|
|
14
11
|
|
|
15
|
-
return { duration, formatted:
|
|
12
|
+
return { duration, formatted: "TODO" };
|
|
16
13
|
}
|
|
17
14
|
}
|
package/src/woodchopper.ts
CHANGED
|
@@ -73,7 +73,7 @@ export class Woodchopper implements LoggerPort, LoggerStatsProviderPort {
|
|
|
73
73
|
let withInjectedFields: LoggerEntry;
|
|
74
74
|
try {
|
|
75
75
|
withInjectedFields = {
|
|
76
|
-
timestamp:
|
|
76
|
+
timestamp: this.deps.Clock.now().toInstant().toString(),
|
|
77
77
|
level,
|
|
78
78
|
app: this.config.app,
|
|
79
79
|
environment: this.config.environment,
|