@timbrix/sdk 1.1.0 → 1.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 +28 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +26 -0
- package/dist/index.mjs +26 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -455,6 +455,8 @@ interface InvoiceTaxInput {
|
|
|
455
455
|
rate?: string;
|
|
456
456
|
base?: number;
|
|
457
457
|
amount?: number;
|
|
458
|
+
/** true = retención, false/omitted = traslado */
|
|
459
|
+
withholding?: boolean;
|
|
458
460
|
}
|
|
459
461
|
interface InvoiceItemInput {
|
|
460
462
|
quantity: number;
|
|
@@ -476,6 +478,8 @@ interface InvoiceItemInput {
|
|
|
476
478
|
interface CreateInvoiceInput {
|
|
477
479
|
/** Ingreso, Egreso, or Traslado — default: I */
|
|
478
480
|
type?: "I" | "E" | "T";
|
|
481
|
+
/** Required when type is "E" — UUID fiscal of the original Ingreso CFDI */
|
|
482
|
+
relatedInvoiceUuid?: string;
|
|
479
483
|
series: string;
|
|
480
484
|
folioNumber: string;
|
|
481
485
|
date: string;
|
|
@@ -507,6 +511,8 @@ interface Invoice {
|
|
|
507
511
|
id: string;
|
|
508
512
|
uuid: string;
|
|
509
513
|
status: "valid";
|
|
514
|
+
/** I = Ingreso, E = Egreso, T = Traslado */
|
|
515
|
+
type: "I" | "E" | "T";
|
|
510
516
|
series: string;
|
|
511
517
|
folioNumber: string;
|
|
512
518
|
total: number;
|
|
@@ -519,6 +525,10 @@ interface ListInvoicesParams {
|
|
|
519
525
|
page?: number;
|
|
520
526
|
/** Results per page (1-100). Default: 20 */
|
|
521
527
|
limit?: number;
|
|
528
|
+
/** Filter by tipo de comprobante */
|
|
529
|
+
type?: "I" | "E" | "T";
|
|
530
|
+
/** Filter by status */
|
|
531
|
+
status?: "vigente" | "cancelado";
|
|
522
532
|
}
|
|
523
533
|
interface InvoiceListItem {
|
|
524
534
|
id: string;
|
|
@@ -634,6 +644,24 @@ declare class InvoicesResource {
|
|
|
634
644
|
* scope), same rules as `create`.
|
|
635
645
|
*/
|
|
636
646
|
list(organizationId: string, params?: ListInvoicesParams): Promise<ListInvoicesResponse>;
|
|
647
|
+
/**
|
|
648
|
+
* Get a single CFDI 4.0 invoice by its folio fiscal (UUID). Works with
|
|
649
|
+
* either a Supabase bearer session or an API key (requires the
|
|
650
|
+
* `read:invoices` scope).
|
|
651
|
+
*/
|
|
652
|
+
get(uuid: string): Promise<Invoice>;
|
|
653
|
+
/**
|
|
654
|
+
* Download the timbrado XML for an invoice. Works with either a
|
|
655
|
+
* Supabase bearer session or an API key (requires the `read:invoices`
|
|
656
|
+
* scope).
|
|
657
|
+
*/
|
|
658
|
+
getXml(uuid: string): Promise<Blob>;
|
|
659
|
+
/**
|
|
660
|
+
* Download the PDF representation for an invoice. Works with either a
|
|
661
|
+
* Supabase bearer session or an API key (requires the `read:invoices`
|
|
662
|
+
* scope).
|
|
663
|
+
*/
|
|
664
|
+
getPdf(uuid: string): Promise<Blob>;
|
|
637
665
|
}
|
|
638
666
|
|
|
639
667
|
declare class OAuthResource {
|
package/dist/index.d.ts
CHANGED
|
@@ -455,6 +455,8 @@ interface InvoiceTaxInput {
|
|
|
455
455
|
rate?: string;
|
|
456
456
|
base?: number;
|
|
457
457
|
amount?: number;
|
|
458
|
+
/** true = retención, false/omitted = traslado */
|
|
459
|
+
withholding?: boolean;
|
|
458
460
|
}
|
|
459
461
|
interface InvoiceItemInput {
|
|
460
462
|
quantity: number;
|
|
@@ -476,6 +478,8 @@ interface InvoiceItemInput {
|
|
|
476
478
|
interface CreateInvoiceInput {
|
|
477
479
|
/** Ingreso, Egreso, or Traslado — default: I */
|
|
478
480
|
type?: "I" | "E" | "T";
|
|
481
|
+
/** Required when type is "E" — UUID fiscal of the original Ingreso CFDI */
|
|
482
|
+
relatedInvoiceUuid?: string;
|
|
479
483
|
series: string;
|
|
480
484
|
folioNumber: string;
|
|
481
485
|
date: string;
|
|
@@ -507,6 +511,8 @@ interface Invoice {
|
|
|
507
511
|
id: string;
|
|
508
512
|
uuid: string;
|
|
509
513
|
status: "valid";
|
|
514
|
+
/** I = Ingreso, E = Egreso, T = Traslado */
|
|
515
|
+
type: "I" | "E" | "T";
|
|
510
516
|
series: string;
|
|
511
517
|
folioNumber: string;
|
|
512
518
|
total: number;
|
|
@@ -519,6 +525,10 @@ interface ListInvoicesParams {
|
|
|
519
525
|
page?: number;
|
|
520
526
|
/** Results per page (1-100). Default: 20 */
|
|
521
527
|
limit?: number;
|
|
528
|
+
/** Filter by tipo de comprobante */
|
|
529
|
+
type?: "I" | "E" | "T";
|
|
530
|
+
/** Filter by status */
|
|
531
|
+
status?: "vigente" | "cancelado";
|
|
522
532
|
}
|
|
523
533
|
interface InvoiceListItem {
|
|
524
534
|
id: string;
|
|
@@ -634,6 +644,24 @@ declare class InvoicesResource {
|
|
|
634
644
|
* scope), same rules as `create`.
|
|
635
645
|
*/
|
|
636
646
|
list(organizationId: string, params?: ListInvoicesParams): Promise<ListInvoicesResponse>;
|
|
647
|
+
/**
|
|
648
|
+
* Get a single CFDI 4.0 invoice by its folio fiscal (UUID). Works with
|
|
649
|
+
* either a Supabase bearer session or an API key (requires the
|
|
650
|
+
* `read:invoices` scope).
|
|
651
|
+
*/
|
|
652
|
+
get(uuid: string): Promise<Invoice>;
|
|
653
|
+
/**
|
|
654
|
+
* Download the timbrado XML for an invoice. Works with either a
|
|
655
|
+
* Supabase bearer session or an API key (requires the `read:invoices`
|
|
656
|
+
* scope).
|
|
657
|
+
*/
|
|
658
|
+
getXml(uuid: string): Promise<Blob>;
|
|
659
|
+
/**
|
|
660
|
+
* Download the PDF representation for an invoice. Works with either a
|
|
661
|
+
* Supabase bearer session or an API key (requires the `read:invoices`
|
|
662
|
+
* scope).
|
|
663
|
+
*/
|
|
664
|
+
getPdf(uuid: string): Promise<Blob>;
|
|
637
665
|
}
|
|
638
666
|
|
|
639
667
|
declare class OAuthResource {
|
package/dist/index.js
CHANGED
|
@@ -232,10 +232,36 @@ var InvoicesResource = class {
|
|
|
232
232
|
const searchParams = {};
|
|
233
233
|
if (params?.page !== void 0) searchParams.page = String(params.page);
|
|
234
234
|
if (params?.limit !== void 0) searchParams.limit = String(params.limit);
|
|
235
|
+
if (params?.type !== void 0) searchParams.type = params.type;
|
|
236
|
+
if (params?.status !== void 0) searchParams.status = params.status;
|
|
235
237
|
return this.http.get(`organizations/${organizationId}/invoices`, {
|
|
236
238
|
searchParams: Object.keys(searchParams).length > 0 ? searchParams : void 0
|
|
237
239
|
}).json();
|
|
238
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Get a single CFDI 4.0 invoice by its folio fiscal (UUID). Works with
|
|
243
|
+
* either a Supabase bearer session or an API key (requires the
|
|
244
|
+
* `read:invoices` scope).
|
|
245
|
+
*/
|
|
246
|
+
async get(uuid) {
|
|
247
|
+
return this.http.get(`invoices/${uuid}`).json();
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Download the timbrado XML for an invoice. Works with either a
|
|
251
|
+
* Supabase bearer session or an API key (requires the `read:invoices`
|
|
252
|
+
* scope).
|
|
253
|
+
*/
|
|
254
|
+
async getXml(uuid) {
|
|
255
|
+
return this.http.get(`invoices/${uuid}/xml`).blob();
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Download the PDF representation for an invoice. Works with either a
|
|
259
|
+
* Supabase bearer session or an API key (requires the `read:invoices`
|
|
260
|
+
* scope).
|
|
261
|
+
*/
|
|
262
|
+
async getPdf(uuid) {
|
|
263
|
+
return this.http.get(`invoices/${uuid}/pdf`).blob();
|
|
264
|
+
}
|
|
239
265
|
};
|
|
240
266
|
|
|
241
267
|
// src/resources/oauth.ts
|
package/dist/index.mjs
CHANGED
|
@@ -184,10 +184,36 @@ var InvoicesResource = class {
|
|
|
184
184
|
const searchParams = {};
|
|
185
185
|
if (params?.page !== void 0) searchParams.page = String(params.page);
|
|
186
186
|
if (params?.limit !== void 0) searchParams.limit = String(params.limit);
|
|
187
|
+
if (params?.type !== void 0) searchParams.type = params.type;
|
|
188
|
+
if (params?.status !== void 0) searchParams.status = params.status;
|
|
187
189
|
return this.http.get(`organizations/${organizationId}/invoices`, {
|
|
188
190
|
searchParams: Object.keys(searchParams).length > 0 ? searchParams : void 0
|
|
189
191
|
}).json();
|
|
190
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Get a single CFDI 4.0 invoice by its folio fiscal (UUID). Works with
|
|
195
|
+
* either a Supabase bearer session or an API key (requires the
|
|
196
|
+
* `read:invoices` scope).
|
|
197
|
+
*/
|
|
198
|
+
async get(uuid) {
|
|
199
|
+
return this.http.get(`invoices/${uuid}`).json();
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Download the timbrado XML for an invoice. Works with either a
|
|
203
|
+
* Supabase bearer session or an API key (requires the `read:invoices`
|
|
204
|
+
* scope).
|
|
205
|
+
*/
|
|
206
|
+
async getXml(uuid) {
|
|
207
|
+
return this.http.get(`invoices/${uuid}/xml`).blob();
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Download the PDF representation for an invoice. Works with either a
|
|
211
|
+
* Supabase bearer session or an API key (requires the `read:invoices`
|
|
212
|
+
* scope).
|
|
213
|
+
*/
|
|
214
|
+
async getPdf(uuid) {
|
|
215
|
+
return this.http.get(`invoices/${uuid}/pdf`).blob();
|
|
216
|
+
}
|
|
191
217
|
};
|
|
192
218
|
|
|
193
219
|
// src/resources/oauth.ts
|