vintrace-sdk 0.1.3 → 0.1.4

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.cjs CHANGED
@@ -983,6 +983,12 @@ var LiveMetricSchema = zod.z.object({
983
983
  value: zod.z.number().optional(),
984
984
  interfaceMappedName: zod.z.string().optional()
985
985
  });
986
+ var AnalysisResultSchema = zod.z.object({
987
+ name: zod.z.string(),
988
+ value: zod.z.number().nullable().optional(),
989
+ interfaceMappedName: zod.z.string().nullable().optional(),
990
+ nonNumericValue: zod.z.string().nullable().optional()
991
+ });
986
992
  var SparklingInfoSchema = zod.z.object({
987
993
  state: zod.z.string().optional()
988
994
  });
@@ -1116,13 +1122,13 @@ var BlockAssessmentOverviewSchema = zod.z.object({
1116
1122
  blockName: zod.z.string().optional(),
1117
1123
  variety: zod.z.string().optional()
1118
1124
  });
1119
- var GetAssessmentsResponseSchema = PaginatedResponseSchema(BlockAssessmentOverviewSchema);
1125
+ PaginatedResponseSchema(BlockAssessmentOverviewSchema);
1120
1126
  var VineyardSchema = zod.z.object({
1121
1127
  id: zod.z.number().optional(),
1122
1128
  name: zod.z.string().optional(),
1123
1129
  grower: ExtIdentifiableEntitySchema.optional()
1124
1130
  });
1125
- var VineyardResponseSchema = zod.z.object({
1131
+ zod.z.object({
1126
1132
  data: VineyardSchema.optional()
1127
1133
  });
1128
1134
  var MaturitySampleSchema = zod.z.object({
@@ -1138,7 +1144,7 @@ var MaturitySampleSchema = zod.z.object({
1138
1144
  ta: zod.z.number().optional(),
1139
1145
  grade: zod.z.string().optional()
1140
1146
  });
1141
- var MaturitySampleResponseSchema = zod.z.object({
1147
+ zod.z.object({
1142
1148
  data: MaturitySampleSchema.optional()
1143
1149
  });
1144
1150
  var PartyV7Schema = zod.z.object({
@@ -1151,7 +1157,7 @@ var PartyV7Schema = zod.z.object({
1151
1157
  isOrganization: zod.z.boolean().optional(),
1152
1158
  address: AddressSchema.optional()
1153
1159
  });
1154
- var GetPartiesV7ResponseSchema = PaginatedResponseSchema(PartyV7Schema);
1160
+ PaginatedResponseSchema(PartyV7Schema);
1155
1161
  var ShipmentDestinationSchema = zod.z.object({
1156
1162
  name: zod.z.string().optional(),
1157
1163
  address: AddressSchema.optional()
@@ -1171,7 +1177,7 @@ var ShipmentDataSchema = zod.z.object({
1171
1177
  destination: ShipmentDestinationSchema.optional(),
1172
1178
  wineDetails: ShipmentWineDetailsSchema.array().optional()
1173
1179
  });
1174
- var GetShipmentsSuccessResponseSchema = PaginatedResponseSchema(ShipmentDataSchema);
1180
+ PaginatedResponseSchema(ShipmentDataSchema);
1175
1181
  var BarrelTreatmentTypeSchema = zod.z.object({
1176
1182
  id: zod.z.number().optional(),
1177
1183
  name: zod.z.string().optional(),
@@ -1189,7 +1195,7 @@ var BarrelTreatmentDataSchema = zod.z.object({
1189
1195
  treatment: BarrelTreatmentTypeSchema.optional(),
1190
1196
  barrels: ShipmentBarrelDetailsSchema.array().optional()
1191
1197
  });
1192
- var GetBarrelTreatmentsSuccessResponseSchema = PaginatedResponseSchema(BarrelTreatmentDataSchema);
1198
+ PaginatedResponseSchema(BarrelTreatmentDataSchema);
1193
1199
  var FruitIntakeSchema = zod.z.object({
1194
1200
  id: zod.z.number().optional(),
1195
1201
  intakeDate: zod.z.number().optional(),
@@ -1214,13 +1220,20 @@ var CreateFruitIntakeSuccessResponseSchema = zod.z.object({
1214
1220
  data: FruitIntakeSchema.optional()
1215
1221
  });
1216
1222
  var UpdateFruitIntakePricingSchema = zod.z.object({
1217
- pricePerTon: zod.z.number().optional(),
1218
- pricePerKg: zod.z.number().optional(),
1219
- bypassed: zod.z.boolean().optional()
1223
+ gross: MeasurementSchema.optional(),
1224
+ tare: MeasurementSchema.optional(),
1225
+ net: MeasurementSchema.optional(),
1226
+ unitPrice: MeasurementSchema.optional()
1220
1227
  });
1221
1228
  var UpdateFruitIntakePricingResponseSchema = zod.z.object({
1222
1229
  data: UpdateFruitIntakePricingSchema.optional()
1223
1230
  });
1231
+ var UpdateMetricsSchema = zod.z.object({
1232
+ metrics: zod.z.array(AnalysisResultSchema).optional()
1233
+ });
1234
+ var UpdateMetricsResponseSchema = zod.z.object({
1235
+ data: UpdateMetricsSchema.optional()
1236
+ });
1224
1237
  var BulkIntakeSchema = zod.z.object({
1225
1238
  id: zod.z.number().optional(),
1226
1239
  code: zod.z.string().optional(),
@@ -1232,7 +1245,7 @@ var BulkIntakeSchema = zod.z.object({
1232
1245
  volume: MeasurementSchema.optional(),
1233
1246
  status: zod.z.string().optional()
1234
1247
  });
1235
- var GetBulkIntakesSuccessResponseSchema = PaginatedResponseSchema(BulkIntakeSchema);
1248
+ PaginatedResponseSchema(BulkIntakeSchema);
1236
1249
  var TrialBlendSchema = zod.z.object({
1237
1250
  id: zod.z.number().optional(),
1238
1251
  name: zod.z.string().optional(),
@@ -1250,7 +1263,7 @@ var TrialBlendSchema = zod.z.object({
1250
1263
  })
1251
1264
  ).optional()
1252
1265
  });
1253
- var GetTrialBlendsSuccessResponseSchema = PaginatedResponseSchema(TrialBlendSchema);
1266
+ PaginatedResponseSchema(TrialBlendSchema);
1254
1267
  var WorkOrderV7Schema = zod.z.object({
1255
1268
  id: zod.z.number().optional(),
1256
1269
  code: zod.z.string().optional(),
@@ -1261,7 +1274,7 @@ var WorkOrderV7Schema = zod.z.object({
1261
1274
  assignedTo: zod.z.string().optional(),
1262
1275
  summary: zod.z.string().optional()
1263
1276
  });
1264
- var GetWorkOrdersV7ResponseSchema = PaginatedResponseSchema(WorkOrderV7Schema);
1277
+ PaginatedResponseSchema(WorkOrderV7Schema);
1265
1278
  var TirageSourceWineDetailsSchema = zod.z.object({
1266
1279
  productId: zod.z.number().optional(),
1267
1280
  productName: zod.z.string().optional(),
@@ -1426,39 +1439,12 @@ var VintraceV7Api = class {
1426
1439
  get blocks() {
1427
1440
  return this._blocks ?? (this._blocks = new BlocksClient(this.client));
1428
1441
  }
1429
- get assessments() {
1430
- return this._assessments ?? (this._assessments = new AssessmentsClient(this.client));
1431
- }
1432
- get vineyards() {
1433
- return this._vineyards ?? (this._vineyards = new VineyardsClient(this.client));
1434
- }
1435
- get maturitySamples() {
1436
- return this._maturitySamples ?? (this._maturitySamples = new MaturitySamplesClient(this.client));
1437
- }
1438
- get parties() {
1439
- return this._parties ?? (this._parties = new PartiesV7Client(this.client));
1440
- }
1441
- get shipments() {
1442
- return this._shipments ?? (this._shipments = new ShipmentsClient(this.client));
1443
- }
1444
- get barrelTreatments() {
1445
- return this._barrelTreatments ?? (this._barrelTreatments = new BarrelTreatmentsClient(this.client));
1446
- }
1447
1442
  get bookings() {
1448
1443
  return this._bookings ?? (this._bookings = new BookingsClient(this.client));
1449
1444
  }
1450
1445
  get fruitIntakes() {
1451
1446
  return this._fruitIntakes ?? (this._fruitIntakes = new FruitIntakesClient(this.client));
1452
1447
  }
1453
- get bulkIntakes() {
1454
- return this._bulkIntakes ?? (this._bulkIntakes = new BulkIntakesClient(this.client));
1455
- }
1456
- get trialBlends() {
1457
- return this._trialBlends ?? (this._trialBlends = new TrialBlendsClient(this.client));
1458
- }
1459
- get workOrders() {
1460
- return this._workOrders ?? (this._workOrders = new WorkOrdersV7Client(this.client));
1461
- }
1462
1448
  get tirage() {
1463
1449
  return this._tirage ?? (this._tirage = new TirageClient(this.client));
1464
1450
  }
@@ -1468,6 +1454,21 @@ var VintraceV7Api = class {
1468
1454
  get vesselDetailsReport() {
1469
1455
  return this._vesselDetailsReport ?? (this._vesselDetailsReport = new VesselDetailsReportClient(this.client));
1470
1456
  }
1457
+ get wineBatches() {
1458
+ return this._wineBatches ?? (this._wineBatches = new WineBatchesClient(this.client));
1459
+ }
1460
+ get documents() {
1461
+ return this._documents ?? (this._documents = new DocumentsClient(this.client));
1462
+ }
1463
+ get stock() {
1464
+ return this._stock ?? (this._stock = new StockClient(this.client));
1465
+ }
1466
+ get vessels() {
1467
+ return this._vessels ?? (this._vessels = new VesselsClient(this.client));
1468
+ }
1469
+ get purchaseOrders() {
1470
+ return this._purchaseOrders ?? (this._purchaseOrders = new PurchaseOrdersClient(this.client));
1471
+ }
1471
1472
  };
1472
1473
  var WorkOrdersClient = class {
1473
1474
  constructor(client) {
@@ -1999,6 +2000,19 @@ var BlocksClient = class {
1999
2000
  patch(id, data) {
2000
2001
  return this.client.request(`v7/harvest/blocks/${id}`, "PATCH", {}, data);
2001
2002
  }
2003
+ /**
2004
+ * Upsert assessment data for a block.
2005
+ *
2006
+ * Create or update assessment data for a block by its blockId.
2007
+ */
2008
+ createAssessment(blockId, data) {
2009
+ return this.client.request(
2010
+ `v7/harvest/blocks/${blockId}/assessments`,
2011
+ "POST",
2012
+ {},
2013
+ data
2014
+ );
2015
+ }
2002
2016
  };
2003
2017
  var BookingsClient = class {
2004
2018
  constructor(client) {
@@ -2149,22 +2163,22 @@ var CostsClient = class {
2149
2163
  return [allResults, null];
2150
2164
  }
2151
2165
  };
2152
- var AssessmentsClient = class {
2166
+ var WineBatchesClient = class {
2153
2167
  constructor(client) {
2154
2168
  this.client = client;
2155
2169
  }
2156
2170
  /**
2157
- * Get all assessments.
2171
+ * Get a list of wine batches.
2158
2172
  *
2159
- * Returns a paginated list of block assessments.
2173
+ * Returns a paginated list of wine batches.
2160
2174
  */
2161
2175
  async getAll(params) {
2162
2176
  const limit = params?.limit ?? 100;
2163
2177
  const firstResponse = await this.client.request(
2164
- "v7/harvest/assessments",
2178
+ "v7/operation/wine-batches",
2165
2179
  "GET",
2166
- { responseSchema: GetAssessmentsResponseSchema },
2167
- { limit: String(limit), offset: String(params?.offset ?? 0) }
2180
+ {},
2181
+ { ...params, limit: String(limit), offset: String(params?.offset ?? 0) }
2168
2182
  );
2169
2183
  if (firstResponse[1]) {
2170
2184
  return [null, firstResponse[1]];
@@ -2187,10 +2201,10 @@ var AssessmentsClient = class {
2187
2201
  const offset = (i + j) * limit;
2188
2202
  batchPromises.push(
2189
2203
  this.client.request(
2190
- "v7/harvest/assessments",
2204
+ "v7/operation/wine-batches",
2191
2205
  "GET",
2192
- { responseSchema: GetAssessmentsResponseSchema },
2193
- { limit: String(limit), offset: String(offset) }
2206
+ {},
2207
+ { ...params, limit: String(limit), offset: String(offset) }
2194
2208
  )
2195
2209
  );
2196
2210
  }
@@ -2199,237 +2213,67 @@ var AssessmentsClient = class {
2199
2213
  if (pageError) {
2200
2214
  return [null, pageError];
2201
2215
  }
2202
- if (pageData?.results) {
2203
- allResults.push(...pageData.results);
2216
+ const pData = pageData;
2217
+ if (pData?.results) {
2218
+ allResults.push(...pData.results);
2204
2219
  }
2205
2220
  }
2206
2221
  }
2207
2222
  return [allResults, null];
2208
2223
  }
2224
+ /**
2225
+ * Create a wine batch.
2226
+ */
2227
+ create(data) {
2228
+ return this.client.request("v7/operation/wine-batches", "POST", {}, data);
2229
+ }
2209
2230
  };
2210
- var VineyardsClient = class {
2231
+ var TirageClient = class {
2211
2232
  constructor(client) {
2212
2233
  this.client = client;
2213
2234
  }
2214
2235
  /**
2215
- * Create a vineyard.
2236
+ * Get a tirage by operation ID.
2216
2237
  *
2217
- * Creates a new vineyard in the system.
2238
+ * Returns a single tirage by its operation ID.
2218
2239
  */
2219
- post(data) {
2220
- return this.client.request(
2221
- "v7/harvest/vineyards",
2222
- "POST",
2223
- { responseSchema: VineyardResponseSchema },
2224
- data
2225
- );
2226
- }
2227
- };
2228
- var MaturitySamplesClient = class {
2229
- constructor(client) {
2230
- this.client = client;
2240
+ get(operationId) {
2241
+ return this.client.request(`v7/operation/tirage/${operationId}`, "GET", {
2242
+ responseSchema: TirageSuccessResponseSchema
2243
+ });
2231
2244
  }
2232
2245
  /**
2233
- * Create a maturity sample.
2246
+ * Patch a tirage.
2234
2247
  *
2235
- * Creates a new maturity sample in the system.
2248
+ * Updates a tirage record.
2236
2249
  */
2237
- post(data) {
2250
+ patch(operationId, data) {
2238
2251
  return this.client.request(
2239
- "v7/harvest/maturity-samples",
2240
- "POST",
2241
- { responseSchema: MaturitySampleResponseSchema },
2252
+ `v7/operation/tirage/${operationId}`,
2253
+ "PATCH",
2254
+ { responseSchema: TirageSuccessResponseSchema },
2242
2255
  data
2243
2256
  );
2244
2257
  }
2245
2258
  };
2246
- var PartiesV7Client = class {
2259
+ var BarrelsMovementsClient = class {
2247
2260
  constructor(client) {
2248
2261
  this.client = client;
2249
2262
  }
2250
2263
  /**
2251
- * List all parties.
2252
- *
2253
- * Returns a paginated list of parties.
2254
- */
2255
- async getAll(params) {
2256
- const limit = params?.limit ?? 100;
2257
- const firstResponse = await this.client.request(
2258
- "v7/identity/parties",
2259
- "GET",
2260
- { responseSchema: GetPartiesV7ResponseSchema },
2261
- { limit: String(limit), offset: String(params?.offset ?? 0) }
2262
- );
2263
- if (firstResponse[1]) {
2264
- return [null, firstResponse[1]];
2265
- }
2266
- const response = firstResponse[0];
2267
- if (!response) {
2268
- return [[], null];
2269
- }
2270
- const totalCount = response.totalResults ?? response.results?.length ?? 0;
2271
- if (totalCount <= limit) {
2272
- return [response.results ?? [], null];
2273
- }
2274
- const pagesNeeded = Math.ceil(totalCount / limit);
2275
- const parallelLimit = this.client.options.parallelLimit;
2276
- const allResults = [...response.results ?? []];
2277
- for (let i = 1; i < pagesNeeded; i += parallelLimit) {
2278
- const batchSize = Math.min(parallelLimit, pagesNeeded - i);
2279
- const batchPromises = [];
2280
- for (let j = 0; j < batchSize; j++) {
2281
- const offset = (i + j) * limit;
2282
- batchPromises.push(
2283
- this.client.request(
2284
- "v7/identity/parties",
2285
- "GET",
2286
- { responseSchema: GetPartiesV7ResponseSchema },
2287
- { limit: String(limit), offset: String(offset) }
2288
- )
2289
- );
2290
- }
2291
- const batchResults = await Promise.all(batchPromises);
2292
- for (const [pageData, pageError] of batchResults) {
2293
- if (pageError) {
2294
- return [null, pageError];
2295
- }
2296
- if (pageData?.results) {
2297
- allResults.push(...pageData.results);
2298
- }
2299
- }
2300
- }
2301
- return [allResults, null];
2302
- }
2303
- /**
2304
- * Upsert a party.
2264
+ * Create a barrels movement.
2305
2265
  *
2306
- * Creates or updates a party.
2266
+ * Creates a new barrels movement in the system.
2307
2267
  */
2308
2268
  post(data) {
2309
2269
  return this.client.request(
2310
- "v7/identity/parties",
2270
+ "v7/operation/barrels-movements",
2311
2271
  "POST",
2312
- { responseSchema: PartyV7Schema },
2272
+ { requestSchema: CreateBarrelsMovementRequestSchema },
2313
2273
  data
2314
2274
  );
2315
2275
  }
2316
2276
  };
2317
- var ShipmentsClient = class {
2318
- constructor(client) {
2319
- this.client = client;
2320
- }
2321
- /**
2322
- * List all shipments.
2323
- *
2324
- * Returns a paginated list of shipments.
2325
- */
2326
- async getAll(params) {
2327
- const limit = params?.limit ?? 100;
2328
- const firstResponse = await this.client.request(
2329
- "v7/operation/shipments",
2330
- "GET",
2331
- { responseSchema: GetShipmentsSuccessResponseSchema },
2332
- { limit: String(limit), offset: String(params?.offset ?? 0) }
2333
- );
2334
- if (firstResponse[1]) {
2335
- return [null, firstResponse[1]];
2336
- }
2337
- const response = firstResponse[0];
2338
- if (!response) {
2339
- return [[], null];
2340
- }
2341
- const totalCount = response.totalResults ?? response.results?.length ?? 0;
2342
- if (totalCount <= limit) {
2343
- return [response.results ?? [], null];
2344
- }
2345
- const pagesNeeded = Math.ceil(totalCount / limit);
2346
- const parallelLimit = this.client.options.parallelLimit;
2347
- const allResults = [...response.results ?? []];
2348
- for (let i = 1; i < pagesNeeded; i += parallelLimit) {
2349
- const batchSize = Math.min(parallelLimit, pagesNeeded - i);
2350
- const batchPromises = [];
2351
- for (let j = 0; j < batchSize; j++) {
2352
- const offset = (i + j) * limit;
2353
- batchPromises.push(
2354
- this.client.request(
2355
- "v7/operation/shipments",
2356
- "GET",
2357
- { responseSchema: GetShipmentsSuccessResponseSchema },
2358
- { limit: String(limit), offset: String(offset) }
2359
- )
2360
- );
2361
- }
2362
- const batchResults = await Promise.all(batchPromises);
2363
- for (const [pageData, pageError] of batchResults) {
2364
- if (pageError) {
2365
- return [null, pageError];
2366
- }
2367
- if (pageData?.results) {
2368
- allResults.push(...pageData.results);
2369
- }
2370
- }
2371
- }
2372
- return [allResults, null];
2373
- }
2374
- };
2375
- var BarrelTreatmentsClient = class {
2376
- constructor(client) {
2377
- this.client = client;
2378
- }
2379
- /**
2380
- * List all barrel treatments.
2381
- *
2382
- * Returns a paginated list of barrel treatments.
2383
- */
2384
- async getAll(params) {
2385
- const limit = params?.limit ?? 100;
2386
- const firstResponse = await this.client.request(
2387
- "v7/operation/barrel-treatments",
2388
- "GET",
2389
- { responseSchema: GetBarrelTreatmentsSuccessResponseSchema },
2390
- { limit: String(limit), offset: String(params?.offset ?? 0) }
2391
- );
2392
- if (firstResponse[1]) {
2393
- return [null, firstResponse[1]];
2394
- }
2395
- const response = firstResponse[0];
2396
- if (!response) {
2397
- return [[], null];
2398
- }
2399
- const totalCount = response.totalResults ?? response.results?.length ?? 0;
2400
- if (totalCount <= limit) {
2401
- return [response.results ?? [], null];
2402
- }
2403
- const pagesNeeded = Math.ceil(totalCount / limit);
2404
- const parallelLimit = this.client.options.parallelLimit;
2405
- const allResults = [...response.results ?? []];
2406
- for (let i = 1; i < pagesNeeded; i += parallelLimit) {
2407
- const batchSize = Math.min(parallelLimit, pagesNeeded - i);
2408
- const batchPromises = [];
2409
- for (let j = 0; j < batchSize; j++) {
2410
- const offset = (i + j) * limit;
2411
- batchPromises.push(
2412
- this.client.request(
2413
- "v7/operation/barrel-treatments",
2414
- "GET",
2415
- { responseSchema: GetBarrelTreatmentsSuccessResponseSchema },
2416
- { limit: String(limit), offset: String(offset) }
2417
- )
2418
- );
2419
- }
2420
- const batchResults = await Promise.all(batchPromises);
2421
- for (const [pageData, pageError] of batchResults) {
2422
- if (pageError) {
2423
- return [null, pageError];
2424
- }
2425
- if (pageData?.results) {
2426
- allResults.push(...pageData.results);
2427
- }
2428
- }
2429
- }
2430
- return [allResults, null];
2431
- }
2432
- };
2433
2277
  var FruitIntakesClient = class {
2434
2278
  constructor(client) {
2435
2279
  this.client = client;
@@ -2437,194 +2281,86 @@ var FruitIntakesClient = class {
2437
2281
  /**
2438
2282
  * Create a fruit intake.
2439
2283
  *
2440
- * Creates a new fruit intake in the system.
2284
+ * Record a new fruit intake transaction.
2441
2285
  */
2442
- post(data) {
2286
+ create(data) {
2443
2287
  return this.client.request(
2444
2288
  "v7/operation/fruit-intakes",
2445
2289
  "POST",
2446
2290
  {
2447
- responseSchema: CreateFruitIntakeSuccessResponseSchema,
2448
- requestSchema: FruitIntakeRequestSchema
2291
+ requestSchema: FruitIntakeRequestSchema,
2292
+ responseSchema: CreateFruitIntakeSuccessResponseSchema
2449
2293
  },
2450
2294
  data
2451
2295
  );
2452
2296
  }
2453
2297
  /**
2454
- * Update fruit intake pricing.
2298
+ * Update pricing for a fruit intake.
2455
2299
  *
2456
- * Updates pricing information for a fruit intake.
2300
+ * Update the pricing related data for this fruit intake record.
2457
2301
  */
2458
2302
  updatePricing(fruitIntakeId, data) {
2459
2303
  return this.client.request(
2460
2304
  `v7/operation/fruit-intakes/${fruitIntakeId}/pricing`,
2461
- "POST",
2462
- { responseSchema: UpdateFruitIntakePricingResponseSchema },
2305
+ "PUT",
2306
+ {
2307
+ requestSchema: UpdateFruitIntakePricingSchema,
2308
+ responseSchema: UpdateFruitIntakePricingResponseSchema
2309
+ },
2463
2310
  data
2464
2311
  );
2465
2312
  }
2466
2313
  /**
2467
- * Update fruit intake metrics.
2314
+ * Update metrics for a fruit intake.
2468
2315
  *
2469
- * Updates metrics for a fruit intake.
2316
+ * Update the metrics for this fruit intake record.
2470
2317
  */
2471
2318
  updateMetrics(fruitIntakeId, data) {
2472
2319
  return this.client.request(
2473
2320
  `v7/operation/fruit-intakes/${fruitIntakeId}/metrics`,
2474
- "POST",
2475
- {},
2321
+ "PUT",
2322
+ { responseSchema: UpdateMetricsResponseSchema, requestSchema: UpdateMetricsSchema },
2476
2323
  data
2477
2324
  );
2478
2325
  }
2479
2326
  };
2480
- var BulkIntakesClient = class {
2327
+ var DocumentsClient = class {
2481
2328
  constructor(client) {
2482
2329
  this.client = client;
2483
2330
  }
2484
2331
  /**
2485
- * List all bulk intakes.
2486
- *
2487
- * Returns a paginated list of bulk intakes.
2488
- */
2489
- async getAll(params) {
2490
- const limit = params?.limit ?? 100;
2491
- const firstResponse = await this.client.request(
2492
- "v7/operation/bulk-intakes",
2493
- "GET",
2494
- { responseSchema: GetBulkIntakesSuccessResponseSchema },
2495
- { limit: String(limit), offset: String(params?.offset ?? 0) }
2496
- );
2497
- if (firstResponse[1]) {
2498
- return [null, firstResponse[1]];
2499
- }
2500
- const response = firstResponse[0];
2501
- if (!response) {
2502
- return [[], null];
2503
- }
2504
- const totalCount = response.totalResults ?? response.results?.length ?? 0;
2505
- if (totalCount <= limit) {
2506
- return [response.results ?? [], null];
2507
- }
2508
- const pagesNeeded = Math.ceil(totalCount / limit);
2509
- const parallelLimit = this.client.options.parallelLimit;
2510
- const allResults = [...response.results ?? []];
2511
- for (let i = 1; i < pagesNeeded; i += parallelLimit) {
2512
- const batchSize = Math.min(parallelLimit, pagesNeeded - i);
2513
- const batchPromises = [];
2514
- for (let j = 0; j < batchSize; j++) {
2515
- const offset = (i + j) * limit;
2516
- batchPromises.push(
2517
- this.client.request(
2518
- "v7/operation/bulk-intakes",
2519
- "GET",
2520
- { responseSchema: GetBulkIntakesSuccessResponseSchema },
2521
- { limit: String(limit), offset: String(offset) }
2522
- )
2523
- );
2524
- }
2525
- const batchResults = await Promise.all(batchPromises);
2526
- for (const [pageData, pageError] of batchResults) {
2527
- if (pageError) {
2528
- return [null, pageError];
2529
- }
2530
- if (pageData?.results) {
2531
- allResults.push(...pageData.results);
2532
- }
2533
- }
2534
- }
2535
- return [allResults, null];
2536
- }
2537
- /**
2538
- * Create a bulk intake.
2332
+ * Upload a file to an operation.
2539
2333
  *
2540
- * Creates a new bulk intake in the system.
2334
+ * Attach documents to a specified operation.
2541
2335
  */
2542
- post(data) {
2543
- return this.client.request("v7/operation/bulk-intakes", "POST", {}, data);
2544
- }
2545
- /**
2546
- * Partially update a bulk intake.
2547
- *
2548
- * Updates specific fields on a bulk intake.
2549
- */
2550
- patch(id, data) {
2551
- return this.client.request(`v7/operation/bulk-intakes/${id}`, "PATCH", {}, data);
2336
+ attach(data) {
2337
+ return this.client.request("v7/operation/operation/documents", "PUT", {}, data);
2552
2338
  }
2553
2339
  };
2554
- var TrialBlendsClient = class {
2340
+ var StockClient = class {
2555
2341
  constructor(client) {
2556
2342
  this.client = client;
2557
2343
  }
2558
2344
  /**
2559
- * List all trial blends.
2345
+ * Receive stock.
2560
2346
  *
2561
- * Returns a paginated list of trial blends.
2347
+ * Perform a receive stock operation in the system.
2562
2348
  */
2563
- async getAll(params) {
2564
- const limit = params?.limit ?? 100;
2565
- const firstResponse = await this.client.request(
2566
- "v7/operation/trial-blends",
2567
- "GET",
2568
- { responseSchema: GetTrialBlendsSuccessResponseSchema },
2569
- { limit: String(limit), offset: String(params?.offset ?? 0) }
2570
- );
2571
- if (firstResponse[1]) {
2572
- return [null, firstResponse[1]];
2573
- }
2574
- const response = firstResponse[0];
2575
- if (!response) {
2576
- return [[], null];
2577
- }
2578
- const totalCount = response.totalResults ?? response.results?.length ?? 0;
2579
- if (totalCount <= limit) {
2580
- return [response.results ?? [], null];
2581
- }
2582
- const pagesNeeded = Math.ceil(totalCount / limit);
2583
- const parallelLimit = this.client.options.parallelLimit;
2584
- const allResults = [...response.results ?? []];
2585
- for (let i = 1; i < pagesNeeded; i += parallelLimit) {
2586
- const batchSize = Math.min(parallelLimit, pagesNeeded - i);
2587
- const batchPromises = [];
2588
- for (let j = 0; j < batchSize; j++) {
2589
- const offset = (i + j) * limit;
2590
- batchPromises.push(
2591
- this.client.request(
2592
- "v7/operation/trial-blends",
2593
- "GET",
2594
- { responseSchema: GetTrialBlendsSuccessResponseSchema },
2595
- { limit: String(limit), offset: String(offset) }
2596
- )
2597
- );
2598
- }
2599
- const batchResults = await Promise.all(batchPromises);
2600
- for (const [pageData, pageError] of batchResults) {
2601
- if (pageError) {
2602
- return [null, pageError];
2603
- }
2604
- if (pageData?.results) {
2605
- allResults.push(...pageData.results);
2606
- }
2607
- }
2608
- }
2609
- return [allResults, null];
2610
- }
2611
- };
2612
- var WorkOrdersV7Client = class {
2613
- constructor(client) {
2614
- this.client = client;
2349
+ receive(data) {
2350
+ return this.client.request("v7/stock/receivals", "POST", {}, data);
2615
2351
  }
2616
2352
  /**
2617
- * List all work orders.
2353
+ * Get all stock dispatches.
2618
2354
  *
2619
- * Returns a paginated list of work orders.
2355
+ * Returns a paginated list of stock dispatch actions.
2620
2356
  */
2621
- async getAll(params) {
2357
+ async getDispatches(params) {
2622
2358
  const limit = params?.limit ?? 100;
2623
2359
  const firstResponse = await this.client.request(
2624
- "v7/operation/work-orders",
2360
+ "v7/stock/dispatches",
2625
2361
  "GET",
2626
- { responseSchema: GetWorkOrdersV7ResponseSchema },
2627
- { limit: String(limit), offset: String(params?.offset ?? 0) }
2362
+ {},
2363
+ { ...params, limit: String(limit), offset: String(params?.offset ?? 0) }
2628
2364
  );
2629
2365
  if (firstResponse[1]) {
2630
2366
  return [null, firstResponse[1]];
@@ -2647,10 +2383,10 @@ var WorkOrdersV7Client = class {
2647
2383
  const offset = (i + j) * limit;
2648
2384
  batchPromises.push(
2649
2385
  this.client.request(
2650
- "v7/operation/work-orders",
2386
+ "v7/stock/dispatches",
2651
2387
  "GET",
2652
- { responseSchema: GetWorkOrdersV7ResponseSchema },
2653
- { limit: String(limit), offset: String(offset) }
2388
+ {},
2389
+ { ...params, limit: String(limit), offset: String(offset) }
2654
2390
  )
2655
2391
  );
2656
2392
  }
@@ -2659,53 +2395,53 @@ var WorkOrdersV7Client = class {
2659
2395
  if (pageError) {
2660
2396
  return [null, pageError];
2661
2397
  }
2662
- if (pageData?.results) {
2663
- allResults.push(...pageData.results);
2398
+ const pData = pageData;
2399
+ if (pData?.results) {
2400
+ allResults.push(...pData.results);
2664
2401
  }
2665
2402
  }
2666
2403
  }
2667
2404
  return [allResults, null];
2668
2405
  }
2669
2406
  };
2670
- var TirageClient = class {
2407
+ var VesselsClient = class {
2671
2408
  constructor(client) {
2672
2409
  this.client = client;
2673
2410
  }
2674
- /**
2675
- * Get a tirage by operation ID.
2676
- *
2677
- * Returns a single tirage by its operation ID.
2678
- */
2679
- get(operationId) {
2680
- return this.client.request(`v7/operation/tirage/${operationId}`, "GET", {
2681
- responseSchema: TirageSuccessResponseSchema
2682
- });
2411
+ getBarrel(id) {
2412
+ return this.client.request(`v7/vessel/barrels/${id}`, "GET");
2683
2413
  }
2684
- /**
2685
- * Patch a tirage.
2686
- *
2687
- * Updates a tirage record.
2688
- */
2689
- patch(operationId, data) {
2690
- return this.client.request(`v7/operation/tirage/${operationId}`, "PATCH", {}, data);
2414
+ getBarrelGroup(id) {
2415
+ return this.client.request(`v7/vessel/barrel-groups/${id}`, "GET");
2416
+ }
2417
+ createTank(data) {
2418
+ return this.client.request("v7/vessel/tanks", "POST", {}, data);
2419
+ }
2420
+ getTank(id) {
2421
+ return this.client.request(`v7/vessel/tanks/${id}`, "GET");
2422
+ }
2423
+ getTanker(id) {
2424
+ return this.client.request(`v7/vessel/tankers/${id}`, "GET");
2425
+ }
2426
+ getBin(id) {
2427
+ return this.client.request(`v7/vessel/bins/${id}`, "GET");
2691
2428
  }
2692
2429
  };
2693
- var BarrelsMovementsClient = class {
2430
+ var PurchaseOrdersClient = class {
2694
2431
  constructor(client) {
2695
2432
  this.client = client;
2696
2433
  }
2697
2434
  /**
2698
- * Create a barrels movement.
2699
- *
2700
- * Creates a new barrels movement in the system.
2435
+ * Create or update a purchase order.
2701
2436
  */
2702
- post(data) {
2703
- return this.client.request(
2704
- "v7/operation/barrels-movements",
2705
- "POST",
2706
- { requestSchema: CreateBarrelsMovementRequestSchema },
2707
- data
2708
- );
2437
+ create(data) {
2438
+ return this.client.request("v7/account/purchase-orders", "POST", {}, data);
2439
+ }
2440
+ /**
2441
+ * Get purchase order details by id.
2442
+ */
2443
+ get(id) {
2444
+ return this.client.request(`v7/account/purchase-orders/${id}`, "GET");
2709
2445
  }
2710
2446
  };
2711
2447
  var TransactionsClient = class {
@@ -3039,6 +2775,14 @@ var InventoryClient = class {
3039
2775
  }
3040
2776
  return [allResults, null];
3041
2777
  }
2778
+ /**
2779
+ * Get stock item by code or id.
2780
+ *
2781
+ * Returns a single stock item by code or id.
2782
+ */
2783
+ lookup(params) {
2784
+ return this.client.request("v6/stock/lookup", "GET", {}, params);
2785
+ }
3042
2786
  };
3043
2787
  var SearchClient = class {
3044
2788
  constructor(client) {