@vllnt/convex-suppression 0.1.0-canary.261f634

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 (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +138 -0
  3. package/dist/client/index.d.ts +135 -0
  4. package/dist/client/index.d.ts.map +1 -0
  5. package/dist/client/index.js +131 -0
  6. package/dist/client/index.js.map +1 -0
  7. package/dist/client/types.d.ts +70 -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 +38 -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 +67 -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/mutations.d.ts +49 -0
  32. package/dist/component/mutations.d.ts.map +1 -0
  33. package/dist/component/mutations.js +110 -0
  34. package/dist/component/mutations.js.map +1 -0
  35. package/dist/component/queries.d.ts +46 -0
  36. package/dist/component/queries.d.ts.map +1 -0
  37. package/dist/component/queries.js +112 -0
  38. package/dist/component/queries.js.map +1 -0
  39. package/dist/component/schema.d.ts +51 -0
  40. package/dist/component/schema.d.ts.map +1 -0
  41. package/dist/component/schema.js +39 -0
  42. package/dist/component/schema.js.map +1 -0
  43. package/dist/component/validators.d.ts +50 -0
  44. package/dist/component/validators.d.ts.map +1 -0
  45. package/dist/component/validators.js +40 -0
  46. package/dist/component/validators.js.map +1 -0
  47. package/dist/shared.d.ts +22 -0
  48. package/dist/shared.d.ts.map +1 -0
  49. package/dist/shared.js +26 -0
  50. package/dist/shared.js.map +1 -0
  51. package/package.json +101 -0
  52. package/src/client/index.ts +271 -0
  53. package/src/client/types.ts +82 -0
  54. package/src/component/_generated/api.ts +54 -0
  55. package/src/component/_generated/component.ts +102 -0
  56. package/src/component/_generated/dataModel.ts +60 -0
  57. package/src/component/_generated/server.ts +156 -0
  58. package/src/component/convex.config.ts +9 -0
  59. package/src/component/mutations.ts +118 -0
  60. package/src/component/queries.ts +128 -0
  61. package/src/component/schema.ts +40 -0
  62. package/src/component/validators.ts +49 -0
  63. package/src/shared.ts +31 -0
  64. package/src/test.ts +15 -0
@@ -0,0 +1,67 @@
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
+ suppress: FunctionReference<"mutation", "internal", {
24
+ channel: string;
25
+ contactHash: string;
26
+ reason: "unsubscribe" | "bounce" | "complaint" | "manual" | "global";
27
+ }, null, Name>;
28
+ unsuppress: FunctionReference<"mutation", "internal", {
29
+ channel: string;
30
+ contactHash: string;
31
+ }, boolean, Name>;
32
+ recordOptIn: FunctionReference<"mutation", "internal", {
33
+ contactHash: string;
34
+ listKey: string;
35
+ proof?: any;
36
+ source: string;
37
+ }, null, Name>;
38
+ };
39
+ queries: {
40
+ isSuppressed: FunctionReference<"query", "internal", {
41
+ channel: string;
42
+ contactHash: string;
43
+ }, null | {
44
+ channel: string | null;
45
+ contactHash: string;
46
+ createdAt: number;
47
+ reason: "unsubscribe" | "bounce" | "complaint" | "manual" | "global";
48
+ }, Name>;
49
+ getOptInProof: FunctionReference<"query", "internal", {
50
+ contactHash: string;
51
+ listKey: string;
52
+ }, null | {
53
+ confirmedAt: number;
54
+ contactHash: string;
55
+ listKey: string | null;
56
+ proof?: any;
57
+ source: string;
58
+ }, Name>;
59
+ isEligible: FunctionReference<"query", "internal", {
60
+ channel: string;
61
+ contactHash: string;
62
+ listKey: string;
63
+ requireOptIn: boolean;
64
+ }, boolean, Name>;
65
+ };
66
+ };
67
+ //# 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,QAAQ,EAAE,iBAAiB,CACzB,UAAU,EACV,UAAU,EACV;YACE,OAAO,EAAE,MAAM,CAAC;YAChB,WAAW,EAAE,MAAM,CAAC;YACpB,MAAM,EACF,aAAa,GACb,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,QAAQ,CAAC;SACd,EACD,IAAI,EACJ,IAAI,CACL,CAAC;QACF,UAAU,EAAE,iBAAiB,CAC3B,UAAU,EACV,UAAU,EACV;YAAE,OAAO,EAAE,MA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AAC"}
@@ -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,sDAAiC,CAAC;AAMjD,eAAe,SAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { defineComponent } from "convex/server";
2
+ const component = defineComponent("suppression");
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,aAAa,CAAC,CAAC;AAEjD,6CAA6C;AAC7C,mEAAmE;AACnE,0BAA0B;AAE1B,eAAe,SAAS,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Suppress a `(contactHash, channel)` — add it to the do-not-contact list. The
3
+ * host hashes and normalizes the contact itself and passes the opaque
4
+ * `contactHash`; the component never sees a raw email/phone, so the entry survives
5
+ * erasure of the underlying subject. `channel` is the host channel string
6
+ * (`"email"`/`"sms"`/`"push"`/…) the suppression applies to; omit it for a global
7
+ * (all-channel) suppression. `reason` is recorded for audit.
8
+ *
9
+ * Idempotent on `(contactHash, channel)`: re-suppressing an existing entry updates
10
+ * its `reason` and refreshes `createdAt` rather than inserting a duplicate, so a
11
+ * replayed bounce/complaint webhook can never fan the table out. `createdAt` is
12
+ * stamped from the server clock (`Date.now()` inside the handler — never
13
+ * caller-supplied).
14
+ */
15
+ export declare const suppress: import("convex/server").RegisteredMutation<"public", {
16
+ contactHash: string;
17
+ channel: string;
18
+ reason: "unsubscribe" | "bounce" | "complaint" | "manual" | "global";
19
+ }, Promise<null>>;
20
+ /**
21
+ * Remove a `(contactHash, channel)` from the do-not-contact list — a rare, audited
22
+ * re-subscribe. Removing a global suppression (`channel` = the sentinel) clears
23
+ * only the global row, not per-channel entries; removing a channel row clears only
24
+ * that channel. Returns `true` if an entry was removed, `false` if none matched (a
25
+ * no-op unsuppress of an address that was never suppressed is not an error).
26
+ */
27
+ export declare const unsuppress: import("convex/server").RegisteredMutation<"public", {
28
+ contactHash: string;
29
+ channel: string;
30
+ }, Promise<boolean>>;
31
+ /**
32
+ * Record an opt-in proof for a `(contactHash, listKey)` — the legal evidence that
33
+ * this contact confirmed receiving mail/messages for one list/purpose (a double
34
+ * opt-in, an explicit checkbox, an import with consent). `listKey` scopes the
35
+ * proof to one list or holds the global sentinel; `source` tags how it was
36
+ * captured; `proof` is opaque host evidence (IP, token ref, form snapshot) narrowed
37
+ * by the host's validator at the client boundary.
38
+ *
39
+ * Idempotent on `(contactHash, listKey)`: a second confirmation updates `source`,
40
+ * `proof`, and `confirmedAt` rather than inserting a duplicate. `confirmedAt` is
41
+ * server-sourced.
42
+ */
43
+ export declare const recordOptIn: import("convex/server").RegisteredMutation<"public", {
44
+ proof?: any;
45
+ contactHash: string;
46
+ listKey: string;
47
+ source: string;
48
+ }, Promise<null>>;
49
+ //# sourceMappingURL=mutations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ;;;;iBA2BnB,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;;;oBAgBrB,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW;;;;;iBAiCtB,CAAC"}
@@ -0,0 +1,110 @@
1
+ import { v } from "convex/values";
2
+ import { mutation } from "./_generated/server";
3
+ import { jsonValue, suppressionReason } from "./validators";
4
+ /**
5
+ * Suppress a `(contactHash, channel)` — add it to the do-not-contact list. The
6
+ * host hashes and normalizes the contact itself and passes the opaque
7
+ * `contactHash`; the component never sees a raw email/phone, so the entry survives
8
+ * erasure of the underlying subject. `channel` is the host channel string
9
+ * (`"email"`/`"sms"`/`"push"`/…) the suppression applies to; omit it for a global
10
+ * (all-channel) suppression. `reason` is recorded for audit.
11
+ *
12
+ * Idempotent on `(contactHash, channel)`: re-suppressing an existing entry updates
13
+ * its `reason` and refreshes `createdAt` rather than inserting a duplicate, so a
14
+ * replayed bounce/complaint webhook can never fan the table out. `createdAt` is
15
+ * stamped from the server clock (`Date.now()` inside the handler — never
16
+ * caller-supplied).
17
+ */
18
+ export const suppress = mutation({
19
+ args: {
20
+ contactHash: v.string(),
21
+ channel: v.string(),
22
+ reason: suppressionReason,
23
+ },
24
+ returns: v.null(),
25
+ handler: async (ctx, args) => {
26
+ const existing = await ctx.db
27
+ .query("suppressions")
28
+ .withIndex("by_hash_channel", (q) => q.eq("contactHash", args.contactHash).eq("channel", args.channel))
29
+ .unique();
30
+ const now = Date.now();
31
+ if (existing !== null) {
32
+ await ctx.db.patch(existing._id, { reason: args.reason, createdAt: now });
33
+ return null;
34
+ }
35
+ await ctx.db.insert("suppressions", {
36
+ contactHash: args.contactHash,
37
+ channel: args.channel,
38
+ reason: args.reason,
39
+ createdAt: now,
40
+ });
41
+ return null;
42
+ },
43
+ });
44
+ /**
45
+ * Remove a `(contactHash, channel)` from the do-not-contact list — a rare, audited
46
+ * re-subscribe. Removing a global suppression (`channel` = the sentinel) clears
47
+ * only the global row, not per-channel entries; removing a channel row clears only
48
+ * that channel. Returns `true` if an entry was removed, `false` if none matched (a
49
+ * no-op unsuppress of an address that was never suppressed is not an error).
50
+ */
51
+ export const unsuppress = mutation({
52
+ args: { contactHash: v.string(), channel: v.string() },
53
+ returns: v.boolean(),
54
+ handler: async (ctx, args) => {
55
+ const existing = await ctx.db
56
+ .query("suppressions")
57
+ .withIndex("by_hash_channel", (q) => q.eq("contactHash", args.contactHash).eq("channel", args.channel))
58
+ .unique();
59
+ if (existing === null) {
60
+ return false;
61
+ }
62
+ await ctx.db.delete(existing._id);
63
+ return true;
64
+ },
65
+ });
66
+ /**
67
+ * Record an opt-in proof for a `(contactHash, listKey)` — the legal evidence that
68
+ * this contact confirmed receiving mail/messages for one list/purpose (a double
69
+ * opt-in, an explicit checkbox, an import with consent). `listKey` scopes the
70
+ * proof to one list or holds the global sentinel; `source` tags how it was
71
+ * captured; `proof` is opaque host evidence (IP, token ref, form snapshot) narrowed
72
+ * by the host's validator at the client boundary.
73
+ *
74
+ * Idempotent on `(contactHash, listKey)`: a second confirmation updates `source`,
75
+ * `proof`, and `confirmedAt` rather than inserting a duplicate. `confirmedAt` is
76
+ * server-sourced.
77
+ */
78
+ export const recordOptIn = mutation({
79
+ args: {
80
+ contactHash: v.string(),
81
+ listKey: v.string(),
82
+ source: v.string(),
83
+ proof: v.optional(jsonValue),
84
+ },
85
+ returns: v.null(),
86
+ handler: async (ctx, args) => {
87
+ const existing = await ctx.db
88
+ .query("optInProofs")
89
+ .withIndex("by_hash_list", (q) => q.eq("contactHash", args.contactHash).eq("listKey", args.listKey))
90
+ .unique();
91
+ const now = Date.now();
92
+ if (existing !== null) {
93
+ await ctx.db.patch(existing._id, {
94
+ source: args.source,
95
+ proof: args.proof,
96
+ confirmedAt: now,
97
+ });
98
+ return null;
99
+ }
100
+ await ctx.db.insert("optInProofs", {
101
+ contactHash: args.contactHash,
102
+ listKey: args.listKey,
103
+ source: args.source,
104
+ proof: args.proof,
105
+ confirmedAt: now,
106
+ });
107
+ return null;
108
+ },
109
+ });
110
+ //# 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,SAAS,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE5D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC;IAC/B,IAAI,EAAE;QACJ,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;QACvB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,MAAM,EAAE,iBAAiB;KAC1B;IACD,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE;IACjB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC3B,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,EAAE;aAC1B,KAAK,CAAC,cAAc,CAAC;aACrB,SAAS,CAAC,iBAAiB,EAAE,CAAC,CAAC,EAAE,EAA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MAAM,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,GAAG;SACjB,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The matching suppression for `(contactHash, channel)`, or `null` if the contact
3
+ * is not suppressed on that channel. A `channel` argument matches a global
4
+ * (all-channel) suppression OR a channel-specific one — a global tombstone wins
5
+ * and is returned first. Omit `channel` (the sentinel) to check the global entry
6
+ * only. Two bounded equality reads on `by_hash_channel`; never spans contacts.
7
+ */
8
+ export declare const isSuppressed: import("convex/server").RegisteredQuery<"public", {
9
+ contactHash: string;
10
+ channel: string;
11
+ }, Promise<{
12
+ contactHash: string;
13
+ channel: string | null;
14
+ reason: "unsubscribe" | "bounce" | "complaint" | "manual" | "global";
15
+ createdAt: number;
16
+ } | null>>;
17
+ /**
18
+ * The opt-in proof for `(contactHash, listKey)`, or `null` if none is recorded.
19
+ * `listKey` holds the global sentinel to fetch a global opt-in. `proof` is the
20
+ * opaque host evidence, narrowed by the host validator at the client boundary.
21
+ */
22
+ export declare const getOptInProof: import("convex/server").RegisteredQuery<"public", {
23
+ contactHash: string;
24
+ listKey: string;
25
+ }, Promise<{
26
+ contactHash: string;
27
+ listKey: string | null;
28
+ source: string;
29
+ proof: any;
30
+ confirmedAt: number;
31
+ } | null>>;
32
+ /**
33
+ * The send gate: `true` when the contact may be contacted. A contact is eligible
34
+ * when it is NOT suppressed on `channel` (global or channel-specific) and — when
35
+ * `requireOptIn` is set — has a recorded opt-in proof for `listKey`. This is the
36
+ * single call a sender makes before every send: `¬suppressed [∧ confirmed]`.
37
+ * Suppression always blocks; the opt-in requirement is opt-in per call (marketing
38
+ * mail sets it; a transactional send may not).
39
+ */
40
+ export declare const isEligible: import("convex/server").RegisteredQuery<"public", {
41
+ contactHash: string;
42
+ channel: string;
43
+ listKey: string;
44
+ requireOptIn: boolean;
45
+ }, Promise<boolean>>;
46
+ //# sourceMappingURL=queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/component/queries.ts"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;;;;;;UAwBvB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;UAqBxB,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU;;;;;oBA0CrB,CAAC"}