@alphabite/medusa-sdk 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +10 -4
- package/dist/index.d.ts +10 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Medusa, { ClientHeaders } from '@medusajs/js-sdk';
|
|
2
2
|
import { BaseProductVariant, BaseProduct } from '@medusajs/types/dist/http/product/common';
|
|
3
|
-
import { FindParams, RemoteQueryFunctionReturnPagination, PriceDTO, StoreCartAddress, StoreCartLineItem, CustomerDTO, ProductDTO } from '@medusajs/types';
|
|
3
|
+
import { FindParams, RemoteQueryFunctionReturnPagination, PriceDTO, StoreCartAddress, StoreCartLineItem, CustomerDTO, ProductDTO, FileDTO } from '@medusajs/types';
|
|
4
4
|
|
|
5
5
|
interface PaginatedOutput<T> extends PaginatedOutputMeta {
|
|
6
6
|
data: T[];
|
|
@@ -213,21 +213,26 @@ interface AggregateCountsInput {
|
|
|
213
213
|
}
|
|
214
214
|
interface AggregateCountsOutput extends AggregateCounts {
|
|
215
215
|
}
|
|
216
|
+
interface UploadImageFilesInput {
|
|
217
|
+
formData: FormData;
|
|
218
|
+
}
|
|
216
219
|
type ReviewsEndpoints = {
|
|
217
220
|
create: (input: CreateReviewInput, headers?: ClientHeaders) => Promise<CreateReviewOutput>;
|
|
218
221
|
list: (input: ListReviewsInput, headers?: ClientHeaders) => Promise<ListReviewsOutput>;
|
|
219
222
|
listProductReviews: (input: ListProductReviewsInput, headers?: ClientHeaders) => Promise<ListProductReviewsOutput>;
|
|
220
223
|
delete: (input: DeleteReviewInput, headers?: ClientHeaders) => Promise<DeleteReviewOutput>;
|
|
221
224
|
aggregateCounts: (input: AggregateCountsInput, headers?: ClientHeaders) => Promise<AggregateCountsOutput>;
|
|
225
|
+
uploadImageFiles: (input: UploadImageFilesInput, headers?: ClientHeaders) => Promise<FileDTO[]>;
|
|
222
226
|
};
|
|
223
227
|
declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
|
|
224
228
|
|
|
225
229
|
type AlphabiteClientOptions = {
|
|
226
230
|
getAuthHeader?: () => Promise<Record<string, string>> | Record<string, string>;
|
|
227
231
|
};
|
|
232
|
+
type AlphabiteMedusaConfig = ConstructorParameters<typeof Medusa>[0];
|
|
228
233
|
type Plugin<Name extends string, Endpoints> = {
|
|
229
234
|
name: Name;
|
|
230
|
-
endpoints: (client: any, options?: AlphabiteClientOptions) => Endpoints;
|
|
235
|
+
endpoints: (client: any, options?: AlphabiteClientOptions, medusaConfig?: AlphabiteMedusaConfig) => Endpoints;
|
|
231
236
|
};
|
|
232
237
|
type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
|
|
233
238
|
[K in T[number] as K['name']]: ReturnType<K['endpoints']>;
|
|
@@ -235,7 +240,8 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
|
|
|
235
240
|
declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], TOptions extends AlphabiteClientOptions = AlphabiteClientOptions> extends Medusa {
|
|
236
241
|
alphabite: PluginsToAlphabite<TPlugins>;
|
|
237
242
|
protected options?: TOptions;
|
|
238
|
-
|
|
243
|
+
medusaConfig: AlphabiteMedusaConfig;
|
|
244
|
+
constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
|
|
239
245
|
}
|
|
240
246
|
|
|
241
|
-
export { type AddItemToWishlistInput, type AddItemToWishlistOutput, type AggregateCounts, type AggregateCountsInput, type AggregateCountsOutput, type AlphabiteClientOptions, AlphabiteMedusaSdk, type CreateClientTokenOutput, type CreateReviewInput, type CreateReviewOutput, type CreateWishlistInput, type CreateWishlistOutput, type DeleteReviewInput, type DeleteReviewOutput, type DeleteWishlistInput, type DeleteWishlistOutput, type ImportWishlistInput, type ImportWishlistOutput, type ListItemsInput, type ListItemsOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListReviewsInput, type ListReviewsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, type RemoveItemFromWishlistInput, type RemoveItemFromWishlistOutput, type RetrieveWishlistInput, type RetrieveWishlistOutput, type Review, type ShareWishlistInput, type ShareWishlistOutput, type TotalItemsCountInput, type TotalItemsCountOutput, type TransferWishlistInput, type TransferWishlistOutput, type UpdateWishlistInput, type UpdateWishlistOutput, type Wishlist, type WishlistItem, paypalPlugin, reviewsPlugin, wishlistPlugin };
|
|
247
|
+
export { type AddItemToWishlistInput, type AddItemToWishlistOutput, type AggregateCounts, type AggregateCountsInput, type AggregateCountsOutput, type AlphabiteClientOptions, type AlphabiteMedusaConfig, AlphabiteMedusaSdk, type CreateClientTokenOutput, type CreateReviewInput, type CreateReviewOutput, type CreateWishlistInput, type CreateWishlistOutput, type DeleteReviewInput, type DeleteReviewOutput, type DeleteWishlistInput, type DeleteWishlistOutput, type ImportWishlistInput, type ImportWishlistOutput, type ListItemsInput, type ListItemsOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListReviewsInput, type ListReviewsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, type RemoveItemFromWishlistInput, type RemoveItemFromWishlistOutput, type RetrieveWishlistInput, type RetrieveWishlistOutput, type Review, type ShareWishlistInput, type ShareWishlistOutput, type TotalItemsCountInput, type TotalItemsCountOutput, type TransferWishlistInput, type TransferWishlistOutput, type UpdateWishlistInput, type UpdateWishlistOutput, type UploadImageFilesInput, type Wishlist, type WishlistItem, paypalPlugin, reviewsPlugin, wishlistPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Medusa, { ClientHeaders } from '@medusajs/js-sdk';
|
|
2
2
|
import { BaseProductVariant, BaseProduct } from '@medusajs/types/dist/http/product/common';
|
|
3
|
-
import { FindParams, RemoteQueryFunctionReturnPagination, PriceDTO, StoreCartAddress, StoreCartLineItem, CustomerDTO, ProductDTO } from '@medusajs/types';
|
|
3
|
+
import { FindParams, RemoteQueryFunctionReturnPagination, PriceDTO, StoreCartAddress, StoreCartLineItem, CustomerDTO, ProductDTO, FileDTO } from '@medusajs/types';
|
|
4
4
|
|
|
5
5
|
interface PaginatedOutput<T> extends PaginatedOutputMeta {
|
|
6
6
|
data: T[];
|
|
@@ -213,21 +213,26 @@ interface AggregateCountsInput {
|
|
|
213
213
|
}
|
|
214
214
|
interface AggregateCountsOutput extends AggregateCounts {
|
|
215
215
|
}
|
|
216
|
+
interface UploadImageFilesInput {
|
|
217
|
+
formData: FormData;
|
|
218
|
+
}
|
|
216
219
|
type ReviewsEndpoints = {
|
|
217
220
|
create: (input: CreateReviewInput, headers?: ClientHeaders) => Promise<CreateReviewOutput>;
|
|
218
221
|
list: (input: ListReviewsInput, headers?: ClientHeaders) => Promise<ListReviewsOutput>;
|
|
219
222
|
listProductReviews: (input: ListProductReviewsInput, headers?: ClientHeaders) => Promise<ListProductReviewsOutput>;
|
|
220
223
|
delete: (input: DeleteReviewInput, headers?: ClientHeaders) => Promise<DeleteReviewOutput>;
|
|
221
224
|
aggregateCounts: (input: AggregateCountsInput, headers?: ClientHeaders) => Promise<AggregateCountsOutput>;
|
|
225
|
+
uploadImageFiles: (input: UploadImageFilesInput, headers?: ClientHeaders) => Promise<FileDTO[]>;
|
|
222
226
|
};
|
|
223
227
|
declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
|
|
224
228
|
|
|
225
229
|
type AlphabiteClientOptions = {
|
|
226
230
|
getAuthHeader?: () => Promise<Record<string, string>> | Record<string, string>;
|
|
227
231
|
};
|
|
232
|
+
type AlphabiteMedusaConfig = ConstructorParameters<typeof Medusa>[0];
|
|
228
233
|
type Plugin<Name extends string, Endpoints> = {
|
|
229
234
|
name: Name;
|
|
230
|
-
endpoints: (client: any, options?: AlphabiteClientOptions) => Endpoints;
|
|
235
|
+
endpoints: (client: any, options?: AlphabiteClientOptions, medusaConfig?: AlphabiteMedusaConfig) => Endpoints;
|
|
231
236
|
};
|
|
232
237
|
type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
|
|
233
238
|
[K in T[number] as K['name']]: ReturnType<K['endpoints']>;
|
|
@@ -235,7 +240,8 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
|
|
|
235
240
|
declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], TOptions extends AlphabiteClientOptions = AlphabiteClientOptions> extends Medusa {
|
|
236
241
|
alphabite: PluginsToAlphabite<TPlugins>;
|
|
237
242
|
protected options?: TOptions;
|
|
238
|
-
|
|
243
|
+
medusaConfig: AlphabiteMedusaConfig;
|
|
244
|
+
constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
|
|
239
245
|
}
|
|
240
246
|
|
|
241
|
-
export { type AddItemToWishlistInput, type AddItemToWishlistOutput, type AggregateCounts, type AggregateCountsInput, type AggregateCountsOutput, type AlphabiteClientOptions, AlphabiteMedusaSdk, type CreateClientTokenOutput, type CreateReviewInput, type CreateReviewOutput, type CreateWishlistInput, type CreateWishlistOutput, type DeleteReviewInput, type DeleteReviewOutput, type DeleteWishlistInput, type DeleteWishlistOutput, type ImportWishlistInput, type ImportWishlistOutput, type ListItemsInput, type ListItemsOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListReviewsInput, type ListReviewsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, type RemoveItemFromWishlistInput, type RemoveItemFromWishlistOutput, type RetrieveWishlistInput, type RetrieveWishlistOutput, type Review, type ShareWishlistInput, type ShareWishlistOutput, type TotalItemsCountInput, type TotalItemsCountOutput, type TransferWishlistInput, type TransferWishlistOutput, type UpdateWishlistInput, type UpdateWishlistOutput, type Wishlist, type WishlistItem, paypalPlugin, reviewsPlugin, wishlistPlugin };
|
|
247
|
+
export { type AddItemToWishlistInput, type AddItemToWishlistOutput, type AggregateCounts, type AggregateCountsInput, type AggregateCountsOutput, type AlphabiteClientOptions, type AlphabiteMedusaConfig, AlphabiteMedusaSdk, type CreateClientTokenOutput, type CreateReviewInput, type CreateReviewOutput, type CreateWishlistInput, type CreateWishlistOutput, type DeleteReviewInput, type DeleteReviewOutput, type DeleteWishlistInput, type DeleteWishlistOutput, type ImportWishlistInput, type ImportWishlistOutput, type ListItemsInput, type ListItemsOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListReviewsInput, type ListReviewsOutput, type ListWishlistsInput, type ListWishlistsOutput, type PaypalPaymentSessionInputData, type Plugin, type PluginsToAlphabite, type ProductCategoryImage, type ProductCollectionImage, type ProductVariantImage, type RemoveItemFromWishlistInput, type RemoveItemFromWishlistOutput, type RetrieveWishlistInput, type RetrieveWishlistOutput, type Review, type ShareWishlistInput, type ShareWishlistOutput, type TotalItemsCountInput, type TotalItemsCountOutput, type TransferWishlistInput, type TransferWishlistOutput, type UpdateWishlistInput, type UpdateWishlistOutput, type UploadImageFilesInput, type Wishlist, type WishlistItem, paypalPlugin, reviewsPlugin, wishlistPlugin };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var u=require('@medusajs/js-sdk');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var u__default=/*#__PURE__*/_interopDefault(u);var
|
|
1
|
+
'use strict';var u=require('@medusajs/js-sdk');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var u__default=/*#__PURE__*/_interopDefault(u);var p={name:"wishlist",endpoints:(r,s)=>({create:async({...t},e)=>r.client.fetch("/store/wishlists",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),list:async({limit:t=10,offset:e=0,...i},n)=>r.client.fetch("/store/wishlists",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{limit:t,offset:e,...i}}),retrieve:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),update:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"PUT",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),delete:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...e}}),totalItemsCount:async({wishlist_id:t},e)=>r.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await s?.getAuthHeader?.(),...e},query:{wishlist_id:t}}),transfer:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/transfer`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),share:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/share`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),import:async(t,e)=>r.client.fetch("/store/wishlists/import",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),addItem:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}/add-item`,{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),listItems:async({id:t,limit:e=10,offset:i=0,...n},a)=>r.client.fetch(`/store/wishlists/${t}/items`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...a},query:{limit:e,offset:i,...n}}),removeItem:async({wishlist_item_id:t,id:e},i)=>r.client.fetch(`/store/wishlists/${e}/items/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}})})};var h={name:"paypal",endpoints:(r,s)=>({createClientToken:async t=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await s?.getAuthHeader?.(),...t}})})};var m={name:"reviews",endpoints:(r,s,t)=>({create:async(e,i)=>r.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),list:async({...e},i)=>r.client.fetch("/store/products/reviews",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),listProductReviews:async({product_id:e,...i},n)=>r.client.fetch(`store/reviews/product/${e}`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),aggregateCounts:async({product_id:e,...i},n)=>r.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),delete:async({id:e},i)=>r.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}}),uploadImageFiles:async(e,i)=>{let n=t?.baseUrl,a=t?.publishableKey;if(console.log("Uploading image files to Medusa",{baseUrl:n,publishableKey:a}),!n||!a)throw new Error("Missing baseUrl or publishableKey");return await(await fetch(`${n}/store/reviews/files/images/upload`,{method:"POST",body:e.formData,headers:{...i,"x-publishable-api-key":a}})).json()}})};var o=class extends u__default.default{constructor(s,t,e){super(s),this.options=e,this.medusaConfig=s;let i={};t.forEach(n=>{i[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=i;}};exports.AlphabiteMedusaSdk=o;exports.paypalPlugin=h;exports.reviewsPlugin=m;exports.wishlistPlugin=p;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import u from'@medusajs/js-sdk';var
|
|
1
|
+
import u from'@medusajs/js-sdk';var p={name:"wishlist",endpoints:(r,s)=>({create:async({...t},e)=>r.client.fetch("/store/wishlists",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),list:async({limit:t=10,offset:e=0,...i},n)=>r.client.fetch("/store/wishlists",{method:"GET",headers:{...await s?.getAuthHeader?.(),...n},query:{limit:t,offset:e,...i}}),retrieve:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),update:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}`,{method:"PUT",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),delete:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...e}}),totalItemsCount:async({wishlist_id:t},e)=>r.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await s?.getAuthHeader?.(),...e},query:{wishlist_id:t}}),transfer:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/transfer`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),share:async({id:t},e)=>r.client.fetch(`/store/wishlists/${t}/share`,{method:"POST",headers:{...await s?.getAuthHeader?.(),...e}}),import:async(t,e)=>r.client.fetch("/store/wishlists/import",{method:"POST",body:t,headers:{...await s?.getAuthHeader?.(),...e}}),addItem:async({id:t,...e},i)=>r.client.fetch(`/store/wishlists/${t}/add-item`,{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),listItems:async({id:t,limit:e=10,offset:i=0,...n},a)=>r.client.fetch(`/store/wishlists/${t}/items`,{method:"GET",headers:{...await s?.getAuthHeader?.(),...a},query:{limit:e,offset:i,...n}}),removeItem:async({wishlist_item_id:t,id:e},i)=>r.client.fetch(`/store/wishlists/${e}/items/${t}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}})})};var h={name:"paypal",endpoints:(r,s)=>({createClientToken:async t=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await s?.getAuthHeader?.(),...t}})})};var m={name:"reviews",endpoints:(r,s,t)=>({create:async(e,i)=>r.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await s?.getAuthHeader?.(),...i}}),list:async({...e},i)=>r.client.fetch("/store/products/reviews",{method:"GET",headers:{...await s?.getAuthHeader?.(),...i},query:e}),listProductReviews:async({product_id:e,...i},n)=>r.client.fetch(`store/reviews/product/${e}`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),aggregateCounts:async({product_id:e,...i},n)=>r.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:i,headers:{...await s?.getAuthHeader?.(),...n}}),delete:async({id:e},i)=>r.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await s?.getAuthHeader?.(),...i}}),uploadImageFiles:async(e,i)=>{let n=t?.baseUrl,a=t?.publishableKey;if(console.log("Uploading image files to Medusa",{baseUrl:n,publishableKey:a}),!n||!a)throw new Error("Missing baseUrl or publishableKey");return await(await fetch(`${n}/store/reviews/files/images/upload`,{method:"POST",body:e.formData,headers:{...i,"x-publishable-api-key":a}})).json()}})};var o=class extends u{constructor(s,t,e){super(s),this.options=e,this.medusaConfig=s;let i={};t.forEach(n=>{i[n.name]=n.endpoints(this,this.options,this.medusaConfig);}),this.alphabite=i;}};export{o as AlphabiteMedusaSdk,h as paypalPlugin,m as reviewsPlugin,p as wishlistPlugin};
|