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.0 to 0.2.1

13

dist/libs/aggregate-factory.d.ts

@@ -8,2 +8,7 @@ /// <reference types="node" />

type ExtractEventHandler<T> = T extends Aggregate<any, any, infer EventHandler> ? EventHandler : never;
type Options<T> = {
readonly defaultState: ExtractState<T> | (() => ExtractState<T>);
readonly cacheMax: number;
readonly cacheTTL: number;
} & Partial<AggregateOptions<ExtractState<T>>>;
export declare class AggregateFactory<T extends Aggregate> {

@@ -14,9 +19,5 @@ private readonly store;

private eventHandlers;
private readonly cache;
private readonly opts;
private cache;
constructor(store: StoreAdapter, stream: StreamAdapter, commandHandlers: ExtractCommandHandler<T>[], eventHandlers: ExtractEventHandler<T>[], opts: {
readonly defaultState?: ExtractState<T> | (() => ExtractState<T>);
readonly cacheMax?: number;
readonly cacheTTL?: number;
} & Partial<AggregateOptions<ExtractState<T>>>);
constructor(store: StoreAdapter, stream: StreamAdapter, commandHandlers: ExtractCommandHandler<T>[], eventHandlers: ExtractEventHandler<T>[], opts?: Partial<Options<T>>);
clear(): Promise<void>;

@@ -23,0 +24,0 @@ load(id: Buffer, opts?: {

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

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

@@ -14,6 +15,10 @@ this.stream = stream;

this.eventHandlers = eventHandlers;
this.opts = opts;
this.opts = {
defaultState: null,
cacheMax: (_a = opts === null || opts === void 0 ? void 0 : opts.cacheMax) !== null && _a !== void 0 ? _a : 256,
cacheTTL: (_b = opts === null || opts === void 0 ? void 0 : opts.cacheTTL) !== null && _b !== void 0 ? _b : 86400000, // 24 hours
};
this.cache = new lru_cache_1.LRUCache({
max: opts.cacheMax || 256,
ttl: opts.cacheTTL || 86400000, // 24 hours
max: this.opts.cacheMax,
ttl: this.opts.cacheTTL,
});

@@ -29,4 +34,3 @@ }

promise = (async () => {
const state = this.opts.defaultState ?
(this.opts.defaultState instanceof Function ? this.opts.defaultState() : this.opts.defaultState) : null;
const state = this.opts.defaultState instanceof Function ? this.opts.defaultState() : this.opts.defaultState;
const aggregate = new aggregate_1.Aggregate(this.store, this.stream, this.commandHandlers, this.eventHandlers, id, 0, state, {

@@ -33,0 +37,0 @@ shouldTakeSnapshot: this.opts.shouldTakeSnapshot,

{
"name": "@arque/core",
"version": "0.2.0",
"version": "0.2.1",
"description": "`arque` core library",

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

},
"gitHead": "859a27ee9e3527e2020645bc3fbbe8f66fa1f4cf"
"gitHead": "639987e593873721588b31f9d1550b6bcb14df12"
}

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