@vllnt/convex-experiments 0.1.0-canary.73e1118 → 0.1.0-canary.f2cd1ba
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 +4 -11
- package/dist/client/index.d.ts +3 -54
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +4 -53
- package/dist/client/index.js.map +1 -1
- package/dist/client/types.d.ts +3 -8
- package/dist/client/types.d.ts.map +1 -1
- package/dist/component/_generated/component.d.ts +0 -35
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/mutations.d.ts +13 -39
- package/dist/component/mutations.d.ts.map +1 -1
- package/dist/component/mutations.js +20 -183
- package/dist/component/mutations.js.map +1 -1
- package/dist/component/queries.d.ts +4 -37
- package/dist/component/queries.d.ts.map +1 -1
- package/dist/component/queries.js +19 -81
- package/dist/component/queries.js.map +1 -1
- package/dist/component/schema.d.ts +3 -25
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/schema.js +4 -19
- package/dist/component/schema.js.map +1 -1
- package/dist/component/validators.d.ts +4 -17
- package/dist/component/validators.d.ts.map +1 -1
- package/dist/component/validators.js +3 -14
- package/dist/component/validators.js.map +1 -1
- package/dist/shared.d.ts +3 -5
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +3 -5
- package/dist/shared.js.map +1 -1
- package/package.json +1 -1
- package/src/client/index.ts +4 -98
- package/src/client/types.ts +3 -8
- package/src/component/_generated/component.ts +1 -42
- package/src/component/mutations.ts +20 -210
- package/src/component/queries.ts +18 -95
- package/src/component/schema.ts +4 -20
- package/src/component/validators.ts +3 -14
- package/src/shared.ts +3 -6
package/README.md
CHANGED
|
@@ -31,12 +31,9 @@ component handles assignment and exposure. Domain-neutral: any subject, any surf
|
|
|
31
31
|
- **Deterministic + sticky** — the same subject always lands in the same weighted variant, even before anything is stored.
|
|
32
32
|
- **Weighted variants** — split traffic by relative weights (`1:1`, `90:10`, N-way); equal weights split evenly.
|
|
33
33
|
- **Enrollment lifecycle** — `draft → running → stopped`; only `running` enrolls, and stopping preserves recorded data.
|
|
34
|
-
- **Deduped exposures
|
|
35
|
-
- **
|
|
36
|
-
-
|
|
37
|
-
- **Immutable once assigned** — `variants`/`salt` are fixed after enrollment (changing them throws); define a new key to re-randomize.
|
|
38
|
-
- **Lifecycle + GDPR** — `listExperiments` to discover, `forgetSubject` to erase one subject, `deleteExperiment` to cascade-delete.
|
|
39
|
-
- **Scopes** — global by default, or namespace per tenant / surface (folded into the hash for independent bucketing).
|
|
34
|
+
- **Deduped exposures** — one tallied row per subject; `results` reports distinct subjects and total exposures per variant.
|
|
35
|
+
- **Salted re-runs** — change `salt` to reshuffle buckets without changing subject ids.
|
|
36
|
+
- **Scopes** — global by default, or namespace per tenant / surface.
|
|
40
37
|
- **Fully typed** — variant keys, weights, and outcomes are concrete types end to end; no `any`.
|
|
41
38
|
- **Server-sourced time** — assignment timestamps come from the server, never the caller.
|
|
42
39
|
|
|
@@ -90,13 +87,9 @@ host-side conversion recorder.
|
|
|
90
87
|
| `setStatus(ctx, key, status, scope?)` | mutation | `boolean` |
|
|
91
88
|
| `assign(ctx, key, subjectRef, scope?)` | mutation | `{ variant: null } \| { variant: string; isNew: boolean }` |
|
|
92
89
|
| `logExposure(ctx, key, subjectRef, scope?)` | mutation | `{ variant: string \| null }` |
|
|
93
|
-
| `forgetSubject(ctx, key, subjectRef, scope?)` | mutation | `boolean` (GDPR erasure) |
|
|
94
|
-
| `deleteExperiment(ctx, key, { scope?, batch? })` | mutation | `number` (cascade delete) |
|
|
95
90
|
| `getExperiment(ctx, key, scope?)` | query | `ExperimentDefinition \| null` |
|
|
96
|
-
| `listExperiments(ctx, { scope?, status? })` | query | `ExperimentDefinition[]` |
|
|
97
91
|
| `getAssignment(ctx, key, subjectRef, scope?)` | query | `{ variant, assignedAt } \| null` |
|
|
98
|
-
| `
|
|
99
|
-
| `results(ctx, key, scope?)` | query | `{ variant, assigned, subjects, exposures, weight }[]` |
|
|
92
|
+
| `results(ctx, key, scope?)` | query | `{ variant, subjects, exposures }[]` |
|
|
100
93
|
|
|
101
94
|
Full reference: [docs/API.md](docs/API.md).
|
|
102
95
|
|
package/dist/client/index.d.ts
CHANGED
|
@@ -31,36 +31,17 @@ export interface ExperimentsComponent {
|
|
|
31
31
|
key: string;
|
|
32
32
|
subjectRef: string;
|
|
33
33
|
}, ExposureOutcome>;
|
|
34
|
-
forgetSubject: FunctionReference<"mutation", "internal", {
|
|
35
|
-
scope: string;
|
|
36
|
-
key: string;
|
|
37
|
-
subjectRef: string;
|
|
38
|
-
}, boolean>;
|
|
39
|
-
deleteExperiment: FunctionReference<"mutation", "internal", {
|
|
40
|
-
scope: string;
|
|
41
|
-
key: string;
|
|
42
|
-
batch: number;
|
|
43
|
-
}, number>;
|
|
44
34
|
};
|
|
45
35
|
queries: {
|
|
46
36
|
getExperiment: FunctionReference<"query", "internal", {
|
|
47
37
|
scope: string;
|
|
48
38
|
key: string;
|
|
49
39
|
}, ExperimentDefinition | null>;
|
|
50
|
-
listExperiments: FunctionReference<"query", "internal", {
|
|
51
|
-
scope: string;
|
|
52
|
-
status?: ExperimentStatus;
|
|
53
|
-
}, ExperimentDefinition[]>;
|
|
54
40
|
getAssignment: FunctionReference<"query", "internal", {
|
|
55
41
|
scope: string;
|
|
56
42
|
key: string;
|
|
57
43
|
subjectRef: string;
|
|
58
44
|
}, Assignment | null>;
|
|
59
|
-
peek: FunctionReference<"query", "internal", {
|
|
60
|
-
scope: string;
|
|
61
|
-
key: string;
|
|
62
|
-
subjectRef: string;
|
|
63
|
-
}, ExposureOutcome>;
|
|
64
45
|
results: FunctionReference<"query", "internal", {
|
|
65
46
|
scope: string;
|
|
66
47
|
key: string;
|
|
@@ -103,9 +84,8 @@ export declare class Experiments {
|
|
|
103
84
|
/**
|
|
104
85
|
* Create or update an experiment. `variants` are weighted (equal weights split
|
|
105
86
|
* evenly). `salt` defaults to `key`; `status` to the client default (`running`).
|
|
106
|
-
* Returns `{ created }` — `false` when an existing definition was updated.
|
|
107
|
-
*
|
|
108
|
-
* is assigned (throws `EXPERIMENT_LOCKED`).
|
|
87
|
+
* Returns `{ created }` — `false` when an existing definition was updated.
|
|
88
|
+
* Updating never disturbs existing sticky assignments.
|
|
109
89
|
*/
|
|
110
90
|
define(ctx: RunMutationCtx, key: string, opts: DefineOptions & {
|
|
111
91
|
variants: Variant[];
|
|
@@ -130,39 +110,8 @@ export declare class Experiments {
|
|
|
130
110
|
getExperiment(ctx: RunQueryCtx, key: string, scope?: string): Promise<ExperimentDefinition | null>;
|
|
131
111
|
/** A subject's sticky assignment, or `null` if not enrolled. */
|
|
132
112
|
getAssignment(ctx: RunQueryCtx, key: string, subjectRef: string, scope?: string): Promise<Assignment | null>;
|
|
133
|
-
/**
|
|
134
|
-
* Read-only deterministic variant for a subject — the sticky variant **without
|
|
135
|
-
* persisting**. Returns the stored assignment if present, else the deterministic
|
|
136
|
-
* pick; `null` when not enrolled. Use for SSR / a flicker-free first paint, then
|
|
137
|
-
* call `logExposure` to enroll + tally.
|
|
138
|
-
*/
|
|
139
|
-
peek(ctx: RunQueryCtx, key: string, subjectRef: string, scope?: string): Promise<ExposureOutcome>;
|
|
140
|
-
/** Every experiment in a scope, optionally filtered by `status`. */
|
|
141
|
-
listExperiments(ctx: RunQueryCtx, opts?: {
|
|
142
|
-
scope?: string;
|
|
143
|
-
status?: ExperimentStatus;
|
|
144
|
-
}): Promise<ExperimentDefinition[]>;
|
|
145
|
-
/**
|
|
146
|
-
* Per-variant tallies — `assigned`, distinct `subjects` exposed, total
|
|
147
|
-
* `exposures`, and the configured `weight` (for sample-ratio-mismatch). Reads
|
|
148
|
-
* O(variants), not the exposure table.
|
|
149
|
-
*/
|
|
113
|
+
/** Per-variant exposure tallies (distinct subjects + total exposures). */
|
|
150
114
|
results(ctx: RunQueryCtx, key: string, scope?: string): Promise<VariantResult[]>;
|
|
151
|
-
/**
|
|
152
|
-
* Erase a subject's assignment + exposure in one experiment (GDPR right-to-
|
|
153
|
-
* erasure), decrementing tallies. Returns `true` if anything was deleted. Loop
|
|
154
|
-
* over `listExperiments` to erase a subject across a whole scope.
|
|
155
|
-
*/
|
|
156
|
-
forgetSubject(ctx: RunMutationCtx, key: string, subjectRef: string, scope?: string): Promise<boolean>;
|
|
157
|
-
/**
|
|
158
|
-
* Delete an experiment and all of its data (definition, assignments, exposures,
|
|
159
|
-
* tallies). Bounded + self-rescheduling; returns the rows removed this pass.
|
|
160
|
-
* Idempotent and safe on an absent experiment.
|
|
161
|
-
*/
|
|
162
|
-
deleteExperiment(ctx: RunMutationCtx, key: string, opts?: {
|
|
163
|
-
scope?: string;
|
|
164
|
-
batch?: number;
|
|
165
|
-
}): Promise<number>;
|
|
166
115
|
}
|
|
167
116
|
export type { Assignment, AssignOutcome, DefineOptions, ExperimentDefinition, ExperimentsOptions, ExperimentStatus, ExposureOutcome, Variant, VariantResult, };
|
|
168
117
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,OAAO,EACP,aAAa,EACd,MAAM,YAAY,CAAC;AAGpB;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE;QACT,MAAM,EAAE,iBAAiB,CACvB,UAAU,EACV,UAAU,EACV;YACE,KAAK,EAAE,MAAM,CAAC;YACd,GAAG,EAAE,MAAM,CAAC;YACZ,QAAQ,EAAE,OAAO,EAAE,CAAC;YACpB,IAAI,EAAE,MAAM,CAAC;YACb,MAAM,EAAE,gBAAgB,CAAC;SAC1B,EACD;YAAE,OAAO,EAAE,OAAO,CAAA;SAAE,CACrB,CAAC;QACF,SAAS,EAAE,iBAAiB,CAC1B,UAAU,EACV,UAAU,EACV;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,gBAAgB,CAAA;SAAE,EACxD,OAAO,CACR,CAAC;QACF,MAAM,EAAE,iBAAiB,CACvB,UAAU,EACV,UAAU,EACV;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,EAClD,aAAa,CACd,CAAC;QACF,WAAW,EAAE,iBAAiB,CAC5B,UAAU,EACV,UAAU,EACV;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,EAClD,eAAe,CAChB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,OAAO,EACP,aAAa,EACd,MAAM,YAAY,CAAC;AAGpB;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE;QACT,MAAM,EAAE,iBAAiB,CACvB,UAAU,EACV,UAAU,EACV;YACE,KAAK,EAAE,MAAM,CAAC;YACd,GAAG,EAAE,MAAM,CAAC;YACZ,QAAQ,EAAE,OAAO,EAAE,CAAC;YACpB,IAAI,EAAE,MAAM,CAAC;YACb,MAAM,EAAE,gBAAgB,CAAC;SAC1B,EACD;YAAE,OAAO,EAAE,OAAO,CAAA;SAAE,CACrB,CAAC;QACF,SAAS,EAAE,iBAAiB,CAC1B,UAAU,EACV,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E,MAAM,EACX,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAOvC,gEAAgE;IAChE,aAAa,CACX,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAQ7B,0EAA0E;IAC1E,OAAO,CACL,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,aAAa,EAAE,CAAC;CAM5B;AAED,YAAY,EACV,UAAU,EACV,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,OAAO,EACP,aAAa,GACd,CAAC"}
|
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DEFAULT_SCOPE, DEFAULT_STATUS } from "../shared.js";
|
|
2
2
|
/**
|
|
3
3
|
* Consumer-facing client for deterministic A/B experimentation. The host owns
|
|
4
4
|
* meaning and auth; it passes an opaque `subjectRef` and variant keys, and the
|
|
@@ -35,9 +35,8 @@ export class Experiments {
|
|
|
35
35
|
/**
|
|
36
36
|
* Create or update an experiment. `variants` are weighted (equal weights split
|
|
37
37
|
* evenly). `salt` defaults to `key`; `status` to the client default (`running`).
|
|
38
|
-
* Returns `{ created }` — `false` when an existing definition was updated.
|
|
39
|
-
*
|
|
40
|
-
* is assigned (throws `EXPERIMENT_LOCKED`).
|
|
38
|
+
* Returns `{ created }` — `false` when an existing definition was updated.
|
|
39
|
+
* Updating never disturbs existing sticky assignments.
|
|
41
40
|
*/
|
|
42
41
|
define(ctx, key, opts) {
|
|
43
42
|
return ctx.runMutation(this.component.mutations.define, {
|
|
@@ -95,60 +94,12 @@ export class Experiments {
|
|
|
95
94
|
subjectRef,
|
|
96
95
|
});
|
|
97
96
|
}
|
|
98
|
-
/**
|
|
99
|
-
* Read-only deterministic variant for a subject — the sticky variant **without
|
|
100
|
-
* persisting**. Returns the stored assignment if present, else the deterministic
|
|
101
|
-
* pick; `null` when not enrolled. Use for SSR / a flicker-free first paint, then
|
|
102
|
-
* call `logExposure` to enroll + tally.
|
|
103
|
-
*/
|
|
104
|
-
peek(ctx, key, subjectRef, scope) {
|
|
105
|
-
return ctx.runQuery(this.component.queries.peek, {
|
|
106
|
-
scope: this.scopeOf(scope),
|
|
107
|
-
key,
|
|
108
|
-
subjectRef,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
/** Every experiment in a scope, optionally filtered by `status`. */
|
|
112
|
-
listExperiments(ctx, opts = {}) {
|
|
113
|
-
return ctx.runQuery(this.component.queries.listExperiments, {
|
|
114
|
-
scope: this.scopeOf(opts.scope),
|
|
115
|
-
status: opts.status,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Per-variant tallies — `assigned`, distinct `subjects` exposed, total
|
|
120
|
-
* `exposures`, and the configured `weight` (for sample-ratio-mismatch). Reads
|
|
121
|
-
* O(variants), not the exposure table.
|
|
122
|
-
*/
|
|
97
|
+
/** Per-variant exposure tallies (distinct subjects + total exposures). */
|
|
123
98
|
results(ctx, key, scope) {
|
|
124
99
|
return ctx.runQuery(this.component.queries.results, {
|
|
125
100
|
scope: this.scopeOf(scope),
|
|
126
101
|
key,
|
|
127
102
|
});
|
|
128
103
|
}
|
|
129
|
-
/**
|
|
130
|
-
* Erase a subject's assignment + exposure in one experiment (GDPR right-to-
|
|
131
|
-
* erasure), decrementing tallies. Returns `true` if anything was deleted. Loop
|
|
132
|
-
* over `listExperiments` to erase a subject across a whole scope.
|
|
133
|
-
*/
|
|
134
|
-
forgetSubject(ctx, key, subjectRef, scope) {
|
|
135
|
-
return ctx.runMutation(this.component.mutations.forgetSubject, {
|
|
136
|
-
scope: this.scopeOf(scope),
|
|
137
|
-
key,
|
|
138
|
-
subjectRef,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Delete an experiment and all of its data (definition, assignments, exposures,
|
|
143
|
-
* tallies). Bounded + self-rescheduling; returns the rows removed this pass.
|
|
144
|
-
* Idempotent and safe on an absent experiment.
|
|
145
|
-
*/
|
|
146
|
-
deleteExperiment(ctx, key, opts = {}) {
|
|
147
|
-
return ctx.runMutation(this.component.mutations.deleteExperiment, {
|
|
148
|
-
scope: this.scopeOf(opts.scope),
|
|
149
|
-
key,
|
|
150
|
-
batch: opts.batch ?? DEFAULT_DELETE_BATCH,
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
104
|
}
|
|
154
105
|
//# sourceMappingURL=index.js.map
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA4E7D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,WAAW;IAKH;IAJF,YAAY,CAAS;IACrB,aAAa,CAAmB;IAEjD,YACmB,SAA+B,EAChD,UAA8B,EAAE;QADf,cAAS,GAAT,SAAS,CAAsB;QAGhD,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,aAAa,CAAC;QAC1D,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,IAAK,cAA4B,CAAC;IAC9E,CAAC;IAEO,OAAO,CAAC,KAAyB;QACvC,OAAO,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC;IACpC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CACJ,GAAmB,EACnB,GAAW,EACX,IAA6C;QAE7C,OAAO,GAAG,CAAC,WAAW,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AAC,aAAa,EAAE;YACxD,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YAC1B,GAAG;SACJ,CAAC,CAAC;IACL,CAAC;IAED,gEAAgE;IAChE,aAAa,CACX,GAAgB,EAChB,GAAW,EACX,UAAkB,EAClB,KAAc;QAEd,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE;YACxD,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YAC1B,GAAG;YACH,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAED,0EAA0E;IAC1E,OAAO,CACL,GAAgB,EAChB,GAAW,EACX,KAAc;QAEd,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE;YAClD,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YAC1B,GAAG;SACJ,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/client/types.d.ts
CHANGED
|
@@ -20,9 +20,8 @@ export interface DefineOptions {
|
|
|
20
20
|
/** Namespace for this experiment. Defaults to the client `defaultScope`. */
|
|
21
21
|
scope?: string;
|
|
22
22
|
/**
|
|
23
|
-
* Hash salt for deterministic assignment. Defaults to the experiment `key
|
|
24
|
-
*
|
|
25
|
-
* `EXPERIMENT_LOCKED`); to re-randomize, define a new experiment key.
|
|
23
|
+
* Hash salt for deterministic assignment. Defaults to the experiment `key`;
|
|
24
|
+
* change it to re-randomize buckets without changing subject ids.
|
|
26
25
|
*/
|
|
27
26
|
salt?: string;
|
|
28
27
|
/** Initial lifecycle status. Defaults to the client `defaultStatus`. */
|
|
@@ -59,17 +58,13 @@ export type AssignOutcome = {
|
|
|
59
58
|
export type ExposureOutcome = {
|
|
60
59
|
variant: string | null;
|
|
61
60
|
};
|
|
62
|
-
/** A per-variant tally, as returned by {@link Experiments.results}. */
|
|
61
|
+
/** A per-variant exposure tally, as returned by {@link Experiments.results}. */
|
|
63
62
|
export interface VariantResult {
|
|
64
63
|
/** The variant key. */
|
|
65
64
|
variant: string;
|
|
66
|
-
/** Subjects assigned to this variant (the realized split, for SRM). */
|
|
67
|
-
assigned: number;
|
|
68
65
|
/** Distinct subjects exposed to this variant (the funnel denominator). */
|
|
69
66
|
subjects: number;
|
|
70
67
|
/** Total exposure events recorded for this variant. */
|
|
71
68
|
exposures: number;
|
|
72
|
-
/** The configured weight from the current definition (0 if the variant is gone). */
|
|
73
|
-
weight: number;
|
|
74
69
|
}
|
|
75
70
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,oFAAoF;AACpF,MAAM,WAAW,OAAO;IACtB,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,uFAAuF;AACvF,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAE/D,+DAA+D;AAC/D,MAAM,WAAW,kBAAkB;IACjC,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kFAAkF;IAClF,aAAa,CAAC,EAAE,gBAAgB,CAAC;CAClC;AAED,yDAAyD;AACzD,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,oFAAoF;AACpF,MAAM,WAAW,OAAO;IACtB,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,uFAAuF;AACvF,MAAM,MAAM,gBAAgB,GAAG,O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extends string | undefined = string | undefined> =
|
|
|
42
42
|
}, {
|
|
43
43
|
created: boolean;
|
|
44
44
|
}, Name>;
|
|
45
|
-
deleteExperiment: FunctionReference<"mutation", "internal", {
|
|
46
|
-
batch: number;
|
|
47
|
-
key: string;
|
|
48
|
-
scope: string;
|
|
49
|
-
}, number, Name>;
|
|
50
|
-
forgetSubject: FunctionReference<"mutation", "internal", {
|
|
51
|
-
key: string;
|
|
52
|
-
scope: string;
|
|
53
|
-
subjectRef: string;
|
|
54
|
-
}, boolean, Name>;
|
|
55
45
|
logExposure: FunctionReference<"mutation", "internal", {
|
|
56
46
|
key: string;
|
|
57
47
|
scope: string;
|
|
@@ -90,38 +80,13 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
90
80
|
weight: number;
|
|
91
81
|
}>;
|
|
92
82
|
}, Name>;
|
|
93
|
-
listExperiments: FunctionReference<"query", "internal", {
|
|
94
|
-
scope: string;
|
|
95
|
-
status?: "draft" | "running" | "stopped";
|
|
96
|
-
}, Array<{
|
|
97
|
-
createdAt: number;
|
|
98
|
-
key: string;
|
|
99
|
-
salt: string;
|
|
100
|
-
scope: string;
|
|
101
|
-
status: "draft" | "running" | "stopped";
|
|
102
|
-
variants: Array<{
|
|
103
|
-
key: string;
|
|
104
|
-
weight: number;
|
|
105
|
-
}>;
|
|
106
|
-
}>, Name>;
|
|
107
|
-
peek: FunctionReference<"query", "internal", {
|
|
108
|
-
key: string;
|
|
109
|
-
scope: string;
|
|
110
|
-
subjectRef: string;
|
|
111
|
-
}, {
|
|
112
|
-
variant: null;
|
|
113
|
-
} | {
|
|
114
|
-
variant: string;
|
|
115
|
-
}, Name>;
|
|
116
83
|
results: FunctionReference<"query", "internal", {
|
|
117
84
|
key: string;
|
|
118
85
|
scope: string;
|
|
119
86
|
}, Array<{
|
|
120
|
-
assigned: number;
|
|
121
87
|
exposures: number;
|
|
122
88
|
subjects: number;
|
|
123
89
|
variant: string;
|
|
124
|
-
weight: number;
|
|
125
90
|
}>, Name>;
|
|
126
91
|
};
|
|
127
92
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAC3E;IACE,SAAS,EAAE;QACT,MAAM,EAAE,iBAAiB,CACvB,UAAU,EACV,UAAU,EACV;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,EAClD;YAAE,OAAO,EAAE,IAAI,CAAA;SAAE,GAAG;YAAE,KAAK,EAAE,OAAO,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,EACvD,IAAI,CACL,CAAC;QACF,MAAM,EAAE,iBAAiB,CACvB,UAAU,EACV,UAAU,EACV;YACE,GAAG,EAAE,MAAM,CAAC;YACZ,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;YACxC,QAAQ,EAAE,KAAK,CAAC;gBAAE,GAAG,EAAE,MAAM,CAAC;gBAAC,MAAM,EAAE,MAAM,CAAA;aAAE,CAAC,CAAC;SAClD,EACD;YAAE,OAAO,EAAE,OAAO,CAAA;SAAE,EACpB,IAAI,CACL,CAAC;QACF,
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,IAAI,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aAAa,EAAE,iBAAiB,CAC9B,OAAO,EACP,UAAU,EACV;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,EAClD,IAAI,GAAG;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,EAC9C,IAAI,CACL,CAAC;QACF,aAAa,EAAE,iBAAiB,CAC9B,OAAO,EACP,UAAU,EACV;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAC9B,IAAI,GAAG;YACL,SAAS,EAAE,MAAM,CAAC;YAClB,GAAG,EAAE,MAAM,CAAC;YACZ,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;YACxC,QAAQ,EAAE,KAAK,CAAC;gBAAE,GAAG,EAAE,MAAM,CAAC;gBAAC,MAAM,EAAE,MAAM,CAAA;aAAE,CAAC,CAAC;SAClD,EACD,IAAI,CACL,CAAC;QACF,OAAO,EAAE,iBAAiB,CACxB,OAAO,EACP,UAAU,EACV;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAC9B,KAAK,CAAC;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,EAC/D,IAAI,CACL,CAAC;KACH,CAAC;CACH,CAAC"}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Create or update an experiment definition, keyed by `(scope, key)`. Returns
|
|
3
|
-
* `{ created: true }` on insert, `{ created: false }` on update.
|
|
4
|
-
*
|
|
3
|
+
* `{ created: true }` on insert, `{ created: false }` on update. Updating leaves
|
|
4
|
+
* existing sticky assignments untouched — only the definition (variants, salt,
|
|
5
|
+
* status) changes. Time is server-sourced.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* (some subjects bucketed under the old definition, some the new) and orphan
|
|
9
|
-
* tallies. Status transitions (start/stop) are always allowed. To re-randomize or
|
|
10
|
-
* reweight after enrollment, define a new experiment key.
|
|
11
|
-
*
|
|
12
|
-
* @throws `ConvexError({ code: "INVALID_VARIANTS", reason })` for a bad variant set.
|
|
13
|
-
* @throws `ConvexError({ code: "EXPERIMENT_LOCKED" })` when `variants`/`salt` change
|
|
14
|
-
* after a subject has been assigned.
|
|
7
|
+
* @throws `ConvexError({ code: "INVALID_VARIANTS" })` when the variant set is
|
|
8
|
+
* empty, has a non-positive/non-finite weight, or repeats a variant key.
|
|
15
9
|
*/
|
|
16
10
|
export declare const define: import("convex/server").RegisteredMutation<"public", {
|
|
17
11
|
scope: string;
|
|
@@ -40,7 +34,9 @@ export declare const setStatus: import("convex/server").RegisteredMutation<"publ
|
|
|
40
34
|
* Enroll `subjectRef` and return the sticky variant. `{ variant: null }` when the
|
|
41
35
|
* experiment is absent or not `running` (the host treats it as control). When
|
|
42
36
|
* `running`, the first call deterministically picks and persists a variant
|
|
43
|
-
* (`isNew: true`); later calls replay it (`isNew: false`).
|
|
37
|
+
* (`isNew: true`); later calls replay it (`isNew: false`). Assignment is a pure
|
|
38
|
+
* function of `(salt, subjectRef)` — see {@link pickVariant} — so it is sticky
|
|
39
|
+
* even before persistence. Time is server-sourced.
|
|
44
40
|
*/
|
|
45
41
|
export declare const assign: import("convex/server").RegisteredMutation<"public", {
|
|
46
42
|
scope: string;
|
|
@@ -53,10 +49,11 @@ export declare const assign: import("convex/server").RegisteredMutation<"public"
|
|
|
53
49
|
variant: null;
|
|
54
50
|
}>>;
|
|
55
51
|
/**
|
|
56
|
-
* Record that `subjectRef` was exposed and return their variant
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
52
|
+
* Record that `subjectRef` was exposed to the experiment and return their variant.
|
|
53
|
+
* Enrolls the subject if needed (same sticky path as `assign`), then upserts a
|
|
54
|
+
* per-subject exposure row — first exposure inserts (`count` 1), later exposures
|
|
55
|
+
* bump `count` and `lastExposedAt`. The deduped tally is what `results` reports as
|
|
56
|
+
* unique subjects. `{ variant: null }` when not enrolled. Time is server-sourced.
|
|
60
57
|
*/
|
|
61
58
|
export declare const logExposure: import("convex/server").RegisteredMutation<"public", {
|
|
62
59
|
scope: string;
|
|
@@ -67,27 +64,4 @@ export declare const logExposure: import("convex/server").RegisteredMutation<"pu
|
|
|
67
64
|
} | {
|
|
68
65
|
variant: string;
|
|
69
66
|
}>>;
|
|
70
|
-
/**
|
|
71
|
-
* Erase a subject's footprint in one experiment — their assignment and exposure
|
|
72
|
-
* rows — decrementing the variant tallies accordingly. The GDPR right-to-erasure
|
|
73
|
-
* primitive for a `subjectRef` that maps to a person. Returns `true` if anything
|
|
74
|
-
* was deleted. Loop over `listExperiments` to erase a subject across a scope.
|
|
75
|
-
*/
|
|
76
|
-
export declare const forgetSubject: import("convex/server").RegisteredMutation<"public", {
|
|
77
|
-
scope: string;
|
|
78
|
-
key: string;
|
|
79
|
-
subjectRef: string;
|
|
80
|
-
}, Promise<boolean>>;
|
|
81
|
-
/**
|
|
82
|
-
* Delete an experiment and all of its data — the definition, every assignment,
|
|
83
|
-
* exposure, and tally row. Bounded: removes up to `batch` rows per table per pass
|
|
84
|
-
* and self-reschedules until the children are drained, then deletes the definition.
|
|
85
|
-
* Idempotent and safe to call on an absent experiment. Returns the rows removed
|
|
86
|
-
* this pass.
|
|
87
|
-
*/
|
|
88
|
-
export declare const deleteExperiment: import("convex/server").RegisteredMutation<"public", {
|
|
89
|
-
scope: string;
|
|
90
|
-
key: string;
|
|
91
|
-
batch: number;
|
|
92
|
-
}, Promise<number>>;
|
|
93
67
|
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AA0EA;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;GAmCjB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,SAAS;;;;oBAgBpB,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM;;;;;aAtGG,MAAM;WAAS,OAAO;;;GAqH1C,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;;;;;;;;GA+CtB,CAAC"}
|