@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 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
  }
@@ -1,19 +1,13 @@
1
- export declare function createSchema(configDirectory: string): Promise<{
2
- name: string;
3
- publicUrl: string;
4
- publicDir: string;
5
- publicDeletedDir: string;
6
- filesUrl: string;
7
- largeFilesUrl: string;
8
- previewUrl?: string | undefined;
9
- silent?: boolean | undefined;
10
- firebase?: {
11
- apiKey: string;
12
- authDomain: string;
13
- databaseURL: string;
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
+ }>>;
@@ -1,9 +1,9 @@
1
- import { EditorialConfigSchema } from '@isardsat/editorial-common';
2
- import { readFile } from 'fs/promises';
3
- import { join } from 'path';
4
- import { parse } from 'yaml';
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, 'schema.yaml'), 'utf-8').then((value) => parse(value));
7
- const config = EditorialConfigSchema.parse(configFile);
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
  }
@@ -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, import("zod").objectOutputType<{
6
- type: import("zod").ZodEnum<["string", "boolean", "date", "datetime", "markdown", "number", "color", "select", "url"]>;
7
- displayName: import("zod").ZodString;
8
- displayExtra: import("zod").ZodOptional<import("zod").ZodString>;
9
- placeholder: import("zod").ZodOptional<import("zod").ZodString>;
10
- isRequired: import("zod").ZodOptional<import("zod").ZodBoolean>;
11
- showInSummary: import("zod").ZodOptional<import("zod").ZodBoolean>;
12
- }, import("zod").ZodTypeAny, "passthrough">>;
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<import("zod").objectOutputType<{
21
- id: import("zod").ZodString;
22
- isDraft: import("zod").ZodDefault<import("zod").ZodBoolean>;
23
- createdAt: import("zod").ZodDefault<import("zod").ZodString>;
24
- updatedAt: import("zod").ZodDefault<import("zod").ZodString>;
25
- }, import("zod").ZodTypeAny, "passthrough">>;
26
- updateItem: (item: EditorialDataObjectWithType) => Promise<import("zod").objectOutputType<{
27
- id: import("zod").ZodString;
28
- isDraft: import("zod").ZodDefault<import("zod").ZodBoolean>;
29
- createdAt: import("zod").ZodDefault<import("zod").ZodString>;
30
- updatedAt: import("zod").ZodDefault<import("zod").ZodString>;
31
- }, import("zod").ZodTypeAny, "passthrough">>;
32
- deleteItem: (item: EditorialDataObjectWithType) => Promise<Record<string, Record<string, import("zod").objectOutputType<{
33
- id: import("zod").ZodString;
34
- isDraft: import("zod").ZodDefault<import("zod").ZodBoolean>;
35
- createdAt: import("zod").ZodDefault<import("zod").ZodString>;
36
- updatedAt: import("zod").ZodDefault<import("zod").ZodString>;
37
- }, import("zod").ZodTypeAny, "passthrough">>>>;
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>;
@@ -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,
@@ -334,7 +334,7 @@ export function createDataRoutes(config, storage) {
334
334
  200: {
335
335
  content: {
336
336
  "application/json": {
337
- schema: EditorialDataSchema,
337
+ schema: EditorialDataItemSchema,
338
338
  },
339
339
  },
340
340
  description: "Update object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isardsat/editorial-server",
3
- "version": "6.7.0",
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.13.8",
11
+ "@hono/node-server": "^1.19.4",
12
12
  "@hono/swagger-ui": "^0.5.0",
13
- "@hono/zod-openapi": "^0.18.4",
14
- "hono": "^4.6.20",
15
- "yaml": "^2.7.0",
16
- "zod": "^3.24.1",
17
- "@isardsat/editorial-admin": "^6.7.0",
18
- "@isardsat/editorial-common": "^6.7.0"
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",