@isardsat/editorial-common 6.0.0-canary-001

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Lobelia Earth
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ export * from './schemas.js';
2
+ export type * from './types.js';
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
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);
@@ -0,0 +1,208 @@
1
+ import { z } from '@hono/zod-openapi';
2
+ export declare const EditorialConfigSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ publicUrl: z.ZodString;
5
+ previewUrl: z.ZodOptional<z.ZodString>;
6
+ silent: z.ZodOptional<z.ZodBoolean>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ name: string;
9
+ publicUrl: string;
10
+ previewUrl?: string | undefined;
11
+ silent?: boolean | undefined;
12
+ }, {
13
+ name: string;
14
+ publicUrl: string;
15
+ previewUrl?: string | undefined;
16
+ silent?: boolean | undefined;
17
+ }>;
18
+ export declare const EditorialDataObjectWithTypeSchema: z.ZodObject<{
19
+ id: z.ZodString;
20
+ type: z.ZodString;
21
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
22
+ id: z.ZodString;
23
+ type: z.ZodString;
24
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
25
+ id: z.ZodString;
26
+ type: z.ZodString;
27
+ }, z.ZodTypeAny, "passthrough">>;
28
+ export declare const EditorialDataItemSchema: z.ZodObject<{
29
+ id: z.ZodString;
30
+ createdAt: z.ZodDefault<z.ZodString>;
31
+ updatedAt: z.ZodDefault<z.ZodString>;
32
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
33
+ id: z.ZodString;
34
+ createdAt: z.ZodDefault<z.ZodString>;
35
+ updatedAt: z.ZodDefault<z.ZodString>;
36
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
37
+ id: z.ZodString;
38
+ createdAt: z.ZodDefault<z.ZodString>;
39
+ updatedAt: z.ZodDefault<z.ZodString>;
40
+ }, z.ZodTypeAny, "passthrough">>;
41
+ export declare const EditorialDataTypeSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
42
+ id: z.ZodString;
43
+ createdAt: z.ZodDefault<z.ZodString>;
44
+ updatedAt: z.ZodDefault<z.ZodString>;
45
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
46
+ id: z.ZodString;
47
+ createdAt: z.ZodDefault<z.ZodString>;
48
+ updatedAt: z.ZodDefault<z.ZodString>;
49
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
50
+ id: z.ZodString;
51
+ createdAt: z.ZodDefault<z.ZodString>;
52
+ updatedAt: z.ZodDefault<z.ZodString>;
53
+ }, z.ZodTypeAny, "passthrough">>>;
54
+ export declare const EditorialDataSchema: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
55
+ id: z.ZodString;
56
+ createdAt: z.ZodDefault<z.ZodString>;
57
+ updatedAt: z.ZodDefault<z.ZodString>;
58
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
59
+ id: z.ZodString;
60
+ createdAt: z.ZodDefault<z.ZodString>;
61
+ updatedAt: z.ZodDefault<z.ZodString>;
62
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
63
+ id: z.ZodString;
64
+ createdAt: z.ZodDefault<z.ZodString>;
65
+ updatedAt: z.ZodDefault<z.ZodString>;
66
+ }, z.ZodTypeAny, "passthrough">>>>;
67
+ export declare const EditorialSchemaItemFieldType: z.ZodEnum<["string", "boolean", "date", "datetime", "markdown", "number", "color", "select", "color"]>;
68
+ export declare const EditorialSchemaItemFieldSchema: z.ZodObject<{
69
+ type: z.ZodEnum<["string", "boolean", "date", "datetime", "markdown", "number", "color", "select", "color"]>;
70
+ displayName: z.ZodString;
71
+ displayExtra: z.ZodOptional<z.ZodString>;
72
+ placeholder: z.ZodOptional<z.ZodString>;
73
+ isRequired: z.ZodOptional<z.ZodBoolean>;
74
+ showInSummary: z.ZodOptional<z.ZodBoolean>;
75
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
76
+ type: z.ZodEnum<["string", "boolean", "date", "datetime", "markdown", "number", "color", "select", "color"]>;
77
+ displayName: z.ZodString;
78
+ displayExtra: z.ZodOptional<z.ZodString>;
79
+ placeholder: z.ZodOptional<z.ZodString>;
80
+ isRequired: z.ZodOptional<z.ZodBoolean>;
81
+ showInSummary: z.ZodOptional<z.ZodBoolean>;
82
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
83
+ type: z.ZodEnum<["string", "boolean", "date", "datetime", "markdown", "number", "color", "select", "color"]>;
84
+ displayName: z.ZodString;
85
+ displayExtra: z.ZodOptional<z.ZodString>;
86
+ placeholder: z.ZodOptional<z.ZodString>;
87
+ isRequired: z.ZodOptional<z.ZodBoolean>;
88
+ showInSummary: z.ZodOptional<z.ZodBoolean>;
89
+ }, z.ZodTypeAny, "passthrough">>;
90
+ export declare const EditorialSchemaItemSchema: z.ZodObject<{
91
+ displayName: z.ZodString;
92
+ singleton: z.ZodOptional<z.ZodBoolean>;
93
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
94
+ type: z.ZodEnum<["string", "boolean", "date", "datetime", "markdown", "number", "color", "select", "color"]>;
95
+ displayName: z.ZodString;
96
+ displayExtra: z.ZodOptional<z.ZodString>;
97
+ placeholder: z.ZodOptional<z.ZodString>;
98
+ isRequired: z.ZodOptional<z.ZodBoolean>;
99
+ showInSummary: z.ZodOptional<z.ZodBoolean>;
100
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
101
+ type: z.ZodEnum<["string", "boolean", "date", "datetime", "markdown", "number", "color", "select", "color"]>;
102
+ displayName: z.ZodString;
103
+ displayExtra: z.ZodOptional<z.ZodString>;
104
+ placeholder: z.ZodOptional<z.ZodString>;
105
+ isRequired: z.ZodOptional<z.ZodBoolean>;
106
+ showInSummary: z.ZodOptional<z.ZodBoolean>;
107
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
108
+ type: z.ZodEnum<["string", "boolean", "date", "datetime", "markdown", "number", "color", "select", "color"]>;
109
+ displayName: z.ZodString;
110
+ displayExtra: z.ZodOptional<z.ZodString>;
111
+ placeholder: z.ZodOptional<z.ZodString>;
112
+ isRequired: z.ZodOptional<z.ZodBoolean>;
113
+ showInSummary: z.ZodOptional<z.ZodBoolean>;
114
+ }, z.ZodTypeAny, "passthrough">>>;
115
+ }, "strip", z.ZodTypeAny, {
116
+ displayName: string;
117
+ fields: Record<string, z.objectOutputType<{
118
+ type: z.ZodEnum<["string", "boolean", "date", "datetime", "markdown", "number", "color", "select", "color"]>;
119
+ displayName: z.ZodString;
120
+ displayExtra: z.ZodOptional<z.ZodString>;
121
+ placeholder: z.ZodOptional<z.ZodString>;
122
+ isRequired: z.ZodOptional<z.ZodBoolean>;
123
+ showInSummary: z.ZodOptional<z.ZodBoolean>;
124
+ }, z.ZodTypeAny, "passthrough">>;
125
+ singleton?: boolean | undefined;
126
+ }, {
127
+ displayName: string;
128
+ fields: Record<string, z.objectInputType<{
129
+ type: z.ZodEnum<["string", "boolean", "date", "datetime", "markdown", "number", "color", "select", "color"]>;
130
+ displayName: z.ZodString;
131
+ displayExtra: z.ZodOptional<z.ZodString>;
132
+ placeholder: z.ZodOptional<z.ZodString>;
133
+ isRequired: z.ZodOptional<z.ZodBoolean>;
134
+ showInSummary: z.ZodOptional<z.ZodBoolean>;
135
+ }, z.ZodTypeAny, "passthrough">>;
136
+ singleton?: boolean | undefined;
137
+ }>;
138
+ export declare const EditorialSchemaSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
139
+ displayName: z.ZodString;
140
+ singleton: z.ZodOptional<z.ZodBoolean>;
141
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
142
+ type: z.ZodEnum<["string", "boolean", "date", "datetime", "markdown", "number", "color", "select", "color"]>;
143
+ displayName: z.ZodString;
144
+ displayExtra: z.ZodOptional<z.ZodString>;
145
+ placeholder: z.ZodOptional<z.ZodString>;
146
+ isRequired: z.ZodOptional<z.ZodBoolean>;
147
+ showInSummary: z.ZodOptional<z.ZodBoolean>;
148
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
149
+ type: z.ZodEnum<["string", "boolean", "date", "datetime", "markdown", "number", "color", "select", "color"]>;
150
+ displayName: z.ZodString;
151
+ displayExtra: z.ZodOptional<z.ZodString>;
152
+ placeholder: z.ZodOptional<z.ZodString>;
153
+ isRequired: z.ZodOptional<z.ZodBoolean>;
154
+ showInSummary: z.ZodOptional<z.ZodBoolean>;
155
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
156
+ type: z.ZodEnum<["string", "boolean", "date", "datetime", "markdown", "number", "color", "select", "color"]>;
157
+ displayName: z.ZodString;
158
+ displayExtra: z.ZodOptional<z.ZodString>;
159
+ placeholder: z.ZodOptional<z.ZodString>;
160
+ isRequired: z.ZodOptional<z.ZodBoolean>;
161
+ showInSummary: z.ZodOptional<z.ZodBoolean>;
162
+ }, z.ZodTypeAny, "passthrough">>>;
163
+ }, "strip", z.ZodTypeAny, {
164
+ displayName: string;
165
+ fields: Record<string, z.objectOutputType<{
166
+ type: z.ZodEnum<["string", "boolean", "date", "datetime", "markdown", "number", "color", "select", "color"]>;
167
+ displayName: z.ZodString;
168
+ displayExtra: z.ZodOptional<z.ZodString>;
169
+ placeholder: z.ZodOptional<z.ZodString>;
170
+ isRequired: z.ZodOptional<z.ZodBoolean>;
171
+ showInSummary: z.ZodOptional<z.ZodBoolean>;
172
+ }, z.ZodTypeAny, "passthrough">>;
173
+ singleton?: boolean | undefined;
174
+ }, {
175
+ displayName: string;
176
+ fields: Record<string, z.objectInputType<{
177
+ type: z.ZodEnum<["string", "boolean", "date", "datetime", "markdown", "number", "color", "select", "color"]>;
178
+ displayName: z.ZodString;
179
+ displayExtra: z.ZodOptional<z.ZodString>;
180
+ placeholder: z.ZodOptional<z.ZodString>;
181
+ isRequired: z.ZodOptional<z.ZodBoolean>;
182
+ showInSummary: z.ZodOptional<z.ZodBoolean>;
183
+ }, z.ZodTypeAny, "passthrough">>;
184
+ singleton?: boolean | undefined;
185
+ }>>;
186
+ export declare const BaseEditorialFileSchema: z.ZodObject<{
187
+ name: z.ZodString;
188
+ type: z.ZodEnum<["file", "directory"]>;
189
+ path: z.ZodString;
190
+ size: z.ZodNumber;
191
+ }, "strip", z.ZodTypeAny, {
192
+ name: string;
193
+ path: string;
194
+ type: "file" | "directory";
195
+ size: number;
196
+ }, {
197
+ name: string;
198
+ path: string;
199
+ type: "file" | "directory";
200
+ size: number;
201
+ }>;
202
+ export type BaseEditorialFile = z.infer<typeof BaseEditorialFileSchema> & {
203
+ children?: BaseEditorialFile[];
204
+ };
205
+ export declare const EditorialFileSchema: z.ZodType<BaseEditorialFile>;
206
+ export declare const EditorialFilesSchema: z.ZodArray<z.ZodType<BaseEditorialFile, z.ZodTypeDef, BaseEditorialFile>, "many">;
207
+ export type EditorialFile = z.infer<typeof EditorialFileSchema>;
208
+ export type EditorialFiles = z.infer<typeof EditorialFilesSchema>;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EditorialFilesSchema = 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.string().url(),
8
+ previewUrl: zod_openapi_1.z.string().optional(),
9
+ silent: zod_openapi_1.z.boolean().optional(),
10
+ });
11
+ exports.EditorialDataObjectWithTypeSchema = zod_openapi_1.z
12
+ .object({
13
+ id: zod_openapi_1.z.string(),
14
+ type: zod_openapi_1.z.string(),
15
+ })
16
+ .passthrough();
17
+ exports.EditorialDataItemSchema = zod_openapi_1.z
18
+ .object({
19
+ id: zod_openapi_1.z.string(),
20
+ createdAt: zod_openapi_1.z
21
+ .string()
22
+ .datetime()
23
+ .default(() => new Date().toISOString()),
24
+ updatedAt: zod_openapi_1.z
25
+ .string()
26
+ .datetime()
27
+ .default(() => new Date().toISOString()),
28
+ })
29
+ .passthrough();
30
+ exports.EditorialDataTypeSchema = zod_openapi_1.z.record(zod_openapi_1.z.string(), exports.EditorialDataItemSchema);
31
+ exports.EditorialDataSchema = zod_openapi_1.z.record(zod_openapi_1.z.string(), exports.EditorialDataTypeSchema);
32
+ exports.EditorialSchemaItemFieldType = zod_openapi_1.z.enum([
33
+ 'string',
34
+ 'boolean',
35
+ 'date',
36
+ 'datetime',
37
+ 'markdown',
38
+ 'number',
39
+ 'color',
40
+ 'select',
41
+ 'color',
42
+ ]);
43
+ exports.EditorialSchemaItemFieldSchema = zod_openapi_1.z
44
+ .object({
45
+ type: exports.EditorialSchemaItemFieldType,
46
+ displayName: zod_openapi_1.z.string(),
47
+ displayExtra: zod_openapi_1.z.string().optional(),
48
+ placeholder: zod_openapi_1.z.string().optional(),
49
+ isRequired: zod_openapi_1.z.boolean().optional(),
50
+ showInSummary: zod_openapi_1.z.boolean().optional(),
51
+ })
52
+ .passthrough();
53
+ exports.EditorialSchemaItemSchema = zod_openapi_1.z.object({
54
+ displayName: zod_openapi_1.z.string(),
55
+ singleton: zod_openapi_1.z.boolean().optional(),
56
+ fields: zod_openapi_1.z.record(zod_openapi_1.z.string(), exports.EditorialSchemaItemFieldSchema),
57
+ });
58
+ exports.EditorialSchemaSchema = zod_openapi_1.z.record(zod_openapi_1.z.string(), exports.EditorialSchemaItemSchema);
59
+ exports.BaseEditorialFileSchema = zod_openapi_1.z.object({
60
+ name: zod_openapi_1.z.string(),
61
+ type: zod_openapi_1.z.enum(['file', 'directory']),
62
+ path: zod_openapi_1.z.string(),
63
+ size: zod_openapi_1.z.number(),
64
+ });
65
+ exports.EditorialFileSchema = exports.BaseEditorialFileSchema.extend({
66
+ children: zod_openapi_1.z
67
+ .lazy(() => exports.EditorialFileSchema.array())
68
+ .openapi({
69
+ type: 'array',
70
+ }),
71
+ });
72
+ exports.EditorialFilesSchema = zod_openapi_1.z.array(exports.EditorialFileSchema);
@@ -0,0 +1,10 @@
1
+ import type { z } from 'zod';
2
+ import type { EditorialConfigSchema, EditorialDataItemSchema, EditorialDataObjectWithTypeSchema, EditorialDataSchema, EditorialDataTypeSchema, EditorialSchemaItemFieldSchema, EditorialSchemaItemSchema, EditorialSchemaSchema } from './schemas.js';
3
+ export type EditorialConfig = z.infer<typeof EditorialConfigSchema>;
4
+ export type EditorialData = z.infer<typeof EditorialDataSchema>;
5
+ export type EditorialDataType = z.infer<typeof EditorialDataTypeSchema>;
6
+ export type EditorialDataItem = z.infer<typeof EditorialDataItemSchema>;
7
+ export type EditorialDataObjectWithType = z.infer<typeof EditorialDataObjectWithTypeSchema>;
8
+ export type EditorialSchemaItemField = z.infer<typeof EditorialSchemaItemFieldSchema>;
9
+ export type EditorialSchemaItem = z.infer<typeof EditorialSchemaItemSchema>;
10
+ export type EditorialSchema = z.infer<typeof EditorialSchemaSchema>;
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@isardsat/editorial-common",
3
+ "version": "6.0.0-canary-001",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "dependencies": {
7
+ "@hono/zod-openapi": "^0.18.4",
8
+ "zod": "^3.24.1"
9
+ },
10
+ "devDependencies": {
11
+ "@tsconfig/node22": "^22.0.0",
12
+ "typescript": "5.7.3"
13
+ },
14
+ "volta": {
15
+ "extends": "../../package.json"
16
+ },
17
+ "scripts": {
18
+ "compile": "tsc",
19
+ "compile:watch": "tsc --watch"
20
+ }
21
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './schemas.js';
2
+ export type * from './types.js';
package/src/schemas.ts ADDED
@@ -0,0 +1,97 @@
1
+ import { z } from '@hono/zod-openapi';
2
+
3
+ export const EditorialConfigSchema = z.object({
4
+ name: z.string(),
5
+ publicUrl: z.string().url(),
6
+ previewUrl: z.string().optional(),
7
+ silent: z.boolean().optional(),
8
+ });
9
+
10
+ export const EditorialDataObjectWithTypeSchema = z
11
+ .object({
12
+ id: z.string(),
13
+ type: z.string(),
14
+ })
15
+ .passthrough();
16
+
17
+ export const EditorialDataItemSchema = z
18
+ .object({
19
+ id: z.string(),
20
+ createdAt: z
21
+ .string()
22
+ .datetime()
23
+ .default(() => new Date().toISOString()),
24
+ updatedAt: z
25
+ .string()
26
+ .datetime()
27
+ .default(() => new Date().toISOString()),
28
+ })
29
+ .passthrough();
30
+
31
+ export const EditorialDataTypeSchema = z.record(
32
+ z.string(),
33
+ EditorialDataItemSchema
34
+ );
35
+
36
+ export const EditorialDataSchema = z.record(
37
+ z.string(),
38
+ EditorialDataTypeSchema
39
+ );
40
+
41
+ export const EditorialSchemaItemFieldType = z.enum([
42
+ 'string',
43
+ 'boolean',
44
+ 'date',
45
+ 'datetime',
46
+ 'markdown',
47
+ 'number',
48
+ 'color',
49
+ 'select',
50
+ 'color',
51
+ ]);
52
+
53
+ export const EditorialSchemaItemFieldSchema = z
54
+ .object({
55
+ type: EditorialSchemaItemFieldType,
56
+ displayName: z.string(),
57
+ displayExtra: z.string().optional(),
58
+ placeholder: z.string().optional(),
59
+ isRequired: z.boolean().optional(),
60
+ showInSummary: z.boolean().optional(),
61
+ })
62
+ .passthrough();
63
+
64
+ export const EditorialSchemaItemSchema = z.object({
65
+ displayName: z.string(),
66
+ singleton: z.boolean().optional(),
67
+ fields: z.record(z.string(), EditorialSchemaItemFieldSchema),
68
+ });
69
+
70
+ export const EditorialSchemaSchema = z.record(
71
+ z.string(),
72
+ EditorialSchemaItemSchema
73
+ );
74
+
75
+ export const BaseEditorialFileSchema = z.object({
76
+ name: z.string(),
77
+ type: z.enum(['file', 'directory']),
78
+ path: z.string(),
79
+ size: z.number(),
80
+ });
81
+
82
+ export type BaseEditorialFile = z.infer<typeof BaseEditorialFileSchema> & {
83
+ children?: BaseEditorialFile[];
84
+ };
85
+
86
+ export const EditorialFileSchema: z.ZodType<BaseEditorialFile> =
87
+ BaseEditorialFileSchema.extend({
88
+ children: z
89
+ .lazy(() => EditorialFileSchema.array())
90
+ .openapi({
91
+ type: 'array',
92
+ }),
93
+ });
94
+
95
+ export const EditorialFilesSchema = z.array(EditorialFileSchema);
96
+ export type EditorialFile = z.infer<typeof EditorialFileSchema>;
97
+ export type EditorialFiles = z.infer<typeof EditorialFilesSchema>;
package/src/types.ts ADDED
@@ -0,0 +1,24 @@
1
+ import type { z } from 'zod';
2
+ import type {
3
+ EditorialConfigSchema,
4
+ EditorialDataItemSchema,
5
+ EditorialDataObjectWithTypeSchema,
6
+ EditorialDataSchema,
7
+ EditorialDataTypeSchema,
8
+ EditorialSchemaItemFieldSchema,
9
+ EditorialSchemaItemSchema,
10
+ EditorialSchemaSchema,
11
+ } from './schemas.js';
12
+
13
+ export type EditorialConfig = z.infer<typeof EditorialConfigSchema>;
14
+ export type EditorialData = z.infer<typeof EditorialDataSchema>;
15
+ export type EditorialDataType = z.infer<typeof EditorialDataTypeSchema>;
16
+ export type EditorialDataItem = z.infer<typeof EditorialDataItemSchema>;
17
+ export type EditorialDataObjectWithType = z.infer<
18
+ typeof EditorialDataObjectWithTypeSchema
19
+ >;
20
+ export type EditorialSchemaItemField = z.infer<
21
+ typeof EditorialSchemaItemFieldSchema
22
+ >;
23
+ export type EditorialSchemaItem = z.infer<typeof EditorialSchemaItemSchema>;
24
+ export type EditorialSchema = z.infer<typeof EditorialSchemaSchema>;
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "@tsconfig/node22/tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "./dist",
6
+ "strictNullChecks": true,
7
+ "declaration": true
8
+ },
9
+ "include": ["src/**/*"]
10
+ }