@szymonpiatek/nextwordpress 0.0.5 → 0.0.6

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,8 +1,22 @@
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';
1
+ import { N as NextWordpressConfig, J as JwtAuthCredentials, k as JwtAuthResponse, a as WooCommerceConfig, d as WooCommerceResponse, W as WordPressResponse, T as Taxonomy, l as WPEntity, R as RenderedTitle, m as RenderedContent, P as Post, A as Author, F as FeaturedMedia, n as WCImage, o as WCProductVariation, b as WCProduct, g as WCCustomer, p as WCAddress, U as UpdateCustomerInput, e as WCCreateOrderInput, f as WCOrder, c as WCProductFilterParams, h as WPGraphQLConfig, j as GQLConnection, i as GQLPostFilter, G as GQLPost } from './types-soq-mA1E.cjs';
2
+ export { q as AuthenticationError, B as BlockType, E as EditorBlock, r as EmbeddedAuthor, s as EmbeddedTerm, t as GQLError, u as GQLPageInfo, M as MediaDetails, v as MediaSize, w as PostEmbedded, S as SearchResult, x as TemplatePart, y as WCDimensions, z as WCOrderLineItem, C as WCProductAttribute, D as WCProductDefaultAttribute, H as WCShippingLine, I as WPGraphQLError, K as WooCommercePaginationHeaders } from './types-soq-mA1E.cjs';
3
+
4
+ declare function createApplicationPasswordToken(username: string, appPassword: string): string;
3
5
 
4
6
  declare function resolveBaseUrl(config: NextWordpressConfig): string;
5
7
 
8
+ declare function authenticateJwt(config: NextWordpressConfig, credentials: JwtAuthCredentials): Promise<JwtAuthResponse>;
9
+ declare function validateJwtToken(config: NextWordpressConfig, token: string): Promise<boolean>;
10
+
11
+ declare function createWooCommerceFetcher(config: WooCommerceConfig): {
12
+ wcFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[], options?: RequestInit) => Promise<T>;
13
+ wcFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
14
+ wcFetchPaginated: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
15
+ wcFetchPaginatedGraceful: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
16
+ wcMutate: <T>(path: string, body: unknown, method?: "POST" | "PUT" | "PATCH" | "DELETE") => Promise<T>;
17
+ };
18
+ type WooCommerceFetcher = ReturnType<typeof createWooCommerceFetcher>;
19
+
6
20
  declare function createFetcher(config: NextWordpressConfig): {
7
21
  wpFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
8
22
  wpFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
@@ -446,15 +460,6 @@ declare function createWordPressClient(config: NextWordpressConfig): {
446
460
  }[]>;
447
461
  };
448
462
 
449
- declare function createWooCommerceFetcher(config: WooCommerceConfig): {
450
- wcFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[], options?: RequestInit) => Promise<T>;
451
- wcFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
452
- wcFetchPaginated: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
453
- wcFetchPaginatedGraceful: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
454
- wcMutate: <T>(path: string, body: unknown, method?: "POST" | "PUT" | "PATCH" | "DELETE") => Promise<T>;
455
- };
456
- type WooCommerceFetcher = ReturnType<typeof createWooCommerceFetcher>;
457
-
458
463
  interface WCProductCategory {
459
464
  id: number;
460
465
  name: string;
@@ -535,110 +540,6 @@ interface CreateProductTagInput {
535
540
  }
536
541
  type UpdateProductTagInput = Partial<CreateProductTagInput>;
537
542
 
538
- interface WCOrderLineItem {
539
- id: number;
540
- name: string;
541
- product_id: number;
542
- variation_id: number;
543
- quantity: number;
544
- sku: string;
545
- price: number;
546
- subtotal: string;
547
- subtotal_tax: string;
548
- total: string;
549
- total_tax: string;
550
- taxes: Array<{
551
- id: number;
552
- total: string;
553
- subtotal: string;
554
- }>;
555
- meta_data: Array<{
556
- id: number;
557
- key: string;
558
- value: unknown;
559
- display_key: string;
560
- display_value: string;
561
- }>;
562
- image: {
563
- id: string;
564
- src: string;
565
- } | null;
566
- }
567
- interface WCShippingLine {
568
- id: number;
569
- method_title: string;
570
- method_id: string;
571
- instance_id: string;
572
- total: string;
573
- total_tax: string;
574
- taxes: Array<{
575
- id: number;
576
- total: string;
577
- }>;
578
- meta_data: Array<{
579
- id: number;
580
- key: string;
581
- value: unknown;
582
- }>;
583
- }
584
- interface WCOrder {
585
- id: number;
586
- parent_id: number;
587
- status: 'pending' | 'processing' | 'on-hold' | 'completed' | 'cancelled' | 'refunded' | 'failed' | 'trash';
588
- currency: string;
589
- date_created: string;
590
- date_modified: string;
591
- discount_total: string;
592
- discount_tax: string;
593
- shipping_total: string;
594
- shipping_tax: string;
595
- cart_tax: string;
596
- total: string;
597
- total_tax: string;
598
- customer_id: number;
599
- order_key: string;
600
- billing: WCAddress;
601
- shipping: WCAddress;
602
- payment_method: string;
603
- payment_method_title: string;
604
- transaction_id: string;
605
- customer_note: string;
606
- line_items: WCOrderLineItem[];
607
- shipping_lines: WCShippingLine[];
608
- meta_data: Array<{
609
- id: number;
610
- key: string;
611
- value: unknown;
612
- }>;
613
- }
614
- interface WCCreateOrderInput {
615
- status?: WCOrder['status'];
616
- payment_method?: string;
617
- payment_method_title?: string;
618
- customer_id?: number;
619
- customer_note?: string;
620
- billing?: Partial<WCAddress>;
621
- shipping?: Partial<WCAddress>;
622
- line_items: Array<{
623
- product_id: number;
624
- variation_id?: number;
625
- quantity: number;
626
- }>;
627
- coupon_lines?: Array<{
628
- code: string;
629
- }>;
630
- shipping_lines?: Array<{
631
- method_id: string;
632
- method_title: string;
633
- total: string;
634
- }>;
635
- meta_data?: Array<{
636
- key: string;
637
- value: unknown;
638
- }>;
639
- set_paid?: boolean;
640
- }
641
-
642
543
  interface WCCoupon {
643
544
  id: number;
644
545
  code: string;
@@ -674,42 +575,6 @@ interface CreateCouponInput {
674
575
  }
675
576
  type UpdateCouponInput = Partial<CreateCouponInput>;
676
577
 
677
- interface WCCustomer {
678
- id: number;
679
- date_created: string;
680
- date_modified: string;
681
- email: string;
682
- first_name: string;
683
- last_name: string;
684
- role: string;
685
- username: string;
686
- billing: WCAddress;
687
- shipping: Omit<WCAddress, 'email' | 'phone'>;
688
- is_paying_customer: boolean;
689
- avatar_url: string;
690
- orders_count: number;
691
- total_spent: string;
692
- meta_data: Array<{
693
- id: number;
694
- key: string;
695
- value: unknown;
696
- }>;
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
-
713
578
  interface OmnibusPriceEntry {
714
579
  price: string;
715
580
  date: string;
@@ -1568,24 +1433,4 @@ interface FaustPreviewDeps {
1568
1433
  declare function createFaustAuthHandler(config: FaustConfig): (request: Request, routePath: string) => Promise<Response>;
1569
1434
  declare function createPreviewHandler(config: FaustPreviewConfig, deps: FaustPreviewDeps): (request: Request) => Promise<Response>;
1570
1435
 
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 };
1436
+ export { 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, JwtAuthCredentials, 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, UpdateCustomerInput, type UpdateMediaInput, type UpdateMenuInput, type UpdateMenuItemInput, type UpdatePageInput, type UpdatePostInput, type UpdateProductCategoryInput, type UpdateProductInput, type UpdateProductTagInput, type UpdateTagInput, type UploadMediaInput, WCAddress, type WCCoupon, WCCreateOrderInput, WCCustomer, WCImage, WCOrder, WCProduct, type WCProductCategory, WCProductFilterParams, type WCProductStatus, type WCProductTag, WCProductVariation, type WCProductVariationWithOmnibus, type WCProductWithOmnibus, 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 };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,22 @@
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.js';
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.js';
1
+ import { N as NextWordpressConfig, J as JwtAuthCredentials, k as JwtAuthResponse, a as WooCommerceConfig, d as WooCommerceResponse, W as WordPressResponse, T as Taxonomy, l as WPEntity, R as RenderedTitle, m as RenderedContent, P as Post, A as Author, F as FeaturedMedia, n as WCImage, o as WCProductVariation, b as WCProduct, g as WCCustomer, p as WCAddress, U as UpdateCustomerInput, e as WCCreateOrderInput, f as WCOrder, c as WCProductFilterParams, h as WPGraphQLConfig, j as GQLConnection, i as GQLPostFilter, G as GQLPost } from './types-soq-mA1E.js';
2
+ export { q as AuthenticationError, B as BlockType, E as EditorBlock, r as EmbeddedAuthor, s as EmbeddedTerm, t as GQLError, u as GQLPageInfo, M as MediaDetails, v as MediaSize, w as PostEmbedded, S as SearchResult, x as TemplatePart, y as WCDimensions, z as WCOrderLineItem, C as WCProductAttribute, D as WCProductDefaultAttribute, H as WCShippingLine, I as WPGraphQLError, K as WooCommercePaginationHeaders } from './types-soq-mA1E.js';
3
+
4
+ declare function createApplicationPasswordToken(username: string, appPassword: string): string;
3
5
 
4
6
  declare function resolveBaseUrl(config: NextWordpressConfig): string;
5
7
 
8
+ declare function authenticateJwt(config: NextWordpressConfig, credentials: JwtAuthCredentials): Promise<JwtAuthResponse>;
9
+ declare function validateJwtToken(config: NextWordpressConfig, token: string): Promise<boolean>;
10
+
11
+ declare function createWooCommerceFetcher(config: WooCommerceConfig): {
12
+ wcFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[], options?: RequestInit) => Promise<T>;
13
+ wcFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
14
+ wcFetchPaginated: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
15
+ wcFetchPaginatedGraceful: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
16
+ wcMutate: <T>(path: string, body: unknown, method?: "POST" | "PUT" | "PATCH" | "DELETE") => Promise<T>;
17
+ };
18
+ type WooCommerceFetcher = ReturnType<typeof createWooCommerceFetcher>;
19
+
6
20
  declare function createFetcher(config: NextWordpressConfig): {
7
21
  wpFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
8
22
  wpFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
@@ -446,15 +460,6 @@ declare function createWordPressClient(config: NextWordpressConfig): {
446
460
  }[]>;
447
461
  };
448
462
 
449
- declare function createWooCommerceFetcher(config: WooCommerceConfig): {
450
- wcFetch: <T>(path: string, query?: Record<string, unknown>, tags?: string[], options?: RequestInit) => Promise<T>;
451
- wcFetchGraceful: <T>(path: string, fallback: T, query?: Record<string, unknown>, tags?: string[]) => Promise<T>;
452
- wcFetchPaginated: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
453
- wcFetchPaginatedGraceful: <T>(path: string, query?: Record<string, unknown>, tags?: string[]) => Promise<WooCommerceResponse<T[]>>;
454
- wcMutate: <T>(path: string, body: unknown, method?: "POST" | "PUT" | "PATCH" | "DELETE") => Promise<T>;
455
- };
456
- type WooCommerceFetcher = ReturnType<typeof createWooCommerceFetcher>;
457
-
458
463
  interface WCProductCategory {
459
464
  id: number;
460
465
  name: string;
@@ -535,110 +540,6 @@ interface CreateProductTagInput {
535
540
  }
536
541
  type UpdateProductTagInput = Partial<CreateProductTagInput>;
537
542
 
538
- interface WCOrderLineItem {
539
- id: number;
540
- name: string;
541
- product_id: number;
542
- variation_id: number;
543
- quantity: number;
544
- sku: string;
545
- price: number;
546
- subtotal: string;
547
- subtotal_tax: string;
548
- total: string;
549
- total_tax: string;
550
- taxes: Array<{
551
- id: number;
552
- total: string;
553
- subtotal: string;
554
- }>;
555
- meta_data: Array<{
556
- id: number;
557
- key: string;
558
- value: unknown;
559
- display_key: string;
560
- display_value: string;
561
- }>;
562
- image: {
563
- id: string;
564
- src: string;
565
- } | null;
566
- }
567
- interface WCShippingLine {
568
- id: number;
569
- method_title: string;
570
- method_id: string;
571
- instance_id: string;
572
- total: string;
573
- total_tax: string;
574
- taxes: Array<{
575
- id: number;
576
- total: string;
577
- }>;
578
- meta_data: Array<{
579
- id: number;
580
- key: string;
581
- value: unknown;
582
- }>;
583
- }
584
- interface WCOrder {
585
- id: number;
586
- parent_id: number;
587
- status: 'pending' | 'processing' | 'on-hold' | 'completed' | 'cancelled' | 'refunded' | 'failed' | 'trash';
588
- currency: string;
589
- date_created: string;
590
- date_modified: string;
591
- discount_total: string;
592
- discount_tax: string;
593
- shipping_total: string;
594
- shipping_tax: string;
595
- cart_tax: string;
596
- total: string;
597
- total_tax: string;
598
- customer_id: number;
599
- order_key: string;
600
- billing: WCAddress;
601
- shipping: WCAddress;
602
- payment_method: string;
603
- payment_method_title: string;
604
- transaction_id: string;
605
- customer_note: string;
606
- line_items: WCOrderLineItem[];
607
- shipping_lines: WCShippingLine[];
608
- meta_data: Array<{
609
- id: number;
610
- key: string;
611
- value: unknown;
612
- }>;
613
- }
614
- interface WCCreateOrderInput {
615
- status?: WCOrder['status'];
616
- payment_method?: string;
617
- payment_method_title?: string;
618
- customer_id?: number;
619
- customer_note?: string;
620
- billing?: Partial<WCAddress>;
621
- shipping?: Partial<WCAddress>;
622
- line_items: Array<{
623
- product_id: number;
624
- variation_id?: number;
625
- quantity: number;
626
- }>;
627
- coupon_lines?: Array<{
628
- code: string;
629
- }>;
630
- shipping_lines?: Array<{
631
- method_id: string;
632
- method_title: string;
633
- total: string;
634
- }>;
635
- meta_data?: Array<{
636
- key: string;
637
- value: unknown;
638
- }>;
639
- set_paid?: boolean;
640
- }
641
-
642
543
  interface WCCoupon {
643
544
  id: number;
644
545
  code: string;
@@ -674,42 +575,6 @@ interface CreateCouponInput {
674
575
  }
675
576
  type UpdateCouponInput = Partial<CreateCouponInput>;
676
577
 
677
- interface WCCustomer {
678
- id: number;
679
- date_created: string;
680
- date_modified: string;
681
- email: string;
682
- first_name: string;
683
- last_name: string;
684
- role: string;
685
- username: string;
686
- billing: WCAddress;
687
- shipping: Omit<WCAddress, 'email' | 'phone'>;
688
- is_paying_customer: boolean;
689
- avatar_url: string;
690
- orders_count: number;
691
- total_spent: string;
692
- meta_data: Array<{
693
- id: number;
694
- key: string;
695
- value: unknown;
696
- }>;
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
-
713
578
  interface OmnibusPriceEntry {
714
579
  price: string;
715
580
  date: string;
@@ -1568,24 +1433,4 @@ interface FaustPreviewDeps {
1568
1433
  declare function createFaustAuthHandler(config: FaustConfig): (request: Request, routePath: string) => Promise<Response>;
1569
1434
  declare function createPreviewHandler(config: FaustPreviewConfig, deps: FaustPreviewDeps): (request: Request) => Promise<Response>;
1570
1435
 
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 };
1436
+ export { 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, JwtAuthCredentials, 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, UpdateCustomerInput, type UpdateMediaInput, type UpdateMenuInput, type UpdateMenuItemInput, type UpdatePageInput, type UpdatePostInput, type UpdateProductCategoryInput, type UpdateProductInput, type UpdateProductTagInput, type UpdateTagInput, type UploadMediaInput, WCAddress, type WCCoupon, WCCreateOrderInput, WCCustomer, WCImage, WCOrder, WCProduct, type WCProductCategory, WCProductFilterParams, type WCProductStatus, type WCProductTag, WCProductVariation, type WCProductVariationWithOmnibus, type WCProductWithOmnibus, 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 };
package/dist/index.js CHANGED
@@ -45,7 +45,7 @@ async function doFetch(url, init = {}) {
45
45
  return response;
46
46
  }
47
47
  function createFetcher(config) {
48
- const cacheTtl = 300;
48
+ const cacheTtl = config.cacheTTL ?? 300;
49
49
  async function wpFetch(path, query, tags = ["wordpress"]) {
50
50
  const url = buildUrl(config, path, query);
51
51
  const res = await doFetch(url, {
@@ -1239,9 +1239,9 @@ var WPGraphQLError = class extends Error {
1239
1239
 
1240
1240
  // src/integrations/wpGraphQL/client/fetcher.ts
1241
1241
  var USER_AGENT3 = "NextWordpress WPGraphQL Client";
1242
- var CACHE_TTL = 300;
1243
1242
  function createWPGraphQLFetcher(config) {
1244
1243
  const url = `${resolveBaseUrl(config)}/graphql`;
1244
+ const cacheTTL = config.cacheTTL ?? 300;
1245
1245
  async function gqlFetch(document, variables, tags = ["wpgraphql"]) {
1246
1246
  const response = await fetch(url, {
1247
1247
  method: "POST",
@@ -1250,7 +1250,7 @@ function createWPGraphQLFetcher(config) {
1250
1250
  "User-Agent": USER_AGENT3
1251
1251
  },
1252
1252
  body: JSON.stringify({ query: document, variables }),
1253
- next: { tags, revalidate: CACHE_TTL }
1253
+ next: { tags, revalidate: cacheTTL }
1254
1254
  });
1255
1255
  if (!response.ok) {
1256
1256
  throw new WPGraphQLError(