@happyvertical/smrt-analytics 0.51.31 → 0.51.33
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 +17 -0
- package/dist/__tests__/helpers/index.d.ts +6 -0
- package/dist/__tests__/helpers/index.d.ts.map +1 -0
- package/dist/__tests__/helpers/test-db.d.ts +49 -0
- package/dist/__tests__/helpers/test-db.d.ts.map +1 -0
- package/dist/collections/AnalyticsDataStreamCollection.d.ts +4 -0
- package/dist/collections/AnalyticsEventCollection.d.ts +5 -1
- package/dist/collections/AnalyticsPropertyCollection.d.ts +4 -0
- package/dist/collections/AnalyticsReportCollection.d.ts +4 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +42 -6
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/models/AnalyticsDataStream.d.ts +5 -1
- package/dist/models/AnalyticsEvent.d.ts +5 -1
- package/dist/models/AnalyticsProperty.d.ts +5 -1
- package/dist/models/AnalyticsReport.d.ts +19 -6
- package/dist/models/AnalyticsReport.d.ts.map +1 -1
- package/dist/prompts.d.ts +48 -4
- package/dist/smrt-knowledge.json +4 -4
- package/dist/ui.d.ts +14 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -73,6 +73,23 @@ const insights = await report.analyzeResults();
|
|
|
73
73
|
const trending = await report.hasPositiveTrends();
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
+
`hasPositiveTrends()` keeps that boolean API. When `decisions: { type:
|
|
77
|
+
'typesafe' }` is configured and no AI tools are registered, it sends the
|
|
78
|
+
resolved report prompt plus only the selected metrics and persisted aggregate
|
|
79
|
+
rows to the typed-decision route. Its threshold defaults to `0.5`; a configured
|
|
80
|
+
uncertainty band uses the same resolved prompt on the generative route, matching
|
|
81
|
+
the framework's decision fallback behavior. The route treats higher
|
|
82
|
+
user-growth, engagement, and conversion values as favorable, and higher bounce
|
|
83
|
+
or error rates as adverse. Unknown metric directions, incomplete comparison
|
|
84
|
+
periods, and insufficient or ambiguous data are not inferred as positive.
|
|
85
|
+
Configured decision failures propagate. Without a decision provider, the
|
|
86
|
+
existing prompt-driven `yes`/`no` behavior remains in use. `resultData` retains
|
|
87
|
+
the documented caller-managed PII limitation in either route.
|
|
88
|
+
|
|
89
|
+
The framework website's analytics guide should add a worked decision-provider
|
|
90
|
+
configuration example; this package README documents the runtime contract until
|
|
91
|
+
that guide is updated.
|
|
92
|
+
|
|
76
93
|
### Server-Side Event Lifecycle
|
|
77
94
|
|
|
78
95
|
Events track their delivery status with built-in retry support:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/__tests__/helpers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test database utilities for multi-adapter testing
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
import { type DatabaseInterface } from '@happyvertical/sql';
|
|
6
|
+
export type TestAdapter = 'sqlite' | 'postgres' | 'json';
|
|
7
|
+
export interface TestDbConfig {
|
|
8
|
+
type: 'sqlite' | 'postgres' | 'json';
|
|
9
|
+
url: string;
|
|
10
|
+
writeStrategy?: 'immediate';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get the current test adapter from environment
|
|
14
|
+
*/
|
|
15
|
+
export declare function getTestAdapter(): TestAdapter;
|
|
16
|
+
/**
|
|
17
|
+
* Get database configuration for the current test adapter
|
|
18
|
+
*/
|
|
19
|
+
export declare function getTestDbConfig(): TestDbConfig;
|
|
20
|
+
/**
|
|
21
|
+
* Create a database instance for the current test adapter
|
|
22
|
+
*/
|
|
23
|
+
export declare function createTestDb(): Promise<{
|
|
24
|
+
db: DatabaseInterface;
|
|
25
|
+
config: TestDbConfig;
|
|
26
|
+
cleanup: () => Promise<void>;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Deterministic UUID for a readable fixture label. Property ids are native
|
|
30
|
+
* UUID columns on PostgreSQL, so a literal such as `'prop-123'` is rejected
|
|
31
|
+
* there (22P02) while SQLite's text ids accept it; routing every fixture id
|
|
32
|
+
* through this keeps the same readable label valid on all three adapters.
|
|
33
|
+
*/
|
|
34
|
+
export declare function fixtureId(label: string): string;
|
|
35
|
+
/** Seed explicit real parents for collection fixtures that exercise child rows. */
|
|
36
|
+
export declare function seedAnalyticsProperties(db: DatabaseInterface, ids: readonly string[]): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Check if PostgreSQL is available (cached)
|
|
39
|
+
*/
|
|
40
|
+
export declare function isPostgresAvailable(): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Get display name for current adapter (for test descriptions)
|
|
43
|
+
*/
|
|
44
|
+
export declare function getAdapterDisplayName(): string;
|
|
45
|
+
/**
|
|
46
|
+
* Check if current test run is for a specific adapter
|
|
47
|
+
*/
|
|
48
|
+
export declare function isAdapter(adapter: TestAdapter): boolean;
|
|
49
|
+
//# sourceMappingURL=test-db.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-db.d.ts","sourceRoot":"","sources":["../../../src/__tests__/helpers/test-db.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,KAAK,iBAAiB,EAAe,MAAM,oBAAoB,CAAC;AAGzE,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,WAAW,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAE5C;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,YAAY,CA8B9C;AAED;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC;IAC5C,EAAE,EAAE,iBAAiB,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC,CAqFD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAW/C;AAED,mFAAmF;AACnF,wBAAsB,uBAAuB,CAC3C,EAAE,EAAE,iBAAiB,EACrB,GAAG,EAAE,SAAS,MAAM,EAAE,GACrB,OAAO,CAAC,IAAI,CAAC,CAUf;AAKD;;GAEG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,CAsB5D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAY9C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAEvD"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AnalyticsDataStreamCollection - Collection manager for AnalyticsDataStream objects
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
1
5
|
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
2
6
|
import { AnalyticsDataStream } from '../models/AnalyticsDataStream.js';
|
|
3
7
|
import { DataStreamStatus, DataStreamType } from '../types/index.js';
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AnalyticsEventCollection - Collection manager for AnalyticsEvent objects
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
1
5
|
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
2
6
|
import { AnalyticsEvent } from '../models/AnalyticsEvent.js';
|
|
3
|
-
import { PropertyStatsWithTrend, TrackingEventStatus } from '../types/index.js';
|
|
7
|
+
import { type PropertyStatsWithTrend, TrackingEventStatus } from '../types/index.js';
|
|
4
8
|
export declare class AnalyticsEventCollection extends SmrtCollection<AnalyticsEvent> {
|
|
5
9
|
static readonly _itemClass: typeof AnalyticsEvent;
|
|
6
10
|
/**
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AnalyticsPropertyCollection - Collection manager for AnalyticsProperty objects
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
1
5
|
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
2
6
|
import { AnalyticsProperty } from '../models/AnalyticsProperty.js';
|
|
3
7
|
import { AnalyticsPropertyStatus, AnalyticsProvider } from '../types/index.js';
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AnalyticsReportCollection - Collection manager for AnalyticsReport objects
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
1
5
|
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
2
6
|
import { AnalyticsReport } from '../models/AnalyticsReport.js';
|
|
3
7
|
import { ReportFrequency, ReportStatus } from '../types/index.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @happyvertical/smrt-analytics
|
|
3
|
+
*
|
|
4
|
+
* Analytics integration models for SMRT framework.
|
|
5
|
+
* Provides SMRT-wrapped models for managing analytics properties, data streams,
|
|
6
|
+
* reports, and event tracking with integration to @happyvertical/analytics SDK.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import './__smrt-register__.js';
|
|
11
|
+
import './prompts.js';
|
|
1
12
|
export { AnalyticsDataStreamCollection, AnalyticsEventCollection, AnalyticsPropertyCollection, AnalyticsReportCollection, } from './collections/index.js';
|
|
2
13
|
export { AnalyticsDataStream, AnalyticsEvent, AnalyticsProperty, AnalyticsReport, } from './models/index.js';
|
|
3
14
|
export { promptMessageOptions, smrtAnalyticsAnalyzePerformancePrompt, smrtAnalyticsAnalyzeResultsPrompt, smrtAnalyticsHasPositiveTrendsPrompt, } from './prompts.js';
|