@timbrix/sdk 0.3.0 → 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.
package/dist/index.d.mts CHANGED
@@ -201,7 +201,7 @@ interface WebhookDelivery {
201
201
  success: boolean;
202
202
  createdAt: string;
203
203
  }
204
- type ApiKeyScope = "read:user" | "write:user" | "read:organization" | "write:organization" | "read:members" | "write:members" | "read:webhooks" | "write:webhooks" | "read:api-keys" | "write:api-keys";
204
+ type ApiKeyScope = "read:user" | "write:user" | "read:organization" | "write:organization" | "read:members" | "write:members" | "read:webhooks" | "write:webhooks" | "read:api-keys" | "write:api-keys" | "read:invoices" | "write:invoices";
205
205
  interface ApiKey {
206
206
  id: string;
207
207
  organizationId: string;
@@ -408,6 +408,72 @@ interface ListUsosCfdiParams {
408
408
  tipoPersona?: TipoPersona;
409
409
  regimen?: string;
410
410
  }
411
+ interface InvoiceCustomerInput {
412
+ legalName: string;
413
+ taxId: string;
414
+ /** SAT régimen fiscal code — required unless the customer is público en general */
415
+ taxSystem?: string;
416
+ zip?: string;
417
+ }
418
+ interface InvoiceTaxInput {
419
+ type: string;
420
+ factorType: string;
421
+ rate?: string;
422
+ base?: number;
423
+ amount?: number;
424
+ }
425
+ interface InvoiceItemInput {
426
+ quantity: number;
427
+ description: string;
428
+ unitPrice: number;
429
+ amount: number;
430
+ productKey: string;
431
+ unitKey: string;
432
+ unit?: string;
433
+ taxObject?: string;
434
+ taxes?: InvoiceTaxInput[];
435
+ }
436
+ interface CreateInvoiceInput {
437
+ /** Ingreso, Egreso, or Traslado — default: I */
438
+ type?: "I" | "E" | "T";
439
+ series: string;
440
+ folioNumber: string;
441
+ date: string;
442
+ paymentForm: string;
443
+ /** Default: PUE */
444
+ paymentMethod?: "PUE" | "PPD";
445
+ /** Default: MXN */
446
+ currency?: string;
447
+ /** Default: 1 */
448
+ exchange?: number;
449
+ /** SAT clave de exportación — default: 01 */
450
+ export?: string;
451
+ /** SAT uso CFDI catalog code */
452
+ use: string;
453
+ /** Inline customer — mutually exclusive with customerId */
454
+ customer?: InvoiceCustomerInput;
455
+ /** Existing customer ID — mutually exclusive with customer */
456
+ customerId?: string;
457
+ items: InvoiceItemInput[];
458
+ /**
459
+ * Client-supplied key to safely retry this request without
460
+ * double-stamping. If an invoice was already created for this
461
+ * organization with the same key, that invoice is returned instead of
462
+ * stamping again.
463
+ */
464
+ idempotencyKey?: string;
465
+ }
466
+ interface Invoice {
467
+ id: string;
468
+ uuid: string;
469
+ status: "valid";
470
+ series: string;
471
+ folioNumber: string;
472
+ total: number;
473
+ date: string;
474
+ xml: string;
475
+ createdAt: string;
476
+ }
411
477
  interface TimbrixError {
412
478
  statusCode: number;
413
479
  message: string | string[];
@@ -485,6 +551,17 @@ declare class CustomersResource {
485
551
  delete(organizationId: string, customerId: string): Promise<void>;
486
552
  }
487
553
 
554
+ declare class InvoicesResource {
555
+ private http;
556
+ constructor(http: KyInstance);
557
+ /**
558
+ * Create and stamp (timbrar) a CFDI 4.0 invoice via the configured PAC.
559
+ * Requires an API-key-authenticated client — the issuing organization is
560
+ * resolved from the key, there is no organizationId parameter.
561
+ */
562
+ create(data: CreateInvoiceInput): Promise<Invoice>;
563
+ }
564
+
488
565
  declare class OAuthResource {
489
566
  private http;
490
567
  constructor(http: KyInstance);
@@ -687,6 +764,7 @@ declare class Timbrix {
687
764
  readonly oauth: OAuthResource;
688
765
  readonly products: ProductsResource;
689
766
  readonly sat: SatResource;
767
+ readonly invoices: InvoicesResource;
690
768
  constructor(config?: TimbrixConfig);
691
769
  /**
692
770
  * Update authentication strategy (useful for CLI when token changes)
@@ -715,4 +793,4 @@ declare class ApiKeyAuth implements AuthStrategy {
715
793
  applyAuth(options: Options): Options;
716
794
  }
717
795
 
718
- export { type ApiKey, ApiKeyAuth, type ApiKeyScope, type ApiKeyStats, type ApiKeyValidateResponse, ApiKeysResource, type AuthMode, AuthResource, type AuthStrategy, BearerAuth, type CreateApiKeyInput, type CreateApiKeyResponse, type CreateCustomerInput, type CreateOAuthAppInput, type CreateOrganizationInput, type CreateProductInput, type CreateWebhookInput, type Customer, type CustomerAddress, CustomersResource, type ExchangeCodeInput, type GenerateTokenInput, type InviteMemberInput, type LegalAddress, type ListProductsFilters, type ListRegimenesParams, type ListUsosCfdiParams, type LoginInput, type LoginResponse, type OAuthApp, type OAuthAppWithSecret, OAuthResource, type OAuthScope, type OAuthToken, type Organization, type OrganizationDetails, type OrganizationInvite, type OrganizationMember, type OrganizationRole, OrganizationsResource, type Product, type ProductTax, ProductsResource, type RefreshTokenInput, type RegimenFiscal, SatResource, Timbrix, type TimbrixConfig, type TimbrixError, type TimbrixUser, type TipoPersona, type TokenResponse, type UpdateApiKeyInput, type UpdateCustomerInput, type UpdateLegalDataInput, type UpdateMemberRoleInput, type UpdateOAuthAppInput, type UpdateOrganizationInput, type UpdateProductInput, type UpdateWebhookInput, UsersResource, type UsoCfdi, type ValidateCertificateResponse, type Webhook, type WebhookDelivery, type WebhookEvent, WebhooksResource };
796
+ export { type ApiKey, ApiKeyAuth, type ApiKeyScope, type ApiKeyStats, type ApiKeyValidateResponse, ApiKeysResource, type AuthMode, AuthResource, type AuthStrategy, BearerAuth, type CreateApiKeyInput, type CreateApiKeyResponse, type CreateCustomerInput, type CreateInvoiceInput, type CreateOAuthAppInput, type CreateOrganizationInput, type CreateProductInput, type CreateWebhookInput, type Customer, type CustomerAddress, CustomersResource, type ExchangeCodeInput, type GenerateTokenInput, type InviteMemberInput, type Invoice, type InvoiceCustomerInput, type InvoiceItemInput, type InvoiceTaxInput, InvoicesResource, type LegalAddress, type ListProductsFilters, type ListRegimenesParams, type ListUsosCfdiParams, type LoginInput, type LoginResponse, type OAuthApp, type OAuthAppWithSecret, OAuthResource, type OAuthScope, type OAuthToken, type Organization, type OrganizationDetails, type OrganizationInvite, type OrganizationMember, type OrganizationRole, OrganizationsResource, type Product, type ProductTax, ProductsResource, type RefreshTokenInput, type RegimenFiscal, SatResource, Timbrix, type TimbrixConfig, type TimbrixError, type TimbrixUser, type TipoPersona, type TokenResponse, type UpdateApiKeyInput, type UpdateCustomerInput, type UpdateLegalDataInput, type UpdateMemberRoleInput, type UpdateOAuthAppInput, type UpdateOrganizationInput, type UpdateProductInput, type UpdateWebhookInput, UsersResource, type UsoCfdi, type ValidateCertificateResponse, type Webhook, type WebhookDelivery, type WebhookEvent, WebhooksResource };
package/dist/index.d.ts CHANGED
@@ -201,7 +201,7 @@ interface WebhookDelivery {
201
201
  success: boolean;
202
202
  createdAt: string;
203
203
  }
204
- type ApiKeyScope = "read:user" | "write:user" | "read:organization" | "write:organization" | "read:members" | "write:members" | "read:webhooks" | "write:webhooks" | "read:api-keys" | "write:api-keys";
204
+ type ApiKeyScope = "read:user" | "write:user" | "read:organization" | "write:organization" | "read:members" | "write:members" | "read:webhooks" | "write:webhooks" | "read:api-keys" | "write:api-keys" | "read:invoices" | "write:invoices";
205
205
  interface ApiKey {
206
206
  id: string;
207
207
  organizationId: string;
@@ -408,6 +408,72 @@ interface ListUsosCfdiParams {
408
408
  tipoPersona?: TipoPersona;
409
409
  regimen?: string;
410
410
  }
411
+ interface InvoiceCustomerInput {
412
+ legalName: string;
413
+ taxId: string;
414
+ /** SAT régimen fiscal code — required unless the customer is público en general */
415
+ taxSystem?: string;
416
+ zip?: string;
417
+ }
418
+ interface InvoiceTaxInput {
419
+ type: string;
420
+ factorType: string;
421
+ rate?: string;
422
+ base?: number;
423
+ amount?: number;
424
+ }
425
+ interface InvoiceItemInput {
426
+ quantity: number;
427
+ description: string;
428
+ unitPrice: number;
429
+ amount: number;
430
+ productKey: string;
431
+ unitKey: string;
432
+ unit?: string;
433
+ taxObject?: string;
434
+ taxes?: InvoiceTaxInput[];
435
+ }
436
+ interface CreateInvoiceInput {
437
+ /** Ingreso, Egreso, or Traslado — default: I */
438
+ type?: "I" | "E" | "T";
439
+ series: string;
440
+ folioNumber: string;
441
+ date: string;
442
+ paymentForm: string;
443
+ /** Default: PUE */
444
+ paymentMethod?: "PUE" | "PPD";
445
+ /** Default: MXN */
446
+ currency?: string;
447
+ /** Default: 1 */
448
+ exchange?: number;
449
+ /** SAT clave de exportación — default: 01 */
450
+ export?: string;
451
+ /** SAT uso CFDI catalog code */
452
+ use: string;
453
+ /** Inline customer — mutually exclusive with customerId */
454
+ customer?: InvoiceCustomerInput;
455
+ /** Existing customer ID — mutually exclusive with customer */
456
+ customerId?: string;
457
+ items: InvoiceItemInput[];
458
+ /**
459
+ * Client-supplied key to safely retry this request without
460
+ * double-stamping. If an invoice was already created for this
461
+ * organization with the same key, that invoice is returned instead of
462
+ * stamping again.
463
+ */
464
+ idempotencyKey?: string;
465
+ }
466
+ interface Invoice {
467
+ id: string;
468
+ uuid: string;
469
+ status: "valid";
470
+ series: string;
471
+ folioNumber: string;
472
+ total: number;
473
+ date: string;
474
+ xml: string;
475
+ createdAt: string;
476
+ }
411
477
  interface TimbrixError {
412
478
  statusCode: number;
413
479
  message: string | string[];
@@ -485,6 +551,17 @@ declare class CustomersResource {
485
551
  delete(organizationId: string, customerId: string): Promise<void>;
486
552
  }
487
553
 
554
+ declare class InvoicesResource {
555
+ private http;
556
+ constructor(http: KyInstance);
557
+ /**
558
+ * Create and stamp (timbrar) a CFDI 4.0 invoice via the configured PAC.
559
+ * Requires an API-key-authenticated client — the issuing organization is
560
+ * resolved from the key, there is no organizationId parameter.
561
+ */
562
+ create(data: CreateInvoiceInput): Promise<Invoice>;
563
+ }
564
+
488
565
  declare class OAuthResource {
489
566
  private http;
490
567
  constructor(http: KyInstance);
@@ -687,6 +764,7 @@ declare class Timbrix {
687
764
  readonly oauth: OAuthResource;
688
765
  readonly products: ProductsResource;
689
766
  readonly sat: SatResource;
767
+ readonly invoices: InvoicesResource;
690
768
  constructor(config?: TimbrixConfig);
691
769
  /**
692
770
  * Update authentication strategy (useful for CLI when token changes)
@@ -715,4 +793,4 @@ declare class ApiKeyAuth implements AuthStrategy {
715
793
  applyAuth(options: Options): Options;
716
794
  }
717
795
 
718
- export { type ApiKey, ApiKeyAuth, type ApiKeyScope, type ApiKeyStats, type ApiKeyValidateResponse, ApiKeysResource, type AuthMode, AuthResource, type AuthStrategy, BearerAuth, type CreateApiKeyInput, type CreateApiKeyResponse, type CreateCustomerInput, type CreateOAuthAppInput, type CreateOrganizationInput, type CreateProductInput, type CreateWebhookInput, type Customer, type CustomerAddress, CustomersResource, type ExchangeCodeInput, type GenerateTokenInput, type InviteMemberInput, type LegalAddress, type ListProductsFilters, type ListRegimenesParams, type ListUsosCfdiParams, type LoginInput, type LoginResponse, type OAuthApp, type OAuthAppWithSecret, OAuthResource, type OAuthScope, type OAuthToken, type Organization, type OrganizationDetails, type OrganizationInvite, type OrganizationMember, type OrganizationRole, OrganizationsResource, type Product, type ProductTax, ProductsResource, type RefreshTokenInput, type RegimenFiscal, SatResource, Timbrix, type TimbrixConfig, type TimbrixError, type TimbrixUser, type TipoPersona, type TokenResponse, type UpdateApiKeyInput, type UpdateCustomerInput, type UpdateLegalDataInput, type UpdateMemberRoleInput, type UpdateOAuthAppInput, type UpdateOrganizationInput, type UpdateProductInput, type UpdateWebhookInput, UsersResource, type UsoCfdi, type ValidateCertificateResponse, type Webhook, type WebhookDelivery, type WebhookEvent, WebhooksResource };
796
+ export { type ApiKey, ApiKeyAuth, type ApiKeyScope, type ApiKeyStats, type ApiKeyValidateResponse, ApiKeysResource, type AuthMode, AuthResource, type AuthStrategy, BearerAuth, type CreateApiKeyInput, type CreateApiKeyResponse, type CreateCustomerInput, type CreateInvoiceInput, type CreateOAuthAppInput, type CreateOrganizationInput, type CreateProductInput, type CreateWebhookInput, type Customer, type CustomerAddress, CustomersResource, type ExchangeCodeInput, type GenerateTokenInput, type InviteMemberInput, type Invoice, type InvoiceCustomerInput, type InvoiceItemInput, type InvoiceTaxInput, InvoicesResource, type LegalAddress, type ListProductsFilters, type ListRegimenesParams, type ListUsosCfdiParams, type LoginInput, type LoginResponse, type OAuthApp, type OAuthAppWithSecret, OAuthResource, type OAuthScope, type OAuthToken, type Organization, type OrganizationDetails, type OrganizationInvite, type OrganizationMember, type OrganizationRole, OrganizationsResource, type Product, type ProductTax, ProductsResource, type RefreshTokenInput, type RegimenFiscal, SatResource, Timbrix, type TimbrixConfig, type TimbrixError, type TimbrixUser, type TipoPersona, type TokenResponse, type UpdateApiKeyInput, type UpdateCustomerInput, type UpdateLegalDataInput, type UpdateMemberRoleInput, type UpdateOAuthAppInput, type UpdateOrganizationInput, type UpdateProductInput, type UpdateWebhookInput, UsersResource, type UsoCfdi, type ValidateCertificateResponse, type Webhook, type WebhookDelivery, type WebhookEvent, WebhooksResource };
package/dist/index.js CHANGED
@@ -35,6 +35,7 @@ __export(index_exports, {
35
35
  AuthResource: () => AuthResource,
36
36
  BearerAuth: () => BearerAuth,
37
37
  CustomersResource: () => CustomersResource,
38
+ InvoicesResource: () => InvoicesResource,
38
39
  OAuthResource: () => OAuthResource,
39
40
  OrganizationsResource: () => OrganizationsResource,
40
41
  ProductsResource: () => ProductsResource,
@@ -53,6 +54,7 @@ var BearerAuth = class {
53
54
  constructor(token) {
54
55
  this.token = token;
55
56
  }
57
+ token;
56
58
  getHeaders() {
57
59
  return {
58
60
  Authorization: `Bearer ${this.token}`
@@ -72,6 +74,7 @@ var ApiKeyAuth = class {
72
74
  constructor(apiKey) {
73
75
  this.apiKey = apiKey;
74
76
  }
77
+ apiKey;
75
78
  getHeaders() {
76
79
  return {
77
80
  "X-API-Key": this.apiKey
@@ -93,6 +96,7 @@ var ApiKeysResource = class {
93
96
  constructor(http) {
94
97
  this.http = http;
95
98
  }
99
+ http;
96
100
  /**
97
101
  * List all API keys for an organization
98
102
  */
@@ -146,6 +150,7 @@ var AuthResource = class {
146
150
  constructor(http) {
147
151
  this.http = http;
148
152
  }
153
+ http;
149
154
  /**
150
155
  * Login with email and password. Returns an access token.
151
156
  */
@@ -165,6 +170,7 @@ var CustomersResource = class {
165
170
  constructor(http) {
166
171
  this.http = http;
167
172
  }
173
+ http;
168
174
  /**
169
175
  * List all customers for an organization
170
176
  */
@@ -201,11 +207,28 @@ var CustomersResource = class {
201
207
  }
202
208
  };
203
209
 
210
+ // src/resources/invoices.ts
211
+ var InvoicesResource = class {
212
+ constructor(http) {
213
+ this.http = http;
214
+ }
215
+ http;
216
+ /**
217
+ * Create and stamp (timbrar) a CFDI 4.0 invoice via the configured PAC.
218
+ * Requires an API-key-authenticated client — the issuing organization is
219
+ * resolved from the key, there is no organizationId parameter.
220
+ */
221
+ async create(data) {
222
+ return this.http.post("invoices", { json: data }).json();
223
+ }
224
+ };
225
+
204
226
  // src/resources/oauth.ts
205
227
  var OAuthResource = class {
206
228
  constructor(http) {
207
229
  this.http = http;
208
230
  }
231
+ http;
209
232
  // ─── App Management ─────────────────────────────────────────────────────────
210
233
  /**
211
234
  * Create a new OAuth application. Client secret is returned only once.
@@ -294,6 +317,7 @@ var OrganizationsResource = class {
294
317
  constructor(http) {
295
318
  this.http = http;
296
319
  }
320
+ http;
297
321
  /**
298
322
  * Create a new organization
299
323
  */
@@ -367,6 +391,7 @@ var ProductsResource = class {
367
391
  constructor(http) {
368
392
  this.http = http;
369
393
  }
394
+ http;
370
395
  /**
371
396
  * List products for an organization, with optional filters
372
397
  */
@@ -415,6 +440,7 @@ var SatResource = class {
415
440
  constructor(http) {
416
441
  this.http = http;
417
442
  }
443
+ http;
418
444
  /**
419
445
  * List régimenes fiscales from the SAT catalog
420
446
  * Calls GET /sat/regimenes-fiscales
@@ -445,6 +471,7 @@ var UsersResource = class {
445
471
  constructor(http) {
446
472
  this.http = http;
447
473
  }
474
+ http;
448
475
  /**
449
476
  * Get the currently authenticated user
450
477
  */
@@ -476,6 +503,7 @@ var WebhooksResource = class {
476
503
  constructor(http) {
477
504
  this.http = http;
478
505
  }
506
+ http;
479
507
  /**
480
508
  * List all webhooks for an organization
481
509
  */
@@ -537,8 +565,9 @@ var Timbrix = class {
537
565
  oauth;
538
566
  products;
539
567
  sat;
568
+ invoices;
540
569
  constructor(config = {}) {
541
- const baseUrl = config.baseUrl || "http://localhost:3001/api";
570
+ const baseUrl = config.baseUrl || "http://localhost:3001";
542
571
  if (config.bearerToken) {
543
572
  this.authStrategy = new BearerAuth(config.bearerToken);
544
573
  } else if (config.apiKey) {
@@ -551,7 +580,7 @@ var Timbrix = class {
551
580
  },
552
581
  hooks: {
553
582
  beforeRequest: [
554
- (request) => {
583
+ ({ request }) => {
555
584
  if (this.authStrategy) {
556
585
  const authHeaders = this.authStrategy.getHeaders();
557
586
  Object.entries(authHeaders).forEach(([key, value]) => {
@@ -571,6 +600,7 @@ var Timbrix = class {
571
600
  this.oauth = new OAuthResource(this.http);
572
601
  this.products = new ProductsResource(this.http);
573
602
  this.sat = new SatResource(this.http);
603
+ this.invoices = new InvoicesResource(this.http);
574
604
  }
575
605
  /**
576
606
  * Update authentication strategy (useful for CLI when token changes)
@@ -598,6 +628,7 @@ var Timbrix = class {
598
628
  AuthResource,
599
629
  BearerAuth,
600
630
  CustomersResource,
631
+ InvoicesResource,
601
632
  OAuthResource,
602
633
  OrganizationsResource,
603
634
  ProductsResource,
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
  */
@@ -154,11 +159,28 @@ var CustomersResource = class {
154
159
  }
155
160
  };
156
161
 
162
+ // src/resources/invoices.ts
163
+ var InvoicesResource = class {
164
+ constructor(http) {
165
+ this.http = http;
166
+ }
167
+ http;
168
+ /**
169
+ * Create and stamp (timbrar) a CFDI 4.0 invoice via the configured PAC.
170
+ * Requires an API-key-authenticated client — the issuing organization is
171
+ * resolved from the key, there is no organizationId parameter.
172
+ */
173
+ async create(data) {
174
+ return this.http.post("invoices", { json: data }).json();
175
+ }
176
+ };
177
+
157
178
  // src/resources/oauth.ts
158
179
  var OAuthResource = class {
159
180
  constructor(http) {
160
181
  this.http = http;
161
182
  }
183
+ http;
162
184
  // ─── App Management ─────────────────────────────────────────────────────────
163
185
  /**
164
186
  * Create a new OAuth application. Client secret is returned only once.
@@ -247,6 +269,7 @@ var OrganizationsResource = class {
247
269
  constructor(http) {
248
270
  this.http = http;
249
271
  }
272
+ http;
250
273
  /**
251
274
  * Create a new organization
252
275
  */
@@ -320,6 +343,7 @@ var ProductsResource = class {
320
343
  constructor(http) {
321
344
  this.http = http;
322
345
  }
346
+ http;
323
347
  /**
324
348
  * List products for an organization, with optional filters
325
349
  */
@@ -368,6 +392,7 @@ var SatResource = class {
368
392
  constructor(http) {
369
393
  this.http = http;
370
394
  }
395
+ http;
371
396
  /**
372
397
  * List régimenes fiscales from the SAT catalog
373
398
  * Calls GET /sat/regimenes-fiscales
@@ -398,6 +423,7 @@ var UsersResource = class {
398
423
  constructor(http) {
399
424
  this.http = http;
400
425
  }
426
+ http;
401
427
  /**
402
428
  * Get the currently authenticated user
403
429
  */
@@ -429,6 +455,7 @@ var WebhooksResource = class {
429
455
  constructor(http) {
430
456
  this.http = http;
431
457
  }
458
+ http;
432
459
  /**
433
460
  * List all webhooks for an organization
434
461
  */
@@ -490,8 +517,9 @@ var Timbrix = class {
490
517
  oauth;
491
518
  products;
492
519
  sat;
520
+ invoices;
493
521
  constructor(config = {}) {
494
- const baseUrl = config.baseUrl || "http://localhost:3001/api";
522
+ const baseUrl = config.baseUrl || "http://localhost:3001";
495
523
  if (config.bearerToken) {
496
524
  this.authStrategy = new BearerAuth(config.bearerToken);
497
525
  } else if (config.apiKey) {
@@ -504,7 +532,7 @@ var Timbrix = class {
504
532
  },
505
533
  hooks: {
506
534
  beforeRequest: [
507
- (request) => {
535
+ ({ request }) => {
508
536
  if (this.authStrategy) {
509
537
  const authHeaders = this.authStrategy.getHeaders();
510
538
  Object.entries(authHeaders).forEach(([key, value]) => {
@@ -524,6 +552,7 @@ var Timbrix = class {
524
552
  this.oauth = new OAuthResource(this.http);
525
553
  this.products = new ProductsResource(this.http);
526
554
  this.sat = new SatResource(this.http);
555
+ this.invoices = new InvoicesResource(this.http);
527
556
  }
528
557
  /**
529
558
  * Update authentication strategy (useful for CLI when token changes)
@@ -550,6 +579,7 @@ export {
550
579
  AuthResource,
551
580
  BearerAuth,
552
581
  CustomersResource,
582
+ InvoicesResource,
553
583
  OAuthResource,
554
584
  OrganizationsResource,
555
585
  ProductsResource,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timbrix/sdk",
3
- "version": "0.3.0",
3
+ "version": "1.0.0",
4
4
  "description": "TypeScript SDK for Timbrix API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -27,12 +27,12 @@
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",
34
+ "typescript": "^6.0.3",
35
+ "@repo/eslint-config": "0.1.1",
36
36
  "@repo/typescript-config": "0.1.0"
37
37
  },
38
38
  "scripts": {