@confect/core 10.0.0-next.15 → 10.0.0-next.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +227 -0
- package/dist/FunctionSpec.d.ts +49 -43
- package/dist/FunctionSpec.d.ts.map +1 -1
- package/dist/FunctionSpec.js +22 -4
- package/dist/FunctionSpec.js.map +1 -1
- package/dist/GroupSpec.d.ts +11 -7
- package/dist/GroupSpec.d.ts.map +1 -1
- package/dist/GroupSpec.js +33 -10
- package/dist/GroupSpec.js.map +1 -1
- package/dist/MiddlewareSpec.d.ts +184 -0
- package/dist/MiddlewareSpec.d.ts.map +1 -0
- package/dist/MiddlewareSpec.js +55 -0
- package/dist/MiddlewareSpec.js.map +1 -0
- package/dist/Ref.d.ts +38 -32
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +53 -35
- package/dist/Ref.js.map +1 -1
- package/dist/Refs.d.ts +8 -3
- package/dist/Refs.d.ts.map +1 -1
- package/dist/Refs.js +3 -3
- package/dist/Refs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/package.json +9 -8
- package/src/FunctionSpec.ts +88 -9
- package/src/GroupSpec.ts +119 -12
- package/src/MiddlewareSpec.ts +356 -0
- package/src/Ref.ts +271 -126
- package/src/Refs.ts +40 -16
- package/src/index.ts +1 -1
- package/dist/Registry.d.ts +0 -24
- package/dist/Registry.d.ts.map +0 -1
- package/dist/Registry.js +0 -19
- package/dist/Registry.js.map +0 -1
- package/dist/tsconfig.src.tsbuildinfo +0 -1
- package/src/Registry.ts +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,232 @@
|
|
|
1
1
|
# @confect/core
|
|
2
2
|
|
|
3
|
+
## 10.0.0-next.17
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
9
|
+
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/...`.
|
|
10
|
+
|
|
11
|
+
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`:
|
|
12
|
+
|
|
13
|
+
```ts confect/middleware/RequireUser.spec.ts
|
|
14
|
+
import { MiddlewareSpec } from "@confect/core";
|
|
15
|
+
|
|
16
|
+
export class CurrentUser extends Context.Service<
|
|
17
|
+
CurrentUser,
|
|
18
|
+
{
|
|
19
|
+
readonly user: User;
|
|
20
|
+
}
|
|
21
|
+
>()("confect/middleware/RequireUser.spec/CurrentUser") {}
|
|
22
|
+
|
|
23
|
+
export class NotSignedIn extends Schema.TaggedError<NotSignedIn>()(
|
|
24
|
+
"NotSignedIn",
|
|
25
|
+
{},
|
|
26
|
+
) {}
|
|
27
|
+
|
|
28
|
+
export default class RequireUser extends MiddlewareSpec.MiddlewareSpec<
|
|
29
|
+
RequireUser,
|
|
30
|
+
{
|
|
31
|
+
provides: CurrentUser;
|
|
32
|
+
}
|
|
33
|
+
>()("RequireUser", {
|
|
34
|
+
error: () => NotSignedIn,
|
|
35
|
+
functionTypes: { query: true, mutation: true, action: false },
|
|
36
|
+
}) {}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```ts confect/notes.spec.ts
|
|
40
|
+
import RequireUser from "./middleware/RequireUser.spec";
|
|
41
|
+
|
|
42
|
+
export default GroupSpec.make()
|
|
43
|
+
.middleware(RequireUser)
|
|
44
|
+
.addFunction(FunctionSpec.publicMutation({ ... }));
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
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:
|
|
48
|
+
|
|
49
|
+
```ts confect/middleware/RequireUser.impl.ts
|
|
50
|
+
import { MiddlewareImpl } from "@confect/server";
|
|
51
|
+
|
|
52
|
+
export default MiddlewareImpl.provides(
|
|
53
|
+
databaseSchema,
|
|
54
|
+
RequireUser,
|
|
55
|
+
CurrentUser,
|
|
56
|
+
Effect.gen(function* () {
|
|
57
|
+
// load the user; `return yield* new NotSignedIn()` short-circuits
|
|
58
|
+
return { user };
|
|
59
|
+
}),
|
|
60
|
+
);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```ts confect/notes.impl.ts
|
|
64
|
+
import RequireUser from "./middleware/RequireUser.impl";
|
|
65
|
+
|
|
66
|
+
export default GroupImpl.make(databaseSchema, group).pipe(
|
|
67
|
+
Layer.provide(createNote),
|
|
68
|
+
Layer.provide(RequireUser), // omitting this is a compile error at `GroupImpl.finalize`
|
|
69
|
+
GroupImpl.finalize,
|
|
70
|
+
);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
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.
|
|
74
|
+
|
|
75
|
+
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:
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
FunctionSpec.publicMutation({ name: "deleteAll", ... }).middleware(RequireAdmin);
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
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.
|
|
82
|
+
|
|
83
|
+
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.
|
|
84
|
+
|
|
85
|
+
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.
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- 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.
|
|
90
|
+
|
|
91
|
+
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/*`.
|
|
92
|
+
|
|
93
|
+
## 10.0.0-next.16
|
|
94
|
+
|
|
95
|
+
### Major Changes
|
|
96
|
+
|
|
97
|
+
- 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/*`).
|
|
98
|
+
|
|
99
|
+
Breaking changes for users:
|
|
100
|
+
|
|
101
|
+
- **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.
|
|
102
|
+
- **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.
|
|
103
|
+
- **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.
|
|
104
|
+
- **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`).
|
|
105
|
+
- **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.
|
|
106
|
+
- **Node actions** use `effect/unstable/process` (`ChildProcessSpawner`) and `@effect/platform-node`'s `NodeServices` in place of `@effect/platform` `Command`/`NodeContext`.
|
|
107
|
+
- **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.
|
|
108
|
+
- **CLI**: a malformed `convex.json` now fails codegen with a descriptive error instead of being silently ignored.
|
|
109
|
+
- 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.
|
|
110
|
+
|
|
111
|
+
### Patch Changes
|
|
112
|
+
|
|
113
|
+
- Raise the required `effect` peer version to `^4.0.0-beta.100` (from `^4.0.0-beta.99`).
|
|
114
|
+
|
|
115
|
+
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.
|
|
116
|
+
|
|
117
|
+
- Raise the required `effect` peer version to `^4.0.0-beta.101` (from `^4.0.0-beta.100`).
|
|
118
|
+
|
|
119
|
+
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.
|
|
120
|
+
|
|
121
|
+
- 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.
|
|
122
|
+
- 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.
|
|
123
|
+
|
|
124
|
+
`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.
|
|
125
|
+
|
|
126
|
+
`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.
|
|
127
|
+
|
|
128
|
+
`beta.104` renames Effect's schema error constructors to match their `Data` counterparts, which affects any error schema you declare for a Confect function:
|
|
129
|
+
|
|
130
|
+
**Before:**
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
export class NoteNotFound extends Schema.TaggedErrorClass<NoteNotFound>()(
|
|
134
|
+
"NoteNotFound",
|
|
135
|
+
{ noteId: Id("notes") },
|
|
136
|
+
) {}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**After:**
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
export class NoteNotFound extends Schema.TaggedError<NoteNotFound>()(
|
|
143
|
+
"NoteNotFound",
|
|
144
|
+
{ noteId: Id("notes") },
|
|
145
|
+
) {}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
`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.
|
|
149
|
+
|
|
150
|
+
`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.
|
|
151
|
+
|
|
152
|
+
- 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.
|
|
153
|
+
|
|
154
|
+
`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.
|
|
155
|
+
|
|
156
|
+
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.
|
|
157
|
+
|
|
158
|
+
**Before:**
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
const NoteArbitrary = Schema.toArbitrary(Note);
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**After:**
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
import * as FastCheck from "fast-check";
|
|
168
|
+
|
|
169
|
+
const NoteArbitrary = Schema.toArbitrary(Note)(FastCheck);
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
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.
|
|
173
|
+
|
|
174
|
+
- 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.
|
|
175
|
+
|
|
176
|
+
`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.
|
|
177
|
+
|
|
178
|
+
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.
|
|
179
|
+
|
|
180
|
+
- Raise the required `effect` peer version to `^4.0.0-beta.98` (from `^4.0.0-beta.97`).
|
|
181
|
+
|
|
182
|
+
`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.
|
|
183
|
+
|
|
184
|
+
- Raise the required `effect` peer version to `^4.0.0-beta.99` (from `^4.0.0-beta.98`).
|
|
185
|
+
|
|
186
|
+
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.
|
|
187
|
+
|
|
188
|
+
- 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/*`.
|
|
189
|
+
|
|
190
|
+
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.
|
|
191
|
+
|
|
192
|
+
Before:
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
import type { SchemaError } from "effect/SchemaError";
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
After:
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
import type { SchemaError } from "effect/Schema";
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
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.
|
|
205
|
+
|
|
206
|
+
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.
|
|
207
|
+
|
|
208
|
+
- 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.
|
|
209
|
+
|
|
210
|
+
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/*`.
|
|
211
|
+
|
|
212
|
+
- 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.
|
|
213
|
+
|
|
214
|
+
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/*`.
|
|
215
|
+
|
|
216
|
+
- 3f0255c: Build and test against `convex` 1.44.0. The published `convex` peer ranges are unchanged, so no consumer action is required.
|
|
217
|
+
- 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.
|
|
218
|
+
|
|
219
|
+
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.
|
|
220
|
+
|
|
221
|
+
- Sync with `main`: this prerelease line now includes all changes released in `@confect/*` 9.2.2–9.2.4 — see those versions' changelog entries.
|
|
222
|
+
- Sync with `main`: this prerelease line now includes all changes released in `@confect/*` 9.2.5 — see that version's changelog entries.
|
|
223
|
+
- Sync with `main`: this prerelease line now includes all changes released in `@confect/*` 9.3.0 — see that version's changelog entries.
|
|
224
|
+
- Sync with `main`: this prerelease line now includes all changes released in `@confect/*` 9.4.0 — see that version's changelog entries.
|
|
225
|
+
|
|
226
|
+
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.
|
|
227
|
+
|
|
228
|
+
- 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.
|
|
229
|
+
|
|
3
230
|
## 10.0.0-next.15
|
|
4
231
|
|
|
5
232
|
### Patch Changes
|
package/dist/FunctionSpec.d.ts
CHANGED
|
@@ -1,35 +1,41 @@
|
|
|
1
1
|
import type { FunctionType, FunctionVisibility, RegisteredAction, RegisteredMutation, RegisteredQuery } from "convex/server";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
3
|
import * as FunctionProvenance from "./FunctionProvenance";
|
|
4
|
+
import type * as MiddlewareSpec from "./MiddlewareSpec";
|
|
4
5
|
import * as RuntimeAndFunctionType from "./RuntimeAndFunctionType";
|
|
5
6
|
export declare const TypeId = "@confect/core/FunctionSpec";
|
|
6
7
|
export type TypeId = typeof TypeId;
|
|
7
8
|
export declare const isFunctionSpec: (u: unknown) => u is AnyWithProps;
|
|
8
|
-
export interface FunctionSpec<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, Name_ extends string, FunctionProvenance_ extends FunctionProvenance.FunctionProvenance> {
|
|
9
|
+
export interface FunctionSpec<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, Name_ extends string, FunctionProvenance_ extends FunctionProvenance.FunctionProvenance, MiddlewareSpecs_ extends MiddlewareSpec.AnyMiddlewareSpec = never> {
|
|
9
10
|
readonly [TypeId]: TypeId;
|
|
10
11
|
readonly runtimeAndFunctionType: RuntimeAndFunctionType_;
|
|
11
12
|
readonly functionVisibility: FunctionVisibility_;
|
|
12
13
|
readonly name: Name_;
|
|
13
14
|
readonly functionProvenance: FunctionProvenance_;
|
|
15
|
+
readonly middlewareSpecs: ReadonlyArray<MiddlewareSpecs_>;
|
|
16
|
+
}
|
|
17
|
+
export interface Builder<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility, Name_ extends string, FunctionProvenance_ extends FunctionProvenance.FunctionProvenance, MiddlewareSpecs_ extends MiddlewareSpec.AnyMiddlewareSpec = never> extends FunctionSpec<RuntimeAndFunctionType_, FunctionVisibility_, Name_, FunctionProvenance_, MiddlewareSpecs_> {
|
|
18
|
+
middleware<MiddlewareSpec_ extends MiddlewareSpec.AnyMiddlewareSpec>(middlewareSpec: MiddlewareSpec_ & MiddlewareSpec.ValidateFunctionAttach<MiddlewareSpec_, RuntimeAndFunctionType_, FunctionProvenance_, MiddlewareSpecs_>): Builder<RuntimeAndFunctionType_, FunctionVisibility_, Name_, FunctionProvenance_, MiddlewareSpecs_ | MiddlewareSpec_>;
|
|
14
19
|
}
|
|
15
20
|
export interface Any {
|
|
16
21
|
readonly [TypeId]: TypeId;
|
|
17
22
|
}
|
|
18
|
-
export interface AnyWithProps extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance.FunctionProvenance> {
|
|
23
|
+
export interface AnyWithProps extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance.FunctionProvenance, MiddlewareSpec.AnyMiddlewareSpec> {
|
|
19
24
|
}
|
|
20
|
-
export interface AnyConfect extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance.AnyConfect> {
|
|
25
|
+
export interface AnyConfect extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance.AnyConfect, MiddlewareSpec.AnyMiddlewareSpec> {
|
|
21
26
|
}
|
|
22
|
-
export interface AnyConvex extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance.AnyConvex> {
|
|
27
|
+
export interface AnyConvex extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance.AnyConvex, MiddlewareSpec.AnyMiddlewareSpec> {
|
|
23
28
|
}
|
|
24
|
-
export interface AnyWithPropsWithRuntime<Runtime extends RuntimeAndFunctionType.Runtime> extends FunctionSpec<RuntimeAndFunctionType.WithRuntime<Runtime>, FunctionVisibility, string, FunctionProvenance.FunctionProvenance> {
|
|
29
|
+
export interface AnyWithPropsWithRuntime<Runtime extends RuntimeAndFunctionType.Runtime> extends FunctionSpec<RuntimeAndFunctionType.WithRuntime<Runtime>, FunctionVisibility, string, FunctionProvenance.FunctionProvenance, MiddlewareSpec.AnyMiddlewareSpec> {
|
|
25
30
|
}
|
|
26
|
-
export interface AnyWithPropsWithFunctionType<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType> extends FunctionSpec<RuntimeAndFunctionType_, FunctionVisibility, string, FunctionProvenance.FunctionProvenance> {
|
|
31
|
+
export interface AnyWithPropsWithFunctionType<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType> extends FunctionSpec<RuntimeAndFunctionType_, FunctionVisibility, string, FunctionProvenance.FunctionProvenance, MiddlewareSpec.AnyMiddlewareSpec> {
|
|
27
32
|
}
|
|
28
|
-
export interface AnyWithPropsWithFunctionProvenance<FunctionProvenance_ extends FunctionProvenance.FunctionProvenance> extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance_> {
|
|
33
|
+
export interface AnyWithPropsWithFunctionProvenance<FunctionProvenance_ extends FunctionProvenance.FunctionProvenance> extends FunctionSpec<RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility, string, FunctionProvenance_, MiddlewareSpec.AnyMiddlewareSpec> {
|
|
29
34
|
}
|
|
30
35
|
export type GetRuntimeAndFunctionType<FunctionSpec_ extends AnyWithProps> = FunctionSpec_["runtimeAndFunctionType"];
|
|
31
36
|
export type GetFunctionVisibility<FunctionSpec_ extends AnyWithProps> = FunctionSpec_["functionVisibility"];
|
|
32
37
|
export type Name<FunctionSpec_ extends AnyWithProps> = FunctionSpec_["name"];
|
|
38
|
+
export type MiddlewareSpecs<FunctionSpec_ extends AnyWithProps> = FunctionSpec_["middlewareSpecs"][number];
|
|
33
39
|
export type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
34
40
|
functionProvenance: {
|
|
35
41
|
_tag: "Confect";
|
|
@@ -113,19 +119,19 @@ export declare const publicQuery: <const Name_ extends string, Args_ extends Sch
|
|
|
113
119
|
args: () => Args_;
|
|
114
120
|
returns: () => Returns_;
|
|
115
121
|
error?: () => Error_;
|
|
116
|
-
}) =>
|
|
122
|
+
}) => Builder<{
|
|
117
123
|
readonly runtime: "Convex";
|
|
118
124
|
readonly functionType: "query";
|
|
119
|
-
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
125
|
+
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
120
126
|
export declare const internalQuery: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
121
127
|
name: Name_;
|
|
122
128
|
args: () => Args_;
|
|
123
129
|
returns: () => Returns_;
|
|
124
130
|
error?: () => Error_;
|
|
125
|
-
}) =>
|
|
131
|
+
}) => Builder<{
|
|
126
132
|
readonly runtime: "Convex";
|
|
127
133
|
readonly functionType: "query";
|
|
128
|
-
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
134
|
+
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
129
135
|
export declare const publicPaginatedQuery: <const Name_ extends string, Item_ extends Schema.Codec<any, any>, UserArgs_ extends FunctionProvenance.AnyUserArgs = Schema.Struct<{}>, Error_ extends Schema.Codec<any, any> = never>({ name, args, item, error, }: {
|
|
130
136
|
name: Name_;
|
|
131
137
|
/** User-declared args, without `paginationOpts` — it is added automatically. */
|
|
@@ -133,10 +139,10 @@ export declare const publicPaginatedQuery: <const Name_ extends string, Item_ ex
|
|
|
133
139
|
/** The page element schema. */
|
|
134
140
|
item: () => Item_;
|
|
135
141
|
error?: () => Error_;
|
|
136
|
-
}) =>
|
|
142
|
+
}) => Builder<{
|
|
137
143
|
readonly runtime: "Convex";
|
|
138
144
|
readonly functionType: "query";
|
|
139
|
-
}, "public", Name_, FunctionProvenance.ConfectPaginated<UserArgs_, Item_, Error_
|
|
145
|
+
}, "public", Name_, FunctionProvenance.ConfectPaginated<UserArgs_, Item_, Error_>, never>;
|
|
140
146
|
export declare const internalPaginatedQuery: <const Name_ extends string, Item_ extends Schema.Codec<any, any>, UserArgs_ extends FunctionProvenance.AnyUserArgs = Schema.Struct<{}>, Error_ extends Schema.Codec<any, any> = never>({ name, args, item, error, }: {
|
|
141
147
|
name: Name_;
|
|
142
148
|
/** User-declared args, without `paginationOpts` — it is added automatically. */
|
|
@@ -144,122 +150,122 @@ export declare const internalPaginatedQuery: <const Name_ extends string, Item_
|
|
|
144
150
|
/** The page element schema. */
|
|
145
151
|
item: () => Item_;
|
|
146
152
|
error?: () => Error_;
|
|
147
|
-
}) =>
|
|
153
|
+
}) => Builder<{
|
|
148
154
|
readonly runtime: "Convex";
|
|
149
155
|
readonly functionType: "query";
|
|
150
|
-
}, "internal", Name_, FunctionProvenance.ConfectPaginated<UserArgs_, Item_, Error_
|
|
156
|
+
}, "internal", Name_, FunctionProvenance.ConfectPaginated<UserArgs_, Item_, Error_>, never>;
|
|
151
157
|
export declare const publicMutation: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
152
158
|
name: Name_;
|
|
153
159
|
args: () => Args_;
|
|
154
160
|
returns: () => Returns_;
|
|
155
161
|
error?: () => Error_;
|
|
156
|
-
}) =>
|
|
162
|
+
}) => Builder<{
|
|
157
163
|
readonly runtime: "Convex";
|
|
158
164
|
readonly functionType: "mutation";
|
|
159
|
-
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
165
|
+
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
160
166
|
export declare const internalMutation: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
161
167
|
name: Name_;
|
|
162
168
|
args: () => Args_;
|
|
163
169
|
returns: () => Returns_;
|
|
164
170
|
error?: () => Error_;
|
|
165
|
-
}) =>
|
|
171
|
+
}) => Builder<{
|
|
166
172
|
readonly runtime: "Convex";
|
|
167
173
|
readonly functionType: "mutation";
|
|
168
|
-
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
174
|
+
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
169
175
|
export declare const publicAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
170
176
|
name: Name_;
|
|
171
177
|
args: () => Args_;
|
|
172
178
|
returns: () => Returns_;
|
|
173
179
|
error?: () => Error_;
|
|
174
|
-
}) =>
|
|
180
|
+
}) => Builder<{
|
|
175
181
|
readonly runtime: "Convex";
|
|
176
182
|
readonly functionType: "action";
|
|
177
|
-
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
183
|
+
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
178
184
|
export declare const internalAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
179
185
|
name: Name_;
|
|
180
186
|
args: () => Args_;
|
|
181
187
|
returns: () => Returns_;
|
|
182
188
|
error?: () => Error_;
|
|
183
|
-
}) =>
|
|
189
|
+
}) => Builder<{
|
|
184
190
|
readonly runtime: "Convex";
|
|
185
191
|
readonly functionType: "action";
|
|
186
|
-
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
192
|
+
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
187
193
|
export declare const publicNodeAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
188
194
|
name: Name_;
|
|
189
195
|
args: () => Args_;
|
|
190
196
|
returns: () => Returns_;
|
|
191
197
|
error?: () => Error_;
|
|
192
|
-
}) =>
|
|
198
|
+
}) => Builder<{
|
|
193
199
|
readonly runtime: "Node";
|
|
194
200
|
readonly functionType: "action";
|
|
195
|
-
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
201
|
+
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
196
202
|
export declare const internalNodeAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
197
203
|
name: Name_;
|
|
198
204
|
args: () => Args_;
|
|
199
205
|
returns: () => Returns_;
|
|
200
206
|
error?: () => Error_;
|
|
201
|
-
}) =>
|
|
207
|
+
}) => Builder<{
|
|
202
208
|
readonly runtime: "Node";
|
|
203
209
|
readonly functionType: "action";
|
|
204
|
-
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind
|
|
210
|
+
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_, FunctionProvenance.ConfectKind>, never>;
|
|
205
211
|
type MatchingRegisteredFunction<RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType, FunctionVisibility_ extends FunctionVisibility> = RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends "query" ? RegisteredQuery<FunctionVisibility_, any, any> : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends "mutation" ? RegisteredMutation<FunctionVisibility_, any, any> : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends "action" ? RegisteredAction<FunctionVisibility_, any, any> : never;
|
|
206
212
|
type ExtractArgs<F> = F extends RegisteredQuery<any, infer A, any> ? A : F extends RegisteredMutation<any, infer A, any> ? A : F extends RegisteredAction<any, infer A, any> ? A : never;
|
|
207
213
|
type ExtractReturns<F> = F extends RegisteredQuery<any, any, infer R> ? R : F extends RegisteredMutation<any, any, infer R> ? R : F extends RegisteredAction<any, any, infer R> ? R : never;
|
|
208
214
|
export declare const convexPublicQuery: <F extends MatchingRegisteredFunction<{
|
|
209
215
|
readonly runtime: "Convex";
|
|
210
216
|
readonly functionType: "query";
|
|
211
|
-
}, "public">>() => <const Name_ extends string>(name: Name_) =>
|
|
217
|
+
}, "public">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
212
218
|
readonly runtime: "Convex";
|
|
213
219
|
readonly functionType: "query";
|
|
214
|
-
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
220
|
+
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
215
221
|
export declare const convexInternalQuery: <F extends MatchingRegisteredFunction<{
|
|
216
222
|
readonly runtime: "Convex";
|
|
217
223
|
readonly functionType: "query";
|
|
218
|
-
}, "internal">>() => <const Name_ extends string>(name: Name_) =>
|
|
224
|
+
}, "internal">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
219
225
|
readonly runtime: "Convex";
|
|
220
226
|
readonly functionType: "query";
|
|
221
|
-
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
227
|
+
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
222
228
|
export declare const convexPublicMutation: <F extends MatchingRegisteredFunction<{
|
|
223
229
|
readonly runtime: "Convex";
|
|
224
230
|
readonly functionType: "mutation";
|
|
225
|
-
}, "public">>() => <const Name_ extends string>(name: Name_) =>
|
|
231
|
+
}, "public">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
226
232
|
readonly runtime: "Convex";
|
|
227
233
|
readonly functionType: "mutation";
|
|
228
|
-
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
234
|
+
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
229
235
|
export declare const convexInternalMutation: <F extends MatchingRegisteredFunction<{
|
|
230
236
|
readonly runtime: "Convex";
|
|
231
237
|
readonly functionType: "mutation";
|
|
232
|
-
}, "internal">>() => <const Name_ extends string>(name: Name_) =>
|
|
238
|
+
}, "internal">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
233
239
|
readonly runtime: "Convex";
|
|
234
240
|
readonly functionType: "mutation";
|
|
235
|
-
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
241
|
+
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
236
242
|
export declare const convexPublicAction: <F extends MatchingRegisteredFunction<{
|
|
237
243
|
readonly runtime: "Convex";
|
|
238
244
|
readonly functionType: "action";
|
|
239
|
-
}, "public">>() => <const Name_ extends string>(name: Name_) =>
|
|
245
|
+
}, "public">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
240
246
|
readonly runtime: "Convex";
|
|
241
247
|
readonly functionType: "action";
|
|
242
|
-
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
248
|
+
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
243
249
|
export declare const convexInternalAction: <F extends MatchingRegisteredFunction<{
|
|
244
250
|
readonly runtime: "Convex";
|
|
245
251
|
readonly functionType: "action";
|
|
246
|
-
}, "internal">>() => <const Name_ extends string>(name: Name_) =>
|
|
252
|
+
}, "internal">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
247
253
|
readonly runtime: "Convex";
|
|
248
254
|
readonly functionType: "action";
|
|
249
|
-
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
255
|
+
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
250
256
|
export declare const convexPublicNodeAction: <F extends MatchingRegisteredFunction<{
|
|
251
257
|
readonly runtime: "Node";
|
|
252
258
|
readonly functionType: "action";
|
|
253
|
-
}, "public">>() => <const Name_ extends string>(name: Name_) =>
|
|
259
|
+
}, "public">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
254
260
|
readonly runtime: "Node";
|
|
255
261
|
readonly functionType: "action";
|
|
256
|
-
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
262
|
+
}, "public", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
257
263
|
export declare const convexInternalNodeAction: <F extends MatchingRegisteredFunction<{
|
|
258
264
|
readonly runtime: "Node";
|
|
259
265
|
readonly functionType: "action";
|
|
260
|
-
}, "internal">>() => <const Name_ extends string>(name: Name_) =>
|
|
266
|
+
}, "internal">>() => <const Name_ extends string>(name: Name_) => Builder<{
|
|
261
267
|
readonly runtime: "Node";
|
|
262
268
|
readonly functionType: "action";
|
|
263
|
-
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F
|
|
269
|
+
}, "internal", Name_, FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>, never>;
|
|
264
270
|
export {};
|
|
265
271
|
//# sourceMappingURL=FunctionSpec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionSpec.d.ts","sourceRoot":"","sources":["../src/FunctionSpec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAE3D,OAAO,KAAK,sBAAsB,MAAM,0BAA0B,CAAC;AAEnE,eAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC;AAEnC,eAAO,MAAM,cAAc,MAAO,OAAO,KAAG,CAAC,IAAI,YACf,CAAC;AAEnC,MAAM,WAAW,YAAY,CAC3B,uBAAuB,SAAS,sBAAsB,CAAC,sBAAsB,EAC7E,mBAAmB,SAAS,kBAAkB,EAC9C,KAAK,SAAS,MAAM,EACpB,mBAAmB,SAAS,kBAAkB,CAAC,kBAAkB;IAEjE,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,sBAAsB,EAAE,uBAAuB,CAAC;IACzD,QAAQ,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;IACjD,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"FunctionSpec.d.ts","sourceRoot":"","sources":["../src/FunctionSpec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAE3D,OAAO,KAAK,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAA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
31
|
const isFunctionSpec = (u) => Predicate.hasProperty(u, TypeId);
|
|
32
|
-
const Proto = {
|
|
32
|
+
const Proto = {
|
|
33
|
+
[TypeId]: TypeId,
|
|
34
|
+
middleware(middlewareSpec) {
|
|
35
|
+
if (this.functionProvenance._tag === "Convex") throw new Error(`Plain Convex function "${this.name}" cannot have middleware`);
|
|
36
|
+
const functionType = this.runtimeAndFunctionType.functionType;
|
|
37
|
+
if (!middlewareSpec.functionTypes[functionType]) throw new Error(`Middleware "${middlewareSpec.key}" does not declare function type "${functionType}" of function "${this.name}"`);
|
|
38
|
+
if (this.middlewareSpecs.some((existing) => existing.key === middlewareSpec.key)) throw new Error(`Middleware "${middlewareSpec.key}" is already attached to function "${this.name}"`);
|
|
39
|
+
return Object.assign(Object.create(Proto), {
|
|
40
|
+
runtimeAndFunctionType: this.runtimeAndFunctionType,
|
|
41
|
+
functionVisibility: this.functionVisibility,
|
|
42
|
+
name: this.name,
|
|
43
|
+
functionProvenance: this.functionProvenance,
|
|
44
|
+
middlewareSpecs: [...this.middlewareSpecs, middlewareSpec]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
33
48
|
const make = (runtimeAndFunctionType, functionVisibility) => ({ name, args, returns, error }) => {
|
|
34
49
|
validateConfectFunctionIdentifier(name);
|
|
35
50
|
return Object.assign(Object.create(Proto), {
|
|
36
51
|
runtimeAndFunctionType,
|
|
37
52
|
functionVisibility,
|
|
38
53
|
name,
|
|
39
|
-
functionProvenance: Confect(args, returns, error)
|
|
54
|
+
functionProvenance: Confect(args, returns, error),
|
|
55
|
+
middlewareSpecs: []
|
|
40
56
|
});
|
|
41
57
|
};
|
|
42
58
|
const makePaginated = (runtimeAndFunctionType, functionVisibility) => ({ name, args, item, error }) => {
|
|
@@ -45,7 +61,8 @@ const makePaginated = (runtimeAndFunctionType, functionVisibility) => ({ name, a
|
|
|
45
61
|
runtimeAndFunctionType,
|
|
46
62
|
functionVisibility,
|
|
47
63
|
name,
|
|
48
|
-
functionProvenance: ConfectPaginated(args ?? (() => Schema.Struct({})), item, error)
|
|
64
|
+
functionProvenance: ConfectPaginated(args ?? (() => Schema.Struct({})), item, error),
|
|
65
|
+
middlewareSpecs: []
|
|
49
66
|
});
|
|
50
67
|
};
|
|
51
68
|
const publicQuery = make(ConvexQuery, "public");
|
|
@@ -64,7 +81,8 @@ const makeConvex = (runtimeAndFunctionType, functionVisibility) => () => (name)
|
|
|
64
81
|
runtimeAndFunctionType,
|
|
65
82
|
functionVisibility,
|
|
66
83
|
name,
|
|
67
|
-
functionProvenance: Convex()
|
|
84
|
+
functionProvenance: Convex(),
|
|
85
|
+
middlewareSpecs: []
|
|
68
86
|
});
|
|
69
87
|
};
|
|
70
88
|
const convexPublicQuery = makeConvex(ConvexQuery, "public");
|