katanakit-js 4.0.4 → 5.2.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.
Files changed (130) hide show
  1. package/README.md +184 -10
  2. package/dist/adapters/insforge/index.d.ts +3 -0
  3. package/dist/adapters/insforge/index.d.ts.map +1 -0
  4. package/dist/adapters/insforge/index.js +2 -0
  5. package/dist/adapters/insforge/index.js.map +1 -0
  6. package/dist/adapters/insforge/insforge.service.d.ts +116 -0
  7. package/dist/adapters/insforge/insforge.service.d.ts.map +1 -0
  8. package/dist/adapters/insforge/insforge.service.js +437 -0
  9. package/dist/adapters/insforge/insforge.service.js.map +1 -0
  10. package/dist/adapters/notion/notion.service.d.ts.map +1 -1
  11. package/dist/adapters/notion/notion.service.js +72 -54
  12. package/dist/adapters/notion/notion.service.js.map +1 -1
  13. package/dist/adapters/wordpress/wordpress.service.d.ts.map +1 -1
  14. package/dist/adapters/wordpress/wordpress.service.js +163 -85
  15. package/dist/adapters/wordpress/wordpress.service.js.map +1 -1
  16. package/dist/config/seo.service.d.ts.map +1 -1
  17. package/dist/config/seo.service.js +42 -4
  18. package/dist/config/seo.service.js.map +1 -1
  19. package/dist/core/index.d.ts +5 -0
  20. package/dist/core/index.d.ts.map +1 -1
  21. package/dist/core/index.js +5 -0
  22. package/dist/core/index.js.map +1 -1
  23. package/dist/core/services/error.service.d.ts +21 -1
  24. package/dist/core/services/error.service.d.ts.map +1 -1
  25. package/dist/core/services/error.service.js +39 -0
  26. package/dist/core/services/error.service.js.map +1 -1
  27. package/dist/core/services/faker.service.d.ts +160 -0
  28. package/dist/core/services/faker.service.d.ts.map +1 -0
  29. package/dist/core/services/faker.service.js +235 -0
  30. package/dist/core/services/faker.service.js.map +1 -0
  31. package/dist/core/services/http.service.d.ts.map +1 -1
  32. package/dist/core/services/http.service.js +10 -16
  33. package/dist/core/services/http.service.js.map +1 -1
  34. package/dist/core/services/media.service.d.ts +97 -0
  35. package/dist/core/services/media.service.d.ts.map +1 -0
  36. package/dist/core/services/media.service.js +239 -0
  37. package/dist/core/services/media.service.js.map +1 -0
  38. package/dist/core/services/reactive.service.d.ts.map +1 -1
  39. package/dist/core/services/reactive.service.js +5 -14
  40. package/dist/core/services/reactive.service.js.map +1 -1
  41. package/dist/core/services/result.service.d.ts +41 -0
  42. package/dist/core/services/result.service.d.ts.map +1 -0
  43. package/dist/core/services/result.service.js +60 -0
  44. package/dist/core/services/result.service.js.map +1 -0
  45. package/dist/core/services/validation.service.d.ts +22 -0
  46. package/dist/core/services/validation.service.d.ts.map +1 -0
  47. package/dist/core/services/validation.service.js +41 -0
  48. package/dist/core/services/validation.service.js.map +1 -0
  49. package/dist/core/services/youtube.service.d.ts +79 -0
  50. package/dist/core/services/youtube.service.d.ts.map +1 -0
  51. package/dist/core/services/youtube.service.js +388 -0
  52. package/dist/core/services/youtube.service.js.map +1 -0
  53. package/dist/index.d.ts +1 -0
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +1 -0
  56. package/dist/index.js.map +1 -1
  57. package/dist/infrastructure/filesystem/filesystem.service.d.ts +267 -0
  58. package/dist/infrastructure/filesystem/filesystem.service.d.ts.map +1 -0
  59. package/dist/infrastructure/filesystem/filesystem.service.js +453 -0
  60. package/dist/infrastructure/filesystem/filesystem.service.js.map +1 -0
  61. package/dist/infrastructure/filesystem/path.service.d.ts +115 -0
  62. package/dist/infrastructure/filesystem/path.service.d.ts.map +1 -0
  63. package/dist/infrastructure/filesystem/path.service.js +154 -0
  64. package/dist/infrastructure/filesystem/path.service.js.map +1 -0
  65. package/dist/infrastructure/index.d.ts +3 -0
  66. package/dist/infrastructure/index.d.ts.map +1 -1
  67. package/dist/infrastructure/index.js +3 -0
  68. package/dist/infrastructure/index.js.map +1 -1
  69. package/dist/infrastructure/media/media.service.d.ts +15 -0
  70. package/dist/infrastructure/media/media.service.d.ts.map +1 -0
  71. package/dist/infrastructure/media/media.service.js +44 -0
  72. package/dist/infrastructure/media/media.service.js.map +1 -0
  73. package/dist/infrastructure/storage/storage.service.d.ts.map +1 -1
  74. package/dist/infrastructure/storage/storage.service.js +10 -8
  75. package/dist/infrastructure/storage/storage.service.js.map +1 -1
  76. package/dist/schemas/access.schema.d.ts +69 -0
  77. package/dist/schemas/access.schema.d.ts.map +1 -0
  78. package/dist/schemas/access.schema.js +36 -0
  79. package/dist/schemas/access.schema.js.map +1 -0
  80. package/dist/schemas/ai.schema.d.ts +53 -0
  81. package/dist/schemas/ai.schema.d.ts.map +1 -0
  82. package/dist/schemas/ai.schema.js +34 -0
  83. package/dist/schemas/ai.schema.js.map +1 -0
  84. package/dist/schemas/common.schema.d.ts +49 -0
  85. package/dist/schemas/common.schema.d.ts.map +1 -0
  86. package/dist/schemas/common.schema.js +23 -0
  87. package/dist/schemas/common.schema.js.map +1 -0
  88. package/dist/schemas/core.schema.d.ts +164 -0
  89. package/dist/schemas/core.schema.d.ts.map +1 -0
  90. package/dist/schemas/core.schema.js +109 -0
  91. package/dist/schemas/core.schema.js.map +1 -0
  92. package/dist/schemas/faker.schema.d.ts +12 -0
  93. package/dist/schemas/faker.schema.d.ts.map +1 -0
  94. package/dist/schemas/faker.schema.js +12 -0
  95. package/dist/schemas/faker.schema.js.map +1 -0
  96. package/dist/schemas/filesystem.schema.d.ts +71 -0
  97. package/dist/schemas/filesystem.schema.d.ts.map +1 -0
  98. package/dist/schemas/filesystem.schema.js +56 -0
  99. package/dist/schemas/filesystem.schema.js.map +1 -0
  100. package/dist/schemas/index.d.ts +13 -0
  101. package/dist/schemas/index.d.ts.map +1 -0
  102. package/dist/schemas/index.js +13 -0
  103. package/dist/schemas/index.js.map +1 -0
  104. package/dist/schemas/insforge.schema.d.ts +69 -0
  105. package/dist/schemas/insforge.schema.d.ts.map +1 -0
  106. package/dist/schemas/insforge.schema.js +82 -0
  107. package/dist/schemas/insforge.schema.js.map +1 -0
  108. package/dist/schemas/media.schema.d.ts +51 -0
  109. package/dist/schemas/media.schema.d.ts.map +1 -0
  110. package/dist/schemas/media.schema.js +50 -0
  111. package/dist/schemas/media.schema.js.map +1 -0
  112. package/dist/schemas/notion.schema.d.ts +1058 -0
  113. package/dist/schemas/notion.schema.d.ts.map +1 -0
  114. package/dist/schemas/notion.schema.js +248 -0
  115. package/dist/schemas/notion.schema.js.map +1 -0
  116. package/dist/schemas/rss.schema.d.ts +35 -0
  117. package/dist/schemas/rss.schema.d.ts.map +1 -0
  118. package/dist/schemas/rss.schema.js +44 -0
  119. package/dist/schemas/rss.schema.js.map +1 -0
  120. package/dist/schemas/wordpress.schema.d.ts +1304 -0
  121. package/dist/schemas/wordpress.schema.d.ts.map +1 -0
  122. package/dist/schemas/wordpress.schema.js +404 -0
  123. package/dist/schemas/wordpress.schema.js.map +1 -0
  124. package/dist/schemas/youtube.schema.d.ts +122 -0
  125. package/dist/schemas/youtube.schema.d.ts.map +1 -0
  126. package/dist/schemas/youtube.schema.js +113 -0
  127. package/dist/schemas/youtube.schema.js.map +1 -0
  128. package/dist/types/index.d.ts +191 -800
  129. package/dist/types/index.d.ts.map +1 -1
  130. package/package.json +40 -15
@@ -1,7 +1,20 @@
1
1
  import type { Temporal } from "@js-temporal/polyfill";
2
2
  import type { WatchCallback as VueWatchCallback, WatchOptions as VueWatchOptions, WatchSource as VueWatchSource, WatchStopHandle as VueWatchStopHandle } from "vue";
3
+ import type { z } from "zod";
4
+ import { AccessCapabilitySchema, AccessRoleDefinitionSchema, AccessRoleSchema, AccessSubjectSchema } from "../schemas/access.schema.js";
5
+ import { AiFunctionCallSchema, AiMessageSchema, AiProviderConfigSchema, AiRoleSchema, AiToolCallSchema } from "../schemas/ai.schema.js";
6
+ import { ApiErrorSchema, HttpMethodSchema, LocaleSchema, LogLevelSchema, SerializedErrorSchema, StorageTargetSchema, ThemeModeSchema } from "../schemas/common.schema.js";
7
+ import { AgentDataSchema, AgentStepSchema, AiErrorSchema, AppDateFormatOptionsSchema, AssistantReplySchema, AstroServiceErrorSchema, CurrencyFormatOptionsSchema, CurrencySchema, FieldErrorsSchema, GeometryFormatOptionsSchema, GeoPositionSchema, LazyLoaderEntrySchema, NumberFormatOptionsSchema, ProductTypeSchema, ScrollPositionSchema, ValidationIssueSchema, ViewportSizeSchema } from "../schemas/core.schema.js";
8
+ import { FakeVehicleSchema } from "../schemas/faker.schema.js";
9
+ import { FileEncodingSchema, FileHashAlgorithmSchema, FileStatsSchema, FilesystemErrorSchema, ReadDirEntrySchema, ReadDirOptionsSchema, WriteFileOptionsSchema } from "../schemas/filesystem.schema.js";
10
+ import { IfConfigSchema, IfInsertRowsSchema, IfInvokeOptionsSchema, IfListOptionsSchema, IfOrderSchema, IfRpcCallSchema, IfStorageRefSchema, IfTableQuerySchema, IfUpdatePatchSchema, IfWriteQuerySchema } from "../schemas/insforge.schema.js";
11
+ import { MediaProviderSchema, MediaSourceSchema, SmartVideoOptionsSchema, YoutubeEmbedOptionsSchema, YoutubeThumbnailQualitySchema } from "../schemas/media.schema.js";
12
+ import { NotionBlockListSchema, NotionBlockSchema, NotionConfigSchema, NotionCoverSchema, NotionDatabaseQuerySchema, NotionDatabaseSchema, NotionIconSchema, NotionPageListSchema, NotionPageSchema, NotionParentSchema, NotionPropertySchemaSchema, NotionPropertyValueSchema, NotionRichTextSchema, NotionSearchQuerySchema, NotionSearchResultSchema, NotionSortSchema, NotionUserListSchema, NotionUserSchema } from "../schemas/notion.schema.js";
13
+ import { RssConfigSchema, RssItemSchema } from "../schemas/rss.schema.js";
14
+ import { WordPressAuthSchema, WordPressConfigSchema, WpAcfFieldsSchema, WpBaseEntitySchema, WpBatchOperationSchema, WpBatchResultSchema, WpCategoryCreateSchema, WpCategorySchema, WpCategoryUpdateSchema, WpCommentCreateSchema, WpCommentSchema, WpCommentUpdateSchema, WpEmbeddedSchema, WpMediaMetaSchema, WpMediaSchema, WpMediaUpdateSchema, WpPageCreateSchema, WpPageSchema, WpPageUpdateSchema, WpPostCreateSchema, WpPostSchema, WpPostUpdateSchema, WpQueryParamsSchema, WpTagCreateSchema, WpTagSchema, WpTagUpdateSchema, WpUserCreateSchema, WpUserSchema, WpUserUpdateSchema } from "../schemas/wordpress.schema.js";
15
+ import { YoutubeApiConfigSchema, YoutubeChannelsResponseSchema, YoutubeListParamsSchema, YoutubePlaylistItemsResponseSchema, YoutubeVideoNormalizedSchema, YoutubeVideoPageSchema, YoutubeVideosResponseSchema, YoutubeVideoThumbnailsSchema } from "../schemas/youtube.schema.js";
3
16
  /** Native console methods used as log levels. */
4
- export type LogLevel = "log" | "warn" | "error";
17
+ export type LogLevel = z.infer<typeof LogLevelSchema>;
5
18
  /** Target can be either an HTMLElement reference or a CSS selector string. */
6
19
  export type ObserverTarget = HTMLElement | string;
7
20
  /** Callback invoked when an observed element enters the viewport. */
@@ -19,10 +32,7 @@ export interface ObserverEntry {
19
32
  targets: Set<HTMLElement>;
20
33
  }
21
34
  /** Internal registry entry for lazy loading configurations. */
22
- export interface LazyLoaderEntry {
23
- selector: string;
24
- observerKey: string;
25
- }
35
+ export type LazyLoaderEntry = z.infer<typeof LazyLoaderEntrySchema>;
26
36
  /** Contract of the DOM facade. */
27
37
  export interface IDomService {
28
38
  useIsBrowser(): boolean;
@@ -51,11 +61,7 @@ export interface IDomService {
51
61
  useRemove(target: Element | string): void;
52
62
  }
53
63
  /** Represents a geographic position with latitude, longitude and accuracy. */
54
- export interface GeoPosition {
55
- lat: number;
56
- lng: number;
57
- accuracy: number;
58
- }
64
+ export type GeoPosition = z.infer<typeof GeoPositionSchema>;
59
65
  /** Type for the experimental Battery API. */
60
66
  export interface BatteryManager extends EventTarget {
61
67
  charging: boolean;
@@ -73,7 +79,7 @@ export interface WorkerPoolEntry<TInput = unknown, TOutput = unknown> {
73
79
  cleanup: () => void;
74
80
  }>;
75
81
  }
76
- export type StorageTarget = "localStorage" | "sessionStorage";
82
+ export type StorageTarget = z.infer<typeof StorageTargetSchema>;
77
83
  /** Strategy contract: homogeneous storage without `any`. */
78
84
  export interface StorageStrategy {
79
85
  useGetItem<T = unknown>(key: string): T | null;
@@ -81,28 +87,28 @@ export interface StorageStrategy {
81
87
  useRemoveItem(key: string): void;
82
88
  useClear(): void;
83
89
  }
84
- export type Locale = "en" | "es" | "fr" | "de" | "it" | "pt" | "ja" | "zh";
85
- export type Currency = "EUR" | "USD" | "GBP" | "JPY" | "CAD" | "MXN" | "CHF" | "AUD" | "BRL" | "CNY" | "ARS" | "COP" | "CLP";
86
- export interface CurrencyFormatOptions {
87
- amount: number;
88
- currency?: Currency;
89
- /**
90
- * Tax rate: percentage when `> 1` (e.g. `21` → 21%), or decimal fraction
91
- * when in `(0, 1]` (e.g. `0.21` → 21%). Prefer a fraction for rates ≤ 1%.
92
- */
93
- taxes?: number;
94
- locale?: Locale;
95
- }
96
- export interface NumberFormatOptions {
97
- locale?: Locale;
98
- digits?: number;
99
- }
90
+ /** Text encodings accepted by the filesystem helpers. */
91
+ export type FileEncoding = z.infer<typeof FileEncodingSchema>;
92
+ /** Hash algorithms supported by `useHashFile` / `useVerifyFileHash`. */
93
+ export type FileHashAlgorithm = z.infer<typeof FileHashAlgorithmSchema>;
94
+ /** Safe error from a filesystem operation (`NodeJS.ErrnoException`-shaped). */
95
+ export type FilesystemError = z.infer<typeof FilesystemErrorSchema>;
96
+ /** Safe Result for filesystem operations: `{ data, error, ok }`, never throws. */
97
+ export type FilesystemResult<T> = SafeResult<T, FilesystemError>;
98
+ /** Portable stats subset returned by `useGetFileStats`. */
99
+ export type FileStats = z.infer<typeof FileStatsSchema>;
100
+ /** A single directory entry returned by `useReadDir`. */
101
+ export type ReadDirEntry = z.infer<typeof ReadDirEntrySchema>;
102
+ /** Options for `useReadDir`. */
103
+ export type ReadDirOptions = z.infer<typeof ReadDirOptionsSchema>;
104
+ /** Options for `useWriteFile` / `useAppendFile`. */
105
+ export type WriteFileOptions = z.infer<typeof WriteFileOptionsSchema>;
106
+ export type Locale = z.infer<typeof LocaleSchema>;
107
+ export type Currency = z.infer<typeof CurrencySchema>;
108
+ export type CurrencyFormatOptions = z.infer<typeof CurrencyFormatOptionsSchema>;
109
+ export type NumberFormatOptions = z.infer<typeof NumberFormatOptionsSchema>;
100
110
  export type TemporalInput = string | number | Date | Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime | Temporal.Instant;
101
- export interface AppDateFormatOptions {
102
- year?: "numeric" | "2-digit";
103
- month?: "numeric" | "2-digit" | "long" | "short" | "narrow";
104
- day?: "numeric" | "2-digit";
105
- }
111
+ export type AppDateFormatOptions = z.infer<typeof AppDateFormatOptionsSchema>;
106
112
  /** Backwards-compatible alias for {@link AppDateFormatOptions}. */
107
113
  export type DateFormatOptions = AppDateFormatOptions;
108
114
  /** Contract of the dates facade. */
@@ -119,7 +125,7 @@ export interface DatesServiceTypes {
119
125
  useFirstDayOfMonth(date?: string | Temporal.PlainDate): string;
120
126
  useLastDayOfMonth(date?: string | Temporal.PlainDate): string;
121
127
  }
122
- export type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
128
+ export type HttpMethod = z.infer<typeof HttpMethodSchema>;
123
129
  export type QueryParams = Record<string, string | number | boolean | undefined | null>;
124
130
  export type PathParams = Record<string, string | number>;
125
131
  export interface UrlOptions {
@@ -138,11 +144,22 @@ export interface FetchOptions extends RequestInit {
138
144
  urlOptions?: UrlOptions;
139
145
  }
140
146
  /** Structure of the safe error returned on non-2xx or network failures. */
141
- export interface ApiError {
142
- message: string;
143
- status: number;
144
- details?: unknown;
145
- }
147
+ export type ApiError = z.infer<typeof ApiErrorSchema>;
148
+ /**
149
+ * Generic Safe Result discriminated union (Astro Actions style): the `ok` flag
150
+ * narrows between the success and error branches and nothing is thrown.
151
+ *
152
+ * Domain results below are aliases of this shape with a specific error type.
153
+ */
154
+ export type SafeResult<T, E = ApiError> = {
155
+ data: T;
156
+ error: null;
157
+ ok: true;
158
+ } | {
159
+ data: null;
160
+ error: E;
161
+ ok: false;
162
+ };
146
163
  /**
147
164
  * Safe result, discriminated union (Astro Actions style) without throwing.
148
165
  * The `ok` flag narrows the union between the success and error branches.
@@ -178,10 +195,7 @@ export interface IFetchApiManager {
178
195
  useDelete<T = unknown>(apiName: string, endpointName: string, urlOptions?: UrlOptions): Promise<FetchResult<T>>;
179
196
  }
180
197
  /** Serialized error shape. */
181
- export interface ISerializedError {
182
- message: string;
183
- code: number;
184
- }
198
+ export type ISerializedError = z.infer<typeof SerializedErrorSchema>;
185
199
  /** Contract of the formatter facade. */
186
200
  export interface IFormatterService {
187
201
  useCapitalize(text: string, locale?: Locale): string;
@@ -213,12 +227,10 @@ export interface ICryptoStrategy {
213
227
  export interface IUuidStrategy {
214
228
  useGenerate(): string;
215
229
  }
230
+ /** Generic fake vehicle returned by `useFakeVehicle`. */
231
+ export type FakeVehicle = z.infer<typeof FakeVehicleSchema>;
216
232
  /** Options for number formatting in geometry calculations. */
217
- export interface GeometryFormatOptions {
218
- locale?: string;
219
- digits?: number;
220
- unit?: string;
221
- }
233
+ export type GeometryFormatOptions = z.infer<typeof GeometryFormatOptionsSchema>;
222
234
  export type SignalListener<T> = (newValue: T, oldValue: T) => void;
223
235
  export interface Subscribable<T> {
224
236
  useSubscribe: (listener: SignalListener<T>) => () => void;
@@ -281,22 +293,16 @@ export interface IAppUtils {
281
293
  readonly system: ISystemUtils;
282
294
  }
283
295
  /** Represents viewport dimensions. */
284
- export interface ViewportSize {
285
- width: number;
286
- height: number;
287
- }
296
+ export type ViewportSize = z.infer<typeof ViewportSizeSchema>;
288
297
  /** Represents scroll position. */
289
- export interface ScrollPosition {
290
- x: number;
291
- y: number;
292
- }
298
+ export type ScrollPosition = z.infer<typeof ScrollPositionSchema>;
293
299
  /** Options for scrolling operations. */
294
300
  export interface ScrollOptions {
295
301
  behavior?: ScrollBehavior;
296
302
  block?: ScrollLogicalPosition;
297
303
  inline?: ScrollLogicalPosition;
298
304
  }
299
- export type ThemeMode = "light" | "dark" | "system";
305
+ export type ThemeMode = z.infer<typeof ThemeModeSchema>;
300
306
  export interface ThemeOptions {
301
307
  defaultMode?: ThemeMode;
302
308
  storageKey?: string;
@@ -337,21 +343,9 @@ export interface PaginationProps<T> {
337
343
  currentPage: number;
338
344
  totalPages: number;
339
345
  }
340
- export interface AstroServiceError {
341
- message: string;
342
- collectionName?: string;
343
- details?: unknown;
344
- }
346
+ export type AstroServiceError = z.infer<typeof AstroServiceErrorSchema>;
345
347
  /** Safe Result (discriminated union without throwing). */
346
- export type AstroServiceResult<T> = {
347
- data: T;
348
- error: null;
349
- ok: true;
350
- } | {
351
- data: null;
352
- error: AstroServiceError;
353
- ok: false;
354
- };
348
+ export type AstroServiceResult<T> = SafeResult<T, AstroServiceError>;
355
349
  /** Contract of the Astro facade. */
356
350
  export interface IAstroService {
357
351
  usePathsFrom<T, TParam extends string = "slug", TProps = T>(items: T[], options?: PathsOptions<T, TParam, TProps>): AstroPath<TParam, TProps>[];
@@ -362,60 +356,14 @@ export interface IAstroService {
362
356
  useExtractUniqueValues<T, V>(items: T[], keyFrom: (item: T) => V | V[]): V[];
363
357
  }
364
358
  /** A single item in an RSS feed. */
365
- export interface RssItem {
366
- /** Title of the item. */
367
- title: string;
368
- /** Publication date (Date object or ISO string). */
369
- pubDate: Date | string;
370
- /** URL of the item (relative to site, e.g. "/blog/my-post/"). */
371
- link: string;
372
- /** Optional description or excerpt. */
373
- description?: string;
374
- /** Optional full content (HTML allowed). */
375
- content?: string;
376
- /** Optional categories/tags. */
377
- categories?: string[];
378
- /** Optional author name. */
379
- author?: string;
380
- /** Optional custom data (e.g. enclosure for podcasts). */
381
- customData?: string;
382
- }
359
+ export type RssItem = z.infer<typeof RssItemSchema>;
383
360
  /** Configuration for generating an RSS feed. */
384
- export interface RssConfig {
385
- /** Title of the feed (e.g. "My Blog"). */
386
- title: string;
387
- /** Description of the feed. */
388
- description: string;
389
- /** Base URL of the site (e.g. "https://example.com"). */
390
- site: string;
391
- /** Feed items. */
392
- items: RssItem[];
393
- /** Output path (default: "/rss.xml"). */
394
- xmlPath?: string;
395
- /** Language code (default: "en"). */
396
- language?: string;
397
- /** Custom XML to inject into the `<channel>` element. */
398
- customData?: string;
399
- /** XSL stylesheet URL for browser rendering (optional). */
400
- xslUrl?: string;
401
- /** Whether to include the `<lastBuildDate>` (default: true). */
402
- lastBuildDate?: boolean;
403
- /** Trailing slash behavior for item links (default: true). */
404
- trailingSlash?: boolean;
405
- }
361
+ export type RssConfig = z.infer<typeof RssConfigSchema>;
406
362
  /** Result of an RSS generation attempt. */
407
- export type RssResult = {
408
- data: string;
409
- error: null;
410
- ok: true;
411
- } | {
412
- data: null;
413
- error: {
414
- message: string;
415
- details?: unknown;
416
- };
417
- ok: false;
418
- };
363
+ export type RssResult = SafeResult<string, {
364
+ message: string;
365
+ details?: unknown;
366
+ }>;
419
367
  /** Contract of the RSS facade. */
420
368
  export interface IRssService {
421
369
  /** Generates the RSS XML string from a config. */
@@ -434,37 +382,18 @@ export interface IRssService {
434
382
  }) => Promise<Response>;
435
383
  }
436
384
  /** Role of a chat message in the OpenAI-compatible protocol. */
437
- export type AiRole = "system" | "user" | "assistant" | "tool";
385
+ export type AiRole = z.infer<typeof AiRoleSchema>;
438
386
  /** Function invocation requested by the model when using tools. */
439
- export interface AiFunctionCall {
440
- name: string;
441
- arguments: string;
442
- }
387
+ export type AiFunctionCall = z.infer<typeof AiFunctionCallSchema>;
443
388
  /** A single tool call emitted by the model (OpenAI-compatible wire shape). */
444
- export interface AiToolCall {
445
- id: string;
446
- type: "function";
447
- function: AiFunctionCall;
448
- }
389
+ export type AiToolCall = z.infer<typeof AiToolCallSchema>;
449
390
  /**
450
391
  * A chat message. `tool_calls` and `tool_call_id` use snake_case on purpose:
451
392
  * they mirror the OpenAI-compatible protocol so messages pass through unchanged.
452
393
  */
453
- export interface AiMessage {
454
- role: AiRole;
455
- content: string | null;
456
- tool_calls?: AiToolCall[];
457
- tool_call_id?: string;
458
- name?: string;
459
- }
394
+ export type AiMessage = z.infer<typeof AiMessageSchema>;
460
395
  /** Provider configuration for an OpenAI-compatible chat/agent endpoint. */
461
- export interface AiProviderConfig {
462
- apiKey: string;
463
- baseUrl: string;
464
- model: string;
465
- /** Default system prompt. Falls back to {@link KITT_SYSTEM_PROMPT}. */
466
- systemPrompt?: string;
467
- }
396
+ export type AiProviderConfig = z.infer<typeof AiProviderConfigSchema>;
468
397
  /** Options for a single chat completion. */
469
398
  export interface AiChatOptions {
470
399
  temperature?: number;
@@ -475,21 +404,9 @@ export interface AiChatOptions {
475
404
  systemPrompt?: string;
476
405
  }
477
406
  /** Safe error returned on non-2xx or network failures. */
478
- export interface AiError {
479
- message: string;
480
- status: number;
481
- details?: unknown;
482
- }
407
+ export type AiError = z.infer<typeof AiErrorSchema>;
483
408
  /** Safe result (discriminated union) without throwing. */
484
- export type AiResult<T = string> = {
485
- data: T;
486
- error: null;
487
- ok: true;
488
- } | {
489
- data: null;
490
- error: AiError;
491
- ok: false;
492
- };
409
+ export type AiResult<T = string> = SafeResult<T, AiError>;
493
410
  /**
494
411
  * A tool the agent can invoke. `parameters` is a JSON Schema object
495
412
  * describing the expected input.
@@ -501,15 +418,9 @@ export interface AiTool {
501
418
  execute(input: unknown): unknown | Promise<unknown>;
502
419
  }
503
420
  /** One round of tool execution inside the agent loop. */
504
- export interface AgentStep {
505
- toolCalls: AiToolCall[];
506
- toolResults: unknown[];
507
- }
421
+ export type AgentStep = z.infer<typeof AgentStepSchema>;
508
422
  /** Payload returned by a successful {@link useRunAgent} call. */
509
- export interface AgentData {
510
- finalMessage: string;
511
- steps: AgentStep[];
512
- }
423
+ export type AgentData = z.infer<typeof AgentDataSchema>;
513
424
  /** Safe result of an agent run. */
514
425
  export type AgentResult = AiResult<AgentData>;
515
426
  /** Options for running the tool-calling agent loop. */
@@ -545,10 +456,7 @@ export interface AssistantReplyOptions extends AiChatOptions {
545
456
  maxSteps?: number;
546
457
  }
547
458
  /** Payload returned by a successful assistant reply. */
548
- export interface AssistantReply {
549
- reply: string;
550
- sessionId: string;
551
- }
459
+ export type AssistantReply = z.infer<typeof AssistantReplySchema>;
552
460
  /** Safe result of an assistant reply. */
553
461
  export type AssistantResult = AiResult<AssistantReply>;
554
462
  /** Contract of the assistant facade. */
@@ -571,27 +479,20 @@ export interface IAssistantService {
571
479
  * - `member` — registered account; can use the assistant and read content.
572
480
  * - `guest` — anonymous default; read-only, never persisted.
573
481
  */
574
- export type AccessRole = "owner" | "admin" | "editor" | "author" | "member" | "guest";
482
+ export type AccessRole = z.infer<typeof AccessRoleSchema>;
575
483
  /**
576
484
  * Namespaced capabilities derived from the project domain.
577
485
  * Format: `<domain>:<action>[:<scope>]`.
578
486
  */
579
- export type AccessCapability = "content:create" | "content:publish" | "content:edit:own" | "content:edit:any" | "content:delete:own" | "content:delete:any" | "conversations:use" | "conversations:moderate" | "members:manage" | "roles:assign" | "system:admin";
487
+ export type AccessCapability = z.infer<typeof AccessCapabilitySchema>;
580
488
  /** A role definition: slug, human label and the capabilities it grants. */
581
- export interface AccessRoleDefinition {
582
- slug: AccessRole;
583
- label: string;
584
- capabilities: AccessCapability[];
585
- }
489
+ export type AccessRoleDefinition = z.infer<typeof AccessRoleDefinitionSchema>;
586
490
  /**
587
491
  * Structural subject for access checks. Decoupled from the persistence layer:
588
492
  * any object with an id and a role list can be checked (e.g. a Prisma
589
493
  * `Account` row, a JWT payload, or a test fixture).
590
494
  */
591
- export interface AccessSubject {
592
- id: string | number;
593
- roles: AccessRole[];
594
- }
495
+ export type AccessSubject = z.infer<typeof AccessSubjectSchema>;
595
496
  /** Contract of the access-control facade. Pure, no I/O. */
596
497
  export interface IAccessService {
597
498
  useCan(subject: AccessSubject, capability: AccessCapability): boolean;
@@ -619,12 +520,9 @@ export type WatchOptions = VueWatchOptions;
619
520
  /** Stop function taken from the native Vue `watch`. */
620
521
  export type WatchStopHandle = VueWatchStopHandle;
621
522
  /** A single field-level validation message keyed by field name. */
622
- export type FieldErrors = Record<string, string>;
623
- /** Minimal Zod-like issue shape (`error.issues` entries). */
624
- export interface ValidationIssue {
625
- path: (string | number)[];
626
- message: string;
627
- }
523
+ export type FieldErrors = z.infer<typeof FieldErrorsSchema>;
524
+ /** Minimal issue shape (`error.issues` entries). */
525
+ export type ValidationIssue = z.infer<typeof ValidationIssueSchema>;
628
526
  /** Minimal Zod-like success/failure result (`schema.safeParse`). */
629
527
  export type ValidationParseResult<T> = {
630
528
  success: true;
@@ -652,181 +550,29 @@ export interface ValidationSchema<T = unknown> {
652
550
  validateSync?: (data: unknown) => unknown;
653
551
  validate?: (data: unknown) => unknown | Promise<unknown>;
654
552
  }
655
- export type ProductType = {
656
- id: number;
657
- name: string;
658
- price: number;
659
- };
553
+ export type ProductType = z.infer<typeof ProductTypeSchema>;
660
554
  /** Configuration for the Notion API integration. */
661
- export interface NotionConfig {
662
- /** Notion integration token (starts with "ntn_" or "secret_"). */
663
- token: string;
664
- /** API version header (default: "2022-06-28"). */
665
- apiVersion?: string;
666
- /** Custom base URL (default: "https://api.notion.com/v1"). */
667
- apiBaseUrl?: string;
668
- }
555
+ export type NotionConfig = z.infer<typeof NotionConfigSchema>;
669
556
  /** Rich text object used in Notion blocks and properties. */
670
- export interface NotionRichText {
671
- type: "text";
672
- text: {
673
- content: string;
674
- link?: {
675
- url: string;
676
- } | null;
677
- };
678
- annotations?: {
679
- bold?: boolean;
680
- italic?: boolean;
681
- strikethrough?: boolean;
682
- underline?: boolean;
683
- code?: boolean;
684
- color?: string;
685
- };
686
- plain_text?: string;
687
- href?: string | null;
688
- }
557
+ export type NotionRichText = z.infer<typeof NotionRichTextSchema>;
689
558
  /** A Notion page object. */
690
- export interface NotionPage {
691
- object: "page";
692
- id: string;
693
- created_time: string;
694
- last_edited_time: string;
695
- created_by: {
696
- object: "user";
697
- id: string;
698
- };
699
- last_edited_by: {
700
- object: "user";
701
- id: string;
702
- };
703
- parent: NotionParent;
704
- archived: boolean;
705
- url: string;
706
- properties: Record<string, NotionProperty>;
707
- icon?: NotionIcon | null;
708
- cover?: NotionCover | null;
709
- }
559
+ export type NotionPage = z.infer<typeof NotionPageSchema>;
710
560
  /** Parent reference for pages and databases. */
711
- export type NotionParent = {
712
- type: "database_id";
713
- database_id: string;
714
- } | {
715
- type: "page_id";
716
- page_id: string;
717
- } | {
718
- type: "workspace";
719
- workspace: true;
720
- };
561
+ export type NotionParent = z.infer<typeof NotionParentSchema>;
721
562
  /** Property value on a Notion page. */
722
- export interface NotionProperty {
723
- id?: string;
724
- type: string;
725
- title?: NotionRichText[];
726
- rich_text?: NotionRichText[];
727
- number?: number;
728
- select?: {
729
- id: string;
730
- name: string;
731
- color?: string;
732
- } | null;
733
- multi_select?: Array<{
734
- id: string;
735
- name: string;
736
- color?: string;
737
- }>;
738
- date?: {
739
- start: string;
740
- end?: string | null;
741
- } | null;
742
- checkbox?: boolean;
743
- url?: string | null;
744
- email?: string | null;
745
- phone_number?: string | null;
746
- formula?: {
747
- type: string;
748
- string?: string;
749
- number?: number;
750
- boolean?: boolean;
751
- };
752
- relation?: Array<{
753
- id: string;
754
- }>;
755
- rollup?: {
756
- type: string;
757
- number?: number;
758
- };
759
- status?: {
760
- id: string;
761
- name: string;
762
- color?: string;
763
- } | null;
764
- [key: string]: unknown;
765
- }
563
+ export type NotionProperty = z.infer<typeof NotionPropertyValueSchema>;
766
564
  /** Icon on a page or database (emoji or file). */
767
- export type NotionIcon = {
768
- type: "emoji";
769
- emoji: string;
770
- } | {
771
- type: "file";
772
- file: {
773
- url: string;
774
- };
775
- };
565
+ export type NotionIcon = z.infer<typeof NotionIconSchema>;
776
566
  /** Cover image on a page. */
777
- export type NotionCover = {
778
- type: "external";
779
- external: {
780
- url: string;
781
- };
782
- } | {
783
- type: "file";
784
- file: {
785
- url: string;
786
- };
787
- };
567
+ export type NotionCover = z.infer<typeof NotionCoverSchema>;
788
568
  /** A Notion block object. */
789
- export interface NotionBlock {
790
- object: "block";
791
- id: string;
792
- type: string;
793
- created_time?: string;
794
- last_edited_time?: string;
795
- has_children?: boolean;
796
- archived?: boolean;
797
- [key: string]: unknown;
798
- }
569
+ export type NotionBlock = z.infer<typeof NotionBlockSchema>;
799
570
  /** Result of listing block children (paginated). */
800
- export interface NotionBlockList {
801
- object: "list";
802
- results: NotionBlock[];
803
- has_more: boolean;
804
- next_cursor: string | null;
805
- type: "block";
806
- block: Record<string, unknown>;
807
- }
571
+ export type NotionBlockList = z.infer<typeof NotionBlockListSchema>;
808
572
  /** A Notion database object. */
809
- export interface NotionDatabase {
810
- object: "database";
811
- id: string;
812
- created_time: string;
813
- last_edited_time: string;
814
- title: NotionRichText[];
815
- description: NotionRichText[];
816
- parent: NotionParent;
817
- url: string;
818
- icon?: NotionIcon | null;
819
- cover?: NotionCover | null;
820
- properties: Record<string, NotionPropertySchema>;
821
- archived?: boolean;
822
- }
573
+ export type NotionDatabase = z.infer<typeof NotionDatabaseSchema>;
823
574
  /** Schema definition for a database property. */
824
- export interface NotionPropertySchema {
825
- id?: string;
826
- name?: string;
827
- type: string;
828
- [key: string]: unknown;
829
- }
575
+ export type NotionPropertySchema = z.infer<typeof NotionPropertySchemaSchema>;
830
576
  /** Filter for querying a Notion database. */
831
577
  export interface NotionFilter {
832
578
  and?: NotionFilter[];
@@ -835,71 +581,19 @@ export interface NotionFilter {
835
581
  [key: string]: unknown;
836
582
  }
837
583
  /** Sort option for querying a Notion database. */
838
- export interface NotionSort {
839
- property?: string;
840
- timestamp?: "created_time" | "last_edited_time";
841
- direction: "ascending" | "descending";
842
- }
584
+ export type NotionSort = z.infer<typeof NotionSortSchema>;
843
585
  /** Query options for a Notion database. */
844
- export interface NotionDatabaseQuery {
845
- filter?: NotionFilter;
846
- sorts?: NotionSort[];
847
- start_cursor?: string;
848
- page_size?: number;
849
- }
586
+ export type NotionDatabaseQuery = z.infer<typeof NotionDatabaseQuerySchema>;
850
587
  /** Result of querying a Notion database (paginated). */
851
- export interface NotionPageList {
852
- object: "list";
853
- results: NotionPage[];
854
- has_more: boolean;
855
- next_cursor: string | null;
856
- type: "page";
857
- page: Record<string, unknown>;
858
- }
588
+ export type NotionPageList = z.infer<typeof NotionPageListSchema>;
859
589
  /** A Notion user object. */
860
- export interface NotionUser {
861
- object: "user";
862
- id: string;
863
- type: "person" | "bot";
864
- name?: string;
865
- avatar_url?: string;
866
- person?: {
867
- email?: string;
868
- };
869
- bot?: {
870
- owner: {
871
- type: string;
872
- };
873
- };
874
- }
590
+ export type NotionUser = z.infer<typeof NotionUserSchema>;
875
591
  /** Paginated list of Notion users. */
876
- export interface NotionUserList {
877
- object: "list";
878
- results: NotionUser[];
879
- has_more: boolean;
880
- next_cursor: string | null;
881
- }
592
+ export type NotionUserList = z.infer<typeof NotionUserListSchema>;
882
593
  /** Search query options for the Notion API. */
883
- export interface NotionSearchQuery {
884
- query?: string;
885
- filter?: {
886
- value: "database" | "page";
887
- property: "object";
888
- };
889
- sort?: {
890
- direction: "ascending" | "descending";
891
- timestamp: "last_edited_time";
892
- };
893
- start_cursor?: string;
894
- page_size?: number;
895
- }
594
+ export type NotionSearchQuery = z.infer<typeof NotionSearchQuerySchema>;
896
595
  /** Result of a Notion search (paginated). */
897
- export interface NotionSearchResult {
898
- object: "list";
899
- results: Array<NotionPage | NotionDatabase>;
900
- has_more: boolean;
901
- next_cursor: string | null;
902
- }
596
+ export type NotionSearchResult = z.infer<typeof NotionSearchResultSchema>;
903
597
  /** Contract of the Notion adapter facade. */
904
598
  export interface INotionService {
905
599
  useInitNotion(config: NotionConfig): void;
@@ -929,366 +623,60 @@ export interface INotionService {
929
623
  useNotionListAllDatabasePages(databaseId: string, filter?: NotionFilter, sorts?: NotionSort[]): Promise<FetchResult<NotionPage[]>>;
930
624
  }
931
625
  /** Configuration for the WordPress REST API integration. */
932
- export interface WordPressConfig {
933
- /** WordPress site base URL (e.g. "https://mysite.com"). */
934
- baseUrl: string;
935
- /** Authentication credentials (choose one method). */
936
- auth?: WordPressAuth;
937
- /** Custom API namespace (default: "wp/v2"). */
938
- apiNamespace?: string;
939
- }
626
+ export type WordPressConfig = z.infer<typeof WordPressConfigSchema>;
940
627
  /** Authentication methods for WordPress. */
941
- export type WordPressAuth = {
942
- type: "application-passwords";
943
- username: string;
944
- password: string;
945
- } | {
946
- type: "jwt";
947
- token: string;
948
- } | {
949
- type: "basic";
950
- username: string;
951
- password: string;
952
- } | {
953
- type: "nonce";
954
- nonce: string;
955
- cookie: string;
956
- };
628
+ export type WordPressAuth = z.infer<typeof WordPressAuthSchema>;
957
629
  /** Base fields shared by all WordPress entities. */
958
- export interface WpBaseEntity {
959
- id: number;
960
- date: string;
961
- date_gmt: string;
962
- modified: string;
963
- modified_gmt: string;
964
- slug: string;
965
- status: string;
966
- link: string;
967
- }
630
+ export type WpBaseEntity = z.infer<typeof WpBaseEntitySchema>;
968
631
  /** A WordPress post. */
969
- export interface WpPost extends WpBaseEntity {
970
- title: {
971
- rendered: string;
972
- };
973
- content: {
974
- rendered: string;
975
- protected: boolean;
976
- };
977
- excerpt: {
978
- rendered: string;
979
- protected: boolean;
980
- };
981
- author: number;
982
- featured_media: number;
983
- comment_status: string;
984
- ping_status: string;
985
- sticky: boolean;
986
- template: string;
987
- format: string;
988
- categories: number[];
989
- tags: number[];
990
- meta: Record<string, unknown>;
991
- /** ACF (Advanced Custom Fields) data. Available when using ACF plugin. */
992
- acf?: WpAcfFields;
993
- /** Embedded resources (author, featured media, terms). Available when using `_embed`. */
994
- _embedded?: WpEmbedded;
995
- }
632
+ export type WpPost = z.infer<typeof WpPostSchema>;
996
633
  /** Payload for creating a WordPress post. */
997
- export interface WpPostCreate {
998
- title: string;
999
- content?: string;
1000
- excerpt?: string;
1001
- author?: number;
1002
- featured_media?: number;
1003
- comment_status?: "open" | "closed";
1004
- ping_status?: "open" | "closed";
1005
- sticky?: boolean;
1006
- format?: string;
1007
- categories?: number[];
1008
- tags?: number[];
1009
- meta?: Record<string, unknown>;
1010
- status?: "publish" | "future" | "draft" | "pending" | "private";
1011
- slug?: string;
1012
- date?: string;
1013
- template?: string;
1014
- }
634
+ export type WpPostCreate = z.infer<typeof WpPostCreateSchema>;
1015
635
  /** Payload for updating a WordPress post. */
1016
- export type WpPostUpdate = Partial<WpPostCreate>;
636
+ export type WpPostUpdate = z.infer<typeof WpPostUpdateSchema>;
1017
637
  /** A WordPress page. */
1018
- export interface WpPage extends WpBaseEntity {
1019
- title: {
1020
- rendered: string;
1021
- };
1022
- content: {
1023
- rendered: string;
1024
- protected: boolean;
1025
- };
1026
- excerpt: {
1027
- rendered: string;
1028
- protected: boolean;
1029
- };
1030
- author: number;
1031
- featured_media: number;
1032
- parent: number;
1033
- menu_order: number;
1034
- comment_status: string;
1035
- ping_status: string;
1036
- template: string;
1037
- meta: Record<string, unknown>;
1038
- /** ACF (Advanced Custom Fields) data. Available when using ACF plugin. */
1039
- acf?: WpAcfFields;
1040
- /** Embedded resources (author, featured media). Available when using `_embed`. */
1041
- _embedded?: WpEmbedded;
1042
- }
638
+ export type WpPage = z.infer<typeof WpPageSchema>;
1043
639
  /** Payload for creating a WordPress page. */
1044
- export interface WpPageCreate {
1045
- title: string;
1046
- content?: string;
1047
- excerpt?: string;
1048
- author?: number;
1049
- featured_media?: number;
1050
- parent?: number;
1051
- menu_order?: number;
1052
- comment_status?: "open" | "closed";
1053
- ping_status?: "open" | "closed";
1054
- status?: "publish" | "future" | "draft" | "pending" | "private";
1055
- slug?: string;
1056
- date?: string;
1057
- template?: string;
1058
- meta?: Record<string, unknown>;
1059
- }
640
+ export type WpPageCreate = z.infer<typeof WpPageCreateSchema>;
1060
641
  /** Payload for updating a WordPress page. */
1061
- export type WpPageUpdate = Partial<WpPageCreate>;
642
+ export type WpPageUpdate = z.infer<typeof WpPageUpdateSchema>;
1062
643
  /** A WordPress media item (attachment). */
1063
- export interface WpMedia extends WpBaseEntity {
1064
- title: {
1065
- rendered: string;
1066
- };
1067
- author: number;
1068
- media_type: string;
1069
- mime_type: string;
1070
- media_details: {
1071
- width?: number;
1072
- height?: number;
1073
- file?: string;
1074
- /** File size in bytes. */
1075
- filesize?: number;
1076
- /** Image metadata from EXIF data. */
1077
- image_meta?: {
1078
- aperture?: string;
1079
- credit?: string;
1080
- camera?: string;
1081
- caption?: string;
1082
- created_timestamp?: string;
1083
- copyright?: string;
1084
- focal_length?: string;
1085
- iso?: string;
1086
- orientation?: string;
1087
- shutter_speed?: string;
1088
- title?: string;
1089
- [key: string]: unknown;
1090
- };
1091
- sizes?: Record<string, {
1092
- source_url: string;
1093
- file: string;
1094
- width: number;
1095
- height: number;
1096
- mime_type: string;
1097
- filesize?: number;
1098
- }>;
1099
- };
1100
- source_url: string;
1101
- alt_text: string;
1102
- caption: {
1103
- rendered: string;
1104
- };
1105
- description: {
1106
- rendered: string;
1107
- };
1108
- post: number | null;
1109
- meta: Record<string, unknown>;
1110
- /** ACF (Advanced Custom Fields) data. Available when using ACF plugin. */
1111
- acf?: WpAcfFields;
1112
- /** Embedded resources (author, post). Available when using `_embed`. */
1113
- _embedded?: WpEmbedded;
1114
- }
644
+ export type WpMedia = z.infer<typeof WpMediaSchema>;
1115
645
  /** Metadata for a media upload. */
1116
- export interface WpMediaMeta {
1117
- title?: string;
1118
- alt_text?: string;
1119
- caption?: string;
1120
- description?: string;
1121
- post?: number;
1122
- slug?: string;
1123
- }
646
+ export type WpMediaMeta = z.infer<typeof WpMediaMetaSchema>;
1124
647
  /** Payload for updating a WordPress media item. */
1125
- export interface WpMediaUpdate extends Partial<WpMediaMeta> {
1126
- status?: string;
1127
- }
648
+ export type WpMediaUpdate = z.infer<typeof WpMediaUpdateSchema>;
1128
649
  /** A WordPress category. */
1129
- export interface WpCategory {
1130
- id: number;
1131
- count: number;
1132
- description: string;
1133
- link: string;
1134
- name: string;
1135
- slug: string;
1136
- parent: number;
1137
- meta: Record<string, unknown>;
1138
- }
650
+ export type WpCategory = z.infer<typeof WpCategorySchema>;
1139
651
  /** Payload for creating a WordPress category. */
1140
- export interface WpCategoryCreate {
1141
- name: string;
1142
- description?: string;
1143
- slug?: string;
1144
- parent?: number;
1145
- meta?: Record<string, unknown>;
1146
- }
652
+ export type WpCategoryCreate = z.infer<typeof WpCategoryCreateSchema>;
1147
653
  /** Payload for updating a WordPress category. */
1148
- export type WpCategoryUpdate = Partial<WpCategoryCreate>;
654
+ export type WpCategoryUpdate = z.infer<typeof WpCategoryUpdateSchema>;
1149
655
  /** A WordPress tag. */
1150
- export interface WpTag {
1151
- id: number;
1152
- count: number;
1153
- description: string;
1154
- link: string;
1155
- name: string;
1156
- slug: string;
1157
- meta: Record<string, unknown>;
1158
- }
656
+ export type WpTag = z.infer<typeof WpTagSchema>;
1159
657
  /** Payload for creating a WordPress tag. */
1160
- export interface WpTagCreate {
1161
- name: string;
1162
- description?: string;
1163
- slug?: string;
1164
- meta?: Record<string, unknown>;
1165
- }
658
+ export type WpTagCreate = z.infer<typeof WpTagCreateSchema>;
1166
659
  /** Payload for updating a WordPress tag. */
1167
- export type WpTagUpdate = Partial<WpTagCreate>;
660
+ export type WpTagUpdate = z.infer<typeof WpTagUpdateSchema>;
1168
661
  /** A WordPress comment. */
1169
- export interface WpComment {
1170
- id: number;
1171
- post: number;
1172
- parent: number;
1173
- author: number;
1174
- author_name: string;
1175
- author_email: string;
1176
- author_url: string;
1177
- date: string;
1178
- date_gmt: string;
1179
- content: {
1180
- rendered: string;
1181
- };
1182
- link: string;
1183
- status: string;
1184
- type: string;
1185
- author_avatar_urls: Record<string, string>;
1186
- meta: Record<string, unknown>;
1187
- }
662
+ export type WpComment = z.infer<typeof WpCommentSchema>;
1188
663
  /** Payload for creating a WordPress comment. */
1189
- export interface WpCommentCreate {
1190
- post: number;
1191
- parent?: number;
1192
- content: string;
1193
- author?: number;
1194
- author_name?: string;
1195
- author_email?: string;
1196
- author_url?: string;
1197
- status?: string;
1198
- meta?: Record<string, unknown>;
1199
- }
664
+ export type WpCommentCreate = z.infer<typeof WpCommentCreateSchema>;
1200
665
  /** Payload for updating a WordPress comment. */
1201
- export type WpCommentUpdate = Partial<WpCommentCreate>;
666
+ export type WpCommentUpdate = z.infer<typeof WpCommentUpdateSchema>;
1202
667
  /** A WordPress user. */
1203
- export interface WpUser {
1204
- id: number;
1205
- username: string;
1206
- name: string;
1207
- first_name: string;
1208
- last_name: string;
1209
- email: string;
1210
- url: string;
1211
- description: string;
1212
- link: string;
1213
- locale: string;
1214
- nickname: string;
1215
- slug: string;
1216
- roles: string[];
1217
- avatar_urls: Record<string, string>;
1218
- meta: Record<string, unknown>;
1219
- }
668
+ export type WpUser = z.infer<typeof WpUserSchema>;
1220
669
  /** Payload for creating a WordPress user. */
1221
- export interface WpUserCreate {
1222
- username: string;
1223
- name?: string;
1224
- first_name?: string;
1225
- last_name?: string;
1226
- email: string;
1227
- url?: string;
1228
- description?: string;
1229
- locale?: string;
1230
- nickname?: string;
1231
- slug?: string;
1232
- roles?: string[];
1233
- password?: string;
1234
- meta?: Record<string, unknown>;
1235
- }
670
+ export type WpUserCreate = z.infer<typeof WpUserCreateSchema>;
1236
671
  /** Payload for updating a WordPress user. */
1237
- export type WpUserUpdate = Partial<WpUserCreate>;
1238
- /** Common query parameters for WordPress REST API list endpoints. */
1239
- export interface WpQueryParams {
1240
- /** Current page (default: 1). */
1241
- page?: number;
1242
- /** Items per page (default: 10, max: 100). */
1243
- per_page?: number;
1244
- /** Search term. */
1245
- search?: string;
1246
- /** Sort order. */
1247
- order?: "asc" | "desc";
1248
- /** Order by field. */
1249
- orderby?: string;
1250
- /** Offset for pagination. */
1251
- offset?: number;
1252
- /** Include specific IDs. */
1253
- include?: number[];
1254
- /** Exclude specific IDs. */
1255
- exclude?: number[];
1256
- /** Filter by slug. */
1257
- slug?: string;
1258
- /** Filter by status. */
1259
- status?: string | string[];
1260
- /** Filter by author. */
1261
- author?: number | number[];
1262
- /** Filter by categories. */
1263
- categories?: number | number[];
1264
- /** Filter by tags. */
1265
- tags?: number | number[];
1266
- /**
1267
- * Limit response fields to reduce payload size.
1268
- * Use comma-separated field names: "id,title,link" or nested: "id,title.rendered,acf.custom_field".
1269
- * Reduces response size by 60-80% — essential for list views.
1270
- *
1271
- * @example
1272
- * ```ts
1273
- * useWpGetPosts({ _fields: "id,title,link,slug,date" });
1274
- * useWpGetPosts({ _fields: "id,title.rendered,acf.hero_image,acf.subtitle" }); // with ACF
1275
- * ```
1276
- */
1277
- _fields?: string;
1278
- /**
1279
- * Embed related resources in the response (author, featured media, terms, replies).
1280
- * Accepts `true` to embed all, or comma-separated resource names.
1281
- *
1282
- * @example
1283
- * ```ts
1284
- * useWpGetPosts({ _embed: true }); // embed all
1285
- * useWpGetPosts({ _embed: "author,wp:featuredmedia" }); // embed specific
1286
- * ```
1287
- */
1288
- _embed?: boolean | string;
1289
- /** Custom query params. */
1290
- [key: string]: unknown;
1291
- }
672
+ export type WpUserUpdate = z.infer<typeof WpUserUpdateSchema>;
673
+ /**
674
+ * Common query parameters for WordPress REST API list endpoints.
675
+ *
676
+ * Includes field limiting (`_fields: "id,title,link"`) and resource
677
+ * embedding (`_embed: true | "author,wp:featuredmedia"`).
678
+ */
679
+ export type WpQueryParams = z.infer<typeof WpQueryParamsSchema>;
1292
680
  /**
1293
681
  * Container for ACF (Advanced Custom Fields) fields on a WordPress entity.
1294
682
  *
@@ -1305,9 +693,7 @@ export interface WpQueryParams {
1305
693
  * }
1306
694
  * ```
1307
695
  */
1308
- export interface WpAcfFields {
1309
- [key: string]: unknown;
1310
- }
696
+ export type WpAcfFields = z.infer<typeof WpAcfFieldsSchema>;
1311
697
  /**
1312
698
  * Embedded resources returned by WordPress when `_embed` is used.
1313
699
  *
@@ -1325,56 +711,11 @@ export interface WpAcfFields {
1325
711
  * }
1326
712
  * ```
1327
713
  */
1328
- export interface WpEmbedded {
1329
- author?: Array<{
1330
- id: number;
1331
- name: string;
1332
- url: string;
1333
- description: string;
1334
- link: string;
1335
- slug: string;
1336
- avatar_urls: Record<string, string>;
1337
- acf?: WpAcfFields;
1338
- [key: string]: unknown;
1339
- }>;
1340
- "wp:featuredmedia"?: WpMedia[];
1341
- "wp:term"?: Array<Array<{
1342
- id: number;
1343
- name: string;
1344
- slug: string;
1345
- _taxonomy: string;
1346
- link: string;
1347
- count?: number;
1348
- [key: string]: unknown;
1349
- }>>;
1350
- replies?: Array<Array<{
1351
- id: number;
1352
- parent: number;
1353
- author: number;
1354
- author_name: string;
1355
- content: {
1356
- rendered: string;
1357
- };
1358
- date: string;
1359
- [key: string]: unknown;
1360
- }>>;
1361
- [key: string]: unknown;
1362
- }
714
+ export type WpEmbedded = z.infer<typeof WpEmbeddedSchema>;
1363
715
  /** A batch operation for the WordPress REST API. */
1364
- export interface WpBatchOperation {
1365
- method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
1366
- path: string;
1367
- body?: Record<string, unknown>;
1368
- }
716
+ export type WpBatchOperation = z.infer<typeof WpBatchOperationSchema>;
1369
717
  /** Result of a WordPress batch operation. */
1370
- export interface WpBatchResult {
1371
- /** Responses for each operation in the batch. */
1372
- responses: Array<{
1373
- status: number;
1374
- body: unknown;
1375
- headers: Record<string, string>;
1376
- }>;
1377
- }
718
+ export type WpBatchResult = z.infer<typeof WpBatchResultSchema>;
1378
719
  /** Contract of the WordPress adapter facade. */
1379
720
  export interface IWordPressService {
1380
721
  useInitWordPress(config: WordPressConfig): void;
@@ -1424,4 +765,54 @@ export interface IWordPressService {
1424
765
  useWpSearchAllPosts(query: string, options?: WpQueryParams): Promise<FetchResult<WpPost[]>>;
1425
766
  useWpFindPostBySlug(slug: string): Promise<FetchResult<WpPost | null>>;
1426
767
  }
768
+ /**
769
+ * Config for the InsForge adapter. InsForge is the database fallback
770
+ * (primary data layer is Cloudflare); storage and edge functions
771
+ * are also available through the same client.
772
+ */
773
+ export type IfConfig = z.infer<typeof IfConfigSchema>;
774
+ /** Sort clause for table queries. */
775
+ export type IfOrder = z.infer<typeof IfOrderSchema>;
776
+ /** Options for a table read. Filters map to equality clauses. */
777
+ export type IfTableQuery = z.infer<typeof IfTableQuerySchema>;
778
+ /** Rows for insert (one or many). */
779
+ export type IfInsertRows = z.infer<typeof IfInsertRowsSchema>;
780
+ /** Patch for update (must be paired with filters — mass updates are refused). */
781
+ export type IfUpdatePatch = z.infer<typeof IfUpdatePatchSchema>;
782
+ /** Options for an update or delete. Filters are REQUIRED (no mass writes). */
783
+ export type IfWriteQuery = z.infer<typeof IfWriteQuerySchema>;
784
+ /** Postgres function (RPC) call. */
785
+ export type IfRpcCall = z.infer<typeof IfRpcCallSchema>;
786
+ /** Bucket + object key reference for storage operations. */
787
+ export type IfStorageRef = z.infer<typeof IfStorageRefSchema>;
788
+ /** Options for listing bucket objects. */
789
+ export type IfListOptions = z.infer<typeof IfListOptionsSchema>;
790
+ /** Edge function invocation. */
791
+ export type IfInvokeOptions = z.infer<typeof IfInvokeOptionsSchema>;
792
+ /** Where a media source comes from. `file` = direct mp4/webm (native `<video>`). */
793
+ export type MediaProvider = z.infer<typeof MediaProviderSchema>;
794
+ /** Normalized media source: provider + stable id or direct src. */
795
+ export type MediaSource = z.infer<typeof MediaSourceSchema>;
796
+ /** Options for the YouTube nocookie embed URL. */
797
+ export type YoutubeEmbedOptions = z.infer<typeof YoutubeEmbedOptionsSchema>;
798
+ /** Thumbnail quality for `i.ytimg.com`. */
799
+ export type YoutubeThumbnailQuality = z.infer<typeof YoutubeThumbnailQualitySchema>;
800
+ /** Input for {@link useBuildVideoEmbed} (core) — one `src`, unified output. */
801
+ export type SmartVideoOptions = z.infer<typeof SmartVideoOptionsSchema>;
802
+ /** Config for the YouTube service. One GCP project serves all repos. */
803
+ export type YoutubeApiConfig = z.infer<typeof YoutubeApiConfigSchema>;
804
+ /** Params for {@link useGetChannelVideos}. */
805
+ export type YoutubeListParams = z.infer<typeof YoutubeListParamsSchema>;
806
+ /** Resolution-keyed thumbnails (all derivable without an API key). */
807
+ export type YoutubeVideoThumbnails = z.infer<typeof YoutubeVideoThumbnailsSchema>;
808
+ /** Normalized video, enriched with player-ready URLs. */
809
+ export type YoutubeVideoNormalized = z.infer<typeof YoutubeVideoNormalizedSchema>;
810
+ /** Paginated channel listing result. */
811
+ export type YoutubeVideoPage = z.infer<typeof YoutubeVideoPageSchema>;
812
+ /** Minimal `channels.list` shape (only what the service reads). */
813
+ export type YoutubeChannelsResponse = z.infer<typeof YoutubeChannelsResponseSchema>;
814
+ /** Minimal `playlistItems.list` shape (only what the service reads). */
815
+ export type YoutubePlaylistItemsResponse = z.infer<typeof YoutubePlaylistItemsResponseSchema>;
816
+ /** Minimal `videos.list` shape (only what the service reads). */
817
+ export type YoutubeVideosResponse = z.infer<typeof YoutubeVideosResponseSchema>;
1427
818
  //# sourceMappingURL=index.d.ts.map