@timbrix/sdk 0.1.0 → 0.3.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
@@ -390,6 +390,24 @@ interface ListProductsFilters {
390
390
  sku?: string;
391
391
  productKey?: number;
392
392
  }
393
+ type TipoPersona = "fisica" | "moral" | "ambas";
394
+ interface RegimenFiscal {
395
+ codigo: string;
396
+ descripcion: string;
397
+ tipoPersona: TipoPersona;
398
+ }
399
+ interface UsoCfdi {
400
+ codigo: string;
401
+ descripcion: string;
402
+ tipoPersona: TipoPersona;
403
+ }
404
+ interface ListRegimenesParams {
405
+ tipoPersona?: TipoPersona;
406
+ }
407
+ interface ListUsosCfdiParams {
408
+ tipoPersona?: TipoPersona;
409
+ regimen?: string;
410
+ }
393
411
  interface TimbrixError {
394
412
  statusCode: number;
395
413
  message: string | string[];
@@ -586,6 +604,21 @@ declare class ProductsResource {
586
604
  delete(organizationId: string, productId: string): Promise<void>;
587
605
  }
588
606
 
607
+ declare class SatResource {
608
+ private http;
609
+ constructor(http: KyInstance);
610
+ /**
611
+ * List régimenes fiscales from the SAT catalog
612
+ * Calls GET /sat/regimenes-fiscales
613
+ */
614
+ regimenes(params?: ListRegimenesParams): Promise<RegimenFiscal[]>;
615
+ /**
616
+ * List usos CFDI from the SAT catalog
617
+ * Calls GET /sat/usos-cfdi
618
+ */
619
+ usosCfdi(params?: ListUsosCfdiParams): Promise<UsoCfdi[]>;
620
+ }
621
+
589
622
  declare class UsersResource {
590
623
  private http;
591
624
  constructor(http: KyInstance);
@@ -653,6 +686,7 @@ declare class Timbrix {
653
686
  readonly customers: CustomersResource;
654
687
  readonly oauth: OAuthResource;
655
688
  readonly products: ProductsResource;
689
+ readonly sat: SatResource;
656
690
  constructor(config?: TimbrixConfig);
657
691
  /**
658
692
  * Update authentication strategy (useful for CLI when token changes)
@@ -681,4 +715,4 @@ declare class ApiKeyAuth implements AuthStrategy {
681
715
  applyAuth(options: Options): Options;
682
716
  }
683
717
 
684
- 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 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, Timbrix, type TimbrixConfig, type TimbrixError, type TimbrixUser, type TokenResponse, type UpdateApiKeyInput, type UpdateCustomerInput, type UpdateLegalDataInput, type UpdateMemberRoleInput, type UpdateOAuthAppInput, type UpdateOrganizationInput, type UpdateProductInput, type UpdateWebhookInput, UsersResource, type ValidateCertificateResponse, type Webhook, type WebhookDelivery, type WebhookEvent, WebhooksResource };
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 };
package/dist/index.d.ts CHANGED
@@ -390,6 +390,24 @@ interface ListProductsFilters {
390
390
  sku?: string;
391
391
  productKey?: number;
392
392
  }
393
+ type TipoPersona = "fisica" | "moral" | "ambas";
394
+ interface RegimenFiscal {
395
+ codigo: string;
396
+ descripcion: string;
397
+ tipoPersona: TipoPersona;
398
+ }
399
+ interface UsoCfdi {
400
+ codigo: string;
401
+ descripcion: string;
402
+ tipoPersona: TipoPersona;
403
+ }
404
+ interface ListRegimenesParams {
405
+ tipoPersona?: TipoPersona;
406
+ }
407
+ interface ListUsosCfdiParams {
408
+ tipoPersona?: TipoPersona;
409
+ regimen?: string;
410
+ }
393
411
  interface TimbrixError {
394
412
  statusCode: number;
395
413
  message: string | string[];
@@ -586,6 +604,21 @@ declare class ProductsResource {
586
604
  delete(organizationId: string, productId: string): Promise<void>;
587
605
  }
588
606
 
607
+ declare class SatResource {
608
+ private http;
609
+ constructor(http: KyInstance);
610
+ /**
611
+ * List régimenes fiscales from the SAT catalog
612
+ * Calls GET /sat/regimenes-fiscales
613
+ */
614
+ regimenes(params?: ListRegimenesParams): Promise<RegimenFiscal[]>;
615
+ /**
616
+ * List usos CFDI from the SAT catalog
617
+ * Calls GET /sat/usos-cfdi
618
+ */
619
+ usosCfdi(params?: ListUsosCfdiParams): Promise<UsoCfdi[]>;
620
+ }
621
+
589
622
  declare class UsersResource {
590
623
  private http;
591
624
  constructor(http: KyInstance);
@@ -653,6 +686,7 @@ declare class Timbrix {
653
686
  readonly customers: CustomersResource;
654
687
  readonly oauth: OAuthResource;
655
688
  readonly products: ProductsResource;
689
+ readonly sat: SatResource;
656
690
  constructor(config?: TimbrixConfig);
657
691
  /**
658
692
  * Update authentication strategy (useful for CLI when token changes)
@@ -681,4 +715,4 @@ declare class ApiKeyAuth implements AuthStrategy {
681
715
  applyAuth(options: Options): Options;
682
716
  }
683
717
 
684
- 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 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, Timbrix, type TimbrixConfig, type TimbrixError, type TimbrixUser, type TokenResponse, type UpdateApiKeyInput, type UpdateCustomerInput, type UpdateLegalDataInput, type UpdateMemberRoleInput, type UpdateOAuthAppInput, type UpdateOrganizationInput, type UpdateProductInput, type UpdateWebhookInput, UsersResource, type ValidateCertificateResponse, type Webhook, type WebhookDelivery, type WebhookEvent, WebhooksResource };
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 };
package/dist/index.js CHANGED
@@ -38,6 +38,7 @@ __export(index_exports, {
38
38
  OAuthResource: () => OAuthResource,
39
39
  OrganizationsResource: () => OrganizationsResource,
40
40
  ProductsResource: () => ProductsResource,
41
+ SatResource: () => SatResource,
41
42
  Timbrix: () => Timbrix,
42
43
  UsersResource: () => UsersResource,
43
44
  WebhooksResource: () => WebhooksResource
@@ -409,6 +410,36 @@ var ProductsResource = class {
409
410
  }
410
411
  };
411
412
 
413
+ // src/resources/sat.ts
414
+ var SatResource = class {
415
+ constructor(http) {
416
+ this.http = http;
417
+ }
418
+ /**
419
+ * List régimenes fiscales from the SAT catalog
420
+ * Calls GET /sat/regimenes-fiscales
421
+ */
422
+ async regimenes(params) {
423
+ const searchParams = {};
424
+ if (params?.tipoPersona) searchParams.tipoPersona = params.tipoPersona;
425
+ return this.http.get("sat/regimenes-fiscales", {
426
+ searchParams: Object.keys(searchParams).length > 0 ? searchParams : void 0
427
+ }).json();
428
+ }
429
+ /**
430
+ * List usos CFDI from the SAT catalog
431
+ * Calls GET /sat/usos-cfdi
432
+ */
433
+ async usosCfdi(params) {
434
+ const searchParams = {};
435
+ if (params?.tipoPersona) searchParams.tipoPersona = params.tipoPersona;
436
+ if (params?.regimen) searchParams.regimen = params.regimen;
437
+ return this.http.get("sat/usos-cfdi", {
438
+ searchParams: Object.keys(searchParams).length > 0 ? searchParams : void 0
439
+ }).json();
440
+ }
441
+ };
442
+
412
443
  // src/resources/users.ts
413
444
  var UsersResource = class {
414
445
  constructor(http) {
@@ -505,6 +536,7 @@ var Timbrix = class {
505
536
  customers;
506
537
  oauth;
507
538
  products;
539
+ sat;
508
540
  constructor(config = {}) {
509
541
  const baseUrl = config.baseUrl || "http://localhost:3001/api";
510
542
  if (config.bearerToken) {
@@ -538,6 +570,7 @@ var Timbrix = class {
538
570
  this.customers = new CustomersResource(this.http);
539
571
  this.oauth = new OAuthResource(this.http);
540
572
  this.products = new ProductsResource(this.http);
573
+ this.sat = new SatResource(this.http);
541
574
  }
542
575
  /**
543
576
  * Update authentication strategy (useful for CLI when token changes)
@@ -568,6 +601,7 @@ var Timbrix = class {
568
601
  OAuthResource,
569
602
  OrganizationsResource,
570
603
  ProductsResource,
604
+ SatResource,
571
605
  Timbrix,
572
606
  UsersResource,
573
607
  WebhooksResource
package/dist/index.mjs CHANGED
@@ -363,6 +363,36 @@ var ProductsResource = class {
363
363
  }
364
364
  };
365
365
 
366
+ // src/resources/sat.ts
367
+ var SatResource = class {
368
+ constructor(http) {
369
+ this.http = http;
370
+ }
371
+ /**
372
+ * List régimenes fiscales from the SAT catalog
373
+ * Calls GET /sat/regimenes-fiscales
374
+ */
375
+ async regimenes(params) {
376
+ const searchParams = {};
377
+ if (params?.tipoPersona) searchParams.tipoPersona = params.tipoPersona;
378
+ return this.http.get("sat/regimenes-fiscales", {
379
+ searchParams: Object.keys(searchParams).length > 0 ? searchParams : void 0
380
+ }).json();
381
+ }
382
+ /**
383
+ * List usos CFDI from the SAT catalog
384
+ * Calls GET /sat/usos-cfdi
385
+ */
386
+ async usosCfdi(params) {
387
+ const searchParams = {};
388
+ if (params?.tipoPersona) searchParams.tipoPersona = params.tipoPersona;
389
+ if (params?.regimen) searchParams.regimen = params.regimen;
390
+ return this.http.get("sat/usos-cfdi", {
391
+ searchParams: Object.keys(searchParams).length > 0 ? searchParams : void 0
392
+ }).json();
393
+ }
394
+ };
395
+
366
396
  // src/resources/users.ts
367
397
  var UsersResource = class {
368
398
  constructor(http) {
@@ -459,6 +489,7 @@ var Timbrix = class {
459
489
  customers;
460
490
  oauth;
461
491
  products;
492
+ sat;
462
493
  constructor(config = {}) {
463
494
  const baseUrl = config.baseUrl || "http://localhost:3001/api";
464
495
  if (config.bearerToken) {
@@ -492,6 +523,7 @@ var Timbrix = class {
492
523
  this.customers = new CustomersResource(this.http);
493
524
  this.oauth = new OAuthResource(this.http);
494
525
  this.products = new ProductsResource(this.http);
526
+ this.sat = new SatResource(this.http);
495
527
  }
496
528
  /**
497
529
  * Update authentication strategy (useful for CLI when token changes)
@@ -521,6 +553,7 @@ export {
521
553
  OAuthResource,
522
554
  OrganizationsResource,
523
555
  ProductsResource,
556
+ SatResource,
524
557
  Timbrix,
525
558
  UsersResource,
526
559
  WebhooksResource
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timbrix/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "TypeScript SDK for Timbrix API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -22,6 +22,10 @@
22
22
  "sdk"
23
23
  ],
24
24
  "license": "MIT",
25
+ "publishConfig": {
26
+ "access": "public",
27
+ "registry": "https://registry.npmjs.org/"
28
+ },
25
29
  "dependencies": {
26
30
  "ky": "^1.14.3"
27
31
  },