@thorprovider/medusa-extended 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,150 @@
1
+ import { GetChannelCustomersOptions, GetChannelCustomersResponse, GetChannelApiKeysResponse, GetChannelCategoriesOptions, GetChannelCategoriesResponse, GetCategorySalesChannelsResponse, AssignCategoriesToChannelsBody, AssignCategoriesToChannelsResponse, UnassignCategoriesFromChannelsBody, UnassignCategoriesFromChannelsResponse, GetCollectionSalesChannelsResponse, AssignCollectionsToChannelsBody, AssignCollectionsToChannelsResponse, UnassignCollectionsFromChannelsBody, UnassignCollectionsFromChannelsResponse, GetAdminStorefrontConfigResponse, UpdateStorefrontConfigBody, UpdateStorefrontConfigResponse, GetAdminSiteConfigResponse, UpdateSiteConfigBody, UpdateSiteConfigResponse, GetAdminSiteConfigHistoryOptions, GetAdminSiteConfigHistoryResponse, RestoreSiteConfigResponse } from '@thorprovider/types';
2
+
3
+ /**
4
+ * @fileoverview Medusa Multi-Tenant Admin Client
5
+ * @module @thorprovider/adapters/providers/medusa/admin
6
+ *
7
+ * Wrapper methods for all `/admin/thor/` endpoints defined in the Thor Commerce
8
+ * multi-tenant API contract. Requires an admin API key (`adminConfig.apiKey`)
9
+ * to be provided when creating the Medusa provider.
10
+ *
11
+ * Every method performs a raw `fetch` against the Medusa backend using the
12
+ * admin API key (`x-medusa-access-token`) — the Medusa JS-SDK's admin client
13
+ * does not expose these custom Thor plugin routes, so we use direct HTTP calls.
14
+ *
15
+ * Endpoint reference: `multitenant-api-contract.md`
16
+ */
17
+
18
+ /**
19
+ * Configuration required to instantiate the admin client.
20
+ */
21
+ interface MedusaAdminClientConfig {
22
+ /** Medusa backend base URL */
23
+ baseUrl: string;
24
+ /** Secret admin API key (x-medusa-access-token) */
25
+ apiKey: string;
26
+ /** Enable debug logging */
27
+ debug?: boolean;
28
+ }
29
+ /**
30
+ * HTTP client for Thor Commerce multi-tenant admin endpoints (`/admin/thor/`).
31
+ *
32
+ * All methods throw `ProviderAPIError` on non-2xx responses.
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const admin = new MedusaAdminClient({
37
+ * baseUrl: process.env.MEDUSA_BACKEND_URL!,
38
+ * apiKey: process.env.MEDUSA_ADMIN_API_KEY!,
39
+ * });
40
+ *
41
+ * const { customers } = await admin.getChannelCustomers('sc_01JXXXXX');
42
+ * ```
43
+ */
44
+ declare class MedusaAdminClient {
45
+ private baseUrl;
46
+ private apiKey;
47
+ private logger;
48
+ constructor(config: MedusaAdminClientConfig);
49
+ private request;
50
+ /**
51
+ * Paginated list of customers linked to a sales channel.
52
+ *
53
+ * `GET /admin/thor/sales-channels/:id/customers`
54
+ */
55
+ getChannelCustomers(salesChannelId: string, options?: GetChannelCustomersOptions): Promise<GetChannelCustomersResponse>;
56
+ /**
57
+ * Publishable API keys associated with a sales channel.
58
+ *
59
+ * `GET /admin/thor/sales-channels/:id/api-keys`
60
+ */
61
+ getChannelApiKeys(salesChannelId: string): Promise<GetChannelApiKeysResponse>;
62
+ /**
63
+ * Product categories assigned to a sales channel.
64
+ *
65
+ * `GET /admin/thor/sales-channels/:id/categories`
66
+ */
67
+ getChannelCategories(salesChannelId: string, options?: GetChannelCategoriesOptions): Promise<GetChannelCategoriesResponse>;
68
+ /**
69
+ * Sales channels to which a category is assigned.
70
+ *
71
+ * `GET /admin/thor/categories/:id/sales-channels`
72
+ */
73
+ getCategorySalesChannels(categoryId: string): Promise<GetCategorySalesChannelsResponse>;
74
+ /**
75
+ * Assign a category to one or more sales channels (idempotent).
76
+ *
77
+ * `POST /admin/thor/categories/:id/sales-channels`
78
+ */
79
+ assignCategoryToChannels(categoryId: string, body: AssignCategoriesToChannelsBody): Promise<AssignCategoriesToChannelsResponse>;
80
+ /**
81
+ * Remove category assignment from one or more sales channels (idempotent).
82
+ *
83
+ * `DELETE /admin/thor/categories/:id/sales-channels`
84
+ */
85
+ unassignCategoryFromChannels(categoryId: string, body: UnassignCategoriesFromChannelsBody): Promise<UnassignCategoriesFromChannelsResponse>;
86
+ /**
87
+ * Sales channels to which a collection is assigned.
88
+ *
89
+ * `GET /admin/thor/collections/:id/sales-channels`
90
+ */
91
+ getCollectionSalesChannels(collectionId: string): Promise<GetCollectionSalesChannelsResponse>;
92
+ /**
93
+ * Assign a collection to one or more sales channels (idempotent).
94
+ *
95
+ * `POST /admin/thor/collections/:id/sales-channels`
96
+ */
97
+ assignCollectionToChannels(collectionId: string, body: AssignCollectionsToChannelsBody): Promise<AssignCollectionsToChannelsResponse>;
98
+ /**
99
+ * Remove collection assignment from one or more sales channels (idempotent).
100
+ *
101
+ * `DELETE /admin/thor/collections/:id/sales-channels`
102
+ */
103
+ unassignCollectionFromChannels(collectionId: string, body: UnassignCollectionsFromChannelsBody): Promise<UnassignCollectionsFromChannelsResponse>;
104
+ /**
105
+ * Read the visual storefront configuration for a channel.
106
+ * `:id` is the `sales_channel_id`.
107
+ *
108
+ * `GET /admin/thor/storefront-config/:id`
109
+ */
110
+ getStorefrontConfig(salesChannelId: string): Promise<GetAdminStorefrontConfigResponse>;
111
+ /**
112
+ * Update the visual storefront configuration for a channel.
113
+ * Triggers the `storefront_config.updated` event → ISR webhook.
114
+ *
115
+ * `PUT /admin/thor/storefront-config/:id`
116
+ */
117
+ updateStorefrontConfig(salesChannelId: string, body: UpdateStorefrontConfigBody): Promise<UpdateStorefrontConfigResponse>;
118
+ /**
119
+ * Read the active Site Designer configuration for a channel, including the
120
+ * last 10 history entries.
121
+ *
122
+ * `GET /admin/thor/site-config/:sales_channel_id`
123
+ */
124
+ getSiteConfig(salesChannelId: string): Promise<GetAdminSiteConfigResponse>;
125
+ /**
126
+ * Update the Site Designer configuration for a channel.
127
+ * Creates a new history entry on every PUT.
128
+ *
129
+ * `PUT /admin/thor/site-config/:sales_channel_id`
130
+ */
131
+ updateSiteConfig(salesChannelId: string, body: UpdateSiteConfigBody): Promise<UpdateSiteConfigResponse>;
132
+ /**
133
+ * Full paginated history of Site Designer versions for a channel.
134
+ * Entries are immutable — they are never deleted.
135
+ *
136
+ * `GET /admin/thor/site-config/:sales_channel_id/history`
137
+ */
138
+ getSiteConfigHistory(salesChannelId: string, options?: GetAdminSiteConfigHistoryOptions): Promise<GetAdminSiteConfigHistoryResponse>;
139
+ /**
140
+ * Restore a previous Site Designer version.
141
+ * Internally runs the update workflow with the stored config of the target
142
+ * version — this creates a **new** history entry and does NOT mutate past
143
+ * entries.
144
+ *
145
+ * `POST /admin/thor/site-config/:sales_channel_id/restore/:version`
146
+ */
147
+ restoreSiteConfig(salesChannelId: string, version: string): Promise<RestoreSiteConfigResponse>;
148
+ }
149
+
150
+ export { MedusaAdminClient, type MedusaAdminClientConfig };
@@ -0,0 +1,150 @@
1
+ import { GetChannelCustomersOptions, GetChannelCustomersResponse, GetChannelApiKeysResponse, GetChannelCategoriesOptions, GetChannelCategoriesResponse, GetCategorySalesChannelsResponse, AssignCategoriesToChannelsBody, AssignCategoriesToChannelsResponse, UnassignCategoriesFromChannelsBody, UnassignCategoriesFromChannelsResponse, GetCollectionSalesChannelsResponse, AssignCollectionsToChannelsBody, AssignCollectionsToChannelsResponse, UnassignCollectionsFromChannelsBody, UnassignCollectionsFromChannelsResponse, GetAdminStorefrontConfigResponse, UpdateStorefrontConfigBody, UpdateStorefrontConfigResponse, GetAdminSiteConfigResponse, UpdateSiteConfigBody, UpdateSiteConfigResponse, GetAdminSiteConfigHistoryOptions, GetAdminSiteConfigHistoryResponse, RestoreSiteConfigResponse } from '@thorprovider/types';
2
+
3
+ /**
4
+ * @fileoverview Medusa Multi-Tenant Admin Client
5
+ * @module @thorprovider/adapters/providers/medusa/admin
6
+ *
7
+ * Wrapper methods for all `/admin/thor/` endpoints defined in the Thor Commerce
8
+ * multi-tenant API contract. Requires an admin API key (`adminConfig.apiKey`)
9
+ * to be provided when creating the Medusa provider.
10
+ *
11
+ * Every method performs a raw `fetch` against the Medusa backend using the
12
+ * admin API key (`x-medusa-access-token`) — the Medusa JS-SDK's admin client
13
+ * does not expose these custom Thor plugin routes, so we use direct HTTP calls.
14
+ *
15
+ * Endpoint reference: `multitenant-api-contract.md`
16
+ */
17
+
18
+ /**
19
+ * Configuration required to instantiate the admin client.
20
+ */
21
+ interface MedusaAdminClientConfig {
22
+ /** Medusa backend base URL */
23
+ baseUrl: string;
24
+ /** Secret admin API key (x-medusa-access-token) */
25
+ apiKey: string;
26
+ /** Enable debug logging */
27
+ debug?: boolean;
28
+ }
29
+ /**
30
+ * HTTP client for Thor Commerce multi-tenant admin endpoints (`/admin/thor/`).
31
+ *
32
+ * All methods throw `ProviderAPIError` on non-2xx responses.
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const admin = new MedusaAdminClient({
37
+ * baseUrl: process.env.MEDUSA_BACKEND_URL!,
38
+ * apiKey: process.env.MEDUSA_ADMIN_API_KEY!,
39
+ * });
40
+ *
41
+ * const { customers } = await admin.getChannelCustomers('sc_01JXXXXX');
42
+ * ```
43
+ */
44
+ declare class MedusaAdminClient {
45
+ private baseUrl;
46
+ private apiKey;
47
+ private logger;
48
+ constructor(config: MedusaAdminClientConfig);
49
+ private request;
50
+ /**
51
+ * Paginated list of customers linked to a sales channel.
52
+ *
53
+ * `GET /admin/thor/sales-channels/:id/customers`
54
+ */
55
+ getChannelCustomers(salesChannelId: string, options?: GetChannelCustomersOptions): Promise<GetChannelCustomersResponse>;
56
+ /**
57
+ * Publishable API keys associated with a sales channel.
58
+ *
59
+ * `GET /admin/thor/sales-channels/:id/api-keys`
60
+ */
61
+ getChannelApiKeys(salesChannelId: string): Promise<GetChannelApiKeysResponse>;
62
+ /**
63
+ * Product categories assigned to a sales channel.
64
+ *
65
+ * `GET /admin/thor/sales-channels/:id/categories`
66
+ */
67
+ getChannelCategories(salesChannelId: string, options?: GetChannelCategoriesOptions): Promise<GetChannelCategoriesResponse>;
68
+ /**
69
+ * Sales channels to which a category is assigned.
70
+ *
71
+ * `GET /admin/thor/categories/:id/sales-channels`
72
+ */
73
+ getCategorySalesChannels(categoryId: string): Promise<GetCategorySalesChannelsResponse>;
74
+ /**
75
+ * Assign a category to one or more sales channels (idempotent).
76
+ *
77
+ * `POST /admin/thor/categories/:id/sales-channels`
78
+ */
79
+ assignCategoryToChannels(categoryId: string, body: AssignCategoriesToChannelsBody): Promise<AssignCategoriesToChannelsResponse>;
80
+ /**
81
+ * Remove category assignment from one or more sales channels (idempotent).
82
+ *
83
+ * `DELETE /admin/thor/categories/:id/sales-channels`
84
+ */
85
+ unassignCategoryFromChannels(categoryId: string, body: UnassignCategoriesFromChannelsBody): Promise<UnassignCategoriesFromChannelsResponse>;
86
+ /**
87
+ * Sales channels to which a collection is assigned.
88
+ *
89
+ * `GET /admin/thor/collections/:id/sales-channels`
90
+ */
91
+ getCollectionSalesChannels(collectionId: string): Promise<GetCollectionSalesChannelsResponse>;
92
+ /**
93
+ * Assign a collection to one or more sales channels (idempotent).
94
+ *
95
+ * `POST /admin/thor/collections/:id/sales-channels`
96
+ */
97
+ assignCollectionToChannels(collectionId: string, body: AssignCollectionsToChannelsBody): Promise<AssignCollectionsToChannelsResponse>;
98
+ /**
99
+ * Remove collection assignment from one or more sales channels (idempotent).
100
+ *
101
+ * `DELETE /admin/thor/collections/:id/sales-channels`
102
+ */
103
+ unassignCollectionFromChannels(collectionId: string, body: UnassignCollectionsFromChannelsBody): Promise<UnassignCollectionsFromChannelsResponse>;
104
+ /**
105
+ * Read the visual storefront configuration for a channel.
106
+ * `:id` is the `sales_channel_id`.
107
+ *
108
+ * `GET /admin/thor/storefront-config/:id`
109
+ */
110
+ getStorefrontConfig(salesChannelId: string): Promise<GetAdminStorefrontConfigResponse>;
111
+ /**
112
+ * Update the visual storefront configuration for a channel.
113
+ * Triggers the `storefront_config.updated` event → ISR webhook.
114
+ *
115
+ * `PUT /admin/thor/storefront-config/:id`
116
+ */
117
+ updateStorefrontConfig(salesChannelId: string, body: UpdateStorefrontConfigBody): Promise<UpdateStorefrontConfigResponse>;
118
+ /**
119
+ * Read the active Site Designer configuration for a channel, including the
120
+ * last 10 history entries.
121
+ *
122
+ * `GET /admin/thor/site-config/:sales_channel_id`
123
+ */
124
+ getSiteConfig(salesChannelId: string): Promise<GetAdminSiteConfigResponse>;
125
+ /**
126
+ * Update the Site Designer configuration for a channel.
127
+ * Creates a new history entry on every PUT.
128
+ *
129
+ * `PUT /admin/thor/site-config/:sales_channel_id`
130
+ */
131
+ updateSiteConfig(salesChannelId: string, body: UpdateSiteConfigBody): Promise<UpdateSiteConfigResponse>;
132
+ /**
133
+ * Full paginated history of Site Designer versions for a channel.
134
+ * Entries are immutable — they are never deleted.
135
+ *
136
+ * `GET /admin/thor/site-config/:sales_channel_id/history`
137
+ */
138
+ getSiteConfigHistory(salesChannelId: string, options?: GetAdminSiteConfigHistoryOptions): Promise<GetAdminSiteConfigHistoryResponse>;
139
+ /**
140
+ * Restore a previous Site Designer version.
141
+ * Internally runs the update workflow with the stored config of the target
142
+ * version — this creates a **new** history entry and does NOT mutate past
143
+ * entries.
144
+ *
145
+ * `POST /admin/thor/site-config/:sales_channel_id/restore/:version`
146
+ */
147
+ restoreSiteConfig(salesChannelId: string, version: string): Promise<RestoreSiteConfigResponse>;
148
+ }
149
+
150
+ export { MedusaAdminClient, type MedusaAdminClientConfig };
package/dist/index.js ADDED
@@ -0,0 +1,315 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ MedusaAdminClient: () => MedusaAdminClient
24
+ });
25
+ module.exports = __toCommonJS(src_exports);
26
+
27
+ // src/admin.ts
28
+ var import_adapters = require("@thorprovider/adapters");
29
+ var MedusaAdminClient = class {
30
+ baseUrl;
31
+ apiKey;
32
+ logger;
33
+ constructor(config) {
34
+ this.baseUrl = config.baseUrl.replace(/\/$/, "");
35
+ this.apiKey = config.apiKey;
36
+ this.logger = (0, import_adapters.createLogger)("MedusaAdminClient", config.debug);
37
+ }
38
+ // -----------------------------------------------------------------------
39
+ // Private — HTTP helper
40
+ // -----------------------------------------------------------------------
41
+ async request(method, path, body) {
42
+ const url = `${this.baseUrl}${path}`;
43
+ this.logger.debug(`[admin] ${method} ${path}`);
44
+ const headers = {
45
+ "x-medusa-access-token": this.apiKey,
46
+ "Content-Type": "application/json"
47
+ };
48
+ const init = {
49
+ method,
50
+ headers,
51
+ ...body !== void 0 ? { body: JSON.stringify(body) } : {}
52
+ };
53
+ let response;
54
+ try {
55
+ response = await fetch(url, init);
56
+ } catch (networkError) {
57
+ throw new import_adapters.ProviderAPIError(
58
+ `[admin] Network error on ${method} ${path}: ${networkError.message}`,
59
+ "NETWORK_ERROR",
60
+ networkError
61
+ );
62
+ }
63
+ if (!response.ok) {
64
+ let message = `HTTP ${response.status}`;
65
+ try {
66
+ const json = await response.json();
67
+ message = json?.message ?? message;
68
+ } catch {
69
+ }
70
+ throw new import_adapters.ProviderAPIError(
71
+ `[admin] ${method} ${path} failed: ${message}`,
72
+ `ADMIN_API_${response.status}`,
73
+ response.status
74
+ );
75
+ }
76
+ return response.json();
77
+ }
78
+ // -----------------------------------------------------------------------
79
+ // 3.1 — Sales Channel: Customers
80
+ // -----------------------------------------------------------------------
81
+ /**
82
+ * Paginated list of customers linked to a sales channel.
83
+ *
84
+ * `GET /admin/thor/sales-channels/:id/customers`
85
+ */
86
+ async getChannelCustomers(salesChannelId, options = {}) {
87
+ const { limit = 20, offset = 0 } = options;
88
+ return this.request(
89
+ "GET",
90
+ `/admin/thor/sales-channels/${salesChannelId}/customers?limit=${limit}&offset=${offset}`
91
+ );
92
+ }
93
+ // -----------------------------------------------------------------------
94
+ // 3.2 — Sales Channel: API Keys
95
+ // -----------------------------------------------------------------------
96
+ /**
97
+ * Publishable API keys associated with a sales channel.
98
+ *
99
+ * `GET /admin/thor/sales-channels/:id/api-keys`
100
+ */
101
+ async getChannelApiKeys(salesChannelId) {
102
+ return this.request(
103
+ "GET",
104
+ `/admin/thor/sales-channels/${salesChannelId}/api-keys`
105
+ );
106
+ }
107
+ // -----------------------------------------------------------------------
108
+ // 3.3 — Sales Channel: Categories
109
+ // -----------------------------------------------------------------------
110
+ /**
111
+ * Product categories assigned to a sales channel.
112
+ *
113
+ * `GET /admin/thor/sales-channels/:id/categories`
114
+ */
115
+ async getChannelCategories(salesChannelId, options = {}) {
116
+ const { limit = 20, offset = 0, include_descendants = false } = options;
117
+ const qs = new URLSearchParams({
118
+ limit: String(limit),
119
+ offset: String(offset),
120
+ include_descendants: String(include_descendants)
121
+ });
122
+ return this.request(
123
+ "GET",
124
+ `/admin/thor/sales-channels/${salesChannelId}/categories?${qs}`
125
+ );
126
+ }
127
+ // -----------------------------------------------------------------------
128
+ // 3.4 — Category: Sales Channels
129
+ // -----------------------------------------------------------------------
130
+ /**
131
+ * Sales channels to which a category is assigned.
132
+ *
133
+ * `GET /admin/thor/categories/:id/sales-channels`
134
+ */
135
+ async getCategorySalesChannels(categoryId) {
136
+ return this.request(
137
+ "GET",
138
+ `/admin/thor/categories/${categoryId}/sales-channels`
139
+ );
140
+ }
141
+ // -----------------------------------------------------------------------
142
+ // 3.5 — Category: Assign to Sales Channels
143
+ // -----------------------------------------------------------------------
144
+ /**
145
+ * Assign a category to one or more sales channels (idempotent).
146
+ *
147
+ * `POST /admin/thor/categories/:id/sales-channels`
148
+ */
149
+ async assignCategoryToChannels(categoryId, body) {
150
+ return this.request(
151
+ "POST",
152
+ `/admin/thor/categories/${categoryId}/sales-channels`,
153
+ body
154
+ );
155
+ }
156
+ // -----------------------------------------------------------------------
157
+ // 3.6 — Category: Unassign from Sales Channels
158
+ // -----------------------------------------------------------------------
159
+ /**
160
+ * Remove category assignment from one or more sales channels (idempotent).
161
+ *
162
+ * `DELETE /admin/thor/categories/:id/sales-channels`
163
+ */
164
+ async unassignCategoryFromChannels(categoryId, body) {
165
+ return this.request(
166
+ "DELETE",
167
+ `/admin/thor/categories/${categoryId}/sales-channels`,
168
+ body
169
+ );
170
+ }
171
+ // -----------------------------------------------------------------------
172
+ // 3.7 — Collection: Sales Channels
173
+ // -----------------------------------------------------------------------
174
+ /**
175
+ * Sales channels to which a collection is assigned.
176
+ *
177
+ * `GET /admin/thor/collections/:id/sales-channels`
178
+ */
179
+ async getCollectionSalesChannels(collectionId) {
180
+ return this.request(
181
+ "GET",
182
+ `/admin/thor/collections/${collectionId}/sales-channels`
183
+ );
184
+ }
185
+ // -----------------------------------------------------------------------
186
+ // 3.8 — Collection: Assign to Sales Channels
187
+ // -----------------------------------------------------------------------
188
+ /**
189
+ * Assign a collection to one or more sales channels (idempotent).
190
+ *
191
+ * `POST /admin/thor/collections/:id/sales-channels`
192
+ */
193
+ async assignCollectionToChannels(collectionId, body) {
194
+ return this.request(
195
+ "POST",
196
+ `/admin/thor/collections/${collectionId}/sales-channels`,
197
+ body
198
+ );
199
+ }
200
+ // -----------------------------------------------------------------------
201
+ // 3.9 — Collection: Unassign from Sales Channels
202
+ // -----------------------------------------------------------------------
203
+ /**
204
+ * Remove collection assignment from one or more sales channels (idempotent).
205
+ *
206
+ * `DELETE /admin/thor/collections/:id/sales-channels`
207
+ */
208
+ async unassignCollectionFromChannels(collectionId, body) {
209
+ return this.request(
210
+ "DELETE",
211
+ `/admin/thor/collections/${collectionId}/sales-channels`,
212
+ body
213
+ );
214
+ }
215
+ // -----------------------------------------------------------------------
216
+ // 3.10 — Storefront Config: Read
217
+ // -----------------------------------------------------------------------
218
+ /**
219
+ * Read the visual storefront configuration for a channel.
220
+ * `:id` is the `sales_channel_id`.
221
+ *
222
+ * `GET /admin/thor/storefront-config/:id`
223
+ */
224
+ async getStorefrontConfig(salesChannelId) {
225
+ return this.request(
226
+ "GET",
227
+ `/admin/thor/storefront-config/${salesChannelId}`
228
+ );
229
+ }
230
+ // -----------------------------------------------------------------------
231
+ // 3.11 — Storefront Config: Update
232
+ // -----------------------------------------------------------------------
233
+ /**
234
+ * Update the visual storefront configuration for a channel.
235
+ * Triggers the `storefront_config.updated` event → ISR webhook.
236
+ *
237
+ * `PUT /admin/thor/storefront-config/:id`
238
+ */
239
+ async updateStorefrontConfig(salesChannelId, body) {
240
+ return this.request(
241
+ "PUT",
242
+ `/admin/thor/storefront-config/${salesChannelId}`,
243
+ body
244
+ );
245
+ }
246
+ // -----------------------------------------------------------------------
247
+ // 3.12 — Site Designer Config: Read
248
+ // -----------------------------------------------------------------------
249
+ /**
250
+ * Read the active Site Designer configuration for a channel, including the
251
+ * last 10 history entries.
252
+ *
253
+ * `GET /admin/thor/site-config/:sales_channel_id`
254
+ */
255
+ async getSiteConfig(salesChannelId) {
256
+ return this.request(
257
+ "GET",
258
+ `/admin/thor/site-config/${salesChannelId}`
259
+ );
260
+ }
261
+ // -----------------------------------------------------------------------
262
+ // 3.13 — Site Designer Config: Update
263
+ // -----------------------------------------------------------------------
264
+ /**
265
+ * Update the Site Designer configuration for a channel.
266
+ * Creates a new history entry on every PUT.
267
+ *
268
+ * `PUT /admin/thor/site-config/:sales_channel_id`
269
+ */
270
+ async updateSiteConfig(salesChannelId, body) {
271
+ return this.request(
272
+ "PUT",
273
+ `/admin/thor/site-config/${salesChannelId}`,
274
+ body
275
+ );
276
+ }
277
+ // -----------------------------------------------------------------------
278
+ // 3.14 — Site Designer Config: History
279
+ // -----------------------------------------------------------------------
280
+ /**
281
+ * Full paginated history of Site Designer versions for a channel.
282
+ * Entries are immutable — they are never deleted.
283
+ *
284
+ * `GET /admin/thor/site-config/:sales_channel_id/history`
285
+ */
286
+ async getSiteConfigHistory(salesChannelId, options = {}) {
287
+ const { limit = 20, offset = 0 } = options;
288
+ return this.request(
289
+ "GET",
290
+ `/admin/thor/site-config/${salesChannelId}/history?limit=${limit}&offset=${offset}`
291
+ );
292
+ }
293
+ // -----------------------------------------------------------------------
294
+ // 3.15 — Site Designer Config: Restore
295
+ // -----------------------------------------------------------------------
296
+ /**
297
+ * Restore a previous Site Designer version.
298
+ * Internally runs the update workflow with the stored config of the target
299
+ * version — this creates a **new** history entry and does NOT mutate past
300
+ * entries.
301
+ *
302
+ * `POST /admin/thor/site-config/:sales_channel_id/restore/:version`
303
+ */
304
+ async restoreSiteConfig(salesChannelId, version) {
305
+ return this.request(
306
+ "POST",
307
+ `/admin/thor/site-config/${salesChannelId}/restore/${encodeURIComponent(version)}`
308
+ );
309
+ }
310
+ };
311
+ // Annotate the CommonJS export names for ESM import in node:
312
+ 0 && (module.exports = {
313
+ MedusaAdminClient
314
+ });
315
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/admin.ts"],"sourcesContent":["/**\n * @thorprovider/medusa-extended\n * Thor Commerce multi-tenant admin extensions for Medusa\n */\n\nexport { MedusaAdminClient } from './admin';\nexport type { MedusaAdminClientConfig } from './admin';\n","/**\n * @fileoverview Medusa Multi-Tenant Admin Client\n * @module @thorprovider/adapters/providers/medusa/admin\n *\n * Wrapper methods for all `/admin/thor/` endpoints defined in the Thor Commerce\n * multi-tenant API contract. Requires an admin API key (`adminConfig.apiKey`)\n * to be provided when creating the Medusa provider.\n *\n * Every method performs a raw `fetch` against the Medusa backend using the\n * admin API key (`x-medusa-access-token`) — the Medusa JS-SDK's admin client\n * does not expose these custom Thor plugin routes, so we use direct HTTP calls.\n *\n * Endpoint reference: `multitenant-api-contract.md`\n */\n\nimport type {\n GetChannelCustomersOptions,\n GetChannelCustomersResponse,\n GetChannelApiKeysResponse,\n GetChannelCategoriesOptions,\n GetChannelCategoriesResponse,\n GetCategorySalesChannelsResponse,\n AssignCategoriesToChannelsBody,\n AssignCategoriesToChannelsResponse,\n UnassignCategoriesFromChannelsBody,\n UnassignCategoriesFromChannelsResponse,\n GetCollectionSalesChannelsResponse,\n AssignCollectionsToChannelsBody,\n AssignCollectionsToChannelsResponse,\n UnassignCollectionsFromChannelsBody,\n UnassignCollectionsFromChannelsResponse,\n GetAdminStorefrontConfigResponse,\n UpdateStorefrontConfigBody,\n UpdateStorefrontConfigResponse,\n GetAdminSiteConfigResponse,\n UpdateSiteConfigBody,\n UpdateSiteConfigResponse,\n GetAdminSiteConfigHistoryOptions,\n GetAdminSiteConfigHistoryResponse,\n RestoreSiteConfigResponse,\n} from '@thorprovider/types';\nimport { createLogger, ProviderAPIError } from '@thorprovider/adapters';\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\ntype FetchMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';\n\n/**\n * Configuration required to instantiate the admin client.\n */\nexport interface MedusaAdminClientConfig {\n /** Medusa backend base URL */\n baseUrl: string;\n /** Secret admin API key (x-medusa-access-token) */\n apiKey: string;\n /** Enable debug logging */\n debug?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// MedusaAdminClient\n// ---------------------------------------------------------------------------\n\n/**\n * HTTP client for Thor Commerce multi-tenant admin endpoints (`/admin/thor/`).\n *\n * All methods throw `ProviderAPIError` on non-2xx responses.\n *\n * @example\n * ```typescript\n * const admin = new MedusaAdminClient({\n * baseUrl: process.env.MEDUSA_BACKEND_URL!,\n * apiKey: process.env.MEDUSA_ADMIN_API_KEY!,\n * });\n *\n * const { customers } = await admin.getChannelCustomers('sc_01JXXXXX');\n * ```\n */\nexport class MedusaAdminClient {\n private baseUrl: string;\n private apiKey: string;\n private logger: ReturnType<typeof createLogger>;\n\n constructor(config: MedusaAdminClientConfig) {\n this.baseUrl = config.baseUrl.replace(/\\/$/, '');\n this.apiKey = config.apiKey;\n this.logger = createLogger('MedusaAdminClient', config.debug);\n }\n\n // -----------------------------------------------------------------------\n // Private — HTTP helper\n // -----------------------------------------------------------------------\n\n private async request<T>(\n method: FetchMethod,\n path: string,\n body?: unknown,\n ): Promise<T> {\n const url = `${this.baseUrl}${path}`;\n this.logger.debug(`[admin] ${method} ${path}`);\n\n const headers: Record<string, string> = {\n 'x-medusa-access-token': this.apiKey,\n 'Content-Type': 'application/json',\n };\n\n const init: RequestInit = {\n method,\n headers,\n ...(body !== undefined ? { body: JSON.stringify(body) } : {}),\n };\n\n let response: Response;\n try {\n response = await fetch(url, init);\n } catch (networkError: any) {\n throw new ProviderAPIError(\n `[admin] Network error on ${method} ${path}: ${networkError.message}`,\n 'NETWORK_ERROR',\n networkError,\n );\n }\n\n if (!response.ok) {\n let message = `HTTP ${response.status}`;\n try {\n const json = await response.json();\n message = json?.message ?? message;\n } catch {\n // ignore parse errors\n }\n throw new ProviderAPIError(\n `[admin] ${method} ${path} failed: ${message}`,\n `ADMIN_API_${response.status}`,\n response.status,\n );\n }\n\n return response.json() as Promise<T>;\n }\n\n // -----------------------------------------------------------------------\n // 3.1 — Sales Channel: Customers\n // -----------------------------------------------------------------------\n\n /**\n * Paginated list of customers linked to a sales channel.\n *\n * `GET /admin/thor/sales-channels/:id/customers`\n */\n async getChannelCustomers(\n salesChannelId: string,\n options: GetChannelCustomersOptions = {},\n ): Promise<GetChannelCustomersResponse> {\n const { limit = 20, offset = 0 } = options;\n return this.request<GetChannelCustomersResponse>(\n 'GET',\n `/admin/thor/sales-channels/${salesChannelId}/customers?limit=${limit}&offset=${offset}`,\n );\n }\n\n // -----------------------------------------------------------------------\n // 3.2 — Sales Channel: API Keys\n // -----------------------------------------------------------------------\n\n /**\n * Publishable API keys associated with a sales channel.\n *\n * `GET /admin/thor/sales-channels/:id/api-keys`\n */\n async getChannelApiKeys(salesChannelId: string): Promise<GetChannelApiKeysResponse> {\n return this.request<GetChannelApiKeysResponse>(\n 'GET',\n `/admin/thor/sales-channels/${salesChannelId}/api-keys`,\n );\n }\n\n // -----------------------------------------------------------------------\n // 3.3 — Sales Channel: Categories\n // -----------------------------------------------------------------------\n\n /**\n * Product categories assigned to a sales channel.\n *\n * `GET /admin/thor/sales-channels/:id/categories`\n */\n async getChannelCategories(\n salesChannelId: string,\n options: GetChannelCategoriesOptions = {},\n ): Promise<GetChannelCategoriesResponse> {\n const { limit = 20, offset = 0, include_descendants = false } = options;\n const qs = new URLSearchParams({\n limit: String(limit),\n offset: String(offset),\n include_descendants: String(include_descendants),\n });\n return this.request<GetChannelCategoriesResponse>(\n 'GET',\n `/admin/thor/sales-channels/${salesChannelId}/categories?${qs}`,\n );\n }\n\n // -----------------------------------------------------------------------\n // 3.4 — Category: Sales Channels\n // -----------------------------------------------------------------------\n\n /**\n * Sales channels to which a category is assigned.\n *\n * `GET /admin/thor/categories/:id/sales-channels`\n */\n async getCategorySalesChannels(\n categoryId: string,\n ): Promise<GetCategorySalesChannelsResponse> {\n return this.request<GetCategorySalesChannelsResponse>(\n 'GET',\n `/admin/thor/categories/${categoryId}/sales-channels`,\n );\n }\n\n // -----------------------------------------------------------------------\n // 3.5 — Category: Assign to Sales Channels\n // -----------------------------------------------------------------------\n\n /**\n * Assign a category to one or more sales channels (idempotent).\n *\n * `POST /admin/thor/categories/:id/sales-channels`\n */\n async assignCategoryToChannels(\n categoryId: string,\n body: AssignCategoriesToChannelsBody,\n ): Promise<AssignCategoriesToChannelsResponse> {\n return this.request<AssignCategoriesToChannelsResponse>(\n 'POST',\n `/admin/thor/categories/${categoryId}/sales-channels`,\n body,\n );\n }\n\n // -----------------------------------------------------------------------\n // 3.6 — Category: Unassign from Sales Channels\n // -----------------------------------------------------------------------\n\n /**\n * Remove category assignment from one or more sales channels (idempotent).\n *\n * `DELETE /admin/thor/categories/:id/sales-channels`\n */\n async unassignCategoryFromChannels(\n categoryId: string,\n body: UnassignCategoriesFromChannelsBody,\n ): Promise<UnassignCategoriesFromChannelsResponse> {\n return this.request<UnassignCategoriesFromChannelsResponse>(\n 'DELETE',\n `/admin/thor/categories/${categoryId}/sales-channels`,\n body,\n );\n }\n\n // -----------------------------------------------------------------------\n // 3.7 — Collection: Sales Channels\n // -----------------------------------------------------------------------\n\n /**\n * Sales channels to which a collection is assigned.\n *\n * `GET /admin/thor/collections/:id/sales-channels`\n */\n async getCollectionSalesChannels(\n collectionId: string,\n ): Promise<GetCollectionSalesChannelsResponse> {\n return this.request<GetCollectionSalesChannelsResponse>(\n 'GET',\n `/admin/thor/collections/${collectionId}/sales-channels`,\n );\n }\n\n // -----------------------------------------------------------------------\n // 3.8 — Collection: Assign to Sales Channels\n // -----------------------------------------------------------------------\n\n /**\n * Assign a collection to one or more sales channels (idempotent).\n *\n * `POST /admin/thor/collections/:id/sales-channels`\n */\n async assignCollectionToChannels(\n collectionId: string,\n body: AssignCollectionsToChannelsBody,\n ): Promise<AssignCollectionsToChannelsResponse> {\n return this.request<AssignCollectionsToChannelsResponse>(\n 'POST',\n `/admin/thor/collections/${collectionId}/sales-channels`,\n body,\n );\n }\n\n // -----------------------------------------------------------------------\n // 3.9 — Collection: Unassign from Sales Channels\n // -----------------------------------------------------------------------\n\n /**\n * Remove collection assignment from one or more sales channels (idempotent).\n *\n * `DELETE /admin/thor/collections/:id/sales-channels`\n */\n async unassignCollectionFromChannels(\n collectionId: string,\n body: UnassignCollectionsFromChannelsBody,\n ): Promise<UnassignCollectionsFromChannelsResponse> {\n return this.request<UnassignCollectionsFromChannelsResponse>(\n 'DELETE',\n `/admin/thor/collections/${collectionId}/sales-channels`,\n body,\n );\n }\n\n // -----------------------------------------------------------------------\n // 3.10 — Storefront Config: Read\n // -----------------------------------------------------------------------\n\n /**\n * Read the visual storefront configuration for a channel.\n * `:id` is the `sales_channel_id`.\n *\n * `GET /admin/thor/storefront-config/:id`\n */\n async getStorefrontConfig(\n salesChannelId: string,\n ): Promise<GetAdminStorefrontConfigResponse> {\n return this.request<GetAdminStorefrontConfigResponse>(\n 'GET',\n `/admin/thor/storefront-config/${salesChannelId}`,\n );\n }\n\n // -----------------------------------------------------------------------\n // 3.11 — Storefront Config: Update\n // -----------------------------------------------------------------------\n\n /**\n * Update the visual storefront configuration for a channel.\n * Triggers the `storefront_config.updated` event → ISR webhook.\n *\n * `PUT /admin/thor/storefront-config/:id`\n */\n async updateStorefrontConfig(\n salesChannelId: string,\n body: UpdateStorefrontConfigBody,\n ): Promise<UpdateStorefrontConfigResponse> {\n return this.request<UpdateStorefrontConfigResponse>(\n 'PUT',\n `/admin/thor/storefront-config/${salesChannelId}`,\n body,\n );\n }\n\n // -----------------------------------------------------------------------\n // 3.12 — Site Designer Config: Read\n // -----------------------------------------------------------------------\n\n /**\n * Read the active Site Designer configuration for a channel, including the\n * last 10 history entries.\n *\n * `GET /admin/thor/site-config/:sales_channel_id`\n */\n async getSiteConfig(salesChannelId: string): Promise<GetAdminSiteConfigResponse> {\n return this.request<GetAdminSiteConfigResponse>(\n 'GET',\n `/admin/thor/site-config/${salesChannelId}`,\n );\n }\n\n // -----------------------------------------------------------------------\n // 3.13 — Site Designer Config: Update\n // -----------------------------------------------------------------------\n\n /**\n * Update the Site Designer configuration for a channel.\n * Creates a new history entry on every PUT.\n *\n * `PUT /admin/thor/site-config/:sales_channel_id`\n */\n async updateSiteConfig(\n salesChannelId: string,\n body: UpdateSiteConfigBody,\n ): Promise<UpdateSiteConfigResponse> {\n return this.request<UpdateSiteConfigResponse>(\n 'PUT',\n `/admin/thor/site-config/${salesChannelId}`,\n body,\n );\n }\n\n // -----------------------------------------------------------------------\n // 3.14 — Site Designer Config: History\n // -----------------------------------------------------------------------\n\n /**\n * Full paginated history of Site Designer versions for a channel.\n * Entries are immutable — they are never deleted.\n *\n * `GET /admin/thor/site-config/:sales_channel_id/history`\n */\n async getSiteConfigHistory(\n salesChannelId: string,\n options: GetAdminSiteConfigHistoryOptions = {},\n ): Promise<GetAdminSiteConfigHistoryResponse> {\n const { limit = 20, offset = 0 } = options;\n return this.request<GetAdminSiteConfigHistoryResponse>(\n 'GET',\n `/admin/thor/site-config/${salesChannelId}/history?limit=${limit}&offset=${offset}`,\n );\n }\n\n // -----------------------------------------------------------------------\n // 3.15 — Site Designer Config: Restore\n // -----------------------------------------------------------------------\n\n /**\n * Restore a previous Site Designer version.\n * Internally runs the update workflow with the stored config of the target\n * version — this creates a **new** history entry and does NOT mutate past\n * entries.\n *\n * `POST /admin/thor/site-config/:sales_channel_id/restore/:version`\n */\n async restoreSiteConfig(\n salesChannelId: string,\n version: string,\n ): Promise<RestoreSiteConfigResponse> {\n return this.request<RestoreSiteConfigResponse>(\n 'POST',\n `/admin/thor/site-config/${salesChannelId}/restore/${encodeURIComponent(version)}`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACyCA,sBAA+C;AAuCxC,IAAM,oBAAN,MAAwB;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EAER,YAAY,QAAiC;AAC3C,SAAK,UAAU,OAAO,QAAQ,QAAQ,OAAO,EAAE;AAC/C,SAAK,SAAS,OAAO;AACrB,SAAK,aAAS,8BAAa,qBAAqB,OAAO,KAAK;AAAA,EAC9D;AAAA;AAAA;AAAA;AAAA,EAMA,MAAc,QACZ,QACA,MACA,MACY;AACZ,UAAM,MAAM,GAAG,KAAK,OAAO,GAAG,IAAI;AAClC,SAAK,OAAO,MAAM,WAAW,MAAM,IAAI,IAAI,EAAE;AAE7C,UAAM,UAAkC;AAAA,MACtC,yBAAyB,KAAK;AAAA,MAC9B,gBAAgB;AAAA,IAClB;AAEA,UAAM,OAAoB;AAAA,MACxB;AAAA,MACA;AAAA,MACA,GAAI,SAAS,SAAY,EAAE,MAAM,KAAK,UAAU,IAAI,EAAE,IAAI,CAAC;AAAA,IAC7D;AAEA,QAAI;AACJ,QAAI;AACF,iBAAW,MAAM,M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