kizlo 0.25.1 → 0.26.1

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/client.js CHANGED
@@ -2,7 +2,7 @@ import { RPC_PROTOCOL_HEADER } from "./shared/constants.js";
2
2
  import { isContractProcedure as isContractProcedure$1, restoreContract } from "./shared/contract.js";
3
3
  import { createResultClient } from "./shared/result.js";
4
4
  import { getObjectProperty } from "./shared/utils.js";
5
- import { DynamicLink, createORPCClient } from "@orpc/client";
5
+ import { DynamicLink, createORPCClient, createORPCErrorFromJson, isORPCErrorJson } from "@orpc/client";
6
6
  import { RPCLink } from "@orpc/client/fetch";
7
7
  import { inferRPCMethodFromContractRouter } from "@orpc/contract";
8
8
  import { OpenAPILink } from "@orpc/openapi-client/fetch";
@@ -17,7 +17,15 @@ var KizloClient = class {
17
17
  const orpcContract = restoreContract(config.contract);
18
18
  const openapiLink = new OpenAPILink(orpcContract, {
19
19
  url,
20
- fetch: config.fetch
20
+ fetch: config.fetch,
21
+ customErrorResponseBodyDecoder(body, response) {
22
+ if (body === null || typeof body !== "object" || Array.isArray(body)) return void 0;
23
+ const error = {
24
+ defined: false,
25
+ ...body
26
+ };
27
+ return isORPCErrorJson(error) && error.status === response.status ? createORPCErrorFromJson(error) : void 0;
28
+ }
21
29
  });
22
30
  const remoteLink = new RPCLink({
23
31
  url,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WP_Error } from "./wordpress/error.js";
2
- import { ActiveWordPressClient, WP_CallOptions, WP_Client, WP_CommonErrorCode, WP_CurrencyFormat, WP_CustomFields, WP_CustomFieldsPath, WP_Endpoint, WP_EndpointData, WP_EndpointDefinition, WP_EndpointError, WP_EndpointInput, WP_EndpointPath, WP_EndpointResult, WP_ErrorData, WP_Failure, WP_List, WP_ListMetadata, WP_RequestBuild, WP_RequestContentType, WP_RequestInput, WP_RequestMethod, WP_RequestParts, WP_ResponseContentType, WP_Result, WP_Success, WP_TransportFailure, WP_TypedHeaders, WordPressClientRegistry, WordPressCredentials, WordPressCustomFieldsRegistry, WordPressEndpointRegistry } from "./wordpress/types.js";
2
+ import { ActiveWordPressClient, WP_CallOptions, WP_Client, WP_CommonErrorCode, WP_CurrencyFormat, WP_CustomFields, WP_CustomFieldsPath, WP_Endpoint, WP_EndpointData, WP_EndpointDefinition, WP_EndpointError, WP_EndpointInput, WP_EndpointPath, WP_EndpointResult, WP_ErrorData, WP_Failure, WP_List, WP_ListMetadata, WP_RequestBuild, WP_RequestContentType, WP_RequestInput, WP_RequestMethod, WP_RequestParts, WP_ResponseContentType, WP_Result, WP_Schema, WP_Success, WP_TransportFailure, WP_TypedHeaders, WordPressClientRegistry, WordPressCredentials, WordPressCustomFieldsRegistry, WordPressEndpointRegistry, WordPressSchemaRegistry } from "./wordpress/types.js";
3
3
  import { WordPressTransport, WordPressTransportOptions, WordPressTransportResult } from "./wordpress/transport.js";
4
4
  import { buildWordPressRequest, createWordPressClient, wpEndpoint } from "./wordpress/endpoint.js";
5
5
  import { isWordPressResourceError } from "./wordpress/utils.js";
@@ -43,4 +43,4 @@ import { ShaAlgorithm, compare, hash, hmac } from "./shared/crypto.js";
43
43
  import { Identifier, parseIdentifier } from "./shared/identifier.js";
44
44
  import { createOrpcRouter } from "./shared/router.js";
45
45
  import { deserializeCurrencyFormat, deserializeListMetadata, emptyList, serializeCurrencyFormat } from "./shared/serialize.js";
46
- export { ActiveKizloClient, ActiveWordPressClient, AnyContext, AnyEventSchema, AnyEvents, AnyIntegration, AnyKizloConfig, AnyMiddleware, AnyNestedClient, AnyProcedure, AnyProcedureTree, AuthAdapter, AuthGetSession, AuthUser, AuthorsSettings, AuthorsSettingsInput, BaseHandlerOptions, BrandSettings, BrandSettingsInput, COMMON_ERRORS, CONTENT_TYPES, CORE_PROCEDURES, CaptchaAdapter, type Category, type CategoryCustomFields, CategoryCustomFieldsSchema, 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, InferClientData, InferClientError, InferClientInput, InferClientResult, InferEventUnion, InferIntegrationProcedures, InferMiddlewares, InferProcedureData, InferProcedureError, InferProcedureInput, InferProcedureResult, Integration, IntegrationRequirements, InvocationScope, JsonValue, Kizlo, KizloBrowserClient, KizloClient, KizloClientConfig, KizloConfig, KizloEnv, KizloError, KizloErrorOptions, KizloErrorUnion, KizloProcedureRegistry, KizloResult, LIST_ORDER, List, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, LocalPlugin, LogLevel, LogPayload, Logger, LoggerAdapter, ManifestIcon, MaybeCallerOptions, MaybeOptionalOptions, Middleware, MiddlewareHandler, MiddlewareNextFn, MiddlewareOptions, MiddlewareResult, OpenapiPart, OrganizationFounder, OrganizationSettings, OrganizationSettingsInput, type Page, type PageCustomFields, PageCustomFieldsSchema, PersonSettings, PersonSettingsInput, PluginSource, type Post, type PostCustomFields, PostCustomFieldsSchema, PostStatusDefinition, PostTypeSettings, PostTypeSettingsInput, PreviewTokenData, PreviewTokenPayload, Procedure, ProcedureContext, ProcedureErrors, ProcedureHandler, ProcedureMethod, ProcedureOptions, ProcedureTreeDepthTuple, RedirectInput, RedirectStatus, ResolveParamsPart, ResolvedIcons, ResolvedSchemaInput, ResolvedSchemaOutput, ResultClient, Robots, RobotsRule, RootProcedures, S2SClient, SITEMAP_BASE, SITEMAP_INDEX_SLUG, SchemaIO, SeedContext, Seo, SeoHead, SeoSchema, ServiceAdapters, SessionFn, Settings, SettingsService, SettleContext, ShaAlgorithm, SiteSettings, SiteSettingsInput, Sitemap, SitemapIndex, SitemapIndexEntry, SitemapList, SitemapRouteExtra, SitemapUrl, SitemapUrlImage, SitemapUrlList, SocialProfile, type Tag, type TagCustomFields, TagCustomFieldsSchema, 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_CustomFields, WP_CustomFieldsPath, WP_Endpoint, WP_EndpointData, WP_EndpointDefinition, WP_EndpointError, WP_EndpointInput, WP_EndpointPath, WP_EndpointResult, WP_Error, WP_ErrorData, WP_Failure, WP_List, WP_ListMetadata, WP_RequestBuild, WP_RequestContentType, WP_RequestInput, WP_RequestMethod, WP_RequestParts, WP_ResponseContentType, WP_Result, WP_Success, WP_TransportFailure, WP_TypedHeaders, WebManifest, WebhookOptions, WebhookSettings, WebhookSettingsInput, WithCommonErrorMap, WordPressClientRegistry, WordPressCredentials, WordPressCustomFieldsRegistry, WordPressEndpointRegistry, 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, createResultClient, 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, sortIntegrations, toKizloError, turnstile, wordPressConnectionComplete, wpEndpoint, xmlResponse };
46
+ export { ActiveKizloClient, ActiveWordPressClient, AnyContext, AnyEventSchema, AnyEvents, AnyIntegration, AnyKizloConfig, AnyMiddleware, AnyNestedClient, AnyProcedure, AnyProcedureTree, AuthAdapter, AuthGetSession, AuthUser, AuthorsSettings, AuthorsSettingsInput, BaseHandlerOptions, BrandSettings, BrandSettingsInput, COMMON_ERRORS, CONTENT_TYPES, CORE_PROCEDURES, CaptchaAdapter, type Category, type CategoryCustomFields, CategoryCustomFieldsSchema, 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, InferClientData, InferClientError, InferClientInput, InferClientResult, InferEventUnion, InferIntegrationProcedures, InferMiddlewares, InferProcedureData, InferProcedureError, InferProcedureInput, InferProcedureResult, Integration, IntegrationRequirements, InvocationScope, JsonValue, Kizlo, KizloBrowserClient, KizloClient, KizloClientConfig, KizloConfig, KizloEnv, KizloError, KizloErrorOptions, KizloErrorUnion, KizloProcedureRegistry, KizloResult, LIST_ORDER, List, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, LocalPlugin, LogLevel, LogPayload, Logger, LoggerAdapter, ManifestIcon, MaybeCallerOptions, MaybeOptionalOptions, Middleware, MiddlewareHandler, MiddlewareNextFn, MiddlewareOptions, MiddlewareResult, OpenapiPart, OrganizationFounder, OrganizationSettings, OrganizationSettingsInput, type Page, type PageCustomFields, PageCustomFieldsSchema, PersonSettings, PersonSettingsInput, PluginSource, type Post, type PostCustomFields, PostCustomFieldsSchema, PostStatusDefinition, PostTypeSettings, PostTypeSettingsInput, PreviewTokenData, PreviewTokenPayload, Procedure, ProcedureContext, ProcedureErrors, ProcedureHandler, ProcedureMethod, ProcedureOptions, ProcedureTreeDepthTuple, RedirectInput, RedirectStatus, ResolveParamsPart, ResolvedIcons, ResolvedSchemaInput, ResolvedSchemaOutput, ResultClient, Robots, RobotsRule, RootProcedures, S2SClient, SITEMAP_BASE, SITEMAP_INDEX_SLUG, SchemaIO, SeedContext, Seo, SeoHead, SeoSchema, ServiceAdapters, SessionFn, Settings, SettingsService, SettleContext, ShaAlgorithm, SiteSettings, SiteSettingsInput, Sitemap, SitemapIndex, SitemapIndexEntry, SitemapList, SitemapRouteExtra, SitemapUrl, SitemapUrlImage, SitemapUrlList, SocialProfile, type Tag, type TagCustomFields, TagCustomFieldsSchema, 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_CustomFields, WP_CustomFieldsPath, WP_Endpoint, WP_EndpointData, WP_EndpointDefinition, WP_EndpointError, WP_EndpointInput, WP_EndpointPath, WP_EndpointResult, WP_Error, WP_ErrorData, WP_Failure, WP_List, WP_ListMetadata, WP_RequestBuild, WP_RequestContentType, WP_RequestInput, WP_RequestMethod, WP_RequestParts, WP_ResponseContentType, WP_Result, WP_Schema, WP_Success, WP_TransportFailure, WP_TypedHeaders, WebManifest, WebhookOptions, WebhookSettings, WebhookSettingsInput, WithCommonErrorMap, WordPressClientRegistry, WordPressCredentials, WordPressCustomFieldsRegistry, WordPressEndpointRegistry, WordPressEnv, WordPressSchemaRegistry, 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, createResultClient, 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, sortIntegrations, toKizloError, turnstile, wordPressConnectionComplete, wpEndpoint, xmlResponse };
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.25.1";
2
+ var version = "0.26.1";
3
3
 
4
4
  //#endregion
5
5
  export { version };
@@ -26,13 +26,13 @@ declare const Post: z.ZodObject<{
26
26
  private: "private";
27
27
  }>;
28
28
  format: z.ZodEnum<{
29
- image: "image";
30
- link: "link";
31
29
  status: "status";
32
30
  standard: "standard";
33
31
  aside: "aside";
34
32
  chat: "chat";
35
33
  gallery: "gallery";
34
+ link: "link";
35
+ image: "image";
36
36
  quote: "quote";
37
37
  video: "video";
38
38
  audio: "audio";
@@ -150,13 +150,13 @@ declare const PostList: z.ZodObject<{
150
150
  private: "private";
151
151
  }>;
152
152
  format: z.ZodEnum<{
153
- image: "image";
154
- link: "link";
155
153
  status: "status";
156
154
  standard: "standard";
157
155
  aside: "aside";
158
156
  chat: "chat";
159
157
  gallery: "gallery";
158
+ link: "link";
159
+ image: "image";
160
160
  quote: "quote";
161
161
  video: "video";
162
162
  audio: "audio";
@@ -44,7 +44,7 @@ declare const CORE_PROCEDURES: {
44
44
  include?: string | number | (string | number)[] | undefined;
45
45
  offset?: string | number | undefined;
46
46
  order?: "asc" | "desc" | undefined;
47
- orderby?: "id" | "slug" | "parent" | "title" | "author" | "date" | "include" | "include_slugs" | "modified" | "relevance" | undefined;
47
+ orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "modified" | "relevance" | "include_slugs" | undefined;
48
48
  searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
49
49
  slug?: string | string[] | undefined;
50
50
  taxRelation?: "AND" | "OR" | undefined;
@@ -99,7 +99,7 @@ declare const CORE_PROCEDURES: {
99
99
  include?: string | number | (string | number)[] | undefined;
100
100
  offset?: string | number | undefined;
101
101
  order?: "asc" | "desc" | undefined;
102
- orderby?: "id" | "slug" | "parent" | "title" | "author" | "date" | "include" | "include_slugs" | "modified" | "relevance" | "menu_order" | undefined;
102
+ orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "modified" | "relevance" | "include_slugs" | "menu_order" | undefined;
103
103
  searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
104
104
  slug?: string | string[] | undefined;
105
105
  parent?: string | number | (string | number)[] | undefined;
@@ -136,7 +136,7 @@ declare const CORE_PROCEDURES: {
136
136
  exclude?: string | number | (string | number)[] | undefined;
137
137
  include?: string | number | (string | number)[] | undefined;
138
138
  order?: "asc" | "desc" | undefined;
139
- orderBy?: "id" | "name" | "slug" | "description" | "include" | "include_slugs" | "term_group" | "count" | undefined;
139
+ orderBy?: "count" | "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | undefined;
140
140
  hideEmpty?: string | boolean | undefined;
141
141
  parent?: string | number | undefined;
142
142
  post?: string | number | undefined;
@@ -172,7 +172,7 @@ declare const CORE_PROCEDURES: {
172
172
  exclude?: string | number | (string | number)[] | undefined;
173
173
  include?: string | number | (string | number)[] | undefined;
174
174
  order?: "asc" | "desc" | undefined;
175
- orderBy?: "id" | "name" | "slug" | "description" | "include" | "include_slugs" | "term_group" | "count" | undefined;
175
+ orderBy?: "count" | "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | undefined;
176
176
  hideEmpty?: string | boolean | undefined;
177
177
  post?: string | number | undefined;
178
178
  slug?: string | string[] | undefined;
@@ -241,7 +241,7 @@ declare const CORE_PROCEDURES: {
241
241
  sitemaps: {
242
242
  list: Procedure<"internal", {}, {
243
243
  key: string;
244
- type: "author" | "post_type" | "taxonomy";
244
+ type: "post_type" | "taxonomy" | "author";
245
245
  pages: number;
246
246
  lastmod: string;
247
247
  }[], DefinedErrorMapLike>;
@@ -249,7 +249,7 @@ declare const CORE_PROCEDURES: {
249
249
  origin: string;
250
250
  sitemaps: {
251
251
  key: string;
252
- type: "author" | "post_type" | "taxonomy";
252
+ type: "post_type" | "taxonomy" | "author";
253
253
  pages: number;
254
254
  lastmod: string;
255
255
  }[];
@@ -292,7 +292,7 @@ declare const CORE_PROCEDURES: {
292
292
  include?: string | number | (string | number)[] | undefined;
293
293
  offset?: string | number | undefined;
294
294
  order?: "asc" | "desc" | undefined;
295
- orderby?: "id" | "slug" | "parent" | "title" | "author" | "date" | "include" | "include_slugs" | "relevance" | "menu_order" | undefined;
295
+ orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "relevance" | "include_slugs" | "menu_order" | undefined;
296
296
  searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
297
297
  slug?: string | string[] | undefined;
298
298
  taxRelation?: "AND" | "OR" | undefined;
@@ -371,7 +371,7 @@ declare const CORE_PROCEDURES: {
371
371
  include?: string | number | (string | number)[] | undefined;
372
372
  offset?: string | number | undefined;
373
373
  order?: "asc" | "desc" | undefined;
374
- orderby?: "id" | "slug" | "parent" | "title" | "author" | "date" | "include" | "include_slugs" | "relevance" | "menu_order" | undefined;
374
+ orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "relevance" | "include_slugs" | "menu_order" | undefined;
375
375
  searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
376
376
  slug?: string | string[] | undefined;
377
377
  taxRelation?: "AND" | "OR" | undefined;
@@ -507,7 +507,7 @@ declare const CORE_PROCEDURES: {
507
507
  include?: string | number | (string | number)[] | undefined;
508
508
  offset?: string | number | undefined;
509
509
  order?: "asc" | "desc" | undefined;
510
- orderby?: "id" | "parent" | "date" | "include" | "post" | undefined;
510
+ orderby?: "date" | "id" | "parent" | "include" | "post" | undefined;
511
511
  parent?: string | number | (string | number)[] | undefined;
512
512
  parentExclude?: string | number | (string | number)[] | undefined;
513
513
  post?: string | number | (string | number)[] | undefined;
@@ -635,8 +635,8 @@ declare const CORE_PROCEDURES: {
635
635
  get: Procedure<"internal", {}, _kizlo_shared11.Settings, DefinedErrorMapLike>;
636
636
  site: {
637
637
  update: Procedure<"internal", {
638
- name?: string | null | undefined;
639
638
  url?: string | null | undefined;
639
+ name?: string | null | undefined;
640
640
  backend_url?: string | null | undefined;
641
641
  secret?: string | null | undefined;
642
642
  alternate_name?: string | null | 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";
112
111
  post_type: "post_type";
113
112
  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";
120
119
  post_type: "post_type";
121
120
  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";
131
130
  post_type: "post_type";
132
131
  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";
144
143
  post_type: "post_type";
145
144
  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";
178
177
  post_type: "post_type";
179
178
  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>;
@@ -69,6 +69,25 @@ function inheritedPropertyTypes(schema, context, indent = "", seen = /* @__PURE_
69
69
  * what `additionalProperties: true` already renders to, and it is the same statement.
70
70
  */
71
71
  const UNDESCRIBED_OBJECT = "Record<string, unknown>";
72
+ /** Empty closed parents contribute no members; their never index must not constrain a child's fields. */
73
+ function isEmptyClosedSchema(schema, context, seen = /* @__PURE__ */ new Set()) {
74
+ if (!schema || schema.anyOf || schema.oneOf) return false;
75
+ if (schema.$ref) {
76
+ if (seen.has(schema.$ref)) return false;
77
+ seen.add(schema.$ref);
78
+ return isEmptyClosedSchema(context.schemas.get(schema.$ref), context, seen);
79
+ }
80
+ if (schema.type !== "object" || schema.additionalProperties !== false || Object.keys(schema.properties ?? {}).length || Object.keys(schema.patternProperties ?? {}).length) return false;
81
+ return (schema.$extends ? Array.isArray(schema.$extends) ? schema.$extends : [schema.$extends] : []).every((id) => {
82
+ if (seen.has(id)) return false;
83
+ const ancestors = new Set(seen);
84
+ ancestors.add(id);
85
+ return isEmptyClosedSchema(context.schemas.get(id), context, ancestors);
86
+ });
87
+ }
88
+ function schemaParents(schema, context) {
89
+ return (schema.$extends ? Array.isArray(schema.$extends) ? schema.$extends : [schema.$extends] : []).filter((id) => !isEmptyClosedSchema(context.schemas.get(id), context, new Set([id])));
90
+ }
72
91
  function renderObject(schema, context, indent = "") {
73
92
  const members = [];
74
93
  const propertyTypes = [];
@@ -89,7 +108,7 @@ function renderObject(schema, context, indent = "") {
89
108
  if (hasOptionalProperty || inherited.hasOptional) patterns.push("undefined");
90
109
  members.push(`${indent}\t[key: string]: ${[...new Set(patterns)].join(" | ")}`);
91
110
  }
92
- if (!members.length) return UNDESCRIBED_OBJECT;
111
+ if (!members.length) return schema.additionalProperties === false && !schemaParents(schema, context).length ? "Record<string, never>" : UNDESCRIBED_OBJECT;
93
112
  return `{\n${members.join("\n")}\n${indent}}`;
94
113
  }
95
114
  function renderType(schema, context, indent = "") {
@@ -114,11 +133,12 @@ function renderType(schema, context, indent = "") {
114
133
  type = renderObject(schema, context, indent);
115
134
  break;
116
135
  }
117
- const parents = schema.$extends ? Array.isArray(schema.$extends) ? schema.$extends : [schema.$extends] : [];
136
+ const parents = schemaParents(schema, context);
118
137
  if (parents.length) {
119
138
  const inherited = parents.map((id) => context.names.get(id) ?? schemaName(id));
120
139
  const own = schema.type === "object" ? renderObject(schema, context, indent) : type;
121
- type = [...inherited, ...own === UNDESCRIBED_OBJECT ? [] : [own]].join(" & ");
140
+ const ownTypes = own === UNDESCRIBED_OBJECT ? parents.every((id) => rendersAsInterface(context.schemas.get(id), context)) ? [] : ["{}"] : [own];
141
+ type = [...inherited, ...ownTypes].join(" & ");
122
142
  }
123
143
  return withNullable(type || "unknown", schema);
124
144
  }
@@ -127,12 +147,12 @@ function renderType(schema, context, indent = "") {
127
147
  * question of whether a child can name it in an `extends` clause. TypeScript extends an object
128
148
  * type with statically known members and nothing else.
129
149
  */
130
- function rendersAsInterface(schema) {
131
- return schema !== void 0 && schema.type === "object" && !schema.nullable && !schema.anyOf && !schema.oneOf && !schema.$ref;
150
+ function rendersAsInterface(schema, context) {
151
+ return schema !== void 0 && schema.type === "object" && !schema.nullable && !schema.anyOf && !schema.oneOf && !schema.$ref && !isEmptyClosedSchema(schema, context);
132
152
  }
133
153
  function renderNamedSchema(id, schema, context) {
134
154
  const name = context.names.get(id) ?? schemaName(id);
135
- const parents = schema.$extends ? Array.isArray(schema.$extends) ? schema.$extends : [schema.$extends] : [];
155
+ const parents = schemaParents(schema, context);
136
156
  const documentation = jsdoc(schema.description, schema.deprecated);
137
157
  if (schema.type === "object" && !schema.anyOf && !schema.oneOf && !schema.$ref) {
138
158
  if (schema.nullable) return `${documentation}export type ${name} = (${renderType({
@@ -144,8 +164,9 @@ function renderNamedSchema(id, schema, context) {
144
164
  ...schema,
145
165
  nullable: void 0
146
166
  }, context);
147
- if (inherited.length && !parents.every((parent) => rendersAsInterface(context.schemas.get(parent)))) {
148
- const own = body === UNDESCRIBED_OBJECT ? [] : [body];
167
+ if (body === "Record<string, never>" && !inherited.length) return `${documentation}export type ${name} = ${body}`;
168
+ if (inherited.length && !parents.every((parent) => rendersAsInterface(context.schemas.get(parent), context))) {
169
+ const own = [body === UNDESCRIBED_OBJECT ? "{}" : body];
149
170
  return `${documentation}export type ${name} = ${[...inherited, ...own].join(" & ")}`;
150
171
  }
151
172
  return `${documentation}export interface ${name}${inherited.length ? ` extends ${inherited.join(", ")}` : ""}${body === UNDESCRIBED_OBJECT ? " {}" : ` ${body}`}`;
@@ -436,6 +457,9 @@ function renderRegistries(tree, document) {
436
457
  `\tinterface WordPressEndpointRegistry {`,
437
458
  ...endpoints,
438
459
  `\t}`,
460
+ `\tinterface WordPressSchemaRegistry {`,
461
+ ...sortedEntries(document.schemas).map(([id]) => `\t\t${JSON.stringify(id)}: ${schemaName(id)}`),
462
+ `\t}`,
439
463
  `\tinterface WordPressCustomFieldsRegistry {`,
440
464
  ...customFields,
441
465
  `\t}`,
@@ -1,5 +1,5 @@
1
1
  import { WP_Error } from "./error.js";
2
- import { ActiveWordPressClient, WP_CallOptions, WP_Client, WP_CommonErrorCode, WP_CurrencyFormat, WP_CustomFields, WP_CustomFieldsPath, WP_Endpoint, WP_EndpointData, WP_EndpointDefinition, WP_EndpointError, WP_EndpointInput, WP_EndpointPath, WP_EndpointResult, WP_ErrorData, WP_Failure, WP_List, WP_ListMetadata, WP_RequestBuild, WP_RequestContentType, WP_RequestInput, WP_RequestMethod, WP_RequestParts, WP_ResponseContentType, WP_Result, WP_Success, WP_TransportFailure, WP_TypedHeaders, WordPressClientRegistry, WordPressCredentials, WordPressCustomFieldsRegistry, WordPressEndpointRegistry } from "./types.js";
2
+ import { ActiveWordPressClient, WP_CallOptions, WP_Client, WP_CommonErrorCode, WP_CurrencyFormat, WP_CustomFields, WP_CustomFieldsPath, WP_Endpoint, WP_EndpointData, WP_EndpointDefinition, WP_EndpointError, WP_EndpointInput, WP_EndpointPath, WP_EndpointResult, WP_ErrorData, WP_Failure, WP_List, WP_ListMetadata, WP_RequestBuild, WP_RequestContentType, WP_RequestInput, WP_RequestMethod, WP_RequestParts, WP_ResponseContentType, WP_Result, WP_Schema, WP_Success, WP_TransportFailure, WP_TypedHeaders, WordPressClientRegistry, WordPressCredentials, WordPressCustomFieldsRegistry, WordPressEndpointRegistry, WordPressSchemaRegistry } from "./types.js";
3
3
  import { WordPressTransport, WordPressTransportOptions, WordPressTransportResult } from "./transport.js";
4
4
  import { buildWordPressRequest, createWordPressClient, wpEndpoint } from "./endpoint.js";
5
5
  import { isWordPressResourceError } from "./utils.js";
@@ -46,6 +46,10 @@ interface WordPressClientRegistry {}
46
46
  interface WordPressEndpointRegistry {}
47
47
  /** Generated WordPress modules augment this registry from managed-content item schemas. */
48
48
  interface WordPressCustomFieldsRegistry {}
49
+ /** Generated modules register every named schema, independently of endpoints and managed content. */
50
+ interface WordPressSchemaRegistry {}
51
+ /** Resolve a consumer's named schema, retaining an explicit fallback for older plugin contracts. */
52
+ type WP_Schema<TName$1 extends string, TFallback = unknown> = TName$1 extends keyof WordPressSchemaRegistry ? WordPressSchemaRegistry[TName$1] : TFallback;
49
53
  /**
50
54
  * The WordPress client this project compiles against: its generated endpoints bound to the
51
55
  * transport, or the bare transport. The stub written before the first generation registers `any`,
@@ -223,4 +227,4 @@ type WP_Failure<TError$1 extends string, TStatus extends number = number, THeade
223
227
  type WP_TransportFailure<TError$1 extends string, THeaderName extends string = string> = WP_Failure<TError$1, 0, Record<string, never>, THeaderName>;
224
228
  type WP_Result<TData$1, TError$1 extends string> = WP_Success<TData$1> | WP_Failure<TError$1>;
225
229
  //#endregion
226
- export { ActiveWordPressClient, WP_CallOptions, WP_Client, WP_CommonErrorCode, WP_CurrencyFormat, WP_CustomFields, WP_CustomFieldsPath, WP_Endpoint, WP_EndpointData, WP_EndpointDefinition, WP_EndpointError, WP_EndpointInput, WP_EndpointPath, WP_EndpointResult, WP_ErrorData, WP_Failure, WP_List, WP_ListMetadata, WP_RequestBuild, WP_RequestContentType, WP_RequestInput, WP_RequestMethod, WP_RequestParts, WP_ResponseContentType, WP_Result, WP_Success, WP_TransportFailure, WP_TypedHeaders, WordPressClientRegistry, WordPressCredentials, WordPressCustomFieldsRegistry, WordPressEndpointRegistry };
230
+ export { ActiveWordPressClient, WP_CallOptions, WP_Client, WP_CommonErrorCode, WP_CurrencyFormat, WP_CustomFields, WP_CustomFieldsPath, WP_Endpoint, WP_EndpointData, WP_EndpointDefinition, WP_EndpointError, WP_EndpointInput, WP_EndpointPath, WP_EndpointResult, WP_ErrorData, WP_Failure, WP_List, WP_ListMetadata, WP_RequestBuild, WP_RequestContentType, WP_RequestInput, WP_RequestMethod, WP_RequestParts, WP_ResponseContentType, WP_Result, WP_Schema, WP_Success, WP_TransportFailure, WP_TypedHeaders, WordPressClientRegistry, WordPressCredentials, WordPressCustomFieldsRegistry, WordPressEndpointRegistry, WordPressSchemaRegistry };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kizlo",
3
- "version": "0.25.1",
3
+ "version": "0.26.1",
4
4
  "type": "module",
5
5
  "description": "A headless WordPress framework for TypeScript.",
6
6
  "keywords": [