@vllnt/convex-experiments 0.1.0-canary.0b21dd5

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.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +161 -0
  3. package/dist/client/index.d.ts +168 -0
  4. package/dist/client/index.d.ts.map +1 -0
  5. package/dist/client/index.js +154 -0
  6. package/dist/client/index.js.map +1 -0
  7. package/dist/client/types.d.ts +75 -0
  8. package/dist/client/types.d.ts.map +1 -0
  9. package/dist/client/types.js +3 -0
  10. package/dist/client/types.js.map +1 -0
  11. package/dist/component/_generated/api.d.ts +38 -0
  12. package/dist/component/_generated/api.d.ts.map +1 -0
  13. package/dist/component/_generated/api.js +31 -0
  14. package/dist/component/_generated/api.js.map +1 -0
  15. package/dist/component/_generated/component.d.ts +128 -0
  16. package/dist/component/_generated/component.d.ts.map +1 -0
  17. package/dist/component/_generated/component.js +11 -0
  18. package/dist/component/_generated/component.js.map +1 -0
  19. package/dist/component/_generated/dataModel.d.ts +46 -0
  20. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  21. package/dist/component/_generated/dataModel.js +11 -0
  22. package/dist/component/_generated/dataModel.js.map +1 -0
  23. package/dist/component/_generated/server.d.ts +133 -0
  24. package/dist/component/_generated/server.d.ts.map +1 -0
  25. package/dist/component/_generated/server.js +80 -0
  26. package/dist/component/_generated/server.js.map +1 -0
  27. package/dist/component/convex.config.d.ts +3 -0
  28. package/dist/component/convex.config.d.ts.map +1 -0
  29. package/dist/component/convex.config.js +7 -0
  30. package/dist/component/convex.config.js.map +1 -0
  31. package/dist/component/mutations.d.ts +93 -0
  32. package/dist/component/mutations.d.ts.map +1 -0
  33. package/dist/component/mutations.js +359 -0
  34. package/dist/component/mutations.js.map +1 -0
  35. package/dist/component/queries.d.ts +72 -0
  36. package/dist/component/queries.d.ts.map +1 -0
  37. package/dist/component/queries.js +134 -0
  38. package/dist/component/queries.js.map +1 -0
  39. package/dist/component/schema.d.ts +99 -0
  40. package/dist/component/schema.d.ts.map +1 -0
  41. package/dist/component/schema.js +64 -0
  42. package/dist/component/schema.js.map +1 -0
  43. package/dist/component/validators.d.ts +109 -0
  44. package/dist/component/validators.d.ts.map +1 -0
  45. package/dist/component/validators.js +49 -0
  46. package/dist/component/validators.js.map +1 -0
  47. package/dist/react/index.d.ts +57 -0
  48. package/dist/react/index.d.ts.map +1 -0
  49. package/dist/react/index.js +39 -0
  50. package/dist/react/index.js.map +1 -0
  51. package/dist/shared.d.ts +32 -0
  52. package/dist/shared.d.ts.map +1 -0
  53. package/dist/shared.js +52 -0
  54. package/dist/shared.js.map +1 -0
  55. package/package.json +116 -0
  56. package/src/client/index.ts +343 -0
  57. package/src/client/types.ts +78 -0
  58. package/src/component/_generated/api.ts +54 -0
  59. package/src/component/_generated/component.ts +133 -0
  60. package/src/component/_generated/dataModel.ts +60 -0
  61. package/src/component/_generated/server.ts +169 -0
  62. package/src/component/convex.config.ts +9 -0
  63. package/src/component/mutations.ts +414 -0
  64. package/src/component/queries.ts +161 -0
  65. package/src/component/schema.ts +71 -0
  66. package/src/component/validators.ts +65 -0
  67. package/src/react/index.test.tsx +85 -0
  68. package/src/react/index.tsx +68 -0
  69. package/src/shared.ts +69 -0
  70. package/src/test.ts +12 -0
  71. package/src/unit.test.ts +84 -0
package/package.json ADDED
@@ -0,0 +1,116 @@
1
+ {
2
+ "name": "@vllnt/convex-experiments",
3
+ "version": "0.1.0-canary.0b21dd5",
4
+ "description": "Deterministic A/B experimentation — sticky variant assignment and deduped exposure tracking, as a Convex component",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "packageManager": "pnpm@9.15.4",
8
+ "files": [
9
+ "dist",
10
+ "src"
11
+ ],
12
+ "exports": {
13
+ "./package.json": "./package.json",
14
+ ".": {
15
+ "types": "./dist/client/index.d.ts",
16
+ "default": "./dist/client/index.js"
17
+ },
18
+ "./react": {
19
+ "types": "./dist/react/index.d.ts",
20
+ "default": "./dist/react/index.js"
21
+ },
22
+ "./test": "./src/test.ts",
23
+ "./_generated/component.js": {
24
+ "types": "./dist/component/_generated/component.d.ts"
25
+ },
26
+ "./_generated/component": {
27
+ "types": "./dist/component/_generated/component.d.ts"
28
+ },
29
+ "./convex.config": {
30
+ "types": "./dist/component/convex.config.d.ts",
31
+ "default": "./dist/component/convex.config.js"
32
+ },
33
+ "./convex.config.js": {
34
+ "types": "./dist/component/convex.config.d.ts",
35
+ "default": "./dist/component/convex.config.js"
36
+ }
37
+ },
38
+ "types": "./dist/client/index.d.ts",
39
+ "module": "./dist/client/index.js",
40
+ "scripts": {
41
+ "build": "tsc --project ./tsconfig.build.json",
42
+ "build:codegen": "pnpm convex codegen --component-dir ./src/component && pnpm build",
43
+ "build:clean": "rm -rf dist *.tsbuildinfo && pnpm build:codegen",
44
+ "typecheck": "tsc --noEmit",
45
+ "typecheck:ci": "tsc --noEmit --project tsconfig.ci.json",
46
+ "lint": "eslint .",
47
+ "test": "vitest run --passWithNoTests",
48
+ "test:watch": "vitest --typecheck --clearScreen false",
49
+ "test:coverage": "vitest run --coverage --coverage.reporter=text",
50
+ "generate:llms": "node scripts/generate-llms.mjs",
51
+ "preversion": "pnpm install --frozen-lockfile && pnpm build && pnpm test:coverage && pnpm typecheck && pnpm generate:llms",
52
+ "prepublishOnly": "npm whoami || npm login",
53
+ "alpha": "npm version prerelease --preid alpha && npm publish --tag alpha && git push --follow-tags",
54
+ "release": "npm version patch && npm publish && git push --follow-tags"
55
+ },
56
+ "peerDependencies": {
57
+ "convex": "^1.45.0",
58
+ "react": ">=18"
59
+ },
60
+ "peerDependenciesMeta": {
61
+ "react": {
62
+ "optional": true
63
+ }
64
+ },
65
+ "devDependencies": {
66
+ "@edge-runtime/vm": "^5.0.0",
67
+ "@testing-library/react": "^16.3.3",
68
+ "@types/react": "^19.2.18",
69
+ "@types/react-dom": "^19.2.5",
70
+ "@typescript/native": "npm:typescript@7.0.2",
71
+ "@vitest/coverage-v8": "^4.1.11",
72
+ "@vllnt/eslint-config": "2.0.0",
73
+ "@vllnt/typescript": "2.0.0",
74
+ "convex": "^1.45.0",
75
+ "convex-test": "^0.0.56",
76
+ "eslint": "^9.39.5",
77
+ "jsdom": "^29.1.1",
78
+ "prettier": "^3.9.6",
79
+ "react": "^19.2.8",
80
+ "react-dom": "^19.2.8",
81
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
82
+ "vite": "^8.2.2",
83
+ "vitest": "^4.1.11"
84
+ },
85
+ "homepage": "https://github.com/vllnt/convex-experiments#readme",
86
+ "bugs": {
87
+ "url": "https://github.com/vllnt/convex-experiments/issues"
88
+ },
89
+ "author": {
90
+ "name": "bntvllnt",
91
+ "url": "https://bntvllnt.com"
92
+ },
93
+ "funding": {
94
+ "type": "github",
95
+ "url": "https://github.com/sponsors/bntvllnt"
96
+ },
97
+ "repository": {
98
+ "type": "git",
99
+ "url": "https://github.com/vllnt/convex-experiments"
100
+ },
101
+ "engines": {
102
+ "node": ">=18"
103
+ },
104
+ "publishConfig": {
105
+ "access": "public"
106
+ },
107
+ "sideEffects": false,
108
+ "keywords": [
109
+ "convex",
110
+ "convex-component",
111
+ "experiments",
112
+ "ab-testing",
113
+ "split-testing",
114
+ "feature-experimentation"
115
+ ]
116
+ }
@@ -0,0 +1,343 @@
1
+ import type {
2
+ FunctionArgs,
3
+ FunctionReference,
4
+ FunctionReturnType,
5
+ } from "convex/server";
6
+ import type {
7
+ Assignment,
8
+ AssignOutcome,
9
+ DefineOptions,
10
+ ExperimentDefinition,
11
+ ExperimentsOptions,
12
+ ExperimentStatus,
13
+ ExposureOutcome,
14
+ Variant,
15
+ VariantResult,
16
+ } from "./types.js";
17
+ import { DEFAULT_DELETE_BATCH, DEFAULT_SCOPE, DEFAULT_STATUS } from "../shared.js";
18
+
19
+ /**
20
+ * The experiments component's function references, as exposed on the host via
21
+ * `components.experiments`. All values are concrete (no opaque host data), so the
22
+ * client is fully typed end to end — there is no generic to narrow.
23
+ */
24
+ export interface ExperimentsComponent {
25
+ mutations: {
26
+ define: FunctionReference<
27
+ "mutation",
28
+ "internal",
29
+ {
30
+ scope: string;
31
+ key: string;
32
+ variants: Variant[];
33
+ salt: string;
34
+ status: ExperimentStatus;
35
+ },
36
+ { created: boolean }
37
+ >;
38
+ setStatus: FunctionReference<
39
+ "mutation",
40
+ "internal",
41
+ { scope: string; key: string; status: ExperimentStatus },
42
+ boolean
43
+ >;
44
+ assign: FunctionReference<
45
+ "mutation",
46
+ "internal",
47
+ { scope: string; key: string; subjectRef: string },
48
+ AssignOutcome
49
+ >;
50
+ logExposure: FunctionReference<
51
+ "mutation",
52
+ "internal",
53
+ { scope: string; key: string; subjectRef: string },
54
+ ExposureOutcome
55
+ >;
56
+ forgetSubject: FunctionReference<
57
+ "mutation",
58
+ "internal",
59
+ { scope: string; key: string; subjectRef: string },
60
+ boolean
61
+ >;
62
+ deleteExperiment: FunctionReference<
63
+ "mutation",
64
+ "internal",
65
+ { scope: string; key: string; batch: number },
66
+ number
67
+ >;
68
+ };
69
+ queries: {
70
+ getExperiment: FunctionReference<
71
+ "query",
72
+ "internal",
73
+ { scope: string; key: string },
74
+ ExperimentDefinition | null
75
+ >;
76
+ listExperiments: FunctionReference<
77
+ "query",
78
+ "internal",
79
+ { scope: string; status?: ExperimentStatus },
80
+ ExperimentDefinition[]
81
+ >;
82
+ getAssignment: FunctionReference<
83
+ "query",
84
+ "internal",
85
+ { scope: string; key: string; subjectRef: string },
86
+ Assignment | null
87
+ >;
88
+ peek: FunctionReference<
89
+ "query",
90
+ "internal",
91
+ { scope: string; key: string; subjectRef: string },
92
+ ExposureOutcome
93
+ >;
94
+ results: FunctionReference<
95
+ "query",
96
+ "internal",
97
+ { scope: string; key: string },
98
+ VariantResult[]
99
+ >;
100
+ };
101
+ }
102
+
103
+ interface RunQueryCtx {
104
+ runQuery<Q extends FunctionReference<"query", "internal">>(
105
+ reference: Q,
106
+ args: FunctionArgs<Q>,
107
+ ): Promise<FunctionReturnType<Q>>;
108
+ }
109
+
110
+ interface RunMutationCtx {
111
+ runMutation<M extends FunctionReference<"mutation", "internal">>(
112
+ reference: M,
113
+ args: FunctionArgs<M>,
114
+ ): Promise<FunctionReturnType<M>>;
115
+ }
116
+
117
+ /**
118
+ * Consumer-facing client for deterministic A/B experimentation. The host owns
119
+ * meaning and auth; it passes an opaque `subjectRef` and variant keys, and the
120
+ * component answers a sticky, weight-respecting variant plus a deduped exposure
121
+ * tally. Assignment is release-control-free — pair it with a feature-flag
122
+ * component for kill-switches; this layer only assigns and measures.
123
+ *
124
+ * @example
125
+ * ```ts
126
+ * const experiments = new Experiments(components.experiments);
127
+ * await experiments.define(ctx, "checkout_button", {
128
+ * variants: [
129
+ * { key: "control", weight: 1 },
130
+ * { key: "treatment", weight: 1 },
131
+ * ],
132
+ * });
133
+ * const { variant } = await experiments.logExposure(ctx, "checkout_button", userId);
134
+ * if (variant === "treatment") renderNewButton();
135
+ * // later: const tally = await experiments.results(ctx, "checkout_button");
136
+ * ```
137
+ */
138
+ export class Experiments {
139
+ private readonly defaultScope: string;
140
+ private readonly defaultStatus: ExperimentStatus;
141
+
142
+ constructor(
143
+ private readonly component: ExperimentsComponent,
144
+ options: ExperimentsOptions = {},
145
+ ) {
146
+ this.defaultScope = options.defaultScope ?? DEFAULT_SCOPE;
147
+ this.defaultStatus = options.defaultStatus ?? (DEFAULT_STATUS as "running");
148
+ }
149
+
150
+ private scopeOf(scope: string | undefined): string {
151
+ return scope ?? this.defaultScope;
152
+ }
153
+
154
+ /**
155
+ * Create or update an experiment. `variants` are weighted (equal weights split
156
+ * evenly). `salt` defaults to `key`; `status` to the client default (`running`).
157
+ * Returns `{ created }` — `false` when an existing definition was updated. Status
158
+ * transitions are always allowed; `variants`/`salt` are immutable once a subject
159
+ * is assigned (throws `EXPERIMENT_LOCKED`).
160
+ */
161
+ define(
162
+ ctx: RunMutationCtx,
163
+ key: string,
164
+ opts: DefineOptions & { variants: Variant[] },
165
+ ): Promise<{ created: boolean }> {
166
+ return ctx.runMutation(this.component.mutations.define, {
167
+ scope: this.scopeOf(opts.scope),
168
+ key,
169
+ variants: opts.variants,
170
+ salt: opts.salt ?? key,
171
+ status: opts.status ?? this.defaultStatus,
172
+ });
173
+ }
174
+
175
+ /** Move an experiment to a new lifecycle status. Returns `false` if it is absent. */
176
+ setStatus(
177
+ ctx: RunMutationCtx,
178
+ key: string,
179
+ status: ExperimentStatus,
180
+ scope?: string,
181
+ ): Promise<boolean> {
182
+ return ctx.runMutation(this.component.mutations.setStatus, {
183
+ scope: this.scopeOf(scope),
184
+ key,
185
+ status,
186
+ });
187
+ }
188
+
189
+ /**
190
+ * Enroll a subject and return the sticky variant. `{ variant: null }` when the
191
+ * experiment is absent or not running; otherwise `{ variant, isNew }`, `isNew`
192
+ * true only on the first persisting call.
193
+ */
194
+ assign(
195
+ ctx: RunMutationCtx,
196
+ key: string,
197
+ subjectRef: string,
198
+ scope?: string,
199
+ ): Promise<AssignOutcome> {
200
+ return ctx.runMutation(this.component.mutations.assign, {
201
+ scope: this.scopeOf(scope),
202
+ key,
203
+ subjectRef,
204
+ });
205
+ }
206
+
207
+ /**
208
+ * Record an exposure (enrolling the subject if needed) and return their variant,
209
+ * or `null` if not enrolled. Repeated exposures for one subject are deduped into
210
+ * a single tallied row.
211
+ */
212
+ logExposure(
213
+ ctx: RunMutationCtx,
214
+ key: string,
215
+ subjectRef: string,
216
+ scope?: string,
217
+ ): Promise<ExposureOutcome> {
218
+ return ctx.runMutation(this.component.mutations.logExposure, {
219
+ scope: this.scopeOf(scope),
220
+ key,
221
+ subjectRef,
222
+ });
223
+ }
224
+
225
+ /** The experiment definition, or `null` if none exists. */
226
+ getExperiment(
227
+ ctx: RunQueryCtx,
228
+ key: string,
229
+ scope?: string,
230
+ ): Promise<ExperimentDefinition | null> {
231
+ return ctx.runQuery(this.component.queries.getExperiment, {
232
+ scope: this.scopeOf(scope),
233
+ key,
234
+ });
235
+ }
236
+
237
+ /** A subject's sticky assignment, or `null` if not enrolled. */
238
+ getAssignment(
239
+ ctx: RunQueryCtx,
240
+ key: string,
241
+ subjectRef: string,
242
+ scope?: string,
243
+ ): Promise<Assignment | null> {
244
+ return ctx.runQuery(this.component.queries.getAssignment, {
245
+ scope: this.scopeOf(scope),
246
+ key,
247
+ subjectRef,
248
+ });
249
+ }
250
+
251
+ /**
252
+ * Read-only deterministic variant for a subject — the sticky variant **without
253
+ * persisting**. Returns the stored assignment if present, else the deterministic
254
+ * pick; `null` when not enrolled. Use for SSR / a flicker-free first paint, then
255
+ * call `logExposure` to enroll + tally.
256
+ */
257
+ peek(
258
+ ctx: RunQueryCtx,
259
+ key: string,
260
+ subjectRef: string,
261
+ scope?: string,
262
+ ): Promise<ExposureOutcome> {
263
+ return ctx.runQuery(this.component.queries.peek, {
264
+ scope: this.scopeOf(scope),
265
+ key,
266
+ subjectRef,
267
+ });
268
+ }
269
+
270
+ /** Every experiment in a scope, optionally filtered by `status`. */
271
+ listExperiments(
272
+ ctx: RunQueryCtx,
273
+ opts: { scope?: string; status?: ExperimentStatus } = {},
274
+ ): Promise<ExperimentDefinition[]> {
275
+ return ctx.runQuery(this.component.queries.listExperiments, {
276
+ scope: this.scopeOf(opts.scope),
277
+ status: opts.status,
278
+ });
279
+ }
280
+
281
+ /**
282
+ * Per-variant tallies — `assigned`, distinct `subjects` exposed, total
283
+ * `exposures`, and the configured `weight` (for sample-ratio-mismatch). Reads
284
+ * O(variants), not the exposure table.
285
+ */
286
+ results(
287
+ ctx: RunQueryCtx,
288
+ key: string,
289
+ scope?: string,
290
+ ): Promise<VariantResult[]> {
291
+ return ctx.runQuery(this.component.queries.results, {
292
+ scope: this.scopeOf(scope),
293
+ key,
294
+ });
295
+ }
296
+
297
+ /**
298
+ * Erase a subject's assignment + exposure in one experiment (GDPR right-to-
299
+ * erasure), decrementing tallies. Returns `true` if anything was deleted. Loop
300
+ * over `listExperiments` to erase a subject across a whole scope.
301
+ */
302
+ forgetSubject(
303
+ ctx: RunMutationCtx,
304
+ key: string,
305
+ subjectRef: string,
306
+ scope?: string,
307
+ ): Promise<boolean> {
308
+ return ctx.runMutation(this.component.mutations.forgetSubject, {
309
+ scope: this.scopeOf(scope),
310
+ key,
311
+ subjectRef,
312
+ });
313
+ }
314
+
315
+ /**
316
+ * Delete an experiment and all of its data (definition, assignments, exposures,
317
+ * tallies). Bounded + self-rescheduling; returns the rows removed this pass.
318
+ * Idempotent and safe on an absent experiment.
319
+ */
320
+ deleteExperiment(
321
+ ctx: RunMutationCtx,
322
+ key: string,
323
+ opts: { scope?: string; batch?: number } = {},
324
+ ): Promise<number> {
325
+ return ctx.runMutation(this.component.mutations.deleteExperiment, {
326
+ scope: this.scopeOf(opts.scope),
327
+ key,
328
+ batch: opts.batch ?? DEFAULT_DELETE_BATCH,
329
+ });
330
+ }
331
+ }
332
+
333
+ export type {
334
+ Assignment,
335
+ AssignOutcome,
336
+ DefineOptions,
337
+ ExperimentDefinition,
338
+ ExperimentsOptions,
339
+ ExperimentStatus,
340
+ ExposureOutcome,
341
+ Variant,
342
+ VariantResult,
343
+ };
@@ -0,0 +1,78 @@
1
+ /** Public TypeScript surface for the experiments client. */
2
+
3
+ /** A weighted variant — an opaque variant key and its relative selection weight. */
4
+ export interface Variant {
5
+ /** The host's opaque variant key (e.g. `"control"`, `"treatment"`). */
6
+ key: string;
7
+ /** Relative selection weight; the bucket width is `weight / sum(weights)`. */
8
+ weight: number;
9
+ }
10
+
11
+ /** Experiment lifecycle status. `running` is the only status that enrolls subjects. */
12
+ export type ExperimentStatus = "draft" | "running" | "stopped";
13
+
14
+ /** Construction options for the {@link Experiments} client. */
15
+ export interface ExperimentsOptions {
16
+ /** Namespace applied when a call omits `scope`. Default `"global"`. */
17
+ defaultScope?: string;
18
+ /** Status applied by `define` when a call omits `status`. Default `"running"`. */
19
+ defaultStatus?: ExperimentStatus;
20
+ }
21
+
22
+ /** Per-call overrides for {@link Experiments.define}. */
23
+ export interface DefineOptions {
24
+ /** Namespace for this experiment. Defaults to the client `defaultScope`. */
25
+ scope?: string;
26
+ /**
27
+ * Hash salt for deterministic assignment. Defaults to the experiment `key`.
28
+ * Fixed once any subject is assigned (changing it after enrollment throws
29
+ * `EXPERIMENT_LOCKED`); to re-randomize, define a new experiment key.
30
+ */
31
+ salt?: string;
32
+ /** Initial lifecycle status. Defaults to the client `defaultStatus`. */
33
+ status?: ExperimentStatus;
34
+ }
35
+
36
+ /** An experiment definition, as returned by {@link Experiments.getExperiment}. */
37
+ export interface ExperimentDefinition {
38
+ key: string;
39
+ scope: string;
40
+ status: ExperimentStatus;
41
+ variants: Variant[];
42
+ salt: string;
43
+ /** Absolute ms timestamp the experiment was first defined. */
44
+ createdAt: number;
45
+ }
46
+
47
+ /** A subject's sticky assignment, as returned by {@link Experiments.getAssignment}. */
48
+ export interface Assignment {
49
+ variant: string;
50
+ /** Absolute ms timestamp the assignment was first persisted. */
51
+ assignedAt: number;
52
+ }
53
+
54
+ /**
55
+ * Outcome of {@link Experiments.assign}. `{ variant: null }` — not enrolled
56
+ * (experiment absent or not running). `{ variant, isNew }` — the enrolled variant,
57
+ * with `isNew` true only on the call that first persisted the assignment.
58
+ */
59
+ export type AssignOutcome =
60
+ | { variant: null }
61
+ | { variant: string; isNew: boolean };
62
+
63
+ /** Outcome of {@link Experiments.logExposure}: the variant, or `null` if not enrolled. */
64
+ export type ExposureOutcome = { variant: string | null };
65
+
66
+ /** A per-variant tally, as returned by {@link Experiments.results}. */
67
+ export interface VariantResult {
68
+ /** The variant key. */
69
+ variant: string;
70
+ /** Subjects assigned to this variant (the realized split, for SRM). */
71
+ assigned: number;
72
+ /** Distinct subjects exposed to this variant (the funnel denominator). */
73
+ subjects: number;
74
+ /** Total exposure events recorded for this variant. */
75
+ exposures: number;
76
+ /** The configured weight from the current definition (0 if the variant is gone). */
77
+ weight: number;
78
+ }
@@ -0,0 +1,54 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated `api` utility.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+
11
+ import type * as mutations from "../mutations.js";
12
+ import type * as queries from "../queries.js";
13
+ import type * as validators from "../validators.js";
14
+
15
+ import type {
16
+ ApiFromModules,
17
+ FilterApi,
18
+ FunctionReference,
19
+ } from "convex/server";
20
+ import { anyApi, componentsGeneric } from "convex/server";
21
+
22
+ const fullApi: ApiFromModules<{
23
+ mutations: typeof mutations;
24
+ queries: typeof queries;
25
+ validators: typeof validators;
26
+ }> = anyApi as any;
27
+
28
+ /**
29
+ * A utility for referencing Convex functions in your app's public API.
30
+ *
31
+ * Usage:
32
+ * ```js
33
+ * const myFunctionReference = api.myModule.myFunction;
34
+ * ```
35
+ */
36
+ export const api: FilterApi<
37
+ typeof fullApi,
38
+ FunctionReference<any, "public">
39
+ > = anyApi as any;
40
+
41
+ /**
42
+ * A utility for referencing Convex functions in your app's internal API.
43
+ *
44
+ * Usage:
45
+ * ```js
46
+ * const myFunctionReference = internal.myModule.myFunction;
47
+ * ```
48
+ */
49
+ export const internal: FilterApi<
50
+ typeof fullApi,
51
+ FunctionReference<any, "internal">
52
+ > = anyApi as any;
53
+
54
+ export const components = componentsGeneric() as unknown as {};