@szymonpiatek/nextwordpress 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,209 +1,17 @@
1
- interface NextWordpressConfig {
2
- /** Used in server components / SSR (e.g., internal Docker hostname). */
3
- serverURL: string;
4
- /** Used in browser / client components (e.g., public domain). */
5
- clientURL: string;
6
- }
7
- interface WPEntity {
8
- id: number;
9
- date: string;
10
- date_gmt: string;
11
- modified: string;
12
- modified_gmt: string;
13
- slug: string;
14
- status: 'publish' | 'future' | 'draft' | 'pending' | 'private';
15
- link: string;
16
- guid: {
17
- rendered: string;
18
- };
19
- }
20
- interface RenderedContent {
21
- rendered: string;
22
- protected: boolean;
23
- }
24
- interface RenderedTitle {
25
- rendered: string;
26
- }
27
- interface Taxonomy {
28
- id: number;
29
- count: number;
30
- description: string;
31
- link: string;
32
- name: string;
33
- slug: string;
34
- meta: Record<string, unknown>;
35
- }
1
+ import { N as NextWordpressConfig, W as WordPressResponse, T as Taxonomy, h as WPEntity, R as RenderedTitle, i as RenderedContent, P as Post, A as Author, F as FeaturedMedia, a as WooCommerceConfig, d as WooCommerceResponse, j as WCImage, k as WCAddress, l as WCProductVariation, b as WCProduct, c as WCProductFilterParams, e as WPGraphQLConfig, g as GQLConnection, f as GQLPostFilter, G as GQLPost } from './types-EjYH-eZp.cjs';
2
+ export { B as BlockType, E as EditorBlock, m as EmbeddedAuthor, n as EmbeddedTerm, o as GQLError, p as GQLPageInfo, M as MediaDetails, q as MediaSize, r as PostEmbedded, S as SearchResult, s as TemplatePart, t as WCDimensions, u as WCProductAttribute, v as WCProductDefaultAttribute, w as WPGraphQLError, x as WooCommercePaginationHeaders } from './types-EjYH-eZp.cjs';
36
3
 
37
4
  declare function resolveBaseUrl(config: NextWordpressConfig): string;
38
5
 
39
- interface MediaSize {
40
- file: string;
41
- width: number;
42
- height: number;
43
- mime_type: string;
44
- source_url: string;
45
- }
46
- interface MediaDetails {
47
- width: number;
48
- height: number;
49
- file: string;
50
- sizes: Record<string, MediaSize>;
51
- }
52
- interface FeaturedMedia extends WPEntity {
53
- title: RenderedTitle;
54
- author: number;
55
- caption: {
56
- rendered: string;
57
- };
58
- alt_text: string;
59
- media_type: string;
60
- mime_type: string;
61
- media_details: MediaDetails;
62
- source_url: string;
63
- }
64
-
65
- interface Author {
66
- id: number;
67
- name: string;
68
- url: string;
69
- description: string;
70
- link: string;
71
- slug: string;
72
- avatar_urls: Record<string, string>;
73
- meta: Record<string, unknown>;
74
- }
75
- interface EmbeddedAuthor {
76
- id: number;
77
- name: string;
78
- slug: string;
79
- avatar_urls: Record<string, string>;
80
- }
81
- interface EmbeddedTerm {
82
- id: number;
83
- name: string;
84
- slug: string;
85
- }
86
-
87
- interface BlockSupports {
88
- align?: boolean | string[];
89
- anchor?: boolean;
90
- className?: boolean;
91
- color?: {
92
- background?: boolean;
93
- gradients?: boolean;
94
- text?: boolean;
95
- };
96
- spacing?: {
97
- margin?: boolean;
98
- padding?: boolean;
99
- };
100
- typography?: {
101
- fontSize?: boolean;
102
- lineHeight?: boolean;
103
- };
104
- [key: string]: unknown;
105
- }
106
- interface BlockStyle {
107
- name: string;
108
- label: string;
109
- isDefault: boolean;
110
- }
111
- interface BlockType {
112
- api_version: number;
113
- title: string;
114
- name: string;
115
- description: string;
116
- icon: string;
117
- category: string;
118
- keywords: string[];
119
- parent: string[];
120
- supports: BlockSupports;
121
- styles: BlockStyle[];
122
- textdomain: string;
123
- example: Record<string, unknown>;
124
- attributes: Record<string, unknown>;
125
- provides_context: Record<string, string>;
126
- uses_context: string[];
127
- editor_script: string;
128
- script: string;
129
- editor_style: string;
130
- style: string;
131
- }
132
- interface EditorBlock {
133
- id: string;
134
- name: string;
135
- attributes: Record<string, unknown>;
136
- innerBlocks: EditorBlock[];
137
- innerHTML: string;
138
- innerContent: (string | null)[];
139
- }
140
- interface TemplatePart {
141
- id: string;
142
- slug: string;
143
- theme: string;
144
- type: string;
145
- source: string;
146
- origin: string;
147
- content: string | EditorBlock[];
148
- title: {
149
- raw: string;
150
- rendered: string;
151
- };
152
- description: string;
153
- status: 'publish' | 'future' | 'draft' | 'pending' | 'private';
154
- wp_id: number;
155
- has_theme_file: boolean;
156
- author: number;
157
- area: string;
158
- }
159
- interface SearchResult {
160
- id: number;
161
- title: string;
162
- url: string;
163
- type: string;
164
- subtype: string;
165
- _links: {
166
- self: Array<{
167
- embeddable: boolean;
168
- href: string;
169
- }>;
170
- about: Array<{
171
- href: string;
172
- }>;
173
- };
174
- }
175
-
176
- interface PostEmbedded {
177
- author?: EmbeddedAuthor[];
178
- 'wp:featuredmedia'?: FeaturedMedia[];
179
- 'wp:term'?: EmbeddedTerm[][];
180
- }
181
- interface Post extends WPEntity {
182
- title: RenderedTitle;
183
- content: RenderedContent;
184
- excerpt: RenderedContent;
185
- author: number;
186
- featured_media: number;
187
- comment_status: 'open' | 'closed';
188
- ping_status: 'open' | 'closed';
189
- sticky: boolean;
190
- template: string;
191
- format: 'standard' | 'aside' | 'chat' | 'gallery' | 'link' | 'image' | 'quote' | 'status' | 'video' | 'audio';
192
- categories: number[];
193
- tags: number[];
194
- meta: Record<string, unknown>;
195
- blocks?: EditorBlock[];
196
- _embedded?: PostEmbedded;
197
- }
198
-
199
- interface WordPressPaginationHeaders {
200
- total: number;
201
- totalPages: number;
202
- }
203
- interface WordPressResponse<T> {
204
- data: T;
205
- headers: WordPressPaginationHeaders;
206
- }
6
+ declare function createFetcher(config: NextWordpressConfig): {
7
+ wpFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
8
+ wpFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
9
+ wpFetchPaginated: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WordPressResponse<T[]>>;
10
+ wpFetchPaginatedGraceful: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WordPressResponse<T[]>>;
11
+ wpMutate: <T>(path: string, body: unknown, method?: "POST" | "PUT" | "PATCH" | "DELETE", authToken?: string) => Promise<T>;
12
+ wpUpload: <T>(path: string, file: Blob | Buffer, filename: string, mimeType: string, authToken: string) => Promise<T>;
13
+ };
14
+ type WordPressFetcher = ReturnType<typeof createFetcher>;
207
15
 
208
16
  interface Category extends Taxonomy {
209
17
  taxonomy: 'category';
@@ -304,6 +112,266 @@ interface CreateCommentInput {
304
112
  parent?: number;
305
113
  }
306
114
 
115
+ type RestPostStatus = 'publish' | 'draft' | 'pending' | 'private' | 'future';
116
+ interface CreatePostInput {
117
+ title: string;
118
+ content?: string;
119
+ excerpt?: string;
120
+ status?: RestPostStatus;
121
+ author?: number;
122
+ date?: string;
123
+ slug?: string;
124
+ categories?: number[];
125
+ tags?: number[];
126
+ featured_media?: number;
127
+ }
128
+ interface UpdatePostInput extends Partial<Omit<CreatePostInput, 'title'>> {
129
+ title?: string;
130
+ }
131
+
132
+ declare function createPostsMutations(fetcher: WordPressFetcher): {
133
+ createPost: (input: CreatePostInput, authToken: string) => Promise<Post>;
134
+ updatePost: (id: number, input: UpdatePostInput, authToken: string) => Promise<Post>;
135
+ deletePost: (id: number, authToken: string, force?: boolean) => Promise<{
136
+ deleted: boolean;
137
+ previous: Post;
138
+ }>;
139
+ };
140
+
141
+ interface UpdateCommentInput {
142
+ content?: string;
143
+ author_name?: string;
144
+ author_email?: string;
145
+ author_url?: string;
146
+ status?: 'approve' | 'hold' | 'spam' | 'trash';
147
+ }
148
+
149
+ declare function createCommentsMutations(fetcher: WordPressFetcher): {
150
+ createComment: (input: CreateCommentInput, authToken?: string) => Promise<Comment>;
151
+ updateComment: (id: number, input: UpdateCommentInput, authToken: string) => Promise<Comment>;
152
+ deleteComment: (id: number, authToken: string, force?: boolean) => Promise<{
153
+ deleted: boolean;
154
+ previous: Comment;
155
+ }>;
156
+ };
157
+
158
+ type RestPageStatus = 'publish' | 'draft' | 'pending' | 'private' | 'future';
159
+ interface CreatePageInput {
160
+ title: string;
161
+ content?: string;
162
+ excerpt?: string;
163
+ status?: RestPageStatus;
164
+ author?: number;
165
+ parent?: number;
166
+ menu_order?: number;
167
+ slug?: string;
168
+ featured_media?: number;
169
+ comment_status?: 'open' | 'closed';
170
+ }
171
+ interface UpdatePageInput extends Partial<Omit<CreatePageInput, 'title'>> {
172
+ title?: string;
173
+ }
174
+
175
+ declare function createPagesMutations(fetcher: WordPressFetcher): {
176
+ createPage: (input: CreatePageInput, authToken: string) => Promise<Page>;
177
+ updatePage: (id: number, input: UpdatePageInput, authToken: string) => Promise<Page>;
178
+ deletePage: (id: number, authToken: string, force?: boolean) => Promise<{
179
+ deleted: boolean;
180
+ previous: Page;
181
+ }>;
182
+ };
183
+
184
+ interface CreateCategoryInput {
185
+ name: string;
186
+ description?: string;
187
+ slug?: string;
188
+ parent?: number;
189
+ }
190
+ type UpdateCategoryInput = Partial<CreateCategoryInput>;
191
+
192
+ declare function createCategoriesMutations(fetcher: WordPressFetcher): {
193
+ createCategory: (input: CreateCategoryInput, authToken: string) => Promise<Category>;
194
+ updateCategory: (id: number, input: UpdateCategoryInput, authToken: string) => Promise<Category>;
195
+ deleteCategory: (id: number, authToken: string, force?: boolean) => Promise<{
196
+ deleted: boolean;
197
+ previous: Category;
198
+ }>;
199
+ };
200
+
201
+ interface CreateTagInput {
202
+ name: string;
203
+ description?: string;
204
+ slug?: string;
205
+ }
206
+ type UpdateTagInput = Partial<CreateTagInput>;
207
+
208
+ declare function createTagsMutations(fetcher: WordPressFetcher): {
209
+ createTag: (input: CreateTagInput, authToken: string) => Promise<Tag>;
210
+ updateTag: (id: number, input: UpdateTagInput, authToken: string) => Promise<Tag>;
211
+ deleteTag: (id: number, authToken: string, force?: boolean) => Promise<{
212
+ deleted: boolean;
213
+ previous: Tag;
214
+ }>;
215
+ };
216
+
217
+ interface CreateAuthorInput {
218
+ username: string;
219
+ email: string;
220
+ password: string;
221
+ name?: string;
222
+ first_name?: string;
223
+ last_name?: string;
224
+ url?: string;
225
+ description?: string;
226
+ nickname?: string;
227
+ slug?: string;
228
+ roles?: string[];
229
+ }
230
+ interface UpdateAuthorInput {
231
+ name?: string;
232
+ first_name?: string;
233
+ last_name?: string;
234
+ email?: string;
235
+ url?: string;
236
+ description?: string;
237
+ nickname?: string;
238
+ slug?: string;
239
+ password?: string;
240
+ roles?: string[];
241
+ }
242
+
243
+ declare function createAuthorsMutations(fetcher: WordPressFetcher): {
244
+ createAuthor: (input: CreateAuthorInput, authToken: string) => Promise<Author>;
245
+ updateAuthor: (id: number, input: UpdateAuthorInput, authToken: string) => Promise<Author>;
246
+ deleteAuthor: (id: number, authToken: string, reassign: number) => Promise<{
247
+ deleted: boolean;
248
+ previous: Author;
249
+ }>;
250
+ };
251
+
252
+ interface CreateMenuInput {
253
+ name: string;
254
+ slug?: string;
255
+ description?: string;
256
+ }
257
+ type UpdateMenuInput = Partial<CreateMenuInput>;
258
+ interface CreateMenuItemInput {
259
+ title: string;
260
+ menus: number;
261
+ url?: string;
262
+ status?: 'publish' | 'draft';
263
+ attr_title?: string;
264
+ description?: string;
265
+ type?: string;
266
+ object?: string;
267
+ object_id?: number;
268
+ parent?: number;
269
+ menu_order?: number;
270
+ target?: string;
271
+ classes?: string[];
272
+ xfn?: string[];
273
+ }
274
+ interface UpdateMenuItemInput extends Partial<Omit<CreateMenuItemInput, 'menus'>> {
275
+ menus?: number;
276
+ }
277
+
278
+ declare function createMenusMutations(fetcher: WordPressFetcher): {
279
+ createMenu: (input: CreateMenuInput, authToken: string) => Promise<Menu>;
280
+ updateMenu: (id: number, input: UpdateMenuInput, authToken: string) => Promise<Menu>;
281
+ deleteMenu: (id: number, authToken: string) => Promise<{
282
+ deleted: boolean;
283
+ previous: Menu;
284
+ }>;
285
+ createMenuItem: (input: CreateMenuItemInput, authToken: string) => Promise<MenuItem>;
286
+ updateMenuItem: (id: number, input: UpdateMenuItemInput, authToken: string) => Promise<MenuItem>;
287
+ deleteMenuItem: (id: number, authToken: string, force?: boolean) => Promise<{
288
+ deleted: boolean;
289
+ previous: MenuItem;
290
+ }>;
291
+ };
292
+
293
+ interface UploadMediaInput {
294
+ file: Blob | Buffer;
295
+ filename: string;
296
+ mimeType: string;
297
+ title?: string;
298
+ caption?: string;
299
+ alt_text?: string;
300
+ }
301
+ interface UpdateMediaInput {
302
+ title?: string;
303
+ caption?: string;
304
+ alt_text?: string;
305
+ description?: string;
306
+ post?: number;
307
+ }
308
+
309
+ declare function createMediaMutations(fetcher: WordPressFetcher): {
310
+ uploadMedia: (input: UploadMediaInput, authToken: string) => Promise<FeaturedMedia>;
311
+ updateMedia: (id: number, input: UpdateMediaInput, authToken: string) => Promise<FeaturedMedia>;
312
+ deleteMedia: (id: number, authToken: string, force?: boolean) => Promise<{
313
+ deleted: boolean;
314
+ previous: FeaturedMedia;
315
+ }>;
316
+ };
317
+
318
+ declare function createWordPressMutationsClient(config: NextWordpressConfig): {
319
+ uploadMedia: (input: UploadMediaInput, authToken: string) => Promise<FeaturedMedia>;
320
+ updateMedia: (id: number, input: UpdateMediaInput, authToken: string) => Promise<FeaturedMedia>;
321
+ deleteMedia: (id: number, authToken: string, force?: boolean) => Promise<{
322
+ deleted: boolean;
323
+ previous: FeaturedMedia;
324
+ }>;
325
+ createMenu: (input: CreateMenuInput, authToken: string) => Promise<Menu>;
326
+ updateMenu: (id: number, input: UpdateMenuInput, authToken: string) => Promise<Menu>;
327
+ deleteMenu: (id: number, authToken: string) => Promise<{
328
+ deleted: boolean;
329
+ previous: Menu;
330
+ }>;
331
+ createMenuItem: (input: CreateMenuItemInput, authToken: string) => Promise<MenuItem>;
332
+ updateMenuItem: (id: number, input: UpdateMenuItemInput, authToken: string) => Promise<MenuItem>;
333
+ deleteMenuItem: (id: number, authToken: string, force?: boolean) => Promise<{
334
+ deleted: boolean;
335
+ previous: MenuItem;
336
+ }>;
337
+ createAuthor: (input: CreateAuthorInput, authToken: string) => Promise<Author>;
338
+ updateAuthor: (id: number, input: UpdateAuthorInput, authToken: string) => Promise<Author>;
339
+ deleteAuthor: (id: number, authToken: string, reassign: number) => Promise<{
340
+ deleted: boolean;
341
+ previous: Author;
342
+ }>;
343
+ createTag: (input: CreateTagInput, authToken: string) => Promise<Tag>;
344
+ updateTag: (id: number, input: UpdateTagInput, authToken: string) => Promise<Tag>;
345
+ deleteTag: (id: number, authToken: string, force?: boolean) => Promise<{
346
+ deleted: boolean;
347
+ previous: Tag;
348
+ }>;
349
+ createCategory: (input: CreateCategoryInput, authToken: string) => Promise<Category>;
350
+ updateCategory: (id: number, input: UpdateCategoryInput, authToken: string) => Promise<Category>;
351
+ deleteCategory: (id: number, authToken: string, force?: boolean) => Promise<{
352
+ deleted: boolean;
353
+ previous: Category;
354
+ }>;
355
+ createPage: (input: CreatePageInput, authToken: string) => Promise<Page>;
356
+ updatePage: (id: number, input: UpdatePageInput, authToken: string) => Promise<Page>;
357
+ deletePage: (id: number, authToken: string, force?: boolean) => Promise<{
358
+ deleted: boolean;
359
+ previous: Page;
360
+ }>;
361
+ createComment: (input: CreateCommentInput, authToken?: string) => Promise<Comment>;
362
+ updateComment: (id: number, input: UpdateCommentInput, authToken: string) => Promise<Comment>;
363
+ deleteComment: (id: number, authToken: string, force?: boolean) => Promise<{
364
+ deleted: boolean;
365
+ previous: Comment;
366
+ }>;
367
+ createPost: (input: CreatePostInput, authToken: string) => Promise<Post>;
368
+ updatePost: (id: number, input: UpdatePostInput, authToken: string) => Promise<Post>;
369
+ deletePost: (id: number, authToken: string, force?: boolean) => Promise<{
370
+ deleted: boolean;
371
+ previous: Post;
372
+ }>;
373
+ };
374
+
307
375
  declare function createWordPressClient(config: NextWordpressConfig): {
308
376
  getCommentsByPostId: (postId: number, page?: number, perPage?: number) => Promise<WordPressResponse<Comment[]>>;
309
377
  getAllCommentsByPostId: (postId: number) => Promise<Comment[]>;
@@ -362,21 +430,6 @@ declare function createWordPressClient(config: NextWordpressConfig): {
362
430
  }[]>;
363
431
  };
364
432
 
365
- interface WooCommerceConfig {
366
- serverURL: string;
367
- consumerKey: string;
368
- consumerSecret: string;
369
- cacheTTL?: number;
370
- }
371
- interface WooCommercePaginationHeaders {
372
- total: number;
373
- totalPages: number;
374
- }
375
- interface WooCommerceResponse<T> {
376
- data: T;
377
- headers: WooCommercePaginationHeaders;
378
- }
379
-
380
433
  declare function createWooCommerceFetcher(config: WooCommerceConfig): {
381
434
  wcFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[], options?: RequestInit) => Promise<T>;
382
435
  wcFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
@@ -386,31 +439,6 @@ declare function createWooCommerceFetcher(config: WooCommerceConfig): {
386
439
  };
387
440
  type WooCommerceFetcher = ReturnType<typeof createWooCommerceFetcher>;
388
441
 
389
- interface WCImage {
390
- id: number;
391
- src: string;
392
- name: string;
393
- alt: string;
394
- }
395
- interface WCDimensions {
396
- length: string;
397
- width: string;
398
- height: string;
399
- }
400
- interface WCAddress {
401
- first_name: string;
402
- last_name: string;
403
- company: string;
404
- address_1: string;
405
- address_2: string;
406
- city: string;
407
- state: string;
408
- postcode: string;
409
- country: string;
410
- email?: string;
411
- phone?: string;
412
- }
413
-
414
442
  interface WCProductCategory {
415
443
  id: number;
416
444
  name: string;
@@ -423,124 +451,57 @@ interface WCProductCategory {
423
451
  count: number;
424
452
  }
425
453
 
426
- interface WCProductAttribute {
427
- id: number;
428
- name: string;
429
- position: number;
430
- visible: boolean;
431
- variation: boolean;
432
- options: string[];
433
- }
434
- interface WCProductDefaultAttribute {
435
- id: number;
454
+ interface CreateProductCategoryInput {
436
455
  name: string;
437
- option: string;
438
- }
439
- interface WCProductVariation {
440
- id: number;
441
- date_created: string;
442
- date_modified: string;
443
- description: string;
444
- permalink: string;
445
- sku: string;
446
- price: string;
447
- regular_price: string;
448
- sale_price: string;
449
- on_sale: boolean;
450
- purchasable: boolean;
451
- stock_quantity: number | null;
452
- stock_status: 'instock' | 'outofstock' | 'onbackorder';
453
- manage_stock: boolean;
454
- backorders: 'no' | 'notify' | 'yes';
455
- backorders_allowed: boolean;
456
- backordered: boolean;
457
- weight: string;
458
- dimensions: WCDimensions;
459
- image: WCImage | null;
460
- attributes: Array<{
461
- id: number;
462
- name: string;
463
- option: string;
464
- }>;
456
+ slug?: string;
457
+ parent?: number;
458
+ description?: string;
459
+ display?: 'default' | 'products' | 'subcategories' | 'both';
460
+ image?: {
461
+ src: string;
462
+ alt?: string;
463
+ };
464
+ menu_order?: number;
465
465
  }
466
- interface WCProduct {
467
- id: number;
466
+ type UpdateProductCategoryInput = Partial<CreateProductCategoryInput>;
467
+
468
+ type WCProductStatus = 'draft' | 'pending' | 'private' | 'publish';
469
+ interface CreateProductInput {
468
470
  name: string;
469
- slug: string;
470
- permalink: string;
471
- date_created: string;
472
- date_modified: string;
473
- type: 'simple' | 'grouped' | 'external' | 'variable';
474
- status: 'draft' | 'pending' | 'private' | 'publish';
475
- featured: boolean;
476
- catalog_visibility: 'visible' | 'catalog' | 'search' | 'hidden';
477
- description: string;
478
- short_description: string;
479
- sku: string;
480
- price: string;
481
- regular_price: string;
482
- sale_price: string;
483
- on_sale: boolean;
484
- purchasable: boolean;
485
- total_sales: number;
486
- virtual: boolean;
487
- downloadable: boolean;
488
- tax_status: 'taxable' | 'shipping' | 'none';
489
- tax_class: string;
490
- manage_stock: boolean;
491
- stock_quantity: number | null;
492
- stock_status: 'instock' | 'outofstock' | 'onbackorder';
493
- backorders: 'no' | 'notify' | 'yes';
494
- backorders_allowed: boolean;
495
- backordered: boolean;
496
- sold_individually: boolean;
497
- weight: string;
498
- dimensions: WCDimensions;
499
- shipping_required: boolean;
500
- shipping_taxable: boolean;
501
- shipping_class: string;
502
- shipping_class_id: number;
503
- reviews_allowed: boolean;
504
- average_rating: string;
505
- rating_count: number;
506
- related_ids: number[];
507
- upsell_ids: number[];
508
- cross_sell_ids: number[];
509
- parent_id: number;
510
- categories: Array<{
471
+ type?: 'simple' | 'variable' | 'grouped' | 'external';
472
+ status?: WCProductStatus;
473
+ description?: string;
474
+ short_description?: string;
475
+ sku?: string;
476
+ regular_price?: string;
477
+ sale_price?: string;
478
+ manage_stock?: boolean;
479
+ stock_quantity?: number;
480
+ stock_status?: 'instock' | 'outofstock' | 'onbackorder';
481
+ categories?: {
511
482
  id: number;
512
- name: string;
513
- slug: string;
514
- }>;
515
- tags: Array<{
483
+ }[];
484
+ tags?: {
516
485
  id: number;
486
+ }[];
487
+ images?: {
488
+ src: string;
489
+ alt?: string;
490
+ }[];
491
+ featured?: boolean;
492
+ virtual?: boolean;
493
+ downloadable?: boolean;
494
+ weight?: string;
495
+ attributes?: {
496
+ id?: number;
517
497
  name: string;
518
- slug: string;
519
- }>;
520
- images: WCImage[];
521
- attributes: WCProductAttribute[];
522
- default_attributes: WCProductDefaultAttribute[];
523
- variations: number[];
524
- grouped_products: number[];
525
- menu_order: number;
526
- meta_data: Array<{
527
- id: number;
528
- key: string;
529
- value: unknown;
530
- }>;
498
+ options: string[];
499
+ visible?: boolean;
500
+ variation?: boolean;
501
+ }[];
531
502
  }
532
- interface WCProductFilterParams {
533
- category?: string;
534
- tag?: string;
535
- featured?: boolean;
536
- on_sale?: boolean;
537
- min_price?: string;
538
- max_price?: string;
539
- search?: string;
540
- orderby?: 'date' | 'id' | 'include' | 'title' | 'slug' | 'price' | 'popularity' | 'rating';
541
- order?: 'asc' | 'desc';
542
- stock_status?: 'instock' | 'outofstock' | 'onbackorder';
543
- type?: WCProduct['type'];
503
+ interface UpdateProductInput extends Partial<Omit<CreateProductInput, 'name'>> {
504
+ name?: string;
544
505
  }
545
506
 
546
507
  interface WCProductTag {
@@ -551,6 +512,13 @@ interface WCProductTag {
551
512
  count: number;
552
513
  }
553
514
 
515
+ interface CreateProductTagInput {
516
+ name: string;
517
+ slug?: string;
518
+ description?: string;
519
+ }
520
+ type UpdateProductTagInput = Partial<CreateProductTagInput>;
521
+
554
522
  interface WCOrderLineItem {
555
523
  id: number;
556
524
  name: string;
@@ -673,6 +641,23 @@ interface WCCoupon {
673
641
  description: string;
674
642
  }
675
643
 
644
+ interface CreateCouponInput {
645
+ code: string;
646
+ discount_type?: 'percent' | 'fixed_cart' | 'fixed_product';
647
+ amount?: string;
648
+ description?: string;
649
+ date_expires?: string | null;
650
+ individual_use?: boolean;
651
+ product_ids?: number[];
652
+ excluded_product_ids?: number[];
653
+ usage_limit?: number | null;
654
+ usage_limit_per_user?: number | null;
655
+ free_shipping?: boolean;
656
+ minimum_amount?: string;
657
+ maximum_amount?: string;
658
+ }
659
+ type UpdateCouponInput = Partial<CreateCouponInput>;
660
+
676
661
  interface WCCustomer {
677
662
  id: number;
678
663
  date_created: string;
@@ -695,6 +680,20 @@ interface WCCustomer {
695
680
  }>;
696
681
  }
697
682
 
683
+ interface UpdateCustomerInput {
684
+ email?: string;
685
+ first_name?: string;
686
+ last_name?: string;
687
+ username?: string;
688
+ password?: string;
689
+ billing?: Partial<WCAddress>;
690
+ shipping?: Partial<Omit<WCAddress, 'email' | 'phone'>>;
691
+ meta_data?: {
692
+ key: string;
693
+ value: unknown;
694
+ }[];
695
+ }
696
+
698
697
  interface OmnibusPriceEntry {
699
698
  price: string;
700
699
  date: string;
@@ -734,6 +733,17 @@ declare function createWooCommerceClient(config: WooCommerceConfig): {
734
733
  billing?: Partial<WCAddress>;
735
734
  shipping?: Partial<Omit<WCAddress, "email" | "phone">>;
736
735
  }) => Promise<WCCustomer>;
736
+ updateCustomer: (id: number, data: UpdateCustomerInput) => Promise<WCCustomer>;
737
+ deleteCustomer: (id: number, reassign?: number) => Promise<{
738
+ deleted: boolean;
739
+ previous: WCCustomer;
740
+ }>;
741
+ createCoupon: (input: CreateCouponInput) => Promise<WCCoupon>;
742
+ updateCoupon: (id: number, input: UpdateCouponInput) => Promise<WCCoupon>;
743
+ deleteCoupon: (id: number, force?: boolean) => Promise<{
744
+ deleted: boolean;
745
+ previous: WCCoupon;
746
+ }>;
737
747
  getCouponByCode: (code: string) => Promise<WCCoupon | undefined>;
738
748
  validateCoupon: (code: string) => Promise<{
739
749
  valid: boolean;
@@ -744,14 +754,36 @@ declare function createWooCommerceClient(config: WooCommerceConfig): {
744
754
  getOrderById: (id: number) => Promise<WCOrder>;
745
755
  updateOrder: (id: number, data: Partial<WCCreateOrderInput>) => Promise<WCOrder>;
746
756
  getOrdersByCustomer: (customerId: number) => Promise<WCOrder[]>;
757
+ deleteOrder: (id: number, force?: boolean) => Promise<{
758
+ deleted: boolean;
759
+ previous: WCOrder;
760
+ }>;
761
+ createProductTag: (input: CreateProductTagInput) => Promise<WCProductTag>;
762
+ updateProductTag: (id: number, input: UpdateProductTagInput) => Promise<WCProductTag>;
763
+ deleteProductTag: (id: number, force?: boolean) => Promise<{
764
+ deleted: boolean;
765
+ previous: WCProductTag;
766
+ }>;
747
767
  getAllProductTags: () => Promise<WCProductTag[]>;
748
768
  getProductTagById: (id: number) => Promise<WCProductTag>;
749
769
  getProductsByTag: (tagId: number, limit?: number) => Promise<WCProduct[]>;
770
+ createProductCategory: (input: CreateProductCategoryInput) => Promise<WCProductCategory>;
771
+ updateProductCategory: (id: number, input: UpdateProductCategoryInput) => Promise<WCProductCategory>;
772
+ deleteProductCategory: (id: number, force?: boolean) => Promise<{
773
+ deleted: boolean;
774
+ previous: WCProductCategory;
775
+ }>;
750
776
  getAllProductCategories: () => Promise<WCProductCategory[]>;
751
777
  getProductCategoryById: (id: number) => Promise<WCProductCategory>;
752
778
  getProductCategoryBySlug: (slug: string) => Promise<WCProductCategory | undefined>;
753
779
  getProductsByCategory: (categoryId: number, limit?: number) => Promise<WCProduct[]>;
754
780
  getProductsByCategorySlug: (categorySlug: string) => Promise<WCProduct[]>;
781
+ createProduct: (input: CreateProductInput) => Promise<WCProduct>;
782
+ updateProduct: (id: number, input: UpdateProductInput) => Promise<WCProduct>;
783
+ deleteProduct: (id: number, force?: boolean) => Promise<{
784
+ deleted: boolean;
785
+ previous: WCProduct;
786
+ }>;
755
787
  getProducts: (filterParams?: WCProductFilterParams) => Promise<WCProduct[]>;
756
788
  getProductsPaginated: (page?: number, perPage?: number, filterParams?: WCProductFilterParams) => Promise<WooCommerceResponse<WCProduct[]>>;
757
789
  getProductById: (id: number) => Promise<WCProduct>;
@@ -766,92 +798,13 @@ declare function createWooCommerceClient(config: WooCommerceConfig): {
766
798
  getProductVariationById: (productId: number, variationId: number) => Promise<WCProductVariation>;
767
799
  };
768
800
 
769
- type WPGraphQLConfig = NextWordpressConfig;
770
- interface GQLPageInfo {
771
- hasNextPage: boolean;
772
- hasPreviousPage: boolean;
773
- startCursor?: string;
774
- endCursor?: string;
775
- }
776
- interface GQLConnection<T> {
777
- nodes: T[];
778
- pageInfo: GQLPageInfo;
779
- }
780
- interface GQLError {
781
- message: string;
782
- locations?: Array<{
783
- line: number;
784
- column: number;
785
- }>;
786
- path?: string[];
787
- }
788
- declare class WPGraphQLError extends Error {
789
- readonly status: number;
790
- readonly endpoint: string;
791
- readonly gqlErrors?: GQLError[] | undefined;
792
- constructor(message: string, status: number, endpoint: string, gqlErrors?: GQLError[] | undefined);
793
- }
794
-
795
801
  declare function createWPGraphQLFetcher(config: WPGraphQLConfig): {
796
802
  gqlFetch: <TData>(document: string, variables?: Record<string, unknown>, tags?: string[]) => Promise<TData>;
797
803
  gqlFetchGraceful: <TData>(document: string, fallback: TData, variables?: Record<string, unknown>, tags?: string[]) => Promise<TData>;
804
+ gqlMutate: <TData>(document: string, variables?: Record<string, unknown>, authToken?: string) => Promise<TData>;
798
805
  };
799
806
  type WPGraphQLFetcher = ReturnType<typeof createWPGraphQLFetcher>;
800
807
 
801
- interface GQLPostFilter {
802
- authorName?: string;
803
- categoryName?: string;
804
- tag?: string;
805
- search?: string;
806
- status?: string;
807
- }
808
- interface GQLPost {
809
- id: string;
810
- databaseId: number;
811
- slug: string;
812
- title: string;
813
- content: string;
814
- excerpt: string;
815
- date: string;
816
- modified: string;
817
- status: string;
818
- uri: string;
819
- author?: {
820
- node: {
821
- databaseId: number;
822
- name: string;
823
- slug: string;
824
- avatar?: {
825
- url: string;
826
- };
827
- };
828
- };
829
- featuredImage?: {
830
- node: {
831
- sourceUrl: string;
832
- altText: string;
833
- mediaDetails?: {
834
- width: number;
835
- height: number;
836
- };
837
- };
838
- };
839
- categories?: {
840
- nodes: Array<{
841
- databaseId: number;
842
- name: string;
843
- slug: string;
844
- }>;
845
- };
846
- tags?: {
847
- nodes: Array<{
848
- databaseId: number;
849
- name: string;
850
- slug: string;
851
- }>;
852
- };
853
- }
854
-
855
808
  interface GQLPage {
856
809
  id: string;
857
810
  databaseId: number;
@@ -871,7 +824,7 @@ interface GQLPage {
871
824
  height: number;
872
825
  };
873
826
  };
874
- };
827
+ } | null;
875
828
  }
876
829
 
877
830
  interface GQLCategory {
@@ -888,7 +841,7 @@ interface GQLCategory {
888
841
  name: string;
889
842
  slug: string;
890
843
  };
891
- };
844
+ } | null;
892
845
  }
893
846
 
894
847
  interface GQLTag {
@@ -933,7 +886,7 @@ interface GQLMenuItem {
933
886
  databaseId?: number;
934
887
  slug?: string;
935
888
  };
936
- };
889
+ } | null;
937
890
  }
938
891
  interface GQLMenu {
939
892
  id: string;
@@ -970,7 +923,277 @@ interface GQLComment {
970
923
  };
971
924
  }
972
925
 
926
+ interface GQLMediaItem {
927
+ id: string;
928
+ databaseId: number;
929
+ slug: string;
930
+ title: string;
931
+ date: string;
932
+ sourceUrl: string;
933
+ altText: string;
934
+ caption: string;
935
+ description: string;
936
+ mediaType: string;
937
+ mimeType: string;
938
+ uri: string;
939
+ mediaDetails: {
940
+ width: number;
941
+ height: number;
942
+ file: string;
943
+ sizes: {
944
+ name: string;
945
+ width: number;
946
+ height: number;
947
+ mimeType: string;
948
+ sourceUrl: string;
949
+ }[];
950
+ };
951
+ }
952
+
953
+ type GQLPostStatus = 'PUBLISH' | 'DRAFT' | 'PENDING' | 'PRIVATE' | 'FUTURE';
954
+ interface GQLCreatePostInput {
955
+ title: string;
956
+ content?: string;
957
+ excerpt?: string;
958
+ status?: GQLPostStatus;
959
+ authorId?: string;
960
+ date?: string;
961
+ slug?: string;
962
+ categoryIds?: number[];
963
+ tagIds?: number[];
964
+ }
965
+ interface GQLUpdatePostInput {
966
+ id: string;
967
+ title?: string;
968
+ content?: string;
969
+ excerpt?: string;
970
+ status?: GQLPostStatus;
971
+ date?: string;
972
+ slug?: string;
973
+ categoryIds?: number[];
974
+ tagIds?: number[];
975
+ }
976
+ interface GQLMutatedPost {
977
+ id: string;
978
+ databaseId: number;
979
+ slug: string;
980
+ title: string;
981
+ status: string;
982
+ }
983
+ interface GQLDeletePostResult {
984
+ deletedId: string | null;
985
+ post: GQLMutatedPost | null;
986
+ }
987
+
988
+ interface GQLCreateCommentInput {
989
+ postId: number;
990
+ content: string;
991
+ authorName?: string;
992
+ authorEmail?: string;
993
+ authorUrl?: string;
994
+ parentId?: string;
995
+ }
996
+ interface GQLUpdateCommentInput {
997
+ id: string;
998
+ content?: string;
999
+ status?: string;
1000
+ }
1001
+ interface GQLMutatedComment {
1002
+ id: string;
1003
+ databaseId: number;
1004
+ content: string;
1005
+ date: string;
1006
+ status: string;
1007
+ parentId: string | null;
1008
+ author: {
1009
+ node: {
1010
+ name: string;
1011
+ url: string;
1012
+ };
1013
+ };
1014
+ }
1015
+ interface GQLCreateCommentResult {
1016
+ success: boolean;
1017
+ comment: GQLMutatedComment | null;
1018
+ }
1019
+ interface GQLDeleteCommentResult {
1020
+ deletedId: string | null;
1021
+ comment: GQLMutatedComment | null;
1022
+ }
1023
+
1024
+ type GQLPageStatus = 'PUBLISH' | 'DRAFT' | 'PENDING' | 'PRIVATE' | 'FUTURE';
1025
+ interface GQLCreatePageInput {
1026
+ title: string;
1027
+ content?: string;
1028
+ excerpt?: string;
1029
+ status?: GQLPageStatus;
1030
+ authorId?: string;
1031
+ date?: string;
1032
+ slug?: string;
1033
+ parentId?: string;
1034
+ menuOrder?: number;
1035
+ }
1036
+ interface GQLUpdatePageInput {
1037
+ id: string;
1038
+ title?: string;
1039
+ content?: string;
1040
+ excerpt?: string;
1041
+ status?: GQLPageStatus;
1042
+ date?: string;
1043
+ slug?: string;
1044
+ parentId?: string;
1045
+ menuOrder?: number;
1046
+ }
1047
+ interface GQLMutatedPage {
1048
+ id: string;
1049
+ databaseId: number;
1050
+ slug: string;
1051
+ title: string;
1052
+ status: string;
1053
+ uri: string;
1054
+ }
1055
+ interface GQLDeletePageResult {
1056
+ deletedId: string | null;
1057
+ page: GQLMutatedPage | null;
1058
+ }
1059
+
1060
+ interface GQLCreateCategoryInput {
1061
+ name: string;
1062
+ description?: string;
1063
+ slug?: string;
1064
+ parentId?: string;
1065
+ }
1066
+ interface GQLUpdateCategoryInput {
1067
+ id: string;
1068
+ name?: string;
1069
+ description?: string;
1070
+ slug?: string;
1071
+ parentId?: string;
1072
+ }
1073
+ interface GQLMutatedCategory {
1074
+ id: string;
1075
+ databaseId: number;
1076
+ name: string;
1077
+ slug: string;
1078
+ }
1079
+ interface GQLDeleteCategoryResult {
1080
+ deletedId: string | null;
1081
+ category: GQLMutatedCategory | null;
1082
+ }
1083
+
1084
+ interface GQLCreateTagInput {
1085
+ name: string;
1086
+ description?: string;
1087
+ slug?: string;
1088
+ }
1089
+ interface GQLUpdateTagInput {
1090
+ id: string;
1091
+ name?: string;
1092
+ description?: string;
1093
+ slug?: string;
1094
+ }
1095
+ interface GQLMutatedTag {
1096
+ id: string;
1097
+ databaseId: number;
1098
+ name: string;
1099
+ slug: string;
1100
+ }
1101
+ interface GQLDeleteTagResult {
1102
+ deletedId: string | null;
1103
+ tag: GQLMutatedTag | null;
1104
+ }
1105
+
1106
+ interface GQLRegisterUserInput {
1107
+ username: string;
1108
+ email: string;
1109
+ password: string;
1110
+ firstName?: string;
1111
+ lastName?: string;
1112
+ displayName?: string;
1113
+ websiteUrl?: string;
1114
+ description?: string;
1115
+ nicename?: string;
1116
+ }
1117
+ interface GQLUpdateUserInput {
1118
+ id: string;
1119
+ firstName?: string;
1120
+ lastName?: string;
1121
+ email?: string;
1122
+ websiteUrl?: string;
1123
+ description?: string;
1124
+ password?: string;
1125
+ displayName?: string;
1126
+ nicename?: string;
1127
+ }
1128
+ interface GQLMutatedUser {
1129
+ id: string;
1130
+ databaseId: number;
1131
+ name: string;
1132
+ slug: string;
1133
+ email: string;
1134
+ }
1135
+ interface GQLDeleteUserResult {
1136
+ deletedId: string | null;
1137
+ user: GQLMutatedUser | null;
1138
+ }
1139
+
1140
+ interface GQLCreateMediaItemInput {
1141
+ filePath: string;
1142
+ fileType?: string;
1143
+ title?: string;
1144
+ altText?: string;
1145
+ caption?: string;
1146
+ description?: string;
1147
+ postId?: number;
1148
+ }
1149
+ interface GQLUpdateMediaItemInput {
1150
+ id: string;
1151
+ title?: string;
1152
+ altText?: string;
1153
+ caption?: string;
1154
+ description?: string;
1155
+ }
1156
+ interface GQLMutatedMediaItem {
1157
+ id: string;
1158
+ databaseId: number;
1159
+ slug: string;
1160
+ title: string;
1161
+ sourceUrl: string;
1162
+ altText: string;
1163
+ }
1164
+ interface GQLDeleteMediaItemResult {
1165
+ deletedId: string | null;
1166
+ mediaItem: GQLMutatedMediaItem | null;
1167
+ }
1168
+
1169
+ declare function createWPGraphQLMutationsClient(config: WPGraphQLConfig): {
1170
+ createMediaItem: (input: GQLCreateMediaItemInput, authToken: string) => Promise<GQLMutatedMediaItem>;
1171
+ updateMediaItem: (input: GQLUpdateMediaItemInput, authToken: string) => Promise<GQLMutatedMediaItem>;
1172
+ deleteMediaItem: (id: string, authToken: string, forceDelete?: boolean) => Promise<GQLDeleteMediaItemResult>;
1173
+ registerUser: (input: GQLRegisterUserInput, authToken?: string) => Promise<GQLMutatedUser>;
1174
+ updateUser: (input: GQLUpdateUserInput, authToken: string) => Promise<GQLMutatedUser>;
1175
+ deleteUser: (id: string, authToken: string, reassignPosts?: string) => Promise<GQLDeleteUserResult>;
1176
+ createTag: (input: GQLCreateTagInput, authToken: string) => Promise<GQLMutatedTag>;
1177
+ updateTag: (input: GQLUpdateTagInput, authToken: string) => Promise<GQLMutatedTag>;
1178
+ deleteTag: (id: string, authToken: string) => Promise<GQLDeleteTagResult>;
1179
+ createCategory: (input: GQLCreateCategoryInput, authToken: string) => Promise<GQLMutatedCategory>;
1180
+ updateCategory: (input: GQLUpdateCategoryInput, authToken: string) => Promise<GQLMutatedCategory>;
1181
+ deleteCategory: (id: string, authToken: string) => Promise<GQLDeleteCategoryResult>;
1182
+ createPage: (input: GQLCreatePageInput, authToken: string) => Promise<GQLMutatedPage>;
1183
+ updatePage: (input: GQLUpdatePageInput, authToken: string) => Promise<GQLMutatedPage>;
1184
+ deletePage: (id: string, authToken: string, forceDelete?: boolean) => Promise<GQLDeletePageResult>;
1185
+ createComment: (input: GQLCreateCommentInput, authToken?: string) => Promise<GQLCreateCommentResult>;
1186
+ updateComment: (input: GQLUpdateCommentInput, authToken: string) => Promise<GQLMutatedComment>;
1187
+ deleteComment: (id: string, authToken: string, forceDelete?: boolean) => Promise<GQLDeleteCommentResult>;
1188
+ createPost: (input: GQLCreatePostInput, authToken: string) => Promise<GQLMutatedPost>;
1189
+ updatePost: (input: GQLUpdatePostInput, authToken: string) => Promise<GQLMutatedPost>;
1190
+ deletePost: (id: string, authToken: string, forceDelete?: boolean) => Promise<GQLDeletePostResult>;
1191
+ };
1192
+
973
1193
  declare function createWPGraphQLCoreClient(config: WPGraphQLConfig): {
1194
+ getMediaItems: (first?: number, after?: string) => Promise<GQLConnection<GQLMediaItem>>;
1195
+ getMediaItemById: (id: number) => Promise<GQLMediaItem | null>;
1196
+ getMediaItemBySlug: (slug: string) => Promise<GQLMediaItem | null>;
974
1197
  getCommentsByPostId: (postId: number, first?: number, after?: string) => Promise<{
975
1198
  nodes: GQLComment[];
976
1199
  pageInfo: {
@@ -1020,12 +1243,12 @@ interface GQLYoastSEO {
1020
1243
  opengraphImage?: {
1021
1244
  sourceUrl: string;
1022
1245
  altText: string;
1023
- };
1246
+ } | null;
1024
1247
  twitterTitle: string;
1025
1248
  twitterDescription: string;
1026
1249
  twitterImage?: {
1027
1250
  sourceUrl: string;
1028
- };
1251
+ } | null;
1029
1252
  schema?: {
1030
1253
  raw: string;
1031
1254
  };
@@ -1203,7 +1426,63 @@ interface GQLCustomer {
1203
1426
  };
1204
1427
  }
1205
1428
 
1429
+ interface GQLProductCategory {
1430
+ id: string;
1431
+ databaseId: number;
1432
+ name: string;
1433
+ slug: string;
1434
+ description: string;
1435
+ count: number;
1436
+ parent: {
1437
+ node: {
1438
+ id: string;
1439
+ databaseId: number;
1440
+ name: string;
1441
+ slug: string;
1442
+ };
1443
+ } | null;
1444
+ image: {
1445
+ sourceUrl: string;
1446
+ altText: string;
1447
+ } | null;
1448
+ }
1449
+
1450
+ interface GQLProductTag {
1451
+ id: string;
1452
+ databaseId: number;
1453
+ name: string;
1454
+ slug: string;
1455
+ description: string;
1456
+ count: number;
1457
+ }
1458
+
1459
+ interface GQLCoupon {
1460
+ id: string;
1461
+ databaseId: number;
1462
+ code: string;
1463
+ discountType: string;
1464
+ amount: string;
1465
+ dateExpiry: string | null;
1466
+ usageCount: number;
1467
+ usageLimit: number | null;
1468
+ usageLimitPerUser: number | null;
1469
+ individualUse: boolean;
1470
+ freeShipping: boolean;
1471
+ minimumAmount: string;
1472
+ maximumAmount: string;
1473
+ description: string;
1474
+ }
1475
+
1206
1476
  declare function createWPGraphQLWooCommerceClient(config: WPGraphQLConfig): {
1477
+ getCoupons: (first?: number, after?: string) => Promise<GQLConnection<GQLCoupon>>;
1478
+ getCouponByCode: (code: string) => Promise<GQLCoupon | null>;
1479
+ getCouponById: (id: number) => Promise<GQLCoupon | null>;
1480
+ getProductTags: (first?: number, after?: string) => Promise<GQLConnection<GQLProductTag>>;
1481
+ getProductTagBySlug: (slug: string) => Promise<GQLProductTag | null>;
1482
+ getProductTagById: (id: number) => Promise<GQLProductTag | null>;
1483
+ getProductCategories: (first?: number, after?: string) => Promise<GQLConnection<GQLProductCategory>>;
1484
+ getProductCategoryBySlug: (slug: string) => Promise<GQLProductCategory | null>;
1485
+ getProductCategoryById: (id: number) => Promise<GQLProductCategory | null>;
1207
1486
  getCustomer: () => Promise<GQLCustomer | null>;
1208
1487
  getCustomerById: (id: number) => Promise<GQLCustomer | null>;
1209
1488
  getOrder: (id: number) => Promise<GQLOrder | null>;
@@ -1238,4 +1517,42 @@ declare function createCPTQueries(fetcher: WPGraphQLFetcher, typeName: string, s
1238
1517
  }[]>;
1239
1518
  };
1240
1519
 
1241
- export { type Author, type BlockType, type Category, type Comment, type CommentAuthorAvatar, type CreateCommentInput, type EditorBlock, type EmbeddedAuthor, type EmbeddedTerm, type FeaturedMedia, type GQLACFFieldGroup, type GQLAuthor, type GQLCPTNode, type GQLCategory, type GQLConnection, type GQLCustomer, type GQLError, type GQLLineItem, type GQLOrder, type GQLOrderAddress, type GQLPage, type GQLPageInfo, type GQLPageWithSEO, type GQLPost, type GQLPostFilter, type GQLPostWithSEO, type GQLProduct, type GQLProductFilter, type GQLProductVariation, type GQLTag, type GQLYoastSEO, type MediaDetails, type MediaSize, type Menu, type MenuItem, type MenuLocation, type MenuWithItems, type NextWordpressConfig, type OmnibusPriceEntry, type OmnibusProductData, type Page, type Post, type PostEmbedded, type RenderedContent, type RenderedTitle, type SearchResult, type Tag, type Taxonomy, type TemplatePart, type WCAddress, type WCCoupon, type WCCreateOrderInput, type WCCustomer, type WCDimensions, type WCImage, type WCOrder, type WCOrderLineItem, type WCProduct, type WCProductAttribute, type WCProductCategory, type WCProductDefaultAttribute, type WCProductFilterParams, type WCProductTag, type WCProductVariation, type WCProductVariationWithOmnibus, type WCProductWithOmnibus, type WCShippingLine, type WPEntity, type WPGraphQLConfig, WPGraphQLError, type WPGraphQLFetcher, type WooCommerceConfig, type WooCommerceFetcher, type WooCommercePaginationHeaders, type WooCommerceResponse, buildACFFragment, buildPageWithACFQuery, buildPostWithACFQuery, buildPostsWithACFQuery, createCPTQueries, createWPGraphQLCoreClient as createWPGraphQLClient, createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLWooCommerceClient, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createYoastQueries, extractOmnibusData, resolveBaseUrl, withOmnibus, withOmnibusVariation };
1520
+ interface RevalidationConfig {
1521
+ secret: string;
1522
+ }
1523
+ interface RevalidationPayload {
1524
+ action: string;
1525
+ post_id?: number;
1526
+ post_type?: string;
1527
+ slug?: string;
1528
+ taxonomy?: string;
1529
+ term_id?: number;
1530
+ }
1531
+ interface RevalidationResult {
1532
+ revalidated: boolean;
1533
+ tags: string[];
1534
+ message?: string;
1535
+ }
1536
+ declare function createRevalidationHandler(config: RevalidationConfig, revalidateTag: (tag: string) => void): (request: Request) => Promise<Response>;
1537
+
1538
+ declare function createApplicationPasswordToken(username: string, appPassword: string): string;
1539
+
1540
+ interface JwtAuthCredentials {
1541
+ username: string;
1542
+ password: string;
1543
+ }
1544
+ interface JwtAuthResponse {
1545
+ token: string;
1546
+ user_email: string;
1547
+ user_nicename: string;
1548
+ user_display_name: string;
1549
+ }
1550
+ declare class AuthenticationError extends Error {
1551
+ status: number;
1552
+ constructor(message: string, status: number);
1553
+ }
1554
+
1555
+ declare function authenticateJwt(config: NextWordpressConfig, credentials: JwtAuthCredentials): Promise<JwtAuthResponse>;
1556
+ declare function validateJwtToken(config: NextWordpressConfig, token: string): Promise<boolean>;
1557
+
1558
+ export { AuthenticationError, Author, type Category, type Comment, type CommentAuthorAvatar, type CreateAuthorInput, type CreateCategoryInput, type CreateCommentInput, type CreateCouponInput, type CreateMenuInput, type CreateMenuItemInput, type CreatePageInput, type CreatePostInput, type CreateProductCategoryInput, type CreateProductInput, type CreateProductTagInput, type CreateTagInput, FeaturedMedia, type GQLACFFieldGroup, type GQLAuthor, type GQLCPTNode, type GQLCategory, GQLConnection, type GQLCreateCommentInput, type GQLCreateCommentResult, type GQLCreatePostInput, type GQLCustomer, type GQLDeletePostResult, type GQLLineItem, type GQLMutatedComment, type GQLMutatedPost, type GQLOrder, type GQLOrderAddress, type GQLPage, type GQLPageWithSEO, GQLPost, GQLPostFilter, type GQLPostStatus, type GQLPostWithSEO, type GQLProduct, type GQLProductFilter, type GQLProductVariation, type GQLTag, type GQLUpdatePostInput, type GQLYoastSEO, type JwtAuthCredentials, type JwtAuthResponse, type Menu, type MenuItem, type MenuLocation, type MenuWithItems, NextWordpressConfig, type OmnibusPriceEntry, type OmnibusProductData, type Page, Post, RenderedContent, RenderedTitle, type RestPageStatus, type RestPostStatus, type RevalidationConfig, type RevalidationPayload, type RevalidationResult, type Tag, Taxonomy, type UpdateAuthorInput, type UpdateCategoryInput, type UpdateCommentInput, type UpdateCouponInput, type UpdateCustomerInput, type UpdateMediaInput, type UpdateMenuInput, type UpdateMenuItemInput, type UpdatePageInput, type UpdatePostInput, type UpdateProductCategoryInput, type UpdateProductInput, type UpdateProductTagInput, type UpdateTagInput, type UploadMediaInput, WCAddress, type WCCoupon, type WCCreateOrderInput, type WCCustomer, WCImage, type WCOrder, type WCOrderLineItem, WCProduct, type WCProductCategory, WCProductFilterParams, type WCProductStatus, type WCProductTag, WCProductVariation, type WCProductVariationWithOmnibus, type WCProductWithOmnibus, type WCShippingLine, WPEntity, WPGraphQLConfig, type WPGraphQLFetcher, WooCommerceConfig, type WooCommerceFetcher, WooCommerceResponse, authenticateJwt, buildACFFragment, buildPageWithACFQuery, buildPostWithACFQuery, buildPostsWithACFQuery, createApplicationPasswordToken, createAuthorsMutations, createCPTQueries, createCategoriesMutations, createCommentsMutations, createMediaMutations, createMenusMutations, createPagesMutations, createPostsMutations, createRevalidationHandler, createTagsMutations, createWPGraphQLCoreClient as createWPGraphQLClient, createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLMutationsClient, createWPGraphQLWooCommerceClient, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYoastQueries, extractOmnibusData, resolveBaseUrl, validateJwtToken, withOmnibus, withOmnibusVariation };