kizlo 0.4.0 → 0.6.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.
@@ -0,0 +1,42 @@
1
+ import { BrandSettings } from "../settings/service.interface.js";
2
+
3
+ //#region src/brand/icons.d.ts
4
+ interface IconDescriptor {
5
+ url: string;
6
+ /** The attachment's mime, e.g. `image/svg+xml`, mapped to the `type` attribute. */
7
+ type: string;
8
+ /** `"any"` for scalable/single sources; omitted for `.ico`. */
9
+ sizes?: string;
10
+ /** Media query for scheme-specific variants, e.g. `(prefers-color-scheme: dark)`. */
11
+ media?: string;
12
+ }
13
+ interface ManifestIcon {
14
+ src: string;
15
+ type: string;
16
+ sizes: string;
17
+ /**
18
+ * `"maskable"` marks art with a safe zone the launcher may crop to any
19
+ * adaptive shape; omitted (default `"any"`) sources render uncropped.
20
+ */
21
+ purpose?: "any" | "maskable";
22
+ }
23
+ interface ResolvedIcons {
24
+ /** `rel="icon"` candidates: the light source plus an optional dark variant. */
25
+ icon: IconDescriptor[];
26
+ /** `rel="apple-touch-icon"` candidate (raster-guarded), or empty. */
27
+ appleTouch: IconDescriptor[];
28
+ /**
29
+ * Web-manifest icon entries (raster or SVG): the square brand icon as the
30
+ * default `"any"` source — expanded to one entry per real square rendition —
31
+ * plus the dedicated Android icon as `"maskable"` when provided. Either may
32
+ * be absent.
33
+ */
34
+ manifestIcons: ManifestIcon[];
35
+ }
36
+ /**
37
+ * Resolve the brand settings into a normalized icon set. Slots that resolve to
38
+ * nothing are simply left out; the consumer only emits what is present.
39
+ */
40
+ declare function resolveIcons(brand: BrandSettings): ResolvedIcons;
41
+ //#endregion
42
+ export { IconDescriptor, ManifestIcon, ResolvedIcons, resolveIcons };
@@ -0,0 +1,108 @@
1
+ //#region src/brand/icons.ts
2
+ /** Raster mimes: the only sources iOS home-screen icons can render. */
3
+ const RASTER_MIMES = new Set(["image/png", "image/jpeg"]);
4
+ /** Scalable icon mime, valid in `rel=icon` and modern web manifests. */
5
+ const SVG_MIME = "image/svg+xml";
6
+ /** Mimes a web manifest can use: raster plus scalable SVG. `.ico` is excluded. */
7
+ const MANIFEST_MIMES = new Set([...RASTER_MIMES, SVG_MIME]);
8
+ /**
9
+ * Smallest square rendition worth advertising as a manifest icon. 192px is
10
+ * Chrome's minimum installable icon size, so smaller generated copies add no
11
+ * install value; a source below it still falls through to its original.
12
+ */
13
+ const MANIFEST_ICON_FLOOR = 192;
14
+ /** `.ico` self-describes its bundled sizes, so it takes no `sizes` hint. */
15
+ const ICO_MIMES = new Set(["image/x-icon", "image/vnd.microsoft.icon"]);
16
+ function isRaster(media) {
17
+ return media != null && media.mime !== void 0 && RASTER_MIMES.has(media.mime);
18
+ }
19
+ /** Return the media only when it is a raster the target can render; otherwise null. */
20
+ function raster(media) {
21
+ return isRaster(media) ? media : null;
22
+ }
23
+ /** Return the media only when a web manifest can render it (raster or SVG). */
24
+ function manifestSource(media) {
25
+ return media?.mime && MANIFEST_MIMES.has(media.mime) ? media : null;
26
+ }
27
+ /**
28
+ * A raster source carries real pixel dimensions; use them verbatim so a
29
+ * descriptor never claims a size the image cannot satisfy. Falls back to `"any"`
30
+ * on scalable sources (e.g. SVG) that have no fixed size.
31
+ */
32
+ function pixelSize(media) {
33
+ return media.width && media.height ? `${media.width}x${media.height}` : "any";
34
+ }
35
+ function toDescriptor(media, extra) {
36
+ return {
37
+ url: media.src,
38
+ type: media.mime ?? "",
39
+ sizes: media.mime && ICO_MIMES.has(media.mime) ? void 0 : pixelSize(media),
40
+ ...extra
41
+ };
42
+ }
43
+ /**
44
+ * Manifest icon entries for a source. A scalable SVG yields a single `"any"`
45
+ * entry (it covers every size). A raster source expands into its real renditions
46
+ * — the original plus WordPress's generated resizes — keeping only square ones at
47
+ * or above the floor so browsers get genuine 192/512-ish icons; if none qualify
48
+ * (e.g. a non-square upload) the original is used as-is.
49
+ */
50
+ function toManifestIcons(media, purpose) {
51
+ const type = media.mime ?? "";
52
+ const withPurpose = purpose ? { purpose } : {};
53
+ if (media.mime === SVG_MIME) return [{
54
+ src: media.src,
55
+ type,
56
+ sizes: "any",
57
+ ...withPurpose
58
+ }];
59
+ const square = [{
60
+ src: media.src,
61
+ width: media.width,
62
+ height: media.height
63
+ }, ...media.variants ?? []].filter((r) => r.width && r.height && r.width === r.height && r.width >= MANIFEST_ICON_FLOOR);
64
+ const chosen = square.length ? square : [{
65
+ src: media.src,
66
+ width: media.width,
67
+ height: media.height
68
+ }];
69
+ const seen = /* @__PURE__ */ new Set();
70
+ const icons = [];
71
+ for (const r of chosen) {
72
+ const sizes = r.width && r.height ? `${r.width}x${r.height}` : "any";
73
+ if (seen.has(sizes)) continue;
74
+ seen.add(sizes);
75
+ icons.push({
76
+ src: r.src,
77
+ type,
78
+ sizes,
79
+ ...withPurpose
80
+ });
81
+ }
82
+ return icons;
83
+ }
84
+ /**
85
+ * Resolve the brand settings into a normalized icon set. Slots that resolve to
86
+ * nothing are simply left out; the consumer only emits what is present.
87
+ */
88
+ function resolveIcons(brand) {
89
+ const icon = [];
90
+ const light = brand.favicon ?? brand.logo_icon;
91
+ if (light) icon.push(toDescriptor(light));
92
+ if (brand.favicon_dark) icon.push(toDescriptor(brand.favicon_dark, { media: "(prefers-color-scheme: dark)" }));
93
+ const apple = raster(brand.ios_app_icon) ?? raster(brand.favicon);
94
+ const appleTouch = apple ? [toDescriptor(apple)] : [];
95
+ const manifestIcons = [];
96
+ const anySource = manifestSource(brand.logo_icon) ?? manifestSource(brand.favicon);
97
+ if (anySource) manifestIcons.push(...toManifestIcons(anySource));
98
+ const maskable = manifestSource(brand.android_app_icon);
99
+ if (maskable) manifestIcons.push(...toManifestIcons(maskable, "maskable"));
100
+ return {
101
+ icon,
102
+ appleTouch,
103
+ manifestIcons
104
+ };
105
+ }
106
+
107
+ //#endregion
108
+ export { resolveIcons };
@@ -0,0 +1,2 @@
1
+ import { IconDescriptor, ManifestIcon, ResolvedIcons, resolveIcons } from "./icons.js";
2
+ import { WEB_MANIFEST_ROUTE, WebManifest, buildWebManifest, createManifestRoute } from "./manifest.js";
@@ -0,0 +1,21 @@
1
+ import { Settings } from "../settings/service.interface.js";
2
+ import { ManifestIcon } from "./icons.js";
3
+ import { S2SClient } from "../kizlo.js";
4
+
5
+ //#region src/brand/manifest.d.ts
6
+ declare const WEB_MANIFEST_ROUTE: "/site.webmanifest";
7
+ interface WebManifest {
8
+ id: string;
9
+ name: string;
10
+ short_name: string;
11
+ start_url: string;
12
+ scope: string;
13
+ display: "standalone" | "fullscreen" | "minimal-ui" | "browser";
14
+ background_color?: string;
15
+ theme_color?: string;
16
+ icons: ManifestIcon[];
17
+ }
18
+ declare function buildWebManifest(settings: Settings): WebManifest;
19
+ declare function createManifestRoute(client: S2SClient<[]>): (_request: Request) => Promise<Response>;
20
+ //#endregion
21
+ export { WEB_MANIFEST_ROUTE, WebManifest, buildWebManifest, createManifestRoute };
@@ -0,0 +1,28 @@
1
+ import { resolveIcons } from "./icons.js";
2
+
3
+ //#region src/brand/manifest.ts
4
+ const WEB_MANIFEST_ROUTE = "/site.webmanifest";
5
+ function buildWebManifest(settings) {
6
+ const org = settings.identity.type === "organization" ? settings.identity.organization : null;
7
+ const manifest = {
8
+ id: "/",
9
+ name: settings.site.name ?? org?.name ?? "",
10
+ short_name: settings.site.alternate_name ?? org?.name ?? settings.site.name ?? "",
11
+ start_url: "/",
12
+ scope: "/",
13
+ display: "standalone",
14
+ icons: resolveIcons(settings.brand).manifestIcons
15
+ };
16
+ if (settings.brand.theme_color) manifest.theme_color = settings.brand.theme_color;
17
+ if (settings.brand.background_color) manifest.background_color = settings.brand.background_color;
18
+ return manifest;
19
+ }
20
+ function createManifestRoute(client) {
21
+ return async function GET(_request) {
22
+ const settings = await client.settings.get.call();
23
+ return new Response(JSON.stringify(buildWebManifest(settings)), { headers: { "Content-Type": "application/manifest+json" } });
24
+ };
25
+ }
26
+
27
+ //#endregion
28
+ export { WEB_MANIFEST_ROUTE, buildWebManifest, createManifestRoute };
@@ -14,6 +14,7 @@ const nextjs = {
14
14
  const apiDir = `${ctx.appDir}/api/kizlo/[[...rest]]`;
15
15
  const robotsDir = `${ctx.appDir}/robots.txt`;
16
16
  const sitemapDir = `${ctx.appDir}/sitemaps/[sitemap]`;
17
+ const manifestDir = `${ctx.appDir}/site.webmanifest`;
17
18
  return [
18
19
  {
19
20
  label: "Kizlo server instance",
@@ -84,6 +85,24 @@ export const runtime = "edge"
84
85
  export const dynamic = "force-dynamic"
85
86
 
86
87
  export const GET = createSitemapRoute(client)
88
+ `
89
+ },
90
+ {
91
+ label: "web manifest route",
92
+ relPath: `${manifestDir}/route.ts`,
93
+ contents: `import { createManifestRoute } from "kizlo/nextjs/server"
94
+ import { client } from "${ctx.serverImport(manifestDir)}"
95
+
96
+ // Run on the edge: cheaper and faster than Node for a response this small.
97
+ export const runtime = "edge"
98
+
99
+ // Like robots.txt, Vercel bakes this route into an immutable Edge CDN asset at build time,
100
+ // bypassing ISR and on-demand revalidatePath. force-dynamic opts out of that static treatment
101
+ // so brand-settings edits show up; createManifestRoute caches the WordPress call, so requests
102
+ // stay cheap.
103
+ export const dynamic = "force-dynamic"
104
+
105
+ export const GET = createManifestRoute(client)
87
106
  `
88
107
  }
89
108
  ];
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ResultClient } from "./shared/result.js";
2
1
  import { AnyProcedureRouter, ExtractProcedureByScope } from "./shared/procedure.js";
2
+ import { ResultClient } from "./shared/result.js";
3
3
 
4
4
  //#region src/client.d.ts
5
5
  interface KizloClientConfig<T extends AnyProcedureRouter> {
package/dist/context.d.ts CHANGED
@@ -5,8 +5,8 @@ import { PreviewTokenPayload } from "./shared/schema.js";
5
5
  import { ConnInfo } from "./adapters/geo.js";
6
6
  import { Logger } from "./adapters/logger.js";
7
7
  import { CookiesStorage } from "./cookie.js";
8
- import { ServiceAdapters } from "./kizlo.js";
9
8
  import { Service } from "./service.js";
9
+ import { ServiceAdapters } from "./kizlo.js";
10
10
 
11
11
  //#region src/context.d.ts
12
12
  interface ContextConfig {
package/dist/index.d.ts CHANGED
@@ -20,22 +20,25 @@ import { CaptchaAdapter, altcha, arkose, createCaptchaAdapter, friendlyCaptcha,
20
20
  import { CONTENT_TYPES, ContentType, ListSitemapUrlInput, ListSitemapUrlInputBase, Robots, RobotsRule, Seo, SeoHead, SeoSchema, Sitemap, SitemapIndex, SitemapList, SitemapUrl, SitemapUrlImage, SitemapUrlList } from "./seo/schema.js";
21
21
  import { WPK_ListSitemapUrlInput, WPK_RobotRule, WPK_Robots, WPK_Seo, WPK_Sitemap, WPK_SitemapContentType, WPK_SitemapIndex, WPK_SitemapUrl, WPK_SitemapUrlImage } from "./seo/types.js";
22
22
  import { SitemapIndexEntry } from "./seo/utils.js";
23
- import { CurrencyFormat, IdentifierInput, LIST_ORDER, ListMetadata, ListOrder, Media as Media$1, PreviewTokenData, PreviewTokenPayload } from "./shared/schema.js";
23
+ import { CurrencyFormat, IdentifierInput, LIST_ORDER, ListMetadata, ListOrder, Media, PreviewTokenData, PreviewTokenPayload } from "./shared/schema.js";
24
24
  import { AnyContext, AnyNestedClient, CookiesAdapter, CookiesDeleteAll, CookiesGetAll, CookiesSetAll, HTTPMethod, List, MaybeOptionalOptions, RedirectInput, RedirectStatus } from "./shared/types.js";
25
25
  import { createCookiesAdapter } from "./adapters/cookies.js";
26
26
  import { ConnInfo, GeoAdapter, GeoGetConnInfo, createGeoAdapter, geoMock } from "./adapters/geo.js";
27
27
  import { geoVercelNext } from "./adapters/geo.vercel.js";
28
28
  import { ConsoleLogAdapterOptions, Environment, LogLevel, LogPayload, Logger, LoggerAdapter, consoleLog, createLoggerAdapter, noopAdapter } from "./adapters/logger.js";
29
- import { AnyEventSchema, AnyEvents, EventHandler, EventHandlerFn, InferEventUnion, WebhookOptions, createEventHandler, createWebhookRouter } from "./webhook/index.js";
30
- import { AnyExtension, Extension, ExtensionInitFn, ExtensionInitOptions, ExtensionInitResult, ExtractExtensionRouter, InferExtensionRouter, createExtension } from "./shared/extension.js";
31
- import { COMMON_ERRORS, CommonErrorCode, CommonErrorLiteral, CommonErrorMap, DefinedErrorMapLike, ErrorDefinition, KizloError, KizloErrorOptions, ThrowableErrorFn, ThrowableErrorMap, WithCommonErrorMap, createThrowableErrorMap, defineErrorMap, isKizloError, toKizloError } from "./shared/error.js";
32
- import { AnyKizloConfig, CreateKizloOptions, Kizlo, KizloConfig, KizloTarget, RootRouter, S2SClient, ServiceAdapters, createKizlo, resolveKizloConfig } from "./kizlo.js";
33
- import { AuthorsSettings, BrandSettings, CrawlingSettings, IdentitySettings, KizloAuthorsSettingsInput, KizloBrandSettingsInput, KizloCrawlingSettingsInput, KizloIdentitySettingsInput, KizloOrganizationSettingsInput, KizloPersonSettingsInput, KizloPostTypeSettingsInput, KizloSiteSettingsInput, KizloTaxonomySettingsInput, KizloWebhookSettingsInput, Media, OrganizationFounder, OrganizationSettings, PersonSettings, PostStatus, PostTypeSettings, Settings, SiteSettings, SocialProfile, TaxonomySettings, WebhookSettings } from "./settings/service.interface.js";
34
- import { KizloSettingsService } from "./settings/service.js";
29
+ import { AuthorsSettings, AuthorsSettingsInput, BrandSettings, BrandSettingsInput, CrawlingSettings, CrawlingSettingsInput, IdentitySettings, IdentitySettingsInput, OrganizationFounder, OrganizationSettings, OrganizationSettingsInput, PersonSettings, PersonSettingsInput, PostStatusDefinition, PostTypeSettings, PostTypeSettingsInput, Settings, SiteSettings, SiteSettingsInput, SocialProfile, TaxonomySettings, TaxonomySettingsInput, WebhookSettings, WebhookSettingsInput } from "./settings/service.interface.js";
30
+ import { IconDescriptor, ManifestIcon, ResolvedIcons, resolveIcons } from "./brand/icons.js";
31
+ import { SettingsService } from "./settings/service.js";
35
32
  import { Service, ServiceConfig } from "./service.js";
36
33
  import { AuthUserFn, ConnInfoFn, Context, ContextConfig, ServerContext, VerifyCaptchaFn, VerifyPreviewTokenFn } from "./context.js";
34
+ import { AnyEventSchema, AnyEvents, EventHandler, EventHandlerFn, InferEventUnion, WebhookOptions, createEventHandler, createWebhookRouter } from "./webhook/index.js";
35
+ import { COMMON_ERRORS, CommonErrorCode, CommonErrorLiteral, CommonErrorMap, DefinedErrorMapLike, ErrorDefinition, KizloError, KizloErrorOptions, ThrowableErrorFn, ThrowableErrorMap, WithCommonErrorMap, createThrowableErrorMap, defineErrorMap, isKizloError, toKizloError } from "./shared/error.js";
37
36
  import { AnyMiddleware, ExtractMiddlewareContextOutput, InferUses, Middleware, MiddlewareHandler, MiddlewareNextFn, MiddlewareOptions, MiddlewareResult, createMiddleware } from "./shared/middleware.js";
38
37
  import { AnyProcedure, AnyProcedureRouter, BaseHandlerOptions, ExtractParams, ExtractProcedureByScope, InvocationScope, OpenapiPart, Procedure, ProcedureContext, ProcedureErrors, ProcedureHandler, ProcedureOptions, ResolveParamsPart, ResolvedSchemaInput, ResolvedSchemaOutput, RouterDepthTuple, SchemaIO, buildProcedure, combineDetailed, createProcedure, handleUnexpectedError, schemaType } from "./shared/procedure.js";
38
+ import { AnyExtension, Extension, ExtensionInitFn, ExtensionInitOptions, ExtensionInitResult, ExtractExtensionRouter, InferExtensionRouter, createExtension } from "./shared/extension.js";
39
+ import { AnyKizloConfig, CreateKizloOptions, Kizlo, KizloConfig, KizloTarget, RootRouter, S2SClient, ServiceAdapters, createKizlo, resolveKizloConfig } from "./kizlo.js";
40
+ import { WEB_MANIFEST_ROUTE, WebManifest, buildWebManifest, createManifestRoute } from "./brand/manifest.js";
41
+ import "./brand/index.js";
39
42
  import { KizloClient, KizloClientConfig, createKizloClient } from "./client.js";
40
43
  import { CreateSitemapRouteOptions, SITEMAP_BASE, SITEMAP_INDEX_SLUG, SitemapRouteExtra, createSitemapRoute } from "./seo/sitemap.js";
41
44
  import { Contract, ContractProcedure, generateContract, isContractProcedure, restoreContract } from "./shared/contract.js";
@@ -43,4 +46,4 @@ import { ShaAlgorithm, compare, hash, hmac } from "./shared/crypto.js";
43
46
  import { Identifier, parseIdentifier } from "./shared/identifier.js";
44
47
  import { createOrpcRouter } from "./shared/router.js";
45
48
  import { deserializeCurrencyFormat, deserializeListMetadata, emptyList, serializeCurrencyFormat } from "./shared/serialize.js";
46
- export { AnyContext, AnyEventSchema, AnyEvents, AnyExtension, AnyKizloConfig, AnyMiddleware, AnyNestedClient, AnyProcedure, AnyProcedureRouter, AuthAdapter, AuthGetUser, AuthUser, AuthUserFn, BaseHandlerOptions, CART_HASH_HEADER_KEY, COMMON_ERRORS, CONTENT_TYPES, CaptchaAdapter, CommentService, CommonErrorCode, CommonErrorLiteral, CommonErrorMap, ConnInfo, ConnInfoFn, ConsoleLogAdapterOptions, ContentType, Context, ContextConfig, Contract, ContractProcedure, CookiesAdapter, CookiesDeleteAll, CookiesGetAll, CookiesSetAll, CreateKizloOptions, CreateSitemapRouteOptions, CurrencyFormat, DefinedErrorMapLike, DevPluginSource, Environment, ErrorDefinition, EventHandler, EventHandlerFn, Extension, ExtensionInitFn, ExtensionInitOptions, ExtensionInitResult, ExtractExtensionRouter, ExtractMiddlewareContextOutput, ExtractParams, ExtractProcedureByScope, Fixture, FixtureCleanupFn, FixtureSeedFn, GeoAdapter, GeoGetConnInfo, HTTPMethod, Identifier, IdentifierInput, InferEventUnion, InferExtensionRouter, InferUses, InvocationScope, JsonValue, Kizlo, AuthorsSettings as KizloAuthorsSettings, KizloAuthorsSettingsInput, BrandSettings as KizloBrandSettings, KizloBrandSettingsInput, KizloClient, KizloClientConfig, KizloConfig, CrawlingSettings as KizloCrawlingSettings, KizloCrawlingSettingsInput, KizloError, KizloErrorOptions, IdentitySettings as KizloIdentitySettings, KizloIdentitySettingsInput, Media as KizloMedia, OrganizationFounder as KizloOrganizationFounder, OrganizationSettings as KizloOrganizationSettings, KizloOrganizationSettingsInput, PersonSettings as KizloPersonSettings, KizloPersonSettingsInput, PostStatus as KizloPostStatus, PostTypeSettings as KizloPostTypeSettings, KizloPostTypeSettingsInput, Settings as KizloSettings, KizloSettingsService, SiteSettings as KizloSiteSettings, KizloSiteSettingsInput, SocialProfile as KizloSocialProfile, KizloTarget, TaxonomySettings as KizloTaxonomySettings, KizloTaxonomySettingsInput, WebhookSettings as KizloWebhookSettings, KizloWebhookSettingsInput, LIST_ORDER, List, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, LocalPlugin, LogLevel, LogPayload, Logger, LoggerAdapter, MaybeOptionalOptions, Media$1 as Media, MenuItemService, MenuService, Middleware, MiddlewareHandler, MiddlewareNextFn, MiddlewareOptions, MiddlewareResult, OpenapiPart, PluginSource, PostService, PreviewTokenData, PreviewTokenPayload, Procedure, ProcedureContext, ProcedureErrors, ProcedureHandler, ProcedureOptions, RedirectInput, RedirectStatus, ResolveParamsPart, ResolvedSchemaInput, ResolvedSchemaOutput, Robots, RobotsRule, RootRouter, RouterDepthTuple, S2SClient, SAFE_REQUEST_TIMEOUT, SITEMAP_BASE, SITEMAP_INDEX_SLUG, SchemaIO, SeedContext, Seo, SeoHead, SeoSchema, ServerContext, Service, ServiceAdapters, ServiceConfig, ShaAlgorithm, Sitemap, SitemapIndex, type SitemapIndexEntry, SitemapList, SitemapRouteExtra, SitemapUrl, SitemapUrlImage, SitemapUrlList, TestAdminUser, TestCredentials, TestUser, ThrowableErrorFn, ThrowableErrorMap, UNEXPECTED_BODY_SNIPPET_LENGTH, UserService, VerifyCaptchaFn, VerifyPreviewTokenFn, WC_CORE_BASE, WC_STORE_BASE, WPK_ListSitemapUrlInput, WPK_RobotRule, WPK_Robots, WPK_Seo, WPK_Sitemap, WPK_SitemapContentType, WPK_SitemapIndex, WPK_SitemapUrl, WPK_SitemapUrlImage, WP_AUTH_HEADER_KEY, WP_AUTH_TYPE, WP_CORE_BASE, WP_Comment, WP_CommentAvatarUrls, WP_CommentContent, WP_CommentContentInput, WP_CommentCreateErrorCode, WP_CommentCreateInput, WP_CommentDeleteErrorCode, WP_CommentDeleteInput, WP_CommentDeleteResponse, WP_CommentLinks, WP_CommentListErrorCode, WP_CommentListInput, WP_CommentOrderBy, WP_CommentRetrieveErrorCode, WP_CommentRetrieveInput, WP_CommentStatus, WP_CommentStatusFilter, WP_CommentStatusInput, WP_CommentType, WP_CommentUpdateErrorCode, WP_CommentUpdateInput, WP_CommonErrorCode, WP_Context, WP_CurrencyFormat, WP_Error, WP_ErrorData, WP_KIZLO_BASE, WP_Link, WP_List, WP_ListMetadata, WP_ListOrder, WP_Menu, WP_MenuCreateErrorCode, WP_MenuCreateInput, WP_MenuDeleteErrorCode, WP_MenuDeleteInput, WP_MenuDeleteResponse, WP_MenuItem, WP_MenuItemCreateErrorCode, WP_MenuItemCreateInput, WP_MenuItemDeleteErrorCode, WP_MenuItemDeleteInput, WP_MenuItemDeleteResponse, WP_MenuItemLinks, WP_MenuItemListErrorCode, WP_MenuItemListInput, WP_MenuItemOrderBy, WP_MenuItemRetrieveErrorCode, WP_MenuItemRetrieveInput, WP_MenuItemStatus, WP_MenuItemStatusFilter, WP_MenuItemTarget, WP_MenuItemTaxRelation, WP_MenuItemTitle, WP_MenuItemTitleInput, WP_MenuItemType, WP_MenuItemUpdateErrorCode, WP_MenuItemUpdateInput, WP_MenuLinks, WP_MenuListErrorCode, WP_MenuListInput, WP_MenuOrderBy, WP_MenuRetrieveErrorCode, WP_MenuRetrieveInput, WP_MenuUpdateErrorCode, WP_MenuUpdateInput, WP_Post, WP_PostCommentStatus, WP_PostContent, WP_PostContentInput, WP_PostCreateErrorCode, WP_PostCreateInput, WP_PostDeleteErrorCode, WP_PostDeleteInput, WP_PostDeleteResponse, WP_PostExcerpt, WP_PostExcerptInput, WP_PostFormat, WP_PostGuid, WP_PostLinks, WP_PostListErrorCode, WP_PostListInput, WP_PostOrderBy, WP_PostRetrieveErrorCode, WP_PostRetrieveInput, WP_PostStatus, WP_PostStatusFilter, WP_PostTaxRelation, WP_PostTitle, WP_PostTitleInput, WP_PostUpdateErrorCode, WP_PostUpdateInput, WP_RequestInput, WP_Result, WP_User, WP_UserAvatarUrls, WP_UserCapabilities, WP_UserCreateErrorCode, WP_UserCreateInput, WP_UserDeleteErrorCode, WP_UserDeleteInput, WP_UserDeleteMeErrorCode, WP_UserDeleteMeInput, WP_UserDeleteMeResponse, WP_UserDeleteResponse, WP_UserLinks, WP_UserListErrorCode, WP_UserListInput, WP_UserOrderBy, WP_UserRetrieveErrorCode, WP_UserRetrieveInput, WP_UserRetrieveMeErrorCode, WP_UserRetrieveMeInput, WP_UserUpdateErrorCode, WP_UserUpdateInput, WP_UserUpdateMeErrorCode, WP_UserUpdateMeInput, WP_UserWho, WebhookOptions, WithCommonErrorMap, WordPressCredentials, WordPressService, altcha, arkose, authMock, buildProcedure, combineDetailed, compare, consoleLog, createAuthAdapter, createCaptchaAdapter, createCookiesAdapter, createEventHandler, createExtension, createGeoAdapter, createKizlo, createKizloClient, createLoggerAdapter, createMiddleware, createOrpcRouter, createProcedure, createSitemapRoute, createThrowableErrorMap, createWebhookRouter, defineErrorMap, defineFixture, deserializeCurrencyFormat, deserializeListMetadata, emptyList, friendlyCaptcha, generateContract, geoMock, geoVercelNext, handleUnexpectedError, hash, hcaptcha, hmac, isContractProcedure, isKizloError, isLocalPlugin, isWordPressResourceError, noopAdapter, parseIdentifier, recaptcha, resolveKizloConfig, restoreContract, schemaType, serializeCurrencyFormat, toKizloError, turnstile };
49
+ export { AnyContext, AnyEventSchema, AnyEvents, AnyExtension, AnyKizloConfig, AnyMiddleware, AnyNestedClient, AnyProcedure, AnyProcedureRouter, AuthAdapter, AuthGetUser, AuthUser, AuthUserFn, AuthorsSettings, AuthorsSettingsInput, BaseHandlerOptions, BrandSettings, BrandSettingsInput, CART_HASH_HEADER_KEY, COMMON_ERRORS, CONTENT_TYPES, CaptchaAdapter, CommentService, CommonErrorCode, CommonErrorLiteral, CommonErrorMap, ConnInfo, ConnInfoFn, ConsoleLogAdapterOptions, ContentType, Context, ContextConfig, Contract, ContractProcedure, CookiesAdapter, CookiesDeleteAll, CookiesGetAll, CookiesSetAll, CrawlingSettings, CrawlingSettingsInput, CreateKizloOptions, CreateSitemapRouteOptions, CurrencyFormat, DefinedErrorMapLike, DevPluginSource, Environment, ErrorDefinition, EventHandler, EventHandlerFn, Extension, ExtensionInitFn, ExtensionInitOptions, ExtensionInitResult, ExtractExtensionRouter, ExtractMiddlewareContextOutput, ExtractParams, ExtractProcedureByScope, Fixture, FixtureCleanupFn, FixtureSeedFn, GeoAdapter, GeoGetConnInfo, HTTPMethod, IconDescriptor, Identifier, IdentifierInput, IdentitySettings, IdentitySettingsInput, InferEventUnion, InferExtensionRouter, InferUses, InvocationScope, JsonValue, Kizlo, KizloClient, KizloClientConfig, KizloConfig, KizloError, KizloErrorOptions, KizloTarget, LIST_ORDER, List, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, LocalPlugin, LogLevel, LogPayload, Logger, LoggerAdapter, ManifestIcon, MaybeOptionalOptions, Media, MenuItemService, MenuService, Middleware, MiddlewareHandler, MiddlewareNextFn, MiddlewareOptions, MiddlewareResult, OpenapiPart, OrganizationFounder, OrganizationSettings, OrganizationSettingsInput, PersonSettings, PersonSettingsInput, PluginSource, PostService, PostStatusDefinition, PostTypeSettings, PostTypeSettingsInput, PreviewTokenData, PreviewTokenPayload, Procedure, ProcedureContext, ProcedureErrors, ProcedureHandler, ProcedureOptions, RedirectInput, RedirectStatus, ResolveParamsPart, ResolvedIcons, ResolvedSchemaInput, ResolvedSchemaOutput, Robots, RobotsRule, RootRouter, RouterDepthTuple, S2SClient, SAFE_REQUEST_TIMEOUT, SITEMAP_BASE, SITEMAP_INDEX_SLUG, SchemaIO, SeedContext, Seo, SeoHead, SeoSchema, ServerContext, Service, ServiceAdapters, ServiceConfig, Settings, SettingsService, ShaAlgorithm, SiteSettings, SiteSettingsInput, Sitemap, SitemapIndex, type SitemapIndexEntry, SitemapList, SitemapRouteExtra, SitemapUrl, SitemapUrlImage, SitemapUrlList, SocialProfile, TaxonomySettings, TaxonomySettingsInput, TestAdminUser, TestCredentials, TestUser, ThrowableErrorFn, ThrowableErrorMap, UNEXPECTED_BODY_SNIPPET_LENGTH, UserService, VerifyCaptchaFn, VerifyPreviewTokenFn, WC_CORE_BASE, WC_STORE_BASE, WEB_MANIFEST_ROUTE, WPK_ListSitemapUrlInput, WPK_RobotRule, WPK_Robots, WPK_Seo, WPK_Sitemap, WPK_SitemapContentType, WPK_SitemapIndex, WPK_SitemapUrl, WPK_SitemapUrlImage, WP_AUTH_HEADER_KEY, WP_AUTH_TYPE, WP_CORE_BASE, WP_Comment, WP_CommentAvatarUrls, WP_CommentContent, WP_CommentContentInput, WP_CommentCreateErrorCode, WP_CommentCreateInput, WP_CommentDeleteErrorCode, WP_CommentDeleteInput, WP_CommentDeleteResponse, WP_CommentLinks, WP_CommentListErrorCode, WP_CommentListInput, WP_CommentOrderBy, WP_CommentRetrieveErrorCode, WP_CommentRetrieveInput, WP_CommentStatus, WP_CommentStatusFilter, WP_CommentStatusInput, WP_CommentType, WP_CommentUpdateErrorCode, WP_CommentUpdateInput, WP_CommonErrorCode, WP_Context, WP_CurrencyFormat, WP_Error, WP_ErrorData, WP_KIZLO_BASE, WP_Link, WP_List, WP_ListMetadata, WP_ListOrder, WP_Menu, WP_MenuCreateErrorCode, WP_MenuCreateInput, WP_MenuDeleteErrorCode, WP_MenuDeleteInput, WP_MenuDeleteResponse, WP_MenuItem, WP_MenuItemCreateErrorCode, WP_MenuItemCreateInput, WP_MenuItemDeleteErrorCode, WP_MenuItemDeleteInput, WP_MenuItemDeleteResponse, WP_MenuItemLinks, WP_MenuItemListErrorCode, WP_MenuItemListInput, WP_MenuItemOrderBy, WP_MenuItemRetrieveErrorCode, WP_MenuItemRetrieveInput, WP_MenuItemStatus, WP_MenuItemStatusFilter, WP_MenuItemTarget, WP_MenuItemTaxRelation, WP_MenuItemTitle, WP_MenuItemTitleInput, WP_MenuItemType, WP_MenuItemUpdateErrorCode, WP_MenuItemUpdateInput, WP_MenuLinks, WP_MenuListErrorCode, WP_MenuListInput, WP_MenuOrderBy, WP_MenuRetrieveErrorCode, WP_MenuRetrieveInput, WP_MenuUpdateErrorCode, WP_MenuUpdateInput, WP_Post, WP_PostCommentStatus, WP_PostContent, WP_PostContentInput, WP_PostCreateErrorCode, WP_PostCreateInput, WP_PostDeleteErrorCode, WP_PostDeleteInput, WP_PostDeleteResponse, WP_PostExcerpt, WP_PostExcerptInput, WP_PostFormat, WP_PostGuid, WP_PostLinks, WP_PostListErrorCode, WP_PostListInput, WP_PostOrderBy, WP_PostRetrieveErrorCode, WP_PostRetrieveInput, WP_PostStatus, WP_PostStatusFilter, WP_PostTaxRelation, WP_PostTitle, WP_PostTitleInput, WP_PostUpdateErrorCode, WP_PostUpdateInput, WP_RequestInput, WP_Result, WP_User, WP_UserAvatarUrls, WP_UserCapabilities, WP_UserCreateErrorCode, WP_UserCreateInput, WP_UserDeleteErrorCode, WP_UserDeleteInput, WP_UserDeleteMeErrorCode, WP_UserDeleteMeInput, WP_UserDeleteMeResponse, WP_UserDeleteResponse, WP_UserLinks, WP_UserListErrorCode, WP_UserListInput, WP_UserOrderBy, WP_UserRetrieveErrorCode, WP_UserRetrieveInput, WP_UserRetrieveMeErrorCode, WP_UserRetrieveMeInput, WP_UserUpdateErrorCode, WP_UserUpdateInput, WP_UserUpdateMeErrorCode, WP_UserUpdateMeInput, WP_UserWho, WebManifest, WebhookOptions, WebhookSettings, WebhookSettingsInput, WithCommonErrorMap, WordPressCredentials, WordPressService, altcha, arkose, authMock, buildProcedure, buildWebManifest, combineDetailed, compare, consoleLog, createAuthAdapter, createCaptchaAdapter, createCookiesAdapter, createEventHandler, createExtension, createGeoAdapter, createKizlo, createKizloClient, createLoggerAdapter, createManifestRoute, createMiddleware, createOrpcRouter, createProcedure, createSitemapRoute, createThrowableErrorMap, createWebhookRouter, defineErrorMap, defineFixture, deserializeCurrencyFormat, deserializeListMetadata, emptyList, friendlyCaptcha, generateContract, geoMock, geoVercelNext, handleUnexpectedError, hash, hcaptcha, hmac, isContractProcedure, isKizloError, isLocalPlugin, isWordPressResourceError, noopAdapter, parseIdentifier, recaptcha, resolveIcons, resolveKizloConfig, restoreContract, schemaType, serializeCurrencyFormat, toKizloError, turnstile };
package/dist/index.js CHANGED
@@ -5,6 +5,8 @@ import { createCookiesAdapter } from "./adapters/cookies.js";
5
5
  import { createGeoAdapter, geoMock } from "./adapters/geo.js";
6
6
  import { geoVercelNext } from "./adapters/geo.vercel.js";
7
7
  import { consoleLog, createLoggerAdapter, noopAdapter } from "./adapters/logger.js";
8
+ import { resolveIcons } from "./brand/icons.js";
9
+ import { WEB_MANIFEST_ROUTE, buildWebManifest, createManifestRoute } from "./brand/manifest.js";
8
10
  import { defineFixture, isLocalPlugin } from "./cli/wp/types.js";
9
11
  import { COMMON_ERRORS, KizloError, createThrowableErrorMap, defineErrorMap, isKizloError, toKizloError } from "./shared/error.js";
10
12
  import { buildProcedure, combineDetailed, createProcedure, handleUnexpectedError, schemaType } from "./shared/procedure.js";
@@ -21,7 +23,7 @@ import { PostService } from "./wordpress/post/service.js";
21
23
  import { UserService } from "./wordpress/user/service.js";
22
24
  import { isWordPressResourceError } from "./wordpress/utils.js";
23
25
  import { WordPressService } from "./wordpress/service.js";
24
- import { KizloSettingsService } from "./settings/service.js";
26
+ import { SettingsService } from "./settings/service.js";
25
27
  import { Service } from "./service.js";
26
28
  import { Context } from "./context.js";
27
29
  import { deserializeCurrencyFormat, deserializeListMetadata, emptyList, serializeCurrencyFormat } from "./shared/serialize.js";
@@ -33,4 +35,4 @@ import { SITEMAP_BASE, SITEMAP_INDEX_SLUG, createSitemapRoute } from "./seo/site
33
35
  import { createExtension } from "./shared/extension.js";
34
36
  import { createMiddleware } from "./shared/middleware.js";
35
37
 
36
- export { CART_HASH_HEADER_KEY, COMMON_ERRORS, CONTENT_TYPES, CommentService, ContentType, Context, CurrencyFormat, IdentifierInput, Kizlo, KizloClient, KizloError, KizloSettingsService, LIST_ORDER, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, Media, MenuItemService, MenuService, PostService, PreviewTokenData, PreviewTokenPayload, Robots, RobotsRule, SAFE_REQUEST_TIMEOUT, SITEMAP_BASE, SITEMAP_INDEX_SLUG, Seo, SeoHead, SeoSchema, Service, Sitemap, SitemapIndex, SitemapList, SitemapUrl, SitemapUrlImage, SitemapUrlList, UNEXPECTED_BODY_SNIPPET_LENGTH, UserService, WC_CORE_BASE, WC_STORE_BASE, WP_AUTH_HEADER_KEY, WP_AUTH_TYPE, WP_CORE_BASE, WP_Error, WP_KIZLO_BASE, WordPressService, altcha, arkose, authMock, buildProcedure, combineDetailed, compare, consoleLog, createAuthAdapter, createCaptchaAdapter, createCookiesAdapter, createEventHandler, createExtension, createGeoAdapter, createKizlo, createKizloClient, createLoggerAdapter, createMiddleware, createOrpcRouter, createProcedure, createSitemapRoute, createThrowableErrorMap, createWebhookRouter, defineErrorMap, defineFixture, deserializeCurrencyFormat, deserializeListMetadata, emptyList, friendlyCaptcha, generateContract, geoMock, geoVercelNext, handleUnexpectedError, hash, hcaptcha, hmac, isContractProcedure, isKizloError, isLocalPlugin, isWordPressResourceError, noopAdapter, parseIdentifier, recaptcha, resolveKizloConfig, restoreContract, schemaType, serializeCurrencyFormat, toKizloError, turnstile };
38
+ export { CART_HASH_HEADER_KEY, COMMON_ERRORS, CONTENT_TYPES, CommentService, ContentType, Context, CurrencyFormat, IdentifierInput, Kizlo, KizloClient, KizloError, LIST_ORDER, ListMetadata, ListOrder, ListSitemapUrlInput, ListSitemapUrlInputBase, Media, MenuItemService, MenuService, PostService, PreviewTokenData, PreviewTokenPayload, Robots, RobotsRule, SAFE_REQUEST_TIMEOUT, SITEMAP_BASE, SITEMAP_INDEX_SLUG, Seo, SeoHead, SeoSchema, Service, SettingsService, Sitemap, SitemapIndex, SitemapList, SitemapUrl, SitemapUrlImage, SitemapUrlList, UNEXPECTED_BODY_SNIPPET_LENGTH, UserService, WC_CORE_BASE, WC_STORE_BASE, WEB_MANIFEST_ROUTE, WP_AUTH_HEADER_KEY, WP_AUTH_TYPE, WP_CORE_BASE, WP_Error, WP_KIZLO_BASE, WordPressService, altcha, arkose, authMock, buildProcedure, buildWebManifest, combineDetailed, compare, consoleLog, createAuthAdapter, createCaptchaAdapter, createCookiesAdapter, createEventHandler, createExtension, createGeoAdapter, createKizlo, createKizloClient, createLoggerAdapter, createManifestRoute, createMiddleware, createOrpcRouter, createProcedure, createSitemapRoute, createThrowableErrorMap, createWebhookRouter, defineErrorMap, defineFixture, deserializeCurrencyFormat, deserializeListMetadata, emptyList, friendlyCaptcha, generateContract, geoMock, geoVercelNext, handleUnexpectedError, hash, hcaptcha, hmac, isContractProcedure, isKizloError, isLocalPlugin, isWordPressResourceError, noopAdapter, parseIdentifier, recaptcha, resolveIcons, resolveKizloConfig, restoreContract, schemaType, serializeCurrencyFormat, toKizloError, turnstile };
@@ -0,0 +1,8 @@
1
+ import { S2SClient } from "../../kizlo.js";
2
+ import { WEB_MANIFEST_ROUTE } from "../../brand/manifest.js";
3
+
4
+ //#region src/integrations/nextjs/manifest.d.ts
5
+ declare const MANIFEST_CACHE_TAG = "kizlo:manifest";
6
+ declare function createManifestRoute(client: S2SClient<[]>): (request: Request) => Promise<Response>;
7
+ //#endregion
8
+ export { MANIFEST_CACHE_TAG, createManifestRoute };
@@ -0,0 +1,18 @@
1
+ import { WEB_MANIFEST_ROUTE, createManifestRoute } from "../../brand/manifest.js";
2
+
3
+ //#region src/integrations/nextjs/manifest.ts
4
+ const MANIFEST_CACHE_TAG = "kizlo:manifest";
5
+ function createManifestRoute$1(client) {
6
+ const handler = createManifestRoute(client);
7
+ let getBody;
8
+ return async function GET(request) {
9
+ if (!getBody) {
10
+ const { unstable_cache } = await import("next/cache");
11
+ getBody = unstable_cache(async () => (await handler(request)).text(), [MANIFEST_CACHE_TAG], { tags: [MANIFEST_CACHE_TAG] });
12
+ }
13
+ return new Response(await getBody(), { headers: { "Content-Type": "application/manifest+json" } });
14
+ };
15
+ }
16
+
17
+ //#endregion
18
+ export { MANIFEST_CACHE_TAG, createManifestRoute$1 as createManifestRoute };
@@ -0,0 +1,17 @@
1
+ import { SeoHead } from "../../seo/schema.js";
2
+ import { S2SClient } from "../../kizlo.js";
3
+ import { Metadata, Viewport } from "next";
4
+
5
+ //#region src/integrations/nextjs/metadata.d.ts
6
+ declare function createRootMetadata(client: S2SClient<[]>): () => Promise<Metadata>;
7
+ /**
8
+ * Root `generateViewport` for `app/layout.tsx`. Emits `<meta name="theme-color">`
9
+ * from the brand theme color so the mobile browser chrome (address bar/toolbar)
10
+ * is tinted for regular visitors — distinct from the manifest `theme_color`,
11
+ * which only applies once the site is installed as an app. When a dark variant
12
+ * is set, both are emitted with `prefers-color-scheme` media queries.
13
+ */
14
+ declare function createRootViewport(client: S2SClient<[]>): () => Promise<Viewport>;
15
+ declare function createPageMetadata(head: SeoHead): Metadata;
16
+ //#endregion
17
+ export { createPageMetadata, createRootMetadata, createRootViewport };
@@ -0,0 +1,90 @@
1
+ import { resolveIcons } from "../../brand/icons.js";
2
+ import { WEB_MANIFEST_ROUTE } from "../../brand/manifest.js";
3
+
4
+ //#region src/integrations/nextjs/metadata.ts
5
+ function createRootMetadata(client) {
6
+ return async function generateMetadata() {
7
+ const settings = await client.settings.get.call();
8
+ const { icon, appleTouch } = resolveIcons(settings.brand);
9
+ const metadata = {
10
+ manifest: WEB_MANIFEST_ROUTE,
11
+ icons: {
12
+ icon: icon.map(toNextIcon),
13
+ apple: appleTouch.map(toNextIcon)
14
+ }
15
+ };
16
+ if (settings.site.url) metadata.metadataBase = new URL(settings.site.url);
17
+ return metadata;
18
+ };
19
+ }
20
+ /**
21
+ * Root `generateViewport` for `app/layout.tsx`. Emits `<meta name="theme-color">`
22
+ * from the brand theme color so the mobile browser chrome (address bar/toolbar)
23
+ * is tinted for regular visitors — distinct from the manifest `theme_color`,
24
+ * which only applies once the site is installed as an app. When a dark variant
25
+ * is set, both are emitted with `prefers-color-scheme` media queries.
26
+ */
27
+ function createRootViewport(client) {
28
+ return async function generateViewport() {
29
+ const { brand } = await client.settings.get.call();
30
+ const light = brand.theme_color;
31
+ const dark = brand.theme_color_dark;
32
+ const themeColor = [];
33
+ if (light) themeColor.push(dark ? {
34
+ media: "(prefers-color-scheme: light)",
35
+ color: light
36
+ } : { color: light });
37
+ if (dark) themeColor.push({
38
+ media: "(prefers-color-scheme: dark)",
39
+ color: dark
40
+ });
41
+ return themeColor.length ? { themeColor } : {};
42
+ };
43
+ }
44
+ function toNextIcon(icon) {
45
+ return {
46
+ url: icon.url,
47
+ type: icon.type,
48
+ sizes: icon.sizes,
49
+ media: icon.media
50
+ };
51
+ }
52
+ function createPageMetadata(head) {
53
+ return {
54
+ title: { absolute: head.title },
55
+ description: head.og.description || void 0,
56
+ alternates: { canonical: head.canonical },
57
+ robots: [
58
+ head.robots.index,
59
+ head.robots.follow,
60
+ head.robots.maxSnippet,
61
+ head.robots.maxImagePreview,
62
+ head.robots.maxVideoPreview
63
+ ].join(", "),
64
+ openGraph: {
65
+ type: head.og.type,
66
+ title: head.og.title,
67
+ description: head.og.description || void 0,
68
+ url: head.og.url,
69
+ siteName: head.og.siteName,
70
+ locale: head.og.locale,
71
+ images: head.og.image ? [{
72
+ url: head.og.image.url,
73
+ width: head.og.image.width,
74
+ height: head.og.image.height,
75
+ alt: head.og.image.alt ?? void 0
76
+ }] : void 0
77
+ },
78
+ twitter: {
79
+ card: head.twitter.card,
80
+ title: head.twitter.title,
81
+ description: head.twitter.description || void 0,
82
+ site: head.twitter.site ?? void 0,
83
+ creator: head.twitter.creator ?? void 0,
84
+ images: head.twitter.image ? [head.twitter.image] : void 0
85
+ }
86
+ };
87
+ }
88
+
89
+ //#endregion
90
+ export { createPageMetadata, createRootMetadata, createRootViewport };
@@ -1,4 +1,4 @@
1
- import { POST_EVENT_TYPES, TERM_EVENT_TYPES } from "../../webhook/schema.js";
1
+ import { POST_EVENT_TYPES, SETTINGS_EVENT_TYPES, TERM_EVENT_TYPES } from "../../webhook/schema.js";
2
2
  import { createEventHandler } from "../../webhook/index.js";
3
3
  import { createExtension } from "../../shared/extension.js";
4
4
  import { ROBOTS_CACHE_TAG } from "./robots.js";
@@ -10,6 +10,8 @@ const DEFAULT_SITEMAP_TARGET = {
10
10
  type: "layout"
11
11
  };
12
12
  const CONTENT_EVENT_TYPES = new Set([...POST_EVENT_TYPES, ...TERM_EVENT_TYPES]);
13
+ const NON_FRONTEND_SETTINGS_EVENT_TYPES = new Set(["settings.crawling.updated", "settings.integration.updated"]);
14
+ const FRONTEND_SETTINGS_EVENT_TYPES = new Set(SETTINGS_EVENT_TYPES.filter((type) => !NON_FRONTEND_SETTINGS_EVENT_TYPES.has(type)));
13
15
  function nextRevalidation(options) {
14
16
  return createExtension({
15
17
  id: "nextjs-revalidation",
@@ -17,13 +19,15 @@ function nextRevalidation(options) {
17
19
  if (!event) return;
18
20
  const revalidatePath = options?.revalidatePath ?? (await import("next/cache")).revalidatePath;
19
21
  const revalidateTag = options?.revalidateTag ?? (await import("next/cache")).revalidateTag;
22
+ const eventUrl = event.data && "url" in event.data ? event.data.url : void 0;
20
23
  const paths = [
21
24
  ...await Promise.resolve(options?.paths?.(event) ?? []),
22
- ...event.data?.url ? [event.data.url] : [],
25
+ ...eventUrl ? [eventUrl] : [],
23
26
  "/post"
24
27
  ];
25
28
  for (const path of normalizePaths(paths)) revalidatePath(path);
26
- if (event.type === "settings.saved") revalidateTag(ROBOTS_CACHE_TAG, { expire: 0 });
29
+ if (event.type === "settings.crawling.updated" || event.type === "settings.site.updated") revalidateTag(ROBOTS_CACHE_TAG, { expire: 0 });
30
+ if (FRONTEND_SETTINGS_EVENT_TYPES.has(event.type)) revalidatePath("/", "layout");
27
31
  if (CONTENT_EVENT_TYPES.has(event.type)) {
28
32
  revalidateTag(SITEMAP_CACHE_TAG, { expire: 0 });
29
33
  for (const target of resolveSitemapTargets(options?.sitemap)) revalidatePath(normalizePath(target.path), target.type);
package/dist/kizlo.d.ts CHANGED
@@ -5,10 +5,10 @@ import { CaptchaAdapter } from "./adapters/captcha.js";
5
5
  import { CookiesAdapter } from "./shared/types.js";
6
6
  import { GeoAdapter } from "./adapters/geo.js";
7
7
  import { Environment, LoggerAdapter } from "./adapters/logger.js";
8
+ import { Context } from "./context.js";
8
9
  import { RouterMap } from "./router.js";
9
10
  import { AnyExtension, InferExtensionRouter } from "./shared/extension.js";
10
11
  import { ResultClient } from "./shared/result.js";
11
- import { Context } from "./context.js";
12
12
 
13
13
  //#region src/kizlo.d.ts
14
14
  type AnyKizloConfig = KizloConfig<any>;
@@ -1,4 +1,7 @@
1
+ import { WEB_MANIFEST_ROUTE } from "../brand/manifest.js";
2
+ import { createRootMetadata, createRootViewport } from "../integrations/nextjs/metadata.js";
1
3
  import { KizloServerOptions, createKizlo } from "../integrations/nextjs/kizlo.server.js";
4
+ import { MANIFEST_CACHE_TAG, createManifestRoute } from "../integrations/nextjs/manifest.js";
2
5
  import { createRobotsRoute } from "../integrations/nextjs/robots.js";
3
6
  import { SITEMAP_CACHE_TAG, SITEMAP_ROUTE, createSitemapRoute } from "../integrations/nextjs/sitemap.js";
4
- export { KizloServerOptions, SITEMAP_CACHE_TAG, SITEMAP_ROUTE, createKizlo, createRobotsRoute, createSitemapRoute };
7
+ export { KizloServerOptions, MANIFEST_CACHE_TAG, SITEMAP_CACHE_TAG, SITEMAP_ROUTE, WEB_MANIFEST_ROUTE, createKizlo, createManifestRoute, createRobotsRoute, createRootMetadata, createRootViewport, createSitemapRoute };
@@ -1,5 +1,8 @@
1
+ import { WEB_MANIFEST_ROUTE } from "../brand/manifest.js";
2
+ import { createRootMetadata, createRootViewport } from "../integrations/nextjs/metadata.js";
1
3
  import { createRobotsRoute } from "../integrations/nextjs/robots.js";
2
4
  import { SITEMAP_CACHE_TAG, SITEMAP_ROUTE, createSitemapRoute } from "../integrations/nextjs/sitemap.js";
3
5
  import { createKizlo } from "../integrations/nextjs/kizlo.server.js";
6
+ import { MANIFEST_CACHE_TAG, createManifestRoute } from "../integrations/nextjs/manifest.js";
4
7
 
5
- export { SITEMAP_CACHE_TAG, SITEMAP_ROUTE, createKizlo, createRobotsRoute, createSitemapRoute };
8
+ export { MANIFEST_CACHE_TAG, SITEMAP_CACHE_TAG, SITEMAP_ROUTE, WEB_MANIFEST_ROUTE, createKizlo, createManifestRoute, createRobotsRoute, createRootMetadata, createRootViewport, createSitemapRoute };
package/dist/nextjs.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { KizloClientOptions, createKizloClient } from "./integrations/nextjs/kizlo.client.js";
2
- import { toMetadata } from "./integrations/nextjs/seo.js";
3
- export { KizloClientOptions, createKizloClient, toMetadata };
2
+ import { createPageMetadata } from "./integrations/nextjs/metadata.js";
3
+ export { KizloClientOptions, createKizloClient, createPageMetadata };
package/dist/nextjs.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { createKizloClient } from "./integrations/nextjs/kizlo.client.js";
2
- import { toMetadata } from "./integrations/nextjs/seo.js";
2
+ import { createPageMetadata } from "./integrations/nextjs/metadata.js";
3
3
 
4
- export { createKizloClient, toMetadata };
4
+ export { createKizloClient, createPageMetadata };
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.4.0";
2
+ var version = "0.6.0";
3
3
 
4
4
  //#endregion
5
5
  export { version };
package/dist/router.d.ts CHANGED
@@ -32,6 +32,14 @@ declare const ROUTER_MAP: {
32
32
  name: string;
33
33
  alt: string;
34
34
  src: string;
35
+ mime?: string | undefined;
36
+ width?: number | undefined;
37
+ height?: number | undefined;
38
+ variants?: {
39
+ src: string;
40
+ width: number;
41
+ height: number;
42
+ }[] | undefined;
35
43
  } | null;
36
44
  } | null;
37
45
  featuredMedia: {
@@ -39,6 +47,14 @@ declare const ROUTER_MAP: {
39
47
  name: string;
40
48
  alt: string;
41
49
  src: string;
50
+ mime?: string | undefined;
51
+ width?: number | undefined;
52
+ height?: number | undefined;
53
+ variants?: {
54
+ src: string;
55
+ width: number;
56
+ height: number;
57
+ }[] | undefined;
42
58
  } | null;
43
59
  categories: {
44
60
  id: number;
@@ -180,6 +196,14 @@ declare const ROUTER_MAP: {
180
196
  name: string;
181
197
  alt: string;
182
198
  src: string;
199
+ mime?: string | undefined;
200
+ width?: number | undefined;
201
+ height?: number | undefined;
202
+ variants?: {
203
+ src: string;
204
+ width: number;
205
+ height: number;
206
+ }[] | undefined;
183
207
  } | null;
184
208
  } | null;
185
209
  featuredMedia: {
@@ -187,6 +211,14 @@ declare const ROUTER_MAP: {
187
211
  name: string;
188
212
  alt: string;
189
213
  src: string;
214
+ mime?: string | undefined;
215
+ width?: number | undefined;
216
+ height?: number | undefined;
217
+ variants?: {
218
+ src: string;
219
+ width: number;
220
+ height: number;
221
+ }[] | undefined;
190
222
  } | null;
191
223
  categories: {
192
224
  id: number;
@@ -522,6 +554,14 @@ declare const ROUTER_MAP: {
522
554
  name: string;
523
555
  alt: string;
524
556
  src: string;
557
+ mime?: string | undefined;
558
+ width?: number | undefined;
559
+ height?: number | undefined;
560
+ variants?: {
561
+ src: string;
562
+ width: number;
563
+ height: number;
564
+ }[] | undefined;
525
565
  } | null;
526
566
  } | null;
527
567
  content: string;
@@ -534,6 +574,14 @@ declare const ROUTER_MAP: {
534
574
  name: string;
535
575
  alt: string;
536
576
  src: string;
577
+ mime?: string | undefined;
578
+ width?: number | undefined;
579
+ height?: number | undefined;
580
+ variants?: {
581
+ src: string;
582
+ width: number;
583
+ height: number;
584
+ }[] | undefined;
537
585
  } | null;
538
586
  };
539
587
  replyCount: number;
@@ -580,6 +628,14 @@ declare const ROUTER_MAP: {
580
628
  name: string;
581
629
  alt: string;
582
630
  src: string;
631
+ mime?: string | undefined;
632
+ width?: number | undefined;
633
+ height?: number | undefined;
634
+ variants?: {
635
+ src: string;
636
+ width: number;
637
+ height: number;
638
+ }[] | undefined;
583
639
  } | null;
584
640
  } | null;
585
641
  content: string;
@@ -592,6 +648,14 @@ declare const ROUTER_MAP: {
592
648
  name: string;
593
649
  alt: string;
594
650
  src: string;
651
+ mime?: string | undefined;
652
+ width?: number | undefined;
653
+ height?: number | undefined;
654
+ variants?: {
655
+ src: string;
656
+ width: number;
657
+ height: number;
658
+ }[] | undefined;
595
659
  } | null;
596
660
  };
597
661
  replyCount: number;
@@ -638,6 +702,14 @@ declare const ROUTER_MAP: {
638
702
  name: string;
639
703
  alt: string;
640
704
  src: string;
705
+ mime?: string | undefined;
706
+ width?: number | undefined;
707
+ height?: number | undefined;
708
+ variants?: {
709
+ src: string;
710
+ width: number;
711
+ height: number;
712
+ }[] | undefined;
641
713
  } | null;
642
714
  } | null;
643
715
  content: string;
@@ -650,6 +722,14 @@ declare const ROUTER_MAP: {
650
722
  name: string;
651
723
  alt: string;
652
724
  src: string;
725
+ mime?: string | undefined;
726
+ width?: number | undefined;
727
+ height?: number | undefined;
728
+ variants?: {
729
+ src: string;
730
+ width: number;
731
+ height: number;
732
+ }[] | undefined;
653
733
  } | null;
654
734
  };
655
735
  replyCount: number;
@@ -700,7 +780,11 @@ declare const ROUTER_MAP: {
700
780
  logo_wordmark_dark?: number | null | undefined;
701
781
  favicon?: number | null | undefined;
702
782
  favicon_dark?: number | null | undefined;
703
- apple_touch_icon?: number | null | undefined;
783
+ ios_app_icon?: number | null | undefined;
784
+ android_app_icon?: number | null | undefined;
785
+ theme_color?: number | null | undefined;
786
+ theme_color_dark?: number | null | undefined;
787
+ background_color?: number | null | undefined;
704
788
  }, null, DefinedErrorMapLike>;
705
789
  updateIdentity: Procedure<"internal", {
706
790
  type?: "person" | "organization" | undefined;
package/dist/service.d.ts CHANGED
@@ -2,7 +2,7 @@ import { WordPressCredentials } from "./wordpress/types.js";
2
2
  import { WordPressService } from "./wordpress/service.js";
3
3
  import "./wordpress/index.js";
4
4
  import { EmailService } from "./email/service.js";
5
- import { KizloSettingsService } from "./settings/service.js";
5
+ import { SettingsService } from "./settings/service.js";
6
6
 
7
7
  //#region src/service.d.ts
8
8
  interface ServiceConfig {
@@ -10,7 +10,7 @@ interface ServiceConfig {
10
10
  }
11
11
  declare class Service {
12
12
  readonly email: EmailService;
13
- readonly settings: KizloSettingsService;
13
+ readonly settings: SettingsService;
14
14
  readonly wordpress: WordPressService;
15
15
  private readonly config;
16
16
  constructor(config: ServiceConfig);
package/dist/service.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { WordPressService } from "./wordpress/service.js";
2
2
  import { EmailService } from "./email/service.js";
3
- import { KizloSettingsService } from "./settings/service.js";
3
+ import { SettingsService } from "./settings/service.js";
4
4
 
5
5
  //#region src/service.ts
6
6
  var Service = class {
@@ -11,7 +11,7 @@ var Service = class {
11
11
  constructor(config) {
12
12
  this.config = config;
13
13
  this.email = new EmailService(this);
14
- this.settings = new KizloSettingsService(this);
14
+ this.settings = new SettingsService(this);
15
15
  this.wordpress = new WordPressService(this.config);
16
16
  }
17
17
  };
@@ -1,23 +1,23 @@
1
1
  import { WP_Result } from "../wordpress/types.js";
2
- import { KizloAuthorsSettingsInput, KizloBrandSettingsInput, KizloCrawlingSettingsInput, KizloIdentitySettingsInput, KizloPostTypeSettingsInput, KizloSiteSettingsInput, KizloTaxonomySettingsInput, KizloWebhookSettingsInput, Settings } from "./service.interface.js";
2
+ import { AuthorsSettingsInput, BrandSettingsInput, CrawlingSettingsInput, IdentitySettingsInput, PostTypeSettingsInput, Settings, SiteSettingsInput, TaxonomySettingsInput, WebhookSettingsInput } from "./service.interface.js";
3
3
  import { Service } from "../service.js";
4
4
  import "../index.js";
5
5
 
6
6
  //#region src/settings/service.d.ts
7
- declare class KizloSettingsService {
7
+ declare class SettingsService {
8
8
  private readonly service;
9
9
  constructor(service: Service);
10
10
  /** Fetch every Kizlo settings section in one response. */
11
11
  get(): Promise<WP_Result<Settings, never>>;
12
- updateSite(input: KizloSiteSettingsInput): Promise<WP_Result<null, "invalid_param">>;
13
- updateBrand(input: KizloBrandSettingsInput): Promise<WP_Result<null, "invalid_param">>;
14
- updateWebhook(input: KizloWebhookSettingsInput): Promise<WP_Result<null, "invalid_param">>;
15
- updateIdentity(input: KizloIdentitySettingsInput): Promise<WP_Result<null, "invalid_param">>;
16
- updateAuthors(input: KizloAuthorsSettingsInput): Promise<WP_Result<null, "invalid_param">>;
17
- updateCrawling(input: KizloCrawlingSettingsInput): Promise<WP_Result<null, "invalid_param">>;
18
- updatePostType(slug: string, input: KizloPostTypeSettingsInput): Promise<WP_Result<null, "invalid_param">>;
19
- updateTaxonomy(slug: string, input: KizloTaxonomySettingsInput): Promise<WP_Result<null, "invalid_param">>;
12
+ updateSite(input: SiteSettingsInput): Promise<WP_Result<null, "invalid_param">>;
13
+ updateBrand(input: BrandSettingsInput): Promise<WP_Result<null, "invalid_param">>;
14
+ updateWebhook(input: WebhookSettingsInput): Promise<WP_Result<null, "invalid_param">>;
15
+ updateIdentity(input: IdentitySettingsInput): Promise<WP_Result<null, "invalid_param">>;
16
+ updateAuthors(input: AuthorsSettingsInput): Promise<WP_Result<null, "invalid_param">>;
17
+ updateCrawling(input: CrawlingSettingsInput): Promise<WP_Result<null, "invalid_param">>;
18
+ updatePostType(slug: string, input: PostTypeSettingsInput): Promise<WP_Result<null, "invalid_param">>;
19
+ updateTaxonomy(slug: string, input: TaxonomySettingsInput): Promise<WP_Result<null, "invalid_param">>;
20
20
  private update;
21
21
  }
22
22
  //#endregion
23
- export { KizloSettingsService };
23
+ export { SettingsService };
@@ -1,25 +1,25 @@
1
- import { AuthorsSettings, BrandSettings, CrawlingSettings, IdentitySettings, Media, OrganizationFounder, OrganizationSettings, PersonSettings, PostStatus, PostTypeSettings, Settings, SiteSettings, SocialProfile, TaxonomySettings, WebhookSettings } from "@kizlo/shared";
1
+ import { AuthorsSettings, BrandSettings, CrawlingSettings, IdentitySettings, OrganizationFounder, OrganizationSettings, PersonSettings, PostStatusDefinition, PostTypeSettings, Settings, SiteSettings, SocialProfile, TaxonomySettings, WebhookSettings } from "@kizlo/shared";
2
2
 
3
3
  //#region src/settings/service.interface.d.ts
4
- type KizloSiteSettingsInput = Partial<Omit<SiteSettings, "fallback_image"> & {
4
+ type SiteSettingsInput = Partial<Omit<SiteSettings, "fallback_image"> & {
5
5
  fallback_image: number | null;
6
6
  }>;
7
- type KizloBrandSettingsInput = Partial<Record<keyof BrandSettings, number | null>>;
8
- type KizloWebhookSettingsInput = Partial<WebhookSettings>;
9
- type KizloPersonSettingsInput = Partial<Omit<PersonSettings, "image"> & {
7
+ type BrandSettingsInput = Partial<Record<keyof BrandSettings, number | null>>;
8
+ type WebhookSettingsInput = Partial<WebhookSettings>;
9
+ type PersonSettingsInput = Partial<Omit<PersonSettings, "image"> & {
10
10
  image: number | null;
11
11
  }>;
12
- type KizloOrganizationSettingsInput = Partial<Omit<OrganizationSettings, "logo"> & {
12
+ type OrganizationSettingsInput = Partial<Omit<OrganizationSettings, "logo"> & {
13
13
  logo: number | null;
14
14
  }>;
15
- type KizloIdentitySettingsInput = Partial<{
15
+ type IdentitySettingsInput = Partial<{
16
16
  type: IdentitySettings["type"];
17
- person: KizloPersonSettingsInput | null;
18
- organization: KizloOrganizationSettingsInput | null;
17
+ person: PersonSettingsInput | null;
18
+ organization: OrganizationSettingsInput | null;
19
19
  }>;
20
- type KizloAuthorsSettingsInput = Partial<AuthorsSettings>;
21
- type KizloCrawlingSettingsInput = Partial<CrawlingSettings>;
22
- type KizloPostTypeSettingsInput = Partial<Pick<PostTypeSettings, "title_structure" | "description_structure" | "search_engine_visibility" | "webpage_type" | "article_type" | "seo_enabled" | "pathname_structure" | "comment_action_structure" | "rest_api_enabled" | "publicly_queryable" | "breadcrumbs">>;
23
- type KizloTaxonomySettingsInput = Partial<Pick<TaxonomySettings, "title_structure" | "description_structure" | "search_engine_visibility" | "seo_enabled" | "pathname_structure" | "rest_api_enabled" | "publicly_queryable" | "breadcrumbs">>;
20
+ type AuthorsSettingsInput = Partial<AuthorsSettings>;
21
+ type CrawlingSettingsInput = Partial<CrawlingSettings>;
22
+ type PostTypeSettingsInput = Partial<Pick<PostTypeSettings, "title_structure" | "description_structure" | "search_engine_visibility" | "webpage_type" | "article_type" | "seo_enabled" | "pathname_structure" | "comment_action_structure" | "rest_api_enabled" | "publicly_queryable" | "breadcrumbs">>;
23
+ type TaxonomySettingsInput = Partial<Pick<TaxonomySettings, "title_structure" | "description_structure" | "search_engine_visibility" | "seo_enabled" | "pathname_structure" | "rest_api_enabled" | "publicly_queryable" | "breadcrumbs">>;
24
24
  //#endregion
25
- export { AuthorsSettings, BrandSettings, CrawlingSettings, IdentitySettings, KizloAuthorsSettingsInput, KizloBrandSettingsInput, KizloCrawlingSettingsInput, KizloIdentitySettingsInput, KizloOrganizationSettingsInput, KizloPersonSettingsInput, KizloPostTypeSettingsInput, KizloSiteSettingsInput, KizloTaxonomySettingsInput, KizloWebhookSettingsInput, Media, OrganizationFounder, OrganizationSettings, PersonSettings, PostStatus, PostTypeSettings, Settings, SiteSettings, SocialProfile, TaxonomySettings, WebhookSettings };
25
+ export { type AuthorsSettings, AuthorsSettingsInput, type BrandSettings, BrandSettingsInput, type CrawlingSettings, CrawlingSettingsInput, type IdentitySettings, IdentitySettingsInput, type OrganizationFounder, type OrganizationSettings, OrganizationSettingsInput, type PersonSettings, PersonSettingsInput, type PostStatusDefinition, type PostTypeSettings, PostTypeSettingsInput, type Settings, type SiteSettings, SiteSettingsInput, type SocialProfile, type TaxonomySettings, TaxonomySettingsInput, type WebhookSettings, WebhookSettingsInput };
@@ -1,7 +1,7 @@
1
1
  import { WP_KIZLO_BASE } from "../wordpress/constants.js";
2
2
 
3
3
  //#region src/settings/service.ts
4
- var KizloSettingsService = class {
4
+ var SettingsService = class {
5
5
  service;
6
6
  constructor(service) {
7
7
  this.service = service;
@@ -43,4 +43,4 @@ var KizloSettingsService = class {
43
43
  };
44
44
 
45
45
  //#endregion
46
- export { KizloSettingsService };
46
+ export { SettingsService };
@@ -1,6 +1,6 @@
1
1
  import { AnyContext } from "./types.js";
2
- import { DefinedErrorMapLike } from "./error.js";
3
2
  import { ServerContext } from "../context.js";
3
+ import { DefinedErrorMapLike } from "./error.js";
4
4
  import { BaseHandlerOptions } from "./procedure.js";
5
5
  import { UnionToIntersection } from "@kizlo/shared";
6
6
 
@@ -1,5 +1,5 @@
1
- import { DefinedErrorMapLike, ThrowableErrorMap, WithCommonErrorMap } from "./error.js";
2
1
  import { ServerContext } from "../context.js";
2
+ import { DefinedErrorMapLike, ThrowableErrorMap, WithCommonErrorMap } from "./error.js";
3
3
  import { AnyMiddleware, InferUses, Middleware } from "./middleware.js";
4
4
  import * as _orpc_contract0 from "@orpc/contract";
5
5
  import { DeepMerge, Pathname, Prettify, Promisify, Schema, SchemaInput, SchemaOutput } from "@kizlo/shared";
@@ -1,3 +1,4 @@
1
+ import { Media } from "@kizlo/shared";
1
2
  import z from "zod/v4";
2
3
 
3
4
  //#region src/shared/schema.d.ts
@@ -27,13 +28,6 @@ declare const CurrencyFormat: z.ZodObject<{
27
28
  currencyThousandSeparator: z.ZodString;
28
29
  }, z.core.$strip>;
29
30
  type CurrencyFormat = z.infer<typeof CurrencyFormat>;
30
- declare const Media: z.ZodObject<{
31
- id: z.ZodNumber;
32
- name: z.ZodString;
33
- alt: z.ZodString;
34
- src: z.ZodString;
35
- }, z.core.$strip>;
36
- type Media = z.infer<typeof Media>;
37
31
  declare const IdentifierInput: z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodString]>;
38
32
  type IdentifierInput = z.output<typeof IdentifierInput>;
39
33
  declare const PreviewTokenPayload: z.ZodObject<{
@@ -1,4 +1,4 @@
1
- import { NumberLike } from "@kizlo/shared";
1
+ import { Media, NumberLike } from "@kizlo/shared";
2
2
  import z from "zod/v4";
3
3
 
4
4
  //#region src/shared/schema.ts
@@ -22,12 +22,6 @@ const CurrencyFormat = z.object({
22
22
  currencyDecimalSeparator: z.string(),
23
23
  currencyThousandSeparator: z.string()
24
24
  });
25
- const Media = z.object({
26
- id: z.number(),
27
- name: z.string(),
28
- alt: z.string(),
29
- src: z.string()
30
- });
31
25
  const IdentifierInput = z.union([NumberLike, z.string()]);
32
26
  const PreviewTokenPayload = z.object({
33
27
  id: z.number(),
@@ -1,6 +1,6 @@
1
+ import { ServerContext } from "../context.js";
1
2
  import { KizloEvent } from "./schema.js";
2
3
  import { DefinedErrorMapLike } from "../shared/error.js";
3
- import { ServerContext } from "../context.js";
4
4
  import { Procedure } from "../shared/procedure.js";
5
5
  import "../index.js";
6
6
  import { Schema, SchemaOutput } from "@kizlo/shared";
@@ -29,9 +29,22 @@ declare const KizloEvent: z.ZodUnion<readonly [z.ZodObject<{
29
29
  }, z.core.$strip>;
30
30
  }, z.core.$strip>, z.ZodObject<{
31
31
  type: z.ZodEnum<{
32
- "settings.saved": "settings.saved";
32
+ "settings.site.updated": "settings.site.updated";
33
+ "settings.brand.updated": "settings.brand.updated";
34
+ "settings.identity.updated": "settings.identity.updated";
35
+ "settings.authors.updated": "settings.authors.updated";
36
+ "settings.crawling.updated": "settings.crawling.updated";
37
+ "settings.integration.updated": "settings.integration.updated";
33
38
  }>;
34
39
  data: z.ZodNull;
40
+ }, z.core.$strip>, z.ZodObject<{
41
+ type: z.ZodEnum<{
42
+ "settings.post_type.updated": "settings.post_type.updated";
43
+ "settings.taxonomy.updated": "settings.taxonomy.updated";
44
+ }>;
45
+ data: z.ZodObject<{
46
+ key: z.ZodString;
47
+ }, z.core.$strip>;
35
48
  }, z.core.$strip>]>;
36
49
  type KizloEvent = z.infer<typeof KizloEvent>;
37
50
  //#endregion
@@ -14,7 +14,18 @@ const POST_EVENT_TYPES = [
14
14
  "post.deleted"
15
15
  ];
16
16
  const PostEventType = z.enum(POST_EVENT_TYPES);
17
- const SETTINGS_EVENT_TYPES = ["settings.saved"];
17
+ const SETTINGS_SIMPLE_EVENT_TYPES = [
18
+ "settings.site.updated",
19
+ "settings.brand.updated",
20
+ "settings.identity.updated",
21
+ "settings.authors.updated",
22
+ "settings.crawling.updated",
23
+ "settings.integration.updated"
24
+ ];
25
+ const SettingsSimpleEventType = z.enum(SETTINGS_SIMPLE_EVENT_TYPES);
26
+ const SETTINGS_INDEXED_EVENT_TYPES = ["settings.post_type.updated", "settings.taxonomy.updated"];
27
+ const SettingsIndexedEventType = z.enum(SETTINGS_INDEXED_EVENT_TYPES);
28
+ const SETTINGS_EVENT_TYPES = [...SETTINGS_SIMPLE_EVENT_TYPES, ...SETTINGS_INDEXED_EVENT_TYPES];
18
29
  const SettingsEventType = z.enum(SETTINGS_EVENT_TYPES);
19
30
  const EVENT_TYPES = [
20
31
  ...TERM_EVENT_TYPES,
@@ -42,15 +53,22 @@ const TermEvent = z.object({
42
53
  type: TermEventType,
43
54
  data: TermEventData
44
55
  });
45
- const SettingsEventData = z.null();
46
- const SettingsEvent = z.object({
47
- type: SettingsEventType,
48
- data: SettingsEventData
56
+ const SettingsSimpleEventData = z.null();
57
+ const SettingsSimpleEvent = z.object({
58
+ type: SettingsSimpleEventType,
59
+ data: SettingsSimpleEventData
60
+ });
61
+ const SettingsIndexedEventData = z.object({ key: z.string() });
62
+ const SettingsIndexedEvent = z.object({
63
+ type: SettingsIndexedEventType,
64
+ data: SettingsIndexedEventData
49
65
  });
66
+ const SettingsEvent = z.union([SettingsSimpleEvent, SettingsIndexedEvent]);
50
67
  const KizloEvent = z.union([
51
68
  PostEvent,
52
69
  TermEvent,
53
- SettingsEvent
70
+ SettingsSimpleEvent,
71
+ SettingsIndexedEvent
54
72
  ]);
55
73
  const AnyEvent = z.object({
56
74
  type: z.string(),
@@ -58,4 +76,4 @@ const AnyEvent = z.object({
58
76
  });
59
77
 
60
78
  //#endregion
61
- export { AnyEvent, KizloEvent, POST_EVENT_TYPES, TERM_EVENT_TYPES };
79
+ export { AnyEvent, KizloEvent, POST_EVENT_TYPES, SETTINGS_EVENT_TYPES, TERM_EVENT_TYPES };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kizlo",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "A headless WordPress toolkit for TypeScript.",
6
6
  "keywords": [
@@ -76,7 +76,7 @@
76
76
  },
77
77
  "dependencies": {
78
78
  "@clack/prompts": "^1.5.1",
79
- "@kizlo/shared": "0.2.0",
79
+ "@kizlo/shared": "0.3.0",
80
80
  "@orpc/client": "^1.14.3",
81
81
  "@orpc/contract": "^1.14.3",
82
82
  "@orpc/openapi": "^1.14.3",
@@ -1,7 +0,0 @@
1
- import { SeoHead } from "../../seo/schema.js";
2
- import { Metadata } from "next";
3
-
4
- //#region src/integrations/nextjs/seo.d.ts
5
- declare function toMetadata(head: SeoHead): Metadata;
6
- //#endregion
7
- export { toMetadata };
@@ -1,41 +0,0 @@
1
- //#region src/integrations/nextjs/seo.ts
2
- function toMetadata(head) {
3
- const robots = [
4
- head.robots.index,
5
- head.robots.follow,
6
- head.robots.maxSnippet,
7
- head.robots.maxImagePreview,
8
- head.robots.maxVideoPreview
9
- ].join(", ");
10
- return {
11
- title: { absolute: head.title },
12
- description: head.og.description || void 0,
13
- alternates: { canonical: head.canonical },
14
- robots,
15
- openGraph: {
16
- type: head.og.type,
17
- title: head.og.title,
18
- description: head.og.description || void 0,
19
- url: head.og.url,
20
- siteName: head.og.siteName,
21
- locale: head.og.locale,
22
- images: head.og.image ? [{
23
- url: head.og.image.url,
24
- width: head.og.image.width,
25
- height: head.og.image.height,
26
- alt: head.og.image.alt ?? void 0
27
- }] : void 0
28
- },
29
- twitter: {
30
- card: head.twitter.card,
31
- title: head.twitter.title,
32
- description: head.twitter.description || void 0,
33
- site: head.twitter.site ?? void 0,
34
- creator: head.twitter.creator ?? void 0,
35
- images: head.twitter.image ? [head.twitter.image] : void 0
36
- }
37
- };
38
- }
39
-
40
- //#endregion
41
- export { toMetadata };