@confect/core 10.0.0-next.15 → 10.0.0-next.18

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 (70) hide show
  1. package/CHANGELOG.md +246 -0
  2. package/dist/FunctionProvenance.d.ts +18 -18
  3. package/dist/FunctionProvenance.d.ts.map +1 -1
  4. package/dist/FunctionProvenance.js +1 -1
  5. package/dist/FunctionProvenance.js.map +1 -1
  6. package/dist/FunctionSpec.d.ts +54 -48
  7. package/dist/FunctionSpec.d.ts.map +1 -1
  8. package/dist/FunctionSpec.js +23 -5
  9. package/dist/FunctionSpec.js.map +1 -1
  10. package/dist/GroupPath.d.ts +1 -4
  11. package/dist/GroupPath.d.ts.map +1 -1
  12. package/dist/GroupPath.js.map +1 -1
  13. package/dist/GroupSpec.d.ts +16 -10
  14. package/dist/GroupSpec.d.ts.map +1 -1
  15. package/dist/GroupSpec.js +34 -11
  16. package/dist/GroupSpec.js.map +1 -1
  17. package/dist/Lazy.d.ts +2 -3
  18. package/dist/Lazy.d.ts.map +1 -1
  19. package/dist/Lazy.js +2 -3
  20. package/dist/Lazy.js.map +1 -1
  21. package/dist/MiddlewareSpec.d.ts +184 -0
  22. package/dist/MiddlewareSpec.d.ts.map +1 -0
  23. package/dist/MiddlewareSpec.js +55 -0
  24. package/dist/MiddlewareSpec.js.map +1 -0
  25. package/dist/Ref.d.ts +53 -37
  26. package/dist/Ref.d.ts.map +1 -1
  27. package/dist/Ref.js +53 -35
  28. package/dist/Ref.js.map +1 -1
  29. package/dist/Refs.d.ts +8 -3
  30. package/dist/Refs.d.ts.map +1 -1
  31. package/dist/Refs.js +3 -3
  32. package/dist/Refs.js.map +1 -1
  33. package/dist/SchemaToValidator.d.ts +99 -0
  34. package/dist/SchemaToValidator.d.ts.map +1 -0
  35. package/dist/SchemaToValidator.js +156 -0
  36. package/dist/SchemaToValidator.js.map +1 -0
  37. package/dist/Spec.d.ts +3 -2
  38. package/dist/Spec.d.ts.map +1 -1
  39. package/dist/Spec.js +1 -1
  40. package/dist/Spec.js.map +1 -1
  41. package/dist/Table.d.ts +74 -0
  42. package/dist/Table.d.ts.map +1 -0
  43. package/dist/Table.js +77 -0
  44. package/dist/Table.js.map +1 -0
  45. package/dist/Types.d.ts +8 -2
  46. package/dist/Types.d.ts.map +1 -1
  47. package/dist/Types.js.map +1 -1
  48. package/dist/index.d.ts +3 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +4 -2
  51. package/package.json +9 -8
  52. package/src/FunctionProvenance.ts +8 -8
  53. package/src/FunctionSpec.ts +93 -14
  54. package/src/GroupPath.ts +1 -6
  55. package/src/GroupSpec.ts +125 -18
  56. package/src/Lazy.ts +2 -3
  57. package/src/MiddlewareSpec.ts +356 -0
  58. package/src/Ref.ts +310 -205
  59. package/src/Refs.ts +40 -16
  60. package/src/SchemaToValidator.ts +601 -0
  61. package/src/Spec.ts +4 -4
  62. package/src/Table.ts +426 -0
  63. package/src/Types.ts +9 -3
  64. package/src/index.ts +3 -1
  65. package/dist/Registry.d.ts +0 -24
  66. package/dist/Registry.d.ts.map +0 -1
  67. package/dist/Registry.js +0 -19
  68. package/dist/Registry.js.map +0 -1
  69. package/dist/tsconfig.src.tsbuildinfo +0 -1
  70. package/src/Registry.ts +0 -30
package/CHANGELOG.md CHANGED
@@ -1,5 +1,251 @@
1
1
  # @confect/core
2
2
 
3
+ ## 10.0.0-next.18
4
+
5
+ ### Minor Changes
6
+
7
+ - 91aebe4: Move `Table.make` to `@confect/core` so a spec that returns `notes.Doc` from `_generated/tables/notes` no longer ships `@confect/server` to the client.
8
+
9
+ ```ts confect/tables/notes.ts
10
+ import { Table } from "@confect/core";
11
+ import * as Schema from "effect/Schema";
12
+
13
+ export default Table.make(() =>
14
+ Schema.Struct({
15
+ text: Schema.String,
16
+ }),
17
+ );
18
+ ```
19
+
20
+ `confect codegen` now fails if any module a spec reaches value-imports `@confect/server`, including `confect/tables/` and `_generated/`. Type-only imports remain allowed.
21
+
22
+ ## 10.0.0-next.17
23
+
24
+ ### Minor Changes
25
+
26
+ - 126548a: Add middleware: reusable logic that runs around a group's function handlers, provides Effect services to them, and fails with typed errors that reach clients.
27
+
28
+ Middleware lives in a reserved `confect/middleware/` directory, one `<Name>.spec.ts`/`<Name>.impl.ts` pair per middleware. Confect no longer scans that directory for function groups, so a group can no longer be defined at `confect/middleware/...`.
29
+
30
+ Declare a middleware's client-safe interface with `MiddlewareSpec.MiddlewareSpec` — its `provides` service (type-level), its `error` schema, and the function types it may cover (`functionTypes`, one required boolean flag per function type, so every spec states its coverage outright) — and attach it in a group spec with `GroupSpec.middleware`:
31
+
32
+ ```ts confect/middleware/RequireUser.spec.ts
33
+ import { MiddlewareSpec } from "@confect/core";
34
+
35
+ export class CurrentUser extends Context.Service<
36
+ CurrentUser,
37
+ {
38
+ readonly user: User;
39
+ }
40
+ >()("confect/middleware/RequireUser.spec/CurrentUser") {}
41
+
42
+ export class NotSignedIn extends Schema.TaggedError<NotSignedIn>()(
43
+ "NotSignedIn",
44
+ {},
45
+ ) {}
46
+
47
+ export default class RequireUser extends MiddlewareSpec.MiddlewareSpec<
48
+ RequireUser,
49
+ {
50
+ provides: CurrentUser;
51
+ }
52
+ >()("RequireUser", {
53
+ error: () => NotSignedIn,
54
+ functionTypes: { query: true, mutation: true, action: false },
55
+ }) {}
56
+ ```
57
+
58
+ ```ts confect/notes.spec.ts
59
+ import RequireUser from "./middleware/RequireUser.spec";
60
+
61
+ export default GroupSpec.make()
62
+ .middleware(RequireUser)
63
+ .addFunction(FunctionSpec.publicMutation({ ... }));
64
+ ```
65
+
66
+ Handlers of covered functions can then consume the provided service — a handler requiring `CurrentUser` type-checks exactly when a middleware providing it is attached to the group. Implement the middleware server-side with `MiddlewareImpl.make` (one strategy for all declared function types), `MiddlewareImpl.makeByFunctionType` (one per function type — the recommended shape for database-touching middleware that also covers actions), or the `MiddlewareImpl.provides` shorthand, and provide it to the group's impl layer like any function implementation:
67
+
68
+ ```ts confect/middleware/RequireUser.impl.ts
69
+ import { MiddlewareImpl } from "@confect/server";
70
+
71
+ export default MiddlewareImpl.provides(
72
+ databaseSchema,
73
+ RequireUser,
74
+ CurrentUser,
75
+ Effect.gen(function* () {
76
+ // load the user; `return yield* new NotSignedIn()` short-circuits
77
+ return { user };
78
+ }),
79
+ );
80
+ ```
81
+
82
+ ```ts confect/notes.impl.ts
83
+ import RequireUser from "./middleware/RequireUser.impl";
84
+
85
+ export default GroupImpl.make(databaseSchema, group).pipe(
86
+ Layer.provide(createNote),
87
+ Layer.provide(RequireUser), // omitting this is a compile error at `GroupImpl.finalize`
88
+ GroupImpl.finalize,
89
+ );
90
+ ```
91
+
92
+ Middleware runs per invocation, after args are decoded and before the handler, in attachment order; a middleware failure short-circuits the rest of the chain. Its errors join the covered functions' error unions end to end: `useQuery`/`useMutation` and the `@confect/js` clients surface them as typed errors with no client-side changes.
93
+
94
+ Middleware can also attach to a single function with `.middleware()` on the function spec — it runs inside the group-attached chain, immediately around the handler, and its errors join only that function's error union:
95
+
96
+ ```ts
97
+ FunctionSpec.publicMutation({ name: "deleteAll", ... }).middleware(RequireAdmin);
98
+ ```
99
+
100
+ A middleware can depend on one that runs earlier in the chain by declaring `requires` in its `Config` type parameter — its implementation may then consume the required service (e.g. `RequireAdmin` reading the `CurrentUser` that `RequireUser` provides). Satisfaction is type-checked at `GroupSpec.middleware` for group attachments and at `GroupImpl.make` for whole groups.
101
+
102
+ Attaching the same middleware twice (including once at group level and once at function level), attaching one whose `functionTypes` don't cover a covered function's type, attaching any middleware to a plain-Convex function, or attaching to a group containing a matching-type plain-Convex function are all type errors. Middleware does not propagate to subgroups. `confect codegen` fails with an explicit error when a group's spec attaches a middleware its impl never provides.
103
+
104
+ Because every `*.spec.ts` is reachable from `_generated/refs.ts`, which clients import, a spec's whole import graph is bundled into the browser — so an implementation co-located with its declaration ships server logic (table names, index names, authorization checks) to users. `confect codegen` now fails when any module a spec reaches value-imports `@confect/server`, outside the `tables/` and `_generated/` directories that legitimately need it. Type-only imports are erased before bundling and remain allowed.
105
+
106
+ ### Patch Changes
107
+
108
+ - 8e4962e: Raise the required `effect` peer version to `^4.0.0-rc.111` (from `^4.0.0-rc.110`), and `@confect/server`'s optional `@effect/platform-node` peer version likewise.
109
+
110
+ No Confect API changed, and no call-site edits are needed. `rc.111` is a patch release of Effect with nothing removed or renamed, so upgrading is a matter of installing it alongside `@confect/*`.
111
+
112
+ ## 10.0.0-next.16
113
+
114
+ ### Major Changes
115
+
116
+ - Migrate to Effect v4. All `@confect/*` packages now require `effect@^4.0.0-beta.97`; `@effect/platform` and `@effect/cli` are no longer dependencies (their functionality moved into `effect` core and `effect/unstable/*`).
117
+
118
+ Breaking changes for users:
119
+
120
+ - **Schemas** follow Effect v4's Schema API: `Schema.Union([a, b])` (array form), `Schema.Literals([...])` for literal unions, `Schema.optionalKey` in place of `optionalWith({ exact: true })`, and checks like `Schema.String.check(Schema.isMaxLength(...))` in place of piped filters.
121
+ - **Option-returning functions** must use a codec with a serializable encoded form, such as `Schema.OptionFromNullOr(...)` — v4's `Schema.Option` encodes to an `Option` instance, which is not a Convex value.
122
+ - **Table schemas** may now be transformations (`Schema.decodeTo` chains, `Schema.encodeKeys`), branded structs, suspended schemas, or unions of these — Convex's system fields are carried through the whole encoding chain. Schemas that do not resolve to an object shape at every step (such as `Schema.Class`) are rejected with a descriptive error when the table is defined.
123
+ - **Clients**: decode failures surface as `SchemaError` rather than `ParseError` in `@confect/js` and `@confect/react`, and `@confect/react`'s `useMutation`/`useAction` handles with an `error` schema now resolve to `Result` (v4's replacement for `Either`).
124
+ - **HTTP** is now mounted through the renamed `HttpRouter` module (formerly `HttpApi`). `HttpRouter.make(routes)` takes a single route-registering `Layer` composed from Effect's own `effect/unstable/http` and `effect/unstable/httpapi` modules — `HttpApiBuilder.layer(api)` (with group handler layers supplied via `Layer.provide`; a missing group is a compile-time error), `HttpApiScalar.layer` for docs, `HttpRouter.add` for plain routes, and `HttpRouter.middleware(fn, { global: true })` for middleware, merged with `Layer.mergeAll`. The per-path-prefix record and its `api`/`apiLive`/`middleware`/`scalar` options are gone; Confect registers one catch-all Convex HTTP action at `/`, and plain Convex routes added to the returned router still take precedence. Handlers, middleware, and route-layer construction all run with Confect's Convex-aware `ConfigProvider` in context.
125
+ - **Node actions** use `effect/unstable/process` (`ChildProcessSpawner`) and `@effect/platform-node`'s `NodeServices` in place of `@effect/platform` `Command`/`NodeContext`.
126
+ - **Configuration**: Confect's Convex-aware `ConfigProvider` treats empty-string environment variables as missing values (matching Effect v4's built-in providers), so `Config.withDefault` and `Config.option` recover from them.
127
+ - **CLI**: a malformed `convex.json` now fails codegen with a descriptive error instead of being silently ignored.
128
+ - Confect queries no longer stub the global `Date.now`. Queries run with a `Clock` whose unsafe accessors return constants, so Effect-internal reads (log timestamps, spans) never evict a query from Convex's cache; explicit time reads — `Clock.currentTimeMillis`/`currentTimeNanos` or a raw `Date.now()` call — opt the query out and evict as they honestly should.
129
+
130
+ ### Patch Changes
131
+
132
+ - Raise the required `effect` peer version to `^4.0.0-beta.100` (from `^4.0.0-beta.99`).
133
+
134
+ This is a peer-range-only change with no consumer-visible API consequences. The `beta.100` release only touches `Cron` internals (month/weekday alias normalization, day/weekday rollover, and equality/hashing), CLI error message formatting (`InvalidValue` prefixes), and `Schema.toTaggedUnion` discriminants that Confect doesn't use.
135
+
136
+ - Raise the required `effect` peer version to `^4.0.0-beta.101` (from `^4.0.0-beta.100`).
137
+
138
+ This is a peer-range-only change with no consumer-visible API consequences. The `beta.101` release only touches fiber/concurrency internals (interrupt handling in concurrent traversal, stack frame annotations, `awaitAllChildren` linearization, `interruptibleMask` interrupt delivery), a `MutableList.filter` fix for empty buckets, a `Schema.Struct` required-readonly-field type display simplification, and an `HttpRouter.toWebHandler` middleware type-inference tightening that Confect doesn't need to accommodate.
139
+
140
+ - Raise the required `effect` peer version to `^4.0.0-beta.102` (from `^4.0.0-beta.101`), and `@confect/server`'s optional `@effect/platform-node` peer version likewise.
141
+ - Raise the required `effect` peer version to `^4.0.0-beta.105` (from `^4.0.0-beta.102`), and `@confect/server`'s optional `@effect/platform-node` peer version likewise.
142
+
143
+ `beta.103` separates wall-clock time from monotonic elapsed time: `Clock.Clock` now also requires `monotonicTimeNanos` and `monotonicTimeNanosUnsafe`, so a custom `Clock` provided to a Confect function has to supply both. Effects that measure elapsed time — `Effect.timed`, duration metrics, `Sink.withDuration` — read the monotonic accessors instead of the wall clock, and continue to report a zero duration inside queries and mutations, where Confect pins the unsafe accessors to constants to keep Convex's query cache from evicting on every logged span.
144
+
145
+ `beta.103` also moves synchronous Effect runs off `setImmediate`/`setTimeout` and onto the microtask queue, which Convex's query and mutation isolate permits. Confect no longer suppresses cooperative fiber yielding for the synchronous work it performs while your modules load — registration and schema-to-validator compilation — and relies on that scheduling instead. Neither the "Can't use `setTimeout` in queries and mutations" crash nor any other consumer-visible behavior changes, but this is the area to look at if module loading starts misbehaving.
146
+
147
+ `beta.104` renames Effect's schema error constructors to match their `Data` counterparts, which affects any error schema you declare for a Confect function:
148
+
149
+ **Before:**
150
+
151
+ ```ts
152
+ export class NoteNotFound extends Schema.TaggedErrorClass<NoteNotFound>()(
153
+ "NoteNotFound",
154
+ { noteId: Id("notes") },
155
+ ) {}
156
+ ```
157
+
158
+ **After:**
159
+
160
+ ```ts
161
+ export class NoteNotFound extends Schema.TaggedError<NoteNotFound>()(
162
+ "NoteNotFound",
163
+ { noteId: Id("notes") },
164
+ ) {}
165
+ ```
166
+
167
+ `Schema.ErrorClass` is likewise now `Schema.Error`; the schema for JavaScript `Error` instances that previously went by `Schema.Error` is now `Schema.ErrorInstance`, and `Schema.ErrorReviver` is now `Schema.ErrorInstanceReviver`. Confect's own error types — `DocumentDecodeError`, `BlobNotFoundError`, and the rest — are unchanged in name, shape, and message.
168
+
169
+ `beta.105` restructures how schema validation failures are reported, but not on the path Confect puts you on: decode and encode failures still surface as `Schema.SchemaError` with a formatted `message`, so error text from `@confect/js`, `@confect/react`, and document decoding is unchanged.
170
+
171
+ - Raise the required `effect` peer version to `^4.0.0-beta.106` (from `^4.0.0-beta.105`), and `@confect/server`'s optional `@effect/platform-node` peer version likewise.
172
+
173
+ `beta.106` is a patch-only Effect release. Nothing in Confect's own API changes, and your table, argument, and returns schemas still compile to the same Convex validators.
174
+
175
+ One Effect change needs a call-site edit if you derive property-test generators from those schemas: `Schema.toArbitrary` now returns a factory that takes the `fast-check` module instead of returning an arbitrary directly, and `Schema.toArbitraryLazy` and the `{ report: true }` option are gone.
176
+
177
+ **Before:**
178
+
179
+ ```ts
180
+ const NoteArbitrary = Schema.toArbitrary(Note);
181
+ ```
182
+
183
+ **After:**
184
+
185
+ ```ts
186
+ import * as FastCheck from "fast-check";
187
+
188
+ const NoteArbitrary = Schema.toArbitrary(Note)(FastCheck);
189
+ ```
190
+
191
+ HTTP actions written against `HttpRouter` also inherit Effect's stricter multipart handling: a request that exceeds the configured part count, part size, or field size limits now stops being parsed at the limit rather than being read to completion first.
192
+
193
+ - Raise the required `effect` peer version to `^4.0.0-beta.107` (from `^4.0.0-beta.106`), and `@confect/server`'s optional `@effect/platform-node` peer version likewise.
194
+
195
+ `beta.107` is a patch-only Effect release, so no Confect API changes and no call-site edits are needed — upgrade `effect` alongside `@confect/*` and everything you have written keeps compiling. Your table, argument, and returns schemas still produce the same Convex validators.
196
+
197
+ Two Effect fixes are worth knowing about if they touch your code. HTTP actions written with `HttpRouter` now collect uploaded file contents far faster on large multipart bodies, and a file part whose stream is cut short — because a parser limit was exceeded or the request body ended early — now fails instead of hanging. Separately, `Duration` values that are equal now hash equally, so a `Duration` used as a `HashMap` key or a `HashSet` member is found regardless of which constructor built it.
198
+
199
+ - Raise the required `effect` peer version to `^4.0.0-beta.98` (from `^4.0.0-beta.97`).
200
+
201
+ `effect`'s `SchemaError` is now exposed as its own public module (`effect/SchemaError`), which changes the import path TypeScript picks when Confect emits `.d.ts` declarations that reference `Schema.SchemaError` (for example in generated `services.d.ts`). Existing `Schema.SchemaError` / `Schema.isSchemaError` usage is unaffected — this is purely a declaration-emit detail that consumers relying on generated types may notice.
202
+
203
+ - Raise the required `effect` peer version to `^4.0.0-beta.99` (from `^4.0.0-beta.98`).
204
+
205
+ This is a peer-range-only change with no consumer-visible API consequences. The `beta.99` release only touches `Graph`, CLI (`Command`/`CliConfig`/wizard mode), `Tool` cloning, Redis script eval, and multipart parser internals that Confect doesn't use.
206
+
207
+ - Raise the required `effect` peer version to `^4.0.0-rc.108` (from `^4.0.0-beta.107`), and `@confect/server`'s optional `@effect/platform-node` peer version likewise. Effect v4 has left beta for release candidates, so `effect@rc` is now the tag to install alongside `@confect/*`.
208
+
209
+ No Confect API changed, and no call-site edits are needed for Confect itself. One Effect change can reach your code: the standalone `effect/SchemaError` module is gone, and `SchemaError` is now exported from `Schema`. Confect still fails decoding with the same error, so this only matters if you name the type when handling it.
210
+
211
+ Before:
212
+
213
+ ```ts
214
+ import type { SchemaError } from "effect/SchemaError";
215
+ ```
216
+
217
+ After:
218
+
219
+ ```ts
220
+ import type { SchemaError } from "effect/Schema";
221
+ ```
222
+
223
+ Also worth knowing if you serve an `HttpApi`: a query parameter declared as an array now decodes correctly when a request supplies exactly one value for it.
224
+
225
+ One internal change rides along. Queries and mutations that run long enough to trigger a cooperative fiber yield now take that yield from Effect's own scheduler, which `rc.108` made usable inside Convex's isolate for the first time. The underlying microtask primitive is identical, so behavior should not change — but it is the thing to look at if a long-running query or mutation regresses on this release.
226
+
227
+ - Raise the required `effect` peer version to `^4.0.0-rc.109` (from `^4.0.0-rc.108`), and `@confect/server`'s optional `@effect/platform-node` peer version likewise.
228
+
229
+ No Confect API changed, and no call-site edits are needed. `rc.109` is a patch release of Effect with nothing removed or renamed, so upgrading is a matter of installing it alongside `@confect/*`.
230
+
231
+ - 8e4962e: Raise the required `effect` peer version to `^4.0.0-rc.110` (from `^4.0.0-rc.109`), and `@confect/server`'s optional `@effect/platform-node` peer version likewise.
232
+
233
+ No Confect API changed, and no call-site edits are needed. `rc.110` is a patch release of Effect with nothing removed or renamed, so upgrading is a matter of installing it alongside `@confect/*`.
234
+
235
+ - 3f0255c: Build and test against `convex` 1.44.0. The published `convex` peer ranges are unchanged, so no consumer action is required.
236
+ - The schemas Confect uses for values Convex itself produces now reject `NaN` and `±Infinity`: `_creationTime`, a scheduled function's `scheduledTime` and `completedTime`, a stored file's `size`, and the fields of `PaginationOptions`. Convex cannot return a non-finite value for any of them, so this rules out states that were never reachable.
237
+
238
+ The Convex validators these compile to are unchanged — each is still `v.float64()` — so nothing changes about what your deployment accepts. Only Confect's decoding is narrower. Your own table schemas are untouched: `Schema.Number` still accepts non-finite values wherever you use it, which matters because Convex stores them.
239
+
240
+ - Sync with `main`: this prerelease line now includes all changes released in `@confect/*` 9.2.2–9.2.4 — see those versions' changelog entries.
241
+ - Sync with `main`: this prerelease line now includes all changes released in `@confect/*` 9.2.5 — see that version's changelog entries.
242
+ - Sync with `main`: this prerelease line now includes all changes released in `@confect/*` 9.3.0 — see that version's changelog entries.
243
+ - Sync with `main`: this prerelease line now includes all changes released in `@confect/*` 9.4.0 — see that version's changelog entries.
244
+
245
+ The `@effect/platform` and `@effect/cli` peer and dependency floors that 9.4.0 raises do not apply here: this line runs on Effect v4, where those packages are not dependencies at all.
246
+
247
+ - The published type declarations are now emitted by TypeScript 7 rather than TypeScript 6. No API changed, but the declaration text differs in places, so an inferred type printed in your editor or in a type error may read slightly differently than before.
248
+
3
249
  ## 10.0.0-next.15
4
250
 
5
251
  ### Patch Changes
@@ -43,8 +43,8 @@ export interface AnyConfect extends Confect<Schema.Codec<any, any>, Schema.Codec
43
43
  }
44
44
  export interface Convex<Args extends DefaultFunctionArgs, Returns> {
45
45
  readonly _tag: "Convex";
46
- readonly _args: Args;
47
- readonly _returns: Returns;
46
+ readonly "~args": Args;
47
+ readonly "~returns": Returns;
48
48
  }
49
49
  export interface AnyConvex extends Convex<DefaultFunctionArgs, any> {
50
50
  }
@@ -59,8 +59,8 @@ export declare const FunctionProvenance: {
59
59
  readonly _tag: Tag;
60
60
  }> | Extract<{
61
61
  readonly _tag: "Convex";
62
- readonly _args: DefaultFunctionArgs;
63
- readonly _returns: any;
62
+ readonly "~args": DefaultFunctionArgs;
63
+ readonly "~returns": any;
64
64
  }, {
65
65
  readonly _tag: Tag;
66
66
  }>;
@@ -73,8 +73,8 @@ export declare const FunctionProvenance: {
73
73
  readonly kind: ConfectKind;
74
74
  } | {
75
75
  readonly _tag: "Convex";
76
- readonly _args: DefaultFunctionArgs;
77
- readonly _returns: any;
76
+ readonly "~args": DefaultFunctionArgs;
77
+ readonly "~returns": any;
78
78
  }, {
79
79
  readonly _tag: Tag;
80
80
  }>) => any; }>(cases: Cases): (value: {
@@ -85,8 +85,8 @@ export declare const FunctionProvenance: {
85
85
  readonly kind: ConfectKind;
86
86
  } | {
87
87
  readonly _tag: "Convex";
88
- readonly _args: DefaultFunctionArgs;
89
- readonly _returns: any;
88
+ readonly "~args": DefaultFunctionArgs;
89
+ readonly "~returns": any;
90
90
  }) => import("effect/Unify").Unify<ReturnType<Cases["Confect" | "Convex"]>>;
91
91
  <Cases extends { readonly [Tag in "Confect" | "Convex"]: (args: Extract<{
92
92
  readonly _tag: "Confect";
@@ -96,8 +96,8 @@ export declare const FunctionProvenance: {
96
96
  readonly kind: ConfectKind;
97
97
  } | {
98
98
  readonly _tag: "Convex";
99
- readonly _args: DefaultFunctionArgs;
100
- readonly _returns: any;
99
+ readonly "~args": DefaultFunctionArgs;
100
+ readonly "~returns": any;
101
101
  }, {
102
102
  readonly _tag: Tag;
103
103
  }>) => any; }>(value: {
@@ -108,8 +108,8 @@ export declare const FunctionProvenance: {
108
108
  readonly kind: ConfectKind;
109
109
  } | {
110
110
  readonly _tag: "Convex";
111
- readonly _args: DefaultFunctionArgs;
112
- readonly _returns: any;
111
+ readonly "~args": DefaultFunctionArgs;
112
+ readonly "~returns": any;
113
113
  }, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Confect" | "Convex"]>>;
114
114
  };
115
115
  readonly Confect: Data.TaggedEnum.ConstructorFrom<{
@@ -121,15 +121,15 @@ export declare const FunctionProvenance: {
121
121
  }, "_tag">;
122
122
  readonly Convex: Data.TaggedEnum.ConstructorFrom<{
123
123
  readonly _tag: "Convex";
124
- readonly _args: DefaultFunctionArgs;
125
- readonly _returns: any;
124
+ readonly "~args": DefaultFunctionArgs;
125
+ readonly "~returns": any;
126
126
  }, "_tag">;
127
127
  };
128
128
  /**
129
129
  * Build a `Confect` provenance from lazy schema thunks. `args`, `returns`,
130
130
  * and `error` are exposed as sync lazy memoised getters (via {@link Lazy.defineProperty})
131
131
  * that only evaluate their thunk on first access, mirroring how `Table`
132
- * defers `Fields`/`Doc`/`tableDefinition`. This keeps importing the assembled
132
+ * defers `Fields`/`Doc`. This keeps importing the assembled
133
133
  * `_generated/spec.ts` cheap — no `Schema.Struct(...)` / `Schema.Array(...)`
134
134
  * work runs at module load; it is deferred to the first invocation that
135
135
  * actually compiles validators or runs a codec.
@@ -183,9 +183,9 @@ export interface AnyConfectPaginated extends ConfectPaginated<AnyUserArgs, Schem
183
183
  * composed schemas can never drift from the stored user schemas.
184
184
  */
185
185
  export declare const ConfectPaginated: <UserArgs extends AnyUserArgs, Item extends Schema.Codec<any, any>, Error extends Schema.Codec<any, any> = never>(userArgs: () => UserArgs, item: () => Item, error?: () => Error) => ConfectPaginated<UserArgs, Item, Error>;
186
- export declare const Convex: <_Args extends DefaultFunctionArgs, _Returns>() => {
186
+ export declare const Convex: <Args extends DefaultFunctionArgs, Returns>() => {
187
187
  readonly _tag: "Convex";
188
- readonly _args: DefaultFunctionArgs;
189
- readonly _returns: any;
188
+ readonly "~args": DefaultFunctionArgs;
189
+ readonly "~returns": any;
190
190
  };
191
191
  //# sourceMappingURL=FunctionProvenance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FunctionProvenance.d.ts","sourceRoot":"","sources":["../src/FunctionProvenance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,M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SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAC1B;CAAG;AAEJ,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB,CAC3D,WAAW,EACX,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,EACtB,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CACvB;CAAG;AAEJ;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,SAAS,WAAW,EAC5B,IAAI,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,EACnC,KAAK,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,KAAK,YAElC,MAAM,QAAQ,QAClB,MAAM,IAAI,UACR,MAAM,KAAK,KAClB,gBAAgB,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,CAkCxC,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,IAAI,SAAS,mBAAmB,EAAE,OAAO;;sBAjNnD,mBAAmB;yBAEhB,GAAG;CAqNhB,CAAC"}
@@ -17,7 +17,7 @@ const Standard = { _tag: "Standard" };
17
17
  * Build a `Confect` provenance from lazy schema thunks. `args`, `returns`,
18
18
  * and `error` are exposed as sync lazy memoised getters (via {@link Lazy.defineProperty})
19
19
  * that only evaluate their thunk on first access, mirroring how `Table`
20
- * defers `Fields`/`Doc`/`tableDefinition`. This keeps importing the assembled
20
+ * defers `Fields`/`Doc`. This keeps importing the assembled
21
21
  * `_generated/spec.ts` cheap — no `Schema.Struct(...)` / `Schema.Array(...)`
22
22
  * work runs at module load; it is deferred to the first invocation that
23
23
  * actually compiles validators or runs a codec.
@@ -1 +1 @@
1
- {"version":3,"file":"FunctionProvenance.js","names":["PaginationOptions.PaginationOptions","PaginationResult.PaginationResult"],"sources":["../src/FunctionProvenance.ts"],"sourcesContent":["import type { DefaultFunctionArgs } from \"convex/server\";\nimport * as Data from \"effect/Data\";\nimport * as Schema from \"effect/Schema\";\nimport * as Lazy from \"./Lazy\";\nimport * as PaginationOptions from \"./PaginationOptions\";\nimport * as PaginationResult from \"./PaginationResult\";\n\nexport type FunctionProvenance = Data.TaggedEnum<{\n Confect: {\n args: Schema.Codec<any, any>;\n returns: Schema.Codec<any, any>;\n error?: Schema.Codec<any, any>;\n kind: ConfectKind;\n };\n Convex: {\n /** @internal */\n _args: DefaultFunctionArgs;\n /** @internal */\n _returns: any;\n };\n}>;\n\n/**\n * The declaration shape of a Confect function — orthogonal to both the\n * provenance origin (Confect vs Convex) and the function type\n * (query/mutation/action). A `Standard` function declares its `args` and\n * `returns` schemas directly; a `Paginated` function declares `userArgs` and\n * `item` schemas from which the Convex-facing `args`/`returns` are composed.\n */\nexport type ConfectKind = Standard | Paginated;\n\nexport interface Standard {\n readonly _tag: \"Standard\";\n}\n\nexport interface Paginated<\n UserArgs extends AnyUserArgs = AnyUserArgs,\n Item extends Schema.Codec<any, any> = Schema.Codec<any, any>,\n> {\n readonly _tag: \"Paginated\";\n /** User-declared args — no `paginationOpts`. */\n readonly userArgs: UserArgs;\n /** Page element schema. */\n readonly item: Item;\n /** Mutable array of items — the page decode target. */\n readonly page: Schema.Codec<any, any>;\n}\n\nexport interface Confect<\n Args extends Schema.Codec<any, any>,\n Returns extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n Kind extends ConfectKind = ConfectKind,\n> {\n readonly _tag: \"Confect\";\n readonly args: Args;\n readonly returns: Returns;\n readonly error?: Error;\n readonly kind: Kind;\n}\n\nexport interface AnyConfect extends Confect<\n Schema.Codec<any, any>,\n Schema.Codec<any, any>,\n Schema.Codec<any, any>\n> {}\n\nexport interface Convex<Args extends DefaultFunctionArgs, Returns> {\n readonly _tag: \"Convex\";\n readonly _args: Args;\n readonly _returns: Returns;\n}\n\nexport interface AnyConvex extends Convex<DefaultFunctionArgs, any> {}\n\nexport const FunctionProvenance = Data.taggedEnum<FunctionProvenance>();\n\nconst Standard: Standard = { _tag: \"Standard\" };\n\n/**\n * Build a `Confect` provenance from lazy schema thunks. `args`, `returns`,\n * and `error` are exposed as sync lazy memoised getters (via {@link Lazy.defineProperty})\n * that only evaluate their thunk on first access, mirroring how `Table`\n * defers `Fields`/`Doc`/`tableDefinition`. This keeps importing the assembled\n * `_generated/spec.ts` cheap — no `Schema.Struct(...)` / `Schema.Array(...)`\n * work runs at module load; it is deferred to the first invocation that\n * actually compiles validators or runs a codec.\n *\n * The object is built by hand rather than through `FunctionProvenance.Confect`\n * because the `Data` constructor copies its input with `Object.assign`, which\n * would force the getters at construction time and defeat the laziness.\n * `error` is only installed when an `errorThunk` is provided, so its absence\n * is observable via `\"error\" in provenance` without forcing anything; nothing\n * relies on `Data`'s structural `Equal`/`Hash` for provenance values.\n */\nexport const Confect = <\n Args extends Schema.Codec<any, any>,\n Returns extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n>(\n args: () => Args,\n returns: () => Returns,\n error?: () => Error,\n): Confect<Args, Returns, Error, Standard> => {\n const provenance = { _tag: \"Confect\" as const, kind: Standard };\n\n Lazy.defineProperty(provenance, \"args\", args);\n Lazy.defineProperty(provenance, \"returns\", returns);\n if (error !== undefined) {\n Lazy.defineProperty(provenance, \"error\", error);\n }\n\n return provenance as Confect<Args, Returns, Error, Standard>;\n};\n\n/**\n * Any struct-shaped, context-free schema usable as a paginated query's user\n * args. A structural bound rather than `Schema.Struct<Schema.Struct.Fields>`\n * because `Schema.Struct` is not covariant in its fields parameter — concrete\n * structs do not extend `Schema.Struct<Schema.Struct.Fields>`.\n */\n// eslint-disable-next-line import/namespace -- oxlint's namespace resolution misses type-only exports, and `Schema` is an interface/namespace\nexport interface AnyUserArgs extends Schema.Codec<any, any> {\n readonly fields: Schema.Struct.Fields;\n}\n\n/**\n * The composed args schema of a paginated query: the user-declared fields\n * plus the `paginationOpts` field managed by Convex's pagination protocol.\n *\n * The `extends infer ... extends` conditional lets TypeScript accept the\n * composed struct where `Schema.Codec<any, any>` is required even while\n * `UserArgs` is an unresolved type parameter; for concrete user args it\n * evaluates away entirely.\n */\nexport type PaginatedArgs<UserArgs extends AnyUserArgs> =\n Schema.Struct<\n UserArgs[\"fields\"] & {\n paginationOpts: typeof PaginationOptions.PaginationOptions;\n }\n > extends infer ComposedArgs extends Schema.Codec<any, any>\n ? ComposedArgs\n : never;\n\n/**\n * The composed returns schema of a paginated query: a `PaginationResult` of\n * the item schema. Same deferred-conditional device as {@link PaginatedArgs}.\n */\nexport type PaginatedReturns<Item extends Schema.Codec<any, any>> =\n PaginationResult.PaginationResult<Item> extends infer ComposedReturns extends\n Schema.Codec<any, any>\n ? ComposedReturns\n : never;\n\nexport interface ConfectPaginated<\n UserArgs extends AnyUserArgs,\n Item extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n> extends Confect<\n PaginatedArgs<UserArgs>,\n PaginatedReturns<Item>,\n Error,\n Paginated<UserArgs, Item>\n> {}\n\nexport interface AnyConfectPaginated extends ConfectPaginated<\n AnyUserArgs,\n Schema.Codec<any, any>,\n Schema.Codec<any, any>\n> {}\n\n/**\n * Build the provenance of a paginated query from lazy schema thunks, with the\n * same laziness contract as {@link Confect}. The user-facing schemas live on\n * the `Paginated` kind (`kind.userArgs`, `kind.item`, `kind.page`) — the kind\n * container is built eagerly (it is cheap) while the schemas inside it stay\n * lazy. The composed Convex-facing `args`/`returns` are derived lazily from\n * them: `args` spreads the user fields plus `paginationOpts`, and `returns`\n * wraps the item in `PaginationResult`. Composition living here means the\n * composed schemas can never drift from the stored user schemas.\n */\nexport const ConfectPaginated = <\n UserArgs extends AnyUserArgs,\n Item extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n>(\n userArgs: () => UserArgs,\n item: () => Item,\n error?: () => Error,\n): ConfectPaginated<UserArgs, Item, Error> => {\n const kind = { _tag: \"Paginated\" as const };\n const paginatedKind = kind as Paginated<UserArgs, Item>;\n\n Lazy.defineProperty(kind, \"userArgs\", userArgs);\n Lazy.defineProperty(kind, \"item\", item);\n Lazy.defineProperty(kind, \"page\", () =>\n Schema.mutable(Schema.Array(paginatedKind.item)),\n );\n\n const provenance = { _tag: \"Confect\" as const, kind: paginatedKind };\n const self = provenance as ConfectPaginated<UserArgs, Item, Error>;\n\n Lazy.defineProperty(provenance, \"args\", () => {\n const fields = paginatedKind.userArgs.fields;\n if (\"paginationOpts\" in fields) {\n throw new globalThis.Error(\n \"A paginated query's args schema must not declare `paginationOpts` — \" +\n \"it is added automatically from the `PaginationOptions` schema\",\n );\n }\n return Schema.Struct({\n ...fields,\n paginationOpts: PaginationOptions.PaginationOptions,\n });\n });\n Lazy.defineProperty(provenance, \"returns\", () =>\n PaginationResult.PaginationResult(paginatedKind.item),\n );\n if (error !== undefined) {\n Lazy.defineProperty(provenance, \"error\", error);\n }\n\n return self;\n};\n\nexport const Convex = <_Args extends DefaultFunctionArgs, _Returns>() =>\n FunctionProvenance.Convex(\n {} as {\n _args: _Args;\n _returns: _Returns;\n },\n );\n"],"mappings":";;;;;;;;;;;;;AA2EA,MAAa,qBAAqB,KAAK,WAA+B;AAEtE,MAAM,WAAqB,EAAE,MAAM,WAAW;;;;;;;;;;;;;;;;;AAkB9C,MAAa,WAKX,MACA,SACA,UAC4C;CAC5C,MAAM,aAAa;EAAE,MAAM;EAAoB,MAAM;CAAS;CAE9D,eAAoB,YAAY,QAAQ,IAAI;CAC5C,eAAoB,YAAY,WAAW,OAAO;CAClD,IAAI,UAAU,KAAA,GACZ,eAAoB,YAAY,SAAS,KAAK;CAGhD,OAAO;AACT;;;;;;;;;;;AAoEA,MAAa,oBAKX,UACA,MACA,UAC4C;CAC5C,MAAM,OAAO,EAAE,MAAM,YAAqB;CAC1C,MAAM,gBAAgB;CAEtB,eAAoB,MAAM,YAAY,QAAQ;CAC9C,eAAoB,MAAM,QAAQ,IAAI;CACtC,eAAoB,MAAM,cACxB,OAAO,QAAQ,OAAO,MAAM,cAAc,IAAI,CAAC,CACjD;CAEA,MAAM,aAAa;EAAE,MAAM;EAAoB,MAAM;CAAc;CACnE,MAAM,OAAO;CAEb,eAAoB,YAAY,cAAc;EAC5C,MAAM,SAAS,cAAc,SAAS;EACtC,IAAI,oBAAoB,QACtB,MAAM,IAAI,WAAW,MACnB,mIAEF;EAEF,OAAO,OAAO,OAAO;GACnB,GAAG;GACH,gBAAgBA;EAClB,CAAC;CACH,CAAC;CACD,eAAoB,YAAY,iBAC9BC,iBAAkC,cAAc,IAAI,CACtD;CACA,IAAI,UAAU,KAAA,GACZ,eAAoB,YAAY,SAAS,KAAK;CAGhD,OAAO;AACT;AAEA,MAAa,eACX,mBAAmB,OACjB,CAAC,CAIH"}
1
+ {"version":3,"file":"FunctionProvenance.js","names":["PaginationOptions.PaginationOptions","PaginationResult.PaginationResult"],"sources":["../src/FunctionProvenance.ts"],"sourcesContent":["import type { DefaultFunctionArgs } from \"convex/server\";\nimport * as Data from \"effect/Data\";\nimport * as Schema from \"effect/Schema\";\nimport * as Lazy from \"./Lazy\";\nimport * as PaginationOptions from \"./PaginationOptions\";\nimport * as PaginationResult from \"./PaginationResult\";\n\nexport type FunctionProvenance = Data.TaggedEnum<{\n Confect: {\n args: Schema.Codec<any, any>;\n returns: Schema.Codec<any, any>;\n error?: Schema.Codec<any, any>;\n kind: ConfectKind;\n };\n Convex: {\n /** @internal */\n \"~args\": DefaultFunctionArgs;\n /** @internal */\n \"~returns\": any;\n };\n}>;\n\n/**\n * The declaration shape of a Confect function — orthogonal to both the\n * provenance origin (Confect vs Convex) and the function type\n * (query/mutation/action). A `Standard` function declares its `args` and\n * `returns` schemas directly; a `Paginated` function declares `userArgs` and\n * `item` schemas from which the Convex-facing `args`/`returns` are composed.\n */\nexport type ConfectKind = Standard | Paginated;\n\nexport interface Standard {\n readonly _tag: \"Standard\";\n}\n\nexport interface Paginated<\n UserArgs extends AnyUserArgs = AnyUserArgs,\n Item extends Schema.Codec<any, any> = Schema.Codec<any, any>,\n> {\n readonly _tag: \"Paginated\";\n /** User-declared args — no `paginationOpts`. */\n readonly userArgs: UserArgs;\n /** Page element schema. */\n readonly item: Item;\n /** Mutable array of items — the page decode target. */\n readonly page: Schema.Codec<any, any>;\n}\n\nexport interface Confect<\n Args extends Schema.Codec<any, any>,\n Returns extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n Kind extends ConfectKind = ConfectKind,\n> {\n readonly _tag: \"Confect\";\n readonly args: Args;\n readonly returns: Returns;\n readonly error?: Error;\n readonly kind: Kind;\n}\n\nexport interface AnyConfect extends Confect<\n Schema.Codec<any, any>,\n Schema.Codec<any, any>,\n Schema.Codec<any, any>\n> {}\n\nexport interface Convex<Args extends DefaultFunctionArgs, Returns> {\n readonly _tag: \"Convex\";\n readonly \"~args\": Args;\n readonly \"~returns\": Returns;\n}\n\nexport interface AnyConvex extends Convex<DefaultFunctionArgs, any> {}\n\nexport const FunctionProvenance = Data.taggedEnum<FunctionProvenance>();\n\nconst Standard: Standard = { _tag: \"Standard\" };\n\n/**\n * Build a `Confect` provenance from lazy schema thunks. `args`, `returns`,\n * and `error` are exposed as sync lazy memoised getters (via {@link Lazy.defineProperty})\n * that only evaluate their thunk on first access, mirroring how `Table`\n * defers `Fields`/`Doc`. This keeps importing the assembled\n * `_generated/spec.ts` cheap — no `Schema.Struct(...)` / `Schema.Array(...)`\n * work runs at module load; it is deferred to the first invocation that\n * actually compiles validators or runs a codec.\n *\n * The object is built by hand rather than through `FunctionProvenance.Confect`\n * because the `Data` constructor copies its input with `Object.assign`, which\n * would force the getters at construction time and defeat the laziness.\n * `error` is only installed when an `errorThunk` is provided, so its absence\n * is observable via `\"error\" in provenance` without forcing anything; nothing\n * relies on `Data`'s structural `Equal`/`Hash` for provenance values.\n */\nexport const Confect = <\n Args extends Schema.Codec<any, any>,\n Returns extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n>(\n args: () => Args,\n returns: () => Returns,\n error?: () => Error,\n): Confect<Args, Returns, Error, Standard> => {\n const provenance = { _tag: \"Confect\" as const, kind: Standard };\n\n Lazy.defineProperty(provenance, \"args\", args);\n Lazy.defineProperty(provenance, \"returns\", returns);\n if (error !== undefined) {\n Lazy.defineProperty(provenance, \"error\", error);\n }\n\n return provenance as Confect<Args, Returns, Error, Standard>;\n};\n\n/**\n * Any struct-shaped, context-free schema usable as a paginated query's user\n * args. A structural bound rather than `Schema.Struct<Schema.Struct.Fields>`\n * because `Schema.Struct` is not covariant in its fields parameter — concrete\n * structs do not extend `Schema.Struct<Schema.Struct.Fields>`.\n */\n// eslint-disable-next-line import/namespace -- oxlint's namespace resolution misses type-only exports, and `Schema` is an interface/namespace\nexport interface AnyUserArgs extends Schema.Codec<any, any> {\n readonly fields: Schema.Struct.Fields;\n}\n\n/**\n * The composed args schema of a paginated query: the user-declared fields\n * plus the `paginationOpts` field managed by Convex's pagination protocol.\n *\n * The `extends infer ... extends` conditional lets TypeScript accept the\n * composed struct where `Schema.Codec<any, any>` is required even while\n * `UserArgs` is an unresolved type parameter; for concrete user args it\n * evaluates away entirely.\n */\nexport type PaginatedArgs<UserArgs extends AnyUserArgs> =\n Schema.Struct<\n UserArgs[\"fields\"] & {\n paginationOpts: typeof PaginationOptions.PaginationOptions;\n }\n > extends infer ComposedArgs extends Schema.Codec<any, any>\n ? ComposedArgs\n : never;\n\n/**\n * The composed returns schema of a paginated query: a `PaginationResult` of\n * the item schema. Same deferred-conditional device as {@link PaginatedArgs}.\n */\nexport type PaginatedReturns<Item extends Schema.Codec<any, any>> =\n PaginationResult.PaginationResult<Item> extends infer ComposedReturns extends\n Schema.Codec<any, any>\n ? ComposedReturns\n : never;\n\nexport interface ConfectPaginated<\n UserArgs extends AnyUserArgs,\n Item extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n> extends Confect<\n PaginatedArgs<UserArgs>,\n PaginatedReturns<Item>,\n Error,\n Paginated<UserArgs, Item>\n> {}\n\nexport interface AnyConfectPaginated extends ConfectPaginated<\n AnyUserArgs,\n Schema.Codec<any, any>,\n Schema.Codec<any, any>\n> {}\n\n/**\n * Build the provenance of a paginated query from lazy schema thunks, with the\n * same laziness contract as {@link Confect}. The user-facing schemas live on\n * the `Paginated` kind (`kind.userArgs`, `kind.item`, `kind.page`) — the kind\n * container is built eagerly (it is cheap) while the schemas inside it stay\n * lazy. The composed Convex-facing `args`/`returns` are derived lazily from\n * them: `args` spreads the user fields plus `paginationOpts`, and `returns`\n * wraps the item in `PaginationResult`. Composition living here means the\n * composed schemas can never drift from the stored user schemas.\n */\nexport const ConfectPaginated = <\n UserArgs extends AnyUserArgs,\n Item extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n>(\n userArgs: () => UserArgs,\n item: () => Item,\n error?: () => Error,\n): ConfectPaginated<UserArgs, Item, Error> => {\n const kind = { _tag: \"Paginated\" as const };\n const paginatedKind = kind as Paginated<UserArgs, Item>;\n\n Lazy.defineProperty(kind, \"userArgs\", userArgs);\n Lazy.defineProperty(kind, \"item\", item);\n Lazy.defineProperty(kind, \"page\", () =>\n Schema.mutable(Schema.Array(paginatedKind.item)),\n );\n\n const provenance = { _tag: \"Confect\" as const, kind: paginatedKind };\n const self = provenance as ConfectPaginated<UserArgs, Item, Error>;\n\n Lazy.defineProperty(provenance, \"args\", () => {\n const fields = paginatedKind.userArgs.fields;\n if (\"paginationOpts\" in fields) {\n throw new globalThis.Error(\n \"A paginated query's args schema must not declare `paginationOpts` — \" +\n \"it is added automatically from the `PaginationOptions` schema\",\n );\n }\n return Schema.Struct({\n ...fields,\n paginationOpts: PaginationOptions.PaginationOptions,\n });\n });\n Lazy.defineProperty(provenance, \"returns\", () =>\n PaginationResult.PaginationResult(paginatedKind.item),\n );\n if (error !== undefined) {\n Lazy.defineProperty(provenance, \"error\", error);\n }\n\n return self;\n};\n\nexport const Convex = <Args extends DefaultFunctionArgs, Returns>() =>\n FunctionProvenance.Convex(\n {} as {\n \"~args\": Args;\n \"~returns\": Returns;\n },\n );\n"],"mappings":";;;;;;;;;;;;;AA2EA,MAAa,qBAAqB,KAAK,WAA+B;AAEtE,MAAM,WAAqB,EAAE,MAAM,WAAW;;;;;;;;;;;;;;;;;AAkB9C,MAAa,WAKX,MACA,SACA,UAC4C;CAC5C,MAAM,aAAa;EAAE,MAAM;EAAoB,MAAM;CAAS;CAE9D,eAAoB,YAAY,QAAQ,IAAI;CAC5C,eAAoB,YAAY,WAAW,OAAO;CAClD,IAAI,UAAU,KAAA,GACZ,eAAoB,YAAY,SAAS,KAAK;CAGhD,OAAO;AACT;;;;;;;;;;;AAoEA,MAAa,oBAKX,UACA,MACA,UAC4C;CAC5C,MAAM,OAAO,EAAE,MAAM,YAAqB;CAC1C,MAAM,gBAAgB;CAEtB,eAAoB,MAAM,YAAY,QAAQ;CAC9C,eAAoB,MAAM,QAAQ,IAAI;CACtC,eAAoB,MAAM,cACxB,OAAO,QAAQ,OAAO,MAAM,cAAc,IAAI,CAAC,CACjD;CAEA,MAAM,aAAa;EAAE,MAAM;EAAoB,MAAM;CAAc;CACnE,MAAM,OAAO;CAEb,eAAoB,YAAY,cAAc;EAC5C,MAAM,SAAS,cAAc,SAAS;EACtC,IAAI,oBAAoB,QACtB,MAAM,IAAI,WAAW,MACnB,mIAEF;EAEF,OAAO,OAAO,OAAO;GACnB,GAAG;GACH,gBAAgBA;EAClB,CAAC;CACH,CAAC;CACD,eAAoB,YAAY,iBAC9BC,iBAAkC,cAAc,IAAI,CACtD;CACA,IAAI,UAAU,KAAA,GACZ,eAAoB,YAAY,SAAS,KAAK;CAGhD,OAAO;AACT;AAEA,MAAa,eACX,mBAAmB,OACjB,CAAC,CAIH"}