@vllnt/convex-buckets 0.1.0-canary.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/LICENSE +21 -0
- package/README.md +157 -0
- package/dist/client/index.d.ts +79 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +86 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/types.d.ts +28 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +3 -0
- package/dist/client/types.js.map +1 -0
- package/dist/component/_generated/api.d.ts +38 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/dist/component/_generated/api.js +31 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +102 -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/dist/component/_generated/server.d.ts +133 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +80 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/convex.config.d.ts +3 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +4 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/mutations.d.ts +44 -0
- package/dist/component/mutations.d.ts.map +1 -0
- package/dist/component/mutations.js +244 -0
- package/dist/component/mutations.js.map +1 -0
- package/dist/component/queries.d.ts +41 -0
- package/dist/component/queries.d.ts.map +1 -0
- package/dist/component/queries.js +101 -0
- package/dist/component/queries.js.map +1 -0
- package/dist/component/schema.d.ts +47 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +31 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/component/validators.d.ts +26 -0
- package/dist/component/validators.d.ts.map +1 -0
- package/dist/component/validators.js +16 -0
- package/dist/component/validators.js.map +1 -0
- package/dist/shared.d.ts +13 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +22 -0
- package/dist/shared.js.map +1 -0
- package/package.json +87 -0
- package/src/client/index.ts +247 -0
- package/src/client/types.ts +33 -0
- package/src/component/_generated/api.ts +54 -0
- package/src/component/_generated/component.ts +123 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +169 -0
- package/src/component/convex.config.ts +5 -0
- package/src/component/mutations.ts +316 -0
- package/src/component/queries.ts +112 -0
- package/src/component/schema.ts +35 -0
- package/src/component/validators.ts +22 -0
- package/src/shared.ts +28 -0
- package/src/test.ts +13 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataModel.js","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated utilities for implementing server-side Convex query and mutation functions.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { ActionBuilder, HttpActionBuilder, MutationBuilder, QueryBuilder, GenericActionCtx, GenericMutationCtx, GenericQueryCtx, GenericDatabaseReader, GenericDatabaseWriter } from "convex/server";
|
|
10
|
+
import type { DataModel } from "./dataModel.js";
|
|
11
|
+
/**
|
|
12
|
+
* Typesafe environment variables.
|
|
13
|
+
*
|
|
14
|
+
* This includes platform-provided env vars and any variables declared in
|
|
15
|
+
* `convex.config.ts`.
|
|
16
|
+
*/
|
|
17
|
+
type Env = {
|
|
18
|
+
readonly CONVEX_CLOUD_URL: string;
|
|
19
|
+
readonly CONVEX_SITE_URL: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Define a query in this Convex app's public API.
|
|
23
|
+
*
|
|
24
|
+
* This function will be allowed to read your Convex database and will be accessible from the client.
|
|
25
|
+
*
|
|
26
|
+
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
27
|
+
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
28
|
+
*/
|
|
29
|
+
export declare const query: QueryBuilder<DataModel, "public">;
|
|
30
|
+
/**
|
|
31
|
+
* Define a query that is only accessible from other Convex functions (but not from the client).
|
|
32
|
+
*
|
|
33
|
+
* This function will be allowed to read from your Convex database. It will not be accessible from the client.
|
|
34
|
+
*
|
|
35
|
+
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
36
|
+
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
37
|
+
*/
|
|
38
|
+
export declare const internalQuery: QueryBuilder<DataModel, "internal">;
|
|
39
|
+
/**
|
|
40
|
+
* Define a mutation in this Convex app's public API.
|
|
41
|
+
*
|
|
42
|
+
* This function will be allowed to modify your Convex database and will be accessible from the client.
|
|
43
|
+
*
|
|
44
|
+
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
45
|
+
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
46
|
+
*/
|
|
47
|
+
export declare const mutation: MutationBuilder<DataModel, "public">;
|
|
48
|
+
/**
|
|
49
|
+
* Define a mutation that is only accessible from other Convex functions (but not from the client).
|
|
50
|
+
*
|
|
51
|
+
* This function will be allowed to modify your Convex database. It will not be accessible from the client.
|
|
52
|
+
*
|
|
53
|
+
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
54
|
+
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
55
|
+
*/
|
|
56
|
+
export declare const internalMutation: MutationBuilder<DataModel, "internal">;
|
|
57
|
+
/**
|
|
58
|
+
* Define an action in this Convex app's public API.
|
|
59
|
+
*
|
|
60
|
+
* An action is a function which can execute any JavaScript code, including non-deterministic
|
|
61
|
+
* code and code with side-effects, like calling third-party services.
|
|
62
|
+
* They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
|
|
63
|
+
* They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
|
|
64
|
+
*
|
|
65
|
+
* @param func - The action. It receives an {@link ActionCtx} as its first argument.
|
|
66
|
+
* @returns The wrapped action. Include this as an `export` to name it and make it accessible.
|
|
67
|
+
*/
|
|
68
|
+
export declare const action: ActionBuilder<DataModel, "public">;
|
|
69
|
+
/**
|
|
70
|
+
* Define an action that is only accessible from other Convex functions (but not from the client).
|
|
71
|
+
*
|
|
72
|
+
* @param func - The function. It receives an {@link ActionCtx} as its first argument.
|
|
73
|
+
* @returns The wrapped function. Include this as an `export` to name it and make it accessible.
|
|
74
|
+
*/
|
|
75
|
+
export declare const internalAction: ActionBuilder<DataModel, "internal">;
|
|
76
|
+
/**
|
|
77
|
+
* Define an HTTP action.
|
|
78
|
+
*
|
|
79
|
+
* The wrapped function will be used to respond to HTTP requests received
|
|
80
|
+
* by a Convex deployment if the requests matches the path and method where
|
|
81
|
+
* this action is routed. Be sure to route your httpAction in `convex/http.js`.
|
|
82
|
+
*
|
|
83
|
+
* @param func - The function. It receives an {@link ActionCtx} as its first argument
|
|
84
|
+
* and a Fetch API `Request` object as its second.
|
|
85
|
+
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
|
|
86
|
+
*/
|
|
87
|
+
export declare const httpAction: HttpActionBuilder;
|
|
88
|
+
export declare const env: Env;
|
|
89
|
+
/**
|
|
90
|
+
* A set of services for use within Convex query functions.
|
|
91
|
+
*
|
|
92
|
+
* The query context is passed as the first argument to any Convex query
|
|
93
|
+
* function run on the server.
|
|
94
|
+
*
|
|
95
|
+
* If you're using code generation, use the `QueryCtx` type in `convex/_generated/server.d.ts` instead.
|
|
96
|
+
*/
|
|
97
|
+
export type QueryCtx = GenericQueryCtx<DataModel>;
|
|
98
|
+
/**
|
|
99
|
+
* A set of services for use within Convex mutation functions.
|
|
100
|
+
*
|
|
101
|
+
* The mutation context is passed as the first argument to any Convex mutation
|
|
102
|
+
* function run on the server.
|
|
103
|
+
*
|
|
104
|
+
* If you're using code generation, use the `MutationCtx` type in `convex/_generated/server.d.ts` instead.
|
|
105
|
+
*/
|
|
106
|
+
export type MutationCtx = GenericMutationCtx<DataModel>;
|
|
107
|
+
/**
|
|
108
|
+
* A set of services for use within Convex action functions.
|
|
109
|
+
*
|
|
110
|
+
* The action context is passed as the first argument to any Convex action
|
|
111
|
+
* function run on the server.
|
|
112
|
+
*/
|
|
113
|
+
export type ActionCtx = GenericActionCtx<DataModel>;
|
|
114
|
+
/**
|
|
115
|
+
* An interface to read from the database within Convex query functions.
|
|
116
|
+
*
|
|
117
|
+
* The two entry points are {@link DatabaseReader.get}, which fetches a single
|
|
118
|
+
* document by its {@link Id}, or {@link DatabaseReader.query}, which starts
|
|
119
|
+
* building a query.
|
|
120
|
+
*/
|
|
121
|
+
export type DatabaseReader = GenericDatabaseReader<DataModel>;
|
|
122
|
+
/**
|
|
123
|
+
* An interface to read from and write to the database within Convex mutation
|
|
124
|
+
* functions.
|
|
125
|
+
*
|
|
126
|
+
* Convex guarantees that all writes within a single mutation are
|
|
127
|
+
* executed atomically, so you never have to worry about partial writes leaving
|
|
128
|
+
* your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control)
|
|
129
|
+
* for the guarantees Convex provides your functions.
|
|
130
|
+
*/
|
|
131
|
+
export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
|
|
132
|
+
export {};
|
|
133
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,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;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* Generated utilities for implementing server-side Convex query and mutation functions.
|
|
4
|
+
*
|
|
5
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
|
+
*
|
|
7
|
+
* To regenerate, run `npx convex dev`.
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { actionGeneric, httpActionGeneric, queryGeneric, mutationGeneric, internalActionGeneric, internalMutationGeneric, internalQueryGeneric, } from "convex/server";
|
|
11
|
+
/**
|
|
12
|
+
* Define a query in this Convex app's public API.
|
|
13
|
+
*
|
|
14
|
+
* This function will be allowed to read your Convex database and will be accessible from the client.
|
|
15
|
+
*
|
|
16
|
+
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
17
|
+
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
18
|
+
*/
|
|
19
|
+
export const query = queryGeneric;
|
|
20
|
+
/**
|
|
21
|
+
* Define a query that is only accessible from other Convex functions (but not from the client).
|
|
22
|
+
*
|
|
23
|
+
* This function will be allowed to read from your Convex database. It will not be accessible from the client.
|
|
24
|
+
*
|
|
25
|
+
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
26
|
+
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
27
|
+
*/
|
|
28
|
+
export const internalQuery = internalQueryGeneric;
|
|
29
|
+
/**
|
|
30
|
+
* Define a mutation in this Convex app's public API.
|
|
31
|
+
*
|
|
32
|
+
* This function will be allowed to modify your Convex database and will be accessible from the client.
|
|
33
|
+
*
|
|
34
|
+
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
35
|
+
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
36
|
+
*/
|
|
37
|
+
export const mutation = mutationGeneric;
|
|
38
|
+
/**
|
|
39
|
+
* Define a mutation that is only accessible from other Convex functions (but not from the client).
|
|
40
|
+
*
|
|
41
|
+
* This function will be allowed to modify your Convex database. It will not be accessible from the client.
|
|
42
|
+
*
|
|
43
|
+
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
44
|
+
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
45
|
+
*/
|
|
46
|
+
export const internalMutation = internalMutationGeneric;
|
|
47
|
+
/**
|
|
48
|
+
* Define an action in this Convex app's public API.
|
|
49
|
+
*
|
|
50
|
+
* An action is a function which can execute any JavaScript code, including non-deterministic
|
|
51
|
+
* code and code with side-effects, like calling third-party services.
|
|
52
|
+
* They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
|
|
53
|
+
* They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
|
|
54
|
+
*
|
|
55
|
+
* @param func - The action. It receives an {@link ActionCtx} as its first argument.
|
|
56
|
+
* @returns The wrapped action. Include this as an `export` to name it and make it accessible.
|
|
57
|
+
*/
|
|
58
|
+
export const action = actionGeneric;
|
|
59
|
+
/**
|
|
60
|
+
* Define an action that is only accessible from other Convex functions (but not from the client).
|
|
61
|
+
*
|
|
62
|
+
* @param func - The function. It receives an {@link ActionCtx} as its first argument.
|
|
63
|
+
* @returns The wrapped function. Include this as an `export` to name it and make it accessible.
|
|
64
|
+
*/
|
|
65
|
+
export const internalAction = internalActionGeneric;
|
|
66
|
+
/**
|
|
67
|
+
* Define an HTTP action.
|
|
68
|
+
*
|
|
69
|
+
* The wrapped function will be used to respond to HTTP requests received
|
|
70
|
+
* by a Convex deployment if the requests matches the path and method where
|
|
71
|
+
* this action is routed. Be sure to route your httpAction in `convex/http.js`.
|
|
72
|
+
*
|
|
73
|
+
* @param func - The function. It receives an {@link ActionCtx} as its first argument
|
|
74
|
+
* and a Fetch API `Request` object as its second.
|
|
75
|
+
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
|
|
76
|
+
*/
|
|
77
|
+
export const httpAction = httpActionGeneric;
|
|
78
|
+
export const env = globalThis
|
|
79
|
+
.process.env;
|
|
80
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAaH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAcvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAsC,YAAY,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GACxB,oBAAoB,CAAC;AAEvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAyC,eAAe,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAC3B,uBAAuB,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,MAAM,GAAuC,aAAa,CAAC;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GACzB,qBAAqB,CAAC;AAExB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsB,iBAAiB,CAAC;AAC/D,MAAM,CAAC,MAAM,GAAG,GAAS,UAAmD;KACzE,OAAO,CAAC,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,sDAA6B,CAAC;eAE9B,SAAS"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex.config.js","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,SAAS,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;AAE7C,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const open: import("convex/server").RegisteredMutation<"public", {
|
|
2
|
+
bucketRef?: string | undefined;
|
|
3
|
+
capacity?: number | undefined;
|
|
4
|
+
scope: string;
|
|
5
|
+
}, Promise<string>>;
|
|
6
|
+
export declare const join: import("convex/server").RegisteredMutation<"public", {
|
|
7
|
+
bucketRef: string;
|
|
8
|
+
scope: string;
|
|
9
|
+
subjectRef: string;
|
|
10
|
+
}, Promise<{
|
|
11
|
+
joined: boolean;
|
|
12
|
+
reason: string;
|
|
13
|
+
} | {
|
|
14
|
+
reason?: undefined;
|
|
15
|
+
joined: boolean;
|
|
16
|
+
}>>;
|
|
17
|
+
export declare const leave: import("convex/server").RegisteredMutation<"public", {
|
|
18
|
+
bucketRef: string;
|
|
19
|
+
scope: string;
|
|
20
|
+
subjectRef: string;
|
|
21
|
+
}, Promise<boolean>>;
|
|
22
|
+
export declare const lock: import("convex/server").RegisteredMutation<"public", {
|
|
23
|
+
bucketRef: string;
|
|
24
|
+
scope: string;
|
|
25
|
+
}, Promise<boolean>>;
|
|
26
|
+
export declare const close: import("convex/server").RegisteredMutation<"public", {
|
|
27
|
+
bucketRef: string;
|
|
28
|
+
scope: string;
|
|
29
|
+
}, Promise<boolean>>;
|
|
30
|
+
export declare const eraseBucket: import("convex/server").RegisteredMutation<"public", {
|
|
31
|
+
batch?: number | undefined;
|
|
32
|
+
bucketRef: string;
|
|
33
|
+
scope: string;
|
|
34
|
+
}, Promise<number>>;
|
|
35
|
+
export declare const continueEraseBucket: import("convex/server").RegisteredMutation<"internal", {
|
|
36
|
+
batch: number;
|
|
37
|
+
bucketId: import("convex/values").GenericId<"buckets">;
|
|
38
|
+
}, Promise<number>>;
|
|
39
|
+
export declare const eraseSubject: import("convex/server").RegisteredMutation<"public", {
|
|
40
|
+
batch?: number | undefined;
|
|
41
|
+
scope: string;
|
|
42
|
+
subjectRef: string;
|
|
43
|
+
}, Promise<number>>;
|
|
44
|
+
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AA8EA,eAAO,MAAM,IAAI;;;;mBAqCf,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;GAkCf,CAAC;AAEH,eAAO,MAAM,KAAK;;;;oBAyBhB,CAAC;AAEH,eAAO,MAAM,IAAI;;;oBAgBf,CAAC;AAEH,eAAO,MAAM,KAAK;;;oBAgBhB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;mBAetB,CAAC;AA6BH,eAAO,MAAM,mBAAmB;;;mBAK9B,CAAC;AAaH,eAAO,MAAM,YAAY;;;;mBAavB,CAAC"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { ConvexError, v } from "convex/values";
|
|
2
|
+
import { DEFAULT_ERASE_BATCH, MAX_ERASE_BATCH, MAX_REF_LENGTH, } from "../shared";
|
|
3
|
+
import { internal } from "./_generated/api";
|
|
4
|
+
import { internalMutation, mutation, } from "./_generated/server";
|
|
5
|
+
function findBucket(ctx, ref) {
|
|
6
|
+
return ctx.db
|
|
7
|
+
.query("buckets")
|
|
8
|
+
.withIndex("by_scope_ref", (q) => q.eq("scope", ref.scope).eq("bucketRef", ref.bucketRef))
|
|
9
|
+
.unique();
|
|
10
|
+
}
|
|
11
|
+
function findMember(ctx, ref) {
|
|
12
|
+
return ctx.db
|
|
13
|
+
.query("members")
|
|
14
|
+
.withIndex("by_bucket_subject", (q) => q
|
|
15
|
+
.eq("scope", ref.scope)
|
|
16
|
+
.eq("bucketRef", ref.bucketRef)
|
|
17
|
+
.eq("subjectRef", ref.subjectRef))
|
|
18
|
+
.unique();
|
|
19
|
+
}
|
|
20
|
+
function membersInBucket(ctx, ref) {
|
|
21
|
+
return ctx.db
|
|
22
|
+
.query("members")
|
|
23
|
+
.withIndex("by_bucket", (q) => q.eq("scope", ref.scope).eq("bucketRef", ref.bucketRef));
|
|
24
|
+
}
|
|
25
|
+
function fail(code, message) {
|
|
26
|
+
throw new ConvexError({ code, message });
|
|
27
|
+
}
|
|
28
|
+
function requireRef(value, name) {
|
|
29
|
+
if (value.length === 0 || value.length > MAX_REF_LENGTH) {
|
|
30
|
+
fail("INVALID_REF", `${name} must be 1..${String(MAX_REF_LENGTH)} characters`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function parseBatch(batch) {
|
|
34
|
+
const raw = batch ?? DEFAULT_ERASE_BATCH;
|
|
35
|
+
if (!Number.isSafeInteger(raw)) {
|
|
36
|
+
fail("INVALID_BATCH", "batch must be a positive integer");
|
|
37
|
+
}
|
|
38
|
+
if (raw < 1) {
|
|
39
|
+
fail("INVALID_BATCH", "batch must be a positive integer");
|
|
40
|
+
}
|
|
41
|
+
return Math.min(raw, MAX_ERASE_BATCH);
|
|
42
|
+
}
|
|
43
|
+
export const open = mutation({
|
|
44
|
+
args: {
|
|
45
|
+
bucketRef: v.optional(v.string()),
|
|
46
|
+
capacity: v.optional(v.number()),
|
|
47
|
+
scope: v.string(),
|
|
48
|
+
},
|
|
49
|
+
handler: async (ctx, arguments_) => {
|
|
50
|
+
requireRef(arguments_.scope, "scope");
|
|
51
|
+
if (arguments_.capacity !== undefined &&
|
|
52
|
+
(!Number.isSafeInteger(arguments_.capacity) || arguments_.capacity < 1)) {
|
|
53
|
+
fail("INVALID_CAPACITY", "capacity must be a positive integer");
|
|
54
|
+
}
|
|
55
|
+
const bucketRef = arguments_.bucketRef ?? crypto.randomUUID();
|
|
56
|
+
requireRef(bucketRef, "bucketRef");
|
|
57
|
+
const existing = await findBucket(ctx, {
|
|
58
|
+
bucketRef,
|
|
59
|
+
scope: arguments_.scope,
|
|
60
|
+
});
|
|
61
|
+
if (existing !== null) {
|
|
62
|
+
fail("BUCKET_EXISTS", "a bucket with this ref already exists in the scope");
|
|
63
|
+
}
|
|
64
|
+
await ctx.db.insert("buckets", {
|
|
65
|
+
bucketRef,
|
|
66
|
+
capacity: arguments_.capacity,
|
|
67
|
+
memberCount: 0,
|
|
68
|
+
openedAt: Date.now(),
|
|
69
|
+
scope: arguments_.scope,
|
|
70
|
+
status: "open",
|
|
71
|
+
});
|
|
72
|
+
return bucketRef;
|
|
73
|
+
},
|
|
74
|
+
returns: v.string(),
|
|
75
|
+
});
|
|
76
|
+
export const join = mutation({
|
|
77
|
+
args: {
|
|
78
|
+
bucketRef: v.string(),
|
|
79
|
+
scope: v.string(),
|
|
80
|
+
subjectRef: v.string(),
|
|
81
|
+
},
|
|
82
|
+
handler: async (ctx, arguments_) => {
|
|
83
|
+
requireRef(arguments_.scope, "scope");
|
|
84
|
+
requireRef(arguments_.bucketRef, "bucketRef");
|
|
85
|
+
requireRef(arguments_.subjectRef, "subjectRef");
|
|
86
|
+
const bucket = await findBucket(ctx, arguments_);
|
|
87
|
+
if (bucket === null) {
|
|
88
|
+
return { joined: false, reason: "missing" };
|
|
89
|
+
}
|
|
90
|
+
if (bucket.status !== "open") {
|
|
91
|
+
return { joined: false, reason: bucket.status };
|
|
92
|
+
}
|
|
93
|
+
const existing = await findMember(ctx, arguments_);
|
|
94
|
+
if (existing !== null) {
|
|
95
|
+
return { joined: false, reason: "already_member" };
|
|
96
|
+
}
|
|
97
|
+
if (bucket.capacity !== undefined &&
|
|
98
|
+
bucket.memberCount >= bucket.capacity) {
|
|
99
|
+
return { joined: false, reason: "full" };
|
|
100
|
+
}
|
|
101
|
+
await ctx.db.insert("members", { ...arguments_, joinedAt: Date.now() });
|
|
102
|
+
await ctx.db.patch("buckets", bucket._id, {
|
|
103
|
+
memberCount: bucket.memberCount + 1,
|
|
104
|
+
});
|
|
105
|
+
return { joined: true };
|
|
106
|
+
},
|
|
107
|
+
returns: v.object({ joined: v.boolean(), reason: v.optional(v.string()) }),
|
|
108
|
+
});
|
|
109
|
+
export const leave = mutation({
|
|
110
|
+
args: {
|
|
111
|
+
bucketRef: v.string(),
|
|
112
|
+
scope: v.string(),
|
|
113
|
+
subjectRef: v.string(),
|
|
114
|
+
},
|
|
115
|
+
handler: async (ctx, arguments_) => {
|
|
116
|
+
requireRef(arguments_.scope, "scope");
|
|
117
|
+
requireRef(arguments_.bucketRef, "bucketRef");
|
|
118
|
+
requireRef(arguments_.subjectRef, "subjectRef");
|
|
119
|
+
const bucket = await findBucket(ctx, arguments_);
|
|
120
|
+
if (bucket === null || bucket.status === "closed") {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
const existing = await findMember(ctx, arguments_);
|
|
124
|
+
if (existing === null) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
await ctx.db.delete("members", existing._id);
|
|
128
|
+
await ctx.db.patch("buckets", bucket._id, {
|
|
129
|
+
memberCount: Math.max(bucket.memberCount - 1, 0),
|
|
130
|
+
});
|
|
131
|
+
return true;
|
|
132
|
+
},
|
|
133
|
+
returns: v.boolean(),
|
|
134
|
+
});
|
|
135
|
+
export const lock = mutation({
|
|
136
|
+
args: { bucketRef: v.string(), scope: v.string() },
|
|
137
|
+
handler: async (ctx, arguments_) => {
|
|
138
|
+
requireRef(arguments_.scope, "scope");
|
|
139
|
+
requireRef(arguments_.bucketRef, "bucketRef");
|
|
140
|
+
const bucket = await findBucket(ctx, arguments_);
|
|
141
|
+
if (bucket?.status !== "open") {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
await ctx.db.patch("buckets", bucket._id, {
|
|
145
|
+
lockedAt: Date.now(),
|
|
146
|
+
status: "locked",
|
|
147
|
+
});
|
|
148
|
+
return true;
|
|
149
|
+
},
|
|
150
|
+
returns: v.boolean(),
|
|
151
|
+
});
|
|
152
|
+
export const close = mutation({
|
|
153
|
+
args: { bucketRef: v.string(), scope: v.string() },
|
|
154
|
+
handler: async (ctx, arguments_) => {
|
|
155
|
+
requireRef(arguments_.scope, "scope");
|
|
156
|
+
requireRef(arguments_.bucketRef, "bucketRef");
|
|
157
|
+
const bucket = await findBucket(ctx, arguments_);
|
|
158
|
+
if (bucket === null || bucket.status === "closed") {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
await ctx.db.patch("buckets", bucket._id, {
|
|
162
|
+
closedAt: Date.now(),
|
|
163
|
+
status: "closed",
|
|
164
|
+
});
|
|
165
|
+
return true;
|
|
166
|
+
},
|
|
167
|
+
returns: v.boolean(),
|
|
168
|
+
});
|
|
169
|
+
export const eraseBucket = mutation({
|
|
170
|
+
args: {
|
|
171
|
+
batch: v.optional(v.number()),
|
|
172
|
+
bucketRef: v.string(),
|
|
173
|
+
scope: v.string(),
|
|
174
|
+
},
|
|
175
|
+
handler: async (ctx, arguments_) => {
|
|
176
|
+
requireRef(arguments_.scope, "scope");
|
|
177
|
+
requireRef(arguments_.bucketRef, "bucketRef");
|
|
178
|
+
const batch = parseBatch(arguments_.batch);
|
|
179
|
+
const bucket = await findBucket(ctx, arguments_);
|
|
180
|
+
if (bucket === null)
|
|
181
|
+
return 0;
|
|
182
|
+
return eraseBucketBatch(ctx, bucket._id, batch);
|
|
183
|
+
},
|
|
184
|
+
returns: v.number(),
|
|
185
|
+
});
|
|
186
|
+
async function eraseBucketBatch(ctx, bucketId, batch) {
|
|
187
|
+
const bucket = await ctx.db.get("buckets", bucketId);
|
|
188
|
+
if (bucket === null)
|
|
189
|
+
return 0;
|
|
190
|
+
const members = await membersInBucket(ctx, bucket).take(batch);
|
|
191
|
+
await Promise.all(members.map((member) => ctx.db.delete("members", member._id)));
|
|
192
|
+
if (members.length < batch) {
|
|
193
|
+
await ctx.db.delete("buckets", bucketId);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
await ctx.db.patch("buckets", bucketId, {
|
|
197
|
+
closedAt: bucket.closedAt ?? Date.now(),
|
|
198
|
+
memberCount: Math.max(0, bucket.memberCount - members.length),
|
|
199
|
+
status: "closed",
|
|
200
|
+
});
|
|
201
|
+
await ctx.scheduler.runAfter(0, internal.mutations.continueEraseBucket, {
|
|
202
|
+
batch,
|
|
203
|
+
bucketId,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
return members.length;
|
|
207
|
+
}
|
|
208
|
+
export const continueEraseBucket = internalMutation({
|
|
209
|
+
args: { batch: v.number(), bucketId: v.id("buckets") },
|
|
210
|
+
handler: async (ctx, arguments_) => eraseBucketBatch(ctx, arguments_.bucketId, parseBatch(arguments_.batch)),
|
|
211
|
+
returns: v.number(),
|
|
212
|
+
});
|
|
213
|
+
function subjectMembers(ctx, ref) {
|
|
214
|
+
return ctx.db
|
|
215
|
+
.query("members")
|
|
216
|
+
.withIndex("by_subject", (q) => q.eq("scope", ref.scope).eq("subjectRef", ref.subjectRef));
|
|
217
|
+
}
|
|
218
|
+
export const eraseSubject = mutation({
|
|
219
|
+
args: {
|
|
220
|
+
batch: v.optional(v.number()),
|
|
221
|
+
scope: v.string(),
|
|
222
|
+
subjectRef: v.string(),
|
|
223
|
+
},
|
|
224
|
+
handler: async (ctx, ref) => {
|
|
225
|
+
requireRef(ref.scope, "scope");
|
|
226
|
+
requireRef(ref.subjectRef, "subjectRef");
|
|
227
|
+
const batch = parseBatch(ref.batch);
|
|
228
|
+
return eraseSubjectBatch(ctx, { ...ref, batch });
|
|
229
|
+
},
|
|
230
|
+
returns: v.number(),
|
|
231
|
+
});
|
|
232
|
+
async function eraseSubjectBatch(ctx, ref) {
|
|
233
|
+
const memberships = await subjectMembers(ctx, ref).take(ref.batch);
|
|
234
|
+
await Promise.all(memberships.map(async (membership) => {
|
|
235
|
+
await ctx.db.delete("members", membership._id);
|
|
236
|
+
const bucket = await findBucket(ctx, membership);
|
|
237
|
+
if (bucket !== null)
|
|
238
|
+
await ctx.db.patch("buckets", bucket._id, {
|
|
239
|
+
memberCount: Math.max(0, bucket.memberCount - 1),
|
|
240
|
+
});
|
|
241
|
+
}));
|
|
242
|
+
return memberships.length;
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=mutations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,cAAc,GACf,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EACL,gBAAgB,EAChB,QAAQ,GAET,MAAM,qBAAqB,CAAC;AAE7B,SAAS,UAAU,CACjB,GAAgB,EAChB,GAAyC;IAEzC,OAAO,GAAG,CAAC,EAAE;SACV,KAAK,CAAC,SAAS,CAAC;SAChB,SAAS,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CAC/B,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,CAAC,SAAS,CAAC,CACxD;SACA,MAAM,EAAE,CAAC;AACd,CAAC;AAED,SAAS,UAAU,CACjB,GAAgB,EAChB,GAA6D;IAE7D,OAAO,GAAG,CAAC,EAAE;SACV,KAAK,CAAC,SAAS,CAAC;SAChB,SAAS,CAAC,mBAAmB,EAAE,CAAC,CAAC,EAAE,EAAE,CACpC,CAAC;SACE,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC;SACtB,EAAE,CAAC,WAAW,EAAE,GAAG,CAAC,SAAS,CAAC;SAC9B,EAAE,CAAC,YAAY,EAAE,GAAG,CAAC,UAAU,CAAC,CACpC;SACA,MAAM,EAAE,CAAC;AACd,CAAC;AAED,SAAS,eAAe,CACtB,GAAgB,EAChB,GAAyC;IAEzC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B,CAAC,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAQH,KAAK,UAAU,iBAAiB,CAC9B,GAAgB,EAChB,GAAiB;IAEjB,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACnE,MAAM,OAAO,CAAC,GAAG,CACf,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;QACnC,MAAM,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QACjD,IAAI,MAAM,KAAK,IAAI;YACjB,MAAM,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,EAAE;gBACxC,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC;aACjD,CAAC,CAAC;IACP,CAAC,CAAC,CACH,CAAC;IACF,OAAO,WAAW,CAAC,MAAM,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare const get: import("convex/server").RegisteredQuery<"public", {
|
|
2
|
+
bucketRef: string;
|
|
3
|
+
scope: string;
|
|
4
|
+
}, Promise<{
|
|
5
|
+
bucketRef: string;
|
|
6
|
+
capacity: number | undefined;
|
|
7
|
+
closedAt: number | undefined;
|
|
8
|
+
lockedAt: number | undefined;
|
|
9
|
+
memberCount: number;
|
|
10
|
+
openedAt: number;
|
|
11
|
+
status: "closed" | "locked" | "open";
|
|
12
|
+
} | null>>;
|
|
13
|
+
export declare const paginateMembers: import("convex/server").RegisteredQuery<"public", {
|
|
14
|
+
bucketRef: string;
|
|
15
|
+
paginationOpts: {
|
|
16
|
+
id?: number;
|
|
17
|
+
endCursor?: string | null;
|
|
18
|
+
maximumRowsRead?: number;
|
|
19
|
+
maximumBytesRead?: number;
|
|
20
|
+
numItems: number;
|
|
21
|
+
cursor: string | null;
|
|
22
|
+
};
|
|
23
|
+
scope: string;
|
|
24
|
+
}, Promise<{
|
|
25
|
+
continueCursor: string;
|
|
26
|
+
isDone: boolean;
|
|
27
|
+
page: {
|
|
28
|
+
joinedAt: number;
|
|
29
|
+
subjectRef: string;
|
|
30
|
+
}[];
|
|
31
|
+
}>>;
|
|
32
|
+
/** Bounded preview; use paginateMembers to list every member. */
|
|
33
|
+
export declare const listMembers: import("convex/server").RegisteredQuery<"public", {
|
|
34
|
+
bucketRef: string;
|
|
35
|
+
limit?: number | undefined;
|
|
36
|
+
scope: string;
|
|
37
|
+
}, Promise<{
|
|
38
|
+
joinedAt: number;
|
|
39
|
+
subjectRef: string;
|
|
40
|
+
}[]>>;
|
|
41
|
+
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/component/queries.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,GAAG;;;;;;;;;;;UA4Bd,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;GAmC1B,CAAC;AAEH,iEAAiE;AACjE,eAAO,MAAM,WAAW;;;;;;;KA+BtB,CAAC"}
|