@timbrix/sdk 0.3.0 → 0.3.1

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.
package/dist/index.js CHANGED
@@ -53,6 +53,7 @@ var BearerAuth = class {
53
53
  constructor(token) {
54
54
  this.token = token;
55
55
  }
56
+ token;
56
57
  getHeaders() {
57
58
  return {
58
59
  Authorization: `Bearer ${this.token}`
@@ -72,6 +73,7 @@ var ApiKeyAuth = class {
72
73
  constructor(apiKey) {
73
74
  this.apiKey = apiKey;
74
75
  }
76
+ apiKey;
75
77
  getHeaders() {
76
78
  return {
77
79
  "X-API-Key": this.apiKey
@@ -93,6 +95,7 @@ var ApiKeysResource = class {
93
95
  constructor(http) {
94
96
  this.http = http;
95
97
  }
98
+ http;
96
99
  /**
97
100
  * List all API keys for an organization
98
101
  */
@@ -146,6 +149,7 @@ var AuthResource = class {
146
149
  constructor(http) {
147
150
  this.http = http;
148
151
  }
152
+ http;
149
153
  /**
150
154
  * Login with email and password. Returns an access token.
151
155
  */
@@ -165,6 +169,7 @@ var CustomersResource = class {
165
169
  constructor(http) {
166
170
  this.http = http;
167
171
  }
172
+ http;
168
173
  /**
169
174
  * List all customers for an organization
170
175
  */
@@ -206,6 +211,7 @@ var OAuthResource = class {
206
211
  constructor(http) {
207
212
  this.http = http;
208
213
  }
214
+ http;
209
215
  // ─── App Management ─────────────────────────────────────────────────────────
210
216
  /**
211
217
  * Create a new OAuth application. Client secret is returned only once.
@@ -294,6 +300,7 @@ var OrganizationsResource = class {
294
300
  constructor(http) {
295
301
  this.http = http;
296
302
  }
303
+ http;
297
304
  /**
298
305
  * Create a new organization
299
306
  */
@@ -367,6 +374,7 @@ var ProductsResource = class {
367
374
  constructor(http) {
368
375
  this.http = http;
369
376
  }
377
+ http;
370
378
  /**
371
379
  * List products for an organization, with optional filters
372
380
  */
@@ -415,6 +423,7 @@ var SatResource = class {
415
423
  constructor(http) {
416
424
  this.http = http;
417
425
  }
426
+ http;
418
427
  /**
419
428
  * List régimenes fiscales from the SAT catalog
420
429
  * Calls GET /sat/regimenes-fiscales
@@ -445,6 +454,7 @@ var UsersResource = class {
445
454
  constructor(http) {
446
455
  this.http = http;
447
456
  }
457
+ http;
448
458
  /**
449
459
  * Get the currently authenticated user
450
460
  */
@@ -476,6 +486,7 @@ var WebhooksResource = class {
476
486
  constructor(http) {
477
487
  this.http = http;
478
488
  }
489
+ http;
479
490
  /**
480
491
  * List all webhooks for an organization
481
492
  */
@@ -538,7 +549,7 @@ var Timbrix = class {
538
549
  products;
539
550
  sat;
540
551
  constructor(config = {}) {
541
- const baseUrl = config.baseUrl || "http://localhost:3001/api";
552
+ const baseUrl = config.baseUrl || "http://localhost:3001";
542
553
  if (config.bearerToken) {
543
554
  this.authStrategy = new BearerAuth(config.bearerToken);
544
555
  } else if (config.apiKey) {
@@ -551,7 +562,7 @@ var Timbrix = class {
551
562
  },
552
563
  hooks: {
553
564
  beforeRequest: [
554
- (request) => {
565
+ ({ request }) => {
555
566
  if (this.authStrategy) {
556
567
  const authHeaders = this.authStrategy.getHeaders();
557
568
  Object.entries(authHeaders).forEach(([key, value]) => {
package/dist/index.mjs CHANGED
@@ -6,6 +6,7 @@ var BearerAuth = class {
6
6
  constructor(token) {
7
7
  this.token = token;
8
8
  }
9
+ token;
9
10
  getHeaders() {
10
11
  return {
11
12
  Authorization: `Bearer ${this.token}`
@@ -25,6 +26,7 @@ var ApiKeyAuth = class {
25
26
  constructor(apiKey) {
26
27
  this.apiKey = apiKey;
27
28
  }
29
+ apiKey;
28
30
  getHeaders() {
29
31
  return {
30
32
  "X-API-Key": this.apiKey
@@ -46,6 +48,7 @@ var ApiKeysResource = class {
46
48
  constructor(http) {
47
49
  this.http = http;
48
50
  }
51
+ http;
49
52
  /**
50
53
  * List all API keys for an organization
51
54
  */
@@ -99,6 +102,7 @@ var AuthResource = class {
99
102
  constructor(http) {
100
103
  this.http = http;
101
104
  }
105
+ http;
102
106
  /**
103
107
  * Login with email and password. Returns an access token.
104
108
  */
@@ -118,6 +122,7 @@ var CustomersResource = class {
118
122
  constructor(http) {
119
123
  this.http = http;
120
124
  }
125
+ http;
121
126
  /**
122
127
  * List all customers for an organization
123
128
  */
@@ -159,6 +164,7 @@ var OAuthResource = class {
159
164
  constructor(http) {
160
165
  this.http = http;
161
166
  }
167
+ http;
162
168
  // ─── App Management ─────────────────────────────────────────────────────────
163
169
  /**
164
170
  * Create a new OAuth application. Client secret is returned only once.
@@ -247,6 +253,7 @@ var OrganizationsResource = class {
247
253
  constructor(http) {
248
254
  this.http = http;
249
255
  }
256
+ http;
250
257
  /**
251
258
  * Create a new organization
252
259
  */
@@ -320,6 +327,7 @@ var ProductsResource = class {
320
327
  constructor(http) {
321
328
  this.http = http;
322
329
  }
330
+ http;
323
331
  /**
324
332
  * List products for an organization, with optional filters
325
333
  */
@@ -368,6 +376,7 @@ var SatResource = class {
368
376
  constructor(http) {
369
377
  this.http = http;
370
378
  }
379
+ http;
371
380
  /**
372
381
  * List régimenes fiscales from the SAT catalog
373
382
  * Calls GET /sat/regimenes-fiscales
@@ -398,6 +407,7 @@ var UsersResource = class {
398
407
  constructor(http) {
399
408
  this.http = http;
400
409
  }
410
+ http;
401
411
  /**
402
412
  * Get the currently authenticated user
403
413
  */
@@ -429,6 +439,7 @@ var WebhooksResource = class {
429
439
  constructor(http) {
430
440
  this.http = http;
431
441
  }
442
+ http;
432
443
  /**
433
444
  * List all webhooks for an organization
434
445
  */
@@ -491,7 +502,7 @@ var Timbrix = class {
491
502
  products;
492
503
  sat;
493
504
  constructor(config = {}) {
494
- const baseUrl = config.baseUrl || "http://localhost:3001/api";
505
+ const baseUrl = config.baseUrl || "http://localhost:3001";
495
506
  if (config.bearerToken) {
496
507
  this.authStrategy = new BearerAuth(config.bearerToken);
497
508
  } else if (config.apiKey) {
@@ -504,7 +515,7 @@ var Timbrix = class {
504
515
  },
505
516
  hooks: {
506
517
  beforeRequest: [
507
- (request) => {
518
+ ({ request }) => {
508
519
  if (this.authStrategy) {
509
520
  const authHeaders = this.authStrategy.getHeaders();
510
521
  Object.entries(authHeaders).forEach(([key, value]) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timbrix/sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "TypeScript SDK for Timbrix API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -27,13 +27,13 @@
27
27
  "registry": "https://registry.npmjs.org/"
28
28
  },
29
29
  "dependencies": {
30
- "ky": "^1.14.3"
30
+ "ky": "^2.0.2"
31
31
  },
32
32
  "devDependencies": {
33
33
  "tsup": "^8.5.1",
34
- "typescript": "^5.9.3",
35
- "@repo/eslint-config": "0.1.0",
36
- "@repo/typescript-config": "0.1.0"
34
+ "typescript": "^6.0.3",
35
+ "@repo/typescript-config": "0.1.0",
36
+ "@repo/eslint-config": "0.1.1"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "tsup src/index.ts --format cjs,esm --dts",