@lssm/lib.personalization 0.0.0-canary-20251207013726 → 0.0.0-canary-20251207043720
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 +1 -0
- package/package.json +7 -3
- package/dist/adapter.d.ts +0 -21
- package/dist/analyzer.d.ts +0 -22
- package/dist/index.d.ts +0 -6
- package/dist/store.d.ts +0 -20
- package/dist/tracker.d.ts +0 -52
- package/dist/types.d.ts +0 -58
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/lib.personalization",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20251207043720",
|
|
4
4
|
"description": "Behavior tracking, analysis, and adaptation helpers for ContractSpec personalization.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -37,10 +37,14 @@
|
|
|
37
37
|
"typescript": "^5.9.3"
|
|
38
38
|
},
|
|
39
39
|
"exports": {
|
|
40
|
-
".": "./
|
|
40
|
+
".": "./src/index.ts",
|
|
41
41
|
"./*": "./*"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
|
-
"access": "public"
|
|
44
|
+
"access": "public",
|
|
45
|
+
"exports": {
|
|
46
|
+
".": "./dist/index.js",
|
|
47
|
+
"./*": "./*"
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
50
|
}
|
package/dist/adapter.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { BehaviorInsights } from "./types.js";
|
|
2
|
-
import { OverlaySpec } from "@lssm/lib.overlay-engine";
|
|
3
|
-
|
|
4
|
-
//#region src/adapter.d.ts
|
|
5
|
-
interface OverlaySuggestionOptions {
|
|
6
|
-
overlayId: string;
|
|
7
|
-
tenantId: string;
|
|
8
|
-
capability: string;
|
|
9
|
-
userId?: string;
|
|
10
|
-
role?: string;
|
|
11
|
-
version?: string;
|
|
12
|
-
}
|
|
13
|
-
interface WorkflowAdaptation {
|
|
14
|
-
workflow: string;
|
|
15
|
-
step: string;
|
|
16
|
-
note: string;
|
|
17
|
-
}
|
|
18
|
-
declare function insightsToOverlaySuggestion(insights: BehaviorInsights, options: OverlaySuggestionOptions): OverlaySpec | null;
|
|
19
|
-
declare function insightsToWorkflowAdaptations(insights: BehaviorInsights): WorkflowAdaptation[];
|
|
20
|
-
//#endregion
|
|
21
|
-
export { OverlaySuggestionOptions, WorkflowAdaptation, insightsToOverlaySuggestion, insightsToWorkflowAdaptations };
|
package/dist/analyzer.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { BehaviorInsights } from "./types.js";
|
|
2
|
-
import { BehaviorStore } from "./store.js";
|
|
3
|
-
|
|
4
|
-
//#region src/analyzer.d.ts
|
|
5
|
-
interface BehaviorAnalyzerOptions {
|
|
6
|
-
fieldInactivityThreshold?: number;
|
|
7
|
-
minSamples?: number;
|
|
8
|
-
}
|
|
9
|
-
interface AnalyzeParams {
|
|
10
|
-
tenantId: string;
|
|
11
|
-
userId?: string;
|
|
12
|
-
role?: string;
|
|
13
|
-
windowMs?: number;
|
|
14
|
-
}
|
|
15
|
-
declare class BehaviorAnalyzer {
|
|
16
|
-
private readonly store;
|
|
17
|
-
private readonly options;
|
|
18
|
-
constructor(store: BehaviorStore, options?: BehaviorAnalyzerOptions);
|
|
19
|
-
analyze(params: AnalyzeParams): Promise<BehaviorInsights>;
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
export { AnalyzeParams, BehaviorAnalyzer, BehaviorAnalyzerOptions };
|
package/dist/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { BehaviorEvent, BehaviorEventBase, BehaviorEventType, BehaviorInsights, BehaviorQuery, BehaviorSummary, FeatureUsageEvent, FieldAccessEvent, WorkflowStepEvent } from "./types.js";
|
|
2
|
-
import { BehaviorStore, InMemoryBehaviorStore } from "./store.js";
|
|
3
|
-
import { BehaviorTracker, BehaviorTrackerContext, BehaviorTrackerOptions, TrackFeatureUsageInput, TrackFieldAccessInput, TrackWorkflowStepInput, createBehaviorTracker } from "./tracker.js";
|
|
4
|
-
import { AnalyzeParams, BehaviorAnalyzer, BehaviorAnalyzerOptions } from "./analyzer.js";
|
|
5
|
-
import { OverlaySuggestionOptions, WorkflowAdaptation, insightsToOverlaySuggestion, insightsToWorkflowAdaptations } from "./adapter.js";
|
|
6
|
-
export { AnalyzeParams, BehaviorAnalyzer, BehaviorAnalyzerOptions, BehaviorEvent, BehaviorEventBase, BehaviorEventType, BehaviorInsights, BehaviorQuery, BehaviorStore, BehaviorSummary, BehaviorTracker, BehaviorTrackerContext, BehaviorTrackerOptions, FeatureUsageEvent, FieldAccessEvent, InMemoryBehaviorStore, OverlaySuggestionOptions, TrackFeatureUsageInput, TrackFieldAccessInput, TrackWorkflowStepInput, WorkflowAdaptation, WorkflowStepEvent, createBehaviorTracker, insightsToOverlaySuggestion, insightsToWorkflowAdaptations };
|
package/dist/store.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { BehaviorEvent, BehaviorQuery, BehaviorSummary } from "./types.js";
|
|
2
|
-
|
|
3
|
-
//#region src/store.d.ts
|
|
4
|
-
interface BehaviorStore {
|
|
5
|
-
record(event: BehaviorEvent): Promise<void> | void;
|
|
6
|
-
bulkRecord(events: BehaviorEvent[]): Promise<void> | void;
|
|
7
|
-
query(query: BehaviorQuery): Promise<BehaviorEvent[]>;
|
|
8
|
-
summarize(query: BehaviorQuery): Promise<BehaviorSummary>;
|
|
9
|
-
clear?(): Promise<void> | void;
|
|
10
|
-
}
|
|
11
|
-
declare class InMemoryBehaviorStore implements BehaviorStore {
|
|
12
|
-
private events;
|
|
13
|
-
record(event: BehaviorEvent): Promise<void>;
|
|
14
|
-
bulkRecord(events: BehaviorEvent[]): Promise<void>;
|
|
15
|
-
query(query: BehaviorQuery): Promise<BehaviorEvent[]>;
|
|
16
|
-
summarize(query: BehaviorQuery): Promise<BehaviorSummary>;
|
|
17
|
-
clear(): Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
20
|
-
export { BehaviorStore, InMemoryBehaviorStore };
|
package/dist/tracker.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { BehaviorStore } from "./store.js";
|
|
2
|
-
|
|
3
|
-
//#region src/tracker.d.ts
|
|
4
|
-
interface BehaviorTrackerContext {
|
|
5
|
-
tenantId: string;
|
|
6
|
-
userId?: string;
|
|
7
|
-
role?: string;
|
|
8
|
-
device?: string;
|
|
9
|
-
metadata?: Record<string, unknown>;
|
|
10
|
-
}
|
|
11
|
-
interface BehaviorTrackerOptions {
|
|
12
|
-
store: BehaviorStore;
|
|
13
|
-
context: BehaviorTrackerContext;
|
|
14
|
-
tracerName?: string;
|
|
15
|
-
autoFlushIntervalMs?: number;
|
|
16
|
-
bufferSize?: number;
|
|
17
|
-
}
|
|
18
|
-
interface TrackFieldAccessInput {
|
|
19
|
-
operation: string;
|
|
20
|
-
field: string;
|
|
21
|
-
metadata?: Record<string, unknown>;
|
|
22
|
-
}
|
|
23
|
-
interface TrackFeatureUsageInput {
|
|
24
|
-
feature: string;
|
|
25
|
-
action: 'opened' | 'completed' | 'dismissed';
|
|
26
|
-
metadata?: Record<string, unknown>;
|
|
27
|
-
}
|
|
28
|
-
interface TrackWorkflowStepInput {
|
|
29
|
-
workflow: string;
|
|
30
|
-
step: string;
|
|
31
|
-
status: 'entered' | 'completed' | 'skipped' | 'errored';
|
|
32
|
-
metadata?: Record<string, unknown>;
|
|
33
|
-
}
|
|
34
|
-
declare class BehaviorTracker {
|
|
35
|
-
private readonly store;
|
|
36
|
-
private readonly context;
|
|
37
|
-
private readonly tracer;
|
|
38
|
-
private readonly counter;
|
|
39
|
-
private buffer;
|
|
40
|
-
private readonly bufferSize;
|
|
41
|
-
private flushTimer?;
|
|
42
|
-
constructor(options: BehaviorTrackerOptions);
|
|
43
|
-
trackFieldAccess(input: TrackFieldAccessInput): void;
|
|
44
|
-
trackFeatureUsage(input: TrackFeatureUsageInput): void;
|
|
45
|
-
trackWorkflowStep(input: TrackWorkflowStepInput): void;
|
|
46
|
-
flush(): Promise<void>;
|
|
47
|
-
dispose(): Promise<void>;
|
|
48
|
-
private enqueue;
|
|
49
|
-
}
|
|
50
|
-
declare const createBehaviorTracker: (options: BehaviorTrackerOptions) => BehaviorTracker;
|
|
51
|
-
//#endregion
|
|
52
|
-
export { BehaviorTracker, BehaviorTrackerContext, BehaviorTrackerOptions, TrackFeatureUsageInput, TrackFieldAccessInput, TrackWorkflowStepInput, createBehaviorTracker };
|
package/dist/types.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
//#region src/types.d.ts
|
|
2
|
-
type BehaviorEventType = 'field_access' | 'feature_usage' | 'workflow_step';
|
|
3
|
-
interface BehaviorEventBase {
|
|
4
|
-
id?: string;
|
|
5
|
-
tenantId: string;
|
|
6
|
-
userId?: string;
|
|
7
|
-
role?: string;
|
|
8
|
-
device?: string;
|
|
9
|
-
timestamp: number;
|
|
10
|
-
metadata?: Record<string, unknown>;
|
|
11
|
-
}
|
|
12
|
-
interface FieldAccessEvent extends BehaviorEventBase {
|
|
13
|
-
type: 'field_access';
|
|
14
|
-
operation: string;
|
|
15
|
-
field: string;
|
|
16
|
-
}
|
|
17
|
-
interface FeatureUsageEvent extends BehaviorEventBase {
|
|
18
|
-
type: 'feature_usage';
|
|
19
|
-
feature: string;
|
|
20
|
-
action: 'opened' | 'completed' | 'dismissed';
|
|
21
|
-
}
|
|
22
|
-
interface WorkflowStepEvent extends BehaviorEventBase {
|
|
23
|
-
type: 'workflow_step';
|
|
24
|
-
workflow: string;
|
|
25
|
-
step: string;
|
|
26
|
-
status: 'entered' | 'completed' | 'skipped' | 'errored';
|
|
27
|
-
}
|
|
28
|
-
type BehaviorEvent = FieldAccessEvent | FeatureUsageEvent | WorkflowStepEvent;
|
|
29
|
-
interface BehaviorQuery {
|
|
30
|
-
tenantId?: string;
|
|
31
|
-
userId?: string;
|
|
32
|
-
role?: string;
|
|
33
|
-
feature?: string;
|
|
34
|
-
operation?: string;
|
|
35
|
-
workflow?: string;
|
|
36
|
-
since?: number;
|
|
37
|
-
until?: number;
|
|
38
|
-
limit?: number;
|
|
39
|
-
}
|
|
40
|
-
interface BehaviorSummary {
|
|
41
|
-
fieldCounts: Record<string, number>;
|
|
42
|
-
featureCounts: Record<string, number>;
|
|
43
|
-
workflowStepCounts: Record<string, Record<string, number>>;
|
|
44
|
-
totalEvents: number;
|
|
45
|
-
}
|
|
46
|
-
interface BehaviorInsights {
|
|
47
|
-
unusedFields: string[];
|
|
48
|
-
frequentlyUsedFields: string[];
|
|
49
|
-
suggestedHiddenFields: string[];
|
|
50
|
-
workflowBottlenecks: {
|
|
51
|
-
workflow: string;
|
|
52
|
-
step: string;
|
|
53
|
-
dropRate: number;
|
|
54
|
-
}[];
|
|
55
|
-
layoutPreference?: 'form' | 'grid' | 'list' | 'table';
|
|
56
|
-
}
|
|
57
|
-
//#endregion
|
|
58
|
-
export { BehaviorEvent, BehaviorEventBase, BehaviorEventType, BehaviorInsights, BehaviorQuery, BehaviorSummary, FeatureUsageEvent, FieldAccessEvent, WorkflowStepEvent };
|