@medusajs/js-sdk 0.0.2-snapshot-20240516152256 → 0.0.2-snapshot-20240520151134
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/admin/index.d.ts +17 -0
- package/dist/admin/index.js +36 -0
- package/dist/admin/index.js.map +1 -1
- package/dist/auth/index.d.ts +2 -1
- package/dist/auth/index.js +10 -3
- package/dist/auth/index.js.map +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.js +27 -6
- package/dist/client.js.map +1 -1
- package/dist/store/index.d.ts +68 -22
- package/dist/store/index.js +53 -46
- package/dist/store/index.js.map +1 -1
- package/package.json +2 -2
package/dist/admin/index.d.ts
CHANGED
@@ -1,5 +1,22 @@
|
|
1
|
+
import { DeleteResponse, FindParams, HttpTypes, SelectParams } from "@medusajs/types";
|
1
2
|
import { Client } from "../client";
|
3
|
+
import { ClientHeaders } from "../types";
|
2
4
|
export declare class Admin {
|
3
5
|
private client;
|
4
6
|
constructor(client: Client);
|
7
|
+
region: {
|
8
|
+
create: (body: HttpTypes.AdminCreateRegion, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
9
|
+
region: HttpTypes.AdminRegion;
|
10
|
+
}>;
|
11
|
+
update: (id: string, body: HttpTypes.AdminUpdateRegion, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
12
|
+
region: HttpTypes.AdminRegion;
|
13
|
+
}>;
|
14
|
+
list: (queryParams?: FindParams & HttpTypes.AdminRegionFilters, headers?: ClientHeaders) => Promise<HttpTypes.PaginatedResponse<{
|
15
|
+
regions: HttpTypes.AdminRegion[];
|
16
|
+
}>>;
|
17
|
+
retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
18
|
+
region: HttpTypes.AdminRegion;
|
19
|
+
}>;
|
20
|
+
delete: (id: string, headers?: ClientHeaders) => Promise<DeleteResponse<"region">>;
|
21
|
+
};
|
5
22
|
}
|
package/dist/admin/index.js
CHANGED
@@ -1,5 +1,41 @@
|
|
1
1
|
export class Admin {
|
2
2
|
constructor(client) {
|
3
|
+
this.region = {
|
4
|
+
create: async (body, query, headers) => {
|
5
|
+
return this.client.fetch(`/admin/regions`, {
|
6
|
+
method: "POST",
|
7
|
+
headers,
|
8
|
+
body,
|
9
|
+
query,
|
10
|
+
});
|
11
|
+
},
|
12
|
+
update: async (id, body, query, headers) => {
|
13
|
+
return this.client.fetch(`/admin/regions/${id}`, {
|
14
|
+
method: "POST",
|
15
|
+
headers,
|
16
|
+
body,
|
17
|
+
query,
|
18
|
+
});
|
19
|
+
},
|
20
|
+
list: async (queryParams, headers) => {
|
21
|
+
return this.client.fetch(`/admin/regions`, {
|
22
|
+
query: queryParams,
|
23
|
+
headers,
|
24
|
+
});
|
25
|
+
},
|
26
|
+
retrieve: async (id, query, headers) => {
|
27
|
+
return this.client.fetch(`/admin/regions/${id}`, {
|
28
|
+
query,
|
29
|
+
headers,
|
30
|
+
});
|
31
|
+
},
|
32
|
+
delete: async (id, headers) => {
|
33
|
+
return this.client.fetch(`/admin/regions/${id}`, {
|
34
|
+
method: "DELETE",
|
35
|
+
headers,
|
36
|
+
});
|
37
|
+
},
|
38
|
+
};
|
3
39
|
this.client = client;
|
4
40
|
}
|
5
41
|
}
|
package/dist/admin/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,KAAK;IAEhB,YAAY,MAAc;QAInB,WAAM,GAAG;YACd,MAAM,EAAE,KAAK,EACX,IAAiC,EACjC,KAAoB,EACpB,OAAuB,EACvB,EAAE;gBACF,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,gBAAgB,EAChB;oBACE,MAAM,EAAE,MAAM;oBACd,OAAO;oBACP,IAAI;oBACJ,KAAK;iBACN,CACF,CAAA;YACH,CAAC;YACD,MAAM,EAAE,KAAK,EACX,EAAU,EACV,IAAiC,EACjC,KAAoB,EACpB,OAAuB,EACvB,EAAE;gBACF,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,kBAAkB,EAAE,EAAE,EACtB;oBACE,MAAM,EAAE,MAAM;oBACd,OAAO;oBACP,IAAI;oBACJ,KAAK;iBACN,CACF,CAAA;YACH,CAAC;YACD,IAAI,EAAE,KAAK,EACT,WAAuD,EACvD,OAAuB,EACvB,EAAE;gBACF,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAEtB,gBAAgB,EAAE;oBAClB,KAAK,EAAE,WAAW;oBAClB,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;YACD,MAAM,EAAE,KAAK,EAAE,EAAU,EAAE,OAAuB,EAAE,EAAE;gBACpD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,kBAAkB,EAAE,EAAE,EACtB;oBACE,MAAM,EAAE,QAAQ;oBAChB,OAAO;iBACR,CACF,CAAA;YACH,CAAC;SACF,CAAA;QApEC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CAoEF"}
|
package/dist/auth/index.d.ts
CHANGED
@@ -4,8 +4,9 @@ export declare class Auth {
|
|
4
4
|
private client;
|
5
5
|
private config;
|
6
6
|
constructor(client: Client, config: Config);
|
7
|
-
login: (payload: {
|
7
|
+
login: (scope: "admin" | "store", method: "emailpass", payload: {
|
8
8
|
email: string;
|
9
9
|
password: string;
|
10
10
|
}) => Promise<void>;
|
11
|
+
logout: () => Promise<void>;
|
11
12
|
}
|
package/dist/auth/index.js
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
export class Auth {
|
2
2
|
constructor(client, config) {
|
3
|
-
this.login = async (payload) => {
|
4
|
-
|
5
|
-
const { token } = await this.client.fetch("/auth/admin/emailpass", {
|
3
|
+
this.login = async (scope, method, payload) => {
|
4
|
+
const { token } = await this.client.fetch(`/auth/${scope}/${method}`, {
|
6
5
|
method: "POST",
|
7
6
|
body: payload,
|
8
7
|
});
|
@@ -17,6 +16,14 @@ export class Auth {
|
|
17
16
|
this.client.setToken(token);
|
18
17
|
}
|
19
18
|
};
|
19
|
+
this.logout = async () => {
|
20
|
+
if (this.config?.auth?.type === "session") {
|
21
|
+
await this.client.fetch("/auth/session", {
|
22
|
+
method: "DELETE",
|
23
|
+
});
|
24
|
+
}
|
25
|
+
this.client.clearToken();
|
26
|
+
};
|
20
27
|
this.client = client;
|
21
28
|
this.config = config;
|
22
29
|
}
|
package/dist/auth/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,IAAI;IAIf,YAAY,MAAc,EAAE,MAAc;QAK1C,UAAK,GAAG,KAAK,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,IAAI;IAIf,YAAY,MAAc,EAAE,MAAc;QAK1C,UAAK,GAAG,KAAK,EACX,KAAwB,EACxB,MAAmB,EACnB,OAA4C,EAC5C,EAAE;YACF,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CACvC,SAAS,KAAK,IAAI,MAAM,EAAE,EAC1B;gBACE,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,OAAO;aACd,CACF,CAAA;YAED,wHAAwH;YACxH,IAAI,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,SAAS,EAAE,CAAC;gBAC1C,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE;oBACvC,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE;iBAC9C,CAAC,CAAA;YACJ,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;YAC7B,CAAC;QACH,CAAC,CAAA;QAED,WAAM,GAAG,KAAK,IAAI,EAAE;YAClB,IAAI,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,SAAS,EAAE,CAAC;gBAC1C,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE;oBACvC,MAAM,EAAE,QAAQ;iBACjB,CAAC,CAAA;YACJ,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAA;QAC1B,CAAC,CAAA;QApCC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CAmCF"}
|
package/dist/client.d.ts
CHANGED
@@ -24,6 +24,8 @@ export declare class Client {
|
|
24
24
|
*/
|
25
25
|
fetch<T extends any>(input: FetchInput, init?: FetchArgs): Promise<T>;
|
26
26
|
setToken(token: string): void;
|
27
|
+
clearToken(): void;
|
28
|
+
protected clearToken_(): void;
|
27
29
|
protected initClient(): ClientFetch;
|
28
30
|
protected getApiKeyHeader_: () => {
|
29
31
|
Authorization: string;
|
package/dist/client.js
CHANGED
@@ -100,13 +100,14 @@ export class Client {
|
|
100
100
|
return;
|
101
101
|
};
|
102
102
|
this.getTokenStorageInfo_ = () => {
|
103
|
-
const
|
104
|
-
|
103
|
+
const hasLocal = hasStorage("localStorage");
|
104
|
+
const hasSession = hasStorage("sessionStorage");
|
105
|
+
const storageMethod = this.config.auth?.jwtTokenStorageMethod || (hasLocal ? "local" : "memory");
|
105
106
|
const storageKey = this.config.auth?.jwtTokenStorageKey || this.DEFAULT_JWT_STORAGE_KEY;
|
106
|
-
if (!
|
107
|
+
if (!hasLocal && storageMethod === "local") {
|
107
108
|
throw new Error("Local JWT storage is only available in the browser");
|
108
109
|
}
|
109
|
-
if (!
|
110
|
+
if (!hasSession && storageMethod === "session") {
|
110
111
|
throw new Error("Session JWT storage is only available in the browser");
|
111
112
|
}
|
112
113
|
return {
|
@@ -145,6 +146,26 @@ export class Client {
|
|
145
146
|
setToken(token) {
|
146
147
|
this.setToken_(token);
|
147
148
|
}
|
149
|
+
clearToken() {
|
150
|
+
this.clearToken_();
|
151
|
+
}
|
152
|
+
clearToken_() {
|
153
|
+
const { storageMethod, storageKey } = this.getTokenStorageInfo_();
|
154
|
+
switch (storageMethod) {
|
155
|
+
case "local": {
|
156
|
+
window.localStorage.removeItem(storageKey);
|
157
|
+
break;
|
158
|
+
}
|
159
|
+
case "session": {
|
160
|
+
window.sessionStorage.removeItem(storageKey);
|
161
|
+
break;
|
162
|
+
}
|
163
|
+
case "memory": {
|
164
|
+
this.token = "";
|
165
|
+
break;
|
166
|
+
}
|
167
|
+
}
|
168
|
+
}
|
148
169
|
initClient() {
|
149
170
|
const defaultHeaders = new Headers({
|
150
171
|
"content-type": "application/json",
|
@@ -153,7 +174,7 @@ export class Client {
|
|
153
174
|
...this.getPublishableKeyHeader_(),
|
154
175
|
});
|
155
176
|
this.logger.debug("Initiating Medusa client with default headers:\n", `${JSON.stringify(sanitizeHeaders(defaultHeaders), null, 2)}\n`);
|
156
|
-
return (input, init) => {
|
177
|
+
return async (input, init) => {
|
157
178
|
// We always want to fetch the up-to-date JWT token before firing off a request.
|
158
179
|
const headers = new Headers(defaultHeaders);
|
159
180
|
const customHeaders = {
|
@@ -176,7 +197,7 @@ export class Client {
|
|
176
197
|
}
|
177
198
|
this.logger.debug("Performing request to:\n", `URL: ${normalizedInput.toString()}\n`, `Headers: ${JSON.stringify(sanitizeHeaders(headers), null, 2)}\n`);
|
178
199
|
// Any non-request errors (eg. invalid JSON in the response) will be thrown as-is.
|
179
|
-
return fetch(normalizedInput, normalizeRequest(init, headers, this.config)).then((resp) => {
|
200
|
+
return await fetch(normalizedInput, normalizeRequest(init, headers, this.config)).then((resp) => {
|
180
201
|
this.logger.debug(`Received response with status ${resp.status}\n`);
|
181
202
|
return normalizeResponse(resp, headers);
|
182
203
|
});
|
package/dist/client.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AAGnB,MAAM,UAAU,GAAG,CAAC,OAA0C,EAAE,EAAE;IAChE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,OAAO,IAAI,MAAM,CAAA;IAC1B,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,EAAE;IAC/B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACzB,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAC5C,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC3C,OAAO;QACL,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACxC,aAAa,EAAE,YAAY;KAC5B,CAAA;AACH,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,CACvB,IAA2B,EAC3B,OAAgB,EAChB,MAAc,EACW,EAAE;IAC3B,IAAI,IAAI,GAAG,IAAI,EAAE,IAAI,CAAA;IACrB,IAAI,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACtE,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;I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,EAAE,IAAI,CAAC,MAAM,CAAC,CAC7C,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;gBACd,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAA;gBACnE,OAAO,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;YACzC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAA;IACH,CAAC;CAkFF"}
|
package/dist/store/index.d.ts
CHANGED
@@ -1,42 +1,88 @@
|
|
1
|
+
import { FindParams, HttpTypes, SelectParams } from "@medusajs/types";
|
1
2
|
import { Client } from "../client";
|
2
3
|
import { ClientHeaders } from "../types";
|
3
4
|
export declare class Store {
|
4
5
|
private client;
|
5
6
|
constructor(client: Client);
|
6
7
|
region: {
|
7
|
-
list: (
|
8
|
-
|
8
|
+
list: (query?: FindParams & HttpTypes.StoreRegionFilters, headers?: ClientHeaders) => Promise<HttpTypes.PaginatedResponse<{
|
9
|
+
regions: HttpTypes.StoreRegion[];
|
10
|
+
}>>;
|
11
|
+
retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
12
|
+
region: HttpTypes.StoreRegion;
|
13
|
+
}>;
|
9
14
|
};
|
10
15
|
collection: {
|
11
|
-
list: (
|
12
|
-
|
16
|
+
list: (query?: FindParams & HttpTypes.StoreCollectionFilters, headers?: ClientHeaders) => Promise<HttpTypes.PaginatedResponse<{
|
17
|
+
collections: HttpTypes.StoreCollection;
|
18
|
+
}>>;
|
19
|
+
retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
20
|
+
collection: HttpTypes.StoreCollection;
|
21
|
+
}>;
|
13
22
|
};
|
14
23
|
category: {
|
15
|
-
list: (
|
16
|
-
|
24
|
+
list: (query?: FindParams & HttpTypes.StoreProductCategoryFilters, headers?: ClientHeaders) => Promise<HttpTypes.PaginatedResponse<{
|
25
|
+
categories: HttpTypes.StoreProductCategory;
|
26
|
+
}>>;
|
27
|
+
retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
28
|
+
category: HttpTypes.StoreProductCategory;
|
29
|
+
}>;
|
17
30
|
};
|
18
31
|
product: {
|
19
|
-
list: (
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
32
|
+
list: (query?: FindParams & HttpTypes.StoreProductFilters, headers?: ClientHeaders) => Promise<HttpTypes.PaginatedResponse<{
|
33
|
+
products: HttpTypes.StoreProduct;
|
34
|
+
}>>;
|
35
|
+
retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
36
|
+
product: HttpTypes.StoreProduct;
|
37
|
+
}>;
|
24
38
|
};
|
25
39
|
cart: {
|
26
|
-
create: (body:
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
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
|
+
}>;
|
34
71
|
};
|
35
72
|
fulfillment: {
|
36
|
-
listCartOptions: (
|
73
|
+
listCartOptions: (query?: FindParams, headers?: ClientHeaders) => Promise<any>;
|
37
74
|
};
|
38
75
|
payment: {
|
39
|
-
listPaymentProviders: (
|
40
|
-
|
76
|
+
listPaymentProviders: (query?: FindParams & HttpTypes.StorePaymentProviderFilters, headers?: ClientHeaders) => Promise<{
|
77
|
+
payment_providers: HttpTypes.StorePaymentProvider[];
|
78
|
+
}>;
|
79
|
+
initiatePaymentSession: (cart: HttpTypes.StoreCart, body: Record<string, any>, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
80
|
+
payment_collection: HttpTypes.StorePaymentCollection;
|
81
|
+
}>;
|
82
|
+
};
|
83
|
+
order: {
|
84
|
+
retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
|
85
|
+
order: HttpTypes.StoreOrder;
|
86
|
+
}>;
|
41
87
|
};
|
42
88
|
}
|
package/dist/store/index.js
CHANGED
@@ -1,140 +1,138 @@
|
|
1
1
|
export class Store {
|
2
2
|
constructor(client) {
|
3
3
|
this.region = {
|
4
|
-
list: async (
|
4
|
+
list: async (query, headers) => {
|
5
5
|
return this.client.fetch(`/store/regions`, {
|
6
|
-
query
|
6
|
+
query,
|
7
7
|
headers,
|
8
8
|
});
|
9
9
|
},
|
10
|
-
retrieve: async (id,
|
10
|
+
retrieve: async (id, query, headers) => {
|
11
11
|
return this.client.fetch(`/store/regions/${id}`, {
|
12
|
-
query
|
12
|
+
query,
|
13
13
|
headers,
|
14
14
|
});
|
15
15
|
},
|
16
16
|
};
|
17
17
|
this.collection = {
|
18
|
-
list: async (
|
18
|
+
list: async (query, headers) => {
|
19
19
|
return this.client.fetch(`/store/collections`, {
|
20
|
-
query
|
20
|
+
query,
|
21
21
|
headers,
|
22
22
|
});
|
23
23
|
},
|
24
|
-
retrieve: async (id,
|
24
|
+
retrieve: async (id, query, headers) => {
|
25
25
|
return this.client.fetch(`/store/collections/${id}`, {
|
26
|
-
query
|
26
|
+
query,
|
27
27
|
headers,
|
28
28
|
});
|
29
29
|
},
|
30
30
|
};
|
31
31
|
this.category = {
|
32
|
-
list: async (
|
32
|
+
list: async (query, headers) => {
|
33
33
|
return this.client.fetch(`/store/product-categories`, {
|
34
|
-
query
|
34
|
+
query,
|
35
35
|
headers,
|
36
36
|
});
|
37
37
|
},
|
38
|
-
retrieve: async (id,
|
38
|
+
retrieve: async (id, query, headers) => {
|
39
39
|
return this.client.fetch(`/store/product-categories/${id}`, {
|
40
|
-
query
|
40
|
+
query,
|
41
41
|
headers,
|
42
42
|
});
|
43
43
|
},
|
44
44
|
};
|
45
45
|
this.product = {
|
46
|
-
list: async (
|
46
|
+
list: async (query, headers) => {
|
47
47
|
return this.client.fetch(`/store/products`, {
|
48
|
-
query
|
48
|
+
query,
|
49
49
|
headers,
|
50
50
|
});
|
51
51
|
},
|
52
|
-
retrieve: async (id,
|
52
|
+
retrieve: async (id, query, headers) => {
|
53
53
|
return this.client.fetch(`/store/products/${id}`, {
|
54
|
-
query
|
55
|
-
headers,
|
56
|
-
});
|
57
|
-
},
|
58
|
-
};
|
59
|
-
this.order = {
|
60
|
-
retrieve: async (id, queryParams, headers) => {
|
61
|
-
return this.client.fetch(`/store/orders/${id}`, {
|
62
|
-
query: queryParams,
|
54
|
+
query,
|
63
55
|
headers,
|
64
56
|
});
|
65
57
|
},
|
66
58
|
};
|
67
59
|
this.cart = {
|
68
|
-
create: async (body, headers) => {
|
60
|
+
create: async (body, query, headers) => {
|
69
61
|
return this.client.fetch(`/store/carts`, {
|
70
|
-
headers,
|
71
62
|
method: "POST",
|
63
|
+
headers,
|
72
64
|
body,
|
65
|
+
query,
|
73
66
|
});
|
74
67
|
},
|
75
|
-
update: async (id, body, headers) => {
|
68
|
+
update: async (id, body, query, headers) => {
|
76
69
|
return this.client.fetch(`/store/carts/${id}`, {
|
77
|
-
headers,
|
78
70
|
method: "POST",
|
71
|
+
headers,
|
79
72
|
body,
|
73
|
+
query,
|
80
74
|
});
|
81
75
|
},
|
82
|
-
retrieve: async (id,
|
76
|
+
retrieve: async (id, query, headers) => {
|
83
77
|
return this.client.fetch(`/store/carts/${id}`, {
|
84
|
-
query: queryParams,
|
85
78
|
headers,
|
79
|
+
query,
|
86
80
|
});
|
87
81
|
},
|
88
|
-
createLineItem: async (cartId, body, headers) => {
|
82
|
+
createLineItem: async (cartId, body, query, headers) => {
|
89
83
|
return this.client.fetch(`/store/carts/${cartId}/line-items`, {
|
90
|
-
headers,
|
91
84
|
method: "POST",
|
85
|
+
headers,
|
92
86
|
body,
|
87
|
+
query,
|
93
88
|
});
|
94
89
|
},
|
95
|
-
updateLineItem: async (cartId, lineItemId, body, headers) => {
|
90
|
+
updateLineItem: async (cartId, lineItemId, body, query, headers) => {
|
96
91
|
return this.client.fetch(`/store/carts/${cartId}/line-items/${lineItemId}`, {
|
97
|
-
headers,
|
98
92
|
method: "POST",
|
93
|
+
headers,
|
99
94
|
body,
|
95
|
+
query,
|
100
96
|
});
|
101
97
|
},
|
102
98
|
deleteLineItem: async (cartId, lineItemId, headers) => {
|
103
99
|
return this.client.fetch(`/store/carts/${cartId}/line-items/${lineItemId}`, {
|
104
|
-
headers,
|
105
100
|
method: "DELETE",
|
101
|
+
headers,
|
106
102
|
});
|
107
103
|
},
|
108
|
-
addShippingMethod: async (cartId, body, headers) => {
|
104
|
+
addShippingMethod: async (cartId, body, query, headers) => {
|
109
105
|
return this.client.fetch(`/store/carts/${cartId}/shipping-methods`, {
|
110
|
-
headers,
|
111
106
|
method: "POST",
|
107
|
+
headers,
|
112
108
|
body,
|
109
|
+
query,
|
113
110
|
});
|
114
111
|
},
|
115
|
-
complete: async (cartId, headers) => {
|
112
|
+
complete: async (cartId, query, headers) => {
|
116
113
|
return this.client.fetch(`/store/carts/${cartId}/complete`, {
|
117
|
-
headers,
|
118
114
|
method: "POST",
|
115
|
+
headers,
|
116
|
+
query,
|
119
117
|
});
|
120
118
|
},
|
121
119
|
};
|
122
120
|
this.fulfillment = {
|
123
|
-
listCartOptions: async (
|
121
|
+
listCartOptions: async (query, headers) => {
|
124
122
|
return this.client.fetch(`/store/shipping-options`, {
|
125
|
-
query: queryParams,
|
126
123
|
headers,
|
124
|
+
query,
|
127
125
|
});
|
128
126
|
},
|
129
127
|
};
|
130
128
|
this.payment = {
|
131
|
-
listPaymentProviders: async (
|
129
|
+
listPaymentProviders: async (query, headers) => {
|
132
130
|
return this.client.fetch(`/store/payment-providers`, {
|
133
|
-
query: queryParams,
|
134
131
|
headers,
|
132
|
+
query,
|
135
133
|
});
|
136
134
|
},
|
137
|
-
initiatePaymentSession: async (cart, body, headers) => {
|
135
|
+
initiatePaymentSession: async (cart, body, query, headers) => {
|
138
136
|
let paymentCollectionId = cart.payment_collection?.id;
|
139
137
|
if (!paymentCollectionId) {
|
140
138
|
const collectionBody = {
|
@@ -144,15 +142,24 @@ export class Store {
|
|
144
142
|
amount: cart.total,
|
145
143
|
};
|
146
144
|
paymentCollectionId = (await this.client.fetch(`/store/payment-collections`, {
|
147
|
-
headers,
|
148
145
|
method: "POST",
|
146
|
+
headers,
|
149
147
|
body: collectionBody,
|
150
148
|
})).payment_collection.id;
|
151
149
|
}
|
152
150
|
return this.client.fetch(`/store/payment-collections/${paymentCollectionId}/payment-sessions`, {
|
153
|
-
headers,
|
154
151
|
method: "POST",
|
152
|
+
headers,
|
155
153
|
body,
|
154
|
+
query,
|
155
|
+
});
|
156
|
+
},
|
157
|
+
};
|
158
|
+
this.order = {
|
159
|
+
retrieve: async (id, query, headers) => {
|
160
|
+
return this.client.fetch(`/store/orders/${id}`, {
|
161
|
+
headers,
|
162
|
+
query,
|
156
163
|
});
|
157
164
|
},
|
158
165
|
};
|
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,EAAU,EACV,KAAoB,EACpB,OAAuB,EACvB,EAAE;gBACF,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,EAAE,EAC1B;oBACE,KAAK;oBACL,OAAO;iBACR,CACF,CAAA;YAC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AAO;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;QAtTC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CAsTF"}
|
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-20240520151134",
|
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-20240520151134",
|
32
32
|
"qs": "^6.12.1"
|
33
33
|
},
|
34
34
|
"scripts": {
|