@isardsat/editorial-server 6.7.0 → 6.8.1
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/dist/lib/hooks.js +5 -1
- package/dist/lib/schema.d.ts +13 -19
- package/dist/lib/schema.js +6 -6
- package/dist/lib/storage.d.ts +30 -26
- package/dist/lib/storage.js +1 -0
- package/dist/routes/data.js +1 -1
- package/package.json +8 -8
package/dist/lib/hooks.js
CHANGED
|
@@ -8,7 +8,11 @@ export async function createHooks(configDirectory) {
|
|
|
8
8
|
const hookFunction = typeof module.default === "function" ? module.default : null;
|
|
9
9
|
return hookFunction;
|
|
10
10
|
}
|
|
11
|
-
catch {
|
|
11
|
+
catch (error) {
|
|
12
|
+
if (error instanceof Error) {
|
|
13
|
+
console.error(`Failed to load hook (${name}) with error: ${error.message}`);
|
|
14
|
+
}
|
|
15
|
+
console.error(`Failed to load hook (${name})`);
|
|
12
16
|
return null;
|
|
13
17
|
}
|
|
14
18
|
}
|
package/dist/lib/schema.d.ts
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
export declare function createSchema(configDirectory: string): Promise<{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
projectId: string;
|
|
15
|
-
storageBucket: string;
|
|
16
|
-
messagingSenderId: string;
|
|
17
|
-
dbUsersPath: string;
|
|
18
|
-
} | undefined;
|
|
19
|
-
}>;
|
|
1
|
+
export declare function createSchema(configDirectory: string): Promise<Record<string, {
|
|
2
|
+
displayName: string;
|
|
3
|
+
fields: Record<string, {
|
|
4
|
+
[x: string]: unknown;
|
|
5
|
+
type: "string" | "number" | "boolean" | "url" | "date" | "datetime" | "markdown" | "color" | "select";
|
|
6
|
+
displayName: string;
|
|
7
|
+
optional: boolean;
|
|
8
|
+
displayExtra?: string | undefined;
|
|
9
|
+
placeholder?: string | undefined;
|
|
10
|
+
showInSummary?: boolean | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
singleton?: boolean | undefined;
|
|
13
|
+
}>>;
|
package/dist/lib/schema.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { readFile } from
|
|
3
|
-
import { join } from
|
|
4
|
-
import { parse } from
|
|
1
|
+
import { EditorialSchemaSchema } from "@isardsat/editorial-common";
|
|
2
|
+
import { readFile } from "fs/promises";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { parse } from "yaml";
|
|
5
5
|
export async function createSchema(configDirectory) {
|
|
6
|
-
const configFile = await readFile(join(configDirectory,
|
|
7
|
-
const config =
|
|
6
|
+
const configFile = await readFile(join(configDirectory, "schema.yaml"), "utf-8").then((value) => parse(value));
|
|
7
|
+
const config = EditorialSchemaSchema.parse(configFile);
|
|
8
8
|
return config;
|
|
9
9
|
}
|
package/dist/lib/storage.d.ts
CHANGED
|
@@ -2,14 +2,15 @@ import type { EditorialData, EditorialDataObjectWithType } from "@isardsat/edito
|
|
|
2
2
|
export declare function createStorage(dataDirectory: string): {
|
|
3
3
|
getSchema: () => Promise<Record<string, {
|
|
4
4
|
displayName: string;
|
|
5
|
-
fields: Record<string,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
fields: Record<string, {
|
|
6
|
+
[x: string]: unknown;
|
|
7
|
+
type: "string" | "number" | "boolean" | "url" | "date" | "datetime" | "markdown" | "color" | "select";
|
|
8
|
+
displayName: string;
|
|
9
|
+
optional: boolean;
|
|
10
|
+
displayExtra?: string | undefined;
|
|
11
|
+
placeholder?: string | undefined;
|
|
12
|
+
showInSummary?: boolean | undefined;
|
|
13
|
+
}>;
|
|
13
14
|
singleton?: boolean | undefined;
|
|
14
15
|
}>>;
|
|
15
16
|
getContent: ({ production, }: {
|
|
@@ -17,24 +18,27 @@ export declare function createStorage(dataDirectory: string): {
|
|
|
17
18
|
}) => Promise<EditorialData>;
|
|
18
19
|
getLocalisationMessages: (langCode: string) => Promise<any>;
|
|
19
20
|
saveLocalisationMessages: (messages: any) => Promise<boolean>;
|
|
20
|
-
createItem: (item: EditorialDataObjectWithType) => Promise<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
21
|
+
createItem: (item: EditorialDataObjectWithType) => Promise<{
|
|
22
|
+
[x: string]: unknown;
|
|
23
|
+
id: string;
|
|
24
|
+
isDraft: boolean;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
}>;
|
|
28
|
+
updateItem: (item: EditorialDataObjectWithType) => Promise<{
|
|
29
|
+
[x: string]: unknown;
|
|
30
|
+
id: string;
|
|
31
|
+
isDraft: boolean;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
}>;
|
|
35
|
+
deleteItem: (item: EditorialDataObjectWithType) => Promise<Record<string, Record<string, {
|
|
36
|
+
[x: string]: unknown;
|
|
37
|
+
id: string;
|
|
38
|
+
isDraft: boolean;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
}>>>;
|
|
38
42
|
saveContent: ({ production }: {
|
|
39
43
|
production?: boolean;
|
|
40
44
|
}) => Promise<boolean>;
|
package/dist/lib/storage.js
CHANGED
|
@@ -58,6 +58,7 @@ export function createStorage(dataDirectory) {
|
|
|
58
58
|
}
|
|
59
59
|
async function updateItem(item) {
|
|
60
60
|
const content = await getContent({ production: false });
|
|
61
|
+
content[item.type] = content[item.type] ?? {};
|
|
61
62
|
const oldItem = content[item.type][item.id];
|
|
62
63
|
const newItem = EditorialDataItemSchema.parse({
|
|
63
64
|
...oldItem,
|
package/dist/routes/data.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isardsat/editorial-server",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.8.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@hono/node-server": "^1.
|
|
11
|
+
"@hono/node-server": "^1.19.4",
|
|
12
12
|
"@hono/swagger-ui": "^0.5.0",
|
|
13
|
-
"@hono/zod-openapi": "^
|
|
14
|
-
"hono": "^4.
|
|
15
|
-
"yaml": "^2.
|
|
16
|
-
"zod": "^
|
|
17
|
-
"@isardsat/editorial-admin": "^6.
|
|
18
|
-
"@isardsat/editorial-common": "^6.
|
|
13
|
+
"@hono/zod-openapi": "^1.1.3",
|
|
14
|
+
"hono": "^4.9.8",
|
|
15
|
+
"yaml": "^2.8.1",
|
|
16
|
+
"zod": "^4.1.11",
|
|
17
|
+
"@isardsat/editorial-admin": "^6.8.1",
|
|
18
|
+
"@isardsat/editorial-common": "^6.8.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@tsconfig/node22": "^22.0.0",
|