h1v3 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/configuration.js
CHANGED
|
@@ -58,13 +58,23 @@ function handleLogValueWritten(logger, e) {
|
|
|
58
58
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
export function configureLoggingStore(paths, onValueWritten, logger) {
|
|
61
|
+
export function configureLoggingStore({ paths, onValueWritten, logger, region, instance }) {
|
|
62
|
+
|
|
63
|
+
if (!paths) throw new Error("Missing paths");
|
|
64
|
+
if (!onValueWritten) throw new Error("Missing onValueWritten");
|
|
65
|
+
if (!logger) throw new Error("Missing logger");
|
|
66
|
+
if (!region) throw new Error("Missing region");
|
|
67
|
+
if (!instance) throw new Error("Missing instance");
|
|
62
68
|
|
|
63
69
|
const ref = paths?.logs?.path;
|
|
64
70
|
if (!ref) throw new Error("Missing: paths.logs.path");
|
|
65
71
|
const triggerPath = refPathToTriggerPath(ref);
|
|
66
72
|
return Object.assign(
|
|
67
|
-
onValueWritten(
|
|
73
|
+
onValueWritten({
|
|
74
|
+
ref: triggerPath,
|
|
75
|
+
region,
|
|
76
|
+
instance
|
|
77
|
+
}, handleLogValueWritten.bind(this, logger)),
|
|
68
78
|
{
|
|
69
79
|
[RAW_STORE_META]: {
|
|
70
80
|
raw: true,
|
|
@@ -4,7 +4,12 @@ import { refPathToTriggerPath } from "../paths.js";
|
|
|
4
4
|
|
|
5
5
|
export const EVENT_STORE_META = Symbol("Event store configuration metadata");
|
|
6
6
|
|
|
7
|
-
export function configureEventStore({ ref, projections, ...rest }, onValueWritten, logger) {
|
|
7
|
+
export function configureEventStore({ ref, projections, ...rest }, { onValueWritten, logger, region, instance }) {
|
|
8
|
+
|
|
9
|
+
if (!onValueWritten) throw new Error("Missing onValueWritten");
|
|
10
|
+
if (!logger) throw new Error("Missing logger");
|
|
11
|
+
if (!region) throw new Error("Missing region");
|
|
12
|
+
if (!instance) throw new Error("Missing instance");
|
|
8
13
|
|
|
9
14
|
// considered the "home" of the event store, under which events and projections will be stored
|
|
10
15
|
const eventStorePath = refPathToTriggerPath(ref);
|
|
@@ -24,16 +29,16 @@ export function configureEventStore({ ref, projections, ...rest }, onValueWritte
|
|
|
24
29
|
|
|
25
30
|
// tag the trigger with metadata
|
|
26
31
|
return Object.assign(
|
|
27
|
-
onValueWritten(writeRefPath, handler),
|
|
32
|
+
onValueWritten({ ref: writeRefPath, region, instance }, handler),
|
|
28
33
|
{ [EVENT_STORE_META]: metadata }
|
|
29
34
|
);
|
|
30
35
|
|
|
31
36
|
}
|
|
32
37
|
|
|
33
|
-
configureEventStore.inject = ({ onValueWritten, logger, paths }) =>
|
|
38
|
+
configureEventStore.inject = ({ onValueWritten, logger, paths, region, instance }) =>
|
|
34
39
|
|
|
35
40
|
(eventStoreFactory, ...args) =>
|
|
36
41
|
|
|
37
|
-
configureEventStore(eventStoreFactory(paths, ...args), onValueWritten, logger);
|
|
42
|
+
configureEventStore(eventStoreFactory(paths, ...args), { onValueWritten, logger, region, instance });
|
|
38
43
|
|
|
39
44
|
|