@alphabite/medusa-sdk 0.5.3 → 0.5.5
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 +11 -4
- package/dist/index.d.ts +11 -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[];
|
|
@@ -41,6 +41,7 @@ interface Wishlist {
|
|
|
41
41
|
deleted_at: string | null;
|
|
42
42
|
items: WishlistItem[];
|
|
43
43
|
items_count: number;
|
|
44
|
+
name: string | null;
|
|
44
45
|
}
|
|
45
46
|
interface WishlistItem {
|
|
46
47
|
id: string;
|
|
@@ -212,21 +213,26 @@ interface AggregateCountsInput {
|
|
|
212
213
|
}
|
|
213
214
|
interface AggregateCountsOutput extends AggregateCounts {
|
|
214
215
|
}
|
|
216
|
+
interface UploadImageFilesInput {
|
|
217
|
+
formData: FormData;
|
|
218
|
+
}
|
|
215
219
|
type ReviewsEndpoints = {
|
|
216
220
|
create: (input: CreateReviewInput, headers?: ClientHeaders) => Promise<CreateReviewOutput>;
|
|
217
221
|
list: (input: ListReviewsInput, headers?: ClientHeaders) => Promise<ListReviewsOutput>;
|
|
218
222
|
listProductReviews: (input: ListProductReviewsInput, headers?: ClientHeaders) => Promise<ListProductReviewsOutput>;
|
|
219
223
|
delete: (input: DeleteReviewInput, headers?: ClientHeaders) => Promise<DeleteReviewOutput>;
|
|
220
224
|
aggregateCounts: (input: AggregateCountsInput, headers?: ClientHeaders) => Promise<AggregateCountsOutput>;
|
|
225
|
+
uploadImageFiles: (input: UploadImageFilesInput, headers?: ClientHeaders) => Promise<FileDTO[]>;
|
|
221
226
|
};
|
|
222
227
|
declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
|
|
223
228
|
|
|
224
229
|
type AlphabiteClientOptions = {
|
|
225
230
|
getAuthHeader?: () => Promise<Record<string, string>> | Record<string, string>;
|
|
226
231
|
};
|
|
232
|
+
type AlphabiteMedusaConfig = ConstructorParameters<typeof Medusa>[0];
|
|
227
233
|
type Plugin<Name extends string, Endpoints> = {
|
|
228
234
|
name: Name;
|
|
229
|
-
endpoints: (client: any, options?: AlphabiteClientOptions) => Endpoints;
|
|
235
|
+
endpoints: (client: any, options?: AlphabiteClientOptions, medusaConfig?: AlphabiteMedusaConfig) => Endpoints;
|
|
230
236
|
};
|
|
231
237
|
type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
|
|
232
238
|
[K in T[number] as K['name']]: ReturnType<K['endpoints']>;
|
|
@@ -234,7 +240,8 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
|
|
|
234
240
|
declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], TOptions extends AlphabiteClientOptions = AlphabiteClientOptions> extends Medusa {
|
|
235
241
|
alphabite: PluginsToAlphabite<TPlugins>;
|
|
236
242
|
protected options?: TOptions;
|
|
237
|
-
|
|
243
|
+
medusaConfig: AlphabiteMedusaConfig;
|
|
244
|
+
constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
|
|
238
245
|
}
|
|
239
246
|
|
|
240
|
-
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[];
|
|
@@ -41,6 +41,7 @@ interface Wishlist {
|
|
|
41
41
|
deleted_at: string | null;
|
|
42
42
|
items: WishlistItem[];
|
|
43
43
|
items_count: number;
|
|
44
|
+
name: string | null;
|
|
44
45
|
}
|
|
45
46
|
interface WishlistItem {
|
|
46
47
|
id: string;
|
|
@@ -212,21 +213,26 @@ interface AggregateCountsInput {
|
|
|
212
213
|
}
|
|
213
214
|
interface AggregateCountsOutput extends AggregateCounts {
|
|
214
215
|
}
|
|
216
|
+
interface UploadImageFilesInput {
|
|
217
|
+
formData: FormData;
|
|
218
|
+
}
|
|
215
219
|
type ReviewsEndpoints = {
|
|
216
220
|
create: (input: CreateReviewInput, headers?: ClientHeaders) => Promise<CreateReviewOutput>;
|
|
217
221
|
list: (input: ListReviewsInput, headers?: ClientHeaders) => Promise<ListReviewsOutput>;
|
|
218
222
|
listProductReviews: (input: ListProductReviewsInput, headers?: ClientHeaders) => Promise<ListProductReviewsOutput>;
|
|
219
223
|
delete: (input: DeleteReviewInput, headers?: ClientHeaders) => Promise<DeleteReviewOutput>;
|
|
220
224
|
aggregateCounts: (input: AggregateCountsInput, headers?: ClientHeaders) => Promise<AggregateCountsOutput>;
|
|
225
|
+
uploadImageFiles: (input: UploadImageFilesInput, headers?: ClientHeaders) => Promise<FileDTO[]>;
|
|
221
226
|
};
|
|
222
227
|
declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
|
|
223
228
|
|
|
224
229
|
type AlphabiteClientOptions = {
|
|
225
230
|
getAuthHeader?: () => Promise<Record<string, string>> | Record<string, string>;
|
|
226
231
|
};
|
|
232
|
+
type AlphabiteMedusaConfig = ConstructorParameters<typeof Medusa>[0];
|
|
227
233
|
type Plugin<Name extends string, Endpoints> = {
|
|
228
234
|
name: Name;
|
|
229
|
-
endpoints: (client: any, options?: AlphabiteClientOptions) => Endpoints;
|
|
235
|
+
endpoints: (client: any, options?: AlphabiteClientOptions, medusaConfig?: AlphabiteMedusaConfig) => Endpoints;
|
|
230
236
|
};
|
|
231
237
|
type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
|
|
232
238
|
[K in T[number] as K['name']]: ReturnType<K['endpoints']>;
|
|
@@ -234,7 +240,8 @@ type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
|
|
|
234
240
|
declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], TOptions extends AlphabiteClientOptions = AlphabiteClientOptions> extends Medusa {
|
|
235
241
|
alphabite: PluginsToAlphabite<TPlugins>;
|
|
236
242
|
protected options?: TOptions;
|
|
237
|
-
|
|
243
|
+
medusaConfig: AlphabiteMedusaConfig;
|
|
244
|
+
constructor(medusaOptions: AlphabiteMedusaConfig, plugins: TPlugins, options?: TOptions);
|
|
238
245
|
}
|
|
239
246
|
|
|
240
|
-
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(!n||!a)throw new Error("Missing baseUrl or publishableKey");return await(await fetch(`${n}/store/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(!n||!a)throw new Error("Missing baseUrl or publishableKey");return await(await fetch(`${n}/store/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};
|