@atomic-solutions/wordpress-api-client 0.1.1 → 0.1.2
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/client/index.cjs +321 -10
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.js +312 -1
- package/dist/client/index.js.map +1 -1
- package/dist/index.cjs +438 -137
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +403 -4
- package/dist/index.js.map +1 -1
- package/dist/testing/index.cjs +321 -10
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.js +312 -1
- package/dist/testing/index.js.map +1 -1
- package/package.json +4 -6
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var axios = require('axios');
|
|
4
|
-
var
|
|
5
|
-
var common = require('@atomic-solutions/schemas/common');
|
|
4
|
+
var zod = require('zod');
|
|
6
5
|
|
|
7
6
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
7
|
|
|
@@ -699,13 +698,316 @@ var setupErrorInterceptor = (axiosInstance, config, client) => {
|
|
|
699
698
|
}
|
|
700
699
|
);
|
|
701
700
|
};
|
|
701
|
+
var JwtLoginInputSchema = zod.z.object({
|
|
702
|
+
username: zod.z.string(),
|
|
703
|
+
password: zod.z.string()
|
|
704
|
+
});
|
|
705
|
+
var JwtTokenResponseSchema = zod.z.object({
|
|
706
|
+
token: zod.z.string(),
|
|
707
|
+
user_email: zod.z.string(),
|
|
708
|
+
user_nicename: zod.z.string(),
|
|
709
|
+
user_display_name: zod.z.string()
|
|
710
|
+
});
|
|
711
|
+
var JwtValidateResponseSchema = zod.z.object({
|
|
712
|
+
code: zod.z.string(),
|
|
713
|
+
data: zod.z.object({
|
|
714
|
+
status: zod.z.number()
|
|
715
|
+
})
|
|
716
|
+
});
|
|
717
|
+
var JwtErrorResponseSchema = zod.z.object({
|
|
718
|
+
code: zod.z.string(),
|
|
719
|
+
message: zod.z.string(),
|
|
720
|
+
data: zod.z.object({
|
|
721
|
+
status: zod.z.number()
|
|
722
|
+
}).optional()
|
|
723
|
+
});
|
|
724
|
+
var RenderedContentSchema = zod.z.object({
|
|
725
|
+
rendered: zod.z.string(),
|
|
726
|
+
protected: zod.z.boolean().optional()
|
|
727
|
+
});
|
|
728
|
+
var GuidSchema = zod.z.object({
|
|
729
|
+
rendered: zod.z.string()
|
|
730
|
+
});
|
|
731
|
+
var PostStatusSchema = zod.z.enum([
|
|
732
|
+
"publish",
|
|
733
|
+
"future",
|
|
734
|
+
"draft",
|
|
735
|
+
"pending",
|
|
736
|
+
"private",
|
|
737
|
+
"trash",
|
|
738
|
+
"auto-draft",
|
|
739
|
+
"inherit"
|
|
740
|
+
]);
|
|
741
|
+
var HalLinkItemSchema = zod.z.object({
|
|
742
|
+
href: zod.z.string(),
|
|
743
|
+
embeddable: zod.z.boolean().optional(),
|
|
744
|
+
templated: zod.z.boolean().optional()
|
|
745
|
+
});
|
|
746
|
+
var HalLinksSchema = zod.z.object({
|
|
747
|
+
self: zod.z.array(HalLinkItemSchema).optional(),
|
|
748
|
+
collection: zod.z.array(HalLinkItemSchema).optional(),
|
|
749
|
+
about: zod.z.array(HalLinkItemSchema).optional(),
|
|
750
|
+
author: zod.z.array(HalLinkItemSchema).optional(),
|
|
751
|
+
replies: zod.z.array(HalLinkItemSchema).optional(),
|
|
752
|
+
"wp:featuredmedia": zod.z.array(HalLinkItemSchema).optional(),
|
|
753
|
+
"wp:attachment": zod.z.array(HalLinkItemSchema).optional(),
|
|
754
|
+
"wp:term": zod.z.array(HalLinkItemSchema).optional(),
|
|
755
|
+
"wp:post_type": zod.z.array(HalLinkItemSchema).optional(),
|
|
756
|
+
curies: zod.z.array(
|
|
757
|
+
zod.z.object({
|
|
758
|
+
name: zod.z.string(),
|
|
759
|
+
href: zod.z.string(),
|
|
760
|
+
templated: zod.z.boolean()
|
|
761
|
+
})
|
|
762
|
+
).optional()
|
|
763
|
+
}).passthrough();
|
|
764
|
+
var WordPressBaseSchema = zod.z.object({
|
|
765
|
+
id: zod.z.number(),
|
|
766
|
+
date: zod.z.string(),
|
|
767
|
+
date_gmt: zod.z.string(),
|
|
768
|
+
modified: zod.z.string(),
|
|
769
|
+
modified_gmt: zod.z.string(),
|
|
770
|
+
slug: zod.z.string(),
|
|
771
|
+
status: zod.z.string(),
|
|
772
|
+
type: zod.z.string(),
|
|
773
|
+
link: zod.z.string(),
|
|
774
|
+
_links: HalLinksSchema.optional()
|
|
775
|
+
});
|
|
776
|
+
var paginationParamsSchema = zod.z.object({
|
|
777
|
+
/** Current page number */
|
|
778
|
+
page: zod.z.number().int().positive().optional(),
|
|
779
|
+
/** Items per page */
|
|
780
|
+
per_page: zod.z.number().int().positive().max(100).optional(),
|
|
781
|
+
/** Offset for pagination */
|
|
782
|
+
offset: zod.z.number().int().nonnegative().optional(),
|
|
783
|
+
/** Sort order */
|
|
784
|
+
order: zod.z.enum(["asc", "desc"]).optional(),
|
|
785
|
+
/** Field to sort by */
|
|
786
|
+
orderby: zod.z.string().optional()
|
|
787
|
+
});
|
|
788
|
+
zod.z.object({
|
|
789
|
+
/** Total number of items */
|
|
790
|
+
total: zod.z.number(),
|
|
791
|
+
/** Total number of pages */
|
|
792
|
+
totalPages: zod.z.number(),
|
|
793
|
+
/** Current page */
|
|
794
|
+
currentPage: zod.z.number(),
|
|
795
|
+
/** Items per page */
|
|
796
|
+
perPage: zod.z.number()
|
|
797
|
+
});
|
|
798
|
+
var CategorySchema = zod.z.object({
|
|
799
|
+
id: zod.z.number(),
|
|
800
|
+
count: zod.z.number(),
|
|
801
|
+
description: zod.z.string().optional(),
|
|
802
|
+
link: zod.z.string(),
|
|
803
|
+
name: zod.z.string(),
|
|
804
|
+
slug: zod.z.string(),
|
|
805
|
+
taxonomy: zod.z.string(),
|
|
806
|
+
parent: zod.z.number(),
|
|
807
|
+
meta: zod.z.any().optional(),
|
|
808
|
+
_links: HalLinksSchema.optional()
|
|
809
|
+
});
|
|
810
|
+
var CategoriesListSchema = zod.z.array(CategorySchema);
|
|
811
|
+
var CategoryParamsSchema = paginationParamsSchema.extend({
|
|
812
|
+
context: zod.z.enum(["view", "embed", "edit"]).optional(),
|
|
813
|
+
search: zod.z.string().optional(),
|
|
814
|
+
exclude: zod.z.array(zod.z.number()).optional(),
|
|
815
|
+
include: zod.z.array(zod.z.number()).optional(),
|
|
816
|
+
hide_empty: zod.z.boolean().optional(),
|
|
817
|
+
parent: zod.z.number().optional(),
|
|
818
|
+
post: zod.z.number().optional(),
|
|
819
|
+
slug: zod.z.string().optional()
|
|
820
|
+
});
|
|
821
|
+
var TagSchema = zod.z.object({
|
|
822
|
+
id: zod.z.number(),
|
|
823
|
+
count: zod.z.number(),
|
|
824
|
+
description: zod.z.string().optional(),
|
|
825
|
+
link: zod.z.string(),
|
|
826
|
+
name: zod.z.string(),
|
|
827
|
+
slug: zod.z.string(),
|
|
828
|
+
taxonomy: zod.z.string(),
|
|
829
|
+
meta: zod.z.any().optional(),
|
|
830
|
+
_links: HalLinksSchema.optional()
|
|
831
|
+
});
|
|
832
|
+
var TagsListSchema = zod.z.array(TagSchema);
|
|
833
|
+
var MediaSizeSchema = zod.z.object({
|
|
834
|
+
file: zod.z.string(),
|
|
835
|
+
width: zod.z.number(),
|
|
836
|
+
height: zod.z.number(),
|
|
837
|
+
filesize: zod.z.number().optional(),
|
|
838
|
+
mime_type: zod.z.string(),
|
|
839
|
+
source_url: zod.z.string()
|
|
840
|
+
});
|
|
841
|
+
var MediaSizesSchema = zod.z.object({
|
|
842
|
+
thumbnail: MediaSizeSchema.optional(),
|
|
843
|
+
medium: MediaSizeSchema.optional(),
|
|
844
|
+
medium_large: MediaSizeSchema.optional(),
|
|
845
|
+
large: MediaSizeSchema.optional(),
|
|
846
|
+
full: MediaSizeSchema.optional()
|
|
847
|
+
}).passthrough();
|
|
848
|
+
var ImageMetaSchema = zod.z.object({
|
|
849
|
+
aperture: zod.z.string().optional(),
|
|
850
|
+
credit: zod.z.string().optional(),
|
|
851
|
+
camera: zod.z.string().optional(),
|
|
852
|
+
caption: zod.z.string().optional(),
|
|
853
|
+
created_timestamp: zod.z.string().optional(),
|
|
854
|
+
copyright: zod.z.string().optional(),
|
|
855
|
+
focal_length: zod.z.string().optional(),
|
|
856
|
+
iso: zod.z.string().optional(),
|
|
857
|
+
shutter_speed: zod.z.string().optional(),
|
|
858
|
+
title: zod.z.string().optional(),
|
|
859
|
+
orientation: zod.z.string().optional(),
|
|
860
|
+
keywords: zod.z.array(zod.z.string()).optional()
|
|
861
|
+
});
|
|
862
|
+
var MediaDetailsSchema = zod.z.object({
|
|
863
|
+
width: zod.z.number(),
|
|
864
|
+
height: zod.z.number(),
|
|
865
|
+
file: zod.z.string(),
|
|
866
|
+
filesize: zod.z.number().optional(),
|
|
867
|
+
sizes: MediaSizesSchema,
|
|
868
|
+
image_meta: ImageMetaSchema.optional()
|
|
869
|
+
});
|
|
870
|
+
var MediaSchema = zod.z.object({
|
|
871
|
+
id: zod.z.number(),
|
|
872
|
+
date: zod.z.string(),
|
|
873
|
+
date_gmt: zod.z.string(),
|
|
874
|
+
guid: GuidSchema,
|
|
875
|
+
modified: zod.z.string(),
|
|
876
|
+
modified_gmt: zod.z.string(),
|
|
877
|
+
slug: zod.z.string(),
|
|
878
|
+
status: zod.z.string(),
|
|
879
|
+
type: zod.z.string(),
|
|
880
|
+
link: zod.z.string(),
|
|
881
|
+
title: RenderedContentSchema,
|
|
882
|
+
author: zod.z.number(),
|
|
883
|
+
comment_status: zod.z.string(),
|
|
884
|
+
ping_status: zod.z.string(),
|
|
885
|
+
template: zod.z.string().optional(),
|
|
886
|
+
meta: zod.z.any().optional(),
|
|
887
|
+
description: RenderedContentSchema,
|
|
888
|
+
caption: RenderedContentSchema,
|
|
889
|
+
alt_text: zod.z.string(),
|
|
890
|
+
media_type: zod.z.string(),
|
|
891
|
+
mime_type: zod.z.string(),
|
|
892
|
+
media_details: MediaDetailsSchema,
|
|
893
|
+
post: zod.z.number().nullable(),
|
|
894
|
+
source_url: zod.z.string(),
|
|
895
|
+
_links: HalLinksSchema.optional()
|
|
896
|
+
});
|
|
897
|
+
var MediaListSchema = zod.z.array(MediaSchema);
|
|
898
|
+
var PostSchema = zod.z.object({
|
|
899
|
+
id: zod.z.number(),
|
|
900
|
+
date: zod.z.string(),
|
|
901
|
+
date_gmt: zod.z.string(),
|
|
902
|
+
guid: GuidSchema,
|
|
903
|
+
modified: zod.z.string(),
|
|
904
|
+
modified_gmt: zod.z.string(),
|
|
905
|
+
slug: zod.z.string(),
|
|
906
|
+
status: zod.z.string(),
|
|
907
|
+
type: zod.z.string(),
|
|
908
|
+
link: zod.z.string(),
|
|
909
|
+
title: RenderedContentSchema,
|
|
910
|
+
content: RenderedContentSchema,
|
|
911
|
+
excerpt: RenderedContentSchema,
|
|
912
|
+
author: zod.z.number(),
|
|
913
|
+
featured_media: zod.z.number(),
|
|
914
|
+
comment_status: zod.z.string(),
|
|
915
|
+
ping_status: zod.z.string(),
|
|
916
|
+
sticky: zod.z.boolean(),
|
|
917
|
+
template: zod.z.string(),
|
|
918
|
+
format: zod.z.string(),
|
|
919
|
+
meta: zod.z.any().optional(),
|
|
920
|
+
categories: zod.z.array(zod.z.number()),
|
|
921
|
+
tags: zod.z.array(zod.z.number()).optional(),
|
|
922
|
+
_links: HalLinksSchema.optional()
|
|
923
|
+
});
|
|
924
|
+
var PostsListSchema = zod.z.array(PostSchema);
|
|
925
|
+
var PostParamsSchema = paginationParamsSchema.extend({
|
|
926
|
+
context: zod.z.enum(["view", "embed", "edit"]).optional(),
|
|
927
|
+
search: zod.z.string().optional(),
|
|
928
|
+
after: zod.z.string().optional(),
|
|
929
|
+
before: zod.z.string().optional(),
|
|
930
|
+
author: zod.z.union([zod.z.number(), zod.z.array(zod.z.number())]).optional(),
|
|
931
|
+
author_exclude: zod.z.array(zod.z.number()).optional(),
|
|
932
|
+
exclude: zod.z.array(zod.z.number()).optional(),
|
|
933
|
+
include: zod.z.array(zod.z.number()).optional(),
|
|
934
|
+
categories: zod.z.union([zod.z.number(), zod.z.array(zod.z.number())]).optional(),
|
|
935
|
+
categories_exclude: zod.z.array(zod.z.number()).optional(),
|
|
936
|
+
tags: zod.z.union([zod.z.number(), zod.z.array(zod.z.number())]).optional(),
|
|
937
|
+
tags_exclude: zod.z.array(zod.z.number()).optional(),
|
|
938
|
+
sticky: zod.z.boolean().optional()
|
|
939
|
+
});
|
|
940
|
+
var EmbeddedPostSchema = zod.z.object({
|
|
941
|
+
id: zod.z.number(),
|
|
942
|
+
title: zod.z.string(),
|
|
943
|
+
content: zod.z.string(),
|
|
944
|
+
featured_image: zod.z.string().optional(),
|
|
945
|
+
published_date: zod.z.string(),
|
|
946
|
+
categories: zod.z.array(
|
|
947
|
+
zod.z.object({
|
|
948
|
+
id: zod.z.number(),
|
|
949
|
+
name: zod.z.string(),
|
|
950
|
+
slug: zod.z.string(),
|
|
951
|
+
taxonomy: zod.z.string().optional(),
|
|
952
|
+
description: zod.z.string().optional(),
|
|
953
|
+
parent: zod.z.number().optional(),
|
|
954
|
+
count: zod.z.number().optional()
|
|
955
|
+
})
|
|
956
|
+
).optional()
|
|
957
|
+
});
|
|
958
|
+
var EmbeddedPostsListSchema = zod.z.array(EmbeddedPostSchema);
|
|
959
|
+
var AvatarUrlsSchema = zod.z.object({
|
|
960
|
+
"24": zod.z.string().optional(),
|
|
961
|
+
"48": zod.z.string().optional(),
|
|
962
|
+
"96": zod.z.string().optional()
|
|
963
|
+
});
|
|
964
|
+
var UserSchema = zod.z.object({
|
|
965
|
+
id: zod.z.number(),
|
|
966
|
+
username: zod.z.string().optional(),
|
|
967
|
+
// Only in edit context
|
|
968
|
+
name: zod.z.string(),
|
|
969
|
+
first_name: zod.z.string().optional(),
|
|
970
|
+
last_name: zod.z.string().optional(),
|
|
971
|
+
email: zod.z.string().optional(),
|
|
972
|
+
// Only for current user or admin
|
|
973
|
+
url: zod.z.string(),
|
|
974
|
+
description: zod.z.string(),
|
|
975
|
+
link: zod.z.string(),
|
|
976
|
+
locale: zod.z.string().optional(),
|
|
977
|
+
// Only for current user
|
|
978
|
+
nickname: zod.z.string().optional(),
|
|
979
|
+
// Only in edit context
|
|
980
|
+
slug: zod.z.string(),
|
|
981
|
+
registered_date: zod.z.string().optional(),
|
|
982
|
+
// Only in edit context
|
|
983
|
+
roles: zod.z.array(zod.z.string()).optional(),
|
|
984
|
+
// Only in edit context
|
|
985
|
+
capabilities: zod.z.record(zod.z.boolean()).optional(),
|
|
986
|
+
// Only in edit context
|
|
987
|
+
extra_capabilities: zod.z.record(zod.z.boolean()).optional(),
|
|
988
|
+
// Only in edit context
|
|
989
|
+
avatar_urls: AvatarUrlsSchema.optional(),
|
|
990
|
+
meta: zod.z.any().optional(),
|
|
991
|
+
_links: HalLinksSchema.optional()
|
|
992
|
+
});
|
|
993
|
+
var UsersListSchema = zod.z.array(UserSchema);
|
|
994
|
+
var CurrentUserSchema = UserSchema.extend({
|
|
995
|
+
username: zod.z.string(),
|
|
996
|
+
email: zod.z.string(),
|
|
997
|
+
locale: zod.z.string(),
|
|
998
|
+
nickname: zod.z.string(),
|
|
999
|
+
registered_date: zod.z.string(),
|
|
1000
|
+
roles: zod.z.array(zod.z.string())
|
|
1001
|
+
});
|
|
1002
|
+
|
|
1003
|
+
// src/api/auth.ts
|
|
702
1004
|
var createAuthAPI = (axios2, options) => ({
|
|
703
1005
|
/**
|
|
704
1006
|
* Login with username/password and get JWT token
|
|
705
1007
|
*/
|
|
706
1008
|
async login(input) {
|
|
707
1009
|
const response = await axios2.post(ENDPOINTS.JWT_TOKEN, input);
|
|
708
|
-
return handleApiResponse(response,
|
|
1010
|
+
return handleApiResponse(response, JwtTokenResponseSchema, options);
|
|
709
1011
|
},
|
|
710
1012
|
/**
|
|
711
1013
|
* Validate current JWT token
|
|
@@ -721,45 +1023,51 @@ var createAuthAPI = (axios2, options) => ({
|
|
|
721
1023
|
}
|
|
722
1024
|
}
|
|
723
1025
|
});
|
|
1026
|
+
|
|
1027
|
+
// src/api/categories.ts
|
|
724
1028
|
var createCategoriesAPI = (axios2, options) => ({
|
|
725
1029
|
/**
|
|
726
1030
|
* Get list of categories with pagination
|
|
727
1031
|
*/
|
|
728
1032
|
async list(params) {
|
|
729
1033
|
const response = await axios2.get(ENDPOINTS.CATEGORIES, { params });
|
|
730
|
-
return handlePaginatedApiResponse(response,
|
|
1034
|
+
return handlePaginatedApiResponse(response, CategoriesListSchema, params, options);
|
|
731
1035
|
},
|
|
732
1036
|
/**
|
|
733
1037
|
* Get single category by ID
|
|
734
1038
|
*/
|
|
735
1039
|
async get(id) {
|
|
736
1040
|
const response = await axios2.get(ENDPOINTS.CATEGORY(id));
|
|
737
|
-
return handleApiResponse(response,
|
|
1041
|
+
return handleApiResponse(response, CategorySchema, options);
|
|
738
1042
|
}
|
|
739
1043
|
});
|
|
1044
|
+
|
|
1045
|
+
// src/api/media.ts
|
|
740
1046
|
var createMediaAPI = (axios2, options) => ({
|
|
741
1047
|
/**
|
|
742
1048
|
* Get single media item by ID
|
|
743
1049
|
*/
|
|
744
1050
|
async get(id) {
|
|
745
1051
|
const response = await axios2.get(ENDPOINTS.MEDIA_ITEM(id));
|
|
746
|
-
return handleApiResponse(response,
|
|
1052
|
+
return handleApiResponse(response, MediaSchema, options);
|
|
747
1053
|
}
|
|
748
1054
|
});
|
|
1055
|
+
|
|
1056
|
+
// src/api/posts.ts
|
|
749
1057
|
var createPostsAPI = (axios2, options) => ({
|
|
750
1058
|
/**
|
|
751
1059
|
* Get list of posts with pagination
|
|
752
1060
|
*/
|
|
753
1061
|
async list(params) {
|
|
754
1062
|
const response = await axios2.get(ENDPOINTS.POSTS, { params });
|
|
755
|
-
return handlePaginatedApiResponse(response,
|
|
1063
|
+
return handlePaginatedApiResponse(response, PostsListSchema, params, options);
|
|
756
1064
|
},
|
|
757
1065
|
/**
|
|
758
1066
|
* Get single post by ID
|
|
759
1067
|
*/
|
|
760
1068
|
async get(id) {
|
|
761
1069
|
const response = await axios2.get(ENDPOINTS.POST(id));
|
|
762
|
-
return handleApiResponse(response,
|
|
1070
|
+
return handleApiResponse(response, PostSchema, options);
|
|
763
1071
|
},
|
|
764
1072
|
/**
|
|
765
1073
|
* Get single post by slug
|
|
@@ -768,24 +1076,26 @@ var createPostsAPI = (axios2, options) => ({
|
|
|
768
1076
|
const response = await axios2.get(ENDPOINTS.POSTS, {
|
|
769
1077
|
params: { slug, per_page: 1 }
|
|
770
1078
|
});
|
|
771
|
-
const posts = handleApiResponse(response,
|
|
1079
|
+
const posts = handleApiResponse(response, PostsListSchema, options);
|
|
772
1080
|
return posts[0] || null;
|
|
773
1081
|
}
|
|
774
1082
|
});
|
|
1083
|
+
|
|
1084
|
+
// src/api/users.ts
|
|
775
1085
|
var createUsersAPI = (axios2, options) => ({
|
|
776
1086
|
/**
|
|
777
1087
|
* Get current authenticated user
|
|
778
1088
|
*/
|
|
779
1089
|
async me() {
|
|
780
1090
|
const response = await axios2.get(ENDPOINTS.USERS_ME);
|
|
781
|
-
return handleApiResponse(response,
|
|
1091
|
+
return handleApiResponse(response, CurrentUserSchema, options);
|
|
782
1092
|
},
|
|
783
1093
|
/**
|
|
784
1094
|
* Get user by ID
|
|
785
1095
|
*/
|
|
786
1096
|
async get(id) {
|
|
787
1097
|
const response = await axios2.get(ENDPOINTS.USER(id));
|
|
788
|
-
return handleApiResponse(response,
|
|
1098
|
+
return handleApiResponse(response, UserSchema, options);
|
|
789
1099
|
}
|
|
790
1100
|
});
|
|
791
1101
|
|
|
@@ -827,142 +1137,133 @@ var createClient = (config) => {
|
|
|
827
1137
|
setupErrorInterceptor(axiosInstance, fullConfig, client);
|
|
828
1138
|
return client;
|
|
829
1139
|
};
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
Object.defineProperty(exports, "EmbeddedPostSchema", {
|
|
852
|
-
enumerable: true,
|
|
853
|
-
get: function () { return wordpress.EmbeddedPostSchema; }
|
|
854
|
-
});
|
|
855
|
-
Object.defineProperty(exports, "EmbeddedPostsListSchema", {
|
|
856
|
-
enumerable: true,
|
|
857
|
-
get: function () { return wordpress.EmbeddedPostsListSchema; }
|
|
858
|
-
});
|
|
859
|
-
Object.defineProperty(exports, "GuidSchema", {
|
|
860
|
-
enumerable: true,
|
|
861
|
-
get: function () { return wordpress.GuidSchema; }
|
|
862
|
-
});
|
|
863
|
-
Object.defineProperty(exports, "HalLinkItemSchema", {
|
|
864
|
-
enumerable: true,
|
|
865
|
-
get: function () { return wordpress.HalLinkItemSchema; }
|
|
866
|
-
});
|
|
867
|
-
Object.defineProperty(exports, "HalLinksSchema", {
|
|
868
|
-
enumerable: true,
|
|
869
|
-
get: function () { return wordpress.HalLinksSchema; }
|
|
870
|
-
});
|
|
871
|
-
Object.defineProperty(exports, "ImageMetaSchema", {
|
|
872
|
-
enumerable: true,
|
|
873
|
-
get: function () { return wordpress.ImageMetaSchema; }
|
|
874
|
-
});
|
|
875
|
-
Object.defineProperty(exports, "JwtErrorResponseSchema", {
|
|
876
|
-
enumerable: true,
|
|
877
|
-
get: function () { return wordpress.JwtErrorResponseSchema; }
|
|
878
|
-
});
|
|
879
|
-
Object.defineProperty(exports, "JwtLoginInputSchema", {
|
|
880
|
-
enumerable: true,
|
|
881
|
-
get: function () { return wordpress.JwtLoginInputSchema; }
|
|
882
|
-
});
|
|
883
|
-
Object.defineProperty(exports, "JwtTokenResponseSchema", {
|
|
884
|
-
enumerable: true,
|
|
885
|
-
get: function () { return wordpress.JwtTokenResponseSchema; }
|
|
1140
|
+
var addressSchema = zod.z.object({
|
|
1141
|
+
/** First name */
|
|
1142
|
+
first_name: zod.z.string().min(1, "First name is required"),
|
|
1143
|
+
/** Last name */
|
|
1144
|
+
last_name: zod.z.string().min(1, "Last name is required"),
|
|
1145
|
+
/** Company name (optional) */
|
|
1146
|
+
company: zod.z.string(),
|
|
1147
|
+
/** Address line 1 */
|
|
1148
|
+
address_1: zod.z.string().min(1, "Address is required"),
|
|
1149
|
+
/** Address line 2 (optional) */
|
|
1150
|
+
address_2: zod.z.string(),
|
|
1151
|
+
/** City */
|
|
1152
|
+
city: zod.z.string().min(1, "City is required"),
|
|
1153
|
+
/** State/Province/Region */
|
|
1154
|
+
state: zod.z.string(),
|
|
1155
|
+
/** Postal code */
|
|
1156
|
+
postcode: zod.z.string().min(1, "Postal code is required"),
|
|
1157
|
+
/** Country code (ISO 3166-1 alpha-2) */
|
|
1158
|
+
country: zod.z.string(),
|
|
1159
|
+
/** Phone number */
|
|
1160
|
+
phone: zod.z.string().min(1, "Phone number is required")
|
|
886
1161
|
});
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
1162
|
+
var addressSchemaNonMandatory = zod.z.object({
|
|
1163
|
+
/** First name */
|
|
1164
|
+
first_name: zod.z.string(),
|
|
1165
|
+
/** Last name */
|
|
1166
|
+
last_name: zod.z.string(),
|
|
1167
|
+
/** Company name (optional) */
|
|
1168
|
+
company: zod.z.string(),
|
|
1169
|
+
/** Address line 1 */
|
|
1170
|
+
address_1: zod.z.string(),
|
|
1171
|
+
/** Address line 2 (optional) */
|
|
1172
|
+
address_2: zod.z.string(),
|
|
1173
|
+
/** City */
|
|
1174
|
+
city: zod.z.string(),
|
|
1175
|
+
/** State/Province/Region */
|
|
1176
|
+
state: zod.z.string(),
|
|
1177
|
+
/** Postal code */
|
|
1178
|
+
postcode: zod.z.string(),
|
|
1179
|
+
/** Country code (ISO 3166-1 alpha-2) */
|
|
1180
|
+
country: zod.z.string(),
|
|
1181
|
+
/** Phone number */
|
|
1182
|
+
phone: zod.z.string()
|
|
890
1183
|
});
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
1184
|
+
addressSchema.extend({
|
|
1185
|
+
/** Email address (required for billing) */
|
|
1186
|
+
email: zod.z.string().email("Valid email is required")
|
|
894
1187
|
});
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
1188
|
+
addressSchemaNonMandatory.extend({
|
|
1189
|
+
/** Email address (can be null for guest carts) */
|
|
1190
|
+
email: zod.z.string().nullable()
|
|
898
1191
|
});
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
1192
|
+
var moneySchema = zod.z.object({
|
|
1193
|
+
/** Currency code (e.g., 'USD', 'EUR', 'BAM') */
|
|
1194
|
+
currency_code: zod.z.string(),
|
|
1195
|
+
/** Currency symbol (e.g., '$', '€', 'KM') */
|
|
1196
|
+
currency_symbol: zod.z.string(),
|
|
1197
|
+
/** Number of decimal places (e.g., 2 for dollars/euros) */
|
|
1198
|
+
currency_minor_unit: zod.z.number(),
|
|
1199
|
+
/** Decimal separator character (e.g., '.', ',') */
|
|
1200
|
+
currency_decimal_separator: zod.z.string(),
|
|
1201
|
+
/** Thousands separator character (e.g., ',', '.') */
|
|
1202
|
+
currency_thousand_separator: zod.z.string(),
|
|
1203
|
+
/** Currency symbol prefix (empty if symbol is suffix) */
|
|
1204
|
+
currency_prefix: zod.z.string(),
|
|
1205
|
+
/** Currency symbol suffix (empty if symbol is prefix) */
|
|
1206
|
+
currency_suffix: zod.z.string()
|
|
902
1207
|
});
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
1208
|
+
var paginationParamsSchema2 = zod.z.object({
|
|
1209
|
+
/** Current page number */
|
|
1210
|
+
page: zod.z.number().int().positive().optional(),
|
|
1211
|
+
/** Items per page */
|
|
1212
|
+
per_page: zod.z.number().int().positive().max(100).optional(),
|
|
1213
|
+
/** Offset for pagination */
|
|
1214
|
+
offset: zod.z.number().int().nonnegative().optional(),
|
|
1215
|
+
/** Sort order */
|
|
1216
|
+
order: zod.z.enum(["asc", "desc"]).optional(),
|
|
1217
|
+
/** Field to sort by */
|
|
1218
|
+
orderby: zod.z.string().optional()
|
|
906
1219
|
});
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
enumerable: true,
|
|
917
|
-
get: function () { return wordpress.PostSchema; }
|
|
918
|
-
});
|
|
919
|
-
Object.defineProperty(exports, "PostStatusSchema", {
|
|
920
|
-
enumerable: true,
|
|
921
|
-
get: function () { return wordpress.PostStatusSchema; }
|
|
922
|
-
});
|
|
923
|
-
Object.defineProperty(exports, "PostsListSchema", {
|
|
924
|
-
enumerable: true,
|
|
925
|
-
get: function () { return wordpress.PostsListSchema; }
|
|
926
|
-
});
|
|
927
|
-
Object.defineProperty(exports, "RenderedContentSchema", {
|
|
928
|
-
enumerable: true,
|
|
929
|
-
get: function () { return wordpress.RenderedContentSchema; }
|
|
930
|
-
});
|
|
931
|
-
Object.defineProperty(exports, "TagSchema", {
|
|
932
|
-
enumerable: true,
|
|
933
|
-
get: function () { return wordpress.TagSchema; }
|
|
934
|
-
});
|
|
935
|
-
Object.defineProperty(exports, "TagsListSchema", {
|
|
936
|
-
enumerable: true,
|
|
937
|
-
get: function () { return wordpress.TagsListSchema; }
|
|
938
|
-
});
|
|
939
|
-
Object.defineProperty(exports, "UserSchema", {
|
|
940
|
-
enumerable: true,
|
|
941
|
-
get: function () { return wordpress.UserSchema; }
|
|
942
|
-
});
|
|
943
|
-
Object.defineProperty(exports, "UsersListSchema", {
|
|
944
|
-
enumerable: true,
|
|
945
|
-
get: function () { return wordpress.UsersListSchema; }
|
|
946
|
-
});
|
|
947
|
-
Object.defineProperty(exports, "WordPressBaseSchema", {
|
|
948
|
-
enumerable: true,
|
|
949
|
-
get: function () { return wordpress.WordPressBaseSchema; }
|
|
950
|
-
});
|
|
951
|
-
Object.defineProperty(exports, "AddressSchema", {
|
|
952
|
-
enumerable: true,
|
|
953
|
-
get: function () { return common.addressSchema; }
|
|
954
|
-
});
|
|
955
|
-
Object.defineProperty(exports, "MoneySchema", {
|
|
956
|
-
enumerable: true,
|
|
957
|
-
get: function () { return common.moneySchema; }
|
|
958
|
-
});
|
|
959
|
-
Object.defineProperty(exports, "PaginationParamsSchema", {
|
|
960
|
-
enumerable: true,
|
|
961
|
-
get: function () { return common.paginationParamsSchema; }
|
|
1220
|
+
zod.z.object({
|
|
1221
|
+
/** Total number of items */
|
|
1222
|
+
total: zod.z.number(),
|
|
1223
|
+
/** Total number of pages */
|
|
1224
|
+
totalPages: zod.z.number(),
|
|
1225
|
+
/** Current page */
|
|
1226
|
+
currentPage: zod.z.number(),
|
|
1227
|
+
/** Items per page */
|
|
1228
|
+
perPage: zod.z.number()
|
|
962
1229
|
});
|
|
1230
|
+
|
|
1231
|
+
exports.AddressSchema = addressSchema;
|
|
1232
|
+
exports.AvatarUrlsSchema = AvatarUrlsSchema;
|
|
963
1233
|
exports.BaseError = BaseError;
|
|
1234
|
+
exports.CategoriesListSchema = CategoriesListSchema;
|
|
1235
|
+
exports.CategoryParamsSchema = CategoryParamsSchema;
|
|
1236
|
+
exports.CategorySchema = CategorySchema;
|
|
1237
|
+
exports.CurrentUserSchema = CurrentUserSchema;
|
|
964
1238
|
exports.ENDPOINTS = ENDPOINTS;
|
|
1239
|
+
exports.EmbeddedPostSchema = EmbeddedPostSchema;
|
|
1240
|
+
exports.EmbeddedPostsListSchema = EmbeddedPostsListSchema;
|
|
1241
|
+
exports.GuidSchema = GuidSchema;
|
|
1242
|
+
exports.HalLinkItemSchema = HalLinkItemSchema;
|
|
1243
|
+
exports.HalLinksSchema = HalLinksSchema;
|
|
1244
|
+
exports.ImageMetaSchema = ImageMetaSchema;
|
|
1245
|
+
exports.JwtErrorResponseSchema = JwtErrorResponseSchema;
|
|
1246
|
+
exports.JwtLoginInputSchema = JwtLoginInputSchema;
|
|
1247
|
+
exports.JwtTokenResponseSchema = JwtTokenResponseSchema;
|
|
1248
|
+
exports.JwtValidateResponseSchema = JwtValidateResponseSchema;
|
|
1249
|
+
exports.MediaDetailsSchema = MediaDetailsSchema;
|
|
1250
|
+
exports.MediaListSchema = MediaListSchema;
|
|
1251
|
+
exports.MediaSchema = MediaSchema;
|
|
1252
|
+
exports.MediaSizeSchema = MediaSizeSchema;
|
|
1253
|
+
exports.MediaSizesSchema = MediaSizesSchema;
|
|
1254
|
+
exports.MoneySchema = moneySchema;
|
|
1255
|
+
exports.PaginationParamsSchema = paginationParamsSchema2;
|
|
1256
|
+
exports.PostParamsSchema = PostParamsSchema;
|
|
1257
|
+
exports.PostSchema = PostSchema;
|
|
1258
|
+
exports.PostStatusSchema = PostStatusSchema;
|
|
1259
|
+
exports.PostsListSchema = PostsListSchema;
|
|
1260
|
+
exports.RenderedContentSchema = RenderedContentSchema;
|
|
1261
|
+
exports.TagSchema = TagSchema;
|
|
1262
|
+
exports.TagsListSchema = TagsListSchema;
|
|
1263
|
+
exports.UserSchema = UserSchema;
|
|
1264
|
+
exports.UsersListSchema = UsersListSchema;
|
|
965
1265
|
exports.WordPressApiError = WordPressApiError;
|
|
1266
|
+
exports.WordPressBaseSchema = WordPressBaseSchema;
|
|
966
1267
|
exports.WordPressDataValidationError = WordPressDataValidationError;
|
|
967
1268
|
exports.calculatePagination = calculatePagination;
|
|
968
1269
|
exports.createClient = createClient;
|