@szymonpiatek/nextwordpress 0.0.3 → 0.0.5

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,282 @@ interface CreateCommentInput {
304
112
  parent?: number;
305
113
  }
306
114
 
115
+ type CF7SubmissionStatus = 'mail_sent' | 'mail_failed' | 'validation_failed' | 'spam' | 'aborted';
116
+ interface CF7ValidationError {
117
+ field: string;
118
+ message: string;
119
+ idref: string | null;
120
+ }
121
+ interface CF7SubmissionResponse {
122
+ status: CF7SubmissionStatus;
123
+ message: string;
124
+ invalid_fields?: CF7ValidationError[];
125
+ }
126
+
127
+ declare function createCF7Queries(config: NextWordpressConfig): {
128
+ submitForm: (formId: number, data: Record<string, string>) => Promise<CF7SubmissionResponse>;
129
+ };
130
+
131
+ type RestPostStatus = 'publish' | 'draft' | 'pending' | 'private' | 'future';
132
+ interface CreatePostInput {
133
+ title: string;
134
+ content?: string;
135
+ excerpt?: string;
136
+ status?: RestPostStatus;
137
+ author?: number;
138
+ date?: string;
139
+ slug?: string;
140
+ categories?: number[];
141
+ tags?: number[];
142
+ featured_media?: number;
143
+ }
144
+ interface UpdatePostInput extends Partial<Omit<CreatePostInput, 'title'>> {
145
+ title?: string;
146
+ }
147
+
148
+ declare function createPostsMutations(fetcher: WordPressFetcher): {
149
+ createPost: (input: CreatePostInput, authToken: string) => Promise<Post>;
150
+ updatePost: (id: number, input: UpdatePostInput, authToken: string) => Promise<Post>;
151
+ deletePost: (id: number, authToken: string, force?: boolean) => Promise<{
152
+ deleted: boolean;
153
+ previous: Post;
154
+ }>;
155
+ };
156
+
157
+ interface UpdateCommentInput {
158
+ content?: string;
159
+ author_name?: string;
160
+ author_email?: string;
161
+ author_url?: string;
162
+ status?: 'approve' | 'hold' | 'spam' | 'trash';
163
+ }
164
+
165
+ declare function createCommentsMutations(fetcher: WordPressFetcher): {
166
+ createComment: (input: CreateCommentInput, authToken?: string) => Promise<Comment>;
167
+ updateComment: (id: number, input: UpdateCommentInput, authToken: string) => Promise<Comment>;
168
+ deleteComment: (id: number, authToken: string, force?: boolean) => Promise<{
169
+ deleted: boolean;
170
+ previous: Comment;
171
+ }>;
172
+ };
173
+
174
+ type RestPageStatus = 'publish' | 'draft' | 'pending' | 'private' | 'future';
175
+ interface CreatePageInput {
176
+ title: string;
177
+ content?: string;
178
+ excerpt?: string;
179
+ status?: RestPageStatus;
180
+ author?: number;
181
+ parent?: number;
182
+ menu_order?: number;
183
+ slug?: string;
184
+ featured_media?: number;
185
+ comment_status?: 'open' | 'closed';
186
+ }
187
+ interface UpdatePageInput extends Partial<Omit<CreatePageInput, 'title'>> {
188
+ title?: string;
189
+ }
190
+
191
+ declare function createPagesMutations(fetcher: WordPressFetcher): {
192
+ createPage: (input: CreatePageInput, authToken: string) => Promise<Page>;
193
+ updatePage: (id: number, input: UpdatePageInput, authToken: string) => Promise<Page>;
194
+ deletePage: (id: number, authToken: string, force?: boolean) => Promise<{
195
+ deleted: boolean;
196
+ previous: Page;
197
+ }>;
198
+ };
199
+
200
+ interface CreateCategoryInput {
201
+ name: string;
202
+ description?: string;
203
+ slug?: string;
204
+ parent?: number;
205
+ }
206
+ type UpdateCategoryInput = Partial<CreateCategoryInput>;
207
+
208
+ declare function createCategoriesMutations(fetcher: WordPressFetcher): {
209
+ createCategory: (input: CreateCategoryInput, authToken: string) => Promise<Category>;
210
+ updateCategory: (id: number, input: UpdateCategoryInput, authToken: string) => Promise<Category>;
211
+ deleteCategory: (id: number, authToken: string, force?: boolean) => Promise<{
212
+ deleted: boolean;
213
+ previous: Category;
214
+ }>;
215
+ };
216
+
217
+ interface CreateTagInput {
218
+ name: string;
219
+ description?: string;
220
+ slug?: string;
221
+ }
222
+ type UpdateTagInput = Partial<CreateTagInput>;
223
+
224
+ declare function createTagsMutations(fetcher: WordPressFetcher): {
225
+ createTag: (input: CreateTagInput, authToken: string) => Promise<Tag>;
226
+ updateTag: (id: number, input: UpdateTagInput, authToken: string) => Promise<Tag>;
227
+ deleteTag: (id: number, authToken: string, force?: boolean) => Promise<{
228
+ deleted: boolean;
229
+ previous: Tag;
230
+ }>;
231
+ };
232
+
233
+ interface CreateAuthorInput {
234
+ username: string;
235
+ email: string;
236
+ password: string;
237
+ name?: string;
238
+ first_name?: string;
239
+ last_name?: string;
240
+ url?: string;
241
+ description?: string;
242
+ nickname?: string;
243
+ slug?: string;
244
+ roles?: string[];
245
+ }
246
+ interface UpdateAuthorInput {
247
+ name?: string;
248
+ first_name?: string;
249
+ last_name?: string;
250
+ email?: string;
251
+ url?: string;
252
+ description?: string;
253
+ nickname?: string;
254
+ slug?: string;
255
+ password?: string;
256
+ roles?: string[];
257
+ }
258
+
259
+ declare function createAuthorsMutations(fetcher: WordPressFetcher): {
260
+ createAuthor: (input: CreateAuthorInput, authToken: string) => Promise<Author>;
261
+ updateAuthor: (id: number, input: UpdateAuthorInput, authToken: string) => Promise<Author>;
262
+ deleteAuthor: (id: number, authToken: string, reassign: number) => Promise<{
263
+ deleted: boolean;
264
+ previous: Author;
265
+ }>;
266
+ };
267
+
268
+ interface CreateMenuInput {
269
+ name: string;
270
+ slug?: string;
271
+ description?: string;
272
+ }
273
+ type UpdateMenuInput = Partial<CreateMenuInput>;
274
+ interface CreateMenuItemInput {
275
+ title: string;
276
+ menus: number;
277
+ url?: string;
278
+ status?: 'publish' | 'draft';
279
+ attr_title?: string;
280
+ description?: string;
281
+ type?: string;
282
+ object?: string;
283
+ object_id?: number;
284
+ parent?: number;
285
+ menu_order?: number;
286
+ target?: string;
287
+ classes?: string[];
288
+ xfn?: string[];
289
+ }
290
+ interface UpdateMenuItemInput extends Partial<Omit<CreateMenuItemInput, 'menus'>> {
291
+ menus?: number;
292
+ }
293
+
294
+ declare function createMenusMutations(fetcher: WordPressFetcher): {
295
+ createMenu: (input: CreateMenuInput, authToken: string) => Promise<Menu>;
296
+ updateMenu: (id: number, input: UpdateMenuInput, authToken: string) => Promise<Menu>;
297
+ deleteMenu: (id: number, authToken: string) => Promise<{
298
+ deleted: boolean;
299
+ previous: Menu;
300
+ }>;
301
+ createMenuItem: (input: CreateMenuItemInput, authToken: string) => Promise<MenuItem>;
302
+ updateMenuItem: (id: number, input: UpdateMenuItemInput, authToken: string) => Promise<MenuItem>;
303
+ deleteMenuItem: (id: number, authToken: string, force?: boolean) => Promise<{
304
+ deleted: boolean;
305
+ previous: MenuItem;
306
+ }>;
307
+ };
308
+
309
+ interface UploadMediaInput {
310
+ file: Blob | Buffer;
311
+ filename: string;
312
+ mimeType: string;
313
+ title?: string;
314
+ caption?: string;
315
+ alt_text?: string;
316
+ }
317
+ interface UpdateMediaInput {
318
+ title?: string;
319
+ caption?: string;
320
+ alt_text?: string;
321
+ description?: string;
322
+ post?: number;
323
+ }
324
+
325
+ declare function createMediaMutations(fetcher: WordPressFetcher): {
326
+ uploadMedia: (input: UploadMediaInput, authToken: string) => Promise<FeaturedMedia>;
327
+ updateMedia: (id: number, input: UpdateMediaInput, authToken: string) => Promise<FeaturedMedia>;
328
+ deleteMedia: (id: number, authToken: string, force?: boolean) => Promise<{
329
+ deleted: boolean;
330
+ previous: FeaturedMedia;
331
+ }>;
332
+ };
333
+
334
+ declare function createWordPressMutationsClient(config: NextWordpressConfig): {
335
+ uploadMedia: (input: UploadMediaInput, authToken: string) => Promise<FeaturedMedia>;
336
+ updateMedia: (id: number, input: UpdateMediaInput, authToken: string) => Promise<FeaturedMedia>;
337
+ deleteMedia: (id: number, authToken: string, force?: boolean) => Promise<{
338
+ deleted: boolean;
339
+ previous: FeaturedMedia;
340
+ }>;
341
+ createMenu: (input: CreateMenuInput, authToken: string) => Promise<Menu>;
342
+ updateMenu: (id: number, input: UpdateMenuInput, authToken: string) => Promise<Menu>;
343
+ deleteMenu: (id: number, authToken: string) => Promise<{
344
+ deleted: boolean;
345
+ previous: Menu;
346
+ }>;
347
+ createMenuItem: (input: CreateMenuItemInput, authToken: string) => Promise<MenuItem>;
348
+ updateMenuItem: (id: number, input: UpdateMenuItemInput, authToken: string) => Promise<MenuItem>;
349
+ deleteMenuItem: (id: number, authToken: string, force?: boolean) => Promise<{
350
+ deleted: boolean;
351
+ previous: MenuItem;
352
+ }>;
353
+ createAuthor: (input: CreateAuthorInput, authToken: string) => Promise<Author>;
354
+ updateAuthor: (id: number, input: UpdateAuthorInput, authToken: string) => Promise<Author>;
355
+ deleteAuthor: (id: number, authToken: string, reassign: number) => Promise<{
356
+ deleted: boolean;
357
+ previous: Author;
358
+ }>;
359
+ createTag: (input: CreateTagInput, authToken: string) => Promise<Tag>;
360
+ updateTag: (id: number, input: UpdateTagInput, authToken: string) => Promise<Tag>;
361
+ deleteTag: (id: number, authToken: string, force?: boolean) => Promise<{
362
+ deleted: boolean;
363
+ previous: Tag;
364
+ }>;
365
+ createCategory: (input: CreateCategoryInput, authToken: string) => Promise<Category>;
366
+ updateCategory: (id: number, input: UpdateCategoryInput, authToken: string) => Promise<Category>;
367
+ deleteCategory: (id: number, authToken: string, force?: boolean) => Promise<{
368
+ deleted: boolean;
369
+ previous: Category;
370
+ }>;
371
+ createPage: (input: CreatePageInput, authToken: string) => Promise<Page>;
372
+ updatePage: (id: number, input: UpdatePageInput, authToken: string) => Promise<Page>;
373
+ deletePage: (id: number, authToken: string, force?: boolean) => Promise<{
374
+ deleted: boolean;
375
+ previous: Page;
376
+ }>;
377
+ createComment: (input: CreateCommentInput, authToken?: string) => Promise<Comment>;
378
+ updateComment: (id: number, input: UpdateCommentInput, authToken: string) => Promise<Comment>;
379
+ deleteComment: (id: number, authToken: string, force?: boolean) => Promise<{
380
+ deleted: boolean;
381
+ previous: Comment;
382
+ }>;
383
+ createPost: (input: CreatePostInput, authToken: string) => Promise<Post>;
384
+ updatePost: (id: number, input: UpdatePostInput, authToken: string) => Promise<Post>;
385
+ deletePost: (id: number, authToken: string, force?: boolean) => Promise<{
386
+ deleted: boolean;
387
+ previous: Post;
388
+ }>;
389
+ };
390
+
307
391
  declare function createWordPressClient(config: NextWordpressConfig): {
308
392
  getCommentsByPostId: (postId: number, page?: number, perPage?: number) => Promise<WordPressResponse<Comment[]>>;
309
393
  getAllCommentsByPostId: (postId: number) => Promise<Comment[]>;
@@ -362,21 +446,6 @@ declare function createWordPressClient(config: NextWordpressConfig): {
362
446
  }[]>;
363
447
  };
364
448
 
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
449
  declare function createWooCommerceFetcher(config: WooCommerceConfig): {
381
450
  wcFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[], options?: RequestInit) => Promise<T>;
382
451
  wcFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
@@ -386,31 +455,6 @@ declare function createWooCommerceFetcher(config: WooCommerceConfig): {
386
455
  };
387
456
  type WooCommerceFetcher = ReturnType<typeof createWooCommerceFetcher>;
388
457
 
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
458
  interface WCProductCategory {
415
459
  id: number;
416
460
  name: string;
@@ -423,124 +467,57 @@ interface WCProductCategory {
423
467
  count: number;
424
468
  }
425
469
 
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;
470
+ interface CreateProductCategoryInput {
436
471
  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
- }>;
472
+ slug?: string;
473
+ parent?: number;
474
+ description?: string;
475
+ display?: 'default' | 'products' | 'subcategories' | 'both';
476
+ image?: {
477
+ src: string;
478
+ alt?: string;
479
+ };
480
+ menu_order?: number;
465
481
  }
466
- interface WCProduct {
467
- id: number;
482
+ type UpdateProductCategoryInput = Partial<CreateProductCategoryInput>;
483
+
484
+ type WCProductStatus = 'draft' | 'pending' | 'private' | 'publish';
485
+ interface CreateProductInput {
468
486
  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<{
487
+ type?: 'simple' | 'variable' | 'grouped' | 'external';
488
+ status?: WCProductStatus;
489
+ description?: string;
490
+ short_description?: string;
491
+ sku?: string;
492
+ regular_price?: string;
493
+ sale_price?: string;
494
+ manage_stock?: boolean;
495
+ stock_quantity?: number;
496
+ stock_status?: 'instock' | 'outofstock' | 'onbackorder';
497
+ categories?: {
511
498
  id: number;
512
- name: string;
513
- slug: string;
514
- }>;
515
- tags: Array<{
499
+ }[];
500
+ tags?: {
516
501
  id: number;
502
+ }[];
503
+ images?: {
504
+ src: string;
505
+ alt?: string;
506
+ }[];
507
+ featured?: boolean;
508
+ virtual?: boolean;
509
+ downloadable?: boolean;
510
+ weight?: string;
511
+ attributes?: {
512
+ id?: number;
517
513
  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
- }>;
514
+ options: string[];
515
+ visible?: boolean;
516
+ variation?: boolean;
517
+ }[];
531
518
  }
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'];
519
+ interface UpdateProductInput extends Partial<Omit<CreateProductInput, 'name'>> {
520
+ name?: string;
544
521
  }
545
522
 
546
523
  interface WCProductTag {
@@ -551,6 +528,13 @@ interface WCProductTag {
551
528
  count: number;
552
529
  }
553
530
 
531
+ interface CreateProductTagInput {
532
+ name: string;
533
+ slug?: string;
534
+ description?: string;
535
+ }
536
+ type UpdateProductTagInput = Partial<CreateProductTagInput>;
537
+
554
538
  interface WCOrderLineItem {
555
539
  id: number;
556
540
  name: string;
@@ -673,6 +657,23 @@ interface WCCoupon {
673
657
  description: string;
674
658
  }
675
659
 
660
+ interface CreateCouponInput {
661
+ code: string;
662
+ discount_type?: 'percent' | 'fixed_cart' | 'fixed_product';
663
+ amount?: string;
664
+ description?: string;
665
+ date_expires?: string | null;
666
+ individual_use?: boolean;
667
+ product_ids?: number[];
668
+ excluded_product_ids?: number[];
669
+ usage_limit?: number | null;
670
+ usage_limit_per_user?: number | null;
671
+ free_shipping?: boolean;
672
+ minimum_amount?: string;
673
+ maximum_amount?: string;
674
+ }
675
+ type UpdateCouponInput = Partial<CreateCouponInput>;
676
+
676
677
  interface WCCustomer {
677
678
  id: number;
678
679
  date_created: string;
@@ -695,6 +696,20 @@ interface WCCustomer {
695
696
  }>;
696
697
  }
697
698
 
699
+ interface UpdateCustomerInput {
700
+ email?: string;
701
+ first_name?: string;
702
+ last_name?: string;
703
+ username?: string;
704
+ password?: string;
705
+ billing?: Partial<WCAddress>;
706
+ shipping?: Partial<Omit<WCAddress, 'email' | 'phone'>>;
707
+ meta_data?: {
708
+ key: string;
709
+ value: unknown;
710
+ }[];
711
+ }
712
+
698
713
  interface OmnibusPriceEntry {
699
714
  price: string;
700
715
  date: string;
@@ -734,6 +749,17 @@ declare function createWooCommerceClient(config: WooCommerceConfig): {
734
749
  billing?: Partial<WCAddress>;
735
750
  shipping?: Partial<Omit<WCAddress, "email" | "phone">>;
736
751
  }) => Promise<WCCustomer>;
752
+ updateCustomer: (id: number, data: UpdateCustomerInput) => Promise<WCCustomer>;
753
+ deleteCustomer: (id: number, reassign?: number) => Promise<{
754
+ deleted: boolean;
755
+ previous: WCCustomer;
756
+ }>;
757
+ createCoupon: (input: CreateCouponInput) => Promise<WCCoupon>;
758
+ updateCoupon: (id: number, input: UpdateCouponInput) => Promise<WCCoupon>;
759
+ deleteCoupon: (id: number, force?: boolean) => Promise<{
760
+ deleted: boolean;
761
+ previous: WCCoupon;
762
+ }>;
737
763
  getCouponByCode: (code: string) => Promise<WCCoupon | undefined>;
738
764
  validateCoupon: (code: string) => Promise<{
739
765
  valid: boolean;
@@ -744,14 +770,36 @@ declare function createWooCommerceClient(config: WooCommerceConfig): {
744
770
  getOrderById: (id: number) => Promise<WCOrder>;
745
771
  updateOrder: (id: number, data: Partial<WCCreateOrderInput>) => Promise<WCOrder>;
746
772
  getOrdersByCustomer: (customerId: number) => Promise<WCOrder[]>;
773
+ deleteOrder: (id: number, force?: boolean) => Promise<{
774
+ deleted: boolean;
775
+ previous: WCOrder;
776
+ }>;
777
+ createProductTag: (input: CreateProductTagInput) => Promise<WCProductTag>;
778
+ updateProductTag: (id: number, input: UpdateProductTagInput) => Promise<WCProductTag>;
779
+ deleteProductTag: (id: number, force?: boolean) => Promise<{
780
+ deleted: boolean;
781
+ previous: WCProductTag;
782
+ }>;
747
783
  getAllProductTags: () => Promise<WCProductTag[]>;
748
784
  getProductTagById: (id: number) => Promise<WCProductTag>;
749
785
  getProductsByTag: (tagId: number, limit?: number) => Promise<WCProduct[]>;
786
+ createProductCategory: (input: CreateProductCategoryInput) => Promise<WCProductCategory>;
787
+ updateProductCategory: (id: number, input: UpdateProductCategoryInput) => Promise<WCProductCategory>;
788
+ deleteProductCategory: (id: number, force?: boolean) => Promise<{
789
+ deleted: boolean;
790
+ previous: WCProductCategory;
791
+ }>;
750
792
  getAllProductCategories: () => Promise<WCProductCategory[]>;
751
793
  getProductCategoryById: (id: number) => Promise<WCProductCategory>;
752
794
  getProductCategoryBySlug: (slug: string) => Promise<WCProductCategory | undefined>;
753
795
  getProductsByCategory: (categoryId: number, limit?: number) => Promise<WCProduct[]>;
754
796
  getProductsByCategorySlug: (categorySlug: string) => Promise<WCProduct[]>;
797
+ createProduct: (input: CreateProductInput) => Promise<WCProduct>;
798
+ updateProduct: (id: number, input: UpdateProductInput) => Promise<WCProduct>;
799
+ deleteProduct: (id: number, force?: boolean) => Promise<{
800
+ deleted: boolean;
801
+ previous: WCProduct;
802
+ }>;
755
803
  getProducts: (filterParams?: WCProductFilterParams) => Promise<WCProduct[]>;
756
804
  getProductsPaginated: (page?: number, perPage?: number, filterParams?: WCProductFilterParams) => Promise<WooCommerceResponse<WCProduct[]>>;
757
805
  getProductById: (id: number) => Promise<WCProduct>;
@@ -766,92 +814,13 @@ declare function createWooCommerceClient(config: WooCommerceConfig): {
766
814
  getProductVariationById: (productId: number, variationId: number) => Promise<WCProductVariation>;
767
815
  };
768
816
 
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
817
  declare function createWPGraphQLFetcher(config: WPGraphQLConfig): {
796
818
  gqlFetch: <TData>(document: string, variables?: Record<string, unknown>, tags?: string[]) => Promise<TData>;
797
819
  gqlFetchGraceful: <TData>(document: string, fallback: TData, variables?: Record<string, unknown>, tags?: string[]) => Promise<TData>;
820
+ gqlMutate: <TData>(document: string, variables?: Record<string, unknown>, authToken?: string) => Promise<TData>;
798
821
  };
799
822
  type WPGraphQLFetcher = ReturnType<typeof createWPGraphQLFetcher>;
800
823
 
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
824
  interface GQLPage {
856
825
  id: string;
857
826
  databaseId: number;
@@ -871,7 +840,7 @@ interface GQLPage {
871
840
  height: number;
872
841
  };
873
842
  };
874
- };
843
+ } | null;
875
844
  }
876
845
 
877
846
  interface GQLCategory {
@@ -888,7 +857,7 @@ interface GQLCategory {
888
857
  name: string;
889
858
  slug: string;
890
859
  };
891
- };
860
+ } | null;
892
861
  }
893
862
 
894
863
  interface GQLTag {
@@ -933,7 +902,7 @@ interface GQLMenuItem {
933
902
  databaseId?: number;
934
903
  slug?: string;
935
904
  };
936
- };
905
+ } | null;
937
906
  }
938
907
  interface GQLMenu {
939
908
  id: string;
@@ -970,7 +939,277 @@ interface GQLComment {
970
939
  };
971
940
  }
972
941
 
942
+ interface GQLMediaItem {
943
+ id: string;
944
+ databaseId: number;
945
+ slug: string;
946
+ title: string;
947
+ date: string;
948
+ sourceUrl: string;
949
+ altText: string;
950
+ caption: string;
951
+ description: string;
952
+ mediaType: string;
953
+ mimeType: string;
954
+ uri: string;
955
+ mediaDetails: {
956
+ width: number;
957
+ height: number;
958
+ file: string;
959
+ sizes: {
960
+ name: string;
961
+ width: number;
962
+ height: number;
963
+ mimeType: string;
964
+ sourceUrl: string;
965
+ }[];
966
+ };
967
+ }
968
+
969
+ type GQLPostStatus = 'PUBLISH' | 'DRAFT' | 'PENDING' | 'PRIVATE' | 'FUTURE';
970
+ interface GQLCreatePostInput {
971
+ title: string;
972
+ content?: string;
973
+ excerpt?: string;
974
+ status?: GQLPostStatus;
975
+ authorId?: string;
976
+ date?: string;
977
+ slug?: string;
978
+ categoryIds?: number[];
979
+ tagIds?: number[];
980
+ }
981
+ interface GQLUpdatePostInput {
982
+ id: string;
983
+ title?: string;
984
+ content?: string;
985
+ excerpt?: string;
986
+ status?: GQLPostStatus;
987
+ date?: string;
988
+ slug?: string;
989
+ categoryIds?: number[];
990
+ tagIds?: number[];
991
+ }
992
+ interface GQLMutatedPost {
993
+ id: string;
994
+ databaseId: number;
995
+ slug: string;
996
+ title: string;
997
+ status: string;
998
+ }
999
+ interface GQLDeletePostResult {
1000
+ deletedId: string | null;
1001
+ post: GQLMutatedPost | null;
1002
+ }
1003
+
1004
+ interface GQLCreateCommentInput {
1005
+ postId: number;
1006
+ content: string;
1007
+ authorName?: string;
1008
+ authorEmail?: string;
1009
+ authorUrl?: string;
1010
+ parentId?: string;
1011
+ }
1012
+ interface GQLUpdateCommentInput {
1013
+ id: string;
1014
+ content?: string;
1015
+ status?: string;
1016
+ }
1017
+ interface GQLMutatedComment {
1018
+ id: string;
1019
+ databaseId: number;
1020
+ content: string;
1021
+ date: string;
1022
+ status: string;
1023
+ parentId: string | null;
1024
+ author: {
1025
+ node: {
1026
+ name: string;
1027
+ url: string;
1028
+ };
1029
+ };
1030
+ }
1031
+ interface GQLCreateCommentResult {
1032
+ success: boolean;
1033
+ comment: GQLMutatedComment | null;
1034
+ }
1035
+ interface GQLDeleteCommentResult {
1036
+ deletedId: string | null;
1037
+ comment: GQLMutatedComment | null;
1038
+ }
1039
+
1040
+ type GQLPageStatus = 'PUBLISH' | 'DRAFT' | 'PENDING' | 'PRIVATE' | 'FUTURE';
1041
+ interface GQLCreatePageInput {
1042
+ title: string;
1043
+ content?: string;
1044
+ excerpt?: string;
1045
+ status?: GQLPageStatus;
1046
+ authorId?: string;
1047
+ date?: string;
1048
+ slug?: string;
1049
+ parentId?: string;
1050
+ menuOrder?: number;
1051
+ }
1052
+ interface GQLUpdatePageInput {
1053
+ id: string;
1054
+ title?: string;
1055
+ content?: string;
1056
+ excerpt?: string;
1057
+ status?: GQLPageStatus;
1058
+ date?: string;
1059
+ slug?: string;
1060
+ parentId?: string;
1061
+ menuOrder?: number;
1062
+ }
1063
+ interface GQLMutatedPage {
1064
+ id: string;
1065
+ databaseId: number;
1066
+ slug: string;
1067
+ title: string;
1068
+ status: string;
1069
+ uri: string;
1070
+ }
1071
+ interface GQLDeletePageResult {
1072
+ deletedId: string | null;
1073
+ page: GQLMutatedPage | null;
1074
+ }
1075
+
1076
+ interface GQLCreateCategoryInput {
1077
+ name: string;
1078
+ description?: string;
1079
+ slug?: string;
1080
+ parentId?: string;
1081
+ }
1082
+ interface GQLUpdateCategoryInput {
1083
+ id: string;
1084
+ name?: string;
1085
+ description?: string;
1086
+ slug?: string;
1087
+ parentId?: string;
1088
+ }
1089
+ interface GQLMutatedCategory {
1090
+ id: string;
1091
+ databaseId: number;
1092
+ name: string;
1093
+ slug: string;
1094
+ }
1095
+ interface GQLDeleteCategoryResult {
1096
+ deletedId: string | null;
1097
+ category: GQLMutatedCategory | null;
1098
+ }
1099
+
1100
+ interface GQLCreateTagInput {
1101
+ name: string;
1102
+ description?: string;
1103
+ slug?: string;
1104
+ }
1105
+ interface GQLUpdateTagInput {
1106
+ id: string;
1107
+ name?: string;
1108
+ description?: string;
1109
+ slug?: string;
1110
+ }
1111
+ interface GQLMutatedTag {
1112
+ id: string;
1113
+ databaseId: number;
1114
+ name: string;
1115
+ slug: string;
1116
+ }
1117
+ interface GQLDeleteTagResult {
1118
+ deletedId: string | null;
1119
+ tag: GQLMutatedTag | null;
1120
+ }
1121
+
1122
+ interface GQLRegisterUserInput {
1123
+ username: string;
1124
+ email: string;
1125
+ password: string;
1126
+ firstName?: string;
1127
+ lastName?: string;
1128
+ displayName?: string;
1129
+ websiteUrl?: string;
1130
+ description?: string;
1131
+ nicename?: string;
1132
+ }
1133
+ interface GQLUpdateUserInput {
1134
+ id: string;
1135
+ firstName?: string;
1136
+ lastName?: string;
1137
+ email?: string;
1138
+ websiteUrl?: string;
1139
+ description?: string;
1140
+ password?: string;
1141
+ displayName?: string;
1142
+ nicename?: string;
1143
+ }
1144
+ interface GQLMutatedUser {
1145
+ id: string;
1146
+ databaseId: number;
1147
+ name: string;
1148
+ slug: string;
1149
+ email: string;
1150
+ }
1151
+ interface GQLDeleteUserResult {
1152
+ deletedId: string | null;
1153
+ user: GQLMutatedUser | null;
1154
+ }
1155
+
1156
+ interface GQLCreateMediaItemInput {
1157
+ filePath: string;
1158
+ fileType?: string;
1159
+ title?: string;
1160
+ altText?: string;
1161
+ caption?: string;
1162
+ description?: string;
1163
+ postId?: number;
1164
+ }
1165
+ interface GQLUpdateMediaItemInput {
1166
+ id: string;
1167
+ title?: string;
1168
+ altText?: string;
1169
+ caption?: string;
1170
+ description?: string;
1171
+ }
1172
+ interface GQLMutatedMediaItem {
1173
+ id: string;
1174
+ databaseId: number;
1175
+ slug: string;
1176
+ title: string;
1177
+ sourceUrl: string;
1178
+ altText: string;
1179
+ }
1180
+ interface GQLDeleteMediaItemResult {
1181
+ deletedId: string | null;
1182
+ mediaItem: GQLMutatedMediaItem | null;
1183
+ }
1184
+
1185
+ declare function createWPGraphQLMutationsClient(config: WPGraphQLConfig): {
1186
+ createMediaItem: (input: GQLCreateMediaItemInput, authToken: string) => Promise<GQLMutatedMediaItem>;
1187
+ updateMediaItem: (input: GQLUpdateMediaItemInput, authToken: string) => Promise<GQLMutatedMediaItem>;
1188
+ deleteMediaItem: (id: string, authToken: string, forceDelete?: boolean) => Promise<GQLDeleteMediaItemResult>;
1189
+ registerUser: (input: GQLRegisterUserInput, authToken?: string) => Promise<GQLMutatedUser>;
1190
+ updateUser: (input: GQLUpdateUserInput, authToken: string) => Promise<GQLMutatedUser>;
1191
+ deleteUser: (id: string, authToken: string, reassignPosts?: string) => Promise<GQLDeleteUserResult>;
1192
+ createTag: (input: GQLCreateTagInput, authToken: string) => Promise<GQLMutatedTag>;
1193
+ updateTag: (input: GQLUpdateTagInput, authToken: string) => Promise<GQLMutatedTag>;
1194
+ deleteTag: (id: string, authToken: string) => Promise<GQLDeleteTagResult>;
1195
+ createCategory: (input: GQLCreateCategoryInput, authToken: string) => Promise<GQLMutatedCategory>;
1196
+ updateCategory: (input: GQLUpdateCategoryInput, authToken: string) => Promise<GQLMutatedCategory>;
1197
+ deleteCategory: (id: string, authToken: string) => Promise<GQLDeleteCategoryResult>;
1198
+ createPage: (input: GQLCreatePageInput, authToken: string) => Promise<GQLMutatedPage>;
1199
+ updatePage: (input: GQLUpdatePageInput, authToken: string) => Promise<GQLMutatedPage>;
1200
+ deletePage: (id: string, authToken: string, forceDelete?: boolean) => Promise<GQLDeletePageResult>;
1201
+ createComment: (input: GQLCreateCommentInput, authToken?: string) => Promise<GQLCreateCommentResult>;
1202
+ updateComment: (input: GQLUpdateCommentInput, authToken: string) => Promise<GQLMutatedComment>;
1203
+ deleteComment: (id: string, authToken: string, forceDelete?: boolean) => Promise<GQLDeleteCommentResult>;
1204
+ createPost: (input: GQLCreatePostInput, authToken: string) => Promise<GQLMutatedPost>;
1205
+ updatePost: (input: GQLUpdatePostInput, authToken: string) => Promise<GQLMutatedPost>;
1206
+ deletePost: (id: string, authToken: string, forceDelete?: boolean) => Promise<GQLDeletePostResult>;
1207
+ };
1208
+
973
1209
  declare function createWPGraphQLCoreClient(config: WPGraphQLConfig): {
1210
+ getMediaItems: (first?: number, after?: string) => Promise<GQLConnection<GQLMediaItem>>;
1211
+ getMediaItemById: (id: number) => Promise<GQLMediaItem | null>;
1212
+ getMediaItemBySlug: (slug: string) => Promise<GQLMediaItem | null>;
974
1213
  getCommentsByPostId: (postId: number, first?: number, after?: string) => Promise<{
975
1214
  nodes: GQLComment[];
976
1215
  pageInfo: {
@@ -1020,12 +1259,12 @@ interface GQLYoastSEO {
1020
1259
  opengraphImage?: {
1021
1260
  sourceUrl: string;
1022
1261
  altText: string;
1023
- };
1262
+ } | null;
1024
1263
  twitterTitle: string;
1025
1264
  twitterDescription: string;
1026
1265
  twitterImage?: {
1027
1266
  sourceUrl: string;
1028
- };
1267
+ } | null;
1029
1268
  schema?: {
1030
1269
  raw: string;
1031
1270
  };
@@ -1203,7 +1442,63 @@ interface GQLCustomer {
1203
1442
  };
1204
1443
  }
1205
1444
 
1445
+ interface GQLProductCategory {
1446
+ id: string;
1447
+ databaseId: number;
1448
+ name: string;
1449
+ slug: string;
1450
+ description: string;
1451
+ count: number;
1452
+ parent: {
1453
+ node: {
1454
+ id: string;
1455
+ databaseId: number;
1456
+ name: string;
1457
+ slug: string;
1458
+ };
1459
+ } | null;
1460
+ image: {
1461
+ sourceUrl: string;
1462
+ altText: string;
1463
+ } | null;
1464
+ }
1465
+
1466
+ interface GQLProductTag {
1467
+ id: string;
1468
+ databaseId: number;
1469
+ name: string;
1470
+ slug: string;
1471
+ description: string;
1472
+ count: number;
1473
+ }
1474
+
1475
+ interface GQLCoupon {
1476
+ id: string;
1477
+ databaseId: number;
1478
+ code: string;
1479
+ discountType: string;
1480
+ amount: string;
1481
+ dateExpiry: string | null;
1482
+ usageCount: number;
1483
+ usageLimit: number | null;
1484
+ usageLimitPerUser: number | null;
1485
+ individualUse: boolean;
1486
+ freeShipping: boolean;
1487
+ minimumAmount: string;
1488
+ maximumAmount: string;
1489
+ description: string;
1490
+ }
1491
+
1206
1492
  declare function createWPGraphQLWooCommerceClient(config: WPGraphQLConfig): {
1493
+ getCoupons: (first?: number, after?: string) => Promise<GQLConnection<GQLCoupon>>;
1494
+ getCouponByCode: (code: string) => Promise<GQLCoupon | null>;
1495
+ getCouponById: (id: number) => Promise<GQLCoupon | null>;
1496
+ getProductTags: (first?: number, after?: string) => Promise<GQLConnection<GQLProductTag>>;
1497
+ getProductTagBySlug: (slug: string) => Promise<GQLProductTag | null>;
1498
+ getProductTagById: (id: number) => Promise<GQLProductTag | null>;
1499
+ getProductCategories: (first?: number, after?: string) => Promise<GQLConnection<GQLProductCategory>>;
1500
+ getProductCategoryBySlug: (slug: string) => Promise<GQLProductCategory | null>;
1501
+ getProductCategoryById: (id: number) => Promise<GQLProductCategory | null>;
1207
1502
  getCustomer: () => Promise<GQLCustomer | null>;
1208
1503
  getCustomerById: (id: number) => Promise<GQLCustomer | null>;
1209
1504
  getOrder: (id: number) => Promise<GQLOrder | null>;
@@ -1238,4 +1533,59 @@ declare function createCPTQueries(fetcher: WPGraphQLFetcher, typeName: string, s
1238
1533
  }[]>;
1239
1534
  };
1240
1535
 
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 };
1536
+ interface RevalidationConfig {
1537
+ secret: string;
1538
+ }
1539
+ interface RevalidationPayload {
1540
+ action: string;
1541
+ post_id?: number;
1542
+ post_type?: string;
1543
+ slug?: string;
1544
+ taxonomy?: string;
1545
+ term_id?: number;
1546
+ }
1547
+ interface RevalidationResult {
1548
+ revalidated: boolean;
1549
+ tags: string[];
1550
+ message?: string;
1551
+ }
1552
+ declare function createRevalidationHandler(config: RevalidationConfig, revalidateTag: (tag: string) => void): (request: Request) => Promise<Response>;
1553
+
1554
+ interface FaustConfig {
1555
+ wpUrl: string;
1556
+ secretKey: string;
1557
+ cookieName?: string;
1558
+ }
1559
+ interface FaustPreviewConfig {
1560
+ wpUrl: string;
1561
+ secretKey: string;
1562
+ previewPath?: string;
1563
+ }
1564
+ interface FaustPreviewDeps {
1565
+ enableDraftMode: () => Promise<void>;
1566
+ redirect: (url: string) => never;
1567
+ }
1568
+ declare function createFaustAuthHandler(config: FaustConfig): (request: Request, routePath: string) => Promise<Response>;
1569
+ declare function createPreviewHandler(config: FaustPreviewConfig, deps: FaustPreviewDeps): (request: Request) => Promise<Response>;
1570
+
1571
+ declare function createApplicationPasswordToken(username: string, appPassword: string): string;
1572
+
1573
+ interface JwtAuthCredentials {
1574
+ username: string;
1575
+ password: string;
1576
+ }
1577
+ interface JwtAuthResponse {
1578
+ token: string;
1579
+ user_email: string;
1580
+ user_nicename: string;
1581
+ user_display_name: string;
1582
+ }
1583
+ declare class AuthenticationError extends Error {
1584
+ status: number;
1585
+ constructor(message: string, status: number);
1586
+ }
1587
+
1588
+ declare function authenticateJwt(config: NextWordpressConfig, credentials: JwtAuthCredentials): Promise<JwtAuthResponse>;
1589
+ declare function validateJwtToken(config: NextWordpressConfig, token: string): Promise<boolean>;
1590
+
1591
+ export { AuthenticationError, Author, type CF7SubmissionResponse, type CF7SubmissionStatus, type CF7ValidationError, 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, type FaustConfig, type FaustPreviewConfig, type FaustPreviewDeps, 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, createCF7Queries, createCPTQueries, createCategoriesMutations, createCommentsMutations, createFaustAuthHandler, createMediaMutations, createMenusMutations, createPagesMutations, createPostsMutations, createPreviewHandler, createRevalidationHandler, createTagsMutations, createWPGraphQLCoreClient as createWPGraphQLClient, createWPGraphQLCoreClient, createWPGraphQLFetcher, createWPGraphQLMutationsClient, createWPGraphQLWooCommerceClient, createWooCommerceClient, createWooCommerceFetcher, createWordPressClient, createWordPressMutationsClient, createYoastQueries, extractOmnibusData, resolveBaseUrl, validateJwtToken, withOmnibus, withOmnibusVariation };