appos 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +399 -0
- package/build/client/assets/IconMail-BZadZvAd.js +1 -0
- package/build/client/assets/_-CgPm6_fJ.js +1 -0
- package/build/client/assets/_index-BCLDp_mg.js +1 -0
- package/build/client/assets/_layout-CTmjtKOZ.js +1 -0
- package/build/client/assets/_layout-HsJ3Zu5t.js +1 -0
- package/build/client/assets/_layout-OcS85aOt.js +1 -0
- package/build/client/assets/app-sidebar-Bm6e4kn_.js +1 -0
- package/build/client/assets/app-sidebar-D2Nsi85j.js +1 -0
- package/build/client/assets/auth-provider-rkzBVtYX.js +1 -0
- package/build/client/assets/brand-CbTWw97e.js +1 -0
- package/build/client/assets/browser-ponyfill-D3yQFvRu.js +2 -0
- package/build/client/assets/button-DtZhoqpk.js +1 -0
- package/build/client/assets/check-D5D2EGI4.js +1 -0
- package/build/client/assets/checkbox-B35Nn166.js +1 -0
- package/build/client/assets/chunk-JG3XND5A-BetDbdG0.js +1 -0
- package/build/client/assets/chunk-UIGDSWPH-DeiamgQc.js +26 -0
- package/build/client/assets/chunk-vBKQ29Cd.js +1 -0
- package/build/client/assets/circle-alert-DB4JluX5.js +1 -0
- package/build/client/assets/compare-Br3z3FUS-BXkA2ojG.js +2 -0
- package/build/client/assets/compiler-runtime-Co9svCia.js +1 -0
- package/build/client/assets/config-ChcA_Pkv.js +1 -0
- package/build/client/assets/createReactComponent-C2TSpqC7.js +1 -0
- package/build/client/assets/dialog-CQrpvURm.js +1 -0
- package/build/client/assets/dist-B6TkSbxV.js +1 -0
- package/build/client/assets/dist-BNO39Rfs.js +1 -0
- package/build/client/assets/dist-BWnI-4xl.js +1 -0
- package/build/client/assets/dist-CA21wN5I.js +1 -0
- package/build/client/assets/dist-CBNvQRbZ.js +1 -0
- package/build/client/assets/dist-CYRPrwOb.js +1 -0
- package/build/client/assets/dist-DKtC0FSi.js +1 -0
- package/build/client/assets/dist-DhfcebhF.js +1 -0
- package/build/client/assets/dist-VqaKdvZu.js +1 -0
- package/build/client/assets/dist-Yn6lj8QC.js +5 -0
- package/build/client/assets/dropdown-menu-CbzduuDa.js +1 -0
- package/build/client/assets/empty-DQRarCKT.js +1 -0
- package/build/client/assets/entry.client-BN1GPjAL.js +10 -0
- package/build/client/assets/es2015-BJguufLZ.js +41 -0
- package/build/client/assets/eye-Ctrln70x.js +1 -0
- package/build/client/assets/file-preview-dialog-BRkWSRN4.js +14 -0
- package/build/client/assets/index-Del2yBnb.js +1 -0
- package/build/client/assets/initReactI18next-CyHiepAw.js +1 -0
- package/build/client/assets/input-V1lM1yoz.js +1 -0
- package/build/client/assets/jsx-runtime-SCjaiuzT.js +1 -0
- package/build/client/assets/lock-Bj7dxHab.js +1 -0
- package/build/client/assets/manifest-ca813980.js +1 -0
- package/build/client/assets/nav-user-BqPUBe9x.js +1 -0
- package/build/client/assets/nav-user-Yu7wt7b_.js +1 -0
- package/build/client/assets/org-switcher-BIuearbE.js +1 -0
- package/build/client/assets/password-input-bor7e4TM.js +1 -0
- package/build/client/assets/react-dom-Bhi-1tDD.js +1 -0
- package/build/client/assets/realtime-BmU1LPhx.js +1 -0
- package/build/client/assets/root-CS5YIV-V.js +3 -0
- package/build/client/assets/root-D0CFuQYc.css +2 -0
- package/build/client/assets/route-B9cwW-UK.js +1 -0
- package/build/client/assets/route-BD2nV1q2.js +1 -0
- package/build/client/assets/route-BEnDcljt.js +1 -0
- package/build/client/assets/route-BR4LdxHR.js +1 -0
- package/build/client/assets/route-BU5TYmVE.js +0 -0
- package/build/client/assets/route-BVmIPEvK.js +11 -0
- package/build/client/assets/route-BY244T48.js +1 -0
- package/build/client/assets/route-Bwd903CU.js +1 -0
- package/build/client/assets/route-CN9iChOk.js +1 -0
- package/build/client/assets/route-CQ3p9Qb1.js +1 -0
- package/build/client/assets/route-CVLnTONw.js +1 -0
- package/build/client/assets/route-CoMZag4T.js +1 -0
- package/build/client/assets/route-CsYSLbnx.js +1 -0
- package/build/client/assets/route-DWNrq2GE.js +1 -0
- package/build/client/assets/route-Dxfmap_u.js +1 -0
- package/build/client/assets/route-Gnx1fkRX.js +0 -0
- package/build/client/assets/route-NduA4SS_.js +1 -0
- package/build/client/assets/route-u2hskgE_.js +1 -0
- package/build/client/assets/route-v9Jwv-AW.js +1 -0
- package/build/client/assets/select-DATRE76_.js +1 -0
- package/build/client/assets/separator-Cla0V581.js +1 -0
- package/build/client/assets/shim-TRiHENXu.js +1 -0
- package/build/client/assets/sidebar-CqrdL512.js +1 -0
- package/build/client/assets/site-header-CZO3qBhf.js +1 -0
- package/build/client/assets/site-header-CwidwSv1.js +1 -0
- package/build/client/assets/social-providers-Bz7f1_yd.js +1 -0
- package/build/client/assets/test-WdoqKbLa.js +1 -0
- package/build/client/assets/tooltip-BeDraHQn.js +1 -0
- package/build/client/assets/trpc-C1CjVipH.js +6 -0
- package/build/client/assets/trust-indicator-D4tEs4Dr.js +20 -0
- package/build/client/assets/use-file-upload-CNPfWC6W.js +1 -0
- package/build/client/assets/useTranslation-Bz7VuQ7j.js +1 -0
- package/build/client/assets/utils-InBzhUf_.js +1 -0
- package/build/client/assets/x-4CC8aqOW.js +1 -0
- package/build/client/favicon.ico +0 -0
- package/build/client/locales/en/emails.json +11 -0
- package/build/client/locales/en/translation.json +411 -0
- package/build/client/locales/zh-CN/emails.json +11 -0
- package/build/client/locales/zh-CN/translation.json +1 -0
- package/build/client/locales/zh-TW/emails.json +11 -0
- package/build/client/locales/zh-TW/translation.json +1 -0
- package/build/client/logo-invert.png +0 -0
- package/build/client/logo.png +0 -0
- package/build/lib/adapter-factory-CLtf7vT5-CTKiMV2u.mjs +19675 -0
- package/build/lib/bun-sqlite-dialect-DN7EKoIB-0pWIoG0L.mjs +155 -0
- package/build/lib/chunk-BYI67GdN.mjs +1 -0
- package/build/lib/chunk-CkKlU7xI.mjs +44 -0
- package/build/lib/client-BtuhFgvy.mjs +65 -0
- package/build/lib/client.d.ts +2272 -0
- package/build/lib/client.js +24 -0
- package/build/lib/date.d.ts +1 -0
- package/build/lib/date.js +1 -0
- package/build/lib/dialect-BeMwdQoz-D41NdSow.mjs +72 -0
- package/build/lib/dist-cjs-B43A5HXv.mjs +169 -0
- package/build/lib/dist-cjs-B_wkbabY.mjs +214 -0
- package/build/lib/dist-cjs-BmbYbMhp.mjs +143 -0
- package/build/lib/dist-cjs-Cc337rwW.mjs +7 -0
- package/build/lib/dist-cjs-CgzfN8xY.mjs +4974 -0
- package/build/lib/dist-cjs-DBFcizQf.mjs +50 -0
- package/build/lib/dist-cjs-DC-UL-xx.mjs +97 -0
- package/build/lib/dist-cjs-DHlTgXUO.mjs +6975 -0
- package/build/lib/dist-cjs-DYAmJYzN.mjs +323 -0
- package/build/lib/dist-cjs-Ddm6Stp9.mjs +1294 -0
- package/build/lib/dist-cjs-GFGBhaZg.mjs +84 -0
- package/build/lib/dist-cjs-ieCOxrOi.mjs +181 -0
- package/build/lib/dist-cjs-nbOGa7i_.mjs +47 -0
- package/build/lib/dist-cjs-pN6ekzMW.mjs +66 -0
- package/build/lib/dist-cjs-yYlQ1OiO.mjs +102 -0
- package/build/lib/esm-DPet4lFW.mjs +15816 -0
- package/build/lib/event-streams-x9fP9BzF.mjs +185 -0
- package/build/lib/file-preview-dialog-Cugg8tEc.mjs +59 -0
- package/build/lib/kysely-adapter-BTWfu5rn.mjs +183 -0
- package/build/lib/magic-string.es-jZcifc5m.mjs +1013 -0
- package/build/lib/memory-adapter-DiU519m9.mjs +147 -0
- package/build/lib/node-ponyfill-Dmm1SWTU.mjs +38212 -0
- package/build/lib/node-sqlite-dialect-BqISUSC3-DYvTLBpY.mjs +155 -0
- package/build/lib/package-DfozRyK6.mjs +5 -0
- package/build/lib/react-dom-CPjM_WCt.mjs +42 -0
- package/build/lib/server.d.mts +76273 -0
- package/build/lib/server.mjs +325 -0
- package/build/lib/sso-oidc-Qom0PEDW.mjs +1036 -0
- package/build/lib/sts-CLRaHSW_.mjs +13 -0
- package/build/lib/sts-Dl7yZqX1.mjs +1405 -0
- package/build/lib/test.d.mts +8922 -0
- package/build/lib/test.mjs +175650 -0
- package/build/lib/ui/index.d.ts +1643 -0
- package/build/lib/ui/index.js +160 -0
- package/build/lib/utils.d.ts +21 -0
- package/build/lib/utils.js +1 -0
- package/build/lib/zod.d.ts +1 -0
- package/build/lib/zod.js +23 -0
- package/build/main.js +2383 -0
- package/build/server/assets/context-BoNg86Eh.js +35 -0
- package/build/server/assets/dialog-B8YbGNaz.js +54 -0
- package/build/server/assets/file-preview-dialog-qWSViOWQ.js +15 -0
- package/build/server/assets/react-CFQ4y0AA.js +13 -0
- package/build/server/assets/react-dom-Ca1YUVo2.js +5 -0
- package/build/server/assets/server-build-BMOfm0ad.js +118 -0
- package/build/server/assets/server.node-B2oksIp8.js +196 -0
- package/build/server/assets/server.node-VQzoub0A.js +1 -0
- package/build/server/index.js +123 -0
- package/package.json +224 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { O as logger, t as createAdapterFactory } from "./adapter-factory-CLtf7vT5-CTKiMV2u.mjs";
|
|
2
|
+
|
|
3
|
+
//#region node_modules/better-auth/dist/adapters/memory-adapter/index.mjs
|
|
4
|
+
const memoryAdapter = (db, config) => {
|
|
5
|
+
let lazyOptions = null;
|
|
6
|
+
let adapterCreator = createAdapterFactory({
|
|
7
|
+
config: {
|
|
8
|
+
adapterId: "memory",
|
|
9
|
+
adapterName: "Memory Adapter",
|
|
10
|
+
usePlural: false,
|
|
11
|
+
debugLogs: config?.debugLogs || false,
|
|
12
|
+
customTransformInput(props) {
|
|
13
|
+
if ((props.options.advanced?.database?.useNumberId || props.options.advanced?.database?.generateId === "serial") && props.field === "id" && props.action === "create") return db[props.model].length + 1;
|
|
14
|
+
return props.data;
|
|
15
|
+
},
|
|
16
|
+
transaction: async (cb) => {
|
|
17
|
+
let clone = structuredClone(db);
|
|
18
|
+
try {
|
|
19
|
+
return await cb(adapterCreator(lazyOptions));
|
|
20
|
+
} catch (error) {
|
|
21
|
+
Object.keys(db).forEach((key) => {
|
|
22
|
+
db[key] = clone[key];
|
|
23
|
+
});
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
adapter: ({ getFieldName, options, debugLog, getModelName }) => {
|
|
29
|
+
function convertWhereClause(where, model) {
|
|
30
|
+
const table = db[model];
|
|
31
|
+
if (!table) {
|
|
32
|
+
logger.error(`[MemoryAdapter] Model ${model} not found in the DB`, Object.keys(db));
|
|
33
|
+
throw new Error(`Model ${model} not found`);
|
|
34
|
+
}
|
|
35
|
+
const evalClause = (record, clause) => {
|
|
36
|
+
const { field, value, operator } = clause;
|
|
37
|
+
switch (operator) {
|
|
38
|
+
case "in":
|
|
39
|
+
if (!Array.isArray(value)) throw new Error("Value must be an array");
|
|
40
|
+
return value.includes(record[field]);
|
|
41
|
+
case "not_in":
|
|
42
|
+
if (!Array.isArray(value)) throw new Error("Value must be an array");
|
|
43
|
+
return !value.includes(record[field]);
|
|
44
|
+
case "contains": return record[field].includes(value);
|
|
45
|
+
case "starts_with": return record[field].startsWith(value);
|
|
46
|
+
case "ends_with": return record[field].endsWith(value);
|
|
47
|
+
case "ne": return record[field] !== value;
|
|
48
|
+
case "gt": return value != null && Boolean(record[field] > value);
|
|
49
|
+
case "gte": return value != null && Boolean(record[field] >= value);
|
|
50
|
+
case "lt": return value != null && Boolean(record[field] < value);
|
|
51
|
+
case "lte": return value != null && Boolean(record[field] <= value);
|
|
52
|
+
default: return record[field] === value;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return table.filter((record) => {
|
|
56
|
+
if (!where.length || where.length === 0) return true;
|
|
57
|
+
let result = evalClause(record, where[0]);
|
|
58
|
+
for (const clause of where) {
|
|
59
|
+
const clauseResult = evalClause(record, clause);
|
|
60
|
+
if (clause.connector === "OR") result = result || clauseResult;
|
|
61
|
+
else result = result && clauseResult;
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
create: async ({ model, data }) => {
|
|
68
|
+
if (options.advanced?.database?.useNumberId || options.advanced?.database?.generateId === "serial") data.id = db[getModelName(model)].length + 1;
|
|
69
|
+
if (!db[model]) db[model] = [];
|
|
70
|
+
db[model].push(data);
|
|
71
|
+
return data;
|
|
72
|
+
},
|
|
73
|
+
findOne: async ({ model, where }) => {
|
|
74
|
+
return convertWhereClause(where, model)[0] || null;
|
|
75
|
+
},
|
|
76
|
+
findMany: async ({ model, where, sortBy, limit, offset }) => {
|
|
77
|
+
let table = db[model];
|
|
78
|
+
if (where) table = convertWhereClause(where, model);
|
|
79
|
+
if (sortBy) table = table.sort((a, b) => {
|
|
80
|
+
const field = getFieldName({
|
|
81
|
+
model,
|
|
82
|
+
field: sortBy.field
|
|
83
|
+
});
|
|
84
|
+
const aValue = a[field];
|
|
85
|
+
const bValue = b[field];
|
|
86
|
+
let comparison = 0;
|
|
87
|
+
if (aValue == null && bValue == null) comparison = 0;
|
|
88
|
+
else if (aValue == null) comparison = -1;
|
|
89
|
+
else if (bValue == null) comparison = 1;
|
|
90
|
+
else if (typeof aValue === "string" && typeof bValue === "string") comparison = aValue.localeCompare(bValue);
|
|
91
|
+
else if (aValue instanceof Date && bValue instanceof Date) comparison = aValue.getTime() - bValue.getTime();
|
|
92
|
+
else if (typeof aValue === "number" && typeof bValue === "number") comparison = aValue - bValue;
|
|
93
|
+
else if (typeof aValue === "boolean" && typeof bValue === "boolean") comparison = aValue === bValue ? 0 : aValue ? 1 : -1;
|
|
94
|
+
else comparison = String(aValue).localeCompare(String(bValue));
|
|
95
|
+
return sortBy.direction === "asc" ? comparison : -comparison;
|
|
96
|
+
});
|
|
97
|
+
if (offset !== void 0) table = table.slice(offset);
|
|
98
|
+
if (limit !== void 0) table = table.slice(0, limit);
|
|
99
|
+
return table || [];
|
|
100
|
+
},
|
|
101
|
+
count: async ({ model, where }) => {
|
|
102
|
+
if (where) return convertWhereClause(where, model).length;
|
|
103
|
+
return db[model].length;
|
|
104
|
+
},
|
|
105
|
+
update: async ({ model, where, update }) => {
|
|
106
|
+
const res = convertWhereClause(where, model);
|
|
107
|
+
res.forEach((record) => {
|
|
108
|
+
Object.assign(record, update);
|
|
109
|
+
});
|
|
110
|
+
return res[0] || null;
|
|
111
|
+
},
|
|
112
|
+
delete: async ({ model, where }) => {
|
|
113
|
+
const table = db[model];
|
|
114
|
+
const res = convertWhereClause(where, model);
|
|
115
|
+
db[model] = table.filter((record) => !res.includes(record));
|
|
116
|
+
},
|
|
117
|
+
deleteMany: async ({ model, where }) => {
|
|
118
|
+
const table = db[model];
|
|
119
|
+
const res = convertWhereClause(where, model);
|
|
120
|
+
let count = 0;
|
|
121
|
+
db[model] = table.filter((record) => {
|
|
122
|
+
if (res.includes(record)) {
|
|
123
|
+
count++;
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
return !res.includes(record);
|
|
127
|
+
});
|
|
128
|
+
return count;
|
|
129
|
+
},
|
|
130
|
+
updateMany({ model, where, update }) {
|
|
131
|
+
const res = convertWhereClause(where, model);
|
|
132
|
+
res.forEach((record) => {
|
|
133
|
+
Object.assign(record, update);
|
|
134
|
+
});
|
|
135
|
+
return res[0] || null;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
return (options) => {
|
|
141
|
+
lazyOptions = options;
|
|
142
|
+
return adapterCreator(options);
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
//#endregion
|
|
147
|
+
export { memoryAdapter };
|