@isardsat/editorial-server 6.6.4 → 6.8.0

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.
@@ -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>;
@@ -131,6 +131,9 @@ export function createDataRoutes(config, storage) {
131
131
  });
132
132
  const schema = await cache.getSchema(storage);
133
133
  const collection = content[itemType];
134
+ if (!collection && schema[itemType]) {
135
+ return c.json({});
136
+ }
134
137
  if (!collection) {
135
138
  return c.notFound();
136
139
  }
@@ -178,11 +181,17 @@ export function createDataRoutes(config, storage) {
178
181
  },
179
182
  description: "Get object ids by type",
180
183
  },
184
+ 404: {
185
+ description: "Item not found",
186
+ },
181
187
  },
182
188
  }), async (c) => {
183
189
  const { itemType } = c.req.valid("param");
184
190
  const { preview } = c.req.valid("query");
185
191
  const content = await cache.getContent(storage, { production: !preview });
192
+ if (!content[itemType]) {
193
+ return c.notFound();
194
+ }
186
195
  return c.json(Object.keys(content[itemType]));
187
196
  });
188
197
  app.openapi(createRoute({
@@ -325,7 +334,7 @@ export function createDataRoutes(config, storage) {
325
334
  200: {
326
335
  content: {
327
336
  "application/json": {
328
- schema: EditorialDataSchema,
337
+ schema: EditorialDataItemSchema,
329
338
  },
330
339
  },
331
340
  description: "Update object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isardsat/editorial-server",
3
- "version": "6.6.4",
3
+ "version": "6.8.0",
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.6.4",
18
- "@isardsat/editorial-common": "^6.6.4"
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.0",
18
+ "@isardsat/editorial-common": "^6.8.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@tsconfig/node22": "^22.0.0",