@gesagro/jaspion-sdk 1.0.10 → 1.0.11

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.mjs CHANGED
@@ -632,6 +632,59 @@ var FarrowingCollectionForm = class extends Report {
632
632
  }
633
633
  };
634
634
 
635
+ // src/core/to-snake-case.ts
636
+ function toSnakeCase(str) {
637
+ return str.replace(/[A-Z]/g, (letter, index) => {
638
+ return index === 0 ? letter.toLowerCase() : `_${letter.toLowerCase()}`;
639
+ });
640
+ }
641
+
642
+ // src/namespaces/pig-master/reports/farrowing-list.ts
643
+ var FarrowingList = class extends Report {
644
+ constructor() {
645
+ super(...arguments);
646
+ this.template = "@pig-master/farrowing-list";
647
+ this.fileName = "Listagem de partos";
648
+ }
649
+ async pdf(input) {
650
+ return this.requestPdf({
651
+ resources: this.getResources(input),
652
+ parameters: [
653
+ ...this.getParameters(input),
654
+ { key: "DATA_ONLY", value: false }
655
+ ]
656
+ });
657
+ }
658
+ async csv(input) {
659
+ return this.requestCsv({
660
+ resources: this.getResources(input),
661
+ parameters: [
662
+ ...this.getParameters(input),
663
+ { key: "DATA_ONLY", value: true }
664
+ ]
665
+ });
666
+ }
667
+ getResources(input) {
668
+ return [{ key: "FARM_ID", value: input.farmId }];
669
+ }
670
+ getParameters(input) {
671
+ return [
672
+ { key: "DATE_BEGIN", value: input.dateRange?.start ?? null },
673
+ { key: "DATE_END", value: input.dateRange?.end ?? null },
674
+ { key: "CALENDAR", value: input.calendarType },
675
+ { key: "FEMALE_SWINE_ID", value: input.femaleSwineId },
676
+ { key: "PARITY", value: input.parity?.toString() ?? null },
677
+ { key: "MATING_DATE_BEGIN", value: input.matingDateRange?.start ?? null },
678
+ { key: "MATING_DATE_END", value: input.matingDateRange?.end ?? null },
679
+ { key: "BIRTH_PLACE_ID", value: input.birthPlaceId },
680
+ { key: "ORIGIN_ID", value: input.originId },
681
+ { key: "BREED_ID", value: input.breedId },
682
+ { key: "ORDERBYDIRECTION", value: input.orderBy.direction },
683
+ { key: "ORDERBYCOLUMN", value: toSnakeCase(input.orderBy.column) }
684
+ ];
685
+ }
686
+ };
687
+
635
688
  // src/namespaces/pig-master/reports/farrowing-type-list.ts
636
689
  var FarrowingTypeList = class extends Report {
637
690
  constructor() {
@@ -2449,6 +2502,7 @@ var PigMaster = class {
2449
2502
  this.weaningCollectionForm = new WeaningCollectionForm(http);
2450
2503
  this.maternityPigletDeathList = new MaternityPigletDeathList(http);
2451
2504
  this.weaningList = new WeaningList(http);
2505
+ this.farrowingList = new FarrowingList(http);
2452
2506
  }
2453
2507
  };
2454
2508