@vllnt/convex-comments 0.1.0-canary.3e5064a

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.
Files changed (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +130 -0
  3. package/dist/client/index.d.ts +146 -0
  4. package/dist/client/index.d.ts.map +1 -0
  5. package/dist/client/index.js +133 -0
  6. package/dist/client/index.js.map +1 -0
  7. package/dist/client/types.d.ts +51 -0
  8. package/dist/client/types.d.ts.map +1 -0
  9. package/dist/client/types.js +3 -0
  10. package/dist/client/types.js.map +1 -0
  11. package/dist/component/_generated/api.d.ts +40 -0
  12. package/dist/component/_generated/api.d.ts.map +1 -0
  13. package/dist/component/_generated/api.js +31 -0
  14. package/dist/component/_generated/api.js.map +1 -0
  15. package/dist/component/_generated/component.d.ts +98 -0
  16. package/dist/component/_generated/component.d.ts.map +1 -0
  17. package/dist/component/_generated/component.js +11 -0
  18. package/dist/component/_generated/component.js.map +1 -0
  19. package/dist/component/_generated/dataModel.d.ts +46 -0
  20. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  21. package/dist/component/_generated/dataModel.js +11 -0
  22. package/dist/component/_generated/dataModel.js.map +1 -0
  23. package/dist/component/_generated/server.d.ts +121 -0
  24. package/dist/component/_generated/server.d.ts.map +1 -0
  25. package/dist/component/_generated/server.js +78 -0
  26. package/dist/component/_generated/server.js.map +1 -0
  27. package/dist/component/convex.config.d.ts +3 -0
  28. package/dist/component/convex.config.d.ts.map +1 -0
  29. package/dist/component/convex.config.js +7 -0
  30. package/dist/component/convex.config.js.map +1 -0
  31. package/dist/component/crons.d.ts +16 -0
  32. package/dist/component/crons.d.ts.map +1 -0
  33. package/dist/component/crons.js +19 -0
  34. package/dist/component/crons.js.map +1 -0
  35. package/dist/component/mutations.d.ts +81 -0
  36. package/dist/component/mutations.d.ts.map +1 -0
  37. package/dist/component/mutations.js +223 -0
  38. package/dist/component/mutations.js.map +1 -0
  39. package/dist/component/queries.d.ts +61 -0
  40. package/dist/component/queries.d.ts.map +1 -0
  41. package/dist/component/queries.js +82 -0
  42. package/dist/component/queries.js.map +1 -0
  43. package/dist/component/schema.d.ts +42 -0
  44. package/dist/component/schema.d.ts.map +1 -0
  45. package/dist/component/schema.js +34 -0
  46. package/dist/component/schema.js.map +1 -0
  47. package/dist/component/validators.d.ts +46 -0
  48. package/dist/component/validators.d.ts.map +1 -0
  49. package/dist/component/validators.js +37 -0
  50. package/dist/component/validators.js.map +1 -0
  51. package/dist/shared.d.ts +25 -0
  52. package/dist/shared.d.ts.map +1 -0
  53. package/dist/shared.js +26 -0
  54. package/dist/shared.js.map +1 -0
  55. package/package.json +98 -0
  56. package/src/client/index.ts +299 -0
  57. package/src/client/types.ts +55 -0
  58. package/src/component/_generated/api.ts +56 -0
  59. package/src/component/_generated/component.ts +129 -0
  60. package/src/component/_generated/dataModel.ts +60 -0
  61. package/src/component/_generated/server.ts +156 -0
  62. package/src/component/convex.config.ts +9 -0
  63. package/src/component/crons.ts +23 -0
  64. package/src/component/mutations.ts +234 -0
  65. package/src/component/queries.ts +96 -0
  66. package/src/component/schema.ts +34 -0
  67. package/src/component/validators.ts +44 -0
  68. package/src/shared.ts +33 -0
  69. package/src/test.ts +15 -0
@@ -0,0 +1,98 @@
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
+ post: FunctionReference<"mutation", "internal", {
24
+ authorRef: string;
25
+ body: any;
26
+ parentId?: string;
27
+ resourceRef: string;
28
+ }, {
29
+ commentId: string;
30
+ }, Name>;
31
+ edit: FunctionReference<"mutation", "internal", {
32
+ authorRef: string;
33
+ body: any;
34
+ commentId: string;
35
+ }, null, Name>;
36
+ remove: FunctionReference<"mutation", "internal", {
37
+ authorRef: string;
38
+ commentId: string;
39
+ }, null, Name>;
40
+ resolve: FunctionReference<"mutation", "internal", {
41
+ authorRef: string;
42
+ commentId: string;
43
+ resolved: boolean;
44
+ }, null, Name>;
45
+ prune: FunctionReference<"mutation", "internal", {
46
+ batch: number;
47
+ before?: number;
48
+ }, number, Name>;
49
+ };
50
+ queries: {
51
+ get: FunctionReference<"query", "internal", {
52
+ commentId: string;
53
+ }, null | {
54
+ authorRef: string;
55
+ body?: any;
56
+ commentId: string;
57
+ createdAt: number;
58
+ editedAt?: number;
59
+ parentId?: string;
60
+ resourceRef: string;
61
+ status: "open" | "resolved" | "deleted";
62
+ updatedAt: number;
63
+ }, Name>;
64
+ list: FunctionReference<"query", "internal", {
65
+ includeDeleted?: boolean;
66
+ paginationOpts: {
67
+ cursor: string | null;
68
+ endCursor?: string | null;
69
+ id?: number;
70
+ maximumBytesRead?: number;
71
+ maximumRowsRead?: number;
72
+ numItems: number;
73
+ };
74
+ parentId?: string;
75
+ resourceRef: string;
76
+ }, {
77
+ continueCursor: string;
78
+ isDone: boolean;
79
+ page: Array<{
80
+ authorRef: string;
81
+ body?: any;
82
+ commentId: string;
83
+ createdAt: number;
84
+ editedAt?: number;
85
+ parentId?: string;
86
+ resourceRef: string;
87
+ status: "open" | "resolved" | "deleted";
88
+ updatedAt: number;
89
+ }>;
90
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
91
+ splitCursor?: string | null;
92
+ }, Name>;
93
+ count: FunctionReference<"query", "internal", {
94
+ resourceRef: string;
95
+ }, number, Name>;
96
+ };
97
+ };
98
+ //# sourceMappingURL=component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated `ComponentApi` utility.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=component.js.map
@@ -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,11 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated data model types.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=dataModel.js.map
@@ -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,3 @@
1
+ declare const component: import("convex/server").ComponentDefinition<any, {}>;
2
+ export default component;
3
+ //# 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,QAAA,MAAM,SAAS,sDAA8B,CAAC;AAM9C,eAAe,SAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { defineComponent } from "convex/server";
2
+ const component = defineComponent("comments");
3
+ // Nest official child components here, e.g.:
4
+ // import aggregate from "@convex-dev/aggregate/convex.config";
5
+ // component.use(aggregate);
6
+ export default component;
7
+ //# 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,MAAM,SAAS,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;AAE9C,6CAA6C;AAC7C,+DAA+D;AAC/D,4BAA4B;AAE5B,eAAe,SAAS,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Default sweep cadence and page size for the built-in prune cron. The cron is
3
+ * the component's own self-healing safety net — a host that wants a different
4
+ * cadence drives `prune` from its own scheduler instead (the client exposes it).
5
+ * Convex cron definitions are static per deployment, so cadence is a documented
6
+ * module constant rather than a mount-time option; the page size bounds each
7
+ * sweep and `prune` self-reschedules until the soft-deleted tail is clean.
8
+ */
9
+ export declare const PRUNE_INTERVAL: {
10
+ readonly hours: 24;
11
+ };
12
+ /** Rows deleted per `prune` pass before the sweep self-reschedules. */
13
+ export declare const PRUNE_BATCH = 200;
14
+ declare const crons: import("convex/server").Crons;
15
+ export default crons;
16
+ //# sourceMappingURL=crons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crons.d.ts","sourceRoot":"","sources":["../../src/component/crons.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;CAAyB,CAAC;AAErD,uEAAuE;AACvE,eAAO,MAAM,WAAW,MAAM,CAAC;AAE/B,QAAA,MAAM,KAAK,+BAAa,CAAC;AAMzB,eAAe,KAAK,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { cronJobs } from "convex/server";
2
+ import { api } from "./_generated/api";
3
+ /**
4
+ * Default sweep cadence and page size for the built-in prune cron. The cron is
5
+ * the component's own self-healing safety net — a host that wants a different
6
+ * cadence drives `prune` from its own scheduler instead (the client exposes it).
7
+ * Convex cron definitions are static per deployment, so cadence is a documented
8
+ * module constant rather than a mount-time option; the page size bounds each
9
+ * sweep and `prune` self-reschedules until the soft-deleted tail is clean.
10
+ */
11
+ export const PRUNE_INTERVAL = { hours: 24 };
12
+ /** Rows deleted per `prune` pass before the sweep self-reschedules. */
13
+ export const PRUNE_BATCH = 200;
14
+ const crons = cronJobs();
15
+ crons.interval("comments:prune", PRUNE_INTERVAL, api.mutations.prune, {
16
+ batch: PRUNE_BATCH,
17
+ });
18
+ export default crons;
19
+ //# 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;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,KAAK,EAAE,EAAE,EAAW,CAAC;AAErD,uEAAuE;AACvE,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAE/B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;AAEzB,KAAK,CAAC,QAAQ,CAAC,gBAAgB,EAAE,cAAc,EAAE,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE;IACpE,KAAK,EAAE,WAAW;CACnB,CAAC,CAAC;AAEH,eAAe,KAAK,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Post a comment on a resource and return its id. The comment is inserted `open`
3
+ * with `createdAt`/`updatedAt` stamped from the server clock (`Date.now()` inside
4
+ * the handler — never caller-supplied). `resourceRef` (the thing commented on) and
5
+ * `authorRef` (who wrote it) are opaque host refs the component never inspects;
6
+ * `body` is opaque host data narrowed by the host's `bodyValidator` at the client
7
+ * boundary. `parentId`, when given, threads this comment as a reply to an existing
8
+ * comment.
9
+ *
10
+ * @throws `ConvexError({ code: "PARENT_NOT_FOUND" })` when `parentId` names no
11
+ * comment.
12
+ * @throws `ConvexError({ code: "PARENT_MISMATCH" })` when the parent belongs to a
13
+ * different resource — a reply must live on the same resource as its parent.
14
+ * @throws `ConvexError({ code: "PARENT_DELETED" })` when the parent is soft-deleted
15
+ * — you cannot reply under a removed comment.
16
+ */
17
+ export declare const post: import("convex/server").RegisteredMutation<"public", {
18
+ parentId?: import("convex/values").GenericId<"comments"> | undefined;
19
+ resourceRef: string;
20
+ authorRef: string;
21
+ body: any;
22
+ }, Promise<{
23
+ commentId: import("convex/values").GenericId<"comments">;
24
+ }>>;
25
+ /**
26
+ * Edit a comment's body. Only the original author may edit — a non-author caller
27
+ * is rejected (`NOT_AUTHOR`). A soft-deleted comment cannot be edited
28
+ * (`DELETED`). Records `editedAt` (and `updatedAt`) from the server clock; the
29
+ * new `body` is opaque host data narrowed at the client boundary.
30
+ *
31
+ * @throws `ConvexError({ code: "NOT_FOUND" })` when no comment has `commentId`.
32
+ * @throws `ConvexError({ code: "NOT_AUTHOR" })` when `authorRef` is not the author.
33
+ * @throws `ConvexError({ code: "DELETED" })` when the comment is soft-deleted.
34
+ */
35
+ export declare const edit: import("convex/server").RegisteredMutation<"public", {
36
+ authorRef: string;
37
+ body: any;
38
+ commentId: import("convex/values").GenericId<"comments">;
39
+ }, Promise<null>>;
40
+ /**
41
+ * Soft-delete a comment. Only the original author may delete it (`NOT_AUTHOR`).
42
+ * The row is kept (its replies are preserved) but moved to `deleted` status with
43
+ * its `body` cleared, so the prune cron can sweep it after the retention window.
44
+ * Idempotent — re-deleting an already-deleted comment is a no-op.
45
+ *
46
+ * @throws `ConvexError({ code: "NOT_FOUND" })` when no comment has `commentId`.
47
+ * @throws `ConvexError({ code: "NOT_AUTHOR" })` when `authorRef` is not the author.
48
+ */
49
+ export declare const remove: import("convex/server").RegisteredMutation<"public", {
50
+ authorRef: string;
51
+ commentId: import("convex/values").GenericId<"comments">;
52
+ }, Promise<null>>;
53
+ /**
54
+ * Toggle a comment's resolved state. Only the original author may resolve/reopen
55
+ * (`NOT_AUTHOR`); a soft-deleted comment cannot be resolved (`DELETED`). Setting
56
+ * `resolved: true` moves an `open` comment to `resolved`; `false` reopens it. The
57
+ * target is idempotent — setting the state it already holds is a no-op.
58
+ *
59
+ * @throws `ConvexError({ code: "NOT_FOUND" })` when no comment has `commentId`.
60
+ * @throws `ConvexError({ code: "NOT_AUTHOR" })` when `authorRef` is not the author.
61
+ * @throws `ConvexError({ code: "DELETED" })` when the comment is soft-deleted.
62
+ */
63
+ export declare const resolve: import("convex/server").RegisteredMutation<"public", {
64
+ resolved: boolean;
65
+ authorRef: string;
66
+ commentId: import("convex/values").GenericId<"comments">;
67
+ }, Promise<null>>;
68
+ /**
69
+ * Delete up to `batch` soft-deleted comments whose `updatedAt < before`, oldest
70
+ * first, via the `by_status_updated` index. `before` defaults to the server clock
71
+ * (`Date.now()`) when omitted, so the built-in cron sweeps exactly the comments
72
+ * deleted-and-stale as of the run. If a full batch was removed there may be more,
73
+ * so the sweep self-reschedules through `ctx.scheduler` until a short batch
74
+ * signals the tail is clean. Idempotent: only ever removes already-`deleted`,
75
+ * past-retention rows. Open and resolved comments are never pruned.
76
+ */
77
+ export declare const prune: import("convex/server").RegisteredMutation<"public", {
78
+ before?: number | undefined;
79
+ batch: number;
80
+ }, Promise<number>>;
81
+ //# sourceMappingURL=mutations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,IAAI;;;;;;;GA2Cf,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,IAAI;;;;iBAoCf,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM;;;iBA2BjB,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO;;;;iBAkClB,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,KAAK;;;mBA0BhB,CAAC"}