@bgord/bun 1.21.6 → 1.21.7
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/event-envelope.d.ts +1 -2
- package/dist/event-envelope.d.ts.map +1 -1
- package/dist/event-envelope.js.map +1 -1
- package/dist/modules/preferences/command-handlers/handleSetUserLanguageCommand.d.ts.map +1 -1
- package/dist/modules/preferences/command-handlers/handleSetUserLanguageCommand.js +1 -3
- package/dist/modules/preferences/command-handlers/handleSetUserLanguageCommand.js.map +1 -1
- package/dist/modules/system/cron-tasks/passage-of-time-hourly.d.ts.map +1 -1
- package/dist/modules/system/cron-tasks/passage-of-time-hourly.js +1 -3
- package/dist/modules/system/cron-tasks/passage-of-time-hourly.js.map +1 -1
- package/dist/modules/system/cron-tasks/passage-of-time-minute.d.ts.map +1 -1
- package/dist/modules/system/cron-tasks/passage-of-time-minute.js +1 -3
- package/dist/modules/system/cron-tasks/passage-of-time-minute.js.map +1 -1
- package/dist/security-countermeasure-ban.strategy.d.ts.map +1 -1
- package/dist/security-countermeasure-ban.strategy.js +1 -2
- package/dist/security-countermeasure-ban.strategy.js.map +1 -1
- package/package.json +1 -1
- package/src/event-envelope.ts +3 -3
- package/src/modules/preferences/command-handlers/handleSetUserLanguageCommand.ts +1 -3
- package/src/modules/system/cron-tasks/passage-of-time-hourly.ts +1 -8
- package/src/modules/system/cron-tasks/passage-of-time-minute.ts +1 -8
- package/src/security-countermeasure-ban.strategy.ts +1 -7
package/dist/event-envelope.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import type { ClockPort } from "./clock.port";
|
|
3
3
|
import { type CommitShaValueType } from "./commit-sha-value.vo";
|
|
4
|
-
import { type EventStreamType } from "./event-stream.vo";
|
|
5
4
|
import type { IdProviderPort } from "./id-provider.port";
|
|
6
5
|
import type { StaticConfigPort } from "./static-config.port";
|
|
7
6
|
type Dependencies = {
|
|
@@ -18,6 +17,6 @@ export declare const EventEnvelopeSchema: {
|
|
|
18
17
|
revision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "RevisionValue">]>, undefined>;
|
|
19
18
|
commit: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.RegexAction<string, string>, v.BrandAction<string, "CommitShaValue">]>;
|
|
20
19
|
};
|
|
21
|
-
export declare function event<Schema extends v.ObjectSchema<any, any>>(schema: Schema, stream:
|
|
20
|
+
export declare function event<Schema extends v.ObjectSchema<any, any>>(schema: Schema, stream: string, payload: v.InferOutput<Schema>["payload"], deps: Dependencies): v.InferOutput<Schema>;
|
|
22
21
|
export {};
|
|
23
22
|
//# sourceMappingURL=event-envelope.d.ts.map
|
|
@@ -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;AAIhF,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,MAAM,EACd,OAAO,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EACzC,IAAI,EAAE,YAAY,GACjB,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAOvB"}
|
|
@@ -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,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,WAAW,
|
|
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,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQjC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,EAAE,EAAE,IAAI;IACR,aAAa,EAAE,aAAa;IAC5B,SAAS,EAAE,KAAK,CAAC,cAAc;IAC/B,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACrB,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC;IACzC,MAAM,EAAE,cAAc;CACvB,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAE,IAAkB,EAAE,EAAE,CACjE,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,MAAM;IACN,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE;CAChC,CAAU,CAAC;AAEd,MAAM,UAAU,KAAK,CACnB,MAAc,EACd,MAAc,EACd,OAAyC,EACzC,IAAkB;IAElB,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE;QACrB,GAAG,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC;QACpC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO;QACjC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO;QACvC,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleSetUserLanguageCommand.d.ts","sourceRoot":"","sources":["../../../../src/modules/preferences/command-handlers/handleSetUserLanguageCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"handleSetUserLanguageCommand.d.ts","sourceRoot":"","sources":["../../../../src/modules/preferences/command-handlers/handleSetUserLanguageCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,KAAK,QAAQ,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,iCAAiC;IAC5C,OAAO;CACR,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,UAAU,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAC1C,UAAU,EAAE,cAAc,CAAC;IAC3B,KAAK,EAAE,SAAS,CAAC;IACjB,iBAAiB,EAAE,KAAK,CAAC,qBAAqB,CAAC;IAC/C,YAAY,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CACpD,CAAC;AAEF,KAAK,aAAa,GAAG,MAAM,CAAC,wBAAwB,CAAC;AAErD,eAAO,MAAM,4BAA4B,GACtC,CAAC,SAAS,KAAK,CAAC,YAAY,aAAa,SAAS,CAAC,CAAC,CAAC,QAAQ,YAAY,eAC1D,QAAQ,CAAC,0BAA0B,kBAiBlD,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import * as v from "valibot";
|
|
2
1
|
import { event } from "../../../event-envelope";
|
|
3
|
-
import { EventStream } from "../../../event-stream.vo";
|
|
4
2
|
import * as Events from "../events";
|
|
5
3
|
import * as Invariants from "../invariants";
|
|
6
4
|
export const HandleSetUserLanguageCommandError = {
|
|
@@ -14,7 +12,7 @@ export const handleSetUserLanguageCommand = (languages, deps) => async (command)
|
|
|
14
12
|
if (!Invariants.UserLanguageHasChanged.passes({ current, candidate }))
|
|
15
13
|
return;
|
|
16
14
|
await deps.EventStore.save([
|
|
17
|
-
event(Events.UserLanguageSetEvent,
|
|
15
|
+
event(Events.UserLanguageSetEvent, `preferences_${command.payload.userId}`, { userId: command.payload.userId, language: candidate }, deps),
|
|
18
16
|
]);
|
|
19
17
|
};
|
|
20
18
|
//# sourceMappingURL=handleSetUserLanguageCommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleSetUserLanguageCommand.js","sourceRoot":"","sources":["../../../../src/modules/preferences/command-handlers/handleSetUserLanguageCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handleSetUserLanguageCommand.js","sourceRoot":"","sources":["../../../../src/modules/preferences/command-handlers/handleSetUserLanguageCommand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAMhD,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAG5C,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,OAAO,EAAE,gDAAgD;CAC1D,CAAC;AAYF,MAAM,CAAC,MAAM,4BAA4B,GACvC,CAA+B,SAAuB,EAAE,IAAkB,EAAE,EAAE,CAC9E,KAAK,EAAE,OAA4C,EAAE,EAAE;IACrD,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC;IAE3C,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAC;IAElG,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzE,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;QAAE,OAAO;IAE9E,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QACzB,KAAK,CACH,MAAM,CAAC,oBAAoB,EAC3B,eAAe,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EACvC,EAAE,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,EACvD,IAAI,CACL;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passage-of-time-hourly.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/cron-tasks/passage-of-time-hourly.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"passage-of-time-hourly.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/cron-tasks/passage-of-time-hourly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAsB,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAElG,KAAK,YAAY,GAAG;IAClB,UAAU,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC;IACnD,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,cAAc,CAAC;IAC3B,YAAY,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CACpD,CAAC;AAEF,eAAO,MAAM,2BAA2B,SAAU,YAAY,KAAG,QAQ/D,CAAC"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import * as v from "valibot";
|
|
2
1
|
import { CronExpressionSchedules } from "../../../cron-expression.vo";
|
|
3
2
|
import { event } from "../../../event-envelope";
|
|
4
|
-
import { EventStream } from "../../../event-stream.vo";
|
|
5
3
|
import { HourHasPassedEvent } from "../events/HOUR_HAS_PASSED_EVENT";
|
|
6
4
|
export const PassageOfTimeHourlyCronTask = (deps) => ({
|
|
7
5
|
label: "PassageOfTimeHourly",
|
|
8
6
|
cron: CronExpressionSchedules.EVERY_HOUR,
|
|
9
7
|
handler: async () => {
|
|
10
8
|
await deps.EventStore.save([
|
|
11
|
-
event(HourHasPassedEvent,
|
|
9
|
+
event(HourHasPassedEvent, "passage_of_time", { timestamp: deps.Clock.now().ms }, deps),
|
|
12
10
|
]);
|
|
13
11
|
},
|
|
14
12
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passage-of-time-hourly.js","sourceRoot":"","sources":["../../../../src/modules/system/cron-tasks/passage-of-time-hourly.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"passage-of-time-hourly.js","sourceRoot":"","sources":["../../../../src/modules/system/cron-tasks/passage-of-time-hourly.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAIhD,OAAO,EAAE,kBAAkB,EAA+B,MAAM,iCAAiC,CAAC;AASlG,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,IAAkB,EAAY,EAAE,CAAC,CAAC;IAC5E,KAAK,EAAE,qBAAqB;IAC5B,IAAI,EAAE,uBAAuB,CAAC,UAAU;IACxC,OAAO,EAAE,KAAK,IAAI,EAAE;QAClB,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACzB,KAAK,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC;SACvF,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passage-of-time-minute.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/cron-tasks/passage-of-time-minute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"passage-of-time-minute.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/cron-tasks/passage-of-time-minute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAwB,KAAK,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAExG,KAAK,YAAY,GAAG;IAClB,UAAU,EAAE,cAAc,CAAC,wBAAwB,CAAC,CAAC;IACrD,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,cAAc,CAAC;IAC3B,YAAY,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CACpD,CAAC;AAEF,eAAO,MAAM,2BAA2B,SAAU,YAAY,KAAG,QAQ/D,CAAC"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import * as v from "valibot";
|
|
2
1
|
import { CronExpressionSchedules } from "../../../cron-expression.vo";
|
|
3
2
|
import { event } from "../../../event-envelope";
|
|
4
|
-
import { EventStream } from "../../../event-stream.vo";
|
|
5
3
|
import { MinuteHasPassedEvent } from "../events/MINUTE_HAS_PASSED_EVENT";
|
|
6
4
|
export const PassageOfTimeMinuteCronTask = (deps) => ({
|
|
7
5
|
label: "PassageOfTimeMinute",
|
|
8
6
|
cron: CronExpressionSchedules.EVERY_MINUTE,
|
|
9
7
|
handler: async () => {
|
|
10
8
|
await deps.EventStore.save([
|
|
11
|
-
event(MinuteHasPassedEvent,
|
|
9
|
+
event(MinuteHasPassedEvent, "passage_of_time", { timestamp: deps.Clock.now().ms }, deps),
|
|
12
10
|
]);
|
|
13
11
|
},
|
|
14
12
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passage-of-time-minute.js","sourceRoot":"","sources":["../../../../src/modules/system/cron-tasks/passage-of-time-minute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"passage-of-time-minute.js","sourceRoot":"","sources":["../../../../src/modules/system/cron-tasks/passage-of-time-minute.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAIhD,OAAO,EAAE,oBAAoB,EAAiC,MAAM,mCAAmC,CAAC;AASxG,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,IAAkB,EAAY,EAAE,CAAC,CAAC;IAC5E,KAAK,EAAE,qBAAqB;IAC5B,IAAI,EAAE,uBAAuB,CAAC,YAAY;IAC1C,OAAO,EAAE,KAAK,IAAI,EAAE;QAClB,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACzB,KAAK,CAAC,oBAAoB,EAAE,iBAAiB,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC;SACzF,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-countermeasure-ban.strategy.d.ts","sourceRoot":"","sources":["../src/security-countermeasure-ban.strategy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"security-countermeasure-ban.strategy.d.ts","sourceRoot":"","sources":["../src/security-countermeasure-ban.strategy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAEL,KAAK,kCAAkC,EACxC,MAAM,2DAA2D,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AACzG,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,eAAO,MAAM,sCAAsC;IACjD,QAAQ;CACT,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,UAAU,EAAE,cAAc,CAAC;IAC3B,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,EAAE,cAAc,CAAC,kCAAkC,CAAC,CAAC;IAC/D,YAAY,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CACpD,CAAC;AAEF,KAAK,MAAM,GAAG;IAAE,QAAQ,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAE/C,qBAAa,iCAAkC,YAAW,8BAA8B;IAEpF,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFzB,YACmB,IAAI,EAAE,YAAY,EAClB,MAAM,GAAE,MAAsC,EAC7D;IAEE,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAoB/D;IAED,IAAI,IAAI,IAAI,8BAA8B,CAEzC;CACF"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
3
3
|
import { event } from "./event-envelope";
|
|
4
|
-
import { EventStream } from "./event-stream.vo";
|
|
5
4
|
import { SecurityViolationDetectedEvent, } from "./modules/system/events/SECURITY_VIOLATION_DETECTED_EVENT";
|
|
6
5
|
import { SecurityCountermeasureName, } from "./security-countermeasure-name.vo";
|
|
7
6
|
export const SecurityCountermeasureBanStrategyError = {
|
|
@@ -28,7 +27,7 @@ export class SecurityCountermeasureBanStrategy {
|
|
|
28
27
|
metadata: context,
|
|
29
28
|
});
|
|
30
29
|
await this.deps.EventStore.save([
|
|
31
|
-
event(SecurityViolationDetectedEvent,
|
|
30
|
+
event(SecurityViolationDetectedEvent, "security", { action: action.kind, ...context }, this.deps),
|
|
32
31
|
]);
|
|
33
32
|
return action;
|
|
34
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-countermeasure-ban.strategy.js","sourceRoot":"","sources":["../src/security-countermeasure-ban.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAG7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"security-countermeasure-ban.strategy.js","sourceRoot":"","sources":["../src/security-countermeasure-ban.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAG7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAIzC,OAAO,EACL,8BAA8B,GAE/B,MAAM,2DAA2D,CAAC;AAGnE,OAAO,EACL,0BAA0B,GAE3B,MAAM,mCAAmC,CAAC;AAG3C,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,QAAQ,EAAE,+CAA+C;CAC1D,CAAC;AAYF,MAAM,OAAO,iCAAiC;IAEzB,IAAI;IACJ,MAAM;IAFzB,YACmB,IAAkB,EAClB,MAAM,GAAW,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE;oBAD9C,IAAI;sBACJ,MAAM;IACtB,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,OAAwB;QACpC,MAAM,MAAM,GAAG;YACb,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,sCAAsC,CAAC,QAAQ;YACvD,GAAG,IAAI,CAAC,MAAM;SACN,CAAC;QAEX,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YACpB,OAAO,EAAE,6BAA6B;YACtC,SAAS,EAAE,UAAU;YACrB,SAAS,EAAE,6BAA6B;YACxC,aAAa,EAAE,kBAAkB,CAAC,GAAG,EAAE;YACvC,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAC9B,KAAK,CAAC,8BAA8B,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC;SAClG,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,CAAC,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;CACF"}
|
package/package.json
CHANGED
package/src/event-envelope.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { ClockPort } from "./clock.port";
|
|
|
4
4
|
import { CommitShaValue, type CommitShaValueType } from "./commit-sha-value.vo";
|
|
5
5
|
import { CorrelationId } from "./correlation-id.vo";
|
|
6
6
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
7
|
-
import { EventStream
|
|
7
|
+
import { EventStream } from "./event-stream.vo";
|
|
8
8
|
import type { IdProviderPort } from "./id-provider.port";
|
|
9
9
|
import type { StaticConfigPort } from "./static-config.port";
|
|
10
10
|
import { UUID } from "./uuid.vo";
|
|
@@ -25,7 +25,7 @@ export const EventEnvelopeSchema = {
|
|
|
25
25
|
commit: CommitShaValue,
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const createEventEnvelope = (stream:
|
|
28
|
+
const createEventEnvelope = (stream: string, deps: Dependencies) =>
|
|
29
29
|
({
|
|
30
30
|
id: deps.IdProvider.generate(),
|
|
31
31
|
correlationId: CorrelationStorage.get(),
|
|
@@ -36,7 +36,7 @@ const createEventEnvelope = (stream: EventStreamType, deps: Dependencies) =>
|
|
|
36
36
|
|
|
37
37
|
export function event<Schema extends v.ObjectSchema<any, any>>(
|
|
38
38
|
schema: Schema,
|
|
39
|
-
stream:
|
|
39
|
+
stream: string,
|
|
40
40
|
payload: v.InferOutput<Schema>["payload"],
|
|
41
41
|
deps: Dependencies,
|
|
42
42
|
): v.InferOutput<Schema> {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type * as tools from "@bgord/tools";
|
|
2
|
-
import * as v from "valibot";
|
|
3
2
|
import type { ClockPort } from "../../../clock.port";
|
|
4
3
|
import type { CommitShaValueType } from "../../../commit-sha-value.vo";
|
|
5
4
|
import { event } from "../../../event-envelope";
|
|
6
5
|
import type { EventStorePort } from "../../../event-store.port";
|
|
7
|
-
import { EventStream } from "../../../event-stream.vo";
|
|
8
6
|
import type { IdProviderPort } from "../../../id-provider.port";
|
|
9
7
|
import type { Languages } from "../../../languages.vo";
|
|
10
8
|
import type { StaticConfigPort } from "../../../static-config.port";
|
|
@@ -41,7 +39,7 @@ export const handleSetUserLanguageCommand =
|
|
|
41
39
|
await deps.EventStore.save([
|
|
42
40
|
event(
|
|
43
41
|
Events.UserLanguageSetEvent,
|
|
44
|
-
|
|
42
|
+
`preferences_${command.payload.userId}`,
|
|
45
43
|
{ userId: command.payload.userId, language: candidate },
|
|
46
44
|
deps,
|
|
47
45
|
),
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import * as v from "valibot";
|
|
2
1
|
import type { ClockPort } from "../../../clock.port";
|
|
3
2
|
import type { CommitShaValueType } from "../../../commit-sha-value.vo";
|
|
4
3
|
import { CronExpressionSchedules } from "../../../cron-expression.vo";
|
|
5
4
|
import type { CronTask } from "../../../cron-task.vo";
|
|
6
5
|
import { event } from "../../../event-envelope";
|
|
7
6
|
import type { EventStorePort } from "../../../event-store.port";
|
|
8
|
-
import { EventStream } from "../../../event-stream.vo";
|
|
9
7
|
import type { IdProviderPort } from "../../../id-provider.port";
|
|
10
8
|
import type { StaticConfigPort } from "../../../static-config.port";
|
|
11
9
|
import { HourHasPassedEvent, type HourHasPassedEventType } from "../events/HOUR_HAS_PASSED_EVENT";
|
|
@@ -22,12 +20,7 @@ export const PassageOfTimeHourlyCronTask = (deps: Dependencies): CronTask => ({
|
|
|
22
20
|
cron: CronExpressionSchedules.EVERY_HOUR,
|
|
23
21
|
handler: async () => {
|
|
24
22
|
await deps.EventStore.save([
|
|
25
|
-
event(
|
|
26
|
-
HourHasPassedEvent,
|
|
27
|
-
v.parse(EventStream, "passage_of_time"),
|
|
28
|
-
{ timestamp: deps.Clock.now().ms },
|
|
29
|
-
deps,
|
|
30
|
-
),
|
|
23
|
+
event(HourHasPassedEvent, "passage_of_time", { timestamp: deps.Clock.now().ms }, deps),
|
|
31
24
|
]);
|
|
32
25
|
},
|
|
33
26
|
});
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import * as v from "valibot";
|
|
2
1
|
import type { ClockPort } from "../../../clock.port";
|
|
3
2
|
import type { CommitShaValueType } from "../../../commit-sha-value.vo";
|
|
4
3
|
import { CronExpressionSchedules } from "../../../cron-expression.vo";
|
|
5
4
|
import type { CronTask } from "../../../cron-task.vo";
|
|
6
5
|
import { event } from "../../../event-envelope";
|
|
7
6
|
import type { EventStorePort } from "../../../event-store.port";
|
|
8
|
-
import { EventStream } from "../../../event-stream.vo";
|
|
9
7
|
import type { IdProviderPort } from "../../../id-provider.port";
|
|
10
8
|
import type { StaticConfigPort } from "../../../static-config.port";
|
|
11
9
|
import { MinuteHasPassedEvent, type MinuteHasPassedEventType } from "../events/MINUTE_HAS_PASSED_EVENT";
|
|
@@ -22,12 +20,7 @@ export const PassageOfTimeMinuteCronTask = (deps: Dependencies): CronTask => ({
|
|
|
22
20
|
cron: CronExpressionSchedules.EVERY_MINUTE,
|
|
23
21
|
handler: async () => {
|
|
24
22
|
await deps.EventStore.save([
|
|
25
|
-
event(
|
|
26
|
-
MinuteHasPassedEvent,
|
|
27
|
-
v.parse(EventStream, "passage_of_time"),
|
|
28
|
-
{ timestamp: deps.Clock.now().ms },
|
|
29
|
-
deps,
|
|
30
|
-
),
|
|
23
|
+
event(MinuteHasPassedEvent, "passage_of_time", { timestamp: deps.Clock.now().ms }, deps),
|
|
31
24
|
]);
|
|
32
25
|
},
|
|
33
26
|
});
|
|
@@ -4,7 +4,6 @@ import type { CommitShaValueType } from "./commit-sha-value.vo";
|
|
|
4
4
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
5
5
|
import { event } from "./event-envelope";
|
|
6
6
|
import type { EventStorePort } from "./event-store.port";
|
|
7
|
-
import { EventStream } from "./event-stream.vo";
|
|
8
7
|
import type { IdProviderPort } from "./id-provider.port";
|
|
9
8
|
import type { LoggerPort } from "./logger.port";
|
|
10
9
|
import {
|
|
@@ -55,12 +54,7 @@ export class SecurityCountermeasureBanStrategy implements SecurityCountermeasure
|
|
|
55
54
|
});
|
|
56
55
|
|
|
57
56
|
await this.deps.EventStore.save([
|
|
58
|
-
event(
|
|
59
|
-
SecurityViolationDetectedEvent,
|
|
60
|
-
v.parse(EventStream, "security"),
|
|
61
|
-
{ action: action.kind, ...context },
|
|
62
|
-
this.deps,
|
|
63
|
-
),
|
|
57
|
+
event(SecurityViolationDetectedEvent, "security", { action: action.kind, ...context }, this.deps),
|
|
64
58
|
]);
|
|
65
59
|
|
|
66
60
|
return action;
|