@convex-dev/sharded-counter 0.1.8 → 0.2.1
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/README.md +39 -41
- package/dist/{commonjs/client → client}/index.d.ts +24 -33
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js.map +1 -0
- package/dist/component/_generated/api.d.ts +34 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/{src → dist}/component/_generated/api.js +11 -3
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +46 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +46 -0
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/{src → dist}/component/_generated/server.d.ts +10 -38
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/{esm/component → component}/_generated/server.js +9 -5
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/{commonjs/component → component}/public.d.ts +1 -1
- package/dist/component/public.d.ts.map +1 -0
- package/dist/{commonjs/component → component}/public.js +4 -4
- package/dist/component/public.js.map +1 -0
- package/dist/{commonjs/component → component}/schema.d.ts +2 -2
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js.map +1 -0
- package/package.json +61 -38
- package/src/client/index.ts +45 -58
- package/src/component/_generated/api.ts +50 -0
- package/src/component/_generated/component.ts +63 -0
- package/src/component/_generated/{dataModel.d.ts → dataModel.ts} +1 -1
- package/src/component/_generated/server.ts +156 -0
- package/src/component/counter.test.ts +12 -9
- package/src/component/public.ts +4 -4
- package/src/test.ts +18 -0
- package/dist/commonjs/client/index.d.ts.map +0 -1
- package/dist/commonjs/client/index.js.map +0 -1
- package/dist/commonjs/component/_generated/api.d.ts +0 -14
- package/dist/commonjs/component/_generated/api.d.ts.map +0 -1
- package/dist/commonjs/component/_generated/api.js +0 -22
- package/dist/commonjs/component/_generated/api.js.map +0 -1
- package/dist/commonjs/component/_generated/server.d.ts +0 -64
- package/dist/commonjs/component/_generated/server.d.ts.map +0 -1
- package/dist/commonjs/component/_generated/server.js +0 -74
- package/dist/commonjs/component/_generated/server.js.map +0 -1
- package/dist/commonjs/component/convex.config.d.ts.map +0 -1
- package/dist/commonjs/component/convex.config.js.map +0 -1
- package/dist/commonjs/component/public.d.ts.map +0 -1
- package/dist/commonjs/component/public.js.map +0 -1
- package/dist/commonjs/component/schema.d.ts.map +0 -1
- package/dist/commonjs/component/schema.js.map +0 -1
- package/dist/commonjs/package.json +0 -3
- package/dist/esm/client/index.d.ts +0 -178
- package/dist/esm/client/index.d.ts.map +0 -1
- package/dist/esm/client/index.js +0 -193
- package/dist/esm/client/index.js.map +0 -1
- package/dist/esm/component/_generated/api.d.ts +0 -14
- package/dist/esm/component/_generated/api.d.ts.map +0 -1
- package/dist/esm/component/_generated/api.js +0 -22
- package/dist/esm/component/_generated/api.js.map +0 -1
- package/dist/esm/component/_generated/server.d.ts +0 -64
- package/dist/esm/component/_generated/server.d.ts.map +0 -1
- package/dist/esm/component/_generated/server.js.map +0 -1
- package/dist/esm/component/convex.config.d.ts +0 -3
- package/dist/esm/component/convex.config.d.ts.map +0 -1
- package/dist/esm/component/convex.config.js +0 -3
- package/dist/esm/component/convex.config.js.map +0 -1
- package/dist/esm/component/public.d.ts +0 -23
- package/dist/esm/component/public.d.ts.map +0 -1
- package/dist/esm/component/public.js +0 -115
- package/dist/esm/component/public.js.map +0 -1
- package/dist/esm/component/schema.d.ts +0 -15
- package/dist/esm/component/schema.d.ts.map +0 -1
- package/dist/esm/component/schema.js +0 -10
- package/dist/esm/component/schema.js.map +0 -1
- package/dist/esm/package.json +0 -3
- package/src/component/_generated/api.d.ts +0 -67
- package/src/component/_generated/server.js +0 -90
- /package/dist/{commonjs/client → client}/index.js +0 -0
- /package/dist/{commonjs/component → component}/convex.config.d.ts +0 -0
- /package/dist/{commonjs/component → component}/convex.config.js +0 -0
- /package/dist/{commonjs/component → component}/schema.js +0 -0
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
<!-- START: Include on https://convex.dev/components -->
|
|
6
6
|
|
|
7
|
-
This component adds counters to Convex. It acts as a key-value store from
|
|
8
|
-
|
|
7
|
+
This component adds counters to Convex. It acts as a key-value store from string
|
|
8
|
+
to number, with sharding to increase throughput when updating values.
|
|
9
9
|
|
|
10
10
|
Since it's built on Convex, everything is automatically consistent, reactive,
|
|
11
11
|
and cached. Since it's built with [Components](https://convex.dev/components),
|
|
@@ -18,8 +18,8 @@ For example, if you want to display
|
|
|
18
18
|
count the checkboxes in real-time while allowing a lot of the boxes to change in
|
|
19
19
|
parallel.
|
|
20
20
|
|
|
21
|
-
More generally, whenever you have a counter that is changing frequently, you
|
|
22
|
-
|
|
21
|
+
More generally, whenever you have a counter that is changing frequently, you can
|
|
22
|
+
use this component to keep track of it efficiently.
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
25
|
export const checkBox = mutation({
|
|
@@ -46,16 +46,17 @@ export const getCount = query({
|
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
This relies on the assumption that you need to frequently modify the counter,
|
|
49
|
-
but only need to read its value from a query, or infrequently in a mutation.
|
|
50
|
-
|
|
49
|
+
but only need to read its value from a query, or infrequently in a mutation. If
|
|
50
|
+
you read the count every time you modify it, you lose the sharding benefit.
|
|
51
51
|
|
|
52
52
|
## Pre-requisite: Convex
|
|
53
53
|
|
|
54
|
-
You'll need an existing Convex project to use the component.
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
You'll need an existing Convex project to use the component. Convex is a hosted
|
|
55
|
+
backend platform, including a database, serverless functions, and a ton more you
|
|
56
|
+
can learn about [here](https://docs.convex.dev/get-started).
|
|
57
57
|
|
|
58
|
-
Run `npm create convex` or follow any of the
|
|
58
|
+
Run `npm create convex` or follow any of the
|
|
59
|
+
[quickstarts](https://docs.convex.dev/home) to set one up.
|
|
59
60
|
|
|
60
61
|
## Installation
|
|
61
62
|
|
|
@@ -65,13 +66,13 @@ First, install the component package:
|
|
|
65
66
|
npm install @convex-dev/sharded-counter
|
|
66
67
|
```
|
|
67
68
|
|
|
68
|
-
Then, create a `convex.config.ts` file in your app's `convex/` folder and
|
|
69
|
-
component by calling `use`:
|
|
69
|
+
Then, create a `convex.config.ts` file in your app's `convex/` folder and
|
|
70
|
+
install the component by calling `use`:
|
|
70
71
|
|
|
71
72
|
```ts
|
|
72
73
|
// convex/convex.config.ts
|
|
73
74
|
import { defineApp } from "convex/server";
|
|
74
|
-
import shardedCounter from "@convex-dev/sharded-counter/convex.config";
|
|
75
|
+
import shardedCounter from "@convex-dev/sharded-counter/convex.config.js";
|
|
75
76
|
|
|
76
77
|
const app = defineApp();
|
|
77
78
|
app.use(shardedCounter);
|
|
@@ -79,8 +80,8 @@ app.use(shardedCounter);
|
|
|
79
80
|
export default app;
|
|
80
81
|
```
|
|
81
82
|
|
|
82
|
-
Finally, create a new `ShardedCounter` within your `convex/` folder, and point
|
|
83
|
-
the installed component.
|
|
83
|
+
Finally, create a new `ShardedCounter` within your `convex/` folder, and point
|
|
84
|
+
it to the installed component.
|
|
84
85
|
|
|
85
86
|
```ts
|
|
86
87
|
import { components } from "./_generated/api";
|
|
@@ -156,7 +157,7 @@ friends for each user, and you don't care about throughput for a single user,
|
|
|
156
157
|
you would declare ShardedCounter like so:
|
|
157
158
|
|
|
158
159
|
```ts
|
|
159
|
-
const friendCounts = new ShardedCounter<
|
|
160
|
+
const friendCounts = new ShardedCounter<Id<"users">>(
|
|
160
161
|
components.shardedCounter,
|
|
161
162
|
{ defaultShards: 1 },
|
|
162
163
|
);
|
|
@@ -175,8 +176,8 @@ to get an accurate count. This takes a read dependency on all shard documents.
|
|
|
175
176
|
- In a mutation, that means any modification to the counter causes an
|
|
176
177
|
[OCC](https://docs.convex.dev/error#1) conflict.
|
|
177
178
|
|
|
178
|
-
You can reduce contention by estimating the count: read from a smaller number
|
|
179
|
-
|
|
179
|
+
You can reduce contention by estimating the count: read from a smaller number of
|
|
180
|
+
shards and extrapolate based on the total number of shards.
|
|
180
181
|
|
|
181
182
|
```ts
|
|
182
183
|
const estimatedCheckboxCount = await counter.estimateCount(ctx, "checkboxes");
|
|
@@ -190,9 +191,9 @@ from more shards, at the cost of more contention:
|
|
|
190
191
|
const estimateFromThree = await counter.estimateCount(ctx, "checkboxes", 3);
|
|
191
192
|
```
|
|
192
193
|
|
|
193
|
-
If the counter was accumulated from many
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
If the counter was accumulated from many small `counter.inc` and `counter.dec`
|
|
195
|
+
calls, then they should be uniformly distributed across the shards, so estimated
|
|
196
|
+
counts will be accurate.
|
|
196
197
|
|
|
197
198
|
In some cases the counter will not be evenly distributed:
|
|
198
199
|
|
|
@@ -201,8 +202,8 @@ In some cases the counter will not be evenly distributed:
|
|
|
201
202
|
values, because each operation only changes a single shard
|
|
202
203
|
- If the number of shards changed
|
|
203
204
|
|
|
204
|
-
In these cases, the count might not be evenly distributed across the shards.
|
|
205
|
-
|
|
205
|
+
In these cases, the count might not be evenly distributed across the shards. To
|
|
206
|
+
repair such cases, you can call:
|
|
206
207
|
|
|
207
208
|
```ts
|
|
208
209
|
await counter.rebalance(ctx, "checkboxes");
|
|
@@ -211,23 +212,21 @@ await counter.rebalance(ctx, "checkboxes");
|
|
|
211
212
|
Which will even out the count across shards.
|
|
212
213
|
|
|
213
214
|
You may change the number of shards for a key, by changing the second argument
|
|
214
|
-
to the `ShardedCounter` constructor. If you decrease the number of shards,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
In this case, you should call `counter.rebalance` to delete
|
|
215
|
+
to the `ShardedCounter` constructor. If you decrease the number of shards, you
|
|
216
|
+
will be left with extra shards that won't be written to but are still read when
|
|
217
|
+
computing `count`. In this case, you should call `counter.rebalance` to delete
|
|
218
218
|
the extraneous shards.
|
|
219
219
|
|
|
220
|
-
NOTE: `counter.rebalance` reads and writes all shards, so it could cause
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
NOTE: `counter.rebalance` reads and writes all shards, so it could cause more
|
|
221
|
+
OCCs, and it's recommended you call it sparingly, from the Convex dashboard or
|
|
222
|
+
from an infrequent cron.
|
|
223
223
|
|
|
224
|
-
NOTE: counts are floats, and floating point arithmetic isn't infinitely
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
224
|
+
NOTE: counts are floats, and floating point arithmetic isn't infinitely precise.
|
|
225
|
+
Even if you always add and subtract integers, you may get a fractional counts,
|
|
226
|
+
especially if you use `estimateCount` or `rebalance`. Values distributed across
|
|
227
|
+
shards may be added in different combinations, and
|
|
228
228
|
[floating point arithmetic isn't associative](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html).
|
|
229
|
-
You can use `Math.round` to ensure your final count is an integer, if
|
|
230
|
-
desired.
|
|
229
|
+
You can use `Math.round` to ensure your final count is an integer, if desired.
|
|
231
230
|
|
|
232
231
|
## Counting documents in a table
|
|
233
232
|
|
|
@@ -262,8 +261,7 @@ async function insertUser(ctx, user) {
|
|
|
262
261
|
```
|
|
263
262
|
|
|
264
263
|
3. Register a [Trigger](https://www.npmjs.com/package/convex-helpers#triggers),
|
|
265
|
-
which automatically runs code when a mutation changes the
|
|
266
|
-
data in a table.
|
|
264
|
+
which automatically runs code when a mutation changes the data in a table.
|
|
267
265
|
|
|
268
266
|
```ts
|
|
269
267
|
// Triggers hook up writes to the table to the ShardedCounter.
|
|
@@ -312,9 +310,9 @@ Walkthrough of steps:
|
|
|
312
310
|
2. Create a new document in this table, with fields
|
|
313
311
|
`{ creationTime: 0, id: "", isDone: false }`
|
|
314
312
|
3. Wherever you want to update a counter based on a document changing, wrap the
|
|
315
|
-
update in a conditional, so it only gets updated if the backfill has
|
|
316
|
-
that document. In the example, you would be changing
|
|
317
|
-
to be implemented as `insertUserDuringBackfill`.
|
|
313
|
+
update in a conditional, so it only gets updated if the backfill has
|
|
314
|
+
processed that document. In the example, you would be changing
|
|
315
|
+
`insertUserBeforeBackfill` to be implemented as `insertUserDuringBackfill`.
|
|
318
316
|
4. Define backfill functions similar to `backfillUsers` and `backfillUsersBatch`
|
|
319
317
|
5. Call `backfillUsersBatch` from the dashboard.
|
|
320
318
|
6. Remove the conditional when updating counters. In the example, you would be
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DocumentByName,
|
|
2
|
-
import { GenericId } from "convex/values";
|
|
3
|
-
import {
|
|
1
|
+
import type { DocumentByName, GenericActionCtx, GenericDataModel, GenericMutationCtx, GenericQueryCtx, TableNamesInDataModel } from "convex/server";
|
|
2
|
+
import type { GenericId } from "convex/values";
|
|
3
|
+
import type { ComponentApi } from "../component/_generated/component.js";
|
|
4
4
|
/**
|
|
5
5
|
* A sharded counter is a map from string -> counter, where each counter can
|
|
6
6
|
* be incremented or decremented atomically.
|
|
@@ -22,7 +22,7 @@ export declare class ShardedCounter<ShardsKey extends string> {
|
|
|
22
22
|
* @param options.defaultShards The number of shards for each counter, for
|
|
23
23
|
* keys not in `options.shards`.
|
|
24
24
|
*/
|
|
25
|
-
constructor(component:
|
|
25
|
+
constructor(component: ComponentApi, options?: {
|
|
26
26
|
shards?: Partial<Record<ShardsKey, number>>;
|
|
27
27
|
defaultShards?: number;
|
|
28
28
|
});
|
|
@@ -35,26 +35,26 @@ export declare class ShardedCounter<ShardsKey extends string> {
|
|
|
35
35
|
* @param name The key to update the counter for.
|
|
36
36
|
* @param count The amount to increment the counter by. Defaults to 1.
|
|
37
37
|
*/
|
|
38
|
-
add<Name extends ShardsKey>(ctx:
|
|
38
|
+
add<Name extends ShardsKey>(ctx: MutationCtx | ActionCtx, name: Name, count?: number): Promise<void>;
|
|
39
39
|
/**
|
|
40
40
|
* Decrease the counter for key `name` by `count`.
|
|
41
41
|
*/
|
|
42
|
-
subtract<Name extends ShardsKey>(ctx:
|
|
42
|
+
subtract<Name extends ShardsKey>(ctx: MutationCtx | ActionCtx, name: Name, count?: number): Promise<void>;
|
|
43
43
|
/**
|
|
44
44
|
* Increment the counter for key `name` by 1.
|
|
45
45
|
*/
|
|
46
|
-
inc<Name extends ShardsKey>(ctx:
|
|
46
|
+
inc<Name extends ShardsKey>(ctx: MutationCtx | ActionCtx, name: Name): Promise<void>;
|
|
47
47
|
/**
|
|
48
48
|
* Decrement the counter for key `name` by 1.
|
|
49
49
|
*/
|
|
50
|
-
dec<Name extends ShardsKey>(ctx:
|
|
50
|
+
dec<Name extends ShardsKey>(ctx: MutationCtx | ActionCtx, name: Name): Promise<void>;
|
|
51
51
|
/**
|
|
52
52
|
* Gets the counter for key `name`.
|
|
53
53
|
*
|
|
54
54
|
* NOTE: this reads from all shards. If used in a mutation, it will contend
|
|
55
55
|
* with all mutations that update the counter for this key.
|
|
56
56
|
*/
|
|
57
|
-
count<Name extends ShardsKey>(ctx:
|
|
57
|
+
count<Name extends ShardsKey>(ctx: QueryCtx | MutationCtx | ActionCtx, name: Name): Promise<number>;
|
|
58
58
|
/**
|
|
59
59
|
* Redistribute counts evenly across the counter's shards.
|
|
60
60
|
*
|
|
@@ -67,13 +67,13 @@ export declare class ShardedCounter<ShardsKey extends string> {
|
|
|
67
67
|
* This operation reads and writes all shards, so it can cause contention if
|
|
68
68
|
* called too often.
|
|
69
69
|
*/
|
|
70
|
-
rebalance<Name extends ShardsKey>(ctx:
|
|
70
|
+
rebalance<Name extends ShardsKey>(ctx: MutationCtx | ActionCtx, name: Name): Promise<void>;
|
|
71
71
|
/**
|
|
72
72
|
* Clear the counter for key `name`.
|
|
73
73
|
*
|
|
74
74
|
* @param name The key to clear the counter for.
|
|
75
75
|
*/
|
|
76
|
-
reset<Name extends ShardsKey>(ctx:
|
|
76
|
+
reset<Name extends ShardsKey>(ctx: MutationCtx | ActionCtx, name: Name): Promise<void>;
|
|
77
77
|
/**
|
|
78
78
|
* Estimate the count of a counter by only reading from a subset of shards,
|
|
79
79
|
* and extrapolating the total count.
|
|
@@ -85,7 +85,7 @@ export declare class ShardedCounter<ShardsKey extends string> {
|
|
|
85
85
|
*
|
|
86
86
|
* Use this to reduce contention when reading the counter.
|
|
87
87
|
*/
|
|
88
|
-
estimateCount<Name extends ShardsKey>(ctx:
|
|
88
|
+
estimateCount<Name extends ShardsKey>(ctx: QueryCtx | MutationCtx | ActionCtx, name: Name, readFromShards?: number): Promise<any>;
|
|
89
89
|
/**
|
|
90
90
|
* Returns an object with methods to update and query the counter for key
|
|
91
91
|
* `name`. For fixed keys, you can call `counter.for("<key>")` to get methods
|
|
@@ -105,46 +105,46 @@ export declare class ShardedCounter<ShardsKey extends string> {
|
|
|
105
105
|
/**
|
|
106
106
|
* Add `count` to the counter.
|
|
107
107
|
*/
|
|
108
|
-
add: (ctx:
|
|
108
|
+
add: (ctx: MutationCtx | ActionCtx, count?: number) => Promise<void>;
|
|
109
109
|
/**
|
|
110
110
|
* Subtract `count` from the counter.
|
|
111
111
|
*/
|
|
112
|
-
subtract: (ctx:
|
|
112
|
+
subtract: (ctx: MutationCtx | ActionCtx, count?: number) => Promise<void>;
|
|
113
113
|
/**
|
|
114
114
|
* Increment the counter by 1.
|
|
115
115
|
*/
|
|
116
|
-
inc: (ctx:
|
|
116
|
+
inc: (ctx: MutationCtx | ActionCtx) => Promise<void>;
|
|
117
117
|
/**
|
|
118
118
|
* Decrement the counter by 1.
|
|
119
119
|
*/
|
|
120
|
-
dec: (ctx:
|
|
120
|
+
dec: (ctx: MutationCtx | ActionCtx) => Promise<void>;
|
|
121
121
|
/**
|
|
122
122
|
* Get the current value of the counter.
|
|
123
123
|
*
|
|
124
124
|
* NOTE: this reads from all shards. If used in a mutation, it will
|
|
125
125
|
* contend with all mutations that update the counter for this key.
|
|
126
126
|
*/
|
|
127
|
-
count: (ctx:
|
|
127
|
+
count: (ctx: QueryCtx | MutationCtx | ActionCtx) => Promise<number>;
|
|
128
128
|
/**
|
|
129
129
|
* Reset the counter for this key.
|
|
130
130
|
*/
|
|
131
|
-
reset: (ctx:
|
|
131
|
+
reset: (ctx: MutationCtx | ActionCtx) => Promise<void>;
|
|
132
132
|
/**
|
|
133
133
|
* Redistribute counts evenly across the counter's shards.
|
|
134
134
|
*
|
|
135
135
|
* This operation reads and writes all shards, so it can cause contention
|
|
136
136
|
* if called too often.
|
|
137
137
|
*/
|
|
138
|
-
rebalance: (ctx:
|
|
138
|
+
rebalance: (ctx: MutationCtx | ActionCtx) => Promise<void>;
|
|
139
139
|
/**
|
|
140
140
|
* Estimate the counter by only reading from a subset of shards,
|
|
141
141
|
* and extrapolating the total count.
|
|
142
142
|
*
|
|
143
143
|
* Use this to reduce contention when reading the counter.
|
|
144
144
|
*/
|
|
145
|
-
estimateCount: (ctx:
|
|
145
|
+
estimateCount: (ctx: QueryCtx | MutationCtx | ActionCtx, readFromShards?: number) => Promise<any>;
|
|
146
146
|
};
|
|
147
|
-
trigger<Ctx extends
|
|
147
|
+
trigger<Ctx extends MutationCtx, Name extends ShardsKey>(name: Name): Trigger<Ctx, GenericDataModel, TableNamesInDataModel<GenericDataModel>>;
|
|
148
148
|
}
|
|
149
149
|
export type Trigger<Ctx, DataModel extends GenericDataModel, TableName extends TableNamesInDataModel<DataModel>> = (ctx: Ctx, change: Change<DataModel, TableName>) => Promise<void>;
|
|
150
150
|
export type Change<DataModel extends GenericDataModel, TableName extends TableNamesInDataModel<DataModel>> = {
|
|
@@ -162,17 +162,8 @@ export type Change<DataModel extends GenericDataModel, TableName extends TableNa
|
|
|
162
162
|
oldDoc: DocumentByName<DataModel, TableName>;
|
|
163
163
|
newDoc: null;
|
|
164
164
|
});
|
|
165
|
-
type
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
type RunMutationCtx = {
|
|
169
|
-
runMutation: GenericMutationCtx<GenericDataModel>["runMutation"];
|
|
170
|
-
};
|
|
171
|
-
export type OpaqueIds<T> = T extends GenericId<infer _T> ? string : T extends (infer U)[] ? OpaqueIds<U>[] : T extends object ? {
|
|
172
|
-
[K in keyof T]: OpaqueIds<T[K]>;
|
|
173
|
-
} : T;
|
|
174
|
-
export type UseApi<API> = Expand<{
|
|
175
|
-
[mod in keyof API]: API[mod] extends FunctionReference<infer FType, "public", infer FArgs, infer FReturnType, infer FComponentPath> ? FunctionReference<FType, "internal", OpaqueIds<FArgs>, OpaqueIds<FReturnType>, FComponentPath> : UseApi<API[mod]>;
|
|
176
|
-
}>;
|
|
165
|
+
type QueryCtx = Pick<GenericQueryCtx<GenericDataModel>, "runQuery">;
|
|
166
|
+
type MutationCtx = Pick<GenericMutationCtx<GenericDataModel>, "runQuery" | "runMutation">;
|
|
167
|
+
type ActionCtx = Pick<GenericActionCtx<GenericDataModel>, "runQuery" | "runMutation" | "runAction">;
|
|
177
168
|
export {};
|
|
178
169
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACtB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE;;;GAGG;AACH,qBAAa,cAAc,CAAC,SAAS,SAAS,MAAM;IAiBhD,OAAO,CAAC,SAAS;IAhBnB;;;;;;;;;;;;;;OAcG;gBAEO,SAAS,EAAE,YAAY,EAC/B,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;QAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB;IAUH,OAAO,CAAC,YAAY,CAA0C;IAI9D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,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC;YAC3B;;;;;eAKG;YACH,aAAa,EAAE,KAAK,EAClB,GAAuC,EACvC,iBAAyB,CAAC,EAC1B,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,cAAc,CAAC;SACnD,CAAC;IACJ,CAAC;IACD,OAAO,CACL,IAAU;QAEV,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE;YAC3B,IAAI,MAAM,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;gBAClC,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAC5B,CAAC;iBAAM,IAAI,MAAM,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;gBACzC,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated `api` utility.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type * as public_ from "../public.js";
|
|
10
|
+
import type { ApiFromModules, FilterApi, FunctionReference } from "convex/server";
|
|
11
|
+
declare const fullApi: ApiFromModules<{
|
|
12
|
+
public: typeof public_;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* A utility for referencing Convex functions in your app's public API.
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* ```js
|
|
19
|
+
* const myFunctionReference = api.myModule.myFunction;
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const api: FilterApi<typeof fullApi, FunctionReference<any, "public">>;
|
|
23
|
+
/**
|
|
24
|
+
* A utility for referencing Convex functions in your app's internal API.
|
|
25
|
+
*
|
|
26
|
+
* Usage:
|
|
27
|
+
* ```js
|
|
28
|
+
* const myFunctionReference = internal.myModule.myFunction;
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const internal: FilterApi<typeof fullApi, FunctionReference<any, "internal">>;
|
|
32
|
+
export declare const components: {};
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,OAAO,MAAM,cAAc,CAAC;AAE7C,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAGvB,QAAA,MAAM,OAAO,EAAE,cAAc,CAAC;IAC5B,MAAM,EAAE,OAAO,OAAO,CAAC;CACxB,CAAiB,CAAC;AAEnB;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,EAAE,SAAS,CACzB,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,QAAQ,CAAC,CACjB,CAAC;AAElB;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,CAC9B,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,UAAU,CAAC,CACnB,CAAC;AAElB,eAAO,MAAM,UAAU,EAAqC,EAAE,CAAC"}
|
|
@@ -7,11 +7,10 @@
|
|
|
7
7
|
* To regenerate, run `npx convex dev`.
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
10
|
import { anyApi, componentsGeneric } from "convex/server";
|
|
12
|
-
|
|
11
|
+
const fullApi = anyApi;
|
|
13
12
|
/**
|
|
14
|
-
* A utility for referencing Convex functions in your app's API.
|
|
13
|
+
* A utility for referencing Convex functions in your app's public API.
|
|
15
14
|
*
|
|
16
15
|
* Usage:
|
|
17
16
|
* ```js
|
|
@@ -19,5 +18,14 @@ import { anyApi, componentsGeneric } from "convex/server";
|
|
|
19
18
|
* ```
|
|
20
19
|
*/
|
|
21
20
|
export const api = anyApi;
|
|
21
|
+
/**
|
|
22
|
+
* A utility for referencing Convex functions in your app's internal API.
|
|
23
|
+
*
|
|
24
|
+
* Usage:
|
|
25
|
+
* ```js
|
|
26
|
+
* const myFunctionReference = internal.myModule.myFunction;
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
22
29
|
export const internal = anyApi;
|
|
23
30
|
export const components = componentsGeneric();
|
|
31
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AASH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,OAAO,GAER,MAAa,CAAC;AAEnB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,GAAG,GAGZ,MAAa,CAAC;AAElB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAGjB,MAAa,CAAC;AAElB,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,EAAmB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated `ComponentApi` utility.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { FunctionReference } from "convex/server";
|
|
10
|
+
/**
|
|
11
|
+
* A utility for referencing a Convex component's exposed API.
|
|
12
|
+
*
|
|
13
|
+
* Useful when expecting a parameter like `components.myComponent`.
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```ts
|
|
16
|
+
* async function myFunction(ctx: QueryCtx, component: ComponentApi) {
|
|
17
|
+
* return ctx.runQuery(component.someFile.someQuery, { ...args });
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export type ComponentApi<Name extends string | undefined = string | undefined> = {
|
|
22
|
+
public: {
|
|
23
|
+
add: FunctionReference<"mutation", "internal", {
|
|
24
|
+
count: number;
|
|
25
|
+
name: string;
|
|
26
|
+
shard?: number;
|
|
27
|
+
shards?: number;
|
|
28
|
+
}, number, Name>;
|
|
29
|
+
count: FunctionReference<"query", "internal", {
|
|
30
|
+
name: string;
|
|
31
|
+
}, number, Name>;
|
|
32
|
+
estimateCount: FunctionReference<"query", "internal", {
|
|
33
|
+
name: string;
|
|
34
|
+
readFromShards?: number;
|
|
35
|
+
shards?: number;
|
|
36
|
+
}, any, Name>;
|
|
37
|
+
rebalance: FunctionReference<"mutation", "internal", {
|
|
38
|
+
name: string;
|
|
39
|
+
shards?: number;
|
|
40
|
+
}, any, Name>;
|
|
41
|
+
reset: FunctionReference<"mutation", "internal", {
|
|
42
|
+
name: string;
|
|
43
|
+
}, any, Name>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAC3E;IACE,MAAM,EAAE;QACN,GAAG,EAAE,iBAAiB,CACpB,UAAU,EACV,UAAU,EACV;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,EAChE,MAAM,EACN,IAAI,CACL,CAAC;QACF,KAAK,EAAE,iBAAiB,CACtB,OAAO,EACP,UAAU,EACV;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,EAChB,MAAM,EACN,IAAI,CACL,CAAC;QACF,aAAa,EAAE,iBAAiB,CAC9B,OAAO,EACP,UAAU,EACV;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,cAAc,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,EAC1D,GAAG,EACH,IAAI,CACL,CAAC;QACF,SAAS,EAAE,iBAAiB,CAC1B,UAAU,EACV,UAAU,EACV;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,EACjC,GAAG,EACH,IAAI,CACL,CAAC;QACF,KAAK,EAAE,iBAAiB,CACtB,UAAU,EACV,UAAU,EACV;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,EAChB,GAAG,EACH,IAAI,CACL,CAAC;KACH,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated data model types.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { DataModelFromSchemaDefinition, DocumentByName, TableNamesInDataModel, SystemTableNames } from "convex/server";
|
|
10
|
+
import type { GenericId } from "convex/values";
|
|
11
|
+
import schema from "../schema.js";
|
|
12
|
+
/**
|
|
13
|
+
* The names of all of your Convex tables.
|
|
14
|
+
*/
|
|
15
|
+
export type TableNames = TableNamesInDataModel<DataModel>;
|
|
16
|
+
/**
|
|
17
|
+
* The type of a document stored in Convex.
|
|
18
|
+
*
|
|
19
|
+
* @typeParam TableName - A string literal type of the table name (like "users").
|
|
20
|
+
*/
|
|
21
|
+
export type Doc<TableName extends TableNames> = DocumentByName<DataModel, TableName>;
|
|
22
|
+
/**
|
|
23
|
+
* An identifier for a document in Convex.
|
|
24
|
+
*
|
|
25
|
+
* Convex documents are uniquely identified by their `Id`, which is accessible
|
|
26
|
+
* on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
|
|
27
|
+
*
|
|
28
|
+
* Documents can be loaded using `db.get(tableName, id)` in query and mutation functions.
|
|
29
|
+
*
|
|
30
|
+
* IDs are just strings at runtime, but this type can be used to distinguish them from other
|
|
31
|
+
* strings when type checking.
|
|
32
|
+
*
|
|
33
|
+
* @typeParam TableName - A string literal type of the table name (like "users").
|
|
34
|
+
*/
|
|
35
|
+
export type Id<TableName extends TableNames | SystemTableNames> = GenericId<TableName>;
|
|
36
|
+
/**
|
|
37
|
+
* A type describing your Convex data model.
|
|
38
|
+
*
|
|
39
|
+
* This type includes information about what tables you have, the type of
|
|
40
|
+
* documents stored in those tables, and the indexes defined on them.
|
|
41
|
+
*
|
|
42
|
+
* This type is used to parameterize methods like `queryGeneric` and
|
|
43
|
+
* `mutationGeneric` to make them type-safe.
|
|
44
|
+
*/
|
|
45
|
+
export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
|
|
46
|
+
//# sourceMappingURL=dataModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataModel.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,6BAA6B,EAC7B,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,MAAM,GAAG,CAAC,SAAS,SAAS,UAAU,IAAI,cAAc,CAC5D,SAAS,EACT,SAAS,CACV,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,EAAE,CAAC,SAAS,SAAS,UAAU,GAAG,gBAAgB,IAC5D,SAAS,CAAC,SAAS,CAAC,CAAC;AAEvB;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,6BAA6B,CAAC,OAAO,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataModel.js","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AASH,OAAO,MAAM,MAAM,cAAc,CAAC"}
|