UNPKG

@dolittle/sdk.artifacts

Version:

Dolittle is a decentralized, distributed, event-driven microservice platform built to harness the power of events.

48 lines 1.87 kB
import { Constructor } from '@dolittle/types'; import { PrimitiveKey } from './NestedMap'; /** * Defines a decomposed key that can be used in a {@link ComplexValueMap}. */ export declare type DecomposedKey = [PrimitiveKey, ...PrimitiveKey[]]; /** * Represents a {@link Map} that handles complex value types - that can be decomposed into stable primitive keys - as keys. * @template K The type of the complex key. * @template V The type of the value. * @template D The type of the decomposed primitive values key. */ export declare class ComplexValueMap<K, V, D extends DecomposedKey> implements Map<K, V> { private readonly _decomposer; private readonly _map; /** * Initialises a new instance of the {@link ComplexValueMap} class. * @param {Constructor} type - The type of the complex value key. * @param {(K) => D} _decomposer - The callback to use for decomposing the complex valye key to primitive types. * @param {number} depth - The length of a decomposed key. */ constructor(type: Constructor<K>, _decomposer: (key: K) => D, depth: D['length']); /** @inheritdoc */ [Symbol.toStringTag]: string; /** @inheritdoc */ get size(): number; /** @inheritdoc */ has(key: K): boolean; /** @inheritdoc */ get(key: K): V | undefined; /** @inheritdoc */ set(key: K, value: V): this; /** @inheritdoc */ delete(key: K): boolean; /** @inheritdoc */ clear(): void; /** @inheritdoc */ entries(): IterableIterator<[K, V]>; /** @inheritdoc */ [Symbol.iterator](): IterableIterator<[K, V]>; /** @inheritdoc */ keys(): IterableIterator<K>; /** @inheritdoc */ values(): IterableIterator<V>; /** @inheritdoc */ forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void; } //# sourceMappingURL=ComplexValueMap.d.ts.map