@esb-market-contracts/backend 1.0.37 → 1.0.39

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/api.d.ts CHANGED
@@ -783,6 +783,9 @@ declare const deliveriesRouter: import("hono/hono-base").HonoBase<{
783
783
  postedAt: Date | null;
784
784
  updatedAt: Date | null;
785
785
  createdAt: Date;
786
+ supplierName: string;
787
+ warehouseName: string;
788
+ currencyCode: string;
786
789
  }[];
787
790
  total: number;
788
791
  }>;
@@ -877,6 +880,35 @@ declare const deliveriesRouter: import("hono/hono-base").HonoBase<{
877
880
  };
878
881
  };
879
882
  };
883
+ } & {
884
+ "/operations/deliveries/item/scan": {
885
+ $post: {
886
+ output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
887
+ outcome: "added";
888
+ deliveryItem: {
889
+ id: number;
890
+ deliveryId: number;
891
+ productVariantId: number;
892
+ quantity: number;
893
+ unitCost: string | null;
894
+ unitCostBase: string | null;
895
+ updatedAt: Date | null;
896
+ createdAt: Date;
897
+ };
898
+ } | {
899
+ outcome: "product-variant-not-found";
900
+ barcode: string;
901
+ }>;
902
+ outputFormat: "json";
903
+ status: 200;
904
+ input: {
905
+ json: {
906
+ deliveryId: number;
907
+ barcode: string;
908
+ };
909
+ };
910
+ };
911
+ };
880
912
  } & {
881
913
  "/operations/deliveries/item/update": {
882
914
  $post: {
package/enums.d.ts CHANGED
@@ -27,6 +27,14 @@ declare const deliveryStatusesRecord: Readonly<{
27
27
  }>;
28
28
  type DeliveryStatus = (typeof deliveryStatusesArray)[number];
29
29
  //#endregion
30
+ //#region src/app/flows/(procurement)/delivery/delivery.enums.d.ts
31
+ export declare const deliveryItemScanOutcomesArray: readonly ['added', 'product-variant-not-found'];
32
+ declare const deliveryItemScanOutcomesRecord: Readonly<{
33
+ ADDED: "added";
34
+ PRODUCT_VARIANT_NOT_FOUND: "product-variant-not-found";
35
+ }>;
36
+ type DeliveryItemScanOutcome = (typeof deliveryItemScanOutcomesArray)[number];
37
+ //#endregion
30
38
  //#region src/app/flows/(audit)/audit/audit.enums.d.ts
31
39
  export declare const auditLogSourcesArray: readonly ['admin', 'backend'];
32
40
  declare const auditLogSourcesRecord: Readonly<{
@@ -53,4 +61,4 @@ declare const productStatusesRecord: Readonly<{
53
61
  }>;
54
62
  type ProductStatus = (typeof productStatusesArray)[number];
55
63
  //#endregion
56
- export { type AuditLogSource, type CustomerType, type DeliveryStatus, type EntityStatus, type Locale, type ProductStatus, auditLogSourcesRecord as auditLogSource, customerTypesRecord as customerType, deliveryStatusesRecord as deliveryStatus, entityStatusesRecord as entityStatus, productStatusesRecord as productStatus };
64
+ export { type AuditLogSource, type CustomerType, type DeliveryItemScanOutcome, type DeliveryStatus, type EntityStatus, type Locale, type ProductStatus, auditLogSourcesRecord as auditLogSource, customerTypesRecord as customerType, deliveryItemScanOutcomesRecord as deliveryItemScanOutcome, deliveryStatusesRecord as deliveryStatus, entityStatusesRecord as entityStatus, productStatusesRecord as productStatus };
package/enums.js CHANGED
@@ -25,31 +25,40 @@ var deliveryStatusesArray = ["draft", "posted", "reversed"];
25
25
  var deliveryStatusPGEnum = pgEnum2("delivery_status", deliveryStatusesArray);
26
26
  var deliveryStatusesRecord = createStringEnumRecord3(deliveryStatusesArray);
27
27
 
28
- // src/app/flows/(audit)/audit/audit.enums.ts
28
+ // src/app/flows/(procurement)/delivery/delivery.enums.ts
29
29
  import { createStringEnumRecord as createStringEnumRecord4 } from "@kalutskii/foundation";
30
30
  import { z as z2 } from "zod";
31
+ var deliveryItemScanOutcomesArray = ["added", "product-variant-not-found"];
32
+ var deliveryItemScanOutcomesRecord = createStringEnumRecord4(deliveryItemScanOutcomesArray);
33
+ var deliveryItemScanOutcomeSchema = z2.enum(deliveryItemScanOutcomesArray);
34
+
35
+ // src/app/flows/(audit)/audit/audit.enums.ts
36
+ import { createStringEnumRecord as createStringEnumRecord5 } from "@kalutskii/foundation";
37
+ import { z as z3 } from "zod";
31
38
  var auditLogSourcesArray = ["admin", "backend"];
32
- var auditLogSourcesRecord = createStringEnumRecord4(auditLogSourcesArray);
33
- var auditLogSourceSchema = z2.enum(auditLogSourcesArray);
39
+ var auditLogSourcesRecord = createStringEnumRecord5(auditLogSourcesArray);
40
+ var auditLogSourceSchema = z3.enum(auditLogSourcesArray);
34
41
 
35
42
  // src/app/domain/(sales)/customers/customers.enums.ts
36
- import { createStringEnumRecord as createStringEnumRecord5 } from "@kalutskii/foundation";
43
+ import { createStringEnumRecord as createStringEnumRecord6 } from "@kalutskii/foundation";
37
44
  import { pgEnum as pgEnum3 } from "drizzle-orm/pg-core";
38
45
  var customerTypesArray = ["individual", "individual_entrepreneur", "legal_entity"];
39
46
  var customerTypePGEnum = pgEnum3("customer_type", customerTypesArray);
40
- var customerTypesRecord = createStringEnumRecord5(customerTypesArray);
47
+ var customerTypesRecord = createStringEnumRecord6(customerTypesArray);
41
48
 
42
49
  // src/app/domain/(catalog)/products/products.enums.ts
43
- import { createStringEnumRecord as createStringEnumRecord6 } from "@kalutskii/foundation";
50
+ import { createStringEnumRecord as createStringEnumRecord7 } from "@kalutskii/foundation";
44
51
  import { pgEnum as pgEnum4 } from "drizzle-orm/pg-core";
45
52
  var productStatusesArray = ["draft", "active", "archived"];
46
53
  var productStatusPGEnum = pgEnum4("product_status", productStatusesArray);
47
- var productStatusesRecord = createStringEnumRecord6(productStatusesArray);
54
+ var productStatusesRecord = createStringEnumRecord7(productStatusesArray);
48
55
  export {
49
56
  auditLogSourcesRecord as auditLogSource,
50
57
  auditLogSourcesArray,
51
58
  customerTypesRecord as customerType,
52
59
  customerTypesArray,
60
+ deliveryItemScanOutcomesRecord as deliveryItemScanOutcome,
61
+ deliveryItemScanOutcomesArray,
53
62
  deliveryStatusesRecord as deliveryStatus,
54
63
  entityStatusesRecord as entityStatus,
55
64
  locale,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@esb-market-contracts/backend",
3
3
  "description": "Shared TypeScript contract definitions for backend.",
4
- "version": "1.0.37",
4
+ "version": "1.0.39",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "sideEffects": false,
package/types.d.ts CHANGED
@@ -402,28 +402,6 @@ declare const deliveryItemSchema: z.ZodObject<{
402
402
  }, z.core.$strip>;
403
403
  type DeliveryItem = z.infer<typeof deliveryItemSchema>;
404
404
  //#endregion
405
- //#region src/app/domain/(procurement)/deliveries/deliveries.schemas.d.ts
406
- declare const deliverySchema: z.ZodObject<{
407
- id: z.ZodInt;
408
- code: z.ZodString;
409
- supplierId: z.ZodInt;
410
- warehouseId: z.ZodInt;
411
- currencyId: z.ZodInt;
412
- status: z.ZodEnum<{
413
- draft: "draft";
414
- posted: "posted";
415
- reversed: "reversed";
416
- }>;
417
- notes: z.ZodNullable<z.ZodString>;
418
- exchangeRateId: z.ZodNullable<z.ZodInt>;
419
- exchangeRate: z.ZodNullable<z.ZodString>;
420
- exchangeRateValidFromDate: z.ZodNullable<z.ZodNullable<z.ZodISODate>>;
421
- postedAt: z.ZodNullable<z.ZodDate>;
422
- updatedAt: z.ZodNullable<z.ZodDate>;
423
- createdAt: z.ZodDate;
424
- }, z.core.$strip>;
425
- type Delivery = z.infer<typeof deliverySchema>;
426
- //#endregion
427
405
  //#region src/app/flows/(procurement)/delivery/delivery.schemas.d.ts
428
406
  declare const deliveryCreatePayloadSchema: z.ZodObject<{
429
407
  supplierId: z.ZodInt;
@@ -437,6 +415,16 @@ declare const deliveryCreatePayloadSchema: z.ZodObject<{
437
415
  declare const deliverySelectOneQuerySchema: z.ZodObject<{
438
416
  id: z.ZodInt;
439
417
  }, z.core.$strip>;
418
+ declare const deliveryUpdatePayloadSchema: z.ZodObject<{
419
+ supplierId: z.ZodOptional<z.ZodInt>;
420
+ warehouseId: z.ZodOptional<z.ZodInt>;
421
+ currencyId: z.ZodOptional<z.ZodInt>;
422
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
423
+ deliveryId: z.ZodInt;
424
+ }, {
425
+ out: {};
426
+ in: {};
427
+ }>;
440
428
  declare const deliverySearchOptionsSchema: z.ZodObject<{
441
429
  where: z.ZodOptional<z.ZodPipe<z.ZodObject<{
442
430
  supplierId: z.ZodOptional<z.ZodInt>;
@@ -505,24 +493,37 @@ declare const deliverySearchOptionsSchema: z.ZodObject<{
505
493
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
506
494
  }, z.core.$strip>;
507
495
  }, z.core.$strict>;
508
- declare const deliveryUpdatePayloadSchema: z.ZodObject<{
509
- supplierId: z.ZodOptional<z.ZodInt>;
510
- warehouseId: z.ZodOptional<z.ZodInt>;
511
- currencyId: z.ZodOptional<z.ZodInt>;
512
- notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
513
- deliveryId: z.ZodInt;
514
- }, {
515
- out: {};
516
- in: {};
517
- }>;
496
+ declare const deliverySearchItemSchema: z.ZodObject<{
497
+ id: z.ZodInt;
498
+ code: z.ZodString;
499
+ supplierId: z.ZodInt;
500
+ warehouseId: z.ZodInt;
501
+ currencyId: z.ZodInt;
502
+ status: z.ZodEnum<{
503
+ draft: "draft";
504
+ posted: "posted";
505
+ reversed: "reversed";
506
+ }>;
507
+ notes: z.ZodNullable<z.ZodString>;
508
+ exchangeRateId: z.ZodNullable<z.ZodInt>;
509
+ exchangeRate: z.ZodNullable<z.ZodString>;
510
+ exchangeRateValidFromDate: z.ZodNullable<z.ZodNullable<z.ZodISODate>>;
511
+ postedAt: z.ZodNullable<z.ZodDate>;
512
+ updatedAt: z.ZodNullable<z.ZodDate>;
513
+ createdAt: z.ZodDate;
514
+ supplierName: z.ZodString;
515
+ warehouseName: z.ZodString;
516
+ currencyCode: z.ZodString;
517
+ }, z.core.$strip>;
518
518
  type DeliveryCreatePayload = z.infer<typeof deliveryCreatePayloadSchema>;
519
519
  type DeliverySelectOneQuery = z.infer<typeof deliverySelectOneQuerySchema>;
520
520
  type DeliverySearchOptions = z.infer<typeof deliverySearchOptionsSchema>;
521
521
  type DeliverySearchResult = {
522
- deliveries: Delivery[];
522
+ deliveries: DeliverySearchItem[];
523
523
  total: number;
524
524
  };
525
525
  type DeliveryUpdatePayload = z.infer<typeof deliveryUpdatePayloadSchema>;
526
+ type DeliverySearchItem = z.infer<typeof deliverySearchItemSchema>;
526
527
  declare const deliveryDeletePayloadSchema: z.ZodObject<{
527
528
  deliveryId: z.ZodInt;
528
529
  }, z.core.$strip>;
@@ -549,6 +550,26 @@ declare const deliveryItemUpdatePayloadSchema: z.ZodObject<{
549
550
  declare const deliveryItemDeletePayloadSchema: z.ZodObject<{
550
551
  deliveryItemId: z.ZodInt;
551
552
  }, z.core.$strip>;
553
+ declare const deliveryItemScanPayloadSchema: z.ZodObject<{
554
+ deliveryId: z.ZodInt;
555
+ barcode: z.ZodString;
556
+ }, z.core.$strip>;
557
+ declare const deliveryItemScanResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
558
+ outcome: z.ZodLiteral<"added">;
559
+ deliveryItem: z.ZodObject<{
560
+ id: z.ZodInt;
561
+ deliveryId: z.ZodInt;
562
+ productVariantId: z.ZodInt;
563
+ quantity: z.ZodNumber;
564
+ unitCost: z.ZodNullable<z.ZodString>;
565
+ unitCostBase: z.ZodNullable<z.ZodString>;
566
+ updatedAt: z.ZodNullable<z.ZodDate>;
567
+ createdAt: z.ZodDate;
568
+ }, z.core.$strip>;
569
+ }, z.core.$strip>, z.ZodObject<{
570
+ outcome: z.ZodLiteral<"product-variant-not-found">;
571
+ barcode: z.ZodString;
572
+ }, z.core.$strip>], "outcome">;
552
573
  declare const deliveryDetailsSchema: z.ZodObject<{
553
574
  id: z.ZodInt;
554
575
  code: z.ZodString;
@@ -583,6 +604,8 @@ type DeliveryPostPayload = z.infer<typeof deliveryPostPayloadSchema>;
583
604
  type DeliveryItemAddPayload = z.infer<typeof deliveryItemAddPayloadSchema>;
584
605
  type DeliveryItemUpdatePayload = z.infer<typeof deliveryItemUpdatePayloadSchema>;
585
606
  type DeliveryItemDeletePayload = z.infer<typeof deliveryItemDeletePayloadSchema>;
607
+ type DeliveryItemScanPayload = z.infer<typeof deliveryItemScanPayloadSchema>;
608
+ type DeliveryItemScanResult = z.infer<typeof deliveryItemScanResultSchema>;
586
609
  type DeliveryItemResult = {
587
610
  deliveryItem: DeliveryItem;
588
611
  };
@@ -1062,4 +1085,26 @@ type ProductVariantCreateResult = {
1062
1085
  };
1063
1086
  type ProductVariantUpdatePayload = z.infer<typeof productVariantUpdatePayloadSchema>;
1064
1087
  //#endregion
1065
- export type { AuditLogResult, AuditLogSearchPayload, AuditLogSearchResult, AuditLogSelectOneQuery, Brand, BrandCreatePayload, BrandSearchOptions, BrandSearchResult, BrandSelectOneQuery, BrandUpdatePayload, Category, CategoryCreatePayload, CategorySearchOptions, CategorySearchResult, CategorySelectOneQuery, CategoryUpdatePayload, Country, CountryCreatePayload, CountrySearchOptions, CountrySearchResult, CountrySelectOneQuery, CountryUpdatePayload, Currency, CurrencyListResult, Customer, CustomerCreatePayload, CustomerSearchOptions, CustomerSearchResult, CustomerSelectOneQuery, CustomerUpdatePayload, Delivery, DeliveryCreatePayload, DeliveryCreateResult, DeliveryDeletePayload, DeliveryDetails, DeliveryItem, DeliveryItemAddPayload, DeliveryItemDeletePayload, DeliveryItemResult, DeliveryItemUpdatePayload, DeliveryPostPayload, DeliverySearchOptions, DeliverySearchResult, DeliverySelectOneQuery, DeliverySelectOneResult, DeliveryUpdatePayload, ExchangeRate, ExchangeRateDateSearchResult, ExchangeRateSearchOptions, ExchangeRateSearchResult, MeasurementUnit, MeasurementUnitListResult, Product, ProductCreatePayload, ProductCreateResult, ProductDeletePayload, ProductImage, ProductImages, ProductSearchOptions, ProductSearchResult, ProductSelectOneQuery, ProductUpdatePayload, ProductVariant, ProductVariantCreatePayload, ProductVariantCreateResult, ProductVariantDeletePayload, ProductVariantSearchOptions, ProductVariantSearchResult, ProductVariantSelectOneQuery, ProductVariantUpdatePayload, Supplier, SupplierCreatePayload, SupplierSearchOptions, SupplierSearchResult, SupplierSelectOneQuery, SupplierSwitchStatusPayload, SupplierUpdatePayload, Warehouse, WarehouseCreatePayload, WarehouseSearchOptions, WarehouseSearchResult, WarehouseSelectOneQuery, WarehouseSwitchStatusPayload, WarehouseUpdatePayload };
1088
+ //#region src/app/domain/(procurement)/deliveries/deliveries.schemas.d.ts
1089
+ declare const deliverySchema: z.ZodObject<{
1090
+ id: z.ZodInt;
1091
+ code: z.ZodString;
1092
+ supplierId: z.ZodInt;
1093
+ warehouseId: z.ZodInt;
1094
+ currencyId: z.ZodInt;
1095
+ status: z.ZodEnum<{
1096
+ draft: "draft";
1097
+ posted: "posted";
1098
+ reversed: "reversed";
1099
+ }>;
1100
+ notes: z.ZodNullable<z.ZodString>;
1101
+ exchangeRateId: z.ZodNullable<z.ZodInt>;
1102
+ exchangeRate: z.ZodNullable<z.ZodString>;
1103
+ exchangeRateValidFromDate: z.ZodNullable<z.ZodNullable<z.ZodISODate>>;
1104
+ postedAt: z.ZodNullable<z.ZodDate>;
1105
+ updatedAt: z.ZodNullable<z.ZodDate>;
1106
+ createdAt: z.ZodDate;
1107
+ }, z.core.$strip>;
1108
+ type Delivery = z.infer<typeof deliverySchema>;
1109
+ //#endregion
1110
+ export type { AuditLogResult, AuditLogSearchPayload, AuditLogSearchResult, AuditLogSelectOneQuery, Brand, BrandCreatePayload, BrandSearchOptions, BrandSearchResult, BrandSelectOneQuery, BrandUpdatePayload, Category, CategoryCreatePayload, CategorySearchOptions, CategorySearchResult, CategorySelectOneQuery, CategoryUpdatePayload, Country, CountryCreatePayload, CountrySearchOptions, CountrySearchResult, CountrySelectOneQuery, CountryUpdatePayload, Currency, CurrencyListResult, Customer, CustomerCreatePayload, CustomerSearchOptions, CustomerSearchResult, CustomerSelectOneQuery, CustomerUpdatePayload, Delivery, DeliveryCreatePayload, DeliveryCreateResult, DeliveryDeletePayload, DeliveryDetails, DeliveryItem, DeliveryItemAddPayload, DeliveryItemDeletePayload, DeliveryItemResult, DeliveryItemScanPayload, DeliveryItemScanResult, DeliveryItemUpdatePayload, DeliveryPostPayload, DeliverySearchItem, DeliverySearchOptions, DeliverySearchResult, DeliverySelectOneQuery, DeliverySelectOneResult, DeliveryUpdatePayload, ExchangeRate, ExchangeRateDateSearchResult, ExchangeRateSearchOptions, ExchangeRateSearchResult, MeasurementUnit, MeasurementUnitListResult, Product, ProductCreatePayload, ProductCreateResult, ProductDeletePayload, ProductImage, ProductImages, ProductSearchOptions, ProductSearchResult, ProductSelectOneQuery, ProductUpdatePayload, ProductVariant, ProductVariantCreatePayload, ProductVariantCreateResult, ProductVariantDeletePayload, ProductVariantSearchOptions, ProductVariantSearchResult, ProductVariantSelectOneQuery, ProductVariantUpdatePayload, Supplier, SupplierCreatePayload, SupplierSearchOptions, SupplierSearchResult, SupplierSelectOneQuery, SupplierSwitchStatusPayload, SupplierUpdatePayload, Warehouse, WarehouseCreatePayload, WarehouseSearchOptions, WarehouseSearchResult, WarehouseSelectOneQuery, WarehouseSwitchStatusPayload, WarehouseUpdatePayload };