@medusajs/js-sdk 0.0.2-snapshot-20240925111619 → 0.0.2-snapshot-20240927035525

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. package/dist/admin/api-key.js +5 -1
  2. package/dist/admin/api-key.js.map +1 -1
  3. package/dist/admin/campaign.js +5 -1
  4. package/dist/admin/campaign.js.map +1 -1
  5. package/dist/admin/claim.js +5 -1
  6. package/dist/admin/claim.js.map +1 -1
  7. package/dist/admin/currency.js +5 -1
  8. package/dist/admin/currency.js.map +1 -1
  9. package/dist/admin/customer-group.js +5 -1
  10. package/dist/admin/customer-group.js.map +1 -1
  11. package/dist/admin/customer.d.ts.map +1 -1
  12. package/dist/admin/customer.js +5 -1
  13. package/dist/admin/customer.js.map +1 -1
  14. package/dist/admin/exchange.js +5 -1
  15. package/dist/admin/exchange.js.map +1 -1
  16. package/dist/admin/fulfillment-provider.js +5 -1
  17. package/dist/admin/fulfillment-provider.js.map +1 -1
  18. package/dist/admin/fulfillment-set.js +5 -1
  19. package/dist/admin/fulfillment-set.js.map +1 -1
  20. package/dist/admin/fulfillment.d.ts.map +1 -1
  21. package/dist/admin/fulfillment.js +5 -1
  22. package/dist/admin/fulfillment.js.map +1 -1
  23. package/dist/admin/index.js +90 -83
  24. package/dist/admin/index.js.map +1 -1
  25. package/dist/admin/inventory-item.js +5 -1
  26. package/dist/admin/inventory-item.js.map +1 -1
  27. package/dist/admin/invite.d.ts.map +1 -1
  28. package/dist/admin/invite.js +5 -1
  29. package/dist/admin/invite.js.map +1 -1
  30. package/dist/admin/notification.js +5 -1
  31. package/dist/admin/notification.js.map +1 -1
  32. package/dist/admin/order-edit.js +5 -1
  33. package/dist/admin/order-edit.js.map +1 -1
  34. package/dist/admin/order.d.ts.map +1 -1
  35. package/dist/admin/order.js +5 -1
  36. package/dist/admin/order.js.map +1 -1
  37. package/dist/admin/payment-collection.js +5 -1
  38. package/dist/admin/payment-collection.js.map +1 -1
  39. package/dist/admin/payment.js +5 -1
  40. package/dist/admin/payment.js.map +1 -1
  41. package/dist/admin/price-list.js +5 -1
  42. package/dist/admin/price-list.js.map +1 -1
  43. package/dist/admin/price-preference.js +5 -1
  44. package/dist/admin/price-preference.js.map +1 -1
  45. package/dist/admin/product-category.js +5 -1
  46. package/dist/admin/product-category.js.map +1 -1
  47. package/dist/admin/product-collection.js +5 -1
  48. package/dist/admin/product-collection.js.map +1 -1
  49. package/dist/admin/product-tag.js +5 -1
  50. package/dist/admin/product-tag.js.map +1 -1
  51. package/dist/admin/product-type.js +5 -1
  52. package/dist/admin/product-type.js.map +1 -1
  53. package/dist/admin/product-variant.js +5 -1
  54. package/dist/admin/product-variant.js.map +1 -1
  55. package/dist/admin/product.js +5 -1
  56. package/dist/admin/product.js.map +1 -1
  57. package/dist/admin/promotion.js +5 -1
  58. package/dist/admin/promotion.js.map +1 -1
  59. package/dist/admin/refund-reasons.js +5 -1
  60. package/dist/admin/refund-reasons.js.map +1 -1
  61. package/dist/admin/region.d.ts.map +1 -1
  62. package/dist/admin/region.js +5 -1
  63. package/dist/admin/region.js.map +1 -1
  64. package/dist/admin/reservation.js +3 -1
  65. package/dist/admin/reservation.js.map +1 -1
  66. package/dist/admin/return-reason.js +5 -1
  67. package/dist/admin/return-reason.js.map +1 -1
  68. package/dist/admin/return.js +5 -1
  69. package/dist/admin/return.js.map +1 -1
  70. package/dist/admin/sales-channel.js +5 -1
  71. package/dist/admin/sales-channel.js.map +1 -1
  72. package/dist/admin/shipping-option.js +5 -1
  73. package/dist/admin/shipping-option.js.map +1 -1
  74. package/dist/admin/shipping-profile.js +5 -1
  75. package/dist/admin/shipping-profile.js.map +1 -1
  76. package/dist/admin/stock-location.js +5 -1
  77. package/dist/admin/stock-location.js.map +1 -1
  78. package/dist/admin/store.js +5 -1
  79. package/dist/admin/store.js.map +1 -1
  80. package/dist/admin/tax-rate.js +5 -1
  81. package/dist/admin/tax-rate.js.map +1 -1
  82. package/dist/admin/tax-region.js +5 -1
  83. package/dist/admin/tax-region.js.map +1 -1
  84. package/dist/admin/upload.d.ts.map +1 -1
  85. package/dist/admin/upload.js +5 -1
  86. package/dist/admin/upload.js.map +1 -1
  87. package/dist/admin/user.js +5 -1
  88. package/dist/admin/user.js.map +1 -1
  89. package/dist/admin/workflow-execution.js +5 -1
  90. package/dist/admin/workflow-execution.js.map +1 -1
  91. package/dist/auth/index.d.ts.map +1 -1
  92. package/dist/auth/index.js +5 -1
  93. package/dist/auth/index.js.map +1 -1
  94. package/dist/client.d.ts.map +1 -1
  95. package/dist/client.js +16 -8
  96. package/dist/client.js.map +1 -1
  97. package/dist/esm/admin/api-key.d.ts +15 -0
  98. package/dist/esm/admin/api-key.d.ts.map +1 -0
  99. package/dist/esm/admin/api-key.js +75 -0
  100. package/dist/esm/admin/api-key.js.map +1 -0
  101. package/dist/esm/admin/campaign.d.ts +14 -0
  102. package/dist/esm/admin/campaign.d.ts.map +1 -0
  103. package/dist/esm/admin/campaign.js +66 -0
  104. package/dist/esm/admin/campaign.js.map +1 -0
  105. package/dist/esm/admin/claim.d.ts +30 -0
  106. package/dist/esm/admin/claim.d.ts.map +1 -0
  107. package/dist/esm/admin/claim.js +223 -0
  108. package/dist/esm/admin/claim.js.map +1 -0
  109. package/dist/esm/admin/currency.d.ts +10 -0
  110. package/dist/esm/admin/currency.d.ts.map +1 -0
  111. package/dist/esm/admin/currency.js +31 -0
  112. package/dist/esm/admin/currency.js.map +1 -0
  113. package/dist/esm/admin/customer-group.d.ts +14 -0
  114. package/dist/esm/admin/customer-group.d.ts.map +1 -0
  115. package/dist/esm/admin/customer-group.js +70 -0
  116. package/dist/esm/admin/customer-group.js.map +1 -0
  117. package/dist/esm/admin/customer.d.ts +21 -0
  118. package/dist/esm/admin/customer.d.ts.map +1 -0
  119. package/dist/esm/admin/customer.js +59 -0
  120. package/dist/esm/admin/customer.js.map +1 -0
  121. package/dist/esm/admin/exchange.d.ts +30 -0
  122. package/dist/esm/admin/exchange.d.ts.map +1 -0
  123. package/dist/esm/admin/exchange.js +223 -0
  124. package/dist/esm/admin/exchange.js.map +1 -0
  125. package/dist/esm/admin/fulfillment-provider.d.ts +9 -0
  126. package/dist/esm/admin/fulfillment-provider.d.ts.map +1 -0
  127. package/dist/esm/admin/fulfillment-provider.js +24 -0
  128. package/dist/esm/admin/fulfillment-provider.js.map +1 -0
  129. package/dist/esm/admin/fulfillment-set.d.ts +13 -0
  130. package/dist/esm/admin/fulfillment-set.d.ts.map +1 -0
  131. package/dist/esm/admin/fulfillment-set.js +60 -0
  132. package/dist/esm/admin/fulfillment-set.js.map +1 -0
  133. package/dist/esm/admin/fulfillment.d.ts +11 -0
  134. package/dist/esm/admin/fulfillment.d.ts.map +1 -0
  135. package/dist/esm/admin/fulfillment.js +44 -0
  136. package/dist/esm/admin/fulfillment.js.map +1 -0
  137. package/dist/esm/admin/index.d.ts +87 -0
  138. package/dist/esm/admin/index.d.ts.map +1 -0
  139. package/dist/esm/admin/index.js +87 -0
  140. package/dist/esm/admin/index.js.map +1 -0
  141. package/dist/esm/admin/inventory-item.d.ts +17 -0
  142. package/dist/esm/admin/inventory-item.d.ts.map +1 -0
  143. package/dist/esm/admin/inventory-item.js +95 -0
  144. package/dist/esm/admin/inventory-item.js.map +1 -0
  145. package/dist/esm/admin/invite.d.ts +26 -0
  146. package/dist/esm/admin/invite.d.ts.map +1 -0
  147. package/dist/esm/admin/invite.js +79 -0
  148. package/dist/esm/admin/invite.js.map +1 -0
  149. package/dist/esm/admin/notification.d.ts +10 -0
  150. package/dist/esm/admin/notification.d.ts.map +1 -0
  151. package/dist/esm/admin/notification.js +33 -0
  152. package/dist/esm/admin/notification.js.map +1 -0
  153. package/dist/esm/admin/order-edit.d.ts +16 -0
  154. package/dist/esm/admin/order-edit.d.ts.map +1 -0
  155. package/dist/esm/admin/order-edit.js +91 -0
  156. package/dist/esm/admin/order-edit.js.map +1 -0
  157. package/dist/esm/admin/order.d.ts +32 -0
  158. package/dist/esm/admin/order.d.ts.map +1 -0
  159. package/dist/esm/admin/order.js +94 -0
  160. package/dist/esm/admin/order.js.map +1 -0
  161. package/dist/esm/admin/payment-collection.d.ts +13 -0
  162. package/dist/esm/admin/payment-collection.d.ts.map +1 -0
  163. package/dist/esm/admin/payment-collection.js +59 -0
  164. package/dist/esm/admin/payment-collection.js.map +1 -0
  165. package/dist/esm/admin/payment.d.ts +13 -0
  166. package/dist/esm/admin/payment.d.ts.map +1 -0
  167. package/dist/esm/admin/payment.js +59 -0
  168. package/dist/esm/admin/payment.js.map +1 -0
  169. package/dist/esm/admin/price-list.d.ts +15 -0
  170. package/dist/esm/admin/price-list.d.ts.map +1 -0
  171. package/dist/esm/admin/price-list.js +81 -0
  172. package/dist/esm/admin/price-list.js.map +1 -0
  173. package/dist/esm/admin/price-preference.d.ts +13 -0
  174. package/dist/esm/admin/price-preference.d.ts.map +1 -0
  175. package/dist/esm/admin/price-preference.js +61 -0
  176. package/dist/esm/admin/price-preference.js.map +1 -0
  177. package/dist/esm/admin/product-category.d.ts +14 -0
  178. package/dist/esm/admin/product-category.d.ts.map +1 -0
  179. package/dist/esm/admin/product-category.js +69 -0
  180. package/dist/esm/admin/product-category.js.map +1 -0
  181. package/dist/esm/admin/product-collection.d.ts +14 -0
  182. package/dist/esm/admin/product-collection.d.ts.map +1 -0
  183. package/dist/esm/admin/product-collection.js +68 -0
  184. package/dist/esm/admin/product-collection.js.map +1 -0
  185. package/dist/esm/admin/product-tag.d.ts +13 -0
  186. package/dist/esm/admin/product-tag.d.ts.map +1 -0
  187. package/dist/esm/admin/product-tag.js +59 -0
  188. package/dist/esm/admin/product-tag.js.map +1 -0
  189. package/dist/esm/admin/product-type.d.ts +13 -0
  190. package/dist/esm/admin/product-type.d.ts.map +1 -0
  191. package/dist/esm/admin/product-type.js +59 -0
  192. package/dist/esm/admin/product-type.js.map +1 -0
  193. package/dist/esm/admin/product-variant.d.ts +9 -0
  194. package/dist/esm/admin/product-variant.d.ts.map +1 -0
  195. package/dist/esm/admin/product-variant.js +23 -0
  196. package/dist/esm/admin/product-variant.js.map +1 -0
  197. package/dist/esm/admin/product.d.ts +29 -0
  198. package/dist/esm/admin/product.d.ts.map +1 -0
  199. package/dist/esm/admin/product.js +211 -0
  200. package/dist/esm/admin/product.js.map +1 -0
  201. package/dist/esm/admin/promotion.d.ts +19 -0
  202. package/dist/esm/admin/promotion.d.ts.map +1 -0
  203. package/dist/esm/admin/promotion.js +110 -0
  204. package/dist/esm/admin/promotion.js.map +1 -0
  205. package/dist/esm/admin/refund-reasons.d.ts +9 -0
  206. package/dist/esm/admin/refund-reasons.d.ts.map +1 -0
  207. package/dist/esm/admin/refund-reasons.js +23 -0
  208. package/dist/esm/admin/refund-reasons.js.map +1 -0
  209. package/dist/esm/admin/region.d.ts +21 -0
  210. package/dist/esm/admin/region.d.ts.map +1 -0
  211. package/dist/esm/admin/region.js +59 -0
  212. package/dist/esm/admin/region.js.map +1 -0
  213. package/dist/esm/admin/reservation.d.ts +14 -0
  214. package/dist/esm/admin/reservation.d.ts.map +1 -0
  215. package/dist/esm/admin/reservation.js +62 -0
  216. package/dist/esm/admin/reservation.js.map +1 -0
  217. package/dist/esm/admin/return-reason.d.ts +13 -0
  218. package/dist/esm/admin/return-reason.d.ts.map +1 -0
  219. package/dist/esm/admin/return-reason.js +60 -0
  220. package/dist/esm/admin/return-reason.js.map +1 -0
  221. package/dist/esm/admin/return.d.ts +30 -0
  222. package/dist/esm/admin/return.d.ts.map +1 -0
  223. package/dist/esm/admin/return.js +224 -0
  224. package/dist/esm/admin/return.js.map +1 -0
  225. package/dist/esm/admin/sales-channel.d.ts +15 -0
  226. package/dist/esm/admin/sales-channel.d.ts.map +1 -0
  227. package/dist/esm/admin/sales-channel.js +79 -0
  228. package/dist/esm/admin/sales-channel.js.map +1 -0
  229. package/dist/esm/admin/shipping-option.d.ts +13 -0
  230. package/dist/esm/admin/shipping-option.d.ts.map +1 -0
  231. package/dist/esm/admin/shipping-option.js +61 -0
  232. package/dist/esm/admin/shipping-option.js.map +1 -0
  233. package/dist/esm/admin/shipping-profile.d.ts +13 -0
  234. package/dist/esm/admin/shipping-profile.d.ts.map +1 -0
  235. package/dist/esm/admin/shipping-profile.js +61 -0
  236. package/dist/esm/admin/shipping-profile.js.map +1 -0
  237. package/dist/esm/admin/stock-location.d.ts +16 -0
  238. package/dist/esm/admin/stock-location.d.ts.map +1 -0
  239. package/dist/esm/admin/stock-location.js +88 -0
  240. package/dist/esm/admin/stock-location.js.map +1 -0
  241. package/dist/esm/admin/store.d.ts +11 -0
  242. package/dist/esm/admin/store.d.ts.map +1 -0
  243. package/dist/esm/admin/store.js +43 -0
  244. package/dist/esm/admin/store.js.map +1 -0
  245. package/dist/esm/admin/tax-rate.d.ts +13 -0
  246. package/dist/esm/admin/tax-rate.d.ts.map +1 -0
  247. package/dist/esm/admin/tax-rate.js +62 -0
  248. package/dist/esm/admin/tax-rate.js.map +1 -0
  249. package/dist/esm/admin/tax-region.d.ts +12 -0
  250. package/dist/esm/admin/tax-region.d.ts.map +1 -0
  251. package/dist/esm/admin/tax-region.js +53 -0
  252. package/dist/esm/admin/tax-region.js.map +1 -0
  253. package/dist/esm/admin/upload.d.ts +15 -0
  254. package/dist/esm/admin/upload.d.ts.map +1 -0
  255. package/dist/esm/admin/upload.js +59 -0
  256. package/dist/esm/admin/upload.js.map +1 -0
  257. package/dist/esm/admin/user.d.ts +14 -0
  258. package/dist/esm/admin/user.d.ts.map +1 -0
  259. package/dist/esm/admin/user.js +67 -0
  260. package/dist/esm/admin/user.js.map +1 -0
  261. package/dist/esm/admin/workflow-execution.d.ts +10 -0
  262. package/dist/esm/admin/workflow-execution.d.ts.map +1 -0
  263. package/dist/esm/admin/workflow-execution.js +30 -0
  264. package/dist/esm/admin/workflow-execution.js.map +1 -0
  265. package/dist/esm/auth/index.d.ts +17 -0
  266. package/dist/esm/auth/index.d.ts.map +1 -0
  267. package/dist/esm/auth/index.js +78 -0
  268. package/dist/esm/auth/index.js.map +1 -0
  269. package/dist/esm/client.d.ts +59 -0
  270. package/dist/esm/client.d.ts.map +1 -0
  271. package/dist/esm/client.js +229 -0
  272. package/dist/esm/client.js.map +1 -0
  273. package/dist/esm/index.d.ts +15 -0
  274. package/dist/esm/index.d.ts.map +1 -0
  275. package/dist/esm/index.js +15 -0
  276. package/dist/esm/index.js.map +1 -0
  277. package/dist/esm/store/index.d.ts +116 -0
  278. package/dist/esm/store/index.d.ts.map +1 -0
  279. package/dist/esm/store/index.js +240 -0
  280. package/dist/esm/store/index.js.map +1 -0
  281. package/dist/esm/types.d.ts +47 -0
  282. package/dist/esm/types.d.ts.map +1 -0
  283. package/dist/esm/types.js +2 -0
  284. package/dist/esm/types.js.map +1 -0
  285. package/dist/index.js +14 -10
  286. package/dist/index.js.map +1 -1
  287. package/dist/store/index.d.ts.map +1 -1
  288. package/dist/store/index.js +5 -1
  289. package/dist/store/index.js.map +1 -1
  290. package/dist/types.js +2 -1
  291. package/package.json +15 -7
@@ -0,0 +1,78 @@
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 Auth {
11
+ constructor(client, config) {
12
+ this.register = (actor, method, payload) => __awaiter(this, void 0, void 0, function* () {
13
+ const { token } = yield this.client.fetch(`/auth/${actor}/${method}/register`, {
14
+ method: "POST",
15
+ body: payload,
16
+ });
17
+ this.client.setToken(token);
18
+ return token;
19
+ });
20
+ this.login = (actor, method, payload) => __awaiter(this, void 0, void 0, function* () {
21
+ // There will either be token or location returned from the backend.
22
+ const { token, location } = yield this.client.fetch(`/auth/${actor}/${method}`, {
23
+ method: "POST",
24
+ body: payload,
25
+ });
26
+ // In the case of an oauth login, we return the redirect location to the caller.
27
+ // They can decide if they do an immediate redirect or put it in an <a> tag.
28
+ if (location) {
29
+ return { location };
30
+ }
31
+ yield this.setToken_(token);
32
+ return token;
33
+ });
34
+ // The callback expects all query parameters from the Oauth callback to be passed to the backend, and the provider is in charge of parsing and validating them
35
+ this.callback = (actor, method, query) => __awaiter(this, void 0, void 0, function* () {
36
+ const { token } = yield this.client.fetch(`/auth/${actor}/${method}/callback`, {
37
+ method: "GET",
38
+ query,
39
+ });
40
+ yield this.setToken_(token);
41
+ return token;
42
+ });
43
+ this.refresh = () => __awaiter(this, void 0, void 0, function* () {
44
+ const { token } = yield this.client.fetch("/auth/token/refresh", {
45
+ method: "POST",
46
+ });
47
+ // Putting the token in session after refreshing is only useful when the new token has updated info (eg. actor_id).
48
+ // Ideally we don't use the full JWT in session as key, but just store a pseudorandom key that keeps the rest of the auth context as value.
49
+ yield this.setToken_(token);
50
+ return token;
51
+ });
52
+ this.logout = () => __awaiter(this, void 0, void 0, function* () {
53
+ var _a, _b;
54
+ if (((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.auth) === null || _b === void 0 ? void 0 : _b.type) === "session") {
55
+ yield this.client.fetch("/auth/session", {
56
+ method: "DELETE",
57
+ });
58
+ }
59
+ this.client.clearToken();
60
+ });
61
+ this.setToken_ = (token) => __awaiter(this, void 0, void 0, function* () {
62
+ var _a, _b;
63
+ // By default we just set the token in the configured storage, if configured to use sessions we convert it into session storage instead.
64
+ if (((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.auth) === null || _b === void 0 ? void 0 : _b.type) === "session") {
65
+ yield this.client.fetch("/auth/session", {
66
+ method: "POST",
67
+ headers: { Authorization: `Bearer ${token}` },
68
+ });
69
+ }
70
+ else {
71
+ this.client.setToken(token);
72
+ }
73
+ });
74
+ this.client = client;
75
+ this.config = config;
76
+ }
77
+ }
78
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+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AAC;CAiGF"}
@@ -0,0 +1,59 @@
1
+ import { ClientFetch, Config, FetchArgs, FetchInput, FetchStreamResponse } from "./types";
2
+ export declare const PUBLISHABLE_KEY_HEADER = "x-publishable-api-key";
3
+ export declare class FetchError extends Error {
4
+ status: number | undefined;
5
+ statusText: string | undefined;
6
+ constructor(message: string, statusText?: string, status?: number);
7
+ }
8
+ export declare class Client {
9
+ fetch_: ClientFetch;
10
+ private config;
11
+ private logger;
12
+ private DEFAULT_JWT_STORAGE_KEY;
13
+ private token;
14
+ constructor(config: Config);
15
+ /**
16
+ * `fetch` closely follows (and uses under the hood) the native `fetch` API. There are, however, few key differences:
17
+ * - Non 2xx statuses throw a `FetchError` with the status code as the `status` property, rather than resolving the promise
18
+ * - You can pass `body` and `query` as objects, and they will be encoded and stringified.
19
+ * - The response gets parsed as JSON if the `accept` header is set to `application/json`, otherwise the raw Response object is returned
20
+ *
21
+ * Since the response is dynamically determined, we cannot know if it is JSON or not. Therefore, it is important to pass `Response` as the return type
22
+ *
23
+ * @param input: FetchInput
24
+ * @param init: FetchArgs
25
+ * @returns Promise<T>
26
+ */
27
+ fetch<T extends any>(input: FetchInput, init?: FetchArgs): Promise<T>;
28
+ /**
29
+ * `fetchStream` is a helper method to deal with server-sent events. It returns an object with a stream and an abort function.
30
+ * It follows a very similar interface to `fetch`, with the return value being an async generator.
31
+ * The stream is an async generator that yields `ServerSentEventMessage` objects, which contains the event name, stringified data, and few other properties.
32
+ * The caller is responsible for handling `disconnect` events and aborting the stream. The caller is also responsible for parsing the data field.
33
+ *
34
+ * @param input: FetchInput
35
+ * @param init: FetchArgs
36
+ * @returns FetchStreamResponse
37
+ */
38
+ fetchStream(input: FetchInput, init?: FetchArgs): Promise<FetchStreamResponse>;
39
+ setToken(token: string): void;
40
+ clearToken(): void;
41
+ protected clearToken_(): void;
42
+ protected initClient(): ClientFetch;
43
+ protected getApiKeyHeader_: () => {
44
+ Authorization: string;
45
+ } | {};
46
+ protected getPublishableKeyHeader_: () => {
47
+ [PUBLISHABLE_KEY_HEADER]: string;
48
+ } | {};
49
+ protected getJwtHeader_: () => {
50
+ Authorization: string;
51
+ } | {};
52
+ protected setToken_: (token: string) => void;
53
+ protected getToken_: () => string | null | undefined;
54
+ protected getTokenStorageInfo_: () => {
55
+ storageMethod: "session" | "local" | "memory";
56
+ storageKey: string;
57
+ };
58
+ }
59
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,MAAM,EACN,SAAS,EACT,UAAU,EACV,mBAAmB,EAEpB,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,sBAAsB,0BAA0B,CAAA;AA6D7D,qBAAa,UAAW,SAAQ,KAAK;IACnC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;gBAElB,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAKlE;AAED,qBAAa,MAAM;IACV,MAAM,EAAE,WAAW,CAAA;IAC1B,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO,CAAC,uBAAuB,CAAsB;IACrD,OAAO,CAAC,KAAK,CAAK;gBAEN,MAAM,EAAE,MAAM;IAiB1B;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,CAAC,SAAS,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC;IAIrE;;;;;;;;;OASG;IACG,WAAW,CACf,KAAK,EAAE,UAAU,EACjB,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,mBAAmB,CAAC;IAgB/B,QAAQ,CAAC,KAAK,EAAE,MAAM;IAItB,UAAU;IAIV,SAAS,CAAC,WAAW;IAkBrB,SAAS,CAAC,UAAU,IAAI,WAAW;IA2DnC,SAAS,CAAC,gBAAgB,QAAO;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,GAAG,EAAE,CAI9D;IAED,SAAS,CAAC,wBAAwB,QAC9B;QAAE,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAA;KAAE,GACpC,EAAE,CAIL;IAED,SAAS,CAAC,aAAa,QAAO;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,GAAG,EAAE,CAQ3D;IAED,SAAS,CAAC,SAAS,UAAW,MAAM,UAgBnC;IAED,SAAS,CAAC,SAAS,kCAelB;IAED,SAAS,CAAC,oBAAoB;;;MAoB7B;CACF"}
@@ -0,0 +1,229 @@
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
+ import qs from "qs";
11
+ import { events } from "fetch-event-stream";
12
+ export const PUBLISHABLE_KEY_HEADER = "x-publishable-api-key";
13
+ const hasStorage = (storage) => {
14
+ if (typeof window !== "undefined") {
15
+ return storage in window;
16
+ }
17
+ return false;
18
+ };
19
+ const toBase64 = (str) => {
20
+ if (typeof window !== "undefined") {
21
+ return window.btoa(str);
22
+ }
23
+ return Buffer.from(str).toString("base64");
24
+ };
25
+ const sanitizeHeaders = (headers) => {
26
+ return Object.assign(Object.assign({}, Object.fromEntries(headers.entries())), { authorization: "<REDACTED>" });
27
+ };
28
+ const normalizeRequest = (init, headers, config) => {
29
+ var _a, _b;
30
+ let body = init === null || init === void 0 ? void 0 : init.body;
31
+ if (body && ((_a = headers.get("content-type")) === null || _a === void 0 ? void 0 : _a.includes("application/json"))) {
32
+ body = JSON.stringify(body);
33
+ }
34
+ return Object.assign(Object.assign(Object.assign({}, init), { headers,
35
+ // TODO: Setting this to "include" poses some security risks, as it will send cookies to any domain. We should consider making this configurable.
36
+ credentials: ((_b = config.auth) === null || _b === void 0 ? void 0 : _b.type) === "session" ? "include" : "omit" }), (body ? { body: body } : {}));
37
+ };
38
+ const normalizeResponse = (resp, reqHeaders) => __awaiter(void 0, void 0, void 0, function* () {
39
+ var _a, _b;
40
+ if (resp.status >= 300) {
41
+ const jsonError = (yield resp.json().catch(() => ({})));
42
+ throw new FetchError((_a = jsonError.message) !== null && _a !== void 0 ? _a : resp.statusText, resp.statusText, resp.status);
43
+ }
44
+ // If we requested JSON, we try to parse the response. Otherwise, we return the raw response.
45
+ const isJsonRequest = (_b = reqHeaders.get("accept")) === null || _b === void 0 ? void 0 : _b.includes("application/json");
46
+ return isJsonRequest ? yield resp.json() : resp;
47
+ });
48
+ export class FetchError extends Error {
49
+ constructor(message, statusText, status) {
50
+ super(message);
51
+ this.statusText = statusText;
52
+ this.status = status;
53
+ }
54
+ }
55
+ export class Client {
56
+ constructor(config) {
57
+ this.DEFAULT_JWT_STORAGE_KEY = "medusa_auth_token";
58
+ this.token = "";
59
+ this.getApiKeyHeader_ = () => {
60
+ return this.config.apiKey
61
+ ? { Authorization: "Basic " + toBase64(this.config.apiKey + ":") }
62
+ : {};
63
+ };
64
+ this.getPublishableKeyHeader_ = () => {
65
+ return this.config.publishableKey
66
+ ? { [PUBLISHABLE_KEY_HEADER]: this.config.publishableKey }
67
+ : {};
68
+ };
69
+ this.getJwtHeader_ = () => {
70
+ var _a;
71
+ // If the user has requested for session storage, we don't want to send the JWT token in the header.
72
+ if (((_a = this.config.auth) === null || _a === void 0 ? void 0 : _a.type) === "session") {
73
+ return {};
74
+ }
75
+ const token = this.getToken_();
76
+ return token ? { Authorization: `Bearer ${token}` } : {};
77
+ };
78
+ this.setToken_ = (token) => {
79
+ const { storageMethod, storageKey } = this.getTokenStorageInfo_();
80
+ switch (storageMethod) {
81
+ case "local": {
82
+ window.localStorage.setItem(storageKey, token);
83
+ break;
84
+ }
85
+ case "session": {
86
+ window.sessionStorage.setItem(storageKey, token);
87
+ break;
88
+ }
89
+ case "memory": {
90
+ this.token = token;
91
+ break;
92
+ }
93
+ }
94
+ };
95
+ this.getToken_ = () => {
96
+ const { storageMethod, storageKey } = this.getTokenStorageInfo_();
97
+ switch (storageMethod) {
98
+ case "local": {
99
+ return window.localStorage.getItem(storageKey);
100
+ }
101
+ case "session": {
102
+ return window.sessionStorage.getItem(storageKey);
103
+ }
104
+ case "memory": {
105
+ return this.token;
106
+ }
107
+ }
108
+ return;
109
+ };
110
+ this.getTokenStorageInfo_ = () => {
111
+ var _a, _b;
112
+ const hasLocal = hasStorage("localStorage");
113
+ const hasSession = hasStorage("sessionStorage");
114
+ const storageMethod = ((_a = this.config.auth) === null || _a === void 0 ? void 0 : _a.jwtTokenStorageMethod) || (hasLocal ? "local" : "memory");
115
+ const storageKey = ((_b = this.config.auth) === null || _b === void 0 ? void 0 : _b.jwtTokenStorageKey) || this.DEFAULT_JWT_STORAGE_KEY;
116
+ if (!hasLocal && storageMethod === "local") {
117
+ throw new Error("Local JWT storage is only available in the browser");
118
+ }
119
+ if (!hasSession && storageMethod === "session") {
120
+ throw new Error("Session JWT storage is only available in the browser");
121
+ }
122
+ return {
123
+ storageMethod,
124
+ storageKey,
125
+ };
126
+ };
127
+ this.config = config;
128
+ const logger = config.logger || {
129
+ error: console.error,
130
+ warn: console.warn,
131
+ info: console.info,
132
+ debug: console.debug,
133
+ };
134
+ this.logger = Object.assign(Object.assign({}, logger), { debug: config.debug ? logger.debug : () => { } });
135
+ this.fetch_ = this.initClient();
136
+ }
137
+ /**
138
+ * `fetch` closely follows (and uses under the hood) the native `fetch` API. There are, however, few key differences:
139
+ * - Non 2xx statuses throw a `FetchError` with the status code as the `status` property, rather than resolving the promise
140
+ * - You can pass `body` and `query` as objects, and they will be encoded and stringified.
141
+ * - The response gets parsed as JSON if the `accept` header is set to `application/json`, otherwise the raw Response object is returned
142
+ *
143
+ * Since the response is dynamically determined, we cannot know if it is JSON or not. Therefore, it is important to pass `Response` as the return type
144
+ *
145
+ * @param input: FetchInput
146
+ * @param init: FetchArgs
147
+ * @returns Promise<T>
148
+ */
149
+ fetch(input, init) {
150
+ return this.fetch_(input, init);
151
+ }
152
+ /**
153
+ * `fetchStream` is a helper method to deal with server-sent events. It returns an object with a stream and an abort function.
154
+ * It follows a very similar interface to `fetch`, with the return value being an async generator.
155
+ * The stream is an async generator that yields `ServerSentEventMessage` objects, which contains the event name, stringified data, and few other properties.
156
+ * The caller is responsible for handling `disconnect` events and aborting the stream. The caller is also responsible for parsing the data field.
157
+ *
158
+ * @param input: FetchInput
159
+ * @param init: FetchArgs
160
+ * @returns FetchStreamResponse
161
+ */
162
+ fetchStream(input, init) {
163
+ return __awaiter(this, void 0, void 0, function* () {
164
+ let abort = new AbortController();
165
+ let res = yield this.fetch_(input, Object.assign(Object.assign({}, init), { signal: abort.signal, headers: Object.assign(Object.assign({}, init === null || init === void 0 ? void 0 : init.headers), { accept: "text/event-stream" }) }));
166
+ if (res.ok) {
167
+ return { stream: events(res, abort.signal), abort: abort.abort };
168
+ }
169
+ return { stream: null, abort: abort.abort };
170
+ });
171
+ }
172
+ setToken(token) {
173
+ this.setToken_(token);
174
+ }
175
+ clearToken() {
176
+ this.clearToken_();
177
+ }
178
+ clearToken_() {
179
+ const { storageMethod, storageKey } = this.getTokenStorageInfo_();
180
+ switch (storageMethod) {
181
+ case "local": {
182
+ window.localStorage.removeItem(storageKey);
183
+ break;
184
+ }
185
+ case "session": {
186
+ window.sessionStorage.removeItem(storageKey);
187
+ break;
188
+ }
189
+ case "memory": {
190
+ this.token = "";
191
+ break;
192
+ }
193
+ }
194
+ }
195
+ initClient() {
196
+ const defaultHeaders = new Headers(Object.assign(Object.assign({ "content-type": "application/json", accept: "application/json" }, this.getApiKeyHeader_()), this.getPublishableKeyHeader_()));
197
+ this.logger.debug("Initiating Medusa client with default headers:\n", `${JSON.stringify(sanitizeHeaders(defaultHeaders), null, 2)}\n`);
198
+ return (input, init) => __awaiter(this, void 0, void 0, function* () {
199
+ // We always want to fetch the up-to-date JWT token before firing off a request.
200
+ const headers = new Headers(defaultHeaders);
201
+ const customHeaders = Object.assign(Object.assign(Object.assign({}, this.config.globalHeaders), this.getJwtHeader_()), init === null || init === void 0 ? void 0 : init.headers);
202
+ // We use `headers.set` in order to ensure headers are overwritten in a case-insensitive manner.
203
+ Object.entries(customHeaders).forEach(([key, value]) => {
204
+ if (value === null) {
205
+ headers.delete(key);
206
+ }
207
+ else {
208
+ headers.set(key, value);
209
+ }
210
+ });
211
+ let normalizedInput = input;
212
+ if (input instanceof URL || typeof input === "string") {
213
+ normalizedInput = new URL(input, this.config.baseUrl);
214
+ if (init === null || init === void 0 ? void 0 : init.query) {
215
+ const params = Object.fromEntries(normalizedInput.searchParams.entries());
216
+ const stringifiedQuery = qs.stringify(Object.assign(Object.assign({}, params), init.query));
217
+ normalizedInput.search = stringifiedQuery;
218
+ }
219
+ }
220
+ this.logger.debug("Performing request to:\n", `URL: ${normalizedInput.toString()}\n`, `Headers: ${JSON.stringify(sanitizeHeaders(headers), null, 2)}\n`);
221
+ // Any non-request errors (eg. invalid JSON in the response) will be thrown as-is.
222
+ return yield fetch(normalizedInput, normalizeRequest(init, headers, this.config)).then((resp) => {
223
+ this.logger.debug(`Received response with status ${resp.status}\n`);
224
+ return normalizeResponse(resp, headers);
225
+ });
226
+ });
227
+ }
228
+ }
229
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAU3C,MAAM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AAC,iCAAiC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAA;gBACnE,OAAO,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;YACzC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAA,CAAA;IACH,CAAC;CAkFF"}
@@ -0,0 +1,15 @@
1
+ import { Admin } from "./admin";
2
+ import { Auth } from "./auth";
3
+ import { Client } from "./client";
4
+ import { Store } from "./store";
5
+ import { Config } from "./types";
6
+ declare class Medusa {
7
+ client: Client;
8
+ admin: Admin;
9
+ store: Store;
10
+ auth: Auth;
11
+ constructor(config: Config);
12
+ }
13
+ export default Medusa;
14
+ export { FetchError } from "./client";
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEhC,cAAM,MAAM;IACH,MAAM,EAAE,MAAM,CAAA;IAEd,KAAK,EAAE,KAAK,CAAA;IACZ,KAAK,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,IAAI,CAAA;gBAEL,MAAM,EAAE,MAAM;CAO3B;AAED,eAAe,MAAM,CAAA;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { Admin } from "./admin";
2
+ import { Auth } from "./auth";
3
+ import { Client } from "./client";
4
+ import { Store } from "./store";
5
+ class Medusa {
6
+ constructor(config) {
7
+ this.client = new Client(config);
8
+ this.admin = new Admin(this.client);
9
+ this.store = new Store(this.client);
10
+ this.auth = new Auth(this.client, config);
11
+ }
12
+ }
13
+ export default Medusa;
14
+ export { FetchError } from "./client";
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG/B,MAAM,MAAM;IAOV,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAA;QAEhC,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACnC,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC3C,CAAC;CACF;AAED,eAAe,MAAM,CAAA;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA"}
@@ -0,0 +1,116 @@
1
+ import { FindParams, HttpTypes, SelectParams } from "@medusajs/types";
2
+ import { Client } from "../client";
3
+ import { ClientHeaders } from "../types";
4
+ export declare class Store {
5
+ private client;
6
+ constructor(client: Client);
7
+ region: {
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
+ }>;
14
+ };
15
+ collection: {
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
+ }>;
22
+ };
23
+ category: {
24
+ list: (query?: HttpTypes.StoreProductCategoryParams, headers?: ClientHeaders) => Promise<HttpTypes.PaginatedResponse<{
25
+ product_categories: HttpTypes.StoreProductCategory[];
26
+ }>>;
27
+ retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
28
+ product_category: HttpTypes.StoreProductCategory;
29
+ }>;
30
+ };
31
+ product: {
32
+ list: (query?: HttpTypes.StoreProductParams, headers?: ClientHeaders) => Promise<HttpTypes.StoreProductListResponse>;
33
+ retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<HttpTypes.StoreProductResponse>;
34
+ };
35
+ cart: {
36
+ create: (body: HttpTypes.StoreCreateCart, query?: SelectParams, headers?: ClientHeaders) => Promise<{
37
+ cart: HttpTypes.StoreCart;
38
+ }>;
39
+ update: (id: string, body: HttpTypes.StoreUpdateCart, query?: SelectParams, headers?: ClientHeaders) => Promise<{
40
+ cart: HttpTypes.StoreCart;
41
+ }>;
42
+ retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
43
+ cart: HttpTypes.StoreCart;
44
+ }>;
45
+ createLineItem: (cartId: string, body: HttpTypes.StoreAddCartLineItem, query?: SelectParams, headers?: ClientHeaders) => Promise<{
46
+ cart: HttpTypes.StoreCart;
47
+ }>;
48
+ updateLineItem: (cartId: string, lineItemId: string, body: HttpTypes.StoreUpdateCartLineItem, query?: SelectParams, headers?: ClientHeaders) => Promise<{
49
+ cart: HttpTypes.StoreCart;
50
+ }>;
51
+ deleteLineItem: (cartId: string, lineItemId: string, headers?: ClientHeaders) => Promise<HttpTypes.StoreLineItemDeleteResponse>;
52
+ addShippingMethod: (cartId: string, body: HttpTypes.StoreAddCartShippingMethods, query?: SelectParams, headers?: ClientHeaders) => Promise<{
53
+ cart: HttpTypes.StoreCart;
54
+ }>;
55
+ complete: (cartId: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
56
+ type: "order";
57
+ order: HttpTypes.StoreOrder;
58
+ } | {
59
+ type: "cart";
60
+ cart: HttpTypes.StoreCart;
61
+ error: {
62
+ message: string;
63
+ name: string;
64
+ type: string;
65
+ };
66
+ }>;
67
+ };
68
+ fulfillment: {
69
+ listCartOptions: (query?: FindParams & {
70
+ cart_id: string;
71
+ }, headers?: ClientHeaders) => Promise<{
72
+ shipping_options: HttpTypes.StoreCartShippingOption[];
73
+ }>;
74
+ };
75
+ payment: {
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
+ list: (query?: FindParams & HttpTypes.StoreOrderFilters, headers?: ClientHeaders) => Promise<HttpTypes.PaginatedResponse<{
85
+ orders: HttpTypes.StoreOrder[];
86
+ }>>;
87
+ retrieve: (id: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
88
+ order: HttpTypes.StoreOrder;
89
+ }>;
90
+ };
91
+ customer: {
92
+ create: (body: HttpTypes.StoreCreateCustomer, query?: SelectParams, headers?: ClientHeaders) => Promise<{
93
+ customer: HttpTypes.StoreCustomer;
94
+ }>;
95
+ update: (body: HttpTypes.StoreUpdateCustomer, query?: SelectParams, headers?: ClientHeaders) => Promise<{
96
+ customer: HttpTypes.StoreCustomer;
97
+ }>;
98
+ retrieve: (query?: SelectParams, headers?: ClientHeaders) => Promise<{
99
+ customer: HttpTypes.StoreCustomer;
100
+ }>;
101
+ createAddress: (body: HttpTypes.StoreCreateCustomerAddress, query?: SelectParams, headers?: ClientHeaders) => Promise<{
102
+ customer: HttpTypes.StoreCustomer;
103
+ }>;
104
+ updateAddress: (addressId: string, body: HttpTypes.StoreUpdateCustomerAddress, query?: SelectParams, headers?: ClientHeaders) => Promise<{
105
+ customer: HttpTypes.StoreCustomer;
106
+ }>;
107
+ listAddress: (query?: FindParams & HttpTypes.StoreCustomerAddressFilters, headers?: ClientHeaders) => Promise<HttpTypes.PaginatedResponse<{
108
+ addresses: HttpTypes.StoreCustomerAddress[];
109
+ }>>;
110
+ retrieveAddress: (addressId: string, query?: SelectParams, headers?: ClientHeaders) => Promise<{
111
+ address: HttpTypes.StoreCustomerAddress;
112
+ }>;
113
+ deleteAddress: (addressId: string, headers?: ClientHeaders) => Promise<HttpTypes.StoreCustomerAddressDeleteResponse>;
114
+ };
115
+ }
116
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/store/index.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,KAAK;IAChB,OAAO,CAAC,MAAM,CAAQ;gBAEV,MAAM,EAAE,MAAM;IAInB,MAAM;uBAED,UAAU,GAAG,SAAS,CAAC,kBAAkB,YACvC,aAAa;qBAGQ,SAAS,CAAC,WAAW,EAAE;;uBAOlD,MAAM,UACF,YAAY,YACV,aAAa;oBAEY,SAAS,CAAC,WAAW;;MAQ3D;IAEM,UAAU;uBAEL,UAAU,GAAG,SAAS,CAAC,sBAAsB,YAC3C,aAAa;yBAGY,SAAS,CAAC,eAAe,EAAE;;uBAO1D,MAAM,UACF,YAAY,YACV,aAAa;wBAEgB,SAAS,CAAC,eAAe;;MAQnE;IAEM,QAAQ;uBAEH,SAAS,CAAC,0BAA0B,YAClC,a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