@medusajs/js-sdk 2.6.0-snapshot-20250221153919 → 3.0.0-preview-20250211091350
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/admin/index.d.ts +0 -5
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/product.d.ts +1 -2
- package/dist/admin/product.d.ts.map +1 -1
- package/dist/admin/product.js +1 -2
- package/dist/admin/product.js.map +1 -1
- package/dist/client.d.ts +8 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +48 -67
- package/dist/client.js.map +1 -1
- package/dist/esm/admin/index.d.ts +0 -5
- package/dist/esm/admin/index.d.ts.map +1 -1
- package/dist/esm/admin/index.js.map +1 -1
- package/dist/esm/admin/product.d.ts +1 -2
- package/dist/esm/admin/product.d.ts.map +1 -1
- package/dist/esm/admin/product.js +1 -2
- package/dist/esm/admin/product.js.map +1 -1
- package/dist/esm/client.d.ts +8 -9
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +63 -97
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/types.d.ts +1 -8
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/types.d.ts +1 -8
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/admin/draft-order.d.ts +0 -146
- package/dist/admin/draft-order.d.ts.map +0 -1
- package/dist/admin/draft-order.js +0 -169
- package/dist/admin/draft-order.js.map +0 -1
- package/dist/esm/admin/draft-order.d.ts +0 -146
- package/dist/esm/admin/draft-order.d.ts.map +0 -1
- package/dist/esm/admin/draft-order.js +0 -182
- package/dist/esm/admin/draft-order.js.map +0 -1
@@ -1,146 +0,0 @@
|
|
1
|
-
import { HttpTypes } from "@medusajs/types";
|
2
|
-
import { Client } from "../client";
|
3
|
-
import { ClientHeaders } from "../types";
|
4
|
-
export declare class DraftOrder {
|
5
|
-
/**
|
6
|
-
* @ignore
|
7
|
-
*/
|
8
|
-
private client;
|
9
|
-
/**
|
10
|
-
* @ignore
|
11
|
-
*/
|
12
|
-
constructor(client: Client);
|
13
|
-
/**
|
14
|
-
* This method retrieves a draft order by its ID. It sends a request to the
|
15
|
-
* [Get Draft Order](https://docs.medusajs.com/api/admin#draft-orders_getdraftordersid)
|
16
|
-
* API route.
|
17
|
-
*
|
18
|
-
* @param id - The draft order's ID.
|
19
|
-
* @param query - Configure the fields to retrieve in the draft order.
|
20
|
-
* @param headers - Headers to pass in the request
|
21
|
-
* @returns The draft order's details.
|
22
|
-
*
|
23
|
-
* @example
|
24
|
-
* To retrieve a draft order by its ID:
|
25
|
-
*
|
26
|
-
* ```ts
|
27
|
-
* sdk.admin.draftOrder.retrieve("draft_order_123")
|
28
|
-
* .then(({ draft_order }) => {
|
29
|
-
* console.log(draft_order)
|
30
|
-
* })
|
31
|
-
* ```
|
32
|
-
*
|
33
|
-
* To specify the fields and relations to retrieve:
|
34
|
-
*
|
35
|
-
* ```ts
|
36
|
-
* sdk.admin.draftOrder.retrieve("draft_order_123", {
|
37
|
-
* fields: "id,*items"
|
38
|
-
* })
|
39
|
-
* .then(({ draft_order }) => {
|
40
|
-
* console.log(draft_order)
|
41
|
-
* })
|
42
|
-
* ```
|
43
|
-
*
|
44
|
-
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
45
|
-
*/
|
46
|
-
retrieve(id: string, query?: HttpTypes.AdminDraftOrderParams, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderResponse>;
|
47
|
-
/**
|
48
|
-
* This method retrieves a paginated list of draft orders. It sends a request to the
|
49
|
-
* [List Draft Orders](https://docs.medusajs.com/api/admin#draft-orders_getdraftorders) API route.
|
50
|
-
*
|
51
|
-
* @param queryParams - Filters and pagination configurations.
|
52
|
-
* @param headers - Headers to pass in the request.
|
53
|
-
* @returns The paginated list of draft orders.
|
54
|
-
*
|
55
|
-
* @example
|
56
|
-
* To retrieve the list of draft orders:
|
57
|
-
*
|
58
|
-
* ```ts
|
59
|
-
* sdk.admin.draftOrder.list()
|
60
|
-
* .then(({ draft_orders, count, limit, offset }) => {
|
61
|
-
* console.log(draft_orders)
|
62
|
-
* })
|
63
|
-
* ```
|
64
|
-
*
|
65
|
-
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
66
|
-
*
|
67
|
-
* For example, to retrieve only 10 items and skip 10 items:
|
68
|
-
*
|
69
|
-
* ```ts
|
70
|
-
* sdk.admin.draftOrder.list({
|
71
|
-
* limit: 10,
|
72
|
-
* offset: 10
|
73
|
-
* })
|
74
|
-
* .then(({ draft_orders, count, limit, offset }) => {
|
75
|
-
* console.log(draft_orders)
|
76
|
-
* })
|
77
|
-
* ```
|
78
|
-
*
|
79
|
-
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
80
|
-
* in each draft order:
|
81
|
-
*
|
82
|
-
* ```ts
|
83
|
-
* sdk.admin.draftOrder.list({
|
84
|
-
* fields: "id,*items"
|
85
|
-
* })
|
86
|
-
* .then(({ draft_orders, count, limit, offset }) => {
|
87
|
-
* console.log(draft_orders)
|
88
|
-
* })
|
89
|
-
* ```
|
90
|
-
*
|
91
|
-
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
92
|
-
*/
|
93
|
-
list(queryParams?: HttpTypes.AdminDraftOrderListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderListResponse>;
|
94
|
-
/**
|
95
|
-
* This method creates a draft order. It sends a request to the
|
96
|
-
* [Create Draft Order](https://docs.medusajs.com/api/admin#draft-orders_postdraftorders) API route.
|
97
|
-
*
|
98
|
-
* @param body - The data to create the draft order.
|
99
|
-
* @param query - Configure the fields to retrieve in the draft order.
|
100
|
-
* @param headers - Headers to pass in the request.
|
101
|
-
*
|
102
|
-
* @example
|
103
|
-
* To create a draft order:
|
104
|
-
*
|
105
|
-
* ```ts
|
106
|
-
* sdk.admin.draftOrder.create({
|
107
|
-
* email: "test@test.com",
|
108
|
-
* items: [
|
109
|
-
* {
|
110
|
-
* variant_id: "variant_123",
|
111
|
-
* quantity: 1,
|
112
|
-
* },
|
113
|
-
* ],
|
114
|
-
* region_id: "region_123",
|
115
|
-
* sales_channel_id: "sales_channel_123",
|
116
|
-
* })
|
117
|
-
* .then(({ draft_order }) => {
|
118
|
-
* console.log(draft_order)
|
119
|
-
* })
|
120
|
-
* ```
|
121
|
-
*/
|
122
|
-
create(body: HttpTypes.AdminCreateDraftOrder, query?: HttpTypes.AdminDraftOrderParams, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderResponse>;
|
123
|
-
/**
|
124
|
-
* This method updates a draft order. It sends a request to the
|
125
|
-
* [Update Draft Order](https://docs.medusajs.com/api/admin#draft-orders_postdraftordersid) API route.
|
126
|
-
*
|
127
|
-
* @param id - The draft order's ID.
|
128
|
-
* @param body - The data to update the draft order.
|
129
|
-
* @param query - Configure the fields to retrieve in the draft order.
|
130
|
-
* @param headers - Headers to pass in the request.
|
131
|
-
*
|
132
|
-
* @example
|
133
|
-
* To update a draft order:
|
134
|
-
*
|
135
|
-
* ```ts
|
136
|
-
* sdk.admin.draftOrder.update("draft_order_123", {
|
137
|
-
* email: "test@test.com",
|
138
|
-
* })
|
139
|
-
* .then(({ draft_order }) => {
|
140
|
-
* console.log(draft_order)
|
141
|
-
* })
|
142
|
-
* ```
|
143
|
-
*/
|
144
|
-
update(id: string, body: HttpTypes.AdminUpdateDraftOrder, query?: HttpTypes.AdminDraftOrderParams, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderResponse>;
|
145
|
-
}
|
146
|
-
//# sourceMappingURL=draft-order.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"draft-order.d.ts","sourceRoot":"","sources":["../../../src/admin/draft-order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,UAAU;IACrB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,qBAAqB,EACvC,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,IAAI,CACR,WAAW,CAAC,EAAE,SAAS,CAAC,yBAAyB,EACjD,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACG,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,qBAAqB,EACrC,KAAK,CAAC,EAAE,SAAS,CAAC,qBAAqB,EACvC,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,qBAAqB,EACrC,KAAK,CAAC,EAAE,SAAS,CAAC,qBAAqB,EACvC,OAAO,CAAC,EAAE,aAAa;CAY1B"}
|
@@ -1,182 +0,0 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
|
-
export class DraftOrder {
|
11
|
-
/**
|
12
|
-
* @ignore
|
13
|
-
*/
|
14
|
-
constructor(client) {
|
15
|
-
this.client = client;
|
16
|
-
}
|
17
|
-
/**
|
18
|
-
* This method retrieves a draft order by its ID. It sends a request to the
|
19
|
-
* [Get Draft Order](https://docs.medusajs.com/api/admin#draft-orders_getdraftordersid)
|
20
|
-
* API route.
|
21
|
-
*
|
22
|
-
* @param id - The draft order's ID.
|
23
|
-
* @param query - Configure the fields to retrieve in the draft order.
|
24
|
-
* @param headers - Headers to pass in the request
|
25
|
-
* @returns The draft order's details.
|
26
|
-
*
|
27
|
-
* @example
|
28
|
-
* To retrieve a draft order by its ID:
|
29
|
-
*
|
30
|
-
* ```ts
|
31
|
-
* sdk.admin.draftOrder.retrieve("draft_order_123")
|
32
|
-
* .then(({ draft_order }) => {
|
33
|
-
* console.log(draft_order)
|
34
|
-
* })
|
35
|
-
* ```
|
36
|
-
*
|
37
|
-
* To specify the fields and relations to retrieve:
|
38
|
-
*
|
39
|
-
* ```ts
|
40
|
-
* sdk.admin.draftOrder.retrieve("draft_order_123", {
|
41
|
-
* fields: "id,*items"
|
42
|
-
* })
|
43
|
-
* .then(({ draft_order }) => {
|
44
|
-
* console.log(draft_order)
|
45
|
-
* })
|
46
|
-
* ```
|
47
|
-
*
|
48
|
-
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
49
|
-
*/
|
50
|
-
retrieve(id, query, headers) {
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
52
|
-
return yield this.client.fetch(`/admin/draft-orders/${id}`, {
|
53
|
-
query,
|
54
|
-
headers,
|
55
|
-
});
|
56
|
-
});
|
57
|
-
}
|
58
|
-
/**
|
59
|
-
* This method retrieves a paginated list of draft orders. It sends a request to the
|
60
|
-
* [List Draft Orders](https://docs.medusajs.com/api/admin#draft-orders_getdraftorders) API route.
|
61
|
-
*
|
62
|
-
* @param queryParams - Filters and pagination configurations.
|
63
|
-
* @param headers - Headers to pass in the request.
|
64
|
-
* @returns The paginated list of draft orders.
|
65
|
-
*
|
66
|
-
* @example
|
67
|
-
* To retrieve the list of draft orders:
|
68
|
-
*
|
69
|
-
* ```ts
|
70
|
-
* sdk.admin.draftOrder.list()
|
71
|
-
* .then(({ draft_orders, count, limit, offset }) => {
|
72
|
-
* console.log(draft_orders)
|
73
|
-
* })
|
74
|
-
* ```
|
75
|
-
*
|
76
|
-
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
77
|
-
*
|
78
|
-
* For example, to retrieve only 10 items and skip 10 items:
|
79
|
-
*
|
80
|
-
* ```ts
|
81
|
-
* sdk.admin.draftOrder.list({
|
82
|
-
* limit: 10,
|
83
|
-
* offset: 10
|
84
|
-
* })
|
85
|
-
* .then(({ draft_orders, count, limit, offset }) => {
|
86
|
-
* console.log(draft_orders)
|
87
|
-
* })
|
88
|
-
* ```
|
89
|
-
*
|
90
|
-
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
91
|
-
* in each draft order:
|
92
|
-
*
|
93
|
-
* ```ts
|
94
|
-
* sdk.admin.draftOrder.list({
|
95
|
-
* fields: "id,*items"
|
96
|
-
* })
|
97
|
-
* .then(({ draft_orders, count, limit, offset }) => {
|
98
|
-
* console.log(draft_orders)
|
99
|
-
* })
|
100
|
-
* ```
|
101
|
-
*
|
102
|
-
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
103
|
-
*/
|
104
|
-
list(queryParams, headers) {
|
105
|
-
return __awaiter(this, void 0, void 0, function* () {
|
106
|
-
return yield this.client.fetch(`/admin/draft-orders`, {
|
107
|
-
query: queryParams,
|
108
|
-
headers,
|
109
|
-
});
|
110
|
-
});
|
111
|
-
}
|
112
|
-
/**
|
113
|
-
* This method creates a draft order. It sends a request to the
|
114
|
-
* [Create Draft Order](https://docs.medusajs.com/api/admin#draft-orders_postdraftorders) API route.
|
115
|
-
*
|
116
|
-
* @param body - The data to create the draft order.
|
117
|
-
* @param query - Configure the fields to retrieve in the draft order.
|
118
|
-
* @param headers - Headers to pass in the request.
|
119
|
-
*
|
120
|
-
* @example
|
121
|
-
* To create a draft order:
|
122
|
-
*
|
123
|
-
* ```ts
|
124
|
-
* sdk.admin.draftOrder.create({
|
125
|
-
* email: "test@test.com",
|
126
|
-
* items: [
|
127
|
-
* {
|
128
|
-
* variant_id: "variant_123",
|
129
|
-
* quantity: 1,
|
130
|
-
* },
|
131
|
-
* ],
|
132
|
-
* region_id: "region_123",
|
133
|
-
* sales_channel_id: "sales_channel_123",
|
134
|
-
* })
|
135
|
-
* .then(({ draft_order }) => {
|
136
|
-
* console.log(draft_order)
|
137
|
-
* })
|
138
|
-
* ```
|
139
|
-
*/
|
140
|
-
create(body, query, headers) {
|
141
|
-
return __awaiter(this, void 0, void 0, function* () {
|
142
|
-
return yield this.client.fetch(`/admin/draft-orders`, {
|
143
|
-
method: "POST",
|
144
|
-
body,
|
145
|
-
query,
|
146
|
-
headers,
|
147
|
-
});
|
148
|
-
});
|
149
|
-
}
|
150
|
-
/**
|
151
|
-
* This method updates a draft order. It sends a request to the
|
152
|
-
* [Update Draft Order](https://docs.medusajs.com/api/admin#draft-orders_postdraftordersid) API route.
|
153
|
-
*
|
154
|
-
* @param id - The draft order's ID.
|
155
|
-
* @param body - The data to update the draft order.
|
156
|
-
* @param query - Configure the fields to retrieve in the draft order.
|
157
|
-
* @param headers - Headers to pass in the request.
|
158
|
-
*
|
159
|
-
* @example
|
160
|
-
* To update a draft order:
|
161
|
-
*
|
162
|
-
* ```ts
|
163
|
-
* sdk.admin.draftOrder.update("draft_order_123", {
|
164
|
-
* email: "test@test.com",
|
165
|
-
* })
|
166
|
-
* .then(({ draft_order }) => {
|
167
|
-
* console.log(draft_order)
|
168
|
-
* })
|
169
|
-
* ```
|
170
|
-
*/
|
171
|
-
update(id, body, query, headers) {
|
172
|
-
return __awaiter(this, void 0, void 0, function* () {
|
173
|
-
return yield this.client.fetch(`/admin/draft-orders/${id}`, {
|
174
|
-
method: "POST",
|
175
|
-
body,
|
176
|
-
query,
|
177
|
-
headers,
|
178
|
-
});
|
179
|
-
});
|
180
|
-
}
|
181
|
-
}
|
182
|
-
//# sourceMappingURL=draft-order.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"draft-order.js","sourceRoot":"","sources":["../../../src/admin/draft-order.ts"],"names":[],"mappings":";;;;;;;;;AAKA,MAAM,OAAO,UAAU;IAKrB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CACZ,EAAU,EACV,KAAuC,EACvC,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,uBAAuB,EAAE,EAAE,EAC3B;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,IAAI,CACR,WAAiD,EACjD,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,qBAAqB,EACrB;gBACE,KAAK,EAAE,WAAW;gBAClB,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACG,MAAM,CACV,IAAqC,EACrC,KAAuC,EACvC,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,qBAAqB,EACrB;gBACE,MAAM,EAAE,MAAM;gBACd,IAAI;gBACJ,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,MAAM,CACV,EAAU,EACV,IAAqC,EACrC,KAAuC,EACvC,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,uBAAuB,EAAE,EAAE,EAC3B;gBACE,MAAM,EAAE,MAAM;gBACd,IAAI;gBACJ,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
|