@medusajs/js-sdk 0.0.2-snapshot-20240520162050 → 0.0.2-snapshot-20240521080659
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/store/index.d.ts +49 -18
- package/dist/store/index.js +11 -10
- package/dist/store/index.js.map +1 -1
- package/dist/types.d.ts +3 -1
- package/package.json +2 -2
package/dist/store/index.d.ts
CHANGED
@@ -14,7 +14,7 @@ export declare class Store {
|
|
14
14
|
};
|
15
15
|
collection: {
|
16
16
|
list: (query?: FindParams & HttpTypes.StoreCollectionFilters, headers?: ClientHeaders) => Promise<HttpTypes.PaginatedResponse<{
|
17
|
-
collections: HttpTypes.StoreCollection;
|
17
|
+
collections: HttpTypes.StoreCollection[];
|
18
18
|
}>>;
|
19
19
|
retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
20
20
|
collection: HttpTypes.StoreCollection;
|
@@ -22,38 +22,69 @@ export declare class Store {
|
|
22
22
|
};
|
23
23
|
category: {
|
24
24
|
list: (query?: FindParams & HttpTypes.StoreProductCategoryFilters, headers?: ClientHeaders) => Promise<HttpTypes.PaginatedResponse<{
|
25
|
-
|
25
|
+
product_categories: HttpTypes.StoreProductCategory[];
|
26
26
|
}>>;
|
27
27
|
retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
28
|
-
|
28
|
+
product_category: HttpTypes.StoreProductCategory;
|
29
29
|
}>;
|
30
30
|
};
|
31
31
|
product: {
|
32
32
|
list: (query?: FindParams & HttpTypes.StoreProductFilters, headers?: ClientHeaders) => Promise<HttpTypes.PaginatedResponse<{
|
33
|
-
products: HttpTypes.StoreProduct;
|
33
|
+
products: HttpTypes.StoreProduct[];
|
34
34
|
}>>;
|
35
35
|
retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
36
36
|
product: HttpTypes.StoreProduct;
|
37
37
|
}>;
|
38
38
|
};
|
39
|
-
order: {
|
40
|
-
retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<any>;
|
41
|
-
};
|
42
39
|
cart: {
|
43
|
-
create: (body:
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
40
|
+
create: (body: HttpTypes.StoreCreateCart, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
41
|
+
cart: HttpTypes.StoreCart;
|
42
|
+
}>;
|
43
|
+
update: (id: string, body: HttpTypes.StoreUpdateCart, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
44
|
+
cart: HttpTypes.StoreCart;
|
45
|
+
}>;
|
46
|
+
retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
47
|
+
cart: HttpTypes.StoreCart;
|
48
|
+
}>;
|
49
|
+
createLineItem: (cartId: string, body: HttpTypes.StoreAddCartLineItem, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
50
|
+
cart: HttpTypes.StoreCart;
|
51
|
+
}>;
|
52
|
+
updateLineItem: (cartId: string, lineItemId: string, body: HttpTypes.StoreUpdateCartLineItem, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
53
|
+
cart: HttpTypes.StoreCart;
|
54
|
+
}>;
|
55
|
+
deleteLineItem: (cartId: string, lineItemId: string, headers?: ClientHeaders) => Promise<HttpTypes.DeleteResponse<"line-item", HttpTypes.StoreCart>>;
|
56
|
+
addShippingMethod: (cartId: string, body: HttpTypes.StoreAddCartShippingMethods, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
57
|
+
cart: HttpTypes.StoreCart;
|
58
|
+
}>;
|
59
|
+
complete: (cartId: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
60
|
+
type: "order";
|
61
|
+
order: HttpTypes.StoreOrder;
|
62
|
+
} | {
|
63
|
+
type: "cart";
|
64
|
+
cart: HttpTypes.StoreCart;
|
65
|
+
error: {
|
66
|
+
message: string;
|
67
|
+
name: string;
|
68
|
+
type: string;
|
69
|
+
};
|
70
|
+
}>;
|
51
71
|
};
|
52
72
|
fulfillment: {
|
53
|
-
listCartOptions: (query?:
|
73
|
+
listCartOptions: (query?: FindParams & {
|
74
|
+
cart_id: string;
|
75
|
+
}, headers?: ClientHeaders) => Promise<any>;
|
54
76
|
};
|
55
77
|
payment: {
|
56
|
-
listPaymentProviders: (query?:
|
57
|
-
|
78
|
+
listPaymentProviders: (query?: FindParams & HttpTypes.StorePaymentProviderFilters, headers?: ClientHeaders) => Promise<{
|
79
|
+
payment_providers: HttpTypes.StorePaymentProvider[];
|
80
|
+
}>;
|
81
|
+
initiatePaymentSession: (cart: HttpTypes.StoreCart, body: Record<string, any>, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
82
|
+
payment_collection: HttpTypes.StorePaymentCollection;
|
83
|
+
}>;
|
84
|
+
};
|
85
|
+
order: {
|
86
|
+
retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
87
|
+
order: HttpTypes.StoreOrder;
|
88
|
+
}>;
|
58
89
|
};
|
59
90
|
}
|
package/dist/store/index.js
CHANGED
@@ -56,14 +56,6 @@ export class Store {
|
|
56
56
|
});
|
57
57
|
},
|
58
58
|
};
|
59
|
-
this.order = {
|
60
|
-
retrieve: async (id, query, headers) => {
|
61
|
-
return this.client.fetch(`/store/orders/${id}`, {
|
62
|
-
query,
|
63
|
-
headers,
|
64
|
-
});
|
65
|
-
},
|
66
|
-
};
|
67
59
|
this.cart = {
|
68
60
|
create: async (body, query, headers) => {
|
69
61
|
return this.client.fetch(`/store/carts`, {
|
@@ -126,18 +118,19 @@ export class Store {
|
|
126
118
|
},
|
127
119
|
};
|
128
120
|
this.fulfillment = {
|
121
|
+
// TODO: Finalize typings for list options
|
129
122
|
listCartOptions: async (query, headers) => {
|
130
123
|
return this.client.fetch(`/store/shipping-options`, {
|
131
|
-
query,
|
132
124
|
headers,
|
125
|
+
query,
|
133
126
|
});
|
134
127
|
},
|
135
128
|
};
|
136
129
|
this.payment = {
|
137
130
|
listPaymentProviders: async (query, headers) => {
|
138
131
|
return this.client.fetch(`/store/payment-providers`, {
|
139
|
-
query,
|
140
132
|
headers,
|
133
|
+
query,
|
141
134
|
});
|
142
135
|
},
|
143
136
|
initiatePaymentSession: async (cart, body, query, headers) => {
|
@@ -163,6 +156,14 @@ export class Store {
|
|
163
156
|
});
|
164
157
|
},
|
165
158
|
};
|
159
|
+
this.order = {
|
160
|
+
retrieve: async (id, query, headers) => {
|
161
|
+
return this.client.fetch(`/store/orders/${id}`, {
|
162
|
+
headers,
|
163
|
+
query,
|
164
|
+
});
|
165
|
+
},
|
166
|
+
};
|
166
167
|
this.client = client;
|
167
168
|
}
|
168
169
|
}
|
package/dist/store/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,KAAK;IAGhB,YAAY,MAAc;QAInB,WAAM,GAAG;YACd,IAAI,EAAE,KAAK,EACT,KAAiD,EACjD,OAAuB,EACvB,EAAE;gBACF,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAEtB,gBAAgB,EAAE;oBAClB,KAAK;oBACL,OAAO;iBACR,CAAC,CAAA;YACJ,CAAC;YACD,QAAQ,EAAE,KAAK,EACb,EAAU,EACV,KAAoB,EACpB,OAAuB,EACvB,EAAE;gBACF,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,kBAAkB,EAAE,EAAE,EACtB;oBACE,KAAK;oBACL,OAAO;iBACR,CACF,CAAA;YACH,CAAC;SACF,CAAA;QAEM,eAAU,GAAG;YAClB,IAAI,EAAE,KAAK,EACT,KAAqD,EACrD,OAAuB,EACvB,EAAE;gBACF,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAEtB,oBAAoB,EAAE;oBACtB,KAAK;oBACL,OAAO;iBACR,CAAC,CAAA;YACJ,CAAC;YACD,QAAQ,EAAE,KAAK,EACb,EAA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,aAAa;wBACjC,MAAM,EAAE,IAAI,CAAC,KAAK;qBACnB,CAAA;oBACD,mBAAmB,GAAG,CACpB,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAEpB,4BAA4B,EAAE;wBAC/B,MAAM,EAAE,MAAM;wBACd,OAAO;wBACP,IAAI,EAAE,cAAc;qBACrB,CAAC,CACH,CAAC,kBAAkB,CAAC,EAAE,CAAA;gBACzB,CAAC;gBAED,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAErB,8BAA8B,mBAAmB,mBAAmB,EAAE;oBACvE,MAAM,EAAE,MAAM;oBACd,OAAO;oBACP,IAAI;oBACJ,KAAK;iBACN,CAAC,CAAA;YACJ,CAAC;SACF,CAAA;QAEM,UAAK,GAAG;YACb,QAAQ,EAAE,KAAK,EACb,EAAU,EACV,KAAoB,EACpB,OAAuB,EACvB,EAAE;gBACF,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,iBAAiB,EAAE,EAAE,EACrB;oBACE,OAAO;oBACP,KAAK;iBACN,CACF,CAAA;YACH,CAAC;SACF,CAAA;QA3TC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CA2TF"}
|
package/dist/types.d.ts
CHANGED
@@ -18,7 +18,9 @@ export type Config = {
|
|
18
18
|
debug?: boolean;
|
19
19
|
};
|
20
20
|
export type FetchParams = Parameters<typeof fetch>;
|
21
|
-
export type ClientHeaders = Record<string, string
|
21
|
+
export type ClientHeaders = Record<string, string | {
|
22
|
+
tags: string[];
|
23
|
+
}>;
|
22
24
|
export type FetchInput = FetchParams[0];
|
23
25
|
export type FetchArgs = Omit<RequestInit, "headers" | "body"> & {
|
24
26
|
query?: Record<string, any>;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@medusajs/js-sdk",
|
3
|
-
"version": "0.0.2-snapshot-
|
3
|
+
"version": "0.0.2-snapshot-20240521080659",
|
4
4
|
"description": "SDK for the Medusa API",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"repository": {
|
@@ -28,7 +28,7 @@
|
|
28
28
|
"typescript": "^5.1.6"
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
|
-
"@medusajs/types": "1.12.0-snapshot-
|
31
|
+
"@medusajs/types": "1.12.0-snapshot-20240521080659",
|
32
32
|
"qs": "^6.12.1"
|
33
33
|
},
|
34
34
|
"scripts": {
|