@geekmidas/testkit 10.0.0-alpha.98 → 10.0.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.
- package/CHANGELOG.md +160 -0
- package/README.md +0 -74
- package/dist/Factory-BFVnMMCC.mjs +51 -0
- package/dist/Factory-BFVnMMCC.mjs.map +1 -0
- package/dist/Factory-BOX312yd.d.cts +147 -0
- package/dist/Factory-BOX312yd.d.cts.map +1 -0
- package/dist/Factory-BhjUOBWN.cjs +57 -0
- package/dist/Factory-BhjUOBWN.cjs.map +1 -0
- package/dist/Factory-SFupxRC2.d.mts +147 -0
- package/dist/Factory-SFupxRC2.d.mts.map +1 -0
- package/dist/Factory.cjs +2 -51
- package/dist/Factory.d.cts +3 -143
- package/dist/Factory.d.mts +3 -143
- package/dist/Factory.mjs +2 -50
- package/dist/KyselyFactory-BFqVIn_0.cjs +246 -0
- package/dist/KyselyFactory-BFqVIn_0.cjs.map +1 -0
- package/dist/KyselyFactory-DMswpwji.mjs +241 -0
- package/dist/KyselyFactory-DMswpwji.mjs.map +1 -0
- package/dist/KyselyFactory-Dy5zzV4B.d.cts +228 -0
- package/dist/KyselyFactory-Dy5zzV4B.d.cts.map +1 -0
- package/dist/KyselyFactory-vAxYodck.d.mts +228 -0
- package/dist/KyselyFactory-vAxYodck.d.mts.map +1 -0
- package/dist/KyselyFactory.cjs +4 -237
- package/dist/KyselyFactory.d.cts +4 -224
- package/dist/KyselyFactory.d.mts +4 -224
- package/dist/KyselyFactory.mjs +4 -236
- package/dist/ObjectionFactory-BWjB49-i.d.mts +241 -0
- package/dist/ObjectionFactory-BWjB49-i.d.mts.map +1 -0
- package/dist/ObjectionFactory-BeFBYcan.cjs +272 -0
- package/dist/ObjectionFactory-BeFBYcan.cjs.map +1 -0
- package/dist/ObjectionFactory-CD-WFuMJ.d.cts +241 -0
- package/dist/ObjectionFactory-CD-WFuMJ.d.cts.map +1 -0
- package/dist/ObjectionFactory-QCJ7u0Ql.mjs +267 -0
- package/dist/ObjectionFactory-QCJ7u0Ql.mjs.map +1 -0
- package/dist/ObjectionFactory.cjs +4 -265
- package/dist/ObjectionFactory.d.cts +4 -237
- package/dist/ObjectionFactory.d.mts +4 -237
- package/dist/ObjectionFactory.mjs +4 -264
- package/dist/PostgresKyselyMigrator-B2M6Gjvv.d.cts +84 -0
- package/dist/PostgresKyselyMigrator-B2M6Gjvv.d.cts.map +1 -0
- package/dist/PostgresKyselyMigrator-BGBxjnFv.cjs +101 -0
- package/dist/PostgresKyselyMigrator-BGBxjnFv.cjs.map +1 -0
- package/dist/PostgresKyselyMigrator-CvwXycJE.d.mts +84 -0
- package/dist/PostgresKyselyMigrator-CvwXycJE.d.mts.map +1 -0
- package/dist/PostgresKyselyMigrator-PI0QhvB1.mjs +95 -0
- package/dist/PostgresKyselyMigrator-PI0QhvB1.mjs.map +1 -0
- package/dist/PostgresKyselyMigrator.cjs +3 -94
- package/dist/PostgresKyselyMigrator.d.cts +3 -80
- package/dist/PostgresKyselyMigrator.d.mts +3 -80
- package/dist/PostgresKyselyMigrator.mjs +3 -93
- package/dist/{PostgresMigrator-CDPnnwMJ.d.cts → PostgresMigrator-C_QQ6q35.d.mts} +5 -11
- package/dist/PostgresMigrator-C_QQ6q35.d.mts.map +1 -0
- package/dist/{PostgresMigrator-CDPnnwMJ.d.mts → PostgresMigrator-CeYy-eHF.d.cts} +5 -11
- package/dist/PostgresMigrator-CeYy-eHF.d.cts.map +1 -0
- package/dist/PostgresMigrator-DVAY04qN.mjs +166 -0
- package/dist/PostgresMigrator-DVAY04qN.mjs.map +1 -0
- package/dist/PostgresMigrator-M9jpzOvN.cjs +172 -0
- package/dist/PostgresMigrator-M9jpzOvN.cjs.map +1 -0
- package/dist/PostgresMigrator.cjs +2 -178
- package/dist/PostgresMigrator.d.cts +1 -1
- package/dist/PostgresMigrator.d.mts +1 -1
- package/dist/PostgresMigrator.mjs +2 -175
- package/dist/PostgresObjectionMigrator-1j6YIB1c.d.mts +79 -0
- package/dist/PostgresObjectionMigrator-1j6YIB1c.d.mts.map +1 -0
- package/dist/PostgresObjectionMigrator-DHVC9h_P.d.cts +79 -0
- package/dist/PostgresObjectionMigrator-DHVC9h_P.d.cts.map +1 -0
- package/dist/PostgresObjectionMigrator-DSaPhwjY.cjs +123 -0
- package/dist/PostgresObjectionMigrator-DSaPhwjY.cjs.map +1 -0
- package/dist/PostgresObjectionMigrator-DjPKdUbm.mjs +118 -0
- package/dist/PostgresObjectionMigrator-DjPKdUbm.mjs.map +1 -0
- package/dist/PostgresObjectionMigrator.cjs +3 -118
- package/dist/PostgresObjectionMigrator.d.cts +3 -75
- package/dist/PostgresObjectionMigrator.d.mts +3 -75
- package/dist/PostgresObjectionMigrator.mjs +3 -117
- package/dist/VitestKyselyTransactionIsolator-0CqOsuc9.cjs +65 -0
- package/dist/VitestKyselyTransactionIsolator-0CqOsuc9.cjs.map +1 -0
- package/dist/VitestKyselyTransactionIsolator-CduJlHoT.d.cts +59 -0
- package/dist/VitestKyselyTransactionIsolator-CduJlHoT.d.cts.map +1 -0
- package/dist/VitestKyselyTransactionIsolator-CfSMOFlN.mjs +60 -0
- package/dist/VitestKyselyTransactionIsolator-CfSMOFlN.mjs.map +1 -0
- package/dist/VitestKyselyTransactionIsolator-Cswnnj0k.d.mts +59 -0
- package/dist/VitestKyselyTransactionIsolator-Cswnnj0k.d.mts.map +1 -0
- package/dist/VitestKyselyTransactionIsolator.cjs +3 -66
- package/dist/VitestKyselyTransactionIsolator.d.cts +3 -60
- package/dist/VitestKyselyTransactionIsolator.d.mts +3 -60
- package/dist/VitestKyselyTransactionIsolator.mjs +3 -65
- package/dist/VitestObjectionTransactionIsolator-B5J9jjKq.cjs +68 -0
- package/dist/VitestObjectionTransactionIsolator-B5J9jjKq.cjs.map +1 -0
- package/dist/VitestObjectionTransactionIsolator-BXoR6xdG.d.cts +60 -0
- package/dist/VitestObjectionTransactionIsolator-BXoR6xdG.d.cts.map +1 -0
- package/dist/VitestObjectionTransactionIsolator-CNo40EdC.mjs +63 -0
- package/dist/VitestObjectionTransactionIsolator-CNo40EdC.mjs.map +1 -0
- package/dist/VitestObjectionTransactionIsolator-x6hY5j4u.d.mts +60 -0
- package/dist/VitestObjectionTransactionIsolator-x6hY5j4u.d.mts.map +1 -0
- package/dist/VitestObjectionTransactionIsolator.cjs +3 -62
- package/dist/VitestObjectionTransactionIsolator.d.cts +3 -56
- package/dist/VitestObjectionTransactionIsolator.d.mts +3 -56
- package/dist/VitestObjectionTransactionIsolator.mjs +3 -61
- package/dist/VitestTransactionIsolator-BNWJqh9f.d.mts +207 -0
- package/dist/VitestTransactionIsolator-BNWJqh9f.d.mts.map +1 -0
- package/dist/VitestTransactionIsolator-CSroc7Df.d.cts +207 -0
- package/dist/VitestTransactionIsolator-CSroc7Df.d.cts.map +1 -0
- package/dist/VitestTransactionIsolator-CtZaOUjH.cjs +193 -0
- package/dist/VitestTransactionIsolator-CtZaOUjH.cjs.map +1 -0
- package/dist/VitestTransactionIsolator-D6ZxLWys.mjs +175 -0
- package/dist/VitestTransactionIsolator-D6ZxLWys.mjs.map +1 -0
- package/dist/VitestTransactionIsolator.cjs +4 -187
- package/dist/VitestTransactionIsolator.d.cts +2 -219
- package/dist/VitestTransactionIsolator.d.mts +2 -219
- package/dist/VitestTransactionIsolator.mjs +2 -184
- package/dist/aws.cjs +4 -3
- package/dist/aws.cjs.map +1 -1
- package/dist/aws.d.cts +8 -3
- package/dist/aws.d.cts.map +1 -1
- package/dist/aws.d.mts +8 -3
- package/dist/aws.d.mts.map +1 -1
- package/dist/aws.mjs +2 -1
- package/dist/aws.mjs.map +1 -1
- package/dist/benchmark.cjs +2 -2
- package/dist/benchmark.cjs.map +1 -1
- package/dist/benchmark.d.cts +6 -4
- package/dist/benchmark.d.cts.map +1 -1
- package/dist/benchmark.d.mts +6 -4
- package/dist/benchmark.d.mts.map +1 -1
- package/dist/benchmark.mjs +1 -1
- package/dist/benchmark.mjs.map +1 -1
- package/dist/better-auth.cjs +15 -31
- package/dist/better-auth.cjs.map +1 -1
- package/dist/better-auth.d.cts +4 -13142
- package/dist/better-auth.d.cts.map +1 -1
- package/dist/better-auth.d.mts +4 -13142
- package/dist/better-auth.d.mts.map +1 -1
- package/dist/better-auth.mjs +13 -29
- package/dist/better-auth.mjs.map +1 -1
- package/dist/{rolldown-runtime-VH7oDXx4.cjs → chunk-CUT6urMc.cjs} +10 -8
- package/dist/directory-Bpz5c5pj.d.cts +13 -0
- package/dist/directory-Bpz5c5pj.d.cts.map +1 -0
- package/dist/directory-BxjqmtCT.mjs +27 -0
- package/dist/directory-BxjqmtCT.mjs.map +1 -0
- package/dist/directory-CVrfTq1I.d.mts +13 -0
- package/dist/directory-CVrfTq1I.d.mts.map +1 -0
- package/dist/directory-DD_xQoSh.cjs +33 -0
- package/dist/directory-DD_xQoSh.cjs.map +1 -0
- package/dist/faker-B14IEMIN.cjs +304 -0
- package/dist/faker-B14IEMIN.cjs.map +1 -0
- package/dist/faker-BGKYFoCT.mjs +262 -0
- package/dist/faker-BGKYFoCT.mjs.map +1 -0
- package/dist/faker-Cg76aFNO.d.cts +166 -0
- package/dist/faker-Cg76aFNO.d.cts.map +1 -0
- package/dist/faker-DHh7xs4u.d.mts +166 -0
- package/dist/faker-DHh7xs4u.d.mts.map +1 -0
- package/dist/faker.cjs +8 -313
- package/dist/faker.d.cts +2 -169
- package/dist/faker.d.mts +2 -169
- package/dist/faker.mjs +2 -305
- package/dist/helpers.cjs +5 -6
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +5 -1
- package/dist/helpers.d.cts.map +1 -1
- package/dist/helpers.d.mts +5 -1
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs +2 -1
- package/dist/helpers.mjs.map +1 -1
- package/dist/initScript.cjs +15 -15
- package/dist/initScript.cjs.map +1 -1
- package/dist/initScript.d.cts +4 -2
- package/dist/initScript.d.cts.map +1 -1
- package/dist/initScript.d.mts +4 -2
- package/dist/initScript.d.mts.map +1 -1
- package/dist/initScript.mjs +12 -10
- package/dist/initScript.mjs.map +1 -1
- package/dist/kysely.cjs +13 -10
- package/dist/kysely.cjs.map +1 -1
- package/dist/kysely.d.cts +14 -10
- package/dist/kysely.d.cts.map +1 -1
- package/dist/kysely.d.mts +14 -10
- package/dist/kysely.d.mts.map +1 -1
- package/dist/kysely.mjs +14 -10
- package/dist/kysely.mjs.map +1 -1
- package/dist/logger.cjs +4 -3
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.d.cts +5 -1
- package/dist/logger.d.cts.map +1 -1
- package/dist/logger.d.mts +5 -1
- package/dist/logger.d.mts.map +1 -1
- package/dist/logger.mjs +2 -1
- package/dist/logger.mjs.map +1 -1
- package/dist/objection.cjs +13 -10
- package/dist/objection.cjs.map +1 -1
- package/dist/objection.d.cts +14 -10
- package/dist/objection.d.cts.map +1 -1
- package/dist/objection.d.mts +14 -10
- package/dist/objection.d.mts.map +1 -1
- package/dist/objection.mjs +14 -10
- package/dist/objection.mjs.map +1 -1
- package/dist/os/directory.cjs +2 -31
- package/dist/os/directory.d.cts +2 -9
- package/dist/os/directory.d.mts +2 -9
- package/dist/os/directory.mjs +2 -25
- package/dist/os/index.cjs +3 -3
- package/dist/os/index.d.cts +1 -1
- package/dist/os/index.d.mts +1 -1
- package/dist/os/index.mjs +3 -2
- package/dist/requestContext.cjs +11 -10
- package/dist/requestContext.cjs.map +1 -1
- package/dist/requestContext.d.cts +9 -5
- package/dist/requestContext.d.cts.map +1 -1
- package/dist/requestContext.d.mts +9 -5
- package/dist/requestContext.d.mts.map +1 -1
- package/dist/requestContext.mjs +3 -2
- package/dist/requestContext.mjs.map +1 -1
- package/dist/timer.cjs +2 -2
- package/dist/timer.cjs.map +1 -1
- package/dist/timer.d.cts +4 -1
- package/dist/timer.d.cts.map +1 -1
- package/dist/timer.d.mts +4 -1
- package/dist/timer.d.mts.map +1 -1
- package/dist/timer.mjs +1 -1
- package/dist/timer.mjs.map +1 -1
- package/package.json +25 -65
- package/src/Factory.ts +174 -0
- package/src/KyselyFactory.ts +391 -0
- package/src/ObjectionFactory.ts +412 -0
- package/src/PostgresKyselyMigrator.ts +104 -0
- package/src/PostgresMigrator.ts +193 -0
- package/src/PostgresObjectionMigrator.ts +138 -0
- package/src/VitestKyselyTransactionIsolator.ts +72 -0
- package/src/VitestObjectionTransactionIsolator.ts +75 -0
- package/src/VitestTransactionIsolator.ts +348 -0
- package/src/__tests__/Factory.spec.ts +178 -0
- package/src/__tests__/KyselyFactory.spec.ts +458 -0
- package/src/__tests__/ObjectionFactory.spec.ts +586 -0
- package/src/__tests__/PostgresKyselyMigrator.spec.ts +794 -0
- package/src/__tests__/PostgresMigrator.spec.ts +471 -0
- package/src/__tests__/PostgresObjectionMigrator.spec.ts +634 -0
- package/src/__tests__/VitestObjectionTransactionIsolator.spec.ts +138 -0
- package/src/__tests__/benchmark.spec.ts +140 -0
- package/src/__tests__/better-auth.spec.ts +21 -0
- package/src/__tests__/faker.spec.ts +231 -0
- package/src/__tests__/initScript.spec.ts +332 -0
- package/src/__tests__/integration.spec.ts +610 -0
- package/src/__tests__/requestContext.spec.ts +113 -0
- package/src/__tests__/utilities.spec.ts +211 -0
- package/src/aws.ts +131 -0
- package/src/benchmark.ts +48 -0
- package/src/better-auth.ts +310 -0
- package/src/faker.ts +349 -0
- package/src/helpers.ts +45 -0
- package/src/initScript.ts +122 -0
- package/src/kysely.ts +166 -0
- package/src/logger.ts +18 -0
- package/src/objection.ts +157 -0
- package/src/os/directory.ts +26 -0
- package/src/os/index.ts +1 -0
- package/src/requestContext.ts +119 -0
- package/src/timer.ts +3 -0
- package/test/globalSetup.ts +54 -0
- package/test/helpers.ts +268 -0
- package/test/migrations/1749664623372_user.ts +22 -0
- package/tsconfig.json +9 -0
- package/vitest.config.ts +8 -0
- package/dist/Factory.cjs.map +0 -1
- package/dist/Factory.d.cts.map +0 -1
- package/dist/Factory.d.mts.map +0 -1
- package/dist/Factory.mjs.map +0 -1
- package/dist/KyselyFactory.cjs.map +0 -1
- package/dist/KyselyFactory.d.cts.map +0 -1
- package/dist/KyselyFactory.d.mts.map +0 -1
- package/dist/KyselyFactory.mjs.map +0 -1
- package/dist/ObjectionFactory.cjs.map +0 -1
- package/dist/ObjectionFactory.d.cts.map +0 -1
- package/dist/ObjectionFactory.d.mts.map +0 -1
- package/dist/ObjectionFactory.mjs.map +0 -1
- package/dist/PostgresKyselyMigrator.cjs.map +0 -1
- package/dist/PostgresKyselyMigrator.d.cts.map +0 -1
- package/dist/PostgresKyselyMigrator.d.mts.map +0 -1
- package/dist/PostgresKyselyMigrator.mjs.map +0 -1
- package/dist/PostgresMigrator-CDPnnwMJ.d.cts.map +0 -1
- package/dist/PostgresMigrator-CDPnnwMJ.d.mts.map +0 -1
- package/dist/PostgresMigrator.cjs.map +0 -1
- package/dist/PostgresMigrator.mjs.map +0 -1
- package/dist/PostgresObjectionMigrator.cjs.map +0 -1
- package/dist/PostgresObjectionMigrator.d.cts.map +0 -1
- package/dist/PostgresObjectionMigrator.d.mts.map +0 -1
- package/dist/PostgresObjectionMigrator.mjs.map +0 -1
- package/dist/VitestKyselyTransactionIsolator.cjs.map +0 -1
- package/dist/VitestKyselyTransactionIsolator.d.cts.map +0 -1
- package/dist/VitestKyselyTransactionIsolator.d.mts.map +0 -1
- package/dist/VitestKyselyTransactionIsolator.mjs.map +0 -1
- package/dist/VitestObjectionTransactionIsolator.cjs.map +0 -1
- package/dist/VitestObjectionTransactionIsolator.d.cts.map +0 -1
- package/dist/VitestObjectionTransactionIsolator.d.mts.map +0 -1
- package/dist/VitestObjectionTransactionIsolator.mjs.map +0 -1
- package/dist/VitestTransactionIsolator.cjs.map +0 -1
- package/dist/VitestTransactionIsolator.d.cts.map +0 -1
- package/dist/VitestTransactionIsolator.d.mts.map +0 -1
- package/dist/VitestTransactionIsolator.mjs.map +0 -1
- package/dist/browser.cjs +0 -149
- package/dist/browser.cjs.map +0 -1
- package/dist/browser.d.cts +0 -62
- package/dist/browser.d.cts.map +0 -1
- package/dist/browser.d.mts +0 -62
- package/dist/browser.d.mts.map +0 -1
- package/dist/browser.mjs +0 -147
- package/dist/browser.mjs.map +0 -1
- package/dist/context.cjs +0 -80
- package/dist/context.cjs.map +0 -1
- package/dist/context.d.cts +0 -55
- package/dist/context.d.cts.map +0 -1
- package/dist/context.d.mts +0 -55
- package/dist/context.d.mts.map +0 -1
- package/dist/context.mjs +0 -73
- package/dist/context.mjs.map +0 -1
- package/dist/faker.cjs.map +0 -1
- package/dist/faker.d.cts.map +0 -1
- package/dist/faker.d.mts.map +0 -1
- package/dist/faker.mjs.map +0 -1
- package/dist/mailbox.cjs +0 -95
- package/dist/mailbox.cjs.map +0 -1
- package/dist/mailbox.d.cts +0 -58
- package/dist/mailbox.d.cts.map +0 -1
- package/dist/mailbox.d.mts +0 -58
- package/dist/mailbox.d.mts.map +0 -1
- package/dist/mailbox.mjs +0 -92
- package/dist/mailbox.mjs.map +0 -1
- package/dist/os/directory.cjs.map +0 -1
- package/dist/os/directory.d.cts.map +0 -1
- package/dist/os/directory.d.mts.map +0 -1
- package/dist/os/directory.mjs.map +0 -1
- package/dist/transactions.cjs +0 -239
- package/dist/transactions.cjs.map +0 -1
- package/dist/transactions.d.cts +0 -44
- package/dist/transactions.d.cts.map +0 -1
- package/dist/transactions.d.mts +0 -44
- package/dist/transactions.d.mts.map +0 -1
- package/dist/transactions.mjs +0 -234
- package/dist/transactions.mjs.map +0 -1
package/dist/benchmark.d.mts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @param count - Number of records to generate
|
|
6
6
|
* @returns Array of test data objects
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
declare function generateTestData(count: number): Array<{
|
|
9
9
|
id: string;
|
|
10
10
|
name: string;
|
|
11
11
|
value: number;
|
|
@@ -17,7 +17,7 @@ export declare function generateTestData(count: number): Array<{
|
|
|
17
17
|
* @param count - Number of keys to generate
|
|
18
18
|
* @returns Array of unique cache keys
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
declare function generateCacheKeys(prefix: string, count: number): string[];
|
|
21
21
|
/**
|
|
22
22
|
* Generates IP addresses for rate limit benchmarks.
|
|
23
23
|
*
|
|
@@ -25,10 +25,12 @@ export declare function generateCacheKeys(prefix: string, count: number): string
|
|
|
25
25
|
* @param subnet - Subnet prefix (default: '192.168.1')
|
|
26
26
|
* @returns Array of IP addresses
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
declare function generateIpAddresses(count: number, subnet?: string): string[];
|
|
29
29
|
/**
|
|
30
30
|
* Creates a random IP address for rate limit benchmarks.
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
declare function randomIpAddress(): string;
|
|
33
|
+
//# sourceMappingURL=benchmark.d.ts.map
|
|
33
34
|
//#endregion
|
|
35
|
+
export { generateCacheKeys, generateIpAddresses, generateTestData, randomIpAddress };
|
|
34
36
|
//# sourceMappingURL=benchmark.d.mts.map
|
package/dist/benchmark.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"benchmark.d.mts","names":[],"sources":["../src/benchmark.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"benchmark.d.mts","names":[],"sources":["../src/benchmark.ts"],"sourcesContent":[],"mappings":";;AAMA;AAiBA;AAWA;AAUA;;iBAtCgB,gBAAA,iBAEb;;;;;;;;;;;;iBAea,iBAAA;;;;;;;;iBAWA,mBAAA;;;;iBAUA,eAAA,CAAA"}
|
package/dist/benchmark.mjs
CHANGED
|
@@ -39,7 +39,7 @@ function randomIpAddress() {
|
|
|
39
39
|
const octet = () => Math.floor(Math.random() * 256);
|
|
40
40
|
return `${octet()}.${octet()}.${octet()}.${octet()}`;
|
|
41
41
|
}
|
|
42
|
+
|
|
42
43
|
//#endregion
|
|
43
44
|
export { generateCacheKeys, generateIpAddresses, generateTestData, randomIpAddress };
|
|
44
|
-
|
|
45
45
|
//# sourceMappingURL=benchmark.mjs.map
|
package/dist/benchmark.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"benchmark.mjs","names":[],"sources":["../src/benchmark.ts"],"sourcesContent":["/**\n * Generates an array of test records for benchmark data sets.\n *\n * @param count - Number of records to generate\n * @returns Array of test data objects\n */\nexport function generateTestData(\n\tcount: number,\n): Array<{ id: string; name: string; value: number }> {\n\treturn Array.from({ length: count }, (_, i) => ({\n\t\tid: `id-${i}`,\n\t\tname: `Item ${i}`,\n\t\tvalue: Math.random() * 1000,\n\t}));\n}\n\n/**\n * Generates unique keys for cache benchmarks to avoid collisions.\n *\n * @param prefix - Key prefix\n * @param count - Number of keys to generate\n * @returns Array of unique cache keys\n */\nexport function generateCacheKeys(prefix: string, count: number): string[] {\n\treturn Array.from({ length: count }, (_, i) => `${prefix}:${i}`);\n}\n\n/**\n * Generates IP addresses for rate limit benchmarks.\n *\n * @param count - Number of IPs to generate\n * @param subnet - Subnet prefix (default: '192.168.1')\n * @returns Array of IP addresses\n */\nexport function generateIpAddresses(\n\tcount: number,\n\tsubnet: string = '192.168.1',\n): string[] {\n\treturn Array.from({ length: count }, (_, i) => `${subnet}.${i % 256}`);\n}\n\n/**\n * Creates a random IP address for rate limit benchmarks.\n */\nexport function randomIpAddress(): string {\n\tconst octet = () => Math.floor(Math.random() * 256);\n\treturn `${octet()}.${octet()}.${octet()}.${octet()}`;\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,
|
|
1
|
+
{"version":3,"file":"benchmark.mjs","names":["count: number","prefix: string","subnet: string"],"sources":["../src/benchmark.ts"],"sourcesContent":["/**\n * Generates an array of test records for benchmark data sets.\n *\n * @param count - Number of records to generate\n * @returns Array of test data objects\n */\nexport function generateTestData(\n\tcount: number,\n): Array<{ id: string; name: string; value: number }> {\n\treturn Array.from({ length: count }, (_, i) => ({\n\t\tid: `id-${i}`,\n\t\tname: `Item ${i}`,\n\t\tvalue: Math.random() * 1000,\n\t}));\n}\n\n/**\n * Generates unique keys for cache benchmarks to avoid collisions.\n *\n * @param prefix - Key prefix\n * @param count - Number of keys to generate\n * @returns Array of unique cache keys\n */\nexport function generateCacheKeys(prefix: string, count: number): string[] {\n\treturn Array.from({ length: count }, (_, i) => `${prefix}:${i}`);\n}\n\n/**\n * Generates IP addresses for rate limit benchmarks.\n *\n * @param count - Number of IPs to generate\n * @param subnet - Subnet prefix (default: '192.168.1')\n * @returns Array of IP addresses\n */\nexport function generateIpAddresses(\n\tcount: number,\n\tsubnet: string = '192.168.1',\n): string[] {\n\treturn Array.from({ length: count }, (_, i) => `${subnet}.${i % 256}`);\n}\n\n/**\n * Creates a random IP address for rate limit benchmarks.\n */\nexport function randomIpAddress(): string {\n\tconst octet = () => Math.floor(Math.random() * 256);\n\treturn `${octet()}.${octet()}.${octet()}.${octet()}`;\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,iBACfA,OACqD;AACrD,QAAO,MAAM,KAAK,EAAE,QAAQ,MAAO,GAAE,CAAC,GAAG,OAAO;EAC/C,KAAK,KAAK,EAAE;EACZ,OAAO,OAAO,EAAE;EAChB,OAAO,KAAK,QAAQ,GAAG;CACvB,GAAE;AACH;;;;;;;;AASD,SAAgB,kBAAkBC,QAAgBD,OAAyB;AAC1E,QAAO,MAAM,KAAK,EAAE,QAAQ,MAAO,GAAE,CAAC,GAAG,OAAO,EAAE,OAAO,GAAG,EAAE,EAAE;AAChE;;;;;;;;AASD,SAAgB,oBACfA,OACAE,SAAiB,aACN;AACX,QAAO,MAAM,KAAK,EAAE,QAAQ,MAAO,GAAE,CAAC,GAAG,OAAO,EAAE,OAAO,GAAG,IAAI,IAAI,EAAE;AACtE;;;;AAKD,SAAgB,kBAA0B;CACzC,MAAM,QAAQ,MAAM,KAAK,MAAM,KAAK,QAAQ,GAAG,IAAI;AACnD,SAAQ,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC;AACnD"}
|
package/dist/better-auth.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const better_auth_adapters = require_chunk.__toESM(require("better-auth/adapters"));
|
|
3
|
+
|
|
3
4
|
//#region src/better-auth.ts
|
|
4
5
|
var MemoryStore = class {
|
|
5
|
-
data;
|
|
6
6
|
constructor(initialData, data = /* @__PURE__ */ new Map()) {
|
|
7
7
|
this.data = data;
|
|
8
8
|
if (initialData) for (const [model, records] of Object.entries(initialData)) {
|
|
@@ -28,10 +28,8 @@ function matchesWhere(record, where) {
|
|
|
28
28
|
if (!where || where.length === 0) return true;
|
|
29
29
|
let result = null;
|
|
30
30
|
for (const condition of where) {
|
|
31
|
-
const { field, operator = "eq", connector = "AND"
|
|
32
|
-
const
|
|
33
|
-
const recordValue = fold(record[field]);
|
|
34
|
-
const value = Array.isArray(condition.value) ? condition.value.map(fold) : fold(condition.value);
|
|
31
|
+
const { field, value, operator = "eq", connector = "AND" } = condition;
|
|
32
|
+
const recordValue = record[field];
|
|
35
33
|
let matches = false;
|
|
36
34
|
switch (operator) {
|
|
37
35
|
case "eq":
|
|
@@ -101,7 +99,7 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
101
99
|
supportsBooleans: true,
|
|
102
100
|
supportsNumericIds: false
|
|
103
101
|
},
|
|
104
|
-
adapter: ({ debugLog, getModelName,
|
|
102
|
+
adapter: ({ debugLog, getModelName, transformWhereClause }) => ({
|
|
105
103
|
create: async ({ data, model }) => {
|
|
106
104
|
debugLog("CREATE", {
|
|
107
105
|
model,
|
|
@@ -124,13 +122,12 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
124
122
|
const modelData = storeInstance.getModel(modelName);
|
|
125
123
|
const transformedWhere = transformWhereClause({
|
|
126
124
|
model,
|
|
127
|
-
where
|
|
128
|
-
action: "findOne"
|
|
125
|
+
where
|
|
129
126
|
});
|
|
130
127
|
for (const record of modelData.values()) if (matchesWhere(record, transformedWhere)) return record;
|
|
131
128
|
return null;
|
|
132
129
|
},
|
|
133
|
-
findMany: async ({ where, model, limit, offset, sortBy
|
|
130
|
+
findMany: async ({ where, model, limit, offset, sortBy }) => {
|
|
134
131
|
debugLog("FIND_MANY", {
|
|
135
132
|
model,
|
|
136
133
|
where
|
|
@@ -139,20 +136,12 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
139
136
|
const modelData = storeInstance.getModel(modelName);
|
|
140
137
|
const transformedWhere = transformWhereClause({
|
|
141
138
|
model,
|
|
142
|
-
where
|
|
143
|
-
action: "findMany"
|
|
139
|
+
where
|
|
144
140
|
});
|
|
145
141
|
let results = Array.from(modelData.values()).filter((record) => matchesWhere(record, transformedWhere));
|
|
146
142
|
if (sortBy) results = applySorting(results, sortBy);
|
|
147
143
|
if (offset) results = results.slice(offset);
|
|
148
144
|
if (limit) results = results.slice(0, limit);
|
|
149
|
-
if (select?.length) {
|
|
150
|
-
const columns = select.map((field) => getFieldName({
|
|
151
|
-
model,
|
|
152
|
-
field
|
|
153
|
-
}));
|
|
154
|
-
return results.map((record) => Object.fromEntries(columns.map((column) => [column, record[column]])));
|
|
155
|
-
}
|
|
156
145
|
return results;
|
|
157
146
|
},
|
|
158
147
|
update: async ({ where, update, model }) => {
|
|
@@ -164,8 +153,7 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
164
153
|
const modelData = storeInstance.getModel(modelName);
|
|
165
154
|
const transformedWhere = transformWhereClause({
|
|
166
155
|
model,
|
|
167
|
-
where
|
|
168
|
-
action: "update"
|
|
156
|
+
where
|
|
169
157
|
});
|
|
170
158
|
for (const [id, record] of modelData.entries()) if (matchesWhere(record, transformedWhere)) {
|
|
171
159
|
const updated = {
|
|
@@ -186,8 +174,7 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
186
174
|
const modelData = storeInstance.getModel(modelName);
|
|
187
175
|
const transformedWhere = transformWhereClause({
|
|
188
176
|
model,
|
|
189
|
-
where
|
|
190
|
-
action: "updateMany"
|
|
177
|
+
where
|
|
191
178
|
});
|
|
192
179
|
let count = 0;
|
|
193
180
|
for (const [id, record] of modelData.entries()) if (matchesWhere(record, transformedWhere)) {
|
|
@@ -208,8 +195,7 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
208
195
|
const modelData = storeInstance.getModel(modelName);
|
|
209
196
|
const transformedWhere = transformWhereClause({
|
|
210
197
|
model,
|
|
211
|
-
where
|
|
212
|
-
action: "delete"
|
|
198
|
+
where
|
|
213
199
|
});
|
|
214
200
|
for (const [id, record] of modelData.entries()) if (matchesWhere(record, transformedWhere)) {
|
|
215
201
|
modelData.delete(id);
|
|
@@ -225,8 +211,7 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
225
211
|
const modelData = storeInstance.getModel(modelName);
|
|
226
212
|
const transformedWhere = transformWhereClause({
|
|
227
213
|
model,
|
|
228
|
-
where
|
|
229
|
-
action: "deleteMany"
|
|
214
|
+
where
|
|
230
215
|
});
|
|
231
216
|
const toDelete = [];
|
|
232
217
|
for (const [id, record] of modelData.entries()) if (matchesWhere(record, transformedWhere)) toDelete.push(id);
|
|
@@ -238,8 +223,7 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
238
223
|
const modelData = storeInstance.getModel(modelName);
|
|
239
224
|
const transformedWhere = transformWhereClause({
|
|
240
225
|
model,
|
|
241
|
-
where
|
|
242
|
-
action: "count"
|
|
226
|
+
where
|
|
243
227
|
});
|
|
244
228
|
return Array.from(modelData.values()).filter((record) => matchesWhere(record, transformedWhere)).length;
|
|
245
229
|
}
|
|
@@ -251,7 +235,7 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
251
235
|
getStore: () => store
|
|
252
236
|
});
|
|
253
237
|
};
|
|
238
|
+
|
|
254
239
|
//#endregion
|
|
255
240
|
exports.memoryAdapter = memoryAdapter;
|
|
256
|
-
|
|
257
241
|
//# sourceMappingURL=better-auth.cjs.map
|
package/dist/better-auth.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"better-auth.cjs","names":["createAdapterFactory"],"sources":["../src/better-auth.ts"],"sourcesContent":["import {\n\tcreateAdapterFactory,\n\ttype DBAdapterDebugLogOption,\n\ttype Where,\n} from 'better-auth/adapters';\n\ninterface MemoryAdapterConfig {\n\tdebugLogs?: DBAdapterDebugLogOption;\n\tusePlural?: boolean;\n\tinitialData?: Record<string, any[]>;\n}\n\nclass MemoryStore {\n\tconstructor(\n\t\tinitialData?: Record<string, any[]>,\n\t\tprivate readonly data: Map<string, any> = new Map(),\n\t) {\n\t\tif (initialData) {\n\t\t\tfor (const [model, records] of Object.entries(initialData)) {\n\t\t\t\tconst modelData = new Map();\n\t\t\t\tfor (const record of records) {\n\t\t\t\t\tmodelData.set(record.id, { ...record });\n\t\t\t\t}\n\t\t\t\tthis.data.set(model, modelData);\n\t\t\t}\n\t\t}\n\t}\n\n\tgetModel(modelName: string): Map<string, any> {\n\t\tif (!this.data.has(modelName)) {\n\t\t\tthis.data.set(modelName, new Map());\n\t\t}\n\t\treturn this.data.get(modelName)!;\n\t}\n\n\tclear() {\n\t\tthis.data.clear();\n\t}\n\n\tgetAllData() {\n\t\tconst result: Record<string, any[]> = {};\n\t\tfor (const [model, records] of this.data.entries()) {\n\t\t\tresult[model] = Array.from(records.values());\n\t\t}\n\t\treturn result;\n\t}\n}\n\nfunction matchesWhere(record: any, where?: Where[]): boolean {\n\tif (!where || where.length === 0) return true;\n\n\tlet result: boolean | null = null;\n\n\tfor (const condition of where) {\n\t\tconst { field, operator = 'eq', connector = 'AND', mode } = condition;\n\t\t// `mode: 'insensitive'` compares strings case-folded on both sides — in\n\t\t// `in`/`not_in` lists too — the way the SQL adapters use ILIKE/LOWER().\n\t\tconst fold =\n\t\t\tmode === 'insensitive'\n\t\t\t\t? (v: unknown) => (typeof v === 'string' ? v.toLowerCase() : v)\n\t\t\t\t: (v: unknown) => v;\n\t\tconst recordValue = fold(record[field]) as any;\n\t\tconst value = (\n\t\t\tArray.isArray(condition.value)\n\t\t\t\t? (condition.value as unknown[]).map(fold)\n\t\t\t\t: fold(condition.value)\n\t\t) as any;\n\n\t\tlet matches = false;\n\n\t\tswitch (operator) {\n\t\t\tcase 'eq':\n\t\t\t\tmatches = recordValue === value;\n\t\t\t\tbreak;\n\t\t\tcase 'ne':\n\t\t\t\tmatches = recordValue !== value;\n\t\t\t\tbreak;\n\t\t\tcase 'lt':\n\t\t\t\tmatches = value != null && recordValue < value;\n\t\t\t\tbreak;\n\t\t\tcase 'lte':\n\t\t\t\tmatches = value != null && recordValue <= value;\n\t\t\t\tbreak;\n\t\t\tcase 'gt':\n\t\t\t\tmatches = value != null && recordValue > value;\n\t\t\t\tbreak;\n\t\t\tcase 'gte':\n\t\t\t\tmatches = value != null && recordValue >= value;\n\t\t\t\tbreak;\n\t\t\tcase 'in':\n\t\t\t\tmatches =\n\t\t\t\t\tArray.isArray(value) && (value as unknown[]).includes(recordValue);\n\t\t\t\tbreak;\n\t\t\tcase 'not_in':\n\t\t\t\tmatches =\n\t\t\t\t\tArray.isArray(value) && !(value as unknown[]).includes(recordValue);\n\t\t\t\tbreak;\n\t\t\tcase 'contains':\n\t\t\t\tmatches =\n\t\t\t\t\ttypeof recordValue === 'string' &&\n\t\t\t\t\ttypeof value === 'string' &&\n\t\t\t\t\trecordValue.includes(value);\n\t\t\t\tbreak;\n\t\t\tcase 'starts_with':\n\t\t\t\tmatches =\n\t\t\t\t\ttypeof recordValue === 'string' &&\n\t\t\t\t\ttypeof value === 'string' &&\n\t\t\t\t\trecordValue.startsWith(value);\n\t\t\t\tbreak;\n\t\t\tcase 'ends_with':\n\t\t\t\tmatches =\n\t\t\t\t\ttypeof recordValue === 'string' &&\n\t\t\t\t\ttypeof value === 'string' &&\n\t\t\t\t\trecordValue.endsWith(value);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tmatches = recordValue === value;\n\t\t}\n\n\t\t// Apply connector logic\n\t\tif (result === null) {\n\t\t\tresult = matches;\n\t\t} else if (connector === 'OR') {\n\t\t\tresult = result || matches;\n\t\t} else {\n\t\t\t// Default: AND\n\t\t\tresult = result && matches;\n\t\t}\n\t}\n\n\treturn result ?? true;\n}\ntype SortBy = {\n\tfield: string;\n\tdirection: 'asc' | 'desc';\n};\n\nfunction applySorting(records: any[], sortBy?: SortBy): any[] {\n\tif (!sortBy) return records;\n\n\tconst { field, direction } = sortBy;\n\n\treturn records.sort((a, b) => {\n\t\tconst aVal = a[field];\n\t\tconst bVal = b[field];\n\n\t\tif (aVal === bVal) return 0;\n\t\tif (aVal == null) return direction === 'asc' ? -1 : 1;\n\t\tif (bVal == null) return direction === 'asc' ? 1 : -1;\n\n\t\tconst comparison = aVal < bVal ? -1 : 1;\n\t\treturn direction === 'asc' ? comparison : -comparison;\n\t});\n}\n\nexport const memoryAdapter = (\n\tconfig: MemoryAdapterConfig = {},\n\tstore = new Map(),\n) => {\n\tconst storeInstance = new MemoryStore(config.initialData, store);\n\n\tconst adapterInstance = createAdapterFactory({\n\t\tconfig: {\n\t\t\tadapterId: 'memory-adapter',\n\t\t\tadapterName: 'Memory Adapter',\n\t\t\tusePlural: config.usePlural ?? false,\n\t\t\tdebugLogs: config.debugLogs ?? false,\n\t\t\tsupportsJSON: true,\n\t\t\tsupportsDates: true,\n\t\t\tsupportsBooleans: true,\n\t\t\tsupportsNumericIds: false,\n\t\t},\n\n\t\t// Note: The framework automatically transforms field names in both directions:\n\t\t// - Input data is already transformed before reaching the adapter (e.g., email -> email_address)\n\t\t// - Output data is automatically transformed after the adapter returns (e.g., email_address -> email)\n\t\t// Therefore, we should NOT call transformInput or transformOutput ourselves.\n\t\tadapter: ({\n\t\t\tdebugLog,\n\t\t\tgetModelName,\n\t\t\tgetFieldName,\n\t\t\ttransformWhereClause,\n\t\t}) => ({\n\t\t\tcreate: async ({ data, model }) => {\n\t\t\t\tdebugLog('CREATE', { model, data });\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\n\t\t\t\t// Data is already transformed by the framework - store directly\n\t\t\t\tconst record = data as Record<string, unknown>;\n\t\t\t\tif (!record.id) {\n\t\t\t\t\trecord.id = crypto.randomUUID();\n\t\t\t\t}\n\n\t\t\t\tconst id = record.id as string;\n\t\t\t\tmodelData.set(id, { ...record });\n\t\t\t\treturn modelData.get(id);\n\t\t\t},\n\n\t\t\tfindOne: async ({ where, model }) => {\n\t\t\t\tdebugLog('FIND_ONE', { model, where });\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\t\t\t\tconst transformedWhere = transformWhereClause({\n\t\t\t\t\tmodel,\n\t\t\t\t\twhere,\n\t\t\t\t\taction: 'findOne',\n\t\t\t\t});\n\n\t\t\t\tfor (const record of modelData.values()) {\n\t\t\t\t\tif (matchesWhere(record, transformedWhere)) {\n\t\t\t\t\t\treturn record;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t},\n\n\t\t\tfindMany: async ({ where, model, limit, offset, sortBy, select }) => {\n\t\t\t\tdebugLog('FIND_MANY', { model, where });\n\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\t\t\t\tconst transformedWhere = transformWhereClause({\n\t\t\t\t\tmodel,\n\t\t\t\t\twhere,\n\t\t\t\t\taction: 'findMany',\n\t\t\t\t});\n\n\t\t\t\tlet results = Array.from(modelData.values()).filter((record) =>\n\t\t\t\t\tmatchesWhere(record, transformedWhere),\n\t\t\t\t);\n\n\t\t\t\tif (sortBy) {\n\t\t\t\t\tresults = applySorting(results, sortBy);\n\t\t\t\t}\n\n\t\t\t\tif (offset) {\n\t\t\t\t\tresults = results.slice(offset);\n\t\t\t\t}\n\t\t\t\tif (limit) {\n\t\t\t\t\tresults = results.slice(0, limit);\n\t\t\t\t}\n\n\t\t\t\t// Only the fields asked for, as a SELECT list would return — under\n\t\t\t\t// their stored names, which differ when the schema renames a field\n\t\t\t\t// (`fields: { email: 'email_address' }`).\n\t\t\t\tif (select?.length) {\n\t\t\t\t\tconst columns = select.map((field) => getFieldName({ model, field }));\n\t\t\t\t\treturn results.map((record) =>\n\t\t\t\t\t\tObject.fromEntries(\n\t\t\t\t\t\t\tcolumns.map((column) => [column, record[column]]),\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn results;\n\t\t\t},\n\n\t\t\tupdate: async ({ where, update, model }) => {\n\t\t\t\tdebugLog('UPDATE', { model, where });\n\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\t\t\t\tconst transformedWhere = transformWhereClause({\n\t\t\t\t\tmodel,\n\t\t\t\t\twhere,\n\t\t\t\t\taction: 'update',\n\t\t\t\t});\n\n\t\t\t\tfor (const [id, record] of modelData.entries()) {\n\t\t\t\t\tif (matchesWhere(record, transformedWhere)) {\n\t\t\t\t\t\t// Update data is already transformed by the framework\n\t\t\t\t\t\tconst updated = { ...record, ...update };\n\t\t\t\t\t\tmodelData.set(id, updated);\n\t\t\t\t\t\treturn updated;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t},\n\n\t\t\tupdateMany: async ({ where, update, model }) => {\n\t\t\t\tdebugLog('UPDATE_MANY', { model, where });\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\t\t\t\tconst transformedWhere = transformWhereClause({\n\t\t\t\t\tmodel,\n\t\t\t\t\twhere,\n\t\t\t\t\taction: 'updateMany',\n\t\t\t\t});\n\n\t\t\t\tlet count = 0;\n\n\t\t\t\tfor (const [id, record] of modelData.entries()) {\n\t\t\t\t\tif (matchesWhere(record, transformedWhere)) {\n\t\t\t\t\t\t// Update data is already transformed by the framework\n\t\t\t\t\t\tmodelData.set(id, { ...record, ...update });\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn count;\n\t\t\t},\n\n\t\t\tdelete: async ({ where, model }) => {\n\t\t\t\tdebugLog('DELETE', { model, where });\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\t\t\t\tconst transformedWhere = transformWhereClause({\n\t\t\t\t\tmodel,\n\t\t\t\t\twhere,\n\t\t\t\t\taction: 'delete',\n\t\t\t\t});\n\n\t\t\t\tfor (const [id, record] of modelData.entries()) {\n\t\t\t\t\tif (matchesWhere(record, transformedWhere)) {\n\t\t\t\t\t\tmodelData.delete(id);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tdeleteMany: async ({ where, model }) => {\n\t\t\t\tdebugLog('DELETE_MANY', { model, where });\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\t\t\t\tconst transformedWhere = transformWhereClause({\n\t\t\t\t\tmodel,\n\t\t\t\t\twhere,\n\t\t\t\t\taction: 'deleteMany',\n\t\t\t\t});\n\n\t\t\t\tconst toDelete: string[] = [];\n\t\t\t\tfor (const [id, record] of modelData.entries()) {\n\t\t\t\t\tif (matchesWhere(record, transformedWhere)) {\n\t\t\t\t\t\ttoDelete.push(id);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (const id of toDelete) {\n\t\t\t\t\tmodelData.delete(id);\n\t\t\t\t}\n\t\t\t\treturn toDelete.length;\n\t\t\t},\n\n\t\t\tcount: async ({ where, model }) => {\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\t\t\t\tconst transformedWhere = transformWhereClause({\n\t\t\t\t\tmodel,\n\t\t\t\t\twhere,\n\t\t\t\t\taction: 'count',\n\t\t\t\t});\n\n\t\t\t\treturn Array.from(modelData.values()).filter((record) =>\n\t\t\t\t\tmatchesWhere(record, transformedWhere),\n\t\t\t\t).length;\n\t\t\t},\n\t\t}),\n\t});\n\n\t// Add utility methods to the adapter\n\treturn Object.assign(adapterInstance, {\n\t\tclear: () => store.clear(),\n\t\tgetAllData: () => storeInstance.getAllData(),\n\t\tgetStore: () => store,\n\t});\n};\n"],"mappings":";;;AAYA,IAAM,cAAN,MAAkB;CAGC;CAFlB,YACC,aACA,uBAA0C,IAAI,IAAI,GACjD;EADgB,KAAA,OAAA;EAEjB,IAAI,aACH,KAAK,MAAM,CAAC,OAAO,YAAY,OAAO,QAAQ,WAAW,GAAG;GAC3D,MAAM,4BAAY,IAAI,IAAI;GAC1B,KAAK,MAAM,UAAU,SACpB,UAAU,IAAI,OAAO,IAAI,EAAE,GAAG,OAAO,CAAC;GAEvC,KAAK,KAAK,IAAI,OAAO,SAAS;EAC/B;CAEF;CAEA,SAAS,WAAqC;EAC7C,IAAI,CAAC,KAAK,KAAK,IAAI,SAAS,GAC3B,KAAK,KAAK,IAAI,2BAAW,IAAI,IAAI,CAAC;EAEnC,OAAO,KAAK,KAAK,IAAI,SAAS;CAC/B;CAEA,QAAQ;EACP,KAAK,KAAK,MAAM;CACjB;CAEA,aAAa;EACZ,MAAM,SAAgC,CAAC;EACvC,KAAK,MAAM,CAAC,OAAO,YAAY,KAAK,KAAK,QAAQ,GAChD,OAAO,SAAS,MAAM,KAAK,QAAQ,OAAO,CAAC;EAE5C,OAAO;CACR;AACD;AAEA,SAAS,aAAa,QAAa,OAA0B;CAC5D,IAAI,CAAC,SAAS,MAAM,WAAW,GAAG,OAAO;CAEzC,IAAI,SAAyB;CAE7B,KAAK,MAAM,aAAa,OAAO;EAC9B,MAAM,EAAE,OAAO,WAAW,MAAM,YAAY,OAAO,SAAS;EAG5D,MAAM,OACL,SAAS,iBACL,MAAgB,OAAO,MAAM,WAAW,EAAE,YAAY,IAAI,KAC1D,MAAe;EACpB,MAAM,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AAC;GACH;EACD;CACD,CAAC;CAGD,OAAO,OAAO,OAAO,iBAAiB;EACrC,aAAa,MAAM,MAAM;EACzB,kBAAkB,cAAc,WAAW;EAC3C,gBAAgB;CACjB,CAAC;AACF"}
|
|
1
|
+
{"version":3,"file":"better-auth.cjs","names":["initialData?: Record<string, any[]>","data: Map<string, any>","modelName: string","result: Record<string, any[]>","record: any","where?: Where[]","result: boolean | null","records: any[]","sortBy?: SortBy","config: MemoryAdapterConfig","toDelete: string[]"],"sources":["../src/better-auth.ts"],"sourcesContent":["import {\n\tcreateAdapterFactory,\n\ttype DBAdapterDebugLogOption,\n\ttype Where,\n} from 'better-auth/adapters';\n\ninterface MemoryAdapterConfig {\n\tdebugLogs?: DBAdapterDebugLogOption;\n\tusePlural?: boolean;\n\tinitialData?: Record<string, any[]>;\n}\n\nclass MemoryStore {\n\tconstructor(\n\t\tinitialData?: Record<string, any[]>,\n\t\tprivate readonly data: Map<string, any> = new Map(),\n\t) {\n\t\tif (initialData) {\n\t\t\tfor (const [model, records] of Object.entries(initialData)) {\n\t\t\t\tconst modelData = new Map();\n\t\t\t\tfor (const record of records) {\n\t\t\t\t\tmodelData.set(record.id, { ...record });\n\t\t\t\t}\n\t\t\t\tthis.data.set(model, modelData);\n\t\t\t}\n\t\t}\n\t}\n\n\tgetModel(modelName: string): Map<string, any> {\n\t\tif (!this.data.has(modelName)) {\n\t\t\tthis.data.set(modelName, new Map());\n\t\t}\n\t\treturn this.data.get(modelName)!;\n\t}\n\n\tclear() {\n\t\tthis.data.clear();\n\t}\n\n\tgetAllData() {\n\t\tconst result: Record<string, any[]> = {};\n\t\tfor (const [model, records] of this.data.entries()) {\n\t\t\tresult[model] = Array.from(records.values());\n\t\t}\n\t\treturn result;\n\t}\n}\n\nfunction matchesWhere(record: any, where?: Where[]): boolean {\n\tif (!where || where.length === 0) return true;\n\n\tlet result: boolean | null = null;\n\n\tfor (const condition of where) {\n\t\tconst { field, value, operator = 'eq', connector = 'AND' } = condition;\n\t\tconst recordValue = record[field];\n\n\t\tlet matches = false;\n\n\t\tswitch (operator) {\n\t\t\tcase 'eq':\n\t\t\t\tmatches = recordValue === value;\n\t\t\t\tbreak;\n\t\t\tcase 'ne':\n\t\t\t\tmatches = recordValue !== value;\n\t\t\t\tbreak;\n\t\t\tcase 'lt':\n\t\t\t\tmatches = value != null && recordValue < value;\n\t\t\t\tbreak;\n\t\t\tcase 'lte':\n\t\t\t\tmatches = value != null && recordValue <= value;\n\t\t\t\tbreak;\n\t\t\tcase 'gt':\n\t\t\t\tmatches = value != null && recordValue > value;\n\t\t\t\tbreak;\n\t\t\tcase 'gte':\n\t\t\t\tmatches = value != null && recordValue >= value;\n\t\t\t\tbreak;\n\t\t\tcase 'in':\n\t\t\t\tmatches =\n\t\t\t\t\tArray.isArray(value) && (value as unknown[]).includes(recordValue);\n\t\t\t\tbreak;\n\t\t\tcase 'not_in':\n\t\t\t\tmatches =\n\t\t\t\t\tArray.isArray(value) && !(value as unknown[]).includes(recordValue);\n\t\t\t\tbreak;\n\t\t\tcase 'contains':\n\t\t\t\tmatches =\n\t\t\t\t\ttypeof recordValue === 'string' &&\n\t\t\t\t\ttypeof value === 'string' &&\n\t\t\t\t\trecordValue.includes(value);\n\t\t\t\tbreak;\n\t\t\tcase 'starts_with':\n\t\t\t\tmatches =\n\t\t\t\t\ttypeof recordValue === 'string' &&\n\t\t\t\t\ttypeof value === 'string' &&\n\t\t\t\t\trecordValue.startsWith(value);\n\t\t\t\tbreak;\n\t\t\tcase 'ends_with':\n\t\t\t\tmatches =\n\t\t\t\t\ttypeof recordValue === 'string' &&\n\t\t\t\t\ttypeof value === 'string' &&\n\t\t\t\t\trecordValue.endsWith(value);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tmatches = recordValue === value;\n\t\t}\n\n\t\t// Apply connector logic\n\t\tif (result === null) {\n\t\t\tresult = matches;\n\t\t} else if (connector === 'OR') {\n\t\t\tresult = result || matches;\n\t\t} else {\n\t\t\t// Default: AND\n\t\t\tresult = result && matches;\n\t\t}\n\t}\n\n\treturn result ?? true;\n}\ntype SortBy = {\n\tfield: string;\n\tdirection: 'asc' | 'desc';\n};\n\nfunction applySorting(records: any[], sortBy?: SortBy): any[] {\n\tif (!sortBy) return records;\n\n\tconst { field, direction } = sortBy;\n\n\treturn records.sort((a, b) => {\n\t\tconst aVal = a[field];\n\t\tconst bVal = b[field];\n\n\t\tif (aVal === bVal) return 0;\n\t\tif (aVal == null) return direction === 'asc' ? -1 : 1;\n\t\tif (bVal == null) return direction === 'asc' ? 1 : -1;\n\n\t\tconst comparison = aVal < bVal ? -1 : 1;\n\t\treturn direction === 'asc' ? comparison : -comparison;\n\t});\n}\n\nexport const memoryAdapter = (\n\tconfig: MemoryAdapterConfig = {},\n\tstore = new Map(),\n) => {\n\tconst storeInstance = new MemoryStore(config.initialData, store);\n\n\tconst adapterInstance = createAdapterFactory({\n\t\tconfig: {\n\t\t\tadapterId: 'memory-adapter',\n\t\t\tadapterName: 'Memory Adapter',\n\t\t\tusePlural: config.usePlural ?? false,\n\t\t\tdebugLogs: config.debugLogs ?? false,\n\t\t\tsupportsJSON: true,\n\t\t\tsupportsDates: true,\n\t\t\tsupportsBooleans: true,\n\t\t\tsupportsNumericIds: false,\n\t\t},\n\n\t\t// Note: The framework automatically transforms field names in both directions:\n\t\t// - Input data is already transformed before reaching the adapter (e.g., email -> email_address)\n\t\t// - Output data is automatically transformed after the adapter returns (e.g., email_address -> email)\n\t\t// Therefore, we should NOT call transformInput or transformOutput ourselves.\n\t\tadapter: ({ debugLog, getModelName, transformWhereClause }) => ({\n\t\t\tcreate: async ({ data, model }) => {\n\t\t\t\tdebugLog('CREATE', { model, data });\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\n\t\t\t\t// Data is already transformed by the framework - store directly\n\t\t\t\tconst record = data as Record<string, unknown>;\n\t\t\t\tif (!record.id) {\n\t\t\t\t\trecord.id = crypto.randomUUID();\n\t\t\t\t}\n\n\t\t\t\tconst id = record.id as string;\n\t\t\t\tmodelData.set(id, { ...record });\n\t\t\t\treturn modelData.get(id);\n\t\t\t},\n\n\t\t\tfindOne: async ({ where, model }) => {\n\t\t\t\tdebugLog('FIND_ONE', { model, where });\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\t\t\t\tconst transformedWhere = transformWhereClause({ model, where });\n\n\t\t\t\tfor (const record of modelData.values()) {\n\t\t\t\t\tif (matchesWhere(record, transformedWhere)) {\n\t\t\t\t\t\treturn record;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t},\n\n\t\t\tfindMany: async ({ where, model, limit, offset, sortBy }) => {\n\t\t\t\tdebugLog('FIND_MANY', { model, where });\n\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\t\t\t\tconst transformedWhere = transformWhereClause({ model, where });\n\n\t\t\t\tlet results = Array.from(modelData.values()).filter((record) =>\n\t\t\t\t\tmatchesWhere(record, transformedWhere),\n\t\t\t\t);\n\n\t\t\t\tif (sortBy) {\n\t\t\t\t\tresults = applySorting(results, sortBy);\n\t\t\t\t}\n\n\t\t\t\tif (offset) {\n\t\t\t\t\tresults = results.slice(offset);\n\t\t\t\t}\n\t\t\t\tif (limit) {\n\t\t\t\t\tresults = results.slice(0, limit);\n\t\t\t\t}\n\n\t\t\t\treturn results;\n\t\t\t},\n\n\t\t\tupdate: async ({ where, update, model }) => {\n\t\t\t\tdebugLog('UPDATE', { model, where });\n\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\t\t\t\tconst transformedWhere = transformWhereClause({ model, where });\n\n\t\t\t\tfor (const [id, record] of modelData.entries()) {\n\t\t\t\t\tif (matchesWhere(record, transformedWhere)) {\n\t\t\t\t\t\t// Update data is already transformed by the framework\n\t\t\t\t\t\tconst updated = { ...record, ...update };\n\t\t\t\t\t\tmodelData.set(id, updated);\n\t\t\t\t\t\treturn updated;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t},\n\n\t\t\tupdateMany: async ({ where, update, model }) => {\n\t\t\t\tdebugLog('UPDATE_MANY', { model, where });\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\t\t\t\tconst transformedWhere = transformWhereClause({ model, where });\n\n\t\t\t\tlet count = 0;\n\n\t\t\t\tfor (const [id, record] of modelData.entries()) {\n\t\t\t\t\tif (matchesWhere(record, transformedWhere)) {\n\t\t\t\t\t\t// Update data is already transformed by the framework\n\t\t\t\t\t\tmodelData.set(id, { ...record, ...update });\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn count;\n\t\t\t},\n\n\t\t\tdelete: async ({ where, model }) => {\n\t\t\t\tdebugLog('DELETE', { model, where });\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\t\t\t\tconst transformedWhere = transformWhereClause({ model, where });\n\n\t\t\t\tfor (const [id, record] of modelData.entries()) {\n\t\t\t\t\tif (matchesWhere(record, transformedWhere)) {\n\t\t\t\t\t\tmodelData.delete(id);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tdeleteMany: async ({ where, model }) => {\n\t\t\t\tdebugLog('DELETE_MANY', { model, where });\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\t\t\t\tconst transformedWhere = transformWhereClause({ model, where });\n\n\t\t\t\tconst toDelete: string[] = [];\n\t\t\t\tfor (const [id, record] of modelData.entries()) {\n\t\t\t\t\tif (matchesWhere(record, transformedWhere)) {\n\t\t\t\t\t\ttoDelete.push(id);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (const id of toDelete) {\n\t\t\t\t\tmodelData.delete(id);\n\t\t\t\t}\n\t\t\t\treturn toDelete.length;\n\t\t\t},\n\n\t\t\tcount: async ({ where, model }) => {\n\t\t\t\tconst modelName = getModelName(model);\n\t\t\t\tconst modelData = storeInstance.getModel(modelName);\n\t\t\t\tconst transformedWhere = transformWhereClause({ model, where });\n\n\t\t\t\treturn Array.from(modelData.values()).filter((record) =>\n\t\t\t\t\tmatchesWhere(record, transformedWhere),\n\t\t\t\t).length;\n\t\t\t},\n\t\t}),\n\t});\n\n\t// Add utility methods to the adapter\n\treturn Object.assign(adapterInstance, {\n\t\tclear: () => store.clear(),\n\t\tgetAllData: () => storeInstance.getAllData(),\n\t\tgetStore: () => store,\n\t});\n};\n"],"mappings":";;;;AAYA,IAAM,cAAN,MAAkB;CACjB,YACCA,aACiBC,uBAAyB,IAAI,OAC7C;EADgB;AAEjB,MAAI,YACH,MAAK,MAAM,CAAC,OAAO,QAAQ,IAAI,OAAO,QAAQ,YAAY,EAAE;GAC3D,MAAM,4BAAY,IAAI;AACtB,QAAK,MAAM,UAAU,QACpB,WAAU,IAAI,OAAO,IAAI,EAAE,GAAG,OAAQ,EAAC;AAExC,QAAK,KAAK,IAAI,OAAO,UAAU;EAC/B;CAEF;CAED,SAASC,WAAqC;AAC7C,OAAK,KAAK,KAAK,IAAI,UAAU,CAC5B,MAAK,KAAK,IAAI,2BAAW,IAAI,MAAM;AAEpC,SAAO,KAAK,KAAK,IAAI,UAAU;CAC/B;CAED,QAAQ;AACP,OAAK,KAAK,OAAO;CACjB;CAED,aAAa;EACZ,MAAMC,SAAgC,CAAE;AACxC,OAAK,MAAM,CAAC,OAAO,QAAQ,IAAI,KAAK,KAAK,SAAS,CACjD,QAAO,SAAS,MAAM,KAAK,QAAQ,QAAQ,CAAC;AAE7C,SAAO;CACP;AACD;AAED,SAAS,aAAaC,QAAaC,OAA0B;AAC5D,MAAK,SAAS,MAAM,WAAW,EAAG,QAAO;CAEzC,IAAIC,SAAyB;AAE7B,MAAK,MAAM,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