kizlo 0.16.0 → 0.18.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/dist/category/index.js +4 -4
- package/dist/category/schema.d.ts +153 -0
- package/dist/category/schema.js +4 -2
- package/dist/category/utils.js +1 -0
- package/dist/cli/daemon/generate.js +6 -0
- package/dist/comment/schema.js +3 -3
- package/dist/comment/utils.js +4 -14
- package/dist/index.d.ts +8 -3
- package/dist/index.js +8 -3
- package/dist/package.js +1 -1
- package/dist/page/index.js +3 -3
- package/dist/page/schema.d.ts +226 -0
- package/dist/page/schema.js +7 -5
- package/dist/page/utils.js +5 -9
- package/dist/post/index.js +3 -3
- package/dist/post/schema.d.ts +268 -0
- package/dist/post/schema.js +7 -5
- package/dist/post/utils.js +5 -9
- package/dist/procedures.d.ts +36 -985
- package/dist/seo/index.js +1 -1
- package/dist/shared/contract.d.ts +1 -1
- package/dist/shared/procedure.d.ts +12 -3
- package/dist/shared/procedure.js +4 -0
- package/dist/shared/result.d.ts +16 -7
- package/dist/shared/schema.d.ts +3 -1
- package/dist/shared/schema.js +3 -1
- package/dist/shared/types.d.ts +1 -1
- package/dist/tag/index.js +3 -3
- package/dist/tag/schema.d.ts +151 -0
- package/dist/tag/schema.js +4 -2
- package/dist/tag/utils.js +1 -0
- package/dist/wordpress/generate.js +41 -3
- package/dist/wordpress/index.d.ts +1 -1
- package/dist/wordpress/types.d.ts +34 -12
- package/package.json +2 -2
package/dist/page/schema.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IdentifierInput, ListMetadata, ListOrder } from "../shared/schema.js";
|
|
2
1
|
import { Seo } from "../seo/schema.js";
|
|
3
|
-
import {
|
|
2
|
+
import { IdentifierInput, ListMetadata, ListOrder, customFieldsSchema } from "../shared/schema.js";
|
|
3
|
+
import { MediaImage, Metadata, NumberLike, arrayable, lenient } from "@kizlo/shared";
|
|
4
4
|
import z from "zod/v4";
|
|
5
5
|
|
|
6
6
|
//#region src/page/schema.ts
|
|
@@ -30,8 +30,9 @@ const PageAuthorRef = z.object({
|
|
|
30
30
|
id: z.number(),
|
|
31
31
|
name: z.string(),
|
|
32
32
|
slug: z.string(),
|
|
33
|
-
|
|
33
|
+
avatarUrl: z.string().nullable()
|
|
34
34
|
});
|
|
35
|
+
const PageCustomFieldsSchema = customFieldsSchema();
|
|
35
36
|
const Page = z.object({
|
|
36
37
|
id: z.number(),
|
|
37
38
|
slug: z.string(),
|
|
@@ -47,8 +48,9 @@ const Page = z.object({
|
|
|
47
48
|
preview: z.boolean(),
|
|
48
49
|
status: PageStatus,
|
|
49
50
|
author: PageAuthorRef.nullable(),
|
|
50
|
-
featuredMedia:
|
|
51
|
+
featuredMedia: MediaImage.nullable(),
|
|
51
52
|
seo: Seo.nullable(),
|
|
53
|
+
custom: PageCustomFieldsSchema,
|
|
52
54
|
createdAt: z.number(),
|
|
53
55
|
updatedAt: z.number(),
|
|
54
56
|
meta: Metadata
|
|
@@ -92,4 +94,4 @@ const ListPageInput = z.object({
|
|
|
92
94
|
});
|
|
93
95
|
|
|
94
96
|
//#endregion
|
|
95
|
-
export { ListPageInput, Page, PageList, RetrievePageInput };
|
|
97
|
+
export { ListPageInput, Page, PageCustomFieldsSchema, PageList, RetrievePageInput };
|
package/dist/page/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { deserializeSeo } from "../seo/utils.js";
|
|
2
2
|
import { publicPostStatus } from "../post-type/status.js";
|
|
3
|
-
import {
|
|
3
|
+
import { stringifiedMetaRecord, timestampFromWpGmt } from "@kizlo/shared";
|
|
4
4
|
|
|
5
5
|
//#region src/page/utils.ts
|
|
6
6
|
function deserializePage(data, options) {
|
|
@@ -26,16 +26,12 @@ function deserializePage(data, options) {
|
|
|
26
26
|
id: kizlo.author.id,
|
|
27
27
|
name: kizlo.author.name,
|
|
28
28
|
slug: kizlo.author.slug,
|
|
29
|
-
|
|
30
|
-
id: 0,
|
|
31
|
-
alt: kizlo.author.name,
|
|
32
|
-
name: kizlo.author.name,
|
|
33
|
-
src: kizlo.author.avatar_url
|
|
34
|
-
} : null
|
|
29
|
+
avatarUrl: kizlo.author.avatar_url || null
|
|
35
30
|
} : null,
|
|
36
31
|
seo: "seo" in kizlo ? deserializeSeo(kizlo.seo) : null,
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
custom: kizlo.custom,
|
|
33
|
+
createdAt: timestampFromWpGmt(data.date_gmt) ?? timestampFromWpGmt(data.modified_gmt) ?? 0,
|
|
34
|
+
updatedAt: timestampFromWpGmt(data.modified_gmt) ?? 0,
|
|
39
35
|
meta: stringifiedMetaRecord(data.meta)
|
|
40
36
|
};
|
|
41
37
|
}
|
package/dist/post/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { compare } from "../shared/crypto.js";
|
|
2
|
-
import { createProcedure } from "../shared/procedure.js";
|
|
2
|
+
import { createProcedure, schemaType } from "../shared/procedure.js";
|
|
3
3
|
import { parseIdentifier } from "../shared/identifier.js";
|
|
4
4
|
import { deserializeListMetadata } from "../shared/serialize.js";
|
|
5
5
|
import { GET_POST_ERROR_MAP, LIST_POST_ERROR_MAP } from "./error.js";
|
|
@@ -18,7 +18,7 @@ const POST_PROCEDURES = {
|
|
|
18
18
|
password: true,
|
|
19
19
|
previewToken: true
|
|
20
20
|
}).optional(),
|
|
21
|
-
output: Post,
|
|
21
|
+
output: schemaType(Post),
|
|
22
22
|
errors: GET_POST_ERROR_MAP
|
|
23
23
|
}, async ({ input, context, errors }) => {
|
|
24
24
|
if (input.query?.previewToken) {
|
|
@@ -73,7 +73,7 @@ const POST_PROCEDURES = {
|
|
|
73
73
|
method: "GET",
|
|
74
74
|
path: "/posts",
|
|
75
75
|
query: ListPostInput.optional(),
|
|
76
|
-
output: PostList,
|
|
76
|
+
output: schemaType(PostList),
|
|
77
77
|
errors: LIST_POST_ERROR_MAP
|
|
78
78
|
}, async ({ input, context, errors }) => {
|
|
79
79
|
const q = input.query;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { WP_CustomFields } from "../wordpress/types.js";
|
|
2
|
+
import "../wordpress/index.js";
|
|
3
|
+
import * as _kizlo_shared7 from "@kizlo/shared";
|
|
4
|
+
import z from "zod/v4";
|
|
5
|
+
|
|
6
|
+
//#region src/post/schema.d.ts
|
|
7
|
+
|
|
8
|
+
type PostCustomFields = WP_CustomFields<"postTypes.post">;
|
|
9
|
+
declare const PostCustomFieldsSchema: z.ZodType<PostCustomFields, PostCustomFields>;
|
|
10
|
+
declare const Post: z.ZodObject<{
|
|
11
|
+
id: z.ZodNumber;
|
|
12
|
+
slug: z.ZodString;
|
|
13
|
+
url: z.ZodNullable<z.ZodString>;
|
|
14
|
+
parent: z.ZodNullable<z.ZodNumber>;
|
|
15
|
+
title: z.ZodNullable<z.ZodString>;
|
|
16
|
+
content: z.ZodNullable<z.ZodString>;
|
|
17
|
+
excerpt: z.ZodNullable<z.ZodString>;
|
|
18
|
+
commentsEnabled: z.ZodBoolean;
|
|
19
|
+
protected: z.ZodBoolean;
|
|
20
|
+
preview: z.ZodBoolean;
|
|
21
|
+
status: z.ZodEnum<{
|
|
22
|
+
publish: "publish";
|
|
23
|
+
future: "future";
|
|
24
|
+
draft: "draft";
|
|
25
|
+
pending: "pending";
|
|
26
|
+
private: "private";
|
|
27
|
+
}>;
|
|
28
|
+
format: z.ZodEnum<{
|
|
29
|
+
status: "status";
|
|
30
|
+
standard: "standard";
|
|
31
|
+
aside: "aside";
|
|
32
|
+
chat: "chat";
|
|
33
|
+
gallery: "gallery";
|
|
34
|
+
link: "link";
|
|
35
|
+
image: "image";
|
|
36
|
+
quote: "quote";
|
|
37
|
+
video: "video";
|
|
38
|
+
audio: "audio";
|
|
39
|
+
}>;
|
|
40
|
+
sticky: z.ZodBoolean;
|
|
41
|
+
author: z.ZodNullable<z.ZodObject<{
|
|
42
|
+
id: z.ZodNumber;
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
slug: z.ZodString;
|
|
45
|
+
avatarUrl: z.ZodNullable<z.ZodString>;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
featuredMedia: z.ZodNullable<z.ZodObject<{
|
|
48
|
+
id: z.ZodNumber;
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
src: z.ZodString;
|
|
51
|
+
mime: z.ZodOptional<z.ZodString>;
|
|
52
|
+
type: z.ZodLiteral<"image">;
|
|
53
|
+
alt: z.ZodString;
|
|
54
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
variants: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
57
|
+
src: z.ZodString;
|
|
58
|
+
width: z.ZodNumber;
|
|
59
|
+
height: z.ZodNumber;
|
|
60
|
+
}, z.core.$strict>>>;
|
|
61
|
+
srcset: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strict>>;
|
|
63
|
+
categories: z.ZodArray<z.ZodObject<{
|
|
64
|
+
id: z.ZodNumber;
|
|
65
|
+
name: z.ZodString;
|
|
66
|
+
slug: z.ZodString;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
tags: z.ZodArray<z.ZodObject<{
|
|
69
|
+
id: z.ZodNumber;
|
|
70
|
+
name: z.ZodString;
|
|
71
|
+
slug: z.ZodString;
|
|
72
|
+
}, z.core.$strip>>;
|
|
73
|
+
seo: z.ZodNullable<z.ZodObject<{
|
|
74
|
+
head: z.ZodObject<{
|
|
75
|
+
title: z.ZodString;
|
|
76
|
+
canonical: z.ZodString;
|
|
77
|
+
robots: z.ZodObject<{
|
|
78
|
+
index: z.ZodString;
|
|
79
|
+
follow: z.ZodString;
|
|
80
|
+
maxSnippet: z.ZodString;
|
|
81
|
+
maxImagePreview: z.ZodString;
|
|
82
|
+
maxVideoPreview: z.ZodString;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
og: z.ZodObject<{
|
|
85
|
+
locale: z.ZodString;
|
|
86
|
+
type: z.ZodString;
|
|
87
|
+
title: z.ZodString;
|
|
88
|
+
url: z.ZodString;
|
|
89
|
+
siteName: z.ZodString;
|
|
90
|
+
description: z.ZodString;
|
|
91
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
92
|
+
url: z.ZodString;
|
|
93
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
94
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
95
|
+
type: z.ZodNullable<z.ZodString>;
|
|
96
|
+
alt: z.ZodNullable<z.ZodString>;
|
|
97
|
+
}, z.core.$strip>>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
twitter: z.ZodObject<{
|
|
100
|
+
card: z.ZodEnum<{
|
|
101
|
+
summary: "summary";
|
|
102
|
+
summary_large_image: "summary_large_image";
|
|
103
|
+
}>;
|
|
104
|
+
title: z.ZodString;
|
|
105
|
+
site: z.ZodNullable<z.ZodString>;
|
|
106
|
+
creator: z.ZodNullable<z.ZodString>;
|
|
107
|
+
description: z.ZodString;
|
|
108
|
+
image: z.ZodNullable<z.ZodString>;
|
|
109
|
+
imageAlt: z.ZodNullable<z.ZodString>;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
article: z.ZodNullable<z.ZodObject<{
|
|
112
|
+
publishedTime: z.ZodString;
|
|
113
|
+
modifiedTime: z.ZodString;
|
|
114
|
+
author: z.ZodString;
|
|
115
|
+
authorUrl: z.ZodString;
|
|
116
|
+
section: z.ZodString;
|
|
117
|
+
tags: z.ZodArray<z.ZodString>;
|
|
118
|
+
}, z.core.$strip>>;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
schema: z.ZodObject<{
|
|
121
|
+
"@context": z.ZodLiteral<"https://schema.org">;
|
|
122
|
+
"@graph": z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
custom: z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>;
|
|
126
|
+
createdAt: z.ZodNumber;
|
|
127
|
+
updatedAt: z.ZodNumber;
|
|
128
|
+
meta: z.ZodRecord<z.ZodString, z.ZodType<_kizlo_shared7.JSONValue, unknown, z.core.$ZodTypeInternals<_kizlo_shared7.JSONValue, unknown>>>;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
type Post = Omit<z.output<typeof Post>, "custom"> & {
|
|
131
|
+
custom: PostCustomFields;
|
|
132
|
+
};
|
|
133
|
+
declare const PostList: z.ZodObject<{
|
|
134
|
+
items: z.ZodArray<z.ZodObject<{
|
|
135
|
+
id: z.ZodNumber;
|
|
136
|
+
slug: z.ZodString;
|
|
137
|
+
url: z.ZodNullable<z.ZodString>;
|
|
138
|
+
parent: z.ZodNullable<z.ZodNumber>;
|
|
139
|
+
title: z.ZodNullable<z.ZodString>;
|
|
140
|
+
content: z.ZodNullable<z.ZodString>;
|
|
141
|
+
excerpt: z.ZodNullable<z.ZodString>;
|
|
142
|
+
commentsEnabled: z.ZodBoolean;
|
|
143
|
+
protected: z.ZodBoolean;
|
|
144
|
+
preview: z.ZodBoolean;
|
|
145
|
+
status: z.ZodEnum<{
|
|
146
|
+
publish: "publish";
|
|
147
|
+
future: "future";
|
|
148
|
+
draft: "draft";
|
|
149
|
+
pending: "pending";
|
|
150
|
+
private: "private";
|
|
151
|
+
}>;
|
|
152
|
+
format: z.ZodEnum<{
|
|
153
|
+
status: "status";
|
|
154
|
+
standard: "standard";
|
|
155
|
+
aside: "aside";
|
|
156
|
+
chat: "chat";
|
|
157
|
+
gallery: "gallery";
|
|
158
|
+
link: "link";
|
|
159
|
+
image: "image";
|
|
160
|
+
quote: "quote";
|
|
161
|
+
video: "video";
|
|
162
|
+
audio: "audio";
|
|
163
|
+
}>;
|
|
164
|
+
sticky: z.ZodBoolean;
|
|
165
|
+
author: z.ZodNullable<z.ZodObject<{
|
|
166
|
+
id: z.ZodNumber;
|
|
167
|
+
name: z.ZodString;
|
|
168
|
+
slug: z.ZodString;
|
|
169
|
+
avatarUrl: z.ZodNullable<z.ZodString>;
|
|
170
|
+
}, z.core.$strip>>;
|
|
171
|
+
featuredMedia: z.ZodNullable<z.ZodObject<{
|
|
172
|
+
id: z.ZodNumber;
|
|
173
|
+
name: z.ZodString;
|
|
174
|
+
src: z.ZodString;
|
|
175
|
+
mime: z.ZodOptional<z.ZodString>;
|
|
176
|
+
type: z.ZodLiteral<"image">;
|
|
177
|
+
alt: z.ZodString;
|
|
178
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
179
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
180
|
+
variants: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
181
|
+
src: z.ZodString;
|
|
182
|
+
width: z.ZodNumber;
|
|
183
|
+
height: z.ZodNumber;
|
|
184
|
+
}, z.core.$strict>>>;
|
|
185
|
+
srcset: z.ZodOptional<z.ZodString>;
|
|
186
|
+
}, z.core.$strict>>;
|
|
187
|
+
categories: z.ZodArray<z.ZodObject<{
|
|
188
|
+
id: z.ZodNumber;
|
|
189
|
+
name: z.ZodString;
|
|
190
|
+
slug: z.ZodString;
|
|
191
|
+
}, z.core.$strip>>;
|
|
192
|
+
tags: z.ZodArray<z.ZodObject<{
|
|
193
|
+
id: z.ZodNumber;
|
|
194
|
+
name: z.ZodString;
|
|
195
|
+
slug: z.ZodString;
|
|
196
|
+
}, z.core.$strip>>;
|
|
197
|
+
seo: z.ZodNullable<z.ZodObject<{
|
|
198
|
+
head: z.ZodObject<{
|
|
199
|
+
title: z.ZodString;
|
|
200
|
+
canonical: z.ZodString;
|
|
201
|
+
robots: z.ZodObject<{
|
|
202
|
+
index: z.ZodString;
|
|
203
|
+
follow: z.ZodString;
|
|
204
|
+
maxSnippet: z.ZodString;
|
|
205
|
+
maxImagePreview: z.ZodString;
|
|
206
|
+
maxVideoPreview: z.ZodString;
|
|
207
|
+
}, z.core.$strip>;
|
|
208
|
+
og: z.ZodObject<{
|
|
209
|
+
locale: z.ZodString;
|
|
210
|
+
type: z.ZodString;
|
|
211
|
+
title: z.ZodString;
|
|
212
|
+
url: z.ZodString;
|
|
213
|
+
siteName: z.ZodString;
|
|
214
|
+
description: z.ZodString;
|
|
215
|
+
image: z.ZodNullable<z.ZodObject<{
|
|
216
|
+
url: z.ZodString;
|
|
217
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
218
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
219
|
+
type: z.ZodNullable<z.ZodString>;
|
|
220
|
+
alt: z.ZodNullable<z.ZodString>;
|
|
221
|
+
}, z.core.$strip>>;
|
|
222
|
+
}, z.core.$strip>;
|
|
223
|
+
twitter: z.ZodObject<{
|
|
224
|
+
card: z.ZodEnum<{
|
|
225
|
+
summary: "summary";
|
|
226
|
+
summary_large_image: "summary_large_image";
|
|
227
|
+
}>;
|
|
228
|
+
title: z.ZodString;
|
|
229
|
+
site: z.ZodNullable<z.ZodString>;
|
|
230
|
+
creator: z.ZodNullable<z.ZodString>;
|
|
231
|
+
description: z.ZodString;
|
|
232
|
+
image: z.ZodNullable<z.ZodString>;
|
|
233
|
+
imageAlt: z.ZodNullable<z.ZodString>;
|
|
234
|
+
}, z.core.$strip>;
|
|
235
|
+
article: z.ZodNullable<z.ZodObject<{
|
|
236
|
+
publishedTime: z.ZodString;
|
|
237
|
+
modifiedTime: z.ZodString;
|
|
238
|
+
author: z.ZodString;
|
|
239
|
+
authorUrl: z.ZodString;
|
|
240
|
+
section: z.ZodString;
|
|
241
|
+
tags: z.ZodArray<z.ZodString>;
|
|
242
|
+
}, z.core.$strip>>;
|
|
243
|
+
}, z.core.$strip>;
|
|
244
|
+
schema: z.ZodObject<{
|
|
245
|
+
"@context": z.ZodLiteral<"https://schema.org">;
|
|
246
|
+
"@graph": z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
247
|
+
}, z.core.$strip>;
|
|
248
|
+
}, z.core.$strip>>;
|
|
249
|
+
custom: z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>;
|
|
250
|
+
createdAt: z.ZodNumber;
|
|
251
|
+
updatedAt: z.ZodNumber;
|
|
252
|
+
meta: z.ZodRecord<z.ZodString, z.ZodType<_kizlo_shared7.JSONValue, unknown, z.core.$ZodTypeInternals<_kizlo_shared7.JSONValue, unknown>>>;
|
|
253
|
+
}, z.core.$strip>>;
|
|
254
|
+
meta: z.ZodObject<{
|
|
255
|
+
page: z.ZodNumber;
|
|
256
|
+
totalItems: z.ZodNumber;
|
|
257
|
+
totalPages: z.ZodNumber;
|
|
258
|
+
nextPage: z.ZodNullable<z.ZodNumber>;
|
|
259
|
+
prevPage: z.ZodNullable<z.ZodNumber>;
|
|
260
|
+
hasNextPage: z.ZodBoolean;
|
|
261
|
+
hasPrevPage: z.ZodBoolean;
|
|
262
|
+
}, z.core.$strip>;
|
|
263
|
+
}, z.core.$strip>;
|
|
264
|
+
type PostList = Omit<z.output<typeof PostList>, "items"> & {
|
|
265
|
+
items: Post[];
|
|
266
|
+
};
|
|
267
|
+
//#endregion
|
|
268
|
+
export { Post, PostCustomFields, PostCustomFieldsSchema, PostList };
|
package/dist/post/schema.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IdentifierInput, ListMetadata, ListOrder } from "../shared/schema.js";
|
|
2
1
|
import { Seo } from "../seo/schema.js";
|
|
3
|
-
import {
|
|
2
|
+
import { IdentifierInput, ListMetadata, ListOrder, customFieldsSchema } from "../shared/schema.js";
|
|
3
|
+
import { BooleanLike, MediaImage, Metadata, NumberLike, arrayable, lenient } from "@kizlo/shared";
|
|
4
4
|
import z from "zod/v4";
|
|
5
5
|
|
|
6
6
|
//#region src/post/schema.ts
|
|
@@ -43,7 +43,7 @@ const PostAuthorRef = z.object({
|
|
|
43
43
|
id: z.number(),
|
|
44
44
|
name: z.string(),
|
|
45
45
|
slug: z.string(),
|
|
46
|
-
|
|
46
|
+
avatarUrl: z.string().nullable()
|
|
47
47
|
});
|
|
48
48
|
const PostCategoryRef = z.object({
|
|
49
49
|
id: z.number(),
|
|
@@ -55,6 +55,7 @@ const PostTagRef = z.object({
|
|
|
55
55
|
name: z.string(),
|
|
56
56
|
slug: z.string()
|
|
57
57
|
});
|
|
58
|
+
const PostCustomFieldsSchema = customFieldsSchema();
|
|
58
59
|
const Post = z.object({
|
|
59
60
|
id: z.number(),
|
|
60
61
|
slug: z.string(),
|
|
@@ -70,10 +71,11 @@ const Post = z.object({
|
|
|
70
71
|
format: PostTypeFormat,
|
|
71
72
|
sticky: z.boolean(),
|
|
72
73
|
author: PostAuthorRef.nullable(),
|
|
73
|
-
featuredMedia:
|
|
74
|
+
featuredMedia: MediaImage.nullable(),
|
|
74
75
|
categories: z.array(PostCategoryRef),
|
|
75
76
|
tags: z.array(PostTagRef),
|
|
76
77
|
seo: Seo.nullable(),
|
|
78
|
+
custom: PostCustomFieldsSchema,
|
|
77
79
|
createdAt: z.number(),
|
|
78
80
|
updatedAt: z.number(),
|
|
79
81
|
meta: Metadata
|
|
@@ -120,4 +122,4 @@ const ListPostInput = z.object({
|
|
|
120
122
|
});
|
|
121
123
|
|
|
122
124
|
//#endregion
|
|
123
|
-
export { ListPostInput, Post, PostList, RetrievePostInput };
|
|
125
|
+
export { ListPostInput, Post, PostCustomFieldsSchema, PostList, RetrievePostInput };
|
package/dist/post/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { deserializeSeo } from "../seo/utils.js";
|
|
2
2
|
import { publicPostStatus } from "../post-type/status.js";
|
|
3
|
-
import {
|
|
3
|
+
import { stringifiedMetaRecord, timestampFromWpGmt } from "@kizlo/shared";
|
|
4
4
|
|
|
5
5
|
//#region src/post/utils.ts
|
|
6
6
|
function deserializePost(data, options) {
|
|
@@ -27,17 +27,13 @@ function deserializePost(data, options) {
|
|
|
27
27
|
id: kizlo.author.id,
|
|
28
28
|
name: kizlo.author.name,
|
|
29
29
|
slug: kizlo.author.slug,
|
|
30
|
-
|
|
31
|
-
id: 0,
|
|
32
|
-
alt: kizlo.author.name,
|
|
33
|
-
name: kizlo.author.name,
|
|
34
|
-
src: kizlo.author.avatar_url
|
|
35
|
-
} : null
|
|
30
|
+
avatarUrl: kizlo.author.avatar_url || null
|
|
36
31
|
} : null,
|
|
37
32
|
format: data.format,
|
|
38
33
|
seo: "seo" in kizlo ? deserializeSeo(kizlo.seo) : null,
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
custom: kizlo.custom,
|
|
35
|
+
createdAt: timestampFromWpGmt(data.date_gmt) ?? timestampFromWpGmt(data.modified_gmt) ?? 0,
|
|
36
|
+
updatedAt: timestampFromWpGmt(data.modified_gmt) ?? 0,
|
|
41
37
|
meta: stringifiedMetaRecord(data.meta)
|
|
42
38
|
};
|
|
43
39
|
}
|