@kyro-cms/admin 0.1.2 → 0.1.3
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/package.json +17 -6
- package/src/components/Admin.tsx +50 -1
- package/src/components/LoginPage.tsx +223 -0
- package/src/components/layout/Sidebar.tsx +35 -0
- package/src/index.ts +35 -0
- package/src/middleware.ts +2 -0
- package/src/pages/api/auth/register.ts +133 -0
- package/src/styles/main.css +148 -0
- package/.astro/content.d.ts +0 -154
- package/.astro/settings.json +0 -5
- package/.astro/types.d.ts +0 -2
- package/astro.config.mjs +0 -28
- package/bun.lock +0 -1374
- package/dist/client/_astro/AdminLayout.DkDpng53.css +0 -1
- package/dist/client/_astro/AutoForm.3eJCmCJp.js +0 -1
- package/dist/client/_astro/client.DyczpTbx.js +0 -9
- package/dist/client/_astro/index.B02hbnpo.js +0 -1
- package/dist/client/fonts/Serotiva-Black.woff2 +0 -0
- package/dist/client/fonts/Serotiva-Bold.woff2 +0 -0
- package/dist/client/fonts/Serotiva-Medium.woff2 +0 -0
- package/dist/client/fonts/Serotiva-Regular.woff2 +0 -0
- package/dist/client/fonts/Serotiva-SemiBold.woff2 +0 -0
- package/dist/server/chunks/AdminLayout_D-_JeUqC.mjs +0 -26
- package/dist/server/chunks/_id__BzI_o0qT.mjs +0 -50
- package/dist/server/chunks/_id__Cd-jOuY3.mjs +0 -238
- package/dist/server/chunks/_id__DvbD--iR.mjs +0 -992
- package/dist/server/chunks/_id__vpVaEo16.mjs +0 -128
- package/dist/server/chunks/_virtual_astro_server-island-manifest_CQQ1F5PF.mjs +0 -7
- package/dist/server/chunks/_virtual_astro_session-driver_Bk3Q189E.mjs +0 -4
- package/dist/server/chunks/astro-component_Dbx3T2Nh.mjs +0 -37
- package/dist/server/chunks/audit-logs_DrnUMRvY.mjs +0 -74
- package/dist/server/chunks/config_CPXslElD.mjs +0 -4221
- package/dist/server/chunks/dataStore_Dl7cA2Qp.mjs +0 -89
- package/dist/server/chunks/index_CVqOkerS.mjs +0 -2960
- package/dist/server/chunks/index_CX8SQ4BF.mjs +0 -55
- package/dist/server/chunks/index_CYofDU51.mjs +0 -58
- package/dist/server/chunks/index_DdNRhuaM.mjs +0 -55
- package/dist/server/chunks/index_DupPvtIF.mjs +0 -42
- package/dist/server/chunks/index_YTS_M-B9.mjs +0 -263
- package/dist/server/chunks/index_YeCzuVps.mjs +0 -53
- package/dist/server/chunks/login_DLyqMRO8.mjs +0 -93
- package/dist/server/chunks/logout_CSbt5wea.mjs +0 -50
- package/dist/server/chunks/me_C04jlYhH.mjs +0 -41
- package/dist/server/chunks/new_BbQ9b55M.mjs +0 -92
- package/dist/server/chunks/node_9bvTewss.mjs +0 -1014
- package/dist/server/chunks/noop-entrypoint_BOlrdqWF.mjs +0 -3
- package/dist/server/chunks/sequence_9cl7AJy-.mjs +0 -2503
- package/dist/server/chunks/server_peBx9VXG.mjs +0 -8117
- package/dist/server/chunks/sharp_pmJ7nHES.mjs +0 -142
- package/dist/server/chunks/users_Dzddy_YR.mjs +0 -137
- package/dist/server/entry.mjs +0 -5
- package/dist/server/virtual_astro_middleware.mjs +0 -48
- package/public/fonts/Serotiva-Black.woff2 +0 -0
- package/public/fonts/Serotiva-Bold.woff2 +0 -0
- package/public/fonts/Serotiva-Medium.woff2 +0 -0
- package/public/fonts/Serotiva-Regular.woff2 +0 -0
- package/public/fonts/Serotiva-SemiBold.woff2 +0 -0
- package/tsconfig.json +0 -12
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
class DataStore {
|
|
2
|
-
data = /* @__PURE__ */ new Map();
|
|
3
|
-
metadata = /* @__PURE__ */ new Map();
|
|
4
|
-
idCounters = /* @__PURE__ */ new Map();
|
|
5
|
-
initialize(collections) {
|
|
6
|
-
for (const [slug, config] of Object.entries(collections)) {
|
|
7
|
-
if (!this.data.has(slug)) {
|
|
8
|
-
this.data.set(slug, []);
|
|
9
|
-
this.idCounters.set(slug, 1);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
generateId(slug) {
|
|
14
|
-
const counter = this.idCounters.get(slug) || 1;
|
|
15
|
-
this.idCounters.set(slug, counter + 1);
|
|
16
|
-
return `${slug}-${counter}`;
|
|
17
|
-
}
|
|
18
|
-
getTimestamp() {
|
|
19
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
20
|
-
}
|
|
21
|
-
find(slug, options = {}) {
|
|
22
|
-
const docs = this.data.get(slug) || [];
|
|
23
|
-
const page = options.page || 1;
|
|
24
|
-
const limit = options.limit || 25;
|
|
25
|
-
const start = (page - 1) * limit;
|
|
26
|
-
const end = start + limit;
|
|
27
|
-
return {
|
|
28
|
-
docs: docs.slice(start, end),
|
|
29
|
-
totalDocs: docs.length,
|
|
30
|
-
totalPages: Math.ceil(docs.length / limit),
|
|
31
|
-
page
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
findById(slug, id) {
|
|
35
|
-
const docs = this.data.get(slug) || [];
|
|
36
|
-
return docs.find((d) => d.id === id) || null;
|
|
37
|
-
}
|
|
38
|
-
create(slug, data) {
|
|
39
|
-
const docs = this.data.get(slug) || [];
|
|
40
|
-
const now = this.getTimestamp();
|
|
41
|
-
const newDoc = {
|
|
42
|
-
id: this.generateId(slug),
|
|
43
|
-
...data,
|
|
44
|
-
createdAt: now,
|
|
45
|
-
updatedAt: now
|
|
46
|
-
};
|
|
47
|
-
docs.push(newDoc);
|
|
48
|
-
this.data.set(slug, docs);
|
|
49
|
-
this.metadata.set(`${slug}:${newDoc.id}`, {
|
|
50
|
-
createdAt: now,
|
|
51
|
-
updatedAt: now
|
|
52
|
-
});
|
|
53
|
-
return newDoc;
|
|
54
|
-
}
|
|
55
|
-
update(slug, id, data) {
|
|
56
|
-
const docs = this.data.get(slug) || [];
|
|
57
|
-
const index = docs.findIndex((d) => d.id === id);
|
|
58
|
-
if (index === -1) return null;
|
|
59
|
-
const now = this.getTimestamp();
|
|
60
|
-
const updated = {
|
|
61
|
-
...docs[index],
|
|
62
|
-
...data,
|
|
63
|
-
id,
|
|
64
|
-
updatedAt: now
|
|
65
|
-
};
|
|
66
|
-
docs[index] = updated;
|
|
67
|
-
this.data.set(slug, docs);
|
|
68
|
-
this.metadata.set(`${slug}:${id}`, {
|
|
69
|
-
createdAt: docs[index].createdAt,
|
|
70
|
-
updatedAt: now
|
|
71
|
-
});
|
|
72
|
-
return updated;
|
|
73
|
-
}
|
|
74
|
-
delete(slug, id) {
|
|
75
|
-
const docs = this.data.get(slug) || [];
|
|
76
|
-
const index = docs.findIndex((d) => d.id === id);
|
|
77
|
-
if (index === -1) return false;
|
|
78
|
-
docs.splice(index, 1);
|
|
79
|
-
this.data.set(slug, docs);
|
|
80
|
-
this.metadata.delete(`${slug}:${id}`);
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
count(slug) {
|
|
84
|
-
return (this.data.get(slug) || []).length;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
const dataStore = new DataStore();
|
|
88
|
-
|
|
89
|
-
export { dataStore as d };
|