@isardsat/editorial-common 6.8.1 → 6.9.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @isardsat/editorial-common
2
2
 
3
+ ## 6.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1a359f9: Fixes
8
+
3
9
  ## 6.8.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,17 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./schemas.js"), exports);
1
+ export * from './schemas.js';
package/dist/schemas.d.ts CHANGED
@@ -51,6 +51,7 @@ export declare const EditorialSchemaItemFieldType: z.ZodEnum<{
51
51
  color: "color";
52
52
  select: "select";
53
53
  }>;
54
+ export declare const RGBColorSchema: z.ZodString;
54
55
  export declare const EditorialSchemaItemFieldSchema: z.ZodObject<{
55
56
  type: z.ZodEnum<{
56
57
  string: "string";
package/dist/schemas.js CHANGED
@@ -1,41 +1,38 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EditorialFilesSchema = exports.EditorialFilesResponseSchema = exports.EditorialFileSchema = exports.BaseEditorialFileSchema = exports.EditorialSchemaSchema = exports.EditorialSchemaItemSchema = exports.EditorialSchemaItemFieldSchema = exports.EditorialSchemaItemFieldType = exports.EditorialDataSchema = exports.EditorialDataTypeSchema = exports.EditorialDataItemSchema = exports.EditorialDataObjectWithTypeSchema = exports.EditorialConfigSchema = void 0;
4
- const zod_openapi_1 = require("@hono/zod-openapi");
5
- exports.EditorialConfigSchema = zod_openapi_1.z.object({
6
- name: zod_openapi_1.z.string(),
7
- publicUrl: zod_openapi_1.z.url(),
8
- publicDir: zod_openapi_1.z.string().default("public/files"),
9
- publicDeletedDir: zod_openapi_1.z.string().default("public/files/.deleted"),
10
- filesUrl: zod_openapi_1.z.url(),
11
- largeFilesUrl: zod_openapi_1.z.url(),
12
- previewUrl: zod_openapi_1.z.string().optional(),
13
- silent: zod_openapi_1.z.boolean().optional(),
14
- firebase: zod_openapi_1.z
1
+ import { z } from "@hono/zod-openapi";
2
+ export const EditorialConfigSchema = z.object({
3
+ name: z.string(),
4
+ publicUrl: z.url(),
5
+ publicDir: z.string().default("public/files"),
6
+ publicDeletedDir: z.string().default("public/files/.deleted"),
7
+ filesUrl: z.url(),
8
+ largeFilesUrl: z.url(),
9
+ previewUrl: z.string().optional(),
10
+ silent: z.boolean().optional(),
11
+ firebase: z
15
12
  .object({
16
- apiKey: zod_openapi_1.z.string(),
17
- authDomain: zod_openapi_1.z.string(),
18
- databaseURL: zod_openapi_1.z.string(),
19
- projectId: zod_openapi_1.z.string(),
20
- storageBucket: zod_openapi_1.z.string(),
21
- messagingSenderId: zod_openapi_1.z.string(),
22
- dbUsersPath: zod_openapi_1.z.string(),
13
+ apiKey: z.string(),
14
+ authDomain: z.string(),
15
+ databaseURL: z.string(),
16
+ projectId: z.string(),
17
+ storageBucket: z.string(),
18
+ messagingSenderId: z.string(),
19
+ dbUsersPath: z.string(),
23
20
  })
24
21
  .optional(),
25
22
  });
26
- exports.EditorialDataObjectWithTypeSchema = zod_openapi_1.z.looseObject({
27
- id: zod_openapi_1.z.string(),
28
- type: zod_openapi_1.z.string(),
23
+ export const EditorialDataObjectWithTypeSchema = z.looseObject({
24
+ id: z.string(),
25
+ type: z.string(),
29
26
  });
30
- exports.EditorialDataItemSchema = zod_openapi_1.z.looseObject({
31
- id: zod_openapi_1.z.string(),
32
- isDraft: zod_openapi_1.z.boolean().default(false),
33
- createdAt: zod_openapi_1.z.iso.datetime().default(() => new Date().toISOString()),
34
- updatedAt: zod_openapi_1.z.iso.datetime().default(() => new Date().toISOString()),
27
+ export const EditorialDataItemSchema = z.looseObject({
28
+ id: z.string(),
29
+ isDraft: z.boolean().default(false),
30
+ createdAt: z.iso.datetime().default(() => new Date().toISOString()),
31
+ updatedAt: z.iso.datetime().default(() => new Date().toISOString()),
35
32
  });
36
- exports.EditorialDataTypeSchema = zod_openapi_1.z.record(zod_openapi_1.z.string(), exports.EditorialDataItemSchema);
37
- exports.EditorialDataSchema = zod_openapi_1.z.record(zod_openapi_1.z.string(), exports.EditorialDataTypeSchema);
38
- exports.EditorialSchemaItemFieldType = zod_openapi_1.z.enum([
33
+ export const EditorialDataTypeSchema = z.record(z.string(), EditorialDataItemSchema);
34
+ export const EditorialDataSchema = z.record(z.string(), EditorialDataTypeSchema);
35
+ export const EditorialSchemaItemFieldType = z.enum([
39
36
  "string",
40
37
  "boolean",
41
38
  "date",
@@ -46,37 +43,52 @@ exports.EditorialSchemaItemFieldType = zod_openapi_1.z.enum([
46
43
  "select",
47
44
  "url",
48
45
  ]);
49
- exports.EditorialSchemaItemFieldSchema = zod_openapi_1.z.looseObject({
50
- type: exports.EditorialSchemaItemFieldType,
51
- displayName: zod_openapi_1.z.string(),
52
- displayExtra: zod_openapi_1.z.string().optional(),
53
- placeholder: zod_openapi_1.z.string().optional(),
54
- optional: zod_openapi_1.z.boolean().default(false),
55
- showInSummary: zod_openapi_1.z.boolean().optional(),
46
+ export const RGBColorSchema = z
47
+ .string()
48
+ .regex(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/, "Must be a valid RGB color format: rgb(r, g, b)")
49
+ .refine((value) => {
50
+ const match = value.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/);
51
+ if (!match)
52
+ return false;
53
+ const [, r, g, b] = match;
54
+ return (Number(r) >= 0 &&
55
+ Number(r) <= 255 &&
56
+ Number(g) >= 0 &&
57
+ Number(g) <= 255 &&
58
+ Number(b) >= 0 &&
59
+ Number(b) <= 255);
60
+ }, "RGB values must be between 0 and 255");
61
+ export const EditorialSchemaItemFieldSchema = z.looseObject({
62
+ type: EditorialSchemaItemFieldType,
63
+ displayName: z.string(),
64
+ displayExtra: z.string().optional(),
65
+ placeholder: z.string().optional(),
66
+ optional: z.boolean().default(false),
67
+ showInSummary: z.boolean().optional(),
56
68
  });
57
- exports.EditorialSchemaItemSchema = zod_openapi_1.z.object({
58
- displayName: zod_openapi_1.z.string(),
59
- singleton: zod_openapi_1.z.boolean().optional(),
60
- fields: zod_openapi_1.z.record(zod_openapi_1.z.string(), exports.EditorialSchemaItemFieldSchema),
69
+ export const EditorialSchemaItemSchema = z.object({
70
+ displayName: z.string(),
71
+ singleton: z.boolean().optional(),
72
+ fields: z.record(z.string(), EditorialSchemaItemFieldSchema),
61
73
  });
62
- exports.EditorialSchemaSchema = zod_openapi_1.z.record(zod_openapi_1.z.string(), exports.EditorialSchemaItemSchema);
63
- exports.BaseEditorialFileSchema = zod_openapi_1.z.object({
64
- name: zod_openapi_1.z.string(),
65
- type: zod_openapi_1.z.enum(["file", "directory"]),
66
- path: zod_openapi_1.z.string(),
67
- relativePath: zod_openapi_1.z.string(),
68
- size: zod_openapi_1.z.number(),
69
- isLarge: zod_openapi_1.z.boolean().optional(),
74
+ export const EditorialSchemaSchema = z.record(z.string(), EditorialSchemaItemSchema);
75
+ export const BaseEditorialFileSchema = z.object({
76
+ name: z.string(),
77
+ type: z.enum(["file", "directory"]),
78
+ path: z.string(),
79
+ relativePath: z.string(),
80
+ size: z.number(),
81
+ isLarge: z.boolean().optional(),
70
82
  });
71
- exports.EditorialFileSchema = exports.BaseEditorialFileSchema.extend({
72
- children: zod_openapi_1.z
73
- .lazy(() => exports.EditorialFileSchema.array())
83
+ export const EditorialFileSchema = BaseEditorialFileSchema.extend({
84
+ children: z
85
+ .lazy(() => EditorialFileSchema.array())
74
86
  .openapi({
75
87
  type: "array",
76
88
  }),
77
89
  });
78
- exports.EditorialFilesResponseSchema = zod_openapi_1.z.object({
79
- files: zod_openapi_1.z.array(exports.EditorialFileSchema),
80
- totalSize: zod_openapi_1.z.number(),
90
+ export const EditorialFilesResponseSchema = z.object({
91
+ files: z.array(EditorialFileSchema),
92
+ totalSize: z.number(),
81
93
  });
82
- exports.EditorialFilesSchema = zod_openapi_1.z.array(exports.EditorialFileSchema);
94
+ export const EditorialFilesSchema = z.array(EditorialFileSchema);
package/dist/types.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@isardsat/editorial-common",
3
- "version": "6.8.1",
3
+ "version": "6.9.0",
4
+ "type": "module",
4
5
  "main": "dist/index.js",
5
6
  "types": "dist/index.d.ts",
6
7
  "dependencies": {
package/src/schemas.ts CHANGED
@@ -56,6 +56,26 @@ export const EditorialSchemaItemFieldType = z.enum([
56
56
  "url",
57
57
  ]);
58
58
 
59
+ export const RGBColorSchema = z
60
+ .string()
61
+ .regex(
62
+ /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/,
63
+ "Must be a valid RGB color format: rgb(r, g, b)"
64
+ )
65
+ .refine((value) => {
66
+ const match = value.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/);
67
+ if (!match) return false;
68
+ const [, r, g, b] = match;
69
+ return (
70
+ Number(r) >= 0 &&
71
+ Number(r) <= 255 &&
72
+ Number(g) >= 0 &&
73
+ Number(g) <= 255 &&
74
+ Number(b) >= 0 &&
75
+ Number(b) <= 255
76
+ );
77
+ }, "RGB values must be between 0 and 255");
78
+
59
79
  export const EditorialSchemaItemFieldSchema = z.looseObject({
60
80
  type: EditorialSchemaItemFieldType,
61
81
  displayName: z.string(),
package/tsconfig.json CHANGED
@@ -4,7 +4,9 @@
4
4
  "compilerOptions": {
5
5
  "outDir": "./dist",
6
6
  "strictNullChecks": true,
7
- "declaration": true
7
+ "declaration": true,
8
+ "module": "NodeNext",
9
+ "verbatimModuleSyntax": true
8
10
  },
9
11
  "include": ["src/**/*"]
10
12
  }