@vllnt/convex-experiments 0.1.0-canary.f2cd1ba → 0.1.1-canary.b4e25b0
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 +150 -36
- package/dist/client/index.d.ts +54 -3
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +53 -4
- package/dist/client/index.js.map +1 -1
- package/dist/client/types.d.ts +8 -3
- package/dist/client/types.d.ts.map +1 -1
- package/dist/component/_generated/component.d.ts +35 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/_generated/server.d.ts +12 -0
- package/dist/component/_generated/server.d.ts.map +1 -1
- package/dist/component/_generated/server.js +2 -0
- package/dist/component/_generated/server.js.map +1 -1
- package/dist/component/convex.config.d.ts.map +1 -1
- package/dist/component/mutations.d.ts +47 -20
- package/dist/component/mutations.d.ts.map +1 -1
- package/dist/component/mutations.js +220 -26
- package/dist/component/mutations.js.map +1 -1
- package/dist/component/queries.d.ts +41 -8
- package/dist/component/queries.d.ts.map +1 -1
- package/dist/component/queries.js +82 -20
- package/dist/component/queries.js.map +1 -1
- package/dist/component/schema.d.ts +39 -17
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/schema.js +20 -5
- package/dist/component/schema.js.map +1 -1
- package/dist/component/validators.d.ts +31 -18
- package/dist/component/validators.d.ts.map +1 -1
- package/dist/component/validators.js +14 -3
- package/dist/component/validators.js.map +1 -1
- package/dist/react/index.d.ts +57 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +39 -0
- package/dist/react/index.js.map +1 -0
- package/dist/shared.d.ts +5 -3
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +5 -3
- package/dist/shared.js.map +1 -1
- package/package.json +50 -20
- package/src/client/index.ts +98 -4
- package/src/client/types.ts +8 -3
- package/src/component/_generated/component.ts +42 -1
- package/src/component/_generated/server.ts +13 -0
- package/src/component/mutations.ts +250 -28
- package/src/component/queries.ts +97 -20
- package/src/component/schema.ts +21 -5
- package/src/component/validators.ts +14 -3
- package/src/react/index.tsx +68 -0
- package/src/shared.ts +6 -3
- package/src/test.ts +2 -1
- package/src/unit.test.ts +0 -84
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<!-- Badges -->
|
|
2
|
+
|
|
2
3
|
[](https://www.convex.dev/components)
|
|
3
4
|
[](https://www.npmjs.com/package/@vllnt/convex-experiments)
|
|
4
5
|
[](https://github.com/vllnt/convex-experiments/actions/workflows/ci.yml)
|
|
@@ -6,8 +7,8 @@
|
|
|
6
7
|
|
|
7
8
|
# @vllnt/convex-experiments
|
|
8
9
|
|
|
9
|
-
Deterministic A/B experimentation — sticky variant assignment and deduped
|
|
10
|
-
Convex component.
|
|
10
|
+
Deterministic A/B experimentation — sticky variant assignment and deduped
|
|
11
|
+
exposure tracking, as a Convex component.
|
|
11
12
|
|
|
12
13
|
```ts
|
|
13
14
|
const experiments = new Experiments(components.experiments);
|
|
@@ -17,25 +18,46 @@ await experiments.define(ctx, "checkout_button", {
|
|
|
17
18
|
{ key: "treatment", weight: 1 },
|
|
18
19
|
],
|
|
19
20
|
});
|
|
20
|
-
const { variant } = await experiments.logExposure(
|
|
21
|
+
const { variant } = await experiments.logExposure(
|
|
22
|
+
ctx,
|
|
23
|
+
"checkout_button",
|
|
24
|
+
userId,
|
|
25
|
+
);
|
|
21
26
|
if (variant === "treatment") showNewButton();
|
|
22
27
|
```
|
|
23
28
|
|
|
24
|
-
Define an experiment with weighted variants; enroll subjects into a **sticky**
|
|
25
|
-
deterministically from `(salt, subjectRef)`; record
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
Define an experiment with weighted variants; enroll subjects into a **sticky**
|
|
30
|
+
variant chosen deterministically from `(scope, salt, subjectRef)`; record
|
|
31
|
+
exposures and read per-variant tallies. Pair it with a feature-flag system for
|
|
32
|
+
kill-switches and measure conversions in your own tables — this component
|
|
33
|
+
handles assignment and exposure. Domain-neutral: any subject, any surface.
|
|
28
34
|
|
|
29
35
|
## Features
|
|
30
36
|
|
|
31
|
-
- **Deterministic + sticky** — the same subject always lands in the same
|
|
32
|
-
|
|
33
|
-
- **
|
|
34
|
-
-
|
|
35
|
-
- **
|
|
36
|
-
|
|
37
|
-
- **
|
|
38
|
-
|
|
37
|
+
- **Deterministic + sticky** — the same subject always lands in the same
|
|
38
|
+
weighted variant, even before anything is stored.
|
|
39
|
+
- **Weighted variants** — split traffic by relative weights (`1:1`, `90:10`,
|
|
40
|
+
N-way); equal weights split evenly.
|
|
41
|
+
- **Enrollment lifecycle** — `draft → running → stopped`; only `running`
|
|
42
|
+
enrolls, and stopping preserves recorded data.
|
|
43
|
+
- **Deduped exposures + O(variants) results** — one tallied row per subject;
|
|
44
|
+
`results` reads maintained per-variant tallies
|
|
45
|
+
(`assigned`/`subjects`/`exposures`/`weight`), never scanning the exposure
|
|
46
|
+
table.
|
|
47
|
+
- **Sample-ratio-ready** — `assigned` + `weight` per variant let you check
|
|
48
|
+
observed vs expected split (SRM).
|
|
49
|
+
- **`peek`** — a read-only deterministic query returns a subject's sticky
|
|
50
|
+
variant without writing (SSR / flicker-free first paint).
|
|
51
|
+
- **Immutable once assigned** — `variants`/`salt` are fixed after enrollment
|
|
52
|
+
(changing them throws); define a new key to re-randomize.
|
|
53
|
+
- **Lifecycle + GDPR** — `listExperiments` to discover, `forgetSubject` to erase
|
|
54
|
+
one subject, `deleteExperiment` to cascade-delete.
|
|
55
|
+
- **Scopes** — global by default, or namespace per tenant / surface (folded into
|
|
56
|
+
the hash for independent bucketing).
|
|
57
|
+
- **Fully typed** — variant keys, weights, and outcomes are concrete types end
|
|
58
|
+
to end; no `any`.
|
|
59
|
+
- **Server-sourced time** — assignment timestamps come from the server, never
|
|
60
|
+
the caller.
|
|
39
61
|
|
|
40
62
|
## Installation
|
|
41
63
|
|
|
@@ -43,7 +65,9 @@ component handles assignment and exposure. Domain-neutral: any subject, any surf
|
|
|
43
65
|
pnpm add @vllnt/convex-experiments
|
|
44
66
|
```
|
|
45
67
|
|
|
46
|
-
|
|
68
|
+
Node.js >=18; required peer: `convex@^1.45.0`. React >=18 is optional. The
|
|
69
|
+
default npm channel is stable; use `@vllnt/convex-experiments@canary` for the
|
|
70
|
+
current prerelease surface documented here.
|
|
47
71
|
|
|
48
72
|
## Usage
|
|
49
73
|
|
|
@@ -69,43 +93,129 @@ const experiments = new Experiments(components.experiments);
|
|
|
69
93
|
export const view = mutation({
|
|
70
94
|
args: { userId: v.string() },
|
|
71
95
|
handler: async (ctx, { userId }) => {
|
|
72
|
-
const { variant } = await experiments.logExposure(
|
|
96
|
+
const { variant } = await experiments.logExposure(
|
|
97
|
+
ctx,
|
|
98
|
+
"checkout_button",
|
|
99
|
+
userId,
|
|
100
|
+
);
|
|
73
101
|
return { variant }; // "control" | "treatment" | null (not enrolled)
|
|
74
102
|
},
|
|
75
103
|
});
|
|
76
104
|
```
|
|
77
105
|
|
|
78
|
-
Measure the outcome in your own table, joined on the assigned variant — then
|
|
79
|
-
`results(ctx, "checkout_button")`. See
|
|
80
|
-
host-side
|
|
106
|
+
Measure the outcome in your own table, joined on the assigned variant — then
|
|
107
|
+
read tallies with `results(ctx, "checkout_button")`. See
|
|
108
|
+
[`example/convex/example.ts`](example/convex/example.ts) for a host-side
|
|
109
|
+
conversion recorder.
|
|
110
|
+
|
|
111
|
+
The wrapper is illustrative, not an auth gate: resolve and authorize the subject
|
|
112
|
+
in the host before enrollment. After mounting, run `pnpm convex dev` to generate
|
|
113
|
+
component references.
|
|
114
|
+
|
|
115
|
+
## Configuration and limits
|
|
116
|
+
|
|
117
|
+
Client options are `defaultScope: "global"` and `defaultStatus: "running"`.
|
|
118
|
+
`define` therefore starts enrollment immediately unless you pass
|
|
119
|
+
`status: "draft"` or set a different client default. Omitted `salt` defaults to
|
|
120
|
+
the experiment key; the component hashes `${scope}:${salt}:${subjectRef}` with
|
|
121
|
+
FNV-1a. Assignment also depends on the ordered variants and weights. It is
|
|
122
|
+
deterministic bucketing, not a cryptographic randomness or access-control
|
|
123
|
+
mechanism.
|
|
124
|
+
|
|
125
|
+
`deleteExperiment` defaults to 200 rows per table per pass, accepts integer
|
|
126
|
+
batches 1–500, and returns only the first pass's deletion count. Discovery reads
|
|
127
|
+
are not paginated. Exposure rows are deduplicated per subject, but every
|
|
128
|
+
`logExposure` call increments total exposures: logical retries are not
|
|
129
|
+
deduplicated. The host owns conversion metrics, statistical inference and
|
|
130
|
+
release kill-switches.
|
|
131
|
+
|
|
132
|
+
## Multiple mounts
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
app.use(experiments, { name: "webExperiments" });
|
|
136
|
+
app.use(experiments, { name: "gameExperiments" });
|
|
137
|
+
// new Experiments(components.webExperiments), new Experiments(components.gameExperiments)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Mounts isolate tables and scheduled cleanup. Use `scope` for runtime namespaces,
|
|
141
|
+
not as a substitute for authorization.
|
|
81
142
|
|
|
82
143
|
## API Reference
|
|
83
144
|
|
|
84
|
-
| Method
|
|
85
|
-
|
|
86
|
-
| `define(ctx, key, { variants, scope?, salt?, status? })` | mutation | `{ created: boolean }`
|
|
87
|
-
| `setStatus(ctx, key, status, scope?)`
|
|
88
|
-
| `assign(ctx, key, subjectRef, scope?)`
|
|
89
|
-
| `logExposure(ctx, key, subjectRef, scope?)`
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
145
|
+
| Method | Kind | Result |
|
|
146
|
+
| -------------------------------------------------------- | -------- | ---------------------------------------------------------- |
|
|
147
|
+
| `define(ctx, key, { variants, scope?, salt?, status? })` | mutation | `{ created: boolean }` |
|
|
148
|
+
| `setStatus(ctx, key, status, scope?)` | mutation | `boolean` |
|
|
149
|
+
| `assign(ctx, key, subjectRef, scope?)` | mutation | `{ variant: null } \| { variant: string; isNew: boolean }` |
|
|
150
|
+
| `logExposure(ctx, key, subjectRef, scope?)` | mutation | `{ variant: string \| null }` |
|
|
151
|
+
| `forgetSubject(ctx, key, subjectRef, scope?)` | mutation | `boolean` (GDPR erasure) |
|
|
152
|
+
| `deleteExperiment(ctx, key, { scope?, batch? })` | mutation | `number` (cascade delete) |
|
|
153
|
+
| `getExperiment(ctx, key, scope?)` | query | `ExperimentDefinition \| null` |
|
|
154
|
+
| `listExperiments(ctx, { scope?, status? })` | query | `ExperimentDefinition[]` |
|
|
155
|
+
| `getAssignment(ctx, key, subjectRef, scope?)` | query | `{ variant, assignedAt } \| null` |
|
|
156
|
+
| `peek(ctx, key, subjectRef, scope?)` | query | `{ variant: string \| null }` (no write) |
|
|
157
|
+
| `results(ctx, key, scope?)` | query | `{ variant, assigned, subjects, exposures, weight }[]` |
|
|
93
158
|
|
|
94
159
|
Full reference: [docs/API.md](docs/API.md).
|
|
95
160
|
|
|
96
161
|
## React
|
|
97
162
|
|
|
98
|
-
|
|
99
|
-
|
|
163
|
+
Optional, tree-shakeable hooks via `@vllnt/convex-experiments/react` (`react` is
|
|
164
|
+
an optional peer dep — a backend-only consumer pulls none of it). Each hook
|
|
165
|
+
wraps `useQuery` over a query reference **you re-export** from your app, so the
|
|
166
|
+
component never owns your `api`.
|
|
167
|
+
|
|
168
|
+
```tsx
|
|
169
|
+
// convex/experiments.ts — re-export the host-side wrappers (auth gated)
|
|
170
|
+
// export const myVariant = query({ args: { key: v.string(), subjectRef: v.string() },
|
|
171
|
+
// handler: (ctx, { key, subjectRef }) => experiments.peek(ctx, key, subjectRef) });
|
|
172
|
+
// Add host authorization before exposing this illustrative wrapper.
|
|
173
|
+
|
|
174
|
+
import { useVariant } from "@vllnt/convex-experiments/react";
|
|
175
|
+
import { api } from "@/convex/_generated/api";
|
|
176
|
+
|
|
177
|
+
function CheckoutButton({ userId }: { userId: string }) {
|
|
178
|
+
// deterministic first paint via peek → no flash-of-control
|
|
179
|
+
const variant = useVariant(api.experiments.myVariant, {
|
|
180
|
+
key: "checkout_button",
|
|
181
|
+
subjectRef: userId,
|
|
182
|
+
});
|
|
183
|
+
return variant === "treatment" ? <OneClick /> : <Classic />;
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
| Hook | Wraps | Returns |
|
|
188
|
+
| ---------------------------------------- | --------------- | ---------------------------------------------------------------- |
|
|
189
|
+
| `useVariant(peekRef, args)` | `peek` | `string \| null \| undefined` (variant / not-enrolled / loading) |
|
|
190
|
+
| `useAssignment(getAssignmentRef, args)` | `getAssignment` | `Assignment \| null \| undefined` |
|
|
191
|
+
| `useExperimentResults(resultsRef, args)` | `results` | `VariantResult[] \| undefined` |
|
|
100
192
|
|
|
101
193
|
## Security
|
|
102
194
|
|
|
103
|
-
- Auth-agnostic — the host resolves identity and decides who may define, start,
|
|
104
|
-
|
|
195
|
+
- Auth-agnostic — the host resolves identity and decides who may define, start,
|
|
196
|
+
stop, or enroll.
|
|
197
|
+
- Tables sandboxed — reached only through the exported functions; `subjectRef`,
|
|
198
|
+
variant keys, and `scope` stay opaque.
|
|
105
199
|
- Server-sourced timestamps — a caller cannot supply assignment time.
|
|
106
200
|
|
|
107
201
|
See [docs/API.md](docs/API.md).
|
|
108
202
|
|
|
203
|
+
## Testing your app
|
|
204
|
+
|
|
205
|
+
`@vllnt/convex-experiments/test` exports `register(t, name = "experiments")` to
|
|
206
|
+
mount the component in a `convex-test` instance. It needs `convex-test` and
|
|
207
|
+
`vitest` (with Vite's `import.meta.glob`) in the consuming app:
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
/// <reference types="vite/client" />
|
|
211
|
+
import { convexTest } from "convex-test";
|
|
212
|
+
import { register } from "@vllnt/convex-experiments/test";
|
|
213
|
+
import schema from "./schema";
|
|
214
|
+
|
|
215
|
+
const t = convexTest(schema, import.meta.glob("./**/*.ts"));
|
|
216
|
+
register(t);
|
|
217
|
+
```
|
|
218
|
+
|
|
109
219
|
## Testing
|
|
110
220
|
|
|
111
221
|
```bash
|
|
@@ -113,7 +223,9 @@ pnpm test # single run
|
|
|
113
223
|
pnpm test:coverage # enforced 100% on covered files
|
|
114
224
|
```
|
|
115
225
|
|
|
116
|
-
Tests
|
|
226
|
+
Tests use the simulated `convex-test` backend (`@edge-runtime/vm`), not a real
|
|
227
|
+
Convex deployment; they do not prove production concurrency or scheduler
|
|
228
|
+
delivery.
|
|
117
229
|
|
|
118
230
|
## Contributing
|
|
119
231
|
|
|
@@ -121,9 +233,11 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
|
121
233
|
|
|
122
234
|
## Author
|
|
123
235
|
|
|
124
|
-
Built by [bntvllnt](https://github.com/bntvllnt) ·
|
|
236
|
+
Built by [bntvllnt](https://github.com/bntvllnt) ·
|
|
237
|
+
[bntvllnt.com](https://bntvllnt.com) · [X @bntvllnt](https://x.com/bntvllnt)
|
|
125
238
|
|
|
126
|
-
Part of the [@vllnt](https://github.com/vllnt) Convex component fleet —
|
|
239
|
+
Part of the [@vllnt](https://github.com/vllnt) Convex component fleet —
|
|
240
|
+
[vllnt.com](https://vllnt.com)
|
|
127
241
|
|
|
128
242
|
If this is useful, [sponsor the work](https://github.com/sponsors/bntvllnt).
|
|
129
243
|
|
package/dist/client/index.d.ts
CHANGED
|
@@ -31,17 +31,36 @@ 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>;
|
|
34
44
|
};
|
|
35
45
|
queries: {
|
|
36
46
|
getExperiment: FunctionReference<"query", "internal", {
|
|
37
47
|
scope: string;
|
|
38
48
|
key: string;
|
|
39
49
|
}, ExperimentDefinition | null>;
|
|
50
|
+
listExperiments: FunctionReference<"query", "internal", {
|
|
51
|
+
scope: string;
|
|
52
|
+
status?: ExperimentStatus;
|
|
53
|
+
}, ExperimentDefinition[]>;
|
|
40
54
|
getAssignment: FunctionReference<"query", "internal", {
|
|
41
55
|
scope: string;
|
|
42
56
|
key: string;
|
|
43
57
|
subjectRef: string;
|
|
44
58
|
}, Assignment | null>;
|
|
59
|
+
peek: FunctionReference<"query", "internal", {
|
|
60
|
+
scope: string;
|
|
61
|
+
key: string;
|
|
62
|
+
subjectRef: string;
|
|
63
|
+
}, ExposureOutcome>;
|
|
45
64
|
results: FunctionReference<"query", "internal", {
|
|
46
65
|
scope: string;
|
|
47
66
|
key: string;
|
|
@@ -84,8 +103,9 @@ export declare class Experiments {
|
|
|
84
103
|
/**
|
|
85
104
|
* Create or update an experiment. `variants` are weighted (equal weights split
|
|
86
105
|
* evenly). `salt` defaults to `key`; `status` to the client default (`running`).
|
|
87
|
-
* Returns `{ created }` — `false` when an existing definition was updated.
|
|
88
|
-
*
|
|
106
|
+
* Returns `{ created }` — `false` when an existing definition was updated. Status
|
|
107
|
+
* transitions are always allowed; `variants`/`salt` are immutable once a subject
|
|
108
|
+
* is assigned (throws `EXPERIMENT_LOCKED`).
|
|
89
109
|
*/
|
|
90
110
|
define(ctx: RunMutationCtx, key: string, opts: DefineOptions & {
|
|
91
111
|
variants: Variant[];
|
|
@@ -110,8 +130,39 @@ export declare class Experiments {
|
|
|
110
130
|
getExperiment(ctx: RunQueryCtx, key: string, scope?: string): Promise<ExperimentDefinition | null>;
|
|
111
131
|
/** A subject's sticky assignment, or `null` if not enrolled. */
|
|
112
132
|
getAssignment(ctx: RunQueryCtx, key: string, subjectRef: string, scope?: string): Promise<Assignment | null>;
|
|
113
|
-
/**
|
|
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
|
+
*/
|
|
114
150
|
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>;
|
|
115
166
|
}
|
|
116
167
|
export type { Assignment, AssignOutcome, DefineOptions, ExperimentDefinition, ExperimentsOptions, ExperimentStatus, ExposureOutcome, Variant, VariantResult, };
|
|
117
168
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"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HANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_SCOPE, DEFAULT_STATUS } from "../shared.js";
|
|
1
|
+
import { DEFAULT_DELETE_BATCH, 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,8 +35,9 @@ 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
|
-
*
|
|
38
|
+
* Returns `{ created }` — `false` when an existing definition was updated. Status
|
|
39
|
+
* transitions are always allowed; `variants`/`salt` are immutable once a subject
|
|
40
|
+
* is assigned (throws `EXPERIMENT_LOCKED`).
|
|
40
41
|
*/
|
|
41
42
|
define(ctx, key, opts) {
|
|
42
43
|
return ctx.runMutation(this.component.mutations.define, {
|
|
@@ -94,12 +95,60 @@ export class Experiments {
|
|
|
94
95
|
subjectRef,
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
|
-
/**
|
|
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
|
+
*/
|
|
98
123
|
results(ctx, key, scope) {
|
|
99
124
|
return ctx.runQuery(this.component.queries.results, {
|
|
100
125
|
scope: this.scopeOf(scope),
|
|
101
126
|
key,
|
|
102
127
|
});
|
|
103
128
|
}
|
|
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
|
+
}
|
|
104
153
|
}
|
|
105
154
|
//# 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,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAoGnF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,WAAW;IAKH,SAAS;IAJX,YAAY,CAAS;IACrB,aAAa,CAAmB;IAEjD,YACmB,SAA+B,EAChD,OAAO,GAAuB,EAAE;yBADf,SAAS;QAG1B,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;;;;;;OAMG;IACH,MAAM,CACJ,GAAmB,EACnB,GAAW,EACX,IAA6C;QAE7C,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE;YACtD,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAC/B,GAAG;YACH,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,GAAG;YACtB,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,aAAa;SAC1C,CAAC,CAAC;IACL,CAAC;IAED,qFAAqF;IACrF,SAAS,CACP,GAAmB,EACnB,GAAW,EACX,MAAwB,EACxB,KAAc;QAEd,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CA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AK,EAAE,IAAI,CAAC,KAAK,IAAI,oBAAoB;SAC1C,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/client/types.d.ts
CHANGED
|
@@ -20,8 +20,9 @@ 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
|
-
*
|
|
23
|
+
* Hash salt for deterministic assignment. Defaults to the experiment `key`.
|
|
24
|
+
* Fixed once any subject is assigned (changing it after enrollment throws
|
|
25
|
+
* `EXPERIMENT_LOCKED`); to re-randomize, define a new experiment key.
|
|
25
26
|
*/
|
|
26
27
|
salt?: string;
|
|
27
28
|
/** Initial lifecycle status. Defaults to the client `defaultStatus`. */
|
|
@@ -58,13 +59,17 @@ export type AssignOutcome = {
|
|
|
58
59
|
export type ExposureOutcome = {
|
|
59
60
|
variant: string | null;
|
|
60
61
|
};
|
|
61
|
-
/** A per-variant
|
|
62
|
+
/** A per-variant tally, as returned by {@link Experiments.results}. */
|
|
62
63
|
export interface VariantResult {
|
|
63
64
|
/** The variant key. */
|
|
64
65
|
variant: string;
|
|
66
|
+
/** Subjects assigned to this variant (the realized split, for SRM). */
|
|
67
|
+
assigned: number;
|
|
65
68
|
/** Distinct subjects exposed to this variant (the funnel denominator). */
|
|
66
69
|
subjects: number;
|
|
67
70
|
/** Total exposure events recorded for this variant. */
|
|
68
71
|
exposures: number;
|
|
72
|
+
/** The configured weight from the current definition (0 if the variant is gone). */
|
|
73
|
+
weight: number;
|
|
69
74
|
}
|
|
70
75
|
//# 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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E,MAAM,CAAC;IACb,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,uFAAuF;AACvF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GACrB;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GACjB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAExC,0FAA0F;AAC1F,MAAM,MAAM,eAAe,GAAG;IAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAEzD,uEAAuE;AACvE,MAAM,WAAW,aAAa;IAC5B,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,oFAAoF;IACpF,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -42,6 +42,16 @@ export type ComponentApi<Name 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>;
|
|
45
55
|
logExposure: FunctionReference<"mutation", "internal", {
|
|
46
56
|
key: string;
|
|
47
57
|
scope: string;
|
|
@@ -80,13 +90,38 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
80
90
|
weight: number;
|
|
81
91
|
}>;
|
|
82
92
|
}, 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>;
|
|
83
116
|
results: FunctionReference<"query", "internal", {
|
|
84
117
|
key: string;
|
|
85
118
|
scope: string;
|
|
86
119
|
}, Array<{
|
|
120
|
+
assigned: number;
|
|
87
121
|
exposures: number;
|
|
88
122
|
subjects: number;
|
|
89
123
|
variant: string;
|
|
124
|
+
weight: number;
|
|
90
125
|
}>, Name>;
|
|
91
126
|
};
|
|
92
127
|
};
|
|
@@ -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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AO,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;
|
|
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,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,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,OAAO,EAAE,MAAM,CAAA;SAAE,EACvC,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;YACJ,QAAQ,EAAE,MAAM,CAAC;YACjB,SAAS,EAAE,MAAM,CAAC;YAClB,QAAQ,EAAE,MAAM,CAAC;YACjB,OAAO,EAAE,MAAM,CAAC;YAChB,MAAM,EAAE,MAAM,CAAC;SAChB,CAAC,EACF,IAAI,CACL,CAAC;KACH,CAAC;CACH,CAAC"}
|
|
@@ -8,6 +8,16 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { ActionBuilder, HttpActionBuilder, MutationBuilder, QueryBuilder, GenericActionCtx, GenericMutationCtx, GenericQueryCtx, GenericDatabaseReader, GenericDatabaseWriter } from "convex/server";
|
|
10
10
|
import type { DataModel } from "./dataModel.js";
|
|
11
|
+
/**
|
|
12
|
+
* Typesafe environment variables.
|
|
13
|
+
*
|
|
14
|
+
* This includes platform-provided env vars and any variables declared in
|
|
15
|
+
* `convex.config.ts`.
|
|
16
|
+
*/
|
|
17
|
+
type Env = {
|
|
18
|
+
readonly CONVEX_CLOUD_URL: string;
|
|
19
|
+
readonly CONVEX_SITE_URL: string;
|
|
20
|
+
};
|
|
11
21
|
/**
|
|
12
22
|
* Define a query in this Convex app's public API.
|
|
13
23
|
*
|
|
@@ -75,6 +85,7 @@ export declare const internalAction: ActionBuilder<DataModel, "internal">;
|
|
|
75
85
|
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
|
|
76
86
|
*/
|
|
77
87
|
export declare const httpAction: HttpActionBuilder;
|
|
88
|
+
export declare const env: Env;
|
|
78
89
|
/**
|
|
79
90
|
* A set of services for use within Convex query functions.
|
|
80
91
|
*
|
|
@@ -118,4 +129,5 @@ export type DatabaseReader = GenericDatabaseReader<DataModel>;
|
|
|
118
129
|
* for the guarantees Convex provides your functions.
|
|
119
130
|
*/
|
|
120
131
|
export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
|
|
132
|
+
export {};
|
|
121
133
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,eAAe,CAAC;AAUvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAAE,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAgB,CAAC;AAErE;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,SAAS,EAAE,UAAU,CACxC,CAAC;AAEvB;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,eAAe,CAAC,SAAS,EAAE,QAAQ,CAAmB,CAAC;AAE9E;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAAC,SAAS,EAAE,UAAU,CAC3C,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM,EAAE,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAiB,CAAC;AAExE;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC,SAAS,EAAE,UAAU,CACzC,CAAC;AAExB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UA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D;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAExD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -75,4 +75,6 @@ export const internalAction = internalActionGeneric;
|
|
|
75
75
|
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
|
|
76
76
|
*/
|
|
77
77
|
export const httpAction = httpActionGeneric;
|
|
78
|
+
export const env = globalThis
|
|
79
|
+
.process.env;
|
|
78
80
|
//# sourceMappingURL=server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAaH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAaH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAcvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAsC,YAAY,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GACxB,oBAAoB,CAAC;AAEvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAyC,eAAe,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAC3B,uBAAuB,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,MAAM,GAAuC,aAAa,CAAC;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GACzB,qBAAqB,CAAC;AAExB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsB,iBAAiB,CAAC;AAC/D,MAAM,CAAC,MAAM,GAAG,GAAS,UAAmD;KACzE,OAAO,CAAC,GAAG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,sDAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,sDAAiC,CAAC;eAMlC,SAAS"}
|