@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.
@@ -0,0 +1,446 @@
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
+ }
36
+
37
+ interface MediaSize {
38
+ file: string;
39
+ width: number;
40
+ height: number;
41
+ mime_type: string;
42
+ source_url: string;
43
+ }
44
+ interface MediaDetails {
45
+ width: number;
46
+ height: number;
47
+ file: string;
48
+ sizes: Record<string, MediaSize>;
49
+ }
50
+ interface FeaturedMedia extends WPEntity {
51
+ title: RenderedTitle;
52
+ author: number;
53
+ caption: {
54
+ rendered: string;
55
+ };
56
+ alt_text: string;
57
+ media_type: string;
58
+ mime_type: string;
59
+ media_details: MediaDetails;
60
+ source_url: string;
61
+ }
62
+
63
+ interface Author {
64
+ id: number;
65
+ name: string;
66
+ url: string;
67
+ description: string;
68
+ link: string;
69
+ slug: string;
70
+ avatar_urls: Record<string, string>;
71
+ meta: Record<string, unknown>;
72
+ }
73
+ interface EmbeddedAuthor {
74
+ id: number;
75
+ name: string;
76
+ slug: string;
77
+ avatar_urls: Record<string, string>;
78
+ }
79
+ interface EmbeddedTerm {
80
+ id: number;
81
+ name: string;
82
+ slug: string;
83
+ }
84
+
85
+ interface BlockSupports {
86
+ align?: boolean | string[];
87
+ anchor?: boolean;
88
+ className?: boolean;
89
+ color?: {
90
+ background?: boolean;
91
+ gradients?: boolean;
92
+ text?: boolean;
93
+ };
94
+ spacing?: {
95
+ margin?: boolean;
96
+ padding?: boolean;
97
+ };
98
+ typography?: {
99
+ fontSize?: boolean;
100
+ lineHeight?: boolean;
101
+ };
102
+ [key: string]: unknown;
103
+ }
104
+ interface BlockStyle {
105
+ name: string;
106
+ label: string;
107
+ isDefault: boolean;
108
+ }
109
+ interface BlockType {
110
+ api_version: number;
111
+ title: string;
112
+ name: string;
113
+ description: string;
114
+ icon: string;
115
+ category: string;
116
+ keywords: string[];
117
+ parent: string[];
118
+ supports: BlockSupports;
119
+ styles: BlockStyle[];
120
+ textdomain: string;
121
+ example: Record<string, unknown>;
122
+ attributes: Record<string, unknown>;
123
+ provides_context: Record<string, string>;
124
+ uses_context: string[];
125
+ editor_script: string;
126
+ script: string;
127
+ editor_style: string;
128
+ style: string;
129
+ }
130
+ interface EditorBlock {
131
+ id: string;
132
+ name: string;
133
+ attributes: Record<string, unknown>;
134
+ innerBlocks: EditorBlock[];
135
+ innerHTML: string;
136
+ innerContent: (string | null)[];
137
+ }
138
+ interface TemplatePart {
139
+ id: string;
140
+ slug: string;
141
+ theme: string;
142
+ type: string;
143
+ source: string;
144
+ origin: string;
145
+ content: string | EditorBlock[];
146
+ title: {
147
+ raw: string;
148
+ rendered: string;
149
+ };
150
+ description: string;
151
+ status: 'publish' | 'future' | 'draft' | 'pending' | 'private';
152
+ wp_id: number;
153
+ has_theme_file: boolean;
154
+ author: number;
155
+ area: string;
156
+ }
157
+ interface SearchResult {
158
+ id: number;
159
+ title: string;
160
+ url: string;
161
+ type: string;
162
+ subtype: string;
163
+ _links: {
164
+ self: Array<{
165
+ embeddable: boolean;
166
+ href: string;
167
+ }>;
168
+ about: Array<{
169
+ href: string;
170
+ }>;
171
+ };
172
+ }
173
+
174
+ interface PostEmbedded {
175
+ author?: EmbeddedAuthor[];
176
+ 'wp:featuredmedia'?: FeaturedMedia[];
177
+ 'wp:term'?: EmbeddedTerm[][];
178
+ }
179
+ interface Post extends WPEntity {
180
+ title: RenderedTitle;
181
+ content: RenderedContent;
182
+ excerpt: RenderedContent;
183
+ author: number;
184
+ featured_media: number;
185
+ comment_status: 'open' | 'closed';
186
+ ping_status: 'open' | 'closed';
187
+ sticky: boolean;
188
+ template: string;
189
+ format: 'standard' | 'aside' | 'chat' | 'gallery' | 'link' | 'image' | 'quote' | 'status' | 'video' | 'audio';
190
+ categories: number[];
191
+ tags: number[];
192
+ meta: Record<string, unknown>;
193
+ blocks?: EditorBlock[];
194
+ _embedded?: PostEmbedded;
195
+ }
196
+
197
+ interface WordPressPaginationHeaders {
198
+ total: number;
199
+ totalPages: number;
200
+ }
201
+ interface WordPressResponse<T> {
202
+ data: T;
203
+ headers: WordPressPaginationHeaders;
204
+ }
205
+
206
+ interface WooCommerceConfig {
207
+ serverURL: string;
208
+ consumerKey: string;
209
+ consumerSecret: string;
210
+ cacheTTL?: number;
211
+ }
212
+ interface WooCommercePaginationHeaders {
213
+ total: number;
214
+ totalPages: number;
215
+ }
216
+ interface WooCommerceResponse<T> {
217
+ data: T;
218
+ headers: WooCommercePaginationHeaders;
219
+ }
220
+
221
+ interface WCImage {
222
+ id: number;
223
+ src: string;
224
+ name: string;
225
+ alt: string;
226
+ }
227
+ interface WCDimensions {
228
+ length: string;
229
+ width: string;
230
+ height: string;
231
+ }
232
+ interface WCAddress {
233
+ first_name: string;
234
+ last_name: string;
235
+ company: string;
236
+ address_1: string;
237
+ address_2: string;
238
+ city: string;
239
+ state: string;
240
+ postcode: string;
241
+ country: string;
242
+ email?: string;
243
+ phone?: string;
244
+ }
245
+
246
+ interface WCProductAttribute {
247
+ id: number;
248
+ name: string;
249
+ position: number;
250
+ visible: boolean;
251
+ variation: boolean;
252
+ options: string[];
253
+ }
254
+ interface WCProductDefaultAttribute {
255
+ id: number;
256
+ name: string;
257
+ option: string;
258
+ }
259
+ interface WCProductVariation {
260
+ id: number;
261
+ date_created: string;
262
+ date_modified: string;
263
+ description: string;
264
+ permalink: string;
265
+ sku: string;
266
+ price: string;
267
+ regular_price: string;
268
+ sale_price: string;
269
+ on_sale: boolean;
270
+ purchasable: boolean;
271
+ stock_quantity: number | null;
272
+ stock_status: 'instock' | 'outofstock' | 'onbackorder';
273
+ manage_stock: boolean;
274
+ backorders: 'no' | 'notify' | 'yes';
275
+ backorders_allowed: boolean;
276
+ backordered: boolean;
277
+ weight: string;
278
+ dimensions: WCDimensions;
279
+ image: WCImage | null;
280
+ attributes: Array<{
281
+ id: number;
282
+ name: string;
283
+ option: string;
284
+ }>;
285
+ }
286
+ interface WCProduct {
287
+ id: number;
288
+ name: string;
289
+ slug: string;
290
+ permalink: string;
291
+ date_created: string;
292
+ date_modified: string;
293
+ type: 'simple' | 'grouped' | 'external' | 'variable';
294
+ status: 'draft' | 'pending' | 'private' | 'publish';
295
+ featured: boolean;
296
+ catalog_visibility: 'visible' | 'catalog' | 'search' | 'hidden';
297
+ description: string;
298
+ short_description: string;
299
+ sku: string;
300
+ price: string;
301
+ regular_price: string;
302
+ sale_price: string;
303
+ on_sale: boolean;
304
+ purchasable: boolean;
305
+ total_sales: number;
306
+ virtual: boolean;
307
+ downloadable: boolean;
308
+ tax_status: 'taxable' | 'shipping' | 'none';
309
+ tax_class: string;
310
+ manage_stock: boolean;
311
+ stock_quantity: number | null;
312
+ stock_status: 'instock' | 'outofstock' | 'onbackorder';
313
+ backorders: 'no' | 'notify' | 'yes';
314
+ backorders_allowed: boolean;
315
+ backordered: boolean;
316
+ sold_individually: boolean;
317
+ weight: string;
318
+ dimensions: WCDimensions;
319
+ shipping_required: boolean;
320
+ shipping_taxable: boolean;
321
+ shipping_class: string;
322
+ shipping_class_id: number;
323
+ reviews_allowed: boolean;
324
+ average_rating: string;
325
+ rating_count: number;
326
+ related_ids: number[];
327
+ upsell_ids: number[];
328
+ cross_sell_ids: number[];
329
+ parent_id: number;
330
+ categories: Array<{
331
+ id: number;
332
+ name: string;
333
+ slug: string;
334
+ }>;
335
+ tags: Array<{
336
+ id: number;
337
+ name: string;
338
+ slug: string;
339
+ }>;
340
+ images: WCImage[];
341
+ attributes: WCProductAttribute[];
342
+ default_attributes: WCProductDefaultAttribute[];
343
+ variations: number[];
344
+ grouped_products: number[];
345
+ menu_order: number;
346
+ meta_data: Array<{
347
+ id: number;
348
+ key: string;
349
+ value: unknown;
350
+ }>;
351
+ }
352
+ interface WCProductFilterParams {
353
+ category?: string;
354
+ tag?: string;
355
+ featured?: boolean;
356
+ on_sale?: boolean;
357
+ min_price?: string;
358
+ max_price?: string;
359
+ search?: string;
360
+ orderby?: 'date' | 'id' | 'include' | 'title' | 'slug' | 'price' | 'popularity' | 'rating';
361
+ order?: 'asc' | 'desc';
362
+ stock_status?: 'instock' | 'outofstock' | 'onbackorder';
363
+ type?: WCProduct['type'];
364
+ }
365
+
366
+ type WPGraphQLConfig = NextWordpressConfig;
367
+ interface GQLPageInfo {
368
+ hasNextPage: boolean;
369
+ hasPreviousPage: boolean;
370
+ startCursor?: string;
371
+ endCursor?: string;
372
+ }
373
+ interface GQLConnection<T> {
374
+ nodes: T[];
375
+ pageInfo: GQLPageInfo;
376
+ }
377
+ interface GQLError {
378
+ message: string;
379
+ locations?: Array<{
380
+ line: number;
381
+ column: number;
382
+ }>;
383
+ path?: string[];
384
+ }
385
+ declare class WPGraphQLError extends Error {
386
+ readonly status: number;
387
+ readonly endpoint: string;
388
+ readonly gqlErrors?: GQLError[] | undefined;
389
+ constructor(message: string, status: number, endpoint: string, gqlErrors?: GQLError[] | undefined);
390
+ }
391
+
392
+ interface GQLPostFilter {
393
+ authorName?: string;
394
+ categoryName?: string;
395
+ tag?: string;
396
+ search?: string;
397
+ status?: string;
398
+ }
399
+ interface GQLPost {
400
+ id: string;
401
+ databaseId: number;
402
+ slug: string;
403
+ title: string;
404
+ content: string;
405
+ excerpt: string;
406
+ date: string;
407
+ modified: string;
408
+ status: string;
409
+ uri: string;
410
+ author?: {
411
+ node: {
412
+ databaseId: number;
413
+ name: string;
414
+ slug: string;
415
+ avatar?: {
416
+ url: string;
417
+ };
418
+ };
419
+ };
420
+ featuredImage?: {
421
+ node: {
422
+ sourceUrl: string;
423
+ altText: string;
424
+ mediaDetails?: {
425
+ width: number;
426
+ height: number;
427
+ };
428
+ };
429
+ };
430
+ categories?: {
431
+ nodes: Array<{
432
+ databaseId: number;
433
+ name: string;
434
+ slug: string;
435
+ }>;
436
+ };
437
+ tags?: {
438
+ nodes: Array<{
439
+ databaseId: number;
440
+ name: string;
441
+ slug: string;
442
+ }>;
443
+ };
444
+ }
445
+
446
+ export { type Author as A, type BlockType as B, type EditorBlock as E, type FeaturedMedia as F, type GQLPost as G, type MediaDetails as M, type NextWordpressConfig as N, type Post as P, type RenderedTitle as R, type SearchResult as S, type Taxonomy as T, type WordPressResponse as W, type WooCommerceConfig as a, type WCProduct as b, type WCProductFilterParams as c, type WooCommerceResponse as d, type WPGraphQLConfig as e, type GQLPostFilter as f, type GQLConnection as g, type WPEntity as h, type RenderedContent as i, type WCImage as j, type WCAddress as k, type WCProductVariation as l, type EmbeddedAuthor as m, type EmbeddedTerm as n, type GQLError as o, type GQLPageInfo as p, type MediaSize as q, type PostEmbedded as r, type TemplatePart as s, type WCDimensions as t, type WCProductAttribute as u, type WCProductDefaultAttribute as v, WPGraphQLError as w, type WooCommercePaginationHeaders as x };