@medusajs/js-sdk 1.0.0-rc-20241018141633 → 1.0.0-rc-20241022152047

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. package/dist/admin/api-key.d.ts +144 -1
  2. package/dist/admin/api-key.d.ts.map +1 -1
  3. package/dist/admin/api-key.js +143 -0
  4. package/dist/admin/api-key.js.map +1 -1
  5. package/dist/admin/campaign.d.ts +135 -0
  6. package/dist/admin/campaign.d.ts.map +1 -1
  7. package/dist/admin/campaign.js +135 -0
  8. package/dist/admin/campaign.js.map +1 -1
  9. package/dist/admin/claim.d.ts +542 -20
  10. package/dist/admin/claim.d.ts.map +1 -1
  11. package/dist/admin/claim.js +523 -7
  12. package/dist/admin/claim.js.map +1 -1
  13. package/dist/admin/currency.d.ts +80 -1
  14. package/dist/admin/currency.d.ts.map +1 -1
  15. package/dist/admin/currency.js +81 -2
  16. package/dist/admin/currency.js.map +1 -1
  17. package/dist/admin/customer-group.d.ts +152 -2
  18. package/dist/admin/customer-group.d.ts.map +1 -1
  19. package/dist/admin/customer-group.js +150 -0
  20. package/dist/admin/customer-group.js.map +1 -1
  21. package/dist/admin/customer.d.ts +135 -13
  22. package/dist/admin/customer.d.ts.map +1 -1
  23. package/dist/admin/customer.js +130 -0
  24. package/dist/admin/customer.js.map +1 -1
  25. package/dist/admin/exchange.d.ts +471 -20
  26. package/dist/admin/exchange.d.ts.map +1 -1
  27. package/dist/admin/exchange.js +455 -30
  28. package/dist/admin/exchange.js.map +1 -1
  29. package/dist/admin/fulfillment-provider.d.ts +47 -0
  30. package/dist/admin/fulfillment-provider.d.ts.map +1 -1
  31. package/dist/admin/fulfillment-provider.js +47 -0
  32. package/dist/admin/fulfillment-provider.js.map +1 -1
  33. package/dist/admin/fulfillment-set.d.ts +122 -0
  34. package/dist/admin/fulfillment-set.d.ts.map +1 -1
  35. package/dist/admin/fulfillment-set.js +122 -0
  36. package/dist/admin/fulfillment-set.js.map +1 -1
  37. package/dist/admin/fulfillment.d.ts +74 -0
  38. package/dist/admin/fulfillment.d.ts.map +1 -1
  39. package/dist/admin/fulfillment.js +75 -0
  40. package/dist/admin/fulfillment.js.map +1 -1
  41. package/dist/admin/inventory-item.d.ts +252 -1
  42. package/dist/admin/inventory-item.d.ts.map +1 -1
  43. package/dist/admin/inventory-item.js +251 -0
  44. package/dist/admin/inventory-item.js.map +1 -1
  45. package/dist/admin/invite.d.ts +170 -15
  46. package/dist/admin/invite.d.ts.map +1 -1
  47. package/dist/admin/invite.js +162 -0
  48. package/dist/admin/invite.js.map +1 -1
  49. package/dist/admin/order.d.ts +1 -0
  50. package/dist/admin/order.d.ts.map +1 -1
  51. package/dist/admin/order.js +6 -0
  52. package/dist/admin/order.js.map +1 -1
  53. package/dist/auth/index.d.ts +156 -0
  54. package/dist/auth/index.d.ts.map +1 -1
  55. package/dist/auth/index.js +152 -1
  56. package/dist/auth/index.js.map +1 -1
  57. package/dist/client.d.ts +1 -1
  58. package/dist/client.d.ts.map +1 -1
  59. package/dist/client.js +2 -1
  60. package/dist/client.js.map +1 -1
  61. package/dist/esm/admin/api-key.d.ts +144 -1
  62. package/dist/esm/admin/api-key.d.ts.map +1 -1
  63. package/dist/esm/admin/api-key.js +143 -0
  64. package/dist/esm/admin/api-key.js.map +1 -1
  65. package/dist/esm/admin/campaign.d.ts +135 -0
  66. package/dist/esm/admin/campaign.d.ts.map +1 -1
  67. package/dist/esm/admin/campaign.js +135 -0
  68. package/dist/esm/admin/campaign.js.map +1 -1
  69. package/dist/esm/admin/claim.d.ts +542 -20
  70. package/dist/esm/admin/claim.d.ts.map +1 -1
  71. package/dist/esm/admin/claim.js +523 -9
  72. package/dist/esm/admin/claim.js.map +1 -1
  73. package/dist/esm/admin/currency.d.ts +80 -1
  74. package/dist/esm/admin/currency.d.ts.map +1 -1
  75. package/dist/esm/admin/currency.js +81 -2
  76. package/dist/esm/admin/currency.js.map +1 -1
  77. package/dist/esm/admin/customer-group.d.ts +152 -2
  78. package/dist/esm/admin/customer-group.d.ts.map +1 -1
  79. package/dist/esm/admin/customer-group.js +150 -0
  80. package/dist/esm/admin/customer-group.js.map +1 -1
  81. package/dist/esm/admin/customer.d.ts +135 -13
  82. package/dist/esm/admin/customer.d.ts.map +1 -1
  83. package/dist/esm/admin/customer.js +130 -0
  84. package/dist/esm/admin/customer.js.map +1 -1
  85. package/dist/esm/admin/exchange.d.ts +471 -20
  86. package/dist/esm/admin/exchange.d.ts.map +1 -1
  87. package/dist/esm/admin/exchange.js +455 -38
  88. package/dist/esm/admin/exchange.js.map +1 -1
  89. package/dist/esm/admin/fulfillment-provider.d.ts +47 -0
  90. package/dist/esm/admin/fulfillment-provider.d.ts.map +1 -1
  91. package/dist/esm/admin/fulfillment-provider.js +47 -0
  92. package/dist/esm/admin/fulfillment-provider.js.map +1 -1
  93. package/dist/esm/admin/fulfillment-set.d.ts +122 -0
  94. package/dist/esm/admin/fulfillment-set.d.ts.map +1 -1
  95. package/dist/esm/admin/fulfillment-set.js +122 -0
  96. package/dist/esm/admin/fulfillment-set.js.map +1 -1
  97. package/dist/esm/admin/fulfillment.d.ts +74 -0
  98. package/dist/esm/admin/fulfillment.d.ts.map +1 -1
  99. package/dist/esm/admin/fulfillment.js +75 -0
  100. package/dist/esm/admin/fulfillment.js.map +1 -1
  101. package/dist/esm/admin/inventory-item.d.ts +252 -1
  102. package/dist/esm/admin/inventory-item.d.ts.map +1 -1
  103. package/dist/esm/admin/inventory-item.js +251 -0
  104. package/dist/esm/admin/inventory-item.js.map +1 -1
  105. package/dist/esm/admin/invite.d.ts +170 -15
  106. package/dist/esm/admin/invite.d.ts.map +1 -1
  107. package/dist/esm/admin/invite.js +162 -0
  108. package/dist/esm/admin/invite.js.map +1 -1
  109. package/dist/esm/admin/order.d.ts +1 -0
  110. package/dist/esm/admin/order.d.ts.map +1 -1
  111. package/dist/esm/admin/order.js +8 -0
  112. package/dist/esm/admin/order.js.map +1 -1
  113. package/dist/esm/auth/index.d.ts +156 -0
  114. package/dist/esm/auth/index.d.ts.map +1 -1
  115. package/dist/esm/auth/index.js +152 -1
  116. package/dist/esm/auth/index.js.map +1 -1
  117. package/dist/esm/client.d.ts +1 -1
  118. package/dist/esm/client.d.ts.map +1 -1
  119. package/dist/esm/client.js +2 -1
  120. package/dist/esm/client.js.map +1 -1
  121. package/dist/esm/store/index.d.ts +973 -83
  122. package/dist/esm/store/index.d.ts.map +1 -1
  123. package/dist/esm/store/index.js +946 -0
  124. package/dist/esm/store/index.js.map +1 -1
  125. package/dist/esm/types.d.ts +6 -1
  126. package/dist/esm/types.d.ts.map +1 -1
  127. package/dist/store/index.d.ts +973 -83
  128. package/dist/store/index.d.ts.map +1 -1
  129. package/dist/store/index.js +946 -0
  130. package/dist/store/index.js.map +1 -1
  131. package/dist/types.d.ts +6 -1
  132. package/dist/types.d.ts.map +1 -1
  133. package/package.json +2 -2
@@ -10,23 +10,178 @@ export declare class Invite {
10
10
  * @ignore
11
11
  */
12
12
  constructor(client: Client);
13
+ /**
14
+ * This method accepts an invite. It requires sending a previous request to
15
+ * the {@link Auth.register}.
16
+ *
17
+ * This method sends a request to the [Accept Invite]
18
+ * (https://docs.medusajs.com/v2/api/admin#invites_postinvitesaccept)
19
+ * API route.
20
+ *
21
+ * @param input - The details of the user to create.
22
+ * @param query - Configure the fields to retrieve in the user.
23
+ * @param headers - Headers to pass in the request
24
+ * @returns The user's details.
25
+ *
26
+ * @example
27
+ * const token = await sdk.auth.register("user", "emailpass", {
28
+ * email: "user@gmail.com",
29
+ * password: "supersecret"
30
+ * })
31
+ *
32
+ * sdk.admin.invite.accept(
33
+ * {
34
+ * email: "user@gmail.com",
35
+ * first_name: "John",
36
+ * last_name: "Smith",
37
+ * invite_token: "12345..."
38
+ * },
39
+ * {
40
+ * Authorization: `Bearer ${token}`
41
+ * }
42
+ * )
43
+ * .then(({ user }) => {
44
+ * console.log(user)
45
+ * })
46
+ */
13
47
  accept(input: HttpTypes.AdminAcceptInvite & {
48
+ /**
49
+ * The invite's token.
50
+ */
14
51
  invite_token: string;
15
- }, query?: SelectParams, headers?: ClientHeaders): Promise<{
16
- user: HttpTypes.AdminUserResponse;
17
- }>;
18
- create(body: HttpTypes.AdminCreateInvite, query?: SelectParams, headers?: ClientHeaders): Promise<{
19
- invite: HttpTypes.AdminInviteResponse;
20
- }>;
21
- retrieve(id: string, query?: SelectParams, headers?: ClientHeaders): Promise<{
22
- invite: HttpTypes.AdminInviteResponse;
23
- }>;
24
- list(queryParams?: FindParams, headers?: ClientHeaders): Promise<HttpTypes.PaginatedResponse<{
25
- invites: HttpTypes.AdminInviteResponse[];
26
- }>>;
27
- resend(id: string, headers?: ClientHeaders): Promise<{
28
- invite: HttpTypes.AdminInviteResponse;
29
- }>;
52
+ }, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminAcceptInviteResponse>;
53
+ /**
54
+ * This method creates an invite. It sends a request to the
55
+ * [Create Invite](https://docs.medusajs.com/v2/api/admin#invites_postinvites)
56
+ * API route.
57
+ *
58
+ * @param body - The invite's details.
59
+ * @param query - Configure the fields to retrieve in the invite.
60
+ * @param headers - Headers to pass in the request
61
+ * @returns The invite's details.
62
+ *
63
+ * @example
64
+ * sdk.admin.invite.create({
65
+ * email: "user@gmail.com",
66
+ * })
67
+ * .then(({ invite }) => {
68
+ * console.log(invite)
69
+ * })
70
+ */
71
+ create(body: HttpTypes.AdminCreateInvite, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminInviteResponse>;
72
+ /**
73
+ * This method retrieves an invite by its ID. It sends a request to the
74
+ * [Get Invite](https://docs.medusajs.com/v2/api/admin#invites_getinvitesid)
75
+ * API route.
76
+ *
77
+ * @param id - The invite's ID.
78
+ * @param query - Configure the fields to retrieve in the invite.
79
+ * @param headers - Headers to pass in the request
80
+ * @returns The invite's details.
81
+ *
82
+ * @example
83
+ * To retrieve an invite its ID:
84
+ *
85
+ * ```ts
86
+ * sdk.admin.invite.retrieve("invite_123")
87
+ * .then(({ invite }) => {
88
+ * console.log(invite)
89
+ * })
90
+ * ```
91
+ *
92
+ * To specify the fields and relations to retrieve:
93
+ *
94
+ * ```ts
95
+ * sdk.admin.invite.retrieve("invite_123", {
96
+ * fields: "id,email"
97
+ * })
98
+ * .then(({ invite }) => {
99
+ * console.log(invite)
100
+ * })
101
+ * ```
102
+ *
103
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
104
+ */
105
+ retrieve(id: string, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminInviteResponse>;
106
+ /**
107
+ * This method retrieves a paginated list of invites. It sends a request to the
108
+ * [List Invites](https://docs.medusajs.com/v2/api/admin#invites_getinvites)
109
+ * API route.
110
+ *
111
+ * @param queryParams - Filters and pagination configurations.
112
+ * @param headers - Headers to pass in the request.
113
+ * @returns The paginated list of invites.
114
+ *
115
+ * @example
116
+ * To retrieve the list of invites:
117
+ *
118
+ * ```ts
119
+ * sdk.admin.invite.list()
120
+ * .then(({ invites, count, limit, offset }) => {
121
+ * console.log(invites)
122
+ * })
123
+ * ```
124
+ *
125
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
126
+ *
127
+ * For example, to retrieve only 10 items and skip 10 items:
128
+ *
129
+ * ```ts
130
+ * sdk.admin.invite.list({
131
+ * limit: 10,
132
+ * offset: 10
133
+ * })
134
+ * .then(({ invites, count, limit, offset }) => {
135
+ * console.log(invites)
136
+ * })
137
+ * ```
138
+ *
139
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
140
+ * in each invite:
141
+ *
142
+ * ```ts
143
+ * sdk.admin.invite.list({
144
+ * fields: "id,email"
145
+ * })
146
+ * .then(({ invites, count, limit, offset }) => {
147
+ * console.log(invites)
148
+ * })
149
+ * ```
150
+ *
151
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
152
+ */
153
+ list(queryParams?: FindParams, headers?: ClientHeaders): Promise<HttpTypes.AdminInviteListResponse>;
154
+ /**
155
+ * This method refreshes the token of an invite. It sends a request to the
156
+ * [Refresh Invite Token](https://docs.medusajs.com/v2/api/admin#invites_postinvitesidresend)
157
+ * API route.
158
+ *
159
+ * @param id - The invite's ID.
160
+ * @param headers - Headers to pass in the request.
161
+ * @returns The invite's details.
162
+ *
163
+ * @example
164
+ * sdk.admin.invite.resend("invite_123")
165
+ * .then(({ invite }) => {
166
+ * console.log(invite)
167
+ * })
168
+ */
169
+ resend(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminInviteResponse>;
170
+ /**
171
+ * This method deletes an invite. It sends a request to the
172
+ * [Delete Invite](https://docs.medusajs.com/v2/api/admin#invites_deleteinvitesid)
173
+ * API route.
174
+ *
175
+ * @param id - The invite's ID.
176
+ * @param headers - Headers to pass in the request.
177
+ * @returns The deletion's details.
178
+ *
179
+ * @example
180
+ * sdk.admin.invite.delete("invite_123")
181
+ * .then(({ deleted }) => {
182
+ * console.log(deleted)
183
+ * })
184
+ */
30
185
  delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminInviteDeleteResponse>;
31
186
  }
32
187
  //# sourceMappingURL=invite.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"invite.d.ts","sourceRoot":"","sources":["../../../src/admin/invite.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAET,YAAY,EACb,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,MAAM;IACjB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAIpB,MAAM,CACV,KAAK,EAAE,SAAS,CAAC,iBAAiB,GAAG;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,EAC7D,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;cAGgB,SAAS,CAAC,iBAAiB;;IAW9D,MAAM,CACV,IAAI,EAAE,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;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,aAAa;IAUxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,IAAI,CAAC,WAAW,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,aAAa;IAS5D;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;IAUhD;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;CASjD"}
@@ -25,6 +25,40 @@ export class Invite {
25
25
  constructor(client) {
26
26
  this.client = client;
27
27
  }
28
+ /**
29
+ * This method accepts an invite. It requires sending a previous request to
30
+ * the {@link Auth.register}.
31
+ *
32
+ * This method sends a request to the [Accept Invite]
33
+ * (https://docs.medusajs.com/v2/api/admin#invites_postinvitesaccept)
34
+ * API route.
35
+ *
36
+ * @param input - The details of the user to create.
37
+ * @param query - Configure the fields to retrieve in the user.
38
+ * @param headers - Headers to pass in the request
39
+ * @returns The user's details.
40
+ *
41
+ * @example
42
+ * const token = await sdk.auth.register("user", "emailpass", {
43
+ * email: "user@gmail.com",
44
+ * password: "supersecret"
45
+ * })
46
+ *
47
+ * sdk.admin.invite.accept(
48
+ * {
49
+ * email: "user@gmail.com",
50
+ * first_name: "John",
51
+ * last_name: "Smith",
52
+ * invite_token: "12345..."
53
+ * },
54
+ * {
55
+ * Authorization: `Bearer ${token}`
56
+ * }
57
+ * )
58
+ * .then(({ user }) => {
59
+ * console.log(user)
60
+ * })
61
+ */
28
62
  accept(input, query, headers) {
29
63
  return __awaiter(this, void 0, void 0, function* () {
30
64
  const { invite_token } = input, rest = __rest(input, ["invite_token"]);
@@ -36,6 +70,24 @@ export class Invite {
36
70
  });
37
71
  });
38
72
  }
73
+ /**
74
+ * This method creates an invite. It sends a request to the
75
+ * [Create Invite](https://docs.medusajs.com/v2/api/admin#invites_postinvites)
76
+ * API route.
77
+ *
78
+ * @param body - The invite's details.
79
+ * @param query - Configure the fields to retrieve in the invite.
80
+ * @param headers - Headers to pass in the request
81
+ * @returns The invite's details.
82
+ *
83
+ * @example
84
+ * sdk.admin.invite.create({
85
+ * email: "user@gmail.com",
86
+ * })
87
+ * .then(({ invite }) => {
88
+ * console.log(invite)
89
+ * })
90
+ */
39
91
  create(body, query, headers) {
40
92
  return __awaiter(this, void 0, void 0, function* () {
41
93
  return yield this.client.fetch(`/admin/invites`, {
@@ -46,6 +98,39 @@ export class Invite {
46
98
  });
47
99
  });
48
100
  }
101
+ /**
102
+ * This method retrieves an invite by its ID. It sends a request to the
103
+ * [Get Invite](https://docs.medusajs.com/v2/api/admin#invites_getinvitesid)
104
+ * API route.
105
+ *
106
+ * @param id - The invite's ID.
107
+ * @param query - Configure the fields to retrieve in the invite.
108
+ * @param headers - Headers to pass in the request
109
+ * @returns The invite's details.
110
+ *
111
+ * @example
112
+ * To retrieve an invite its ID:
113
+ *
114
+ * ```ts
115
+ * sdk.admin.invite.retrieve("invite_123")
116
+ * .then(({ invite }) => {
117
+ * console.log(invite)
118
+ * })
119
+ * ```
120
+ *
121
+ * To specify the fields and relations to retrieve:
122
+ *
123
+ * ```ts
124
+ * sdk.admin.invite.retrieve("invite_123", {
125
+ * fields: "id,email"
126
+ * })
127
+ * .then(({ invite }) => {
128
+ * console.log(invite)
129
+ * })
130
+ * ```
131
+ *
132
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
133
+ */
49
134
  retrieve(id, query, headers) {
50
135
  return __awaiter(this, void 0, void 0, function* () {
51
136
  return yield this.client.fetch(`/admin/invites/${id}`, {
@@ -54,6 +139,53 @@ export class Invite {
54
139
  });
55
140
  });
56
141
  }
142
+ /**
143
+ * This method retrieves a paginated list of invites. It sends a request to the
144
+ * [List Invites](https://docs.medusajs.com/v2/api/admin#invites_getinvites)
145
+ * API route.
146
+ *
147
+ * @param queryParams - Filters and pagination configurations.
148
+ * @param headers - Headers to pass in the request.
149
+ * @returns The paginated list of invites.
150
+ *
151
+ * @example
152
+ * To retrieve the list of invites:
153
+ *
154
+ * ```ts
155
+ * sdk.admin.invite.list()
156
+ * .then(({ invites, count, limit, offset }) => {
157
+ * console.log(invites)
158
+ * })
159
+ * ```
160
+ *
161
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
162
+ *
163
+ * For example, to retrieve only 10 items and skip 10 items:
164
+ *
165
+ * ```ts
166
+ * sdk.admin.invite.list({
167
+ * limit: 10,
168
+ * offset: 10
169
+ * })
170
+ * .then(({ invites, count, limit, offset }) => {
171
+ * console.log(invites)
172
+ * })
173
+ * ```
174
+ *
175
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
176
+ * in each invite:
177
+ *
178
+ * ```ts
179
+ * sdk.admin.invite.list({
180
+ * fields: "id,email"
181
+ * })
182
+ * .then(({ invites, count, limit, offset }) => {
183
+ * console.log(invites)
184
+ * })
185
+ * ```
186
+ *
187
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
188
+ */
57
189
  list(queryParams, headers) {
58
190
  return __awaiter(this, void 0, void 0, function* () {
59
191
  return yield this.client.fetch(`/admin/invites`, {
@@ -62,6 +194,21 @@ export class Invite {
62
194
  });
63
195
  });
64
196
  }
197
+ /**
198
+ * This method refreshes the token of an invite. It sends a request to the
199
+ * [Refresh Invite Token](https://docs.medusajs.com/v2/api/admin#invites_postinvitesidresend)
200
+ * API route.
201
+ *
202
+ * @param id - The invite's ID.
203
+ * @param headers - Headers to pass in the request.
204
+ * @returns The invite's details.
205
+ *
206
+ * @example
207
+ * sdk.admin.invite.resend("invite_123")
208
+ * .then(({ invite }) => {
209
+ * console.log(invite)
210
+ * })
211
+ */
65
212
  resend(id, headers) {
66
213
  return __awaiter(this, void 0, void 0, function* () {
67
214
  return yield this.client.fetch(`/admin/invites/${id}/resend`, {
@@ -70,6 +217,21 @@ export class Invite {
70
217
  });
71
218
  });
72
219
  }
220
+ /**
221
+ * This method deletes an invite. It sends a request to the
222
+ * [Delete Invite](https://docs.medusajs.com/v2/api/admin#invites_deleteinvitesid)
223
+ * API route.
224
+ *
225
+ * @param id - The invite's ID.
226
+ * @param headers - Headers to pass in the request.
227
+ * @returns The deletion's details.
228
+ *
229
+ * @example
230
+ * sdk.admin.invite.delete("invite_123")
231
+ * .then(({ deleted }) => {
232
+ * console.log(deleted)
233
+ * })
234
+ */
73
235
  delete(id, headers) {
74
236
  return __awaiter(this, void 0, void 0, function* () {
75
237
  return yield this.client.fetch(`/admin/invites/${id}`, {
@@ -1 +1 @@
1
- {"version":3,"file":"invite.js","sourceRoot":"","sources":["../../../src/admin/invite.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,MAAM,OAAO,MAAM;IAKjB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEK,MAAM,CACV,KAA6D,EAC7D,KAAoB,EACpB,OAAuB;;YAEvB,MAAM,EAAE,YAAY,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAAjC,gBAAyB,CAAQ,CAAA;YACvC,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,+BAA+B,KAAK,CAAC,YAAY,EAAE,EACnD;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI,EAAE,IAAI;gBACV,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAEK,MAAM,CACV,IAAiC,EACjC,KAAoB,EACpB,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,gBAAgB,EAChB;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,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B;gBACE,MAAM,EAAE,QAAQ;gBAChB,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
@@ -33,5 +33,6 @@ export declare class Order {
33
33
  order: HttpTypes.AdminOrder;
34
34
  }>;
35
35
  listChanges(id: string, queryParams?: FindParams & HttpTypes.AdminOrderChangesFilters, headers?: ClientHeaders): Promise<HttpTypes.PaginatedResponse<HttpTypes.AdminOrderChangesResponse>>;
36
+ listLineItems(id: string, queryParams?: FindParams & HttpTypes.AdminOrderItemsFilters, headers?: ClientHeaders): Promise<HttpTypes.PaginatedResponse<HttpTypes.AdminOrderLineItemsListResponse>>;
36
37
  }
37
38
  //# sourceMappingURL=order.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../src/admin/order.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAET,YAAY,EACb,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,KAAK;IAChB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAIpB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,aAAa;eAC9B,SAAS,CAAC,UAAU;;IASxD,eAAe,CACnB,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,iBAAiB,EACnC,OAAO,CAAC,EAAE,aAAa;IAWnB,IAAI,CACR,WAAW,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC,iBAAiB,EACtD,OAAO,CAAC,EAAE,aAAa;gBAGO,SAAS,CAAC,UAAU,EAAE;;IAOhD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;eACN,SAAS,CAAC,U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AE,EAAE,MAAM,EACV,WAAW,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC,sBAAsB,EAC3D,OAAO,CAAC,EAAE,aAAa;CAS1B"}
@@ -93,5 +93,13 @@ export class Order {
93
93
  });
94
94
  });
95
95
  }
96
+ listLineItems(id, queryParams, headers) {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ return yield this.client.fetch(`/admin/orders/${id}/line-items`, {
99
+ query: queryParams,
100
+ headers,
101
+ });
102
+ });
103
+ }
96
104
  }
97
105
  //# sourceMappingURL=order.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"order.js","sourceRoot":"","sources":["../../../src/admin/order.ts"],"names":[],"mappings":";;;;;;;;;AAWA,MAAM,OAAO,KAAK;IAKhB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEK,QAAQ,CAAC,EAAU,EAAE,KAAoB,EAAE,OAAuB;;YACtE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,EAAE,EACrB;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAEK,eAAe,CACnB,EAAU,EACV,KAAmC,EACnC,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,UAAU,EAC7B;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAEK,IAAI,CACR,WAAsD,EACtD,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAE5B,eAAe,EAAE;gBACjB,KAAK,EAAE,WAAW;gBAClB,OAAO;aACR,CAAC,CAAA;QACJ,CAAC;KAAA;IAEK,MAAM,CAAC,EAAU,EAAE,OAAuB;;YAC9C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,SAAS,EAC5B;gBAC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AA;CACF"}
@@ -5,17 +5,173 @@ export declare class Auth {
5
5
  private client;
6
6
  private config;
7
7
  constructor(client: Client, config: Config);
8
+ /**
9
+ * This method is used to retrieve a registration JWT token for a user, customer, or custom actor type. It sends a request to the
10
+ * [Retrieve Registration Token API route](https://docs.medusajs.com/v2/api/store#auth_postactor_typeauth_provider_register).
11
+ *
12
+ * @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
13
+ * @param method - The authentication provider to use. For example, `emailpass` or `google`.
14
+ * @param payload - The data to pass in the request's body for authentication. When using the `emailpass` provider,
15
+ * you pass the email and password.
16
+ * @returns The JWT token used for registration later.
17
+ *
18
+ * @example
19
+ * sdk.auth.register(
20
+ * "customer",
21
+ * "emailpass",
22
+ * {
23
+ * email: "customer@gmail.com",
24
+ * password: "supersecret"
25
+ * }
26
+ * ).then((token) => {
27
+ * console.log(token)
28
+ * })
29
+ */
8
30
  register: (actor: string, method: string, payload: HttpTypes.AdminSignUpWithEmailPassword) => Promise<string>;
31
+ /**
32
+ * This method retrieves the JWT authenticated token for an admin user, customer, or custom
33
+ * actor type. It sends a request to the [Authenticate API Route](https://docs.medusajs.com/v2/api/admin#auth_postactor_typeauth_provider).
34
+ *
35
+ * If the `auth.type` of the SDK is set to `session`, this method will also send a request to the
36
+ * [Set Authentication Session API route](https://docs.medusajs.com/v2/api/admin#auth_postsession).
37
+ *
38
+ * Subsequent requests using the SDK will automatically have the necessary authentication headers / session
39
+ * set.
40
+ *
41
+ * @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
42
+ * @param method - The authentication provider to use. For example, `emailpass` or `google`.
43
+ * @param payload - The data to pass in the request's body for authentication. When using the `emailpass` provider,
44
+ * you pass the email and password.
45
+ * @returns The authentication JWT token
46
+ *
47
+ * @example
48
+ * sdk.auth.login(
49
+ * "customer",
50
+ * "emailpass",
51
+ * {
52
+ * email: "customer@gmail.com",
53
+ * password: "supersecret"
54
+ * }
55
+ * ).then((token) => {
56
+ * console.log(token)
57
+ * })
58
+ */
9
59
  login: (actor: string, method: string, payload: HttpTypes.AdminSignInWithEmailPassword | Record<string, unknown>) => Promise<string | {
10
60
  location: string;
11
61
  }>;
62
+ /**
63
+ * This method is used to validate an Oauth callback from a third-party service, such as Google, for an admin user, customer, or custom actor types.
64
+ * It sends a request to the [Validate Authentication Callback](https://docs.medusajs.com/v2/api/admin#auth_postactor_typeauth_providercallback).
65
+ *
66
+ * @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
67
+ * @param method - The authentication provider to use. For example, `google`.
68
+ * @param query - The query parameters from the Oauth callback, which should be passed to the API route.
69
+ * @returns The authentication JWT token
70
+ *
71
+ * @example
72
+ * sdk.auth.callback(
73
+ * "customer",
74
+ * "google",
75
+ * {
76
+ * code: "123",
77
+ * }
78
+ * ).then((token) => {
79
+ * console.log(token)
80
+ * })
81
+ *
82
+ *
83
+ * @privateRemarks
84
+ * The callback expects all query parameters from the Oauth callback to be passed to
85
+ * the backend, and the provider is in charge of parsing and validating them
86
+ */
12
87
  callback: (actor: string, method: string, query?: Record<string, unknown>) => Promise<string>;
88
+ /**
89
+ * This method refreshes a JWT authentication token, which is useful after validating the Oauth callback
90
+ * with {@link callback}. It sends a request to the [Refresh Authentication Token API route](https://docs.medusajs.com/v2/api/admin#auth_postadminauthtokenrefresh).
91
+ *
92
+ * @returns The refreshed JWT authentication token.
93
+ *
94
+ * @example
95
+ * sdk.auth.refresh()
96
+ * .then((token) => {
97
+ * console.log(token)
98
+ * })
99
+ */
13
100
  refresh: () => Promise<string>;
101
+ /**
102
+ * This method deletes the authentication session of the currently logged-in user to log them out.
103
+ * It sends a request to the [Delete Authentication Session API route](https://docs.medusajs.com/v2/api/admin#auth_deletesession).
104
+ *
105
+ * @example
106
+ * sdk.auth.logout()
107
+ * .then(() => {
108
+ * // user is logged out
109
+ * })
110
+ */
14
111
  logout: () => Promise<void>;
112
+ /**
113
+ * This method requests a reset password token for an admin user, customer, or custom actor type.
114
+ * It sends a request to the [Generate Reset Password Token API route](https://docs.medusajs.com/v2/api/admin#auth_postactor_typeauth_providerresetpassword).
115
+ *
116
+ * To reset the password later using the token delivered to the user, use the {@link updateProvider} method.
117
+ *
118
+ * Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.medusajs.com/v2/resources/storefront-development/customers/reset-password).
119
+ *
120
+ * @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
121
+ * @param provider - The authentication provider to use. For example, `emailpass`.
122
+ * @param body - The data required to identify the user.
123
+ *
124
+ * @example
125
+ * sdk.auth.resetPassword(
126
+ * "customer",
127
+ * "emailpass",
128
+ * {
129
+ * identifier: "customer@gmail.com"
130
+ * }
131
+ * )
132
+ * .then(() => {
133
+ * // user receives token
134
+ * })
135
+ */
15
136
  resetPassword: (actor: string, provider: string, body: {
137
+ /**
138
+ * The user's identifier. For example, when using the `emailpass` provider,
139
+ * this would be the user's email.
140
+ */
16
141
  identifier: string;
17
142
  }) => Promise<void>;
143
+ /**
144
+ * This method is used to update user-related data authentication data.
145
+ *
146
+ * More specifically, use this method when updating the password of an admin user, customer, or
147
+ * custom actor type after requesting to reset their password with {@link resetPassword}.
148
+ *
149
+ * This method sends a request to [this API route](https://docs.medusajs.com/v2/api/admin#auth_postactor_typeauth_providerupdate).
150
+ *
151
+ * Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.medusajs.com/v2/resources/storefront-development/customers/reset-password).
152
+ *
153
+ * @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
154
+ * @param provider - The authentication provider to use. For example, `emailpass`.
155
+ * @param body - The data necessary to update the user's authentication data. When resetting the user's password,
156
+ * send the `email` and `password` properties.
157
+ *
158
+ * @example
159
+ * sdk.auth.updateProvider(
160
+ * "customer",
161
+ * "emailpass",
162
+ * {
163
+ * email: "customer@gmail.com",
164
+ * password: "supersecret"
165
+ * }
166
+ * )
167
+ * .then(() => {
168
+ * // password updated
169
+ * })
170
+ */
18
171
  updateProvider: (actor: string, provider: string, body: Record<string, unknown>) => Promise<void>;
172
+ /**
173
+ * @ignore
174
+ */
19
175
  private setToken_;
20
176
  }
21
177
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,qBAAa,IAAI;IACf,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,MAAM,CAAQ;gBAEV,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAK1C,QAAQ,UACC,MAAM,UACL,MAAM,WACL,SAAS,CAAC,4BAA4B,qBAahD;IAED,KAAK,UACI,MAAM,UACL,MAAM,WACL,SAAS,CAAC,4BAA4B,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;OAmB1E;IAGD,QAAQ,UACC,MAAM,UACL,MAAM,UACN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,qBAYhC;IAED,OAAO,wBAYN;IAED,MAAM,sBAQL;IAED,aAAa,UACJ,MAAM,YACH,MAAM,QACV;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,mBAO7B;IAED,cAAc,UACL,MAAM,YACH,MAAM,QACV,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,mBAM9B;IAED,OAAO,CAAC,SAAS,CAUhB;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,qBAAa,IAAI;IACf,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,MAAM,CA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