@blackcode_sa/metaestetics-api 1.12.54 → 1.12.55

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.js CHANGED
@@ -16492,7 +16492,7 @@ var ProcedureService = class extends BaseService {
16492
16492
  * @returns The created procedure
16493
16493
  */
16494
16494
  async createProcedure(data) {
16495
- var _a, _b, _c;
16495
+ var _a, _b;
16496
16496
  const validatedData = createProcedureSchema.parse(data);
16497
16497
  const isProductFree = !validatedData.productId;
16498
16498
  const procedureId = this.generateId();
@@ -16577,7 +16577,7 @@ var ProcedureService = class extends BaseService {
16577
16577
  contraindications: technology.contraindications || [],
16578
16578
  contraindicationIds: ((_b = technology.contraindications) == null ? void 0 : _b.map((c) => c.id)) || [],
16579
16579
  treatmentBenefits: technology.benefits,
16580
- treatmentBenefitIds: ((_c = technology.benefits) == null ? void 0 : _c.map((b) => b.id)) || [],
16580
+ treatmentBenefitIds: Array.isArray(technology.benefits) ? technology.benefits.map((b) => typeof b === "string" ? b : b.id) : [],
16581
16581
  preRequirements: technology.requirements.pre,
16582
16582
  postRequirements: technology.requirements.post,
16583
16583
  certificationRequirement: technology.certificationRequirement,
@@ -16631,7 +16631,7 @@ var ProcedureService = class extends BaseService {
16631
16631
  * @returns A promise that resolves to an array of the newly created procedures.
16632
16632
  */
16633
16633
  async bulkCreateProcedures(baseData, practitionerIds) {
16634
- var _a, _b, _c;
16634
+ var _a, _b;
16635
16635
  if (!practitionerIds || practitionerIds.length === 0) {
16636
16636
  throw new Error("Practitioner IDs array cannot be empty.");
16637
16637
  }
@@ -16739,7 +16739,7 @@ var ProcedureService = class extends BaseService {
16739
16739
  contraindications: technology.contraindications || [],
16740
16740
  contraindicationIds: ((_b = technology.contraindications) == null ? void 0 : _b.map((c) => c.id)) || [],
16741
16741
  treatmentBenefits: technology.benefits,
16742
- treatmentBenefitIds: ((_c = technology.benefits) == null ? void 0 : _c.map((b) => b.id)) || [],
16742
+ treatmentBenefitIds: Array.isArray(technology.benefits) ? technology.benefits.map((b) => typeof b === "string" ? b : b.id) : [],
16743
16743
  preRequirements: technology.requirements.pre,
16744
16744
  postRequirements: technology.requirements.post,
16745
16745
  certificationRequirement: technology.certificationRequirement,
@@ -16852,7 +16852,7 @@ var ProcedureService = class extends BaseService {
16852
16852
  * @returns The updated procedure
16853
16853
  */
16854
16854
  async updateProcedure(id, data) {
16855
- var _a, _b, _c, _d;
16855
+ var _a, _b, _c;
16856
16856
  const validatedData = updateProcedureSchema.parse(data);
16857
16857
  const procedureRef = (0, import_firestore55.doc)(this.db, PROCEDURES_COLLECTION, id);
16858
16858
  const procedureSnapshot = await (0, import_firestore55.getDoc)(procedureRef);
@@ -16966,7 +16966,7 @@ var ProcedureService = class extends BaseService {
16966
16966
  updatedProcedureData.contraindications = technology.contraindications || [];
16967
16967
  updatedProcedureData.contraindicationIds = ((_c = technology.contraindications) == null ? void 0 : _c.map((c) => c.id)) || [];
16968
16968
  updatedProcedureData.treatmentBenefits = technology.benefits;
16969
- updatedProcedureData.treatmentBenefitIds = ((_d = technology.benefits) == null ? void 0 : _d.map((b) => b.id)) || [];
16969
+ updatedProcedureData.treatmentBenefitIds = Array.isArray(technology.benefits) ? technology.benefits.map((b) => typeof b === "string" ? b : b.id) : [];
16970
16970
  updatedProcedureData.preRequirements = technology.requirements.pre;
16971
16971
  updatedProcedureData.postRequirements = technology.requirements.post;
16972
16972
  updatedProcedureData.certificationRequirement = technology.certificationRequirement;
@@ -17486,7 +17486,7 @@ var ProcedureService = class extends BaseService {
17486
17486
  * @returns The created procedure
17487
17487
  */
17488
17488
  async createConsultationProcedure(data) {
17489
- var _a, _b, _c;
17489
+ var _a, _b;
17490
17490
  const procedureId = this.generateId();
17491
17491
  const [category, subcategory, technology] = await Promise.all([
17492
17492
  this.categoryService.getById(data.categoryId),
@@ -17548,7 +17548,7 @@ var ProcedureService = class extends BaseService {
17548
17548
  contraindications: technology.contraindications || [],
17549
17549
  contraindicationIds: ((_b = technology.contraindications) == null ? void 0 : _b.map((c) => c.id)) || [],
17550
17550
  treatmentBenefits: technology.benefits,
17551
- treatmentBenefitIds: ((_c = technology.benefits) == null ? void 0 : _c.map((b) => b.id)) || [],
17551
+ treatmentBenefitIds: Array.isArray(technology.benefits) ? technology.benefits.map((b) => typeof b === "string" ? b : b.id) : [],
17552
17552
  preRequirements: technology.requirements.pre,
17553
17553
  postRequirements: technology.requirements.post,
17554
17554
  certificationRequirement: technology.certificationRequirement,
package/dist/index.mjs CHANGED
@@ -16740,7 +16740,7 @@ var ProcedureService = class extends BaseService {
16740
16740
  * @returns The created procedure
16741
16741
  */
16742
16742
  async createProcedure(data) {
16743
- var _a, _b, _c;
16743
+ var _a, _b;
16744
16744
  const validatedData = createProcedureSchema.parse(data);
16745
16745
  const isProductFree = !validatedData.productId;
16746
16746
  const procedureId = this.generateId();
@@ -16825,7 +16825,7 @@ var ProcedureService = class extends BaseService {
16825
16825
  contraindications: technology.contraindications || [],
16826
16826
  contraindicationIds: ((_b = technology.contraindications) == null ? void 0 : _b.map((c) => c.id)) || [],
16827
16827
  treatmentBenefits: technology.benefits,
16828
- treatmentBenefitIds: ((_c = technology.benefits) == null ? void 0 : _c.map((b) => b.id)) || [],
16828
+ treatmentBenefitIds: Array.isArray(technology.benefits) ? technology.benefits.map((b) => typeof b === "string" ? b : b.id) : [],
16829
16829
  preRequirements: technology.requirements.pre,
16830
16830
  postRequirements: technology.requirements.post,
16831
16831
  certificationRequirement: technology.certificationRequirement,
@@ -16879,7 +16879,7 @@ var ProcedureService = class extends BaseService {
16879
16879
  * @returns A promise that resolves to an array of the newly created procedures.
16880
16880
  */
16881
16881
  async bulkCreateProcedures(baseData, practitionerIds) {
16882
- var _a, _b, _c;
16882
+ var _a, _b;
16883
16883
  if (!practitionerIds || practitionerIds.length === 0) {
16884
16884
  throw new Error("Practitioner IDs array cannot be empty.");
16885
16885
  }
@@ -16987,7 +16987,7 @@ var ProcedureService = class extends BaseService {
16987
16987
  contraindications: technology.contraindications || [],
16988
16988
  contraindicationIds: ((_b = technology.contraindications) == null ? void 0 : _b.map((c) => c.id)) || [],
16989
16989
  treatmentBenefits: technology.benefits,
16990
- treatmentBenefitIds: ((_c = technology.benefits) == null ? void 0 : _c.map((b) => b.id)) || [],
16990
+ treatmentBenefitIds: Array.isArray(technology.benefits) ? technology.benefits.map((b) => typeof b === "string" ? b : b.id) : [],
16991
16991
  preRequirements: technology.requirements.pre,
16992
16992
  postRequirements: technology.requirements.post,
16993
16993
  certificationRequirement: technology.certificationRequirement,
@@ -17100,7 +17100,7 @@ var ProcedureService = class extends BaseService {
17100
17100
  * @returns The updated procedure
17101
17101
  */
17102
17102
  async updateProcedure(id, data) {
17103
- var _a, _b, _c, _d;
17103
+ var _a, _b, _c;
17104
17104
  const validatedData = updateProcedureSchema.parse(data);
17105
17105
  const procedureRef = doc36(this.db, PROCEDURES_COLLECTION, id);
17106
17106
  const procedureSnapshot = await getDoc37(procedureRef);
@@ -17214,7 +17214,7 @@ var ProcedureService = class extends BaseService {
17214
17214
  updatedProcedureData.contraindications = technology.contraindications || [];
17215
17215
  updatedProcedureData.contraindicationIds = ((_c = technology.contraindications) == null ? void 0 : _c.map((c) => c.id)) || [];
17216
17216
  updatedProcedureData.treatmentBenefits = technology.benefits;
17217
- updatedProcedureData.treatmentBenefitIds = ((_d = technology.benefits) == null ? void 0 : _d.map((b) => b.id)) || [];
17217
+ updatedProcedureData.treatmentBenefitIds = Array.isArray(technology.benefits) ? technology.benefits.map((b) => typeof b === "string" ? b : b.id) : [];
17218
17218
  updatedProcedureData.preRequirements = technology.requirements.pre;
17219
17219
  updatedProcedureData.postRequirements = technology.requirements.post;
17220
17220
  updatedProcedureData.certificationRequirement = technology.certificationRequirement;
@@ -17734,7 +17734,7 @@ var ProcedureService = class extends BaseService {
17734
17734
  * @returns The created procedure
17735
17735
  */
17736
17736
  async createConsultationProcedure(data) {
17737
- var _a, _b, _c;
17737
+ var _a, _b;
17738
17738
  const procedureId = this.generateId();
17739
17739
  const [category, subcategory, technology] = await Promise.all([
17740
17740
  this.categoryService.getById(data.categoryId),
@@ -17796,7 +17796,7 @@ var ProcedureService = class extends BaseService {
17796
17796
  contraindications: technology.contraindications || [],
17797
17797
  contraindicationIds: ((_b = technology.contraindications) == null ? void 0 : _b.map((c) => c.id)) || [],
17798
17798
  treatmentBenefits: technology.benefits,
17799
- treatmentBenefitIds: ((_c = technology.benefits) == null ? void 0 : _c.map((b) => b.id)) || [],
17799
+ treatmentBenefitIds: Array.isArray(technology.benefits) ? technology.benefits.map((b) => typeof b === "string" ? b : b.id) : [],
17800
17800
  preRequirements: technology.requirements.pre,
17801
17801
  postRequirements: technology.requirements.post,
17802
17802
  certificationRequirement: technology.certificationRequirement,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.12.54",
4
+ "version": "1.12.55",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -1007,11 +1007,11 @@ export class BookingAdmin {
1007
1007
  procedureProducts: productsMetadata
1008
1008
  .filter((pp: any) => pp && pp.product) // Safety check for product-free procedures
1009
1009
  .map((pp: any) => ({
1010
- productId: pp.product.id,
1011
- productName: pp.product.name,
1012
- brandId: pp.product.brandId,
1013
- brandName: pp.product.brandName,
1014
- })),
1010
+ productId: pp.product.id,
1011
+ productName: pp.product.name,
1012
+ brandId: pp.product.brandId,
1013
+ brandName: pp.product.brandName,
1014
+ })),
1015
1015
  };
1016
1016
  }
1017
1017
 
@@ -1021,16 +1021,16 @@ export class BookingAdmin {
1021
1021
  return productsMetadata
1022
1022
  .filter((pp: any) => pp && pp.product) // Safety check for product-free procedures
1023
1023
  .map((pp: any) => {
1024
- const product = pp.product;
1025
- return {
1026
- productId: product.id,
1027
- productName: product.name,
1028
- brandId: product.brandId,
1029
- brandName: product.brandName,
1030
- procedureId: procedure.id,
1031
- price: pp.price,
1032
- currency: pp.currency,
1033
- unitOfMeasurement: pp.pricingMeasure,
1024
+ const product = pp.product;
1025
+ return {
1026
+ productId: product.id,
1027
+ productName: product.name,
1028
+ brandId: product.brandId,
1029
+ brandName: product.brandName,
1030
+ procedureId: procedure.id,
1031
+ price: pp.price,
1032
+ currency: pp.currency,
1033
+ unitOfMeasurement: pp.pricingMeasure,
1034
1034
  };
1035
1035
  });
1036
1036
  }
@@ -41,20 +41,20 @@ async function aggregateProductsFromProcedure(
41
41
  const newProducts: AppointmentProductMetadata[] = productsMetadata
42
42
  .filter((pp: any) => pp && pp.product)
43
43
  .map((pp: any) => {
44
- // Each item in productsMetadata is a ProcedureProduct with embedded Product
45
- const product = pp.product;
46
-
47
- return {
48
- productId: product.id,
49
- productName: product.name,
50
- brandId: product.brandId,
51
- brandName: product.brandName,
52
- procedureId: procedureId,
53
- price: pp.price, // Price from ProcedureProduct
54
- currency: pp.currency, // Currency from ProcedureProduct
55
- unitOfMeasurement: pp.pricingMeasure, // PricingMeasure from ProcedureProduct
56
- };
57
- });
44
+ // Each item in productsMetadata is a ProcedureProduct with embedded Product
45
+ const product = pp.product;
46
+
47
+ return {
48
+ productId: product.id,
49
+ productName: product.name,
50
+ brandId: product.brandId,
51
+ brandName: product.brandName,
52
+ procedureId: procedureId,
53
+ price: pp.price, // Price from ProcedureProduct
54
+ currency: pp.currency, // Currency from ProcedureProduct
55
+ unitOfMeasurement: pp.pricingMeasure, // PricingMeasure from ProcedureProduct
56
+ };
57
+ });
58
58
 
59
59
  // Merge with existing products, avoiding duplicates
60
60
  const productMap = new Map<string, AppointmentProductMetadata>();
@@ -108,11 +108,11 @@ async function createExtendedProcedureInfo(
108
108
  procedureProducts: (data.productsMetadata || [])
109
109
  .filter((pp: any) => pp && pp.product) // Safety check for product-free procedures
110
110
  .map((pp: any) => ({
111
- productId: pp.product.id, // Access embedded product
112
- productName: pp.product.name, // Access embedded product
113
- brandId: pp.product.brandId, // Access embedded product
114
- brandName: pp.product.brandName, // Access embedded product
115
- })),
111
+ productId: pp.product.id, // Access embedded product
112
+ productName: pp.product.name, // Access embedded product
113
+ brandId: pp.product.brandId, // Access embedded product
114
+ brandName: pp.product.brandName, // Access embedded product
115
+ })),
116
116
  };
117
117
  }
118
118
 
@@ -41,11 +41,11 @@ async function createExtendedProcedureInfoForRecommended(
41
41
  procedureProducts: (data.productsMetadata || [])
42
42
  .filter((pp: any) => pp && pp.product) // Safety check for product-free procedures
43
43
  .map((pp: any) => ({
44
- productId: pp.product.id,
45
- productName: pp.product.name,
46
- brandId: pp.product.brandId,
47
- brandName: pp.product.brandName,
48
- })),
44
+ productId: pp.product.id,
45
+ productName: pp.product.name,
46
+ brandId: pp.product.brandId,
47
+ brandName: pp.product.brandName,
48
+ })),
49
49
  };
50
50
  }
51
51
 
@@ -307,7 +307,9 @@ export class ProcedureService extends BaseService {
307
307
  contraindications: technology.contraindications || [],
308
308
  contraindicationIds: technology.contraindications?.map(c => c.id) || [],
309
309
  treatmentBenefits: technology.benefits,
310
- treatmentBenefitIds: technology.benefits?.map(b => b.id) || [],
310
+ treatmentBenefitIds: Array.isArray(technology.benefits)
311
+ ? technology.benefits.map(b => typeof b === 'string' ? b : b.id)
312
+ : [],
311
313
  preRequirements: technology.requirements.pre,
312
314
  postRequirements: technology.requirements.post,
313
315
  certificationRequirement: technology.certificationRequirement,
@@ -516,7 +518,9 @@ export class ProcedureService extends BaseService {
516
518
  contraindications: technology.contraindications || [],
517
519
  contraindicationIds: technology.contraindications?.map(c => c.id) || [],
518
520
  treatmentBenefits: technology.benefits,
519
- treatmentBenefitIds: technology.benefits?.map(b => b.id) || [],
521
+ treatmentBenefitIds: Array.isArray(technology.benefits)
522
+ ? technology.benefits.map(b => typeof b === 'string' ? b : b.id)
523
+ : [],
520
524
  preRequirements: technology.requirements.pre,
521
525
  postRequirements: technology.requirements.post,
522
526
  certificationRequirement: technology.certificationRequirement,
@@ -789,7 +793,9 @@ export class ProcedureService extends BaseService {
789
793
  updatedProcedureData.contraindications = technology.contraindications || [];
790
794
  updatedProcedureData.contraindicationIds = technology.contraindications?.map(c => c.id) || [];
791
795
  updatedProcedureData.treatmentBenefits = technology.benefits;
792
- updatedProcedureData.treatmentBenefitIds = technology.benefits?.map(b => b.id) || [];
796
+ updatedProcedureData.treatmentBenefitIds = Array.isArray(technology.benefits)
797
+ ? technology.benefits.map(b => typeof b === 'string' ? b : b.id)
798
+ : [];
793
799
  updatedProcedureData.preRequirements = technology.requirements.pre;
794
800
  updatedProcedureData.postRequirements = technology.requirements.post;
795
801
  updatedProcedureData.certificationRequirement = technology.certificationRequirement;
@@ -1552,7 +1558,9 @@ export class ProcedureService extends BaseService {
1552
1558
  contraindications: technology.contraindications || [],
1553
1559
  contraindicationIds: technology.contraindications?.map(c => c.id) || [],
1554
1560
  treatmentBenefits: technology.benefits,
1555
- treatmentBenefitIds: technology.benefits?.map(b => b.id) || [],
1561
+ treatmentBenefitIds: Array.isArray(technology.benefits)
1562
+ ? technology.benefits.map(b => typeof b === 'string' ? b : b.id)
1563
+ : [],
1556
1564
  preRequirements: technology.requirements.pre,
1557
1565
  postRequirements: technology.requirements.post,
1558
1566
  certificationRequirement: technology.certificationRequirement,