@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
@@ -3,6 +3,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Auth = void 0;
4
4
  class Auth {
5
5
  constructor(client, config) {
6
+ /**
7
+ * This method is used to retrieve a registration JWT token for a user, customer, or custom actor type. It sends a request to the
8
+ * [Retrieve Registration Token API route](https://docs.medusajs.com/v2/api/store#auth_postactor_typeauth_provider_register).
9
+ *
10
+ * @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
11
+ * @param method - The authentication provider to use. For example, `emailpass` or `google`.
12
+ * @param payload - The data to pass in the request's body for authentication. When using the `emailpass` provider,
13
+ * you pass the email and password.
14
+ * @returns The JWT token used for registration later.
15
+ *
16
+ * @example
17
+ * sdk.auth.register(
18
+ * "customer",
19
+ * "emailpass",
20
+ * {
21
+ * email: "customer@gmail.com",
22
+ * password: "supersecret"
23
+ * }
24
+ * ).then((token) => {
25
+ * console.log(token)
26
+ * })
27
+ */
6
28
  this.register = async (actor, method, payload) => {
7
29
  const { token } = await this.client.fetch(`/auth/${actor}/${method}/register`, {
8
30
  method: "POST",
@@ -11,6 +33,34 @@ class Auth {
11
33
  this.client.setToken(token);
12
34
  return token;
13
35
  };
36
+ /**
37
+ * This method retrieves the JWT authenticated token for an admin user, customer, or custom
38
+ * actor type. It sends a request to the [Authenticate API Route](https://docs.medusajs.com/v2/api/admin#auth_postactor_typeauth_provider).
39
+ *
40
+ * If the `auth.type` of the SDK is set to `session`, this method will also send a request to the
41
+ * [Set Authentication Session API route](https://docs.medusajs.com/v2/api/admin#auth_postsession).
42
+ *
43
+ * Subsequent requests using the SDK will automatically have the necessary authentication headers / session
44
+ * set.
45
+ *
46
+ * @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
47
+ * @param method - The authentication provider to use. For example, `emailpass` or `google`.
48
+ * @param payload - The data to pass in the request's body for authentication. When using the `emailpass` provider,
49
+ * you pass the email and password.
50
+ * @returns The authentication JWT token
51
+ *
52
+ * @example
53
+ * sdk.auth.login(
54
+ * "customer",
55
+ * "emailpass",
56
+ * {
57
+ * email: "customer@gmail.com",
58
+ * password: "supersecret"
59
+ * }
60
+ * ).then((token) => {
61
+ * console.log(token)
62
+ * })
63
+ */
14
64
  this.login = async (actor, method, payload) => {
15
65
  // There will either be token or location returned from the backend.
16
66
  const { token, location } = await this.client.fetch(`/auth/${actor}/${method}`, {
@@ -25,7 +75,31 @@ class Auth {
25
75
  await this.setToken_(token);
26
76
  return token;
27
77
  };
28
- // 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
78
+ /**
79
+ * 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.
80
+ * It sends a request to the [Validate Authentication Callback](https://docs.medusajs.com/v2/api/admin#auth_postactor_typeauth_providercallback).
81
+ *
82
+ * @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
83
+ * @param method - The authentication provider to use. For example, `google`.
84
+ * @param query - The query parameters from the Oauth callback, which should be passed to the API route.
85
+ * @returns The authentication JWT token
86
+ *
87
+ * @example
88
+ * sdk.auth.callback(
89
+ * "customer",
90
+ * "google",
91
+ * {
92
+ * code: "123",
93
+ * }
94
+ * ).then((token) => {
95
+ * console.log(token)
96
+ * })
97
+ *
98
+ *
99
+ * @privateRemarks
100
+ * The callback expects all query parameters from the Oauth callback to be passed to
101
+ * the backend, and the provider is in charge of parsing and validating them
102
+ */
29
103
  this.callback = async (actor, method, query) => {
30
104
  const { token } = await this.client.fetch(`/auth/${actor}/${method}/callback`, {
31
105
  method: "GET",
@@ -34,6 +108,18 @@ class Auth {
34
108
  await this.setToken_(token);
35
109
  return token;
36
110
  };
111
+ /**
112
+ * This method refreshes a JWT authentication token, which is useful after validating the Oauth callback
113
+ * with {@link callback}. It sends a request to the [Refresh Authentication Token API route](https://docs.medusajs.com/v2/api/admin#auth_postadminauthtokenrefresh).
114
+ *
115
+ * @returns The refreshed JWT authentication token.
116
+ *
117
+ * @example
118
+ * sdk.auth.refresh()
119
+ * .then((token) => {
120
+ * console.log(token)
121
+ * })
122
+ */
37
123
  this.refresh = async () => {
38
124
  const { token } = await this.client.fetch("/auth/token/refresh", {
39
125
  method: "POST",
@@ -43,6 +129,16 @@ class Auth {
43
129
  await this.setToken_(token);
44
130
  return token;
45
131
  };
132
+ /**
133
+ * This method deletes the authentication session of the currently logged-in user to log them out.
134
+ * It sends a request to the [Delete Authentication Session API route](https://docs.medusajs.com/v2/api/admin#auth_deletesession).
135
+ *
136
+ * @example
137
+ * sdk.auth.logout()
138
+ * .then(() => {
139
+ * // user is logged out
140
+ * })
141
+ */
46
142
  this.logout = async () => {
47
143
  if (this.config?.auth?.type === "session") {
48
144
  await this.client.fetch("/auth/session", {
@@ -51,6 +147,30 @@ class Auth {
51
147
  }
52
148
  this.client.clearToken();
53
149
  };
150
+ /**
151
+ * This method requests a reset password token for an admin user, customer, or custom actor type.
152
+ * It sends a request to the [Generate Reset Password Token API route](https://docs.medusajs.com/v2/api/admin#auth_postactor_typeauth_providerresetpassword).
153
+ *
154
+ * To reset the password later using the token delivered to the user, use the {@link updateProvider} method.
155
+ *
156
+ * Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.medusajs.com/v2/resources/storefront-development/customers/reset-password).
157
+ *
158
+ * @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
159
+ * @param provider - The authentication provider to use. For example, `emailpass`.
160
+ * @param body - The data required to identify the user.
161
+ *
162
+ * @example
163
+ * sdk.auth.resetPassword(
164
+ * "customer",
165
+ * "emailpass",
166
+ * {
167
+ * identifier: "customer@gmail.com"
168
+ * }
169
+ * )
170
+ * .then(() => {
171
+ * // user receives token
172
+ * })
173
+ */
54
174
  this.resetPassword = async (actor, provider, body) => {
55
175
  await this.client.fetch(`/auth/${actor}/${provider}/reset-password`, {
56
176
  method: "POST",
@@ -58,12 +178,43 @@ class Auth {
58
178
  headers: { accept: "text/plain" }, // 201 Created response
59
179
  });
60
180
  };
181
+ /**
182
+ * This method is used to update user-related data authentication data.
183
+ *
184
+ * More specifically, use this method when updating the password of an admin user, customer, or
185
+ * custom actor type after requesting to reset their password with {@link resetPassword}.
186
+ *
187
+ * This method sends a request to [this API route](https://docs.medusajs.com/v2/api/admin#auth_postactor_typeauth_providerupdate).
188
+ *
189
+ * Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.medusajs.com/v2/resources/storefront-development/customers/reset-password).
190
+ *
191
+ * @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
192
+ * @param provider - The authentication provider to use. For example, `emailpass`.
193
+ * @param body - The data necessary to update the user's authentication data. When resetting the user's password,
194
+ * send the `email` and `password` properties.
195
+ *
196
+ * @example
197
+ * sdk.auth.updateProvider(
198
+ * "customer",
199
+ * "emailpass",
200
+ * {
201
+ * email: "customer@gmail.com",
202
+ * password: "supersecret"
203
+ * }
204
+ * )
205
+ * .then(() => {
206
+ * // password updated
207
+ * })
208
+ */
61
209
  this.updateProvider = async (actor, provider, body) => {
62
210
  await this.client.fetch(`/auth/${actor}/${provider}/update`, {
63
211
  method: "POST",
64
212
  body,
65
213
  });
66
214
  };
215
+ /**
216
+ * @ignore
217
+ */
67
218
  this.setToken_ = async (token) => {
68
219
  // By default we just set the token in the configured storage, if configured to use sessions we convert it into session storage instead.
69
220
  if (this.config?.auth?.type === "session") {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":";;;AAIA,MAAa,IAAI;IAIf,YAAY,MAAc,EAAE,MAAc;QAK1C,aAAQ,GAAG,KAAK,EACd,KAAa,EACb,MAAc,EACd,OAA+C,EAC/C,EAAE;YACF,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CACvC,SAAS,KAAK,IAAI,MAAM,WAAW,EACnC;gBACE,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,OAAO;aACd,CACF,CAAA;YAED,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;YAE3B,OAAO,KAAK,CAAA;QACd,CAAC,CAAA;QAED,UAAK,GAAG,KAAK,EACX,KAAa,EACb,MAAc,EACd,OAAyE,EACzE,EAAE;YACF,oEAAoE;YACpE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAGhD,SAAS,KAAK,IAAI,MAAM,EAAE,EAAE;gBAC7B,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,OAAO;aACd,CAAC,CAAA;YAEF,gFAAgF;YAChF,4EAA4E;YAC5E,IAAI,QAAQ,EAAE,CAAC;gBACb,OAAO,EAAE,QAAQ,EAAE,CAAA;YACrB,CAAC;YAED,MAAM,IAAI,CAAC,SAAS,CAAC,KAAe,CAAC,CAAA;YACrC,OAAO,KAAe,CAAA;QACxB,CAAC,CAAA;QAED,8JAA8J;QAC9J,aAAQ,GAAG,KAAK,EACd,KAAa,EACb,MAAc,EACd,KAA+B,EAC/B,EAAE;YACF,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CACvC,SAAS,KAAK,IAAI,MAAM,WAAW,EACnC;gBACE,MAAM,EAAE,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A;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CAqRF;AA5RD,oBA4RC"}
package/dist/client.d.ts CHANGED
@@ -52,7 +52,7 @@ export declare class Client {
52
52
  protected setToken_: (token: string) => void;
53
53
  protected getToken_: () => string | null | undefined;
54
54
  protected getTokenStorageInfo_: () => {
55
- storageMethod: "session" | "local" | "memory";
55
+ storageMethod: "session" | "local" | "memory" | "nostore";
56
56
  storageKey: string;
57
57
  };
58
58
  }
@@ -1 +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;IAiB/B,QAAQ,CAAC,KAAK,EAAE,MA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IAIrE;;;;;;;;;OASG;IACG,WAAW,CACf,KAAK,EAAE,UAAU,EACjB,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,mBAAmB,CAAC;IAiB/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;;;MAqB7B;CACF"}
package/dist/client.js CHANGED
@@ -112,7 +112,8 @@ class Client {
112
112
  this.getTokenStorageInfo_ = () => {
113
113
  const hasLocal = hasStorage("localStorage");
114
114
  const hasSession = hasStorage("sessionStorage");
115
- const storageMethod = this.config.auth?.jwtTokenStorageMethod || (hasLocal ? "local" : "memory");
115
+ const storageMethod = this.config.auth?.jwtTokenStorageMethod ||
116
+ (hasLocal ? "local" : "nostore");
116
117
  const storageKey = this.config.auth?.jwtTokenStorageKey || this.DEFAULT_JWT_STORAGE_KEY;
117
118
  if (!hasLocal && storageMethod === "local") {
118
119
  throw new Error("Local JWT storage is only available in the browser");
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAmB;AACnB,2DAA2C;AAU9B,QAAA,sBAAsB,GAAG,uBAAuB,CAAA;AAE7D,MAAM,UAAU,GAAG,CAAC,OAA0C,EAAE,EAAE;IAChE,IAAI,OAAO,MAA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AI,CAClE,CAAA;YAED,kFAAkF;YAClF,OAAO,MAAM,KAAK,CAChB,eAAe,EACf,gBAAgB,CAAC,IAAI,EAAE,OAAO,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;CAmFF;AA7OD,wBA6OC"}
@@ -10,12 +10,155 @@ export declare class ApiKey {
10
10
  * @ignore
11
11
  */
12
12
  constructor(client: Client);
13
- list(queryParams?: HttpTypes.AdminGetApiKeysParams, headers?: ClientHeaders): Promise<HttpTypes.PaginatedResponse<HttpTypes.AdminApiKeyListResponse>>;
13
+ /**
14
+ * This methods retrieves a paginated list of API keys. It sends a request to the
15
+ * [List API Keys](https://docs.medusajs.com/v2/api/admin#api-keys_getapikeys) API route.
16
+ *
17
+ * @param queryParams - Filters and pagination configurations.
18
+ * @param headers - Headers to pass in the request.
19
+ * @returns The paginated list of API keys.
20
+ *
21
+ * @example
22
+ * To retrieve the list of API keys:
23
+ *
24
+ * ```ts
25
+ * sdk.admin.apiKey.list()
26
+ * .then(({ api_keys, count, limit, offset }) => {
27
+ * console.log(api_keys)
28
+ * })
29
+ * ```
30
+ *
31
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
32
+ *
33
+ * For example, to retrieve only 10 items and skip 10 items:
34
+ *
35
+ * ```ts
36
+ * sdk.admin.apiKey.list({
37
+ * limit: 10,
38
+ * offset: 10
39
+ * })
40
+ * .then(({ api_keys, count, limit, offset }) => {
41
+ * console.log(api_keys)
42
+ * })
43
+ * ```
44
+ *
45
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
46
+ * in each API key:
47
+ *
48
+ * ```ts
49
+ * sdk.admin.apiKey.list({
50
+ * fields: "id,*sales_channels"
51
+ * })
52
+ * .then(({ api_keys, count, limit, offset }) => {
53
+ * console.log(api_keys)
54
+ * })
55
+ * ```
56
+ *
57
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
58
+ */
59
+ list(queryParams?: HttpTypes.AdminGetApiKeysParams, headers?: ClientHeaders): Promise<HttpTypes.AdminApiKeyListResponse>;
60
+ /**
61
+ * This method creates an API key. It sends a request to the [Create API Key](https://docs.medusajs.com/v2/api/admin#api-keys_postapikeys)
62
+ * API route.
63
+ *
64
+ * @param body - The API key's details.
65
+ * @param query - Configure the fields to retrieve in the created API key.
66
+ * @param headers - Headers to pass in the request
67
+ * @returns The created API key
68
+ *
69
+ * @example
70
+ * sdk.admin.apiKey.create({
71
+ * title: "Development",
72
+ * type: "publishable"
73
+ * })
74
+ * .then(({ api_key }) => {
75
+ * console.log(api_key)
76
+ * })
77
+ */
14
78
  create(body: HttpTypes.AdminCreateApiKey, query?: HttpTypes.AdminGetApiKeysParams, headers?: ClientHeaders): Promise<HttpTypes.AdminApiKeyResponse>;
79
+ /**
80
+ * This method revokes an API key. It sends a request to the
81
+ * [Revoke API Key](https://docs.medusajs.com/v2/api/admin#api-keys_postapikeysidrevoke) API route.
82
+ *
83
+ * @param id - The API key's ID.
84
+ * @param headers - Headers to pass in the request.
85
+ * @returns The API key's details.
86
+ *
87
+ * @example
88
+ * sdk.admin.apiKey.revoke("apk_123")
89
+ * .then(({ api_key }) => {
90
+ * console.log(api_key)
91
+ * })
92
+ */
15
93
  revoke(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminApiKeyResponse>;
94
+ /**
95
+ * This method retrieves an API key's details. It sends a request to the
96
+ * [Get API key](https://docs.medusajs.com/v2/api/admin#api-keys_getapikeysid) API route.
97
+ *
98
+ * @param id - The API key's ID.
99
+ * @param headers - Headers to pass in the request.
100
+ * @returns The API key's details.
101
+ *
102
+ * @example
103
+ * sdk.admin.apiKey.retrieve("apk_123")
104
+ * .then(({ api_key }) => {
105
+ * console.log(api_key)
106
+ * })
107
+ */
16
108
  retrieve(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminApiKeyResponse>;
109
+ /**
110
+ * This method updates an API key's details. It sends a request to the
111
+ * [Update API Key](https://docs.medusajs.com/v2/api/admin#api-keys_postapikeysid) API route.
112
+ *
113
+ * @param id - The API key's ID.
114
+ * @param body - The data to update in the API key.
115
+ * @param query - Configure the fields to retrieve in the API key.
116
+ * @param headers - Headers to pass in the request.
117
+ * @returns The API key's details.
118
+ *
119
+ * @example
120
+ * sdk.admin.apiKey.update("apk_123", {
121
+ * title: "Development"
122
+ * })
123
+ * .then(({ api_key }) => {
124
+ * console.log(api_key)
125
+ * })
126
+ */
17
127
  update(id: string, body: HttpTypes.AdminUpdateApiKey, query?: HttpTypes.AdminGetApiKeysParams, headers?: ClientHeaders): Promise<HttpTypes.AdminApiKeyResponse>;
128
+ /**
129
+ * This method deletes an API key by its ID. It sends a request to the
130
+ * [Delete API Key](https://docs.medusajs.com/v2/api/admin#api-keys_deleteapikeysid) API route.
131
+ *
132
+ * @param id - The API key's ID.
133
+ * @param headers - Headers to pass in the request.
134
+ * @returns The deletion's details.
135
+ *
136
+ * @example
137
+ * sdk.admin.apiKey.delete("apk_123")
138
+ * .then(({ deleted }) => {
139
+ * console.log(deleted)
140
+ * })
141
+ */
18
142
  delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminApiKeyDeleteResponse>;
143
+ /**
144
+ * This method manages the sales channels associated with a publishable API key to either add
145
+ * or remove associations. It sends a request to the [Manage Sales Channels](https://docs.medusajs.com/v2/api/admin#api-keys_postapikeysidsaleschannels)
146
+ * API route.
147
+ *
148
+ * @param id - The API key's ID.
149
+ * @param body - The sales channels to add or remove from the API key.
150
+ * @param headers - Headers to pass in the request.
151
+ * @returns The API key's details.
152
+ *
153
+ * @example
154
+ * sdk.admin.apiKey.batchSalesChannels("apk_123", {
155
+ * add: ["sc_123"],
156
+ * remove: ["sc_321"]
157
+ * })
158
+ * .then(({ api_key }) => {
159
+ * console.log(api_key)
160
+ * })
161
+ */
19
162
  batchSalesChannels(id: string, body: HttpTypes.AdminBatchLink, headers?: ClientHeaders): Promise<HttpTypes.AdminApiKeyResponse>;
20
163
  }
21
164
  //# sourceMappingURL=api-key.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-key.d.ts","sourceRoot":"","sources":["../../../src/admin/api-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAqB,MAAM,iBAAiB,CAAA;AAC9D,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,IAAI,CACR,WAAW,CAAC,EAAE,SAAS,CAAC,qBAAqB,EAC7C,OAAO,CAAC,EAAE,aAAa;IAUnB,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,iBAAiB,EACjC,KAAK,CAAC,EAAE,SAAS,CAAC,qBAAqB,EACvC,OAAO,CAAC,EAAE,aAAa;IAanB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;IAU1C,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;IAS5C,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,iBAAiB,EACjC,KAAK,CAAC,EAAE,SAAS,CAAC,qBAAqB,EACvC,OAAO,CAAC,EAAE,aAAa;IAanB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;IAU1C,kBAAkB,CACtB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,cAAc,EAC9B,OAAO,CAAC,EAAE,aAAa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AAa;CAW1B"}
@@ -14,6 +14,52 @@ export class ApiKey {
14
14
  constructor(client) {
15
15
  this.client = client;
16
16
  }
17
+ /**
18
+ * This methods retrieves a paginated list of API keys. It sends a request to the
19
+ * [List API Keys](https://docs.medusajs.com/v2/api/admin#api-keys_getapikeys) API route.
20
+ *
21
+ * @param queryParams - Filters and pagination configurations.
22
+ * @param headers - Headers to pass in the request.
23
+ * @returns The paginated list of API keys.
24
+ *
25
+ * @example
26
+ * To retrieve the list of API keys:
27
+ *
28
+ * ```ts
29
+ * sdk.admin.apiKey.list()
30
+ * .then(({ api_keys, count, limit, offset }) => {
31
+ * console.log(api_keys)
32
+ * })
33
+ * ```
34
+ *
35
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
36
+ *
37
+ * For example, to retrieve only 10 items and skip 10 items:
38
+ *
39
+ * ```ts
40
+ * sdk.admin.apiKey.list({
41
+ * limit: 10,
42
+ * offset: 10
43
+ * })
44
+ * .then(({ api_keys, count, limit, offset }) => {
45
+ * console.log(api_keys)
46
+ * })
47
+ * ```
48
+ *
49
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
50
+ * in each API key:
51
+ *
52
+ * ```ts
53
+ * sdk.admin.apiKey.list({
54
+ * fields: "id,*sales_channels"
55
+ * })
56
+ * .then(({ api_keys, count, limit, offset }) => {
57
+ * console.log(api_keys)
58
+ * })
59
+ * ```
60
+ *
61
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
62
+ */
17
63
  list(queryParams, headers) {
18
64
  return __awaiter(this, void 0, void 0, function* () {
19
65
  return yield this.client.fetch(`/admin/api-keys`, {
@@ -22,6 +68,24 @@ export class ApiKey {
22
68
  });
23
69
  });
24
70
  }
71
+ /**
72
+ * This method creates an API key. It sends a request to the [Create API Key](https://docs.medusajs.com/v2/api/admin#api-keys_postapikeys)
73
+ * API route.
74
+ *
75
+ * @param body - The API key's details.
76
+ * @param query - Configure the fields to retrieve in the created API key.
77
+ * @param headers - Headers to pass in the request
78
+ * @returns The created API key
79
+ *
80
+ * @example
81
+ * sdk.admin.apiKey.create({
82
+ * title: "Development",
83
+ * type: "publishable"
84
+ * })
85
+ * .then(({ api_key }) => {
86
+ * console.log(api_key)
87
+ * })
88
+ */
25
89
  create(body, query, headers) {
26
90
  return __awaiter(this, void 0, void 0, function* () {
27
91
  return yield this.client.fetch(`/admin/api-keys`, {
@@ -32,6 +96,20 @@ export class ApiKey {
32
96
  });
33
97
  });
34
98
  }
99
+ /**
100
+ * This method revokes an API key. It sends a request to the
101
+ * [Revoke API Key](https://docs.medusajs.com/v2/api/admin#api-keys_postapikeysidrevoke) API route.
102
+ *
103
+ * @param id - The API key's ID.
104
+ * @param headers - Headers to pass in the request.
105
+ * @returns The API key's details.
106
+ *
107
+ * @example
108
+ * sdk.admin.apiKey.revoke("apk_123")
109
+ * .then(({ api_key }) => {
110
+ * console.log(api_key)
111
+ * })
112
+ */
35
113
  revoke(id, headers) {
36
114
  return __awaiter(this, void 0, void 0, function* () {
37
115
  return yield this.client.fetch(`/admin/api-keys/${id}/revoke`, {
@@ -40,6 +118,20 @@ export class ApiKey {
40
118
  });
41
119
  });
42
120
  }
121
+ /**
122
+ * This method retrieves an API key's details. It sends a request to the
123
+ * [Get API key](https://docs.medusajs.com/v2/api/admin#api-keys_getapikeysid) API route.
124
+ *
125
+ * @param id - The API key's ID.
126
+ * @param headers - Headers to pass in the request.
127
+ * @returns The API key's details.
128
+ *
129
+ * @example
130
+ * sdk.admin.apiKey.retrieve("apk_123")
131
+ * .then(({ api_key }) => {
132
+ * console.log(api_key)
133
+ * })
134
+ */
43
135
  retrieve(id, headers) {
44
136
  return __awaiter(this, void 0, void 0, function* () {
45
137
  return yield this.client.fetch(`/admin/api-keys/${id}`, {
@@ -47,6 +139,24 @@ export class ApiKey {
47
139
  });
48
140
  });
49
141
  }
142
+ /**
143
+ * This method updates an API key's details. It sends a request to the
144
+ * [Update API Key](https://docs.medusajs.com/v2/api/admin#api-keys_postapikeysid) API route.
145
+ *
146
+ * @param id - The API key's ID.
147
+ * @param body - The data to update in the API key.
148
+ * @param query - Configure the fields to retrieve in the API key.
149
+ * @param headers - Headers to pass in the request.
150
+ * @returns The API key's details.
151
+ *
152
+ * @example
153
+ * sdk.admin.apiKey.update("apk_123", {
154
+ * title: "Development"
155
+ * })
156
+ * .then(({ api_key }) => {
157
+ * console.log(api_key)
158
+ * })
159
+ */
50
160
  update(id, body, query, headers) {
51
161
  return __awaiter(this, void 0, void 0, function* () {
52
162
  return yield this.client.fetch(`/admin/api-keys/${id}`, {
@@ -57,6 +167,20 @@ export class ApiKey {
57
167
  });
58
168
  });
59
169
  }
170
+ /**
171
+ * This method deletes an API key by its ID. It sends a request to the
172
+ * [Delete API Key](https://docs.medusajs.com/v2/api/admin#api-keys_deleteapikeysid) API route.
173
+ *
174
+ * @param id - The API key's ID.
175
+ * @param headers - Headers to pass in the request.
176
+ * @returns The deletion's details.
177
+ *
178
+ * @example
179
+ * sdk.admin.apiKey.delete("apk_123")
180
+ * .then(({ deleted }) => {
181
+ * console.log(deleted)
182
+ * })
183
+ */
60
184
  delete(id, headers) {
61
185
  return __awaiter(this, void 0, void 0, function* () {
62
186
  return yield this.client.fetch(`/admin/api-keys/${id}`, {
@@ -65,6 +189,25 @@ export class ApiKey {
65
189
  });
66
190
  });
67
191
  }
192
+ /**
193
+ * This method manages the sales channels associated with a publishable API key to either add
194
+ * or remove associations. It sends a request to the [Manage Sales Channels](https://docs.medusajs.com/v2/api/admin#api-keys_postapikeysidsaleschannels)
195
+ * API route.
196
+ *
197
+ * @param id - The API key's ID.
198
+ * @param body - The sales channels to add or remove from the API key.
199
+ * @param headers - Headers to pass in the request.
200
+ * @returns The API key's details.
201
+ *
202
+ * @example
203
+ * sdk.admin.apiKey.batchSalesChannels("apk_123", {
204
+ * add: ["sc_123"],
205
+ * remove: ["sc_321"]
206
+ * })
207
+ * .then(({ api_key }) => {
208
+ * console.log(api_key)
209
+ * })
210
+ */
68
211
  batchSalesChannels(id, body, headers) {
69
212
  return __awaiter(this, void 0, void 0, function* () {
70
213
  return yield this.client.fetch(`/admin/api-keys/${id}/sales-channels`, {
@@ -1 +1 @@
1
- {"version":3,"file":"api-key.js","sourceRoot":"","sources":["../../../src/admin/api-key.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,MAAM;IAKjB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEK,IAAI,CACR,WAA6C,EAC7C,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAE5B,iBAAiB,EAAE;gBACnB,KAAK,EAAE,WAAW;gBAClB,OAAO;aACR,CAAC,CAAA;QACJ,CAAC;KAAA;IAEK,MAAM,CACV,IAAiC,EACjC,KAAuC,EACvC,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EACjB;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAEK,MAAM,CAAC,EAAU,EAAE,OAAuB;;YAC9C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,SAAS,EAC9B;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAEK,QAAQ,CAAC,EAAU,EAAE,OAAuB;;YAChD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,EAAE,EACvB;gBACE,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAEK,MAAM,CACV,EAAU,EACV,IAAiC,EACjC,KAAuC,EACvC,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,EAAE,EACvB;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAEK,MAAM,CAAC,EAAU,EAAE,OAAuB;;YAC9C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,EAAE,EACvB;gBACE,MAAM,EAAE,QAAQ;gBAChB,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAEK,kBAAkB,CACtB,EAAU,EACV,IAA8B,EAC9B,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,iBAAiB,EACtC;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;aACL,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
1
+ {"version":3,"file":"api-key.js","sourceRoot":"","sources":["../../../src/admin/api-key.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,MAAM;IAKjB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,IAAI,CACR,WAA6C,EAC7C,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAE5B,iBAAiB,EAAE;gBACnB,KAAK,EAAE,WAAW;gBAClB,OAAO;aACR,CAAC,CAAA;QACJ,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CACV,IAAiC,EACjC,KAAuC,EACvC,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EACjB;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;OAaG;IACG,MAAM,CAAC,EAAU,EAAE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