kizlo 0.16.0 → 0.17.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,4 +1,4 @@
1
- import { IdentifierInput, ListMetadata, ListOrder } from "../shared/schema.js";
1
+ import { IdentifierInput, ListMetadata, ListOrder, customFieldsSchema } from "../shared/schema.js";
2
2
  import { Seo } from "../seo/schema.js";
3
3
  import { BooleanLike, Metadata, NumberLike, arrayable, lenient } from "@kizlo/shared";
4
4
  import z from "zod/v4";
@@ -23,6 +23,7 @@ const Category = z.object({
23
23
  parent: z.number().nullable(),
24
24
  postCount: z.number(),
25
25
  seo: Seo.nullable(),
26
+ custom: customFieldsSchema(),
26
27
  meta: Metadata
27
28
  });
28
29
  const RetrieveCategoryInput = z.object({ identifier: IdentifierInput });
@@ -12,6 +12,7 @@ function deserializeCategory(data) {
12
12
  parent: data.parent > 0 ? data.parent : null,
13
13
  postCount: data.count,
14
14
  seo: "seo" in data.kizlo ? deserializeSeo(data.kizlo.seo) : null,
15
+ custom: data.kizlo.custom,
15
16
  meta: stringifiedMetaRecord(data.meta)
16
17
  };
17
18
  }
@@ -1,18 +1,18 @@
1
1
  import { ListMetadata, ListOrder } from "../shared/schema.js";
2
- import { Media, NumberLike, arrayable } from "@kizlo/shared";
2
+ import { MediaImage, NumberLike, arrayable } from "@kizlo/shared";
3
3
  import z from "zod/v4";
4
4
 
5
5
  //#region src/comment/schema.ts
6
6
  const CommentAuthorRef = z.object({
7
7
  id: z.number(),
8
8
  name: z.string(),
9
- avatar: Media.nullable()
9
+ avatarUrl: z.string().nullable()
10
10
  });
11
11
  const CommentPostRef = z.object({
12
12
  id: z.number(),
13
13
  slug: z.string(),
14
14
  title: z.string(),
15
- image: Media.nullable()
15
+ image: MediaImage.nullable()
16
16
  });
17
17
  const Comment = z.object({
18
18
  id: z.number(),
@@ -1,4 +1,4 @@
1
- import { resolveWpTimestamp } from "@kizlo/shared";
1
+ import { timestampFromWpGmt } from "@kizlo/shared";
2
2
 
3
3
  //#region src/comment/utils.ts
4
4
  /**
@@ -12,12 +12,7 @@ function deserializeComment(data) {
12
12
  id: data.id,
13
13
  author: data.kizlo.author ? {
14
14
  id: data.kizlo.author.id,
15
- avatar: data.kizlo.author.avatar_url ? {
16
- id: 0,
17
- alt: "",
18
- name: "",
19
- src: data.kizlo.author.avatar_url
20
- } : null,
15
+ avatarUrl: data.kizlo.author.avatar_url || null,
21
16
  name: data.kizlo.author.name
22
17
  } : null,
23
18
  content: data.content.rendered,
@@ -25,16 +20,11 @@ function deserializeComment(data) {
25
20
  parentId: data.parent,
26
21
  post: {
27
22
  id: post.id,
28
- image: post.featured_image?.url ? {
29
- id: post.featured_image.id,
30
- alt: post.featured_image.alt,
31
- src: post.featured_image.url,
32
- name: ""
33
- } : null,
23
+ image: post.featured_image ?? null,
34
24
  title: post.title,
35
25
  slug: post.slug
36
26
  },
37
- postedAt: resolveWpTimestamp(data.date_gmt) ?? 0,
27
+ postedAt: timestampFromWpGmt(data.date_gmt) ?? 0,
38
28
  replyCount: data.kizlo.reply_count
39
29
  };
40
30
  }
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import "./wordpress/index.js";
7
7
  import { DevPluginSource, Fixture, FixtureCleanupFn, FixtureSeedFn, FixtureSettleFn, JsonValue, LocalPlugin, PluginSource, SeedContext, SettleContext, TestAdminUser, TestCredentials, TestUser, defineFixture, isLocalPlugin } from "./cli/wp/types.js";
8
8
  import { AuthAdapter, AuthGetUser, AuthUser, authMock, createAuthAdapter } from "./adapters/auth.js";
9
9
  import { CaptchaAdapter, altcha, arkose, createCaptchaAdapter, friendlyCaptcha, hcaptcha, recaptcha, turnstile } from "./adapters/captcha.js";
10
- import { CurrencyFormat, IdentifierInput, LIST_ORDER, ListMetadata, ListOrder, PreviewTokenData, PreviewTokenPayload } from "./shared/schema.js";
10
+ import { CurrencyFormat, IdentifierInput, LIST_ORDER, ListMetadata, ListOrder, PreviewTokenData, PreviewTokenPayload, customFieldsSchema } from "./shared/schema.js";
11
11
  import { AnyContext, AnyNestedClient, CookiesAdapter, CookiesDeleteAll, CookiesGetAll, CookiesSetAll, HTTPMethod, List, MaybeOptionalOptions, RedirectInput, RedirectStatus } from "./shared/types.js";
12
12
  import { createCookiesAdapter } from "./adapters/cookies.js";
13
13
  import { ConnInfo, GeoAdapter, GeoGetConnInfo, createGeoAdapter, geoMock } from "./adapters/geo.js";
@@ -38,4 +38,4 @@ import { ShaAlgorithm, compare, hash, hmac } from "./shared/crypto.js";
38
38
  import { Identifier, parseIdentifier } from "./shared/identifier.js";
39
39
  import { createOrpcRouter } from "./shared/router.js";
40
40
  import { deserializeCurrencyFormat, deserializeListMetadata, emptyList, serializeCurrencyFormat } from "./shared/serialize.js";
41
- export { ActiveWordPressClient, AnyContext, AnyEventSchema, AnyEvents, AnyIntegration, AnyKizloConfig, AnyMiddleware, AnyNestedClient, AnyProcedure, AnyProcedureTree, AuthAdapter, AuthGetUser, AuthUser, AuthUserFn, AuthorsSettings, AuthorsSettingsInput, BaseHandlerOptions, BrandSettings, BrandSettingsInput, COMMON_ERRORS, CONTENT_TYPES, CORE_PROCEDURES, CaptchaAdapter, CommonErrorCode, CommonErrorLiteral, CommonErrorMap, ConnInfo, ConnInfoFn, ConsoleLogAdapterOptions, ContentType, Context, ContextConfig, Contract, ContractProcedure, CookiesAdapter, CookiesDeleteAll, CookiesGetAll, CookiesSetAll, CookiesStorage, CoreProcedures, CrawlingSettings, CrawlingSettingsInput, CreateKizloOptions, CreateSitemapRouteOptions, CurrencyFormat, DefinedErrorMapLike, DevPluginSource, EnvReader, EnvRecord, EnvSource, ErrorDefinition, EventHandler, EventHandlerFn, ExtractIntegrationProcedures, ExtractMiddlewareContextOutput, ExtractParams, ExtractProcedureByScope, Fixture, FixtureCleanupFn, FixtureSeedFn, FixtureSettleFn, GeoAdapter, GeoGetConnInfo, HTTPMethod, HeadlessSettings, HeadlessSettingsInput, IconDescriptor, Identifier, IdentifierInput, IdentitySettings, IdentitySettingsInput, InferEventUnion, InferIntegrationProcedures, InferMiddlewares, Integration, IntegrationRequirements, InvocationScope, JsonValue, Kizlo, KizloClient, KizloClientConfig, KizloConfig, KizloEnv, KizloError, KizloErrorOptions, LIST_ORDER, List, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, LocalPlugin, LogLevel, LogPayload, Logger, LoggerAdapter, ManifestIcon, MaybeOptionalOptions, Middleware, MiddlewareHandler, MiddlewareNextFn, MiddlewareOptions, MiddlewareResult, OpenapiPart, OrganizationFounder, OrganizationSettings, OrganizationSettingsInput, PersonSettings, PersonSettingsInput, PluginSource, PostStatusDefinition, PostTypeSettings, PostTypeSettingsInput, PreviewTokenData, PreviewTokenPayload, Procedure, ProcedureContext, ProcedureErrors, ProcedureHandler, ProcedureOptions, ProcedureTreeDepthTuple, RedirectInput, RedirectStatus, ResolveParamsPart, ResolvedIcons, ResolvedSchemaInput, ResolvedSchemaOutput, Robots, RobotsRule, RootProcedures, S2SClient, SITEMAP_BASE, SITEMAP_INDEX_SLUG, SchemaIO, SeedContext, Seo, SeoHead, SeoSchema, ServiceAdapters, Settings, SettingsService, SettleContext, ShaAlgorithm, SiteSettings, SiteSettingsInput, Sitemap, SitemapIndex, SitemapIndexEntry, SitemapList, SitemapRouteExtra, SitemapUrl, SitemapUrlImage, SitemapUrlList, SocialProfile, TaxonomySettings, TaxonomySettingsInput, TestAdminUser, TestCredentials, TestUser, ThrowableErrorFn, ThrowableErrorMap, UploadsSettings, UploadsSettingsInput, VerifyCaptchaFn, VerifyPreviewTokenFn, WEB_MANIFEST_ROUTE, WPK_RobotRule, WPK_Robots, WPK_Seo, WPK_Sitemap, WPK_SitemapUrl, WPK_SitemapUrlImage, WP_CallOptions, WP_Client, WP_CommonErrorCode, WP_CurrencyFormat, WP_Endpoint, WP_EndpointData, WP_EndpointDefinition, WP_EndpointInput, WP_EndpointResult, WP_Error, WP_ErrorData, WP_Failure, WP_List, WP_ListMetadata, WP_RequestBuild, WP_RequestContentType, WP_RequestInput, WP_RequestMethod, WP_ResponseContentType, WP_Result, WP_Success, WP_TransportFailure, WP_TypedHeaders, WebManifest, WebhookOptions, WebhookSettings, WebhookSettingsInput, WithCommonErrorMap, WordPressClientRegistry, WordPressCredentials, WordPressEnv, WordPressTransport, WordPressTransportOptions, WordPressTransportResult, altcha, arkose, assertIntegrationEndpoints, assertIntegrationEnv, authMock, buildProcedure, buildWebManifest, buildWordPressRequest, combineDetailed, compare, consoleLog, createAuthAdapter, createCaptchaAdapter, createCookiesAdapter, createEventHandler, createGeoAdapter, createIntegration, createKizlo, createKizloClient, createLoggerAdapter, createManifestRoute, createMiddleware, createOrpcRouter, createProcedure, createSitemapRedirectRoute, createSitemapRoute, createThrowableErrorMap, createWebhookRouter, createWordPressClient, defineErrorMap, defineFixture, deserializeCurrencyFormat, deserializeListMetadata, deserializeSeo, emptyList, friendlyCaptcha, generateContract, geoMock, geoVercelNext, handleUnexpectedError, hash, hcaptcha, hmac, integrationEnv, isContractProcedure, isKizloError, isLocalPlugin, isWordPressResourceError, mergeServiceAdapters, missingEndpoints, missingEnv, noopAdapter, parseIdentifier, parseSitemapSlug, readEnv, recaptcha, renderJsonLd, renderSitemapIndex, renderUrlSet, resolveIcons, resolveKizloConfig, resolveWordPressConnection, restoreContract, schemaType, serializeCurrencyFormat, sitemapEntryPath, toKizloError, turnstile, wpEndpoint, xmlResponse };
41
+ export { ActiveWordPressClient, AnyContext, AnyEventSchema, AnyEvents, AnyIntegration, AnyKizloConfig, AnyMiddleware, AnyNestedClient, AnyProcedure, AnyProcedureTree, AuthAdapter, AuthGetUser, AuthUser, AuthUserFn, AuthorsSettings, AuthorsSettingsInput, BaseHandlerOptions, BrandSettings, BrandSettingsInput, COMMON_ERRORS, CONTENT_TYPES, CORE_PROCEDURES, CaptchaAdapter, CommonErrorCode, CommonErrorLiteral, CommonErrorMap, ConnInfo, ConnInfoFn, ConsoleLogAdapterOptions, ContentType, Context, ContextConfig, Contract, ContractProcedure, CookiesAdapter, CookiesDeleteAll, CookiesGetAll, CookiesSetAll, CookiesStorage, CoreProcedures, CrawlingSettings, CrawlingSettingsInput, CreateKizloOptions, CreateSitemapRouteOptions, CurrencyFormat, DefinedErrorMapLike, DevPluginSource, EnvReader, EnvRecord, EnvSource, ErrorDefinition, EventHandler, EventHandlerFn, ExtractIntegrationProcedures, ExtractMiddlewareContextOutput, ExtractParams, ExtractProcedureByScope, Fixture, FixtureCleanupFn, FixtureSeedFn, FixtureSettleFn, GeoAdapter, GeoGetConnInfo, HTTPMethod, HeadlessSettings, HeadlessSettingsInput, IconDescriptor, Identifier, IdentifierInput, IdentitySettings, IdentitySettingsInput, InferEventUnion, InferIntegrationProcedures, InferMiddlewares, Integration, IntegrationRequirements, InvocationScope, JsonValue, Kizlo, KizloClient, KizloClientConfig, KizloConfig, KizloEnv, KizloError, KizloErrorOptions, LIST_ORDER, List, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, LocalPlugin, LogLevel, LogPayload, Logger, LoggerAdapter, ManifestIcon, MaybeOptionalOptions, Middleware, MiddlewareHandler, MiddlewareNextFn, MiddlewareOptions, MiddlewareResult, OpenapiPart, OrganizationFounder, OrganizationSettings, OrganizationSettingsInput, PersonSettings, PersonSettingsInput, PluginSource, PostStatusDefinition, PostTypeSettings, PostTypeSettingsInput, PreviewTokenData, PreviewTokenPayload, Procedure, ProcedureContext, ProcedureErrors, ProcedureHandler, ProcedureOptions, ProcedureTreeDepthTuple, RedirectInput, RedirectStatus, ResolveParamsPart, ResolvedIcons, ResolvedSchemaInput, ResolvedSchemaOutput, Robots, RobotsRule, RootProcedures, S2SClient, SITEMAP_BASE, SITEMAP_INDEX_SLUG, SchemaIO, SeedContext, Seo, SeoHead, SeoSchema, ServiceAdapters, Settings, SettingsService, SettleContext, ShaAlgorithm, SiteSettings, SiteSettingsInput, Sitemap, SitemapIndex, SitemapIndexEntry, SitemapList, SitemapRouteExtra, SitemapUrl, SitemapUrlImage, SitemapUrlList, SocialProfile, TaxonomySettings, TaxonomySettingsInput, TestAdminUser, TestCredentials, TestUser, ThrowableErrorFn, ThrowableErrorMap, UploadsSettings, UploadsSettingsInput, VerifyCaptchaFn, VerifyPreviewTokenFn, WEB_MANIFEST_ROUTE, WPK_RobotRule, WPK_Robots, WPK_Seo, WPK_Sitemap, WPK_SitemapUrl, WPK_SitemapUrlImage, WP_CallOptions, WP_Client, WP_CommonErrorCode, WP_CurrencyFormat, WP_Endpoint, WP_EndpointData, WP_EndpointDefinition, WP_EndpointInput, WP_EndpointResult, WP_Error, WP_ErrorData, WP_Failure, WP_List, WP_ListMetadata, WP_RequestBuild, WP_RequestContentType, WP_RequestInput, WP_RequestMethod, WP_ResponseContentType, WP_Result, WP_Success, WP_TransportFailure, WP_TypedHeaders, WebManifest, WebhookOptions, WebhookSettings, WebhookSettingsInput, WithCommonErrorMap, WordPressClientRegistry, WordPressCredentials, WordPressEnv, WordPressTransport, WordPressTransportOptions, WordPressTransportResult, altcha, arkose, assertIntegrationEndpoints, assertIntegrationEnv, authMock, buildProcedure, buildWebManifest, buildWordPressRequest, combineDetailed, compare, consoleLog, createAuthAdapter, createCaptchaAdapter, createCookiesAdapter, createEventHandler, createGeoAdapter, createIntegration, createKizlo, createKizloClient, createLoggerAdapter, createManifestRoute, createMiddleware, createOrpcRouter, createProcedure, createSitemapRedirectRoute, createSitemapRoute, createThrowableErrorMap, createWebhookRouter, createWordPressClient, customFieldsSchema, defineErrorMap, defineFixture, deserializeCurrencyFormat, deserializeListMetadata, deserializeSeo, emptyList, friendlyCaptcha, generateContract, geoMock, geoVercelNext, handleUnexpectedError, hash, hcaptcha, hmac, integrationEnv, isContractProcedure, isKizloError, isLocalPlugin, isWordPressResourceError, mergeServiceAdapters, missingEndpoints, missingEnv, noopAdapter, parseIdentifier, parseSitemapSlug, readEnv, recaptcha, renderJsonLd, renderSitemapIndex, renderUrlSet, resolveIcons, resolveKizloConfig, resolveWordPressConnection, restoreContract, schemaType, serializeCurrencyFormat, sitemapEntryPath, toKizloError, turnstile, wpEndpoint, xmlResponse };
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import { COMMON_ERRORS, KizloError, createThrowableErrorMap, defineErrorMap, isK
13
13
  import { buildProcedure, combineDetailed, createProcedure, handleUnexpectedError, schemaType } from "./shared/procedure.js";
14
14
  import { createOrpcRouter } from "./shared/router.js";
15
15
  import { generateContract, isContractProcedure, restoreContract } from "./shared/contract.js";
16
- import { CurrencyFormat, IdentifierInput, LIST_ORDER, ListMetadata, ListOrder, PreviewTokenData, PreviewTokenPayload } from "./shared/schema.js";
16
+ import { CurrencyFormat, IdentifierInput, LIST_ORDER, ListMetadata, ListOrder, PreviewTokenData, PreviewTokenPayload, customFieldsSchema } from "./shared/schema.js";
17
17
  import { KizloClient, createKizloClient } from "./client.js";
18
18
  import { CookiesStorage } from "./cookie.js";
19
19
  import { SettingsService } from "./settings/service.js";
@@ -33,4 +33,4 @@ import { Kizlo, createKizlo, integrationEnv, resolveKizloConfig, resolveWordPres
33
33
  import { SITEMAP_BASE, SITEMAP_INDEX_SLUG, createSitemapRedirectRoute, createSitemapRoute } from "./seo/sitemap.js";
34
34
  import { createMiddleware } from "./shared/middleware.js";
35
35
 
36
- export { COMMON_ERRORS, CONTENT_TYPES, CORE_PROCEDURES, ContentType, Context, CookiesStorage, CurrencyFormat, IdentifierInput, Kizlo, KizloClient, KizloError, LIST_ORDER, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, PreviewTokenData, PreviewTokenPayload, Robots, RobotsRule, SITEMAP_BASE, SITEMAP_INDEX_SLUG, Seo, SeoHead, SeoSchema, SettingsService, Sitemap, SitemapIndex, SitemapList, SitemapUrl, SitemapUrlImage, SitemapUrlList, WEB_MANIFEST_ROUTE, WP_Error, WordPressTransport, altcha, arkose, assertIntegrationEndpoints, assertIntegrationEnv, authMock, buildProcedure, buildWebManifest, buildWordPressRequest, combineDetailed, compare, consoleLog, createAuthAdapter, createCaptchaAdapter, createCookiesAdapter, createEventHandler, createGeoAdapter, createIntegration, createKizlo, createKizloClient, createLoggerAdapter, createManifestRoute, createMiddleware, createOrpcRouter, createProcedure, createSitemapRedirectRoute, createSitemapRoute, createThrowableErrorMap, createWebhookRouter, createWordPressClient, defineErrorMap, defineFixture, deserializeCurrencyFormat, deserializeListMetadata, deserializeSeo, emptyList, friendlyCaptcha, generateContract, geoMock, geoVercelNext, handleUnexpectedError, hash, hcaptcha, hmac, integrationEnv, isContractProcedure, isKizloError, isLocalPlugin, isWordPressResourceError, mergeServiceAdapters, missingEndpoints, missingEnv, noopAdapter, parseIdentifier, parseSitemapSlug, readEnv, recaptcha, renderJsonLd, renderSitemapIndex, renderUrlSet, resolveIcons, resolveKizloConfig, resolveWordPressConnection, restoreContract, schemaType, serializeCurrencyFormat, sitemapEntryPath, toKizloError, turnstile, wpEndpoint, xmlResponse };
36
+ export { COMMON_ERRORS, CONTENT_TYPES, CORE_PROCEDURES, ContentType, Context, CookiesStorage, CurrencyFormat, IdentifierInput, Kizlo, KizloClient, KizloError, LIST_ORDER, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, PreviewTokenData, PreviewTokenPayload, Robots, RobotsRule, SITEMAP_BASE, SITEMAP_INDEX_SLUG, Seo, SeoHead, SeoSchema, SettingsService, Sitemap, SitemapIndex, SitemapList, SitemapUrl, SitemapUrlImage, SitemapUrlList, WEB_MANIFEST_ROUTE, WP_Error, WordPressTransport, altcha, arkose, assertIntegrationEndpoints, assertIntegrationEnv, authMock, buildProcedure, buildWebManifest, buildWordPressRequest, combineDetailed, compare, consoleLog, createAuthAdapter, createCaptchaAdapter, createCookiesAdapter, createEventHandler, createGeoAdapter, createIntegration, createKizlo, createKizloClient, createLoggerAdapter, createManifestRoute, createMiddleware, createOrpcRouter, createProcedure, createSitemapRedirectRoute, createSitemapRoute, createThrowableErrorMap, createWebhookRouter, createWordPressClient, customFieldsSchema, defineErrorMap, defineFixture, deserializeCurrencyFormat, deserializeListMetadata, deserializeSeo, emptyList, friendlyCaptcha, generateContract, geoMock, geoVercelNext, handleUnexpectedError, hash, hcaptcha, hmac, integrationEnv, isContractProcedure, isKizloError, isLocalPlugin, isWordPressResourceError, mergeServiceAdapters, missingEndpoints, missingEnv, noopAdapter, parseIdentifier, parseSitemapSlug, readEnv, recaptcha, renderJsonLd, renderSitemapIndex, renderUrlSet, resolveIcons, resolveKizloConfig, resolveWordPressConnection, restoreContract, schemaType, serializeCurrencyFormat, sitemapEntryPath, toKizloError, turnstile, wpEndpoint, xmlResponse };
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.16.0";
2
+ var version = "0.17.0";
3
3
 
4
4
  //#endregion
5
5
  export { version };
@@ -1,6 +1,6 @@
1
- import { IdentifierInput, ListMetadata, ListOrder } from "../shared/schema.js";
1
+ import { IdentifierInput, ListMetadata, ListOrder, customFieldsSchema } from "../shared/schema.js";
2
2
  import { Seo } from "../seo/schema.js";
3
- import { Media, Metadata, NumberLike, arrayable, lenient } from "@kizlo/shared";
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,7 +30,7 @@ const PageAuthorRef = z.object({
30
30
  id: z.number(),
31
31
  name: z.string(),
32
32
  slug: z.string(),
33
- avatar: Media.nullable()
33
+ avatarUrl: z.string().nullable()
34
34
  });
35
35
  const Page = z.object({
36
36
  id: z.number(),
@@ -47,8 +47,9 @@ const Page = z.object({
47
47
  preview: z.boolean(),
48
48
  status: PageStatus,
49
49
  author: PageAuthorRef.nullable(),
50
- featuredMedia: Media.nullable(),
50
+ featuredMedia: MediaImage.nullable(),
51
51
  seo: Seo.nullable(),
52
+ custom: customFieldsSchema(),
52
53
  createdAt: z.number(),
53
54
  updatedAt: z.number(),
54
55
  meta: Metadata
@@ -1,6 +1,6 @@
1
1
  import { deserializeSeo } from "../seo/utils.js";
2
2
  import { publicPostStatus } from "../post-type/status.js";
3
- import { resolveWpTimestamp, stringifiedMetaRecord } from "@kizlo/shared";
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
- avatar: kizlo.author.avatar_url ? {
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
- createdAt: resolveWpTimestamp(data.date_gmt) ?? resolveWpTimestamp(data.modified_gmt) ?? 0,
38
- updatedAt: resolveWpTimestamp(data.modified_gmt) ?? 0,
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
  }
@@ -1,6 +1,6 @@
1
- import { IdentifierInput, ListMetadata, ListOrder } from "../shared/schema.js";
1
+ import { IdentifierInput, ListMetadata, ListOrder, customFieldsSchema } from "../shared/schema.js";
2
2
  import { Seo } from "../seo/schema.js";
3
- import { BooleanLike, Media, Metadata, NumberLike, arrayable, lenient } from "@kizlo/shared";
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
- avatar: Media.nullable()
46
+ avatarUrl: z.string().nullable()
47
47
  });
48
48
  const PostCategoryRef = z.object({
49
49
  id: z.number(),
@@ -70,10 +70,11 @@ const Post = z.object({
70
70
  format: PostTypeFormat,
71
71
  sticky: z.boolean(),
72
72
  author: PostAuthorRef.nullable(),
73
- featuredMedia: Media.nullable(),
73
+ featuredMedia: MediaImage.nullable(),
74
74
  categories: z.array(PostCategoryRef),
75
75
  tags: z.array(PostTagRef),
76
76
  seo: Seo.nullable(),
77
+ custom: customFieldsSchema(),
77
78
  createdAt: z.number(),
78
79
  updatedAt: z.number(),
79
80
  meta: Metadata
@@ -1,6 +1,6 @@
1
1
  import { deserializeSeo } from "../seo/utils.js";
2
2
  import { publicPostStatus } from "../post-type/status.js";
3
- import { resolveWpTimestamp, stringifiedMetaRecord } from "@kizlo/shared";
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
- avatar: kizlo.author.avatar_url ? {
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
- createdAt: resolveWpTimestamp(data.date_gmt) ?? resolveWpTimestamp(data.modified_gmt) ?? 0,
40
- updatedAt: resolveWpTimestamp(data.modified_gmt) ?? 0,
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
  }
@@ -33,27 +33,14 @@ declare const CORE_PROCEDURES: {
33
33
  id: number;
34
34
  name: string;
35
35
  slug: string;
36
- avatar: {
37
- id: number;
38
- name: string;
39
- alt: string;
40
- src: string;
41
- mime?: string | undefined;
42
- width?: number | undefined;
43
- height?: number | undefined;
44
- variants?: {
45
- src: string;
46
- width: number;
47
- height: number;
48
- }[] | undefined;
49
- srcset?: string | undefined;
50
- } | null;
36
+ avatarUrl: string | null;
51
37
  } | null;
52
38
  featuredMedia: {
53
39
  id: number;
54
40
  name: string;
55
- alt: string;
56
41
  src: string;
42
+ type: "image";
43
+ alt: string;
57
44
  mime?: string | undefined;
58
45
  width?: number | undefined;
59
46
  height?: number | undefined;
@@ -125,6 +112,7 @@ declare const CORE_PROCEDURES: {
125
112
  }[];
126
113
  };
127
114
  } | null;
115
+ custom: never;
128
116
  createdAt: number;
129
117
  updatedAt: number;
130
118
  meta: {
@@ -208,27 +196,14 @@ declare const CORE_PROCEDURES: {
208
196
  id: number;
209
197
  name: string;
210
198
  slug: string;
211
- avatar: {
212
- id: number;
213
- name: string;
214
- alt: string;
215
- src: string;
216
- mime?: string | undefined;
217
- width?: number | undefined;
218
- height?: number | undefined;
219
- variants?: {
220
- src: string;
221
- width: number;
222
- height: number;
223
- }[] | undefined;
224
- srcset?: string | undefined;
225
- } | null;
199
+ avatarUrl: string | null;
226
200
  } | null;
227
201
  featuredMedia: {
228
202
  id: number;
229
203
  name: string;
230
- alt: string;
231
204
  src: string;
205
+ type: "image";
206
+ alt: string;
232
207
  mime?: string | undefined;
233
208
  width?: number | undefined;
234
209
  height?: number | undefined;
@@ -300,6 +275,7 @@ declare const CORE_PROCEDURES: {
300
275
  }[];
301
276
  };
302
277
  } | null;
278
+ custom: never;
303
279
  createdAt: number;
304
280
  updatedAt: number;
305
281
  meta: {
@@ -375,27 +351,14 @@ declare const CORE_PROCEDURES: {
375
351
  id: number;
376
352
  name: string;
377
353
  slug: string;
378
- avatar: {
379
- id: number;
380
- name: string;
381
- alt: string;
382
- src: string;
383
- mime?: string | undefined;
384
- width?: number | undefined;
385
- height?: number | undefined;
386
- variants?: {
387
- src: string;
388
- width: number;
389
- height: number;
390
- }[] | undefined;
391
- srcset?: string | undefined;
392
- } | null;
354
+ avatarUrl: string | null;
393
355
  } | null;
394
356
  featuredMedia: {
395
357
  id: number;
396
358
  name: string;
397
- alt: string;
398
359
  src: string;
360
+ type: "image";
361
+ alt: string;
399
362
  mime?: string | undefined;
400
363
  width?: number | undefined;
401
364
  height?: number | undefined;
@@ -457,6 +420,7 @@ declare const CORE_PROCEDURES: {
457
420
  }[];
458
421
  };
459
422
  } | null;
423
+ custom: never;
460
424
  createdAt: number;
461
425
  updatedAt: number;
462
426
  meta: {
@@ -537,27 +501,14 @@ declare const CORE_PROCEDURES: {
537
501
  id: number;
538
502
  name: string;
539
503
  slug: string;
540
- avatar: {
541
- id: number;
542
- name: string;
543
- alt: string;
544
- src: string;
545
- mime?: string | undefined;
546
- width?: number | undefined;
547
- height?: number | undefined;
548
- variants?: {
549
- src: string;
550
- width: number;
551
- height: number;
552
- }[] | undefined;
553
- srcset?: string | undefined;
554
- } | null;
504
+ avatarUrl: string | null;
555
505
  } | null;
556
506
  featuredMedia: {
557
507
  id: number;
558
508
  name: string;
559
- alt: string;
560
509
  src: string;
510
+ type: "image";
511
+ alt: string;
561
512
  mime?: string | undefined;
562
513
  width?: number | undefined;
563
514
  height?: number | undefined;
@@ -619,6 +570,7 @@ declare const CORE_PROCEDURES: {
619
570
  }[];
620
571
  };
621
572
  } | null;
573
+ custom: never;
622
574
  createdAt: number;
623
575
  updatedAt: number;
624
576
  meta: {
@@ -731,6 +683,7 @@ declare const CORE_PROCEDURES: {
731
683
  }[];
732
684
  };
733
685
  } | null;
686
+ custom: never;
734
687
  meta: {
735
688
  [x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | {
736
689
  [x: string]: string | number | boolean | /*elided*/any | /*elided*/any | null;
@@ -772,7 +725,7 @@ declare const CORE_PROCEDURES: {
772
725
  exclude?: string | number | (string | number)[] | undefined;
773
726
  include?: string | number | (string | number)[] | undefined;
774
727
  order?: "asc" | "desc" | undefined;
775
- orderBy?: "count" | "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | undefined;
728
+ orderBy?: "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | "count" | undefined;
776
729
  hideEmpty?: string | boolean | undefined;
777
730
  parent?: string | number | undefined;
778
731
  post?: string | number | undefined;
@@ -838,6 +791,7 @@ declare const CORE_PROCEDURES: {
838
791
  }[];
839
792
  };
840
793
  } | null;
794
+ custom: never;
841
795
  meta: {
842
796
  [x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | {
843
797
  [x: string]: string | number | boolean | /*elided*/any | /*elided*/any | null;
@@ -947,6 +901,7 @@ declare const CORE_PROCEDURES: {
947
901
  }[];
948
902
  };
949
903
  } | null;
904
+ custom: never;
950
905
  meta: {
951
906
  [x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | {
952
907
  [x: string]: string | number | boolean | /*elided*/any | /*elided*/any | null;
@@ -988,7 +943,7 @@ declare const CORE_PROCEDURES: {
988
943
  exclude?: string | number | (string | number)[] | undefined;
989
944
  include?: string | number | (string | number)[] | undefined;
990
945
  order?: "asc" | "desc" | undefined;
991
- orderBy?: "count" | "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | undefined;
946
+ orderBy?: "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | "count" | undefined;
992
947
  hideEmpty?: string | boolean | undefined;
993
948
  post?: string | number | undefined;
994
949
  slug?: string | string[] | undefined;
@@ -1052,6 +1007,7 @@ declare const CORE_PROCEDURES: {
1052
1007
  }[];
1053
1008
  };
1054
1009
  } | null;
1010
+ custom: never;
1055
1011
  meta: {
1056
1012
  [x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | {
1057
1013
  [x: string]: string | number | boolean | /*elided*/any | /*elided*/any | null;
@@ -1151,7 +1107,7 @@ declare const CORE_PROCEDURES: {
1151
1107
  sitemaps: {
1152
1108
  list: Procedure<"internal", {}, {
1153
1109
  key: string;
1154
- type: "post_type" | "taxonomy" | "author";
1110
+ type: "author" | "post_type" | "taxonomy";
1155
1111
  pages: number;
1156
1112
  lastmod: string;
1157
1113
  }[], DefinedErrorMapLike>;
@@ -1159,7 +1115,7 @@ declare const CORE_PROCEDURES: {
1159
1115
  origin: string;
1160
1116
  sitemaps: {
1161
1117
  key: string;
1162
- type: "post_type" | "taxonomy" | "author";
1118
+ type: "author" | "post_type" | "taxonomy";
1163
1119
  pages: number;
1164
1120
  lastmod: string;
1165
1121
  }[];
@@ -1367,21 +1323,7 @@ declare const CORE_PROCEDURES: {
1367
1323
  author: {
1368
1324
  id: number;
1369
1325
  name: string;
1370
- avatar: {
1371
- id: number;
1372
- name: string;
1373
- alt: string;
1374
- src: string;
1375
- mime?: string | undefined;
1376
- width?: number | undefined;
1377
- height?: number | undefined;
1378
- variants?: {
1379
- src: string;
1380
- width: number;
1381
- height: number;
1382
- }[] | undefined;
1383
- srcset?: string | undefined;
1384
- } | null;
1326
+ avatarUrl: string | null;
1385
1327
  } | null;
1386
1328
  content: string;
1387
1329
  post: {
@@ -1391,8 +1333,9 @@ declare const CORE_PROCEDURES: {
1391
1333
  image: {
1392
1334
  id: number;
1393
1335
  name: string;
1394
- alt: string;
1395
1336
  src: string;
1337
+ type: "image";
1338
+ alt: string;
1396
1339
  mime?: string | undefined;
1397
1340
  width?: number | undefined;
1398
1341
  height?: number | undefined;
@@ -1443,21 +1386,7 @@ declare const CORE_PROCEDURES: {
1443
1386
  author: {
1444
1387
  id: number;
1445
1388
  name: string;
1446
- avatar: {
1447
- id: number;
1448
- name: string;
1449
- alt: string;
1450
- src: string;
1451
- mime?: string | undefined;
1452
- width?: number | undefined;
1453
- height?: number | undefined;
1454
- variants?: {
1455
- src: string;
1456
- width: number;
1457
- height: number;
1458
- }[] | undefined;
1459
- srcset?: string | undefined;
1460
- } | null;
1389
+ avatarUrl: string | null;
1461
1390
  } | null;
1462
1391
  content: string;
1463
1392
  post: {
@@ -1467,8 +1396,9 @@ declare const CORE_PROCEDURES: {
1467
1396
  image: {
1468
1397
  id: number;
1469
1398
  name: string;
1470
- alt: string;
1471
1399
  src: string;
1400
+ type: "image";
1401
+ alt: string;
1472
1402
  mime?: string | undefined;
1473
1403
  width?: number | undefined;
1474
1404
  height?: number | undefined;
@@ -1519,21 +1449,7 @@ declare const CORE_PROCEDURES: {
1519
1449
  author: {
1520
1450
  id: number;
1521
1451
  name: string;
1522
- avatar: {
1523
- id: number;
1524
- name: string;
1525
- alt: string;
1526
- src: string;
1527
- mime?: string | undefined;
1528
- width?: number | undefined;
1529
- height?: number | undefined;
1530
- variants?: {
1531
- src: string;
1532
- width: number;
1533
- height: number;
1534
- }[] | undefined;
1535
- srcset?: string | undefined;
1536
- } | null;
1452
+ avatarUrl: string | null;
1537
1453
  } | null;
1538
1454
  content: string;
1539
1455
  post: {
@@ -1543,8 +1459,9 @@ declare const CORE_PROCEDURES: {
1543
1459
  image: {
1544
1460
  id: number;
1545
1461
  name: string;
1546
- alt: string;
1547
1462
  src: string;
1463
+ type: "image";
1464
+ alt: string;
1548
1465
  mime?: string | undefined;
1549
1466
  width?: number | undefined;
1550
1467
  height?: number | undefined;
@@ -108,17 +108,17 @@ declare const Seo: z.ZodObject<{
108
108
  type Seo = z.infer<typeof Seo>;
109
109
  declare const CONTENT_TYPES: readonly ["post_type", "taxonomy", "author"];
110
110
  declare const ContentType: z.ZodEnum<{
111
+ author: "author";
111
112
  post_type: "post_type";
112
113
  taxonomy: "taxonomy";
113
- author: "author";
114
114
  }>;
115
115
  type ContentType = z.infer<typeof ContentType>;
116
116
  declare const Sitemap: z.ZodObject<{
117
117
  key: z.ZodString;
118
118
  type: z.ZodEnum<{
119
+ author: "author";
119
120
  post_type: "post_type";
120
121
  taxonomy: "taxonomy";
121
- author: "author";
122
122
  }>;
123
123
  pages: z.ZodNumber;
124
124
  lastmod: z.ZodString;
@@ -127,9 +127,9 @@ type Sitemap = z.infer<typeof Sitemap>;
127
127
  declare const SitemapList: z.ZodArray<z.ZodObject<{
128
128
  key: z.ZodString;
129
129
  type: z.ZodEnum<{
130
+ author: "author";
130
131
  post_type: "post_type";
131
132
  taxonomy: "taxonomy";
132
- author: "author";
133
133
  }>;
134
134
  pages: z.ZodNumber;
135
135
  lastmod: z.ZodString;
@@ -140,9 +140,9 @@ declare const SitemapIndex: z.ZodObject<{
140
140
  sitemaps: z.ZodArray<z.ZodObject<{
141
141
  key: z.ZodString;
142
142
  type: z.ZodEnum<{
143
+ author: "author";
143
144
  post_type: "post_type";
144
145
  taxonomy: "taxonomy";
145
- author: "author";
146
146
  }>;
147
147
  pages: z.ZodNumber;
148
148
  lastmod: z.ZodString;
@@ -174,9 +174,9 @@ declare const SitemapUrlList: z.ZodArray<z.ZodObject<{
174
174
  type SitemapUrlList = z.infer<typeof SitemapUrlList>;
175
175
  declare const ListSitemapUrlInputBase: z.ZodObject<{
176
176
  type: z.ZodEnum<{
177
+ author: "author";
177
178
  post_type: "post_type";
178
179
  taxonomy: "taxonomy";
179
- author: "author";
180
180
  }>;
181
181
  page: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>>;
182
182
  }, z.core.$strip>;
@@ -29,6 +29,8 @@ declare const CurrencyFormat: z.ZodObject<{
29
29
  type CurrencyFormat = z.infer<typeof CurrencyFormat>;
30
30
  declare const IdentifierInput: z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodString]>;
31
31
  type IdentifierInput = z.output<typeof IdentifierInput>;
32
+ /** Preserve a project's generated custom-field shape while checking the runtime value is an object. */
33
+ declare const customFieldsSchema: <TCustom extends object>() => z.ZodCustom<TCustom, TCustom>;
32
34
  declare const PreviewTokenPayload: z.ZodObject<{
33
35
  id: z.ZodNumber;
34
36
  parent: z.ZodNumber;
@@ -45,4 +47,4 @@ declare const PreviewTokenData: z.ZodObject<{
45
47
  }, z.core.$strip>;
46
48
  type PreviewTokenData = z.infer<typeof PreviewTokenData>;
47
49
  //#endregion
48
- export { CurrencyFormat, IdentifierInput, LIST_ORDER, ListMetadata, ListOrder, PreviewTokenData, PreviewTokenPayload };
50
+ export { CurrencyFormat, IdentifierInput, LIST_ORDER, ListMetadata, ListOrder, PreviewTokenData, PreviewTokenPayload, customFieldsSchema };
@@ -23,6 +23,8 @@ const CurrencyFormat = z.object({
23
23
  currencyThousandSeparator: z.string()
24
24
  });
25
25
  const IdentifierInput = z.union([NumberLike, z.string()]);
26
+ /** Preserve a project's generated custom-field shape while checking the runtime value is an object. */
27
+ const customFieldsSchema = () => z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value), "Expected custom fields to be an object");
26
28
  const PreviewTokenPayload = z.object({
27
29
  id: z.number(),
28
30
  parent: z.number(),
@@ -34,4 +36,4 @@ const PreviewTokenData = z.object({
34
36
  });
35
37
 
36
38
  //#endregion
37
- export { CurrencyFormat, IdentifierInput, LIST_ORDER, ListMetadata, ListOrder, PreviewTokenData, PreviewTokenPayload };
39
+ export { CurrencyFormat, IdentifierInput, LIST_ORDER, ListMetadata, ListOrder, PreviewTokenData, PreviewTokenPayload, customFieldsSchema };
@@ -1,4 +1,4 @@
1
- import { IdentifierInput, ListMetadata, ListOrder } from "../shared/schema.js";
1
+ import { IdentifierInput, ListMetadata, ListOrder, customFieldsSchema } from "../shared/schema.js";
2
2
  import { Seo } from "../seo/schema.js";
3
3
  import { BooleanLike, Metadata, NumberLike, arrayable, lenient } from "@kizlo/shared";
4
4
  import z from "zod/v4";
@@ -22,6 +22,7 @@ const Tag = z.object({
22
22
  description: z.string().nullable(),
23
23
  postCount: z.number(),
24
24
  seo: Seo.nullable(),
25
+ custom: customFieldsSchema(),
25
26
  meta: Metadata
26
27
  });
27
28
  const RetrieveTagInput = z.object({ identifier: IdentifierInput });
package/dist/tag/utils.js CHANGED
@@ -11,6 +11,7 @@ function deserializeTag(data) {
11
11
  description: data.description.length > 0 ? data.description : null,
12
12
  postCount: data.count,
13
13
  seo: "seo" in data.kizlo ? deserializeSeo(data.kizlo.seo) : null,
14
+ custom: data.kizlo.custom,
14
15
  meta: stringifiedMetaRecord(data.meta)
15
16
  };
16
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kizlo",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "type": "module",
5
5
  "description": "A headless WordPress framework for TypeScript.",
6
6
  "keywords": [
@@ -106,7 +106,7 @@
106
106
  },
107
107
  "dependencies": {
108
108
  "@clack/prompts": "^1.5.1",
109
- "@kizlo/shared": "0.8.0",
109
+ "@kizlo/shared": "0.9.0",
110
110
  "@orpc/client": "^1.14.3",
111
111
  "@orpc/contract": "^1.14.3",
112
112
  "@orpc/openapi": "^1.14.3",