@alphabite/medusa-sdk 0.3.1
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 +207 -0
- package/dist/index.d.ts +207 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +49 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import Medusa, { ClientHeaders } from '@medusajs/js-sdk';
|
|
2
|
+
import { BaseProductVariant, BaseProduct } from '@medusajs/types/dist/http/product/common';
|
|
3
|
+
import { FindParams, RemoteQueryFunctionReturnPagination, PriceDTO, CustomerDTO, ProductDTO } from '@medusajs/types';
|
|
4
|
+
|
|
5
|
+
interface PaginatedOutput<T> extends PaginatedOutputMeta {
|
|
6
|
+
data: T[];
|
|
7
|
+
}
|
|
8
|
+
interface PaginatedOutputMeta extends RemoteQueryFunctionReturnPagination {
|
|
9
|
+
totalPages: number;
|
|
10
|
+
currentPage: number;
|
|
11
|
+
nextPage: number;
|
|
12
|
+
prevPage: number;
|
|
13
|
+
}
|
|
14
|
+
interface PaginatedInput extends FindParams {
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface Wishlist {
|
|
18
|
+
id: string;
|
|
19
|
+
customer_id: string | null;
|
|
20
|
+
sales_channel_id: string;
|
|
21
|
+
created_at: string;
|
|
22
|
+
updated_at: string;
|
|
23
|
+
deleted_at: string | null;
|
|
24
|
+
items: WishlistItem[];
|
|
25
|
+
items_count: number;
|
|
26
|
+
}
|
|
27
|
+
interface WishlistItem {
|
|
28
|
+
id: string;
|
|
29
|
+
product_id: string;
|
|
30
|
+
wishlist_id: string;
|
|
31
|
+
created_at: string;
|
|
32
|
+
updated_at: string;
|
|
33
|
+
deleted_at: string | null;
|
|
34
|
+
product_variant: (Omit<BaseProductVariant, 'product'> & {
|
|
35
|
+
product: Pick<BaseProduct, 'id' | 'thumbnail'>;
|
|
36
|
+
prices: PriceDTO[];
|
|
37
|
+
}) | null;
|
|
38
|
+
}
|
|
39
|
+
interface CreateWishlistInput {
|
|
40
|
+
name?: string;
|
|
41
|
+
sales_channel_id: string;
|
|
42
|
+
}
|
|
43
|
+
interface CreateWishlistOutput extends Wishlist {
|
|
44
|
+
}
|
|
45
|
+
interface AddItemToWishlistInput {
|
|
46
|
+
product_variant_id: string;
|
|
47
|
+
id: string;
|
|
48
|
+
}
|
|
49
|
+
interface AddItemToWishlistOutput extends WishlistItem {
|
|
50
|
+
}
|
|
51
|
+
interface ListWishlistsInput extends PaginatedInput {
|
|
52
|
+
items_fields?: string[];
|
|
53
|
+
}
|
|
54
|
+
interface ListWishlistsOutput extends PaginatedOutput<Wishlist> {
|
|
55
|
+
}
|
|
56
|
+
interface RetrieveWishlistInput {
|
|
57
|
+
id: string;
|
|
58
|
+
items_fields?: string[];
|
|
59
|
+
}
|
|
60
|
+
interface RetrieveWishlistOutput extends Wishlist {
|
|
61
|
+
}
|
|
62
|
+
interface ListItemsInput extends PaginatedInput {
|
|
63
|
+
id: string;
|
|
64
|
+
}
|
|
65
|
+
interface ListItemsOutput extends PaginatedOutput<WishlistItem> {
|
|
66
|
+
}
|
|
67
|
+
interface TotalItemsCountInput {
|
|
68
|
+
wishlist_id?: string;
|
|
69
|
+
}
|
|
70
|
+
interface TotalItemsCountOutput {
|
|
71
|
+
total_items_count: number;
|
|
72
|
+
}
|
|
73
|
+
interface TransferWishlistInput {
|
|
74
|
+
id: string;
|
|
75
|
+
}
|
|
76
|
+
interface TransferWishlistOutput {
|
|
77
|
+
id: string;
|
|
78
|
+
}
|
|
79
|
+
interface UpdateWishlistInput {
|
|
80
|
+
id: string;
|
|
81
|
+
name?: string;
|
|
82
|
+
}
|
|
83
|
+
interface UpdateWishlistOutput extends Omit<Wishlist, 'items'> {
|
|
84
|
+
}
|
|
85
|
+
interface RemoveItemFromWishlistInput {
|
|
86
|
+
wishlist_item_id: string;
|
|
87
|
+
id: string;
|
|
88
|
+
}
|
|
89
|
+
interface RemoveItemFromWishlistOutput {
|
|
90
|
+
id: string;
|
|
91
|
+
}
|
|
92
|
+
interface DeleteWishlistInput {
|
|
93
|
+
id: string;
|
|
94
|
+
}
|
|
95
|
+
interface DeleteWishlistOutput {
|
|
96
|
+
id: string;
|
|
97
|
+
}
|
|
98
|
+
type WishlistEndpoints = {
|
|
99
|
+
create: (input: CreateWishlistInput, headers?: ClientHeaders) => Promise<CreateWishlistOutput>;
|
|
100
|
+
addItem: (input: AddItemToWishlistInput, headers?: ClientHeaders) => Promise<AddItemToWishlistOutput>;
|
|
101
|
+
list: (input: ListWishlistsInput, headers?: ClientHeaders) => Promise<ListWishlistsOutput>;
|
|
102
|
+
listItems: (input: ListItemsInput, headers?: ClientHeaders) => Promise<ListItemsOutput>;
|
|
103
|
+
retrieve: (input: RetrieveWishlistInput, headers?: ClientHeaders) => Promise<RetrieveWishlistOutput>;
|
|
104
|
+
transfer: (input: TransferWishlistInput, headers?: ClientHeaders) => Promise<TransferWishlistOutput>;
|
|
105
|
+
update: (input: UpdateWishlistInput, headers?: ClientHeaders) => Promise<UpdateWishlistOutput>;
|
|
106
|
+
delete: (input: DeleteWishlistInput, headers?: ClientHeaders) => Promise<DeleteWishlistOutput>;
|
|
107
|
+
removeItem: (input: RemoveItemFromWishlistInput, headers?: ClientHeaders) => Promise<RemoveItemFromWishlistOutput>;
|
|
108
|
+
totalItemsCount: (input: TotalItemsCountInput, headers?: ClientHeaders) => Promise<TotalItemsCountOutput>;
|
|
109
|
+
};
|
|
110
|
+
declare const wishlistPlugin: Plugin<'wishlist', WishlistEndpoints>;
|
|
111
|
+
|
|
112
|
+
interface CreateClientTokenOutput {
|
|
113
|
+
client_token: string;
|
|
114
|
+
}
|
|
115
|
+
type PaypalEndpoints = {
|
|
116
|
+
createClientToken: (headers?: ClientHeaders) => Promise<CreateClientTokenOutput>;
|
|
117
|
+
};
|
|
118
|
+
declare const paypalPlugin: Plugin<'paypal', PaypalEndpoints>;
|
|
119
|
+
|
|
120
|
+
interface AggregateCounts {
|
|
121
|
+
average: number;
|
|
122
|
+
counts: {
|
|
123
|
+
rating: number;
|
|
124
|
+
count: number;
|
|
125
|
+
}[];
|
|
126
|
+
product_id: string;
|
|
127
|
+
total_count: number;
|
|
128
|
+
}
|
|
129
|
+
interface Review {
|
|
130
|
+
title: string;
|
|
131
|
+
content: string;
|
|
132
|
+
rating: number;
|
|
133
|
+
id: string;
|
|
134
|
+
created_at: string;
|
|
135
|
+
image_urls: string[];
|
|
136
|
+
is_verified_purchase: boolean;
|
|
137
|
+
product_id: string;
|
|
138
|
+
customer: Pick<CustomerDTO, 'first_name' | 'last_name'>;
|
|
139
|
+
product?: Pick<ProductDTO, 'thumbnail' | 'title' | 'handle' | 'id'> & AggregateCounts;
|
|
140
|
+
}
|
|
141
|
+
interface CreateReviewInput {
|
|
142
|
+
content: string;
|
|
143
|
+
rating: number;
|
|
144
|
+
product_id: string;
|
|
145
|
+
image_base64s: string[];
|
|
146
|
+
title?: string;
|
|
147
|
+
}
|
|
148
|
+
interface CreateReviewOutput extends Review {
|
|
149
|
+
}
|
|
150
|
+
interface ListReviewsInput extends PaginatedInput {
|
|
151
|
+
product_ids?: string[];
|
|
152
|
+
my_reviews_only?: boolean;
|
|
153
|
+
verified_purchase_only?: boolean;
|
|
154
|
+
rating?: number;
|
|
155
|
+
include_product?: boolean;
|
|
156
|
+
}
|
|
157
|
+
interface ListReviewsOutput extends PaginatedOutput<Review> {
|
|
158
|
+
}
|
|
159
|
+
interface ListProductReviewsInput extends PaginatedInput {
|
|
160
|
+
product_id: string;
|
|
161
|
+
my_reviews_only?: boolean;
|
|
162
|
+
verified_purchase_only?: boolean;
|
|
163
|
+
sort?: 'created_at' | 'rating';
|
|
164
|
+
order?: 'asc' | 'desc';
|
|
165
|
+
rating?: number;
|
|
166
|
+
include_product?: boolean;
|
|
167
|
+
}
|
|
168
|
+
interface ListProductReviewsOutput extends PaginatedOutput<Review> {
|
|
169
|
+
}
|
|
170
|
+
interface DeleteReviewInput {
|
|
171
|
+
id: string;
|
|
172
|
+
}
|
|
173
|
+
interface DeleteReviewOutput {
|
|
174
|
+
id: string;
|
|
175
|
+
}
|
|
176
|
+
interface AggregateCountsInput {
|
|
177
|
+
product_id: string;
|
|
178
|
+
verified_purchase_only?: boolean;
|
|
179
|
+
}
|
|
180
|
+
interface AggregateCountsOutput extends AggregateCounts {
|
|
181
|
+
}
|
|
182
|
+
type ReviewsEndpoints = {
|
|
183
|
+
create: (input: CreateReviewInput, headers?: ClientHeaders) => Promise<CreateReviewOutput>;
|
|
184
|
+
list: (input: ListReviewsInput, headers?: ClientHeaders) => Promise<ListReviewsOutput>;
|
|
185
|
+
listProductReviews: (input: ListProductReviewsInput, headers?: ClientHeaders) => Promise<ListProductReviewsOutput>;
|
|
186
|
+
delete: (input: DeleteReviewInput, headers?: ClientHeaders) => Promise<DeleteReviewOutput>;
|
|
187
|
+
aggregateCounts: (input: AggregateCountsInput, headers?: ClientHeaders) => Promise<AggregateCountsOutput>;
|
|
188
|
+
};
|
|
189
|
+
declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
|
|
190
|
+
|
|
191
|
+
type AlphabiteClientOptions = {
|
|
192
|
+
getAuthHeader?: () => Promise<Record<string, string>> | Record<string, string>;
|
|
193
|
+
};
|
|
194
|
+
type Plugin<Name extends string, Endpoints> = {
|
|
195
|
+
name: Name;
|
|
196
|
+
endpoints: (client: any, options?: AlphabiteClientOptions) => Endpoints;
|
|
197
|
+
};
|
|
198
|
+
type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
|
|
199
|
+
[K in T[number] as K['name']]: ReturnType<K['endpoints']>;
|
|
200
|
+
};
|
|
201
|
+
declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], TOptions extends AlphabiteClientOptions = AlphabiteClientOptions> extends Medusa {
|
|
202
|
+
alphabite: PluginsToAlphabite<TPlugins>;
|
|
203
|
+
protected options?: TOptions;
|
|
204
|
+
constructor(medusaOptions: ConstructorParameters<typeof Medusa>[0], plugins: TPlugins, options?: TOptions);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
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 ListItemsInput, type ListItemsOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListReviewsInput, type ListReviewsOutput, type ListWishlistsInput, type ListWishlistsOutput, type Plugin, type PluginsToAlphabite, type RemoveItemFromWishlistInput, type RemoveItemFromWishlistOutput, type RetrieveWishlistInput, type RetrieveWishlistOutput, type Review, type TotalItemsCountInput, type TotalItemsCountOutput, type TransferWishlistInput, type TransferWishlistOutput, type UpdateWishlistInput, type UpdateWishlistOutput, type Wishlist, type WishlistItem, paypalPlugin, reviewsPlugin, wishlistPlugin };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import Medusa, { ClientHeaders } from '@medusajs/js-sdk';
|
|
2
|
+
import { BaseProductVariant, BaseProduct } from '@medusajs/types/dist/http/product/common';
|
|
3
|
+
import { FindParams, RemoteQueryFunctionReturnPagination, PriceDTO, CustomerDTO, ProductDTO } from '@medusajs/types';
|
|
4
|
+
|
|
5
|
+
interface PaginatedOutput<T> extends PaginatedOutputMeta {
|
|
6
|
+
data: T[];
|
|
7
|
+
}
|
|
8
|
+
interface PaginatedOutputMeta extends RemoteQueryFunctionReturnPagination {
|
|
9
|
+
totalPages: number;
|
|
10
|
+
currentPage: number;
|
|
11
|
+
nextPage: number;
|
|
12
|
+
prevPage: number;
|
|
13
|
+
}
|
|
14
|
+
interface PaginatedInput extends FindParams {
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface Wishlist {
|
|
18
|
+
id: string;
|
|
19
|
+
customer_id: string | null;
|
|
20
|
+
sales_channel_id: string;
|
|
21
|
+
created_at: string;
|
|
22
|
+
updated_at: string;
|
|
23
|
+
deleted_at: string | null;
|
|
24
|
+
items: WishlistItem[];
|
|
25
|
+
items_count: number;
|
|
26
|
+
}
|
|
27
|
+
interface WishlistItem {
|
|
28
|
+
id: string;
|
|
29
|
+
product_id: string;
|
|
30
|
+
wishlist_id: string;
|
|
31
|
+
created_at: string;
|
|
32
|
+
updated_at: string;
|
|
33
|
+
deleted_at: string | null;
|
|
34
|
+
product_variant: (Omit<BaseProductVariant, 'product'> & {
|
|
35
|
+
product: Pick<BaseProduct, 'id' | 'thumbnail'>;
|
|
36
|
+
prices: PriceDTO[];
|
|
37
|
+
}) | null;
|
|
38
|
+
}
|
|
39
|
+
interface CreateWishlistInput {
|
|
40
|
+
name?: string;
|
|
41
|
+
sales_channel_id: string;
|
|
42
|
+
}
|
|
43
|
+
interface CreateWishlistOutput extends Wishlist {
|
|
44
|
+
}
|
|
45
|
+
interface AddItemToWishlistInput {
|
|
46
|
+
product_variant_id: string;
|
|
47
|
+
id: string;
|
|
48
|
+
}
|
|
49
|
+
interface AddItemToWishlistOutput extends WishlistItem {
|
|
50
|
+
}
|
|
51
|
+
interface ListWishlistsInput extends PaginatedInput {
|
|
52
|
+
items_fields?: string[];
|
|
53
|
+
}
|
|
54
|
+
interface ListWishlistsOutput extends PaginatedOutput<Wishlist> {
|
|
55
|
+
}
|
|
56
|
+
interface RetrieveWishlistInput {
|
|
57
|
+
id: string;
|
|
58
|
+
items_fields?: string[];
|
|
59
|
+
}
|
|
60
|
+
interface RetrieveWishlistOutput extends Wishlist {
|
|
61
|
+
}
|
|
62
|
+
interface ListItemsInput extends PaginatedInput {
|
|
63
|
+
id: string;
|
|
64
|
+
}
|
|
65
|
+
interface ListItemsOutput extends PaginatedOutput<WishlistItem> {
|
|
66
|
+
}
|
|
67
|
+
interface TotalItemsCountInput {
|
|
68
|
+
wishlist_id?: string;
|
|
69
|
+
}
|
|
70
|
+
interface TotalItemsCountOutput {
|
|
71
|
+
total_items_count: number;
|
|
72
|
+
}
|
|
73
|
+
interface TransferWishlistInput {
|
|
74
|
+
id: string;
|
|
75
|
+
}
|
|
76
|
+
interface TransferWishlistOutput {
|
|
77
|
+
id: string;
|
|
78
|
+
}
|
|
79
|
+
interface UpdateWishlistInput {
|
|
80
|
+
id: string;
|
|
81
|
+
name?: string;
|
|
82
|
+
}
|
|
83
|
+
interface UpdateWishlistOutput extends Omit<Wishlist, 'items'> {
|
|
84
|
+
}
|
|
85
|
+
interface RemoveItemFromWishlistInput {
|
|
86
|
+
wishlist_item_id: string;
|
|
87
|
+
id: string;
|
|
88
|
+
}
|
|
89
|
+
interface RemoveItemFromWishlistOutput {
|
|
90
|
+
id: string;
|
|
91
|
+
}
|
|
92
|
+
interface DeleteWishlistInput {
|
|
93
|
+
id: string;
|
|
94
|
+
}
|
|
95
|
+
interface DeleteWishlistOutput {
|
|
96
|
+
id: string;
|
|
97
|
+
}
|
|
98
|
+
type WishlistEndpoints = {
|
|
99
|
+
create: (input: CreateWishlistInput, headers?: ClientHeaders) => Promise<CreateWishlistOutput>;
|
|
100
|
+
addItem: (input: AddItemToWishlistInput, headers?: ClientHeaders) => Promise<AddItemToWishlistOutput>;
|
|
101
|
+
list: (input: ListWishlistsInput, headers?: ClientHeaders) => Promise<ListWishlistsOutput>;
|
|
102
|
+
listItems: (input: ListItemsInput, headers?: ClientHeaders) => Promise<ListItemsOutput>;
|
|
103
|
+
retrieve: (input: RetrieveWishlistInput, headers?: ClientHeaders) => Promise<RetrieveWishlistOutput>;
|
|
104
|
+
transfer: (input: TransferWishlistInput, headers?: ClientHeaders) => Promise<TransferWishlistOutput>;
|
|
105
|
+
update: (input: UpdateWishlistInput, headers?: ClientHeaders) => Promise<UpdateWishlistOutput>;
|
|
106
|
+
delete: (input: DeleteWishlistInput, headers?: ClientHeaders) => Promise<DeleteWishlistOutput>;
|
|
107
|
+
removeItem: (input: RemoveItemFromWishlistInput, headers?: ClientHeaders) => Promise<RemoveItemFromWishlistOutput>;
|
|
108
|
+
totalItemsCount: (input: TotalItemsCountInput, headers?: ClientHeaders) => Promise<TotalItemsCountOutput>;
|
|
109
|
+
};
|
|
110
|
+
declare const wishlistPlugin: Plugin<'wishlist', WishlistEndpoints>;
|
|
111
|
+
|
|
112
|
+
interface CreateClientTokenOutput {
|
|
113
|
+
client_token: string;
|
|
114
|
+
}
|
|
115
|
+
type PaypalEndpoints = {
|
|
116
|
+
createClientToken: (headers?: ClientHeaders) => Promise<CreateClientTokenOutput>;
|
|
117
|
+
};
|
|
118
|
+
declare const paypalPlugin: Plugin<'paypal', PaypalEndpoints>;
|
|
119
|
+
|
|
120
|
+
interface AggregateCounts {
|
|
121
|
+
average: number;
|
|
122
|
+
counts: {
|
|
123
|
+
rating: number;
|
|
124
|
+
count: number;
|
|
125
|
+
}[];
|
|
126
|
+
product_id: string;
|
|
127
|
+
total_count: number;
|
|
128
|
+
}
|
|
129
|
+
interface Review {
|
|
130
|
+
title: string;
|
|
131
|
+
content: string;
|
|
132
|
+
rating: number;
|
|
133
|
+
id: string;
|
|
134
|
+
created_at: string;
|
|
135
|
+
image_urls: string[];
|
|
136
|
+
is_verified_purchase: boolean;
|
|
137
|
+
product_id: string;
|
|
138
|
+
customer: Pick<CustomerDTO, 'first_name' | 'last_name'>;
|
|
139
|
+
product?: Pick<ProductDTO, 'thumbnail' | 'title' | 'handle' | 'id'> & AggregateCounts;
|
|
140
|
+
}
|
|
141
|
+
interface CreateReviewInput {
|
|
142
|
+
content: string;
|
|
143
|
+
rating: number;
|
|
144
|
+
product_id: string;
|
|
145
|
+
image_base64s: string[];
|
|
146
|
+
title?: string;
|
|
147
|
+
}
|
|
148
|
+
interface CreateReviewOutput extends Review {
|
|
149
|
+
}
|
|
150
|
+
interface ListReviewsInput extends PaginatedInput {
|
|
151
|
+
product_ids?: string[];
|
|
152
|
+
my_reviews_only?: boolean;
|
|
153
|
+
verified_purchase_only?: boolean;
|
|
154
|
+
rating?: number;
|
|
155
|
+
include_product?: boolean;
|
|
156
|
+
}
|
|
157
|
+
interface ListReviewsOutput extends PaginatedOutput<Review> {
|
|
158
|
+
}
|
|
159
|
+
interface ListProductReviewsInput extends PaginatedInput {
|
|
160
|
+
product_id: string;
|
|
161
|
+
my_reviews_only?: boolean;
|
|
162
|
+
verified_purchase_only?: boolean;
|
|
163
|
+
sort?: 'created_at' | 'rating';
|
|
164
|
+
order?: 'asc' | 'desc';
|
|
165
|
+
rating?: number;
|
|
166
|
+
include_product?: boolean;
|
|
167
|
+
}
|
|
168
|
+
interface ListProductReviewsOutput extends PaginatedOutput<Review> {
|
|
169
|
+
}
|
|
170
|
+
interface DeleteReviewInput {
|
|
171
|
+
id: string;
|
|
172
|
+
}
|
|
173
|
+
interface DeleteReviewOutput {
|
|
174
|
+
id: string;
|
|
175
|
+
}
|
|
176
|
+
interface AggregateCountsInput {
|
|
177
|
+
product_id: string;
|
|
178
|
+
verified_purchase_only?: boolean;
|
|
179
|
+
}
|
|
180
|
+
interface AggregateCountsOutput extends AggregateCounts {
|
|
181
|
+
}
|
|
182
|
+
type ReviewsEndpoints = {
|
|
183
|
+
create: (input: CreateReviewInput, headers?: ClientHeaders) => Promise<CreateReviewOutput>;
|
|
184
|
+
list: (input: ListReviewsInput, headers?: ClientHeaders) => Promise<ListReviewsOutput>;
|
|
185
|
+
listProductReviews: (input: ListProductReviewsInput, headers?: ClientHeaders) => Promise<ListProductReviewsOutput>;
|
|
186
|
+
delete: (input: DeleteReviewInput, headers?: ClientHeaders) => Promise<DeleteReviewOutput>;
|
|
187
|
+
aggregateCounts: (input: AggregateCountsInput, headers?: ClientHeaders) => Promise<AggregateCountsOutput>;
|
|
188
|
+
};
|
|
189
|
+
declare const reviewsPlugin: Plugin<'reviews', ReviewsEndpoints>;
|
|
190
|
+
|
|
191
|
+
type AlphabiteClientOptions = {
|
|
192
|
+
getAuthHeader?: () => Promise<Record<string, string>> | Record<string, string>;
|
|
193
|
+
};
|
|
194
|
+
type Plugin<Name extends string, Endpoints> = {
|
|
195
|
+
name: Name;
|
|
196
|
+
endpoints: (client: any, options?: AlphabiteClientOptions) => Endpoints;
|
|
197
|
+
};
|
|
198
|
+
type PluginsToAlphabite<T extends readonly Plugin<any, any>[]> = {
|
|
199
|
+
[K in T[number] as K['name']]: ReturnType<K['endpoints']>;
|
|
200
|
+
};
|
|
201
|
+
declare class AlphabiteMedusaSdk<TPlugins extends readonly Plugin<any, any>[], TOptions extends AlphabiteClientOptions = AlphabiteClientOptions> extends Medusa {
|
|
202
|
+
alphabite: PluginsToAlphabite<TPlugins>;
|
|
203
|
+
protected options?: TOptions;
|
|
204
|
+
constructor(medusaOptions: ConstructorParameters<typeof Medusa>[0], plugins: TPlugins, options?: TOptions);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
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 ListItemsInput, type ListItemsOutput, type ListProductReviewsInput, type ListProductReviewsOutput, type ListReviewsInput, type ListReviewsOutput, type ListWishlistsInput, type ListWishlistsOutput, type Plugin, type PluginsToAlphabite, type RemoveItemFromWishlistInput, type RemoveItemFromWishlistOutput, type RetrieveWishlistInput, type RetrieveWishlistOutput, type Review, type TotalItemsCountInput, type TotalItemsCountOutput, type TransferWishlistInput, type TransferWishlistOutput, type UpdateWishlistInput, type UpdateWishlistOutput, type Wishlist, type WishlistItem, paypalPlugin, reviewsPlugin, wishlistPlugin };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var d=require('@medusajs/js-sdk');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var d__default=/*#__PURE__*/_interopDefault(d);var p={name:"wishlist",endpoints:(r,i)=>({create:async({name:e,sales_channel_id:t},s)=>r.client.fetch("/store/wishlists",{method:"POST",body:{name:e,sales_channel_id:t},headers:{...await i?.getAuthHeader?.(),...s}}),addItem:async({product_variant_id:e,id:t},s)=>r.client.fetch(`/store/wishlists/${t}/add-item`,{method:"POST",body:{product_variant_id:e},headers:{...await i?.getAuthHeader?.(),...s}}),list:async({limit:e=10,offset:t=0,order:s,fields:n,items_fields:a},o)=>r.client.fetch("/store/wishlists",{method:"GET",headers:{...await i?.getAuthHeader?.(),...o},query:{limit:e,offset:t,order:s,fields:n,items_fields:a}}),listItems:async({id:e,limit:t=10,offset:s=0,fields:n,order:a},o)=>r.client.fetch(`/store/wishlists/${e}/items`,{method:"GET",headers:{...await i?.getAuthHeader?.(),...o},query:{limit:t,offset:s,order:a,fields:n}}),retrieve:async({id:e,items_fields:t},s)=>r.client.fetch(`/store/wishlists/${e}`,{method:"GET",headers:{...await i?.getAuthHeader?.(),...s},query:{items_fields:t}}),transfer:async({id:e},t)=>r.client.fetch(`/store/wishlists/${e}/transfer`,{method:"POST",headers:{...await i?.getAuthHeader?.(),...t}}),update:async({id:e,...t},s)=>r.client.fetch(`/store/wishlists/${e}`,{method:"PUT",body:t,headers:{...await i?.getAuthHeader?.(),...s}}),removeItem:async({wishlist_item_id:e,id:t},s)=>r.client.fetch(`/store/wishlists/${t}/items/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...s}}),delete:async({id:e},t)=>r.client.fetch(`/store/wishlists/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...t}}),totalItemsCount:async({wishlist_id:e},t)=>r.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:{wishlist_id:e}})})};var c={name:"paypal",endpoints:(r,i)=>({createClientToken:async e=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await i?.getAuthHeader?.(),...e}})})};var m={name:"reviews",endpoints:(r,i)=>({create:async(e,t)=>r.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),list:async({...e},t)=>r.client.fetch("/store/products/reviews",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:e}),listProductReviews:async({product_id:e,...t},s)=>r.client.fetch(`store/reviews/product/${e}`,{method:"GET",query:t,headers:{...await i?.getAuthHeader?.(),...s}}),delete:async({id:e},t)=>r.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...t}}),aggregateCounts:async({product_id:e,...t},s)=>r.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:t,headers:{...await i?.getAuthHeader?.(),...s}})})};var u=class extends d__default.default{constructor(i,e,t){super(i),this.options=t;let s={};e.forEach(n=>{s[n.name]=n.endpoints(this,this.options);}),this.alphabite=s;}};exports.AlphabiteMedusaSdk=u;exports.paypalPlugin=c;exports.reviewsPlugin=m;exports.wishlistPlugin=p;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import d from'@medusajs/js-sdk';var p={name:"wishlist",endpoints:(r,i)=>({create:async({name:e,sales_channel_id:t},s)=>r.client.fetch("/store/wishlists",{method:"POST",body:{name:e,sales_channel_id:t},headers:{...await i?.getAuthHeader?.(),...s}}),addItem:async({product_variant_id:e,id:t},s)=>r.client.fetch(`/store/wishlists/${t}/add-item`,{method:"POST",body:{product_variant_id:e},headers:{...await i?.getAuthHeader?.(),...s}}),list:async({limit:e=10,offset:t=0,order:s,fields:n,items_fields:a},o)=>r.client.fetch("/store/wishlists",{method:"GET",headers:{...await i?.getAuthHeader?.(),...o},query:{limit:e,offset:t,order:s,fields:n,items_fields:a}}),listItems:async({id:e,limit:t=10,offset:s=0,fields:n,order:a},o)=>r.client.fetch(`/store/wishlists/${e}/items`,{method:"GET",headers:{...await i?.getAuthHeader?.(),...o},query:{limit:t,offset:s,order:a,fields:n}}),retrieve:async({id:e,items_fields:t},s)=>r.client.fetch(`/store/wishlists/${e}`,{method:"GET",headers:{...await i?.getAuthHeader?.(),...s},query:{items_fields:t}}),transfer:async({id:e},t)=>r.client.fetch(`/store/wishlists/${e}/transfer`,{method:"POST",headers:{...await i?.getAuthHeader?.(),...t}}),update:async({id:e,...t},s)=>r.client.fetch(`/store/wishlists/${e}`,{method:"PUT",body:t,headers:{...await i?.getAuthHeader?.(),...s}}),removeItem:async({wishlist_item_id:e,id:t},s)=>r.client.fetch(`/store/wishlists/${t}/items/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...s}}),delete:async({id:e},t)=>r.client.fetch(`/store/wishlists/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...t}}),totalItemsCount:async({wishlist_id:e},t)=>r.client.fetch("store/wishlists/total-items-count",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:{wishlist_id:e}})})};var c={name:"paypal",endpoints:(r,i)=>({createClientToken:async e=>r.client.fetch("/store/paypal/client-token",{method:"POST",headers:{...await i?.getAuthHeader?.(),...e}})})};var m={name:"reviews",endpoints:(r,i)=>({create:async(e,t)=>r.client.fetch("/store/reviews",{method:"POST",body:e,headers:{...await i?.getAuthHeader?.(),...t}}),list:async({...e},t)=>r.client.fetch("/store/products/reviews",{method:"GET",headers:{...await i?.getAuthHeader?.(),...t},query:e}),listProductReviews:async({product_id:e,...t},s)=>r.client.fetch(`store/reviews/product/${e}`,{method:"GET",query:t,headers:{...await i?.getAuthHeader?.(),...s}}),delete:async({id:e},t)=>r.client.fetch(`/store/reviews/${e}`,{method:"DELETE",headers:{...await i?.getAuthHeader?.(),...t}}),aggregateCounts:async({product_id:e,...t},s)=>r.client.fetch(`/store/reviews/product/${e}/aggregate-counts`,{method:"GET",query:t,headers:{...await i?.getAuthHeader?.(),...s}})})};var u=class extends d{constructor(i,e,t){super(i),this.options=t;let s={};e.forEach(n=>{s[n.name]=n.endpoints(this,this.options);}),this.alphabite=s;}};export{u as AlphabiteMedusaSdk,c as paypalPlugin,m as reviewsPlugin,p as wishlistPlugin};
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alphabite/medusa-sdk",
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Extended Medusa utility sdk client, that adds Alphabite's plugins endpoints",
|
|
5
|
+
"author": "Alphabite",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://github.com/alphabite-soft/medusa-client/issues"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/alphabite-soft/medusa-client#readme",
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"module": "dist/index.mjs",
|
|
13
|
+
"types": "dist/index.d.ts",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"!src"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsup",
|
|
20
|
+
"lint": "eslint src --ext .ts",
|
|
21
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
22
|
+
"publish:public": "npm publish --access public"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"medusa client",
|
|
26
|
+
"alphabite medusa client",
|
|
27
|
+
"medusa v2",
|
|
28
|
+
"medusa other"
|
|
29
|
+
],
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@medusajs/js-sdk": "^2.8.3",
|
|
32
|
+
"@medusajs/types": "^2.8.3",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
34
|
+
"@typescript-eslint/parser": "^5.62.0",
|
|
35
|
+
"eslint": "^8.57.0",
|
|
36
|
+
"prettier": "^3",
|
|
37
|
+
"tsup": "^8.5.0",
|
|
38
|
+
"typescript": "^5"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@medusajs/js-sdk": "^2.8.3",
|
|
42
|
+
"@medusajs/types": "^2.8.3"
|
|
43
|
+
},
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+ssh://git@github.com/alphabite-soft/medusa-client.git"
|
|
47
|
+
},
|
|
48
|
+
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
|
|
49
|
+
}
|