@blackcode_sa/metaestetics-api 1.12.42 → 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
  /**
@@ -581,10 +581,9 @@ interface UpdateDocumentTemplateData {
581
581
  *
582
582
  * @property id - Unique identifier of the product
583
583
  * @property name - Name of the product
584
- * @property brandId - ID of the brand that manufactures this product
585
- * @property brandName - Name of the brand (denormalized for display)
586
- * @property assignedTechnologyIds - Array of technology IDs this product is assigned to
587
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
588
587
  * @property technicalDetails - Technical details and specifications
589
588
  * @property warnings - List of warnings related to product use
590
589
  * @property dosage - Dosage information (if applicable)
@@ -600,7 +599,10 @@ interface Product {
600
599
  name: string;
601
600
  brandId: string;
602
601
  brandName: string;
603
- assignedTechnologyIds?: string[];
602
+ technologyId: string;
603
+ technologyName: string;
604
+ categoryId: string;
605
+ subcategoryId: string;
604
606
  createdAt: Date;
605
607
  updatedAt: Date;
606
608
  isActive: boolean;
@@ -611,14 +613,6 @@ interface Product {
611
613
  composition?: string;
612
614
  indications?: string[];
613
615
  contraindications?: ContraindicationDynamic[];
614
- /** Present only in subcollections - synced from technology metadata */
615
- technologyId?: string;
616
- /** Present only in subcollections - synced from technology name */
617
- technologyName?: string;
618
- /** Present only in subcollections - synced from technology categoryId */
619
- categoryId?: string;
620
- /** Present only in subcollections - synced from technology subcategoryId */
621
- subcategoryId?: string;
622
616
  }
623
617
  /**
624
618
  * Collection in Firestore database where products are stored
@@ -626,75 +620,9 @@ interface Product {
626
620
  declare const PRODUCTS_COLLECTION = "products";
627
621
  /**
628
622
  * Interface for the ProductService class
629
- *
630
- * NOTE: This interface maintains backward compatibility while adding new top-level collection methods.
631
- * Old methods using technologyId are kept for existing code, new methods work with top-level collection.
632
623
  */
633
624
  interface IProductService {
634
625
  /**
635
- * Creates a new product in the top-level collection
636
- * @param brandId - ID of the brand that manufactures this product
637
- * @param product - Product data
638
- * @param technologyIds - Optional array of technology IDs to assign this product to
639
- */
640
- createTopLevel(brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
641
- /**
642
- * Gets all products from the top-level collection
643
- * @param options - Query options
644
- */
645
- getAllTopLevel(options: {
646
- rowsPerPage: number;
647
- lastVisible?: any;
648
- brandId?: string;
649
- }): Promise<{
650
- products: Product[];
651
- lastVisible: any;
652
- }>;
653
- /**
654
- * Gets a product by ID from the top-level collection
655
- * @param productId - ID of the product
656
- */
657
- getByIdTopLevel(productId: string): Promise<Product | null>;
658
- /**
659
- * Updates a product in the top-level collection
660
- * @param productId - ID of the product to update
661
- * @param product - Updated product data
662
- */
663
- updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId'>>): Promise<Product | null>;
664
- /**
665
- * Deletes a product from the top-level collection (soft delete)
666
- * @param productId - ID of the product to delete
667
- */
668
- deleteTopLevel(productId: string): Promise<void>;
669
- /**
670
- * Assigns a product to a technology
671
- * @param productId - ID of the product
672
- * @param technologyId - ID of the technology
673
- */
674
- assignToTechnology(productId: string, technologyId: string): Promise<void>;
675
- /**
676
- * Unassigns a product from a technology
677
- * @param productId - ID of the product
678
- * @param technologyId - ID of the technology
679
- */
680
- unassignFromTechnology(productId: string, technologyId: string): Promise<void>;
681
- /**
682
- * Gets products assigned to a specific technology
683
- * @param technologyId - ID of the technology
684
- */
685
- getAssignedProducts(technologyId: string): Promise<Product[]>;
686
- /**
687
- * Gets products NOT assigned to a specific technology
688
- * @param technologyId - ID of the technology
689
- */
690
- getUnassignedProducts(technologyId: string): Promise<Product[]>;
691
- /**
692
- * Gets all products for a brand
693
- * @param brandId - ID of the brand
694
- */
695
- getByBrand(brandId: string): Promise<Product[]>;
696
- /**
697
- * @deprecated Use createTopLevel instead
698
626
  * Creates a new product
699
627
  * @param technologyId - ID of the technology this product is used with
700
628
  * @param brandId - ID of the brand that manufactures this product
@@ -702,7 +630,6 @@ interface IProductService {
702
630
  */
703
631
  create(technologyId: string, brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'technologyId'>): Promise<Product>;
704
632
  /**
705
- * @deprecated Use getAllTopLevel instead
706
633
  * Gets a paginated list of all products, with optional filters.
707
634
  */
708
635
  getAll(options: {
@@ -716,7 +643,6 @@ interface IProductService {
716
643
  lastVisible: any;
717
644
  }>;
718
645
  /**
719
- * @deprecated Use alternative counting methods
720
646
  * Gets the total count of active products, with optional filters.
721
647
  */
722
648
  getProductsCount(options: {
@@ -725,7 +651,6 @@ interface IProductService {
725
651
  technologyId?: string;
726
652
  }): Promise<number>;
727
653
  /**
728
- * @deprecated Use alternative counting methods
729
654
  * Gets counts of active products grouped by category, subcategory, and technology.
730
655
  */
731
656
  getProductCounts(): Promise<{
@@ -734,19 +659,16 @@ interface IProductService {
734
659
  byTechnology: Record<string, number>;
735
660
  }>;
736
661
  /**
737
- * @deprecated Use getAssignedProducts instead
738
662
  * Gets all products for a specific technology (non-paginated, for filters/dropdowns)
739
663
  * @param technologyId - ID of the technology
740
664
  */
741
665
  getAllByTechnology(technologyId: string): Promise<Product[]>;
742
666
  /**
743
- * @deprecated Use getByBrand instead
744
667
  * Gets all products for a brand
745
668
  * @param brandId - ID of the brand
746
669
  */
747
670
  getAllByBrand(brandId: string): Promise<Product[]>;
748
671
  /**
749
- * @deprecated Use updateTopLevel instead
750
672
  * Updates a product
751
673
  * @param technologyId - ID of the technology
752
674
  * @param productId - ID of the product to update
@@ -754,14 +676,12 @@ interface IProductService {
754
676
  */
755
677
  update(technologyId: string, productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId' | 'technologyId'>>): Promise<Product | null>;
756
678
  /**
757
- * @deprecated Use deleteTopLevel instead
758
679
  * Deletes a product (soft delete)
759
680
  * @param technologyId - ID of the technology
760
681
  * @param productId - ID of the product to delete
761
682
  */
762
683
  delete(technologyId: string, productId: string): Promise<void>;
763
684
  /**
764
- * @deprecated Use getByIdTopLevel instead
765
685
  * Gets a product by ID
766
686
  * @param technologyId - ID of the technology
767
687
  * @param productId - ID of the product
@@ -1548,12 +1468,7 @@ declare class DocumentationTemplateServiceBackoffice {
1548
1468
 
1549
1469
  declare class ProductService extends BaseService implements IProductService {
1550
1470
  /**
1551
- * Gets reference to top-level products collection (source of truth)
1552
- * @returns Firestore collection reference
1553
- */
1554
- private getTopLevelProductsRef;
1555
- /**
1556
- * Gets reference to products collection under a technology (backward compatibility)
1471
+ * Gets reference to products collection under a technology
1557
1472
  * @param technologyId - ID of the technology
1558
1473
  * @returns Firestore collection reference
1559
1474
  */
@@ -1586,7 +1501,7 @@ declare class ProductService extends BaseService implements IProductService {
1586
1501
  }): Promise<number>;
1587
1502
  /**
1588
1503
  * Gets counts of active products grouped by category, subcategory, and technology.
1589
- * Queries technology subcollections which have the legacy fields synced by Cloud Functions.
1504
+ * This uses a single collectionGroup query for efficiency.
1590
1505
  */
1591
1506
  getProductCounts(): Promise<{
1592
1507
  byCategory: Record<string, number>;
@@ -1613,53 +1528,6 @@ declare class ProductService extends BaseService implements IProductService {
1613
1528
  * Gets a product by ID
1614
1529
  */
1615
1530
  getById(technologyId: string, productId: string): Promise<Product | null>;
1616
- /**
1617
- * Creates a new product in the top-level collection
1618
- */
1619
- createTopLevel(brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
1620
- /**
1621
- * Gets all products from the top-level collection
1622
- */
1623
- getAllTopLevel(options: {
1624
- rowsPerPage: number;
1625
- lastVisible?: any;
1626
- brandId?: string;
1627
- }): Promise<{
1628
- products: Product[];
1629
- lastVisible: any;
1630
- }>;
1631
- /**
1632
- * Gets a product by ID from the top-level collection
1633
- */
1634
- getByIdTopLevel(productId: string): Promise<Product | null>;
1635
- /**
1636
- * Updates a product in the top-level collection
1637
- */
1638
- updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId'>>): Promise<Product | null>;
1639
- /**
1640
- * Deletes a product from the top-level collection (soft delete)
1641
- */
1642
- deleteTopLevel(productId: string): Promise<void>;
1643
- /**
1644
- * Assigns a product to a technology
1645
- */
1646
- assignToTechnology(productId: string, technologyId: string): Promise<void>;
1647
- /**
1648
- * Unassigns a product from a technology
1649
- */
1650
- unassignFromTechnology(productId: string, technologyId: string): Promise<void>;
1651
- /**
1652
- * Gets products assigned to a specific technology
1653
- */
1654
- getAssignedProducts(technologyId: string): Promise<Product[]>;
1655
- /**
1656
- * Gets products NOT assigned to a specific technology
1657
- */
1658
- getUnassignedProducts(technologyId: string): Promise<Product[]>;
1659
- /**
1660
- * Gets all products for a brand (from top-level collection)
1661
- */
1662
- getByBrand(brandId: string): Promise<Product[]>;
1663
1531
  }
1664
1532
 
1665
1533
  /**
@@ -1872,10 +1740,10 @@ declare class TechnologyService extends BaseService implements ITechnologyServic
1872
1740
  isActive: boolean;
1873
1741
  description: string;
1874
1742
  family: ProcedureFamily;
1875
- technicalDetails?: string | undefined;
1876
- contraindications: ContraindicationDynamic[];
1877
1743
  categoryId: string;
1878
1744
  subcategoryId: string;
1745
+ technicalDetails?: string | undefined;
1746
+ contraindications: ContraindicationDynamic[];
1879
1747
  requirements: {
1880
1748
  pre: Requirement[];
1881
1749
  post: Requirement[];
@@ -2144,38 +2012,6 @@ declare class TechnologyService extends BaseService implements ITechnologyServic
2144
2012
  * Gets all active technologies for filter dropdowns.
2145
2013
  */
2146
2014
  getAllForFilter(): Promise<Technology[]>;
2147
- /**
2148
- * Assigns multiple products to a technology
2149
- * Updates each product's assignedTechnologyIds array
2150
- */
2151
- assignProducts(technologyId: string, productIds: string[]): Promise<void>;
2152
- /**
2153
- * Unassigns multiple products from a technology
2154
- * Updates each product's assignedTechnologyIds array
2155
- */
2156
- unassignProducts(technologyId: string, productIds: string[]): Promise<void>;
2157
- /**
2158
- * Gets products assigned to a specific technology
2159
- * Reads from top-level collection for immediate consistency (Cloud Functions may lag)
2160
- */
2161
- getAssignedProducts(technologyId: string): Promise<Product[]>;
2162
- /**
2163
- * Gets products NOT assigned to a specific technology
2164
- */
2165
- getUnassignedProducts(technologyId: string): Promise<Product[]>;
2166
- /**
2167
- * Gets product assignment statistics for a technology
2168
- */
2169
- getProductStats(technologyId: string): Promise<{
2170
- totalAssigned: number;
2171
- byBrand: Record<string, number>;
2172
- }>;
2173
- /**
2174
- * Updates products in technology subcollection when technology metadata changes
2175
- * @param technologyId - ID of the technology
2176
- * @param updates - Fields to update (categoryId, subcategoryId, technologyName)
2177
- */
2178
- private updateProductsInSubcollection;
2179
2015
  }
2180
2016
 
2181
2017
  /**
@@ -4989,13 +4825,13 @@ declare const technologySchema: z.ZodObject<{
4989
4825
  name: string;
4990
4826
  isActive: boolean;
4991
4827
  family: ProcedureFamily;
4828
+ categoryId: string;
4829
+ subcategoryId: string;
4992
4830
  contraindications: {
4993
4831
  id: string;
4994
4832
  name: string;
4995
4833
  description?: string | undefined;
4996
4834
  }[];
4997
- categoryId: string;
4998
- subcategoryId: string;
4999
4835
  requirements: {
5000
4836
  pre: {
5001
4837
  name: string;
@@ -5134,13 +4970,13 @@ declare const technologySchema: z.ZodObject<{
5134
4970
  }, {
5135
4971
  name: string;
5136
4972
  family: ProcedureFamily;
4973
+ categoryId: string;
4974
+ subcategoryId: string;
5137
4975
  contraindications: {
5138
4976
  id: string;
5139
4977
  name: string;
5140
4978
  description?: string | undefined;
5141
4979
  }[];
5142
- categoryId: string;
5143
- subcategoryId: string;
5144
4980
  blockingConditions: BlockingCondition[];
5145
4981
  benefits: {
5146
4982
  id: string;
@@ -6003,14 +5839,14 @@ declare const technologyUpdateSchema: z.ZodObject<{
6003
5839
  isActive?: boolean | undefined;
6004
5840
  description?: string | undefined;
6005
5841
  family?: ProcedureFamily | undefined;
5842
+ categoryId?: string | undefined;
5843
+ subcategoryId?: string | undefined;
6006
5844
  technicalDetails?: string | undefined;
6007
5845
  contraindications?: {
6008
5846
  id: string;
6009
5847
  name: string;
6010
5848
  description?: string | undefined;
6011
5849
  }[] | undefined;
6012
- categoryId?: string | undefined;
6013
- subcategoryId?: string | undefined;
6014
5850
  requirements?: {
6015
5851
  pre: {
6016
5852
  name: string;
@@ -6149,14 +5985,14 @@ declare const technologyUpdateSchema: z.ZodObject<{
6149
5985
  isActive?: boolean | undefined;
6150
5986
  description?: string | undefined;
6151
5987
  family?: ProcedureFamily | undefined;
5988
+ categoryId?: string | undefined;
5989
+ subcategoryId?: string | undefined;
6152
5990
  technicalDetails?: string | undefined;
6153
5991
  contraindications?: {
6154
5992
  id: string;
6155
5993
  name: string;
6156
5994
  description?: string | undefined;
6157
5995
  }[] | undefined;
6158
- categoryId?: string | undefined;
6159
- subcategoryId?: string | undefined;
6160
5996
  requirements?: {
6161
5997
  pre: {
6162
5998
  name: string;