@oktis-works/admin 0.1.4 → 0.1.7
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/bin/admin.js +14 -0
- package/bin/listen-log.d.ts +8 -0
- package/bin/listen-log.js +66 -0
- package/dist/client/_astro/{BaseLayout.COf3Eran.css → BaseLayout.BPkaFsmK.css} +1 -1
- package/dist/client/_astro/{ContentEditor.COyD6bGV.js → ContentEditor.DOcUnkMP.js} +1 -1
- package/dist/client/_astro/ContentList.KzxsMMxH.js +1 -0
- package/dist/client/_astro/DashboardHome.DFRZ_yyM.js +1 -0
- package/dist/client/_astro/DashboardLayout.astro_astro_type_script_index_0_lang.B663y3aY.js +1 -0
- package/dist/client/_astro/GeneralSettings.gbcKHf_p.js +1 -0
- package/dist/client/_astro/MediaLibrary.BtCjwNlR.js +1 -0
- package/dist/client/_astro/{PostTypesManager.APvO7Cs9.js → PostTypesManager.DsxV-sF3.js} +1 -1
- package/dist/client/_astro/{TaxonomiesManager.CVFdfaUR.js → TaxonomiesManager.DqnwUCtt.js} +1 -1
- package/dist/client/_astro/UserCreateForm.BLaiQTzI.js +1 -0
- package/dist/client/_astro/UsersManager.BPRG8tjn.js +1 -0
- package/dist/client/_astro/api.BegLcOlq.js +1 -0
- package/dist/client/_astro/{login.astro_astro_type_script_index_0_lang.BLhqPWk8.js → login.astro_astro_type_script_index_0_lang.ozrnjgkA.js} +1 -1
- package/dist/server/chunks/{BaseLayout_Mvr1_6Ng.mjs → BaseLayout_C41_wW4F.mjs} +19 -2
- package/dist/server/chunks/{edit_D14rRl_p.mjs → ContentEditor_DwBpNq-K.mjs} +21 -30
- package/dist/server/chunks/DashboardLayout_DO66tdeZ.mjs +43 -0
- package/dist/server/chunks/MediaLibrary_DEi9k6ms.mjs +179 -0
- package/dist/server/chunks/api_BWOj0bUJ.mjs +274 -0
- package/dist/server/chunks/edit_DNavSwFw.mjs +30 -0
- package/dist/server/chunks/general_r50g45qE.mjs +173 -0
- package/dist/server/chunks/index_6G7rXrus.mjs +133 -0
- package/dist/server/chunks/index_B50u2M3P.mjs +23 -0
- package/dist/server/chunks/index_DUzUgyr4.mjs +155 -0
- package/dist/server/chunks/index_qxSk7_hO.mjs +30 -0
- package/dist/server/chunks/index_yiAU3Mfy.mjs +204 -0
- package/dist/server/chunks/{login_B7vbWIed.mjs → login_BH67N4b1.mjs} +2 -19
- package/dist/server/chunks/new_BWcSqoqV.mjs +86 -0
- package/dist/server/chunks/new_h8TItZZ9.mjs +30 -0
- package/dist/server/chunks/{post-types_BtNyF2Iv.mjs → post-types_BSobAovm.mjs} +2 -2
- package/dist/server/chunks/{taxonomies_DSgstawN.mjs → taxonomies_Ij7CReDF.mjs} +2 -2
- package/dist/server/chunks/upload_16xg6koU.mjs +31 -0
- package/dist/server/entry.mjs +259 -13
- package/package.json +5 -5
- package/dist/client/_astro/api.DSP61PKM.js +0 -1
- package/dist/server/chunks/DashboardLayout_CP5ag-_P.mjs +0 -17
- package/dist/server/chunks/api_Cy8sbUHf.mjs +0 -153
- package/dist/server/chunks/index_BgbHlcwr.mjs +0 -23
- package/dist/server/chunks/index_c3b5hMDp.mjs +0 -22
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
//#region src/lib/api.ts
|
|
2
|
-
var API_BASE = Object.assign({
|
|
3
|
-
"ASSETS_PREFIX": void 0,
|
|
4
|
-
"BASE_URL": "/",
|
|
5
|
-
"DEV": false,
|
|
6
|
-
"MODE": "production",
|
|
7
|
-
"PROD": true,
|
|
8
|
-
"SITE": void 0,
|
|
9
|
-
"SSR": true
|
|
10
|
-
}, { _: "/home/runner/work/cms/cms/apps/admin/node_modules/.bin/astro" })["PUBLIC_API_URL"] ?? "http://localhost:3000";
|
|
11
|
-
var ApiClient = class {
|
|
12
|
-
baseUrl;
|
|
13
|
-
accessToken = null;
|
|
14
|
-
refreshTokenValue = null;
|
|
15
|
-
constructor(baseUrl = API_BASE) {
|
|
16
|
-
this.baseUrl = baseUrl;
|
|
17
|
-
}
|
|
18
|
-
setTokens(accessToken, refreshToken) {
|
|
19
|
-
this.accessToken = accessToken;
|
|
20
|
-
this.refreshTokenValue = refreshToken;
|
|
21
|
-
if (typeof window !== "undefined") {
|
|
22
|
-
localStorage.setItem("accessToken", accessToken);
|
|
23
|
-
localStorage.setItem("refreshToken", refreshToken);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
loadTokens() {
|
|
27
|
-
if (typeof window !== "undefined") {
|
|
28
|
-
this.accessToken = localStorage.getItem("accessToken");
|
|
29
|
-
this.refreshTokenValue = localStorage.getItem("refreshToken");
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
clearTokens() {
|
|
33
|
-
this.accessToken = null;
|
|
34
|
-
this.refreshTokenValue = null;
|
|
35
|
-
if (typeof window !== "undefined") {
|
|
36
|
-
localStorage.removeItem("accessToken");
|
|
37
|
-
localStorage.removeItem("refreshToken");
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
async request(method, path, body, headers) {
|
|
41
|
-
const url = `${this.baseUrl}${path}`;
|
|
42
|
-
const requestHeaders = {
|
|
43
|
-
"Content-Type": "application/json",
|
|
44
|
-
...headers
|
|
45
|
-
};
|
|
46
|
-
if (this.accessToken) requestHeaders["Authorization"] = `Bearer ${this.accessToken}`;
|
|
47
|
-
const response = await fetch(url, {
|
|
48
|
-
method,
|
|
49
|
-
headers: requestHeaders,
|
|
50
|
-
body: body ? JSON.stringify(body) : void 0
|
|
51
|
-
});
|
|
52
|
-
if (!response.ok) {
|
|
53
|
-
const error = await response.json().catch(() => ({ error: "Request failed" }));
|
|
54
|
-
throw new Error(error.error ?? "Request failed");
|
|
55
|
-
}
|
|
56
|
-
return response.json();
|
|
57
|
-
}
|
|
58
|
-
async login(input) {
|
|
59
|
-
const response = await this.request("POST", "/api/v1/auth/login", input);
|
|
60
|
-
this.setTokens(response.accessToken, response.refreshToken);
|
|
61
|
-
return response;
|
|
62
|
-
}
|
|
63
|
-
async logout() {
|
|
64
|
-
if (this.refreshTokenValue) await this.request("POST", "/api/v1/auth/logout", { token: this.refreshTokenValue });
|
|
65
|
-
this.clearTokens();
|
|
66
|
-
}
|
|
67
|
-
async refreshTokens() {
|
|
68
|
-
if (!this.refreshTokenValue) throw new Error("No refresh token");
|
|
69
|
-
const response = await this.request("POST", "/api/v1/auth/refresh", { refreshToken: this.refreshTokenValue });
|
|
70
|
-
this.setTokens(response.accessToken, response.refreshToken);
|
|
71
|
-
}
|
|
72
|
-
async getContent(options) {
|
|
73
|
-
const params = new URLSearchParams();
|
|
74
|
-
if (options?.page) params.set("page", String(options.page));
|
|
75
|
-
if (options?.limit) params.set("limit", String(options.limit));
|
|
76
|
-
if (options?.type) params.set("type", options.type);
|
|
77
|
-
if (options?.status) params.set("status", options.status);
|
|
78
|
-
if (options?.search) params.set("search", options.search);
|
|
79
|
-
return this.request("GET", `/api/v1/content?${params.toString()}`);
|
|
80
|
-
}
|
|
81
|
-
async getContentById(id) {
|
|
82
|
-
return this.request("GET", `/api/v1/content/${id}`);
|
|
83
|
-
}
|
|
84
|
-
async createContent(data) {
|
|
85
|
-
return this.request("POST", "/api/v1/content", data);
|
|
86
|
-
}
|
|
87
|
-
async updateContent(id, data) {
|
|
88
|
-
return this.request("PUT", `/api/v1/content/${id}`, data);
|
|
89
|
-
}
|
|
90
|
-
async deleteContent(id) {
|
|
91
|
-
await this.request("DELETE", `/api/v1/content/${id}`);
|
|
92
|
-
}
|
|
93
|
-
async getContentTypes() {
|
|
94
|
-
return this.request("GET", "/api/v1/content-types");
|
|
95
|
-
}
|
|
96
|
-
async createContentType(data) {
|
|
97
|
-
return this.request("POST", "/api/v1/content-types", data);
|
|
98
|
-
}
|
|
99
|
-
async updateContentType(slug, data) {
|
|
100
|
-
return this.request("PUT", `/api/v1/content-types/${slug}`, data);
|
|
101
|
-
}
|
|
102
|
-
async deleteContentType(slug) {
|
|
103
|
-
await this.request("DELETE", `/api/v1/content-types/${slug}`);
|
|
104
|
-
}
|
|
105
|
-
async getTaxonomies() {
|
|
106
|
-
return this.request("GET", "/api/v1/taxonomies");
|
|
107
|
-
}
|
|
108
|
-
async createTaxonomy(data) {
|
|
109
|
-
return this.request("POST", "/api/v1/taxonomies", data);
|
|
110
|
-
}
|
|
111
|
-
async attachTaxonomy(slug, contentType) {
|
|
112
|
-
await this.request("POST", `/api/v1/taxonomies/${slug}/attach`, { contentType });
|
|
113
|
-
}
|
|
114
|
-
async detachTaxonomy(slug, contentType) {
|
|
115
|
-
await this.request("POST", `/api/v1/taxonomies/${slug}/detach`, { contentType });
|
|
116
|
-
}
|
|
117
|
-
async deleteTaxonomy(slug) {
|
|
118
|
-
await this.request("DELETE", `/api/v1/taxonomies/${slug}`);
|
|
119
|
-
}
|
|
120
|
-
async getFieldGroups(context) {
|
|
121
|
-
if (context?.type) {
|
|
122
|
-
const qs = new URLSearchParams({ type: context.type });
|
|
123
|
-
for (const [key, value] of Object.entries(context)) if (key !== "type" && value) qs.set(key, value);
|
|
124
|
-
return this.request("GET", `/api/v1/field-groups?${qs.toString()}`);
|
|
125
|
-
}
|
|
126
|
-
return this.request("GET", "/api/v1/field-groups");
|
|
127
|
-
}
|
|
128
|
-
async getFieldGroup(id) {
|
|
129
|
-
return this.request("GET", `/api/v1/field-groups/${id}`);
|
|
130
|
-
}
|
|
131
|
-
async createFieldGroup(data) {
|
|
132
|
-
return this.request("POST", "/api/v1/field-groups", data);
|
|
133
|
-
}
|
|
134
|
-
async getFieldTypes(category) {
|
|
135
|
-
const query = category ? `?category=${encodeURIComponent(category)}` : "";
|
|
136
|
-
return this.request("GET", `/api/v1/field-types${query}`);
|
|
137
|
-
}
|
|
138
|
-
async healthCheck() {
|
|
139
|
-
return this.request("GET", "/health");
|
|
140
|
-
}
|
|
141
|
-
async getThemes() {
|
|
142
|
-
return (await this.request("GET", "/api/v1/themes")).map((theme) => ({
|
|
143
|
-
id: String(theme["id"] ?? ""),
|
|
144
|
-
name: String(theme["name"] ?? ""),
|
|
145
|
-
version: theme["version"] ? String(theme["version"]) : void 0,
|
|
146
|
-
status: String(theme["status"] ?? "INSTALLED"),
|
|
147
|
-
manifest: theme["manifest"] ?? null
|
|
148
|
-
}));
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
var apiClient = new ApiClient();
|
|
152
|
-
//#endregion
|
|
153
|
-
export { apiClient as t };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { r as __exportAll } from "./rolldown-runtime_BMI-E3GI.mjs";
|
|
2
|
-
import { d as maybeRenderHead, i as renderComponent, u as renderTemplate } from "./server_CnzC2Y0K.mjs";
|
|
3
|
-
import { t as createComponent } from "./compiler_CYjwXhLT.mjs";
|
|
4
|
-
import { t as $$DashboardLayout } from "./DashboardLayout_CP5ag-_P.mjs";
|
|
5
|
-
//#region src/pages/content/index.astro
|
|
6
|
-
var content_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
-
default: () => $$Index,
|
|
8
|
-
file: () => $$file,
|
|
9
|
-
url: () => $$url
|
|
10
|
-
});
|
|
11
|
-
var $$Index = createComponent(($$result, $$props, $$slots) => {
|
|
12
|
-
return renderTemplate`${renderComponent($$result, "DashboardLayout", $$DashboardLayout, {
|
|
13
|
-
"title": "Content",
|
|
14
|
-
"data-astro-cid-qhu5jad5": true
|
|
15
|
-
}, { "default": ($$result) => renderTemplate`${maybeRenderHead($$result)}<div class="content-page" data-astro-cid-qhu5jad5><div class="page-header" data-astro-cid-qhu5jad5><div class="header-left" data-astro-cid-qhu5jad5><input type="search" class="input" placeholder="Search content..." id="search-input" data-astro-cid-qhu5jad5><select class="input" id="type-filter" data-astro-cid-qhu5jad5><option value="" data-astro-cid-qhu5jad5>All Types</option><option value="post" data-astro-cid-qhu5jad5>Posts</option><option value="page" data-astro-cid-qhu5jad5>Pages</option></select><select class="input" id="status-filter" data-astro-cid-qhu5jad5><option value="" data-astro-cid-qhu5jad5>All Status</option><option value="DRAFT" data-astro-cid-qhu5jad5>Draft</option><option value="PUBLISHED" data-astro-cid-qhu5jad5>Published</option><option value="ARCHIVED" data-astro-cid-qhu5jad5>Archived</option></select></div><a href="/content/new" class="btn btn-primary" data-astro-cid-qhu5jad5>New Content</a></div><div class="card" data-astro-cid-qhu5jad5><table class="table" data-astro-cid-qhu5jad5><thead data-astro-cid-qhu5jad5><tr data-astro-cid-qhu5jad5><th data-astro-cid-qhu5jad5>Title</th><th data-astro-cid-qhu5jad5>Type</th><th data-astro-cid-qhu5jad5>Status</th><th data-astro-cid-qhu5jad5>Author</th><th data-astro-cid-qhu5jad5>Updated</th><th data-astro-cid-qhu5jad5>Actions</th></tr></thead><tbody id="content-list" data-astro-cid-qhu5jad5><tr data-astro-cid-qhu5jad5><td colspan="6" class="text-center" data-astro-cid-qhu5jad5>Loading...</td></tr></tbody></table><div class="pagination" id="pagination" data-astro-cid-qhu5jad5></div></div></div>` })}`;
|
|
16
|
-
}, "/home/runner/work/cms/cms/apps/admin/src/pages/content/index.astro", void 0);
|
|
17
|
-
var $$file = "/home/runner/work/cms/cms/apps/admin/src/pages/content/index.astro";
|
|
18
|
-
var $$url = "/content";
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region \0virtual:astro:page:src/pages/content/index@_@astro
|
|
21
|
-
var page = () => content_exports;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { page };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { r as __exportAll } from "./rolldown-runtime_BMI-E3GI.mjs";
|
|
2
|
-
import { d as maybeRenderHead, i as renderComponent, u as renderTemplate } from "./server_CnzC2Y0K.mjs";
|
|
3
|
-
import { t as createComponent } from "./compiler_CYjwXhLT.mjs";
|
|
4
|
-
import { t as $$DashboardLayout } from "./DashboardLayout_CP5ag-_P.mjs";
|
|
5
|
-
//#region src/pages/index.astro
|
|
6
|
-
var pages_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
-
default: () => $$Index,
|
|
8
|
-
file: () => $$file,
|
|
9
|
-
url: () => ""
|
|
10
|
-
});
|
|
11
|
-
var $$Index = createComponent(($$result, $$props, $$slots) => {
|
|
12
|
-
return renderTemplate`${renderComponent($$result, "DashboardLayout", $$DashboardLayout, {
|
|
13
|
-
"title": "Dashboard",
|
|
14
|
-
"data-astro-cid-lcdefpme": true
|
|
15
|
-
}, { "default": ($$result) => renderTemplate`${maybeRenderHead($$result)}<div class="dashboard" data-astro-cid-lcdefpme><div class="stats-grid" data-astro-cid-lcdefpme><div class="card stat-card" data-astro-cid-lcdefpme><h3 class="stat-label" data-astro-cid-lcdefpme>Total Content</h3><p class="stat-value" id="total-content" data-astro-cid-lcdefpme>--</p></div><div class="card stat-card" data-astro-cid-lcdefpme><h3 class="stat-label" data-astro-cid-lcdefpme>Published</h3><p class="stat-value" id="published-content" data-astro-cid-lcdefpme>--</p></div><div class="card stat-card" data-astro-cid-lcdefpme><h3 class="stat-label" data-astro-cid-lcdefpme>Drafts</h3><p class="stat-value" id="draft-content" data-astro-cid-lcdefpme>--</p></div><div class="card stat-card" data-astro-cid-lcdefpme><h3 class="stat-label" data-astro-cid-lcdefpme>Media Files</h3><p class="stat-value" id="total-media" data-astro-cid-lcdefpme>--</p></div></div><div class="recent-content" data-astro-cid-lcdefpme><div class="card" data-astro-cid-lcdefpme><div class="card-header" data-astro-cid-lcdefpme><h3 data-astro-cid-lcdefpme>Recent Content</h3><a href="/content" class="btn btn-secondary btn-sm" data-astro-cid-lcdefpme>View All</a></div><table class="table" data-astro-cid-lcdefpme><thead data-astro-cid-lcdefpme><tr data-astro-cid-lcdefpme><th data-astro-cid-lcdefpme>Title</th><th data-astro-cid-lcdefpme>Type</th><th data-astro-cid-lcdefpme>Status</th><th data-astro-cid-lcdefpme>Updated</th></tr></thead><tbody id="recent-content-list" data-astro-cid-lcdefpme><tr data-astro-cid-lcdefpme><td colspan="4" class="text-center" data-astro-cid-lcdefpme>Loading...</td></tr></tbody></table></div></div><div class="quick-actions" data-astro-cid-lcdefpme><div class="card" data-astro-cid-lcdefpme><h3 class="card-header" data-astro-cid-lcdefpme>Quick Actions</h3><div class="actions-grid" data-astro-cid-lcdefpme><a href="/content/new" class="action-card" data-astro-cid-lcdefpme><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-astro-cid-lcdefpme><line x1="12" y1="5" x2="12" y2="19" data-astro-cid-lcdefpme></line><line x1="5" y1="12" x2="19" y2="12" data-astro-cid-lcdefpme></line></svg><span data-astro-cid-lcdefpme>New Post</span></a><a href="/media/upload" class="action-card" data-astro-cid-lcdefpme><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-astro-cid-lcdefpme><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" data-astro-cid-lcdefpme></path><polyline points="17 8 12 3 7 8" data-astro-cid-lcdefpme></polyline><line x1="12" y1="3" x2="12" y2="15" data-astro-cid-lcdefpme></line></svg><span data-astro-cid-lcdefpme>Upload Media</span></a><a href="/users/new" class="action-card" data-astro-cid-lcdefpme><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-astro-cid-lcdefpme><path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" data-astro-cid-lcdefpme></path><circle cx="8.5" cy="7" r="4" data-astro-cid-lcdefpme></circle><line x1="20" y1="8" x2="20" y2="14" data-astro-cid-lcdefpme></line><line x1="23" y1="11" x2="17" y2="11" data-astro-cid-lcdefpme></line></svg><span data-astro-cid-lcdefpme>Add User</span></a><a href="/settings" class="action-card" data-astro-cid-lcdefpme><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-astro-cid-lcdefpme><circle cx="12" cy="12" r="3" data-astro-cid-lcdefpme></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" data-astro-cid-lcdefpme></path></svg><span data-astro-cid-lcdefpme>Settings</span></a></div></div></div></div>` })}`;
|
|
16
|
-
}, "/home/runner/work/cms/cms/apps/admin/src/pages/index.astro", void 0);
|
|
17
|
-
var $$file = "/home/runner/work/cms/cms/apps/admin/src/pages/index.astro";
|
|
18
|
-
//#endregion
|
|
19
|
-
//#region \0virtual:astro:page:src/pages/index@_@astro
|
|
20
|
-
var page = () => pages_exports;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { page };
|