@convex-dev/better-auth 0.10.13 → 0.11.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 (185) hide show
  1. package/dist/auth-options.d.ts.map +1 -1
  2. package/dist/auth-options.js +0 -2
  3. package/dist/auth-options.js.map +1 -1
  4. package/dist/client/adapter-utils.d.ts +10 -10
  5. package/dist/client/adapter-utils.d.ts.map +1 -1
  6. package/dist/client/adapter-utils.js +41 -32
  7. package/dist/client/adapter-utils.js.map +1 -1
  8. package/dist/client/adapter.d.ts +1 -1
  9. package/dist/client/adapter.d.ts.map +1 -1
  10. package/dist/client/adapter.js +113 -7
  11. package/dist/client/adapter.js.map +1 -1
  12. package/dist/client/create-api.d.ts +8 -7
  13. package/dist/client/create-api.d.ts.map +1 -1
  14. package/dist/client/create-api.js +1 -0
  15. package/dist/client/create-api.js.map +1 -1
  16. package/dist/client/create-client.d.ts +1 -1
  17. package/dist/client/create-client.d.ts.map +1 -1
  18. package/dist/client/create-client.js +8 -7
  19. package/dist/client/create-client.js.map +1 -1
  20. package/dist/client/create-schema.d.ts +0 -1
  21. package/dist/client/create-schema.d.ts.map +1 -1
  22. package/dist/client/create-schema.js +0 -1
  23. package/dist/client/create-schema.js.map +1 -1
  24. package/dist/component/_generated/api.d.ts +12 -0
  25. package/dist/component/_generated/api.d.ts.map +1 -1
  26. package/dist/component/_generated/api.js.map +1 -1
  27. package/dist/component/_generated/component.d.ts +7407 -92
  28. package/dist/component/_generated/component.d.ts.map +1 -1
  29. package/dist/component/adapter.d.ts +8 -7
  30. package/dist/component/adapter.d.ts.map +1 -1
  31. package/dist/component/adapterTest.d.ts +1 -7
  32. package/dist/component/adapterTest.d.ts.map +1 -1
  33. package/dist/component/adapterTest.js +193 -390
  34. package/dist/component/adapterTest.js.map +1 -1
  35. package/dist/component/schema.d.ts +35 -74
  36. package/dist/component/schema.d.ts.map +1 -1
  37. package/dist/component/schema.js +16 -21
  38. package/dist/component/schema.js.map +1 -1
  39. package/dist/component/testProfiles/adapterAdditionalFields.d.ts +131 -0
  40. package/dist/component/testProfiles/adapterAdditionalFields.d.ts.map +1 -0
  41. package/dist/component/testProfiles/adapterAdditionalFields.js +5 -0
  42. package/dist/component/testProfiles/adapterAdditionalFields.js.map +1 -0
  43. package/dist/component/testProfiles/adapterOrganizationJoins.d.ts +131 -0
  44. package/dist/component/testProfiles/adapterOrganizationJoins.d.ts.map +1 -0
  45. package/dist/component/testProfiles/adapterOrganizationJoins.js +5 -0
  46. package/dist/component/testProfiles/adapterOrganizationJoins.js.map +1 -0
  47. package/dist/component/testProfiles/adapterPluginTable.d.ts +131 -0
  48. package/dist/component/testProfiles/adapterPluginTable.d.ts.map +1 -0
  49. package/dist/component/testProfiles/adapterPluginTable.js +5 -0
  50. package/dist/component/testProfiles/adapterPluginTable.js.map +1 -0
  51. package/dist/component/testProfiles/adapterRenameField.d.ts +131 -0
  52. package/dist/component/testProfiles/adapterRenameField.d.ts.map +1 -0
  53. package/dist/component/testProfiles/adapterRenameField.js +5 -0
  54. package/dist/component/testProfiles/adapterRenameField.js.map +1 -0
  55. package/dist/component/testProfiles/adapterRenameUserCustom.d.ts +131 -0
  56. package/dist/component/testProfiles/adapterRenameUserCustom.d.ts.map +1 -0
  57. package/dist/component/testProfiles/adapterRenameUserCustom.js +5 -0
  58. package/dist/component/testProfiles/adapterRenameUserCustom.js.map +1 -0
  59. package/dist/component/testProfiles/adapterRenameUserTable.d.ts +131 -0
  60. package/dist/component/testProfiles/adapterRenameUserTable.d.ts.map +1 -0
  61. package/dist/component/testProfiles/adapterRenameUserTable.js +5 -0
  62. package/dist/component/testProfiles/adapterRenameUserTable.js.map +1 -0
  63. package/dist/component/testProfiles/auth-options.profile-additional-fields.d.ts +3 -0
  64. package/dist/component/testProfiles/auth-options.profile-additional-fields.d.ts.map +1 -0
  65. package/dist/component/testProfiles/auth-options.profile-additional-fields.js +38 -0
  66. package/dist/component/testProfiles/auth-options.profile-additional-fields.js.map +1 -0
  67. package/dist/component/testProfiles/auth-options.profile-plugin-table.d.ts +3 -0
  68. package/dist/component/testProfiles/auth-options.profile-plugin-table.d.ts.map +1 -0
  69. package/dist/component/testProfiles/auth-options.profile-plugin-table.js +92 -0
  70. package/dist/component/testProfiles/auth-options.profile-plugin-table.js.map +1 -0
  71. package/dist/component/testProfiles/auth-options.profile-rename-joins.d.ts +6 -0
  72. package/dist/component/testProfiles/auth-options.profile-rename-joins.d.ts.map +1 -0
  73. package/dist/component/testProfiles/auth-options.profile-rename-joins.js +49 -0
  74. package/dist/component/testProfiles/auth-options.profile-rename-joins.js.map +1 -0
  75. package/dist/component/testProfiles/schema.profile-additional-fields.d.ts +227 -0
  76. package/dist/component/testProfiles/schema.profile-additional-fields.d.ts.map +1 -0
  77. package/dist/component/testProfiles/schema.profile-additional-fields.js +37 -0
  78. package/dist/component/testProfiles/schema.profile-additional-fields.js.map +1 -0
  79. package/dist/component/testProfiles/schema.profile-plugin-table.d.ts +450 -0
  80. package/dist/component/testProfiles/schema.profile-plugin-table.d.ts.map +1 -0
  81. package/dist/component/testProfiles/schema.profile-plugin-table.js +116 -0
  82. package/dist/component/testProfiles/schema.profile-plugin-table.js.map +1 -0
  83. package/dist/nextjs/index.d.ts.map +1 -1
  84. package/dist/nextjs/index.js +1 -0
  85. package/dist/nextjs/index.js.map +1 -1
  86. package/dist/plugins/convex/index.d.ts +131 -12
  87. package/dist/plugins/convex/index.d.ts.map +1 -1
  88. package/dist/plugins/convex/index.js +12 -5
  89. package/dist/plugins/convex/index.js.map +1 -1
  90. package/dist/plugins/cross-domain/client.d.ts +1 -1
  91. package/dist/plugins/cross-domain/index.d.ts +126 -1
  92. package/dist/plugins/cross-domain/index.d.ts.map +1 -1
  93. package/dist/plugins/cross-domain/index.js +10 -15
  94. package/dist/plugins/cross-domain/index.js.map +1 -1
  95. package/dist/react-start/index.d.ts.map +1 -1
  96. package/dist/react-start/index.js +1 -0
  97. package/dist/react-start/index.js.map +1 -1
  98. package/dist/test/adapter-factory/auth-flow.d.ts +42 -0
  99. package/dist/test/adapter-factory/auth-flow.d.ts.map +1 -0
  100. package/dist/test/adapter-factory/auth-flow.js +145 -0
  101. package/dist/test/adapter-factory/auth-flow.js.map +1 -0
  102. package/dist/test/adapter-factory/basic.d.ts +190 -0
  103. package/dist/test/adapter-factory/basic.d.ts.map +1 -0
  104. package/dist/test/adapter-factory/basic.js +2713 -0
  105. package/dist/test/adapter-factory/basic.js.map +1 -0
  106. package/dist/test/adapter-factory/convex-custom.d.ts +18 -0
  107. package/dist/test/adapter-factory/convex-custom.d.ts.map +1 -0
  108. package/dist/test/adapter-factory/convex-custom.js +610 -0
  109. package/dist/test/adapter-factory/convex-custom.js.map +1 -0
  110. package/dist/test/adapter-factory/index.d.ts +11 -0
  111. package/dist/test/adapter-factory/index.d.ts.map +1 -0
  112. package/dist/test/adapter-factory/index.js +11 -0
  113. package/dist/test/adapter-factory/index.js.map +1 -0
  114. package/dist/test/adapter-factory/joins.d.ts +18 -0
  115. package/dist/test/adapter-factory/joins.d.ts.map +1 -0
  116. package/dist/test/adapter-factory/joins.js +22 -0
  117. package/dist/test/adapter-factory/joins.js.map +1 -0
  118. package/dist/test/adapter-factory/number-id.d.ts +18 -0
  119. package/dist/test/adapter-factory/number-id.d.ts.map +1 -0
  120. package/dist/test/adapter-factory/number-id.js +36 -0
  121. package/dist/test/adapter-factory/number-id.js.map +1 -0
  122. package/dist/test/adapter-factory/profile-additional-fields.d.ts +71 -0
  123. package/dist/test/adapter-factory/profile-additional-fields.d.ts.map +1 -0
  124. package/dist/test/adapter-factory/profile-additional-fields.js +44 -0
  125. package/dist/test/adapter-factory/profile-additional-fields.js.map +1 -0
  126. package/dist/test/adapter-factory/profile-plugin-table.d.ts +19 -0
  127. package/dist/test/adapter-factory/profile-plugin-table.d.ts.map +1 -0
  128. package/dist/test/adapter-factory/profile-plugin-table.js +25 -0
  129. package/dist/test/adapter-factory/profile-plugin-table.js.map +1 -0
  130. package/dist/test/adapter-factory/profile-rename-joins.d.ts +73 -0
  131. package/dist/test/adapter-factory/profile-rename-joins.d.ts.map +1 -0
  132. package/dist/test/adapter-factory/profile-rename-joins.js +34 -0
  133. package/dist/test/adapter-factory/profile-rename-joins.js.map +1 -0
  134. package/dist/test/adapter-factory/transactions.d.ts +21 -0
  135. package/dist/test/adapter-factory/transactions.d.ts.map +1 -0
  136. package/dist/test/adapter-factory/transactions.js +28 -0
  137. package/dist/test/adapter-factory/transactions.js.map +1 -0
  138. package/dist/test/adapter-factory/uuid.d.ts +18 -0
  139. package/dist/test/adapter-factory/uuid.d.ts.map +1 -0
  140. package/dist/test/adapter-factory/uuid.js +58 -0
  141. package/dist/test/adapter-factory/uuid.js.map +1 -0
  142. package/dist/utils/index.d.ts +18 -3
  143. package/dist/utils/index.d.ts.map +1 -1
  144. package/dist/utils/index.js.map +1 -1
  145. package/package.json +8 -4
  146. package/src/auth-options.ts +0 -2
  147. package/src/client/adapter-utils.ts +80 -73
  148. package/src/client/adapter.test.ts +2 -74
  149. package/src/client/adapter.ts +142 -7
  150. package/src/client/create-api.ts +1 -0
  151. package/src/client/create-client.ts +14 -6
  152. package/src/client/create-schema.ts +0 -1
  153. package/src/component/_generated/api.ts +12 -0
  154. package/src/component/_generated/component.ts +19454 -215
  155. package/src/component/adapterTest.ts +250 -466
  156. package/src/component/schema.ts +21 -26
  157. package/src/component/testProfiles/adapterAdditionalFields.ts +13 -0
  158. package/src/component/testProfiles/adapterOrganizationJoins.ts +13 -0
  159. package/src/component/testProfiles/adapterPluginTable.ts +13 -0
  160. package/src/component/testProfiles/adapterRenameField.ts +13 -0
  161. package/src/component/testProfiles/adapterRenameUserCustom.ts +13 -0
  162. package/src/component/testProfiles/adapterRenameUserTable.ts +13 -0
  163. package/src/component/testProfiles/auth-options.profile-additional-fields.ts +39 -0
  164. package/src/component/testProfiles/auth-options.profile-plugin-table.ts +93 -0
  165. package/src/component/testProfiles/auth-options.profile-rename-joins.ts +54 -0
  166. package/src/component/testProfiles/schema.profile-additional-fields.ts +39 -0
  167. package/src/component/testProfiles/schema.profile-plugin-table.ts +130 -0
  168. package/src/nextjs/index.ts +1 -0
  169. package/src/plugins/convex/index.test.ts +55 -0
  170. package/src/plugins/convex/index.ts +26 -11
  171. package/src/plugins/cross-domain/index.test.ts +67 -0
  172. package/src/plugins/cross-domain/index.ts +10 -21
  173. package/src/react-start/index.ts +1 -0
  174. package/src/test/adapter-factory/auth-flow.ts +170 -0
  175. package/src/test/adapter-factory/basic.ts +3190 -0
  176. package/src/test/adapter-factory/convex-custom.ts +706 -0
  177. package/src/test/adapter-factory/index.ts +10 -0
  178. package/src/test/adapter-factory/joins.ts +28 -0
  179. package/src/test/adapter-factory/number-id.ts +45 -0
  180. package/src/test/adapter-factory/profile-additional-fields.ts +84 -0
  181. package/src/test/adapter-factory/profile-plugin-table.ts +37 -0
  182. package/src/test/adapter-factory/profile-rename-joins.ts +67 -0
  183. package/src/test/adapter-factory/transactions.ts +38 -0
  184. package/src/test/adapter-factory/uuid.ts +67 -0
  185. package/src/utils/index.ts +25 -3
@@ -0,0 +1,42 @@
1
+ import { createTestSuite } from "@better-auth/test-utils/adapter";
2
+ export declare const AUTH_FLOW_DEFAULT_BETTER_AUTH_OPTIONS: {
3
+ emailAndPassword: {
4
+ enabled: boolean;
5
+ password: {
6
+ hash: (password: string) => Promise<string>;
7
+ verify(data: {
8
+ hash: string;
9
+ password: string;
10
+ }): Promise<boolean>;
11
+ };
12
+ };
13
+ };
14
+ export declare const getAuthFlowSuiteTests: ({ generate, getAuth, modifyBetterAuthOptions, tryCatch, }: Parameters<Parameters<typeof createTestSuite>[2]>[0]) => {
15
+ "should successfully sign up": () => Promise<void>;
16
+ "should successfully sign in": () => Promise<void>;
17
+ "should successfully get session": () => Promise<void>;
18
+ "should not sign in with invalid email": () => Promise<void>;
19
+ "should store and retrieve timestamps correctly across timezones": () => Promise<void>;
20
+ "should sign up with additional fields": () => Promise<void>;
21
+ };
22
+ /**
23
+ * This test suite tests basic authentication flow using the adapter.
24
+ */
25
+ export declare const authFlowTestSuite: (options?: {
26
+ disableTests?: Partial<Record<"should successfully sign up" | "should successfully sign in" | "should successfully get session" | "should not sign in with invalid email" | "should store and retrieve timestamps correctly across timezones" | "should sign up with additional fields", boolean> & {
27
+ ALL?: boolean;
28
+ }> | undefined;
29
+ } | undefined) => (helpers: {
30
+ adapter: () => Promise<import("better-auth").DBAdapter<import("better-auth").BetterAuthOptions>>;
31
+ log: import("@better-auth/test-utils/adapter").Logger;
32
+ adapterDisplayName: string;
33
+ getBetterAuthOptions: () => import("better-auth").BetterAuthOptions;
34
+ modifyBetterAuthOptions: (options: import("better-auth").BetterAuthOptions) => Promise<import("better-auth").BetterAuthOptions>;
35
+ cleanup: () => Promise<void>;
36
+ runMigrations: () => Promise<void>;
37
+ prefixTests?: string | undefined;
38
+ onTestFinish: (stats: import("@better-auth/test-utils/adapter").TestSuiteStats) => Promise<void>;
39
+ customIdGenerator?: () => any | Promise<any> | undefined;
40
+ transformIdOutput?: (id: any) => string | undefined;
41
+ }) => Promise<void>;
42
+ //# sourceMappingURL=auth-flow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-flow.d.ts","sourceRoot":"","sources":["../../../src/test/adapter-factory/auth-flow.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAIlE,eAAO,MAAM,qCAAqC;;;;6BAIxB,MAAM;yBACV;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,QAAQ,EAAE,MAAM,CAAA;aAAE;;;CAKvD,CAAC;AAEF,eAAO,MAAM,qBAAqB,GACjC,2DAKG,UAAU,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;;;CA8HtD,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;eAGjB,CAAC;;qBAE4B,CAAC;qBAIrB,CAAC;mBAHtB,CAAC"}
@@ -0,0 +1,145 @@
1
+ import { createTestSuite } from "@better-auth/test-utils/adapter";
2
+ import { setCookieToHeader } from "better-auth/cookies";
3
+ import { expect } from "vitest";
4
+ export const AUTH_FLOW_DEFAULT_BETTER_AUTH_OPTIONS = {
5
+ emailAndPassword: {
6
+ enabled: true,
7
+ password: {
8
+ hash: async (password) => password,
9
+ async verify(data) {
10
+ return data.hash === data.password;
11
+ },
12
+ },
13
+ },
14
+ };
15
+ export const getAuthFlowSuiteTests = ({ generate, getAuth, modifyBetterAuthOptions, tryCatch, }) => ({
16
+ "should successfully sign up": async () => {
17
+ const auth = await getAuth();
18
+ const user = await generate("user");
19
+ const result = await auth.api.signUpEmail({
20
+ body: {
21
+ email: user.email,
22
+ password: crypto.randomUUID(),
23
+ name: user.name,
24
+ image: user.image || "",
25
+ },
26
+ });
27
+ expect(result.user).toBeDefined();
28
+ expect(result.user.email).toBe(user.email);
29
+ expect(result.user.name).toBe(user.name);
30
+ expect(result.user.image).toBe(user.image || "");
31
+ expect(result.user.emailVerified).toBe(false);
32
+ expect(result.user.createdAt).toBeDefined();
33
+ expect(result.user.updatedAt).toBeDefined();
34
+ },
35
+ "should successfully sign in": async () => {
36
+ const auth = await getAuth();
37
+ const user = await generate("user");
38
+ const password = crypto.randomUUID();
39
+ const signUpResult = await auth.api.signUpEmail({
40
+ body: {
41
+ email: user.email,
42
+ password: password,
43
+ name: user.name,
44
+ image: user.image || "",
45
+ },
46
+ });
47
+ const result = await auth.api.signInEmail({
48
+ body: { email: user.email, password: password },
49
+ });
50
+ expect(result.user).toBeDefined();
51
+ expect(result.user.id).toBe(signUpResult.user.id);
52
+ },
53
+ "should successfully get session": async () => {
54
+ const auth = await getAuth();
55
+ const user = await generate("user");
56
+ const password = crypto.randomUUID();
57
+ const response = await auth.api.signUpEmail({
58
+ body: {
59
+ email: user.email,
60
+ password: password,
61
+ name: user.name,
62
+ image: user.image || "",
63
+ },
64
+ asResponse: true,
65
+ });
66
+ const headers = new Headers();
67
+ setCookieToHeader(headers)({ response });
68
+ const result = await auth.api.getSession({
69
+ headers,
70
+ });
71
+ const signUpResult = (await response.json());
72
+ signUpResult.user.createdAt = new Date(signUpResult.user.createdAt);
73
+ signUpResult.user.updatedAt = new Date(signUpResult.user.updatedAt);
74
+ expect(result?.user).toBeDefined();
75
+ expect(result?.user).toStrictEqual(signUpResult.user);
76
+ expect(result?.session).toBeDefined();
77
+ },
78
+ "should not sign in with invalid email": async () => {
79
+ const auth = await getAuth();
80
+ const user = await generate("user");
81
+ const { data, error } = await tryCatch(auth.api.signInEmail({
82
+ body: { email: user.email, password: crypto.randomUUID() },
83
+ }));
84
+ expect(data).toBeNull();
85
+ expect(error).toBeDefined();
86
+ },
87
+ "should store and retrieve timestamps correctly across timezones": async () => {
88
+ using _ = recoverProcessTZ();
89
+ const auth = await getAuth();
90
+ const user = await generate("user");
91
+ const password = crypto.randomUUID();
92
+ const userSignUp = await auth.api.signUpEmail({
93
+ body: {
94
+ email: user.email,
95
+ password: password,
96
+ name: user.name,
97
+ image: user.image || "",
98
+ },
99
+ });
100
+ process.env.TZ = "Europe/London";
101
+ const userSignIn = await auth.api.signInEmail({
102
+ body: { email: user.email, password: password },
103
+ });
104
+ process.env.TZ = "America/Los_Angeles";
105
+ expect(userSignUp.user.createdAt.toISOString()).toStrictEqual(userSignIn.user.createdAt.toISOString());
106
+ },
107
+ "should sign up with additional fields": async () => {
108
+ await modifyBetterAuthOptions({ user: { additionalFields: { dateField: { type: "date" } } } }, true);
109
+ const auth = await getAuth();
110
+ const user = await generate("user");
111
+ const dateField = new Date();
112
+ const response = await auth.api.signUpEmail({
113
+ body: {
114
+ email: user.email,
115
+ name: user.name,
116
+ password: crypto.randomUUID(),
117
+ //@ts-expect-error - we are testing with additional fields
118
+ dateField: dateField.toISOString(), // using iso string to simulate client to server communication (this should be converted back to Date)
119
+ },
120
+ asResponse: true,
121
+ });
122
+ const headers = new Headers();
123
+ setCookieToHeader(headers)({ response });
124
+ const result = await auth.api.getSession({
125
+ headers,
126
+ });
127
+ //@ts-expect-error - we are testing with additional fields
128
+ expect(result?.user.dateField).toStrictEqual(dateField);
129
+ },
130
+ });
131
+ /**
132
+ * This test suite tests basic authentication flow using the adapter.
133
+ */
134
+ export const authFlowTestSuite = createTestSuite("auth-flow", {
135
+ defaultBetterAuthOptions: AUTH_FLOW_DEFAULT_BETTER_AUTH_OPTIONS,
136
+ }, (helpers) => getAuthFlowSuiteTests(helpers));
137
+ function recoverProcessTZ() {
138
+ const originalTZ = process.env.TZ;
139
+ return {
140
+ [Symbol.dispose]: () => {
141
+ process.env.TZ = originalTZ;
142
+ },
143
+ };
144
+ }
145
+ //# sourceMappingURL=auth-flow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-flow.js","sourceRoot":"","sources":["../../../src/test/adapter-factory/auth-flow.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACpD,gBAAgB,EAAE;QACjB,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE;YACT,IAAI,EAAE,KAAK,EAAE,QAAgB,EAAE,EAAE,CAAC,QAAQ;YAC1C,KAAK,CAAC,MAAM,CAAC,IAAwC;gBACpD,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,QAAQ,CAAC;YACpC,CAAC;SACD;KACD;CACD,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACpC,EACC,QAAQ,EACR,OAAO,EACP,uBAAuB,EACvB,QAAQ,GAC8C,EACtD,EAAE,CAAC,CAAC;IACL,6BAA6B,EAAE,KAAK,IAAI,EAAE;QACzC,MAAM,IAAI,GAAG,MAAM,OAAO,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG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B,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE,MAAM,CAAC,UAAU,EAAE;gBAC7B,0DAA0D;gBAC1D,SAAS,EAAE,SAAS,CAAC,WAAW,EAAE,EAAE,sGAAsG;aAC1I;YACD,UAAU,EAAE,IAAI;SAChB,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;QAC9B,iBAAiB,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC;YACxC,OAAO;SACP,CAAC,CAAC;QACH,0DAA0D;QAC1D,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC;CACD,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAC/C,WAAW,EACX;IACC,wBAAwB,EAAE,qCAAqC;CAC/D,EACD,CAAC,OAAO,EAAE,EAAE,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAC3C,CAAC;AAEF,SAAS,gBAAgB;IACxB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,OAAO;QACN,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE;YACtB,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,UAAU,CAAC;QAC7B,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,190 @@
1
+ import { createTestSuite } from "@better-auth/test-utils/adapter";
2
+ /**
3
+ * This test suite tests the basic CRUD operations of the adapter.
4
+ */
5
+ export declare const normalTestSuite: (options?: ({
6
+ disableTests?: Partial<Record<"create - should apply default values to fields" | "create - should return null for nullable foreign keys" | "create - should support arrays" | "create - should support json" | "create - should use generateId if provided" | "findMany - should be able to perform a complex limited join" | "findMany - should find many models with limit and offset" | "findMany - should find many models with offset" | "findMany - should find many models with sortBy and limit and offset" | "findMany - should find many models with sortBy and limit and offset and where" | "findMany - should find many models with sortBy and offset" | "findMany - should find many with both one-to-one and one-to-many joins" | "findMany - should find many with join and offset" | "findMany - should find many with join, where, limit, and offset" | "findMany - should find many with one-to-one join" | "findMany - should handle mixed joins correctly when some are missing" | "findMany - should return empty array when base records don't exist with joins" | "findMany - should return null for one-to-one join when joined records don't exist" | "findMany - should select fields with one-to-one join" | "findOne - backwards join with modified field name (session base, users-table join)" | "findOne - multiple joins should return result even when some joined tables have no matching rows" | "findOne - should find a model with modified field name" | "findOne - should find a model with modified model name" | "findOne - should join a model with modified field name" | "findOne - should not apply defaultValue if value not found" | "findOne - should return an object for one-to-one joins" | "findOne - should return null for failed base model lookup that has joins" | "findOne - should return null for one-to-one join when joined record doesn't exist" | "findOne - should select fields with one-to-one join" | "findOne - should work with both one-to-one and one-to-many joins" | "init - tests" | "create - should create a model" | "create - should always return an id" | "findOne - should find a model" | "findOne - should find a model using a reference field" | "findOne - should not throw on record not found" | "findOne - should find a model without id" | "findOne - should find a model with join" | "findOne - should find a model with additional fields" | "findOne - should select fields" | "findOne - should select fields with one-to-many join" | "findOne - should select fields with multiple joins" | "findOne - should find model with date field" | "findOne - should perform backwards joins" | "findOne - should return an array for one-to-many joins" | "findMany - should find many models" | "findMany - should find many models with date fields" | "findMany - should find many models with join" | "findMany - should find many with join and limit" | "findMany - should select fields" | "findMany - should select fields with one-to-many join" | "findMany - should select fields with multiple joins" | "findMany - should find many with join and sortBy" | "findMany - should find many with join and where clause" | "findMany - should return an empty array when no models are found" | "findMany - should find many models with starts_with operator" | "findMany - starts_with should not interpret regex patterns" | "findMany - ends_with should not interpret regex patterns" | "findMany - contains should not interpret regex patterns" | "findMany - should find many models with ends_with operator" | "findMany - should find many models with contains operator" | "findMany - should handle multiple where conditions with different operators" | "findMany - should find many models with contains operator (using symbol)" | "findMany - should find many models with eq operator" | "findMany - should find many models with ne operator" | "findMany - should find many models with gt operator" | "findMany - should find many models with gte operator" | "findMany - should find many models with lte operator" | "findMany - should find many models with lt operator" | "findMany - should find many models with in operator" | "findMany - should find many models with not_in operator" | "findMany - should find many models with sortBy" | "findMany - should find many models with limit" | "findMany - should find many models with sortBy and limit" | "update - should update a model" | "updateMany - should update all models when where is empty" | "updateMany - should update many models with a specific where" | "updateMany - should update many models with a multiple where" | "delete - should delete a model" | "delete - should not throw on record not found" | "delete - should delete by non-unique field" | "deleteMany - should delete many models" | "deleteMany - starts_with should not interpret regex patterns" | "deleteMany - ends_with should not interpret regex patterns" | "deleteMany - contains should not interpret regex patterns" | "deleteMany - should delete many models with numeric values" | "deleteMany - should delete many models with boolean values" | "count - should count many models" | "count - should return 0 with no rows to count" | "count - should count with where clause" | "update - should correctly return record when updating a field used in where clause" | "update - should handle updating multiple fields including where clause field" | "update - should work when updated field is not in where clause" | "findOne - backwards join should only return single record not array" | "findMany - backwards join should only return single record not array" | "findOne - should be able to perform a limited join" | "findOne - should be able to perform a complex limited join" | "findMany - should be able to perform a limited join" | "findMany - should return empty array for one-to-many join when joined records don't exist" | "update - should support multiple where conditions under AND connector with unique field", boolean> & {
7
+ ALL?: boolean;
8
+ }> | undefined;
9
+ } & {
10
+ showDB?: () => Promise<void>;
11
+ }) | undefined) => (helpers: {
12
+ adapter: () => Promise<import("better-auth").DBAdapter<import("better-auth").BetterAuthOptions>>;
13
+ log: import("@better-auth/test-utils/adapter").Logger;
14
+ adapterDisplayName: string;
15
+ getBetterAuthOptions: () => import("better-auth").BetterAuthOptions;
16
+ modifyBetterAuthOptions: (options: import("better-auth").BetterAuthOptions) => Promise<import("better-auth").BetterAuthOptions>;
17
+ cleanup: () => Promise<void>;
18
+ runMigrations: () => Promise<void>;
19
+ prefixTests?: string | undefined;
20
+ onTestFinish: (stats: import("@better-auth/test-utils/adapter").TestSuiteStats) => Promise<void>;
21
+ customIdGenerator?: () => any | Promise<any> | undefined;
22
+ transformIdOutput?: (id: any) => string | undefined;
23
+ }) => Promise<void>;
24
+ export declare const getNormalTestSuiteTests: ({ adapter, generate, insertRandom, modifyBetterAuthOptions, sortModels, customIdGenerator, getBetterAuthOptions, transformGeneratedModel, transformIdOutput, }: Parameters<Parameters<typeof createTestSuite>[2]>[0], debugTools?: {
25
+ showDB?: () => Promise<void>;
26
+ }) => {
27
+ "create - should create a model": () => Promise<void>;
28
+ "create - should always return an id": () => Promise<void>;
29
+ "create - should use generateId if provided": () => Promise<void>;
30
+ "create - should return null for nullable foreign keys": {
31
+ migrateBetterAuth: {
32
+ plugins: {
33
+ id: "nullable-test";
34
+ schema: {
35
+ testModel: {
36
+ fields: {
37
+ nullableReference: {
38
+ type: "string";
39
+ references: {
40
+ field: string;
41
+ model: string;
42
+ };
43
+ required: false;
44
+ };
45
+ };
46
+ };
47
+ };
48
+ }[];
49
+ };
50
+ test: () => Promise<void>;
51
+ };
52
+ "create - should apply default values to fields": () => Promise<void>;
53
+ "findOne - should find a model": () => Promise<void>;
54
+ "findOne - should not apply defaultValue if value not found": () => Promise<void>;
55
+ "findOne - should find a model using a reference field": () => Promise<void>;
56
+ "findOne - should not throw on record not found": () => Promise<void>;
57
+ "findOne - should find a model without id": () => Promise<void>;
58
+ "findOne - should find a model with join": () => Promise<void>;
59
+ "findOne - should find a model with modified field name": () => Promise<void>;
60
+ "findOne - should find a model with modified model name": () => Promise<void>;
61
+ "findOne - should find a model with additional fields": () => Promise<void>;
62
+ "findOne - should select fields": () => Promise<void>;
63
+ "findOne - should select fields with one-to-many join": () => Promise<void>;
64
+ "findOne - should select fields with one-to-one join": () => Promise<void>;
65
+ "findOne - should select fields with multiple joins": () => Promise<void>;
66
+ "findOne - should find model with date field": () => Promise<void>;
67
+ "findOne - should perform backwards joins": () => Promise<void>;
68
+ "findOne - should return an object for one-to-one joins": () => Promise<void>;
69
+ "findOne - should return an array for one-to-many joins": () => Promise<void>;
70
+ "findOne - should work with both one-to-one and one-to-many joins": () => Promise<void>;
71
+ "findOne - should return null for failed base model lookup that has joins": () => Promise<void>;
72
+ "findOne - should join a model with modified field name": () => Promise<void>;
73
+ "findMany - should find many models": () => Promise<void>;
74
+ "findMany - should find many models with date fields": () => Promise<void>;
75
+ "findMany - should find many models with join": () => Promise<void>;
76
+ "findMany - should find many with join and limit": () => Promise<void>;
77
+ "findMany - should select fields": () => Promise<void>;
78
+ "findMany - should select fields with one-to-many join": () => Promise<void>;
79
+ "findMany - should select fields with one-to-one join": () => Promise<void>;
80
+ "findMany - should select fields with multiple joins": () => Promise<void>;
81
+ "findMany - should find many with join and offset": () => Promise<void>;
82
+ "findMany - should find many with join and sortBy": () => Promise<void>;
83
+ "findMany - should find many with join and where clause": () => Promise<void>;
84
+ "findMany - should find many with join, where, limit, and offset": () => Promise<void>;
85
+ "findMany - should find many with one-to-one join": () => Promise<void>;
86
+ "findMany - should find many with both one-to-one and one-to-many joins": () => Promise<void>;
87
+ "findMany - should return an empty array when no models are found": () => Promise<void>;
88
+ "findMany - should return empty array when base records don't exist with joins": () => Promise<void>;
89
+ "findMany - should find many models with starts_with operator": () => Promise<void>;
90
+ "findMany - starts_with should not interpret regex patterns": () => Promise<void>;
91
+ "findMany - ends_with should not interpret regex patterns": () => Promise<void>;
92
+ "findMany - contains should not interpret regex patterns": () => Promise<void>;
93
+ "findMany - should find many models with ends_with operator": () => Promise<void>;
94
+ "findMany - should find many models with contains operator": () => Promise<void>;
95
+ "findMany - should handle multiple where conditions with different operators": () => Promise<void>;
96
+ "findMany - should find many models with contains operator (using symbol)": () => Promise<void>;
97
+ "findMany - should find many models with eq operator": () => Promise<void>;
98
+ "findMany - should find many models with ne operator": () => Promise<void>;
99
+ "findMany - should find many models with gt operator": () => Promise<void>;
100
+ "findMany - should find many models with gte operator": () => Promise<void>;
101
+ "findMany - should find many models with lte operator": () => Promise<void>;
102
+ "findMany - should find many models with lt operator": () => Promise<void>;
103
+ "findMany - should find many models with in operator": () => Promise<void>;
104
+ "findMany - should find many models with not_in operator": () => Promise<void>;
105
+ "findMany - should find many models with sortBy": () => Promise<void>;
106
+ "findMany - should find many models with limit": () => Promise<void>;
107
+ "findMany - should find many models with offset": () => Promise<void>;
108
+ "findMany - should find many models with limit and offset": () => Promise<void>;
109
+ "findMany - should find many models with sortBy and offset": () => Promise<void>;
110
+ "findMany - should find many models with sortBy and limit": () => Promise<void>;
111
+ "findMany - should find many models with sortBy and limit and offset": () => Promise<void>;
112
+ "findMany - should find many models with sortBy and limit and offset and where": () => Promise<void>;
113
+ "update - should update a model": () => Promise<void>;
114
+ "updateMany - should update all models when where is empty": () => Promise<void>;
115
+ "updateMany - should update many models with a specific where": () => Promise<void>;
116
+ "updateMany - should update many models with a multiple where": () => Promise<void>;
117
+ "delete - should delete a model": () => Promise<void>;
118
+ "delete - should not throw on record not found": () => Promise<void>;
119
+ /**
120
+ * @see https://github.com/better-auth/better-auth/issues/8313
121
+ */
122
+ "delete - should delete by non-unique field": () => Promise<void>;
123
+ "deleteMany - should delete many models": () => Promise<void>;
124
+ "deleteMany - starts_with should not interpret regex patterns": () => Promise<void>;
125
+ "deleteMany - ends_with should not interpret regex patterns": () => Promise<void>;
126
+ "deleteMany - contains should not interpret regex patterns": () => Promise<void>;
127
+ "deleteMany - should delete many models with numeric values": () => Promise<void>;
128
+ "deleteMany - should delete many models with boolean values": () => Promise<void>;
129
+ "count - should count many models": () => Promise<void>;
130
+ "count - should return 0 with no rows to count": () => Promise<void>;
131
+ "count - should count with where clause": () => Promise<void>;
132
+ "update - should correctly return record when updating a field used in where clause": () => Promise<void>;
133
+ "update - should handle updating multiple fields including where clause field": () => Promise<void>;
134
+ "update - should work when updated field is not in where clause": () => Promise<void>;
135
+ "findOne - backwards join should only return single record not array": () => Promise<void>;
136
+ "findMany - backwards join should only return single record not array": () => Promise<void>;
137
+ "findOne - backwards join with modified field name (session base, users-table join)": () => Promise<void>;
138
+ "findOne - multiple joins should return result even when some joined tables have no matching rows": () => Promise<void>;
139
+ "findOne - should be able to perform a limited join": () => Promise<void>;
140
+ "findOne - should be able to perform a complex limited join": () => Promise<void>;
141
+ "findMany - should be able to perform a limited join": () => Promise<void>;
142
+ "findMany - should be able to perform a complex limited join": () => Promise<void>;
143
+ "findOne - should return null for one-to-one join when joined record doesn't exist": () => Promise<void>;
144
+ "findMany - should return null for one-to-one join when joined records don't exist": () => Promise<void>;
145
+ "findMany - should return empty array for one-to-many join when joined records don't exist": () => Promise<void>;
146
+ "findMany - should handle mixed joins correctly when some are missing": () => Promise<void>;
147
+ "create - should support arrays": {
148
+ migrateBetterAuth: {
149
+ plugins: {
150
+ id: "string-arrays-test";
151
+ schema: {
152
+ testModel: {
153
+ fields: {
154
+ stringArray: {
155
+ type: "string[]";
156
+ required: true;
157
+ };
158
+ numberArray: {
159
+ type: "number[]";
160
+ required: true;
161
+ };
162
+ };
163
+ };
164
+ };
165
+ }[];
166
+ };
167
+ test: () => Promise<void>;
168
+ };
169
+ "create - should support json": {
170
+ migrateBetterAuth: {
171
+ plugins: {
172
+ id: "json-test";
173
+ schema: {
174
+ testModel: {
175
+ fields: {
176
+ json: {
177
+ type: "json";
178
+ required: true;
179
+ };
180
+ };
181
+ };
182
+ };
183
+ }[];
184
+ };
185
+ test: () => Promise<void>;
186
+ };
187
+ "update - should support multiple where conditions under AND connector with unique field": () => Promise<void>;
188
+ };
189
+ export declare const enableJoinTests: Partial<Record<"create - should apply default values to fields" | "create - should return null for nullable foreign keys" | "create - should support arrays" | "create - should support json" | "create - should use generateId if provided" | "findMany - should be able to perform a complex limited join" | "findMany - should find many models with limit and offset" | "findMany - should find many models with offset" | "findMany - should find many models with sortBy and limit and offset" | "findMany - should find many models with sortBy and limit and offset and where" | "findMany - should find many models with sortBy and offset" | "findMany - should find many with both one-to-one and one-to-many joins" | "findMany - should find many with join and offset" | "findMany - should find many with join, where, limit, and offset" | "findMany - should find many with one-to-one join" | "findMany - should handle mixed joins correctly when some are missing" | "findMany - should return empty array when base records don't exist with joins" | "findMany - should return null for one-to-one join when joined records don't exist" | "findMany - should select fields with one-to-one join" | "findOne - backwards join with modified field name (session base, users-table join)" | "findOne - multiple joins should return result even when some joined tables have no matching rows" | "findOne - should find a model with modified field name" | "findOne - should find a model with modified model name" | "findOne - should join a model with modified field name" | "findOne - should not apply defaultValue if value not found" | "findOne - should return an object for one-to-one joins" | "findOne - should return null for failed base model lookup that has joins" | "findOne - should return null for one-to-one join when joined record doesn't exist" | "findOne - should select fields with one-to-one join" | "findOne - should work with both one-to-one and one-to-many joins" | "create - should create a model" | "create - should always return an id" | "findOne - should find a model" | "findOne - should find a model using a reference field" | "findOne - should not throw on record not found" | "findOne - should find a model without id" | "findOne - should find a model with join" | "findOne - should find a model with additional fields" | "findOne - should select fields" | "findOne - should select fields with one-to-many join" | "findOne - should select fields with multiple joins" | "findOne - should find model with date field" | "findOne - should perform backwards joins" | "findOne - should return an array for one-to-many joins" | "findMany - should find many models" | "findMany - should find many models with date fields" | "findMany - should find many models with join" | "findMany - should find many with join and limit" | "findMany - should select fields" | "findMany - should select fields with one-to-many join" | "findMany - should select fields with multiple joins" | "findMany - should find many with join and sortBy" | "findMany - should find many with join and where clause" | "findMany - should return an empty array when no models are found" | "findMany - should find many models with starts_with operator" | "findMany - starts_with should not interpret regex patterns" | "findMany - ends_with should not interpret regex patterns" | "findMany - contains should not interpret regex patterns" | "findMany - should find many models with ends_with operator" | "findMany - should find many models with contains operator" | "findMany - should handle multiple where conditions with different operators" | "findMany - should find many models with contains operator (using symbol)" | "findMany - should find many models with eq operator" | "findMany - should find many models with ne operator" | "findMany - should find many models with gt operator" | "findMany - should find many models with gte operator" | "findMany - should find many models with lte operator" | "findMany - should find many models with lt operator" | "findMany - should find many models with in operator" | "findMany - should find many models with not_in operator" | "findMany - should find many models with sortBy" | "findMany - should find many models with limit" | "findMany - should find many models with sortBy and limit" | "update - should update a model" | "updateMany - should update all models when where is empty" | "updateMany - should update many models with a specific where" | "updateMany - should update many models with a multiple where" | "delete - should delete a model" | "delete - should not throw on record not found" | "delete - should delete by non-unique field" | "deleteMany - should delete many models" | "deleteMany - starts_with should not interpret regex patterns" | "deleteMany - ends_with should not interpret regex patterns" | "deleteMany - contains should not interpret regex patterns" | "deleteMany - should delete many models with numeric values" | "deleteMany - should delete many models with boolean values" | "count - should count many models" | "count - should return 0 with no rows to count" | "count - should count with where clause" | "update - should correctly return record when updating a field used in where clause" | "update - should handle updating multiple fields including where clause field" | "update - should work when updated field is not in where clause" | "findOne - backwards join should only return single record not array" | "findMany - backwards join should only return single record not array" | "findOne - should be able to perform a limited join" | "findOne - should be able to perform a complex limited join" | "findMany - should be able to perform a limited join" | "findMany - should return empty array for one-to-many join when joined records don't exist" | "update - should support multiple where conditions under AND connector with unique field", boolean>>;
190
+ //# sourceMappingURL=basic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../../src/test/adapter-factory/basic.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAUlE;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;aAGO,MAAM,OAAO,CAAC,IAAI,CAAC;;;;;;;;;eAwK7C,CAAA;;qBAIH,CAAC;qBAGJ,CAAD;mBArKD,CAAC;AAEF,eAAO,MAAM,uBAAuB,GACnC,gKAUG,UAAU,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACvD,aAAa;IAAE,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqkE5C;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAm/BJ,CAAC;AAOF,eAAO,MAAM,eAAe,gwLAKV,CAAC"}