vintrace-sdk 0.1.4 → 0.2.1
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/README.md +6 -1
- package/dist/index.cjs +241 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +671 -10
- package/dist/index.d.ts +671 -10
- package/dist/index.js +241 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -230,7 +230,7 @@ type VintraceResult<T> =
|
|
|
230
230
|
| Module | Status | Methods |
|
|
231
231
|
| ------------------- | ------- | ---------------------------------------- |
|
|
232
232
|
| Costs | Ready | `businessUnitTransactions` |
|
|
233
|
-
| Blocks |
|
|
233
|
+
| Blocks | Ready | `getAll`, `get`, `post`, `patch`, `createAssessment` |
|
|
234
234
|
| Assessments | Ready | `getAll` |
|
|
235
235
|
| Vineyards | Ready | `post` |
|
|
236
236
|
| MaturitySamples | Ready | `post` |
|
|
@@ -245,6 +245,11 @@ type VintraceResult<T> =
|
|
|
245
245
|
| Tirage | Ready | `get`, `patch` |
|
|
246
246
|
| BarrelsMovements | Ready | `post` |
|
|
247
247
|
| VesselDetailsReport | Ready | `get` |
|
|
248
|
+
| WineBatches | Ready | `getAll`, `post` |
|
|
249
|
+
| Documents | Ready | `attach` |
|
|
250
|
+
| Stock | Ready | `receive`, `getDispatches` |
|
|
251
|
+
| Vessels | Ready | `getBarrel`, `getBarrelGroup`, `getTank`, `getTankGroup`, `getTanker`, `getBin`, `createTank` |
|
|
252
|
+
| PurchaseOrders | Ready | `get`, `post` |
|
|
248
253
|
|
|
249
254
|
---
|
|
250
255
|
|
package/dist/index.cjs
CHANGED
|
@@ -359,10 +359,12 @@ async function batchFetch(ids, fetchFn) {
|
|
|
359
359
|
}
|
|
360
360
|
var ExtIdentifiableEntitySchema = zod.z.object({
|
|
361
361
|
id: zod.z.number().optional(),
|
|
362
|
-
extId: zod.z.string().optional()
|
|
362
|
+
extId: zod.z.string().optional(),
|
|
363
|
+
name: zod.z.string().optional()
|
|
363
364
|
});
|
|
364
365
|
var IdentifiableEntitySchema = zod.z.object({
|
|
365
|
-
id: zod.z.number().optional()
|
|
366
|
+
id: zod.z.number().optional(),
|
|
367
|
+
name: zod.z.string().optional()
|
|
366
368
|
});
|
|
367
369
|
var CodedIdentifiableEntitySchema = zod.z.object({
|
|
368
370
|
id: zod.z.number().optional(),
|
|
@@ -880,15 +882,94 @@ var PaginatedResponseSchema = (itemSchema) => zod.z.object({
|
|
|
880
882
|
last: zod.z.string().nullable().optional(),
|
|
881
883
|
results: zod.z.array(itemSchema).optional()
|
|
882
884
|
});
|
|
885
|
+
var VineyardIdentifiableEntitySchema = IdentifiableEntitySchema.extend({
|
|
886
|
+
name: zod.z.string(),
|
|
887
|
+
grower: ExtIdentifiableEntitySchema
|
|
888
|
+
});
|
|
889
|
+
var GradingSchema = zod.z.object({
|
|
890
|
+
id: zod.z.number().optional(),
|
|
891
|
+
value: zod.z.string().optional(),
|
|
892
|
+
scaleName: zod.z.string().optional(),
|
|
893
|
+
scaleId: zod.z.number().optional()
|
|
894
|
+
});
|
|
895
|
+
var BulkStockSchema = zod.z.object({
|
|
896
|
+
totalVolume: VolumeSchema.optional(),
|
|
897
|
+
equivalentVolume: VolumeSchema.optional(),
|
|
898
|
+
equivalentWeight: VolumeSchema.optional(),
|
|
899
|
+
compWeighting: zod.z.number().optional(),
|
|
900
|
+
percentageOfFruit: zod.z.number().optional(),
|
|
901
|
+
batchId: zod.z.number().optional(),
|
|
902
|
+
batchName: zod.z.string().optional(),
|
|
903
|
+
grading: GradingSchema.nullable().optional()
|
|
904
|
+
});
|
|
905
|
+
var FruitPlacementSchema = zod.z.object({
|
|
906
|
+
vintage: zod.z.string().optional(),
|
|
907
|
+
bulkStocks: zod.z.array(BulkStockSchema).optional()
|
|
908
|
+
});
|
|
883
909
|
var BlockDataSchema = zod.z.object({
|
|
884
910
|
id: zod.z.number(),
|
|
885
911
|
code: zod.z.string().optional(),
|
|
886
|
-
name: zod.z.string()
|
|
887
|
-
description: zod.z.string().optional(),
|
|
912
|
+
name: zod.z.string(),
|
|
888
913
|
extId: zod.z.string().optional(),
|
|
889
|
-
inactive: zod.z.boolean().optional()
|
|
914
|
+
inactive: zod.z.boolean().optional(),
|
|
915
|
+
description: zod.z.string().optional(),
|
|
916
|
+
rowNumbers: zod.z.string().optional(),
|
|
917
|
+
estate: zod.z.boolean().optional(),
|
|
918
|
+
grower: ExtIdentifiableEntitySchema.optional(),
|
|
919
|
+
vineyard: VineyardIdentifiableEntitySchema.optional(),
|
|
920
|
+
region: IdentifiableEntitySchema.optional(),
|
|
921
|
+
subRegion: IdentifiableEntitySchema.optional(),
|
|
922
|
+
variety: IdentifiableEntitySchema.optional(),
|
|
923
|
+
intendedUse: IdentifiableEntitySchema.optional(),
|
|
924
|
+
grading: GradingSchema.nullable().optional(),
|
|
925
|
+
fruitPlacement: FruitPlacementSchema.optional()
|
|
890
926
|
});
|
|
891
927
|
var GetBlocksSuccessResponseSchema = PaginatedResponseSchema(BlockDataSchema);
|
|
928
|
+
var BlockSchema = ExtIdentifiableEntitySchema.extend({
|
|
929
|
+
extId: zod.z.string(),
|
|
930
|
+
name: zod.z.string(),
|
|
931
|
+
estate: zod.z.boolean().optional(),
|
|
932
|
+
vineyard: VineyardIdentifiableEntitySchema,
|
|
933
|
+
variety: IdentifiableEntitySchema,
|
|
934
|
+
countyCode: zod.z.string().optional(),
|
|
935
|
+
inactive: zod.z.boolean().optional(),
|
|
936
|
+
noOfVines: zod.z.number().optional(),
|
|
937
|
+
area: zod.z.number().optional(),
|
|
938
|
+
rootStock: IdentifiableEntitySchema.optional(),
|
|
939
|
+
clone: IdentifiableEntitySchema.optional(),
|
|
940
|
+
vineSpacing: zod.z.string().optional(),
|
|
941
|
+
rowSpacing: zod.z.string().optional(),
|
|
942
|
+
soilProfile: zod.z.string().optional(),
|
|
943
|
+
trellis: IdentifiableEntitySchema.optional(),
|
|
944
|
+
aspect: zod.z.string().optional(),
|
|
945
|
+
plantedTime: zod.z.number().optional(),
|
|
946
|
+
pruningType: zod.z.string().optional(),
|
|
947
|
+
averageGradient: zod.z.number().optional(),
|
|
948
|
+
irrigationType: zod.z.string().optional(),
|
|
949
|
+
frostProtection: zod.z.string().optional(),
|
|
950
|
+
organic: zod.z.boolean().optional(),
|
|
951
|
+
organicCertifiedTime: zod.z.number().optional(),
|
|
952
|
+
township: zod.z.string().optional(),
|
|
953
|
+
range: zod.z.string().optional(),
|
|
954
|
+
section: zod.z.string().optional(),
|
|
955
|
+
emitterRate: zod.z.number().optional(),
|
|
956
|
+
emitterSize: zod.z.string().optional(),
|
|
957
|
+
siteId: zod.z.string().optional(),
|
|
958
|
+
noOfRows: zod.z.number().optional(),
|
|
959
|
+
districtCode: zod.z.string().optional(),
|
|
960
|
+
regionalAdminCode: zod.z.string().optional(),
|
|
961
|
+
comments: zod.z.string().optional(),
|
|
962
|
+
code: zod.z.string().optional(),
|
|
963
|
+
defaultHarvestMethod: zod.z.string().optional(),
|
|
964
|
+
description: zod.z.string().optional(),
|
|
965
|
+
graftedDate: zod.z.number().optional(),
|
|
966
|
+
intendedUse: IdentifiableEntitySchema.optional(),
|
|
967
|
+
rowNumbers: zod.z.string().optional(),
|
|
968
|
+
vineStructure: IdentifiableEntitySchema.optional()
|
|
969
|
+
});
|
|
970
|
+
var BlockResponseSchema = zod.z.object({
|
|
971
|
+
data: BlockSchema
|
|
972
|
+
});
|
|
892
973
|
var V6PaginatedResponseSchema = zod.z.object({
|
|
893
974
|
totalResultCount: zod.z.number().optional(),
|
|
894
975
|
firstResult: zod.z.number().optional(),
|
|
@@ -918,7 +999,7 @@ var WinerySchema = zod.z.object({
|
|
|
918
999
|
name: zod.z.string().optional(),
|
|
919
1000
|
businessUnit: zod.z.string().optional()
|
|
920
1001
|
});
|
|
921
|
-
var
|
|
1002
|
+
var VesselGradingSchema = zod.z.object({
|
|
922
1003
|
scaleId: zod.z.number().optional(),
|
|
923
1004
|
scaleName: zod.z.string().optional(),
|
|
924
1005
|
valueId: zod.z.number().optional(),
|
|
@@ -935,7 +1016,7 @@ var WineBatchDetailsSchema = zod.z.object({
|
|
|
935
1016
|
program: zod.z.string().optional(),
|
|
936
1017
|
productCategory: CodedIdentifiableEntitySchema.optional(),
|
|
937
1018
|
designatedProduct: CodedIdentifiableEntitySchema.optional(),
|
|
938
|
-
grading:
|
|
1019
|
+
grading: VesselGradingSchema.optional()
|
|
939
1020
|
});
|
|
940
1021
|
var ProductStateSchema = zod.z.object({
|
|
941
1022
|
id: zod.z.number().optional(),
|
|
@@ -1337,6 +1418,99 @@ zod.z.object({
|
|
|
1337
1418
|
status: zod.z.string().optional(),
|
|
1338
1419
|
message: zod.z.string().optional()
|
|
1339
1420
|
});
|
|
1421
|
+
var PurchaseOrderStateEnum = zod.z.enum(["NEW", "APPROVED"]);
|
|
1422
|
+
var FulfillmentEnum = zod.z.enum(["NOT_FULFILLED", "PART_FULFILLED", "FULFILLED", "OVER_FULFILLED"]);
|
|
1423
|
+
var TaxPolicyEnum = zod.z.enum(["TAX_INCLUSIVE", "TAX_EXCLUSIVE", "NO_TAX"]);
|
|
1424
|
+
var PurchaseOrderLineTypeEnum = zod.z.enum(["GENERAL", "ADHOC", "WINE_BATCH", "STOCK"]);
|
|
1425
|
+
var PurchaseOrderLineSchema = zod.z.object({
|
|
1426
|
+
id: zod.z.number(),
|
|
1427
|
+
type: PurchaseOrderLineTypeEnum,
|
|
1428
|
+
lineNumber: zod.z.string().nullable().optional(),
|
|
1429
|
+
itemCode: zod.z.string().nullable().optional(),
|
|
1430
|
+
vendorCode: zod.z.string().nullable().optional(),
|
|
1431
|
+
description: zod.z.string().nullable().optional(),
|
|
1432
|
+
itemName: zod.z.string().optional(),
|
|
1433
|
+
unitPrice: zod.z.number().optional(),
|
|
1434
|
+
totalPrice: zod.z.number().optional(),
|
|
1435
|
+
taxable: zod.z.boolean().optional(),
|
|
1436
|
+
quantityOrdered: MeasurementSchema.optional(),
|
|
1437
|
+
quantityFulfilled: MeasurementSchema.optional()
|
|
1438
|
+
});
|
|
1439
|
+
var PurchaseOrderSchema = zod.z.object({
|
|
1440
|
+
id: zod.z.number(),
|
|
1441
|
+
name: zod.z.string(),
|
|
1442
|
+
state: PurchaseOrderStateEnum.optional(),
|
|
1443
|
+
fulfillment: FulfillmentEnum.optional(),
|
|
1444
|
+
taxPolicy: TaxPolicyEnum.optional(),
|
|
1445
|
+
freightCost: zod.z.number().nullable().optional(),
|
|
1446
|
+
inactive: zod.z.boolean().optional(),
|
|
1447
|
+
vendor: ExtIdentifiableEntitySchema.optional(),
|
|
1448
|
+
vendorReference: zod.z.string().nullable().optional(),
|
|
1449
|
+
deliverBy: zod.z.number().nullable().optional(),
|
|
1450
|
+
notes: zod.z.string().nullable().optional(),
|
|
1451
|
+
winery: zod.z.object({
|
|
1452
|
+
id: zod.z.number().optional(),
|
|
1453
|
+
name: zod.z.string().optional(),
|
|
1454
|
+
businessUnit: zod.z.string().nullable().optional()
|
|
1455
|
+
}).optional(),
|
|
1456
|
+
lines: PurchaseOrderLineSchema.array().optional()
|
|
1457
|
+
});
|
|
1458
|
+
var PurchaseOrderResponseSchema = zod.z.object({
|
|
1459
|
+
data: PurchaseOrderSchema
|
|
1460
|
+
});
|
|
1461
|
+
var FractionTypeEnum = zod.z.enum([
|
|
1462
|
+
"FREE_RUN",
|
|
1463
|
+
"PRESSINGS",
|
|
1464
|
+
"MUST",
|
|
1465
|
+
"LEES",
|
|
1466
|
+
"UNKNOWN",
|
|
1467
|
+
"COMBINED",
|
|
1468
|
+
"CONDENSATE",
|
|
1469
|
+
"PRESSINGS_LIGHT",
|
|
1470
|
+
"PRESSINGS_HEAVY",
|
|
1471
|
+
"DRAININGS",
|
|
1472
|
+
"PRESSINGS_OVERNIGHT",
|
|
1473
|
+
"SAIGNEE"
|
|
1474
|
+
]);
|
|
1475
|
+
var WineBatchVesselSchema = zod.z.object({
|
|
1476
|
+
id: zod.z.number().optional(),
|
|
1477
|
+
name: zod.z.string().optional(),
|
|
1478
|
+
type: zod.z.enum(["TANK", "BIN", "BARREL", "BARREL_GROUP", "BIN_GROUP", "PRESS", "TANKER"]).optional(),
|
|
1479
|
+
amount: MeasurementSchema.optional()
|
|
1480
|
+
});
|
|
1481
|
+
var WineBatchDataSchema = zod.z.object({
|
|
1482
|
+
id: zod.z.number().optional(),
|
|
1483
|
+
batchCode: zod.z.string().optional(),
|
|
1484
|
+
batchNumber: zod.z.string().optional(),
|
|
1485
|
+
description: zod.z.string().optional(),
|
|
1486
|
+
productionYear: zod.z.number().optional(),
|
|
1487
|
+
owner: ExtIdentifiableEntitySchema.optional(),
|
|
1488
|
+
grading: VesselGradingSchema.optional(),
|
|
1489
|
+
program: IdentifiableEntitySchema.optional(),
|
|
1490
|
+
designatedRegion: IdentifiableEntitySchema.optional(),
|
|
1491
|
+
designatedSubRegion: IdentifiableEntitySchema.optional(),
|
|
1492
|
+
designatedVariety: IdentifiableEntitySchema.optional(),
|
|
1493
|
+
winery: WinerySchema.optional(),
|
|
1494
|
+
category: IdentifiableEntitySchema.optional(),
|
|
1495
|
+
designatedProduct: IdentifiableEntitySchema.optional(),
|
|
1496
|
+
costsTrackedPercentage: zod.z.number().optional(),
|
|
1497
|
+
ageOfSpirits: zod.z.string().optional(),
|
|
1498
|
+
serviceOrder: IdentifiableEntitySchema.optional(),
|
|
1499
|
+
fractionType: FractionTypeEnum.optional(),
|
|
1500
|
+
inactive: zod.z.boolean().optional(),
|
|
1501
|
+
vessels: zod.z.array(WineBatchVesselSchema).optional(),
|
|
1502
|
+
allocations: zod.z.array(AllocationSliceSchema).optional()
|
|
1503
|
+
});
|
|
1504
|
+
var GetWineBatchSuccessResponseSchema = PaginatedResponseSchema(WineBatchDataSchema);
|
|
1505
|
+
var CreateWineBatchSuccessResponseSchema = zod.z.object({
|
|
1506
|
+
data: WineBatchDataSchema.optional()
|
|
1507
|
+
});
|
|
1508
|
+
var CreateWineBatchRequestSchema = WineBatchDataSchema.extend({
|
|
1509
|
+
batchCode: zod.z.string(),
|
|
1510
|
+
productionYear: zod.z.number(),
|
|
1511
|
+
winery: WinerySchema,
|
|
1512
|
+
owner: ExtIdentifiableEntitySchema
|
|
1513
|
+
});
|
|
1340
1514
|
|
|
1341
1515
|
// src/client/VintraceClient.ts
|
|
1342
1516
|
var VintraceClient = class {
|
|
@@ -1373,7 +1547,9 @@ var VintraceClient = class {
|
|
|
1373
1547
|
timeout: options?.timeout ?? this.options.timeout,
|
|
1374
1548
|
maxRetries: options?.maxRetries ?? this.options.maxRetries,
|
|
1375
1549
|
validateRequest: options?.validateRequest ?? this.options.validateRequests,
|
|
1376
|
-
validateResponse: options?.validateResponse ?? this.options.validateResponses
|
|
1550
|
+
validateResponse: options?.validateResponse ?? this.options.validateResponses,
|
|
1551
|
+
responseSchema: options?.responseSchema,
|
|
1552
|
+
requestSchema: options?.requestSchema
|
|
1377
1553
|
},
|
|
1378
1554
|
body
|
|
1379
1555
|
);
|
|
@@ -1941,12 +2117,17 @@ var BlocksClient = class {
|
|
|
1941
2117
|
* API consumer can use the include and vintage query params to request including more information in the response.
|
|
1942
2118
|
*/
|
|
1943
2119
|
async getAll(params) {
|
|
1944
|
-
const limit = params?.limit
|
|
2120
|
+
const limit = params?.limit ?? 100;
|
|
2121
|
+
const queryParams = { limit: String(limit), offset: "0" };
|
|
2122
|
+
if (params?.include) queryParams.include = params.include;
|
|
2123
|
+
if (params?.vintage) queryParams.vintage = params.vintage;
|
|
2124
|
+
if (params?.VintraceEntityIds) queryParams.VintraceEntityIds = params.VintraceEntityIds;
|
|
2125
|
+
if (params?.offset) queryParams.offset = String(params.offset);
|
|
1945
2126
|
const firstResponse = await this.client.request(
|
|
1946
2127
|
"v7/harvest/blocks",
|
|
1947
2128
|
"GET",
|
|
1948
2129
|
{ responseSchema: GetBlocksSuccessResponseSchema },
|
|
1949
|
-
|
|
2130
|
+
queryParams
|
|
1950
2131
|
);
|
|
1951
2132
|
if (firstResponse[1]) {
|
|
1952
2133
|
return [null, firstResponse[1]];
|
|
@@ -1966,13 +2147,14 @@ var BlocksClient = class {
|
|
|
1966
2147
|
const batchSize = Math.min(parallelLimit, pagesNeeded - i);
|
|
1967
2148
|
const batchPromises = [];
|
|
1968
2149
|
for (let j = 0; j < batchSize; j++) {
|
|
1969
|
-
const
|
|
2150
|
+
const pageOffset = (i + j) * limit;
|
|
2151
|
+
const pageParams = { ...queryParams, offset: String(pageOffset) };
|
|
1970
2152
|
batchPromises.push(
|
|
1971
2153
|
this.client.request(
|
|
1972
2154
|
"v7/harvest/blocks",
|
|
1973
2155
|
"GET",
|
|
1974
2156
|
{ responseSchema: GetBlocksSuccessResponseSchema },
|
|
1975
|
-
|
|
2157
|
+
pageParams
|
|
1976
2158
|
)
|
|
1977
2159
|
);
|
|
1978
2160
|
}
|
|
@@ -1988,14 +2170,22 @@ var BlocksClient = class {
|
|
|
1988
2170
|
}
|
|
1989
2171
|
return [allResults, null];
|
|
1990
2172
|
}
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
post(data) {
|
|
1998
|
-
|
|
2173
|
+
/**
|
|
2174
|
+
* Upsert block data into system.
|
|
2175
|
+
*
|
|
2176
|
+
* Create or update block data in the system. Provide a Block object in `data`.
|
|
2177
|
+
* Example fields: `extId`, `name`, `estate`, `vineyard`, `variety`, `area`.
|
|
2178
|
+
*/
|
|
2179
|
+
async post(data) {
|
|
2180
|
+
const [response, error] = await this.client.request(
|
|
2181
|
+
"v7/harvest/blocks",
|
|
2182
|
+
"POST",
|
|
2183
|
+
{ responseSchema: BlockResponseSchema },
|
|
2184
|
+
data
|
|
2185
|
+
);
|
|
2186
|
+
if (error) return [null, error];
|
|
2187
|
+
if (!response?.data) return [null, null];
|
|
2188
|
+
return [response.data, null];
|
|
1999
2189
|
}
|
|
2000
2190
|
patch(id, data) {
|
|
2001
2191
|
return this.client.request(`v7/harvest/blocks/${id}`, "PATCH", {}, data);
|
|
@@ -2174,11 +2364,17 @@ var WineBatchesClient = class {
|
|
|
2174
2364
|
*/
|
|
2175
2365
|
async getAll(params) {
|
|
2176
2366
|
const limit = params?.limit ?? 100;
|
|
2367
|
+
const queryParams = {
|
|
2368
|
+
limit: String(limit),
|
|
2369
|
+
offset: String(params?.offset ?? 0)
|
|
2370
|
+
};
|
|
2371
|
+
if (params?.ids) queryParams.ids = params.ids;
|
|
2372
|
+
if (params?.include) queryParams.include = params.include;
|
|
2177
2373
|
const firstResponse = await this.client.request(
|
|
2178
2374
|
"v7/operation/wine-batches",
|
|
2179
2375
|
"GET",
|
|
2180
|
-
{},
|
|
2181
|
-
|
|
2376
|
+
{ responseSchema: GetWineBatchSuccessResponseSchema },
|
|
2377
|
+
queryParams
|
|
2182
2378
|
);
|
|
2183
2379
|
if (firstResponse[1]) {
|
|
2184
2380
|
return [null, firstResponse[1]];
|
|
@@ -2198,13 +2394,13 @@ var WineBatchesClient = class {
|
|
|
2198
2394
|
const batchSize = Math.min(parallelLimit, pagesNeeded - i);
|
|
2199
2395
|
const batchPromises = [];
|
|
2200
2396
|
for (let j = 0; j < batchSize; j++) {
|
|
2201
|
-
const
|
|
2397
|
+
const pageOffset = (i + j) * limit;
|
|
2202
2398
|
batchPromises.push(
|
|
2203
2399
|
this.client.request(
|
|
2204
2400
|
"v7/operation/wine-batches",
|
|
2205
2401
|
"GET",
|
|
2206
|
-
{},
|
|
2207
|
-
{ ...
|
|
2402
|
+
{ responseSchema: GetWineBatchSuccessResponseSchema },
|
|
2403
|
+
{ ...queryParams, offset: String(pageOffset) }
|
|
2208
2404
|
)
|
|
2209
2405
|
);
|
|
2210
2406
|
}
|
|
@@ -2213,9 +2409,8 @@ var WineBatchesClient = class {
|
|
|
2213
2409
|
if (pageError) {
|
|
2214
2410
|
return [null, pageError];
|
|
2215
2411
|
}
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
allResults.push(...pData.results);
|
|
2412
|
+
if (pageData?.results) {
|
|
2413
|
+
allResults.push(...pageData.results);
|
|
2219
2414
|
}
|
|
2220
2415
|
}
|
|
2221
2416
|
}
|
|
@@ -2225,7 +2420,15 @@ var WineBatchesClient = class {
|
|
|
2225
2420
|
* Create a wine batch.
|
|
2226
2421
|
*/
|
|
2227
2422
|
create(data) {
|
|
2228
|
-
return this.client.request(
|
|
2423
|
+
return this.client.request(
|
|
2424
|
+
"v7/operation/wine-batches",
|
|
2425
|
+
"POST",
|
|
2426
|
+
{
|
|
2427
|
+
responseSchema: CreateWineBatchSuccessResponseSchema,
|
|
2428
|
+
requestSchema: CreateWineBatchRequestSchema
|
|
2429
|
+
},
|
|
2430
|
+
data
|
|
2431
|
+
);
|
|
2229
2432
|
}
|
|
2230
2433
|
};
|
|
2231
2434
|
var TirageClient = class {
|
|
@@ -2440,8 +2643,15 @@ var PurchaseOrdersClient = class {
|
|
|
2440
2643
|
/**
|
|
2441
2644
|
* Get purchase order details by id.
|
|
2442
2645
|
*/
|
|
2443
|
-
get(id) {
|
|
2444
|
-
|
|
2646
|
+
async get(id) {
|
|
2647
|
+
const [response, error] = await this.client.request(
|
|
2648
|
+
`v7/account/purchase-orders/${id}`,
|
|
2649
|
+
"GET",
|
|
2650
|
+
{ responseSchema: PurchaseOrderResponseSchema }
|
|
2651
|
+
);
|
|
2652
|
+
if (error) return [null, error];
|
|
2653
|
+
if (!response?.data) return [null, null];
|
|
2654
|
+
return [response.data, null];
|
|
2445
2655
|
}
|
|
2446
2656
|
};
|
|
2447
2657
|
var TransactionsClient = class {
|