convex-helpers 0.1.124 → 0.1.126
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/browser.d.ts +4 -4
- package/browser.d.ts.map +1 -1
- package/browser.ts +16 -4
- package/functionReferences.test.ts +359 -0
- package/package.json +2 -2
- package/react/cache/hooks.d.ts +5 -4
- package/react/cache/hooks.d.ts.map +1 -1
- package/react/cache/hooks.js +3 -1
- package/react/cache/hooks.ts +12 -7
- package/react/cache/provider.d.ts +2 -2
- package/react/cache/provider.d.ts.map +1 -1
- package/react/cache/provider.tsx +9 -2
- package/react/sessions.d.ts +5 -3
- package/react/sessions.d.ts.map +1 -1
- package/react/sessions.ts +10 -6
- package/react.d.ts +3 -3
- package/react.d.ts.map +1 -1
- package/react.test.ts +114 -0
- package/react.ts +5 -1
- package/server/migrations.d.ts +6 -5
- package/server/migrations.d.ts.map +1 -1
- package/server/migrations.ts +9 -4
- package/server/retries.d.ts +2 -2
- package/server/retries.d.ts.map +1 -1
- package/server/retries.ts +14 -6
- package/server/sessions.d.ts +4 -2
- package/server/sessions.d.ts.map +1 -1
- package/server/sessions.ts +13 -9
- package/server/stream.d.ts +1 -1
- package/server/stream.d.ts.map +1 -1
- package/server/stream.js +24 -11
- package/server/stream.ts +36 -17
- package/testing.d.ts +4 -4
- package/testing.d.ts.map +1 -1
- package/testing.ts +14 -3
package/browser.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BetterOmit, EmptyObject } from "./index.js";
|
|
2
2
|
import type { ConvexClient, ConvexHttpClient } from "convex/browser";
|
|
3
3
|
import type { FunctionArgs, FunctionReturnType } from "convex/server";
|
|
4
|
-
import type { FunctionReference } from "convex/server";
|
|
4
|
+
import type { FunctionReference, FunctionReference_future } from "convex/server";
|
|
5
5
|
import type { Value } from "convex/values";
|
|
6
6
|
export type ArgsArray<Injected extends Record<string, Value>, FullArgs extends Injected> = keyof FullArgs extends keyof Injected ? [args?: EmptyObject] : [args: BetterOmit<FullArgs, keyof Injected>];
|
|
7
7
|
/**
|
|
@@ -23,8 +23,8 @@ export type ArgsArray<Injected extends Record<string, Value>, FullArgs extends I
|
|
|
23
23
|
* @returns { query, mutation, action } functions with the injected arguments
|
|
24
24
|
*/
|
|
25
25
|
export declare function withArgs<A extends Record<string, Value>>(client: ConvexClient | ConvexHttpClient, injectedArgs: A): {
|
|
26
|
-
query<Query extends FunctionReference<"query">>(query: Query, ...args: ArgsArray<A, FunctionArgs<Query>>): Promise<Awaited<FunctionReturnType<Query>>>;
|
|
27
|
-
mutation<Mutation extends FunctionReference<"mutation">>(mutation: Mutation, ...args: ArgsArray<A, FunctionArgs<Mutation>>): Promise<Awaited<FunctionReturnType<Mutation>>>;
|
|
28
|
-
action<Action extends FunctionReference<"action">>(action: Action, ...args: ArgsArray<A, FunctionArgs<Action>>): Promise<Awaited<FunctionReturnType<Action>>>;
|
|
26
|
+
query<Query extends FunctionReference<"query"> | FunctionReference_future<"query">>(query: Query, ...args: ArgsArray<A, FunctionArgs<Query>>): Promise<Awaited<FunctionReturnType<Query>>>;
|
|
27
|
+
mutation<Mutation extends FunctionReference<"mutation"> | FunctionReference_future<"mutation">>(mutation: Mutation, ...args: ArgsArray<A, FunctionArgs<Mutation>>): Promise<Awaited<FunctionReturnType<Mutation>>>;
|
|
28
|
+
action<Action extends FunctionReference<"action"> | FunctionReference_future<"action">>(action: Action, ...args: ArgsArray<A, FunctionArgs<Action>>): Promise<Awaited<FunctionReturnType<Action>>>;
|
|
29
29
|
};
|
|
30
30
|
//# sourceMappingURL=browser.d.ts.map
|
package/browser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM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AG,wBAAwB,CAAC,UAAU,CAAC,YAE5D,QAAQ,WACT,SAAS,CAAC,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,GAC5C,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAMjD,MAAM,CACJ,MAAM,SACJ,iBAAiB,CAAC,QAAQ,CAAC,GAAG,wBAAwB,CAAC,QAAQ,CAAC,UAE1D,MAAM,WACL,SAAS,CAAC,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,GAC1C,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;EAOlD"}
|
package/browser.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { BetterOmit, EmptyObject } from "./index.js";
|
|
2
2
|
import type { ConvexClient, ConvexHttpClient } from "convex/browser";
|
|
3
3
|
import type { FunctionArgs, FunctionReturnType } from "convex/server";
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
FunctionReference,
|
|
6
|
+
FunctionReference_future,
|
|
7
|
+
} from "convex/server";
|
|
5
8
|
import type { Value } from "convex/values";
|
|
6
9
|
|
|
7
10
|
export type ArgsArray<
|
|
@@ -34,7 +37,10 @@ export function withArgs<A extends Record<string, Value>>(
|
|
|
34
37
|
injectedArgs: A,
|
|
35
38
|
) {
|
|
36
39
|
return {
|
|
37
|
-
query<
|
|
40
|
+
query<
|
|
41
|
+
Query extends
|
|
42
|
+
FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
43
|
+
>(
|
|
38
44
|
query: Query,
|
|
39
45
|
...args: ArgsArray<A, FunctionArgs<Query>>
|
|
40
46
|
): Promise<Awaited<FunctionReturnType<Query>>> {
|
|
@@ -43,7 +49,10 @@ export function withArgs<A extends Record<string, Value>>(
|
|
|
43
49
|
...injectedArgs,
|
|
44
50
|
} as FunctionArgs<Query>);
|
|
45
51
|
},
|
|
46
|
-
mutation<
|
|
52
|
+
mutation<
|
|
53
|
+
Mutation extends
|
|
54
|
+
FunctionReference<"mutation"> | FunctionReference_future<"mutation">,
|
|
55
|
+
>(
|
|
47
56
|
mutation: Mutation,
|
|
48
57
|
...args: ArgsArray<A, FunctionArgs<Mutation>>
|
|
49
58
|
): Promise<Awaited<FunctionReturnType<Mutation>>> {
|
|
@@ -52,7 +61,10 @@ export function withArgs<A extends Record<string, Value>>(
|
|
|
52
61
|
...injectedArgs,
|
|
53
62
|
} as FunctionArgs<Mutation>);
|
|
54
63
|
},
|
|
55
|
-
action<
|
|
64
|
+
action<
|
|
65
|
+
Action extends
|
|
66
|
+
FunctionReference<"action"> | FunctionReference_future<"action">,
|
|
67
|
+
>(
|
|
56
68
|
action: Action,
|
|
57
69
|
...args: ArgsArray<A, FunctionArgs<Action>>
|
|
58
70
|
): Promise<Awaited<FunctionReturnType<Action>>> {
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import { expectTypeOf, test } from "vitest";
|
|
2
|
+
import type { ConvexClient } from "convex/browser";
|
|
3
|
+
import {
|
|
4
|
+
useQueries as useQueriesCore,
|
|
5
|
+
useQuery as useQueryCore,
|
|
6
|
+
usePaginatedQuery as usePaginatedQueryCore,
|
|
7
|
+
} from "convex/react";
|
|
8
|
+
import type {
|
|
9
|
+
FunctionArgs,
|
|
10
|
+
FunctionReference,
|
|
11
|
+
FunctionReference_future,
|
|
12
|
+
GenericActionCtx,
|
|
13
|
+
GenericDataModel,
|
|
14
|
+
PaginationOptions,
|
|
15
|
+
PaginationResult,
|
|
16
|
+
Scheduler,
|
|
17
|
+
} from "convex/server";
|
|
18
|
+
import { withArgs } from "./browser.js";
|
|
19
|
+
import {
|
|
20
|
+
makeUseQueryWithStatus,
|
|
21
|
+
useQuery,
|
|
22
|
+
usePaginatedQuery,
|
|
23
|
+
} from "./react.js";
|
|
24
|
+
import {
|
|
25
|
+
useQueries as useCachedQueries,
|
|
26
|
+
useQuery as useCachedQuery,
|
|
27
|
+
usePaginatedQuery as useCachedPaginatedQuery,
|
|
28
|
+
} from "./react/cache/hooks.js";
|
|
29
|
+
import {
|
|
30
|
+
ConvexReactSessionClient,
|
|
31
|
+
useSessionQuery,
|
|
32
|
+
useSessionMutation,
|
|
33
|
+
useSessionAction,
|
|
34
|
+
useSessionPaginatedQuery,
|
|
35
|
+
} from "./react/sessions.js";
|
|
36
|
+
import { runSessionFunctions, type SessionId } from "./server/sessions.js";
|
|
37
|
+
import {
|
|
38
|
+
startMigration,
|
|
39
|
+
startMigrationsSerially,
|
|
40
|
+
getStatus,
|
|
41
|
+
cancelMigration,
|
|
42
|
+
} from "./server/migrations.js";
|
|
43
|
+
import { makeActionRetrier } from "./server/retries.js";
|
|
44
|
+
import type { ConvexTestingHelper } from "./testing.js";
|
|
45
|
+
|
|
46
|
+
type Result = { value: string };
|
|
47
|
+
type Query = FunctionReference_future<
|
|
48
|
+
"query",
|
|
49
|
+
"public",
|
|
50
|
+
{ id: string },
|
|
51
|
+
Result
|
|
52
|
+
>;
|
|
53
|
+
type Mutation = FunctionReference_future<
|
|
54
|
+
"mutation",
|
|
55
|
+
"public",
|
|
56
|
+
{ id: string },
|
|
57
|
+
Result
|
|
58
|
+
>;
|
|
59
|
+
type Action = FunctionReference_future<
|
|
60
|
+
"action",
|
|
61
|
+
"public",
|
|
62
|
+
{ id: string },
|
|
63
|
+
Result
|
|
64
|
+
>;
|
|
65
|
+
type EmptyQuery = FunctionReference_future<
|
|
66
|
+
"query",
|
|
67
|
+
"public",
|
|
68
|
+
Record<string, never>,
|
|
69
|
+
Result
|
|
70
|
+
>;
|
|
71
|
+
|
|
72
|
+
test("query hooks match Convex 1.46 and compose with cached useQueries", () => {
|
|
73
|
+
expectTypeOf(useCachedQueries).toExtend<typeof useQueriesCore>();
|
|
74
|
+
expectTypeOf(useCachedQuery).toExtend<typeof useQueryCore>();
|
|
75
|
+
const useCachedQueryWithStatus = makeUseQueryWithStatus(useCachedQueries);
|
|
76
|
+
expectTypeOf(useCachedQueryWithStatus).toEqualTypeOf<typeof useQuery>();
|
|
77
|
+
|
|
78
|
+
// These callbacks are typechecked, but not run: hooks need a React render.
|
|
79
|
+
expectTypeOf((query: Query, empty: EmptyQuery, mutation: Mutation) => {
|
|
80
|
+
const result = useCachedQuery(query, { id: "one" });
|
|
81
|
+
expectTypeOf(result).toEqualTypeOf<Result | undefined>();
|
|
82
|
+
expectTypeOf(useCachedQuery(empty)).toEqualTypeOf<Result | undefined>();
|
|
83
|
+
useCachedQuery(query, "skip");
|
|
84
|
+
useCachedQuery(empty, "skip");
|
|
85
|
+
// @ts-expect-error Required query arguments cannot be omitted.
|
|
86
|
+
useCachedQuery(query);
|
|
87
|
+
// @ts-expect-error Argument types are preserved.
|
|
88
|
+
useCachedQuery(query, { id: 1 });
|
|
89
|
+
// @ts-expect-error Mutation references are not query references.
|
|
90
|
+
useCachedQuery(mutation, { id: "one" });
|
|
91
|
+
// @ts-expect-error Empty queries reject extra arguments.
|
|
92
|
+
useCachedQuery(empty, { id: "one" });
|
|
93
|
+
|
|
94
|
+
useCachedQueries({ first: { query, args: { id: "one" } } });
|
|
95
|
+
const status = useCachedQueryWithStatus(query, { id: "one" });
|
|
96
|
+
if (status.isSuccess) {
|
|
97
|
+
expectTypeOf(status.data).toEqualTypeOf<Result>();
|
|
98
|
+
}
|
|
99
|
+
expectTypeOf(useQuery(empty).data).toEqualTypeOf<Result | undefined>();
|
|
100
|
+
useQuery(query, "skip");
|
|
101
|
+
// @ts-expect-error Status queries also require their arguments.
|
|
102
|
+
useQuery(query);
|
|
103
|
+
// @ts-expect-error Status queries retain argument checking.
|
|
104
|
+
useCachedQueryWithStatus(query, { id: 1 });
|
|
105
|
+
}).toBeFunction();
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test("paginated hooks preserve the SDK's reference and result signatures", () => {
|
|
109
|
+
// Convex 1.46's paginated hooks still take a plain FunctionReference.
|
|
110
|
+
expectTypeOf(usePaginatedQuery).toExtend<typeof usePaginatedQueryCore>();
|
|
111
|
+
expectTypeOf(useCachedPaginatedQuery).toExtend<
|
|
112
|
+
typeof usePaginatedQueryCore
|
|
113
|
+
>();
|
|
114
|
+
type PaginatedQuery = FunctionReference<
|
|
115
|
+
"query",
|
|
116
|
+
"public",
|
|
117
|
+
{ channel: string; paginationOpts: PaginationOptions },
|
|
118
|
+
PaginationResult<Result>
|
|
119
|
+
>;
|
|
120
|
+
type SessionPaginatedQuery = FunctionReference<
|
|
121
|
+
"query",
|
|
122
|
+
"public",
|
|
123
|
+
{
|
|
124
|
+
sessionId: SessionId;
|
|
125
|
+
channel: string;
|
|
126
|
+
paginationOpts: PaginationOptions;
|
|
127
|
+
},
|
|
128
|
+
PaginationResult<Result>
|
|
129
|
+
>;
|
|
130
|
+
expectTypeOf((query: PaginatedQuery, sessionQuery: SessionPaginatedQuery) => {
|
|
131
|
+
expectTypeOf(
|
|
132
|
+
usePaginatedQuery(query, { channel: "one" }, { initialNumItems: 5 })
|
|
133
|
+
.results,
|
|
134
|
+
).toEqualTypeOf<Result[]>();
|
|
135
|
+
expectTypeOf(
|
|
136
|
+
useCachedPaginatedQuery(query, { channel: "one" }, { initialNumItems: 5 })
|
|
137
|
+
.results,
|
|
138
|
+
).toEqualTypeOf<Result[]>();
|
|
139
|
+
expectTypeOf(
|
|
140
|
+
useSessionPaginatedQuery(
|
|
141
|
+
sessionQuery,
|
|
142
|
+
{ channel: "one" },
|
|
143
|
+
{ initialNumItems: 5 },
|
|
144
|
+
)?.results,
|
|
145
|
+
).toEqualTypeOf<Result[] | undefined>();
|
|
146
|
+
usePaginatedQuery(query, "skip", { initialNumItems: 5 });
|
|
147
|
+
useCachedPaginatedQuery(query, "skip", { initialNumItems: 5 });
|
|
148
|
+
// @ts-expect-error Non-pagination arguments remain required.
|
|
149
|
+
usePaginatedQuery(query, {}, { initialNumItems: 5 });
|
|
150
|
+
// @ts-expect-error Non-pagination argument types are preserved.
|
|
151
|
+
useCachedPaginatedQuery(query, { channel: 1 }, { initialNumItems: 5 });
|
|
152
|
+
}).toBeFunction();
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test("client wrappers preserve future reference arguments and results", () => {
|
|
156
|
+
type InjectedQuery = FunctionReference_future<
|
|
157
|
+
"query",
|
|
158
|
+
"public",
|
|
159
|
+
{ injected: string; id: string },
|
|
160
|
+
Result
|
|
161
|
+
>;
|
|
162
|
+
type InjectedMutation = FunctionReference_future<
|
|
163
|
+
"mutation",
|
|
164
|
+
"public",
|
|
165
|
+
{ injected: string; id: string },
|
|
166
|
+
Result
|
|
167
|
+
>;
|
|
168
|
+
type InjectedAction = FunctionReference_future<
|
|
169
|
+
"action",
|
|
170
|
+
"public",
|
|
171
|
+
{ injected: string; id: string },
|
|
172
|
+
Result
|
|
173
|
+
>;
|
|
174
|
+
type OnlyInjected = FunctionReference_future<
|
|
175
|
+
"query",
|
|
176
|
+
"public",
|
|
177
|
+
{ injected: string },
|
|
178
|
+
Result
|
|
179
|
+
>;
|
|
180
|
+
expectTypeOf(
|
|
181
|
+
(
|
|
182
|
+
client: ConvexClient,
|
|
183
|
+
query: InjectedQuery,
|
|
184
|
+
mutation: InjectedMutation,
|
|
185
|
+
action: InjectedAction,
|
|
186
|
+
onlyInjected: OnlyInjected,
|
|
187
|
+
) => {
|
|
188
|
+
const injected = withArgs(client, { injected: "value" });
|
|
189
|
+
expectTypeOf(injected.query(query, { id: "one" })).toEqualTypeOf<
|
|
190
|
+
Promise<Result>
|
|
191
|
+
>();
|
|
192
|
+
expectTypeOf(injected.mutation(mutation, { id: "one" })).toEqualTypeOf<
|
|
193
|
+
Promise<Result>
|
|
194
|
+
>();
|
|
195
|
+
expectTypeOf(injected.action(action, { id: "one" })).toEqualTypeOf<
|
|
196
|
+
Promise<Result>
|
|
197
|
+
>();
|
|
198
|
+
expectTypeOf(injected.query(onlyInjected)).toEqualTypeOf<
|
|
199
|
+
Promise<Result>
|
|
200
|
+
>();
|
|
201
|
+
// @ts-expect-error Non-injected arguments remain required.
|
|
202
|
+
void injected.query(query);
|
|
203
|
+
// @ts-expect-error Non-injected argument types are preserved.
|
|
204
|
+
void injected.mutation(mutation, { id: 1 });
|
|
205
|
+
// @ts-expect-error Function kinds are preserved.
|
|
206
|
+
void injected.action(mutation, { id: "one" });
|
|
207
|
+
},
|
|
208
|
+
).toBeFunction();
|
|
209
|
+
expectTypeOf(
|
|
210
|
+
(
|
|
211
|
+
helper: ConvexTestingHelper,
|
|
212
|
+
query: Query,
|
|
213
|
+
mutation: Mutation,
|
|
214
|
+
action: Action,
|
|
215
|
+
) => {
|
|
216
|
+
expectTypeOf(helper.query(query, { id: "one" })).toEqualTypeOf<
|
|
217
|
+
Promise<Result>
|
|
218
|
+
>();
|
|
219
|
+
expectTypeOf(helper.mutation(mutation, { id: "one" })).toEqualTypeOf<
|
|
220
|
+
Promise<Result>
|
|
221
|
+
>();
|
|
222
|
+
expectTypeOf(helper.action(action, { id: "one" })).toEqualTypeOf<
|
|
223
|
+
Promise<Result>
|
|
224
|
+
>();
|
|
225
|
+
// @ts-expect-error Argument types are preserved by testing helpers.
|
|
226
|
+
void helper.query(query, { id: 1 });
|
|
227
|
+
},
|
|
228
|
+
).toBeFunction();
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
test("session wrappers accept future references without losing injected argument types", () => {
|
|
232
|
+
type SessionQuery = FunctionReference_future<
|
|
233
|
+
"query",
|
|
234
|
+
"public",
|
|
235
|
+
{ sessionId: SessionId | null; id: string },
|
|
236
|
+
Result
|
|
237
|
+
>;
|
|
238
|
+
type SessionMutation = FunctionReference_future<
|
|
239
|
+
"mutation",
|
|
240
|
+
"public",
|
|
241
|
+
{ sessionId: SessionId; id: string },
|
|
242
|
+
Result
|
|
243
|
+
>;
|
|
244
|
+
type SessionAction = FunctionReference_future<
|
|
245
|
+
"action",
|
|
246
|
+
"public",
|
|
247
|
+
{ sessionId: SessionId; id: string },
|
|
248
|
+
Result
|
|
249
|
+
>;
|
|
250
|
+
type OnlySession = FunctionReference_future<
|
|
251
|
+
"query",
|
|
252
|
+
"public",
|
|
253
|
+
{ sessionId: SessionId },
|
|
254
|
+
Result
|
|
255
|
+
>;
|
|
256
|
+
type OptionalSessionQuery = FunctionReference_future<
|
|
257
|
+
"query",
|
|
258
|
+
"public",
|
|
259
|
+
{ sessionId: SessionId; id?: string },
|
|
260
|
+
Result
|
|
261
|
+
>;
|
|
262
|
+
expectTypeOf(
|
|
263
|
+
(
|
|
264
|
+
query: SessionQuery,
|
|
265
|
+
mutation: SessionMutation,
|
|
266
|
+
action: SessionAction,
|
|
267
|
+
onlySession: OnlySession,
|
|
268
|
+
optional: OptionalSessionQuery,
|
|
269
|
+
client: ConvexReactSessionClient,
|
|
270
|
+
ctx: GenericActionCtx<GenericDataModel>,
|
|
271
|
+
sessionId: SessionId,
|
|
272
|
+
) => {
|
|
273
|
+
expectTypeOf(useSessionQuery(query, { id: "one" })).toEqualTypeOf<
|
|
274
|
+
Result | undefined
|
|
275
|
+
>();
|
|
276
|
+
expectTypeOf(useSessionQuery(onlySession)).toEqualTypeOf<
|
|
277
|
+
Result | undefined
|
|
278
|
+
>();
|
|
279
|
+
expectTypeOf(useSessionQuery(optional)).toEqualTypeOf<
|
|
280
|
+
Result | undefined
|
|
281
|
+
>();
|
|
282
|
+
useSessionQuery(query, "skip");
|
|
283
|
+
expectTypeOf(useSessionMutation(mutation)({ id: "one" })).toEqualTypeOf<
|
|
284
|
+
Promise<Result>
|
|
285
|
+
>();
|
|
286
|
+
expectTypeOf(useSessionAction(action)({ id: "one" })).toEqualTypeOf<
|
|
287
|
+
Promise<Result>
|
|
288
|
+
>();
|
|
289
|
+
useSessionMutation(mutation).withOptimisticUpdate((_store, args) => {
|
|
290
|
+
expectTypeOf(args).toEqualTypeOf<{
|
|
291
|
+
sessionId: SessionId;
|
|
292
|
+
id: string;
|
|
293
|
+
}>();
|
|
294
|
+
});
|
|
295
|
+
expectTypeOf(client.sessionQuery(query, { id: "one" })).toEqualTypeOf<
|
|
296
|
+
Promise<Result>
|
|
297
|
+
>();
|
|
298
|
+
expectTypeOf(client.sessionQuery(onlySession)).toEqualTypeOf<
|
|
299
|
+
Promise<Result>
|
|
300
|
+
>();
|
|
301
|
+
expectTypeOf(
|
|
302
|
+
client.sessionMutation(mutation, { id: "one" }),
|
|
303
|
+
).toEqualTypeOf<Promise<Result>>();
|
|
304
|
+
expectTypeOf(client.sessionAction(action, { id: "one" })).toEqualTypeOf<
|
|
305
|
+
Promise<Result>
|
|
306
|
+
>();
|
|
307
|
+
const session = runSessionFunctions(ctx, sessionId);
|
|
308
|
+
expectTypeOf(session.runSessionQuery(query, { id: "one" })).toEqualTypeOf<
|
|
309
|
+
Promise<Result>
|
|
310
|
+
>();
|
|
311
|
+
expectTypeOf(
|
|
312
|
+
session.runSessionMutation(mutation, { id: "one" }),
|
|
313
|
+
).toEqualTypeOf<Promise<Result>>();
|
|
314
|
+
expectTypeOf(
|
|
315
|
+
session.runSessionAction(action, { id: "one" }),
|
|
316
|
+
).toEqualTypeOf<Promise<Result>>();
|
|
317
|
+
// @ts-expect-error Non-session arguments remain required.
|
|
318
|
+
useSessionQuery(query);
|
|
319
|
+
// @ts-expect-error Argument types are preserved.
|
|
320
|
+
void client.sessionMutation(mutation, { id: 1 });
|
|
321
|
+
// @ts-expect-error Session IDs are supplied by the wrapper.
|
|
322
|
+
void session.runSessionQuery(query, { id: "one", sessionId });
|
|
323
|
+
},
|
|
324
|
+
).toBeFunction();
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
test("migration and retry helpers accept future references", () => {
|
|
328
|
+
type MigrationArgs = FunctionArgs<Parameters<typeof startMigration>[1]>;
|
|
329
|
+
type Migration = FunctionReference_future<
|
|
330
|
+
"mutation",
|
|
331
|
+
"internal",
|
|
332
|
+
MigrationArgs
|
|
333
|
+
>;
|
|
334
|
+
type RetryAction = FunctionReference_future<
|
|
335
|
+
"action",
|
|
336
|
+
"internal",
|
|
337
|
+
{ id: string },
|
|
338
|
+
null
|
|
339
|
+
>;
|
|
340
|
+
expectTypeOf(
|
|
341
|
+
(
|
|
342
|
+
ctx: GenericActionCtx<GenericDataModel>,
|
|
343
|
+
scheduler: Scheduler,
|
|
344
|
+
migration: Migration,
|
|
345
|
+
action: RetryAction,
|
|
346
|
+
) => {
|
|
347
|
+
void startMigration({ scheduler }, migration);
|
|
348
|
+
void startMigrationsSerially({ scheduler }, [migration]);
|
|
349
|
+
const { runWithRetries } = makeActionRetrier("test:retry");
|
|
350
|
+
void runWithRetries(ctx, action, { id: "one" });
|
|
351
|
+
// @ts-expect-error Retry arguments retain their types.
|
|
352
|
+
void runWithRetries(ctx, action, { id: 1 });
|
|
353
|
+
},
|
|
354
|
+
).toBeFunction();
|
|
355
|
+
expectTypeOf<Migration[]>().toExtend<
|
|
356
|
+
NonNullable<Parameters<typeof getStatus>[1]["migrations"]>
|
|
357
|
+
>();
|
|
358
|
+
expectTypeOf<Migration>().toExtend<Parameters<typeof cancelMigration>[2]>();
|
|
359
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "convex-helpers",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.126",
|
|
4
4
|
"description": "A collection of useful code to complement the official convex package.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
"homepage": "https://github.com/get-convex/convex-helpers/tree/main/packages/convex-helpers/README.md",
|
|
165
165
|
"peerDependencies": {
|
|
166
166
|
"@standard-schema/spec": "^1.0.0",
|
|
167
|
-
"convex": "^1.
|
|
167
|
+
"convex": "^1.46.0",
|
|
168
168
|
"hono": "^4.0.5",
|
|
169
169
|
"react": "^17.0.2 || ^18.0.0 || ^19.0.0",
|
|
170
170
|
"typescript": "^5.5 || ^6.0.0 || ^7.0.0",
|
package/react/cache/hooks.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { OptionalRestArgsOrSkip, PaginatedQueryArgs, PaginatedQueryReference,
|
|
2
|
-
import
|
|
1
|
+
import type { OptionalRestArgsOrSkip, PaginatedQueryArgs, PaginatedQueryReference, UsePaginatedQueryReturnType } from "convex/react";
|
|
2
|
+
import { useQueries as useQueriesCore } from "convex/react";
|
|
3
|
+
import type { FunctionReference, FunctionReference_future, FunctionReturnType } from "convex/server";
|
|
3
4
|
/**
|
|
4
5
|
* Load a variable number of reactive Convex queries, utilizing
|
|
5
6
|
* the query cache.
|
|
@@ -52,7 +53,7 @@ import type { FunctionReference, FunctionReturnType } from "convex/server";
|
|
|
52
53
|
*
|
|
53
54
|
* @public
|
|
54
55
|
*/
|
|
55
|
-
export declare function useQueries(queries:
|
|
56
|
+
export declare function useQueries(queries: Record<string, Pick<Parameters<typeof useQueriesCore>[0][string], "query" | "args">>): Record<string, any | undefined | Error>;
|
|
56
57
|
/**
|
|
57
58
|
* Load a reactive query within a React component.
|
|
58
59
|
*
|
|
@@ -69,7 +70,7 @@ export declare function useQueries(queries: RequestForQueries): Record<string, a
|
|
|
69
70
|
*
|
|
70
71
|
* @public
|
|
71
72
|
*/
|
|
72
|
-
export declare function useQuery<Query extends FunctionReference<"query">>(query: Query, ...queryArgs: OptionalRestArgsOrSkip<Query>): FunctionReturnType<Query> | undefined;
|
|
73
|
+
export declare function useQuery<Query extends FunctionReference<"query"> | FunctionReference_future<"query">>(query: Query, ...queryArgs: OptionalRestArgsOrSkip<Query>): FunctionReturnType<Query> | undefined;
|
|
73
74
|
/**
|
|
74
75
|
* Load data reactively from a paginated query to a create a growing list.
|
|
75
76
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAs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
*
|
|
62
62
|
* @public
|
|
63
63
|
*/
|
|
64
|
-
export function useQueries(
|
|
64
|
+
export function useQueries(
|
|
65
|
+
// Follow the SDK's reference types, excluding its internal pagination options.
|
|
66
|
+
queries) {
|
|
65
67
|
const { registry } = useContext(ConvexQueryCacheContext);
|
|
66
68
|
if (registry === null) {
|
|
67
69
|
throw new Error("Could not find `ConvexQueryCacheContext`! This `useQuery` implementation must be used in the React component " +
|
package/react/cache/hooks.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type {
|
|
|
2
2
|
OptionalRestArgsOrSkip,
|
|
3
3
|
PaginatedQueryArgs,
|
|
4
4
|
PaginatedQueryReference,
|
|
5
|
-
RequestForQueries,
|
|
6
5
|
UsePaginatedQueryReturnType,
|
|
7
6
|
} from "convex/react";
|
|
8
7
|
import {
|
|
@@ -14,6 +13,7 @@ import {
|
|
|
14
13
|
import type {
|
|
15
14
|
FunctionArgs,
|
|
16
15
|
FunctionReference,
|
|
16
|
+
FunctionReference_future,
|
|
17
17
|
FunctionReturnType,
|
|
18
18
|
paginationOptsValidator,
|
|
19
19
|
PaginationResult,
|
|
@@ -88,7 +88,11 @@ const uuid =
|
|
|
88
88
|
* @public
|
|
89
89
|
*/
|
|
90
90
|
export function useQueries(
|
|
91
|
-
|
|
91
|
+
// Follow the SDK's reference types, excluding its internal pagination options.
|
|
92
|
+
queries: Record<
|
|
93
|
+
string,
|
|
94
|
+
Pick<Parameters<typeof useQueriesCore>[0][string], "query" | "args">
|
|
95
|
+
>,
|
|
92
96
|
): Record<string, any | undefined | Error> {
|
|
93
97
|
const { registry } = useContext(ConvexQueryCacheContext);
|
|
94
98
|
if (registry === null) {
|
|
@@ -139,7 +143,9 @@ export function useQueries(
|
|
|
139
143
|
*
|
|
140
144
|
* @public
|
|
141
145
|
*/
|
|
142
|
-
export function useQuery<
|
|
146
|
+
export function useQuery<
|
|
147
|
+
Query extends FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
148
|
+
>(
|
|
143
149
|
query: Query,
|
|
144
150
|
...queryArgs: OptionalRestArgsOrSkip<Query>
|
|
145
151
|
): FunctionReturnType<Query> | undefined {
|
|
@@ -170,10 +176,9 @@ export function useQuery<Query extends FunctionReference<"query">>(
|
|
|
170
176
|
* @param args Arguments to the function, like { foo: "bar" }
|
|
171
177
|
* @returns A string key that uniquely identifies the query and its arguments.
|
|
172
178
|
*/
|
|
173
|
-
function createQueryKey<
|
|
174
|
-
query
|
|
175
|
-
|
|
176
|
-
): string {
|
|
179
|
+
function createQueryKey<
|
|
180
|
+
Query extends FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
181
|
+
>(query: Query, args: FunctionArgs<Query>): string {
|
|
177
182
|
const queryString = getFunctionName(query);
|
|
178
183
|
const key = [queryString, convexToJson(args)];
|
|
179
184
|
const queryKey = JSON.stringify(key);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConvexReactClient } from "convex/react";
|
|
2
|
-
import type { FunctionArgs, FunctionReference } from "convex/server";
|
|
2
|
+
import type { FunctionArgs, FunctionReference, FunctionReference_future } from "convex/server";
|
|
3
3
|
import type { FC, PropsWithChildren } from "react";
|
|
4
4
|
export declare const ConvexQueryCacheContext: import("react").Context<{
|
|
5
5
|
registry: CacheRegistry | null;
|
|
@@ -54,7 +54,7 @@ declare class CacheRegistry {
|
|
|
54
54
|
maxIdleEntries: number;
|
|
55
55
|
idle: number;
|
|
56
56
|
constructor(convex: ConvexReactClient, options: ConvexQueryCacheOptions);
|
|
57
|
-
start<Query extends FunctionReference<"query">>(id: string, queryKey: string, query: Query, args: FunctionArgs<Query>): void;
|
|
57
|
+
start<Query extends FunctionReference<"query"> | FunctionReference_future<"query">>(id: string, queryKey: string, query: Query, args: FunctionArgs<Query>): void;
|
|
58
58
|
end(id: string): void;
|
|
59
59
|
debug(): void;
|
|
60
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["provider.tsx"],"names":[],"mappings":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AEb,YAAY,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,uBAAuB,EAkBtE;IAGD,KAAK,CACH,KAAK,SACH,iBAAiB,CAAC,OAAO,CAAC,GAAG,wBAAwB,CAAC,OAAO,CAAC,EAEhE,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,GACxB,IAAI,CAiBN;IAED,GAAG,CAAC,EAAE,EAAE,MAAM,QAwBb;IACD,KAAK,SAYJ;CACF"}
|
package/react/cache/provider.tsx
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useConvex, ConvexReactClient } from "convex/react";
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
FunctionArgs,
|
|
5
|
+
FunctionReference,
|
|
6
|
+
FunctionReference_future,
|
|
7
|
+
} from "convex/server";
|
|
4
8
|
import type { FC, PropsWithChildren } from "react";
|
|
5
9
|
import { createContext, useMemo } from "react";
|
|
6
10
|
|
|
@@ -109,7 +113,10 @@ class CacheRegistry {
|
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
// Enable a new subscription.
|
|
112
|
-
start<
|
|
116
|
+
start<
|
|
117
|
+
Query extends
|
|
118
|
+
FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
119
|
+
>(
|
|
113
120
|
id: string,
|
|
114
121
|
queryKey: string,
|
|
115
122
|
query: Query,
|
package/react/sessions.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* for more information.
|
|
17
17
|
*/
|
|
18
18
|
import React from "react";
|
|
19
|
-
import type { FunctionArgs, FunctionReference, FunctionReturnType, PaginationOptions, PaginationResult } from "convex/server";
|
|
19
|
+
import type { FunctionArgs, FunctionReference, FunctionReference_future, FunctionReturnType, PaginationOptions, PaginationResult } from "convex/server";
|
|
20
20
|
import { ConvexReactClient, type ConvexReactClientOptions, type MutationOptions, type PaginatedQueryArgs, type UsePaginatedQueryReturnType } from "convex/react";
|
|
21
21
|
import type { SessionId } from "../server/sessions.js";
|
|
22
22
|
import type { EmptyObject, BetterOmit } from "../index.js";
|
|
@@ -26,6 +26,8 @@ export type UseStorage<T> = (key: string, initialValue: T) => readonly [T, (valu
|
|
|
26
26
|
export type RefreshSessionFn = (beforeUpdate?: (newSessionId: SessionId) => any | Promise<any>) => Promise<SessionId>;
|
|
27
27
|
type SessionFunction<T extends "query" | "mutation" | "action", Args = any> = FunctionReference<T, "public", {
|
|
28
28
|
sessionId: SessionId;
|
|
29
|
+
} & Args> | FunctionReference_future<T, "public", {
|
|
30
|
+
sessionId: SessionId;
|
|
29
31
|
} & Args>;
|
|
30
32
|
type ArgsWithoutSession<Fn extends SessionFunction<"query" | "mutation" | "action">> = BetterOmit<FunctionArgs<Fn>, "sessionId">;
|
|
31
33
|
export type SessionQueryArgsArray<Fn extends SessionFunction<"query">> = keyof FunctionArgs<Fn> extends "sessionId" ? [args?: EmptyObject | "skip"] : Partial<ArgsWithoutSession<Fn>> extends ArgsWithoutSession<Fn> ? [args?: ArgsWithoutSession<Fn> | "skip"] : [args: ArgsWithoutSession<Fn> | "skip"];
|
|
@@ -90,8 +92,8 @@ export declare function useSessionQuery<Query extends SessionFunction<"query">>(
|
|
|
90
92
|
export declare function useSessionPaginatedQuery<Query extends SessionPaginatedQueryFunction>(query: Query, args: SessionPaginatedQueryArgs<Query>, options: {
|
|
91
93
|
initialNumItems: number;
|
|
92
94
|
}): UsePaginatedQueryReturnType<Query> | undefined;
|
|
93
|
-
type SessionMutation<Mutation extends FunctionReference<"mutation">> = (...args: SessionArgsArray<Mutation>) => Promise<FunctionReturnType<Mutation>>;
|
|
94
|
-
interface ReactSessionMutation<Mutation extends FunctionReference<"mutation">> extends SessionMutation<Mutation> {
|
|
95
|
+
type SessionMutation<Mutation extends FunctionReference<"mutation"> | FunctionReference_future<"mutation">> = (...args: SessionArgsArray<Mutation>) => Promise<FunctionReturnType<Mutation>>;
|
|
96
|
+
interface ReactSessionMutation<Mutation extends FunctionReference<"mutation"> | FunctionReference_future<"mutation">> extends SessionMutation<Mutation> {
|
|
95
97
|
withOptimisticUpdate(optimisticUpdate: OptimisticUpdate<FunctionArgs<Mutation>>): SessionMutation<Mutation>;
|
|
96
98
|
}
|
|
97
99
|
/**
|
package/react/sessions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["sessions.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAIL,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EAIpB,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EACjC,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AAEvD,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAC1B,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,CAAC,KAEb,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,GAChC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC;AAEjD,MAAM,MAAM,gBAAgB,GAAG,CAC7B,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,SAAS,KAAK,GAAG,GAAG,O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