@scell/sdk 1.2.0 → 1.5.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 (46) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +61 -2
  3. package/dist/index.d.mts +2353 -236
  4. package/dist/index.d.ts +2353 -236
  5. package/dist/index.js +1308 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +1308 -2
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/src/client.ts +3 -1
  11. package/src/errors.ts +0 -0
  12. package/src/index.ts +42 -2
  13. package/src/resources/api-keys.ts +0 -0
  14. package/src/resources/auth.ts +0 -0
  15. package/src/resources/balance.ts +0 -0
  16. package/src/resources/billing.ts +49 -0
  17. package/src/resources/companies.ts +0 -0
  18. package/src/resources/fiscal.ts +128 -0
  19. package/src/resources/invoices.ts +0 -0
  20. package/src/resources/signatures.ts +33 -0
  21. package/src/resources/stats.ts +29 -0
  22. package/src/resources/sub-tenants.ts +41 -0
  23. package/src/resources/tenant-credit-notes.ts +301 -0
  24. package/src/resources/tenant-direct-credit-notes.ts +360 -0
  25. package/src/resources/tenant-direct-invoices.ts +424 -0
  26. package/src/resources/tenant-incoming-invoices.ts +429 -0
  27. package/src/resources/webhooks.ts +0 -0
  28. package/src/tenant-client.ts +105 -0
  29. package/src/types/api-keys.ts +0 -0
  30. package/src/types/auth.ts +0 -0
  31. package/src/types/balance.ts +0 -0
  32. package/src/types/billing.ts +73 -0
  33. package/src/types/common.ts +0 -0
  34. package/src/types/companies.ts +0 -0
  35. package/src/types/fiscal.ts +251 -0
  36. package/src/types/index.ts +103 -0
  37. package/src/types/invoices.ts +0 -0
  38. package/src/types/signatures.ts +0 -0
  39. package/src/types/stats.ts +37 -0
  40. package/src/types/sub-tenants.ts +57 -0
  41. package/src/types/tenant-credit-notes.ts +128 -0
  42. package/src/types/tenant-invoices.ts +390 -0
  43. package/src/types/tenant-profile.ts +51 -0
  44. package/src/types/webhooks.ts +0 -0
  45. package/src/utils/retry.ts +0 -0
  46. package/src/utils/webhook-verify.ts +0 -0
package/dist/index.mjs CHANGED
@@ -275,6 +275,8 @@ var HttpClient = class {
275
275
  };
276
276
  if (this.authMode === "bearer") {
277
277
  headers["Authorization"] = `Bearer ${this.authToken}`;
278
+ } else if (this.authMode === "tenant-key") {
279
+ headers["X-Tenant-Key"] = this.authToken;
278
280
  } else {
279
281
  headers["X-API-Key"] = this.authToken;
280
282
  }
@@ -457,6 +459,1261 @@ var HttpClient = class {
457
459
  }
458
460
  };
459
461
 
462
+ // src/resources/tenant-direct-invoices.ts
463
+ var TenantDirectInvoicesResource = class {
464
+ constructor(http) {
465
+ this.http = http;
466
+ }
467
+ /**
468
+ * Create a new direct invoice
469
+ *
470
+ * Creates an outgoing invoice from the tenant to an external buyer.
471
+ * The invoice will be generated in the specified format (Factur-X by default).
472
+ *
473
+ * @param params - Invoice creation parameters
474
+ * @param requestOptions - Optional request configuration
475
+ * @returns Created invoice
476
+ *
477
+ * @example
478
+ * ```typescript
479
+ * const { data: invoice } = await client.directInvoices.create({
480
+ * company_id: 'company-uuid',
481
+ * buyer: {
482
+ * company_name: 'Acme Corporation',
483
+ * siret: '98765432109876',
484
+ * address: {
485
+ * line1: '456 Avenue Business',
486
+ * postal_code: '69001',
487
+ * city: 'Lyon',
488
+ * country: 'FR'
489
+ * },
490
+ * email: 'accounts@acme.com'
491
+ * },
492
+ * lines: [{
493
+ * description: 'Monthly subscription',
494
+ * quantity: 1,
495
+ * unit_price: 299,
496
+ * tax_rate: 20,
497
+ * total_ht: 299,
498
+ * total_tax: 59.80,
499
+ * total_ttc: 358.80
500
+ * }],
501
+ * issue_date: '2026-01-26',
502
+ * due_date: '2026-02-26',
503
+ * notes: 'Thank you for your business!'
504
+ * });
505
+ *
506
+ * console.log('Invoice created:', invoice.invoice_number);
507
+ * ```
508
+ */
509
+ async create(params, requestOptions) {
510
+ return this.http.post(
511
+ "/tenant/invoices",
512
+ params,
513
+ requestOptions
514
+ );
515
+ }
516
+ /**
517
+ * List all direct invoices
518
+ *
519
+ * Returns a paginated list of direct invoices created by the tenant.
520
+ * Supports filtering by status, date range, buyer, and amount.
521
+ *
522
+ * @param filters - Filter and pagination options
523
+ * @param requestOptions - Optional request configuration
524
+ * @returns Paginated list of invoices
525
+ *
526
+ * @example
527
+ * ```typescript
528
+ * // List all validated invoices
529
+ * const { data: invoices, meta } = await client.directInvoices.list({
530
+ * status: 'validated',
531
+ * per_page: 50
532
+ * });
533
+ *
534
+ * console.log(`Found ${meta.total} validated invoices`);
535
+ *
536
+ * // Filter by date range
537
+ * const januaryInvoices = await client.directInvoices.list({
538
+ * date_from: '2026-01-01',
539
+ * date_to: '2026-01-31'
540
+ * });
541
+ *
542
+ * // Search by buyer
543
+ * const acmeInvoices = await client.directInvoices.list({
544
+ * search: 'Acme'
545
+ * });
546
+ * ```
547
+ */
548
+ async list(filters = {}, requestOptions) {
549
+ const query = {
550
+ ...filters,
551
+ status: Array.isArray(filters.status) ? filters.status.join(",") : filters.status
552
+ };
553
+ return this.http.get(
554
+ "/tenant/invoices",
555
+ query,
556
+ requestOptions
557
+ );
558
+ }
559
+ /**
560
+ * Get a specific direct invoice by ID
561
+ *
562
+ * @param invoiceId - Invoice UUID
563
+ * @param requestOptions - Optional request configuration
564
+ * @returns Invoice details
565
+ *
566
+ * @example
567
+ * ```typescript
568
+ * const { data: invoice } = await client.directInvoices.get('invoice-uuid');
569
+ *
570
+ * console.log('Invoice:', invoice.invoice_number);
571
+ * console.log('Status:', invoice.status);
572
+ * console.log('Total:', invoice.total_ttc, invoice.currency);
573
+ * ```
574
+ */
575
+ async get(invoiceId, requestOptions) {
576
+ return this.http.get(
577
+ `/tenant/invoices/${invoiceId}`,
578
+ void 0,
579
+ requestOptions
580
+ );
581
+ }
582
+ /**
583
+ * Update a direct invoice
584
+ *
585
+ * Only invoices in 'draft' status can be updated.
586
+ * Once validated or sent, invoices become immutable.
587
+ *
588
+ * @param invoiceId - Invoice UUID
589
+ * @param params - Update parameters
590
+ * @param requestOptions - Optional request configuration
591
+ * @returns Updated invoice
592
+ *
593
+ * @example
594
+ * ```typescript
595
+ * const { data: invoice } = await client.directInvoices.update(
596
+ * 'invoice-uuid',
597
+ * {
598
+ * due_date: '2026-03-15',
599
+ * notes: 'Updated payment terms'
600
+ * }
601
+ * );
602
+ *
603
+ * console.log('Invoice updated:', invoice.due_date);
604
+ * ```
605
+ */
606
+ async update(invoiceId, params, requestOptions) {
607
+ return this.http.patch(
608
+ `/tenant/invoices/${invoiceId}`,
609
+ params,
610
+ requestOptions
611
+ );
612
+ }
613
+ /**
614
+ * Delete a direct invoice
615
+ *
616
+ * Only invoices in 'draft' status can be deleted.
617
+ * Validated or sent invoices cannot be deleted for audit trail compliance.
618
+ *
619
+ * @param invoiceId - Invoice UUID
620
+ * @param requestOptions - Optional request configuration
621
+ *
622
+ * @example
623
+ * ```typescript
624
+ * await client.directInvoices.delete('draft-invoice-uuid');
625
+ * console.log('Invoice deleted successfully');
626
+ * ```
627
+ */
628
+ async delete(invoiceId, requestOptions) {
629
+ return this.http.delete(
630
+ `/tenant/invoices/${invoiceId}`,
631
+ requestOptions
632
+ );
633
+ }
634
+ /**
635
+ * Validate a direct invoice
636
+ *
637
+ * Validates the invoice, generates the electronic invoice file,
638
+ * and changes status from 'draft' to 'validated'.
639
+ *
640
+ * @param invoiceId - Invoice UUID
641
+ * @param requestOptions - Optional request configuration
642
+ * @returns Validated invoice
643
+ *
644
+ * @example
645
+ * ```typescript
646
+ * const { data: invoice } = await client.directInvoices.validate('invoice-uuid');
647
+ * console.log('Invoice validated:', invoice.status); // 'validated'
648
+ * console.log('Validated at:', invoice.validated_at);
649
+ * ```
650
+ */
651
+ async validate(invoiceId, requestOptions) {
652
+ return this.http.post(
653
+ `/tenant/invoices/${invoiceId}/validate`,
654
+ void 0,
655
+ requestOptions
656
+ );
657
+ }
658
+ /**
659
+ * Send a direct invoice to the buyer
660
+ *
661
+ * Sends the validated invoice to the buyer via email.
662
+ * The invoice must be in 'validated' status.
663
+ *
664
+ * @param invoiceId - Invoice UUID
665
+ * @param requestOptions - Optional request configuration
666
+ * @returns Updated invoice
667
+ *
668
+ * @example
669
+ * ```typescript
670
+ * const { data: invoice } = await client.directInvoices.send('invoice-uuid');
671
+ * console.log('Invoice sent to:', invoice.buyer.email);
672
+ * ```
673
+ */
674
+ async send(invoiceId, requestOptions) {
675
+ return this.http.post(
676
+ `/tenant/invoices/${invoiceId}/send`,
677
+ void 0,
678
+ requestOptions
679
+ );
680
+ }
681
+ /**
682
+ * Download invoice as PDF
683
+ *
684
+ * Downloads the electronic invoice file as a PDF (Factur-X).
685
+ *
686
+ * @param invoiceId - Invoice UUID
687
+ * @param requestOptions - Optional request configuration
688
+ * @returns ArrayBuffer containing the PDF file
689
+ *
690
+ * @example
691
+ * ```typescript
692
+ * // Download invoice PDF
693
+ * const pdfBuffer = await client.directInvoices.download('invoice-uuid');
694
+ *
695
+ * // In Node.js, save to file:
696
+ * import { writeFileSync } from 'fs';
697
+ * writeFileSync('invoice.pdf', Buffer.from(pdfBuffer));
698
+ *
699
+ * // In browser, trigger download:
700
+ * const blob = new Blob([pdfBuffer], { type: 'application/pdf' });
701
+ * const url = URL.createObjectURL(blob);
702
+ * const a = document.createElement('a');
703
+ * a.href = url;
704
+ * a.download = 'invoice.pdf';
705
+ * a.click();
706
+ * ```
707
+ */
708
+ async download(invoiceId, requestOptions) {
709
+ return this.http.getRaw(
710
+ `/tenant/invoices/${invoiceId}/download`,
711
+ void 0,
712
+ requestOptions
713
+ );
714
+ }
715
+ /**
716
+ * Download invoice XML
717
+ *
718
+ * Downloads the electronic invoice XML (UBL/CII format).
719
+ *
720
+ * @param invoiceId - Invoice UUID
721
+ * @param requestOptions - Optional request configuration
722
+ * @returns ArrayBuffer containing the XML file
723
+ *
724
+ * @example
725
+ * ```typescript
726
+ * const xmlBuffer = await client.directInvoices.downloadXml('invoice-uuid');
727
+ * const xmlString = new TextDecoder().decode(xmlBuffer);
728
+ * console.log('XML:', xmlString);
729
+ * ```
730
+ */
731
+ async downloadXml(invoiceId, requestOptions) {
732
+ return this.http.getRaw(
733
+ `/tenant/invoices/${invoiceId}/download`,
734
+ { format: "xml" },
735
+ requestOptions
736
+ );
737
+ }
738
+ /**
739
+ * Bulk create multiple invoices
740
+ */
741
+ async bulkCreate(invoices, requestOptions) {
742
+ return this.http.post(
743
+ "/tenant/invoices/bulk",
744
+ { invoices },
745
+ requestOptions
746
+ );
747
+ }
748
+ /**
749
+ * Bulk submit multiple invoices
750
+ */
751
+ async bulkSubmit(invoiceIds, requestOptions) {
752
+ return this.http.post(
753
+ "/tenant/invoices/bulk-submit",
754
+ { invoice_ids: invoiceIds },
755
+ requestOptions
756
+ );
757
+ }
758
+ /**
759
+ * Get status of multiple invoices
760
+ */
761
+ async bulkStatus(invoiceIds, requestOptions) {
762
+ return this.http.post(
763
+ "/tenant/invoices/bulk-status",
764
+ { invoice_ids: invoiceIds },
765
+ requestOptions
766
+ );
767
+ }
768
+ };
769
+
770
+ // src/resources/tenant-direct-credit-notes.ts
771
+ var TenantDirectCreditNotesResource = class {
772
+ constructor(http) {
773
+ this.http = http;
774
+ }
775
+ /**
776
+ * Create a new credit note for a direct invoice
777
+ *
778
+ * Creates a credit note (avoir) linked to a direct invoice.
779
+ * - For partial credit notes, specify the items and quantities to credit.
780
+ * - For total credit notes, all items are automatically credited.
781
+ *
782
+ * @param params - Credit note creation parameters
783
+ * @param requestOptions - Optional request configuration
784
+ * @returns Created credit note
785
+ *
786
+ * @example
787
+ * ```typescript
788
+ * // Partial credit note
789
+ * const { data: creditNote } = await client.directCreditNotes.create({
790
+ * invoice_id: 'invoice-uuid',
791
+ * reason: 'Returned items',
792
+ * type: 'partial',
793
+ * items: [
794
+ * { invoice_line_id: 'line-1-uuid', quantity: 2 },
795
+ * { invoice_line_id: 'line-2-uuid', quantity: 1 }
796
+ * ]
797
+ * });
798
+ *
799
+ * // Total credit note (cancels entire invoice)
800
+ * const { data: totalCreditNote } = await client.directCreditNotes.create({
801
+ * invoice_id: 'invoice-uuid',
802
+ * reason: 'Invoice issued in error',
803
+ * type: 'total'
804
+ * });
805
+ *
806
+ * console.log('Credit note number:', creditNote.credit_note_number);
807
+ * console.log('Amount:', creditNote.total, creditNote.currency);
808
+ * ```
809
+ */
810
+ async create(params, requestOptions) {
811
+ return this.http.post(
812
+ "/tenant/credit-notes",
813
+ params,
814
+ requestOptions
815
+ );
816
+ }
817
+ /**
818
+ * List all direct credit notes
819
+ *
820
+ * Returns a paginated list of credit notes for direct invoices.
821
+ *
822
+ * @param filters - Filter and pagination options
823
+ * @param requestOptions - Optional request configuration
824
+ * @returns Paginated list of credit notes
825
+ *
826
+ * @example
827
+ * ```typescript
828
+ * // List all sent credit notes
829
+ * const { data: creditNotes, meta } = await client.directCreditNotes.list({
830
+ * status: 'sent',
831
+ * per_page: 50
832
+ * });
833
+ *
834
+ * console.log(`Found ${meta.total} sent credit notes`);
835
+ *
836
+ * // Filter by date range
837
+ * const januaryCreditNotes = await client.directCreditNotes.list({
838
+ * date_from: '2026-01-01',
839
+ * date_to: '2026-01-31'
840
+ * });
841
+ * ```
842
+ */
843
+ async list(filters = {}, requestOptions) {
844
+ return this.http.get(
845
+ "/tenant/credit-notes",
846
+ filters,
847
+ requestOptions
848
+ );
849
+ }
850
+ /**
851
+ * Get a specific credit note by ID
852
+ *
853
+ * @param creditNoteId - Credit note UUID
854
+ * @param requestOptions - Optional request configuration
855
+ * @returns Credit note details
856
+ *
857
+ * @example
858
+ * ```typescript
859
+ * const { data: creditNote } = await client.directCreditNotes.get('credit-note-uuid');
860
+ *
861
+ * console.log('Credit note:', creditNote.credit_note_number);
862
+ * console.log('Status:', creditNote.status);
863
+ * console.log('Reason:', creditNote.reason);
864
+ * console.log('Total:', creditNote.total, creditNote.currency);
865
+ * ```
866
+ */
867
+ async get(creditNoteId, requestOptions) {
868
+ return this.http.get(
869
+ `/tenant/credit-notes/${creditNoteId}`,
870
+ void 0,
871
+ requestOptions
872
+ );
873
+ }
874
+ /**
875
+ * Update a credit note
876
+ *
877
+ * Only credit notes in 'draft' status can be updated.
878
+ *
879
+ * @param creditNoteId - Credit note UUID
880
+ * @param params - Update parameters
881
+ * @param requestOptions - Optional request configuration
882
+ * @returns Updated credit note
883
+ *
884
+ * @example
885
+ * ```typescript
886
+ * const { data: creditNote } = await client.directCreditNotes.update(
887
+ * 'credit-note-uuid',
888
+ * {
889
+ * reason: 'Updated reason: Customer complaint resolved',
890
+ * items: [
891
+ * { invoice_line_id: 'line-uuid', quantity: 3 }
892
+ * ]
893
+ * }
894
+ * );
895
+ * ```
896
+ */
897
+ async update(creditNoteId, params, requestOptions) {
898
+ return this.http.patch(
899
+ `/tenant/credit-notes/${creditNoteId}`,
900
+ params,
901
+ requestOptions
902
+ );
903
+ }
904
+ /**
905
+ * Delete a credit note
906
+ *
907
+ * Only credit notes in 'draft' status can be deleted.
908
+ *
909
+ * @param creditNoteId - Credit note UUID
910
+ * @param requestOptions - Optional request configuration
911
+ *
912
+ * @example
913
+ * ```typescript
914
+ * await client.directCreditNotes.delete('draft-credit-note-uuid');
915
+ * console.log('Credit note deleted');
916
+ * ```
917
+ */
918
+ async delete(creditNoteId, requestOptions) {
919
+ return this.http.delete(
920
+ `/tenant/credit-notes/${creditNoteId}`,
921
+ requestOptions
922
+ );
923
+ }
924
+ /**
925
+ * Send a credit note
926
+ *
927
+ * Validates and sends the credit note, changing status from 'draft' to 'sent'.
928
+ *
929
+ * @param creditNoteId - Credit note UUID
930
+ * @param requestOptions - Optional request configuration
931
+ * @returns Sent credit note
932
+ *
933
+ * @example
934
+ * ```typescript
935
+ * const { data: creditNote } = await client.directCreditNotes.send('credit-note-uuid');
936
+ * console.log('Credit note sent:', creditNote.status); // 'sent'
937
+ * ```
938
+ */
939
+ async send(creditNoteId, requestOptions) {
940
+ return this.http.post(
941
+ `/tenant/credit-notes/${creditNoteId}/send`,
942
+ void 0,
943
+ requestOptions
944
+ );
945
+ }
946
+ /**
947
+ * Download credit note as PDF
948
+ *
949
+ * @param creditNoteId - Credit note UUID
950
+ * @param requestOptions - Optional request configuration
951
+ * @returns ArrayBuffer containing the PDF file
952
+ *
953
+ * @example
954
+ * ```typescript
955
+ * const pdfBuffer = await client.directCreditNotes.download('credit-note-uuid');
956
+ *
957
+ * // In Node.js:
958
+ * import { writeFileSync } from 'fs';
959
+ * writeFileSync('credit-note.pdf', Buffer.from(pdfBuffer));
960
+ *
961
+ * // In browser:
962
+ * const blob = new Blob([pdfBuffer], { type: 'application/pdf' });
963
+ * const url = URL.createObjectURL(blob);
964
+ * window.open(url);
965
+ * ```
966
+ */
967
+ async download(creditNoteId, requestOptions) {
968
+ return this.http.getRaw(
969
+ `/tenant/credit-notes/${creditNoteId}/download`,
970
+ void 0,
971
+ requestOptions
972
+ );
973
+ }
974
+ /**
975
+ * Get remaining creditable amount for a direct invoice
976
+ *
977
+ * Returns information about how much can still be credited,
978
+ * including line-by-line breakdown.
979
+ *
980
+ * @param invoiceId - Invoice UUID
981
+ * @param requestOptions - Optional request configuration
982
+ * @returns Remaining creditable information
983
+ *
984
+ * @example
985
+ * ```typescript
986
+ * const remaining = await client.directCreditNotes.remainingCreditable('invoice-uuid');
987
+ *
988
+ * console.log('Invoice total:', remaining.invoice_total);
989
+ * console.log('Already credited:', remaining.credited_total);
990
+ * console.log('Can still credit:', remaining.remaining_total);
991
+ *
992
+ * // Check per-line
993
+ * remaining.lines.forEach(line => {
994
+ * if (line.remaining_quantity > 0) {
995
+ * console.log(`${line.description}: ${line.remaining_quantity} units remaining`);
996
+ * }
997
+ * });
998
+ * ```
999
+ */
1000
+ async remainingCreditable(invoiceId, requestOptions) {
1001
+ return this.http.get(
1002
+ `/tenant/invoices/${invoiceId}/remaining-creditable`,
1003
+ void 0,
1004
+ requestOptions
1005
+ );
1006
+ }
1007
+ };
1008
+
1009
+ // src/resources/tenant-incoming-invoices.ts
1010
+ var TenantIncomingInvoicesResource = class {
1011
+ constructor(http) {
1012
+ this.http = http;
1013
+ }
1014
+ /**
1015
+ * Create a new incoming invoice for a sub-tenant
1016
+ *
1017
+ * Creates a purchase invoice received by a sub-tenant from an external supplier.
1018
+ * The seller's SIREN is validated using the Luhn algorithm.
1019
+ *
1020
+ * @param subTenantId - Sub-tenant UUID
1021
+ * @param params - Invoice creation parameters
1022
+ * @param requestOptions - Optional request configuration
1023
+ * @returns Created invoice
1024
+ *
1025
+ * @example
1026
+ * ```typescript
1027
+ * const { data: invoice } = await client.incomingInvoices.create(
1028
+ * 'sub-tenant-uuid',
1029
+ * {
1030
+ * invoice_number: 'SUPP-2026-001',
1031
+ * company_id: 'company-uuid',
1032
+ * seller: {
1033
+ * company_name: 'Acme Supplies',
1034
+ * siren: '123456789',
1035
+ * siret: '12345678901234',
1036
+ * vat_number: 'FR12123456789',
1037
+ * address: {
1038
+ * line1: '123 Industrial Park',
1039
+ * postal_code: '31000',
1040
+ * city: 'Toulouse',
1041
+ * country: 'FR'
1042
+ * },
1043
+ * email: 'billing@acme-supplies.com'
1044
+ * },
1045
+ * lines: [
1046
+ * {
1047
+ * description: 'Widget A - Bulk order',
1048
+ * quantity: 500,
1049
+ * unit_price: 2.50,
1050
+ * tax_rate: 20,
1051
+ * total_ht: 1250,
1052
+ * total_tax: 250,
1053
+ * total_ttc: 1500
1054
+ * }
1055
+ * ],
1056
+ * issue_date: '2026-01-15',
1057
+ * due_date: '2026-02-15',
1058
+ * total_ht: 1250,
1059
+ * total_ttc: 1500
1060
+ * }
1061
+ * );
1062
+ *
1063
+ * console.log('Incoming invoice created:', invoice.invoice_number);
1064
+ * ```
1065
+ */
1066
+ async create(subTenantId, params, requestOptions) {
1067
+ return this.http.post(
1068
+ `/tenant/sub-tenants/${subTenantId}/incoming-invoices`,
1069
+ params,
1070
+ requestOptions
1071
+ );
1072
+ }
1073
+ /**
1074
+ * List incoming invoices for a sub-tenant
1075
+ *
1076
+ * Returns a paginated list of purchase invoices received by the sub-tenant.
1077
+ *
1078
+ * @param subTenantId - Sub-tenant UUID
1079
+ * @param filters - Filter and pagination options
1080
+ * @param requestOptions - Optional request configuration
1081
+ * @returns Paginated list of invoices
1082
+ *
1083
+ * @example
1084
+ * ```typescript
1085
+ * // List all pending invoices
1086
+ * const { data: invoices, meta } = await client.incomingInvoices.listForSubTenant(
1087
+ * 'sub-tenant-uuid',
1088
+ * { status: 'pending', per_page: 50 }
1089
+ * );
1090
+ *
1091
+ * console.log(`Found ${meta.total} pending invoices to review`);
1092
+ *
1093
+ * // Filter by supplier
1094
+ * const acmeInvoices = await client.incomingInvoices.listForSubTenant(
1095
+ * 'sub-tenant-uuid',
1096
+ * { seller_siret: '12345678901234' }
1097
+ * );
1098
+ * ```
1099
+ */
1100
+ async listForSubTenant(subTenantId, filters = {}, requestOptions) {
1101
+ const query = {
1102
+ ...filters,
1103
+ status: Array.isArray(filters.status) ? filters.status.join(",") : filters.status
1104
+ };
1105
+ return this.http.get(
1106
+ `/tenant/sub-tenants/${subTenantId}/incoming-invoices`,
1107
+ query,
1108
+ requestOptions
1109
+ );
1110
+ }
1111
+ /**
1112
+ * Get a specific incoming invoice by ID
1113
+ *
1114
+ * @param invoiceId - Invoice UUID
1115
+ * @param requestOptions - Optional request configuration
1116
+ * @returns Invoice details
1117
+ *
1118
+ * @example
1119
+ * ```typescript
1120
+ * const { data: invoice } = await client.incomingInvoices.get('invoice-uuid');
1121
+ *
1122
+ * console.log('Invoice from:', invoice.seller.name);
1123
+ * console.log('Status:', invoice.status);
1124
+ * console.log('Amount:', invoice.total_ttc, invoice.currency);
1125
+ * ```
1126
+ */
1127
+ async get(invoiceId, requestOptions) {
1128
+ return this.http.get(
1129
+ `/tenant/incoming-invoices/${invoiceId}`,
1130
+ void 0,
1131
+ requestOptions
1132
+ );
1133
+ }
1134
+ /**
1135
+ * Accept an incoming invoice
1136
+ *
1137
+ * Marks the invoice as accepted, indicating approval for payment.
1138
+ * Optionally specify an expected payment date.
1139
+ *
1140
+ * @param invoiceId - Invoice UUID
1141
+ * @param input - Optional acceptance details
1142
+ * @param requestOptions - Optional request configuration
1143
+ * @returns Updated invoice
1144
+ *
1145
+ * @example
1146
+ * ```typescript
1147
+ * // Accept with payment date
1148
+ * const { data: invoice } = await client.incomingInvoices.accept(
1149
+ * 'invoice-uuid',
1150
+ * {
1151
+ * payment_date: '2026-02-15',
1152
+ * note: 'Approved by CFO'
1153
+ * }
1154
+ * );
1155
+ *
1156
+ * console.log('Invoice accepted:', invoice.status); // 'accepted'
1157
+ *
1158
+ * // Simple acceptance
1159
+ * await client.incomingInvoices.accept('invoice-uuid');
1160
+ * ```
1161
+ */
1162
+ async accept(invoiceId, input, requestOptions) {
1163
+ return this.http.post(
1164
+ `/tenant/incoming-invoices/${invoiceId}/accept`,
1165
+ input,
1166
+ requestOptions
1167
+ );
1168
+ }
1169
+ /**
1170
+ * Reject an incoming invoice
1171
+ *
1172
+ * Marks the invoice as rejected with a reason and optional code.
1173
+ *
1174
+ * @param invoiceId - Invoice UUID
1175
+ * @param reason - Reason for rejection
1176
+ * @param code - Optional standardized rejection code
1177
+ * @param requestOptions - Optional request configuration
1178
+ * @returns Updated invoice
1179
+ *
1180
+ * @example
1181
+ * ```typescript
1182
+ * const { data: invoice } = await client.incomingInvoices.reject(
1183
+ * 'invoice-uuid',
1184
+ * 'Amount does not match purchase order PO-2026-042',
1185
+ * 'incorrect_amount'
1186
+ * );
1187
+ *
1188
+ * console.log('Invoice rejected:', invoice.status); // 'rejected'
1189
+ * ```
1190
+ */
1191
+ async reject(invoiceId, reason, code, requestOptions) {
1192
+ const input = { reason };
1193
+ if (code) {
1194
+ input.reason_code = code;
1195
+ }
1196
+ return this.http.post(
1197
+ `/tenant/incoming-invoices/${invoiceId}/reject`,
1198
+ input,
1199
+ requestOptions
1200
+ );
1201
+ }
1202
+ /**
1203
+ * Mark an incoming invoice as paid
1204
+ *
1205
+ * Records payment information for an accepted invoice.
1206
+ * This is a mandatory step in the French e-invoicing lifecycle.
1207
+ *
1208
+ * @param invoiceId - Invoice UUID
1209
+ * @param input - Optional payment details
1210
+ * @param requestOptions - Optional request configuration
1211
+ * @returns Updated invoice with payment information
1212
+ *
1213
+ * @example
1214
+ * ```typescript
1215
+ * // Mark as paid with details
1216
+ * const { data: invoice } = await client.incomingInvoices.markPaid(
1217
+ * 'invoice-uuid',
1218
+ * {
1219
+ * payment_reference: 'VIR-2026-0150',
1220
+ * paid_at: '2026-02-14T14:30:00Z',
1221
+ * note: 'Payment via bank transfer'
1222
+ * }
1223
+ * );
1224
+ *
1225
+ * console.log('Invoice paid:', invoice.status); // 'paid'
1226
+ * console.log('Payment ref:', invoice.payment_reference);
1227
+ *
1228
+ * // Simple mark as paid (current date)
1229
+ * await client.incomingInvoices.markPaid('invoice-uuid');
1230
+ * ```
1231
+ */
1232
+ async markPaid(invoiceId, input, requestOptions) {
1233
+ return this.http.post(
1234
+ `/tenant/incoming-invoices/${invoiceId}/mark-paid`,
1235
+ input,
1236
+ requestOptions
1237
+ );
1238
+ }
1239
+ /**
1240
+ * Delete an incoming invoice
1241
+ *
1242
+ * Only invoices in 'pending' status can be deleted.
1243
+ *
1244
+ * @param invoiceId - Invoice UUID
1245
+ * @param requestOptions - Optional request configuration
1246
+ *
1247
+ * @example
1248
+ * ```typescript
1249
+ * await client.incomingInvoices.delete('pending-invoice-uuid');
1250
+ * console.log('Incoming invoice deleted');
1251
+ * ```
1252
+ */
1253
+ async delete(invoiceId, requestOptions) {
1254
+ return this.http.delete(
1255
+ `/tenant/incoming-invoices/${invoiceId}`,
1256
+ requestOptions
1257
+ );
1258
+ }
1259
+ /**
1260
+ * Download incoming invoice as PDF
1261
+ *
1262
+ * @param invoiceId - Invoice UUID
1263
+ * @param requestOptions - Optional request configuration
1264
+ * @returns ArrayBuffer containing the PDF file
1265
+ *
1266
+ * @example
1267
+ * ```typescript
1268
+ * const pdfBuffer = await client.incomingInvoices.download('invoice-uuid');
1269
+ *
1270
+ * // Save to file (Node.js)
1271
+ * import { writeFileSync } from 'fs';
1272
+ * writeFileSync('supplier-invoice.pdf', Buffer.from(pdfBuffer));
1273
+ * ```
1274
+ */
1275
+ async download(invoiceId, requestOptions) {
1276
+ return this.http.getRaw(
1277
+ `/tenant/incoming-invoices/${invoiceId}/download`,
1278
+ void 0,
1279
+ requestOptions
1280
+ );
1281
+ }
1282
+ };
1283
+
1284
+ // src/resources/tenant-credit-notes.ts
1285
+ var TenantCreditNotesResource = class {
1286
+ constructor(http) {
1287
+ this.http = http;
1288
+ }
1289
+ /**
1290
+ * List credit notes for a sub-tenant
1291
+ *
1292
+ * @param subTenantId - Sub-tenant UUID
1293
+ * @param options - Filter and pagination options
1294
+ * @param requestOptions - Request options
1295
+ * @returns Paginated list of credit notes
1296
+ *
1297
+ * @example
1298
+ * ```typescript
1299
+ * const { data, meta } = await client.tenantCreditNotes.list('sub-tenant-uuid', {
1300
+ * status: 'sent',
1301
+ * date_from: '2024-01-01',
1302
+ * per_page: 50
1303
+ * });
1304
+ * console.log(`Found ${meta.total} credit notes`);
1305
+ * ```
1306
+ */
1307
+ async list(subTenantId, options = {}, requestOptions) {
1308
+ return this.http.get(
1309
+ `/tenant/sub-tenants/${subTenantId}/credit-notes`,
1310
+ options,
1311
+ requestOptions
1312
+ );
1313
+ }
1314
+ /**
1315
+ * Create a new credit note for a sub-tenant invoice
1316
+ *
1317
+ * @param subTenantId - Sub-tenant UUID
1318
+ * @param input - Credit note creation data
1319
+ * @param requestOptions - Request options
1320
+ * @returns Created credit note
1321
+ *
1322
+ * @example
1323
+ * ```typescript
1324
+ * // Create a partial credit note
1325
+ * const { data: creditNote } = await client.tenantCreditNotes.create(
1326
+ * 'sub-tenant-uuid',
1327
+ * {
1328
+ * invoice_id: 'invoice-uuid',
1329
+ * reason: 'Product returned - damaged item',
1330
+ * type: 'partial',
1331
+ * items: [
1332
+ * { invoice_line_id: 'line-uuid-1', quantity: 2 }
1333
+ * ]
1334
+ * }
1335
+ * );
1336
+ *
1337
+ * // Create a total credit note
1338
+ * const { data: totalCreditNote } = await client.tenantCreditNotes.create(
1339
+ * 'sub-tenant-uuid',
1340
+ * {
1341
+ * invoice_id: 'invoice-uuid',
1342
+ * reason: 'Order cancelled',
1343
+ * type: 'total'
1344
+ * }
1345
+ * );
1346
+ * ```
1347
+ */
1348
+ async create(subTenantId, input, requestOptions) {
1349
+ return this.http.post(
1350
+ `/tenant/sub-tenants/${subTenantId}/credit-notes`,
1351
+ input,
1352
+ requestOptions
1353
+ );
1354
+ }
1355
+ /**
1356
+ * Get a specific credit note by ID
1357
+ *
1358
+ * @param creditNoteId - Credit note UUID
1359
+ * @param requestOptions - Request options
1360
+ * @returns Credit note details
1361
+ *
1362
+ * @example
1363
+ * ```typescript
1364
+ * const { data: creditNote } = await client.tenantCreditNotes.get('credit-note-uuid');
1365
+ * console.log('Credit note number:', creditNote.credit_note_number);
1366
+ * console.log('Total:', creditNote.total, creditNote.currency);
1367
+ * ```
1368
+ */
1369
+ async get(creditNoteId, requestOptions) {
1370
+ return this.http.get(
1371
+ `/tenant/credit-notes/${creditNoteId}`,
1372
+ void 0,
1373
+ requestOptions
1374
+ );
1375
+ }
1376
+ /**
1377
+ * Update a credit note
1378
+ *
1379
+ * Only credit notes in 'draft' status can be updated.
1380
+ *
1381
+ * @param creditNoteId - Credit note UUID
1382
+ * @param input - Update data
1383
+ * @param requestOptions - Request options
1384
+ * @returns Updated credit note
1385
+ *
1386
+ * @example
1387
+ * ```typescript
1388
+ * const { data: creditNote } = await client.tenantCreditNotes.update(
1389
+ * 'credit-note-uuid',
1390
+ * {
1391
+ * reason: 'Updated reason: Customer complaint resolved',
1392
+ * items: [
1393
+ * { invoice_line_id: 'line-uuid', quantity: 3 }
1394
+ * ]
1395
+ * }
1396
+ * );
1397
+ * console.log('Credit note updated:', creditNote.reason);
1398
+ * ```
1399
+ */
1400
+ async update(creditNoteId, input, requestOptions) {
1401
+ return this.http.patch(
1402
+ `/tenant/credit-notes/${creditNoteId}`,
1403
+ input,
1404
+ requestOptions
1405
+ );
1406
+ }
1407
+ /**
1408
+ * Send a credit note
1409
+ *
1410
+ * Changes the status from 'draft' to 'sent'.
1411
+ *
1412
+ * @param creditNoteId - Credit note UUID
1413
+ * @param requestOptions - Request options
1414
+ * @returns Updated credit note
1415
+ *
1416
+ * @example
1417
+ * ```typescript
1418
+ * const { data: sentCreditNote } = await client.tenantCreditNotes.send('credit-note-uuid');
1419
+ * console.log('Status:', sentCreditNote.status); // 'sent'
1420
+ * ```
1421
+ */
1422
+ async send(creditNoteId, requestOptions) {
1423
+ return this.http.post(
1424
+ `/tenant/credit-notes/${creditNoteId}/send`,
1425
+ void 0,
1426
+ requestOptions
1427
+ );
1428
+ }
1429
+ /**
1430
+ * Delete a credit note (draft only)
1431
+ *
1432
+ * Only credit notes with status 'draft' can be deleted.
1433
+ *
1434
+ * @param creditNoteId - Credit note UUID
1435
+ * @param requestOptions - Request options
1436
+ *
1437
+ * @example
1438
+ * ```typescript
1439
+ * await client.tenantCreditNotes.delete('credit-note-uuid');
1440
+ * ```
1441
+ */
1442
+ async delete(creditNoteId, requestOptions) {
1443
+ return this.http.delete(
1444
+ `/tenant/credit-notes/${creditNoteId}`,
1445
+ requestOptions
1446
+ );
1447
+ }
1448
+ /**
1449
+ * Download credit note as PDF
1450
+ *
1451
+ * @param creditNoteId - Credit note UUID
1452
+ * @param requestOptions - Request options
1453
+ * @returns ArrayBuffer containing the PDF file
1454
+ *
1455
+ * @example
1456
+ * ```typescript
1457
+ * // Download credit note PDF
1458
+ * const pdfBuffer = await client.tenantCreditNotes.download('credit-note-uuid');
1459
+ *
1460
+ * // In Node.js, save to file:
1461
+ * import { writeFileSync } from 'fs';
1462
+ * writeFileSync('credit-note.pdf', Buffer.from(pdfBuffer));
1463
+ *
1464
+ * // In browser, trigger download:
1465
+ * const blob = new Blob([pdfBuffer], { type: 'application/pdf' });
1466
+ * const url = URL.createObjectURL(blob);
1467
+ * const a = document.createElement('a');
1468
+ * a.href = url;
1469
+ * a.download = 'credit-note.pdf';
1470
+ * a.click();
1471
+ * ```
1472
+ */
1473
+ async download(creditNoteId, requestOptions) {
1474
+ return this.http.getRaw(
1475
+ `/tenant/credit-notes/${creditNoteId}/download`,
1476
+ void 0,
1477
+ requestOptions
1478
+ );
1479
+ }
1480
+ /**
1481
+ * Get remaining creditable amount for an invoice
1482
+ *
1483
+ * Returns information about how much can still be credited for an invoice,
1484
+ * including per-line breakdown.
1485
+ *
1486
+ * @param invoiceId - Invoice UUID
1487
+ * @param requestOptions - Request options
1488
+ * @returns Remaining creditable information
1489
+ *
1490
+ * @example
1491
+ * ```typescript
1492
+ * const remaining = await client.tenantCreditNotes.remainingCreditable('invoice-uuid');
1493
+ *
1494
+ * console.log('Invoice total:', remaining.invoice_total);
1495
+ * console.log('Already credited:', remaining.credited_total);
1496
+ * console.log('Remaining to credit:', remaining.remaining_total);
1497
+ *
1498
+ * // Check remaining quantity per line
1499
+ * remaining.lines.forEach(line => {
1500
+ * console.log(`${line.description}: ${line.remaining_quantity} remaining`);
1501
+ * });
1502
+ * ```
1503
+ */
1504
+ async remainingCreditable(invoiceId, requestOptions) {
1505
+ return this.http.get(
1506
+ `/tenant/invoices/${invoiceId}/remaining-creditable`,
1507
+ void 0,
1508
+ requestOptions
1509
+ );
1510
+ }
1511
+ };
1512
+
1513
+ // src/resources/fiscal.ts
1514
+ var FiscalResource = class {
1515
+ constructor(http) {
1516
+ this.http = http;
1517
+ }
1518
+ async compliance(requestOptions) {
1519
+ return this.http.get("/tenant/fiscal/compliance", void 0, requestOptions);
1520
+ }
1521
+ async integrity(options = {}, requestOptions) {
1522
+ return this.http.get("/tenant/fiscal/integrity", options, requestOptions);
1523
+ }
1524
+ async integrityHistory(options = {}, requestOptions) {
1525
+ return this.http.get("/tenant/fiscal/integrity/history", options, requestOptions);
1526
+ }
1527
+ async integrityForDate(date, requestOptions) {
1528
+ return this.http.get(`/tenant/fiscal/integrity/${date}`, void 0, requestOptions);
1529
+ }
1530
+ async closings(options = {}, requestOptions) {
1531
+ return this.http.get("/tenant/fiscal/closings", options, requestOptions);
1532
+ }
1533
+ async performDailyClosing(input = {}, requestOptions) {
1534
+ return this.http.post("/tenant/fiscal/closings/daily", input, requestOptions);
1535
+ }
1536
+ async fecExport(options, requestOptions) {
1537
+ return this.http.get("/tenant/fiscal/fec", options, requestOptions);
1538
+ }
1539
+ async fecDownload(options, requestOptions) {
1540
+ return this.http.getRaw("/tenant/fiscal/fec", { ...options, download: true }, requestOptions);
1541
+ }
1542
+ async attestation(year, requestOptions) {
1543
+ return this.http.get(`/tenant/fiscal/attestation/${year}`, void 0, requestOptions);
1544
+ }
1545
+ async attestationDownload(year, requestOptions) {
1546
+ return this.http.getRaw(`/tenant/fiscal/attestation/${year}/download`, void 0, requestOptions);
1547
+ }
1548
+ async entries(options = {}, requestOptions) {
1549
+ return this.http.get("/tenant/fiscal/entries", options, requestOptions);
1550
+ }
1551
+ async killSwitchStatus(requestOptions) {
1552
+ return this.http.get("/tenant/fiscal/kill-switch/status", void 0, requestOptions);
1553
+ }
1554
+ async killSwitchActivate(input, requestOptions) {
1555
+ return this.http.post("/tenant/fiscal/kill-switch/activate", input, requestOptions);
1556
+ }
1557
+ async killSwitchDeactivate(requestOptions) {
1558
+ return this.http.post("/tenant/fiscal/kill-switch/deactivate", void 0, requestOptions);
1559
+ }
1560
+ async anchors(options = {}, requestOptions) {
1561
+ return this.http.get("/tenant/fiscal/anchors", options, requestOptions);
1562
+ }
1563
+ async rules(options = {}, requestOptions) {
1564
+ return this.http.get("/tenant/fiscal/rules", options, requestOptions);
1565
+ }
1566
+ async ruleDetail(key, requestOptions) {
1567
+ return this.http.get(`/tenant/fiscal/rules/${key}`, void 0, requestOptions);
1568
+ }
1569
+ async ruleHistory(key, requestOptions) {
1570
+ return this.http.get(`/tenant/fiscal/rules/${key}/history`, void 0, requestOptions);
1571
+ }
1572
+ async createRule(input, requestOptions) {
1573
+ return this.http.post("/tenant/fiscal/rules", input, requestOptions);
1574
+ }
1575
+ async updateRule(id, input, requestOptions) {
1576
+ return this.http.post(`/tenant/fiscal/rules/${id}`, input, requestOptions);
1577
+ }
1578
+ async exportRules(options, requestOptions) {
1579
+ return this.http.get("/tenant/fiscal/rules/export", options, requestOptions);
1580
+ }
1581
+ async replayRules(input, requestOptions) {
1582
+ return this.http.post("/tenant/fiscal/rules/replay", input, requestOptions);
1583
+ }
1584
+ async forensicExport(options, requestOptions) {
1585
+ return this.http.get("/tenant/fiscal/forensic-export", options, requestOptions);
1586
+ }
1587
+ };
1588
+
1589
+ // src/resources/billing.ts
1590
+ var BillingResource = class {
1591
+ constructor(http) {
1592
+ this.http = http;
1593
+ }
1594
+ async invoices(options = {}, requestOptions) {
1595
+ return this.http.get("/tenant/billing/invoices", options, requestOptions);
1596
+ }
1597
+ async showInvoice(invoiceId, requestOptions) {
1598
+ return this.http.get(`/tenant/billing/invoices/${invoiceId}`, void 0, requestOptions);
1599
+ }
1600
+ async downloadInvoice(invoiceId, requestOptions) {
1601
+ return this.http.getRaw(`/tenant/billing/invoices/${invoiceId}/download`, void 0, requestOptions);
1602
+ }
1603
+ async usage(options = {}, requestOptions) {
1604
+ return this.http.get("/tenant/billing/usage", options, requestOptions);
1605
+ }
1606
+ async topUp(input, requestOptions) {
1607
+ return this.http.post("/tenant/billing/top-up", input, requestOptions);
1608
+ }
1609
+ async confirmTopUp(input, requestOptions) {
1610
+ return this.http.post("/tenant/billing/top-up/confirm", input, requestOptions);
1611
+ }
1612
+ async transactions(options = {}, requestOptions) {
1613
+ return this.http.get("/tenant/billing/transactions", options, requestOptions);
1614
+ }
1615
+ };
1616
+
1617
+ // src/resources/stats.ts
1618
+ var StatsResource = class {
1619
+ constructor(http) {
1620
+ this.http = http;
1621
+ }
1622
+ async overview(options = {}, requestOptions) {
1623
+ return this.http.get("/tenant/stats/overview", options, requestOptions);
1624
+ }
1625
+ async monthly(options = {}, requestOptions) {
1626
+ return this.http.get("/tenant/stats/monthly", options, requestOptions);
1627
+ }
1628
+ async subTenantOverview(subTenantId, options = {}, requestOptions) {
1629
+ return this.http.get(`/tenant/sub-tenants/${subTenantId}/stats/overview`, options, requestOptions);
1630
+ }
1631
+ };
1632
+
1633
+ // src/resources/sub-tenants.ts
1634
+ var SubTenantsResource = class {
1635
+ constructor(http) {
1636
+ this.http = http;
1637
+ }
1638
+ async list(options = {}, requestOptions) {
1639
+ return this.http.get("/tenant/sub-tenants", options, requestOptions);
1640
+ }
1641
+ async create(input, requestOptions) {
1642
+ return this.http.post("/tenant/sub-tenants", input, requestOptions);
1643
+ }
1644
+ async get(id, requestOptions) {
1645
+ return this.http.get(`/tenant/sub-tenants/${id}`, void 0, requestOptions);
1646
+ }
1647
+ async update(id, input, requestOptions) {
1648
+ return this.http.patch(`/tenant/sub-tenants/${id}`, input, requestOptions);
1649
+ }
1650
+ async delete(id, requestOptions) {
1651
+ return this.http.delete(`/tenant/sub-tenants/${id}`, requestOptions);
1652
+ }
1653
+ async findByExternalId(externalId, requestOptions) {
1654
+ return this.http.get(`/tenant/sub-tenants/by-external-id/${externalId}`, void 0, requestOptions);
1655
+ }
1656
+ };
1657
+
1658
+ // src/tenant-client.ts
1659
+ var ScellTenantClient = class {
1660
+ http;
1661
+ /** Direct invoices resource */
1662
+ directInvoices;
1663
+ /** Direct credit notes resource */
1664
+ directCreditNotes;
1665
+ /** Incoming invoices resource */
1666
+ incomingInvoices;
1667
+ /** Sub-tenant credit notes resource */
1668
+ subTenantCreditNotes;
1669
+ /** Fiscal compliance resource (LF 2026) */
1670
+ fiscal;
1671
+ /** Billing resource */
1672
+ billing;
1673
+ /** Stats resource */
1674
+ stats;
1675
+ /** Sub-tenants resource */
1676
+ subTenants;
1677
+ /**
1678
+ * Create a new Scell Tenant Client
1679
+ *
1680
+ * @param tenantKey - Your tenant API key (from dashboard)
1681
+ * @param config - Optional client configuration
1682
+ */
1683
+ constructor(tenantKey, config = {}) {
1684
+ this.http = new HttpClient("tenant-key", tenantKey, config);
1685
+ this.directInvoices = new TenantDirectInvoicesResource(this.http);
1686
+ this.directCreditNotes = new TenantDirectCreditNotesResource(this.http);
1687
+ this.incomingInvoices = new TenantIncomingInvoicesResource(this.http);
1688
+ this.subTenantCreditNotes = new TenantCreditNotesResource(this.http);
1689
+ this.fiscal = new FiscalResource(this.http);
1690
+ this.billing = new BillingResource(this.http);
1691
+ this.stats = new StatsResource(this.http);
1692
+ this.subTenants = new SubTenantsResource(this.http);
1693
+ }
1694
+ // ── Tenant Profile Methods ──────────────────────────────
1695
+ /** Get tenant profile */
1696
+ async me(requestOptions) {
1697
+ return this.http.get("/tenant/me", void 0, requestOptions);
1698
+ }
1699
+ /** Update tenant profile */
1700
+ async updateProfile(input, requestOptions) {
1701
+ return this.http.post("/tenant/me", input, requestOptions);
1702
+ }
1703
+ /** Get tenant balance */
1704
+ async balance(requestOptions) {
1705
+ return this.http.get("/tenant/balance", void 0, requestOptions);
1706
+ }
1707
+ /** Get quick stats */
1708
+ async quickStats(requestOptions) {
1709
+ return this.http.get("/tenant/stats", void 0, requestOptions);
1710
+ }
1711
+ /** Regenerate tenant key */
1712
+ async regenerateKey(requestOptions) {
1713
+ return this.http.post("/tenant/regenerate-key", void 0, requestOptions);
1714
+ }
1715
+ };
1716
+
460
1717
  // src/resources/api-keys.ts
461
1718
  var ApiKeysResource = class {
462
1719
  constructor(http) {
@@ -1551,6 +2808,34 @@ var SignaturesResource = class {
1551
2808
  requestOptions
1552
2809
  );
1553
2810
  }
2811
+ /**
2812
+ * Get signature audit trail (JSON)
2813
+ *
2814
+ * Returns the complete history of actions on the signature:
2815
+ * creation, delivery, opening, signing, refusal, etc.
2816
+ *
2817
+ * @param id - Signature UUID
2818
+ * @param requestOptions - Request options
2819
+ * @returns Audit trail entries with integrity validation
2820
+ *
2821
+ * @example
2822
+ * ```typescript
2823
+ * const { data: entries, integrity_valid } = await client.signatures.auditTrail(
2824
+ * 'signature-uuid'
2825
+ * );
2826
+ *
2827
+ * if (integrity_valid) {
2828
+ * entries.forEach(e => console.log(e.action, e.created_at));
2829
+ * }
2830
+ * ```
2831
+ */
2832
+ async auditTrail(id, requestOptions) {
2833
+ return this.http.get(
2834
+ `/signatures/${id}/audit-trail`,
2835
+ void 0,
2836
+ requestOptions
2837
+ );
2838
+ }
1554
2839
  };
1555
2840
 
1556
2841
  // src/resources/webhooks.ts
@@ -1955,10 +3240,24 @@ var ScellApiClient = class {
1955
3240
  invoices;
1956
3241
  /** Signature operations (create, download, remind, cancel) */
1957
3242
  signatures;
3243
+ /** Sub-tenant management (provision, update, list) */
3244
+ subTenants;
3245
+ /** NF525 fiscal compliance (closings, FEC, attestation) */
3246
+ fiscal;
3247
+ /** Platform statistics */
3248
+ stats;
3249
+ /** Platform billing (usage, top-up, transactions) */
3250
+ billing;
3251
+ /** Credit notes operations (create, send, download) */
3252
+ creditNotes;
3253
+ /** Tenant invoice operations (create, submit, update, delete) */
3254
+ tenantInvoices;
3255
+ /** Incoming invoice operations (list, accept, reject) */
3256
+ incomingInvoices;
1958
3257
  /**
1959
3258
  * Create a new Scell API Client
1960
3259
  *
1961
- * @param apiKey - Your API key (from dashboard)
3260
+ * @param apiKey - Your API key (sk_live_xxx or sk_test_xxx)
1962
3261
  * @param config - Client configuration
1963
3262
  *
1964
3263
  * @example
@@ -1976,9 +3275,16 @@ var ScellApiClient = class {
1976
3275
  this.http = new HttpClient("api-key", apiKey, config);
1977
3276
  this.invoices = new InvoicesResource(this.http);
1978
3277
  this.signatures = new SignaturesResource(this.http);
3278
+ this.subTenants = new SubTenantsResource(this.http);
3279
+ this.fiscal = new FiscalResource(this.http);
3280
+ this.stats = new StatsResource(this.http);
3281
+ this.billing = new BillingResource(this.http);
3282
+ this.creditNotes = new TenantCreditNotesResource(this.http);
3283
+ this.tenantInvoices = new TenantDirectInvoicesResource(this.http);
3284
+ this.incomingInvoices = new TenantIncomingInvoicesResource(this.http);
1979
3285
  }
1980
3286
  };
1981
3287
 
1982
- export { ScellApiClient, ScellAuth, ScellAuthenticationError, ScellAuthorizationError, ScellClient, ScellError, ScellInsufficientBalanceError, ScellNetworkError, ScellNotFoundError, ScellRateLimitError, ScellServerError, ScellTimeoutError, ScellValidationError, ScellWebhooks, createRetryWrapper, withRetry };
3288
+ export { ScellApiClient, ScellAuth, ScellAuthenticationError, ScellAuthorizationError, ScellClient, ScellError, ScellInsufficientBalanceError, ScellNetworkError, ScellNotFoundError, ScellRateLimitError, ScellServerError, ScellTenantClient, ScellTimeoutError, ScellValidationError, ScellWebhooks, createRetryWrapper, withRetry };
1983
3289
  //# sourceMappingURL=index.mjs.map
1984
3290
  //# sourceMappingURL=index.mjs.map