@gesagro/jaspion-sdk 1.0.9 → 1.0.10
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 +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +41 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1312,12 +1312,15 @@ interface WeaningListInput {
|
|
|
1312
1312
|
femaleSwineId: string | null;
|
|
1313
1313
|
context: MaternityContext | null;
|
|
1314
1314
|
nurseryPigletBatchId: string | null;
|
|
1315
|
+
orderBy: OrderBy<'date' | 'parity' | 'weanedPiglets' | 'createdAt'>;
|
|
1315
1316
|
}
|
|
1316
1317
|
declare class WeaningList extends Report implements PdfReport, CsvReport {
|
|
1317
1318
|
readonly template = "@pig-master/weaning-list";
|
|
1318
1319
|
fileName: string;
|
|
1319
1320
|
pdf(input: WeaningListInput): Promise<void>;
|
|
1320
1321
|
csv(input: WeaningListInput): Promise<void>;
|
|
1322
|
+
private getResources;
|
|
1323
|
+
private getParameters;
|
|
1321
1324
|
}
|
|
1322
1325
|
|
|
1323
1326
|
declare class PigMaster {
|
package/dist/index.d.ts
CHANGED
|
@@ -1312,12 +1312,15 @@ interface WeaningListInput {
|
|
|
1312
1312
|
femaleSwineId: string | null;
|
|
1313
1313
|
context: MaternityContext | null;
|
|
1314
1314
|
nurseryPigletBatchId: string | null;
|
|
1315
|
+
orderBy: OrderBy<'date' | 'parity' | 'weanedPiglets' | 'createdAt'>;
|
|
1315
1316
|
}
|
|
1316
1317
|
declare class WeaningList extends Report implements PdfReport, CsvReport {
|
|
1317
1318
|
readonly template = "@pig-master/weaning-list";
|
|
1318
1319
|
fileName: string;
|
|
1319
1320
|
pdf(input: WeaningListInput): Promise<void>;
|
|
1320
1321
|
csv(input: WeaningListInput): Promise<void>;
|
|
1322
|
+
private getResources;
|
|
1323
|
+
private getParameters;
|
|
1321
1324
|
}
|
|
1322
1325
|
|
|
1323
1326
|
declare class PigMaster {
|
package/dist/index.js
CHANGED
|
@@ -2348,48 +2348,57 @@ var WeaningList = class extends Report {
|
|
|
2348
2348
|
}
|
|
2349
2349
|
async pdf(input) {
|
|
2350
2350
|
return this.requestPdf({
|
|
2351
|
-
resources:
|
|
2351
|
+
resources: this.getResources(input),
|
|
2352
2352
|
parameters: [
|
|
2353
|
-
|
|
2354
|
-
{ key: "
|
|
2355
|
-
{ key: "CALENDAR", value: input.calendarType },
|
|
2356
|
-
{ key: "PARITY", value: input.parity?.toString() ?? null },
|
|
2357
|
-
{ key: "ORIGIN_ID", value: input.originId },
|
|
2358
|
-
{ key: "BREED_ID", value: input.breedId },
|
|
2359
|
-
{ key: "BIRTH_PLACE_ID", value: input.birthPlaceId },
|
|
2360
|
-
{ key: "FEMALE_SWINE_ID", value: input.femaleSwineId },
|
|
2361
|
-
{
|
|
2362
|
-
key: "MATING_DATE_BEGIN",
|
|
2363
|
-
value: input.matingDateRange?.start ?? null
|
|
2364
|
-
},
|
|
2365
|
-
{ key: "MATING_DATE_END", value: input.matingDateRange?.end ?? null },
|
|
2366
|
-
{ key: "CONTEXT", value: input.context },
|
|
2367
|
-
{ key: "PIGLET_BATCH_ID", value: input.nurseryPigletBatchId }
|
|
2353
|
+
...this.getParameters(input),
|
|
2354
|
+
{ key: "DATA_ONLY", value: false }
|
|
2368
2355
|
]
|
|
2369
2356
|
});
|
|
2370
2357
|
}
|
|
2371
2358
|
async csv(input) {
|
|
2372
2359
|
return this.requestCsv({
|
|
2373
|
-
resources:
|
|
2360
|
+
resources: this.getResources(input),
|
|
2374
2361
|
parameters: [
|
|
2375
|
-
|
|
2376
|
-
{ key: "
|
|
2377
|
-
{ key: "CALENDAR", value: input.calendarType },
|
|
2378
|
-
{ key: "PARITY", value: input.parity?.toString() ?? null },
|
|
2379
|
-
{ key: "ORIGIN_ID", value: input.originId },
|
|
2380
|
-
{ key: "BREED_ID", value: input.breedId },
|
|
2381
|
-
{ key: "BIRTH_PLACE_ID", value: input.birthPlaceId },
|
|
2382
|
-
{ key: "FEMALE_SWINE_ID", value: input.femaleSwineId },
|
|
2383
|
-
{
|
|
2384
|
-
key: "MATING_DATE_BEGIN",
|
|
2385
|
-
value: input.matingDateRange?.start ?? null
|
|
2386
|
-
},
|
|
2387
|
-
{ key: "MATING_DATE_END", value: input.matingDateRange?.end ?? null },
|
|
2388
|
-
{ key: "CONTEXT", value: input.context },
|
|
2389
|
-
{ key: "PIGLET_BATCH_ID", value: input.nurseryPigletBatchId }
|
|
2362
|
+
...this.getParameters(input),
|
|
2363
|
+
{ key: "DATA_ONLY", value: true }
|
|
2390
2364
|
]
|
|
2391
2365
|
});
|
|
2392
2366
|
}
|
|
2367
|
+
getResources(input) {
|
|
2368
|
+
return [{ key: "FARM_ID", value: input.farmId }];
|
|
2369
|
+
}
|
|
2370
|
+
getParameters(input) {
|
|
2371
|
+
let orderByColumn = input.orderBy.column;
|
|
2372
|
+
switch (orderByColumn) {
|
|
2373
|
+
case "createdAt":
|
|
2374
|
+
orderByColumn = "created_at";
|
|
2375
|
+
break;
|
|
2376
|
+
case "weanedPiglets":
|
|
2377
|
+
orderByColumn = "weaned_piglets";
|
|
2378
|
+
break;
|
|
2379
|
+
default:
|
|
2380
|
+
break;
|
|
2381
|
+
}
|
|
2382
|
+
return [
|
|
2383
|
+
{ key: "DATE_BEGIN", value: input.dateRange?.start ?? null },
|
|
2384
|
+
{ key: "DATE_END", value: input.dateRange?.end ?? null },
|
|
2385
|
+
{ key: "CALENDAR", value: input.calendarType },
|
|
2386
|
+
{ key: "PARITY", value: input.parity?.toString() ?? null },
|
|
2387
|
+
{ key: "ORIGIN_ID", value: input.originId },
|
|
2388
|
+
{ key: "BREED_ID", value: input.breedId },
|
|
2389
|
+
{ key: "BIRTH_PLACE_ID", value: input.birthPlaceId },
|
|
2390
|
+
{ key: "FEMALE_SWINE_ID", value: input.femaleSwineId },
|
|
2391
|
+
{
|
|
2392
|
+
key: "MATING_DATE_BEGIN",
|
|
2393
|
+
value: input.matingDateRange?.start ?? null
|
|
2394
|
+
},
|
|
2395
|
+
{ key: "MATING_DATE_END", value: input.matingDateRange?.end ?? null },
|
|
2396
|
+
{ key: "CONTEXT", value: input.context },
|
|
2397
|
+
{ key: "PIGLET_BATCH_ID", value: input.nurseryPigletBatchId },
|
|
2398
|
+
{ key: "ORDERBYDIRECTION", value: input.orderBy.direction },
|
|
2399
|
+
{ key: "ORDERBYCOLUMN", value: orderByColumn }
|
|
2400
|
+
];
|
|
2401
|
+
}
|
|
2393
2402
|
};
|
|
2394
2403
|
|
|
2395
2404
|
// src/namespaces/pig-master/index.ts
|