@timbro/invoices 0.14.0-next.0 → 0.14.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.
Files changed (39) hide show
  1. package/README.md +25 -1
  2. package/dist/admin.d.ts +1 -1
  3. package/dist/admin.d.ts.map +1 -1
  4. package/dist/fiscal-engine-runtime.manifest.json +17 -12
  5. package/dist/fiscal-engine-runtime.provenance.json +18 -13
  6. package/dist/generated/hosted/types.gen.d.ts +40 -5
  7. package/dist/generated/hosted/types.gen.d.ts.map +1 -1
  8. package/dist/generated/hosted/zod-response.gen.d.ts +28 -14
  9. package/dist/generated/hosted/zod-response.gen.d.ts.map +1 -1
  10. package/dist/generated/hosted/zod-response.gen.js +90 -0
  11. package/dist/generated/hosted/zod.gen.d.ts +10 -5
  12. package/dist/generated/hosted/zod.gen.d.ts.map +1 -1
  13. package/dist/generated/hosted/zod.gen.js +90 -0
  14. package/dist/generated/index.d.ts +3 -3
  15. package/dist/generated/index.d.ts.map +1 -1
  16. package/dist/generated/index.js +2 -2
  17. package/dist/generated/invoice-api-contract.d.ts +241 -12
  18. package/dist/generated/invoice-api-contract.d.ts.map +1 -1
  19. package/dist/generated/invoice-api-contract.js +369 -12
  20. package/dist/generated/problem-catalog.d.ts.map +1 -1
  21. package/dist/generated/problem-catalog.js +13 -0
  22. package/dist/generated/sdk.gen.d.ts +4 -2
  23. package/dist/generated/sdk.gen.d.ts.map +1 -1
  24. package/dist/generated/sdk.gen.js +70 -2
  25. package/dist/generated/types.gen.d.ts +179 -9
  26. package/dist/generated/types.gen.d.ts.map +1 -1
  27. package/dist/generated/zod-response.gen.d.ts +588 -286
  28. package/dist/generated/zod-response.gen.d.ts.map +1 -1
  29. package/dist/generated/zod-response.gen.js +86 -4
  30. package/dist/generated/zod.gen.d.ts +15608 -597
  31. package/dist/generated/zod.gen.d.ts.map +1 -1
  32. package/dist/generated/zod.gen.js +312 -17
  33. package/dist/hosted-tenant.d.ts +12 -1
  34. package/dist/hosted-tenant.d.ts.map +1 -1
  35. package/dist/hosted-tenant.js +13 -1
  36. package/dist/problem-contract.d.ts +4 -0
  37. package/dist/problem-contract.d.ts.map +1 -1
  38. package/dist/timbro_fiscal_engine_bg.wasm +0 -0
  39. package/package.json +1 -1
@@ -3628,6 +3628,7 @@ export const zHostedImportResponse = z.strictObject({
3628
3628
  .string()
3629
3629
  .refine((text) => Array.from(text).length <= 256)
3630
3630
  .nullable(),
3631
+ environments: z.array(zHostedCertificateImportEnvironment),
3631
3632
  object: z.string(),
3632
3633
  signer_subject_serial_number: z.string(),
3633
3634
  });
@@ -3651,6 +3652,10 @@ export const zHostedReceiverUrls = z.strictObject({
3651
3652
  commercial_approval_url: z.string(),
3652
3653
  reception_url: z.string(),
3653
3654
  });
3655
+ /**
3656
+ * What the repair did to the binding's Source connection.
3657
+ */
3658
+ export const zHostedSourceConnectionRepairOutcome = z.enum(["reconnected", "already_connected"]);
3654
3659
  export const zHostedTenantResource = z.strictObject({
3655
3660
  hosted_tenant_binding_id: z.uuid(),
3656
3661
  legal_issuer_id: z.uuid(),
@@ -3921,6 +3926,10 @@ export const zInvoiceCreditNotePaymentTerms = z.union([
3921
3926
  type: z.enum(["free"]),
3922
3927
  }),
3923
3928
  ]);
3929
+ /**
3930
+ * A calendar date in the public API's ISO 8601 date form.
3931
+ */
3932
+ export const zInvoiceDate = z.iso.date().regex(/^(19|20)[0-9]{2}-[0-9]{2}-[0-9]{2}$/);
3924
3933
  export const zInvoiceDebitNoteModificationCode = z.enum(["2", "3"]);
3925
3934
  export const zInvoiceDeliveryAttachmentSelection = z.strictObject({
3926
3935
  pdf: z.boolean().optional(),
@@ -4004,6 +4013,30 @@ export const zInvoiceExportEligibility = z.union([
4004
4013
  exporterKind: z.enum(["free_zone_business"]),
4005
4014
  }),
4006
4015
  ]);
4016
+ /**
4017
+ * A document issued outside Timbro that a legal note modifies.
4018
+ *
4019
+ * `fiscalNumber` is the original e-NCF (`E`, the two type digits, and ten digits) or paper NCF
4020
+ * (`B` and ten digits, or `A` or `P` and eighteen digits). `issuerTaxId` is DGII's RNC Otro
4021
+ * Contribuyente and applies only when the original was issued under a different RNC than the
4022
+ * note, for example after a merger or split. `buyer` is the original's buyer and may be omitted
4023
+ * for an anonymous consumer document. `total` is the original's total and is required when the
4024
+ * original is an e-CF type 32, because DGII requires the buyer's identity on a note against a
4025
+ * type 32 of DOP 250,000.00 or more.
4026
+ */
4027
+ export const zInvoiceExternalOriginal = z.strictObject({
4028
+ buyer: zInvoiceConsumerBuyer.nullish(),
4029
+ fiscalNumber: z.string().regex(/^(B[0-9]{10}|E[0-9]{12}|[AP][0-9]{18})$/),
4030
+ issuedOn: zInvoiceDate,
4031
+ issuerTaxId: z
4032
+ .string()
4033
+ .regex(/^[0-9]{9}([0-9]{2})?$/)
4034
+ .nullish(),
4035
+ total: z
4036
+ .string()
4037
+ .regex(/^[0-9]{1,16}(\.[0-9]{1,2})?$/)
4038
+ .nullish(),
4039
+ });
4007
4040
  export const zInvoiceForeignCurrency = z.strictObject({
4008
4041
  currencyCode: z.enum([
4009
4042
  "BRL",
@@ -6550,6 +6583,9 @@ export const zPublicProblemCode = z.enum([
6550
6583
  "environment_not_active",
6551
6584
  "certificate_custody_binding_not_found",
6552
6585
  "certificate_custody_binding_conflict",
6586
+ "certificate_custody_environment_occupied",
6587
+ "certificate_custody_environment_revoked",
6588
+ "certificate_custody_environment_signer_mismatch",
6553
6589
  "certificate_custody_certificate_version_not_active",
6554
6590
  "source_connection_not_found",
6555
6591
  "source_connection_not_connected",
@@ -6580,6 +6616,7 @@ export const zPublicProblemCode = z.enum([
6580
6616
  "request_body_timeout",
6581
6617
  "malformed_json",
6582
6618
  "invalid_request",
6619
+ "invoice_original_invalid",
6583
6620
  "certification_environment_required",
6584
6621
  "certification_test_set_invalid",
6585
6622
  "invalid_collection_query",
@@ -6902,6 +6939,20 @@ export const zReleasedHostedTenant = z.strictObject({
6902
6939
  release_id: z.uuid(),
6903
6940
  state: z.string(),
6904
6941
  });
6942
+ export const zRepairHostedTenantSourceConnectionRequest = z.strictObject({
6943
+ checkout_tenant_id: z
6944
+ .string()
6945
+ .refine((text) => Array.from(text).length >= 1)
6946
+ .refine((text) => Array.from(text).length <= 128)
6947
+ .regex(/^[A-Za-z0-9._:-]{1,128}$/),
6948
+ environment: zFiscalEnvironment,
6949
+ });
6950
+ export const zRepairedHostedTenantSourceConnection = z.strictObject({
6951
+ environment: zFiscalEnvironment,
6952
+ hosted_tenant_binding_id: z.uuid(),
6953
+ outcome: zHostedSourceConnectionRepairOutcome,
6954
+ source_connection_id: z.uuid(),
6955
+ });
6905
6956
  export const zReplayEventIdsScope = z.strictObject({
6906
6957
  eventIds: z.array(z.uuid()).min(1).max(100),
6907
6958
  });
@@ -7416,6 +7467,52 @@ export const zSourceFiscalActionCommand = z.union([
7416
7467
  .refine((text) => Array.from(text).length <= 90)
7417
7468
  .regex(/^(?=.*[^\p{White_Space}])[\s\S]+$/u),
7418
7469
  }),
7470
+ z.strictObject({
7471
+ affected_document: z.strictObject({
7472
+ consumer_invoice_total: z
7473
+ .string()
7474
+ .regex(/^[0-9]{1,16}(\.[0-9]{1,2})?$/)
7475
+ .optional(),
7476
+ fiscal_number: z.string().regex(/^(B[0-9]{10}|E[0-9]{12}|[AP][0-9]{18})$/),
7477
+ issued_on: z
7478
+ .string()
7479
+ .regex(/^(?:(?:31-(?:0?[13578]|1[02])|(?:29|30)-(?:0?[13-9]|1[0-2])|(?:0?[1-9]|1[0-9]|2[0-8])-(?:0?[1-9]|1[0-2]))-(?:19|20)[0-9]{2}|29-0?2-(?:(?:19|20)(?:0[48]|[2468][048]|[13579][26])|2000))$/),
7480
+ issuer_tax_id: z
7481
+ .string()
7482
+ .regex(/^[0-9]{9}([0-9]{2})?$/)
7483
+ .optional(),
7484
+ }),
7485
+ correction: zSourceCreditNoteCorrection,
7486
+ kind: z.enum(["credit_note_of_external_document"]),
7487
+ reason: z
7488
+ .string()
7489
+ .refine((text) => Array.from(text).length >= 1)
7490
+ .refine((text) => Array.from(text).length <= 90)
7491
+ .regex(/^(?=.*[^\p{White_Space}])[\s\S]+$/u),
7492
+ }),
7493
+ z.strictObject({
7494
+ affected_document: z.strictObject({
7495
+ consumer_invoice_total: z
7496
+ .string()
7497
+ .regex(/^[0-9]{1,16}(\.[0-9]{1,2})?$/)
7498
+ .optional(),
7499
+ fiscal_number: z.string().regex(/^(B[0-9]{10}|E[0-9]{12}|[AP][0-9]{18})$/),
7500
+ issued_on: z
7501
+ .string()
7502
+ .regex(/^(?:(?:31-(?:0?[13578]|1[02])|(?:29|30)-(?:0?[13-9]|1[0-2])|(?:0?[1-9]|1[0-9]|2[0-8])-(?:0?[1-9]|1[0-2]))-(?:19|20)[0-9]{2}|29-0?2-(?:(?:19|20)(?:0[48]|[2468][048]|[13579][26])|2000))$/),
7503
+ issuer_tax_id: z
7504
+ .string()
7505
+ .regex(/^[0-9]{9}([0-9]{2})?$/)
7506
+ .optional(),
7507
+ }),
7508
+ correction: zSourceDebitNoteCorrection,
7509
+ kind: z.enum(["debit_note_of_external_document"]),
7510
+ reason: z
7511
+ .string()
7512
+ .refine((text) => Array.from(text).length >= 1)
7513
+ .refine((text) => Array.from(text).length <= 90)
7514
+ .regex(/^(?=.*[^\p{White_Space}])[\s\S]+$/u),
7515
+ }),
7419
7516
  ]);
7420
7517
  export const zSourceFiscalOperationPage = z.strictObject({
7421
7518
  data: z.array(zFiscalOperationResource),
@@ -7460,24 +7557,74 @@ export const zSourceGovernmentEligibility = z.union([
7460
7557
  * Whether a Source line describes a good or a service.
7461
7558
  */
7462
7559
  export const zSourceItemKind = z.enum(["good", "service"]);
7463
- export const zInvoiceItemResource = z.strictObject({
7464
- additionalTaxCodes: z.array(z.string()),
7465
- adjustments: zInvoiceLinePriceAdjustmentsResource.nullable(),
7466
- description: z.string(),
7467
- id: z.string(),
7468
- itemCodes: z.array(zInvoiceItemCodeResource),
7469
- kind: zSourceItemKind,
7470
- legalTip: z.boolean(),
7471
- quantity: z.string().regex(/^(?=[0-9.]*[1-9])[0-9]{1,16}(\.[0-9]{1,2})?$/),
7472
- tax: zInvoiceTax,
7473
- unit: z.string(),
7474
- unitPrice: z.string().regex(/^[0-9]{1,16}(\.[0-9]{1,4})?$/),
7475
- withholding: zInvoiceItemWithholding.nullable(),
7476
- });
7477
7560
  /**
7478
- * Common semantic measurement units mapped to official DGII catalog codes by fiscal-document.
7561
+ * A DGII e-CF unit of measure: a readable lowercase name on the Source and Invoice wire,
7562
+ * the official numeric catalog code in fiscal documents.
7479
7563
  */
7480
- export const zSourceMeasurementUnit = z.enum(["unit", "kilogram", "litre", "metre", "piece"]);
7564
+ export const zSourceMeasurementUnit = z.enum([
7565
+ "barrel",
7566
+ "bag",
7567
+ "jar",
7568
+ "bundle",
7569
+ "bottle",
7570
+ "box",
7571
+ "cigarette_pack",
7572
+ "centimetre",
7573
+ "cylinder",
7574
+ "set",
7575
+ "container",
7576
+ "day",
7577
+ "dozen",
7578
+ "bale",
7579
+ "gallon",
7580
+ "degree",
7581
+ "gram",
7582
+ "bulk",
7583
+ "hour",
7584
+ "crate",
7585
+ "kilogram",
7586
+ "kilowatt_hour",
7587
+ "pound",
7588
+ "litre",
7589
+ "lot",
7590
+ "metre",
7591
+ "square_metre",
7592
+ "cubic_metre",
7593
+ "million_btu",
7594
+ "minute",
7595
+ "package",
7596
+ "pair",
7597
+ "foot",
7598
+ "piece",
7599
+ "roll",
7600
+ "envelope",
7601
+ "second",
7602
+ "tank",
7603
+ "ton",
7604
+ "tube",
7605
+ "yard",
7606
+ "square_yard",
7607
+ "unit",
7608
+ "element",
7609
+ "thousand",
7610
+ "sack",
7611
+ "tin",
7612
+ "display",
7613
+ "drum",
7614
+ "ration",
7615
+ "quintal",
7616
+ "gross_register_tonnage",
7617
+ "square_foot",
7618
+ "passenger",
7619
+ "inch",
7620
+ "boat_berth_stay",
7621
+ "tray",
7622
+ "hectare",
7623
+ "millilitre",
7624
+ "milligram",
7625
+ "ounce",
7626
+ "troy_ounce",
7627
+ ]);
7481
7628
  export const zInvoiceExportItem = z.strictObject({
7482
7629
  adjustments: zLinePriceAdjustments.nullish(),
7483
7630
  description: z
@@ -7557,6 +7704,20 @@ export const zInvoiceItem = z.strictObject({
7557
7704
  unit: zSourceMeasurementUnit,
7558
7705
  unitPrice: z.string().regex(/^[0-9]{1,16}(\.[0-9]{1,4})?$/),
7559
7706
  });
7707
+ export const zInvoiceItemResource = z.strictObject({
7708
+ additionalTaxCodes: z.array(z.string()),
7709
+ adjustments: zInvoiceLinePriceAdjustmentsResource.nullable(),
7710
+ description: z.string(),
7711
+ id: z.string(),
7712
+ itemCodes: z.array(zInvoiceItemCodeResource),
7713
+ kind: zSourceItemKind,
7714
+ legalTip: z.boolean(),
7715
+ quantity: z.string().regex(/^(?=[0-9.]*[1-9])[0-9]{1,16}(\.[0-9]{1,2})?$/),
7716
+ tax: zInvoiceTax,
7717
+ unit: zSourceMeasurementUnit,
7718
+ unitPrice: z.string().regex(/^[0-9]{1,16}(\.[0-9]{1,4})?$/),
7719
+ withholding: zInvoiceItemWithholding.nullable(),
7720
+ });
7560
7721
  export const zInvoiceMinorExpenseItem = z.strictObject({
7561
7722
  description: z
7562
7723
  .string()
@@ -10356,6 +10517,39 @@ export const zInvoiceRequest = z.union([
10356
10517
  source: zInvoiceSourceInput.nullish(),
10357
10518
  type: z.enum(["E33"]),
10358
10519
  }),
10520
+ z.strictObject({
10521
+ additionalInformation: zInvoiceAdditionalInformation.nullish(),
10522
+ currency: z.enum(["DOP"]),
10523
+ expectedTotals: zInvoiceExpectedTotals.nullish(),
10524
+ externalOriginal: zInvoiceExternalOriginal,
10525
+ incomeType: z
10526
+ .union([
10527
+ z.literal("01"),
10528
+ z.literal("02"),
10529
+ z.literal("03"),
10530
+ z.literal("04"),
10531
+ z.literal("05"),
10532
+ z.literal("06"),
10533
+ ])
10534
+ .nullish(),
10535
+ invoiceReference: z
10536
+ .string()
10537
+ .refine((text) => Array.from(text).length >= 1)
10538
+ .refine((text) => Array.from(text).length <= 128)
10539
+ .regex(/^[^\p{White_Space}](?:[\s\S]*[^\p{White_Space}])?$/u),
10540
+ items: z.array(zInvoiceItem).min(1).max(1000),
10541
+ modificationCode: zInvoiceDebitNoteModificationCode,
10542
+ numbering: zInvoiceNumbering.nullish(),
10543
+ paymentTerms: zInvoicePaymentTerms,
10544
+ pdfLayout: zInvoicePdfLayout.nullish(),
10545
+ reason: z
10546
+ .string()
10547
+ .refine((text) => Array.from(text).length >= 1)
10548
+ .refine((text) => Array.from(text).length <= 90)
10549
+ .regex(/^[^\p{White_Space}](?:[\s\S]*[^\p{White_Space}])?$/u),
10550
+ source: zInvoiceSourceInput.nullish(),
10551
+ type: z.enum(["E33"]),
10552
+ }),
10359
10553
  z.strictObject({
10360
10554
  additionalInformation: zInvoiceAdditionalInformation.nullish(),
10361
10555
  currency: z.enum(["DOP"]),
@@ -10389,6 +10583,39 @@ export const zInvoiceRequest = z.union([
10389
10583
  source: zInvoiceSourceInput.nullish(),
10390
10584
  type: z.enum(["E34"]),
10391
10585
  }),
10586
+ z.strictObject({
10587
+ additionalInformation: zInvoiceAdditionalInformation.nullish(),
10588
+ currency: z.enum(["DOP"]),
10589
+ expectedTotals: zInvoiceExpectedTotals.nullish(),
10590
+ externalOriginal: zInvoiceExternalOriginal,
10591
+ incomeType: z
10592
+ .union([
10593
+ z.literal("01"),
10594
+ z.literal("02"),
10595
+ z.literal("03"),
10596
+ z.literal("04"),
10597
+ z.literal("05"),
10598
+ z.literal("06"),
10599
+ ])
10600
+ .nullish(),
10601
+ invoiceReference: z
10602
+ .string()
10603
+ .refine((text) => Array.from(text).length >= 1)
10604
+ .refine((text) => Array.from(text).length <= 128)
10605
+ .regex(/^[^\p{White_Space}](?:[\s\S]*[^\p{White_Space}])?$/u),
10606
+ items: z.array(zInvoiceItem).min(1).max(10000),
10607
+ modificationCode: zInvoiceCreditNoteModificationCode,
10608
+ numbering: zInvoiceNumbering.nullish(),
10609
+ paymentTerms: zInvoiceCreditNotePaymentTerms,
10610
+ pdfLayout: zInvoicePdfLayout.nullish(),
10611
+ reason: z
10612
+ .string()
10613
+ .refine((text) => Array.from(text).length >= 1)
10614
+ .refine((text) => Array.from(text).length <= 90)
10615
+ .regex(/^[^\p{White_Space}](?:[\s\S]*[^\p{White_Space}])?$/u),
10616
+ source: zInvoiceSourceInput.nullish(),
10617
+ type: z.enum(["E34"]),
10618
+ }),
10392
10619
  ]);
10393
10620
  export const zHostedInvoiceReplacementSubmission = z.strictObject({
10394
10621
  checkout_tenant_id: z.string(),
@@ -10782,7 +11009,70 @@ export const zSourceSalesLine = z.strictObject({
10782
11009
  .regex(/^[^\p{White_Space}](?:[\s\S]*[^\p{White_Space}])?$/u),
10783
11010
  item_codes: z.array(zFiscalItemCode).min(0).max(5).optional(),
10784
11011
  item_kind: zSourceItemKind,
10785
- measurement_unit: z.enum(["unit", "kilogram", "litre", "metre", "piece"]),
11012
+ measurement_unit: z.enum([
11013
+ "barrel",
11014
+ "bag",
11015
+ "jar",
11016
+ "bundle",
11017
+ "bottle",
11018
+ "box",
11019
+ "cigarette_pack",
11020
+ "centimetre",
11021
+ "cylinder",
11022
+ "set",
11023
+ "container",
11024
+ "day",
11025
+ "dozen",
11026
+ "bale",
11027
+ "gallon",
11028
+ "degree",
11029
+ "gram",
11030
+ "bulk",
11031
+ "hour",
11032
+ "crate",
11033
+ "kilogram",
11034
+ "kilowatt_hour",
11035
+ "pound",
11036
+ "litre",
11037
+ "lot",
11038
+ "metre",
11039
+ "square_metre",
11040
+ "cubic_metre",
11041
+ "million_btu",
11042
+ "minute",
11043
+ "package",
11044
+ "pair",
11045
+ "foot",
11046
+ "piece",
11047
+ "roll",
11048
+ "envelope",
11049
+ "second",
11050
+ "tank",
11051
+ "ton",
11052
+ "tube",
11053
+ "yard",
11054
+ "square_yard",
11055
+ "unit",
11056
+ "element",
11057
+ "thousand",
11058
+ "sack",
11059
+ "tin",
11060
+ "display",
11061
+ "drum",
11062
+ "ration",
11063
+ "quintal",
11064
+ "gross_register_tonnage",
11065
+ "square_foot",
11066
+ "passenger",
11067
+ "inch",
11068
+ "boat_berth_stay",
11069
+ "tray",
11070
+ "hectare",
11071
+ "millilitre",
11072
+ "milligram",
11073
+ "ounce",
11074
+ "troy_ounce",
11075
+ ]),
10786
11076
  quantity: z.string().regex(/^(?=[0-9.]*[1-9])[0-9]{1,16}(\.[0-9]{1,2})?$/),
10787
11077
  source_line_id: z
10788
11078
  .string()
@@ -30312,6 +30602,11 @@ export const zReleaseHostedTenantHeaders = z.object({
30312
30602
  * The binding is released. Replays return the same non-sensitive terminal result.
30313
30603
  */
30314
30604
  export const zReleaseHostedTenantResponse = zReleasedHostedTenant;
30605
+ export const zRepairHostedTenantSourceConnectionBody = zRepairHostedTenantSourceConnectionRequest;
30606
+ /**
30607
+ * The binding's Source connection is connected. A repeat on a connected Source connection answers `already_connected` and changes nothing.
30608
+ */
30609
+ export const zRepairHostedTenantSourceConnectionResponse = zRepairedHostedTenantSourceConnection;
30315
30610
  export const zCreateHostedTenantWebhookSecretRotationHeaders = z.object({
30316
30611
  "Idempotency-Key": z
30317
30612
  .string()
@@ -1,5 +1,5 @@
1
1
  import { type CertificateCustodyImportResult } from "./certificate-custody-import.ts";
2
- import { type CreateHostedTenantRequest, type HostedWebhookSecretRotation as GeneratedHostedWebhookSecretRotation, type ReleasedHostedTenant as GeneratedReleasedHostedTenant, type HostedTenantResource } from "./generated/index.ts";
2
+ import { type CreateHostedTenantRequest, type HostedWebhookSecretRotation as GeneratedHostedWebhookSecretRotation, type ReleasedHostedTenant as GeneratedReleasedHostedTenant, type RepairedHostedTenantSourceConnection as GeneratedRepairedHostedTenantSourceConnection, type HostedTenantResource } from "./generated/index.ts";
3
3
  import { type ReadonlyCamelCase } from "./public-case.ts";
4
4
  import { type StampServerBearerTokenProvider } from "./stamp-server-http-transport.ts";
5
5
  export type HostedTenantEnvironment = CreateHostedTenantRequest["environment"];
@@ -21,6 +21,11 @@ export type HostedTenantWebhookSecretRotationCommand = {
21
21
  readonly idempotencyKey?: string;
22
22
  readonly signal?: AbortSignal;
23
23
  };
24
+ export type HostedTenantSourceConnectionRepairCommand = {
25
+ readonly checkoutTenantId: string;
26
+ readonly environment: HostedTenantEnvironment;
27
+ readonly signal?: AbortSignal;
28
+ };
24
29
  export type HostedTenantReleaseCommand = {
25
30
  readonly checkoutTenantId: string;
26
31
  readonly hostedTenantBindingId: string;
@@ -31,6 +36,7 @@ export type HostedTenantReleaseCommand = {
31
36
  export type HostedTenant = ReadonlyCamelCase<HostedTenantResource>;
32
37
  export type HostedTenantRelease = ReadonlyCamelCase<GeneratedReleasedHostedTenant>;
33
38
  export type HostedWebhookSecretRotation = ReadonlyCamelCase<GeneratedHostedWebhookSecretRotation>;
39
+ export type HostedTenantSourceConnectionRepair = ReadonlyCamelCase<GeneratedRepairedHostedTenantSourceConnection>;
34
40
  export type HostedTenantClientOptions = {
35
41
  readonly baseUrl: string;
36
42
  readonly bearerToken: string | StampServerBearerTokenProvider;
@@ -40,6 +46,11 @@ export type HostedTenantClient = {
40
46
  readonly create: (command: HostedTenantCreateCommand) => Promise<HostedTenant>;
41
47
  readonly importCertificate: (command: HostedTenantCertificateImportCommand) => Promise<CertificateCustodyImportResult>;
42
48
  readonly release: (command: HostedTenantReleaseCommand) => Promise<HostedTenantRelease>;
49
+ /**
50
+ * Reconnects the binding's Source connection when it is not connected. A repeat on a connected
51
+ * Source connection changes nothing, so it is safe to retry.
52
+ */
53
+ readonly repairSourceConnection: (command: HostedTenantSourceConnectionRepairCommand) => Promise<HostedTenantSourceConnectionRepair>;
43
54
  readonly rotateWebhookSecret: (command: HostedTenantWebhookSecretRotationCommand) => Promise<HostedWebhookSecretRotation>;
44
55
  };
45
56
  /** Creates the owner-authenticated client for hosted Checkout tenant bindings. */
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-tenant.d.ts","sourceRoot":"","sources":["../src/hosted-tenant.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,8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,EAAE,CAC5B,OAAO,EAAE,wCAAwC,KAC9C,OAAO,CAAC,2BAA2B,CAAC,CAAC;CAC3C,CAAC;AAEF,kFAAkF;AAClF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,kBAAkB,CA0B/F"}
@@ -1,5 +1,5 @@
1
1
  import { importHostedCertificateCustodyResource, } from "./certificate-custody-import.js";
2
- import { createHostedTenant, createHostedTenantWebhookSecretRotation, releaseHostedTenant, } from "./generated/index.js";
2
+ import { createHostedTenant, createHostedTenantWebhookSecretRotation, releaseHostedTenant, repairHostedTenantSourceConnection, } from "./generated/index.js";
3
3
  import { createGeneratedOperationClient } from "./generated-operation-client.js";
4
4
  import { throwGeneratedProblem } from "./generated-problem.js";
5
5
  import { toPublicCase } from "./public-case.js";
@@ -23,6 +23,7 @@ export function createHostedTenantClient(options) {
23
23
  ...(command.signal === undefined ? {} : { signal: command.signal }),
24
24
  }),
25
25
  release: (command) => releaseHostedTenantBinding(client, command),
26
+ repairSourceConnection: (command) => repairHostedTenantBindingSourceConnection(client, command),
26
27
  rotateWebhookSecret: (command) => rotateHostedTenantWebhookSecret(client, command),
27
28
  };
28
29
  }
@@ -58,6 +59,17 @@ async function releaseHostedTenantBinding(client, command) {
58
59
  }
59
60
  return toPublicCase(response.body);
60
61
  }
62
+ async function repairHostedTenantBindingSourceConnection(client, command) {
63
+ const response = await repairHostedTenantSourceConnection({
64
+ client,
65
+ body: { checkout_tenant_id: command.checkoutTenantId, environment: command.environment },
66
+ ...(command.signal === undefined ? {} : { signal: command.signal }),
67
+ });
68
+ if (response.status !== 200) {
69
+ throwGeneratedProblem(response, "Hosted tenant Source connection repair failed");
70
+ }
71
+ return toPublicCase(response.body);
72
+ }
61
73
  async function rotateHostedTenantWebhookSecret(client, command) {
62
74
  const response = await createHostedTenantWebhookSecretRotation({
63
75
  client,
@@ -55,6 +55,9 @@ export declare const problemCodeSchema: z.ZodEnum<{
55
55
  certificate_custody_binding_conflict: "certificate_custody_binding_conflict";
56
56
  certificate_custody_binding_not_found: "certificate_custody_binding_not_found";
57
57
  certificate_custody_certificate_version_not_active: "certificate_custody_certificate_version_not_active";
58
+ certificate_custody_environment_occupied: "certificate_custody_environment_occupied";
59
+ certificate_custody_environment_revoked: "certificate_custody_environment_revoked";
60
+ certificate_custody_environment_signer_mismatch: "certificate_custody_environment_signer_mismatch";
58
61
  certificate_p12_password_invalid: "certificate_p12_password_invalid";
59
62
  certification_environment_required: "certification_environment_required";
60
63
  certification_test_set_invalid: "certification_test_set_invalid";
@@ -103,6 +106,7 @@ export declare const problemCodeSchema: z.ZodEnum<{
103
106
  invitation_expired: "invitation_expired";
104
107
  invitation_invalid: "invitation_invalid";
105
108
  invoice_not_found: "invoice_not_found";
109
+ invoice_original_invalid: "invoice_original_invalid";
106
110
  invoice_receipt_not_found: "invoice_receipt_not_found";
107
111
  invoice_receipt_not_ready: "invoice_receipt_not_ready";
108
112
  invoice_receipt_unavailable: "invoice_receipt_unavailable";
@@ -1 +1 @@
1
- {"version":3,"file":"problem-contract.d.ts","sourceRoot":"","sources":["../src/problem-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EACV,sBAAsB,EACtB,WAAW,EACX,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG,YAAY,GAAG,WAAW,GAAG,mBAAmB,CAAC;AACjG,MAAM,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAC5C,MAAM,MAAM,YAAY,GAAG,sBAAsB,GAAG,YAAY,CAAC;AACjE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,M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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAe,CAAC;AAC9C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAqB,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,wBAAgB,aAAa,CAAC,SAAS,EAAE,OAAO,GAAG,SAAS,IAAI,iBAAiB,CAEhF;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAiB1E;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timbro/invoices",
3
- "version": "0.14.0-next.0",
3
+ "version": "0.14.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "private": false,
6
6
  "type": "module",