@bgord/bun 1.15.1 → 1.15.3
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/command-envelope.d.ts +6 -4
- package/dist/command-envelope.d.ts.map +1 -1
- package/dist/command-envelope.js +4 -0
- package/dist/command-envelope.js.map +1 -1
- package/dist/event-envelope.d.ts +1 -0
- package/dist/event-envelope.d.ts.map +1 -1
- package/dist/event-envelope.js +7 -0
- package/dist/event-envelope.js.map +1 -1
- package/dist/event-loop-lag.service.d.ts +1 -1
- package/dist/event-loop-lag.service.js +2 -2
- package/dist/i18n.service.d.ts +2 -2
- package/dist/i18n.service.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/mailer-with-logger.adapter.d.ts +2 -3
- package/dist/mailer-with-logger.adapter.d.ts.map +1 -1
- package/dist/mailer-with-logger.adapter.js.map +1 -1
- package/dist/mailer-with-retry.adapter.d.ts +19 -0
- package/dist/mailer-with-retry.adapter.d.ts.map +1 -0
- package/dist/mailer-with-retry.adapter.js +16 -0
- package/dist/mailer-with-retry.adapter.js.map +1 -0
- package/dist/mailer-with-timeout.adapter.d.ts +19 -0
- package/dist/mailer-with-timeout.adapter.d.ts.map +1 -0
- package/dist/mailer-with-timeout.adapter.js +15 -0
- package/dist/mailer-with-timeout.adapter.js.map +1 -0
- package/dist/mailer.builder.d.ts +14 -0
- package/dist/mailer.builder.d.ts.map +1 -0
- package/dist/mailer.builder.js +28 -0
- package/dist/mailer.builder.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/woodchopper-dispatcher-async.strategy.d.ts.map +1 -1
- package/dist/woodchopper-dispatcher-async.strategy.js +1 -1
- package/dist/woodchopper-dispatcher-async.strategy.js.map +1 -1
- package/dist/woodchopper-dispatcher-sampling.strategy.d.ts +2 -2
- package/dist/woodchopper-dispatcher-sampling.strategy.d.ts.map +1 -1
- package/dist/woodchopper-dispatcher-sampling.strategy.js.map +1 -1
- package/dist/woodchopper-sampling-composite.strategy.d.ts +3 -3
- package/dist/woodchopper-sampling-composite.strategy.d.ts.map +1 -1
- package/dist/woodchopper-sampling-composite.strategy.js.map +1 -1
- package/dist/woodchopper-sampling-correlation-id.strategy.d.ts +2 -2
- package/dist/woodchopper-sampling-correlation-id.strategy.d.ts.map +1 -1
- package/dist/woodchopper-sampling-every-nth.strategy.d.ts +2 -2
- package/dist/woodchopper-sampling-every-nth.strategy.d.ts.map +1 -1
- package/dist/woodchopper-sampling-pass-component.strategy.d.ts +2 -2
- package/dist/woodchopper-sampling-pass-component.strategy.d.ts.map +1 -1
- package/dist/woodchopper-sampling-pass-level.strategy.d.ts +2 -2
- package/dist/woodchopper-sampling-pass-level.strategy.d.ts.map +1 -1
- package/dist/woodchopper-sampling.strategy.d.ts +1 -1
- package/dist/woodchopper-sampling.strategy.d.ts.map +1 -1
- package/package.json +4 -4
- package/readme.md +3 -0
- package/src/command-envelope.ts +9 -0
- package/src/event-envelope.ts +13 -0
- package/src/event-loop-lag.service.ts +2 -2
- package/src/i18n.service.ts +2 -2
- package/src/index.ts +4 -0
- package/src/mailer-with-logger.adapter.ts +2 -2
- package/src/mailer-with-retry.adapter.ts +22 -0
- package/src/mailer-with-timeout.adapter.ts +22 -0
- package/src/mailer.builder.ts +45 -0
- package/src/woodchopper-dispatcher-async.strategy.ts +1 -1
- package/src/woodchopper-dispatcher-sampling.strategy.ts +2 -2
- package/src/woodchopper-sampling-composite.strategy.ts +3 -3
- package/src/woodchopper-sampling-correlation-id.strategy.ts +2 -2
- package/src/woodchopper-sampling-every-nth.strategy.ts +2 -2
- package/src/woodchopper-sampling-pass-component.strategy.ts +2 -2
- package/src/woodchopper-sampling-pass-level.strategy.ts +2 -2
- package/src/woodchopper-sampling.strategy.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woodchopper-dispatcher-async.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-dispatcher-async.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAO3E,eAAO,MAAM,+BAA+B;uCACP,KAAK,CAAC,mBAAmB;CAE7D,CAAC;AAEF,qBAAa,0BAA2B,YAAW,qBAAqB;IASpE,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAT3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAEnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IACjD,OAAO,CAAC,KAAK,CAA2C;IAExD,OAAO,CAAC,IAAI,CAAC,CAAa;gBAGP,IAAI,EAAE,uBAAuB,EAC7B,QAAQ,GAAE,KAAK,CAAC,mBAA6C;IAKhF,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAWrC,KAAK,IAAI,IAAI;YAqBC,GAAG;
|
|
1
|
+
{"version":3,"file":"woodchopper-dispatcher-async.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-dispatcher-async.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAO3E,eAAO,MAAM,+BAA+B;uCACP,KAAK,CAAC,mBAAmB;CAE7D,CAAC;AAEF,qBAAa,0BAA2B,YAAW,qBAAqB;IASp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AAE,EAAE,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;IACxB,CAAC;IAEO,KAAK,CAAC,YAAY;QACxB,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAClC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { LoggerEntry } from "./logger.port";
|
|
2
2
|
import type { WoodchopperDispatcher } from "./woodchopper-dispatcher.strategy";
|
|
3
|
-
import type {
|
|
3
|
+
import type { WoodchopperSamplingStrategy } from "./woodchopper-sampling.strategy";
|
|
4
4
|
export declare class WoodchopperDispatcherSampling implements WoodchopperDispatcher {
|
|
5
5
|
private readonly inner;
|
|
6
6
|
private readonly strategy;
|
|
7
7
|
onError?: (error: unknown) => void;
|
|
8
|
-
constructor(inner: WoodchopperDispatcher, strategy:
|
|
8
|
+
constructor(inner: WoodchopperDispatcher, strategy: WoodchopperSamplingStrategy);
|
|
9
9
|
dispatch(entry: LoggerEntry): boolean;
|
|
10
10
|
close(): void;
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woodchopper-dispatcher-sampling.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-dispatcher-sampling.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"woodchopper-dispatcher-sampling.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-dispatcher-sampling.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAEnF,qBAAa,6BAA8B,YAAW,qBAAqB;IAIvE,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAJ3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;gBAGhB,KAAK,EAAE,qBAAqB,EAC5B,QAAQ,EAAE,2BAA2B;IAKxD,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAIrC,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woodchopper-dispatcher-sampling.strategy.js","sourceRoot":"","sources":["../src/woodchopper-dispatcher-sampling.strategy.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,6BAA6B;IAIrB;IACA;IAJnB,OAAO,CAA4B;IAEnC,YACmB,KAA4B,EAC5B,
|
|
1
|
+
{"version":3,"file":"woodchopper-dispatcher-sampling.strategy.js","sourceRoot":"","sources":["../src/woodchopper-dispatcher-sampling.strategy.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,6BAA6B;IAIrB;IACA;IAJnB,OAAO,CAA4B;IAEnC,YACmB,KAA4B,EAC5B,QAAqC;QADrC,UAAK,GAAL,KAAK,CAAuB;QAC5B,aAAQ,GAAR,QAAQ,CAA6B;QAEtD,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IACxD,CAAC;IAED,QAAQ,CAAC,KAAkB;QACzB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1E,CAAC;IAED,KAAK;QACH,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { LoggerEntry } from "./logger.port";
|
|
2
|
-
import type {
|
|
3
|
-
export declare class WoodchopperSamplingComposite implements
|
|
2
|
+
import type { WoodchopperSamplingStrategy } from "./woodchopper-sampling.strategy";
|
|
3
|
+
export declare class WoodchopperSamplingComposite implements WoodchopperSamplingStrategy {
|
|
4
4
|
private readonly strategies;
|
|
5
|
-
constructor(strategies: ReadonlyArray<
|
|
5
|
+
constructor(strategies: ReadonlyArray<WoodchopperSamplingStrategy>);
|
|
6
6
|
decide(entry: LoggerEntry): boolean;
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=woodchopper-sampling-composite.strategy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woodchopper-sampling-composite.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-sampling-composite.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"woodchopper-sampling-composite.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-sampling-composite.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAEnF,qBAAa,4BAA6B,YAAW,2BAA2B;IAClE,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,aAAa,CAAC,2BAA2B,CAAC;IAEnF,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;CAOpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woodchopper-sampling-composite.strategy.js","sourceRoot":"","sources":["../src/woodchopper-sampling-composite.strategy.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,4BAA4B;IACV;IAA7B,YAA6B,
|
|
1
|
+
{"version":3,"file":"woodchopper-sampling-composite.strategy.js","sourceRoot":"","sources":["../src/woodchopper-sampling-composite.strategy.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,4BAA4B;IACV;IAA7B,YAA6B,UAAsD;QAAtD,eAAU,GAAV,UAAU,CAA4C;IAAG,CAAC;IAEvF,MAAM,CAAC,KAAkB;QACvB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACvC,IAAI,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC;QAC1C,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type * as tools from "@bgord/tools";
|
|
2
2
|
import type { LoggerEntry } from "./logger.port";
|
|
3
|
-
import type {
|
|
3
|
+
import type { WoodchopperSamplingStrategy } from "./woodchopper-sampling.strategy";
|
|
4
4
|
type Config = {
|
|
5
5
|
everyNth: tools.IntegerPositiveType;
|
|
6
6
|
};
|
|
7
|
-
export declare class WoodchoperSamplingCorrelationId implements
|
|
7
|
+
export declare class WoodchoperSamplingCorrelationId implements WoodchopperSamplingStrategy {
|
|
8
8
|
private readonly config;
|
|
9
9
|
constructor(config: Config);
|
|
10
10
|
decide(entry: LoggerEntry): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woodchopper-sampling-correlation-id.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-sampling-correlation-id.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"woodchopper-sampling-correlation-id.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-sampling-correlation-id.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAEnF,KAAK,MAAM,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC,mBAAmB,CAAA;CAAE,CAAC;AAEtD,qBAAa,+BAAgC,YAAW,2BAA2B;IACrE,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE3C,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;CAMpC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type * as tools from "@bgord/tools";
|
|
2
2
|
import type { LoggerEntry } from "./logger.port";
|
|
3
|
-
import type {
|
|
3
|
+
import type { WoodchopperSamplingStrategy } from "./woodchopper-sampling.strategy";
|
|
4
4
|
type Config = {
|
|
5
5
|
n: tools.IntegerPositiveType;
|
|
6
6
|
};
|
|
7
|
-
export declare class WoodchopperSamplingEveryNth implements
|
|
7
|
+
export declare class WoodchopperSamplingEveryNth implements WoodchopperSamplingStrategy {
|
|
8
8
|
private readonly config;
|
|
9
9
|
constructor(config: Config);
|
|
10
10
|
private counter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woodchopper-sampling-every-nth.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-sampling-every-nth.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"woodchopper-sampling-every-nth.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-sampling-every-nth.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAEnF,KAAK,MAAM,GAAG;IAAE,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAA;CAAE,CAAC;AAE/C,qBAAa,2BAA4B,YAAW,2BAA2B;IACjE,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE3C,OAAO,CAAC,OAAO,CAAK;IAEpB,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO;CAQrC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LoggerEntry } from "./logger.port";
|
|
2
|
-
import type {
|
|
3
|
-
export declare class WoodchopperSamplingPassComponent implements
|
|
2
|
+
import type { WoodchopperSamplingStrategy } from "./woodchopper-sampling.strategy";
|
|
3
|
+
export declare class WoodchopperSamplingPassComponent implements WoodchopperSamplingStrategy {
|
|
4
4
|
private readonly components;
|
|
5
5
|
constructor(components: ReadonlyArray<LoggerEntry["component"]>);
|
|
6
6
|
decide(entry: LoggerEntry): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woodchopper-sampling-pass-component.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-sampling-pass-component.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"woodchopper-sampling-pass-component.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-sampling-pass-component.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAEnF,qBAAa,gCAAiC,YAAW,2BAA2B;IACtE,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,aAAa,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAEhF,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;CAGpC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LoggerEntry, LogLevelEnum } from "./logger.port";
|
|
2
|
-
import type {
|
|
3
|
-
export declare class WoodchopperSamplingPassLevel implements
|
|
2
|
+
import type { WoodchopperSamplingStrategy } from "./woodchopper-sampling.strategy";
|
|
3
|
+
export declare class WoodchopperSamplingPassLevel implements WoodchopperSamplingStrategy {
|
|
4
4
|
private readonly levels;
|
|
5
5
|
constructor(levels: ReadonlyArray<LogLevelEnum>);
|
|
6
6
|
decide(entry: LoggerEntry): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woodchopper-sampling-pass-level.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-sampling-pass-level.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"woodchopper-sampling-pass-level.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-sampling-pass-level.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAEnF,qBAAa,4BAA6B,YAAW,2BAA2B;IAClE,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC;IAEhE,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;CAGpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woodchopper-sampling.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-sampling.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"woodchopper-sampling.strategy.d.ts","sourceRoot":"","sources":["../src/woodchopper-sampling.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,WAAW,2BAA2B;IAC1C,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC;CACrC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bgord/bun",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Bartosz Gordon",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@types/yazl": "3.3.0",
|
|
31
31
|
"better-auth": "1.5.5",
|
|
32
32
|
"cspell": "9.7.0",
|
|
33
|
-
"csv": "6.
|
|
34
|
-
"knip": "5.
|
|
33
|
+
"csv": "6.5.0",
|
|
34
|
+
"knip": "5.88.0",
|
|
35
35
|
"lefthook": "2.1.4",
|
|
36
36
|
"lockfile-lint": "5.0.0",
|
|
37
37
|
"nodemailer": "8.0.2",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"better-auth": "1.5.5",
|
|
53
|
-
"csv": "6.
|
|
53
|
+
"csv": "6.5.0",
|
|
54
54
|
"nodemailer": "8.0.2",
|
|
55
55
|
"resend": "6.9.4",
|
|
56
56
|
"sharp": "0.34.5",
|
package/readme.md
CHANGED
|
@@ -249,6 +249,9 @@ src/
|
|
|
249
249
|
├── mailer-subject.vo.ts
|
|
250
250
|
├── mailer-template.vo.ts
|
|
251
251
|
├── mailer-with-logger.adapter.ts
|
|
252
|
+
├── mailer-with-retry.adapter.ts
|
|
253
|
+
├── mailer-with-timeout.adapter.ts
|
|
254
|
+
├── mailer.builder.ts
|
|
252
255
|
├── mailer.port.ts
|
|
253
256
|
├── markdown-generator-noop.adapter.ts
|
|
254
257
|
├── markdown-generator.adapter.ts
|
package/src/command-envelope.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
|
+
import * as v from "valibot";
|
|
2
3
|
import type { ClockPort } from "./clock.port";
|
|
3
4
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
4
5
|
import type { IdProviderPort } from "./id-provider.port";
|
|
@@ -14,3 +15,11 @@ export const createCommandEnvelope = (deps: Dependencies) =>
|
|
|
14
15
|
correlationId: CorrelationStorage.get(),
|
|
15
16
|
createdAt: deps.Clock.now().ms,
|
|
16
17
|
}) as const;
|
|
18
|
+
|
|
19
|
+
export function command<Schema extends v.ObjectSchema<any, any>>(
|
|
20
|
+
schema: Schema,
|
|
21
|
+
fields: Omit<v.InferOutput<Schema>, "id" | "correlationId" | "createdAt" | "name">,
|
|
22
|
+
deps: Dependencies,
|
|
23
|
+
): v.InferOutput<Schema> {
|
|
24
|
+
return v.parse(schema, { ...createCommandEnvelope(deps), name: schema.entries.name.literal, ...fields });
|
|
25
|
+
}
|
package/src/event-envelope.ts
CHANGED
|
@@ -25,3 +25,16 @@ export const createEventEnvelope = (stream: EventStreamType, deps: Dependencies)
|
|
|
25
25
|
stream,
|
|
26
26
|
version: 1,
|
|
27
27
|
}) as const;
|
|
28
|
+
|
|
29
|
+
export function event<Schema extends v.ObjectSchema<any, any>>(
|
|
30
|
+
schema: Schema,
|
|
31
|
+
stream: EventStreamType,
|
|
32
|
+
payload: v.InferOutput<Schema>["payload"],
|
|
33
|
+
deps: Dependencies,
|
|
34
|
+
): v.InferOutput<Schema> {
|
|
35
|
+
return v.parse(schema, {
|
|
36
|
+
...createEventEnvelope(stream, deps),
|
|
37
|
+
name: schema.entries.name.literal,
|
|
38
|
+
payload,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -3,7 +3,7 @@ import * as tools from "@bgord/tools";
|
|
|
3
3
|
|
|
4
4
|
export type EventLoopLagSnapshotType = { p50: tools.Duration; p95: tools.Duration; p99: tools.Duration };
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const EventLoopLagError = { NotStarted: "event.loop.lag.not.started" };
|
|
7
7
|
|
|
8
8
|
export class EventLoopLag {
|
|
9
9
|
private static histogram: ReturnType<typeof perf_hooks.monitorEventLoopDelay> | null = null;
|
|
@@ -16,7 +16,7 @@ export class EventLoopLag {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
static snapshot(): EventLoopLagSnapshotType {
|
|
19
|
-
if (!EventLoopLag.histogram) throw new Error(
|
|
19
|
+
if (!EventLoopLag.histogram) throw new Error(EventLoopLagError.NotStarted);
|
|
20
20
|
|
|
21
21
|
return {
|
|
22
22
|
p50: tools.Duration.Ns(EventLoopLag.histogram.percentile(50)),
|
package/src/i18n.service.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
2
|
import * as v from "valibot";
|
|
3
|
-
import type { FileReaderJsonPort } from "
|
|
4
|
-
import type { LoggerPort } from "
|
|
3
|
+
import type { FileReaderJsonPort } from "./file-reader-json.port";
|
|
4
|
+
import type { LoggerPort } from "./logger.port";
|
|
5
5
|
|
|
6
6
|
export type TranslationsKeyType = string;
|
|
7
7
|
export type TranslationsValueType = string;
|
package/src/index.ts
CHANGED
|
@@ -213,6 +213,8 @@ export * from "./logger-collecting.adapter";
|
|
|
213
213
|
export * from "./logger-noop.adapter";
|
|
214
214
|
export * from "./logger-stats-provider.port";
|
|
215
215
|
export * from "./logger-stats-provider-noop.adapter";
|
|
216
|
+
export * from "./mailer.builder";
|
|
217
|
+
export * from "./mailer.builder";
|
|
216
218
|
export * from "./mailer.port";
|
|
217
219
|
export * from "./mailer-content-html.vo";
|
|
218
220
|
export * from "./mailer-noop.adapter";
|
|
@@ -221,6 +223,8 @@ export * from "./mailer-smtp.adapter";
|
|
|
221
223
|
export * from "./mailer-subject.vo";
|
|
222
224
|
export * from "./mailer-template.vo";
|
|
223
225
|
export * from "./mailer-with-logger.adapter";
|
|
226
|
+
export * from "./mailer-with-retry.adapter";
|
|
227
|
+
export * from "./mailer-with-timeout.adapter";
|
|
224
228
|
export * from "./markdown-generator.adapter";
|
|
225
229
|
export * from "./markdown-generator.port";
|
|
226
230
|
export * from "./markdown-generator-noop.adapter";
|
|
@@ -4,12 +4,12 @@ import type { MailerPort } from "./mailer.port";
|
|
|
4
4
|
import type { MailerTemplate } from "./mailer-template.vo";
|
|
5
5
|
import { Stopwatch } from "./stopwatch.service";
|
|
6
6
|
|
|
7
|
-
type
|
|
7
|
+
export type MailerWithLoggerAdapterDependencies = { inner: MailerPort; Logger: LoggerPort; Clock: ClockPort };
|
|
8
8
|
|
|
9
9
|
export class MailerWithLoggerAdapter implements MailerPort {
|
|
10
10
|
private readonly base = { component: "infra", operation: "mailer" };
|
|
11
11
|
|
|
12
|
-
constructor(private readonly deps:
|
|
12
|
+
constructor(private readonly deps: MailerWithLoggerAdapterDependencies) {}
|
|
13
13
|
|
|
14
14
|
async send(template: MailerTemplate): Promise<void> {
|
|
15
15
|
const duration = new Stopwatch(this.deps);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MailerPort } from "./mailer.port";
|
|
2
|
+
import type { MailerTemplate } from "./mailer-template.vo";
|
|
3
|
+
import { Retry, type RetryConfig } from "./retry.service";
|
|
4
|
+
import type { SleeperPort } from "./sleeper.port";
|
|
5
|
+
|
|
6
|
+
export type MailerWithRetryAdapterDependencies = { Sleeper: SleeperPort; inner: MailerPort };
|
|
7
|
+
export type MailerWithRetryAdapterConfig = { retry: RetryConfig };
|
|
8
|
+
|
|
9
|
+
export class MailerWithRetryAdapter implements MailerPort {
|
|
10
|
+
constructor(
|
|
11
|
+
private readonly config: MailerWithRetryAdapterConfig,
|
|
12
|
+
private readonly deps: MailerWithRetryAdapterDependencies,
|
|
13
|
+
) {}
|
|
14
|
+
|
|
15
|
+
async send(template: MailerTemplate): Promise<void> {
|
|
16
|
+
await new Retry(this.deps).run(async () => this.deps.inner.send(template), this.config.retry);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async verify(): Promise<boolean> {
|
|
20
|
+
return this.deps.inner.verify();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type * as tools from "@bgord/tools";
|
|
2
|
+
import type { MailerPort } from "./mailer.port";
|
|
3
|
+
import type { MailerTemplate } from "./mailer-template.vo";
|
|
4
|
+
import type { TimeoutRunnerPort } from "./timeout-runner.port";
|
|
5
|
+
|
|
6
|
+
export type MailerWithTimeoutAdapterDependencies = { TimeoutRunner: TimeoutRunnerPort; inner: MailerPort };
|
|
7
|
+
export type MailerWithTimeoutAdapterConfig = { timeout: tools.Duration };
|
|
8
|
+
|
|
9
|
+
export class MailerWithTimeoutAdapter implements MailerPort {
|
|
10
|
+
constructor(
|
|
11
|
+
private readonly config: MailerWithTimeoutAdapterConfig,
|
|
12
|
+
private readonly deps: MailerWithTimeoutAdapterDependencies,
|
|
13
|
+
) {}
|
|
14
|
+
|
|
15
|
+
async send(template: MailerTemplate): Promise<void> {
|
|
16
|
+
await this.deps.TimeoutRunner.run(this.deps.inner.send(template), this.config.timeout);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async verify(): Promise<boolean> {
|
|
20
|
+
return this.deps.inner.verify();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { MailerPort } from "./mailer.port";
|
|
2
|
+
import {
|
|
3
|
+
MailerWithLoggerAdapter,
|
|
4
|
+
type MailerWithLoggerAdapterDependencies,
|
|
5
|
+
} from "./mailer-with-logger.adapter";
|
|
6
|
+
import {
|
|
7
|
+
MailerWithRetryAdapter,
|
|
8
|
+
type MailerWithRetryAdapterConfig,
|
|
9
|
+
type MailerWithRetryAdapterDependencies,
|
|
10
|
+
} from "./mailer-with-retry.adapter";
|
|
11
|
+
import {
|
|
12
|
+
MailerWithTimeoutAdapter,
|
|
13
|
+
type MailerWithTimeoutAdapterConfig,
|
|
14
|
+
type MailerWithTimeoutAdapterDependencies,
|
|
15
|
+
} from "./mailer-with-timeout.adapter";
|
|
16
|
+
|
|
17
|
+
export class MailerBuilder {
|
|
18
|
+
constructor(private inner: MailerPort) {}
|
|
19
|
+
|
|
20
|
+
static of(mailer: MailerPort): MailerBuilder {
|
|
21
|
+
return new MailerBuilder(mailer);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
withLogger(deps: Omit<MailerWithLoggerAdapterDependencies, "inner">) {
|
|
25
|
+
this.inner = new MailerWithLoggerAdapter({ ...deps, inner: this.inner });
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
withRetry(config: MailerWithRetryAdapterConfig, deps: Omit<MailerWithRetryAdapterDependencies, "inner">) {
|
|
30
|
+
this.inner = new MailerWithRetryAdapter(config, { ...deps, inner: this.inner });
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
withTimeout(
|
|
35
|
+
config: MailerWithTimeoutAdapterConfig,
|
|
36
|
+
deps: Omit<MailerWithTimeoutAdapterDependencies, "inner">,
|
|
37
|
+
) {
|
|
38
|
+
this.inner = new MailerWithTimeoutAdapter(config, { ...deps, inner: this.inner });
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
build() {
|
|
43
|
+
return this.inner;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { LoggerEntry } from "./logger.port";
|
|
2
2
|
import type { WoodchopperDispatcher } from "./woodchopper-dispatcher.strategy";
|
|
3
|
-
import type {
|
|
3
|
+
import type { WoodchopperSamplingStrategy } from "./woodchopper-sampling.strategy";
|
|
4
4
|
|
|
5
5
|
export class WoodchopperDispatcherSampling implements WoodchopperDispatcher {
|
|
6
6
|
onError?: (error: unknown) => void;
|
|
7
7
|
|
|
8
8
|
constructor(
|
|
9
9
|
private readonly inner: WoodchopperDispatcher,
|
|
10
|
-
private readonly strategy:
|
|
10
|
+
private readonly strategy: WoodchopperSamplingStrategy,
|
|
11
11
|
) {
|
|
12
12
|
this.inner.onError = (error) => this.onError?.(error);
|
|
13
13
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { LoggerEntry } from "./logger.port";
|
|
2
|
-
import type {
|
|
2
|
+
import type { WoodchopperSamplingStrategy } from "./woodchopper-sampling.strategy";
|
|
3
3
|
|
|
4
|
-
export class WoodchopperSamplingComposite implements
|
|
5
|
-
constructor(private readonly strategies: ReadonlyArray<
|
|
4
|
+
export class WoodchopperSamplingComposite implements WoodchopperSamplingStrategy {
|
|
5
|
+
constructor(private readonly strategies: ReadonlyArray<WoodchopperSamplingStrategy>) {}
|
|
6
6
|
|
|
7
7
|
decide(entry: LoggerEntry): boolean {
|
|
8
8
|
for (const strategy of this.strategies) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type * as tools from "@bgord/tools";
|
|
2
2
|
import { fnv1a32 } from "./fnv1a32.service";
|
|
3
3
|
import type { LoggerEntry } from "./logger.port";
|
|
4
|
-
import type {
|
|
4
|
+
import type { WoodchopperSamplingStrategy } from "./woodchopper-sampling.strategy";
|
|
5
5
|
|
|
6
6
|
type Config = { everyNth: tools.IntegerPositiveType };
|
|
7
7
|
|
|
8
|
-
export class WoodchoperSamplingCorrelationId implements
|
|
8
|
+
export class WoodchoperSamplingCorrelationId implements WoodchopperSamplingStrategy {
|
|
9
9
|
constructor(private readonly config: Config) {}
|
|
10
10
|
|
|
11
11
|
decide(entry: LoggerEntry): boolean {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type * as tools from "@bgord/tools";
|
|
2
2
|
import type { LoggerEntry } from "./logger.port";
|
|
3
|
-
import type {
|
|
3
|
+
import type { WoodchopperSamplingStrategy } from "./woodchopper-sampling.strategy";
|
|
4
4
|
|
|
5
5
|
type Config = { n: tools.IntegerPositiveType };
|
|
6
6
|
|
|
7
|
-
export class WoodchopperSamplingEveryNth implements
|
|
7
|
+
export class WoodchopperSamplingEveryNth implements WoodchopperSamplingStrategy {
|
|
8
8
|
constructor(private readonly config: Config) {}
|
|
9
9
|
|
|
10
10
|
private counter = 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LoggerEntry } from "./logger.port";
|
|
2
|
-
import type {
|
|
2
|
+
import type { WoodchopperSamplingStrategy } from "./woodchopper-sampling.strategy";
|
|
3
3
|
|
|
4
|
-
export class WoodchopperSamplingPassComponent implements
|
|
4
|
+
export class WoodchopperSamplingPassComponent implements WoodchopperSamplingStrategy {
|
|
5
5
|
constructor(private readonly components: ReadonlyArray<LoggerEntry["component"]>) {}
|
|
6
6
|
|
|
7
7
|
decide(entry: LoggerEntry): boolean {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LoggerEntry, LogLevelEnum } from "./logger.port";
|
|
2
|
-
import type {
|
|
2
|
+
import type { WoodchopperSamplingStrategy } from "./woodchopper-sampling.strategy";
|
|
3
3
|
|
|
4
|
-
export class WoodchopperSamplingPassLevel implements
|
|
4
|
+
export class WoodchopperSamplingPassLevel implements WoodchopperSamplingStrategy {
|
|
5
5
|
constructor(private readonly levels: ReadonlyArray<LogLevelEnum>) {}
|
|
6
6
|
|
|
7
7
|
decide(entry: LoggerEntry): boolean {
|