UNPKG
saga-flow
Version:
latest (1.0.0)
1.0.0
A JavaScript library for implementing the Saga pattern in distributed transactions
saga-flow
/
core
/
Context.js
14 lines
(13 loc)
•
271 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
export
function
getContextSnapshot
(
context
) {
return
{
timestamp
:
Date
.
now
(),
data
: { ...context },
version
:
'1.0'
}; }
export
function
mergeContexts
(
contexts
) {
return
contexts.
reduce
(
(
merged, context
) =>
({ ...merged, ...context }), {}); }