@signaltree/core 7.1.2 → 7.1.4
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/README.md +138 -6
- package/package.json +2 -2
- package/dist/constants.js +0 -6
- package/dist/deep-equal.js +0 -41
- package/dist/enhancers/batching/batching.js +0 -230
- package/dist/enhancers/devtools/devtools.js +0 -318
- package/dist/enhancers/effects/effects.js +0 -66
- package/dist/enhancers/entities/entities.js +0 -24
- package/dist/enhancers/index.js +0 -72
- package/dist/enhancers/memoization/memoization.js +0 -420
- package/dist/enhancers/presets/lib/presets.js +0 -27
- package/dist/enhancers/serialization/constants.js +0 -15
- package/dist/enhancers/serialization/serialization.js +0 -656
- package/dist/enhancers/time-travel/time-travel.js +0 -283
- package/dist/enhancers/time-travel/utils.js +0 -11
- package/dist/enhancers/utils/copy-tree-properties.js +0 -20
- package/dist/index.js +0 -25
- package/dist/is-built-in-object.js +0 -23
- package/dist/lib/async-helpers.js +0 -77
- package/dist/lib/constants.js +0 -56
- package/dist/lib/edit-session.js +0 -84
- package/dist/lib/entity-signal.js +0 -544
- package/dist/lib/internals/batch-scope.js +0 -8
- package/dist/lib/internals/materialize-markers.js +0 -72
- package/dist/lib/internals/merge-derived.js +0 -59
- package/dist/lib/markers/derived.js +0 -6
- package/dist/lib/markers/entity-map.js +0 -20
- package/dist/lib/markers/status.js +0 -71
- package/dist/lib/markers/stored.js +0 -111
- package/dist/lib/memory/memory-manager.js +0 -164
- package/dist/lib/path-notifier.js +0 -178
- package/dist/lib/presets.js +0 -21
- package/dist/lib/security/security-validator.js +0 -121
- package/dist/lib/signal-tree.js +0 -415
- package/dist/lib/types.js +0 -3
- package/dist/lib/utils.js +0 -264
- package/dist/lru-cache.js +0 -64
- package/dist/parse-path.js +0 -13
- package/src/enhancers/batching/batching.d.ts +0 -10
- package/src/enhancers/batching/batching.types.d.ts +0 -1
- package/src/enhancers/batching/index.d.ts +0 -1
- package/src/enhancers/batching/test-setup.d.ts +0 -3
- package/src/enhancers/devtools/devtools.d.ts +0 -68
- package/src/enhancers/devtools/devtools.types.d.ts +0 -1
- package/src/enhancers/devtools/index.d.ts +0 -1
- package/src/enhancers/devtools/test-setup.d.ts +0 -3
- package/src/enhancers/effects/effects.d.ts +0 -9
- package/src/enhancers/effects/effects.types.d.ts +0 -1
- package/src/enhancers/effects/index.d.ts +0 -1
- package/src/enhancers/entities/entities.d.ts +0 -11
- package/src/enhancers/entities/entities.types.d.ts +0 -1
- package/src/enhancers/entities/index.d.ts +0 -1
- package/src/enhancers/entities/test-setup.d.ts +0 -3
- package/src/enhancers/index.d.ts +0 -3
- package/src/enhancers/memoization/index.d.ts +0 -1
- package/src/enhancers/memoization/memoization.d.ts +0 -54
- package/src/enhancers/memoization/memoization.types.d.ts +0 -1
- package/src/enhancers/memoization/test-setup.d.ts +0 -3
- package/src/enhancers/presets/index.d.ts +0 -1
- package/src/enhancers/presets/lib/presets.d.ts +0 -8
- package/src/enhancers/serialization/constants.d.ts +0 -14
- package/src/enhancers/serialization/index.d.ts +0 -2
- package/src/enhancers/serialization/serialization.d.ts +0 -68
- package/src/enhancers/serialization/test-setup.d.ts +0 -3
- package/src/enhancers/test-helpers/types-equals.d.ts +0 -2
- package/src/enhancers/time-travel/index.d.ts +0 -1
- package/src/enhancers/time-travel/test-setup.d.ts +0 -3
- package/src/enhancers/time-travel/time-travel.d.ts +0 -10
- package/src/enhancers/time-travel/time-travel.types.d.ts +0 -1
- package/src/enhancers/time-travel/utils.d.ts +0 -2
- package/src/enhancers/types.d.ts +0 -1
- package/src/enhancers/typing/helpers-types.d.ts +0 -2
- package/src/enhancers/utils/copy-tree-properties.d.ts +0 -1
- package/src/index.d.ts +0 -25
- package/src/lib/async-helpers.d.ts +0 -8
- package/src/lib/constants.d.ts +0 -41
- package/src/lib/dev-proxy.d.ts +0 -3
- package/src/lib/edit-session.d.ts +0 -21
- package/src/lib/entity-signal.d.ts +0 -1
- package/src/lib/internals/batch-scope.d.ts +0 -3
- package/src/lib/internals/builder-types.d.ts +0 -13
- package/src/lib/internals/derived-types.d.ts +0 -10
- package/src/lib/internals/materialize-markers.d.ts +0 -5
- package/src/lib/internals/merge-derived.d.ts +0 -4
- package/src/lib/markers/derived.d.ts +0 -9
- package/src/lib/markers/entity-map.d.ts +0 -4
- package/src/lib/markers/index.d.ts +0 -3
- package/src/lib/markers/status.d.ts +0 -32
- package/src/lib/markers/stored.d.ts +0 -23
- package/src/lib/memory/memory-manager.d.ts +0 -30
- package/src/lib/path-notifier.d.ts +0 -34
- package/src/lib/performance/diff-engine.d.ts +0 -33
- package/src/lib/performance/path-index.d.ts +0 -25
- package/src/lib/performance/update-engine.d.ts +0 -32
- package/src/lib/presets.d.ts +0 -34
- package/src/lib/security/security-validator.d.ts +0 -33
- package/src/lib/signal-tree.d.ts +0 -6
- package/src/lib/types.d.ts +0 -300
- package/src/lib/utils.d.ts +0 -25
package/dist/lru-cache.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
class LRUCache {
|
|
2
|
-
constructor(maxSize) {
|
|
3
|
-
this.maxSize = maxSize;
|
|
4
|
-
this.cache = new Map();
|
|
5
|
-
if (!Number.isFinite(maxSize) || maxSize <= 0) {
|
|
6
|
-
throw new Error('LRUCache maxSize must be a positive, finite number');
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
set(key, value) {
|
|
10
|
-
if (this.cache.has(key)) {
|
|
11
|
-
this.cache.delete(key);
|
|
12
|
-
}
|
|
13
|
-
this.cache.set(key, value);
|
|
14
|
-
if (this.cache.size > this.maxSize) {
|
|
15
|
-
const oldestKey = this.cache.keys().next().value;
|
|
16
|
-
if (oldestKey !== undefined) {
|
|
17
|
-
this.cache.delete(oldestKey);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
get(key) {
|
|
22
|
-
if (!this.cache.has(key)) return undefined;
|
|
23
|
-
const value = this.cache.get(key);
|
|
24
|
-
if (value !== undefined) {
|
|
25
|
-
this.cache.delete(key);
|
|
26
|
-
this.cache.set(key, value);
|
|
27
|
-
}
|
|
28
|
-
return value;
|
|
29
|
-
}
|
|
30
|
-
delete(key) {
|
|
31
|
-
this.cache.delete(key);
|
|
32
|
-
}
|
|
33
|
-
has(key) {
|
|
34
|
-
return this.cache.has(key);
|
|
35
|
-
}
|
|
36
|
-
clear() {
|
|
37
|
-
this.cache.clear();
|
|
38
|
-
}
|
|
39
|
-
size() {
|
|
40
|
-
return this.cache.size;
|
|
41
|
-
}
|
|
42
|
-
forEach(callback) {
|
|
43
|
-
this.cache.forEach((value, key) => callback(value, key));
|
|
44
|
-
}
|
|
45
|
-
entries() {
|
|
46
|
-
return this.cache.entries();
|
|
47
|
-
}
|
|
48
|
-
keys() {
|
|
49
|
-
return this.cache.keys();
|
|
50
|
-
}
|
|
51
|
-
resize(newSize) {
|
|
52
|
-
if (!Number.isFinite(newSize) || newSize <= 0) {
|
|
53
|
-
throw new Error('LRUCache newSize must be a positive, finite number');
|
|
54
|
-
}
|
|
55
|
-
this.maxSize = newSize;
|
|
56
|
-
while (this.cache.size > this.maxSize) {
|
|
57
|
-
const oldestKey = this.cache.keys().next().value;
|
|
58
|
-
if (oldestKey === undefined) break;
|
|
59
|
-
this.cache.delete(oldestKey);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export { LRUCache };
|
package/dist/parse-path.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_PATH_CACHE_SIZE } from './constants.js';
|
|
2
|
-
import { LRUCache } from './lru-cache.js';
|
|
3
|
-
|
|
4
|
-
const pathCache = new LRUCache(DEFAULT_PATH_CACHE_SIZE);
|
|
5
|
-
function parsePath(path) {
|
|
6
|
-
const cached = pathCache.get(path);
|
|
7
|
-
if (cached) return cached;
|
|
8
|
-
const segments = path.split('.');
|
|
9
|
-
pathCache.set(path, segments);
|
|
10
|
-
return segments;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { parsePath };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ISignalTree, BatchingConfig, BatchingMethods } from '../../lib/types';
|
|
2
|
-
export declare function batching(config?: BatchingConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & BatchingMethods<T>;
|
|
3
|
-
export declare function highPerformanceBatching(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & BatchingMethods<T>;
|
|
4
|
-
export declare function batchingWithConfig(config?: BatchingConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & BatchingMethods<T>;
|
|
5
|
-
export declare function flushBatchedUpdates(): void;
|
|
6
|
-
export declare function hasPendingUpdates(): boolean;
|
|
7
|
-
export declare function getBatchQueueSize(): number;
|
|
8
|
-
export declare const withBatching: ((config?: BatchingConfig) => <T>(tree: ISignalTree<T>) => ISignalTree<T> & BatchingMethods<T>) & {
|
|
9
|
-
highPerformance: typeof highPerformanceBatching;
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './batching';
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Signal } from '@angular/core';
|
|
2
|
-
import type { ISignalTree, DevToolsConfig, DevToolsMethods } from '../../lib/types';
|
|
3
|
-
export interface ModuleMetadata {
|
|
4
|
-
name: string;
|
|
5
|
-
methods: string[];
|
|
6
|
-
addedAt: Date;
|
|
7
|
-
lastActivity: Date;
|
|
8
|
-
operationCount: number;
|
|
9
|
-
averageExecutionTime: number;
|
|
10
|
-
errorCount: number;
|
|
11
|
-
}
|
|
12
|
-
export interface ModularPerformanceMetrics {
|
|
13
|
-
totalUpdates: number;
|
|
14
|
-
moduleUpdates: Record<string, number>;
|
|
15
|
-
modulePerformance: Record<string, number>;
|
|
16
|
-
compositionChain: string[];
|
|
17
|
-
signalGrowth: Record<string, number>;
|
|
18
|
-
memoryDelta: Record<string, number>;
|
|
19
|
-
moduleCacheStats: Record<string, {
|
|
20
|
-
hits: number;
|
|
21
|
-
misses: number;
|
|
22
|
-
}>;
|
|
23
|
-
}
|
|
24
|
-
export interface ModuleActivityTracker {
|
|
25
|
-
trackMethodCall: (module: string, method: string, duration: number) => void;
|
|
26
|
-
trackError: (module: string, error: Error, context?: string) => void;
|
|
27
|
-
getModuleActivity: (module: string) => ModuleMetadata | undefined;
|
|
28
|
-
getAllModules: () => ModuleMetadata[];
|
|
29
|
-
}
|
|
30
|
-
export interface CompositionLogger {
|
|
31
|
-
logComposition: (modules: string[], action: 'with' | 'enhance') => void;
|
|
32
|
-
logMethodExecution: (module: string, method: string, args: unknown[], result: unknown) => void;
|
|
33
|
-
logStateChange: (module: string, path: string, oldValue: unknown, newValue: unknown) => void;
|
|
34
|
-
logPerformanceWarning: (module: string, operation: string, duration: number, threshold: number) => void;
|
|
35
|
-
exportLogs: () => Array<{
|
|
36
|
-
timestamp: Date;
|
|
37
|
-
module: string;
|
|
38
|
-
type: 'composition' | 'method' | 'state' | 'performance';
|
|
39
|
-
data: unknown;
|
|
40
|
-
}>;
|
|
41
|
-
}
|
|
42
|
-
export interface ModularDevToolsInterface {
|
|
43
|
-
activityTracker: ModuleActivityTracker;
|
|
44
|
-
logger: CompositionLogger;
|
|
45
|
-
metrics: Signal<ModularPerformanceMetrics>;
|
|
46
|
-
trackComposition: (modules: string[]) => void;
|
|
47
|
-
startModuleProfiling: (module: string) => string;
|
|
48
|
-
endModuleProfiling: (profileId: string) => void;
|
|
49
|
-
connectDevTools: (treeName: string) => void;
|
|
50
|
-
exportDebugSession: () => {
|
|
51
|
-
metrics: ModularPerformanceMetrics;
|
|
52
|
-
modules: ModuleMetadata[];
|
|
53
|
-
logs: Array<unknown>;
|
|
54
|
-
compositionHistory: Array<{
|
|
55
|
-
timestamp: Date;
|
|
56
|
-
chain: string[];
|
|
57
|
-
}>;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
export declare function devTools(config?: DevToolsConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & DevToolsMethods;
|
|
61
|
-
export declare function enableDevTools(treeName?: string): <T>(tree: ISignalTree<T>) => ISignalTree<T> & DevToolsMethods;
|
|
62
|
-
export declare function fullDevTools(treeName?: string): <T>(tree: ISignalTree<T>) => ISignalTree<T> & DevToolsMethods;
|
|
63
|
-
export declare function productionDevTools(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & DevToolsMethods;
|
|
64
|
-
export declare const withDevTools: typeof devTools & {
|
|
65
|
-
production: typeof productionDevTools;
|
|
66
|
-
full: typeof fullDevTools;
|
|
67
|
-
enable: typeof enableDevTools;
|
|
68
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './devtools';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ISignalTree, EffectsMethods } from '../../lib/types';
|
|
2
|
-
export interface EffectsConfig {
|
|
3
|
-
enabled?: boolean;
|
|
4
|
-
}
|
|
5
|
-
export declare function effects(config?: EffectsConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & EffectsMethods<T>;
|
|
6
|
-
export declare function enableEffects(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & EffectsMethods<T>;
|
|
7
|
-
export declare const withEffects: ((config?: EffectsConfig) => <T>(tree: ISignalTree<T>) => ISignalTree<T> & EffectsMethods<T>) & {
|
|
8
|
-
enable: typeof enableEffects;
|
|
9
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './effects';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ISignalTree, EntitiesEnabled } from '../../lib/types';
|
|
2
|
-
export interface EntitiesEnhancerConfig {
|
|
3
|
-
enabled?: boolean;
|
|
4
|
-
}
|
|
5
|
-
export declare function entities(config?: EntitiesEnhancerConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & EntitiesEnabled;
|
|
6
|
-
export declare function enableEntities(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & EntitiesEnabled;
|
|
7
|
-
export declare function highPerformanceEntities(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & EntitiesEnabled;
|
|
8
|
-
export declare const withEntities: typeof entities & {
|
|
9
|
-
highPerformance: typeof highPerformanceEntities;
|
|
10
|
-
enable: typeof enableEntities;
|
|
11
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './entities';
|
package/src/enhancers/index.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { EnhancerMeta, EnhancerWithMeta, Enhancer } from '../lib/types';
|
|
2
|
-
export declare function createEnhancer<TAdded = unknown>(meta: EnhancerMeta, enhancerFn: Enhancer<TAdded>): EnhancerWithMeta<TAdded>;
|
|
3
|
-
export declare function resolveEnhancerOrder(enhancers: EnhancerWithMeta<unknown>[], availableCapabilities?: Set<string>, debugMode?: boolean): EnhancerWithMeta<unknown>[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './memoization';
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { ISignalTree } from '../../lib/types';
|
|
2
|
-
export declare function cleanupMemoizationCache(): void;
|
|
3
|
-
import type { MemoizationConfig, MemoizationMethods } from '../../lib/types';
|
|
4
|
-
export declare function memoize<TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => TReturn, keyFn?: (...args: TArgs) => string, config?: MemoizationConfig): (...args: TArgs) => TReturn;
|
|
5
|
-
export declare function memoizeShallow<TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => TReturn, keyFn?: (...args: TArgs) => string): (...args: TArgs) => TReturn;
|
|
6
|
-
export declare function memoizeReference<TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => TReturn, keyFn?: (...args: TArgs) => string): (...args: TArgs) => TReturn;
|
|
7
|
-
export declare const MEMOIZATION_PRESETS: {
|
|
8
|
-
readonly selector: {
|
|
9
|
-
readonly equality: "reference";
|
|
10
|
-
readonly maxCacheSize: 10;
|
|
11
|
-
readonly enableLRU: false;
|
|
12
|
-
readonly ttl: undefined;
|
|
13
|
-
};
|
|
14
|
-
readonly computed: {
|
|
15
|
-
readonly equality: "shallow";
|
|
16
|
-
readonly maxCacheSize: 100;
|
|
17
|
-
readonly enableLRU: false;
|
|
18
|
-
readonly ttl: undefined;
|
|
19
|
-
};
|
|
20
|
-
readonly deepState: {
|
|
21
|
-
readonly equality: "deep";
|
|
22
|
-
readonly maxCacheSize: 1000;
|
|
23
|
-
readonly enableLRU: true;
|
|
24
|
-
readonly ttl: number;
|
|
25
|
-
};
|
|
26
|
-
readonly highFrequency: {
|
|
27
|
-
readonly equality: "reference";
|
|
28
|
-
readonly maxCacheSize: 5;
|
|
29
|
-
readonly enableLRU: false;
|
|
30
|
-
readonly ttl: undefined;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
export declare function selectorMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
|
|
34
|
-
export declare function computedMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
|
|
35
|
-
export declare function deepStateMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
|
|
36
|
-
export declare function highFrequencyMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
|
|
37
|
-
export declare const withMemoization: ((config?: MemoizationConfig) => <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>) & {
|
|
38
|
-
selector: typeof selectorMemoization;
|
|
39
|
-
computed: typeof computedMemoization;
|
|
40
|
-
deep: typeof deepStateMemoization;
|
|
41
|
-
fast: typeof highFrequencyMemoization;
|
|
42
|
-
};
|
|
43
|
-
export declare function memoization(config?: MemoizationConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
|
|
44
|
-
export declare function enableMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
|
|
45
|
-
export declare function highPerformanceMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
|
|
46
|
-
export declare function lightweightMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
|
|
47
|
-
export declare function shallowMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
|
|
48
|
-
export declare function clearAllCaches(): void;
|
|
49
|
-
export declare function getGlobalCacheStats(): {
|
|
50
|
-
treeCount: number;
|
|
51
|
-
totalSize: number;
|
|
52
|
-
totalHits: number;
|
|
53
|
-
averageCacheSize: number;
|
|
54
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './lib/presets';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createDevTree, createMinimalTree, createProdTree } from '../../../lib/presets';
|
|
2
|
-
import type { TreeConfig, TreePreset } from '../../../lib/types';
|
|
3
|
-
export declare const TREE_PRESETS: Record<TreePreset, Partial<TreeConfig>>;
|
|
4
|
-
export declare function createPresetConfig(preset: TreePreset, overrides?: Partial<TreeConfig>): TreeConfig;
|
|
5
|
-
export declare function validatePreset(preset: TreePreset): boolean;
|
|
6
|
-
export declare function getAvailablePresets(): TreePreset[];
|
|
7
|
-
export declare function combinePresets(presets: TreePreset[], overrides?: Partial<TreeConfig>): TreeConfig;
|
|
8
|
-
export { createDevTree, createProdTree, createMinimalTree };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const TYPE_MARKERS: {
|
|
2
|
-
readonly DATE: "§d";
|
|
3
|
-
readonly REGEXP: "§r";
|
|
4
|
-
readonly MAP: "§m";
|
|
5
|
-
readonly SET: "§s";
|
|
6
|
-
readonly UNDEFINED: "§u";
|
|
7
|
-
readonly NAN: "§n";
|
|
8
|
-
readonly INFINITY: "§i";
|
|
9
|
-
readonly NEG_INFINITY: "§-i";
|
|
10
|
-
readonly BIGINT: "§b";
|
|
11
|
-
readonly SYMBOL: "§y";
|
|
12
|
-
readonly FUNCTION: "§f";
|
|
13
|
-
readonly CIRCULAR: "§c";
|
|
14
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { ISignalTree } from '../../lib/types';
|
|
2
|
-
export interface SerializationConfig {
|
|
3
|
-
includeMetadata?: boolean;
|
|
4
|
-
replacer?: (key: string, value: unknown) => unknown;
|
|
5
|
-
reviver?: (key: string, value: unknown) => unknown;
|
|
6
|
-
preserveTypes?: boolean;
|
|
7
|
-
maxDepth?: number;
|
|
8
|
-
handleCircular?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface SerializedState<T = unknown> {
|
|
11
|
-
data: T;
|
|
12
|
-
metadata?: {
|
|
13
|
-
timestamp: number;
|
|
14
|
-
version: string;
|
|
15
|
-
appVersion?: string;
|
|
16
|
-
types?: Record<string, string>;
|
|
17
|
-
circularRefs?: Array<{
|
|
18
|
-
path: string;
|
|
19
|
-
targetPath: string;
|
|
20
|
-
}>;
|
|
21
|
-
nodeMap?: Record<string, 'b' | 'r'>;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export interface SerializableSignalTree<T> extends ISignalTree<T> {
|
|
25
|
-
$: any;
|
|
26
|
-
serialize(config?: SerializationConfig): string;
|
|
27
|
-
deserialize(json: string, config?: SerializationConfig): void;
|
|
28
|
-
toJSON(): T;
|
|
29
|
-
fromJSON(data: T, metadata?: SerializedState<T>['metadata']): void;
|
|
30
|
-
snapshot(): SerializedState<T>;
|
|
31
|
-
restore(snapshot: SerializedState<T>): void;
|
|
32
|
-
}
|
|
33
|
-
export interface SerializationMethods {
|
|
34
|
-
serialize(config?: SerializationConfig): string;
|
|
35
|
-
deserialize(json: string, config?: SerializationConfig): void;
|
|
36
|
-
toJSON(): unknown;
|
|
37
|
-
fromJSON(data: unknown, metadata?: SerializedState<unknown>['metadata']): void;
|
|
38
|
-
snapshot(): SerializedState<unknown>;
|
|
39
|
-
restore(snapshot: SerializedState<unknown>): void;
|
|
40
|
-
}
|
|
41
|
-
export interface PersistenceMethods {
|
|
42
|
-
save(): Promise<void>;
|
|
43
|
-
load(): Promise<void>;
|
|
44
|
-
clear(): Promise<void>;
|
|
45
|
-
__flushAutoSave?: () => Promise<void>;
|
|
46
|
-
}
|
|
47
|
-
export declare function serialization(defaultConfig?: SerializationConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & SerializationMethods;
|
|
48
|
-
export declare const withSerialization: (defaultConfig?: SerializationConfig) => <T>(tree: ISignalTree<T>) => ISignalTree<T> & SerializationMethods;
|
|
49
|
-
export declare function enableSerialization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & SerializationMethods;
|
|
50
|
-
export interface StorageAdapter {
|
|
51
|
-
getItem(key: string): string | null | Promise<string | null>;
|
|
52
|
-
setItem(key: string, value: string): void | Promise<void>;
|
|
53
|
-
removeItem(key: string): void | Promise<void>;
|
|
54
|
-
}
|
|
55
|
-
export interface PersistenceConfig extends SerializationConfig {
|
|
56
|
-
key: string;
|
|
57
|
-
storage?: StorageAdapter;
|
|
58
|
-
autoSave?: boolean;
|
|
59
|
-
debounceMs?: number;
|
|
60
|
-
autoLoad?: boolean;
|
|
61
|
-
skipCache?: boolean;
|
|
62
|
-
}
|
|
63
|
-
export declare function persistence(config: PersistenceConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & SerializationMethods & PersistenceMethods;
|
|
64
|
-
export declare const withPersistence: (cfg: PersistenceConfig) => <T>(tree: ISignalTree<T>) => ISignalTree<T> & SerializationMethods & PersistenceMethods;
|
|
65
|
-
export declare function createStorageAdapter(getItem: (key: string) => string | null | Promise<string | null>, setItem: (key: string, value: string) => void | Promise<void>, removeItem: (key: string) => void | Promise<void>): StorageAdapter;
|
|
66
|
-
export declare function createIndexedDBAdapter(dbName?: string, storeName?: string): StorageAdapter;
|
|
67
|
-
export declare function applySerialization<T extends Record<string, unknown>>(tree: ISignalTree<T>): ISignalTree<T> & SerializationMethods;
|
|
68
|
-
export declare function applyPersistence<T extends Record<string, unknown>>(tree: ISignalTree<T>, cfg: PersistenceConfig): ISignalTree<T> & SerializationMethods & PersistenceMethods;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './time-travel';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ISignalTree, TimeTravelMethods, TimeTravelConfig, TimeTravelEntry } from '../../lib/types';
|
|
2
|
-
export type { TimeTravelConfig, TimeTravelEntry };
|
|
3
|
-
export declare function timeTravel(config?: TimeTravelConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & TimeTravelMethods<T>;
|
|
4
|
-
export declare function enableTimeTravel(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & TimeTravelMethods<T>;
|
|
5
|
-
export declare function timeTravelHistory(maxHistorySize: number): <T>(tree: ISignalTree<T>) => ISignalTree<T> & TimeTravelMethods<T>;
|
|
6
|
-
export declare const withTimeTravel: ((config?: TimeTravelConfig) => <T>(tree: ISignalTree<T>) => ISignalTree<T> & TimeTravelMethods<T>) & {
|
|
7
|
-
minimal: () => <T>(tree: ISignalTree<T>) => ISignalTree<T> & TimeTravelMethods<T>;
|
|
8
|
-
debug: () => <T>(tree: ISignalTree<T>) => ISignalTree<T> & TimeTravelMethods<T>;
|
|
9
|
-
history: typeof timeTravelHistory;
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/src/enhancers/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { BatchingMethods, BatchingConfig, MemoizationMethods, MemoizationConfig, TimeTravelMethods, TimeTravelConfig, EffectsMethods, DevToolsMethods, DevToolsConfig, EntitiesEnabled, Enhancer, EnhancerWithMeta, EnhancerMeta, } from '../lib/types';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function copyTreeProperties<T extends object>(source: T, target: T): void;
|
package/src/index.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export { signalTree } from './lib/signal-tree';
|
|
2
|
-
export type { ISignalTree, SignalTree, SignalTreeBase, FullSignalTree, ProdSignalTree, TreeNode, CallableWritableSignal, AccessibleNode, NodeAccessor, Primitive, NotFn, TreeConfig, TreePreset, Enhancer, EnhancerMeta, EnhancerWithMeta, EntitySignal, EntityMapMarker, EntityConfig, MutationOptions, AddOptions, AddManyOptions, TimeTravelEntry, TimeTravelMethods, } from './lib/types';
|
|
3
|
-
export { entityMap } from './lib/types';
|
|
4
|
-
export type { ProcessDerived, DeepMergeTree, DerivedFactory, } from './lib/internals/derived-types';
|
|
5
|
-
export type { SignalTreeBuilder } from './lib/internals/builder-types';
|
|
6
|
-
export { isDerivedMarker, type DerivedMarker, type DerivedType, } from './lib/markers/derived';
|
|
7
|
-
export { status, isStatusMarker, LoadingState, type StatusMarker, type StatusSignal, type StatusConfig, } from './lib/markers/status';
|
|
8
|
-
export { stored, isStoredMarker, type StoredMarker, type StoredSignal, type StoredOptions, } from './lib/markers/stored';
|
|
9
|
-
export { registerMarkerProcessor } from './lib/internals/materialize-markers';
|
|
10
|
-
export { equal, deepEqual, isNodeAccessor, isAnySignal, toWritableSignal, parsePath, composeEnhancers, isBuiltInObject, createLazySignalTree, } from './lib/utils';
|
|
11
|
-
export { createEditSession, type EditSession, type UndoRedoHistory, } from './lib/edit-session';
|
|
12
|
-
export { getPathNotifier } from './lib/path-notifier';
|
|
13
|
-
export { SecurityValidator, SecurityPresets, type SecurityEvent, type SecurityEventType, type SecurityValidatorConfig, } from './lib/security/security-validator';
|
|
14
|
-
export { createEnhancer, resolveEnhancerOrder } from './enhancers/index';
|
|
15
|
-
export { ENHANCER_META } from './lib/types';
|
|
16
|
-
export { batching, batchingWithConfig, highPerformanceBatching, flushBatchedUpdates, hasPendingUpdates, getBatchQueueSize, } from './enhancers/batching/batching';
|
|
17
|
-
export type { BatchingConfig, BatchingMethods } from './lib/types';
|
|
18
|
-
export { memoization, selectorMemoization, computedMemoization, deepStateMemoization, highFrequencyMemoization, highPerformanceMemoization, lightweightMemoization, shallowMemoization, memoize, memoizeShallow, memoizeReference, clearAllCaches, getGlobalCacheStats, } from './enhancers/memoization/memoization';
|
|
19
|
-
export { timeTravel, enableTimeTravel, } from './enhancers/time-travel/time-travel';
|
|
20
|
-
export { entities, enableEntities, highPerformanceEntities, } from './enhancers/entities/entities';
|
|
21
|
-
export { serialization, enableSerialization, persistence, createStorageAdapter, createIndexedDBAdapter, applySerialization, applyPersistence, } from './enhancers/serialization/serialization';
|
|
22
|
-
export { devTools, enableDevTools, fullDevTools, productionDevTools, } from './enhancers/devtools/devtools';
|
|
23
|
-
export { createAsyncOperation, trackAsync } from './lib/async-helpers';
|
|
24
|
-
export { TREE_PRESETS, createPresetConfig, validatePreset, getAvailablePresets, combinePresets, createDevTree, } from './enhancers/presets/lib/presets';
|
|
25
|
-
export { SIGNAL_TREE_CONSTANTS, SIGNAL_TREE_MESSAGES } from './lib/constants';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ISignalTree } from './types';
|
|
2
|
-
export declare function createAsyncOperation<T, TResult>(name: string, operation: () => Promise<TResult>): (tree: ISignalTree<T>) => Promise<TResult>;
|
|
3
|
-
export declare function trackAsync<T>(operation: () => Promise<T>): {
|
|
4
|
-
pending: import("@angular/core").Signal<boolean>;
|
|
5
|
-
error: import("@angular/core").Signal<Error | null>;
|
|
6
|
-
result: import("@angular/core").Signal<T | null>;
|
|
7
|
-
execute: () => Promise<T>;
|
|
8
|
-
};
|
package/src/lib/constants.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export declare const SIGNAL_TREE_CONSTANTS: {
|
|
2
|
-
readonly MAX_PATH_CACHE_SIZE: 1000;
|
|
3
|
-
readonly LAZY_THRESHOLD: 50;
|
|
4
|
-
readonly ESTIMATE_MAX_DEPTH: 3;
|
|
5
|
-
readonly ESTIMATE_SAMPLE_SIZE_ARRAY: 3;
|
|
6
|
-
readonly ESTIMATE_SAMPLE_SIZE_OBJECT: 5;
|
|
7
|
-
readonly DEFAULT_CACHE_SIZE: 100;
|
|
8
|
-
readonly DEFAULT_BATCH_SIZE: 10;
|
|
9
|
-
};
|
|
10
|
-
export declare const SIGNAL_TREE_MESSAGES: Readonly<{
|
|
11
|
-
readonly NULL_OR_UNDEFINED: "null/undefined";
|
|
12
|
-
readonly CIRCULAR_REF: "circular ref";
|
|
13
|
-
readonly UPDATER_INVALID: "updater invalid";
|
|
14
|
-
readonly LAZY_FALLBACK: "lazy fallback";
|
|
15
|
-
readonly SIGNAL_CREATION_FAILED: "signal creation failed";
|
|
16
|
-
readonly UPDATE_PATH_NOT_FOUND: "update path not found";
|
|
17
|
-
readonly UPDATE_FAILED: "update failed";
|
|
18
|
-
readonly ROLLBACK_FAILED: "rollback failed";
|
|
19
|
-
readonly CLEANUP_ERROR: "cleanup error";
|
|
20
|
-
readonly PRESET_UNKNOWN: "unknown preset";
|
|
21
|
-
readonly STRATEGY_SELECTION: "strategy select";
|
|
22
|
-
readonly TREE_DESTROYED: "destroyed";
|
|
23
|
-
readonly UPDATE_TRANSACTION: "update tx";
|
|
24
|
-
readonly BATCH_NOT_ENABLED: "batching disabled";
|
|
25
|
-
readonly MEMOIZE_NOT_ENABLED: "memoize disabled";
|
|
26
|
-
readonly MIDDLEWARE_NOT_AVAILABLE: "middleware missing";
|
|
27
|
-
readonly ENTITY_HELPERS_NOT_AVAILABLE: "entity helpers missing";
|
|
28
|
-
readonly TIME_TRAVEL_NOT_AVAILABLE: "time travel missing";
|
|
29
|
-
readonly OPTIMIZE_NOT_AVAILABLE: "optimize missing";
|
|
30
|
-
readonly UPDATE_OPTIMIZED_NOT_AVAILABLE: "update optimized missing";
|
|
31
|
-
readonly CACHE_NOT_AVAILABLE: "cache missing";
|
|
32
|
-
readonly PERFORMANCE_NOT_ENABLED: "performance disabled";
|
|
33
|
-
readonly ENHANCER_ORDER_FAILED: "enhancer order failed";
|
|
34
|
-
readonly ENHANCER_CYCLE_DETECTED: "enhancer cycle";
|
|
35
|
-
readonly ENHANCER_REQUIREMENT_MISSING: "enhancer req missing";
|
|
36
|
-
readonly ENHANCER_PROVIDES_MISSING: "enhancer provides missing";
|
|
37
|
-
readonly ENHANCER_FAILED: "enhancer failed";
|
|
38
|
-
readonly ENHANCER_NOT_FUNCTION: "enhancer not function";
|
|
39
|
-
readonly EFFECT_NO_CONTEXT: "no angular context";
|
|
40
|
-
readonly SUBSCRIBE_NO_CONTEXT: "no angular context";
|
|
41
|
-
}>;
|
package/src/lib/dev-proxy.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { WritableSignal } from '@angular/core';
|
|
2
|
-
export type UndoRedoHistory<T> = {
|
|
3
|
-
past: T[];
|
|
4
|
-
present: T;
|
|
5
|
-
future: T[];
|
|
6
|
-
};
|
|
7
|
-
export interface EditSession<T> {
|
|
8
|
-
readonly original: WritableSignal<T>;
|
|
9
|
-
readonly modified: WritableSignal<T>;
|
|
10
|
-
readonly canUndo: () => boolean;
|
|
11
|
-
readonly canRedo: () => boolean;
|
|
12
|
-
readonly isDirty: () => boolean;
|
|
13
|
-
setOriginal(value: T): void;
|
|
14
|
-
applyChanges(valueOrUpdater: T | ((current: T) => T)): void;
|
|
15
|
-
undo(): void;
|
|
16
|
-
redo(): void;
|
|
17
|
-
reset(): void;
|
|
18
|
-
getHistory(): UndoRedoHistory<T>;
|
|
19
|
-
}
|
|
20
|
-
export declare function createEditSession<T>(initial: T): EditSession<T>;
|
|
21
|
-
export default createEditSession;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ProcessDerived } from './derived-types';
|
|
2
|
-
import type { ISignalTree, TreeNode } from '../types';
|
|
3
|
-
export interface SignalTreeBuilder<TSource, TAccum = TreeNode<TSource>> {
|
|
4
|
-
(): TSource;
|
|
5
|
-
(value: Partial<TSource>): void;
|
|
6
|
-
(updater: (current: TSource) => TSource): void;
|
|
7
|
-
readonly $: TAccum;
|
|
8
|
-
readonly state: TAccum;
|
|
9
|
-
with<TAdded>(enhancer: (tree: ISignalTree<TSource>) => ISignalTree<TSource> & TAdded): SignalTreeBuilder<TSource, TAccum> & TAdded;
|
|
10
|
-
bind(thisArg?: unknown): (value?: TSource) => TSource | void;
|
|
11
|
-
destroy(): void;
|
|
12
|
-
derived<TDerived extends object>(factory: ($: TAccum) => TDerived): SignalTreeBuilder<TSource, TAccum & ProcessDerived<TDerived>>;
|
|
13
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Signal } from '@angular/core';
|
|
2
|
-
import type { DerivedMarker } from '../markers/derived';
|
|
3
|
-
import type { TreeNode } from '../types';
|
|
4
|
-
export type ProcessDerived<T> = T extends DerivedMarker<infer R> ? Signal<R> : T extends Signal<infer S> ? Signal<S> : T extends object ? {
|
|
5
|
-
[P in keyof T]: ProcessDerived<T[P]>;
|
|
6
|
-
} : never;
|
|
7
|
-
export type DeepMergeTree<TSource, TDerived> = {
|
|
8
|
-
[K in keyof TSource | keyof TDerived]: K extends keyof TSource ? K extends keyof TDerived ? TSource[K] extends object ? TDerived[K] extends object ? TDerived[K] extends DerivedMarker<infer R> ? Signal<R> : TSource[K] & DeepMergeTree<TSource[K], ProcessDerived<TDerived[K]>> : TSource[K] : ProcessDerived<TDerived[K]> : TSource[K] : K extends keyof TDerived ? ProcessDerived<TDerived[K]> : never;
|
|
9
|
-
};
|
|
10
|
-
export type DerivedFactory<TSource, TDerived> = ($: TreeNode<TSource>) => TDerived;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { PathNotifier } from '../path-notifier';
|
|
2
|
-
export declare function isRegisteredMarker(value: unknown): boolean;
|
|
3
|
-
export declare function registerMarkerProcessor<T, R>(check: (value: unknown) => value is T, create: (marker: T, notifier: PathNotifier, path: string) => R): void;
|
|
4
|
-
export declare function materializeMarkers(node: unknown, notifier?: PathNotifier, path?: string[]): void;
|
|
5
|
-
export declare function hasMarkers(node: unknown, visited?: WeakSet<object>): boolean;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const DERIVED_MARKER: unique symbol;
|
|
2
|
-
export interface DerivedMarker<T> {
|
|
3
|
-
readonly [DERIVED_MARKER]: true;
|
|
4
|
-
readonly factory: () => T;
|
|
5
|
-
readonly __type?: T;
|
|
6
|
-
}
|
|
7
|
-
export type DerivedType<T> = T extends DerivedMarker<infer R> ? R : never;
|
|
8
|
-
export declare function isDerivedMarker(value: unknown): value is DerivedMarker<unknown>;
|
|
9
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { isDerivedMarker, getDerivedMarkerSymbol, type DerivedMarker, type DerivedType, } from './derived';
|
|
2
|
-
export { status, isStatusMarker, createStatusSignal, LoadingState, STATUS_MARKER, type StatusMarker, type StatusSignal, type StatusConfig, } from './status';
|
|
3
|
-
export { stored, isStoredMarker, createStoredSignal, STORED_MARKER, type StoredMarker, type StoredSignal, type StoredOptions, } from './stored';
|