@vllnt/convex-consent 0.1.0-canary.600dfc5

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 +143 -0
  3. package/dist/client/index.d.ts +156 -0
  4. package/dist/client/index.d.ts.map +1 -0
  5. package/dist/client/index.js +142 -0
  6. package/dist/client/index.js.map +1 -0
  7. package/dist/client/types.d.ts +79 -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 +102 -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 +133 -0
  24. package/dist/component/_generated/server.d.ts.map +1 -0
  25. package/dist/component/_generated/server.js +80 -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 +60 -0
  36. package/dist/component/mutations.d.ts.map +1 -0
  37. package/dist/component/mutations.js +142 -0
  38. package/dist/component/mutations.js.map +1 -0
  39. package/dist/component/queries.d.ts +78 -0
  40. package/dist/component/queries.d.ts.map +1 -0
  41. package/dist/component/queries.js +119 -0
  42. package/dist/component/queries.js.map +1 -0
  43. package/dist/component/schema.d.ts +53 -0
  44. package/dist/component/schema.d.ts.map +1 -0
  45. package/dist/component/schema.js +40 -0
  46. package/dist/component/schema.js.map +1 -0
  47. package/dist/component/validators.d.ts +80 -0
  48. package/dist/component/validators.d.ts.map +1 -0
  49. package/dist/component/validators.js +62 -0
  50. package/dist/component/validators.js.map +1 -0
  51. package/dist/shared.d.ts +30 -0
  52. package/dist/shared.d.ts.map +1 -0
  53. package/dist/shared.js +28 -0
  54. package/dist/shared.js.map +1 -0
  55. package/package.json +99 -0
  56. package/src/client/index.ts +298 -0
  57. package/src/client/types.ts +85 -0
  58. package/src/component/_generated/api.ts +56 -0
  59. package/src/component/_generated/component.ts +127 -0
  60. package/src/component/_generated/dataModel.ts +60 -0
  61. package/src/component/_generated/server.ts +169 -0
  62. package/src/component/convex.config.ts +9 -0
  63. package/src/component/crons.ts +23 -0
  64. package/src/component/mutations.ts +151 -0
  65. package/src/component/queries.ts +142 -0
  66. package/src/component/schema.ts +41 -0
  67. package/src/component/validators.ts +70 -0
  68. package/src/shared.ts +35 -0
  69. package/src/test.ts +15 -0
@@ -0,0 +1,102 @@
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
+ prune: FunctionReference<"mutation", "internal", {
24
+ batch: number;
25
+ before?: number;
26
+ }, number, Name>;
27
+ record: FunctionReference<"mutation", "internal", {
28
+ decision: "granted" | "denied" | "withdrawn";
29
+ proof?: any;
30
+ purpose: string;
31
+ subjectRef: string;
32
+ version: string;
33
+ }, {
34
+ at: number;
35
+ }, Name>;
36
+ withdraw: FunctionReference<"mutation", "internal", {
37
+ proof?: any;
38
+ purpose: string;
39
+ subjectRef: string;
40
+ }, {
41
+ at: number;
42
+ }, Name>;
43
+ };
44
+ queries: {
45
+ check: FunctionReference<"query", "internal", {
46
+ purpose: string;
47
+ requiredVersion?: string;
48
+ subjectRef: string;
49
+ }, {
50
+ at: number | null;
51
+ decision: "granted" | "denied" | "withdrawn" | null;
52
+ granted: boolean;
53
+ stale: boolean;
54
+ version: string | null;
55
+ }, Name>;
56
+ getState: FunctionReference<"query", "internal", {
57
+ purpose: string;
58
+ subjectRef: string;
59
+ }, null | {
60
+ at: number;
61
+ decision: "granted" | "denied" | "withdrawn";
62
+ purpose: string;
63
+ subjectRef: string;
64
+ version: string;
65
+ }, Name>;
66
+ getStatesForSubject: FunctionReference<"query", "internal", {
67
+ subjectRef: string;
68
+ }, Array<{
69
+ at: number;
70
+ decision: "granted" | "denied" | "withdrawn";
71
+ purpose: string;
72
+ subjectRef: string;
73
+ version: string;
74
+ }>, Name>;
75
+ history: FunctionReference<"query", "internal", {
76
+ paginationOpts: {
77
+ cursor: string | null;
78
+ endCursor?: string | null;
79
+ id?: number;
80
+ maximumBytesRead?: number;
81
+ maximumRowsRead?: number;
82
+ numItems: number;
83
+ };
84
+ purpose: string;
85
+ subjectRef: string;
86
+ }, {
87
+ continueCursor: string;
88
+ isDone: boolean;
89
+ page: Array<{
90
+ at: number;
91
+ decision: "granted" | "denied" | "withdrawn";
92
+ proof?: any;
93
+ purpose: string;
94
+ subjectRef: string;
95
+ version: string;
96
+ }>;
97
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
98
+ splitCursor?: string | null;
99
+ }, Name>;
100
+ };
101
+ };
102
+ //# 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,KAAK,EAAE,iBAAiB,CACtB,UAAU,EACV,UAAU,EACV;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,EAClC,MAAM,EACN,IAAI,CACL,CAAC;QACF,MAAM,EAAE,iBAAiB,CACvB,UAAU,EACV,UAAU,EACV;YACE,QAAQ,EAAE,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;YAC7C,KAAK,CAAC,EAAE,GAAG,CAAC;YACZ,OAAO,EAAE,MAAM,CAAC;YAChB,UAAU,EAAE,MAAM,CAAC;YACnB,OAAO,EAAE,MAAM,CAAC;SACjB,EACD;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,EACd,IAAI,CACL,CAAC;QACF,QAAQ,EAAE,iBAAiB,CACzB,UAAU,EACV,UAAU,EACV;YAAE,KAAK,CAAC,EAAE,GAAG,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,EACpD;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,EACd,IAAI,CACL,CAAC;KACH,CAAC;IACF,OAAO,EAAE;QACP,KAAK,EAAE,iBAAiB,CACtB,OAAO,EACP,UAAU,EACV;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,eAAe,CAAC,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,EACjE;YACE,EAAE,EAAE,MAAM,G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,UAAU,EAAE,MAAM,CAAC;SACpB,EACD;YACE,cAAc,EAAE,MAAM,CAAC;YACvB,MAAM,EAAE,OAAO,CAAC;YAChB,IAAI,EAAE,KAAK,CAAC;gBACV,EAAE,EAAE,MAAM,CAAC;gBACX,QAAQ,EAAE,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;gBAC7C,KAAK,CAAC,EAAE,GAAG,CAAC;gBACZ,OAAO,EAAE,MAAM,CAAC;gBAChB,UAAU,EAAE,MAAM,CAAC;gBACnB,OAAO,EAAE,MAAM,CAAC;aACjB,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,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,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;;;;;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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,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,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,sDAA6B,CAAC;eAM9B,SAAS"}
@@ -0,0 +1,7 @@
1
+ import { defineComponent } from "convex/server";
2
+ const component = defineComponent("consent");
3
+ // Nest official child components here, e.g.:
4
+ // import sharded from "@convex-dev/sharded-counter/convex.config";
5
+ // component.use(sharded);
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,SAAS,CAAC,CAAC;AAE7C,6CAA6C;AAC7C,mEAAmE;AACnE,0BAA0B;AAE1B,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 stale-event 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;aAAK,KAAK,EAAE,EAAE;CAAW,CAAC;AAErD,uEAAuE;AACvE,eAAO,MAAM,WAAW,MAAM,CAAC;AAE/B,QAAA,MAAM,KAAK,+BAAa,CAAC;eAMV,KAAK"}
@@ -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 stale-event 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("consent: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,eAAe,EAAE,cAAc,EAAE,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE;IACnE,KAAK,EAAE,WAAW;CACnB,CAAC,CAAC;AAEH,eAAe,KAAK,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Record a consent decision for a `(subjectRef, purpose)` pair. Appends one
3
+ * immutable row to the `consentEvents` ledger — the GDPR proof — and overwrites
4
+ * the `consentState` projection so the next {@link check}/{@link getState} reads
5
+ * the new decision. `at` is stamped from the server clock (`Date.now()` inside
6
+ * the handler — never caller-supplied), so the ledger order cannot be skewed by a
7
+ * client clock.
8
+ *
9
+ * `subjectRef` and `purpose` are opaque host strings; `version` is the policy
10
+ * version the subject consented to (defaults to the host's `defaultVersion` at
11
+ * the client boundary); `proof` is opaque host evidence stored verbatim. The
12
+ * ledger row is the legal record — it is never mutated, only swept by retention
13
+ * `prune`.
14
+ */
15
+ export declare const record: import("convex/server").RegisteredMutation<"public", {
16
+ decision: "denied" | "granted" | "withdrawn";
17
+ proof?: any;
18
+ purpose: string;
19
+ subjectRef: string;
20
+ version: string;
21
+ }, Promise<{
22
+ at: number;
23
+ }>>;
24
+ /**
25
+ * Withdraw a previously-granted consent — the GDPR Art. 7(3) "as easy to withdraw
26
+ * as to give" path. Appends a `withdrawn` event and projects it, but ONLY when the
27
+ * subject currently holds a `granted` decision for the purpose; withdrawing
28
+ * something never granted is a no-op error rather than a silent ledger entry, so
29
+ * the audit trail stays meaningful.
30
+ *
31
+ * @throws `ConvexError({ code: "NO_CONSENT" })` when no consent was ever recorded
32
+ * for the pair.
33
+ * @throws `ConvexError({ code: "NOT_GRANTED" })` when the current decision is not
34
+ * `granted` (already `denied`/`withdrawn`) — there is nothing to withdraw.
35
+ */
36
+ export declare const withdraw: import("convex/server").RegisteredMutation<"public", {
37
+ proof?: any;
38
+ purpose: string;
39
+ subjectRef: string;
40
+ }, Promise<{
41
+ at: number;
42
+ }>>;
43
+ /**
44
+ * Delete up to `batch` superseded ledger events whose `at < before`, oldest first
45
+ * via the `by_at` index, and return the count removed in the first pass. `before`
46
+ * defaults to the server clock (`Date.now()`) when omitted, so the built-in cron
47
+ * sweeps exactly the events stale as of the run. If a full batch was removed there
48
+ * may be more, so the sweep self-reschedules through `ctx.scheduler` until a short
49
+ * batch signals the tail is clean.
50
+ *
51
+ * Only the historical `consentEvents` ledger is pruned — the `consentState`
52
+ * projection is the live gate and is never swept, so a host that prunes old proof
53
+ * still gets the correct current decision. Idempotent: only ever removes
54
+ * already-past-retention rows.
55
+ */
56
+ export declare const prune: import("convex/server").RegisteredMutation<"public", {
57
+ batch: number;
58
+ before?: number | undefined;
59
+ }, Promise<number>>;
60
+ //# sourceMappingURL=mutations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM;;;;;;;;GAwCjB,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ;;;;;;GAuCnB,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK;;;mBAuBhB,CAAC"}