@convex-dev/workos-authkit 0.1.1

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 (60) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +288 -0
  3. package/dist/client/_generated/_ignore.d.ts +1 -0
  4. package/dist/client/_generated/_ignore.d.ts.map +1 -0
  5. package/dist/client/_generated/_ignore.js +3 -0
  6. package/dist/client/_generated/_ignore.js.map +1 -0
  7. package/dist/client/index.d.ts +83 -0
  8. package/dist/client/index.d.ts.map +1 -0
  9. package/dist/client/index.js +177 -0
  10. package/dist/client/index.js.map +1 -0
  11. package/dist/client/types.d.ts +27 -0
  12. package/dist/client/types.d.ts.map +1 -0
  13. package/dist/client/types.js +2 -0
  14. package/dist/client/types.js.map +1 -0
  15. package/dist/component/_generated/api.d.ts +112 -0
  16. package/dist/component/_generated/api.d.ts.map +1 -0
  17. package/dist/component/_generated/api.js +31 -0
  18. package/dist/component/_generated/api.js.map +1 -0
  19. package/dist/component/_generated/component.d.ts +50 -0
  20. package/dist/component/_generated/component.d.ts.map +1 -0
  21. package/dist/component/_generated/component.js +11 -0
  22. package/dist/component/_generated/component.js.map +1 -0
  23. package/dist/component/_generated/dataModel.d.ts +46 -0
  24. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  25. package/dist/component/_generated/dataModel.js +11 -0
  26. package/dist/component/_generated/dataModel.js.map +1 -0
  27. package/dist/component/_generated/server.d.ts +121 -0
  28. package/dist/component/_generated/server.d.ts.map +1 -0
  29. package/dist/component/_generated/server.js +78 -0
  30. package/dist/component/_generated/server.js.map +1 -0
  31. package/dist/component/convex.config.d.ts +3 -0
  32. package/dist/component/convex.config.d.ts.map +1 -0
  33. package/dist/component/convex.config.js +6 -0
  34. package/dist/component/convex.config.js.map +1 -0
  35. package/dist/component/lib.d.ts +43 -0
  36. package/dist/component/lib.d.ts.map +1 -0
  37. package/dist/component/lib.js +177 -0
  38. package/dist/component/lib.js.map +1 -0
  39. package/dist/component/schema.d.ts +44 -0
  40. package/dist/component/schema.d.ts.map +1 -0
  41. package/dist/component/schema.js +24 -0
  42. package/dist/component/schema.js.map +1 -0
  43. package/dist/react/index.d.ts +2 -0
  44. package/dist/react/index.d.ts.map +1 -0
  45. package/dist/react/index.js +6 -0
  46. package/dist/react/index.js.map +1 -0
  47. package/package.json +108 -0
  48. package/src/client/_generated/_ignore.ts +1 -0
  49. package/src/client/index.ts +278 -0
  50. package/src/client/types.ts +71 -0
  51. package/src/component/_generated/api.ts +138 -0
  52. package/src/component/_generated/component.ts +63 -0
  53. package/src/component/_generated/dataModel.ts +60 -0
  54. package/src/component/_generated/server.ts +161 -0
  55. package/src/component/convex.config.ts +8 -0
  56. package/src/component/lib.ts +189 -0
  57. package/src/component/schema.ts +24 -0
  58. package/src/component/setup.test.ts +5 -0
  59. package/src/react/index.ts +7 -0
  60. package/src/test.ts +17 -0
@@ -0,0 +1,177 @@
1
+ import { createFunctionHandle, httpActionGeneric, internalMutationGeneric, } from "convex/server";
2
+ import { WorkOS, } from "@workos-inc/node";
3
+ import { v } from "convex/values";
4
+ export class AuthKit {
5
+ component;
6
+ options;
7
+ workos;
8
+ config;
9
+ constructor(component, options) {
10
+ this.component = component;
11
+ this.options = options;
12
+ const clientId = options?.clientId ?? process.env.WORKOS_CLIENT_ID;
13
+ const apiKey = options?.apiKey ?? process.env.WORKOS_API_KEY;
14
+ const webhookSecret = options?.webhookSecret ?? process.env.WORKOS_WEBHOOK_SECRET;
15
+ const actionSecret = options?.actionSecret ?? process.env.WORKOS_ACTION_SECRET;
16
+ const missingEnvVars = [];
17
+ if (!clientId) {
18
+ missingEnvVars.push("WORKOS_CLIENT_ID");
19
+ }
20
+ if (!apiKey) {
21
+ missingEnvVars.push("WORKOS_API_KEY");
22
+ }
23
+ if (!webhookSecret) {
24
+ missingEnvVars.push("WORKOS_WEBHOOK_SECRET");
25
+ }
26
+ if (!actionSecret) {
27
+ missingEnvVars.push("WORKOS_ACTION_SECRET");
28
+ }
29
+ if (!clientId || !apiKey || !webhookSecret || !actionSecret) {
30
+ throw new Error(`Missing environment variables: ${missingEnvVars.join(", ")}`);
31
+ }
32
+ this.config = {
33
+ ...options,
34
+ clientId,
35
+ apiKey,
36
+ webhookSecret,
37
+ actionSecret,
38
+ webhookPath: options?.webhookPath ?? "/workos/webhook",
39
+ };
40
+ this.workos = new WorkOS(this.config.apiKey);
41
+ }
42
+ getAuthConfigProviders = () => [
43
+ {
44
+ type: "customJwt",
45
+ issuer: `https://api.workos.com/`,
46
+ algorithm: "RS256",
47
+ jwks: `https://api.workos.com/sso/jwks/${this.config.clientId}`,
48
+ applicationID: this.config.clientId,
49
+ },
50
+ {
51
+ type: "customJwt",
52
+ issuer: `https://api.workos.com/user_management/${this.config.clientId}`,
53
+ algorithm: "RS256",
54
+ jwks: `https://api.workos.com/sso/jwks/${this.config.clientId}`,
55
+ },
56
+ ];
57
+ async getAuthUser(ctx) {
58
+ const identity = await ctx.auth.getUserIdentity();
59
+ if (!identity) {
60
+ return null;
61
+ }
62
+ return ctx.runQuery(this.component.lib.getAuthUser, {
63
+ id: identity.subject,
64
+ });
65
+ }
66
+ events(opts) {
67
+ return {
68
+ authKitEvent: internalMutationGeneric({
69
+ args: {
70
+ event: v.string(),
71
+ data: v.record(v.string(), v.any()),
72
+ },
73
+ returns: v.null(),
74
+ handler: async (ctx, args) => {
75
+ await opts[args.event](ctx, args);
76
+ },
77
+ }),
78
+ };
79
+ }
80
+ actions(opts) {
81
+ return {
82
+ authKitAction: internalMutationGeneric({
83
+ args: {
84
+ action: v.record(v.string(), v.any()),
85
+ },
86
+ returns: v.record(v.string(), v.any()),
87
+ handler: async (ctx, args) => {
88
+ const resp = {
89
+ type: args.action.object === "authentication_action_context"
90
+ ? "authentication"
91
+ : "user_registration",
92
+ timestamp: new Date().getTime(),
93
+ };
94
+ const allow = () => ({ ...resp, verdict: "Allow" });
95
+ const deny = (errorMessage) => ({
96
+ ...resp,
97
+ verdict: "Deny",
98
+ errorMessage,
99
+ });
100
+ const responsePayload = await opts[(args.action.object === "authentication_action_context"
101
+ ? "authentication"
102
+ : "userRegistration")](ctx, args.action, {
103
+ allow,
104
+ deny,
105
+ });
106
+ return responsePayload;
107
+ },
108
+ }),
109
+ };
110
+ }
111
+ registerRoutes(http) {
112
+ http.route({
113
+ path: "/workos/webhook",
114
+ method: "POST",
115
+ handler: httpActionGeneric(async (ctx, request) => {
116
+ const payload = await request.text();
117
+ const sigHeader = request.headers.get("workos-signature");
118
+ if (!sigHeader) {
119
+ throw new Error("No signature header");
120
+ }
121
+ const secret = this.config.webhookSecret;
122
+ if (!secret) {
123
+ throw new Error("webhook secret is not set");
124
+ }
125
+ const event = await this.workos.webhooks.constructEvent({
126
+ payload: JSON.parse(payload),
127
+ sigHeader: sigHeader,
128
+ secret,
129
+ });
130
+ if (this.config.logLevel === "DEBUG") {
131
+ console.log("received event", event);
132
+ }
133
+ await ctx.runMutation(this.component.lib.enqueueWebhookEvent, {
134
+ apiKey: this.config.apiKey,
135
+ eventId: event.id,
136
+ event: event.event,
137
+ onEventHandle: this.config.authFunctions?.authKitEvent
138
+ ? await createFunctionHandle(this.config.authFunctions.authKitEvent)
139
+ : undefined,
140
+ updatedAt: "updated_at" in event ? event.updated_at : undefined,
141
+ eventTypes: this.config.additionalEventTypes,
142
+ logLevel: this.config.logLevel,
143
+ });
144
+ return new Response("OK", { status: 200 });
145
+ }),
146
+ });
147
+ http.route({
148
+ path: "/workos/action",
149
+ method: "POST",
150
+ handler: httpActionGeneric(async (ctx, request) => {
151
+ const payload = await request.text();
152
+ const sigHeader = request.headers.get("workos-signature");
153
+ if (!sigHeader) {
154
+ throw new Error("No signature header");
155
+ }
156
+ const secret = this.config.actionSecret;
157
+ if (!secret) {
158
+ throw new Error("webhook secret is not set");
159
+ }
160
+ const action = await this.workos.actions.constructAction({
161
+ payload: JSON.parse(payload),
162
+ sigHeader: sigHeader,
163
+ secret,
164
+ });
165
+ if (this.config.logLevel === "DEBUG") {
166
+ console.log("received action", action);
167
+ }
168
+ const responsePayload = await ctx.runMutation(this.config.authFunctions.authKitAction, {
169
+ action,
170
+ });
171
+ const response = await this.workos.actions.signResponse(responsePayload, this.config.actionSecret);
172
+ return new Response(JSON.stringify(response), { status: 200 });
173
+ }),
174
+ });
175
+ }
176
+ }
177
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,MAAM,GAKP,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAqClC,MAAM,OAAO,OAAO;IAIT;IACA;IAJF,MAAM,CAAS;IACd,MAAM,CAAS;IACvB,YACS,SAAuB,EACvB,OAAgB;QADhB,cAAS,GAAT,SAAS,CAAc;QACvB,YAAO,GAAP,OAAO,CAAS;QAEvB,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;QACnE,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;QAC7D,MAAM,aAAa,GACjB,OAAO,EAAE,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;QAC9D,MAAM,YAAY,GAChB,OAAO,EAAE,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;QAC5D,MAAM,cAAc,GAAa,EAAE,CAAC;QACpC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,cAAc,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,cAAc,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACxC,CAAC;Q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OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;gBAC1D,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;gBACzC,CAAC;gBACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;gBACxC,IAAI,CAAC,MAAM,EAAE,CAAC;oBACZ,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;gBAC/C,CAAC;gBACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC;oBACvD,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;oBAC5B,SAAS,EAAE,SAAS;oBACpB,MAAM;iBACP,CAAC,CAAC;gBACH,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;oBACrC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;gBACzC,CAAC;gBACD,MAAM,eAAe,GAA0B,MAAM,GAAG,CAAC,WAAW,CAClE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,EACvC;oBACE,MAAM;iBACP,CACF,CAAC;gBACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CACrD,eAAe,EACf,IAAI,CAAC,MAAM,CAAC,YAAY,CACzB,CAAC;gBACF,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YACjE,CAAC,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,27 @@
1
+ import type { Auth, Expand, FunctionArgs, FunctionReference, FunctionReturnType, StorageActionWriter, StorageReader } from "convex/server";
2
+ import type { GenericId } from "convex/values";
3
+ export type RunQueryCtx = {
4
+ auth: Auth;
5
+ runQuery: <Query extends FunctionReference<"query", "internal">>(query: Query, args: FunctionArgs<Query>) => Promise<FunctionReturnType<Query>>;
6
+ };
7
+ export type RunMutationCtx = RunQueryCtx & {
8
+ auth: Auth;
9
+ runMutation: <Mutation extends FunctionReference<"mutation", "internal">>(mutation: Mutation, args: FunctionArgs<Mutation>) => Promise<FunctionReturnType<Mutation>>;
10
+ };
11
+ export type RunActionCtx = RunMutationCtx & {
12
+ auth: Auth;
13
+ runAction<Action extends FunctionReference<"action", "internal">>(action: Action, args: FunctionArgs<Action>): Promise<FunctionReturnType<Action>>;
14
+ };
15
+ export type ActionCtx = RunActionCtx & {
16
+ storage: StorageActionWriter;
17
+ };
18
+ export type QueryCtx = RunQueryCtx & {
19
+ storage: StorageReader;
20
+ };
21
+ export type OpaqueIds<T> = T extends GenericId<infer _T> ? string : T extends (infer U)[] ? OpaqueIds<U>[] : T extends ArrayBuffer ? ArrayBuffer : T extends object ? {
22
+ [K in keyof T]: OpaqueIds<T[K]>;
23
+ } : T;
24
+ export type UseApi<API> = Expand<{
25
+ [mod in keyof API]: API[mod] extends FunctionReference<infer FType, "public", infer FArgs, infer FReturnType, infer FComponentPath> ? FunctionReference<FType, "internal", OpaqueIds<FArgs>, OpaqueIds<FReturnType>, FComponentPath> : UseApi<API[mod]>;
26
+ }>;
27
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,MAAM,EACN,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI/C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,CAAC,KAAK,SAAS,iBAAi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AAC,CAAC;AAEd,MAAM,MAAM,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC;KAC9B,GAAG,IAAI,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,iBAAiB,CACpD,MAAM,KAAK,EACX,QAAQ,EACR,MAAM,KAAK,EACX,MAAM,WAAW,EACjB,MAAM,cAAc,CACrB,GACG,iBAAiB,CACf,KAAK,EACL,UAAU,EACV,SAAS,CAAC,KAAK,CAAC,EAChB,SAAS,CAAC,WAAW,CAAC,EACtB,cAAc,CACf,GACD,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACrB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Generated `api` utility.
3
+ *
4
+ * THIS CODE IS AUTOMATICALLY GENERATED.
5
+ *
6
+ * To regenerate, run `npx convex dev`.
7
+ * @module
8
+ */
9
+ import type * as lib from "../lib.js";
10
+ import type { ApiFromModules, FilterApi, FunctionReference } from "convex/server";
11
+ declare const fullApi: ApiFromModules<{
12
+ lib: typeof lib;
13
+ }>;
14
+ /**
15
+ * A utility for referencing Convex functions in your app's public API.
16
+ *
17
+ * Usage:
18
+ * ```js
19
+ * const myFunctionReference = api.myModule.myFunction;
20
+ * ```
21
+ */
22
+ export declare const api: FilterApi<typeof fullApi, FunctionReference<any, "public">>;
23
+ /**
24
+ * A utility for referencing Convex functions in your app's internal API.
25
+ *
26
+ * Usage:
27
+ * ```js
28
+ * const myFunctionReference = internal.myModule.myFunction;
29
+ * ```
30
+ */
31
+ export declare const internal: FilterApi<typeof fullApi, FunctionReference<any, "internal">>;
32
+ export declare const components: {
33
+ eventWorkpool: {
34
+ lib: {
35
+ cancel: FunctionReference<"mutation", "internal", {
36
+ id: string;
37
+ logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
38
+ }, any>;
39
+ cancelAll: FunctionReference<"mutation", "internal", {
40
+ before?: number;
41
+ limit?: number;
42
+ logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
43
+ }, any>;
44
+ enqueue: FunctionReference<"mutation", "internal", {
45
+ config: {
46
+ logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
47
+ maxParallelism: number;
48
+ };
49
+ fnArgs: any;
50
+ fnHandle: string;
51
+ fnName: string;
52
+ fnType: "action" | "mutation" | "query";
53
+ onComplete?: {
54
+ context?: any;
55
+ fnHandle: string;
56
+ };
57
+ retryBehavior?: {
58
+ base: number;
59
+ initialBackoffMs: number;
60
+ maxAttempts: number;
61
+ };
62
+ runAt: number;
63
+ }, string>;
64
+ enqueueBatch: FunctionReference<"mutation", "internal", {
65
+ config: {
66
+ logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
67
+ maxParallelism: number;
68
+ };
69
+ items: Array<{
70
+ fnArgs: any;
71
+ fnHandle: string;
72
+ fnName: string;
73
+ fnType: "action" | "mutation" | "query";
74
+ onComplete?: {
75
+ context?: any;
76
+ fnHandle: string;
77
+ };
78
+ retryBehavior?: {
79
+ base: number;
80
+ initialBackoffMs: number;
81
+ maxAttempts: number;
82
+ };
83
+ runAt: number;
84
+ }>;
85
+ }, Array<string>>;
86
+ status: FunctionReference<"query", "internal", {
87
+ id: string;
88
+ }, {
89
+ previousAttempts: number;
90
+ state: "pending";
91
+ } | {
92
+ previousAttempts: number;
93
+ state: "running";
94
+ } | {
95
+ state: "finished";
96
+ }>;
97
+ statusBatch: FunctionReference<"query", "internal", {
98
+ ids: Array<string>;
99
+ }, Array<{
100
+ previousAttempts: number;
101
+ state: "pending";
102
+ } | {
103
+ previousAttempts: number;
104
+ state: "running";
105
+ } | {
106
+ state: "finished";
107
+ }>>;
108
+ };
109
+ };
110
+ };
111
+ export {};
112
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,GAAG,MAAM,WAAW,CAAC;AAEtC,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAGvB,QAAA,MAAM,OAAO,EAAE,cAAc,CAAC;IAC5B,GAAG,EAAE,OAAO,GAAG,CAAC;CACjB,CAAiB,CAAC;AAEnB;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,EAAE,SAAS,CACzB,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,QAAQ,CAAC,CACjB,CAAC;AAElB;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,CAC9B,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,UAAU,CAAC,CACnB,CAAC;AAElB,eAAO,MAAM,UAAU,EAAqC;IAC1D,aAAa,EAAE;QACb,GAAG,EAAE;YACH,MAAM,EAAE,iBAAiB,CACvB,UAAU,EACV,UAAU,EACV;gBACE,EAAE,EAAE,MAAM,CAAC;gBACX,QAAQ,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;aACpE,EACD,GAAG,CACJ,CAAC;YACF,SAAS,EAAE,iBAAiB,CAC1B,UAAU,EACV,UAAU,EACV;gBACE,MAAM,CAAC,EAAE,MAAM,CAAC;gBAChB,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,QAAQ,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;aACpE,EACD,GAAG,CACJ,CAAC;YACF,OAAO,EAAE,iBAAiB,CACxB,UAAU,EACV,UAAU,EACV;gBACE,MAAM,EA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E,MAAM,CAAC;iBACf,CAAC,CAAC;aACJ,EACD,KAAK,CAAC,MAAM,CAAC,CACd,CAAC;YACF,MAAM,EAAE,iBAAiB,CACvB,OAAO,EACP,UAAU,EACV;gBAAE,EAAE,EAAE,MAAM,CAAA;aAAE,EACZ;gBAAE,gBAAgB,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,SAAS,CAAA;aAAE,GAC9C;gBAAE,gBAAgB,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,SAAS,CAAA;aAAE,GAC9C;gBAAE,KAAK,EAAE,UAAU,CAAA;aAAE,CACxB,CAAC;YACF,WAAW,EAAE,iBAAiB,CAC5B,OAAO,EACP,UAAU,EACV;gBAAE,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;aAAE,EACtB,KAAK,CACD;gBAAE,gBAAgB,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,SAAS,CAAA;aAAE,GAC9C;gBAAE,gBAAgB,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,SAAS,CAAA;aAAE,GAC9C;gBAAE,KAAK,EAAE,UAAU,CAAA;aAAE,CACxB,CACF,CAAC;SACH,CAAC;KACH,CAAC;CACH,CAAC"}
@@ -0,0 +1,31 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated `api` utility.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ import { anyApi, componentsGeneric } from "convex/server";
11
+ const fullApi = anyApi;
12
+ /**
13
+ * A utility for referencing Convex functions in your app's public API.
14
+ *
15
+ * Usage:
16
+ * ```js
17
+ * const myFunctionReference = api.myModule.myFunction;
18
+ * ```
19
+ */
20
+ export const api = anyApi;
21
+ /**
22
+ * A utility for referencing Convex functions in your app's internal API.
23
+ *
24
+ * Usage:
25
+ * ```js
26
+ * const myFunctionReference = internal.myModule.myFunction;
27
+ * ```
28
+ */
29
+ export const internal = anyApi;
30
+ export const components = componentsGeneric();
31
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AASH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,OAAO,GAER,MAAa,CAAC;AAEnB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,GAAG,GAGZ,MAAa,CAAC;AAElB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAGjB,MAAa,CAAC;AAElB,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,EAwF1C,CAAC"}
@@ -0,0 +1,50 @@
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
+ lib: {
23
+ enqueueWebhookEvent: FunctionReference<"mutation", "internal", {
24
+ apiKey: string;
25
+ event: string;
26
+ eventId: string;
27
+ eventTypes?: Array<string>;
28
+ logLevel?: "DEBUG";
29
+ onEventHandle?: string;
30
+ updatedAt?: string;
31
+ }, any, Name>;
32
+ getAuthUser: FunctionReference<"query", "internal", {
33
+ id: string;
34
+ }, {
35
+ createdAt: string;
36
+ email: string;
37
+ emailVerified: boolean;
38
+ externalId?: null | string;
39
+ firstName?: null | string;
40
+ id: string;
41
+ lastName?: null | string;
42
+ lastSignInAt?: null | string;
43
+ locale?: null | string;
44
+ metadata: Record<string, any>;
45
+ profilePictureUrl?: null | string;
46
+ updatedAt: string;
47
+ } | null, Name>;
48
+ };
49
+ };
50
+ //# 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,GAAG,EAAE;QACH,mBAAmB,EAAE,iBAAiB,CACpC,UAAU,EACV,UAAU,EACV;YACE,MAAM,EAAE,MAAM,CAAC;YACf,KAAK,EAAE,MAAM,CAAC;YACd,OAAO,EAAE,MAAM,CAAC;YAChB,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB,aAAa,CAAC,EAAE,MAAM,CAAC;YACvB,SAAS,CAAC,EAAE,MAAM,CAAC;SACpB,EACD,GAAG,EACH,IAAI,CACL,CAAC;QACF,WAAW,EAAE,iBAAiB,CAC5B,OAAO,EACP,UAAU,EACV;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,EACd;YACE,SAAS,EAAE,MAAM,CAAC;YAClB,KAAK,EAAE,MAAM,CAAC;YACd,aAAa,EAAE,OAAO,CAAC;YACvB,UAAU,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;YAC3B,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;YAC1B,EAAE,EAAE,MAAM,CAAC;YACX,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;YACzB,YAAY,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;YAC7B,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;YACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAC9B,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;YAClC,SAAS,EAAE,MAAM,CAAC;SACnB,GAAG,IAAI,EACR,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(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
+ import schema from "../schema.js";
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;AASH,OAAO,MAAM,MAAM,cAAc,CAAC"}
@@ -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,eA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