@rotorsoft/act 0.18.0 → 0.19.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/dist/.tsbuildinfo +1 -1
- package/dist/@types/event-sourcing.d.ts.map +1 -1
- package/dist/@types/types/action.d.ts +1 -7
- package/dist/@types/types/action.d.ts.map +1 -1
- package/dist/@types/utils.d.ts +1 -90
- package/dist/@types/utils.d.ts.map +1 -1
- package/dist/index.cjs +3 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -35
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -139,40 +139,6 @@ var config = () => {
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
// src/utils.ts
|
|
142
|
-
var UNMERGEABLES = [
|
|
143
|
-
RegExp,
|
|
144
|
-
Date,
|
|
145
|
-
Array,
|
|
146
|
-
Map,
|
|
147
|
-
Set,
|
|
148
|
-
WeakMap,
|
|
149
|
-
WeakSet,
|
|
150
|
-
ArrayBuffer,
|
|
151
|
-
SharedArrayBuffer,
|
|
152
|
-
DataView,
|
|
153
|
-
Int8Array,
|
|
154
|
-
Uint8Array,
|
|
155
|
-
Uint8ClampedArray,
|
|
156
|
-
Int16Array,
|
|
157
|
-
Uint16Array,
|
|
158
|
-
Int32Array,
|
|
159
|
-
Uint32Array,
|
|
160
|
-
Float32Array,
|
|
161
|
-
Float64Array
|
|
162
|
-
];
|
|
163
|
-
var is_mergeable = (value) => !!value && typeof value === "object" && !UNMERGEABLES.some((t) => value instanceof t);
|
|
164
|
-
var patch = (original, patches) => {
|
|
165
|
-
const copy = {};
|
|
166
|
-
Object.keys({ ...original, ...patches }).forEach((key) => {
|
|
167
|
-
const patched_value = patches[key];
|
|
168
|
-
const original_value = original[key];
|
|
169
|
-
const patched = patches && key in patches;
|
|
170
|
-
const deleted = patched && (typeof patched_value === "undefined" || patched_value === null);
|
|
171
|
-
const value = patched && !deleted ? patched_value : original_value;
|
|
172
|
-
!deleted && (copy[key] = is_mergeable(value) ? patch(original_value || {}, patched_value || {}) : value);
|
|
173
|
-
});
|
|
174
|
-
return copy;
|
|
175
|
-
};
|
|
176
142
|
var validate = (target, payload, schema) => {
|
|
177
143
|
try {
|
|
178
144
|
return schema ? schema.parse(payload) : payload;
|
|
@@ -569,6 +535,7 @@ import { randomUUID as randomUUID2 } from "crypto";
|
|
|
569
535
|
import EventEmitter from "events";
|
|
570
536
|
|
|
571
537
|
// src/event-sourcing.ts
|
|
538
|
+
import { patch } from "@rotorsoft/act-patch";
|
|
572
539
|
import { randomUUID } from "crypto";
|
|
573
540
|
async function snap(snapshot) {
|
|
574
541
|
try {
|
|
@@ -1753,7 +1720,6 @@ export {
|
|
|
1753
1720
|
disposeAndExit,
|
|
1754
1721
|
extend,
|
|
1755
1722
|
logger,
|
|
1756
|
-
patch,
|
|
1757
1723
|
port,
|
|
1758
1724
|
projection,
|
|
1759
1725
|
sleep,
|