@geekmidas/testkit 10.0.0-alpha.3 → 10.0.0-alpha.30
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/README.md +74 -0
- package/dist/Factory.cjs +51 -2
- package/dist/Factory.cjs.map +1 -0
- package/dist/Factory.d.cts +143 -3
- package/dist/Factory.d.cts.map +1 -0
- package/dist/Factory.d.mts +143 -3
- package/dist/Factory.d.mts.map +1 -0
- package/dist/Factory.mjs +50 -2
- package/dist/Factory.mjs.map +1 -0
- package/dist/KyselyFactory.cjs +237 -4
- package/dist/KyselyFactory.cjs.map +1 -0
- package/dist/KyselyFactory.d.cts +224 -4
- package/dist/KyselyFactory.d.cts.map +1 -0
- package/dist/KyselyFactory.d.mts +224 -4
- package/dist/KyselyFactory.d.mts.map +1 -0
- package/dist/KyselyFactory.mjs +236 -4
- package/dist/KyselyFactory.mjs.map +1 -0
- package/dist/ObjectionFactory.cjs +265 -4
- package/dist/ObjectionFactory.cjs.map +1 -0
- package/dist/ObjectionFactory.d.cts +237 -4
- package/dist/ObjectionFactory.d.cts.map +1 -0
- package/dist/ObjectionFactory.d.mts +237 -4
- package/dist/ObjectionFactory.d.mts.map +1 -0
- package/dist/ObjectionFactory.mjs +264 -4
- package/dist/ObjectionFactory.mjs.map +1 -0
- package/dist/PostgresKyselyMigrator.cjs +94 -3
- package/dist/PostgresKyselyMigrator.cjs.map +1 -0
- package/dist/PostgresKyselyMigrator.d.cts +80 -3
- package/dist/PostgresKyselyMigrator.d.cts.map +1 -0
- package/dist/PostgresKyselyMigrator.d.mts +80 -3
- package/dist/PostgresKyselyMigrator.d.mts.map +1 -0
- package/dist/PostgresKyselyMigrator.mjs +93 -3
- package/dist/PostgresKyselyMigrator.mjs.map +1 -0
- package/dist/{PostgresMigrator-C_QQ6q35.d.mts → PostgresMigrator-CDPnnwMJ.d.cts} +11 -5
- package/dist/PostgresMigrator-CDPnnwMJ.d.cts.map +1 -0
- package/dist/{PostgresMigrator-CeYy-eHF.d.cts → PostgresMigrator-CDPnnwMJ.d.mts} +11 -5
- package/dist/PostgresMigrator-CDPnnwMJ.d.mts.map +1 -0
- package/dist/PostgresMigrator.cjs +178 -2
- package/dist/PostgresMigrator.cjs.map +1 -0
- package/dist/PostgresMigrator.d.cts +1 -1
- package/dist/PostgresMigrator.d.mts +1 -1
- package/dist/PostgresMigrator.mjs +175 -2
- package/dist/PostgresMigrator.mjs.map +1 -0
- package/dist/PostgresObjectionMigrator.cjs +118 -3
- package/dist/PostgresObjectionMigrator.cjs.map +1 -0
- package/dist/PostgresObjectionMigrator.d.cts +75 -3
- package/dist/PostgresObjectionMigrator.d.cts.map +1 -0
- package/dist/PostgresObjectionMigrator.d.mts +75 -3
- package/dist/PostgresObjectionMigrator.d.mts.map +1 -0
- package/dist/PostgresObjectionMigrator.mjs +117 -3
- package/dist/PostgresObjectionMigrator.mjs.map +1 -0
- package/dist/VitestKyselyTransactionIsolator.cjs +66 -3
- package/dist/VitestKyselyTransactionIsolator.cjs.map +1 -0
- package/dist/VitestKyselyTransactionIsolator.d.cts +60 -3
- package/dist/VitestKyselyTransactionIsolator.d.cts.map +1 -0
- package/dist/VitestKyselyTransactionIsolator.d.mts +60 -3
- package/dist/VitestKyselyTransactionIsolator.d.mts.map +1 -0
- package/dist/VitestKyselyTransactionIsolator.mjs +65 -3
- package/dist/VitestKyselyTransactionIsolator.mjs.map +1 -0
- package/dist/VitestObjectionTransactionIsolator.cjs +62 -3
- package/dist/VitestObjectionTransactionIsolator.cjs.map +1 -0
- package/dist/VitestObjectionTransactionIsolator.d.cts +56 -3
- package/dist/VitestObjectionTransactionIsolator.d.cts.map +1 -0
- package/dist/VitestObjectionTransactionIsolator.d.mts +56 -3
- package/dist/VitestObjectionTransactionIsolator.d.mts.map +1 -0
- package/dist/VitestObjectionTransactionIsolator.mjs +61 -3
- package/dist/VitestObjectionTransactionIsolator.mjs.map +1 -0
- package/dist/VitestTransactionIsolator.cjs +187 -4
- package/dist/VitestTransactionIsolator.cjs.map +1 -0
- package/dist/VitestTransactionIsolator.d.cts +219 -2
- package/dist/VitestTransactionIsolator.d.cts.map +1 -0
- package/dist/VitestTransactionIsolator.d.mts +219 -2
- package/dist/VitestTransactionIsolator.d.mts.map +1 -0
- package/dist/VitestTransactionIsolator.mjs +184 -2
- package/dist/VitestTransactionIsolator.mjs.map +1 -0
- package/dist/aws.cjs +3 -4
- package/dist/aws.cjs.map +1 -1
- package/dist/aws.d.cts +3 -8
- package/dist/aws.d.cts.map +1 -1
- package/dist/aws.d.mts +3 -8
- package/dist/aws.d.mts.map +1 -1
- package/dist/aws.mjs +1 -2
- 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 +4 -6
- package/dist/benchmark.d.cts.map +1 -1
- package/dist/benchmark.d.mts +4 -6
- 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 +31 -15
- package/dist/better-auth.cjs.map +1 -1
- package/dist/better-auth.d.cts +13142 -4
- package/dist/better-auth.d.cts.map +1 -1
- package/dist/better-auth.d.mts +13142 -4
- package/dist/better-auth.d.mts.map +1 -1
- package/dist/better-auth.mjs +29 -13
- package/dist/better-auth.mjs.map +1 -1
- package/dist/browser.cjs +127 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +47 -0
- package/dist/browser.d.cts.map +1 -0
- package/dist/browser.d.mts +47 -0
- package/dist/browser.d.mts.map +1 -0
- package/dist/browser.mjs +125 -0
- package/dist/browser.mjs.map +1 -0
- package/dist/context.cjs +80 -0
- package/dist/context.cjs.map +1 -0
- package/dist/context.d.cts +55 -0
- package/dist/context.d.cts.map +1 -0
- package/dist/context.d.mts +55 -0
- package/dist/context.d.mts.map +1 -0
- package/dist/context.mjs +73 -0
- package/dist/context.mjs.map +1 -0
- package/dist/faker.cjs +262 -8
- package/dist/faker.cjs.map +1 -0
- package/dist/faker.d.cts +162 -2
- package/dist/faker.d.cts.map +1 -0
- package/dist/faker.d.mts +162 -2
- package/dist/faker.d.mts.map +1 -0
- package/dist/faker.mjs +255 -2
- package/dist/faker.mjs.map +1 -0
- package/dist/helpers.cjs +6 -5
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +1 -5
- package/dist/helpers.d.cts.map +1 -1
- package/dist/helpers.d.mts +1 -5
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs +1 -2
- 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 +2 -4
- package/dist/initScript.d.cts.map +1 -1
- package/dist/initScript.d.mts +2 -4
- package/dist/initScript.d.mts.map +1 -1
- package/dist/initScript.mjs +10 -12
- package/dist/initScript.mjs.map +1 -1
- package/dist/kysely.cjs +10 -13
- package/dist/kysely.cjs.map +1 -1
- package/dist/kysely.d.cts +10 -14
- package/dist/kysely.d.cts.map +1 -1
- package/dist/kysely.d.mts +10 -14
- package/dist/kysely.d.mts.map +1 -1
- package/dist/kysely.mjs +10 -14
- package/dist/kysely.mjs.map +1 -1
- package/dist/logger.cjs +3 -4
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.d.cts +1 -5
- package/dist/logger.d.cts.map +1 -1
- package/dist/logger.d.mts +1 -5
- package/dist/logger.d.mts.map +1 -1
- package/dist/logger.mjs +1 -2
- package/dist/logger.mjs.map +1 -1
- package/dist/mailbox.cjs +95 -0
- package/dist/mailbox.cjs.map +1 -0
- package/dist/mailbox.d.cts +58 -0
- package/dist/mailbox.d.cts.map +1 -0
- package/dist/mailbox.d.mts +58 -0
- package/dist/mailbox.d.mts.map +1 -0
- package/dist/mailbox.mjs +92 -0
- package/dist/mailbox.mjs.map +1 -0
- package/dist/objection.cjs +10 -13
- package/dist/objection.cjs.map +1 -1
- package/dist/objection.d.cts +10 -14
- package/dist/objection.d.cts.map +1 -1
- package/dist/objection.d.mts +10 -14
- package/dist/objection.d.mts.map +1 -1
- package/dist/objection.mjs +10 -14
- package/dist/objection.mjs.map +1 -1
- package/dist/os/directory.cjs +31 -2
- package/dist/os/directory.cjs.map +1 -0
- package/dist/os/directory.d.cts +9 -2
- package/dist/os/directory.d.cts.map +1 -0
- package/dist/os/directory.d.mts +9 -2
- package/dist/os/directory.d.mts.map +1 -0
- package/dist/os/directory.mjs +25 -2
- package/dist/os/directory.mjs.map +1 -0
- 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 +2 -3
- package/dist/requestContext.cjs +10 -11
- package/dist/requestContext.cjs.map +1 -1
- package/dist/requestContext.d.cts +4 -8
- package/dist/requestContext.d.cts.map +1 -1
- package/dist/requestContext.d.mts +4 -8
- package/dist/requestContext.d.mts.map +1 -1
- package/dist/requestContext.mjs +1 -2
- package/dist/requestContext.mjs.map +1 -1
- package/dist/{chunk-CUT6urMc.cjs → rolldown-runtime-VH7oDXx4.cjs} +8 -10
- package/dist/timer.cjs +2 -2
- package/dist/timer.cjs.map +1 -1
- package/dist/timer.d.cts +1 -4
- package/dist/timer.d.cts.map +1 -1
- package/dist/timer.d.mts +1 -4
- package/dist/timer.d.mts.map +1 -1
- package/dist/timer.mjs +1 -1
- package/dist/timer.mjs.map +1 -1
- package/dist/transactions.cjs +123 -0
- package/dist/transactions.cjs.map +1 -0
- package/dist/transactions.d.cts +44 -0
- package/dist/transactions.d.cts.map +1 -0
- package/dist/transactions.d.mts +44 -0
- package/dist/transactions.d.mts.map +1 -0
- package/dist/transactions.mjs +118 -0
- package/dist/transactions.mjs.map +1 -0
- package/package.json +59 -16
- package/dist/Factory-BFVnMMCC.mjs +0 -51
- package/dist/Factory-BFVnMMCC.mjs.map +0 -1
- package/dist/Factory-BOX312yd.d.cts +0 -147
- package/dist/Factory-BOX312yd.d.cts.map +0 -1
- package/dist/Factory-BhjUOBWN.cjs +0 -57
- package/dist/Factory-BhjUOBWN.cjs.map +0 -1
- package/dist/Factory-C6W78ulZ.d.mts +0 -147
- package/dist/Factory-C6W78ulZ.d.mts.map +0 -1
- package/dist/KyselyFactory-BFqVIn_0.cjs +0 -246
- package/dist/KyselyFactory-BFqVIn_0.cjs.map +0 -1
- package/dist/KyselyFactory-Cc2UmOJk.d.mts +0 -228
- package/dist/KyselyFactory-Cc2UmOJk.d.mts.map +0 -1
- package/dist/KyselyFactory-DMswpwji.mjs +0 -241
- package/dist/KyselyFactory-DMswpwji.mjs.map +0 -1
- package/dist/KyselyFactory-Dy5zzV4B.d.cts +0 -228
- package/dist/KyselyFactory-Dy5zzV4B.d.cts.map +0 -1
- package/dist/ObjectionFactory-BYnPr9ZP.d.mts +0 -241
- package/dist/ObjectionFactory-BYnPr9ZP.d.mts.map +0 -1
- package/dist/ObjectionFactory-BeFBYcan.cjs +0 -272
- package/dist/ObjectionFactory-BeFBYcan.cjs.map +0 -1
- package/dist/ObjectionFactory-CD-WFuMJ.d.cts +0 -241
- package/dist/ObjectionFactory-CD-WFuMJ.d.cts.map +0 -1
- package/dist/ObjectionFactory-QCJ7u0Ql.mjs +0 -267
- package/dist/ObjectionFactory-QCJ7u0Ql.mjs.map +0 -1
- package/dist/PostgresKyselyMigrator-B2M6Gjvv.d.cts +0 -84
- package/dist/PostgresKyselyMigrator-B2M6Gjvv.d.cts.map +0 -1
- package/dist/PostgresKyselyMigrator-BGBxjnFv.cjs +0 -101
- package/dist/PostgresKyselyMigrator-BGBxjnFv.cjs.map +0 -1
- package/dist/PostgresKyselyMigrator-CvwXycJE.d.mts +0 -84
- package/dist/PostgresKyselyMigrator-CvwXycJE.d.mts.map +0 -1
- package/dist/PostgresKyselyMigrator-PI0QhvB1.mjs +0 -95
- package/dist/PostgresKyselyMigrator-PI0QhvB1.mjs.map +0 -1
- package/dist/PostgresMigrator-C_QQ6q35.d.mts.map +0 -1
- package/dist/PostgresMigrator-CeYy-eHF.d.cts.map +0 -1
- package/dist/PostgresMigrator-DVAY04qN.mjs +0 -166
- package/dist/PostgresMigrator-DVAY04qN.mjs.map +0 -1
- package/dist/PostgresMigrator-M9jpzOvN.cjs +0 -172
- package/dist/PostgresMigrator-M9jpzOvN.cjs.map +0 -1
- package/dist/PostgresObjectionMigrator-1j6YIB1c.d.mts +0 -79
- package/dist/PostgresObjectionMigrator-1j6YIB1c.d.mts.map +0 -1
- package/dist/PostgresObjectionMigrator-DHVC9h_P.d.cts +0 -79
- package/dist/PostgresObjectionMigrator-DHVC9h_P.d.cts.map +0 -1
- package/dist/PostgresObjectionMigrator-DSaPhwjY.cjs +0 -123
- package/dist/PostgresObjectionMigrator-DSaPhwjY.cjs.map +0 -1
- package/dist/PostgresObjectionMigrator-DjPKdUbm.mjs +0 -118
- package/dist/PostgresObjectionMigrator-DjPKdUbm.mjs.map +0 -1
- package/dist/VitestKyselyTransactionIsolator-1Saieke7.mjs +0 -67
- package/dist/VitestKyselyTransactionIsolator-1Saieke7.mjs.map +0 -1
- package/dist/VitestKyselyTransactionIsolator-BjJSXryR.cjs +0 -72
- package/dist/VitestKyselyTransactionIsolator-BjJSXryR.cjs.map +0 -1
- package/dist/VitestKyselyTransactionIsolator-CwlTo6yf.d.mts +0 -64
- package/dist/VitestKyselyTransactionIsolator-CwlTo6yf.d.mts.map +0 -1
- package/dist/VitestKyselyTransactionIsolator-DJasVuIZ.d.cts +0 -64
- package/dist/VitestKyselyTransactionIsolator-DJasVuIZ.d.cts.map +0 -1
- package/dist/VitestObjectionTransactionIsolator-B_VSWFum.mjs +0 -63
- package/dist/VitestObjectionTransactionIsolator-B_VSWFum.mjs.map +0 -1
- package/dist/VitestObjectionTransactionIsolator-CTTjvTPO.d.cts +0 -60
- package/dist/VitestObjectionTransactionIsolator-CTTjvTPO.d.cts.map +0 -1
- package/dist/VitestObjectionTransactionIsolator-CyZG6nq4.d.mts +0 -60
- package/dist/VitestObjectionTransactionIsolator-CyZG6nq4.d.mts.map +0 -1
- package/dist/VitestObjectionTransactionIsolator-DDoJTu7e.cjs +0 -68
- package/dist/VitestObjectionTransactionIsolator-DDoJTu7e.cjs.map +0 -1
- package/dist/VitestTransactionIsolator-BLaw80cx.d.mts +0 -223
- package/dist/VitestTransactionIsolator-BLaw80cx.d.mts.map +0 -1
- package/dist/VitestTransactionIsolator-CvwPecpl.mjs +0 -188
- package/dist/VitestTransactionIsolator-CvwPecpl.mjs.map +0 -1
- package/dist/VitestTransactionIsolator-DyiX-QtK.cjs +0 -206
- package/dist/VitestTransactionIsolator-DyiX-QtK.cjs.map +0 -1
- package/dist/VitestTransactionIsolator-glcxyS_R.d.cts +0 -223
- package/dist/VitestTransactionIsolator-glcxyS_R.d.cts.map +0 -1
- package/dist/directory-BxjqmtCT.mjs +0 -27
- package/dist/directory-BxjqmtCT.mjs.map +0 -1
- package/dist/directory-DD_xQoSh.cjs +0 -33
- package/dist/directory-DD_xQoSh.cjs.map +0 -1
- package/dist/directory-DGOcVlKD.d.cts +0 -13
- package/dist/directory-DGOcVlKD.d.cts.map +0 -1
- package/dist/directory-DiQ_DkaF.d.mts +0 -13
- package/dist/directory-DiQ_DkaF.d.mts.map +0 -1
- package/dist/faker-B14IEMIN.cjs +0 -304
- package/dist/faker-B14IEMIN.cjs.map +0 -1
- package/dist/faker-BGKYFoCT.mjs +0 -262
- package/dist/faker-BGKYFoCT.mjs.map +0 -1
- package/dist/faker-Cg76aFNO.d.cts +0 -166
- package/dist/faker-Cg76aFNO.d.cts.map +0 -1
- package/dist/faker-D9gz7KjY.d.mts +0 -166
- package/dist/faker-D9gz7KjY.d.mts.map +0 -1
package/dist/better-auth.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let better_auth_adapters = require("better-auth/adapters");
|
|
4
3
|
//#region src/better-auth.ts
|
|
5
4
|
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,8 +28,10 @@ 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,
|
|
32
|
-
const
|
|
31
|
+
const { field, operator = "eq", connector = "AND", mode } = condition;
|
|
32
|
+
const fold = mode === "insensitive" ? (v) => typeof v === "string" ? v.toLowerCase() : v : (v) => v;
|
|
33
|
+
const recordValue = fold(record[field]);
|
|
34
|
+
const value = Array.isArray(condition.value) ? condition.value.map(fold) : fold(condition.value);
|
|
33
35
|
let matches = false;
|
|
34
36
|
switch (operator) {
|
|
35
37
|
case "eq":
|
|
@@ -99,7 +101,7 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
99
101
|
supportsBooleans: true,
|
|
100
102
|
supportsNumericIds: false
|
|
101
103
|
},
|
|
102
|
-
adapter: ({ debugLog, getModelName, transformWhereClause }) => ({
|
|
104
|
+
adapter: ({ debugLog, getModelName, getFieldName, transformWhereClause }) => ({
|
|
103
105
|
create: async ({ data, model }) => {
|
|
104
106
|
debugLog("CREATE", {
|
|
105
107
|
model,
|
|
@@ -122,12 +124,13 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
122
124
|
const modelData = storeInstance.getModel(modelName);
|
|
123
125
|
const transformedWhere = transformWhereClause({
|
|
124
126
|
model,
|
|
125
|
-
where
|
|
127
|
+
where,
|
|
128
|
+
action: "findOne"
|
|
126
129
|
});
|
|
127
130
|
for (const record of modelData.values()) if (matchesWhere(record, transformedWhere)) return record;
|
|
128
131
|
return null;
|
|
129
132
|
},
|
|
130
|
-
findMany: async ({ where, model, limit, offset, sortBy }) => {
|
|
133
|
+
findMany: async ({ where, model, limit, offset, sortBy, select }) => {
|
|
131
134
|
debugLog("FIND_MANY", {
|
|
132
135
|
model,
|
|
133
136
|
where
|
|
@@ -136,12 +139,20 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
136
139
|
const modelData = storeInstance.getModel(modelName);
|
|
137
140
|
const transformedWhere = transformWhereClause({
|
|
138
141
|
model,
|
|
139
|
-
where
|
|
142
|
+
where,
|
|
143
|
+
action: "findMany"
|
|
140
144
|
});
|
|
141
145
|
let results = Array.from(modelData.values()).filter((record) => matchesWhere(record, transformedWhere));
|
|
142
146
|
if (sortBy) results = applySorting(results, sortBy);
|
|
143
147
|
if (offset) results = results.slice(offset);
|
|
144
148
|
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
|
+
}
|
|
145
156
|
return results;
|
|
146
157
|
},
|
|
147
158
|
update: async ({ where, update, model }) => {
|
|
@@ -153,7 +164,8 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
153
164
|
const modelData = storeInstance.getModel(modelName);
|
|
154
165
|
const transformedWhere = transformWhereClause({
|
|
155
166
|
model,
|
|
156
|
-
where
|
|
167
|
+
where,
|
|
168
|
+
action: "update"
|
|
157
169
|
});
|
|
158
170
|
for (const [id, record] of modelData.entries()) if (matchesWhere(record, transformedWhere)) {
|
|
159
171
|
const updated = {
|
|
@@ -174,7 +186,8 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
174
186
|
const modelData = storeInstance.getModel(modelName);
|
|
175
187
|
const transformedWhere = transformWhereClause({
|
|
176
188
|
model,
|
|
177
|
-
where
|
|
189
|
+
where,
|
|
190
|
+
action: "updateMany"
|
|
178
191
|
});
|
|
179
192
|
let count = 0;
|
|
180
193
|
for (const [id, record] of modelData.entries()) if (matchesWhere(record, transformedWhere)) {
|
|
@@ -195,7 +208,8 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
195
208
|
const modelData = storeInstance.getModel(modelName);
|
|
196
209
|
const transformedWhere = transformWhereClause({
|
|
197
210
|
model,
|
|
198
|
-
where
|
|
211
|
+
where,
|
|
212
|
+
action: "delete"
|
|
199
213
|
});
|
|
200
214
|
for (const [id, record] of modelData.entries()) if (matchesWhere(record, transformedWhere)) {
|
|
201
215
|
modelData.delete(id);
|
|
@@ -211,7 +225,8 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
211
225
|
const modelData = storeInstance.getModel(modelName);
|
|
212
226
|
const transformedWhere = transformWhereClause({
|
|
213
227
|
model,
|
|
214
|
-
where
|
|
228
|
+
where,
|
|
229
|
+
action: "deleteMany"
|
|
215
230
|
});
|
|
216
231
|
const toDelete = [];
|
|
217
232
|
for (const [id, record] of modelData.entries()) if (matchesWhere(record, transformedWhere)) toDelete.push(id);
|
|
@@ -223,7 +238,8 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
223
238
|
const modelData = storeInstance.getModel(modelName);
|
|
224
239
|
const transformedWhere = transformWhereClause({
|
|
225
240
|
model,
|
|
226
|
-
where
|
|
241
|
+
where,
|
|
242
|
+
action: "count"
|
|
227
243
|
});
|
|
228
244
|
return Array.from(modelData.values()).filter((record) => matchesWhere(record, transformedWhere)).length;
|
|
229
245
|
}
|
|
@@ -235,7 +251,7 @@ const memoryAdapter = (config = {}, store = /* @__PURE__ */ new Map()) => {
|
|
|
235
251
|
getStore: () => store
|
|
236
252
|
});
|
|
237
253
|
};
|
|
238
|
-
|
|
239
254
|
//#endregion
|
|
240
255
|
exports.memoryAdapter = memoryAdapter;
|
|
256
|
+
|
|
241
257
|
//# sourceMappingURL=better-auth.cjs.map
|
package/dist/better-auth.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,aAAa,OAAO;EAC9B,MAAM,EAAE,OAAO,OAAO,WAAW,MAAM,YAAY,OAAO,GAAG;EAC7D,MAAM,cAAc,OAAO;EAE3B,IAAI,UAAU;AAEd,UAAQ,UAAR;GAC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C;AAE/D,SAAK,MAAM,CAAC,IAAI,OAAO,IAAI,UAAU,SAAS,CAC7C,KAAI,aAAa,QAAQ,iBAAiB,EAAE;AAC3C,eAAU,OAAO,GAAG;AACpB;IACA;GAEF;GAED,YAAY,OAAO,EAAE,OAAO,OAAO,KAAK;AACvC,aAAS,eAAe;KAAE;KAAO;IAAO,EAAC;IACzC,MAAM,YAAY,aAAa,MAAM;IACrC,MAAM,YAAY,cAAc,SAAS,UAAU;IACnD,MAAM,mBAAmB,qBAAqB;KAAE;KAAO;IAAO,EAAC;IAE/D,MAAMC,WAAqB,CAAE;AAC7B,SAAK,MAAM,CAAC,IAAI,OAAO,IAAI,UAAU,SAAS,CAC7C,KAAI,aAAa,QAAQ,iBAAiB,CACzC,UAAS,KAAK,GAAG;AAInB,SAAK,MAAM,MAAM,SAChB,WAAU,OAAO,GAAG;AAErB,WAAO,SAAS;GAChB;GAED,OAAO,OAAO,EAAE,OAAO,OAAO,KAAK;IAClC,MAAM,YAAY,aAAa,MAAM;IACrC,MAAM,YAAY,cAAc,SAAS,UAAU;IACnD,MAAM,mBAAmB,qBAAqB;KAAE;KAAO;IAAO,EAAC;AAE/D,WAAO,MAAM,KAAK,UAAU,QAAQ,CAAC,CAAC,OAAO,CAAC,WAC7C,aAAa,QAAQ,iBAAiB,CACtC,CAAC;GACF;EACD;CACD,EAAC;AAGF,QAAO,OAAO,OAAO,iBAAiB;EACrC,OAAO,MAAM,MAAM,OAAO;EAC1B,YAAY,MAAM,cAAc,YAAY;EAC5C,UAAU,MAAM;CAChB,EAAC;AACF"}
|
|
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,OA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