@bygghammar/cms-platform 0.32.0 → 0.32.2
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 +2 -2
- package/src/server/admin-core.ts +9 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bygghammar/cms-platform",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.2",
|
|
4
4
|
"description": "Shared CMS platform: blocks, block types, i18n core, UI primitives and design-token contract used by every Bygghammar/Voyara site.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -217,4 +217,4 @@
|
|
|
217
217
|
"bin": {
|
|
218
218
|
"cms-platform-migrations": "scripts/sync-migrations.mjs"
|
|
219
219
|
}
|
|
220
|
-
}
|
|
220
|
+
}
|
package/src/server/admin-core.ts
CHANGED
|
@@ -40,6 +40,10 @@ export type AdminUser = {
|
|
|
40
40
|
|
|
41
41
|
const anyClient = (client: SupabaseClient) => client as unknown as any;
|
|
42
42
|
|
|
43
|
+
/** Serializable row shape: log and settings rows cross the RPC boundary as JSON. */
|
|
44
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | { [k: string]: JsonValue };
|
|
45
|
+
export type JsonRow = Record<string, JsonValue>;
|
|
46
|
+
|
|
43
47
|
async function audit(
|
|
44
48
|
deps: AdminDeps,
|
|
45
49
|
action: string,
|
|
@@ -72,7 +76,7 @@ export async function listUsersCore(deps: AdminDeps): Promise<AdminUser[]> {
|
|
|
72
76
|
.in("user_id", ids.length ? ids : ["00000000-0000-0000-0000-000000000000"]);
|
|
73
77
|
|
|
74
78
|
const rolesByUser = new Map<string, PlatformRole[]>();
|
|
75
|
-
for (const r of (
|
|
79
|
+
for (const r of (roleRows ?? []) as any[]) {
|
|
76
80
|
const arr = rolesByUser.get(r.user_id) ?? [];
|
|
77
81
|
arr.push(r.role as PlatformRole);
|
|
78
82
|
rolesByUser.set(r.user_id, arr);
|
|
@@ -198,7 +202,7 @@ async function listLog(deps: AdminDeps, table: string, limit: number) {
|
|
|
198
202
|
.order("created_at", { ascending: false })
|
|
199
203
|
.limit(limit);
|
|
200
204
|
if (error) throw new Error(error.message);
|
|
201
|
-
return (data ?? []) as
|
|
205
|
+
return (data ?? []) as JsonRow[];
|
|
202
206
|
}
|
|
203
207
|
|
|
204
208
|
export function listAuditLogsCore(deps: AdminDeps, input?: { limit?: number }) {
|
|
@@ -219,7 +223,7 @@ export async function getEmailSettingsCore(deps: AdminDeps) {
|
|
|
219
223
|
.eq("id", true)
|
|
220
224
|
.maybeSingle();
|
|
221
225
|
if (error) throw new Error(error.message);
|
|
222
|
-
return data as
|
|
226
|
+
return data as JsonRow | null;
|
|
223
227
|
}
|
|
224
228
|
|
|
225
229
|
export async function saveEmailSettingsCore(
|
|
@@ -246,7 +250,7 @@ export async function listEmailProvidersCore(deps: AdminDeps) {
|
|
|
246
250
|
.order("sort_order", { ascending: true })
|
|
247
251
|
.order("created_at", { ascending: true });
|
|
248
252
|
if (error) throw new Error(error.message);
|
|
249
|
-
return (data ?? []) as
|
|
253
|
+
return (data ?? []) as JsonRow[];
|
|
250
254
|
}
|
|
251
255
|
|
|
252
256
|
export async function upsertEmailProviderCore(
|
|
@@ -269,7 +273,7 @@ export async function upsertEmailProviderCore(
|
|
|
269
273
|
(saved as any).id,
|
|
270
274
|
{ name: input.name, kind: input.kind },
|
|
271
275
|
);
|
|
272
|
-
return saved as
|
|
276
|
+
return saved as JsonRow;
|
|
273
277
|
}
|
|
274
278
|
|
|
275
279
|
export async function deleteEmailProviderCore(
|