Socket
Socket
Sign inDemoInstall

@arque/core

Package Overview
Dependencies
Maintainers
4
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arque/core - npm Package Compare versions

Comparing version 0.2.5 to 0.3.0

10

dist/libs/aggregate-factory.js

@@ -14,9 +14,3 @@ "use strict";

this.eventHandlers = eventHandlers;
this.opts = {
defaultState: (_a = opts === null || opts === void 0 ? void 0 : opts.defaultState) !== null && _a !== void 0 ? _a : null,
cacheMax: (_b = opts === null || opts === void 0 ? void 0 : opts.cacheMax) !== null && _b !== void 0 ? _b : 256,
cacheTTL: (_c = opts === null || opts === void 0 ? void 0 : opts.cacheTTL) !== null && _c !== void 0 ? _c : 86400000,
shouldTakeSnapshot: opts === null || opts === void 0 ? void 0 : opts.shouldTakeSnapshot,
snapshotInterval: (_d = opts === null || opts === void 0 ? void 0 : opts.snapshotInterval) !== null && _d !== void 0 ? _d : 100,
};
this.opts = Object.assign(Object.assign({}, opts), { defaultState: (_a = opts === null || opts === void 0 ? void 0 : opts.defaultState) !== null && _a !== void 0 ? _a : null, cacheMax: (_b = opts === null || opts === void 0 ? void 0 : opts.cacheMax) !== null && _b !== void 0 ? _b : 256, cacheTTL: (_c = opts === null || opts === void 0 ? void 0 : opts.cacheTTL) !== null && _c !== void 0 ? _c : 86400000, shouldTakeSnapshot: opts === null || opts === void 0 ? void 0 : opts.shouldTakeSnapshot, snapshotInterval: (_d = opts === null || opts === void 0 ? void 0 : opts.snapshotInterval) !== null && _d !== void 0 ? _d : 100 });
this.cache = new lru_cache_1.LRUCache({

@@ -39,2 +33,4 @@ max: this.opts.cacheMax,

snapshotInterval: this.opts.snapshotInterval,
serializeState: this.opts.serializeState,
deserializeState: this.opts.deserializeState,
});

@@ -41,0 +37,0 @@ if (!(opts === null || opts === void 0 ? void 0 : opts.noReload)) {

@@ -15,2 +15,4 @@ /// <reference types="node" />

readonly snapshotInterval?: number;
readonly serializeState: (state: TState) => unknown;
readonly deserializeState: (state: unknown) => TState;
};

@@ -17,0 +19,0 @@ export declare class Aggregate<TState = unknown, TCommandHandler extends CommandHandler<Command, Event, TState> = CommandHandler<Command, Event, TState>, TEventHandler extends EventHandler<Event, TState> = EventHandler<Event, TState>> {

@@ -13,3 +13,3 @@ "use strict";

constructor(store, stream, commandHandlers, eventHandlers, _id, _version, _state, opts) {
var _a;
var _a, _b, _c;
this.store = store;

@@ -24,3 +24,3 @@ this.stream = stream;

this.eventHandlers = new Map(eventHandlers.map((item) => [item.type, item]));
this.opts = Object.assign(Object.assign({}, opts), { snapshotInterval: (_a = opts === null || opts === void 0 ? void 0 : opts.snapshotInterval) !== null && _a !== void 0 ? _a : 100 });
this.opts = Object.assign(Object.assign({}, opts), { snapshotInterval: (_a = opts === null || opts === void 0 ? void 0 : opts.snapshotInterval) !== null && _a !== void 0 ? _a : 100, serializeState: (_b = opts === null || opts === void 0 ? void 0 : opts.serializeState) !== null && _b !== void 0 ? _b : (state => state), deserializeState: (_c = opts === null || opts === void 0 ? void 0 : opts.deserializeState) !== null && _c !== void 0 ? _c : (state => state) });
}

@@ -97,3 +97,3 @@ get id() {

if (snapshot) {
this._state = snapshot.state;
this._state = this.opts.deserializeState(snapshot.state);
this._version = snapshot.aggregate.version;

@@ -136,3 +136,3 @@ }

},
state: this.state,
state: this.opts.serializeState(this.state),
timestamp: params.timestamp,

@@ -139,0 +139,0 @@ });

{
"name": "@arque/core",
"version": "0.2.5",
"version": "0.3.0",
"description": "`arque` core library",

@@ -34,3 +34,3 @@ "author": "ScaleForge",

},
"gitHead": "3fc76123adffd4fd31fbd3d33ab96123bc35b05a"
"gitHead": "6cf69f252fed0e61719ba0d22210ef30658441d4"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc