@oktis-works/admin 0.1.3 → 0.1.5

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.
Files changed (62) hide show
  1. package/bin/admin.js +14 -0
  2. package/bin/listen-log.d.ts +8 -0
  3. package/bin/listen-log.js +66 -0
  4. package/dist/client/_astro/BaseLayout.COf3Eran.css +1 -0
  5. package/dist/client/_astro/ContentEditor.COyD6bGV.js +1 -0
  6. package/dist/client/_astro/PostTypesManager.APvO7Cs9.js +1 -0
  7. package/dist/client/_astro/TaxonomiesManager.CVFdfaUR.js +1 -0
  8. package/dist/client/_astro/api.DSP61PKM.js +1 -0
  9. package/dist/client/_astro/client.D7G9q8lk.js +1 -0
  10. package/dist/client/_astro/login.astro_astro_type_script_index_0_lang.BLhqPWk8.js +1 -0
  11. package/dist/client/_astro/web.BRlgYXBp.js +1 -0
  12. package/dist/server/chunks/BaseLayout_Mvr1_6Ng.mjs +12 -0
  13. package/dist/server/chunks/DashboardLayout_CP5ag-_P.mjs +17 -0
  14. package/dist/server/chunks/_virtual_astro_server-island-manifest_C1Q2srgE.mjs +5 -0
  15. package/dist/server/chunks/_virtual_astro_session-driver_Ei6unT4E.mjs +123 -0
  16. package/dist/server/chunks/api_Cy8sbUHf.mjs +153 -0
  17. package/dist/server/chunks/compiler_CYjwXhLT.mjs +35 -0
  18. package/dist/server/chunks/console_tZnymcoE.mjs +170 -0
  19. package/dist/server/chunks/dist_CP9QIrJI.mjs +7807 -0
  20. package/dist/server/chunks/edit_D14rRl_p.mjs +845 -0
  21. package/dist/server/chunks/errors_mm28nMpQ.mjs +383 -0
  22. package/dist/server/chunks/index_BgbHlcwr.mjs +23 -0
  23. package/dist/server/chunks/index_c3b5hMDp.mjs +22 -0
  24. package/dist/server/chunks/login_B7vbWIed.mjs +40 -0
  25. package/dist/server/chunks/node_C0YbdEL-.mjs +2263 -0
  26. package/dist/server/chunks/noop-entrypoint_Z3zFhrGC.mjs +4 -0
  27. package/dist/server/chunks/post-types_BtNyF2Iv.mjs +137 -0
  28. package/dist/server/chunks/remote_DUw5DMmE.mjs +169 -0
  29. package/dist/server/chunks/rolldown-runtime_BMI-E3GI.mjs +44 -0
  30. package/dist/server/chunks/semver_WbqCUY_o.mjs +1395 -0
  31. package/dist/server/chunks/server_CnzC2Y0K.mjs +7582 -0
  32. package/dist/server/chunks/sharp_CfXj7Ul-.mjs +152 -0
  33. package/dist/server/chunks/taxonomies_DSgstawN.mjs +126 -0
  34. package/dist/server/entry.mjs +17510 -9592
  35. package/dist/server/virtual_astro_middleware.mjs +4 -0
  36. package/package.json +9 -9
  37. package/dist/client/_astro/ContentEditor.A5N-aCxT.js +0 -1
  38. package/dist/client/_astro/PostTypesManager.w66_1tDh.js +0 -1
  39. package/dist/client/_astro/TaxonomiesManager.Dv_OOCEw.js +0 -1
  40. package/dist/client/_astro/api.GqKwASBH.js +0 -1
  41. package/dist/client/_astro/client.CCQ0X2AX.js +0 -1
  42. package/dist/client/_astro/edit.B4LyOiwH.css +0 -1
  43. package/dist/client/_astro/hoisted.SqllSTyr.js +0 -1
  44. package/dist/client/_astro/web.D5F0ytYW.js +0 -1
  45. package/dist/server/_empty-middleware.mjs +0 -3
  46. package/dist/server/chunks/astro/assets-service_BADPYD54.mjs +0 -438
  47. package/dist/server/chunks/astro_C5DJOQ1V.mjs +0 -2038
  48. package/dist/server/chunks/edit_C98B4jh0.mjs +0 -6
  49. package/dist/server/chunks/index_53XIf90M.mjs +0 -6
  50. package/dist/server/chunks/index_CHiEzckm.mjs +0 -6
  51. package/dist/server/chunks/login_C_Jl-EtG.mjs +0 -6
  52. package/dist/server/chunks/node_Cb_YHUva.mjs +0 -6
  53. package/dist/server/chunks/pages/edit_AQihQPyy.mjs +0 -2173
  54. package/dist/server/chunks/pages/index_NImiBHcL.mjs +0 -61
  55. package/dist/server/chunks/pages/login_B9ODIzLV.mjs +0 -12
  56. package/dist/server/chunks/pages/node_B3GvoMAw.mjs +0 -268
  57. package/dist/server/chunks/pages/post-types_ClxoBrjv.mjs +0 -246
  58. package/dist/server/chunks/pages/taxonomies_CMtxsQlk.mjs +0 -69
  59. package/dist/server/chunks/post-types_w-FxNhTw.mjs +0 -6
  60. package/dist/server/chunks/taxonomies_4sch1jA4.mjs +0 -6
  61. package/dist/server/manifest_BHg4-rj9.mjs +0 -455
  62. package/dist/server/renderers.mjs +0 -101
@@ -0,0 +1,153 @@
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 };
@@ -0,0 +1,35 @@
1
+ import { t as AstroError, x as InvalidComponentArgs } from "./errors_mm28nMpQ.mjs";
2
+ import "./server_CnzC2Y0K.mjs";
3
+ //#region ../../node_modules/.bun/astro@7.3.5+b816f5dfb7c6296d/node_modules/astro/dist/runtime/server/astro-component.js
4
+ function validateArgs(args) {
5
+ if (args.length !== 3) return false;
6
+ if (!args[0] || typeof args[0] !== "object") return false;
7
+ return true;
8
+ }
9
+ function baseCreateComponent(cb, moduleId, propagation) {
10
+ const name = moduleId?.split("/").pop()?.replace(".astro", "") ?? "";
11
+ const fn = (...args) => {
12
+ if (!validateArgs(args)) throw new AstroError({
13
+ ...InvalidComponentArgs,
14
+ message: InvalidComponentArgs.message(name)
15
+ });
16
+ return cb(...args);
17
+ };
18
+ Object.defineProperty(fn, "name", {
19
+ value: name,
20
+ writable: false
21
+ });
22
+ fn.isAstroComponentFactory = true;
23
+ fn.moduleId = moduleId;
24
+ fn.propagation = propagation;
25
+ return fn;
26
+ }
27
+ function createComponentWithOptions(opts) {
28
+ return baseCreateComponent(opts.factory, opts.moduleId, opts.propagation);
29
+ }
30
+ function createComponent(arg1, moduleId, propagation) {
31
+ if (typeof arg1 === "function") return baseCreateComponent(arg1, moduleId, propagation);
32
+ else return createComponentWithOptions(arg1);
33
+ }
34
+ //#endregion
35
+ export { createComponent as t };
@@ -0,0 +1,170 @@
1
+ import { T as s } from "./server_CnzC2Y0K.mjs";
2
+ //#region ../../node_modules/.bun/astro@7.3.5+b816f5dfb7c6296d/node_modules/astro/dist/core/logger/core.js
3
+ var dateTimeFormat = new Intl.DateTimeFormat([], {
4
+ hour: "2-digit",
5
+ minute: "2-digit",
6
+ second: "2-digit",
7
+ hour12: false
8
+ });
9
+ var levels = {
10
+ debug: 20,
11
+ info: 30,
12
+ warn: 40,
13
+ error: 50,
14
+ silent: 90
15
+ };
16
+ function log(opts, level, label, message, newLine = true) {
17
+ const logLevel = opts.level;
18
+ const dest = opts.destination;
19
+ const event = {
20
+ label,
21
+ level,
22
+ message,
23
+ newLine
24
+ };
25
+ if (!isLogLevelEnabled(logLevel, level)) return;
26
+ dest.write(event);
27
+ }
28
+ function isLogLevelEnabled(configuredLogLevel, level) {
29
+ return levels[configuredLogLevel] <= levels[level];
30
+ }
31
+ function info(opts, label, message, newLine = true) {
32
+ return log(opts, "info", label, message, newLine);
33
+ }
34
+ function warn(opts, label, message, newLine = true) {
35
+ return log(opts, "warn", label, message, newLine);
36
+ }
37
+ function error(opts, label, message, newLine = true) {
38
+ return log(opts, "error", label, message, newLine);
39
+ }
40
+ function debug(...args) {
41
+ if ("_astroGlobalDebug" in globalThis) globalThis._astroGlobalDebug(...args);
42
+ }
43
+ function getEventPrefix({ level, label }) {
44
+ const timestamp = `${dateTimeFormat.format(/* @__PURE__ */ new Date())}`;
45
+ const prefix = [];
46
+ if (level === "error" || level === "warn") {
47
+ prefix.push(s.bold(timestamp));
48
+ prefix.push(`[${level.toUpperCase()}]`);
49
+ } else prefix.push(timestamp);
50
+ if (label) prefix.push(`[${label}]`);
51
+ if (level === "error") return s.red(prefix.join(" "));
52
+ if (level === "warn") return s.yellow(prefix.join(" "));
53
+ if (prefix.length === 1) return s.dim(prefix[0]);
54
+ return s.dim(prefix[0]) + " " + s.blue(prefix.splice(1).join(" "));
55
+ }
56
+ var AstroLogger = class {
57
+ options;
58
+ constructor(options) {
59
+ this.options = options;
60
+ }
61
+ info(label, message, newLine = true) {
62
+ info(this.options, label, message, newLine);
63
+ }
64
+ warn(label, message, newLine = true) {
65
+ warn(this.options, label, message, newLine);
66
+ }
67
+ error(label, message, newLine = true) {
68
+ error(this.options, label, message, newLine);
69
+ }
70
+ debug(label, ...messages) {
71
+ debug(label, ...messages);
72
+ }
73
+ level() {
74
+ return this.options.level;
75
+ }
76
+ forkIntegrationLogger(label) {
77
+ return new AstroIntegrationLogger(this.options, label);
78
+ }
79
+ setDestination(destination) {
80
+ this.options.destination = destination;
81
+ }
82
+ /**
83
+ * It calls the `close` function of the provided destination, if it exists.
84
+ */
85
+ close() {
86
+ if (this.options.destination.close) this.options.destination.close();
87
+ }
88
+ /**
89
+ * It calls the `flush` function of the provided destination, if it exists.
90
+ */
91
+ flush() {
92
+ if (this.options.destination.flush) this.options.destination.flush();
93
+ }
94
+ };
95
+ var AstroIntegrationLogger = class AstroIntegrationLogger {
96
+ options;
97
+ label;
98
+ constructor(logging, label) {
99
+ this.options = logging;
100
+ this.label = label;
101
+ }
102
+ /**
103
+ * Creates a new logger instance with a new label, but the same log options.
104
+ */
105
+ fork(label) {
106
+ return new AstroIntegrationLogger(this.options, label);
107
+ }
108
+ info(message) {
109
+ info(this.options, this.label, message);
110
+ }
111
+ warn(message) {
112
+ warn(this.options, this.label, message);
113
+ }
114
+ error(message) {
115
+ error(this.options, this.label, message);
116
+ }
117
+ debug(message) {
118
+ debug(this.label, message);
119
+ }
120
+ /**
121
+ * It calls the `flush` function of the provided destination, if it exists.
122
+ */
123
+ flush() {
124
+ if (this.options.destination.flush) this.options.destination.flush();
125
+ }
126
+ /**
127
+ * It calls the `close` function of the provided destination, if it exists.
128
+ */
129
+ close() {
130
+ if (this.options.destination.close) this.options.destination.close();
131
+ }
132
+ };
133
+ function astroToRuntimeLogger(logger) {
134
+ return {
135
+ info(msg) {
136
+ logger.info(null, msg);
137
+ },
138
+ warn(msg) {
139
+ logger.warn(null, msg);
140
+ },
141
+ error(msg) {
142
+ logger.error(null, msg);
143
+ }
144
+ };
145
+ }
146
+ //#endregion
147
+ //#region ../../node_modules/.bun/astro@7.3.5+b816f5dfb7c6296d/node_modules/astro/dist/core/logger/public.js
148
+ function matchesLevel(messageLevel, configuredLevel) {
149
+ return levels[messageLevel] >= levels[configuredLevel];
150
+ }
151
+ //#endregion
152
+ //#region ../../node_modules/.bun/astro@7.3.5+b816f5dfb7c6296d/node_modules/astro/dist/core/logger/impls/console.js
153
+ function consoleLogDestination(config = {}) {
154
+ const { level = "info" } = config;
155
+ return { write(event) {
156
+ let dest = console.error;
157
+ if (levels[event.level] < levels["error"]) dest = console.info;
158
+ if (!matchesLevel(event.level, level)) return;
159
+ if (event.label === "SKIP_FORMAT") dest(event.message);
160
+ else dest(getEventPrefix(event) + " " + event.message);
161
+ } };
162
+ }
163
+ function createConsoleLogger({ level }) {
164
+ return new AstroLogger({
165
+ level,
166
+ destination: consoleLogDestination()
167
+ });
168
+ }
169
+ //#endregion
170
+ export { AstroIntegrationLogger as n, astroToRuntimeLogger as r, createConsoleLogger as t };