@blackcode_sa/metaestetics-api 1.12.43 → 1.12.45

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.
@@ -452,10 +452,9 @@ interface FilledDocumentFileValue {
452
452
  *
453
453
  * @property id - Unique identifier of the product
454
454
  * @property name - Name of the product
455
- * @property brandId - ID of the brand that manufactures this product
456
- * @property brandName - Name of the brand (denormalized for display)
457
- * @property assignedTechnologyIds - Array of technology IDs this product is assigned to
458
455
  * @property description - Detailed description of the product and its purpose
456
+ * @property brandId - ID of the brand that manufactures this product
457
+ * @property technologyId - ID of the technology this product is used with
459
458
  * @property technicalDetails - Technical details and specifications
460
459
  * @property warnings - List of warnings related to product use
461
460
  * @property dosage - Dosage information (if applicable)
@@ -471,7 +470,10 @@ interface Product {
471
470
  name: string;
472
471
  brandId: string;
473
472
  brandName: string;
474
- assignedTechnologyIds?: string[];
473
+ technologyId: string;
474
+ technologyName: string;
475
+ categoryId: string;
476
+ subcategoryId: string;
475
477
  createdAt: Date;
476
478
  updatedAt: Date;
477
479
  isActive: boolean;
@@ -482,14 +484,6 @@ interface Product {
482
484
  composition?: string;
483
485
  indications?: string[];
484
486
  contraindications?: ContraindicationDynamic[];
485
- /** Present only in subcollections - synced from technology metadata */
486
- technologyId?: string;
487
- /** Present only in subcollections - synced from technology name */
488
- technologyName?: string;
489
- /** Present only in subcollections - synced from technology categoryId */
490
- categoryId?: string;
491
- /** Present only in subcollections - synced from technology subcategoryId */
492
- subcategoryId?: string;
493
487
  }
494
488
 
495
489
  /**
@@ -452,10 +452,9 @@ interface FilledDocumentFileValue {
452
452
  *
453
453
  * @property id - Unique identifier of the product
454
454
  * @property name - Name of the product
455
- * @property brandId - ID of the brand that manufactures this product
456
- * @property brandName - Name of the brand (denormalized for display)
457
- * @property assignedTechnologyIds - Array of technology IDs this product is assigned to
458
455
  * @property description - Detailed description of the product and its purpose
456
+ * @property brandId - ID of the brand that manufactures this product
457
+ * @property technologyId - ID of the technology this product is used with
459
458
  * @property technicalDetails - Technical details and specifications
460
459
  * @property warnings - List of warnings related to product use
461
460
  * @property dosage - Dosage information (if applicable)
@@ -471,7 +470,10 @@ interface Product {
471
470
  name: string;
472
471
  brandId: string;
473
472
  brandName: string;
474
- assignedTechnologyIds?: string[];
473
+ technologyId: string;
474
+ technologyName: string;
475
+ categoryId: string;
476
+ subcategoryId: string;
475
477
  createdAt: Date;
476
478
  updatedAt: Date;
477
479
  isActive: boolean;
@@ -482,14 +484,6 @@ interface Product {
482
484
  composition?: string;
483
485
  indications?: string[];
484
486
  contraindications?: ContraindicationDynamic[];
485
- /** Present only in subcollections - synced from technology metadata */
486
- technologyId?: string;
487
- /** Present only in subcollections - synced from technology name */
488
- technologyName?: string;
489
- /** Present only in subcollections - synced from technology categoryId */
490
- categoryId?: string;
491
- /** Present only in subcollections - synced from technology subcategoryId */
492
- subcategoryId?: string;
493
487
  }
494
488
 
495
489
  /**
@@ -98,18 +98,6 @@ declare class BrandService extends BaseService {
98
98
  * Gets a brand by ID
99
99
  */
100
100
  getById(brandId: string): Promise<Brand | null>;
101
- /**
102
- * Exports brands to CSV string, suitable for Excel/Sheets.
103
- * Includes headers and optional UTF-8 BOM.
104
- * By default exports only active brands (set includeInactive to true to export all).
105
- */
106
- exportToCsv(options?: {
107
- includeInactive?: boolean;
108
- includeBom?: boolean;
109
- }): Promise<string>;
110
- private brandToCsvRow;
111
- private formatDateIso;
112
- private formatCsvValue;
113
101
  }
114
102
 
115
103
  /**
@@ -289,18 +277,6 @@ declare class CategoryService extends BaseService implements ICategoryService {
289
277
  * @returns Kategorija ili null ako ne postoji
290
278
  */
291
279
  getById(id: string): Promise<Category | null>;
292
- /**
293
- * Exports categories to CSV string, suitable for Excel/Sheets.
294
- * Includes headers and optional UTF-8 BOM.
295
- * By default exports only active categories (set includeInactive to true to export all).
296
- */
297
- exportToCsv(options?: {
298
- includeInactive?: boolean;
299
- includeBom?: boolean;
300
- }): Promise<string>;
301
- private categoryToCsvRow;
302
- private formatDateIso;
303
- private formatCsvValue;
304
280
  }
305
281
 
306
282
  /**
@@ -605,10 +581,9 @@ interface UpdateDocumentTemplateData {
605
581
  *
606
582
  * @property id - Unique identifier of the product
607
583
  * @property name - Name of the product
608
- * @property brandId - ID of the brand that manufactures this product
609
- * @property brandName - Name of the brand (denormalized for display)
610
- * @property assignedTechnologyIds - Array of technology IDs this product is assigned to
611
584
  * @property description - Detailed description of the product and its purpose
585
+ * @property brandId - ID of the brand that manufactures this product
586
+ * @property technologyId - ID of the technology this product is used with
612
587
  * @property technicalDetails - Technical details and specifications
613
588
  * @property warnings - List of warnings related to product use
614
589
  * @property dosage - Dosage information (if applicable)
@@ -624,7 +599,10 @@ interface Product {
624
599
  name: string;
625
600
  brandId: string;
626
601
  brandName: string;
627
- assignedTechnologyIds?: string[];
602
+ technologyId: string;
603
+ technologyName: string;
604
+ categoryId: string;
605
+ subcategoryId: string;
628
606
  createdAt: Date;
629
607
  updatedAt: Date;
630
608
  isActive: boolean;
@@ -635,14 +613,6 @@ interface Product {
635
613
  composition?: string;
636
614
  indications?: string[];
637
615
  contraindications?: ContraindicationDynamic[];
638
- /** Present only in subcollections - synced from technology metadata */
639
- technologyId?: string;
640
- /** Present only in subcollections - synced from technology name */
641
- technologyName?: string;
642
- /** Present only in subcollections - synced from technology categoryId */
643
- categoryId?: string;
644
- /** Present only in subcollections - synced from technology subcategoryId */
645
- subcategoryId?: string;
646
616
  }
647
617
  /**
648
618
  * Collection in Firestore database where products are stored
@@ -650,75 +620,9 @@ interface Product {
650
620
  declare const PRODUCTS_COLLECTION = "products";
651
621
  /**
652
622
  * Interface for the ProductService class
653
- *
654
- * NOTE: This interface maintains backward compatibility while adding new top-level collection methods.
655
- * Old methods using technologyId are kept for existing code, new methods work with top-level collection.
656
623
  */
657
624
  interface IProductService {
658
625
  /**
659
- * Creates a new product in the top-level collection
660
- * @param brandId - ID of the brand that manufactures this product
661
- * @param product - Product data
662
- * @param technologyIds - Optional array of technology IDs to assign this product to
663
- */
664
- createTopLevel(brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
665
- /**
666
- * Gets all products from the top-level collection
667
- * @param options - Query options
668
- */
669
- getAllTopLevel(options: {
670
- rowsPerPage: number;
671
- lastVisible?: any;
672
- brandId?: string;
673
- }): Promise<{
674
- products: Product[];
675
- lastVisible: any;
676
- }>;
677
- /**
678
- * Gets a product by ID from the top-level collection
679
- * @param productId - ID of the product
680
- */
681
- getByIdTopLevel(productId: string): Promise<Product | null>;
682
- /**
683
- * Updates a product in the top-level collection
684
- * @param productId - ID of the product to update
685
- * @param product - Updated product data
686
- */
687
- updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId'>>): Promise<Product | null>;
688
- /**
689
- * Deletes a product from the top-level collection (soft delete)
690
- * @param productId - ID of the product to delete
691
- */
692
- deleteTopLevel(productId: string): Promise<void>;
693
- /**
694
- * Assigns a product to a technology
695
- * @param productId - ID of the product
696
- * @param technologyId - ID of the technology
697
- */
698
- assignToTechnology(productId: string, technologyId: string): Promise<void>;
699
- /**
700
- * Unassigns a product from a technology
701
- * @param productId - ID of the product
702
- * @param technologyId - ID of the technology
703
- */
704
- unassignFromTechnology(productId: string, technologyId: string): Promise<void>;
705
- /**
706
- * Gets products assigned to a specific technology
707
- * @param technologyId - ID of the technology
708
- */
709
- getAssignedProducts(technologyId: string): Promise<Product[]>;
710
- /**
711
- * Gets products NOT assigned to a specific technology
712
- * @param technologyId - ID of the technology
713
- */
714
- getUnassignedProducts(technologyId: string): Promise<Product[]>;
715
- /**
716
- * Gets all products for a brand
717
- * @param brandId - ID of the brand
718
- */
719
- getByBrand(brandId: string): Promise<Product[]>;
720
- /**
721
- * @deprecated Use createTopLevel instead
722
626
  * Creates a new product
723
627
  * @param technologyId - ID of the technology this product is used with
724
628
  * @param brandId - ID of the brand that manufactures this product
@@ -726,7 +630,6 @@ interface IProductService {
726
630
  */
727
631
  create(technologyId: string, brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'technologyId'>): Promise<Product>;
728
632
  /**
729
- * @deprecated Use getAllTopLevel instead
730
633
  * Gets a paginated list of all products, with optional filters.
731
634
  */
732
635
  getAll(options: {
@@ -740,7 +643,6 @@ interface IProductService {
740
643
  lastVisible: any;
741
644
  }>;
742
645
  /**
743
- * @deprecated Use alternative counting methods
744
646
  * Gets the total count of active products, with optional filters.
745
647
  */
746
648
  getProductsCount(options: {
@@ -749,7 +651,6 @@ interface IProductService {
749
651
  technologyId?: string;
750
652
  }): Promise<number>;
751
653
  /**
752
- * @deprecated Use alternative counting methods
753
654
  * Gets counts of active products grouped by category, subcategory, and technology.
754
655
  */
755
656
  getProductCounts(): Promise<{
@@ -758,19 +659,16 @@ interface IProductService {
758
659
  byTechnology: Record<string, number>;
759
660
  }>;
760
661
  /**
761
- * @deprecated Use getAssignedProducts instead
762
662
  * Gets all products for a specific technology (non-paginated, for filters/dropdowns)
763
663
  * @param technologyId - ID of the technology
764
664
  */
765
665
  getAllByTechnology(technologyId: string): Promise<Product[]>;
766
666
  /**
767
- * @deprecated Use getByBrand instead
768
667
  * Gets all products for a brand
769
668
  * @param brandId - ID of the brand
770
669
  */
771
670
  getAllByBrand(brandId: string): Promise<Product[]>;
772
671
  /**
773
- * @deprecated Use updateTopLevel instead
774
672
  * Updates a product
775
673
  * @param technologyId - ID of the technology
776
674
  * @param productId - ID of the product to update
@@ -778,14 +676,12 @@ interface IProductService {
778
676
  */
779
677
  update(technologyId: string, productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId' | 'technologyId'>>): Promise<Product | null>;
780
678
  /**
781
- * @deprecated Use deleteTopLevel instead
782
679
  * Deletes a product (soft delete)
783
680
  * @param technologyId - ID of the technology
784
681
  * @param productId - ID of the product to delete
785
682
  */
786
683
  delete(technologyId: string, productId: string): Promise<void>;
787
684
  /**
788
- * @deprecated Use getByIdTopLevel instead
789
685
  * Gets a product by ID
790
686
  * @param technologyId - ID of the technology
791
687
  * @param productId - ID of the product
@@ -1572,12 +1468,7 @@ declare class DocumentationTemplateServiceBackoffice {
1572
1468
 
1573
1469
  declare class ProductService extends BaseService implements IProductService {
1574
1470
  /**
1575
- * Gets reference to top-level products collection (source of truth)
1576
- * @returns Firestore collection reference
1577
- */
1578
- private getTopLevelProductsRef;
1579
- /**
1580
- * Gets reference to products collection under a technology (backward compatibility)
1471
+ * Gets reference to products collection under a technology
1581
1472
  * @param technologyId - ID of the technology
1582
1473
  * @returns Firestore collection reference
1583
1474
  */
@@ -1610,7 +1501,7 @@ declare class ProductService extends BaseService implements IProductService {
1610
1501
  }): Promise<number>;
1611
1502
  /**
1612
1503
  * Gets counts of active products grouped by category, subcategory, and technology.
1613
- * Queries technology subcollections which have the legacy fields synced by Cloud Functions.
1504
+ * This uses a single collectionGroup query for efficiency.
1614
1505
  */
1615
1506
  getProductCounts(): Promise<{
1616
1507
  byCategory: Record<string, number>;
@@ -1637,65 +1528,6 @@ declare class ProductService extends BaseService implements IProductService {
1637
1528
  * Gets a product by ID
1638
1529
  */
1639
1530
  getById(technologyId: string, productId: string): Promise<Product | null>;
1640
- /**
1641
- * Creates a new product in the top-level collection
1642
- */
1643
- createTopLevel(brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
1644
- /**
1645
- * Gets all products from the top-level collection
1646
- */
1647
- getAllTopLevel(options: {
1648
- rowsPerPage: number;
1649
- lastVisible?: any;
1650
- brandId?: string;
1651
- }): Promise<{
1652
- products: Product[];
1653
- lastVisible: any;
1654
- }>;
1655
- /**
1656
- * Gets a product by ID from the top-level collection
1657
- */
1658
- getByIdTopLevel(productId: string): Promise<Product | null>;
1659
- /**
1660
- * Updates a product in the top-level collection
1661
- */
1662
- updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId'>>): Promise<Product | null>;
1663
- /**
1664
- * Deletes a product from the top-level collection (soft delete)
1665
- */
1666
- deleteTopLevel(productId: string): Promise<void>;
1667
- /**
1668
- * Assigns a product to a technology
1669
- */
1670
- assignToTechnology(productId: string, technologyId: string): Promise<void>;
1671
- /**
1672
- * Unassigns a product from a technology
1673
- */
1674
- unassignFromTechnology(productId: string, technologyId: string): Promise<void>;
1675
- /**
1676
- * Gets products assigned to a specific technology
1677
- */
1678
- getAssignedProducts(technologyId: string): Promise<Product[]>;
1679
- /**
1680
- * Gets products NOT assigned to a specific technology
1681
- */
1682
- getUnassignedProducts(technologyId: string): Promise<Product[]>;
1683
- /**
1684
- * Gets all products for a brand (from top-level collection)
1685
- */
1686
- getByBrand(brandId: string): Promise<Product[]>;
1687
- /**
1688
- * Exports products to CSV string, suitable for Excel/Sheets.
1689
- * Includes headers and optional UTF-8 BOM.
1690
- * By default exports only active products (set includeInactive to true to export all).
1691
- */
1692
- exportToCsv(options?: {
1693
- includeInactive?: boolean;
1694
- includeBom?: boolean;
1695
- }): Promise<string>;
1696
- private productToCsvRow;
1697
- private formatDateIso;
1698
- private formatCsvValue;
1699
1531
  }
1700
1532
 
1701
1533
  /**
@@ -1776,18 +1608,6 @@ declare class RequirementService extends BaseService {
1776
1608
  * @returns Zahtev ili null ako ne postoji
1777
1609
  */
1778
1610
  getById(id: string): Promise<Requirement | null>;
1779
- /**
1780
- * Exports requirements to CSV string, suitable for Excel/Sheets.
1781
- * Includes headers and optional UTF-8 BOM.
1782
- * By default exports only active requirements (set includeInactive to true to export all).
1783
- */
1784
- exportToCsv(options?: {
1785
- includeInactive?: boolean;
1786
- includeBom?: boolean;
1787
- }): Promise<string>;
1788
- private requirementToCsvRow;
1789
- private formatDateIso;
1790
- private formatCsvValue;
1791
1611
  }
1792
1612
 
1793
1613
  /**
@@ -1898,18 +1718,6 @@ declare class SubcategoryService extends BaseService {
1898
1718
  * @returns Podkategorija ili null ako ne postoji
1899
1719
  */
1900
1720
  getById(categoryId: string, subcategoryId: string): Promise<Subcategory | null>;
1901
- /**
1902
- * Exports subcategories to CSV string, suitable for Excel/Sheets.
1903
- * Includes headers and optional UTF-8 BOM.
1904
- * By default exports only active subcategories (set includeInactive to true to export all).
1905
- */
1906
- exportToCsv(options?: {
1907
- includeInactive?: boolean;
1908
- includeBom?: boolean;
1909
- }): Promise<string>;
1910
- private subcategoryToCsvRow;
1911
- private formatDateIso;
1912
- private formatCsvValue;
1913
1721
  }
1914
1722
 
1915
1723
  /**
@@ -1932,10 +1740,10 @@ declare class TechnologyService extends BaseService implements ITechnologyServic
1932
1740
  isActive: boolean;
1933
1741
  description: string;
1934
1742
  family: ProcedureFamily;
1935
- technicalDetails?: string | undefined;
1936
- contraindications: ContraindicationDynamic[];
1937
1743
  categoryId: string;
1938
1744
  subcategoryId: string;
1745
+ technicalDetails?: string | undefined;
1746
+ contraindications: ContraindicationDynamic[];
1939
1747
  requirements: {
1940
1748
  pre: Requirement[];
1941
1749
  post: Requirement[];
@@ -2204,54 +2012,6 @@ declare class TechnologyService extends BaseService implements ITechnologyServic
2204
2012
  * Gets all active technologies for filter dropdowns.
2205
2013
  */
2206
2014
  getAllForFilter(): Promise<Technology[]>;
2207
- /**
2208
- * Assigns multiple products to a technology
2209
- * Updates each product's assignedTechnologyIds array
2210
- */
2211
- assignProducts(technologyId: string, productIds: string[]): Promise<void>;
2212
- /**
2213
- * Unassigns multiple products from a technology
2214
- * Updates each product's assignedTechnologyIds array
2215
- */
2216
- unassignProducts(technologyId: string, productIds: string[]): Promise<void>;
2217
- /**
2218
- * Gets products assigned to a specific technology
2219
- * Reads from top-level collection for immediate consistency (Cloud Functions may lag)
2220
- */
2221
- getAssignedProducts(technologyId: string): Promise<Product[]>;
2222
- /**
2223
- * Gets products NOT assigned to a specific technology
2224
- */
2225
- getUnassignedProducts(technologyId: string): Promise<Product[]>;
2226
- /**
2227
- * Gets product assignment statistics for a technology
2228
- */
2229
- getProductStats(technologyId: string): Promise<{
2230
- totalAssigned: number;
2231
- byBrand: Record<string, number>;
2232
- }>;
2233
- /**
2234
- * Updates products in technology subcollection when technology metadata changes
2235
- * @param technologyId - ID of the technology
2236
- * @param updates - Fields to update (categoryId, subcategoryId, technologyName)
2237
- */
2238
- private updateProductsInSubcollection;
2239
- /**
2240
- * Exports technologies to CSV string, suitable for Excel/Sheets.
2241
- * Includes headers and optional UTF-8 BOM.
2242
- * By default exports only active technologies (set includeInactive to true to export all).
2243
- * Includes product names from subcollections.
2244
- */
2245
- exportToCsv(options?: {
2246
- includeInactive?: boolean;
2247
- includeBom?: boolean;
2248
- }): Promise<string>;
2249
- /**
2250
- * Gets product names from the technology's product subcollection
2251
- */
2252
- private getProductNamesForTechnology;
2253
- private technologyToCsvRow;
2254
- private formatCsvValue;
2255
2015
  }
2256
2016
 
2257
2017
  /**
@@ -2371,23 +2131,6 @@ declare class ConstantsService extends BaseService {
2371
2131
  * @returns {Promise<void>}
2372
2132
  */
2373
2133
  deleteContraindication(contraindicationId: string): Promise<void>;
2374
- /**
2375
- * Exports treatment benefits to CSV string, suitable for Excel/Sheets.
2376
- * Includes headers and optional UTF-8 BOM.
2377
- */
2378
- exportBenefitsToCsv(options?: {
2379
- includeBom?: boolean;
2380
- }): Promise<string>;
2381
- /**
2382
- * Exports contraindications to CSV string, suitable for Excel/Sheets.
2383
- * Includes headers and optional UTF-8 BOM.
2384
- */
2385
- exportContraindicationsToCsv(options?: {
2386
- includeBom?: boolean;
2387
- }): Promise<string>;
2388
- private benefitToCsvRow;
2389
- private contraindicationToCsvRow;
2390
- private formatCsvValue;
2391
2134
  }
2392
2135
 
2393
2136
  declare const documentElementSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
@@ -5082,13 +4825,13 @@ declare const technologySchema: z.ZodObject<{
5082
4825
  name: string;
5083
4826
  isActive: boolean;
5084
4827
  family: ProcedureFamily;
4828
+ categoryId: string;
4829
+ subcategoryId: string;
5085
4830
  contraindications: {
5086
4831
  id: string;
5087
4832
  name: string;
5088
4833
  description?: string | undefined;
5089
4834
  }[];
5090
- categoryId: string;
5091
- subcategoryId: string;
5092
4835
  requirements: {
5093
4836
  pre: {
5094
4837
  name: string;
@@ -5227,13 +4970,13 @@ declare const technologySchema: z.ZodObject<{
5227
4970
  }, {
5228
4971
  name: string;
5229
4972
  family: ProcedureFamily;
4973
+ categoryId: string;
4974
+ subcategoryId: string;
5230
4975
  contraindications: {
5231
4976
  id: string;
5232
4977
  name: string;
5233
4978
  description?: string | undefined;
5234
4979
  }[];
5235
- categoryId: string;
5236
- subcategoryId: string;
5237
4980
  blockingConditions: BlockingCondition[];
5238
4981
  benefits: {
5239
4982
  id: string;
@@ -6096,14 +5839,14 @@ declare const technologyUpdateSchema: z.ZodObject<{
6096
5839
  isActive?: boolean | undefined;
6097
5840
  description?: string | undefined;
6098
5841
  family?: ProcedureFamily | undefined;
5842
+ categoryId?: string | undefined;
5843
+ subcategoryId?: string | undefined;
6099
5844
  technicalDetails?: string | undefined;
6100
5845
  contraindications?: {
6101
5846
  id: string;
6102
5847
  name: string;
6103
5848
  description?: string | undefined;
6104
5849
  }[] | undefined;
6105
- categoryId?: string | undefined;
6106
- subcategoryId?: string | undefined;
6107
5850
  requirements?: {
6108
5851
  pre: {
6109
5852
  name: string;
@@ -6242,14 +5985,14 @@ declare const technologyUpdateSchema: z.ZodObject<{
6242
5985
  isActive?: boolean | undefined;
6243
5986
  description?: string | undefined;
6244
5987
  family?: ProcedureFamily | undefined;
5988
+ categoryId?: string | undefined;
5989
+ subcategoryId?: string | undefined;
6245
5990
  technicalDetails?: string | undefined;
6246
5991
  contraindications?: {
6247
5992
  id: string;
6248
5993
  name: string;
6249
5994
  description?: string | undefined;
6250
5995
  }[] | undefined;
6251
- categoryId?: string | undefined;
6252
- subcategoryId?: string | undefined;
6253
5996
  requirements?: {
6254
5997
  pre: {
6255
5998
  name: string;