@szymonpiatek/nextwordpress 0.0.2 → 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/hooks/index.cjs +872 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.cts +26 -0
- package/dist/hooks/index.d.ts +26 -0
- package/dist/hooks/index.js +855 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.cjs +1603 -128
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +900 -428
- package/dist/index.d.ts +900 -428
- package/dist/index.js +1589 -129
- package/dist/index.js.map +1 -1
- package/dist/types-EjYH-eZp.d.cts +446 -0
- package/dist/types-EjYH-eZp.d.ts +446 -0
- package/package.json +26 -6
package/dist/index.d.cts
CHANGED
|
@@ -1,234 +1,389 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
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>;
|
|
47
15
|
|
|
48
|
-
interface
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
height: number;
|
|
52
|
-
mime_type: string;
|
|
53
|
-
source_url: string;
|
|
16
|
+
interface Category extends Taxonomy {
|
|
17
|
+
taxonomy: 'category';
|
|
18
|
+
parent: number;
|
|
54
19
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
file: string;
|
|
59
|
-
sizes: Record<string, MediaSize>;
|
|
20
|
+
|
|
21
|
+
interface Tag extends Taxonomy {
|
|
22
|
+
taxonomy: 'post_tag';
|
|
60
23
|
}
|
|
61
|
-
|
|
24
|
+
|
|
25
|
+
interface Page extends WPEntity {
|
|
62
26
|
title: RenderedTitle;
|
|
27
|
+
content: RenderedContent;
|
|
28
|
+
excerpt: RenderedContent;
|
|
63
29
|
author: number;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
source_url: string;
|
|
30
|
+
featured_media: number;
|
|
31
|
+
parent: number;
|
|
32
|
+
menu_order: number;
|
|
33
|
+
comment_status: 'open' | 'closed';
|
|
34
|
+
ping_status: 'open' | 'closed';
|
|
35
|
+
template: string;
|
|
36
|
+
meta: Record<string, unknown>;
|
|
72
37
|
}
|
|
73
38
|
|
|
74
|
-
interface
|
|
39
|
+
interface Menu {
|
|
75
40
|
id: number;
|
|
76
|
-
name: string;
|
|
77
|
-
url: string;
|
|
78
41
|
description: string;
|
|
79
|
-
|
|
42
|
+
name: string;
|
|
80
43
|
slug: string;
|
|
81
|
-
avatar_urls: Record<string, string>;
|
|
82
44
|
meta: Record<string, unknown>;
|
|
45
|
+
locations: string[];
|
|
46
|
+
auto_add: boolean;
|
|
83
47
|
}
|
|
84
|
-
interface
|
|
48
|
+
interface MenuItem {
|
|
85
49
|
id: number;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
50
|
+
title: {
|
|
51
|
+
rendered: string;
|
|
52
|
+
};
|
|
53
|
+
status: string;
|
|
54
|
+
url: string;
|
|
55
|
+
attr_title: string;
|
|
56
|
+
description: string;
|
|
57
|
+
type: string;
|
|
58
|
+
type_label: string;
|
|
59
|
+
object: string;
|
|
60
|
+
object_id: number;
|
|
61
|
+
parent: number;
|
|
62
|
+
menu_order: number;
|
|
63
|
+
target: string;
|
|
64
|
+
classes: string[];
|
|
65
|
+
xfn: string[];
|
|
66
|
+
invalid: boolean;
|
|
67
|
+
menus: number;
|
|
68
|
+
meta: Record<string, unknown>;
|
|
89
69
|
}
|
|
90
|
-
interface
|
|
91
|
-
id: number;
|
|
70
|
+
interface MenuLocation {
|
|
92
71
|
name: string;
|
|
93
|
-
|
|
72
|
+
description: string;
|
|
73
|
+
menu: number;
|
|
74
|
+
}
|
|
75
|
+
interface MenuWithItems {
|
|
76
|
+
menu: Menu;
|
|
77
|
+
items: MenuItem[];
|
|
94
78
|
}
|
|
95
79
|
|
|
96
|
-
interface
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
80
|
+
interface CommentAuthorAvatar {
|
|
81
|
+
'24': string;
|
|
82
|
+
'48': string;
|
|
83
|
+
'96': string;
|
|
84
|
+
[size: string]: string;
|
|
85
|
+
}
|
|
86
|
+
interface Comment {
|
|
87
|
+
id: number;
|
|
88
|
+
post: number;
|
|
89
|
+
parent: number;
|
|
90
|
+
author: number;
|
|
91
|
+
author_name: string;
|
|
92
|
+
author_email: string;
|
|
93
|
+
author_url: string;
|
|
94
|
+
author_ip: string;
|
|
95
|
+
author_avatar_urls: CommentAuthorAvatar;
|
|
96
|
+
date: string;
|
|
97
|
+
date_gmt: string;
|
|
98
|
+
content: {
|
|
99
|
+
rendered: string;
|
|
112
100
|
};
|
|
113
|
-
|
|
101
|
+
link: string;
|
|
102
|
+
status: 'approve' | 'hold' | 'spam' | 'trash';
|
|
103
|
+
type: string;
|
|
104
|
+
meta: Record<string, unknown>;
|
|
114
105
|
}
|
|
115
|
-
interface
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
106
|
+
interface CreateCommentInput {
|
|
107
|
+
post: number;
|
|
108
|
+
content: string;
|
|
109
|
+
author_name?: string;
|
|
110
|
+
author_email?: string;
|
|
111
|
+
author_url?: string;
|
|
112
|
+
parent?: number;
|
|
119
113
|
}
|
|
120
|
-
|
|
121
|
-
|
|
114
|
+
|
|
115
|
+
type RestPostStatus = 'publish' | 'draft' | 'pending' | 'private' | 'future';
|
|
116
|
+
interface CreatePostInput {
|
|
122
117
|
title: string;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
uses_context: string[];
|
|
136
|
-
editor_script: string;
|
|
137
|
-
script: string;
|
|
138
|
-
editor_style: string;
|
|
139
|
-
style: string;
|
|
140
|
-
}
|
|
141
|
-
interface EditorBlock {
|
|
142
|
-
id: string;
|
|
143
|
-
name: string;
|
|
144
|
-
attributes: Record<string, unknown>;
|
|
145
|
-
innerBlocks: EditorBlock[];
|
|
146
|
-
innerHTML: string;
|
|
147
|
-
innerContent: (string | null)[];
|
|
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;
|
|
148
130
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
author: number;
|
|
166
|
-
area: string;
|
|
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';
|
|
167
147
|
}
|
|
168
|
-
|
|
169
|
-
|
|
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 {
|
|
170
160
|
title: string;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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;
|
|
183
173
|
}
|
|
184
174
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
189
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
_embedded?: PostEmbedded;
|
|
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;
|
|
206
205
|
}
|
|
206
|
+
type UpdateTagInput = Partial<CreateTagInput>;
|
|
207
207
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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[];
|
|
211
241
|
}
|
|
212
242
|
|
|
213
|
-
|
|
214
|
-
|
|
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;
|
|
215
276
|
}
|
|
216
277
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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;
|
|
229
307
|
}
|
|
230
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
|
+
|
|
231
375
|
declare function createWordPressClient(config: NextWordpressConfig): {
|
|
376
|
+
getCommentsByPostId: (postId: number, page?: number, perPage?: number) => Promise<WordPressResponse<Comment[]>>;
|
|
377
|
+
getAllCommentsByPostId: (postId: number) => Promise<Comment[]>;
|
|
378
|
+
getCommentById: (id: number) => Promise<Comment>;
|
|
379
|
+
getCommentReplies: (parentId: number) => Promise<Comment[]>;
|
|
380
|
+
createComment: (input: CreateCommentInput) => Promise<Comment>;
|
|
381
|
+
getMenus: () => Promise<Menu[]>;
|
|
382
|
+
getMenuById: (id: number) => Promise<Menu>;
|
|
383
|
+
getMenuBySlug: (slug: string) => Promise<Menu | undefined>;
|
|
384
|
+
getMenuItemsByMenuId: (menuId: number) => Promise<MenuItem[]>;
|
|
385
|
+
getMenuLocations: () => Promise<Record<string, MenuLocation>>;
|
|
386
|
+
getMenuByLocation: (location: string) => Promise<MenuWithItems | undefined>;
|
|
232
387
|
getAllPages: () => Promise<Page[]>;
|
|
233
388
|
getPageById: (id: number) => Promise<Page>;
|
|
234
389
|
getPageBySlug: (slug: string) => Promise<Page | undefined>;
|
|
@@ -275,21 +430,6 @@ declare function createWordPressClient(config: NextWordpressConfig): {
|
|
|
275
430
|
}[]>;
|
|
276
431
|
};
|
|
277
432
|
|
|
278
|
-
interface WooCommerceConfig {
|
|
279
|
-
serverURL: string;
|
|
280
|
-
consumerKey: string;
|
|
281
|
-
consumerSecret: string;
|
|
282
|
-
cacheTTL?: number;
|
|
283
|
-
}
|
|
284
|
-
interface WooCommercePaginationHeaders {
|
|
285
|
-
total: number;
|
|
286
|
-
totalPages: number;
|
|
287
|
-
}
|
|
288
|
-
interface WooCommerceResponse<T> {
|
|
289
|
-
data: T;
|
|
290
|
-
headers: WooCommercePaginationHeaders;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
433
|
declare function createWooCommerceFetcher(config: WooCommerceConfig): {
|
|
294
434
|
wcFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[], options?: RequestInit) => Promise<T>;
|
|
295
435
|
wcFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
|
|
@@ -299,31 +439,6 @@ declare function createWooCommerceFetcher(config: WooCommerceConfig): {
|
|
|
299
439
|
};
|
|
300
440
|
type WooCommerceFetcher = ReturnType<typeof createWooCommerceFetcher>;
|
|
301
441
|
|
|
302
|
-
interface WCImage {
|
|
303
|
-
id: number;
|
|
304
|
-
src: string;
|
|
305
|
-
name: string;
|
|
306
|
-
alt: string;
|
|
307
|
-
}
|
|
308
|
-
interface WCDimensions {
|
|
309
|
-
length: string;
|
|
310
|
-
width: string;
|
|
311
|
-
height: string;
|
|
312
|
-
}
|
|
313
|
-
interface WCAddress {
|
|
314
|
-
first_name: string;
|
|
315
|
-
last_name: string;
|
|
316
|
-
company: string;
|
|
317
|
-
address_1: string;
|
|
318
|
-
address_2: string;
|
|
319
|
-
city: string;
|
|
320
|
-
state: string;
|
|
321
|
-
postcode: string;
|
|
322
|
-
country: string;
|
|
323
|
-
email?: string;
|
|
324
|
-
phone?: string;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
442
|
interface WCProductCategory {
|
|
328
443
|
id: number;
|
|
329
444
|
name: string;
|
|
@@ -336,124 +451,57 @@ interface WCProductCategory {
|
|
|
336
451
|
count: number;
|
|
337
452
|
}
|
|
338
453
|
|
|
339
|
-
interface
|
|
340
|
-
id: number;
|
|
454
|
+
interface CreateProductCategoryInput {
|
|
341
455
|
name: string;
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
352
|
-
interface WCProductVariation {
|
|
353
|
-
id: number;
|
|
354
|
-
date_created: string;
|
|
355
|
-
date_modified: string;
|
|
356
|
-
description: string;
|
|
357
|
-
permalink: string;
|
|
358
|
-
sku: string;
|
|
359
|
-
price: string;
|
|
360
|
-
regular_price: string;
|
|
361
|
-
sale_price: string;
|
|
362
|
-
on_sale: boolean;
|
|
363
|
-
purchasable: boolean;
|
|
364
|
-
stock_quantity: number | null;
|
|
365
|
-
stock_status: 'instock' | 'outofstock' | 'onbackorder';
|
|
366
|
-
manage_stock: boolean;
|
|
367
|
-
backorders: 'no' | 'notify' | 'yes';
|
|
368
|
-
backorders_allowed: boolean;
|
|
369
|
-
backordered: boolean;
|
|
370
|
-
weight: string;
|
|
371
|
-
dimensions: WCDimensions;
|
|
372
|
-
image: WCImage | null;
|
|
373
|
-
attributes: Array<{
|
|
374
|
-
id: number;
|
|
375
|
-
name: string;
|
|
376
|
-
option: string;
|
|
377
|
-
}>;
|
|
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;
|
|
378
465
|
}
|
|
379
|
-
|
|
380
|
-
|
|
466
|
+
type UpdateProductCategoryInput = Partial<CreateProductCategoryInput>;
|
|
467
|
+
|
|
468
|
+
type WCProductStatus = 'draft' | 'pending' | 'private' | 'publish';
|
|
469
|
+
interface CreateProductInput {
|
|
381
470
|
name: string;
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
price: string;
|
|
394
|
-
regular_price: string;
|
|
395
|
-
sale_price: string;
|
|
396
|
-
on_sale: boolean;
|
|
397
|
-
purchasable: boolean;
|
|
398
|
-
total_sales: number;
|
|
399
|
-
virtual: boolean;
|
|
400
|
-
downloadable: boolean;
|
|
401
|
-
tax_status: 'taxable' | 'shipping' | 'none';
|
|
402
|
-
tax_class: string;
|
|
403
|
-
manage_stock: boolean;
|
|
404
|
-
stock_quantity: number | null;
|
|
405
|
-
stock_status: 'instock' | 'outofstock' | 'onbackorder';
|
|
406
|
-
backorders: 'no' | 'notify' | 'yes';
|
|
407
|
-
backorders_allowed: boolean;
|
|
408
|
-
backordered: boolean;
|
|
409
|
-
sold_individually: boolean;
|
|
410
|
-
weight: string;
|
|
411
|
-
dimensions: WCDimensions;
|
|
412
|
-
shipping_required: boolean;
|
|
413
|
-
shipping_taxable: boolean;
|
|
414
|
-
shipping_class: string;
|
|
415
|
-
shipping_class_id: number;
|
|
416
|
-
reviews_allowed: boolean;
|
|
417
|
-
average_rating: string;
|
|
418
|
-
rating_count: number;
|
|
419
|
-
related_ids: number[];
|
|
420
|
-
upsell_ids: number[];
|
|
421
|
-
cross_sell_ids: number[];
|
|
422
|
-
parent_id: number;
|
|
423
|
-
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?: {
|
|
424
482
|
id: number;
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
}>;
|
|
428
|
-
tags: Array<{
|
|
483
|
+
}[];
|
|
484
|
+
tags?: {
|
|
429
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;
|
|
430
497
|
name: string;
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
default_attributes: WCProductDefaultAttribute[];
|
|
436
|
-
variations: number[];
|
|
437
|
-
grouped_products: number[];
|
|
438
|
-
menu_order: number;
|
|
439
|
-
meta_data: Array<{
|
|
440
|
-
id: number;
|
|
441
|
-
key: string;
|
|
442
|
-
value: unknown;
|
|
443
|
-
}>;
|
|
498
|
+
options: string[];
|
|
499
|
+
visible?: boolean;
|
|
500
|
+
variation?: boolean;
|
|
501
|
+
}[];
|
|
444
502
|
}
|
|
445
|
-
interface
|
|
446
|
-
|
|
447
|
-
tag?: string;
|
|
448
|
-
featured?: boolean;
|
|
449
|
-
on_sale?: boolean;
|
|
450
|
-
min_price?: string;
|
|
451
|
-
max_price?: string;
|
|
452
|
-
search?: string;
|
|
453
|
-
orderby?: 'date' | 'id' | 'include' | 'title' | 'slug' | 'price' | 'popularity' | 'rating';
|
|
454
|
-
order?: 'asc' | 'desc';
|
|
455
|
-
stock_status?: 'instock' | 'outofstock' | 'onbackorder';
|
|
456
|
-
type?: WCProduct['type'];
|
|
503
|
+
interface UpdateProductInput extends Partial<Omit<CreateProductInput, 'name'>> {
|
|
504
|
+
name?: string;
|
|
457
505
|
}
|
|
458
506
|
|
|
459
507
|
interface WCProductTag {
|
|
@@ -464,6 +512,13 @@ interface WCProductTag {
|
|
|
464
512
|
count: number;
|
|
465
513
|
}
|
|
466
514
|
|
|
515
|
+
interface CreateProductTagInput {
|
|
516
|
+
name: string;
|
|
517
|
+
slug?: string;
|
|
518
|
+
description?: string;
|
|
519
|
+
}
|
|
520
|
+
type UpdateProductTagInput = Partial<CreateProductTagInput>;
|
|
521
|
+
|
|
467
522
|
interface WCOrderLineItem {
|
|
468
523
|
id: number;
|
|
469
524
|
name: string;
|
|
@@ -586,6 +641,23 @@ interface WCCoupon {
|
|
|
586
641
|
description: string;
|
|
587
642
|
}
|
|
588
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
|
+
|
|
589
661
|
interface WCCustomer {
|
|
590
662
|
id: number;
|
|
591
663
|
date_created: string;
|
|
@@ -608,6 +680,20 @@ interface WCCustomer {
|
|
|
608
680
|
}>;
|
|
609
681
|
}
|
|
610
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
|
+
|
|
611
697
|
interface OmnibusPriceEntry {
|
|
612
698
|
price: string;
|
|
613
699
|
date: string;
|
|
@@ -647,6 +733,17 @@ declare function createWooCommerceClient(config: WooCommerceConfig): {
|
|
|
647
733
|
billing?: Partial<WCAddress>;
|
|
648
734
|
shipping?: Partial<Omit<WCAddress, "email" | "phone">>;
|
|
649
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
|
+
}>;
|
|
650
747
|
getCouponByCode: (code: string) => Promise<WCCoupon | undefined>;
|
|
651
748
|
validateCoupon: (code: string) => Promise<{
|
|
652
749
|
valid: boolean;
|
|
@@ -657,14 +754,36 @@ declare function createWooCommerceClient(config: WooCommerceConfig): {
|
|
|
657
754
|
getOrderById: (id: number) => Promise<WCOrder>;
|
|
658
755
|
updateOrder: (id: number, data: Partial<WCCreateOrderInput>) => Promise<WCOrder>;
|
|
659
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
|
+
}>;
|
|
660
767
|
getAllProductTags: () => Promise<WCProductTag[]>;
|
|
661
768
|
getProductTagById: (id: number) => Promise<WCProductTag>;
|
|
662
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
|
+
}>;
|
|
663
776
|
getAllProductCategories: () => Promise<WCProductCategory[]>;
|
|
664
777
|
getProductCategoryById: (id: number) => Promise<WCProductCategory>;
|
|
665
778
|
getProductCategoryBySlug: (slug: string) => Promise<WCProductCategory | undefined>;
|
|
666
779
|
getProductsByCategory: (categoryId: number, limit?: number) => Promise<WCProduct[]>;
|
|
667
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
|
+
}>;
|
|
668
787
|
getProducts: (filterParams?: WCProductFilterParams) => Promise<WCProduct[]>;
|
|
669
788
|
getProductsPaginated: (page?: number, perPage?: number, filterParams?: WCProductFilterParams) => Promise<WooCommerceResponse<WCProduct[]>>;
|
|
670
789
|
getProductById: (id: number) => Promise<WCProduct>;
|
|
@@ -679,92 +798,13 @@ declare function createWooCommerceClient(config: WooCommerceConfig): {
|
|
|
679
798
|
getProductVariationById: (productId: number, variationId: number) => Promise<WCProductVariation>;
|
|
680
799
|
};
|
|
681
800
|
|
|
682
|
-
type WPGraphQLConfig = NextWordpressConfig;
|
|
683
|
-
interface GQLPageInfo {
|
|
684
|
-
hasNextPage: boolean;
|
|
685
|
-
hasPreviousPage: boolean;
|
|
686
|
-
startCursor?: string;
|
|
687
|
-
endCursor?: string;
|
|
688
|
-
}
|
|
689
|
-
interface GQLConnection<T> {
|
|
690
|
-
nodes: T[];
|
|
691
|
-
pageInfo: GQLPageInfo;
|
|
692
|
-
}
|
|
693
|
-
interface GQLError {
|
|
694
|
-
message: string;
|
|
695
|
-
locations?: Array<{
|
|
696
|
-
line: number;
|
|
697
|
-
column: number;
|
|
698
|
-
}>;
|
|
699
|
-
path?: string[];
|
|
700
|
-
}
|
|
701
|
-
declare class WPGraphQLError extends Error {
|
|
702
|
-
readonly status: number;
|
|
703
|
-
readonly endpoint: string;
|
|
704
|
-
readonly gqlErrors?: GQLError[] | undefined;
|
|
705
|
-
constructor(message: string, status: number, endpoint: string, gqlErrors?: GQLError[] | undefined);
|
|
706
|
-
}
|
|
707
|
-
|
|
708
801
|
declare function createWPGraphQLFetcher(config: WPGraphQLConfig): {
|
|
709
802
|
gqlFetch: <TData>(document: string, variables?: Record<string, unknown>, tags?: string[]) => Promise<TData>;
|
|
710
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>;
|
|
711
805
|
};
|
|
712
806
|
type WPGraphQLFetcher = ReturnType<typeof createWPGraphQLFetcher>;
|
|
713
807
|
|
|
714
|
-
interface GQLPostFilter {
|
|
715
|
-
authorName?: string;
|
|
716
|
-
categoryName?: string;
|
|
717
|
-
tag?: string;
|
|
718
|
-
search?: string;
|
|
719
|
-
status?: string;
|
|
720
|
-
}
|
|
721
|
-
interface GQLPost {
|
|
722
|
-
id: string;
|
|
723
|
-
databaseId: number;
|
|
724
|
-
slug: string;
|
|
725
|
-
title: string;
|
|
726
|
-
content: string;
|
|
727
|
-
excerpt: string;
|
|
728
|
-
date: string;
|
|
729
|
-
modified: string;
|
|
730
|
-
status: string;
|
|
731
|
-
uri: string;
|
|
732
|
-
author?: {
|
|
733
|
-
node: {
|
|
734
|
-
databaseId: number;
|
|
735
|
-
name: string;
|
|
736
|
-
slug: string;
|
|
737
|
-
avatar?: {
|
|
738
|
-
url: string;
|
|
739
|
-
};
|
|
740
|
-
};
|
|
741
|
-
};
|
|
742
|
-
featuredImage?: {
|
|
743
|
-
node: {
|
|
744
|
-
sourceUrl: string;
|
|
745
|
-
altText: string;
|
|
746
|
-
mediaDetails?: {
|
|
747
|
-
width: number;
|
|
748
|
-
height: number;
|
|
749
|
-
};
|
|
750
|
-
};
|
|
751
|
-
};
|
|
752
|
-
categories?: {
|
|
753
|
-
nodes: Array<{
|
|
754
|
-
databaseId: number;
|
|
755
|
-
name: string;
|
|
756
|
-
slug: string;
|
|
757
|
-
}>;
|
|
758
|
-
};
|
|
759
|
-
tags?: {
|
|
760
|
-
nodes: Array<{
|
|
761
|
-
databaseId: number;
|
|
762
|
-
name: string;
|
|
763
|
-
slug: string;
|
|
764
|
-
}>;
|
|
765
|
-
};
|
|
766
|
-
}
|
|
767
|
-
|
|
768
808
|
interface GQLPage {
|
|
769
809
|
id: string;
|
|
770
810
|
databaseId: number;
|
|
@@ -784,7 +824,7 @@ interface GQLPage {
|
|
|
784
824
|
height: number;
|
|
785
825
|
};
|
|
786
826
|
};
|
|
787
|
-
};
|
|
827
|
+
} | null;
|
|
788
828
|
}
|
|
789
829
|
|
|
790
830
|
interface GQLCategory {
|
|
@@ -801,7 +841,7 @@ interface GQLCategory {
|
|
|
801
841
|
name: string;
|
|
802
842
|
slug: string;
|
|
803
843
|
};
|
|
804
|
-
};
|
|
844
|
+
} | null;
|
|
805
845
|
}
|
|
806
846
|
|
|
807
847
|
interface GQLTag {
|
|
@@ -829,7 +869,345 @@ interface GQLAuthor {
|
|
|
829
869
|
};
|
|
830
870
|
}
|
|
831
871
|
|
|
872
|
+
interface GQLMenuItem {
|
|
873
|
+
id: string;
|
|
874
|
+
databaseId: number;
|
|
875
|
+
label: string;
|
|
876
|
+
url: string;
|
|
877
|
+
parentId: string | null;
|
|
878
|
+
order: number;
|
|
879
|
+
target: string;
|
|
880
|
+
cssClasses: string[];
|
|
881
|
+
description: string;
|
|
882
|
+
connectedNode?: {
|
|
883
|
+
node: {
|
|
884
|
+
__typename: string;
|
|
885
|
+
id?: string;
|
|
886
|
+
databaseId?: number;
|
|
887
|
+
slug?: string;
|
|
888
|
+
};
|
|
889
|
+
} | null;
|
|
890
|
+
}
|
|
891
|
+
interface GQLMenu {
|
|
892
|
+
id: string;
|
|
893
|
+
databaseId: number;
|
|
894
|
+
name: string;
|
|
895
|
+
slug: string;
|
|
896
|
+
locations: string[];
|
|
897
|
+
menuItems?: {
|
|
898
|
+
nodes: GQLMenuItem[];
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
interface GQLCommentAuthor {
|
|
903
|
+
name: string;
|
|
904
|
+
url: string;
|
|
905
|
+
avatar?: {
|
|
906
|
+
url: string;
|
|
907
|
+
width: number;
|
|
908
|
+
height: number;
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
interface GQLComment {
|
|
912
|
+
id: string;
|
|
913
|
+
databaseId: number;
|
|
914
|
+
content: string;
|
|
915
|
+
date: string;
|
|
916
|
+
parentId: string | null;
|
|
917
|
+
status: string;
|
|
918
|
+
author: {
|
|
919
|
+
node: GQLCommentAuthor;
|
|
920
|
+
};
|
|
921
|
+
replies?: {
|
|
922
|
+
nodes: GQLComment[];
|
|
923
|
+
};
|
|
924
|
+
}
|
|
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
|
+
|
|
832
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>;
|
|
1197
|
+
getCommentsByPostId: (postId: number, first?: number, after?: string) => Promise<{
|
|
1198
|
+
nodes: GQLComment[];
|
|
1199
|
+
pageInfo: {
|
|
1200
|
+
hasNextPage: boolean;
|
|
1201
|
+
endCursor?: string;
|
|
1202
|
+
};
|
|
1203
|
+
}>;
|
|
1204
|
+
getAllCommentsByPostId: (postId: number) => Promise<GQLComment[]>;
|
|
1205
|
+
getCommentById: (id: number) => Promise<GQLComment | null>;
|
|
1206
|
+
getMenus: () => Promise<GQLMenu[]>;
|
|
1207
|
+
getMenuById: (id: number) => Promise<GQLMenu | null>;
|
|
1208
|
+
getMenuBySlug: (slug: string) => Promise<GQLMenu | null>;
|
|
1209
|
+
getMenuByLocation: (location: string) => Promise<GQLMenu | null>;
|
|
1210
|
+
getMenuItems: (menuSlug: string) => Promise<GQLMenuItem[]>;
|
|
833
1211
|
getAuthors: (first?: number, after?: string) => Promise<GQLConnection<GQLAuthor>>;
|
|
834
1212
|
getAuthorBySlug: (slug: string) => Promise<GQLAuthor | null>;
|
|
835
1213
|
getTags: (first?: number, after?: string) => Promise<GQLConnection<GQLTag>>;
|
|
@@ -865,12 +1243,12 @@ interface GQLYoastSEO {
|
|
|
865
1243
|
opengraphImage?: {
|
|
866
1244
|
sourceUrl: string;
|
|
867
1245
|
altText: string;
|
|
868
|
-
};
|
|
1246
|
+
} | null;
|
|
869
1247
|
twitterTitle: string;
|
|
870
1248
|
twitterDescription: string;
|
|
871
1249
|
twitterImage?: {
|
|
872
1250
|
sourceUrl: string;
|
|
873
|
-
};
|
|
1251
|
+
} | null;
|
|
874
1252
|
schema?: {
|
|
875
1253
|
raw: string;
|
|
876
1254
|
};
|
|
@@ -1048,7 +1426,63 @@ interface GQLCustomer {
|
|
|
1048
1426
|
};
|
|
1049
1427
|
}
|
|
1050
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
|
+
|
|
1051
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>;
|
|
1052
1486
|
getCustomer: () => Promise<GQLCustomer | null>;
|
|
1053
1487
|
getCustomerById: (id: number) => Promise<GQLCustomer | null>;
|
|
1054
1488
|
getOrder: (id: number) => Promise<GQLOrder | null>;
|
|
@@ -1083,4 +1517,42 @@ declare function createCPTQueries(fetcher: WPGraphQLFetcher, typeName: string, s
|
|
|
1083
1517
|
}[]>;
|
|
1084
1518
|
};
|
|
1085
1519
|
|
|
1086
|
-
|
|
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 };
|