ce-storefront 0.20.1 → 0.21.0
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/README.md +28 -3
- package/esm/funcs/marketplaceGetProductDetail.d.ts +20 -0
- package/esm/funcs/marketplaceGetProductDetail.d.ts.map +1 -0
- package/esm/funcs/marketplaceGetProductDetail.js +91 -0
- package/esm/funcs/marketplaceGetProductDetail.js.map +1 -0
- package/esm/funcs/marketplaceGetVariantDetail.d.ts +20 -0
- package/esm/funcs/marketplaceGetVariantDetail.d.ts.map +1 -0
- package/esm/funcs/marketplaceGetVariantDetail.js +98 -0
- package/esm/funcs/marketplaceGetVariantDetail.js.map +1 -0
- package/esm/funcs/marketplaceListCategories.d.ts +20 -0
- package/esm/funcs/marketplaceListCategories.d.ts.map +1 -0
- package/esm/funcs/marketplaceListCategories.js +91 -0
- package/esm/funcs/marketplaceListCategories.js.map +1 -0
- package/esm/funcs/marketplaceListCrosssellProducts.d.ts +20 -0
- package/esm/funcs/marketplaceListCrosssellProducts.d.ts.map +1 -0
- package/esm/funcs/marketplaceListCrosssellProducts.js +91 -0
- package/esm/funcs/marketplaceListCrosssellProducts.js.map +1 -0
- package/esm/funcs/marketplaceListProductReviews.d.ts +20 -0
- package/esm/funcs/marketplaceListProductReviews.d.ts.map +1 -0
- package/esm/funcs/marketplaceListProductReviews.js +97 -0
- package/esm/funcs/marketplaceListProductReviews.js.map +1 -0
- package/esm/funcs/marketplaceListProductVariants.d.ts +20 -0
- package/esm/funcs/marketplaceListProductVariants.d.ts.map +1 -0
- package/esm/funcs/marketplaceListProductVariants.js +94 -0
- package/esm/funcs/marketplaceListProductVariants.js.map +1 -0
- package/esm/funcs/marketplaceListProducts.d.ts +20 -0
- package/esm/funcs/marketplaceListProducts.d.ts.map +1 -0
- package/esm/funcs/marketplaceListProducts.js +93 -0
- package/esm/funcs/marketplaceListProducts.js.map +1 -0
- package/esm/funcs/marketplaceListSimilarProducts.d.ts +20 -0
- package/esm/funcs/marketplaceListSimilarProducts.d.ts.map +1 -0
- package/esm/funcs/marketplaceListSimilarProducts.js +91 -0
- package/esm/funcs/marketplaceListSimilarProducts.js.map +1 -0
- package/esm/funcs/marketplaceListSkus.d.ts +20 -0
- package/esm/funcs/marketplaceListSkus.d.ts.map +1 -0
- package/esm/funcs/marketplaceListSkus.js +93 -0
- package/esm/funcs/marketplaceListSkus.js.map +1 -0
- package/esm/funcs/marketplaceListUpsellProducts.d.ts +20 -0
- package/esm/funcs/marketplaceListUpsellProducts.d.ts.map +1 -0
- package/esm/funcs/marketplaceListUpsellProducts.js +91 -0
- package/esm/funcs/marketplaceListUpsellProducts.js.map +1 -0
- package/esm/funcs/marketplaceSearchProducts.d.ts +20 -0
- package/esm/funcs/marketplaceSearchProducts.d.ts.map +1 -0
- package/esm/funcs/marketplaceSearchProducts.js +85 -0
- package/esm/funcs/marketplaceSearchProducts.js.map +1 -0
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/lib/encodings.d.ts +1 -0
- package/esm/lib/encodings.d.ts.map +1 -1
- package/esm/lib/encodings.js +12 -1
- package/esm/lib/encodings.js.map +1 -1
- package/esm/models/components/booleanattribute.d.ts +1 -1
- package/esm/models/components/booleanattribute.d.ts.map +1 -1
- package/esm/models/components/booleanattribute.js +1 -1
- package/esm/models/components/booleanattribute.js.map +1 -1
- package/esm/models/components/collectinstorefulfillment.d.ts +1 -1
- package/esm/models/components/collectinstorefulfillment.d.ts.map +1 -1
- package/esm/models/components/collectinstorefulfillment.js +1 -2
- package/esm/models/components/collectinstorefulfillment.js.map +1 -1
- package/esm/models/components/collectinstorefulfillmentinput.d.ts +1 -1
- package/esm/models/components/collectinstorefulfillmentinput.d.ts.map +1 -1
- package/esm/models/components/colorattribute.d.ts +1 -1
- package/esm/models/components/colorattribute.d.ts.map +1 -1
- package/esm/models/components/colorattribute.js +1 -1
- package/esm/models/components/colorattribute.js.map +1 -1
- package/esm/models/components/coloroption.d.ts +1 -1
- package/esm/models/components/coloroption.d.ts.map +1 -1
- package/esm/models/components/coloroption.js +1 -1
- package/esm/models/components/coloroption.js.map +1 -1
- package/esm/models/components/customeraddress.d.ts +1 -1
- package/esm/models/components/customeraddress.d.ts.map +1 -1
- package/esm/models/components/customeraddress.js +1 -1
- package/esm/models/components/customeraddress.js.map +1 -1
- package/esm/models/components/customeraddressinput.d.ts +1 -1
- package/esm/models/components/customeraddressinput.d.ts.map +1 -1
- package/esm/models/components/dateattribute.d.ts +1 -1
- package/esm/models/components/dateattribute.js +1 -1
- package/esm/models/components/dateattribute.js.map +1 -1
- package/esm/models/components/deliveryfulfillment.d.ts +1 -1
- package/esm/models/components/deliveryfulfillment.d.ts.map +1 -1
- package/esm/models/components/deliveryfulfillment.js +1 -1
- package/esm/models/components/deliveryfulfillment.js.map +1 -1
- package/esm/models/components/deliveryfulfillmentinput.d.ts +1 -1
- package/esm/models/components/deliveryfulfillmentinput.d.ts.map +1 -1
- package/esm/models/components/discountbasedpromotion.d.ts +1 -10
- package/esm/models/components/discountbasedpromotion.d.ts.map +1 -1
- package/esm/models/components/discountbasedpromotion.js +1 -9
- package/esm/models/components/discountbasedpromotion.js.map +1 -1
- package/esm/models/components/fixedpricepromotion.d.ts +1 -11
- package/esm/models/components/fixedpricepromotion.d.ts.map +1 -1
- package/esm/models/components/fixedpricepromotion.js +1 -9
- package/esm/models/components/fixedpricepromotion.js.map +1 -1
- package/esm/models/components/freegoodspromotion.d.ts +1 -11
- package/esm/models/components/freegoodspromotion.d.ts.map +1 -1
- package/esm/models/components/freegoodspromotion.js +1 -9
- package/esm/models/components/freegoodspromotion.js.map +1 -1
- package/esm/models/components/fulfillmentpreference.d.ts +1 -7
- package/esm/models/components/fulfillmentpreference.d.ts.map +1 -1
- package/esm/models/components/fulfillmentpreference.js +3 -6
- package/esm/models/components/fulfillmentpreference.js.map +1 -1
- package/esm/models/components/fulfillmentpreferenceinput.d.ts +2 -14
- package/esm/models/components/fulfillmentpreferenceinput.d.ts.map +1 -1
- package/esm/models/components/fulfillmentpreferenceinput.js +3 -6
- package/esm/models/components/fulfillmentpreferenceinput.js.map +1 -1
- package/esm/models/components/generateotpwithemail.d.ts +1 -1
- package/esm/models/components/generateotpwithemail.d.ts.map +1 -1
- package/esm/models/components/juspayhypercheckout.d.ts +1 -1
- package/esm/models/components/juspayhypercheckout.d.ts.map +1 -1
- package/esm/models/components/juspayhypercheckoutresponse.d.ts.map +1 -1
- package/esm/models/components/juspayhypercheckoutresponse.js +2 -3
- package/esm/models/components/juspayhypercheckoutresponse.js.map +1 -1
- package/esm/models/components/juspaynetbanking.d.ts +2 -2
- package/esm/models/components/juspaynetbanking.d.ts.map +1 -1
- package/esm/models/components/juspaynewcard.d.ts +3 -3
- package/esm/models/components/juspaynewcard.d.ts.map +1 -1
- package/esm/models/components/juspaysavedcardtoken.d.ts +3 -3
- package/esm/models/components/juspaysavedcardtoken.d.ts.map +1 -1
- package/esm/models/components/juspayupicollect.d.ts +3 -3
- package/esm/models/components/juspayupicollect.d.ts.map +1 -1
- package/esm/models/components/juspayupiintent.d.ts +3 -3
- package/esm/models/components/juspayupiintent.d.ts.map +1 -1
- package/esm/models/components/multiselectattribute.d.ts +1 -1
- package/esm/models/components/multiselectattribute.d.ts.map +1 -1
- package/esm/models/components/multiselectattribute.js +1 -1
- package/esm/models/components/multiselectattribute.js.map +1 -1
- package/esm/models/components/numberattribute.d.ts +1 -1
- package/esm/models/components/numberattribute.d.ts.map +1 -1
- package/esm/models/components/numberattribute.js +1 -1
- package/esm/models/components/numberattribute.js.map +1 -1
- package/esm/models/components/partialcollectanddelivery.d.ts +1 -1
- package/esm/models/components/partialcollectanddelivery.d.ts.map +1 -1
- package/esm/models/components/partialcollectanddelivery.js +1 -1
- package/esm/models/components/partialcollectanddelivery.js.map +1 -1
- package/esm/models/components/partialcollectanddeliveryinput.d.ts +1 -1
- package/esm/models/components/partialcollectanddeliveryinput.d.ts.map +1 -1
- package/esm/models/components/payupaymentinfo.js +3 -3
- package/esm/models/components/payupaymentinfo.js.map +1 -1
- package/esm/models/components/productattribute.d.ts +1 -15
- package/esm/models/components/productattribute.d.ts.map +1 -1
- package/esm/models/components/productattribute.js +7 -15
- package/esm/models/components/productattribute.js.map +1 -1
- package/esm/models/components/productpromotion.d.ts +2 -18
- package/esm/models/components/productpromotion.d.ts.map +1 -1
- package/esm/models/components/productpromotion.js +8 -20
- package/esm/models/components/productpromotion.js.map +1 -1
- package/esm/models/components/singleselectattribute.d.ts +1 -1
- package/esm/models/components/singleselectattribute.d.ts.map +1 -1
- package/esm/models/components/singleselectattribute.js +1 -1
- package/esm/models/components/singleselectattribute.js.map +1 -1
- package/esm/models/components/singleselectoption.d.ts +1 -1
- package/esm/models/components/singleselectoption.d.ts.map +1 -1
- package/esm/models/components/singleselectoption.js +1 -1
- package/esm/models/components/singleselectoption.js.map +1 -1
- package/esm/models/components/textattribute.d.ts +1 -1
- package/esm/models/components/textattribute.js +1 -1
- package/esm/models/components/textattribute.js.map +1 -1
- package/esm/models/components/volumebasedpromotion.d.ts +1 -11
- package/esm/models/components/volumebasedpromotion.d.ts.map +1 -1
- package/esm/models/components/volumebasedpromotion.js +1 -9
- package/esm/models/components/volumebasedpromotion.js.map +1 -1
- package/esm/models/operations/createaddress.d.ts +1 -1
- package/esm/models/operations/createaddress.d.ts.map +1 -1
- package/esm/models/operations/generateotp.d.ts +20 -4
- package/esm/models/operations/generateotp.d.ts.map +1 -1
- package/esm/models/operations/generateotp.js +4 -2
- package/esm/models/operations/generateotp.js.map +1 -1
- package/esm/models/operations/getaddressdetail.d.ts +1 -1
- package/esm/models/operations/getaddressdetail.d.ts.map +1 -1
- package/esm/models/operations/getaddressdetail.js +1 -1
- package/esm/models/operations/getaddressdetail.js.map +1 -1
- package/esm/models/operations/getmarketplaceproductdetail.d.ts +45 -0
- package/esm/models/operations/getmarketplaceproductdetail.d.ts.map +1 -0
- package/esm/models/operations/getmarketplaceproductdetail.js +38 -0
- package/esm/models/operations/getmarketplaceproductdetail.js.map +1 -0
- package/esm/models/operations/getmarketplacevariantdetail.d.ts +50 -0
- package/esm/models/operations/getmarketplacevariantdetail.d.ts.map +1 -0
- package/esm/models/operations/getmarketplacevariantdetail.js +40 -0
- package/esm/models/operations/getmarketplacevariantdetail.js.map +1 -0
- package/esm/models/operations/index.d.ts +11 -0
- package/esm/models/operations/index.d.ts.map +1 -1
- package/esm/models/operations/index.js +11 -0
- package/esm/models/operations/index.js.map +1 -1
- package/esm/models/operations/listaddresses.d.ts +1 -1
- package/esm/models/operations/listaddresses.d.ts.map +1 -1
- package/esm/models/operations/listaddresses.js +1 -1
- package/esm/models/operations/listaddresses.js.map +1 -1
- package/esm/models/operations/listmarketplacecategories.d.ts +59 -0
- package/esm/models/operations/listmarketplacecategories.d.ts.map +1 -0
- package/esm/models/operations/listmarketplacecategories.js +43 -0
- package/esm/models/operations/listmarketplacecategories.js.map +1 -0
- package/esm/models/operations/listmarketplacecrosssellproducts.d.ts +59 -0
- package/esm/models/operations/listmarketplacecrosssellproducts.d.ts.map +1 -0
- package/esm/models/operations/listmarketplacecrosssellproducts.js +42 -0
- package/esm/models/operations/listmarketplacecrosssellproducts.js.map +1 -0
- package/esm/models/operations/listmarketplaceproductreviews.d.ts +65 -0
- package/esm/models/operations/listmarketplaceproductreviews.d.ts.map +1 -0
- package/esm/models/operations/listmarketplaceproductreviews.js +48 -0
- package/esm/models/operations/listmarketplaceproductreviews.js.map +1 -0
- package/esm/models/operations/listmarketplaceproducts.d.ts +69 -0
- package/esm/models/operations/listmarketplaceproducts.d.ts.map +1 -0
- package/esm/models/operations/listmarketplaceproducts.js +45 -0
- package/esm/models/operations/listmarketplaceproducts.js.map +1 -0
- package/esm/models/operations/listmarketplaceproductvariants.d.ts +45 -0
- package/esm/models/operations/listmarketplaceproductvariants.d.ts.map +1 -0
- package/esm/models/operations/listmarketplaceproductvariants.js +38 -0
- package/esm/models/operations/listmarketplaceproductvariants.js.map +1 -0
- package/esm/models/operations/listmarketplacesimilarproducts.d.ts +59 -0
- package/esm/models/operations/listmarketplacesimilarproducts.d.ts.map +1 -0
- package/esm/models/operations/listmarketplacesimilarproducts.js +42 -0
- package/esm/models/operations/listmarketplacesimilarproducts.js.map +1 -0
- package/esm/models/operations/listmarketplaceskus.d.ts +69 -0
- package/esm/models/operations/listmarketplaceskus.d.ts.map +1 -0
- package/esm/models/operations/listmarketplaceskus.js +44 -0
- package/esm/models/operations/listmarketplaceskus.js.map +1 -0
- package/esm/models/operations/listmarketplaceupsellproducts.d.ts +62 -0
- package/esm/models/operations/listmarketplaceupsellproducts.d.ts.map +1 -0
- package/esm/models/operations/listmarketplaceupsellproducts.js +42 -0
- package/esm/models/operations/listmarketplaceupsellproducts.js.map +1 -0
- package/esm/models/operations/loginwithwhatsapp.d.ts +1 -1
- package/esm/models/operations/loginwithwhatsapp.d.ts.map +1 -1
- package/esm/models/operations/loginwithwhatsapp.js +1 -1
- package/esm/models/operations/loginwithwhatsapp.js.map +1 -1
- package/esm/models/operations/searchmarketplaceproducts.d.ts +56 -0
- package/esm/models/operations/searchmarketplaceproducts.d.ts.map +1 -0
- package/esm/models/operations/searchmarketplaceproducts.js +53 -0
- package/esm/models/operations/searchmarketplaceproducts.js.map +1 -0
- package/esm/models/operations/searchproducts.d.ts +4 -4
- package/esm/models/operations/searchproducts.d.ts.map +1 -1
- package/esm/models/operations/searchproducts.js +4 -4
- package/esm/models/operations/searchproducts.js.map +1 -1
- package/esm/models/operations/updateaddressdetail.d.ts +1 -1
- package/esm/models/operations/updateaddressdetail.d.ts.map +1 -1
- package/esm/sdk/marketplace.d.ts +104 -0
- package/esm/sdk/marketplace.d.ts.map +1 -0
- package/esm/sdk/marketplace.js +140 -0
- package/esm/sdk/marketplace.js.map +1 -0
- package/esm/sdk/sdk.d.ts +3 -0
- package/esm/sdk/sdk.d.ts.map +1 -1
- package/esm/sdk/sdk.js +4 -0
- package/esm/sdk/sdk.js.map +1 -1
- package/esm/types/enums.d.ts +8 -11
- package/esm/types/enums.d.ts.map +1 -1
- package/esm/types/enums.js +22 -2
- package/esm/types/enums.js.map +1 -1
- package/esm/types/index.d.ts +2 -2
- package/esm/types/index.d.ts.map +1 -1
- package/esm/types/index.js +1 -1
- package/esm/types/index.js.map +1 -1
- package/esm/types/unrecognized.d.ts +16 -0
- package/esm/types/unrecognized.d.ts.map +1 -0
- package/esm/types/unrecognized.js +31 -0
- package/esm/types/unrecognized.js.map +1 -0
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/marketplaceGetProductDetail.ts +198 -0
- package/src/funcs/marketplaceGetVariantDetail.ts +201 -0
- package/src/funcs/marketplaceListCategories.ts +188 -0
- package/src/funcs/marketplaceListCrosssellProducts.ts +193 -0
- package/src/funcs/marketplaceListProductReviews.ts +198 -0
- package/src/funcs/marketplaceListProductVariants.ts +199 -0
- package/src/funcs/marketplaceListProducts.ts +190 -0
- package/src/funcs/marketplaceListSimilarProducts.ts +193 -0
- package/src/funcs/marketplaceListSkus.ts +190 -0
- package/src/funcs/marketplaceListUpsellProducts.ts +193 -0
- package/src/funcs/marketplaceSearchProducts.ts +177 -0
- package/src/lib/config.ts +3 -3
- package/src/lib/encodings.ts +17 -3
- package/src/models/components/booleanattribute.ts +2 -2
- package/src/models/components/collectinstorefulfillment.ts +2 -3
- package/src/models/components/collectinstorefulfillmentinput.ts +1 -1
- package/src/models/components/colorattribute.ts +2 -2
- package/src/models/components/coloroption.ts +2 -2
- package/src/models/components/customeraddress.ts +2 -2
- package/src/models/components/customeraddressinput.ts +1 -1
- package/src/models/components/dateattribute.ts +2 -2
- package/src/models/components/deliveryfulfillment.ts +2 -2
- package/src/models/components/deliveryfulfillmentinput.ts +1 -1
- package/src/models/components/discountbasedpromotion.ts +2 -17
- package/src/models/components/fixedpricepromotion.ts +2 -18
- package/src/models/components/freegoodspromotion.ts +2 -18
- package/src/models/components/fulfillmentpreference.ts +6 -19
- package/src/models/components/fulfillmentpreferenceinput.ts +9 -26
- package/src/models/components/generateotpwithemail.ts +1 -1
- package/src/models/components/juspayhypercheckout.ts +1 -1
- package/src/models/components/juspayhypercheckoutresponse.ts +2 -3
- package/src/models/components/juspaynetbanking.ts +2 -2
- package/src/models/components/juspaynewcard.ts +3 -3
- package/src/models/components/juspaysavedcardtoken.ts +3 -3
- package/src/models/components/juspayupicollect.ts +3 -3
- package/src/models/components/juspayupiintent.ts +3 -3
- package/src/models/components/multiselectattribute.ts +2 -2
- package/src/models/components/numberattribute.ts +2 -2
- package/src/models/components/partialcollectanddelivery.ts +2 -4
- package/src/models/components/partialcollectanddeliveryinput.ts +1 -1
- package/src/models/components/payupaymentinfo.ts +3 -3
- package/src/models/components/productattribute.ts +14 -36
- package/src/models/components/productpromotion.ts +16 -48
- package/src/models/components/singleselectattribute.ts +2 -2
- package/src/models/components/singleselectoption.ts +2 -2
- package/src/models/components/textattribute.ts +2 -2
- package/src/models/components/volumebasedpromotion.ts +2 -18
- package/src/models/operations/createaddress.ts +1 -1
- package/src/models/operations/generateotp.ts +20 -6
- package/src/models/operations/getaddressdetail.ts +2 -2
- package/src/models/operations/getmarketplaceproductdetail.ts +118 -0
- package/src/models/operations/getmarketplacevariantdetail.ts +125 -0
- package/src/models/operations/index.ts +11 -0
- package/src/models/operations/listaddresses.ts +2 -2
- package/src/models/operations/listmarketplacecategories.ts +131 -0
- package/src/models/operations/listmarketplacecrosssellproducts.ts +145 -0
- package/src/models/operations/listmarketplaceproductreviews.ts +148 -0
- package/src/models/operations/listmarketplaceproducts.ts +143 -0
- package/src/models/operations/listmarketplaceproductvariants.ts +118 -0
- package/src/models/operations/listmarketplacesimilarproducts.ts +136 -0
- package/src/models/operations/listmarketplaceskus.ts +139 -0
- package/src/models/operations/listmarketplaceupsellproducts.ts +139 -0
- package/src/models/operations/loginwithwhatsapp.ts +2 -2
- package/src/models/operations/searchmarketplaceproducts.ts +142 -0
- package/src/models/operations/searchproducts.ts +9 -9
- package/src/models/operations/updateaddressdetail.ts +1 -1
- package/src/sdk/marketplace.ts +229 -0
- package/src/sdk/sdk.ts +6 -0
- package/src/types/enums.ts +38 -9
- package/src/types/index.ts +2 -2
- package/src/types/unrecognized.ts +35 -0
- package/tsconfig.json +1 -2
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import * as components from "../components/index.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
export type SearchMarketplaceProductsRequest = {
|
|
13
|
+
/**
|
|
14
|
+
* This param is used to determine product pricing, promotions, and subscription rates. If a valid customer group id is provided, pricing details will be retrieved accordingly. If no matching data is found for the specified customer group id, the system will fall back to the default customer group id. If no data is found for the default group either, the highest applicable price will be returned.
|
|
15
|
+
*/
|
|
16
|
+
xCustomerGroupId?: string | undefined;
|
|
17
|
+
searchProduct: components.SearchProduct;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type FacetStats = {
|
|
21
|
+
min: number;
|
|
22
|
+
max: number;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type SearchMarketplaceProductsContent = {
|
|
26
|
+
skus: Array<components.Item>;
|
|
27
|
+
facetDistribution: { [k: string]: { [k: string]: number } };
|
|
28
|
+
facetStats: { [k: string]: FacetStats };
|
|
29
|
+
/**
|
|
30
|
+
* pagination metadata structure
|
|
31
|
+
*/
|
|
32
|
+
pagination: components.Pagination;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Success response
|
|
37
|
+
*/
|
|
38
|
+
export type SearchMarketplaceProductsResponseBody = {
|
|
39
|
+
message: string;
|
|
40
|
+
success: boolean;
|
|
41
|
+
content: SearchMarketplaceProductsContent;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** @internal */
|
|
45
|
+
export type SearchMarketplaceProductsRequest$Outbound = {
|
|
46
|
+
"x-customer-group-id"?: string | undefined;
|
|
47
|
+
SearchProduct: components.SearchProduct$Outbound;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** @internal */
|
|
51
|
+
export const SearchMarketplaceProductsRequest$outboundSchema: z.ZodType<
|
|
52
|
+
SearchMarketplaceProductsRequest$Outbound,
|
|
53
|
+
z.ZodTypeDef,
|
|
54
|
+
SearchMarketplaceProductsRequest
|
|
55
|
+
> = z.object({
|
|
56
|
+
xCustomerGroupId: z.string().optional(),
|
|
57
|
+
searchProduct: components.SearchProduct$outboundSchema,
|
|
58
|
+
}).transform((v) => {
|
|
59
|
+
return remap$(v, {
|
|
60
|
+
xCustomerGroupId: "x-customer-group-id",
|
|
61
|
+
searchProduct: "SearchProduct",
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export function searchMarketplaceProductsRequestToJSON(
|
|
66
|
+
searchMarketplaceProductsRequest: SearchMarketplaceProductsRequest,
|
|
67
|
+
): string {
|
|
68
|
+
return JSON.stringify(
|
|
69
|
+
SearchMarketplaceProductsRequest$outboundSchema.parse(
|
|
70
|
+
searchMarketplaceProductsRequest,
|
|
71
|
+
),
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** @internal */
|
|
76
|
+
export const FacetStats$inboundSchema: z.ZodType<
|
|
77
|
+
FacetStats,
|
|
78
|
+
z.ZodTypeDef,
|
|
79
|
+
unknown
|
|
80
|
+
> = z.object({
|
|
81
|
+
min: z.number(),
|
|
82
|
+
max: z.number(),
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export function facetStatsFromJSON(
|
|
86
|
+
jsonString: string,
|
|
87
|
+
): SafeParseResult<FacetStats, SDKValidationError> {
|
|
88
|
+
return safeParse(
|
|
89
|
+
jsonString,
|
|
90
|
+
(x) => FacetStats$inboundSchema.parse(JSON.parse(x)),
|
|
91
|
+
`Failed to parse 'FacetStats' from JSON`,
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** @internal */
|
|
96
|
+
export const SearchMarketplaceProductsContent$inboundSchema: z.ZodType<
|
|
97
|
+
SearchMarketplaceProductsContent,
|
|
98
|
+
z.ZodTypeDef,
|
|
99
|
+
unknown
|
|
100
|
+
> = z.object({
|
|
101
|
+
skus: z.array(components.Item$inboundSchema),
|
|
102
|
+
facet_distribution: z.record(z.record(z.number().int())),
|
|
103
|
+
facet_stats: z.record(z.lazy(() => FacetStats$inboundSchema)),
|
|
104
|
+
pagination: components.Pagination$inboundSchema,
|
|
105
|
+
}).transform((v) => {
|
|
106
|
+
return remap$(v, {
|
|
107
|
+
"facet_distribution": "facetDistribution",
|
|
108
|
+
"facet_stats": "facetStats",
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
export function searchMarketplaceProductsContentFromJSON(
|
|
113
|
+
jsonString: string,
|
|
114
|
+
): SafeParseResult<SearchMarketplaceProductsContent, SDKValidationError> {
|
|
115
|
+
return safeParse(
|
|
116
|
+
jsonString,
|
|
117
|
+
(x) => SearchMarketplaceProductsContent$inboundSchema.parse(JSON.parse(x)),
|
|
118
|
+
`Failed to parse 'SearchMarketplaceProductsContent' from JSON`,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** @internal */
|
|
123
|
+
export const SearchMarketplaceProductsResponseBody$inboundSchema: z.ZodType<
|
|
124
|
+
SearchMarketplaceProductsResponseBody,
|
|
125
|
+
z.ZodTypeDef,
|
|
126
|
+
unknown
|
|
127
|
+
> = z.object({
|
|
128
|
+
message: z.string(),
|
|
129
|
+
success: z.boolean(),
|
|
130
|
+
content: z.lazy(() => SearchMarketplaceProductsContent$inboundSchema),
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
export function searchMarketplaceProductsResponseBodyFromJSON(
|
|
134
|
+
jsonString: string,
|
|
135
|
+
): SafeParseResult<SearchMarketplaceProductsResponseBody, SDKValidationError> {
|
|
136
|
+
return safeParse(
|
|
137
|
+
jsonString,
|
|
138
|
+
(x) =>
|
|
139
|
+
SearchMarketplaceProductsResponseBody$inboundSchema.parse(JSON.parse(x)),
|
|
140
|
+
`Failed to parse 'SearchMarketplaceProductsResponseBody' from JSON`,
|
|
141
|
+
);
|
|
142
|
+
}
|
|
@@ -17,7 +17,7 @@ export type SearchProductsRequest = {
|
|
|
17
17
|
searchProduct: components.SearchProduct;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export type
|
|
20
|
+
export type SearchProductsFacetStats = {
|
|
21
21
|
min: number;
|
|
22
22
|
max: number;
|
|
23
23
|
};
|
|
@@ -25,7 +25,7 @@ export type FacetStats = {
|
|
|
25
25
|
export type SearchProductsContent = {
|
|
26
26
|
skus: Array<components.Item>;
|
|
27
27
|
facetDistribution: { [k: string]: { [k: string]: number } };
|
|
28
|
-
facetStats: { [k: string]:
|
|
28
|
+
facetStats: { [k: string]: SearchProductsFacetStats };
|
|
29
29
|
/**
|
|
30
30
|
* pagination metadata structure
|
|
31
31
|
*/
|
|
@@ -71,8 +71,8 @@ export function searchProductsRequestToJSON(
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/** @internal */
|
|
74
|
-
export const
|
|
75
|
-
|
|
74
|
+
export const SearchProductsFacetStats$inboundSchema: z.ZodType<
|
|
75
|
+
SearchProductsFacetStats,
|
|
76
76
|
z.ZodTypeDef,
|
|
77
77
|
unknown
|
|
78
78
|
> = z.object({
|
|
@@ -80,13 +80,13 @@ export const FacetStats$inboundSchema: z.ZodType<
|
|
|
80
80
|
max: z.number(),
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
export function
|
|
83
|
+
export function searchProductsFacetStatsFromJSON(
|
|
84
84
|
jsonString: string,
|
|
85
|
-
): SafeParseResult<
|
|
85
|
+
): SafeParseResult<SearchProductsFacetStats, SDKValidationError> {
|
|
86
86
|
return safeParse(
|
|
87
87
|
jsonString,
|
|
88
|
-
(x) =>
|
|
89
|
-
`Failed to parse '
|
|
88
|
+
(x) => SearchProductsFacetStats$inboundSchema.parse(JSON.parse(x)),
|
|
89
|
+
`Failed to parse 'SearchProductsFacetStats' from JSON`,
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -98,7 +98,7 @@ export const SearchProductsContent$inboundSchema: z.ZodType<
|
|
|
98
98
|
> = z.object({
|
|
99
99
|
skus: z.array(components.Item$inboundSchema),
|
|
100
100
|
facet_distribution: z.record(z.record(z.number().int())),
|
|
101
|
-
facet_stats: z.record(z.lazy(() =>
|
|
101
|
+
facet_stats: z.record(z.lazy(() => SearchProductsFacetStats$inboundSchema)),
|
|
102
102
|
pagination: components.Pagination$inboundSchema,
|
|
103
103
|
}).transform((v) => {
|
|
104
104
|
return remap$(v, {
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { marketplaceGetProductDetail } from "../funcs/marketplaceGetProductDetail.js";
|
|
6
|
+
import { marketplaceGetVariantDetail } from "../funcs/marketplaceGetVariantDetail.js";
|
|
7
|
+
import { marketplaceListCategories } from "../funcs/marketplaceListCategories.js";
|
|
8
|
+
import { marketplaceListCrosssellProducts } from "../funcs/marketplaceListCrosssellProducts.js";
|
|
9
|
+
import { marketplaceListProductReviews } from "../funcs/marketplaceListProductReviews.js";
|
|
10
|
+
import { marketplaceListProducts } from "../funcs/marketplaceListProducts.js";
|
|
11
|
+
import { marketplaceListProductVariants } from "../funcs/marketplaceListProductVariants.js";
|
|
12
|
+
import { marketplaceListSimilarProducts } from "../funcs/marketplaceListSimilarProducts.js";
|
|
13
|
+
import { marketplaceListSkus } from "../funcs/marketplaceListSkus.js";
|
|
14
|
+
import { marketplaceListUpsellProducts } from "../funcs/marketplaceListUpsellProducts.js";
|
|
15
|
+
import { marketplaceSearchProducts } from "../funcs/marketplaceSearchProducts.js";
|
|
16
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
17
|
+
import * as operations from "../models/operations/index.js";
|
|
18
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
19
|
+
|
|
20
|
+
export class Marketplace extends ClientSDK {
|
|
21
|
+
/**
|
|
22
|
+
* List all categories
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* Returns a list of your product categories. The categories are returned sorted by creation date, with the most recently created categories appearing first.
|
|
26
|
+
*
|
|
27
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/operations/list-marketplace-categories} - API reference for the list-marketplace-categories operation
|
|
28
|
+
*/
|
|
29
|
+
async listCategories(
|
|
30
|
+
request: operations.ListMarketplaceCategoriesRequest,
|
|
31
|
+
options?: RequestOptions,
|
|
32
|
+
): Promise<operations.ListMarketplaceCategoriesResponseBody> {
|
|
33
|
+
return unwrapAsync(marketplaceListCategories(
|
|
34
|
+
this,
|
|
35
|
+
request,
|
|
36
|
+
options,
|
|
37
|
+
));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* List all products
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.
|
|
45
|
+
*
|
|
46
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/operations/list-marketplace-products} - API reference for the list-marketplace-products operation
|
|
47
|
+
*/
|
|
48
|
+
async listProducts(
|
|
49
|
+
request: operations.ListMarketplaceProductsRequest,
|
|
50
|
+
options?: RequestOptions,
|
|
51
|
+
): Promise<operations.ListMarketplaceProductsResponseBody> {
|
|
52
|
+
return unwrapAsync(marketplaceListProducts(
|
|
53
|
+
this,
|
|
54
|
+
request,
|
|
55
|
+
options,
|
|
56
|
+
));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Retrieve cross-sell products
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* Retrieves a list of products specified for cross selling. The cross-sell products are returned based on product ids specified in request param.
|
|
64
|
+
*
|
|
65
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/operations/list-marketplace-crosssell-products} - API reference for the list-marketplace-crosssell-products operation
|
|
66
|
+
*/
|
|
67
|
+
async listCrosssellProducts(
|
|
68
|
+
request: operations.ListMarketplaceCrosssellProductsRequest,
|
|
69
|
+
options?: RequestOptions,
|
|
70
|
+
): Promise<operations.ListMarketplaceCrosssellProductsResponseBody> {
|
|
71
|
+
return unwrapAsync(marketplaceListCrosssellProducts(
|
|
72
|
+
this,
|
|
73
|
+
request,
|
|
74
|
+
options,
|
|
75
|
+
));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Search products
|
|
80
|
+
*
|
|
81
|
+
* @remarks
|
|
82
|
+
* Search for products matching a specific words or characters given.
|
|
83
|
+
*
|
|
84
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/operations/search-marketplace-products} - API reference for the search-marketplace-products operation
|
|
85
|
+
*/
|
|
86
|
+
async searchProducts(
|
|
87
|
+
request: operations.SearchMarketplaceProductsRequest,
|
|
88
|
+
options?: RequestOptions,
|
|
89
|
+
): Promise<operations.SearchMarketplaceProductsResponseBody> {
|
|
90
|
+
return unwrapAsync(marketplaceSearchProducts(
|
|
91
|
+
this,
|
|
92
|
+
request,
|
|
93
|
+
options,
|
|
94
|
+
));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Retrieve similar products
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* Retrieves a list of products similar to a specified product based on their attributes and category. The similar products are returned sorted by relevance, with the most closely matching products appearing first. Useful for providing product recommendations to your customers.
|
|
102
|
+
*
|
|
103
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/operations/list-marketplace-similar-products} - API reference for the list-marketplace-similar-products operation
|
|
104
|
+
*/
|
|
105
|
+
async listSimilarProducts(
|
|
106
|
+
request: operations.ListMarketplaceSimilarProductsRequest,
|
|
107
|
+
options?: RequestOptions,
|
|
108
|
+
): Promise<operations.ListMarketplaceSimilarProductsResponseBody> {
|
|
109
|
+
return unwrapAsync(marketplaceListSimilarProducts(
|
|
110
|
+
this,
|
|
111
|
+
request,
|
|
112
|
+
options,
|
|
113
|
+
));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Retrieve up-sell products
|
|
118
|
+
*
|
|
119
|
+
* @remarks
|
|
120
|
+
* Retrieves a list of products specified for upsell. The upsell products are returned based on product ids specified in request param.
|
|
121
|
+
*
|
|
122
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/operations/list-marketplace-upsell-products} - API reference for the list-marketplace-upsell-products operation
|
|
123
|
+
*/
|
|
124
|
+
async listUpsellProducts(
|
|
125
|
+
request: operations.ListMarketplaceUpsellProductsRequest,
|
|
126
|
+
options?: RequestOptions,
|
|
127
|
+
): Promise<operations.ListMarketplaceUpsellProductsResponseBody> {
|
|
128
|
+
return unwrapAsync(marketplaceListUpsellProducts(
|
|
129
|
+
this,
|
|
130
|
+
request,
|
|
131
|
+
options,
|
|
132
|
+
));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Retrieve a product detail
|
|
137
|
+
*
|
|
138
|
+
* @remarks
|
|
139
|
+
* Retrieves the details of an existing product. Supply either the unique product ID or the unique slug, and Commerce Engine will return the corresponding product information.
|
|
140
|
+
*
|
|
141
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/operations/get-marketplace-product-detail} - API reference for the get-marketplace-product-detail operation
|
|
142
|
+
*/
|
|
143
|
+
async getProductDetail(
|
|
144
|
+
request: operations.GetMarketplaceProductDetailRequest,
|
|
145
|
+
options?: RequestOptions,
|
|
146
|
+
): Promise<operations.GetMarketplaceProductDetailResponseBody> {
|
|
147
|
+
return unwrapAsync(marketplaceGetProductDetail(
|
|
148
|
+
this,
|
|
149
|
+
request,
|
|
150
|
+
options,
|
|
151
|
+
));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* List all product reviews
|
|
156
|
+
*
|
|
157
|
+
* @remarks
|
|
158
|
+
* List of reviews for a specified product. The reviews are returned sorted by submission date, with the most recent reviews appearing first. You can filter the reviews by rating, reviewer, or date for more detailed analysis.
|
|
159
|
+
*
|
|
160
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/operations/list-marketplace-product-reviews} - API reference for the list-marketplace-product-reviews operation
|
|
161
|
+
*/
|
|
162
|
+
async listProductReviews(
|
|
163
|
+
request: operations.ListMarketplaceProductReviewsRequest,
|
|
164
|
+
options?: RequestOptions,
|
|
165
|
+
): Promise<operations.ListMarketplaceProductReviewsResponseBody> {
|
|
166
|
+
return unwrapAsync(marketplaceListProductReviews(
|
|
167
|
+
this,
|
|
168
|
+
request,
|
|
169
|
+
options,
|
|
170
|
+
));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Retrieve product variants
|
|
175
|
+
*
|
|
176
|
+
* @remarks
|
|
177
|
+
* Retrieves the variants of an existing product. Supply the unique product ID, and Commerce Engine will return the corresponding product variants information.
|
|
178
|
+
*
|
|
179
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/operations/list-marketplace-product-variants} - API reference for the list-marketplace-product-variants operation
|
|
180
|
+
*/
|
|
181
|
+
async listProductVariants(
|
|
182
|
+
request: operations.ListMarketplaceProductVariantsRequest,
|
|
183
|
+
options?: RequestOptions,
|
|
184
|
+
): Promise<operations.ListMarketplaceProductVariantsResponseBody> {
|
|
185
|
+
return unwrapAsync(marketplaceListProductVariants(
|
|
186
|
+
this,
|
|
187
|
+
request,
|
|
188
|
+
options,
|
|
189
|
+
));
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Retrieve variant detail
|
|
194
|
+
*
|
|
195
|
+
* @remarks
|
|
196
|
+
* Retrieves the details of a particular variant. Supply the unique product ID, and variant ID.
|
|
197
|
+
*
|
|
198
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/operations/get-marketplace-variant-detail} - API reference for the get-marketplace-variant-detail operation
|
|
199
|
+
*/
|
|
200
|
+
async getVariantDetail(
|
|
201
|
+
request: operations.GetMarketplaceVariantDetailRequest,
|
|
202
|
+
options?: RequestOptions,
|
|
203
|
+
): Promise<operations.GetMarketplaceVariantDetailResponseBody> {
|
|
204
|
+
return unwrapAsync(marketplaceGetVariantDetail(
|
|
205
|
+
this,
|
|
206
|
+
request,
|
|
207
|
+
options,
|
|
208
|
+
));
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* List all SKUs
|
|
213
|
+
*
|
|
214
|
+
* @remarks
|
|
215
|
+
* Returns a list of SKUs. The SKUs are returned sorted by creation date, with the most recently created SKUs appearing first.
|
|
216
|
+
*
|
|
217
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/operations/list-marketplace-skus} - API reference for the list-marketplace-skus operation
|
|
218
|
+
*/
|
|
219
|
+
async listSkus(
|
|
220
|
+
request: operations.ListMarketplaceSkusRequest,
|
|
221
|
+
options?: RequestOptions,
|
|
222
|
+
): Promise<operations.ListMarketplaceSkusResponseBody> {
|
|
223
|
+
return unwrapAsync(marketplaceListSkus(
|
|
224
|
+
this,
|
|
225
|
+
request,
|
|
226
|
+
options,
|
|
227
|
+
));
|
|
228
|
+
}
|
|
229
|
+
}
|
package/src/sdk/sdk.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { Carts } from "./carts.js";
|
|
|
8
8
|
import { Catalog } from "./catalog.js";
|
|
9
9
|
import { Common } from "./common.js";
|
|
10
10
|
import { Customers } from "./customers.js";
|
|
11
|
+
import { Marketplace } from "./marketplace.js";
|
|
11
12
|
import { Orders } from "./orders.js";
|
|
12
13
|
import { Shipping } from "./shipping.js";
|
|
13
14
|
|
|
@@ -27,6 +28,11 @@ export class CeStorefront extends ClientSDK {
|
|
|
27
28
|
return (this._catalog ??= new Catalog(this._options));
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
private _marketplace?: Marketplace;
|
|
32
|
+
get marketplace(): Marketplace {
|
|
33
|
+
return (this._marketplace ??= new Marketplace(this._options));
|
|
34
|
+
}
|
|
35
|
+
|
|
30
36
|
private _common?: Common;
|
|
31
37
|
get common(): Common {
|
|
32
38
|
return (this._common ??= new Common(this._options));
|
package/src/types/enums.ts
CHANGED
|
@@ -2,15 +2,44 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { Unrecognized, unrecognized } from "./unrecognized.js";
|
|
7
7
|
|
|
8
|
-
export
|
|
9
|
-
|
|
8
|
+
export type ClosedEnum<T extends Readonly<Record<string, string | number>>> =
|
|
9
|
+
T[keyof T];
|
|
10
|
+
export type OpenEnum<T extends Readonly<Record<string, string | number>>> =
|
|
11
|
+
| T[keyof T]
|
|
12
|
+
| Unrecognized<T[keyof T] extends number ? number : string>;
|
|
13
|
+
|
|
14
|
+
export function inboundSchema<T extends Record<string, string>>(
|
|
15
|
+
enumObj: T,
|
|
16
|
+
): z.ZodType<OpenEnum<T>, z.ZodTypeDef, unknown> {
|
|
17
|
+
const options = Object.values(enumObj);
|
|
18
|
+
return z.union([
|
|
19
|
+
...options.map(x => z.literal(x)),
|
|
20
|
+
z.string().transform(x => unrecognized(x)),
|
|
21
|
+
] as any);
|
|
10
22
|
}
|
|
11
23
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
export function inboundSchemaInt<T extends Record<string, number | string>>(
|
|
25
|
+
enumObj: T,
|
|
26
|
+
): z.ZodType<OpenEnum<T>, z.ZodTypeDef, unknown> {
|
|
27
|
+
// For numeric enums, Object.values returns both numbers and string keys
|
|
28
|
+
const options = Object.values(enumObj).filter(v => typeof v === "number");
|
|
29
|
+
return z.union([
|
|
30
|
+
...options.map(x => z.literal(x)),
|
|
31
|
+
z.number().int().transform(x => unrecognized(x)),
|
|
32
|
+
] as any);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function outboundSchema<T extends Record<string, string>>(
|
|
36
|
+
_: T,
|
|
37
|
+
): z.ZodType<string, z.ZodTypeDef, OpenEnum<T>> {
|
|
38
|
+
return z.string() as any;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function outboundSchemaInt<T extends Record<string, number | string>>(
|
|
42
|
+
_: T,
|
|
43
|
+
): z.ZodType<number, z.ZodTypeDef, OpenEnum<T>> {
|
|
44
|
+
return z.number().int() as any;
|
|
45
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
export { blobLikeSchema, isBlobLike } from "./blobs.js";
|
|
6
|
-
export {
|
|
7
|
-
export type { ClosedEnum, OpenEnum, Unrecognized } from "./enums.js";
|
|
6
|
+
export type { ClosedEnum, OpenEnum } from "./enums.js";
|
|
8
7
|
export type { Result } from "./fp.js";
|
|
9
8
|
export type { PageIterator, Paginator } from "./operations.js";
|
|
10
9
|
export { createPageIterator } from "./operations.js";
|
|
11
10
|
export { RFCDate } from "./rfcdate.js";
|
|
11
|
+
export * from "./unrecognized.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
declare const __brand: unique symbol;
|
|
6
|
+
export type Unrecognized<T> = T & { [__brand]: "unrecognized" };
|
|
7
|
+
|
|
8
|
+
function unrecognized<T>(value: T): Unrecognized<T> {
|
|
9
|
+
globalCount++;
|
|
10
|
+
return value as Unrecognized<T>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let globalCount = 0;
|
|
14
|
+
let refCount = 0;
|
|
15
|
+
export function startCountingUnrecognized() {
|
|
16
|
+
refCount++;
|
|
17
|
+
const start = globalCount;
|
|
18
|
+
return {
|
|
19
|
+
/**
|
|
20
|
+
* Ends counting and returns the delta.
|
|
21
|
+
* @param delta - If provided, only this amount is added to the parent counter
|
|
22
|
+
* (used for nested unions where we only want to record the winning option's count).
|
|
23
|
+
* If not provided, records all counts since start().
|
|
24
|
+
*/
|
|
25
|
+
end: (delta?: number) => {
|
|
26
|
+
const count = globalCount - start;
|
|
27
|
+
// Reset globalCount back to start, then add only the specified delta
|
|
28
|
+
globalCount = start + (delta ?? count);
|
|
29
|
+
if (--refCount === 0) globalCount = 0;
|
|
30
|
+
return count;
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { unrecognized };
|