@inkress/admin-sdk 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,520 @@
1
+ import fetch from 'cross-fetch';
2
+
3
+ class HttpClient {
4
+ constructor(config) {
5
+ this.config = {
6
+ endpoint: 'https://api.inkress.com',
7
+ apiVersion: 'v1',
8
+ clientId: '',
9
+ timeout: 30000,
10
+ retries: 0,
11
+ headers: {},
12
+ ...config,
13
+ };
14
+ }
15
+ getBaseUrl() {
16
+ const { endpoint, apiVersion } = this.config;
17
+ return `${endpoint}/api/${apiVersion}`;
18
+ }
19
+ getHeaders(additionalHeaders = {}) {
20
+ const headers = {
21
+ 'Content-Type': 'application/json',
22
+ 'Authorization': `Bearer ${this.config.bearerToken}`,
23
+ ...this.config.headers,
24
+ ...additionalHeaders,
25
+ };
26
+ // Add Client-Id header if provided
27
+ if (this.config.clientId) {
28
+ headers['Client-Id'] = this.config.clientId;
29
+ }
30
+ return headers;
31
+ }
32
+ async makeRequest(path, options = {}) {
33
+ const url = `${this.getBaseUrl()}${path}`;
34
+ const { method = 'GET', body, headers: requestHeaders, timeout } = options;
35
+ const headers = this.getHeaders(requestHeaders);
36
+ const requestTimeout = timeout || this.config.timeout;
37
+ const requestInit = {
38
+ method,
39
+ headers,
40
+ };
41
+ if (body && method !== 'GET') {
42
+ requestInit.body = typeof body === 'string' ? body : JSON.stringify(body);
43
+ }
44
+ // Create timeout promise
45
+ const timeoutPromise = new Promise((_, reject) => {
46
+ setTimeout(() => reject(new Error('Request timeout')), requestTimeout);
47
+ });
48
+ try {
49
+ const response = await Promise.race([
50
+ fetch(url, requestInit),
51
+ timeoutPromise,
52
+ ]);
53
+ if (!response.ok) {
54
+ const errorText = await response.text();
55
+ let errorData;
56
+ try {
57
+ errorData = JSON.parse(errorText);
58
+ }
59
+ catch (_a) {
60
+ errorData = { message: errorText || `HTTP ${response.status}` };
61
+ }
62
+ throw new InkressApiError(errorData.message || `HTTP ${response.status}`, response.status, errorData);
63
+ }
64
+ const responseText = await response.text();
65
+ if (!responseText) {
66
+ return { state: 'ok', data: undefined };
67
+ }
68
+ const data = JSON.parse(responseText);
69
+ return data;
70
+ }
71
+ catch (error) {
72
+ if (error instanceof InkressApiError) {
73
+ throw error;
74
+ }
75
+ throw new InkressApiError(error instanceof Error ? error.message : 'Unknown error', 0, { error });
76
+ }
77
+ }
78
+ async retryRequest(path, options = {}, retries = this.config.retries) {
79
+ try {
80
+ return await this.makeRequest(path, options);
81
+ }
82
+ catch (error) {
83
+ if (retries > 0 && this.shouldRetry(error)) {
84
+ await this.delay(1000 * (this.config.retries - retries + 1));
85
+ return this.retryRequest(path, options, retries - 1);
86
+ }
87
+ throw error;
88
+ }
89
+ }
90
+ shouldRetry(error) {
91
+ if (error instanceof InkressApiError) {
92
+ // Retry on 5xx errors and timeouts
93
+ return error.status >= 500 || error.status === 0;
94
+ }
95
+ return false;
96
+ }
97
+ delay(ms) {
98
+ return new Promise(resolve => setTimeout(resolve, ms));
99
+ }
100
+ async get(path, params) {
101
+ let url = path;
102
+ if (params) {
103
+ const searchParams = new URLSearchParams();
104
+ Object.entries(params).forEach(([key, value]) => {
105
+ if (value !== undefined && value !== null) {
106
+ searchParams.append(key, String(value));
107
+ }
108
+ });
109
+ const queryString = searchParams.toString();
110
+ if (queryString) {
111
+ url += `?${queryString}`;
112
+ }
113
+ }
114
+ return this.retryRequest(url, { method: 'GET' });
115
+ }
116
+ async post(path, body) {
117
+ return this.retryRequest(path, { method: 'POST', body });
118
+ }
119
+ async put(path, body) {
120
+ return this.retryRequest(path, { method: 'PUT', body });
121
+ }
122
+ async delete(path) {
123
+ return this.retryRequest(path, { method: 'DELETE' });
124
+ }
125
+ async patch(path, body) {
126
+ return this.retryRequest(path, { method: 'PATCH', body });
127
+ }
128
+ // Update configuration
129
+ updateConfig(newConfig) {
130
+ this.config = { ...this.config, ...newConfig };
131
+ }
132
+ // Get current configuration (without sensitive data)
133
+ getConfig() {
134
+ const { bearerToken, ...config } = this.config;
135
+ return config;
136
+ }
137
+ }
138
+ class InkressApiError extends Error {
139
+ constructor(message, status, data) {
140
+ super(message);
141
+ this.name = 'InkressApiError';
142
+ this.status = status;
143
+ this.data = data;
144
+ }
145
+ }
146
+
147
+ class MerchantsResource {
148
+ constructor(client) {
149
+ this.client = client;
150
+ }
151
+ /**
152
+ * List merchants with pagination and filtering
153
+ */
154
+ async list(params) {
155
+ return this.client.get('/merchants', params);
156
+ }
157
+ /**
158
+ * Get a specific merchant by ID
159
+ */
160
+ async get(id) {
161
+ return this.client.get(`/merchants/${id}`);
162
+ }
163
+ /**
164
+ * Create a new merchant
165
+ */
166
+ async create(data) {
167
+ return this.client.post('/merchants', data);
168
+ }
169
+ /**
170
+ * Update an existing merchant
171
+ */
172
+ async update(id, data) {
173
+ return this.client.put(`/merchants/${id}`, data);
174
+ }
175
+ }
176
+
177
+ class CategoriesResource {
178
+ constructor(client) {
179
+ this.client = client;
180
+ }
181
+ /**
182
+ * List categories with pagination and filtering
183
+ * Requires Client-Id header to be set in the configuration
184
+ */
185
+ async list(params) {
186
+ return this.client.get('/categories', params);
187
+ }
188
+ /**
189
+ * Get a specific category by ID
190
+ * Requires Client-Id header to be set in the configuration
191
+ */
192
+ async get(id) {
193
+ return this.client.get(`/categories/${id}`);
194
+ }
195
+ /**
196
+ * Create a new category
197
+ * Requires Client-Id header to be set in the configuration
198
+ */
199
+ async create(data) {
200
+ return this.client.post('/categories', data);
201
+ }
202
+ /**
203
+ * Update an existing category
204
+ * Requires Client-Id header to be set in the configuration
205
+ * Note: parent_id is immutable and cannot be changed after creation
206
+ */
207
+ async update(id, data) {
208
+ return this.client.put(`/categories/${id}`, data);
209
+ }
210
+ /**
211
+ * Delete a category
212
+ * Requires Client-Id header to be set in the configuration
213
+ * Note: Categories with assigned products or child categories cannot be deleted
214
+ */
215
+ async delete(id) {
216
+ return this.client.delete(`/categories/${id}`);
217
+ }
218
+ }
219
+
220
+ class OrdersResource {
221
+ constructor(client) {
222
+ this.client = client;
223
+ }
224
+ /**
225
+ * Create a new order
226
+ * Requires Client-Id header to be set in the configuration
227
+ */
228
+ async create(data) {
229
+ return this.client.post('/orders', data);
230
+ }
231
+ /**
232
+ * Get order details by ID
233
+ * Requires Client-Id header to be set in the configuration
234
+ */
235
+ async get(id) {
236
+ return this.client.get(`/orders/${id}`);
237
+ }
238
+ /**
239
+ * Update order status
240
+ * Requires Client-Id header to be set in the configuration
241
+ */
242
+ async update(id, data) {
243
+ return this.client.put(`/orders/${id}`, data);
244
+ }
245
+ /**
246
+ * Get order status (public endpoint - no auth required)
247
+ */
248
+ async getStatus(id) {
249
+ return this.client.get(`/orders/status/${id}`);
250
+ }
251
+ /**
252
+ * Get order list with pagination and filtering
253
+ * Supports filtering by status, kind, customer email, and date range
254
+ * Requires Client-Id header to be set in the configuration
255
+ */
256
+ async list() {
257
+ return this.client.get('/orders');
258
+ }
259
+ }
260
+
261
+ class ProductsResource {
262
+ constructor(client) {
263
+ this.client = client;
264
+ }
265
+ /**
266
+ * List products with pagination and filtering
267
+ * Requires Client-Id header to be set in the configuration
268
+ */
269
+ async list(params) {
270
+ return this.client.get('/products', params);
271
+ }
272
+ /**
273
+ * Get a specific product by ID
274
+ * Requires Client-Id header to be set in the configuration
275
+ */
276
+ async get(id) {
277
+ return this.client.get(`/products/${id}`);
278
+ }
279
+ /**
280
+ * Create a new product
281
+ * Requires Client-Id header to be set in the configuration
282
+ */
283
+ async create(data) {
284
+ return this.client.post('/products', data);
285
+ }
286
+ /**
287
+ * Update an existing product
288
+ * Requires Client-Id header to be set in the configuration
289
+ */
290
+ async update(id, data) {
291
+ return this.client.put(`/products/${id}`, data);
292
+ }
293
+ /**
294
+ * Delete a product
295
+ * Requires Client-Id header to be set in the configuration
296
+ */
297
+ async delete(id) {
298
+ return this.client.delete(`/products/${id}`);
299
+ }
300
+ }
301
+
302
+ class BillingPlansResource {
303
+ constructor(client) {
304
+ this.client = client;
305
+ }
306
+ /**
307
+ * List billing plans with pagination and filtering
308
+ * Requires Client-Id header to be set in the configuration
309
+ */
310
+ async list(params) {
311
+ return this.client.get('/billing_plans', params);
312
+ }
313
+ /**
314
+ * Get a specific billing plan by ID
315
+ * Requires Client-Id header to be set in the configuration
316
+ */
317
+ async get(id) {
318
+ return this.client.get(`/billing_plans/${id}`);
319
+ }
320
+ /**
321
+ * Create a new billing plan
322
+ * Requires Client-Id header to be set in the configuration
323
+ */
324
+ async create(data) {
325
+ return this.client.post('/billing_plans', data);
326
+ }
327
+ /**
328
+ * Update an existing billing plan
329
+ * Requires Client-Id header to be set in the configuration
330
+ */
331
+ async update(id, data) {
332
+ return this.client.put(`/billing_plans/${id}`, data);
333
+ }
334
+ /**
335
+ * Delete a billing plan
336
+ * Requires Client-Id header to be set in the configuration
337
+ */
338
+ async delete(id) {
339
+ return this.client.delete(`/billing_plans/${id}`);
340
+ }
341
+ }
342
+
343
+ class SubscriptionsResource {
344
+ constructor(client) {
345
+ this.client = client;
346
+ }
347
+ /**
348
+ * List billing subscriptions with pagination and filtering
349
+ * Requires Client-Id header to be set in the configuration
350
+ */
351
+ async list(params) {
352
+ return this.client.get('/billing_subscriptions', params);
353
+ }
354
+ /**
355
+ * Create a subscription payment link
356
+ * Requires Client-Id header to be set in the configuration
357
+ */
358
+ async createLink(data) {
359
+ return this.client.post('/billing_subscriptions/link', data);
360
+ }
361
+ /**
362
+ * Charge an existing subscription
363
+ * Requires Client-Id header to be set in the configuration
364
+ */
365
+ async charge(uid, data) {
366
+ return this.client.post(`/billing_subscriptions/${uid}/charge`, data);
367
+ }
368
+ /**
369
+ * Get subscription billing periods
370
+ * Requires Client-Id header to be set in the configuration
371
+ */
372
+ async getPeriods(uid, params) {
373
+ return this.client.get(`/billing_subscriptions/${uid}/periods`, params);
374
+ }
375
+ /**
376
+ * Cancel a subscription
377
+ * Requires Client-Id header to be set in the configuration
378
+ */
379
+ async cancel(uid, code) {
380
+ return this.client.post(`/billing_subscriptions/${uid}/cancel/${code}`);
381
+ }
382
+ }
383
+
384
+ class UsersResource {
385
+ constructor(client) {
386
+ this.client = client;
387
+ }
388
+ /**
389
+ * List users with pagination and filtering
390
+ * Requires Client-Id header to be set in the configuration
391
+ */
392
+ async list(params) {
393
+ return this.client.get('/users', params);
394
+ }
395
+ /**
396
+ * Get a specific user by ID
397
+ * Requires Client-Id header to be set in the configuration
398
+ */
399
+ async get(id) {
400
+ return this.client.get(`/users/${id}`);
401
+ }
402
+ /**
403
+ * Create a new user
404
+ * Requires Client-Id header to be set in the configuration
405
+ */
406
+ async create(data) {
407
+ return this.client.post('/users', data);
408
+ }
409
+ /**
410
+ * Update an existing user
411
+ * Requires Client-Id header to be set in the configuration
412
+ */
413
+ async update(id, data) {
414
+ return this.client.put(`/users/${id}`, data);
415
+ }
416
+ /**
417
+ * Delete a user
418
+ * Requires Client-Id header to be set in the configuration
419
+ */
420
+ async delete(id) {
421
+ return this.client.delete(`/users/${id}`);
422
+ }
423
+ }
424
+
425
+ class PublicResource {
426
+ constructor(client) {
427
+ this.client = client;
428
+ }
429
+ /**
430
+ * Get public information about a merchant by username or cname
431
+ */
432
+ async getMerchant(params) {
433
+ return this.client.get(`/public/m`, params);
434
+ }
435
+ /**
436
+ * Get merchant fees (public endpoint - no auth required)
437
+ */
438
+ async getMerchantFees(merchantUsername, params) {
439
+ return this.client.get(`/public/m/${merchantUsername}/fees`, params);
440
+ }
441
+ /**
442
+ * Get merchant products (public endpoint - no auth required)
443
+ */
444
+ async getMerchantProducts(merchantUsername, params) {
445
+ return this.client.get(`/public/m/${merchantUsername}/products`, params);
446
+ }
447
+ }
448
+
449
+ /**
450
+ * Main Inkress Commerce API SDK class
451
+ *
452
+ * @example
453
+ * ```typescript
454
+ * import { InkressSDK } from '@inkress/admin-sdk';
455
+ *
456
+ * const inkress = new InkressSDK({
457
+ * bearerToken: 'your-jwt-token',
458
+ * clientId: 'm-merchant-username', // Required for merchant-specific endpoints
459
+ * endpoint: 'https://api.inkress.com', // Optional, defaults to production
460
+ * apiVersion: 'v1', // Optional, defaults to v1
461
+ * });
462
+ *
463
+ * // List merchants
464
+ * const merchants = await inkress.merchants.list();
465
+ *
466
+ * // Get public merchant information (no auth required)
467
+ * const publicMerchant = await inkress.public.getMerchant({ username: 'merchant-username' });
468
+ *
469
+ * // List categories
470
+ * const categories = await inkress.categories.list();
471
+ *
472
+ * // Create a category
473
+ * const category = await inkress.categories.create({
474
+ * name: 'Electronics',
475
+ * description: 'Electronic devices and accessories',
476
+ * kind: 1
477
+ * });
478
+ *
479
+ * // Create an order
480
+ * const order = await inkress.orders.create({
481
+ * currency_code: 'USD',
482
+ * customer: {
483
+ * email: 'customer@example.com',
484
+ * first_name: 'John',
485
+ * last_name: 'Doe'
486
+ * },
487
+ * total: 29.99,
488
+ * reference_id: 'order-123'
489
+ * });
490
+ * ```
491
+ */
492
+ class InkressSDK {
493
+ constructor(config) {
494
+ this.client = new HttpClient(config);
495
+ // Initialize resources
496
+ this.merchants = new MerchantsResource(this.client);
497
+ this.categories = new CategoriesResource(this.client);
498
+ this.orders = new OrdersResource(this.client);
499
+ this.products = new ProductsResource(this.client);
500
+ this.billingPlans = new BillingPlansResource(this.client);
501
+ this.subscriptions = new SubscriptionsResource(this.client);
502
+ this.users = new UsersResource(this.client);
503
+ this.public = new PublicResource(this.client);
504
+ }
505
+ /**
506
+ * Update the SDK configuration
507
+ */
508
+ updateConfig(newConfig) {
509
+ this.client.updateConfig(newConfig);
510
+ }
511
+ /**
512
+ * Get current configuration (without sensitive data)
513
+ */
514
+ getConfig() {
515
+ return this.client.getConfig();
516
+ }
517
+ }
518
+
519
+ export { HttpClient, InkressApiError, InkressSDK, InkressSDK as default };
520
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/client.ts","../src/resources/merchants.ts","../src/resources/categories.ts","../src/resources/orders.ts","../src/resources/products.ts","../src/resources/billing-plans.ts","../src/resources/subscriptions.ts","../src/resources/users.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