@contentgrowth/content-auth 0.2.0 → 0.2.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.
@@ -1059,6 +1059,22 @@ declare namespace schema {
1059
1059
  export { schema_accounts as accounts, schema_invitations as invitations, schema_members as members, schema_organizations as organizations, schema_sessions as sessions, schema_users as users, schema_verifications as verifications };
1060
1060
  }
1061
1061
 
1062
+ /**
1063
+ * Generates a formatted invitation link from the Better-Auth invitation data.
1064
+ *
1065
+ * Handles:
1066
+ * 1. Default Better-Auth fields (link, url)
1067
+ * 2. Fallback construction using baseUrl and invitation ID
1068
+ * 3. Markdown formatting for email clients causing auto-link issues
1069
+ *
1070
+ * @param data The data object received in the sendInvitationEmail hook
1071
+ * @param baseUrl The base URL of the application (e.g., https://app.example.com)
1072
+ * @returns An object containing the raw link and the markdown formatted link
1073
+ */
1074
+ declare function getInvitationLink(data: any, baseUrl: string): {
1075
+ link: any;
1076
+ };
1077
+
1062
1078
  interface AuthConfig {
1063
1079
  /**
1064
1080
  * The database instance or D1 binding.
@@ -1088,4 +1104,4 @@ declare const createAuthApp: (config: AuthConfig) => {
1088
1104
  auth: better_auth.Auth<any>;
1089
1105
  };
1090
1106
 
1091
- export { type AuthConfig, authMiddleware, createAuth, createAuthApp, schema };
1107
+ export { type AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, schema };
@@ -3,13 +3,15 @@ import {
3
3
  authMiddleware,
4
4
  createAuth,
5
5
  createAuthApp,
6
+ getInvitationLink,
6
7
  schema_exports
7
- } from "../chunk-C2QC5WEH.js";
8
+ } from "../chunk-FYU2PONS.js";
8
9
  import "../chunk-R5U7XKVJ.js";
9
10
  export {
10
11
  Hono,
11
12
  authMiddleware,
12
13
  createAuth,
13
14
  createAuthApp,
15
+ getInvitationLink,
14
16
  schema_exports as schema
15
17
  };
@@ -164,6 +164,18 @@ async function verifyPassword(passwordOrData, storedHash) {
164
164
  return result === 0;
165
165
  }
166
166
 
167
+ // src/backend/utils.ts
168
+ function getInvitationLink(data, baseUrl) {
169
+ let rawLink = data.link || data.url;
170
+ if (!rawLink) {
171
+ const cleanBaseUrl = baseUrl.replace(/\/$/, "");
172
+ rawLink = `${cleanBaseUrl}/accept-invitation/${data.id}`;
173
+ }
174
+ return {
175
+ link: rawLink
176
+ };
177
+ }
178
+
167
179
  // src/backend/index.ts
168
180
  var createAuth = (config) => {
169
181
  let db;
@@ -222,6 +234,7 @@ var createAuthApp = (config) => {
222
234
 
223
235
  export {
224
236
  schema_exports,
237
+ getInvitationLink,
225
238
  Hono,
226
239
  createAuth,
227
240
  authMiddleware,
@@ -628,7 +628,7 @@ declare const createClient: (baseUrl?: string) => {
628
628
  sortDirection?: "asc" | "desc" | undefined;
629
629
  filterField?: string | undefined;
630
630
  filterValue?: string | number | boolean | undefined;
631
- filterOperator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "contains" | undefined;
631
+ filterOperator?: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "contains" | undefined;
632
632
  organizationId?: string | undefined;
633
633
  organizationSlug?: string | undefined;
634
634
  }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
@@ -639,7 +639,7 @@ declare const createClient: (baseUrl?: string) => {
639
639
  sortDirection?: "asc" | "desc" | undefined;
640
640
  filterField?: string | undefined;
641
641
  filterValue?: string | number | boolean | undefined;
642
- filterOperator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "contains" | undefined;
642
+ filterOperator?: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "contains" | undefined;
643
643
  organizationId?: string | undefined;
644
644
  organizationSlug?: string | undefined;
645
645
  } | undefined;
@@ -746,7 +746,7 @@ declare const createClient: (baseUrl?: string) => {
746
746
  } & {
747
747
  signIn: {
748
748
  social: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
749
- provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
749
+ provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
750
750
  callbackURL?: string | undefined;
751
751
  newUserCallbackURL?: string | undefined;
752
752
  errorCallbackURL?: string | undefined;
@@ -763,7 +763,7 @@ declare const createClient: (baseUrl?: string) => {
763
763
  loginHint?: string | undefined;
764
764
  additionalData?: Record<string, any> | undefined;
765
765
  }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
766
- provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
766
+ provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
767
767
  callbackURL?: string | undefined;
768
768
  newUserCallbackURL?: string | undefined;
769
769
  errorCallbackURL?: string | undefined;
@@ -2205,7 +2205,7 @@ declare const authClient: {
2205
2205
  sortDirection?: "asc" | "desc" | undefined;
2206
2206
  filterField?: string | undefined;
2207
2207
  filterValue?: string | number | boolean | undefined;
2208
- filterOperator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "contains" | undefined;
2208
+ filterOperator?: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "contains" | undefined;
2209
2209
  organizationId?: string | undefined;
2210
2210
  organizationSlug?: string | undefined;
2211
2211
  }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
@@ -2216,7 +2216,7 @@ declare const authClient: {
2216
2216
  sortDirection?: "asc" | "desc" | undefined;
2217
2217
  filterField?: string | undefined;
2218
2218
  filterValue?: string | number | boolean | undefined;
2219
- filterOperator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "contains" | undefined;
2219
+ filterOperator?: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "contains" | undefined;
2220
2220
  organizationId?: string | undefined;
2221
2221
  organizationSlug?: string | undefined;
2222
2222
  } | undefined;
@@ -2323,7 +2323,7 @@ declare const authClient: {
2323
2323
  } & {
2324
2324
  signIn: {
2325
2325
  social: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
2326
- provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
2326
+ provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
2327
2327
  callbackURL?: string | undefined;
2328
2328
  newUserCallbackURL?: string | undefined;
2329
2329
  errorCallbackURL?: string | undefined;
@@ -2340,7 +2340,7 @@ declare const authClient: {
2340
2340
  loginHint?: string | undefined;
2341
2341
  additionalData?: Record<string, any> | undefined;
2342
2342
  }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
2343
- provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
2343
+ provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
2344
2344
  callbackURL?: string | undefined;
2345
2345
  newUserCallbackURL?: string | undefined;
2346
2346
  errorCallbackURL?: string | undefined;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { AuthConfig, authMiddleware, createAuth, createAuthApp, schema } from './backend/index.js';
1
+ export { AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, schema } from './backend/index.js';
2
2
  export { AuthForm, CreateOrganizationForm, InviteMemberForm, OrganizationSwitcher } from './frontend/index.js';
3
3
  export { authClient, createClient } from './frontend/client.js';
4
4
  export * from 'better-auth';
package/dist/index.js CHANGED
@@ -3,8 +3,9 @@ import {
3
3
  authMiddleware,
4
4
  createAuth,
5
5
  createAuthApp,
6
+ getInvitationLink,
6
7
  schema_exports
7
- } from "./chunk-C2QC5WEH.js";
8
+ } from "./chunk-FYU2PONS.js";
8
9
  import {
9
10
  AuthForm,
10
11
  CreateOrganizationForm,
@@ -27,5 +28,6 @@ export {
27
28
  createAuth,
28
29
  createAuthApp,
29
30
  createClient,
31
+ getInvitationLink,
30
32
  schema_exports as schema
31
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentgrowth/content-auth",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Better Auth wrapper with UI components for Cloudflare Workers & Pages",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",