@signaltree/enterprise 7.3.0 → 7.3.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/package.json +2 -1
- package/src/diff-engine.d.ts +2 -0
- package/src/enterprise-enhancer.d.ts +2 -0
- package/src/index.d.ts +6 -0
- package/src/lib/diff-engine.d.ts +43 -0
- package/src/lib/enterprise-enhancer.d.ts +16 -0
- package/src/lib/enterprise.d.ts +1 -0
- package/src/lib/path-index.d.ts +31 -0
- package/src/lib/scheduler.d.ts +18 -0
- package/src/lib/thread-pools.d.ts +4 -0
- package/src/lib/update-engine.d.ts +32 -0
- package/src/path-index.d.ts +2 -0
- package/src/scheduler.d.ts +2 -0
- package/src/signaltree-core.d.ts +4 -0
- package/src/test-setup.d.ts +3 -0
- package/src/thread-pools.d.ts +2 -0
- package/src/update-engine.d.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signaltree/enterprise",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.1",
|
|
4
4
|
"description": "Enterprise optimizations for SignalTree reactive JSON. Diff-based updates, bulk operations, and advanced change tracking for large-scale applications.",
|
|
5
5
|
"license": "BSL-1.1",
|
|
6
6
|
"type": "module",
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
"files": [
|
|
99
99
|
"dist/**/*.js",
|
|
100
100
|
"dist/**/*.d.ts",
|
|
101
|
+
"src/**/*.d.ts",
|
|
101
102
|
"README.md"
|
|
102
103
|
]
|
|
103
104
|
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Path } from './path-index';
|
|
2
|
+
export declare enum ChangeType {
|
|
3
|
+
ADD = "add",
|
|
4
|
+
UPDATE = "update",
|
|
5
|
+
DELETE = "delete",
|
|
6
|
+
REPLACE = "replace"
|
|
7
|
+
}
|
|
8
|
+
export interface Change {
|
|
9
|
+
type: ChangeType;
|
|
10
|
+
path: Path;
|
|
11
|
+
value?: unknown;
|
|
12
|
+
oldValue?: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface Diff {
|
|
15
|
+
changes: Change[];
|
|
16
|
+
hasChanges: boolean;
|
|
17
|
+
instrumentation?: {
|
|
18
|
+
elementComparisons: number;
|
|
19
|
+
prefixFastPathHits: number;
|
|
20
|
+
wholeArrayReplaceHits: number;
|
|
21
|
+
traversals: number;
|
|
22
|
+
suffixFastPathHits: number;
|
|
23
|
+
segmentSkips: number;
|
|
24
|
+
samplesTaken: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface DiffOptions {
|
|
28
|
+
maxDepth?: number;
|
|
29
|
+
detectDeletions?: boolean;
|
|
30
|
+
ignoreArrayOrder?: boolean;
|
|
31
|
+
equalityFn?: (a: unknown, b: unknown) => boolean;
|
|
32
|
+
keyValidator?: (key: string) => boolean;
|
|
33
|
+
instrumentation?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare class DiffEngine {
|
|
36
|
+
private defaultOptions;
|
|
37
|
+
diff(current: unknown, updates: unknown, options?: DiffOptions): Diff;
|
|
38
|
+
private traverse;
|
|
39
|
+
private diffArrays;
|
|
40
|
+
private diffArraysOrdered;
|
|
41
|
+
private diffArraysUnordered;
|
|
42
|
+
private stringify;
|
|
43
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PathIndex } from './path-index';
|
|
2
|
+
import { UpdateResult } from './update-engine';
|
|
3
|
+
import type { Signal } from '@angular/core';
|
|
4
|
+
import type { ISignalTree } from '@signaltree/core';
|
|
5
|
+
export declare function enterprise<T = unknown>(): (tree: ISignalTree<T>) => ISignalTree<T> & EnterpriseEnhancedTree<T>;
|
|
6
|
+
export interface EnterpriseEnhancedTree<T> {
|
|
7
|
+
updateOptimized(updates: Partial<T>, options?: {
|
|
8
|
+
maxDepth?: number;
|
|
9
|
+
ignoreArrayOrder?: boolean;
|
|
10
|
+
equalityFn?: (a: unknown, b: unknown) => boolean;
|
|
11
|
+
autoBatch?: boolean;
|
|
12
|
+
batchSize?: number;
|
|
13
|
+
}): UpdateResult;
|
|
14
|
+
getPathIndex(): PathIndex<Signal<unknown>> | null;
|
|
15
|
+
}
|
|
16
|
+
export declare const withEnterprise: typeof enterprise;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function enterprise(): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { WritableSignal } from '@angular/core';
|
|
2
|
+
export type PathSegment = string | number;
|
|
3
|
+
export type Path = PathSegment[];
|
|
4
|
+
export declare class PathIndex<T extends object = WritableSignal<any>> {
|
|
5
|
+
private root;
|
|
6
|
+
private pathCache;
|
|
7
|
+
private stats;
|
|
8
|
+
private enableInstrumentation;
|
|
9
|
+
private instrumentation;
|
|
10
|
+
set(path: Path, signal: T): void;
|
|
11
|
+
get(path: Path): T | null;
|
|
12
|
+
has(path: Path): boolean;
|
|
13
|
+
getByPrefix(prefix: Path): Map<string, T>;
|
|
14
|
+
delete(path: Path): boolean;
|
|
15
|
+
clear(): void;
|
|
16
|
+
getStats(): {
|
|
17
|
+
hits: number;
|
|
18
|
+
misses: number;
|
|
19
|
+
sets: number;
|
|
20
|
+
cleanups: number;
|
|
21
|
+
hitRate: number;
|
|
22
|
+
cacheSize: number;
|
|
23
|
+
};
|
|
24
|
+
buildFromTree(tree: unknown, path?: Path): void;
|
|
25
|
+
private pathToString;
|
|
26
|
+
private collectDescendants;
|
|
27
|
+
deleteSubtree(path: Path): void;
|
|
28
|
+
incrementalUpdate(rootTree: unknown, changedPaths: string[]): void;
|
|
29
|
+
setInstrumentation(enabled: boolean): void;
|
|
30
|
+
getInstrumentation(reset?: boolean): typeof this.instrumentation;
|
|
31
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type Task = () => void;
|
|
2
|
+
interface SchedulerConfig {
|
|
3
|
+
yieldEveryTasks?: number;
|
|
4
|
+
yieldEveryMs?: number;
|
|
5
|
+
instrumentation?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface SchedulerMetrics {
|
|
8
|
+
drainCycles: number;
|
|
9
|
+
tasksExecuted: number;
|
|
10
|
+
maxQueueLength: number;
|
|
11
|
+
yields: number;
|
|
12
|
+
lastDrainDurationMs: number;
|
|
13
|
+
totalDrainDurationMs: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function configureScheduler(newConfig: SchedulerConfig): void;
|
|
16
|
+
export declare function getSchedulerMetrics(reset?: boolean): SchedulerMetrics;
|
|
17
|
+
export declare function postTask(t: Task): void;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PathIndex } from './path-index';
|
|
2
|
+
import type { DiffOptions } from './diff-engine';
|
|
3
|
+
export interface UpdateOptions extends DiffOptions {
|
|
4
|
+
batch?: boolean;
|
|
5
|
+
batchSize?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface UpdateResult {
|
|
8
|
+
changed: boolean;
|
|
9
|
+
duration: number;
|
|
10
|
+
changedPaths: string[];
|
|
11
|
+
stats?: {
|
|
12
|
+
totalPaths: number;
|
|
13
|
+
optimizedPaths: number;
|
|
14
|
+
batchedUpdates: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare class OptimizedUpdateEngine {
|
|
18
|
+
private pathIndex;
|
|
19
|
+
private diffEngine;
|
|
20
|
+
constructor(tree: unknown);
|
|
21
|
+
update(tree: unknown, updates: unknown, options?: UpdateOptions): UpdateResult;
|
|
22
|
+
rebuildIndex(tree: unknown): void;
|
|
23
|
+
getIndexStats(): ReturnType<PathIndex['getStats']>;
|
|
24
|
+
private createPatches;
|
|
25
|
+
private createPatch;
|
|
26
|
+
private calculatePriority;
|
|
27
|
+
private sortPatches;
|
|
28
|
+
private applyPatches;
|
|
29
|
+
private batchApplyPatches;
|
|
30
|
+
private applyPatch;
|
|
31
|
+
private isEqual;
|
|
32
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Removed shim: previous local module augmentation caused stray declaration
|
|
2
|
+
// files that break TypeScript resolution during packaging. If a module
|
|
3
|
+
// augmentation is required again, prefer adding path mapping or proper
|
|
4
|
+
// project references instead of committing a local `.d.ts` into `src/`.
|