@confect/server 5.0.0 → 7.0.0
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 +145 -1
- package/dist/ActionRunner.d.ts +3 -5
- package/dist/ActionRunner.d.ts.map +1 -1
- package/dist/ActionRunner.js +1 -1
- package/dist/ActionRunner.js.map +1 -1
- package/dist/CronJob.d.ts +1 -2
- package/dist/CronJob.d.ts.map +1 -1
- package/dist/CronJob.js.map +1 -1
- package/dist/DatabaseReader.d.ts +5 -5
- package/dist/DatabaseWriter.d.ts +4 -4
- package/dist/DatabaseWriter.d.ts.map +1 -1
- package/dist/Handler.d.ts +1 -1
- package/dist/Handler.d.ts.map +1 -1
- package/dist/Handler.js.map +1 -1
- package/dist/MutationRunner.d.ts +5 -16
- package/dist/MutationRunner.d.ts.map +1 -1
- package/dist/MutationRunner.js +3 -13
- package/dist/MutationRunner.js.map +1 -1
- package/dist/QueryInitializer.d.ts +1 -1
- package/dist/QueryInitializer.d.ts.map +1 -1
- package/dist/QueryRunner.d.ts +3 -5
- package/dist/QueryRunner.d.ts.map +1 -1
- package/dist/QueryRunner.js +1 -1
- package/dist/QueryRunner.js.map +1 -1
- package/dist/RegisteredConvexFunction.d.ts +8 -8
- package/dist/RegisteredConvexFunction.d.ts.map +1 -1
- package/dist/RegisteredConvexFunction.js +41 -9
- package/dist/RegisteredConvexFunction.js.map +1 -1
- package/dist/RegisteredFunction.d.ts +26 -7
- package/dist/RegisteredFunction.d.ts.map +1 -1
- package/dist/RegisteredFunction.js +34 -5
- package/dist/RegisteredFunction.js.map +1 -1
- package/dist/RegisteredNodeFunction.js +3 -1
- package/dist/RegisteredNodeFunction.js.map +1 -1
- package/dist/Scheduler.d.ts +6 -7
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js.map +1 -1
- package/package.json +5 -5
- package/src/ActionRunner.ts +13 -3
- package/src/CronJob.ts +1 -4
- package/src/Handler.ts +5 -1
- package/src/MutationRunner.ts +12 -19
- package/src/QueryRunner.ts +13 -3
- package/src/RegisteredConvexFunction.ts +121 -65
- package/src/RegisteredFunction.ts +67 -22
- package/src/RegisteredNodeFunction.ts +4 -0
- package/src/Scheduler.ts +2 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,149 @@
|
|
|
1
1
|
# @confect/server
|
|
2
2
|
|
|
3
|
+
## 7.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 90094d0: Add typed errors to Confect functions (queries, mutations, and actions). Declare an optional `error` schema in `FunctionSpec` and recover it as a typed value at every call site—`useQuery`, `useMutation`, `useAction`, `HttpClient`, `WebSocketClient`, and `TestConfect`—without paying for it on functions that don't fail.
|
|
8
|
+
|
|
9
|
+
Typed errors travel across the function boundary as Convex's native [`ConvexError`](https://docs.convex.dev/functions/error-handling/application-errors#throwing-application-errors): the encoded error sits in `ConvexError.data`, leaving the `returns` channel unsullied and preserving native Convex semantics for non-Confect callers of the same API.
|
|
10
|
+
|
|
11
|
+
### Authoring a function with typed errors
|
|
12
|
+
|
|
13
|
+
`FunctionSpec` constructors now accept an optional `error` schema. To support multiple error shapes, combine them with `Schema.Union`.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { FunctionSpec, GenericId, GroupSpec } from "@confect/core";
|
|
17
|
+
import { Schema } from "effect";
|
|
18
|
+
|
|
19
|
+
export class NoteNotFound extends Schema.TaggedError<NoteNotFound>()(
|
|
20
|
+
"NoteNotFound",
|
|
21
|
+
{ noteId: GenericId.GenericId("notes") },
|
|
22
|
+
) {}
|
|
23
|
+
|
|
24
|
+
export const notes = GroupSpec.make("notes").addFunction(
|
|
25
|
+
FunctionSpec.publicQuery({
|
|
26
|
+
name: "getOrFail",
|
|
27
|
+
args: Schema.Struct({ noteId: GenericId.GenericId("notes") }),
|
|
28
|
+
returns: Notes.Doc,
|
|
29
|
+
error: NoteNotFound,
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The `FunctionImpl` for that ref can now `Effect.fail` (or `mapError` to) any value matching the declared schema. Whichever invocation path the caller takes—`useQuery`/`useMutation`/`useAction`, `HttpClient`, `WebSocketClient`, or `TestConfect`—Confect encodes the failure, transports it via `ConvexError`, and surfaces the decoded value in the appropriate channel for that call site.
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { FunctionImpl } from "@confect/server";
|
|
38
|
+
import { Effect } from "effect";
|
|
39
|
+
import api from "../_generated/api";
|
|
40
|
+
import { DatabaseReader } from "../_generated/services";
|
|
41
|
+
import { NoteNotFound } from "./notes.spec";
|
|
42
|
+
|
|
43
|
+
const getOrFail = FunctionImpl.make(api, "notes", "getOrFail", ({ noteId }) =>
|
|
44
|
+
Effect.gen(function* () {
|
|
45
|
+
const reader = yield* DatabaseReader;
|
|
46
|
+
return yield* reader
|
|
47
|
+
.table("notes")
|
|
48
|
+
.get(noteId)
|
|
49
|
+
.pipe(Effect.mapError(() => new NoteNotFound({ noteId })));
|
|
50
|
+
}),
|
|
51
|
+
);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Consuming a typed error
|
|
55
|
+
|
|
56
|
+
`@confect/js` (`HttpClient`, `WebSocketClient`) and `@confect/test` (`TestConfect`) surface the decoded error in the `Effect` error channel alongside the existing `HttpClientError`/`WebSocketClientError`/`ParseError`:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
HttpClient.query(refs.public.notes.getOrFail, { noteId });
|
|
60
|
+
// Effect.Effect<Note, NoteNotFound | HttpClientError | ParseError>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### `@confect/react`—breaking changes
|
|
64
|
+
|
|
65
|
+
`useQuery`, `useMutation`, and `useAction` now expose typed errors, and `useQuery` returns a tagged result type instead of `Returns | undefined`.
|
|
66
|
+
|
|
67
|
+
**`useQuery` now returns `QueryResult<A, E>`.** Loading and (when an `error` schema is declared) failure are reified as variants alongside success. Match on the result with `QueryResult.match`:
|
|
68
|
+
|
|
69
|
+
Before:
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
const notes = useQuery(refs.public.notes.list, {});
|
|
73
|
+
if (notes === undefined) return <p>Loading…</p>;
|
|
74
|
+
return <NoteList notes={notes} />;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
After:
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import { QueryResult, useQuery } from "@confect/react";
|
|
81
|
+
|
|
82
|
+
const notes = useQuery(refs.public.notes.list, {});
|
|
83
|
+
return QueryResult.match(notes, {
|
|
84
|
+
onLoading: (skipped) => (skipped ? null : <p>Loading…</p>),
|
|
85
|
+
onSuccess: (notes) => <NoteList notes={notes} />,
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The `Loading` variant carries a `skipped: boolean` flag, exposed as the argument to `onLoading`. It distinguishes a query that is genuinely in flight (`skipped: false`) from one that is sitting idle because `"skip"` was passed as its args (`skipped: true`)—a distinction `convex/react`'s plain `undefined` return value cannot make. Use it to render a loading indicator only when work is actually happening, and an empty/placeholder state otherwise.
|
|
90
|
+
|
|
91
|
+
When the ref declares an `error` schema, `onFailure` becomes required and receives the decoded typed error:
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
const lookup = useQuery(refs.public.notes.getOrFail, { noteId });
|
|
95
|
+
QueryResult.match(lookup, {
|
|
96
|
+
onLoading: (skipped) => (skipped ? null : "Looking up…"),
|
|
97
|
+
onSuccess: (note) => `Found: ${note.text}`,
|
|
98
|
+
onFailure: (error) => `Note ${error.noteId} not found.`,
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`QueryResult` is a Confect-native type exported from `@confect/react`.
|
|
103
|
+
|
|
104
|
+
**`useMutation` and `useAction` return `Promise<Either<A, E>>` when the ref declares an `error` schema.** Refs without an `error` schema continue to resolve to `Promise<A>`, matching the prior shape and `convex/react`'s behavior.
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
const deleteOrFail = useMutation(refs.public.notes.deleteOrFail);
|
|
108
|
+
const result = await deleteOrFail({ noteId });
|
|
109
|
+
// Either.Either<null, NoteNotFound | Forbidden>
|
|
110
|
+
Either.match(result, {
|
|
111
|
+
onLeft: (error) => /* typed error */,
|
|
112
|
+
onRight: (value) => /* success */,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const deleteNote = useMutation(refs.public.notes.delete_); // no `error` schema
|
|
116
|
+
await deleteNote({ noteId }); // Promise<null>, as before
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Unspecified failures continue to reject the promise.
|
|
120
|
+
|
|
121
|
+
### Migration
|
|
122
|
+
- For each `useQuery` call site, replace `result === undefined` checks and direct property access with `QueryResult.match` (or the lower-level `QueryResult.isLoading`/`isSuccess`/`isFailure` predicates).
|
|
123
|
+
- For each `useMutation`/`useAction` call site whose ref now declares an `error` schema, unwrap the resolved `Either` (e.g. with `Either.match`); call sites against refs without an `error` schema need no change.
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- Updated dependencies [90094d0]
|
|
128
|
+
- @confect/core@7.0.0
|
|
129
|
+
|
|
130
|
+
## 6.0.0
|
|
131
|
+
|
|
132
|
+
### Major Changes
|
|
133
|
+
|
|
134
|
+
- 228589b: Fixed an issue where the cached value for any Confect query would be regularly busted by a hidden Effect dependency on `Date.now()`. This has been solved by stubbing `Date.now()` to always return the Unix epoch (`0`). If you previously relied on `Date.now()` in your queries, (1) try to rewrite them to avoid it (see [Convex best practices](https://docs.convex.dev/understanding/best-practices/#date-in-queries) on using dates in queries), or (2) use Effect's `Clock` service, which will still return an unstubbed timestamp.
|
|
135
|
+
|
|
136
|
+
### Minor Changes
|
|
137
|
+
|
|
138
|
+
- df95ce7: Add `Ref.OptionalArgs` type utility to `@confect/core` for conditionally optional function args. `QueryRunner`, `MutationRunner`, and `ActionRunner` now accept optional args for no-arg Confect functions. `useQuery`, `useMutation`, and `useAction` now accept optional args for no-arg Confect functions. `TestConfect` `query`/`mutation`/`action` helpers now accept optional args for no-arg Confect functions.
|
|
139
|
+
|
|
140
|
+
### Patch Changes
|
|
141
|
+
|
|
142
|
+
- a8083e8: Fix table field path inference when a schema has a `name` field and an optional Convex ID or bytes field.
|
|
143
|
+
- Updated dependencies [df95ce7]
|
|
144
|
+
- Updated dependencies [a8083e8]
|
|
145
|
+
- @confect/core@6.0.0
|
|
146
|
+
|
|
3
147
|
## 5.0.0
|
|
4
148
|
|
|
5
149
|
### Minor Changes
|
|
@@ -26,7 +170,7 @@
|
|
|
26
170
|
|
|
27
171
|
### Minor Changes
|
|
28
172
|
|
|
29
|
-
- 641fd99: Add optional `filter` parameter to `OrderedQuery.paginate`. This allows applying a Convex filter directly at the pagination level
|
|
173
|
+
- 641fd99: Add optional `filter` parameter to `OrderedQuery.paginate`. This allows applying a Convex filter directly at the pagination level—the one scenario where `.filter()` is recommended over index-based filtering. The filter callback receives a `FilterBuilder` and is applied to the underlying query before paginating.
|
|
30
174
|
|
|
31
175
|
### Patch Changes
|
|
32
176
|
|
package/dist/ActionRunner.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { Context, Layer } from "effect";
|
|
1
|
+
import { Context, Effect, Layer, ParseResult } from "effect";
|
|
2
2
|
import * as Ref$1 from "@confect/core/Ref";
|
|
3
3
|
import { GenericActionCtx } from "convex/server";
|
|
4
|
-
import * as effect_ParseResult0 from "effect/ParseResult";
|
|
5
|
-
import * as effect_Effect0 from "effect/Effect";
|
|
6
4
|
|
|
7
5
|
//#region src/ActionRunner.d.ts
|
|
8
6
|
declare namespace ActionRunner_d_exports {
|
|
9
7
|
export { ActionRunner, layer };
|
|
10
8
|
}
|
|
11
|
-
declare const ActionRunner: Context.Tag<(<Action extends Ref$1.AnyAction>(action: Action, args: Ref$1.
|
|
9
|
+
declare const ActionRunner: Context.Tag<(<Action extends Ref$1.AnyAction>(action: Action, ...args: Ref$1.OptionalArgs<Action>) => Effect.Effect<Ref$1.Returns<Action>, Ref$1.Error<Action> | ParseResult.ParseError>), <Action extends Ref$1.AnyAction>(action: Action, ...args: Ref$1.OptionalArgs<Action>) => Effect.Effect<Ref$1.Returns<Action>, Ref$1.Error<Action> | ParseResult.ParseError>>;
|
|
12
10
|
type ActionRunner = typeof ActionRunner.Identifier;
|
|
13
|
-
declare const layer: (runAction: GenericActionCtx<any>["runAction"]) => Layer.Layer<(<Action extends Ref$1.AnyAction>(action: Action, args: Ref$1.
|
|
11
|
+
declare const layer: (runAction: GenericActionCtx<any>["runAction"]) => Layer.Layer<(<Action extends Ref$1.AnyAction>(action: Action, ...args: Ref$1.OptionalArgs<Action>) => Effect.Effect<Ref$1.Returns<Action>, Ref$1.Error<Action> | ParseResult.ParseError>), never, never>;
|
|
14
12
|
//#endregion
|
|
15
13
|
export { ActionRunner, ActionRunner_d_exports, layer };
|
|
16
14
|
//# sourceMappingURL=ActionRunner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionRunner.d.ts","names":[],"sources":["../src/ActionRunner.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActionRunner.d.ts","names":[],"sources":["../src/ActionRunner.ts"],"mappings":";;;;;;;;cAqBa,YAAA,EAAY,OAAA,CAAA,GAAA,kBAdP,KAAA,CAAI,SAAA,EAAS,MAAA,EACnB,MAAA,KAAM,IAAA,EACL,KAAA,CAAI,YAAA,CAAa,MAAA,MACzB,MAAA,CAAO,MAAA,CACR,KAAA,CAAI,OAAA,CAAQ,MAAA,GACZ,KAAA,CAAI,KAAA,CAAM,MAAA,IAAU,WAAA,CAAY,UAAA,oBALlB,KAAA,CAAI,SAAA,EAAS,MAAA,EACnB,MAAA,KAAM,IAAA,EACL,KAAA,CAAI,YAAA,CAAa,MAAA,MACzB,MAAA,CAAO,MAAA,CACR,KAAA,CAAI,OAAA,CAAQ,MAAA,GACZ,KAAA,CAAI,KAAA,CAAM,MAAA,IAAU,WAAA,CAAY,UAAA;AAAA,KAYxB,YAAA,UAAsB,YAAA,CAAa,UAAA;AAAA,cAElC,KAAA,GAAS,SAAA,EAAW,gBAAA,uBAAkC,KAAA,CAAA,KAAA,kBAnBjD,KAAA,CAAI,SAAA,EAAS,MAAA,EACnB,MAAA,KAAM,IAAA,EACL,KAAA,CAAI,YAAA,CAAa,MAAA,MACzB,MAAA,CAAO,MAAA,CACR,KAAA,CAAI,OAAA,CAAQ,MAAA,GACZ,KAAA,CAAI,KAAA,CAAM,MAAA,IAAU,WAAA,CAAY,UAAA"}
|
package/dist/ActionRunner.js
CHANGED
|
@@ -8,7 +8,7 @@ var ActionRunner_exports = /* @__PURE__ */ __exportAll({
|
|
|
8
8
|
ActionRunner: () => ActionRunner,
|
|
9
9
|
layer: () => layer
|
|
10
10
|
});
|
|
11
|
-
const make = (runAction) => (action, args) => Ref$1.runWithCodec(action, args, (functionReference, encodedArgs) => runAction(functionReference, encodedArgs));
|
|
11
|
+
const make = (runAction) => (action, ...args) => Ref$1.runWithCodec(action, args[0] ?? {}, (functionReference, encodedArgs) => runAction(functionReference, encodedArgs));
|
|
12
12
|
const ActionRunner = Context.GenericTag("@confect/server/ActionRunner");
|
|
13
13
|
const layer = (runAction) => Layer.succeed(ActionRunner, make(runAction));
|
|
14
14
|
|
package/dist/ActionRunner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionRunner.js","names":["Ref"],"sources":["../src/ActionRunner.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport { type GenericActionCtx } from \"convex/server\";\nimport { Context, Layer } from \"effect\";\n\nconst make =\n (runAction: GenericActionCtx<any>[\"runAction\"]) =>\n <Action extends Ref.AnyAction>(action: Action
|
|
1
|
+
{"version":3,"file":"ActionRunner.js","names":["Ref"],"sources":["../src/ActionRunner.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport { type GenericActionCtx } from \"convex/server\";\nimport type { ParseResult, Effect } from \"effect\";\nimport { Context, Layer } from \"effect\";\n\nconst make =\n (runAction: GenericActionCtx<any>[\"runAction\"]) =>\n <Action extends Ref.AnyAction>(\n action: Action,\n ...args: Ref.OptionalArgs<Action>\n ): Effect.Effect<\n Ref.Returns<Action>,\n Ref.Error<Action> | ParseResult.ParseError\n > =>\n Ref.runWithCodec(\n action,\n (args[0] ?? {}) as Ref.Args<Action>,\n (functionReference, encodedArgs) =>\n runAction(functionReference, encodedArgs),\n );\n\nexport const ActionRunner = Context.GenericTag<ReturnType<typeof make>>(\n \"@confect/server/ActionRunner\",\n);\nexport type ActionRunner = typeof ActionRunner.Identifier;\n\nexport const layer = (runAction: GenericActionCtx<any>[\"runAction\"]) =>\n Layer.succeed(ActionRunner, make(runAction));\n"],"mappings":";;;;;;;;;;AAKA,MAAM,QACH,eAEC,QACA,GAAG,SAKHA,MAAI,aACF,QACC,KAAK,MAAM,EAAE,GACb,mBAAmB,gBAClB,UAAU,mBAAmB,YAAY,CAC5C;AAEL,MAAa,eAAe,QAAQ,WAClC,+BACD;AAGD,MAAa,SAAS,cACpB,MAAM,QAAQ,cAAc,KAAK,UAAU,CAAC"}
|
package/dist/CronJob.d.ts
CHANGED
|
@@ -15,8 +15,7 @@ interface CronJob {
|
|
|
15
15
|
readonly args: Record<string, unknown>;
|
|
16
16
|
}
|
|
17
17
|
declare const isCronJob: (u: unknown) => u is CronJob;
|
|
18
|
-
|
|
19
|
-
declare const make: <R extends Ref$1.AnyMutation | Ref$1.AnyAction>(identifier: string, schedule: Cron.Cron | Duration.Duration, ref: R, ...args: OptionalArgs<R>) => CronJob;
|
|
18
|
+
declare const make: <R extends Ref$1.AnyMutation | Ref$1.AnyAction>(identifier: string, schedule: Cron.Cron | Duration.Duration, ref: R, ...args: Ref$1.OptionalArgs<R>) => CronJob;
|
|
20
19
|
//#endregion
|
|
21
20
|
export { CronJob, CronJob_d_exports, TypeId, isCronJob, make };
|
|
22
21
|
//# sourceMappingURL=CronJob.d.ts.map
|
package/dist/CronJob.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CronJob.d.ts","names":[],"sources":["../src/CronJob.ts"],"mappings":";;;;;;;cAIa,MAAA;AAAA,KACD,MAAA,UAAgB,MAAA;AAAA,UAEX,OAAA;EAAA,UACL,MAAA,GAAS,MAAA;EAAA,SAEV,UAAA;EAAA,SACA,QAAA,EAAU,IAAA,CAAK,IAAA,GAAO,QAAA,CAAS,QAAA;EAAA,SAC/B,GAAA,EAAK,KAAA,CAAI,WAAA,GAAc,KAAA,CAAI,SAAA;EAAA,SAC3B,IAAA,EAAM,MAAA;AAAA;AAAA,cAGJ,SAAA,GAAa,CAAA,cAAa,CAAA,IAAK,OAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"CronJob.d.ts","names":[],"sources":["../src/CronJob.ts"],"mappings":";;;;;;;cAIa,MAAA;AAAA,KACD,MAAA,UAAgB,MAAA;AAAA,UAEX,OAAA;EAAA,UACL,MAAA,GAAS,MAAA;EAAA,SAEV,UAAA;EAAA,SACA,QAAA,EAAU,IAAA,CAAK,IAAA,GAAO,QAAA,CAAS,QAAA;EAAA,SAC/B,GAAA,EAAK,KAAA,CAAI,WAAA,GAAc,KAAA,CAAI,SAAA;EAAA,SAC3B,IAAA,EAAM,MAAA;AAAA;AAAA,cAGJ,SAAA,GAAa,CAAA,cAAa,CAAA,IAAK,OAAA;AAAA,cAoB/B,IAAA,aAAkB,KAAA,CAAI,WAAA,GAAc,KAAA,CAAI,SAAA,EACnD,UAAA,UACA,QAAA,EAAU,IAAA,CAAK,IAAA,GAAO,QAAA,CAAS,QAAA,EAC/B,GAAA,EAAK,CAAA,KACF,IAAA,EAAM,KAAA,CAAI,YAAA,CAAa,CAAA,MACzB,OAAA"}
|
package/dist/CronJob.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CronJob.js","names":[],"sources":["../src/CronJob.ts"],"sourcesContent":["import type { Ref } from \"@confect/core\";\nimport type { Cron, Duration } from \"effect\";\nimport { Predicate } from \"effect\";\n\nexport const TypeId = \"@confect/server/CronJob\";\nexport type TypeId = typeof TypeId;\n\nexport interface CronJob {\n readonly [TypeId]: TypeId;\n\n readonly identifier: string;\n readonly schedule: Cron.Cron | Duration.Duration;\n readonly ref: Ref.AnyMutation | Ref.AnyAction;\n readonly args: Record<string, unknown>;\n}\n\nexport const isCronJob = (u: unknown): u is CronJob =>\n Predicate.hasProperty(u, TypeId);\n\
|
|
1
|
+
{"version":3,"file":"CronJob.js","names":[],"sources":["../src/CronJob.ts"],"sourcesContent":["import type { Ref } from \"@confect/core\";\nimport type { Cron, Duration } from \"effect\";\nimport { Predicate } from \"effect\";\n\nexport const TypeId = \"@confect/server/CronJob\";\nexport type TypeId = typeof TypeId;\n\nexport interface CronJob {\n readonly [TypeId]: TypeId;\n\n readonly identifier: string;\n readonly schedule: Cron.Cron | Duration.Duration;\n readonly ref: Ref.AnyMutation | Ref.AnyAction;\n readonly args: Record<string, unknown>;\n}\n\nexport const isCronJob = (u: unknown): u is CronJob =>\n Predicate.hasProperty(u, TypeId);\n\nconst Proto = {\n [TypeId]: TypeId,\n};\n\nconst makeProto = (\n identifier: string,\n schedule: Cron.Cron | Duration.Duration,\n ref: Ref.AnyMutation | Ref.AnyAction,\n args: Record<string, unknown>,\n): CronJob =>\n Object.assign(Object.create(Proto), {\n identifier,\n schedule,\n ref,\n args,\n });\n\nexport const make = <R extends Ref.AnyMutation | Ref.AnyAction>(\n identifier: string,\n schedule: Cron.Cron | Duration.Duration,\n ref: R,\n ...args: Ref.OptionalArgs<R>\n): CronJob => makeProto(identifier, schedule, ref, args[0] ?? {});\n"],"mappings":";;;;;;;;;AAIA,MAAa,SAAS;AAYtB,MAAa,aAAa,MACxB,UAAU,YAAY,GAAG,OAAO;AAElC,MAAM,QAAQ,GACX,SAAS,QACX;AAED,MAAM,aACJ,YACA,UACA,KACA,SAEA,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;CAClC;CACA;CACA;CACA;CACD,CAAC;AAEJ,MAAa,QACX,YACA,UACA,KACA,GAAG,SACS,UAAU,YAAY,UAAU,KAAK,KAAK,MAAM,EAAE,CAAC"}
|
package/dist/DatabaseReader.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ import { Context, Layer } from "effect";
|
|
|
9
9
|
import * as convex_server0 from "convex/server";
|
|
10
10
|
import { GenericDatabaseReader } from "convex/server";
|
|
11
11
|
import * as convex_values0 from "convex/values";
|
|
12
|
-
import * as effect_Effect0 from "effect/Effect";
|
|
13
12
|
import * as _confect_core_Types0 from "@confect/core/Types";
|
|
13
|
+
import * as effect_Effect0 from "effect/Effect";
|
|
14
14
|
|
|
15
15
|
//#region src/DatabaseReader.d.ts
|
|
16
16
|
declare namespace DatabaseReader_d_exports {
|
|
@@ -19,7 +19,7 @@ declare namespace DatabaseReader_d_exports {
|
|
|
19
19
|
declare const make: <DatabaseSchema_ extends AnyWithProps>(databaseSchema: DatabaseSchema_, convexDatabaseReader: GenericDatabaseReader<ToConvex<FromSchema<DatabaseSchema_>>>) => {
|
|
20
20
|
table: <const TableName extends Name<IncludeSystemTables<Tables<DatabaseSchema_>>>>(tableName: TableName) => {
|
|
21
21
|
readonly get: {
|
|
22
|
-
(id: convex_values0.GenericId<TableName>): effect_Effect0.Effect<TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["document"],
|
|
22
|
+
(id: convex_values0.GenericId<TableName>): effect_Effect0.Effect<TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["document"], DocumentDecodeError | GetByIdFailure, never>;
|
|
23
23
|
<IndexName extends keyof TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["indexes"]>(indexName: IndexName, ...indexFieldValues: _confect_core_Types0.IndexFieldTypesForEq<ToConvex<DataModel<IncludeSystemTables<Tables<DatabaseSchema_>>>>, TableName, TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["indexes"][IndexName]>): effect_Effect0.Effect<TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["document"], DocumentDecodeError | GetByIndexFailure, never>;
|
|
24
24
|
};
|
|
25
25
|
readonly index: {
|
|
@@ -32,7 +32,7 @@ declare const make: <DatabaseSchema_ extends AnyWithProps>(databaseSchema: Datab
|
|
|
32
32
|
declare const DatabaseReader: <DatabaseSchema_ extends AnyWithProps>() => Context.Tag<{
|
|
33
33
|
table: <const TableName extends Name<IncludeSystemTables<Tables<DatabaseSchema_>>>>(tableName: TableName) => {
|
|
34
34
|
readonly get: {
|
|
35
|
-
(id: convex_values0.GenericId<TableName>): effect_Effect0.Effect<TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["document"],
|
|
35
|
+
(id: convex_values0.GenericId<TableName>): effect_Effect0.Effect<TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["document"], DocumentDecodeError | GetByIdFailure, never>;
|
|
36
36
|
<IndexName extends keyof TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["indexes"]>(indexName: IndexName, ...indexFieldValues: _confect_core_Types0.IndexFieldTypesForEq<ToConvex<DataModel<IncludeSystemTables<Tables<DatabaseSchema_>>>>, TableName, TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["indexes"][IndexName]>): effect_Effect0.Effect<TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["document"], DocumentDecodeError | GetByIndexFailure, never>;
|
|
37
37
|
};
|
|
38
38
|
readonly index: {
|
|
@@ -44,7 +44,7 @@ declare const DatabaseReader: <DatabaseSchema_ extends AnyWithProps>() => Contex
|
|
|
44
44
|
}, {
|
|
45
45
|
table: <const TableName extends Name<IncludeSystemTables<Tables<DatabaseSchema_>>>>(tableName: TableName) => {
|
|
46
46
|
readonly get: {
|
|
47
|
-
(id: convex_values0.GenericId<TableName>): effect_Effect0.Effect<TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["document"],
|
|
47
|
+
(id: convex_values0.GenericId<TableName>): effect_Effect0.Effect<TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["document"], DocumentDecodeError | GetByIdFailure, never>;
|
|
48
48
|
<IndexName extends keyof TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["indexes"]>(indexName: IndexName, ...indexFieldValues: _confect_core_Types0.IndexFieldTypesForEq<ToConvex<DataModel<IncludeSystemTables<Tables<DatabaseSchema_>>>>, TableName, TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["indexes"][IndexName]>): effect_Effect0.Effect<TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["document"], DocumentDecodeError | GetByIndexFailure, never>;
|
|
49
49
|
};
|
|
50
50
|
readonly index: {
|
|
@@ -58,7 +58,7 @@ type DatabaseReader<DatabaseSchema_ extends AnyWithProps> = ReturnType<typeof Da
|
|
|
58
58
|
declare const layer: <DatabaseSchema_ extends AnyWithProps>(databaseSchema: DatabaseSchema_, convexDatabaseReader: GenericDatabaseReader<ToConvex<FromSchema<DatabaseSchema_>>>) => Layer.Layer<{
|
|
59
59
|
table: <const TableName extends Name<IncludeSystemTables<Tables<DatabaseSchema_>>>>(tableName: TableName) => {
|
|
60
60
|
readonly get: {
|
|
61
|
-
(id: convex_values0.GenericId<TableName>): effect_Effect0.Effect<TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["document"],
|
|
61
|
+
(id: convex_values0.GenericId<TableName>): effect_Effect0.Effect<TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["document"], DocumentDecodeError | GetByIdFailure, never>;
|
|
62
62
|
<IndexName extends keyof TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["indexes"]>(indexName: IndexName, ...indexFieldValues: _confect_core_Types0.IndexFieldTypesForEq<ToConvex<DataModel<IncludeSystemTables<Tables<DatabaseSchema_>>>>, TableName, TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["indexes"][IndexName]>): effect_Effect0.Effect<TableInfo<WithName<IncludeSystemTables<Tables<DatabaseSchema_>>, TableName>>["document"], DocumentDecodeError | GetByIndexFailure, never>;
|
|
63
63
|
};
|
|
64
64
|
readonly index: {
|
package/dist/DatabaseWriter.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ declare namespace DatabaseWriter_d_exports {
|
|
|
13
13
|
declare const make: <DatabaseSchema_ extends AnyWithProps>(databaseSchema: DatabaseSchema_, convexDatabaseWriter: GenericDatabaseWriter<ToConvex<FromSchema<DatabaseSchema_>>>) => {
|
|
14
14
|
table: <const TableName extends TableNames<FromSchema<DatabaseSchema_>>>(tableName: TableName) => {
|
|
15
15
|
insert: (document: WithoutSystemFields$1<DocumentByName<FromSchema<DatabaseSchema_>, TableName>>) => Effect.Effect<GenericId<TableName>, DocumentEncodeError, never>;
|
|
16
|
-
patch: (id: GenericId<TableName>, patchedValues: Partial<WithoutSystemFields<DocumentByName<FromSchema<DatabaseSchema_>, TableName>>>) => Effect.Effect<void,
|
|
16
|
+
patch: (id: GenericId<TableName>, patchedValues: Partial<WithoutSystemFields<DocumentByName<FromSchema<DatabaseSchema_>, TableName>>>) => Effect.Effect<void, DocumentDecodeError | GetByIdFailure | DocumentEncodeError, never>;
|
|
17
17
|
replace: (id: GenericId<TableName>, value: WithoutSystemFields<DocumentByName<FromSchema<DatabaseSchema_>, TableName>>) => Effect.Effect<void, DocumentEncodeError, never>;
|
|
18
18
|
delete: (id: GenericId<TableName>) => Effect.Effect<void, never, never>;
|
|
19
19
|
};
|
|
@@ -21,14 +21,14 @@ declare const make: <DatabaseSchema_ extends AnyWithProps>(databaseSchema: Datab
|
|
|
21
21
|
declare const DatabaseWriter: <DatabaseSchema_ extends AnyWithProps>() => Context.Tag<{
|
|
22
22
|
table: <const TableName extends TableNames<FromSchema<DatabaseSchema_>>>(tableName: TableName) => {
|
|
23
23
|
insert: (document: WithoutSystemFields$1<DocumentByName<FromSchema<DatabaseSchema_>, TableName>>) => Effect.Effect<GenericId<TableName>, DocumentEncodeError, never>;
|
|
24
|
-
patch: (id: GenericId<TableName>, patchedValues: Partial<Expand<BetterOmit<DocumentByName<FromSchema<DatabaseSchema_>, TableName>, "_id" | "_creationTime">>>) => Effect.Effect<void,
|
|
24
|
+
patch: (id: GenericId<TableName>, patchedValues: Partial<Expand<BetterOmit<DocumentByName<FromSchema<DatabaseSchema_>, TableName>, "_id" | "_creationTime">>>) => Effect.Effect<void, DocumentDecodeError | GetByIdFailure | DocumentEncodeError, never>;
|
|
25
25
|
replace: (id: GenericId<TableName>, value: Expand<BetterOmit<DocumentByName<FromSchema<DatabaseSchema_>, TableName>, "_id" | "_creationTime">>) => Effect.Effect<void, DocumentEncodeError, never>;
|
|
26
26
|
delete: (id: GenericId<TableName>) => Effect.Effect<void, never, never>;
|
|
27
27
|
};
|
|
28
28
|
}, {
|
|
29
29
|
table: <const TableName extends TableNames<FromSchema<DatabaseSchema_>>>(tableName: TableName) => {
|
|
30
30
|
insert: (document: WithoutSystemFields$1<DocumentByName<FromSchema<DatabaseSchema_>, TableName>>) => Effect.Effect<GenericId<TableName>, DocumentEncodeError, never>;
|
|
31
|
-
patch: (id: GenericId<TableName>, patchedValues: Partial<Expand<BetterOmit<DocumentByName<FromSchema<DatabaseSchema_>, TableName>, "_id" | "_creationTime">>>) => Effect.Effect<void,
|
|
31
|
+
patch: (id: GenericId<TableName>, patchedValues: Partial<Expand<BetterOmit<DocumentByName<FromSchema<DatabaseSchema_>, TableName>, "_id" | "_creationTime">>>) => Effect.Effect<void, DocumentDecodeError | GetByIdFailure | DocumentEncodeError, never>;
|
|
32
32
|
replace: (id: GenericId<TableName>, value: Expand<BetterOmit<DocumentByName<FromSchema<DatabaseSchema_>, TableName>, "_id" | "_creationTime">>) => Effect.Effect<void, DocumentEncodeError, never>;
|
|
33
33
|
delete: (id: GenericId<TableName>) => Effect.Effect<void, never, never>;
|
|
34
34
|
};
|
|
@@ -37,7 +37,7 @@ type DatabaseWriter<DatabaseSchema_ extends AnyWithProps> = ReturnType<typeof Da
|
|
|
37
37
|
declare const layer: <DatabaseSchema_ extends AnyWithProps>(databaseSchema: DatabaseSchema_, convexDatabaseWriter: GenericDatabaseWriter<ToConvex<FromSchema<DatabaseSchema_>>>) => Layer.Layer<{
|
|
38
38
|
table: <const TableName extends TableNames<FromSchema<DatabaseSchema_>>>(tableName: TableName) => {
|
|
39
39
|
insert: (document: WithoutSystemFields$1<DocumentByName<FromSchema<DatabaseSchema_>, TableName>>) => Effect.Effect<GenericId<TableName>, DocumentEncodeError, never>;
|
|
40
|
-
patch: (id: GenericId<TableName>, patchedValues: Partial<Expand<BetterOmit<DocumentByName<FromSchema<DatabaseSchema_>, TableName>, "_id" | "_creationTime">>>) => Effect.Effect<void,
|
|
40
|
+
patch: (id: GenericId<TableName>, patchedValues: Partial<Expand<BetterOmit<DocumentByName<FromSchema<DatabaseSchema_>, TableName>, "_id" | "_creationTime">>>) => Effect.Effect<void, DocumentDecodeError | GetByIdFailure | DocumentEncodeError, never>;
|
|
41
41
|
replace: (id: GenericId<TableName>, value: Expand<BetterOmit<DocumentByName<FromSchema<DatabaseSchema_>, TableName>, "_id" | "_creationTime">>) => Effect.Effect<void, DocumentEncodeError, never>;
|
|
42
42
|
delete: (id: GenericId<TableName>) => Effect.Effect<void, never, never>;
|
|
43
43
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatabaseWriter.d.ts","names":[],"sources":["../src/DatabaseWriter.ts"],"mappings":";;;;;;;;;;;;cAiBa,IAAA,2BAAgC,YAAA,EAC3C,cAAA,EAAgB,eAAA,EAChB,oBAAA,EAAsB,qBAAA,CACpB,QAAA,CAAmB,UAAA,CAAqB,eAAA;kCAMH,UAAA,CAAoB,UAAA,CAAA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,eAAA,IAAA,SAAA,EAAA,SAAA;;;;;;;KAmHpB,cAAA,yBACc,YAAA,IACtB,UAAA,QAAkB,cAAA,CAAe,eAAA;AAAA,cAExB,KAAA,2BAAiC,YAAA,EAC5C,cAAA,EAAgB,eAAA,EAChB,oBAAA,EAAsB,qBAAA,CACpB,QAAA,CAAmB,UAAA,CAAqB,eAAA,QACzC,KAAA,CAAA,KAAA;kCA3H6B,UAAA,CAAA,UAAA,CAAA,eAAA,IAAA,SAAA,EAAA,SAAA"}
|
package/dist/Handler.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ type ConfectProvenanceMutation<DatabaseSchema_ extends AnyWithProps, FunctionSpe
|
|
|
32
32
|
type ActionServices<DatabaseSchema_ extends AnyWithProps> = Scheduler | Auth | StorageReader | StorageWriter | StorageActionWriter | QueryRunner | MutationRunner | ActionRunner | VectorSearch<FromSchema<DatabaseSchema_>> | ActionCtx<ToConvex<FromSchema<DatabaseSchema_>>>;
|
|
33
33
|
type ConvexRuntimeAction<DatabaseSchema_ extends AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyAction>> = Base<FunctionSpec_, ActionServices<DatabaseSchema_>>;
|
|
34
34
|
type NodeRuntimeAction<DatabaseSchema_ extends AnyWithProps, FunctionSpec_ extends FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.NodeAction>> = Base<FunctionSpec_, ActionServices<DatabaseSchema_> | NodeContext.NodeContext>;
|
|
35
|
-
type Base<FunctionSpec_ extends FunctionSpec.AnyWithProps, R> = (args: FunctionSpec.Args<FunctionSpec_>) => Effect.Effect<FunctionSpec.Returns<FunctionSpec_>,
|
|
35
|
+
type Base<FunctionSpec_ extends FunctionSpec.AnyWithProps, R> = (args: FunctionSpec.Args<FunctionSpec_>) => Effect.Effect<FunctionSpec.Returns<FunctionSpec_>, FunctionSpec.Error<FunctionSpec_>, R>;
|
|
36
36
|
type Any = AnyConfectProvenance | AnyConvexProvenance;
|
|
37
37
|
type AnyConfectProvenance = Base<FunctionSpec.AnyConfect, any>;
|
|
38
38
|
type AnyConvexProvenance = Any$1;
|
package/dist/Handler.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Handler.d.ts","names":[],"sources":["../src/Handler.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;KAsBY,OAAA,yBACc,YAAA,wBACF,YAAA,CAAa,YAAA,IAEnC,aAAA,SAAsB,YAAA,CAAa,sBAAA,CACjC,aAAA,EACA,kBAAA,CAAmB,SAAA,IAEjB,uBAAA,CAAwB,aAAA,IACxB,aAAA,SAAsB,YAAA,CAAa,sBAAA,CAC/B,aAAA,EACA,kBAAA,CAAmB,UAAA,IAErB,wBAAA,CAAyB,eAAA,EAAiB,aAAA;AAAA,KAG7C,uBAAA,uBAED,YAAA,CAAa,kCAAA,CAAmC,kBAAA,CAAmB,SAAA,KACnE,wBAAA,CAA4C,aAAA;AAAA,KAE3C,wBAAA,yBACqB,YAAA,wBAEtB,YAAA,CAAa,kCAAA,CAAmC,kBAAA,CAAmB,UAAA,KAErE,aAAA,SAAsB,YAAA,CAAa,gBAAA,CAAiB,aAAA,aAChD,sBAAA,CAAuB,eAAA,EAAiB,aAAA,IACxC,aAAA,SAAsB,YAAA,CAAa,gBAAA,CAC/B,aAAA,gBAGF,yBAAA,CAA0B,eAAA,EAAiB,aAAA,IAC3C,aAAA,SAAsB,YAAA,CAAa,0BAAA,CAC/B,aAAA,EACA,sBAAA,CAAuB,YAAA,IAEzB,mBAAA,CAAoB,eAAA,EAAiB,aAAA,IACrC,aAAA,SAAsB,YAAA,CAAa,0BAAA,CAC/B,aAAA,EACA,sBAAA,CAAuB,UAAA,IAEzB,iBAAA,CAAkB,eAAA,EAAiB,aAAA;AAAA,KAGnC,sBAAA,yBACc,YAAA,wBAEtB,YAAA,CAAa,4BAAA,CAA6B,sBAAA,CAAuB,QAAA,KACjE,IAAA,CACF,aAAA,EACE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AAA,CAAqB,eAAA;AAAA,KAIzC,cAAA,yBAAuC,YAAA,IACxC,SAAA,GACA,IAAA,GACA,aAAA,GACA,aAAA,GACA,mBAAA,GACA,WAAA,GACA,cAAA,GACA,YAAA,GACA,YAAA,CAA0B,UAAA,CAAqB,eAAA,KAC/C,SAAA,CACE,QAAA,CAAmB,UAAA,CAAqB,eAAA;AAAA,KAGlC,mBAAA,yBACc,YAAA,wBAEtB,YAAA,CAAa,4BAAA,CAA6B,sBAAA,CAAuB,SAAA,KACjE,IAAA,CAAK,aAAA,EAAe,cAAA,CAAe,eAAA;AAAA,KAE3B,iBAAA,yBACc,YAAA,wBAEtB,YAAA,CAAa,4BAAA,CAA6B,sBAAA,CAAuB,UAAA,KACjE,IAAA,CACF,aAAA,EACA,cAAA,CAAe,eAAA,IAAmB,WAAA,CAAY,WAAA;AAAA,KAG3C,IAAA,uBAA2B,YAAA,CAAa,YAAA,QAC3C,IAAA,EAAM,YAAA,CAAa,IAAA,CAAK,aAAA,MACrB,MAAA,CAAO,MAAA,CACV,YAAA,CAAa,OAAA,CAAQ,aAAA,GACrB,YAAA,CAAa,KAAA,CAAM,aAAA,GACnB,CAAA;AAAA,KAGU,GAAA,GAAM,oBAAA,GAAuB,mBAAA;AAAA,KAE7B,oBAAA,GAAuB,IAAA,CAAK,YAAA,CAAa,UAAA;AAAA,KAEzC,mBAAA,GAAsB,KAAA;AAAA,KAEtB,QAAA,yBACc,YAAA,wBACF,YAAA,CAAa,YAAA,iCAEjC,OAAA,CACF,eAAA,EACA,YAAA,CAAa,QAAA,CAAS,aAAA,EAAe,YAAA"}
|
package/dist/Handler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Handler.js","names":[],"sources":["../src/Handler.ts"],"sourcesContent":["import type { FunctionSpec, RuntimeAndFunctionType } from \"@confect/core\";\nimport type * as FunctionProvenance from \"@confect/core/FunctionProvenance\";\nimport type { NodeContext } from \"@effect/platform-node\";\nimport type { Effect } from \"effect\";\nimport type * as ActionCtx from \"./ActionCtx\";\nimport type * as ActionRunner from \"./ActionRunner\";\nimport type * as Auth from \"./Auth\";\nimport type * as DatabaseReader from \"./DatabaseReader\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as DatabaseWriter from \"./DatabaseWriter\";\nimport type * as DataModel from \"./DataModel\";\nimport type * as MutationCtx from \"./MutationCtx\";\nimport type * as MutationRunner from \"./MutationRunner\";\nimport type * as QueryCtx from \"./QueryCtx\";\nimport type * as QueryRunner from \"./QueryRunner\";\nimport type * as RegisteredFunction from \"./RegisteredFunction\";\nimport type * as Scheduler from \"./Scheduler\";\nimport type { StorageActionWriter } from \"./StorageActionWriter\";\nimport type { StorageReader } from \"./StorageReader\";\nimport type { StorageWriter } from \"./StorageWriter\";\nimport type * as VectorSearch from \"./VectorSearch\";\n\nexport type Handler<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n> =\n FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<\n FunctionSpec_,\n FunctionProvenance.AnyConvex\n >\n ? ConvexProvenanceHandler<FunctionSpec_>\n : FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<\n FunctionSpec_,\n FunctionProvenance.AnyConfect\n >\n ? ConfectProvenanceHandler<DatabaseSchema_, FunctionSpec_>\n : never;\n\ntype ConvexProvenanceHandler<\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConvex>,\n> = RegisteredFunction.ConvexRegisteredFunction<FunctionSpec_>;\n\ntype ConfectProvenanceHandler<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConfect>,\n> =\n FunctionSpec_ extends FunctionSpec.WithFunctionType<FunctionSpec_, \"query\">\n ? ConfectProvenanceQuery<DatabaseSchema_, FunctionSpec_>\n : FunctionSpec_ extends FunctionSpec.WithFunctionType<\n FunctionSpec_,\n \"mutation\"\n >\n ? ConfectProvenanceMutation<DatabaseSchema_, FunctionSpec_>\n : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<\n FunctionSpec_,\n RuntimeAndFunctionType.ConvexAction\n >\n ? ConvexRuntimeAction<DatabaseSchema_, FunctionSpec_>\n : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<\n FunctionSpec_,\n RuntimeAndFunctionType.NodeAction\n >\n ? NodeRuntimeAction<DatabaseSchema_, FunctionSpec_>\n : never;\n\nexport type ConfectProvenanceQuery<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyQuery>,\n> = Base<\n FunctionSpec_,\n | DatabaseReader.DatabaseReader<DatabaseSchema_>\n | Auth.Auth\n | StorageReader\n | QueryRunner.QueryRunner\n | QueryCtx.QueryCtx<DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>>\n>;\n\nexport type ConfectProvenanceMutation<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyMutation>,\n> = Base<\n FunctionSpec_,\n | DatabaseReader.DatabaseReader<DatabaseSchema_>\n | DatabaseWriter.DatabaseWriter<DatabaseSchema_>\n | Auth.Auth\n | Scheduler.Scheduler\n | StorageReader\n | StorageWriter\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | MutationCtx.MutationCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >\n>;\n\ntype ActionServices<DatabaseSchema_ extends DatabaseSchema.AnyWithProps> =\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | VectorSearch.VectorSearch<DataModel.FromSchema<DatabaseSchema_>>\n | ActionCtx.ActionCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >;\n\nexport type ConvexRuntimeAction<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyAction>,\n> = Base<FunctionSpec_, ActionServices<DatabaseSchema_>>;\n\nexport type NodeRuntimeAction<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.NodeAction>,\n> = Base<\n FunctionSpec_,\n ActionServices<DatabaseSchema_> | NodeContext.NodeContext\n>;\n\ntype Base<FunctionSpec_ extends FunctionSpec.AnyWithProps, R> = (\n args: FunctionSpec.Args<FunctionSpec_>,\n) => Effect.Effect
|
|
1
|
+
{"version":3,"file":"Handler.js","names":[],"sources":["../src/Handler.ts"],"sourcesContent":["import type { FunctionSpec, RuntimeAndFunctionType } from \"@confect/core\";\nimport type * as FunctionProvenance from \"@confect/core/FunctionProvenance\";\nimport type { NodeContext } from \"@effect/platform-node\";\nimport type { Effect } from \"effect\";\nimport type * as ActionCtx from \"./ActionCtx\";\nimport type * as ActionRunner from \"./ActionRunner\";\nimport type * as Auth from \"./Auth\";\nimport type * as DatabaseReader from \"./DatabaseReader\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as DatabaseWriter from \"./DatabaseWriter\";\nimport type * as DataModel from \"./DataModel\";\nimport type * as MutationCtx from \"./MutationCtx\";\nimport type * as MutationRunner from \"./MutationRunner\";\nimport type * as QueryCtx from \"./QueryCtx\";\nimport type * as QueryRunner from \"./QueryRunner\";\nimport type * as RegisteredFunction from \"./RegisteredFunction\";\nimport type * as Scheduler from \"./Scheduler\";\nimport type { StorageActionWriter } from \"./StorageActionWriter\";\nimport type { StorageReader } from \"./StorageReader\";\nimport type { StorageWriter } from \"./StorageWriter\";\nimport type * as VectorSearch from \"./VectorSearch\";\n\nexport type Handler<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n> =\n FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<\n FunctionSpec_,\n FunctionProvenance.AnyConvex\n >\n ? ConvexProvenanceHandler<FunctionSpec_>\n : FunctionSpec_ extends FunctionSpec.WithFunctionProvenance<\n FunctionSpec_,\n FunctionProvenance.AnyConfect\n >\n ? ConfectProvenanceHandler<DatabaseSchema_, FunctionSpec_>\n : never;\n\ntype ConvexProvenanceHandler<\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConvex>,\n> = RegisteredFunction.ConvexRegisteredFunction<FunctionSpec_>;\n\ntype ConfectProvenanceHandler<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionProvenance<FunctionProvenance.AnyConfect>,\n> =\n FunctionSpec_ extends FunctionSpec.WithFunctionType<FunctionSpec_, \"query\">\n ? ConfectProvenanceQuery<DatabaseSchema_, FunctionSpec_>\n : FunctionSpec_ extends FunctionSpec.WithFunctionType<\n FunctionSpec_,\n \"mutation\"\n >\n ? ConfectProvenanceMutation<DatabaseSchema_, FunctionSpec_>\n : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<\n FunctionSpec_,\n RuntimeAndFunctionType.ConvexAction\n >\n ? ConvexRuntimeAction<DatabaseSchema_, FunctionSpec_>\n : FunctionSpec_ extends FunctionSpec.WithRuntimeAndFunctionType<\n FunctionSpec_,\n RuntimeAndFunctionType.NodeAction\n >\n ? NodeRuntimeAction<DatabaseSchema_, FunctionSpec_>\n : never;\n\nexport type ConfectProvenanceQuery<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyQuery>,\n> = Base<\n FunctionSpec_,\n | DatabaseReader.DatabaseReader<DatabaseSchema_>\n | Auth.Auth\n | StorageReader\n | QueryRunner.QueryRunner\n | QueryCtx.QueryCtx<DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>>\n>;\n\nexport type ConfectProvenanceMutation<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyMutation>,\n> = Base<\n FunctionSpec_,\n | DatabaseReader.DatabaseReader<DatabaseSchema_>\n | DatabaseWriter.DatabaseWriter<DatabaseSchema_>\n | Auth.Auth\n | Scheduler.Scheduler\n | StorageReader\n | StorageWriter\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | MutationCtx.MutationCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >\n>;\n\ntype ActionServices<DatabaseSchema_ extends DatabaseSchema.AnyWithProps> =\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | VectorSearch.VectorSearch<DataModel.FromSchema<DatabaseSchema_>>\n | ActionCtx.ActionCtx<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >;\n\nexport type ConvexRuntimeAction<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyAction>,\n> = Base<FunctionSpec_, ActionServices<DatabaseSchema_>>;\n\nexport type NodeRuntimeAction<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends\n FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.NodeAction>,\n> = Base<\n FunctionSpec_,\n ActionServices<DatabaseSchema_> | NodeContext.NodeContext\n>;\n\ntype Base<FunctionSpec_ extends FunctionSpec.AnyWithProps, R> = (\n args: FunctionSpec.Args<FunctionSpec_>,\n) => Effect.Effect<\n FunctionSpec.Returns<FunctionSpec_>,\n FunctionSpec.Error<FunctionSpec_>,\n R\n>;\n\nexport type Any = AnyConfectProvenance | AnyConvexProvenance;\n\nexport type AnyConfectProvenance = Base<FunctionSpec.AnyConfect, any>;\n\nexport type AnyConvexProvenance = RegisteredFunction.Any;\n\nexport type WithName<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n FunctionName extends string,\n> = Handler<\n DatabaseSchema_,\n FunctionSpec.WithName<FunctionSpec_, FunctionName>\n>;\n"],"mappings":""}
|
package/dist/MutationRunner.d.ts
CHANGED
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
import { Context, Layer,
|
|
1
|
+
import { Context, Effect, Layer, ParseResult } from "effect";
|
|
2
2
|
import * as Ref$1 from "@confect/core/Ref";
|
|
3
3
|
import { GenericMutationCtx } from "convex/server";
|
|
4
|
-
import * as effect_ParseResult0 from "effect/ParseResult";
|
|
5
|
-
import * as effect_Effect0 from "effect/Effect";
|
|
6
4
|
|
|
7
5
|
//#region src/MutationRunner.d.ts
|
|
8
6
|
declare namespace MutationRunner_d_exports {
|
|
9
|
-
export {
|
|
7
|
+
export { MutationRunner, layer };
|
|
10
8
|
}
|
|
11
|
-
declare const MutationRunner: Context.Tag<(<Mutation extends Ref$1.AnyMutation>(mutation: Mutation, args: Ref$1.
|
|
9
|
+
declare const MutationRunner: Context.Tag<(<Mutation extends Ref$1.AnyMutation>(mutation: Mutation, ...args: Ref$1.OptionalArgs<Mutation>) => Effect.Effect<Ref$1.Returns<Mutation>, Ref$1.Error<Mutation> | ParseResult.ParseError>), <Mutation extends Ref$1.AnyMutation>(mutation: Mutation, ...args: Ref$1.OptionalArgs<Mutation>) => Effect.Effect<Ref$1.Returns<Mutation>, Ref$1.Error<Mutation> | ParseResult.ParseError>>;
|
|
12
10
|
type MutationRunner = typeof MutationRunner.Identifier;
|
|
13
|
-
declare const layer: (runMutation: GenericMutationCtx<any>["runMutation"]) => Layer.Layer<(<Mutation extends Ref$1.AnyMutation>(mutation: Mutation, args: Ref$1.
|
|
14
|
-
declare const MutationRollback_base: Schema.TaggedErrorClass<MutationRollback, "MutationRollback", {
|
|
15
|
-
readonly _tag: Schema.tag<"MutationRollback">;
|
|
16
|
-
} & {
|
|
17
|
-
mutationName: typeof Schema.String;
|
|
18
|
-
error: typeof Schema.Unknown;
|
|
19
|
-
}>;
|
|
20
|
-
declare class MutationRollback extends MutationRollback_base {
|
|
21
|
-
get message(): string;
|
|
22
|
-
}
|
|
11
|
+
declare const layer: (runMutation: GenericMutationCtx<any>["runMutation"]) => Layer.Layer<(<Mutation extends Ref$1.AnyMutation>(mutation: Mutation, ...args: Ref$1.OptionalArgs<Mutation>) => Effect.Effect<Ref$1.Returns<Mutation>, Ref$1.Error<Mutation> | ParseResult.ParseError>), never, never>;
|
|
23
12
|
//#endregion
|
|
24
|
-
export {
|
|
13
|
+
export { MutationRunner, MutationRunner_d_exports, layer };
|
|
25
14
|
//# sourceMappingURL=MutationRunner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutationRunner.d.ts","names":[],"sources":["../src/MutationRunner.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"MutationRunner.d.ts","names":[],"sources":["../src/MutationRunner.ts"],"mappings":";;;;;;;;cAqBa,cAAA,EAAc,OAAA,CAAA,GAAA,oBAdP,KAAA,CAAI,WAAA,EAAW,QAAA,EACrB,QAAA,KAAQ,IAAA,EACT,KAAA,CAAI,YAAA,CAAa,QAAA,MACzB,MAAA,CAAO,MAAA,CACR,KAAA,CAAI,OAAA,CAAQ,QAAA,GACZ,KAAA,CAAI,KAAA,CAAM,QAAA,IAAY,WAAA,CAAY,UAAA,sBALlB,KAAA,CAAI,WAAA,EAAW,QAAA,EACrB,QAAA,KAAQ,IAAA,EACT,KAAA,CAAI,YAAA,CAAa,QAAA,MACzB,MAAA,CAAO,MAAA,CACR,KAAA,CAAI,OAAA,CAAQ,QAAA,GACZ,KAAA,CAAI,KAAA,CAAM,QAAA,IAAY,WAAA,CAAY,UAAA;AAAA,KAY1B,cAAA,UAAwB,cAAA,CAAe,UAAA;AAAA,cAEtC,KAAA,GAAS,WAAA,EAAa,kBAAA,yBAAsC,KAAA,CAAA,KAAA,oBAnBrD,KAAA,CAAI,WAAA,EAAW,QAAA,EACrB,QAAA,KAAQ,IAAA,EACT,KAAA,CAAI,YAAA,CAAa,QAAA,MACzB,MAAA,CAAO,MAAA,CACR,KAAA,CAAI,OAAA,CAAQ,QAAA,GACZ,KAAA,CAAI,KAAA,CAAM,QAAA,IAAY,WAAA,CAAY,UAAA"}
|
package/dist/MutationRunner.js
CHANGED
|
@@ -1,27 +1,17 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { Context, Layer
|
|
2
|
+
import { Context, Layer } from "effect";
|
|
3
3
|
import * as Ref$1 from "@confect/core/Ref";
|
|
4
4
|
import "convex/server";
|
|
5
5
|
|
|
6
6
|
//#region src/MutationRunner.ts
|
|
7
7
|
var MutationRunner_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
-
MutationRollback: () => MutationRollback,
|
|
9
8
|
MutationRunner: () => MutationRunner,
|
|
10
9
|
layer: () => layer
|
|
11
10
|
});
|
|
12
|
-
const make = (runMutation) => (mutation, args) => Ref$1.runWithCodec(mutation, args, (functionReference, encodedArgs) => runMutation(functionReference, encodedArgs));
|
|
11
|
+
const make = (runMutation) => (mutation, ...args) => Ref$1.runWithCodec(mutation, args[0] ?? {}, (functionReference, encodedArgs) => runMutation(functionReference, encodedArgs));
|
|
13
12
|
const MutationRunner = Context.GenericTag("@confect/server/MutationRunner");
|
|
14
13
|
const layer = (runMutation) => Layer.succeed(MutationRunner, make(runMutation));
|
|
15
|
-
var MutationRollback = class extends Schema.TaggedError()("MutationRollback", {
|
|
16
|
-
mutationName: Schema.String,
|
|
17
|
-
error: Schema.Unknown
|
|
18
|
-
}) {
|
|
19
|
-
/* v8 ignore start */
|
|
20
|
-
get message() {
|
|
21
|
-
return `Mutation ${this.mutationName} failed and was rolled back.\n\n${this.error}`;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
14
|
|
|
25
15
|
//#endregion
|
|
26
|
-
export {
|
|
16
|
+
export { MutationRunner, MutationRunner_exports, layer };
|
|
27
17
|
//# sourceMappingURL=MutationRunner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutationRunner.js","names":["Ref"],"sources":["../src/MutationRunner.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport { type GenericMutationCtx } from \"convex/server\";\nimport { Context, Layer
|
|
1
|
+
{"version":3,"file":"MutationRunner.js","names":["Ref"],"sources":["../src/MutationRunner.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport { type GenericMutationCtx } from \"convex/server\";\nimport type { ParseResult, Effect } from \"effect\";\nimport { Context, Layer } from \"effect\";\n\nconst make =\n (runMutation: GenericMutationCtx<any>[\"runMutation\"]) =>\n <Mutation extends Ref.AnyMutation>(\n mutation: Mutation,\n ...args: Ref.OptionalArgs<Mutation>\n ): Effect.Effect<\n Ref.Returns<Mutation>,\n Ref.Error<Mutation> | ParseResult.ParseError\n > =>\n Ref.runWithCodec(\n mutation,\n (args[0] ?? {}) as Ref.Args<Mutation>,\n (functionReference, encodedArgs) =>\n runMutation(functionReference, encodedArgs),\n );\n\nexport const MutationRunner = Context.GenericTag<ReturnType<typeof make>>(\n \"@confect/server/MutationRunner\",\n);\nexport type MutationRunner = typeof MutationRunner.Identifier;\n\nexport const layer = (runMutation: GenericMutationCtx<any>[\"runMutation\"]) =>\n Layer.succeed(MutationRunner, make(runMutation));\n"],"mappings":";;;;;;;;;;AAKA,MAAM,QACH,iBAEC,UACA,GAAG,SAKHA,MAAI,aACF,UACC,KAAK,MAAM,EAAE,GACb,mBAAmB,gBAClB,YAAY,mBAAmB,YAAY,CAC9C;AAEL,MAAa,iBAAiB,QAAQ,WACpC,iCACD;AAGD,MAAa,SAAS,gBACpB,MAAM,QAAQ,gBAAgB,KAAK,YAAY,CAAC"}
|
|
@@ -24,7 +24,7 @@ type QueryInitializer<DataModel_ extends AnyWithProps$2, TableName extends Table
|
|
|
24
24
|
readonly search: <IndexName extends keyof SearchIndexes<_ConvexTableInfo>>(indexName: IndexName, searchFilter: (q: SearchFilterBuilder<DocumentByInfo<_ConvexTableInfo>, NamedSearchIndex<_ConvexTableInfo, IndexName>>) => SearchFilter) => OrderedQuery$1<_TableInfo, TableName>;
|
|
25
25
|
};
|
|
26
26
|
declare const make: <Tables extends AnyWithProps, TableName extends Name<Tables>>(tableName: TableName, convexDatabaseReader: BaseDatabaseReader<ToConvex<FromTables<Tables>>>, table: WithName<Tables, TableName>) => QueryInitializer<DataModel<Tables>, TableName, TableInfoWithName<DataModel<Tables>, TableName>, TableInfoWithName_<DataModel<Tables>, TableName>>;
|
|
27
|
-
declare const getById: <Tables extends AnyWithProps, TableName extends Name<Tables>>(tableName: TableName, convexDatabaseReader: BaseDatabaseReader<ToConvex<FromTables<Tables>>>, table: WithName<Tables, TableName>) => (id: GenericId<TableName>) => Effect.Effect<any,
|
|
27
|
+
declare const getById: <Tables extends AnyWithProps, TableName extends Name<Tables>>(tableName: TableName, convexDatabaseReader: BaseDatabaseReader<ToConvex<FromTables<Tables>>>, table: WithName<Tables, TableName>) => (id: GenericId<TableName>) => Effect.Effect<any, DocumentDecodeError | GetByIdFailure, never>;
|
|
28
28
|
declare const GetByIdFailure_base: Schema.TaggedErrorClass<GetByIdFailure, "GetByIdFailure", {
|
|
29
29
|
readonly _tag: Schema.tag<"GetByIdFailure">;
|
|
30
30
|
} & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryInitializer.d.ts","names":[],"sources":["../src/QueryInitializer.ts"],"mappings":";;;;;;;;;;;;;;KA6BK,gBAAA,oBACg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aAAA,CAAc,gBAAA,GACtD,SAAA,EAAW,SAAA,EACX,YAAA,GACE,CAAA,EAAG,mBAAA,CACD,cAAA,CAAe,gBAAA,GACf,gBAAA,CAAiB,gBAAA,EAAkB,SAAA,OAElC,YAAA,KACF,cAAA,CAA0B,UAAA,EAAY,SAAA;AAAA;AAAA,cAGhC,IAAA,kBACI,YAAA,oBACG,IAAA,CAAW,MAAA,GAE7B,SAAA,EAAW,SAAA,EACX,oBAAA,EAAsB,kBAAA,CACpB,QAAA,CAAmB,UAAA,CAAqB,MAAA,KAE1C,KAAA,EAAO,QAAA,CAAe,MAAA,EAAQ,SAAA,MAC7B,gBAAA,CACD,SAAA,CAAoB,MAAA,GACpB,SAAA,EACA,iBAAA,CAA4B,SAAA,CAAoB,MAAA,GAAS,SAAA,GACzD,kBAAA,CAA6B,SAAA,CAAoB,MAAA,GAAS,SAAA;AAAA,cA2K/C,OAAA,kBACK,YAAA,oBAAsC,IAAA,CAAW,MAAA,GAC/D,SAAA,EAAW,SAAA,EACX,oBAAA,EAAsB,kBAAA,CACpB,QAAA,CAAmB,UAAA,CAAqB,MAAA,KAE1C,KAAA,EAAO,QAAA,CAAe,MAAA,EAAQ,SAAA,OAE/B,EAAA,EAAI,SAAA,CAAU,SAAA,MAAU,MAAA,CAAA,MAAA,MAAA,mBAAA,GAAA,cAAA;AAAA,cAOrB,mBAAA;;;;;;cAEO,cAAA,SAAuB,mBAAA;EAAA,IAOrB,OAAA,CAAA;AAAA;AAAA,cAOd,sBAAA;;;;;;;cAEY,iBAAA,SAA0B,sBAAA;EAAA,IAQxB,OAAA,CAAA;AAAA"}
|
package/dist/QueryRunner.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { Context, Layer } from "effect";
|
|
1
|
+
import { Context, Effect, Layer, ParseResult } from "effect";
|
|
2
2
|
import * as Ref$1 from "@confect/core/Ref";
|
|
3
3
|
import { GenericQueryCtx } from "convex/server";
|
|
4
|
-
import * as effect_ParseResult0 from "effect/ParseResult";
|
|
5
|
-
import * as effect_Effect0 from "effect/Effect";
|
|
6
4
|
|
|
7
5
|
//#region src/QueryRunner.d.ts
|
|
8
6
|
declare namespace QueryRunner_d_exports {
|
|
9
7
|
export { QueryRunner, layer };
|
|
10
8
|
}
|
|
11
|
-
declare const QueryRunner: Context.Tag<(<Query extends Ref$1.AnyQuery>(query: Query, args: Ref$1.
|
|
9
|
+
declare const QueryRunner: Context.Tag<(<Query extends Ref$1.AnyQuery>(query: Query, ...args: Ref$1.OptionalArgs<Query>) => Effect.Effect<Ref$1.Returns<Query>, Ref$1.Error<Query> | ParseResult.ParseError>), <Query extends Ref$1.AnyQuery>(query: Query, ...args: Ref$1.OptionalArgs<Query>) => Effect.Effect<Ref$1.Returns<Query>, Ref$1.Error<Query> | ParseResult.ParseError>>;
|
|
12
10
|
type QueryRunner = typeof QueryRunner.Identifier;
|
|
13
|
-
declare const layer: (runQuery: GenericQueryCtx<any>["runQuery"]) => Layer.Layer<(<Query extends Ref$1.AnyQuery>(query: Query, args: Ref$1.
|
|
11
|
+
declare const layer: (runQuery: GenericQueryCtx<any>["runQuery"]) => Layer.Layer<(<Query extends Ref$1.AnyQuery>(query: Query, ...args: Ref$1.OptionalArgs<Query>) => Effect.Effect<Ref$1.Returns<Query>, Ref$1.Error<Query> | ParseResult.ParseError>), never, never>;
|
|
14
12
|
//#endregion
|
|
15
13
|
export { QueryRunner, QueryRunner_d_exports, layer };
|
|
16
14
|
//# sourceMappingURL=QueryRunner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryRunner.d.ts","names":[],"sources":["../src/QueryRunner.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"QueryRunner.d.ts","names":[],"sources":["../src/QueryRunner.ts"],"mappings":";;;;;;;;cAqBa,WAAA,EAAW,OAAA,CAAA,GAAA,iBAdP,KAAA,CAAI,QAAA,EAAQ,KAAA,EAClB,KAAA,KAAK,IAAA,EACH,KAAA,CAAI,YAAA,CAAa,KAAA,MACzB,MAAA,CAAO,MAAA,CACR,KAAA,CAAI,OAAA,CAAQ,KAAA,GACZ,KAAA,CAAI,KAAA,CAAM,KAAA,IAAS,WAAA,CAAY,UAAA,mBALlB,KAAA,CAAI,QAAA,EAAQ,KAAA,EAClB,KAAA,KAAK,IAAA,EACH,KAAA,CAAI,YAAA,CAAa,KAAA,MACzB,MAAA,CAAO,MAAA,CACR,KAAA,CAAI,OAAA,CAAQ,KAAA,GACZ,KAAA,CAAI,KAAA,CAAM,KAAA,IAAS,WAAA,CAAY,UAAA;AAAA,KAYvB,WAAA,UAAqB,WAAA,CAAY,UAAA;AAAA,cAEhC,KAAA,GAAS,QAAA,EAAU,eAAA,sBAAgC,KAAA,CAAA,KAAA,iBAnB/C,KAAA,CAAI,QAAA,EAAQ,KAAA,EAClB,KAAA,KAAK,IAAA,EACH,KAAA,CAAI,YAAA,CAAa,KAAA,MACzB,MAAA,CAAO,MAAA,CACR,KAAA,CAAI,OAAA,CAAQ,KAAA,GACZ,KAAA,CAAI,KAAA,CAAM,KAAA,IAAS,WAAA,CAAY,UAAA"}
|
package/dist/QueryRunner.js
CHANGED
|
@@ -8,7 +8,7 @@ var QueryRunner_exports = /* @__PURE__ */ __exportAll({
|
|
|
8
8
|
QueryRunner: () => QueryRunner,
|
|
9
9
|
layer: () => layer
|
|
10
10
|
});
|
|
11
|
-
const make = (runQuery) => (query, args) => Ref$1.runWithCodec(query, args, (functionReference, encodedArgs) => runQuery(functionReference, encodedArgs));
|
|
11
|
+
const make = (runQuery) => (query, ...args) => Ref$1.runWithCodec(query, args[0] ?? {}, (functionReference, encodedArgs) => runQuery(functionReference, encodedArgs));
|
|
12
12
|
const QueryRunner = Context.GenericTag("@confect/server/QueryRunner");
|
|
13
13
|
const layer = (runQuery) => Layer.succeed(QueryRunner, make(runQuery));
|
|
14
14
|
|
package/dist/QueryRunner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryRunner.js","names":["Ref"],"sources":["../src/QueryRunner.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport { type GenericQueryCtx } from \"convex/server\";\nimport { Context, Layer } from \"effect\";\n\nconst make =\n (runQuery: GenericQueryCtx<any>[\"runQuery\"]) =>\n <Query extends Ref.AnyQuery>(query: Query
|
|
1
|
+
{"version":3,"file":"QueryRunner.js","names":["Ref"],"sources":["../src/QueryRunner.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport { type GenericQueryCtx } from \"convex/server\";\nimport type { ParseResult, Effect } from \"effect\";\nimport { Context, Layer } from \"effect\";\n\nconst make =\n (runQuery: GenericQueryCtx<any>[\"runQuery\"]) =>\n <Query extends Ref.AnyQuery>(\n query: Query,\n ...args: Ref.OptionalArgs<Query>\n ): Effect.Effect<\n Ref.Returns<Query>,\n Ref.Error<Query> | ParseResult.ParseError\n > =>\n Ref.runWithCodec(\n query,\n (args[0] ?? {}) as Ref.Args<Query>,\n (functionReference, encodedArgs) =>\n runQuery(functionReference, encodedArgs),\n );\n\nexport const QueryRunner = Context.GenericTag<ReturnType<typeof make>>(\n \"@confect/server/QueryRunner\",\n);\nexport type QueryRunner = typeof QueryRunner.Identifier;\n\nexport const layer = (runQuery: GenericQueryCtx<any>[\"runQuery\"]) =>\n Layer.succeed(QueryRunner, make(runQuery));\n"],"mappings":";;;;;;;;;;AAKA,MAAM,QACH,cAEC,OACA,GAAG,SAKHA,MAAI,aACF,OACC,KAAK,MAAM,EAAE,GACb,mBAAmB,gBAClB,SAAS,mBAAmB,YAAY,CAC3C;AAEL,MAAa,cAAc,QAAQ,WACjC,8BACD;AAGD,MAAa,SAAS,aACpB,MAAM,QAAQ,aAAa,KAAK,SAAS,CAAC"}
|