@vllnt/convex-events 0.1.0-canary.2310a69
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 +140 -0
- package/dist/client/index.d.ts +134 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +144 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/types.d.ts +58 -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 +40 -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 +93 -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 +121 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +78 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/convex.config.d.ts +8 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +9 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/crons.d.ts +8 -0
- package/dist/component/crons.d.ts.map +1 -0
- package/dist/component/crons.js +11 -0
- package/dist/component/crons.js.map +1 -0
- package/dist/component/mutations.d.ts +30 -0
- package/dist/component/mutations.d.ts.map +1 -0
- package/dist/component/mutations.js +105 -0
- package/dist/component/mutations.js.map +1 -0
- package/dist/component/queries.d.ts +54 -0
- package/dist/component/queries.d.ts.map +1 -0
- package/dist/component/queries.js +103 -0
- package/dist/component/queries.js.map +1 -0
- package/dist/component/schema.d.ts +35 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +28 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/component/validators.d.ts +82 -0
- package/dist/component/validators.d.ts.map +1 -0
- package/dist/component/validators.js +29 -0
- package/dist/component/validators.js.map +1 -0
- package/dist/react/index.d.ts +63 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +40 -0
- package/dist/react/index.js.map +1 -0
- package/dist/shared.d.ts +23 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +23 -0
- package/dist/shared.js.map +1 -0
- package/package.json +112 -0
- package/src/client/index.ts +297 -0
- package/src/client/types.ts +62 -0
- package/src/component/_generated/api.ts +56 -0
- package/src/component/_generated/component.ts +113 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +156 -0
- package/src/component/convex.config.ts +10 -0
- package/src/component/crons.ts +18 -0
- package/src/component/mutations.ts +108 -0
- package/src/component/queries.ts +109 -0
- package/src/component/schema.ts +28 -0
- package/src/component/validators.ts +32 -0
- package/src/react/index.test.tsx +133 -0
- package/src/react/index.tsx +83 -0
- package/src/shared.ts +35 -0
- package/src/test.ts +12 -0
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
mutations: {
|
|
23
|
+
configure: FunctionReference<"mutation", "internal", {
|
|
24
|
+
retentionMs?: number;
|
|
25
|
+
}, null, Name>;
|
|
26
|
+
pruneExpired: FunctionReference<"mutation", "internal", {
|
|
27
|
+
batch?: number;
|
|
28
|
+
}, number, Name>;
|
|
29
|
+
purge: FunctionReference<"mutation", "internal", {
|
|
30
|
+
batch?: number;
|
|
31
|
+
before?: number;
|
|
32
|
+
subjectRef: string;
|
|
33
|
+
}, number, Name>;
|
|
34
|
+
record: FunctionReference<"mutation", "internal", {
|
|
35
|
+
actorRef?: string;
|
|
36
|
+
metadata?: any;
|
|
37
|
+
subjectRef: string;
|
|
38
|
+
type: string;
|
|
39
|
+
}, string, Name>;
|
|
40
|
+
};
|
|
41
|
+
queries: {
|
|
42
|
+
count: FunctionReference<"query", "internal", {
|
|
43
|
+
maxCount?: number;
|
|
44
|
+
subjectRef: string;
|
|
45
|
+
type?: string;
|
|
46
|
+
}, {
|
|
47
|
+
count: number;
|
|
48
|
+
isExact: boolean;
|
|
49
|
+
}, Name>;
|
|
50
|
+
list: FunctionReference<"query", "internal", {
|
|
51
|
+
limit: number;
|
|
52
|
+
since?: number;
|
|
53
|
+
subjectRef: string;
|
|
54
|
+
type?: string;
|
|
55
|
+
}, Array<{
|
|
56
|
+
_creationTime: number;
|
|
57
|
+
_id: string;
|
|
58
|
+
actorRef?: string;
|
|
59
|
+
createdAt: number;
|
|
60
|
+
metadata?: any;
|
|
61
|
+
subjectRef: string;
|
|
62
|
+
type: string;
|
|
63
|
+
}>, Name>;
|
|
64
|
+
listPaginated: FunctionReference<"query", "internal", {
|
|
65
|
+
paginationOpts: {
|
|
66
|
+
cursor: string | null;
|
|
67
|
+
endCursor?: string | null;
|
|
68
|
+
id?: number;
|
|
69
|
+
maximumBytesRead?: number;
|
|
70
|
+
maximumRowsRead?: number;
|
|
71
|
+
numItems: number;
|
|
72
|
+
};
|
|
73
|
+
since?: number;
|
|
74
|
+
subjectRef: string;
|
|
75
|
+
type?: string;
|
|
76
|
+
}, {
|
|
77
|
+
continueCursor: string;
|
|
78
|
+
isDone: boolean;
|
|
79
|
+
page: Array<{
|
|
80
|
+
_creationTime: number;
|
|
81
|
+
_id: string;
|
|
82
|
+
actorRef?: string;
|
|
83
|
+
createdAt: number;
|
|
84
|
+
metadata?: any;
|
|
85
|
+
subjectRef: string;
|
|
86
|
+
type: string;
|
|
87
|
+
}>;
|
|
88
|
+
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
89
|
+
splitCursor?: string | null;
|
|
90
|
+
}, Name>;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
//# 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,SAAS,EAAE;QACT,SAAS,EAAE,iBAAiB,CAC1B,UAAU,EACV,UAAU,EACV;YAAE,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,EACxB,IAAI,EACJ,IAAI,CACL,CAAC;QACF,YAAY,EAAE,iBAAiB,CAC7B,UAAU,EACV,UAAU,EACV;YAAE,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,EAClB,MAAM,EACN,IAAI,CACL,CAAC;QACF,KAAK,EAAE,iBAAiB,CACtB,UAAU,EACV,UAAU,EACV;YAAE,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;S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,CAAC,EAAE,MAAM,CAAC;gBAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;gBACzB,QAAQ,EAAE,MAAM,CAAC;aAClB,CAAC;YACF,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,UAAU,EAAE,MAAM,CAAC;YACnB,IAAI,CAAC,EAAE,MAAM,CAAC;SACf,EACD;YACE,cAAc,EAAE,MAAM,CAAC;YACvB,MAAM,EAAE,OAAO,CAAC;YAChB,IAAI,EAAE,KAAK,CAAC;gBACV,aAAa,EAAE,MAAM,CAAC;gBACtB,GAAG,EAAE,MAAM,CAAC;gBACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAClB,SAAS,EAAE,MAAM,CAAC;gBAClB,QAAQ,CAAC,EAAE,GAAG,CAAC;gBACf,UAAU,EAAE,MAAM,CAAC;gBACnB,IAAI,EAAE,MAAM,CAAC;aACd,CAAC,CAAC;YACH,UAAU,CAAC,EAAE,kBAAkB,GAAG,eAAe,GAAG,IAAI,CAAC;YACzD,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;SAC7B,EACD,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"}
|
|
@@ -0,0 +1,121 @@
|
|
|
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
|
+
* 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 declare const query: QueryBuilder<DataModel, "public">;
|
|
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 declare const internalQuery: QueryBuilder<DataModel, "internal">;
|
|
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 declare const mutation: MutationBuilder<DataModel, "public">;
|
|
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 declare const internalMutation: MutationBuilder<DataModel, "internal">;
|
|
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 declare const action: ActionBuilder<DataModel, "public">;
|
|
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 declare const internalAction: ActionBuilder<DataModel, "internal">;
|
|
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 declare const httpAction: HttpActionBuilder;
|
|
78
|
+
/**
|
|
79
|
+
* A set of services for use within Convex query functions.
|
|
80
|
+
*
|
|
81
|
+
* The query context is passed as the first argument to any Convex query
|
|
82
|
+
* function run on the server.
|
|
83
|
+
*
|
|
84
|
+
* If you're using code generation, use the `QueryCtx` type in `convex/_generated/server.d.ts` instead.
|
|
85
|
+
*/
|
|
86
|
+
export type QueryCtx = GenericQueryCtx<DataModel>;
|
|
87
|
+
/**
|
|
88
|
+
* A set of services for use within Convex mutation functions.
|
|
89
|
+
*
|
|
90
|
+
* The mutation context is passed as the first argument to any Convex mutation
|
|
91
|
+
* function run on the server.
|
|
92
|
+
*
|
|
93
|
+
* If you're using code generation, use the `MutationCtx` type in `convex/_generated/server.d.ts` instead.
|
|
94
|
+
*/
|
|
95
|
+
export type MutationCtx = GenericMutationCtx<DataModel>;
|
|
96
|
+
/**
|
|
97
|
+
* A set of services for use within Convex action functions.
|
|
98
|
+
*
|
|
99
|
+
* The action context is passed as the first argument to any Convex action
|
|
100
|
+
* function run on the server.
|
|
101
|
+
*/
|
|
102
|
+
export type ActionCtx = GenericActionCtx<DataModel>;
|
|
103
|
+
/**
|
|
104
|
+
* An interface to read from the database within Convex query functions.
|
|
105
|
+
*
|
|
106
|
+
* The two entry points are {@link DatabaseReader.get}, which fetches a single
|
|
107
|
+
* document by its {@link Id}, or {@link DatabaseReader.query}, which starts
|
|
108
|
+
* building a query.
|
|
109
|
+
*/
|
|
110
|
+
export type DatabaseReader = GenericDatabaseReader<DataModel>;
|
|
111
|
+
/**
|
|
112
|
+
* An interface to read from and write to the database within Convex mutation
|
|
113
|
+
* functions.
|
|
114
|
+
*
|
|
115
|
+
* Convex guarantees that all writes within a single mutation are
|
|
116
|
+
* executed atomically, so you never have to worry about partial writes leaving
|
|
117
|
+
* your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control)
|
|
118
|
+
* for the guarantees Convex provides your functions.
|
|
119
|
+
*/
|
|
120
|
+
export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
|
|
121
|
+
//# 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,EACjB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,eAAe,CAAC;AAUvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAAE,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAgB,CAAC;AAErE;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,SAAS,EAAE,UAAU,CACxC,CAAC;AAEvB;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,eAAe,CAAC,SAAS,EAAE,QAAQ,CAAmB,CAAC;AAE9E;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAAC,SAAS,EAAE,UAAU,CAC3C,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM,EAAE,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAiB,CAAC;AAExE;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC,SAAS,EAAE,UAAU,CACzC,CAAC;AAExB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,EAAE,iBAAqC,CAAC;AAE/D;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAExD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAEpD;;;;;;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,78 @@
|
|
|
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
|
+
//# 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;AAGvB;;;;;;;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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The events component. Owns the sandboxed `events` ledger + a singleton
|
|
3
|
+
* `config` row, and runs an internal daily retention cron (see `crons.ts`,
|
|
4
|
+
* `mutations.pruneExpired`) that prunes events past the host-configured window.
|
|
5
|
+
*/
|
|
6
|
+
declare const component: import("convex/server").ComponentDefinition<any, {}>;
|
|
7
|
+
export default component;
|
|
8
|
+
//# sourceMappingURL=convex.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,QAAA,MAAM,SAAS,sDAA4B,CAAC;AAE5C,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineComponent } from "convex/server";
|
|
2
|
+
/**
|
|
3
|
+
* The events component. Owns the sandboxed `events` ledger + a singleton
|
|
4
|
+
* `config` row, and runs an internal daily retention cron (see `crons.ts`,
|
|
5
|
+
* `mutations.pruneExpired`) that prunes events past the host-configured window.
|
|
6
|
+
*/
|
|
7
|
+
const component = defineComponent("events");
|
|
8
|
+
export default component;
|
|
9
|
+
//# sourceMappingURL=convex.config.js.map
|
|
@@ -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;;;;GAIG;AACH,MAAM,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;AAE5C,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component-internal retention sweep. Runs daily and prunes events older than
|
|
3
|
+
* the host-configured `retentionMs` (set via `configure`). Idempotent and a
|
|
4
|
+
* no-op until the host configures retention — see `mutations.pruneExpired`.
|
|
5
|
+
*/
|
|
6
|
+
declare const crons: import("convex/server").Crons;
|
|
7
|
+
export default crons;
|
|
8
|
+
//# sourceMappingURL=crons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crons.d.ts","sourceRoot":"","sources":["../../src/component/crons.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,QAAA,MAAM,KAAK,+BAAa,CAAC;AASzB,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { cronJobs } from "convex/server";
|
|
2
|
+
import { api } from "./_generated/api";
|
|
3
|
+
/**
|
|
4
|
+
* Component-internal retention sweep. Runs daily and prunes events older than
|
|
5
|
+
* the host-configured `retentionMs` (set via `configure`). Idempotent and a
|
|
6
|
+
* no-op until the host configures retention — see `mutations.pruneExpired`.
|
|
7
|
+
*/
|
|
8
|
+
const crons = cronJobs();
|
|
9
|
+
crons.daily("prune-expired-events", { hourUTC: 0, minuteUTC: 0 }, api.mutations.pruneExpired, {});
|
|
10
|
+
export default crons;
|
|
11
|
+
//# sourceMappingURL=crons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crons.js","sourceRoot":"","sources":["../../src/component/crons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC;;;;GAIG;AACH,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;AAEzB,KAAK,CAAC,KAAK,CACT,sBAAsB,EACtB,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,EAC5B,GAAG,CAAC,SAAS,CAAC,YAAY,EAC1B,EAAE,CACH,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const record: import("convex/server").RegisteredMutation<"public", {
|
|
2
|
+
actorRef?: string | undefined;
|
|
3
|
+
metadata?: any;
|
|
4
|
+
subjectRef: string;
|
|
5
|
+
type: string;
|
|
6
|
+
}, Promise<import("convex/values").GenericId<"events">>>;
|
|
7
|
+
/**
|
|
8
|
+
* Delete a batch of a subject's events, oldest-first, rescheduling itself until
|
|
9
|
+
* fewer than `batch` rows remain. Idempotent and at-least-once safe: a redelivery
|
|
10
|
+
* simply deletes the next (or zero) batch. Returns the count deleted this batch.
|
|
11
|
+
*/
|
|
12
|
+
export declare const purge: import("convex/server").RegisteredMutation<"public", {
|
|
13
|
+
before?: number | undefined;
|
|
14
|
+
batch?: number | undefined;
|
|
15
|
+
subjectRef: string;
|
|
16
|
+
}, Promise<number>>;
|
|
17
|
+
/** Set (or clear) the singleton retention window the daily cron prunes against. */
|
|
18
|
+
export declare const configure: import("convex/server").RegisteredMutation<"public", {
|
|
19
|
+
retentionMs?: number | undefined;
|
|
20
|
+
}, Promise<null>>;
|
|
21
|
+
/**
|
|
22
|
+
* Prune a batch of events older than the configured retention window across all
|
|
23
|
+
* subjects, rescheduling until short. The component's daily cron calls this; the
|
|
24
|
+
* host may also trigger a manual sweep. No config (or no `retentionMs`) ⇒ no-op.
|
|
25
|
+
* Idempotent and at-least-once safe: a redelivery prunes the next/zero batch.
|
|
26
|
+
*/
|
|
27
|
+
export declare const pruneExpired: import("convex/server").RegisteredMutation<"public", {
|
|
28
|
+
batch?: number | undefined;
|
|
29
|
+
}, Promise<number>>;
|
|
30
|
+
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM;;;;;wDAiBjB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,KAAK;;;;mBA6BhB,CAAC;AAEH,mFAAmF;AACnF,eAAO,MAAM,SAAS;;iBAYpB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;mBAuBvB,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { mutation } from "./_generated/server";
|
|
3
|
+
import { api } from "./_generated/api";
|
|
4
|
+
import { jsonValue } from "./validators";
|
|
5
|
+
/** Default number of rows deleted per `purge` / prune batch before rescheduling. */
|
|
6
|
+
const DEFAULT_PURGE_BATCH = 256;
|
|
7
|
+
export const record = mutation({
|
|
8
|
+
args: {
|
|
9
|
+
subjectRef: v.string(),
|
|
10
|
+
type: v.string(),
|
|
11
|
+
actorRef: v.optional(v.string()),
|
|
12
|
+
metadata: v.optional(jsonValue),
|
|
13
|
+
},
|
|
14
|
+
returns: v.id("events"),
|
|
15
|
+
handler: async (ctx, args) => {
|
|
16
|
+
return await ctx.db.insert("events", {
|
|
17
|
+
subjectRef: args.subjectRef,
|
|
18
|
+
type: args.type,
|
|
19
|
+
actorRef: args.actorRef,
|
|
20
|
+
metadata: args.metadata,
|
|
21
|
+
createdAt: Date.now(),
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Delete a batch of a subject's events, oldest-first, rescheduling itself until
|
|
27
|
+
* fewer than `batch` rows remain. Idempotent and at-least-once safe: a redelivery
|
|
28
|
+
* simply deletes the next (or zero) batch. Returns the count deleted this batch.
|
|
29
|
+
*/
|
|
30
|
+
export const purge = mutation({
|
|
31
|
+
args: {
|
|
32
|
+
subjectRef: v.string(),
|
|
33
|
+
before: v.optional(v.number()),
|
|
34
|
+
batch: v.optional(v.number()),
|
|
35
|
+
},
|
|
36
|
+
returns: v.number(),
|
|
37
|
+
handler: async (ctx, args) => {
|
|
38
|
+
const before = args.before;
|
|
39
|
+
const batch = args.batch ?? DEFAULT_PURGE_BATCH;
|
|
40
|
+
const rows = await ctx.db
|
|
41
|
+
.query("events")
|
|
42
|
+
.withIndex("by_subject", (q) => {
|
|
43
|
+
const scoped = q.eq("subjectRef", args.subjectRef);
|
|
44
|
+
return before === undefined ? scoped : scoped.lt("createdAt", before);
|
|
45
|
+
})
|
|
46
|
+
.take(batch);
|
|
47
|
+
for (const row of rows) {
|
|
48
|
+
await ctx.db.delete(row._id);
|
|
49
|
+
}
|
|
50
|
+
if (rows.length === batch) {
|
|
51
|
+
await ctx.scheduler.runAfter(0, api.mutations.purge, {
|
|
52
|
+
subjectRef: args.subjectRef,
|
|
53
|
+
before,
|
|
54
|
+
batch,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return rows.length;
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
/** Set (or clear) the singleton retention window the daily cron prunes against. */
|
|
61
|
+
export const configure = mutation({
|
|
62
|
+
args: { retentionMs: v.optional(v.number()) },
|
|
63
|
+
returns: v.null(),
|
|
64
|
+
handler: async (ctx, args) => {
|
|
65
|
+
const existing = await ctx.db.query("config").first();
|
|
66
|
+
if (existing === null) {
|
|
67
|
+
await ctx.db.insert("config", { retentionMs: args.retentionMs });
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
await ctx.db.patch(existing._id, { retentionMs: args.retentionMs });
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* Prune a batch of events older than the configured retention window across all
|
|
77
|
+
* subjects, rescheduling until short. The component's daily cron calls this; the
|
|
78
|
+
* host may also trigger a manual sweep. No config (or no `retentionMs`) ⇒ no-op.
|
|
79
|
+
* Idempotent and at-least-once safe: a redelivery prunes the next/zero batch.
|
|
80
|
+
*/
|
|
81
|
+
export const pruneExpired = mutation({
|
|
82
|
+
args: { batch: v.optional(v.number()) },
|
|
83
|
+
returns: v.number(),
|
|
84
|
+
handler: async (ctx, args) => {
|
|
85
|
+
const cfg = await ctx.db.query("config").first();
|
|
86
|
+
const retentionMs = cfg?.retentionMs;
|
|
87
|
+
if (retentionMs === undefined) {
|
|
88
|
+
return 0;
|
|
89
|
+
}
|
|
90
|
+
const batch = args.batch ?? DEFAULT_PURGE_BATCH;
|
|
91
|
+
const cutoff = Date.now() - retentionMs;
|
|
92
|
+
const rows = await ctx.db
|
|
93
|
+
.query("events")
|
|
94
|
+
.withIndex("by_createdAt", (q) => q.lt("createdAt", cutoff))
|
|
95
|
+
.take(batch);
|
|
96
|
+
for (const row of rows) {
|
|
97
|
+
await ctx.db.delete(row._id);
|
|
98
|
+
}
|
|
99
|
+
if (rows.length === batch) {
|
|
100
|
+
await ctx.scheduler.runAfter(0, api.mutations.pruneExpired, { batch });
|
|
101
|
+
}
|
|
102
|
+
return rows.length;
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL=mutations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,oFAAoF;AACpF,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC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MAAM,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YAC1B,MAAM,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACzE,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export declare const list: import("convex/server").RegisteredQuery<"public", {
|
|
2
|
+
type?: string | undefined;
|
|
3
|
+
since?: number | undefined;
|
|
4
|
+
subjectRef: string;
|
|
5
|
+
limit: number;
|
|
6
|
+
}, Promise<{
|
|
7
|
+
_id: import("convex/values").GenericId<"events">;
|
|
8
|
+
_creationTime: number;
|
|
9
|
+
actorRef?: string | undefined;
|
|
10
|
+
metadata?: any;
|
|
11
|
+
subjectRef: string;
|
|
12
|
+
type: string;
|
|
13
|
+
createdAt: number;
|
|
14
|
+
}[]>>;
|
|
15
|
+
/**
|
|
16
|
+
* Cursor-paginated feed, newest-first, honoring the same `type` / `since`
|
|
17
|
+
* filters as `list`. Returns Convex's `{ page, isDone, continueCursor }` so a
|
|
18
|
+
* host can page past any single-call `limit`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const listPaginated: import("convex/server").RegisteredQuery<"public", {
|
|
21
|
+
type?: string | undefined;
|
|
22
|
+
since?: number | undefined;
|
|
23
|
+
subjectRef: string;
|
|
24
|
+
paginationOpts: {
|
|
25
|
+
id?: number;
|
|
26
|
+
endCursor?: string | null;
|
|
27
|
+
maximumRowsRead?: number;
|
|
28
|
+
maximumBytesRead?: number;
|
|
29
|
+
numItems: number;
|
|
30
|
+
cursor: string | null;
|
|
31
|
+
};
|
|
32
|
+
}, Promise<import("convex/server").PaginationResult<{
|
|
33
|
+
_id: import("convex/values").GenericId<"events">;
|
|
34
|
+
_creationTime: number;
|
|
35
|
+
actorRef?: string | undefined;
|
|
36
|
+
metadata?: any;
|
|
37
|
+
subjectRef: string;
|
|
38
|
+
type: string;
|
|
39
|
+
createdAt: number;
|
|
40
|
+
}>>>;
|
|
41
|
+
/**
|
|
42
|
+
* Bounded count for `subjectRef` (optionally one `type`). Scans at most
|
|
43
|
+
* `maxCount + 1` rows: if more exist, returns `{ count: maxCount, isExact: false }`
|
|
44
|
+
* rather than loading the whole feed.
|
|
45
|
+
*/
|
|
46
|
+
export declare const count: import("convex/server").RegisteredQuery<"public", {
|
|
47
|
+
type?: string | undefined;
|
|
48
|
+
maxCount?: number | undefined;
|
|
49
|
+
subjectRef: string;
|
|
50
|
+
}, Promise<{
|
|
51
|
+
count: number;
|
|
52
|
+
isExact: boolean;
|
|
53
|
+
}>>;
|
|
54
|
+
//# sourceMappingURL=queries.d.ts.map
|