@bgord/bun 1.21.3 → 1.21.5
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 +2 -2
- package/dist/command-envelope.d.ts.map +1 -1
- package/dist/command-envelope.js +6 -1
- package/dist/command-envelope.js.map +1 -1
- package/dist/correlation-hono.middleware.d.ts +2 -2
- package/dist/correlation-hono.middleware.d.ts.map +1 -1
- package/dist/correlation-hono.middleware.js.map +1 -1
- package/dist/correlation-id.vo.d.ts +2 -2
- package/dist/correlation-id.vo.d.ts.map +1 -1
- package/dist/correlation-id.vo.js +2 -1
- package/dist/correlation-id.vo.js.map +1 -1
- package/dist/correlation.middleware.js +1 -1
- package/dist/correlation.middleware.js.map +1 -1
- package/dist/cron-task-handler-bare.strategy.d.ts.map +1 -1
- package/dist/cron-task-handler-bare.strategy.js +4 -1
- package/dist/cron-task-handler-bare.strategy.js.map +1 -1
- package/dist/cron-task-handler-with-logger.strategy.d.ts.map +1 -1
- package/dist/cron-task-handler-with-logger.strategy.js +3 -1
- package/dist/cron-task-handler-with-logger.strategy.js.map +1 -1
- package/dist/event-envelope.d.ts +2 -2
- package/dist/event-envelope.d.ts.map +1 -1
- package/dist/event-envelope.js +2 -1
- package/dist/event-envelope.js.map +1 -1
- package/dist/event-revision-assigner.adapter.d.ts.map +1 -1
- package/dist/event-revision-assigner.adapter.js +6 -1
- package/dist/event-revision-assigner.adapter.js.map +1 -1
- package/dist/event.types.d.ts +2 -1
- package/dist/event.types.d.ts.map +1 -1
- package/dist/http-logger.middleware.d.ts +3 -2
- package/dist/http-logger.middleware.d.ts.map +1 -1
- package/dist/http-logger.middleware.js.map +1 -1
- package/dist/job-envelope.d.ts +2 -2
- package/dist/job-envelope.d.ts.map +1 -1
- package/dist/job-envelope.js +2 -1
- package/dist/job-envelope.js.map +1 -1
- package/dist/job-queue-worker.service.d.ts.map +1 -1
- package/dist/job-queue-worker.service.js +2 -1
- package/dist/job-queue-worker.service.js.map +1 -1
- package/dist/job.types.d.ts +2 -1
- package/dist/job.types.d.ts.map +1 -1
- package/dist/modules/history/events/HISTORY_CLEARED_EVENT.d.ts +2 -2
- package/dist/modules/history/events/HISTORY_POPULATED_EVENT.d.ts +2 -2
- package/dist/modules/preferences/commands/SET_USER_LANGUAGE_COMMAND.d.ts +1 -1
- package/dist/modules/preferences/events/USER_LANGUAGE_SET_EVENT.d.ts +2 -2
- package/dist/modules/system/events/HOUR_HAS_PASSED_EVENT.d.ts +2 -2
- package/dist/modules/system/events/MINUTE_HAS_PASSED_EVENT.d.ts +2 -2
- package/dist/modules/system/events/SECURITY_VIOLATION_DETECTED_EVENT.d.ts +2 -2
- package/dist/modules/system/jobs/SEND_EMAIL_JOB.d.ts +2 -2
- package/dist/shield-maintenance.strategy.d.ts +1 -1
- package/package.json +2 -2
- package/src/command-envelope.ts +6 -1
- package/src/correlation-hono.middleware.ts +2 -2
- package/src/correlation-id.vo.ts +2 -2
- package/src/correlation.middleware.ts +1 -1
- package/src/cron-task-handler-bare.strategy.ts +5 -1
- package/src/cron-task-handler-with-logger.strategy.ts +3 -1
- package/src/event-envelope.ts +2 -1
- package/src/event-revision-assigner.adapter.ts +6 -1
- package/src/event.types.ts +2 -1
- package/src/http-logger.middleware.ts +3 -2
- package/src/job-envelope.ts +2 -1
- package/src/job-queue-worker.service.ts +2 -1
- package/src/job.types.ts +2 -1
|
@@ -7,12 +7,12 @@ type Dependencies = {
|
|
|
7
7
|
};
|
|
8
8
|
export declare const CommandEnvelopeSchema: {
|
|
9
9
|
id: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
10
|
-
correlationId: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
10
|
+
correlationId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>, v.BrandAction<string, "CorrelationId">]>;
|
|
11
11
|
createdAt: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.SafeIntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "TimestampValue">]>;
|
|
12
12
|
};
|
|
13
13
|
export declare const createCommandEnvelope: (deps: Dependencies) => {
|
|
14
14
|
readonly id: string;
|
|
15
|
-
readonly correlationId: string
|
|
15
|
+
readonly correlationId: string & v.Brand<"CorrelationId">;
|
|
16
16
|
readonly createdAt: number & v.Brand<"TimestampValue">;
|
|
17
17
|
};
|
|
18
18
|
export declare function command<Schema extends v.ObjectSchema<any, any>>(schema: Schema, fields: Omit<v.InferOutput<Schema>, "id" | "correlationId" | "createdAt" | "name">, deps: Dependencies): v.InferOutput<Schema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-envelope.d.ts","sourceRoot":"","sources":["../src/command-envelope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"command-envelope.d.ts","sourceRoot":"","sources":["../src/command-envelope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,KAAK,YAAY,GAAG;IAAE,UAAU,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAErE,eAAO,MAAM,qBAAqB;IAChC,EAAE;IACF,aAAa;IACb,SAAS;CACV,CAAC;AAEF,eAAO,MAAM,qBAAqB,SAAU,YAAY;aAEpD,EAAE;aACF,aAAa;aACb,SAAS;CACA,CAAC;AAEd,wBAAgB,OAAO,CAAC,MAAM,SAAS,CAAC,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,EAC7D,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,GAAG,eAAe,GAAG,WAAW,GAAG,MAAM,CAAC,EAClF,IAAI,EAAE,YAAY,GACjB,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAEvB"}
|
package/dist/command-envelope.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
2
|
import * as v from "valibot";
|
|
3
|
+
import { CorrelationId } from "./correlation-id.vo";
|
|
3
4
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
4
5
|
import { UUID } from "./uuid.vo";
|
|
5
|
-
export const CommandEnvelopeSchema = {
|
|
6
|
+
export const CommandEnvelopeSchema = {
|
|
7
|
+
id: UUID,
|
|
8
|
+
correlationId: CorrelationId,
|
|
9
|
+
createdAt: tools.TimestampValue,
|
|
10
|
+
};
|
|
6
11
|
export const createCommandEnvelope = (deps) => ({
|
|
7
12
|
id: deps.IdProvider.generate(),
|
|
8
13
|
correlationId: CorrelationStorage.get(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-envelope.js","sourceRoot":"","sources":["../src/command-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"command-envelope.js","sourceRoot":"","sources":["../src/command-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,EAAE,EAAE,IAAI;IACR,aAAa,EAAE,aAAa;IAC5B,SAAS,EAAE,KAAK,CAAC,cAAc;CAChC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAkB,EAAE,EAAE,CAC1D,CAAC;IACC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE;IAC9B,aAAa,EAAE,kBAAkB,CAAC,GAAG,EAAE;IACvC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE;CAC/B,CAAU,CAAC;AAEd,MAAM,UAAU,OAAO,CACrB,MAAc,EACd,MAAkF,EAClF,IAAkB;IAElB,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,GAAG,qBAAqB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;AAC3G,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type CorrelationMiddlewareDependencies } from "./correlation.middleware";
|
|
2
|
+
import type { CorrelationIdType } from "./correlation-id.vo";
|
|
2
3
|
import type { MiddlewareHonoPort } from "./middleware-hono.port";
|
|
3
|
-
import type { UUIDType } from "./uuid.vo";
|
|
4
4
|
export type CorrelationVariables = {
|
|
5
|
-
correlationId:
|
|
5
|
+
correlationId: CorrelationIdType;
|
|
6
6
|
};
|
|
7
7
|
export declare class CorrelationHonoMiddleware implements MiddlewareHonoPort {
|
|
8
8
|
private readonly correlationId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correlation-hono.middleware.d.ts","sourceRoot":"","sources":["../src/correlation-hono.middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,iCAAiC,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"correlation-hono.middleware.d.ts","sourceRoot":"","sources":["../src/correlation-hono.middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,iCAAiC,EAAE,MAAM,0BAA0B,CAAC;AACzG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGjE,MAAM,MAAM,oBAAoB,GAAG;IAAE,aAAa,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAExE,qBAAa,yBAA0B,YAAW,kBAAkB;IAClE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAwB;IAEtD,YAAY,IAAI,EAAE,iCAAiC,EAElD;IAED,MAAM;mBACiC,oBAAoB;6BAa1D;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correlation-hono.middleware.js","sourceRoot":"","sources":["../src/correlation-hono.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAA0C,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"correlation-hono.middleware.js","sourceRoot":"","sources":["../src/correlation-hono.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAA0C,MAAM,0BAA0B,CAAC;AAEzG,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAI3E,MAAM,OAAO,yBAAyB;IACnB,aAAa,CAAwB;IAEtD,YAAY,IAAuC;QACjD,IAAI,CAAC,aAAa,GAAG,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;IAED,MAAM;QACJ,OAAO,gBAAgB,CAAsC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;YAC7E,MAAM,OAAO,GAAG,IAAI,yBAAyB,CAAC,CAAC,CAAC,CAAC;YAEjD,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAEpD,CAAC,CAAC,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;YAE/B,OAAO,kBAAkB,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE;gBAC/C,MAAM,IAAI,EAAE,CAAC;gBAEb,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;YACtD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const CorrelationId: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const CorrelationId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>, v.BrandAction<string, "CorrelationId">]>;
|
|
3
3
|
export type CorrelationIdType = v.InferOutput<typeof CorrelationId>;
|
|
4
4
|
//# sourceMappingURL=correlation-id.vo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correlation-id.vo.d.ts","sourceRoot":"","sources":["../src/correlation-id.vo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"correlation-id.vo.d.ts","sourceRoot":"","sources":["../src/correlation-id.vo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAG7B,eAAO,MAAM,aAAa,kKAAyC,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correlation-id.vo.js","sourceRoot":"","sources":["../src/correlation-id.vo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"correlation-id.vo.js","sourceRoot":"","sources":["../src/correlation-id.vo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC"}
|
|
@@ -11,7 +11,7 @@ export class CorrelationMiddleware {
|
|
|
11
11
|
const existing = v.safeParse(CorrelationId, incoming);
|
|
12
12
|
if (existing.success)
|
|
13
13
|
return existing.output;
|
|
14
|
-
return this.deps.IdProvider.generate();
|
|
14
|
+
return v.parse(CorrelationId, this.deps.IdProvider.generate());
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=correlation.middleware.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correlation.middleware.js","sourceRoot":"","sources":["../src/correlation.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,aAAa,EAA0B,MAAM,qBAAqB,CAAC;AAM5E,MAAM,OAAO,qBAAqB;IAGH,IAAI;IAFjC,MAAM,CAAU,WAAW,GAAG,gBAAgB,CAAC;IAE/C,YAA6B,IAAuC;oBAAvC,IAAI;IAAsC,CAAC;IAExE,QAAQ,CAAC,OAAyB;QAChC,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;QAE3E,MAAM,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;QAEtD,IAAI,QAAQ,CAAC,OAAO;YAAE,OAAO,QAAQ,CAAC,MAAM,CAAC;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"correlation.middleware.js","sourceRoot":"","sources":["../src/correlation.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,aAAa,EAA0B,MAAM,qBAAqB,CAAC;AAM5E,MAAM,OAAO,qBAAqB;IAGH,IAAI;IAFjC,MAAM,CAAU,WAAW,GAAG,gBAAgB,CAAC;IAE/C,YAA6B,IAAuC;oBAAvC,IAAI;IAAsC,CAAC;IAExE,QAAQ,CAAC,OAAyB;QAChC,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;QAE3E,MAAM,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;QAEtD,IAAI,QAAQ,CAAC,OAAO;YAAE,OAAO,QAAQ,CAAC,MAAM,CAAC;QAC7C,OAAO,CAAC,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjE,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron-task-handler-bare.strategy.d.ts","sourceRoot":"","sources":["../src/cron-task-handler-bare.strategy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cron-task-handler-bare.strategy.d.ts","sourceRoot":"","sources":["../src/cron-task-handler-bare.strategy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,KAAK,YAAY,GAAG;IAAE,UAAU,EAAE,cAAc,CAAA;CAAE,CAAC;AAEnD,qBAAa,2BAA4B,YAAW,uBAAuB;IAC7D,OAAO,CAAC,QAAQ,CAAC,IAAI;IAAjC,YAA6B,IAAI,EAAE,YAAY,EAAI;IAEnD,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAO/B;CACF"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { CorrelationId } from "./correlation-id.vo";
|
|
1
3
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
2
4
|
export class CronTaskHandlerBareStrategy {
|
|
3
5
|
deps;
|
|
@@ -5,9 +7,10 @@ export class CronTaskHandlerBareStrategy {
|
|
|
5
7
|
this.deps = deps;
|
|
6
8
|
}
|
|
7
9
|
handle(task) {
|
|
10
|
+
const correlationId = v.parse(CorrelationId, this.deps.IdProvider.generate());
|
|
8
11
|
return {
|
|
9
12
|
...task,
|
|
10
|
-
handler: async () => CorrelationStorage.run(
|
|
13
|
+
handler: async () => CorrelationStorage.run(correlationId, task.handler),
|
|
11
14
|
};
|
|
12
15
|
}
|
|
13
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron-task-handler-bare.strategy.js","sourceRoot":"","sources":["../src/cron-task-handler-bare.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAOnE,MAAM,OAAO,2BAA2B;IACT,IAAI;IAAjC,YAA6B,IAAkB;oBAAlB,IAAI;IAAiB,CAAC;IAEnD,MAAM,CAAC,IAAc;QACnB,OAAO;YACL,GAAG,IAAI;YACP,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"cron-task-handler-bare.strategy.js","sourceRoot":"","sources":["../src/cron-task-handler-bare.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAOnE,MAAM,OAAO,2BAA2B;IACT,IAAI;IAAjC,YAA6B,IAAkB;oBAAlB,IAAI;IAAiB,CAAC;IAEnD,MAAM,CAAC,IAAc;QACnB,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;QAE9E,OAAO;YACL,GAAG,IAAI;YACP,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC;SACzE,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron-task-handler-with-logger.strategy.d.ts","sourceRoot":"","sources":["../src/cron-task-handler-with-logger.strategy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cron-task-handler-with-logger.strategy.d.ts","sourceRoot":"","sources":["../src/cron-task-handler-with-logger.strategy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,KAAK,YAAY,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAEzF,qBAAa,iCAAkC,YAAW,uBAAuB;IAGnE,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA0D;IAE/E,YAA6B,IAAI,EAAE,YAAY,EAAI;IAEnD,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,CA+B/B;CACF"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { CorrelationId } from "./correlation-id.vo";
|
|
1
3
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
2
4
|
import { Stopwatch } from "./stopwatch.service";
|
|
3
5
|
export class CronTaskHandlerWithLoggerStrategy {
|
|
@@ -10,7 +12,7 @@ export class CronTaskHandlerWithLoggerStrategy {
|
|
|
10
12
|
return {
|
|
11
13
|
...task,
|
|
12
14
|
handler: async () => {
|
|
13
|
-
const correlationId = this.deps.IdProvider.generate();
|
|
15
|
+
const correlationId = v.parse(CorrelationId, this.deps.IdProvider.generate());
|
|
14
16
|
const duration = new Stopwatch(this.deps);
|
|
15
17
|
try {
|
|
16
18
|
this.deps.Logger.info({ message: `${task.label} start`, correlationId, ...this.base });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron-task-handler-with-logger.strategy.js","sourceRoot":"","sources":["../src/cron-task-handler-with-logger.strategy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cron-task-handler-with-logger.strategy.js","sourceRoot":"","sources":["../src/cron-task-handler-with-logger.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAKnE,OAAO,EAAE,SAAS,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Q,CAAC,IAAI,EAAE,EAAE;oBACvC,GAAG,IAAI,CAAC,IAAI;iBACb,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
|
package/dist/event-envelope.d.ts
CHANGED
|
@@ -11,11 +11,11 @@ type Dependencies = {
|
|
|
11
11
|
};
|
|
12
12
|
export declare const EventEnvelopeSchema: {
|
|
13
13
|
id: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
14
|
-
correlationId: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
14
|
+
correlationId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>, v.BrandAction<string, "CorrelationId">]>;
|
|
15
15
|
createdAt: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.SafeIntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "TimestampValue">]>;
|
|
16
16
|
stream: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.MinLengthAction<string, 1, string>, v.MaxLengthAction<string, 256, string>]>;
|
|
17
17
|
version: v.LiteralSchema<1, undefined>;
|
|
18
|
-
revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>]>, undefined>;
|
|
18
|
+
revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "RevisionValue">]>, undefined>;
|
|
19
19
|
commit: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.RegexAction<string, string>, v.BrandAction<string, "CommitShaValue">]>;
|
|
20
20
|
};
|
|
21
21
|
export declare function event<Schema extends v.ObjectSchema<any, any>>(schema: Schema, stream: EventStreamType, payload: v.InferOutput<Schema>["payload"], deps: Dependencies): v.InferOutput<Schema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-envelope.d.ts","sourceRoot":"","sources":["../src/event-envelope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"event-envelope.d.ts","sourceRoot":"","sources":["../src/event-envelope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGhF,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,KAAK,YAAY,GAAG;IAClB,UAAU,EAAE,cAAc,CAAC;IAC3B,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CACpD,CAAC;AAEF,eAAO,MAAM,mBAAmB;IAC9B,EAAE;IACF,aAAa;IACb,SAAS;IACT,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM;CACP,CAAC;AAWF,wBAAgB,KAAK,CAAC,MAAM,SAAS,CAAC,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,EAC3D,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EACzC,IAAI,EAAE,YAAY,GACjB,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAOvB"}
|
package/dist/event-envelope.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
import { CommitShaValue } from "./commit-sha-value.vo";
|
|
4
|
+
import { CorrelationId } from "./correlation-id.vo";
|
|
4
5
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
5
6
|
import { EventStream } from "./event-stream.vo";
|
|
6
7
|
import { UUID } from "./uuid.vo";
|
|
7
8
|
export const EventEnvelopeSchema = {
|
|
8
9
|
id: UUID,
|
|
9
|
-
correlationId:
|
|
10
|
+
correlationId: CorrelationId,
|
|
10
11
|
createdAt: tools.TimestampValue,
|
|
11
12
|
stream: EventStream,
|
|
12
13
|
version: v.literal(1),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-envelope.js","sourceRoot":"","sources":["../src/event-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,cAAc,EAA2B,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AAGtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQjC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,EAAE,EAAE,IAAI;IACR,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"event-envelope.js","sourceRoot":"","sources":["../src/event-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,cAAc,EAA2B,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAA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version":3,"file":"event-revision-assigner.adapter.d.ts","sourceRoot":"","sources":["../src/event-revision-assigner.adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAEhF,qBAAa,4BAA6B,YAAW,yBAAyB;IAC5E,MAAM,CAAC,QAAQ,CAAC,qBAAqB,MAAM;IAE3C,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,sBAAsB,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC,sBAAsB,CAAC,CAOzG;CACF"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import * as tools from "@bgord/tools";
|
|
2
|
+
import * as v from "valibot";
|
|
1
3
|
export class EventRevisionAssignerAdapter {
|
|
2
4
|
static EMPTY_STREAM_REVISION = -1;
|
|
3
5
|
assign(events, max) {
|
|
4
6
|
const current = max ?? EventRevisionAssignerAdapter.EMPTY_STREAM_REVISION;
|
|
5
|
-
return events.map((event, index) => ({
|
|
7
|
+
return events.map((event, index) => ({
|
|
8
|
+
...event,
|
|
9
|
+
revision: v.parse(tools.RevisionValue, current + index + 1),
|
|
10
|
+
}));
|
|
6
11
|
}
|
|
7
12
|
}
|
|
8
13
|
//# sourceMappingURL=event-revision-assigner.adapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-revision-assigner.adapter.js","sourceRoot":"","sources":["../src/event-revision-assigner.adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event-revision-assigner.adapter.js","sourceRoot":"","sources":["../src/event-revision-assigner.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAI7B,MAAM,OAAO,4BAA4B;IACvC,MAAM,CAAU,qBAAqB,GAAG,CAAC,CAAC,CAAC;IAE3C,MAAM,CAAC,MAA6C,EAAE,GAAY;QAChE,MAAM,OAAO,GAAG,GAAG,IAAI,4BAA4B,CAAC,qBAAqB,CAAC;QAE1E,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YACnC,GAAG,KAAK;YACR,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,OAAO,GAAG,KAAK,GAAG,CAAC,CAAC;SAC5D,CAAC,CAAC,CAAC;IACN,CAAC;CACF"}
|
package/dist/event.types.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type * as tools from "@bgord/tools";
|
|
2
|
+
import type { CorrelationIdType } from "./correlation-id.vo";
|
|
2
3
|
import type { EventStreamType } from "./event-stream.vo";
|
|
3
4
|
import type { UUIDType } from "./uuid.vo";
|
|
4
5
|
export type GenericEvent = {
|
|
5
6
|
id: UUIDType;
|
|
6
|
-
correlationId:
|
|
7
|
+
correlationId: CorrelationIdType;
|
|
7
8
|
createdAt: number;
|
|
8
9
|
stream: EventStreamType;
|
|
9
10
|
revision?: tools.RevisionValueType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.types.d.ts","sourceRoot":"","sources":["../src/event.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,QAAQ,CAAC;IACb,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"event.types.d.ts","sourceRoot":"","sources":["../src/event.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,QAAQ,CAAC;IACb,aAAa,EAAE,iBAAiB,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ClockPort } from "./clock.port";
|
|
2
|
+
import type { CorrelationIdType } from "./correlation-id.vo";
|
|
2
3
|
import { type LoggerPort } from "./logger.port";
|
|
3
4
|
import type { HasRequestHeader, HasRequestPath, RequestContext } from "./request-context.port";
|
|
4
5
|
import { Stopwatch } from "./stopwatch.service";
|
|
@@ -24,7 +25,7 @@ export declare class HttpLoggerMiddleware {
|
|
|
24
25
|
private readonly config?;
|
|
25
26
|
constructor(deps: HttpLoggerMiddlewareDependencies, config?: HttpLoggerConfig | undefined);
|
|
26
27
|
shouldSkip(context: HasRequestPath & HasRequestHeader): boolean;
|
|
27
|
-
before(context: RequestContext, correlationId:
|
|
28
|
-
after(context: RequestContext, correlationId:
|
|
28
|
+
before(context: RequestContext, correlationId: CorrelationIdType, body?: any): HttpLoggerBeforeResult;
|
|
29
|
+
after(context: RequestContext, correlationId: CorrelationIdType, input: HttpLoggerAfterInput): void;
|
|
29
30
|
}
|
|
30
31
|
//# sourceMappingURL=http-logger.middleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-logger.middleware.d.ts","sourceRoot":"","sources":["../src/http-logger.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,KAAK,UAAU,EAAgB,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,eAAO,MAAM,qBAAqB,UAoBjC,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAExF,MAAM,MAAM,gBAAgB,GAAG;IAAE,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,UAAU,CAAC,CAAA;CAAE,CAAC;AAE7E,MAAM,MAAM,sBAAsB,GAAG;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,CAAC;AAC9D,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,GAAG,CAAC;CACnB,CAAC;AAEF,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IAF1B,YACmB,IAAI,EAAE,gCAAgC,EACtC,MAAM,CAAC,EAAE,gBAAgB,YAAA,EACxC;IAEJ,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,gBAAgB,GAAG,OAAO,CAS9D;IAED,MAAM,CAAC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"http-logger.middleware.d.ts","s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OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAAE,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAkBlG;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-logger.middleware.js","sourceRoot":"","sources":["../src/http-logger.middleware.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-logger.middleware.js","sourceRoot":"","sources":["../src/http-logger.middleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,YAAY,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,QAAQ;IACR,iBAAiB;IACjB,eAAe;IACf,YAAY;IACZ,gBAAgB;IAChB,cAAc;IACd,QAAQ;IACR,KAAK;IACL,MAAM;IACN,QAAQ;IACR,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,SAAS;IACT,2BAA2B;IAC3B,YAAY;IACZ,eAAe;IACf,UAAU;CACX,CAAC;AAcF,MAAM,OAAO,oBAAoB;IAEZ,IAAI;IACJ,MAAM;IAFzB,YACmB,IAAsC,EACtC,MAAyB;oBADzB,IAAI;sBACJ,MAAM;IACtB,CAAC;IAEJ,UAAU,CAAC,OAA0C;QACnD,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC;YAAE,OAAO,IAAI,CAAC;QAEjG,OAAO,CACL,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YAC/B,IAAI,IAAI,YAAY,UAAU;gBAAE,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YACrF,OAAO,OAAO,CAAC,OAAO,CAAC,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QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;QACxE,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;QAE3E,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACtB,SAAS,EAAE,MAAM;YACjB,SAAS,EAAE,oBAAoB;YAC/B,aAAa;YACb,OAAO,EAAE,UAAU;YACnB,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM;YAC9B,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;YAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,EAAE,EAAE,QAAQ,CAAC,EAAE;YACf,MAAM;YACN,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,QAAQ,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,YAAY,EAAE;SAC3C,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/job-envelope.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ type Dependencies = {
|
|
|
7
7
|
};
|
|
8
8
|
export declare const JobEnvelopeSchema: {
|
|
9
9
|
id: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
10
|
-
correlationId: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
10
|
+
correlationId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>, v.BrandAction<string, "CorrelationId">]>;
|
|
11
11
|
createdAt: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.SafeIntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "TimestampValue">]>;
|
|
12
|
-
revision: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>]>;
|
|
12
|
+
revision: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "RevisionValue">]>;
|
|
13
13
|
};
|
|
14
14
|
export declare function job<Schema extends v.ObjectSchema<any, any>>(schema: Schema, payload: v.InferOutput<Schema>["payload"], deps: Dependencies): v.InferOutput<Schema>;
|
|
15
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-envelope.d.ts","sourceRoot":"","sources":["../src/job-envelope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"job-envelope.d.ts","sourceRoot":"","sources":["../src/job-envelope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,KAAK,YAAY,GAAG;IAAE,UAAU,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAErE,eAAO,MAAM,iBAAiB;IAC5B,EAAE;IACF,aAAa;IACb,SAAS;IACT,QAAQ;CACT,CAAC;AAUF,wBAAgB,GAAG,CAAC,MAAM,SAAS,CAAC,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,EACzD,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EACzC,IAAI,EAAE,YAAY,GACjB,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAEvB"}
|
package/dist/job-envelope.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
2
|
import * as v from "valibot";
|
|
3
|
+
import { CorrelationId } from "./correlation-id.vo";
|
|
3
4
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
4
5
|
import { UUID } from "./uuid.vo";
|
|
5
6
|
export const JobEnvelopeSchema = {
|
|
6
7
|
id: UUID,
|
|
7
|
-
correlationId:
|
|
8
|
+
correlationId: CorrelationId,
|
|
8
9
|
createdAt: tools.TimestampValue,
|
|
9
10
|
revision: tools.RevisionValue,
|
|
10
11
|
};
|
package/dist/job-envelope.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-envelope.js","sourceRoot":"","sources":["../src/job-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,EAAE,EAAE,IAAI;IACR,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"job-envelope.js","sourceRoot":"","sources":["../src/job-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,EAAE,EAAE,IAAI;IACR,aAAa,EAAE,aAAa;IAC5B,SAAS,EAAE,KAAK,CAAC,cAAc;IAC/B,QAAQ,EAAE,KAAK,CAAC,aAAa;CAC9B,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,IAAkB,EAAE,EAAE,CAC/C,CAAC;IACC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE;IAC9B,aAAa,EAAE,kBAAkB,CAAC,GAAG,EAAE;IACvC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE;IAC9B,QAAQ,EAAE,CAAC;CACZ,CAAU,CAAC;AAEd,MAAM,UAAU,GAAG,CACjB,MAAc,EACd,OAAyC,EACzC,IAAkB;IAElB,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AACrG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-queue-worker.service.d.ts","sourceRoot":"","sources":["../src/job-queue-worker.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"job-queue-worker.service.d.ts","sourceRoot":"","sources":["../src/job-queue-worker.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,KAAK,MAAM,GAAG;IAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC,mBAAmB,CAAA;CAAE,CAAC;AAErG,KAAK,YAAY,CAAC,GAAG,SAAS,UAAU,IAAI;IAAE,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC;AAE5E,wBAAgB,cAAc,CAAC,GAAG,SAAS,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC,GAAG,QAAQ,CA0BxG"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
|
+
import * as v from "valibot";
|
|
2
3
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
3
4
|
export function JobQueueWorker(config, deps) {
|
|
4
5
|
return {
|
|
@@ -18,7 +19,7 @@ export function JobQueueWorker(config, deps) {
|
|
|
18
19
|
const retry = policy.evaluate(job, tools.ErrorNormalizer.normalize(error));
|
|
19
20
|
if (!retry)
|
|
20
21
|
return deps.JobQueue.fail(job.id);
|
|
21
|
-
await deps.JobQueue.requeue(job.id, job.revision + 1, retry);
|
|
22
|
+
await deps.JobQueue.requeue(job.id, v.parse(tools.RevisionValue, job.revision + 1), retry);
|
|
22
23
|
}
|
|
23
24
|
});
|
|
24
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-queue-worker.service.js","sourceRoot":"","sources":["../src/job-queue-worker.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AASnE,MAAM,UAAU,cAAc,CAAyB,MAAc,EAAE,IAAuB;IAC5F,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAErD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACvB,MAAM,k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AAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAErD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACvB,MAAM,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE;oBACzD,IAAI,CAAC;wBACH,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;wBAEnD,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;wBACnB,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;oBACvC,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;wBAEtD,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,eAAe,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;wBAE3E,IAAI,CAAC,KAAK;4BAAE,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;wBAC9C,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;oBAC7F,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/job.types.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type * as tools from "@bgord/tools";
|
|
2
|
+
import type { CorrelationIdType } from "./correlation-id.vo";
|
|
2
3
|
import type { UUIDType } from "./uuid.vo";
|
|
3
4
|
export type GenericJob = {
|
|
4
5
|
id: UUIDType;
|
|
5
|
-
correlationId:
|
|
6
|
+
correlationId: CorrelationIdType;
|
|
6
7
|
createdAt: number;
|
|
7
8
|
name: string;
|
|
8
9
|
revision: tools.RevisionValueType;
|
package/dist/job.types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job.types.d.ts","sourceRoot":"","sources":["../src/job.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,QAAQ,CAAC;IACb,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"job.types.d.ts","sourceRoot":"","sources":["../src/job.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,QAAQ,CAAC;IACb,aAAa,EAAE,iBAAiB,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -2,11 +2,11 @@ import * as v from "valibot";
|
|
|
2
2
|
export declare const HISTORY_CLEARED_EVENT = "HISTORY_CLEARED_EVENT";
|
|
3
3
|
export declare const HistoryClearedEvent: v.ObjectSchema<{
|
|
4
4
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
-
readonly correlationId: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
+
readonly correlationId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>, v.BrandAction<string, "CorrelationId">]>;
|
|
6
6
|
readonly createdAt: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.SafeIntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "TimestampValue">]>;
|
|
7
7
|
readonly stream: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.MinLengthAction<string, 1, string>, v.MaxLengthAction<string, 256, string>]>;
|
|
8
8
|
readonly version: v.LiteralSchema<1, undefined>;
|
|
9
|
-
readonly revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>]>, undefined>;
|
|
9
|
+
readonly revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "RevisionValue">]>, undefined>;
|
|
10
10
|
readonly commit: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.RegexAction<string, string>, v.BrandAction<string, "CommitShaValue">]>;
|
|
11
11
|
readonly name: v.LiteralSchema<"HISTORY_CLEARED_EVENT", undefined>;
|
|
12
12
|
readonly payload: v.ObjectSchema<{
|
|
@@ -2,11 +2,11 @@ import * as v from "valibot";
|
|
|
2
2
|
export declare const HISTORY_POPULATED_EVENT = "HISTORY_POPULATED_EVENT";
|
|
3
3
|
export declare const HistoryPopulatedEvent: v.ObjectSchema<{
|
|
4
4
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
-
readonly correlationId: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
+
readonly correlationId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>, v.BrandAction<string, "CorrelationId">]>;
|
|
6
6
|
readonly createdAt: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.SafeIntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "TimestampValue">]>;
|
|
7
7
|
readonly stream: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.MinLengthAction<string, 1, string>, v.MaxLengthAction<string, 256, string>]>;
|
|
8
8
|
readonly version: v.LiteralSchema<1, undefined>;
|
|
9
|
-
readonly revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>]>, undefined>;
|
|
9
|
+
readonly revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "RevisionValue">]>, undefined>;
|
|
10
10
|
readonly commit: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.RegexAction<string, string>, v.BrandAction<string, "CommitShaValue">]>;
|
|
11
11
|
readonly name: v.LiteralSchema<"HISTORY_POPULATED_EVENT", undefined>;
|
|
12
12
|
readonly payload: v.ObjectSchema<{
|
|
@@ -2,7 +2,7 @@ import * as v from "valibot";
|
|
|
2
2
|
export declare const SET_USER_LANGUAGE_COMMAND = "SET_USER_LANGUAGE_COMMAND";
|
|
3
3
|
export declare const SetUserLanguageCommand: v.ObjectSchema<{
|
|
4
4
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
-
readonly correlationId: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
+
readonly correlationId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>, v.BrandAction<string, "CorrelationId">]>;
|
|
6
6
|
readonly createdAt: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.SafeIntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "TimestampValue">]>;
|
|
7
7
|
readonly name: v.LiteralSchema<"SET_USER_LANGUAGE_COMMAND", undefined>;
|
|
8
8
|
readonly payload: v.ObjectSchema<{
|
|
@@ -2,11 +2,11 @@ import * as v from "valibot";
|
|
|
2
2
|
export declare const USER_LANGUAGE_SET_EVENT = "USER_LANGUAGE_SET_EVENT";
|
|
3
3
|
export declare const UserLanguageSetEvent: v.ObjectSchema<{
|
|
4
4
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
-
readonly correlationId: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
+
readonly correlationId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>, v.BrandAction<string, "CorrelationId">]>;
|
|
6
6
|
readonly createdAt: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.SafeIntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "TimestampValue">]>;
|
|
7
7
|
readonly stream: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.MinLengthAction<string, 1, string>, v.MaxLengthAction<string, 256, string>]>;
|
|
8
8
|
readonly version: v.LiteralSchema<1, undefined>;
|
|
9
|
-
readonly revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>]>, undefined>;
|
|
9
|
+
readonly revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "RevisionValue">]>, undefined>;
|
|
10
10
|
readonly commit: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.RegexAction<string, string>, v.BrandAction<string, "CommitShaValue">]>;
|
|
11
11
|
readonly name: v.LiteralSchema<"USER_LANGUAGE_SET_EVENT", undefined>;
|
|
12
12
|
readonly payload: v.ObjectSchema<{
|
|
@@ -2,11 +2,11 @@ import * as v from "valibot";
|
|
|
2
2
|
export declare const HOUR_HAS_PASSED_EVENT = "HOUR_HAS_PASSED_EVENT";
|
|
3
3
|
export declare const HourHasPassedEvent: v.ObjectSchema<{
|
|
4
4
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
-
readonly correlationId: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
+
readonly correlationId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>, v.BrandAction<string, "CorrelationId">]>;
|
|
6
6
|
readonly createdAt: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.SafeIntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "TimestampValue">]>;
|
|
7
7
|
readonly stream: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.MinLengthAction<string, 1, string>, v.MaxLengthAction<string, 256, string>]>;
|
|
8
8
|
readonly version: v.LiteralSchema<1, undefined>;
|
|
9
|
-
readonly revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>]>, undefined>;
|
|
9
|
+
readonly revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "RevisionValue">]>, undefined>;
|
|
10
10
|
readonly commit: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.RegexAction<string, string>, v.BrandAction<string, "CommitShaValue">]>;
|
|
11
11
|
readonly name: v.LiteralSchema<"HOUR_HAS_PASSED_EVENT", undefined>;
|
|
12
12
|
readonly payload: v.ObjectSchema<{
|
|
@@ -2,11 +2,11 @@ import * as v from "valibot";
|
|
|
2
2
|
export declare const MINUTE_HAS_PASSED_EVENT = "MINUTE_HAS_PASSED_EVENT";
|
|
3
3
|
export declare const MinuteHasPassedEvent: v.ObjectSchema<{
|
|
4
4
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
-
readonly correlationId: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
+
readonly correlationId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>, v.BrandAction<string, "CorrelationId">]>;
|
|
6
6
|
readonly createdAt: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.SafeIntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "TimestampValue">]>;
|
|
7
7
|
readonly stream: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.MinLengthAction<string, 1, string>, v.MaxLengthAction<string, 256, string>]>;
|
|
8
8
|
readonly version: v.LiteralSchema<1, undefined>;
|
|
9
|
-
readonly revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>]>, undefined>;
|
|
9
|
+
readonly revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "RevisionValue">]>, undefined>;
|
|
10
10
|
readonly commit: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.RegexAction<string, string>, v.BrandAction<string, "CommitShaValue">]>;
|
|
11
11
|
readonly name: v.LiteralSchema<"MINUTE_HAS_PASSED_EVENT", undefined>;
|
|
12
12
|
readonly payload: v.ObjectSchema<{
|
|
@@ -2,11 +2,11 @@ import * as v from "valibot";
|
|
|
2
2
|
export declare const SECURITY_VIOLATION_DETECTED_EVENT = "SECURITY_VIOLATION_DETECTED_EVENT";
|
|
3
3
|
export declare const SecurityViolationDetectedEvent: v.ObjectSchema<{
|
|
4
4
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
-
readonly correlationId: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
+
readonly correlationId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>, v.BrandAction<string, "CorrelationId">]>;
|
|
6
6
|
readonly createdAt: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.SafeIntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "TimestampValue">]>;
|
|
7
7
|
readonly stream: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.MinLengthAction<string, 1, string>, v.MaxLengthAction<string, 256, string>]>;
|
|
8
8
|
readonly version: v.LiteralSchema<1, undefined>;
|
|
9
|
-
readonly revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>]>, undefined>;
|
|
9
|
+
readonly revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "RevisionValue">]>, undefined>;
|
|
10
10
|
readonly commit: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.RegexAction<string, string>, v.BrandAction<string, "CommitShaValue">]>;
|
|
11
11
|
readonly name: v.LiteralSchema<"SECURITY_VIOLATION_DETECTED_EVENT", undefined>;
|
|
12
12
|
readonly payload: v.ObjectSchema<{
|
|
@@ -2,9 +2,9 @@ import * as v from "valibot";
|
|
|
2
2
|
export declare const SEND_EMAIL_JOB = "SEND_EMAIL_JOB";
|
|
3
3
|
export declare const SendEmailJobSchema: v.ObjectSchema<{
|
|
4
4
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
-
readonly correlationId: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
5
|
+
readonly correlationId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>, v.BrandAction<string, "CorrelationId">]>;
|
|
6
6
|
readonly createdAt: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.SafeIntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "TimestampValue">]>;
|
|
7
|
-
readonly revision: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>]>;
|
|
7
|
+
readonly revision: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "RevisionValue">]>;
|
|
8
8
|
readonly name: v.LiteralSchema<"SEND_EMAIL_JOB", undefined>;
|
|
9
9
|
readonly payload: v.ObjectSchema<{
|
|
10
10
|
readonly from: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.MaxLengthAction<string, 254, string>, v.EmailAction<string, string>, v.BrandAction<string, "Email">]>;
|
|
@@ -3,7 +3,7 @@ import * as v from "valibot";
|
|
|
3
3
|
import type { ReactiveConfigPort } from "./reactive-config.port";
|
|
4
4
|
import type { HasRequestPath } from "./request-context.port";
|
|
5
5
|
export declare const Maintenance: v.ObjectSchema<{
|
|
6
|
-
readonly enabled: v.PicklistSchema<tools.FeatureFlagEnum[], string>;
|
|
6
|
+
readonly enabled: v.SchemaWithPipe<readonly [v.PicklistSchema<tools.FeatureFlagEnum[], string>, v.BrandAction<tools.FeatureFlagEnum, "FeatureFlagValue">]>;
|
|
7
7
|
}, undefined>;
|
|
8
8
|
export type MaintenanceType = v.InferOutput<typeof Maintenance>;
|
|
9
9
|
export type ShieldMaintenanceConfig = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bgord/bun",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bartosz Gordon",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"yazl": "3.3.1"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@bgord/tools": "1.6.
|
|
43
|
+
"@bgord/tools": "1.6.5",
|
|
44
44
|
"emittery": "2.0.0",
|
|
45
45
|
"hono": "4.13.1",
|
|
46
46
|
"node-cache": "5.1.2"
|
package/src/command-envelope.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
import type { ClockPort } from "./clock.port";
|
|
4
|
+
import { CorrelationId } from "./correlation-id.vo";
|
|
4
5
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
5
6
|
import type { IdProviderPort } from "./id-provider.port";
|
|
6
7
|
import { UUID } from "./uuid.vo";
|
|
7
8
|
|
|
8
9
|
type Dependencies = { IdProvider: IdProviderPort; Clock: ClockPort };
|
|
9
10
|
|
|
10
|
-
export const CommandEnvelopeSchema = {
|
|
11
|
+
export const CommandEnvelopeSchema = {
|
|
12
|
+
id: UUID,
|
|
13
|
+
correlationId: CorrelationId,
|
|
14
|
+
createdAt: tools.TimestampValue,
|
|
15
|
+
};
|
|
11
16
|
|
|
12
17
|
export const createCommandEnvelope = (deps: Dependencies) =>
|
|
13
18
|
({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createMiddleware } from "hono/factory";
|
|
2
2
|
import { CorrelationMiddleware, type CorrelationMiddlewareDependencies } from "./correlation.middleware";
|
|
3
|
+
import type { CorrelationIdType } from "./correlation-id.vo";
|
|
3
4
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
4
5
|
import type { MiddlewareHonoPort } from "./middleware-hono.port";
|
|
5
6
|
import { RequestContextHonoAdapter } from "./request-context-hono.adapter";
|
|
6
|
-
import type { UUIDType } from "./uuid.vo";
|
|
7
7
|
|
|
8
|
-
export type CorrelationVariables = { correlationId:
|
|
8
|
+
export type CorrelationVariables = { correlationId: CorrelationIdType };
|
|
9
9
|
|
|
10
10
|
export class CorrelationHonoMiddleware implements MiddlewareHonoPort {
|
|
11
11
|
private readonly correlationId: CorrelationMiddleware;
|
package/src/correlation-id.vo.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as v from "valibot";
|
|
2
2
|
import { UUID } from "./uuid.vo";
|
|
3
3
|
|
|
4
|
-
export const CorrelationId = UUID;
|
|
4
|
+
export const CorrelationId = v.pipe(UUID, v.brand("CorrelationId"));
|
|
5
5
|
|
|
6
6
|
export type CorrelationIdType = v.InferOutput<typeof CorrelationId>;
|
|
@@ -16,6 +16,6 @@ export class CorrelationMiddleware {
|
|
|
16
16
|
const existing = v.safeParse(CorrelationId, incoming);
|
|
17
17
|
|
|
18
18
|
if (existing.success) return existing.output;
|
|
19
|
-
return this.deps.IdProvider.generate();
|
|
19
|
+
return v.parse(CorrelationId, this.deps.IdProvider.generate());
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { CorrelationId } from "./correlation-id.vo";
|
|
1
3
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
2
4
|
import type { CronTask } from "./cron-task.vo";
|
|
3
5
|
import type { CronTaskHandlerStrategy } from "./cron-task-handler.strategy";
|
|
@@ -9,9 +11,11 @@ export class CronTaskHandlerBareStrategy implements CronTaskHandlerStrategy {
|
|
|
9
11
|
constructor(private readonly deps: Dependencies) {}
|
|
10
12
|
|
|
11
13
|
handle(task: CronTask): CronTask {
|
|
14
|
+
const correlationId = v.parse(CorrelationId, this.deps.IdProvider.generate());
|
|
15
|
+
|
|
12
16
|
return {
|
|
13
17
|
...task,
|
|
14
|
-
handler: async () => CorrelationStorage.run(
|
|
18
|
+
handler: async () => CorrelationStorage.run(correlationId, task.handler),
|
|
15
19
|
};
|
|
16
20
|
}
|
|
17
21
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
1
2
|
import type { ClockPort } from "./clock.port";
|
|
3
|
+
import { CorrelationId } from "./correlation-id.vo";
|
|
2
4
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
3
5
|
import type { CronTask } from "./cron-task.vo";
|
|
4
6
|
import type { CronTaskHandlerStrategy } from "./cron-task-handler.strategy";
|
|
@@ -17,7 +19,7 @@ export class CronTaskHandlerWithLoggerStrategy implements CronTaskHandlerStrateg
|
|
|
17
19
|
return {
|
|
18
20
|
...task,
|
|
19
21
|
handler: async () => {
|
|
20
|
-
const correlationId = this.deps.IdProvider.generate();
|
|
22
|
+
const correlationId = v.parse(CorrelationId, this.deps.IdProvider.generate());
|
|
21
23
|
const duration = new Stopwatch(this.deps);
|
|
22
24
|
|
|
23
25
|
try {
|
package/src/event-envelope.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as tools from "@bgord/tools";
|
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
import type { ClockPort } from "./clock.port";
|
|
4
4
|
import { CommitShaValue, type CommitShaValueType } from "./commit-sha-value.vo";
|
|
5
|
+
import { CorrelationId } from "./correlation-id.vo";
|
|
5
6
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
6
7
|
import { EventStream, type EventStreamType } from "./event-stream.vo";
|
|
7
8
|
import type { IdProviderPort } from "./id-provider.port";
|
|
@@ -16,7 +17,7 @@ type Dependencies = {
|
|
|
16
17
|
|
|
17
18
|
export const EventEnvelopeSchema = {
|
|
18
19
|
id: UUID,
|
|
19
|
-
correlationId:
|
|
20
|
+
correlationId: CorrelationId,
|
|
20
21
|
createdAt: tools.TimestampValue,
|
|
21
22
|
stream: EventStream,
|
|
22
23
|
version: v.literal(1),
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as tools from "@bgord/tools";
|
|
2
|
+
import * as v from "valibot";
|
|
1
3
|
import type { GenericEventSerialized } from "./event.types";
|
|
2
4
|
import type { EventRevisionAssignerPort } from "./event-revision-assigner.port";
|
|
3
5
|
|
|
@@ -7,6 +9,9 @@ export class EventRevisionAssignerAdapter implements EventRevisionAssignerPort {
|
|
|
7
9
|
assign(events: ReadonlyArray<GenericEventSerialized>, max?: number): ReadonlyArray<GenericEventSerialized> {
|
|
8
10
|
const current = max ?? EventRevisionAssignerAdapter.EMPTY_STREAM_REVISION;
|
|
9
11
|
|
|
10
|
-
return events.map((event, index) => ({
|
|
12
|
+
return events.map((event, index) => ({
|
|
13
|
+
...event,
|
|
14
|
+
revision: v.parse(tools.RevisionValue, current + index + 1),
|
|
15
|
+
}));
|
|
11
16
|
}
|
|
12
17
|
}
|
package/src/event.types.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type * as tools from "@bgord/tools";
|
|
2
|
+
import type { CorrelationIdType } from "./correlation-id.vo";
|
|
2
3
|
import type { EventStreamType } from "./event-stream.vo";
|
|
3
4
|
import type { UUIDType } from "./uuid.vo";
|
|
4
5
|
|
|
5
6
|
export type GenericEvent = {
|
|
6
7
|
id: UUIDType;
|
|
7
|
-
correlationId:
|
|
8
|
+
correlationId: CorrelationIdType;
|
|
8
9
|
createdAt: number;
|
|
9
10
|
stream: EventStreamType;
|
|
10
11
|
revision?: tools.RevisionValueType;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ClockPort } from "./clock.port";
|
|
2
|
+
import type { CorrelationIdType } from "./correlation-id.vo";
|
|
2
3
|
import { type LoggerPort, LogLevelEnum } from "./logger.port";
|
|
3
4
|
import type { HasRequestHeader, HasRequestPath, RequestContext } from "./request-context.port";
|
|
4
5
|
import { Stopwatch } from "./stopwatch.service";
|
|
@@ -54,7 +55,7 @@ export class HttpLoggerMiddleware {
|
|
|
54
55
|
);
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
before(context: RequestContext, correlationId:
|
|
58
|
+
before(context: RequestContext, correlationId: CorrelationIdType, body: any = {}): HttpLoggerBeforeResult {
|
|
58
59
|
const client = { ip: context.identity.ip(), ua: context.identity.ua() };
|
|
59
60
|
|
|
60
61
|
const metadata = {
|
|
@@ -82,7 +83,7 @@ export class HttpLoggerMiddleware {
|
|
|
82
83
|
return { stopwatch: new Stopwatch(this.deps) };
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
after(context: RequestContext, correlationId:
|
|
86
|
+
after(context: RequestContext, correlationId: CorrelationIdType, input: HttpLoggerAfterInput): void {
|
|
86
87
|
const client = { ip: context.identity.ip(), ua: context.identity.ua() };
|
|
87
88
|
const duration = input.stopwatch.stop();
|
|
88
89
|
const level = input.status >= 400 ? LogLevelEnum.error : LogLevelEnum.http;
|
package/src/job-envelope.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
import type { ClockPort } from "./clock.port";
|
|
4
|
+
import { CorrelationId } from "./correlation-id.vo";
|
|
4
5
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
5
6
|
import type { IdProviderPort } from "./id-provider.port";
|
|
6
7
|
import { UUID } from "./uuid.vo";
|
|
@@ -9,7 +10,7 @@ type Dependencies = { IdProvider: IdProviderPort; Clock: ClockPort };
|
|
|
9
10
|
|
|
10
11
|
export const JobEnvelopeSchema = {
|
|
11
12
|
id: UUID,
|
|
12
|
-
correlationId:
|
|
13
|
+
correlationId: CorrelationId,
|
|
13
14
|
createdAt: tools.TimestampValue,
|
|
14
15
|
revision: tools.RevisionValue,
|
|
15
16
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
|
+
import * as v from "valibot";
|
|
2
3
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
3
4
|
import type { CronTask } from "./cron-task.vo";
|
|
4
5
|
import type { GenericJob } from "./job.types";
|
|
@@ -28,7 +29,7 @@ export function JobQueueWorker<Job extends GenericJob>(config: Config, deps: Dep
|
|
|
28
29
|
const retry = policy.evaluate(job, tools.ErrorNormalizer.normalize(error));
|
|
29
30
|
|
|
30
31
|
if (!retry) return deps.JobQueue.fail(job.id);
|
|
31
|
-
await deps.JobQueue.requeue(job.id, job.revision + 1, retry);
|
|
32
|
+
await deps.JobQueue.requeue(job.id, v.parse(tools.RevisionValue, job.revision + 1), retry);
|
|
32
33
|
}
|
|
33
34
|
});
|
|
34
35
|
}
|
package/src/job.types.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type * as tools from "@bgord/tools";
|
|
2
|
+
import type { CorrelationIdType } from "./correlation-id.vo";
|
|
2
3
|
import type { UUIDType } from "./uuid.vo";
|
|
3
4
|
|
|
4
5
|
export type GenericJob = {
|
|
5
6
|
id: UUIDType;
|
|
6
|
-
correlationId:
|
|
7
|
+
correlationId: CorrelationIdType;
|
|
7
8
|
createdAt: number;
|
|
8
9
|
name: string;
|
|
9
10
|
revision: tools.RevisionValueType;
|