@tinkerlandai/indiana-sdk 0.1.0 → 0.3.0
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/CHANGELOG.md +20 -0
- package/README.md +63 -7
- package/THIRD_PARTY_NOTICES.md +27 -0
- package/dist/{ai-usage-DX99gvfl.d.ts → ai-usage-D_mBF5Gp.d.ts} +539 -80
- package/dist/chunk-D37O6FAW.js +11 -0
- package/dist/chunk-MJG7X7LM.js +17 -0
- package/dist/chunk-PTWRGCVW.js +1 -0
- package/dist/chunk-X5UXOLOU.js +1 -0
- package/dist/funnel-runtime-host-OVCJIQRT.js +1 -0
- package/dist/{funnel-runtime-start-CcuXliU_.d.ts → funnel-runtime-start-CQhy2kx1.d.ts} +2742 -1416
- package/dist/growth-rules-D64pEvg9.d.ts +166 -0
- package/dist/index.d.ts +3041 -2268
- package/dist/index.js +1 -1
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.d.ts +2 -2
- package/dist/openrouter.js +1 -1
- package/dist/page.d.ts +134 -0
- package/dist/page.js +4 -0
- package/dist/paywall-4JTI7QAB.js +1 -0
- package/dist/popup.d.ts +31 -4
- package/dist/popup.js +15 -4
- package/dist/server.d.ts +4 -3
- package/dist/server.js +1 -1
- package/dist/src-RZJKF6LQ.js +1 -0
- package/package.json +5 -1
- package/dist/chunk-2HEB2TPD.js +0 -1
- package/dist/chunk-FMAMDKAV.js +0 -27
- package/dist/chunk-Y7LNDG3O.js +0 -1
- package/dist/funnel-runtime-host-QIYKF5KH.js +0 -1
- package/dist/paywall-6HHA4OJV.js +0 -1
- package/dist/src-G7U7DUQR.js +0 -1
- package/dist/{screen-DfuSw6Tz.d.ts → screen-Keau_Qa2.d.ts} +1 -1
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/** A condition object: operator keys ($and, $or, …) or attribute paths. */
|
|
2
|
+
type ConditionInterface = {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
};
|
|
5
|
+
type ParentConditionInterface = {
|
|
6
|
+
id: string;
|
|
7
|
+
condition: ConditionInterface;
|
|
8
|
+
gate?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/** Current saved group representation. Lists always use their declared attribute. */
|
|
11
|
+
type SavedGroupPayloadEntry = {
|
|
12
|
+
type: "list";
|
|
13
|
+
attributeKey: string;
|
|
14
|
+
values: (string | number)[];
|
|
15
|
+
} | {
|
|
16
|
+
type: "hashed";
|
|
17
|
+
attributeKey: string;
|
|
18
|
+
values: string[];
|
|
19
|
+
} | {
|
|
20
|
+
type: "condition";
|
|
21
|
+
condition: ConditionInterface;
|
|
22
|
+
};
|
|
23
|
+
type SavedGroupsPayload = Record<string, SavedGroupPayloadEntry>;
|
|
24
|
+
type VariationRange = [number, number];
|
|
25
|
+
type VariationMeta = {
|
|
26
|
+
passthrough?: boolean;
|
|
27
|
+
key?: string;
|
|
28
|
+
name?: string;
|
|
29
|
+
};
|
|
30
|
+
interface Filter {
|
|
31
|
+
attribute?: string;
|
|
32
|
+
seed: string;
|
|
33
|
+
hashVersion: number;
|
|
34
|
+
ranges: VariationRange[];
|
|
35
|
+
}
|
|
36
|
+
type UrlTargetType = "regex" | "simple";
|
|
37
|
+
type UrlTarget = {
|
|
38
|
+
include: boolean;
|
|
39
|
+
type: UrlTargetType;
|
|
40
|
+
pattern: string;
|
|
41
|
+
};
|
|
42
|
+
type Experiment<T> = {
|
|
43
|
+
key: string;
|
|
44
|
+
variations: [T, T, ...T[]];
|
|
45
|
+
ranges?: VariationRange[];
|
|
46
|
+
meta?: VariationMeta[];
|
|
47
|
+
filters?: Filter[];
|
|
48
|
+
seed?: string;
|
|
49
|
+
name?: string;
|
|
50
|
+
phase?: string;
|
|
51
|
+
urlPatterns?: UrlTarget[];
|
|
52
|
+
weights?: number[];
|
|
53
|
+
condition?: ConditionInterface;
|
|
54
|
+
parentConditions?: ParentConditionInterface[];
|
|
55
|
+
coverage?: number;
|
|
56
|
+
include?: () => boolean;
|
|
57
|
+
force?: number;
|
|
58
|
+
hashAttribute?: string;
|
|
59
|
+
fallbackAttribute?: string;
|
|
60
|
+
hashVersion?: number;
|
|
61
|
+
disableStickyBucketing?: boolean;
|
|
62
|
+
bucketVersion?: number;
|
|
63
|
+
minBucketVersion?: number;
|
|
64
|
+
active?: boolean;
|
|
65
|
+
persistQueryString?: boolean;
|
|
66
|
+
};
|
|
67
|
+
interface Result<T> {
|
|
68
|
+
value: T;
|
|
69
|
+
variationId: number;
|
|
70
|
+
key: string;
|
|
71
|
+
name?: string;
|
|
72
|
+
bucket?: number;
|
|
73
|
+
passthrough?: boolean;
|
|
74
|
+
inExperiment: boolean;
|
|
75
|
+
hashUsed?: boolean;
|
|
76
|
+
hashAttribute: string;
|
|
77
|
+
hashValue: string;
|
|
78
|
+
featureId: string | null;
|
|
79
|
+
stickyBucketUsed?: boolean;
|
|
80
|
+
}
|
|
81
|
+
type FeatureRule<T = unknown> = {
|
|
82
|
+
id?: string;
|
|
83
|
+
condition?: ConditionInterface;
|
|
84
|
+
parentConditions?: ParentConditionInterface[];
|
|
85
|
+
force?: T;
|
|
86
|
+
variations?: T[];
|
|
87
|
+
weights?: number[];
|
|
88
|
+
key?: string;
|
|
89
|
+
hashAttribute?: string;
|
|
90
|
+
fallbackAttribute?: string;
|
|
91
|
+
hashVersion?: number;
|
|
92
|
+
disableStickyBucketing?: boolean;
|
|
93
|
+
bucketVersion?: number;
|
|
94
|
+
minBucketVersion?: number;
|
|
95
|
+
range?: VariationRange;
|
|
96
|
+
coverage?: number;
|
|
97
|
+
ranges?: VariationRange[];
|
|
98
|
+
meta?: VariationMeta[];
|
|
99
|
+
filters?: Filter[];
|
|
100
|
+
seed?: string;
|
|
101
|
+
name?: string;
|
|
102
|
+
phase?: string;
|
|
103
|
+
tracks?: Array<{
|
|
104
|
+
experiment: Experiment<T>;
|
|
105
|
+
result: Result<T>;
|
|
106
|
+
}>;
|
|
107
|
+
};
|
|
108
|
+
interface FeatureDefinition<T = unknown> {
|
|
109
|
+
defaultValue?: T;
|
|
110
|
+
rules?: FeatureRule<T>[];
|
|
111
|
+
}
|
|
112
|
+
type FeatureResultSource = "unknownFeature" | "defaultValue" | "force" | "override" | "experiment" | "prerequisite" | "cyclicPrerequisite";
|
|
113
|
+
interface FeatureResult<T = unknown> {
|
|
114
|
+
value: T | null;
|
|
115
|
+
source: FeatureResultSource;
|
|
116
|
+
on: boolean;
|
|
117
|
+
off: boolean;
|
|
118
|
+
ruleId: string;
|
|
119
|
+
experiment?: Experiment<T>;
|
|
120
|
+
experimentResult?: Result<T>;
|
|
121
|
+
}
|
|
122
|
+
/** `${attributeName}||${attributeValue}` */
|
|
123
|
+
type StickyAttributeKey = string;
|
|
124
|
+
/** `${experimentKey}__${bucketVersion}` */
|
|
125
|
+
type StickyExperimentKey = string;
|
|
126
|
+
type StickyAssignments = Record<StickyExperimentKey, string>;
|
|
127
|
+
interface StickyAssignmentsDocument {
|
|
128
|
+
attributeName: string;
|
|
129
|
+
attributeValue: string;
|
|
130
|
+
assignments: StickyAssignments;
|
|
131
|
+
}
|
|
132
|
+
type Attributes = Record<string, unknown>;
|
|
133
|
+
/**
|
|
134
|
+
* Everything one evaluation needs. Replaces the GrowthBook class plus its
|
|
135
|
+
* global/user context split; fields keep the upstream names and meaning.
|
|
136
|
+
*/
|
|
137
|
+
type EvaluationContext = {
|
|
138
|
+
attributes?: Attributes;
|
|
139
|
+
attributeOverrides?: Attributes;
|
|
140
|
+
url?: string;
|
|
141
|
+
enabled?: boolean;
|
|
142
|
+
qaMode?: boolean;
|
|
143
|
+
features?: Record<string, FeatureDefinition>;
|
|
144
|
+
savedGroups?: SavedGroupsPayload;
|
|
145
|
+
forcedVariations?: Record<string, number>;
|
|
146
|
+
forcedFeatureValues?: Map<string, unknown>;
|
|
147
|
+
/** Sticky docs already loaded for this user; updated in place on assignment. */
|
|
148
|
+
stickyBucketAssignmentDocs?: Record<StickyAttributeKey, StickyAssignmentsDocument>;
|
|
149
|
+
/** Enables sticky bucketing; receives each changed document. */
|
|
150
|
+
saveStickyBucketAssignmentDoc?: (doc: StickyAssignmentsDocument) => unknown;
|
|
151
|
+
/** Dedupes onExperimentViewed per hash value, experiment and variation. */
|
|
152
|
+
trackedExperiments?: Set<string>;
|
|
153
|
+
/** Dedupes onFeatureUsage per feature value. */
|
|
154
|
+
trackedFeatureUsage?: Record<string, string>;
|
|
155
|
+
onExperimentViewed?: (experiment: Experiment<unknown>, result: Result<unknown>) => unknown;
|
|
156
|
+
onFeatureUsage?: (key: string, result: FeatureResult<unknown>) => unknown;
|
|
157
|
+
onExperimentEval?: (experiment: Experiment<unknown>, result: Result<unknown>) => void;
|
|
158
|
+
/** Receives the same diagnostic messages the upstream SDK logs. */
|
|
159
|
+
log?: (message: string, details: Record<string, unknown>) => void;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
163
|
+
[key: string]: JsonValue;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export type { EvaluationContext as E, FeatureResult as F, JsonValue as J, Result as R };
|