@banata-auth/convex 0.1.0

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 (72) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +104 -0
  3. package/dist/auth-config.d.ts +22 -0
  4. package/dist/auth-config.d.ts.map +1 -0
  5. package/dist/auth-config.js +3 -0
  6. package/dist/auth-config.js.map +1 -0
  7. package/dist/auth.d.ts +462 -0
  8. package/dist/auth.d.ts.map +1 -0
  9. package/dist/component/adapter.d.ts +21 -0
  10. package/dist/component/adapter.d.ts.map +1 -0
  11. package/dist/component/adapter.js +3 -0
  12. package/dist/component/adapter.js.map +1 -0
  13. package/dist/component/schema.d.ts +1026 -0
  14. package/dist/component/schema.d.ts.map +1 -0
  15. package/dist/hooks.d.ts +25 -0
  16. package/dist/hooks.d.ts.map +1 -0
  17. package/dist/http.d.ts +41 -0
  18. package/dist/http.d.ts.map +1 -0
  19. package/dist/http.js +62 -0
  20. package/dist/http.js.map +1 -0
  21. package/dist/index.d.ts +9 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +9516 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/node.d.ts +389 -0
  26. package/dist/node.d.ts.map +1 -0
  27. package/dist/node.js +9559 -0
  28. package/dist/node.js.map +1 -0
  29. package/dist/plugins/audit.d.ts +106 -0
  30. package/dist/plugins/audit.d.ts.map +1 -0
  31. package/dist/plugins/config.d.ts +83 -0
  32. package/dist/plugins/config.d.ts.map +1 -0
  33. package/dist/plugins/domains.d.ts +3 -0
  34. package/dist/plugins/domains.d.ts.map +1 -0
  35. package/dist/plugins/email-sender.d.ts +75 -0
  36. package/dist/plugins/email-sender.d.ts.map +1 -0
  37. package/dist/plugins/email-templates.d.ts +108 -0
  38. package/dist/plugins/email-templates.d.ts.map +1 -0
  39. package/dist/plugins/email.d.ts +82 -0
  40. package/dist/plugins/email.d.ts.map +1 -0
  41. package/dist/plugins/enterprise.d.ts +3 -0
  42. package/dist/plugins/enterprise.d.ts.map +1 -0
  43. package/dist/plugins/events.d.ts +40 -0
  44. package/dist/plugins/events.d.ts.map +1 -0
  45. package/dist/plugins/index.d.ts +18 -0
  46. package/dist/plugins/index.d.ts.map +1 -0
  47. package/dist/plugins/index.js +9192 -0
  48. package/dist/plugins/index.js.map +1 -0
  49. package/dist/plugins/organization-rbac.d.ts +3 -0
  50. package/dist/plugins/organization-rbac.d.ts.map +1 -0
  51. package/dist/plugins/portal.d.ts +34 -0
  52. package/dist/plugins/portal.d.ts.map +1 -0
  53. package/dist/plugins/projects.d.ts +16 -0
  54. package/dist/plugins/projects.d.ts.map +1 -0
  55. package/dist/plugins/protection.d.ts +127 -0
  56. package/dist/plugins/protection.d.ts.map +1 -0
  57. package/dist/plugins/types.d.ts +508 -0
  58. package/dist/plugins/types.d.ts.map +1 -0
  59. package/dist/plugins/user-management.d.ts +8 -0
  60. package/dist/plugins/user-management.d.ts.map +1 -0
  61. package/dist/plugins/vault.d.ts +68 -0
  62. package/dist/plugins/vault.d.ts.map +1 -0
  63. package/dist/plugins/webhook.d.ts +65 -0
  64. package/dist/plugins/webhook.d.ts.map +1 -0
  65. package/dist/triggers.d.ts +158 -0
  66. package/dist/triggers.d.ts.map +1 -0
  67. package/dist/triggers.js +36 -0
  68. package/dist/triggers.js.map +1 -0
  69. package/package.json +102 -0
  70. package/src/component/adapter.ts +21 -0
  71. package/src/component/convex.config.ts +15 -0
  72. package/src/component/schema.ts +916 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AA4BA,QAAA,MAAM,MAAM;IAMX;;;;;;;OAOG;;;;;;;;;;;;;;QAOF,mDAAmD;;;;;;;;;IAYpD;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6CH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0BH;;;OAGG;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OAGG;;;;;;;;;;;;;;;;;;;;IAkBH;;;OAGG;;;;;;;;;;;;;;IAaH;;;OAGG;;;;;;;;;;;;;;IAaH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0BH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;IAmBH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA0BF,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Bridge between Banata Auth triggers and Better Auth's databaseHooks.
3
+ *
4
+ * Better Auth provides databaseHooks that fire when database operations occur.
5
+ * This module converts BanataAuthTriggers into the databaseHooks format.
6
+ *
7
+ * @see https://www.better-auth.com/docs/concepts/database-hooks
8
+ */
9
+ import type { GenericCtx } from "@convex-dev/better-auth/utils";
10
+ import type { BetterAuthOptions } from "better-auth";
11
+ import type { GenericDataModel } from "convex/server";
12
+ import type { BanataAuthTriggers } from "./triggers";
13
+ /**
14
+ * Create Better Auth databaseHooks from Banata Auth triggers.
15
+ *
16
+ * This bridges the two systems: when Better Auth fires a database hook
17
+ * (e.g., after creating a user), the corresponding trigger handler is
18
+ * invoked with a properly typed TriggerContext.
19
+ *
20
+ * @param ctx - Convex function context (for creating TriggerContext)
21
+ * @param triggers - The registered trigger handlers
22
+ * @returns BetterAuthOptions["databaseHooks"] compatible object
23
+ */
24
+ export declare function createDatabaseHooks(ctx: GenericCtx<GenericDataModel>, triggers: BanataAuthTriggers | undefined): BetterAuthOptions["databaseHooks"];
25
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EACX,kBAAkB,EAKlB,MAAM,YAAY,CAAC;AAgHpB;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAClC,GAAG,EAAE,UAAU,CAAC,gBAAgB,CAAC,EACjC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,GACtC,iBAAiB,CAAC,eAAe,CAAC,CAuFpC"}
package/dist/http.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ /**
2
+ * HTTP route registration for Banata Auth.
3
+ *
4
+ * Better Auth exposes its endpoints as HTTP routes on Convex's httpRouter.
5
+ * This module provides helpers for both direct Convex runtime registration and
6
+ * Node-action proxy registration for SSO/SCIM flows that need Node libraries.
7
+ */
8
+ import type { createClient } from "@convex-dev/better-auth";
9
+ import type { CreateAuth } from "@convex-dev/better-auth/utils";
10
+ import type { FunctionReference, GenericDataModel, HttpRouter } from "convex/server";
11
+ /**
12
+ * Type for the createAuth function that the HTTP router needs.
13
+ * Uses the properly typed CreateAuth from @convex-dev/better-auth.
14
+ */
15
+ export type CreateAuthFn = CreateAuth<GenericDataModel>;
16
+ /**
17
+ * Type for the component client's registerRoutes method.
18
+ */
19
+ export type RegisterRoutesFn = ReturnType<typeof createClient>["registerRoutes"];
20
+ /**
21
+ * CORS configuration for auth routes.
22
+ */
23
+ export interface BanataAuthCorsConfig {
24
+ allowedOrigins?: string[];
25
+ allowedHeaders?: string[];
26
+ exposedHeaders?: string[];
27
+ }
28
+ /**
29
+ * Register all Banata Auth HTTP routes on a Convex httpRouter.
30
+ */
31
+ export declare function registerBanataAuthRoutes(authComponent: ReturnType<typeof createClient>, httpRouter: HttpRouter, createAuth: CreateAuthFn, opts?: {
32
+ cors?: boolean | BanataAuthCorsConfig;
33
+ }): void;
34
+ /**
35
+ * Register auth routes through a Node action proxy.
36
+ *
37
+ * Use this when some Better Auth plugins depend on Node-only libraries while
38
+ * keeping the public HTTP surface on Convex.
39
+ */
40
+ export declare function registerBanataAuthNodeProxyRoutes(httpRouter: HttpRouter, createAuth: CreateAuthFn, handleNodeAuthRequest: FunctionReference<"action", "internal">): void;
41
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EACX,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EAEV,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,gBAAgB,CAAC,CAAC;AAEjF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AA+BD;;GAEG;AACH,wBAAgB,wBAAwB,CACvC,aAAa,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,EAC9C,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,YAAY,EACxB,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,GAAG,oBAAoB,CAAA;CAAE,QAGhD;AAWD;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAChD,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,YAAY,EACxB,qBAAqB,EAAE,iBAAiB,CAAC,QAAQ,EAAE,UAAU,CAAC,QAuC9D"}
package/dist/http.js ADDED
@@ -0,0 +1,62 @@
1
+ import { httpActionGeneric } from 'convex/server';
2
+
3
+ // src/http.ts
4
+ function deserializeAuthResponse(serialized) {
5
+ const headers = new Headers();
6
+ for (const header of serialized.headers) {
7
+ headers.append(header.key, header.value);
8
+ }
9
+ return new Response(serialized.body, {
10
+ status: serialized.status,
11
+ headers
12
+ });
13
+ }
14
+ function registerBanataAuthRoutes(authComponent, httpRouter, createAuth, opts) {
15
+ authComponent.registerRoutes(httpRouter, createAuth, opts);
16
+ }
17
+ var ROUTABLE_HTTP_METHODS = [
18
+ "GET",
19
+ "POST",
20
+ "PUT",
21
+ "PATCH",
22
+ "DELETE",
23
+ "OPTIONS"
24
+ ];
25
+ function registerBanataAuthNodeProxyRoutes(httpRouter, createAuth, handleNodeAuthRequest) {
26
+ const staticAuth = createAuth({});
27
+ const path = staticAuth.options.basePath ?? "/api/auth";
28
+ const authRequestHandler = httpActionGeneric(async (ctx, request) => {
29
+ const serializedRequest = {
30
+ method: request.method,
31
+ url: request.url,
32
+ headers: Array.from(request.headers.entries()).map(([key, value]) => ({ key, value })),
33
+ body: request.method === "GET" || request.method === "HEAD" ? null : await request.text()
34
+ };
35
+ const serializedResponse = await ctx.runAction(handleNodeAuthRequest, {
36
+ request: serializedRequest
37
+ });
38
+ return deserializeAuthResponse(serializedResponse);
39
+ });
40
+ const wellKnown = httpRouter.lookup("/.well-known/openid-configuration", "GET");
41
+ if (!wellKnown) {
42
+ httpRouter.route({
43
+ path: "/.well-known/openid-configuration",
44
+ method: "GET",
45
+ handler: httpActionGeneric(async () => {
46
+ const url = `${process.env.CONVEX_SITE_URL}${path}/convex/.well-known/openid-configuration`;
47
+ return Response.redirect(url, 302);
48
+ })
49
+ });
50
+ }
51
+ for (const method of ROUTABLE_HTTP_METHODS) {
52
+ httpRouter.route({
53
+ pathPrefix: `${path}/`,
54
+ method,
55
+ handler: authRequestHandler
56
+ });
57
+ }
58
+ }
59
+
60
+ export { registerBanataAuthNodeProxyRoutes, registerBanataAuthRoutes };
61
+ //# sourceMappingURL=http.js.map
62
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
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AA,MACrF,IAAA,EACC,OAAA,CAAQ,MAAA,KAAW,KAAA,IAAS,OAAA,CAAQ,WAAW,MAAA,GAC5C,IAAA,GACA,MAAM,OAAA,CAAQ,IAAA;AAAK,KACxB;AACA,IAAA,MAAM,kBAAA,GAAqB,MAAM,GAAA,CAAI,SAAA,CAAU,qBAAA,EAAuB;AAAA,MACrE,OAAA,EAAS;AAAA,KACT,CAAA;AACD,IAAA,OAAO,wBAAwB,kBAAkB,CAAA;AAAA,EAClD,CAAC,CAAA;AAED,EAAA,MAAM,SAAA,GAAY,UAAA,CAAW,MAAA,CAAO,mCAAA,EAAqC,KAAK,CAAA;AAC9E,EAAA,IAAI,CAAC,SAAA,EAAW;AACf,IAAA,UAAA,CAAW,KAAA,CAAM;AAAA,MAChB,IAAA,EAAM,mCAAA;AAAA,MACN,MAAA,EAAQ,KAAA;AAAA,MACR,OAAA,EAAS,kBAAkB,YAAY;AACtC,QAAA,MAAM,MAAM,CAAA,EAAG,OAAA,CAAQ,GAAA,CAAI,eAAe,GAAG,IAAI,CAAA,wCAAA,CAAA;AACjD,QAAA,OAAO,QAAA,CAAS,QAAA,CAAS,GAAA,EAAK,GAAG,CAAA;AAAA,MAClC,CAAC;AAAA,KACD,CAAA;AAAA,EACF;AAEA,EAAA,KAAA,MAAW,UAAU,qBAAA,EAAuB;AAC3C,IAAA,UAAA,CAAW,KAAA,CAAM;AAAA,MAChB,UAAA,EAAY,GAAG,IAAI,CAAA,CAAA,CAAA;AAAA,MACnB,MAAA;AAAA,MACA,OAAA,EAAS;AAAA,KACT,CAAA;AAAA,EACF;AACD","file":"http.js","sourcesContent":["/**\n * HTTP route registration for Banata Auth.\n *\n * Better Auth exposes its endpoints as HTTP routes on Convex's httpRouter.\n * This module provides helpers for both direct Convex runtime registration and\n * Node-action proxy registration for SSO/SCIM flows that need Node libraries.\n */\n\nimport type { createClient } from \"@convex-dev/better-auth\";\nimport type { CreateAuth } from \"@convex-dev/better-auth/utils\";\nimport type {\n\tFunctionReference,\n\tGenericDataModel,\n\tHttpRouter,\n\tRoutableMethod,\n} from \"convex/server\";\nimport { httpActionGeneric } from \"convex/server\";\n\n/**\n * Type for the createAuth function that the HTTP router needs.\n * Uses the properly typed CreateAuth from @convex-dev/better-auth.\n */\nexport type CreateAuthFn = CreateAuth<GenericDataModel>;\n\n/**\n * Type for the component client's registerRoutes method.\n */\nexport type RegisterRoutesFn = ReturnType<typeof createClient>[\"registerRoutes\"];\n\n/**\n * CORS configuration for auth routes.\n */\nexport interface BanataAuthCorsConfig {\n\tallowedOrigins?: string[];\n\tallowedHeaders?: string[];\n\texposedHeaders?: string[];\n}\n\ninterface SerializedAuthHeader {\n\tkey: string;\n\tvalue: string;\n}\n\ninterface SerializedAuthRequest {\n\tmethod: string;\n\turl: string;\n\theaders: SerializedAuthHeader[];\n\tbody: string | null;\n}\n\ninterface SerializedAuthResponse {\n\tstatus: number;\n\theaders: SerializedAuthHeader[];\n\tbody: string | null;\n}\n\nfunction deserializeAuthResponse(serialized: SerializedAuthResponse) {\n\tconst headers = new Headers();\n\tfor (const header of serialized.headers) {\n\t\theaders.append(header.key, header.value);\n\t}\n\treturn new Response(serialized.body, {\n\t\tstatus: serialized.status,\n\t\theaders,\n\t});\n}\n\n/**\n * Register all Banata Auth HTTP routes on a Convex httpRouter.\n */\nexport function registerBanataAuthRoutes(\n\tauthComponent: ReturnType<typeof createClient>,\n\thttpRouter: HttpRouter,\n\tcreateAuth: CreateAuthFn,\n\topts?: { cors?: boolean | BanataAuthCorsConfig },\n) {\n\tauthComponent.registerRoutes(httpRouter, createAuth, opts);\n}\n\nconst ROUTABLE_HTTP_METHODS: RoutableMethod[] = [\n\t\"GET\",\n\t\"POST\",\n\t\"PUT\",\n\t\"PATCH\",\n\t\"DELETE\",\n\t\"OPTIONS\",\n];\n\n/**\n * Register auth routes through a Node action proxy.\n *\n * Use this when some Better Auth plugins depend on Node-only libraries while\n * keeping the public HTTP surface on Convex.\n */\nexport function registerBanataAuthNodeProxyRoutes(\n\thttpRouter: HttpRouter,\n\tcreateAuth: CreateAuthFn,\n\thandleNodeAuthRequest: FunctionReference<\"action\", \"internal\">,\n) {\n\tconst staticAuth = createAuth({} as never);\n\tconst path = staticAuth.options.basePath ?? \"/api/auth\";\n\tconst authRequestHandler = httpActionGeneric(async (ctx, request) => {\n\t\tconst serializedRequest: SerializedAuthRequest = {\n\t\t\tmethod: request.method,\n\t\t\turl: request.url,\n\t\t\theaders: Array.from(request.headers.entries()).map(([key, value]) => ({ key, value })),\n\t\t\tbody:\n\t\t\t\trequest.method === \"GET\" || request.method === \"HEAD\"\n\t\t\t\t\t? null\n\t\t\t\t\t: await request.text(),\n\t\t};\n\t\tconst serializedResponse = await ctx.runAction(handleNodeAuthRequest, {\n\t\t\trequest: serializedRequest,\n\t\t});\n\t\treturn deserializeAuthResponse(serializedResponse);\n\t});\n\n\tconst wellKnown = httpRouter.lookup(\"/.well-known/openid-configuration\", \"GET\");\n\tif (!wellKnown) {\n\t\thttpRouter.route({\n\t\t\tpath: \"/.well-known/openid-configuration\",\n\t\t\tmethod: \"GET\",\n\t\t\thandler: httpActionGeneric(async () => {\n\t\t\t\tconst url = `${process.env.CONVEX_SITE_URL}${path}/convex/.well-known/openid-configuration`;\n\t\t\t\treturn Response.redirect(url, 302);\n\t\t\t}),\n\t\t});\n\t}\n\n\tfor (const method of ROUTABLE_HTTP_METHODS) {\n\t\thttpRouter.route({\n\t\t\tpathPrefix: `${path}/`,\n\t\t\tmethod,\n\t\t\thandler: authRequestHandler,\n\t\t});\n\t}\n}\r\n"]}
@@ -0,0 +1,9 @@
1
+ export { createBanataAuthComponent, createBanataAuthOptions, createBanataAuth, createBanataAuthStaticOptions, } from "./auth";
2
+ export type { BanataAuthConfig, BanataAuthEmailConfig, BanataAuthSocialProviders, SocialProviderConfig, } from "./auth";
3
+ export type { BanataAuthConvexAuthConfig } from "./auth";
4
+ export { registerBanataAuthRoutes, registerBanataAuthNodeProxyRoutes } from "./http";
5
+ export type { CreateAuthFn, RegisterRoutesFn, BanataAuthCorsConfig } from "./http";
6
+ export { defineBanataAuthTriggers, executeTrigger, createTriggerContext, } from "./triggers";
7
+ export type { BanataAuthTriggers, TriggerContext, TriggerMetadata, TriggerUser, TriggerSession, TriggerOrganization, TriggerMember, } from "./triggers";
8
+ export { createDatabaseHooks } from "./hooks";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,yBAAyB,EACzB,uBAAuB,EACvB,gBAAgB,EAChB,6BAA6B,GAC7B,MAAM,QAAQ,CAAC;AAEhB,YAAY,EACX,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,GACpB,MAAM,QAAQ,CAAC;AAChB,YAAY,EAAE,0BAA0B,EAAE,MAAM,QAAQ,CAAC;AAGzD,OAAO,EAAE,wBAAwB,EAAE,iCAAiC,EAAE,MAAM,QAAQ,CAAC;AACrF,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAGnF,OAAO,EACN,wBAAwB,EACxB,cAAc,EACd,oBAAoB,GACpB,MAAM,YAAY,CAAC;AACpB,YAAY,EACX,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,aAAa,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC"}