@timbrix/sdk 1.2.0 → 1.4.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
@@ -638,12 +638,40 @@ declare class InvoicesResource {
638
638
  * belong to `organizationId`).
639
639
  */
640
640
  create(organizationId: string, data: CreateInvoiceInput): Promise<Invoice>;
641
+ /**
642
+ * Generate a PDF preview of a CFDI 4.0 invoice without stamping
643
+ * (timbrar) it via the PAC. Nothing is persisted and no stamping quota
644
+ * is consumed. Accepts the same body shape as `create`. Works with
645
+ * either a Supabase bearer session (internal dashboard, the user must
646
+ * be a member of `organizationId`) or an API key (external
647
+ * integrations, requires the `write:invoices` scope — the key must
648
+ * belong to `organizationId`).
649
+ */
650
+ previewPdf(organizationId: string, data: CreateInvoiceInput): Promise<Blob>;
641
651
  /**
642
652
  * List invoices for an organization, newest first. Works with either a
643
653
  * Supabase bearer session or an API key (requires the `read:invoices`
644
654
  * scope), same rules as `create`.
645
655
  */
646
656
  list(organizationId: string, params?: ListInvoicesParams): Promise<ListInvoicesResponse>;
657
+ /**
658
+ * Get a single CFDI 4.0 invoice by its folio fiscal (UUID). Works with
659
+ * either a Supabase bearer session or an API key (requires the
660
+ * `read:invoices` scope).
661
+ */
662
+ get(uuid: string): Promise<Invoice>;
663
+ /**
664
+ * Download the timbrado XML for an invoice. Works with either a
665
+ * Supabase bearer session or an API key (requires the `read:invoices`
666
+ * scope).
667
+ */
668
+ getXml(uuid: string): Promise<Blob>;
669
+ /**
670
+ * Download the PDF representation for an invoice. Works with either a
671
+ * Supabase bearer session or an API key (requires the `read:invoices`
672
+ * scope).
673
+ */
674
+ getPdf(uuid: string): Promise<Blob>;
647
675
  }
648
676
 
649
677
  declare class OAuthResource {
package/dist/index.d.ts CHANGED
@@ -638,12 +638,40 @@ declare class InvoicesResource {
638
638
  * belong to `organizationId`).
639
639
  */
640
640
  create(organizationId: string, data: CreateInvoiceInput): Promise<Invoice>;
641
+ /**
642
+ * Generate a PDF preview of a CFDI 4.0 invoice without stamping
643
+ * (timbrar) it via the PAC. Nothing is persisted and no stamping quota
644
+ * is consumed. Accepts the same body shape as `create`. Works with
645
+ * either a Supabase bearer session (internal dashboard, the user must
646
+ * be a member of `organizationId`) or an API key (external
647
+ * integrations, requires the `write:invoices` scope — the key must
648
+ * belong to `organizationId`).
649
+ */
650
+ previewPdf(organizationId: string, data: CreateInvoiceInput): Promise<Blob>;
641
651
  /**
642
652
  * List invoices for an organization, newest first. Works with either a
643
653
  * Supabase bearer session or an API key (requires the `read:invoices`
644
654
  * scope), same rules as `create`.
645
655
  */
646
656
  list(organizationId: string, params?: ListInvoicesParams): Promise<ListInvoicesResponse>;
657
+ /**
658
+ * Get a single CFDI 4.0 invoice by its folio fiscal (UUID). Works with
659
+ * either a Supabase bearer session or an API key (requires the
660
+ * `read:invoices` scope).
661
+ */
662
+ get(uuid: string): Promise<Invoice>;
663
+ /**
664
+ * Download the timbrado XML for an invoice. Works with either a
665
+ * Supabase bearer session or an API key (requires the `read:invoices`
666
+ * scope).
667
+ */
668
+ getXml(uuid: string): Promise<Blob>;
669
+ /**
670
+ * Download the PDF representation for an invoice. Works with either a
671
+ * Supabase bearer session or an API key (requires the `read:invoices`
672
+ * scope).
673
+ */
674
+ getPdf(uuid: string): Promise<Blob>;
647
675
  }
648
676
 
649
677
  declare class OAuthResource {
package/dist/index.js CHANGED
@@ -223,6 +223,20 @@ var InvoicesResource = class {
223
223
  async create(organizationId, data) {
224
224
  return this.http.post(`organizations/${organizationId}/invoices`, { json: data }).json();
225
225
  }
226
+ /**
227
+ * Generate a PDF preview of a CFDI 4.0 invoice without stamping
228
+ * (timbrar) it via the PAC. Nothing is persisted and no stamping quota
229
+ * is consumed. Accepts the same body shape as `create`. Works with
230
+ * either a Supabase bearer session (internal dashboard, the user must
231
+ * be a member of `organizationId`) or an API key (external
232
+ * integrations, requires the `write:invoices` scope — the key must
233
+ * belong to `organizationId`).
234
+ */
235
+ async previewPdf(organizationId, data) {
236
+ return this.http.post(`organizations/${organizationId}/invoices/preview/pdf`, {
237
+ json: data
238
+ }).blob();
239
+ }
226
240
  /**
227
241
  * List invoices for an organization, newest first. Works with either a
228
242
  * Supabase bearer session or an API key (requires the `read:invoices`
@@ -238,6 +252,30 @@ var InvoicesResource = class {
238
252
  searchParams: Object.keys(searchParams).length > 0 ? searchParams : void 0
239
253
  }).json();
240
254
  }
255
+ /**
256
+ * Get a single CFDI 4.0 invoice by its folio fiscal (UUID). Works with
257
+ * either a Supabase bearer session or an API key (requires the
258
+ * `read:invoices` scope).
259
+ */
260
+ async get(uuid) {
261
+ return this.http.get(`invoices/${uuid}`).json();
262
+ }
263
+ /**
264
+ * Download the timbrado XML for an invoice. Works with either a
265
+ * Supabase bearer session or an API key (requires the `read:invoices`
266
+ * scope).
267
+ */
268
+ async getXml(uuid) {
269
+ return this.http.get(`invoices/${uuid}/xml`).blob();
270
+ }
271
+ /**
272
+ * Download the PDF representation for an invoice. Works with either a
273
+ * Supabase bearer session or an API key (requires the `read:invoices`
274
+ * scope).
275
+ */
276
+ async getPdf(uuid) {
277
+ return this.http.get(`invoices/${uuid}/pdf`).blob();
278
+ }
241
279
  };
242
280
 
243
281
  // src/resources/oauth.ts
package/dist/index.mjs CHANGED
@@ -175,6 +175,20 @@ var InvoicesResource = class {
175
175
  async create(organizationId, data) {
176
176
  return this.http.post(`organizations/${organizationId}/invoices`, { json: data }).json();
177
177
  }
178
+ /**
179
+ * Generate a PDF preview of a CFDI 4.0 invoice without stamping
180
+ * (timbrar) it via the PAC. Nothing is persisted and no stamping quota
181
+ * is consumed. Accepts the same body shape as `create`. Works with
182
+ * either a Supabase bearer session (internal dashboard, the user must
183
+ * be a member of `organizationId`) or an API key (external
184
+ * integrations, requires the `write:invoices` scope — the key must
185
+ * belong to `organizationId`).
186
+ */
187
+ async previewPdf(organizationId, data) {
188
+ return this.http.post(`organizations/${organizationId}/invoices/preview/pdf`, {
189
+ json: data
190
+ }).blob();
191
+ }
178
192
  /**
179
193
  * List invoices for an organization, newest first. Works with either a
180
194
  * Supabase bearer session or an API key (requires the `read:invoices`
@@ -190,6 +204,30 @@ var InvoicesResource = class {
190
204
  searchParams: Object.keys(searchParams).length > 0 ? searchParams : void 0
191
205
  }).json();
192
206
  }
207
+ /**
208
+ * Get a single CFDI 4.0 invoice by its folio fiscal (UUID). Works with
209
+ * either a Supabase bearer session or an API key (requires the
210
+ * `read:invoices` scope).
211
+ */
212
+ async get(uuid) {
213
+ return this.http.get(`invoices/${uuid}`).json();
214
+ }
215
+ /**
216
+ * Download the timbrado XML for an invoice. Works with either a
217
+ * Supabase bearer session or an API key (requires the `read:invoices`
218
+ * scope).
219
+ */
220
+ async getXml(uuid) {
221
+ return this.http.get(`invoices/${uuid}/xml`).blob();
222
+ }
223
+ /**
224
+ * Download the PDF representation for an invoice. Works with either a
225
+ * Supabase bearer session or an API key (requires the `read:invoices`
226
+ * scope).
227
+ */
228
+ async getPdf(uuid) {
229
+ return this.http.get(`invoices/${uuid}/pdf`).blob();
230
+ }
193
231
  };
194
232
 
195
233
  // src/resources/oauth.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timbrix/sdk",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "TypeScript SDK for Timbrix API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",