@01.software/sdk 0.1.7 → 0.1.9

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.
@@ -918,17 +918,6 @@ interface Product {
918
918
  tenant?: (number | null) | Tenant;
919
919
  title: string;
920
920
  subtitle?: string | null;
921
- /**
922
- * When enabled, the slug will auto-generate from the title field on save and autosave.
923
- */
924
- generateSlug?: boolean | null;
925
- slug?: string | null;
926
- /**
927
- * Stock Keeping Unit
928
- */
929
- sku?: string | null;
930
- status?: ('draft' | 'published' | 'archived') | null;
931
- isSoldOut?: boolean | null;
932
921
  thumbnail?: (number | null) | ProductImage;
933
922
  images?: (number | ProductImage)[] | null;
934
923
  description?: {
@@ -951,13 +940,6 @@ interface Product {
951
940
  * Original price before discount
952
941
  */
953
942
  compareAtPrice?: number | null;
954
- categories?: (number | ProductCategory)[] | null;
955
- tags?: (number | ProductTag)[] | null;
956
- brand?: (number | null) | Brand;
957
- shippingPolicy?: (number | null) | ShippingPolicy;
958
- metadata?: {
959
- [k: string]: unknown;
960
- } | unknown[] | string | number | boolean | null;
961
943
  variants?: {
962
944
  docs?: (number | ProductVariant)[];
963
945
  hasNextPage?: boolean;
@@ -982,6 +964,24 @@ interface Product {
982
964
  */
983
965
  image?: (number | null) | Media;
984
966
  };
967
+ /**
968
+ * When enabled, the slug will auto-generate from the title field on save and autosave.
969
+ */
970
+ generateSlug?: boolean | null;
971
+ slug?: string | null;
972
+ /**
973
+ * Stock Keeping Unit
974
+ */
975
+ sku?: string | null;
976
+ status?: ('draft' | 'published' | 'archived') | null;
977
+ isSoldOut?: boolean | null;
978
+ categories?: (number | ProductCategory)[] | null;
979
+ tags?: (number | ProductTag)[] | null;
980
+ brand?: (number | null) | Brand;
981
+ shippingPolicy?: (number | null) | ShippingPolicy;
982
+ metadata?: {
983
+ [k: string]: unknown;
984
+ } | unknown[] | string | number | boolean | null;
985
985
  updatedAt: string;
986
986
  createdAt: string;
987
987
  }
@@ -1033,6 +1033,75 @@ interface ProductImage {
1033
1033
  };
1034
1034
  };
1035
1035
  }
1036
+ /**
1037
+ * This interface was referenced by `Config`'s JSON-Schema
1038
+ * via the `definition` "product-variants".
1039
+ */
1040
+ interface ProductVariant {
1041
+ id: number;
1042
+ _order?: string | null;
1043
+ '_product-variants_variants_order'?: string | null;
1044
+ tenant?: (number | null) | Tenant;
1045
+ product: number | Product;
1046
+ title: string;
1047
+ /**
1048
+ * Variant-specific SKU
1049
+ */
1050
+ sku?: string | null;
1051
+ /**
1052
+ * Override price (uses product price if empty)
1053
+ */
1054
+ price?: number | null;
1055
+ /**
1056
+ * Barcode (EAN, UPC, etc.)
1057
+ */
1058
+ barcode?: string | null;
1059
+ /**
1060
+ * Weight in grams (g)
1061
+ */
1062
+ weight?: number | null;
1063
+ isSoldOut?: boolean | null;
1064
+ images?: (number | ProductImage)[] | null;
1065
+ metadata?: {
1066
+ [k: string]: unknown;
1067
+ } | unknown[] | string | number | boolean | null;
1068
+ productOptions?: {
1069
+ docs?: (number | ProductOption)[];
1070
+ hasNextPage?: boolean;
1071
+ totalDocs?: number;
1072
+ };
1073
+ updatedAt: string;
1074
+ createdAt: string;
1075
+ }
1076
+ /**
1077
+ * This interface was referenced by `Config`'s JSON-Schema
1078
+ * via the `definition` "product-options".
1079
+ */
1080
+ interface ProductOption {
1081
+ id: number;
1082
+ _order?: string | null;
1083
+ '_product-options_productOptions_order'?: string | null;
1084
+ '_product-options_options_order'?: string | null;
1085
+ tenant?: (number | null) | Tenant;
1086
+ product: number | Product;
1087
+ variant?: (number | null) | ProductVariant;
1088
+ title?: string | null;
1089
+ /**
1090
+ * Option-specific SKU
1091
+ */
1092
+ sku?: string | null;
1093
+ stock: number;
1094
+ /**
1095
+ * Reserved by carts (available = stock - reservedStock)
1096
+ */
1097
+ reservedStock?: number | null;
1098
+ /**
1099
+ * Price adjustment (add/subtract from base price)
1100
+ */
1101
+ priceAdjustment?: number | null;
1102
+ updatedAt: string;
1103
+ createdAt: string;
1104
+ }
1036
1105
  /**
1037
1106
  * This interface was referenced by `Config`'s JSON-Schema
1038
1107
  * via the `definition` "product-categories".
@@ -1141,75 +1210,6 @@ interface ShippingPolicy {
1141
1210
  updatedAt: string;
1142
1211
  createdAt: string;
1143
1212
  }
1144
- /**
1145
- * This interface was referenced by `Config`'s JSON-Schema
1146
- * via the `definition` "product-variants".
1147
- */
1148
- interface ProductVariant {
1149
- id: number;
1150
- _order?: string | null;
1151
- '_product-variants_variants_order'?: string | null;
1152
- tenant?: (number | null) | Tenant;
1153
- product: number | Product;
1154
- title: string;
1155
- /**
1156
- * Variant-specific SKU
1157
- */
1158
- sku?: string | null;
1159
- /**
1160
- * Override price (uses product price if empty)
1161
- */
1162
- price?: number | null;
1163
- /**
1164
- * Barcode (EAN, UPC, etc.)
1165
- */
1166
- barcode?: string | null;
1167
- /**
1168
- * Weight in grams (g)
1169
- */
1170
- weight?: number | null;
1171
- isSoldOut?: boolean | null;
1172
- images?: (number | ProductImage)[] | null;
1173
- metadata?: {
1174
- [k: string]: unknown;
1175
- } | unknown[] | string | number | boolean | null;
1176
- productOptions?: {
1177
- docs?: (number | ProductOption)[];
1178
- hasNextPage?: boolean;
1179
- totalDocs?: number;
1180
- };
1181
- updatedAt: string;
1182
- createdAt: string;
1183
- }
1184
- /**
1185
- * This interface was referenced by `Config`'s JSON-Schema
1186
- * via the `definition` "product-options".
1187
- */
1188
- interface ProductOption {
1189
- id: number;
1190
- _order?: string | null;
1191
- '_product-options_productOptions_order'?: string | null;
1192
- '_product-options_options_order'?: string | null;
1193
- tenant?: (number | null) | Tenant;
1194
- product: number | Product;
1195
- variant?: (number | null) | ProductVariant;
1196
- title?: string | null;
1197
- /**
1198
- * Option-specific SKU
1199
- */
1200
- sku?: string | null;
1201
- stock: number;
1202
- /**
1203
- * Reserved by carts (available = stock - reservedStock)
1204
- */
1205
- reservedStock?: number | null;
1206
- /**
1207
- * Price adjustment (add/subtract from base price)
1208
- */
1209
- priceAdjustment?: number | null;
1210
- updatedAt: string;
1211
- createdAt: string;
1212
- }
1213
1213
  /**
1214
1214
  * This interface was referenced by `Config`'s JSON-Schema
1215
1215
  * via the `definition` "orders".
@@ -1318,6 +1318,7 @@ interface Customer {
1318
1318
  */
1319
1319
  interface CustomerGroup {
1320
1320
  id: number;
1321
+ _order?: string | null;
1321
1322
  tenant?: (number | null) | Tenant;
1322
1323
  title: string;
1323
1324
  /**
@@ -1683,22 +1684,12 @@ interface Post {
1683
1684
  id: number;
1684
1685
  _order?: string | null;
1685
1686
  tenant?: (number | null) | Tenant;
1686
- thumbnail?: (number | null) | PostImage;
1687
1687
  title: string;
1688
1688
  subtitle?: string | null;
1689
- /**
1690
- * When enabled, the slug will auto-generate from the title field on save and autosave.
1691
- */
1692
- generateSlug?: boolean | null;
1693
- slug?: string | null;
1694
- author?: (number | null) | Author;
1695
1689
  /**
1696
1690
  * Brief summary for listing pages
1697
1691
  */
1698
1692
  excerpt?: string | null;
1699
- publishedAt?: string | null;
1700
- categories?: (number | PostCategory)[] | null;
1701
- tags?: (number | PostTag)[] | null;
1702
1693
  content?: {
1703
1694
  root: {
1704
1695
  type: string;
@@ -1728,6 +1719,16 @@ interface Post {
1728
1719
  */
1729
1720
  image?: (number | null) | Media;
1730
1721
  };
1722
+ thumbnail?: (number | null) | PostImage;
1723
+ /**
1724
+ * When enabled, the slug will auto-generate from the title field on save and autosave.
1725
+ */
1726
+ generateSlug?: boolean | null;
1727
+ slug?: string | null;
1728
+ author?: (number | null) | Author;
1729
+ publishedAt?: string | null;
1730
+ categories?: (number | PostCategory)[] | null;
1731
+ tags?: (number | PostTag)[] | null;
1731
1732
  updatedAt: string;
1732
1733
  createdAt: string;
1733
1734
  _status?: ('draft' | 'published') | null;
@@ -1855,24 +1856,6 @@ interface Document {
1855
1856
  _order?: string | null;
1856
1857
  tenant?: (number | null) | Tenant;
1857
1858
  title: string;
1858
- /**
1859
- * When enabled, the slug will auto-generate from the title field on save and autosave.
1860
- */
1861
- generateSlug?: boolean | null;
1862
- slug?: string | null;
1863
- type: 'terms_of_service' | 'privacy_policy' | 'guide' | 'notice' | 'legal_notice' | 'refund_policy' | 'other';
1864
- /**
1865
- * Document version (e.g. 1.0, 1.1, 2.0)
1866
- */
1867
- version: string;
1868
- /**
1869
- * Effective date
1870
- */
1871
- effectiveDate?: string | null;
1872
- /**
1873
- * Expiry date (optional)
1874
- */
1875
- expiryDate?: string | null;
1876
1859
  summary?: string | null;
1877
1860
  content: {
1878
1861
  root: {
@@ -1889,7 +1872,6 @@ interface Document {
1889
1872
  };
1890
1873
  [k: string]: unknown;
1891
1874
  };
1892
- category?: (number | null) | DocumentCategory;
1893
1875
  /**
1894
1876
  * Tags for search (e.g. GDPR, CCPA)
1895
1877
  */
@@ -1897,10 +1879,6 @@ interface Document {
1897
1879
  tag?: string | null;
1898
1880
  id?: string | null;
1899
1881
  }[] | null;
1900
- /**
1901
- * Document that requires user agreement
1902
- */
1903
- isRequired?: boolean | null;
1904
1882
  /**
1905
1883
  * Changelog (differences from previous version)
1906
1884
  */
@@ -1919,6 +1897,29 @@ interface Document {
1919
1897
  */
1920
1898
  image?: (number | null) | Media;
1921
1899
  };
1900
+ /**
1901
+ * When enabled, the slug will auto-generate from the title field on save and autosave.
1902
+ */
1903
+ generateSlug?: boolean | null;
1904
+ slug?: string | null;
1905
+ type: 'terms_of_service' | 'privacy_policy' | 'guide' | 'notice' | 'legal_notice' | 'refund_policy' | 'other';
1906
+ /**
1907
+ * Document version (e.g. 1.0, 1.1, 2.0)
1908
+ */
1909
+ version: string;
1910
+ /**
1911
+ * Effective date
1912
+ */
1913
+ effectiveDate?: string | null;
1914
+ /**
1915
+ * Expiry date (optional)
1916
+ */
1917
+ expiryDate?: string | null;
1918
+ category?: (number | null) | DocumentCategory;
1919
+ /**
1920
+ * Document that requires user agreement
1921
+ */
1922
+ isRequired?: boolean | null;
1922
1923
  updatedAt: string;
1923
1924
  createdAt: string;
1924
1925
  _status?: ('draft' | 'published') | null;
@@ -1999,13 +2000,7 @@ interface DocumentImage {
1999
2000
  interface Playlist {
2000
2001
  id: number;
2001
2002
  tenant?: (number | null) | Tenant;
2002
- image?: (number | null) | PlaylistImage;
2003
2003
  title: string;
2004
- /**
2005
- * When enabled, the slug will auto-generate from the title field on save and autosave.
2006
- */
2007
- generateSlug?: boolean | null;
2008
- slug?: string | null;
2009
2004
  description?: string | null;
2010
2005
  musics?: {
2011
2006
  docs?: (number | Music)[];
@@ -2026,6 +2021,38 @@ interface Playlist {
2026
2021
  */
2027
2022
  image?: (number | null) | Media;
2028
2023
  };
2024
+ image?: (number | null) | PlaylistImage;
2025
+ /**
2026
+ * When enabled, the slug will auto-generate from the title field on save and autosave.
2027
+ */
2028
+ generateSlug?: boolean | null;
2029
+ slug?: string | null;
2030
+ updatedAt: string;
2031
+ createdAt: string;
2032
+ }
2033
+ /**
2034
+ * This interface was referenced by `Config`'s JSON-Schema
2035
+ * via the `definition` "musics".
2036
+ */
2037
+ interface Music {
2038
+ id: number;
2039
+ _musics_musics_order?: string | null;
2040
+ tenant?: (number | null) | Tenant;
2041
+ playlist: number | Playlist;
2042
+ url: string;
2043
+ /**
2044
+ * Auto-filled from YouTube
2045
+ */
2046
+ title: string;
2047
+ /**
2048
+ * Auto-filled from YouTube channel
2049
+ */
2050
+ artist?: string | null;
2051
+ /**
2052
+ * Duration in seconds (auto-filled from YouTube)
2053
+ */
2054
+ duration?: number | null;
2055
+ isValid?: boolean | null;
2029
2056
  updatedAt: string;
2030
2057
  createdAt: string;
2031
2058
  }
@@ -2077,32 +2104,6 @@ interface PlaylistImage {
2077
2104
  };
2078
2105
  };
2079
2106
  }
2080
- /**
2081
- * This interface was referenced by `Config`'s JSON-Schema
2082
- * via the `definition` "musics".
2083
- */
2084
- interface Music {
2085
- id: number;
2086
- _musics_musics_order?: string | null;
2087
- tenant?: (number | null) | Tenant;
2088
- playlist: number | Playlist;
2089
- url: string;
2090
- /**
2091
- * Auto-filled from YouTube
2092
- */
2093
- title: string;
2094
- /**
2095
- * Auto-filled from YouTube channel
2096
- */
2097
- artist?: string | null;
2098
- /**
2099
- * Duration in seconds (auto-filled from YouTube)
2100
- */
2101
- duration?: number | null;
2102
- isValid?: boolean | null;
2103
- updatedAt: string;
2104
- createdAt: string;
2105
- }
2106
2107
  /**
2107
2108
  * This interface was referenced by `Config`'s JSON-Schema
2108
2109
  * via the `definition` "galleries".
@@ -2111,13 +2112,7 @@ interface Gallery {
2111
2112
  id: number;
2112
2113
  _order?: string | null;
2113
2114
  tenant?: (number | null) | Tenant;
2114
- thumbnail?: (number | null) | GalleryImage;
2115
2115
  title: string;
2116
- /**
2117
- * When enabled, the slug will auto-generate from the title field on save and autosave.
2118
- */
2119
- generateSlug?: boolean | null;
2120
- slug?: string | null;
2121
2116
  description?: string | null;
2122
2117
  images: (number | GalleryImage)[];
2123
2118
  meta?: {
@@ -2134,6 +2129,12 @@ interface Gallery {
2134
2129
  */
2135
2130
  image?: (number | null) | Media;
2136
2131
  };
2132
+ thumbnail?: (number | null) | GalleryImage;
2133
+ /**
2134
+ * When enabled, the slug will auto-generate from the title field on save and autosave.
2135
+ */
2136
+ generateSlug?: boolean | null;
2137
+ slug?: string | null;
2137
2138
  updatedAt: string;
2138
2139
  createdAt: string;
2139
2140
  }
@@ -2960,21 +2961,11 @@ interface ProductsSelect<T extends boolean = true> {
2960
2961
  tenant?: T;
2961
2962
  title?: T;
2962
2963
  subtitle?: T;
2963
- generateSlug?: T;
2964
- slug?: T;
2965
- sku?: T;
2966
- status?: T;
2967
- isSoldOut?: T;
2968
2964
  thumbnail?: T;
2969
2965
  images?: T;
2970
2966
  description?: T;
2971
2967
  price?: T;
2972
2968
  compareAtPrice?: T;
2973
- categories?: T;
2974
- tags?: T;
2975
- brand?: T;
2976
- shippingPolicy?: T;
2977
- metadata?: T;
2978
2969
  variants?: T;
2979
2970
  options?: T;
2980
2971
  meta?: T | {
@@ -2982,6 +2973,16 @@ interface ProductsSelect<T extends boolean = true> {
2982
2973
  description?: T;
2983
2974
  image?: T;
2984
2975
  };
2976
+ generateSlug?: T;
2977
+ slug?: T;
2978
+ sku?: T;
2979
+ status?: T;
2980
+ isSoldOut?: T;
2981
+ categories?: T;
2982
+ tags?: T;
2983
+ brand?: T;
2984
+ shippingPolicy?: T;
2985
+ metadata?: T;
2985
2986
  updatedAt?: T;
2986
2987
  createdAt?: T;
2987
2988
  }
@@ -3421,6 +3422,7 @@ interface CustomerAddressesSelect<T extends boolean = true> {
3421
3422
  * via the `definition` "customer-groups_select".
3422
3423
  */
3423
3424
  interface CustomerGroupsSelect<T extends boolean = true> {
3425
+ _order?: T;
3424
3426
  tenant?: T;
3425
3427
  title?: T;
3426
3428
  generateSlug?: T;
@@ -3567,22 +3569,22 @@ interface ShippingPoliciesSelect<T extends boolean = true> {
3567
3569
  interface PostsSelect<T extends boolean = true> {
3568
3570
  _order?: T;
3569
3571
  tenant?: T;
3570
- thumbnail?: T;
3571
3572
  title?: T;
3572
3573
  subtitle?: T;
3573
- generateSlug?: T;
3574
- slug?: T;
3575
- author?: T;
3576
3574
  excerpt?: T;
3577
- publishedAt?: T;
3578
- categories?: T;
3579
- tags?: T;
3580
3575
  content?: T;
3581
3576
  meta?: T | {
3582
3577
  title?: T;
3583
3578
  description?: T;
3584
3579
  image?: T;
3585
3580
  };
3581
+ thumbnail?: T;
3582
+ generateSlug?: T;
3583
+ slug?: T;
3584
+ author?: T;
3585
+ publishedAt?: T;
3586
+ categories?: T;
3587
+ tags?: T;
3586
3588
  updatedAt?: T;
3587
3589
  createdAt?: T;
3588
3590
  _status?: T;
@@ -3692,26 +3694,26 @@ interface DocumentsSelect<T extends boolean = true> {
3692
3694
  _order?: T;
3693
3695
  tenant?: T;
3694
3696
  title?: T;
3695
- generateSlug?: T;
3696
- slug?: T;
3697
- type?: T;
3698
- version?: T;
3699
- effectiveDate?: T;
3700
- expiryDate?: T;
3701
3697
  summary?: T;
3702
3698
  content?: T;
3703
- category?: T;
3704
3699
  tags?: T | {
3705
3700
  tag?: T;
3706
3701
  id?: T;
3707
3702
  };
3708
- isRequired?: T;
3709
3703
  changeLog?: T;
3710
3704
  meta?: T | {
3711
3705
  title?: T;
3712
3706
  description?: T;
3713
3707
  image?: T;
3714
3708
  };
3709
+ generateSlug?: T;
3710
+ slug?: T;
3711
+ type?: T;
3712
+ version?: T;
3713
+ effectiveDate?: T;
3714
+ expiryDate?: T;
3715
+ category?: T;
3716
+ isRequired?: T;
3715
3717
  updatedAt?: T;
3716
3718
  createdAt?: T;
3717
3719
  _status?: T;
@@ -3786,10 +3788,7 @@ interface DocumentImagesSelect<T extends boolean = true> {
3786
3788
  */
3787
3789
  interface PlaylistsSelect<T extends boolean = true> {
3788
3790
  tenant?: T;
3789
- image?: T;
3790
3791
  title?: T;
3791
- generateSlug?: T;
3792
- slug?: T;
3793
3792
  description?: T;
3794
3793
  musics?: T;
3795
3794
  meta?: T | {
@@ -3797,6 +3796,9 @@ interface PlaylistsSelect<T extends boolean = true> {
3797
3796
  description?: T;
3798
3797
  image?: T;
3799
3798
  };
3799
+ image?: T;
3800
+ generateSlug?: T;
3801
+ slug?: T;
3800
3802
  updatedAt?: T;
3801
3803
  createdAt?: T;
3802
3804
  }
@@ -3870,10 +3872,7 @@ interface MusicsSelect<T extends boolean = true> {
3870
3872
  interface GalleriesSelect<T extends boolean = true> {
3871
3873
  _order?: T;
3872
3874
  tenant?: T;
3873
- thumbnail?: T;
3874
3875
  title?: T;
3875
- generateSlug?: T;
3876
- slug?: T;
3877
3876
  description?: T;
3878
3877
  images?: T;
3879
3878
  meta?: T | {
@@ -3881,6 +3880,9 @@ interface GalleriesSelect<T extends boolean = true> {
3881
3880
  description?: T;
3882
3881
  image?: T;
3883
3882
  };
3883
+ thumbnail?: T;
3884
+ generateSlug?: T;
3885
+ slug?: T;
3884
3886
  updatedAt?: T;
3885
3887
  createdAt?: T;
3886
3888
  }
@@ -4111,4 +4113,4 @@ declare module 'payload' {
4111
4113
  }
4112
4114
  }
4113
4115
 
4114
- export type { Music as $, Audience as A, BrandLogo as B, CartItem as C, ExchangeProduct as D, EmailLog as E, Fulfillment as F, FulfillmentItem as G, Cart as H, IframeBlock as I, Discount as J, Post as K, PostImage as L, Media as M, Author as N, Order as O, ProductOption as P, PostCategory as Q, Return as R, SupportedTimezones as S, Transaction as T, UserAuthOperations as U, PostTag as V, Document as W, DocumentCategory as X, DocumentImage as Y, Playlist as Z, PlaylistImage as _, OrderProduct as a, Auth as a$, Gallery as a0, GalleryImage as a1, Form as a2, FormSubmission as a3, PayloadKv as a4, PayloadLockedDocument as a5, PayloadPreference as a6, PayloadMigration as a7, UsersSelect as a8, MediaSelect as a9, CustomersSelect as aA, CustomerAddressesSelect as aB, CustomerGroupsSelect as aC, CustomerGroupImagesSelect as aD, CartsSelect as aE, CartItemsSelect as aF, DiscountsSelect as aG, ShippingPoliciesSelect as aH, PostsSelect as aI, PostCategoriesSelect as aJ, PostTagsSelect as aK, PostImagesSelect as aL, AuthorsSelect as aM, DocumentsSelect as aN, DocumentCategoriesSelect as aO, DocumentImagesSelect as aP, PlaylistsSelect as aQ, PlaylistImagesSelect as aR, MusicsSelect as aS, GalleriesSelect as aT, GalleryImagesSelect as aU, FormsSelect as aV, FormSubmissionsSelect as aW, PayloadKvSelect as aX, PayloadLockedDocumentsSelect as aY, PayloadPreferencesSelect as aZ, PayloadMigrationsSelect as a_, AudiencesSelect as aa, EmailLogsSelect as ab, TenantsSelect as ac, TenantMetadataSelect as ad, TenantLogosSelect as ae, TenantOgImagesSelect as af, ApiUsageSelect as ag, SubscriptionsSelect as ah, BillingHistorySelect as ai, ProductsSelect as aj, ProductVariantsSelect as ak, ProductOptionsSelect as al, ProductCategoriesSelect as am, ProductTagsSelect as an, ProductImagesSelect as ao, BrandsSelect as ap, BrandLogosSelect as aq, OrdersSelect as ar, OrderProductsSelect as as, ReturnsSelect as at, ReturnProductsSelect as au, ExchangesSelect as av, ExchangeProductsSelect as aw, FulfillmentsSelect as ax, FulfillmentItemsSelect as ay, TransactionsSelect as az, Config as b, CustomerAuthOperations as c, PlayerBlock as d, CodeBlock as e, User as f, Tenant as g, TenantMetadatum as h, TenantOgImage as i, TenantLogo as j, ApiUsage as k, Subscription as l, BillingHistory as m, Product as n, ProductImage as o, ProductCategory as p, ProductTag as q, Brand as r, ShippingPolicy as s, ProductVariant as t, Customer as u, CustomerGroup as v, CustomerGroupImage as w, CustomerAddress as x, ReturnProduct as y, Exchange as z };
4116
+ export type { PlaylistImage as $, Audience as A, BrandLogo as B, CartItem as C, ExchangeProduct as D, EmailLog as E, Fulfillment as F, FulfillmentItem as G, Cart as H, IframeBlock as I, Discount as J, Post as K, PostImage as L, Media as M, Author as N, Order as O, ProductOption as P, PostCategory as Q, Return as R, SupportedTimezones as S, Transaction as T, UserAuthOperations as U, PostTag as V, Document as W, DocumentCategory as X, DocumentImage as Y, Playlist as Z, Music as _, OrderProduct as a, Auth as a$, Gallery as a0, GalleryImage as a1, Form as a2, FormSubmission as a3, PayloadKv as a4, PayloadLockedDocument as a5, PayloadPreference as a6, PayloadMigration as a7, UsersSelect as a8, MediaSelect as a9, CustomersSelect as aA, CustomerAddressesSelect as aB, CustomerGroupsSelect as aC, CustomerGroupImagesSelect as aD, CartsSelect as aE, CartItemsSelect as aF, DiscountsSelect as aG, ShippingPoliciesSelect as aH, PostsSelect as aI, PostCategoriesSelect as aJ, PostTagsSelect as aK, PostImagesSelect as aL, AuthorsSelect as aM, DocumentsSelect as aN, DocumentCategoriesSelect as aO, DocumentImagesSelect as aP, PlaylistsSelect as aQ, PlaylistImagesSelect as aR, MusicsSelect as aS, GalleriesSelect as aT, GalleryImagesSelect as aU, FormsSelect as aV, FormSubmissionsSelect as aW, PayloadKvSelect as aX, PayloadLockedDocumentsSelect as aY, PayloadPreferencesSelect as aZ, PayloadMigrationsSelect as a_, AudiencesSelect as aa, EmailLogsSelect as ab, TenantsSelect as ac, TenantMetadataSelect as ad, TenantLogosSelect as ae, TenantOgImagesSelect as af, ApiUsageSelect as ag, SubscriptionsSelect as ah, BillingHistorySelect as ai, ProductsSelect as aj, ProductVariantsSelect as ak, ProductOptionsSelect as al, ProductCategoriesSelect as am, ProductTagsSelect as an, ProductImagesSelect as ao, BrandsSelect as ap, BrandLogosSelect as aq, OrdersSelect as ar, OrderProductsSelect as as, ReturnsSelect as at, ReturnProductsSelect as au, ExchangesSelect as av, ExchangeProductsSelect as aw, FulfillmentsSelect as ax, FulfillmentItemsSelect as ay, TransactionsSelect as az, Config as b, CustomerAuthOperations as c, PlayerBlock as d, CodeBlock as e, User as f, Tenant as g, TenantMetadatum as h, TenantOgImage as i, TenantLogo as j, ApiUsage as k, Subscription as l, BillingHistory as m, Product as n, ProductImage as o, ProductVariant as p, ProductCategory as q, ProductTag as r, Brand as s, ShippingPolicy as t, Customer as u, CustomerGroup as v, CustomerGroupImage as w, CustomerAddress as x, ReturnProduct as y, Exchange as z };
@@ -1,4 +1,4 @@
1
- import { b as Config } from './payload-types-9ZTBbiqb.cjs';
1
+ import { b as Config } from './payload-types-DcOQUD4x.cjs';
2
2
 
3
3
  /**
4
4
  * Collection type derived from Payload Config.
@@ -1,4 +1,4 @@
1
- import { b as Config } from './payload-types-9ZTBbiqb.js';
1
+ import { b as Config } from './payload-types-DcOQUD4x.js';
2
2
 
3
3
  /**
4
4
  * Collection type derived from Payload Config.
package/dist/webhook.cjs CHANGED
@@ -76,11 +76,6 @@ function handleWebhook(request, handler, options) {
76
76
  return __async(this, null, function* () {
77
77
  try {
78
78
  const rawBody = yield request.text();
79
- if (!(options == null ? void 0 : options.secret)) {
80
- console.warn(
81
- "[@01.software/sdk] Webhook signature verification is skipped because no secret was provided. Pass { secret } to handleWebhook() to enable signature verification."
82
- );
83
- }
84
79
  if (options == null ? void 0 : options.secret) {
85
80
  const signature = request.headers.get("x-webhook-signature") || "";
86
81
  const valid = yield verifySignature(rawBody, options.secret, signature);
@@ -90,6 +85,10 @@ function handleWebhook(request, handler, options) {
90
85
  { status: 401, headers: { "Content-Type": "application/json" } }
91
86
  );
92
87
  }
88
+ } else {
89
+ console.warn(
90
+ "[@01.software/sdk] Webhook signature verification is disabled. Set { secret } in handleWebhook() options to enable HMAC-SHA256 verification."
91
+ );
93
92
  }
94
93
  const body = JSON.parse(rawBody);
95
94
  if (!isValidWebhookEvent(body)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/webhook.ts","../src/core/webhook/index.tsx"],"sourcesContent":["export {\n handleWebhook,\n createTypedWebhookHandler,\n isValidWebhookEvent,\n} from './core/webhook'\nexport type {\n WebhookEvent,\n WebhookHandler,\n WebhookOperation,\n WebhookOptions,\n} from './core/webhook'\n","import type { Collection } from '../client/types'\nimport type { CollectionType } from '../collection/types'\n\nexport type WebhookOperation = 'create' | 'update'\n\nexport interface WebhookEvent<T extends Collection = Collection> {\n collection: T\n operation: WebhookOperation\n data: CollectionType<T>\n}\n\nexport type WebhookHandler<T extends Collection = Collection> = (\n event: WebhookEvent<T>,\n) => Promise<void> | void\n\nexport interface WebhookOptions {\n secret?: string\n}\n\nexport function isValidWebhookEvent(data: unknown): data is WebhookEvent {\n if (typeof data !== 'object' || data === null) return false\n const obj = data as Record<string, unknown>\n return (\n typeof obj.collection === 'string' &&\n (obj.operation === 'create' || obj.operation === 'update') &&\n typeof obj.data === 'object' &&\n obj.data !== null\n )\n}\n\nasync function verifySignature(\n payload: string,\n secret: string,\n signature: string,\n): Promise<boolean> {\n const encoder = new TextEncoder()\n const key = await crypto.subtle.importKey(\n 'raw',\n encoder.encode(secret),\n { name: 'HMAC', hash: 'SHA-256' },\n false,\n ['sign'],\n )\n const sig = await crypto.subtle.sign('HMAC', key, encoder.encode(payload))\n const expected = Array.from(new Uint8Array(sig))\n .map((b) => b.toString(16).padStart(2, '0'))\n .join('')\n // Constant-time comparison to prevent timing attacks\n let result = expected.length !== signature.length ? 1 : 0\n const len = Math.max(expected.length, signature.length)\n for (let i = 0; i < len; i++) {\n result |= (expected.charCodeAt(i) || 0) ^ (signature.charCodeAt(i) || 0)\n }\n return result === 0\n}\n\nexport async function handleWebhook<T extends Collection = Collection>(\n request: Request,\n handler: WebhookHandler<T>,\n options?: WebhookOptions,\n): Promise<Response> {\n try {\n const rawBody = await request.text()\n\n if (!options?.secret) {\n console.warn(\n '[@01.software/sdk] Webhook signature verification is skipped because no secret was provided. ' +\n 'Pass { secret } to handleWebhook() to enable signature verification.',\n )\n }\n\n if (options?.secret) {\n const signature = request.headers.get('x-webhook-signature') || ''\n const valid = await verifySignature(rawBody, options.secret, signature)\n if (!valid) {\n return new Response(\n JSON.stringify({ error: 'Invalid webhook signature' }),\n { status: 401, headers: { 'Content-Type': 'application/json' } },\n )\n }\n }\n\n const body = JSON.parse(rawBody)\n\n if (!isValidWebhookEvent(body)) {\n return new Response(\n JSON.stringify({ error: 'Invalid webhook event format' }),\n { status: 400, headers: { 'Content-Type': 'application/json' } },\n )\n }\n\n await handler(body as WebhookEvent<T>)\n\n return new Response(\n JSON.stringify({ success: true, message: 'Webhook processed' }),\n { status: 200, headers: { 'Content-Type': 'application/json' } },\n )\n } catch (error) {\n console.error('Webhook processing error:', error)\n\n return new Response(\n JSON.stringify({ error: 'Internal server error' }),\n { status: 500, headers: { 'Content-Type': 'application/json' } },\n )\n }\n}\n\nexport function createTypedWebhookHandler<T extends Collection>(\n collection: T,\n handler: (event: WebhookEvent<T>) => Promise<void> | void,\n): WebhookHandler<T> {\n return async (event: WebhookEvent<T>) => {\n if (event.collection !== collection) {\n throw new Error(`Expected collection \"${collection}\", got \"${event.collection}\"`)\n }\n return handler(event)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBO,SAAS,oBAAoB,MAAqC;AACvE,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,MAAM;AACZ,SACE,OAAO,IAAI,eAAe,aACzB,IAAI,cAAc,YAAY,IAAI,cAAc,aACjD,OAAO,IAAI,SAAS,YACpB,IAAI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AAA,MACF;AAEA,YAAM,OAAO,KAAK,MAAM,OAAO;AAE/B,UAAI,CAAC,oBAAoB,IAAI,GAAG;AAC9B,eAAO,IAAI;AAAA,UACT,KAAK,UAAU,EAAE,OAAO,+BAA+B,CAAC;AAAA,UACxD,EAAE,QAAQ,KAAK,SAAS,EAAE,gBAAgB,mBAAmB,EAAE;AAAA,QACjE;AAAA,MACF;AAEA,YAAM,QAAQ,IAAuB;AAErC,aAAO,IAAI;AAAA,QACT,KAAK,UAAU,EAAE,SAAS,MAAM,SAAS,oBAAoB,CAAC;AAAA,QAC9D,EAAE,QAAQ,KAAK,SAAS,EAAE,gBAAgB,mBAAmB,EAAE;AAAA,MACjE;AAAA,IACF,SAAS,OAAO;AACd,cAAQ,MAAM,6BAA6B,KAAK;AAEhD,aAAO,IAAI;AAAA,QACT,KAAK,UAAU,EAAE,OAAO,wBAAwB,CAAC;AAAA,QACjD,EAAE,QAAQ,KAAK,SAAS,EAAE,gBAAgB,mBAAmB,EAAE;AAAA,MACjE;AAAA,IACF;AAAA,EACF;AAAA;AAEO,SAAS,0BACd,YACA,SACmB;AACnB,SAAO,CAAO,UAA2B;AACvC,QAAI,MAAM,eAAe,YAAY;AACnC,YAAM,IAAI,MAAM,wBAAwB,UAAU,WAAW,MAAM,UAAU,GAAG;AAAA,IAClF;AACA,WAAO,QAAQ,KAAK;AAAA,EACtB;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/webhook.ts","../src/core/webhook/index.tsx"],"sourcesContent":["export {\n handleWebhook,\n createTypedWebhookHandler,\n isValidWebhookEvent,\n} from './core/webhook'\nexport type {\n WebhookEvent,\n WebhookHandler,\n WebhookOperation,\n WebhookOptions,\n} from './core/webhook'\n","import type { Collection } from '../client/types'\nimport type { CollectionType } from '../collection/types'\n\nexport type WebhookOperation = 'create' | 'update'\n\nexport interface WebhookEvent<T extends Collection = Collection> {\n collection: T\n operation: WebhookOperation\n data: CollectionType<T>\n}\n\nexport type WebhookHandler<T extends Collection = Collection> = (\n event: WebhookEvent<T>,\n) => Promise<void> | void\n\nexport interface WebhookOptions {\n secret?: string\n}\n\nexport function isValidWebhookEvent(data: unknown): data is WebhookEvent {\n if (typeof data !== 'object' || data === null) return false\n const obj = data as Record<string, unknown>\n return (\n typeof obj.collection === 'string' &&\n (obj.operation === 'create' || obj.operation === 'update') &&\n typeof obj.data === 'object' &&\n obj.data !== null\n )\n}\n\nasync function verifySignature(\n payload: string,\n secret: string,\n signature: string,\n): Promise<boolean> {\n const encoder = new TextEncoder()\n const key = await crypto.subtle.importKey(\n 'raw',\n encoder.encode(secret),\n { name: 'HMAC', hash: 'SHA-256' },\n false,\n ['sign'],\n )\n const sig = await crypto.subtle.sign('HMAC', key, encoder.encode(payload))\n const expected = Array.from(new Uint8Array(sig))\n .map((b) => b.toString(16).padStart(2, '0'))\n .join('')\n // Constant-time comparison to prevent timing attacks\n let result = expected.length !== signature.length ? 1 : 0\n const len = Math.max(expected.length, signature.length)\n for (let i = 0; i < len; i++) {\n result |= (expected.charCodeAt(i) || 0) ^ (signature.charCodeAt(i) || 0)\n }\n return result === 0\n}\n\nexport async function handleWebhook<T extends Collection = Collection>(\n request: Request,\n handler: WebhookHandler<T>,\n options?: WebhookOptions,\n): Promise<Response> {\n try {\n const rawBody = await request.text()\n\n if (options?.secret) {\n const signature = request.headers.get('x-webhook-signature') || ''\n const valid = await verifySignature(rawBody, options.secret, signature)\n if (!valid) {\n return new Response(\n JSON.stringify({ error: 'Invalid webhook signature' }),\n { status: 401, headers: { 'Content-Type': 'application/json' } },\n )\n }\n } else {\n console.warn(\n '[@01.software/sdk] Webhook signature verification is disabled. ' +\n 'Set { secret } in handleWebhook() options to enable HMAC-SHA256 verification.',\n )\n }\n\n const body = JSON.parse(rawBody)\n\n if (!isValidWebhookEvent(body)) {\n return new Response(\n JSON.stringify({ error: 'Invalid webhook event format' }),\n { status: 400, headers: { 'Content-Type': 'application/json' } },\n )\n }\n\n await handler(body as WebhookEvent<T>)\n\n return new Response(\n JSON.stringify({ success: true, message: 'Webhook processed' }),\n { status: 200, headers: { 'Content-Type': 'application/json' } },\n )\n } catch (error) {\n console.error('Webhook processing error:', error)\n\n return new Response(\n JSON.stringify({ error: 'Internal server error' }),\n { status: 500, headers: { 'Content-Type': 'application/json' } },\n )\n }\n}\n\nexport function createTypedWebhookHandler<T extends Collection>(\n collection: T,\n handler: (event: WebhookEvent<T>) => Promise<void> | void,\n): WebhookHandler<T> {\n return async (event: WebhookEvent<T>) => {\n if (event.collection !== collection) {\n throw new Error(`Expected collection \"${collection}\", got \"${event.collection}\"`)\n }\n return handler(event)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBO,SAAS,oBAAoB,MAAqC;AACvE,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,MAAM;AACZ,SACE,OAAO,IAAI,eAAe,aACzB,IAAI,cAAc,YAAY,IAAI,cAAc,aACjD,OAAO,IAAI,SAAS,YACpB,IAAI,SAAS;AAEjB;AAEA,SAAe,gBACb,SACA,QACA,WACkB;AAAA;AAClB,UAAM,UAAU,IAAI,YAAY;AAChC,UAAM,MAAM,MAAM,OAAO,OAAO;AAAA,MAC9B;AAAA,MACA,QAAQ,OAAO,MAAM;AAAA,MACrB,EAAE,MAAM,QAAQ,MAAM,UAAU;AAAA,MAChC;AAAA,MACA,CAAC,MAAM;AAAA,IACT;AACA,UAAM,MAAM,MAAM,OAAO,OAAO,KAAK,QAAQ,KAAK,QAAQ,OAAO,OAAO,CAAC;AACzE,UAAM,WAAW,MAAM,KAAK,IAAI,WAAW,GAAG,CAAC,EAC5C,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,EAC1C,KAAK,EAAE;AAEV,QAAI,SAAS,SAAS,WAAW,UAAU,SAAS,IAAI;AACxD,UAAM,MAAM,KAAK,IAAI,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AAS,EAAE,gBAAgB,mBAAmB,EAAE;AAAA,MACjE;AAAA,IACF;AAAA,EACF;AAAA;AAEO,SAAS,0BACd,YACA,SACmB;AACnB,SAAO,CAAO,UAA2B;AACvC,QAAI,MAAM,eAAe,YAAY;AACnC,YAAM,IAAI,MAAM,wBAAwB,UAAU,WAAW,MAAM,UAAU,GAAG;AAAA,IAClF;AACA,WAAO,QAAQ,KAAK;AAAA,EACtB;AACF;","names":[]}
@@ -1,2 +1,2 @@
1
- export { c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-Cdv7bup2.cjs';
2
- import './payload-types-9ZTBbiqb.cjs';
1
+ export { c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-E1YlE_k1.cjs';
2
+ import './payload-types-DcOQUD4x.cjs';
package/dist/webhook.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-c_A4J8UH.js';
2
- import './payload-types-9ZTBbiqb.js';
1
+ export { c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-xdgxEN8s.js';
2
+ import './payload-types-DcOQUD4x.js';