@blackcode_sa/metaestetics-api 1.5.14 → 1.5.16

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.d.mts CHANGED
@@ -1233,6 +1233,7 @@ declare enum AdminTokenStatus {
1233
1233
  interface AdminToken {
1234
1234
  id: string;
1235
1235
  token: string;
1236
+ email?: string | null;
1236
1237
  status: AdminTokenStatus;
1237
1238
  usedByUserRef?: string;
1238
1239
  createdAt: Timestamp;
@@ -1312,6 +1313,7 @@ interface UpdateClinicGroupData extends Partial<CreateClinicGroupData> {
1312
1313
  */
1313
1314
  interface CreateAdminTokenData {
1314
1315
  expiresInDays?: number;
1316
+ email?: string | null;
1315
1317
  }
1316
1318
  /**
1317
1319
  * Interface for doctor information
@@ -4970,8 +4972,8 @@ declare class ProcedureService extends BaseService {
4970
4972
  * console.log(allowedProcedures.categories); // ["category1", "category2"]
4971
4973
  * console.log(allowedProcedures.subcategories); // ["subcategory1", "subcategory2"]
4972
4974
  */
4973
- getAllowedProcedures(practitioner: Practitioner): Promise<{
4974
- procedures: Procedure[];
4975
+ getAllowedTechnologies(practitioner: Practitioner): Promise<{
4976
+ technologies: Technology[];
4975
4977
  families: ProcedureFamily[];
4976
4978
  categories: string[];
4977
4979
  subcategories: string[];
@@ -11082,6 +11084,7 @@ declare const clinicAdminSchema: z.ZodObject<{
11082
11084
  declare const adminTokenSchema: z.ZodObject<{
11083
11085
  id: z.ZodString;
11084
11086
  token: z.ZodString;
11087
+ email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
11085
11088
  status: z.ZodNativeEnum<typeof AdminTokenStatus>;
11086
11089
  usedByUserRef: z.ZodOptional<z.ZodString>;
11087
11090
  createdAt: z.ZodUnion<[z.ZodType<Date, z.ZodTypeDef, Date>, z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>]>;
@@ -11092,6 +11095,7 @@ declare const adminTokenSchema: z.ZodObject<{
11092
11095
  createdAt: Timestamp | Date;
11093
11096
  token: string;
11094
11097
  expiresAt: Timestamp | Date;
11098
+ email?: string | null | undefined;
11095
11099
  usedByUserRef?: string | undefined;
11096
11100
  }, {
11097
11101
  id: string;
@@ -11099,6 +11103,7 @@ declare const adminTokenSchema: z.ZodObject<{
11099
11103
  createdAt: Timestamp | Date;
11100
11104
  token: string;
11101
11105
  expiresAt: Timestamp | Date;
11106
+ email?: string | null | undefined;
11102
11107
  usedByUserRef?: string | undefined;
11103
11108
  }>;
11104
11109
  /**
@@ -11106,9 +11111,12 @@ declare const adminTokenSchema: z.ZodObject<{
11106
11111
  */
11107
11112
  declare const createAdminTokenSchema: z.ZodObject<{
11108
11113
  expiresInDays: z.ZodOptional<z.ZodNumber>;
11114
+ email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
11109
11115
  }, "strip", z.ZodTypeAny, {
11116
+ email?: string | null | undefined;
11110
11117
  expiresInDays?: number | undefined;
11111
11118
  }, {
11119
+ email?: string | null | undefined;
11112
11120
  expiresInDays?: number | undefined;
11113
11121
  }>;
11114
11122
  /**
@@ -11283,6 +11291,7 @@ declare const clinicGroupSchema: z.ZodObject<{
11283
11291
  adminTokens: z.ZodArray<z.ZodObject<{
11284
11292
  id: z.ZodString;
11285
11293
  token: z.ZodString;
11294
+ email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
11286
11295
  status: z.ZodNativeEnum<typeof AdminTokenStatus>;
11287
11296
  usedByUserRef: z.ZodOptional<z.ZodString>;
11288
11297
  createdAt: z.ZodUnion<[z.ZodType<Date, z.ZodTypeDef, Date>, z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>]>;
@@ -11293,6 +11302,7 @@ declare const clinicGroupSchema: z.ZodObject<{
11293
11302
  createdAt: Timestamp | Date;
11294
11303
  token: string;
11295
11304
  expiresAt: Timestamp | Date;
11305
+ email?: string | null | undefined;
11296
11306
  usedByUserRef?: string | undefined;
11297
11307
  }, {
11298
11308
  id: string;
@@ -11300,6 +11310,7 @@ declare const clinicGroupSchema: z.ZodObject<{
11300
11310
  createdAt: Timestamp | Date;
11301
11311
  token: string;
11302
11312
  expiresAt: Timestamp | Date;
11313
+ email?: string | null | undefined;
11303
11314
  usedByUserRef?: string | undefined;
11304
11315
  }>, "many">;
11305
11316
  ownerId: z.ZodNullable<z.ZodString>;
@@ -11377,6 +11388,7 @@ declare const clinicGroupSchema: z.ZodObject<{
11377
11388
  createdAt: Timestamp | Date;
11378
11389
  token: string;
11379
11390
  expiresAt: Timestamp | Date;
11391
+ email?: string | null | undefined;
11380
11392
  usedByUserRef?: string | undefined;
11381
11393
  }[];
11382
11394
  description?: string | null | undefined;
@@ -11450,6 +11462,7 @@ declare const clinicGroupSchema: z.ZodObject<{
11450
11462
  createdAt: Timestamp | Date;
11451
11463
  token: string;
11452
11464
  expiresAt: Timestamp | Date;
11465
+ email?: string | null | undefined;
11453
11466
  usedByUserRef?: string | undefined;
11454
11467
  }[];
11455
11468
  description?: string | null | undefined;
package/dist/index.d.ts CHANGED
@@ -1233,6 +1233,7 @@ declare enum AdminTokenStatus {
1233
1233
  interface AdminToken {
1234
1234
  id: string;
1235
1235
  token: string;
1236
+ email?: string | null;
1236
1237
  status: AdminTokenStatus;
1237
1238
  usedByUserRef?: string;
1238
1239
  createdAt: Timestamp;
@@ -1312,6 +1313,7 @@ interface UpdateClinicGroupData extends Partial<CreateClinicGroupData> {
1312
1313
  */
1313
1314
  interface CreateAdminTokenData {
1314
1315
  expiresInDays?: number;
1316
+ email?: string | null;
1315
1317
  }
1316
1318
  /**
1317
1319
  * Interface for doctor information
@@ -4970,8 +4972,8 @@ declare class ProcedureService extends BaseService {
4970
4972
  * console.log(allowedProcedures.categories); // ["category1", "category2"]
4971
4973
  * console.log(allowedProcedures.subcategories); // ["subcategory1", "subcategory2"]
4972
4974
  */
4973
- getAllowedProcedures(practitioner: Practitioner): Promise<{
4974
- procedures: Procedure[];
4975
+ getAllowedTechnologies(practitioner: Practitioner): Promise<{
4976
+ technologies: Technology[];
4975
4977
  families: ProcedureFamily[];
4976
4978
  categories: string[];
4977
4979
  subcategories: string[];
@@ -11082,6 +11084,7 @@ declare const clinicAdminSchema: z.ZodObject<{
11082
11084
  declare const adminTokenSchema: z.ZodObject<{
11083
11085
  id: z.ZodString;
11084
11086
  token: z.ZodString;
11087
+ email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
11085
11088
  status: z.ZodNativeEnum<typeof AdminTokenStatus>;
11086
11089
  usedByUserRef: z.ZodOptional<z.ZodString>;
11087
11090
  createdAt: z.ZodUnion<[z.ZodType<Date, z.ZodTypeDef, Date>, z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>]>;
@@ -11092,6 +11095,7 @@ declare const adminTokenSchema: z.ZodObject<{
11092
11095
  createdAt: Timestamp | Date;
11093
11096
  token: string;
11094
11097
  expiresAt: Timestamp | Date;
11098
+ email?: string | null | undefined;
11095
11099
  usedByUserRef?: string | undefined;
11096
11100
  }, {
11097
11101
  id: string;
@@ -11099,6 +11103,7 @@ declare const adminTokenSchema: z.ZodObject<{
11099
11103
  createdAt: Timestamp | Date;
11100
11104
  token: string;
11101
11105
  expiresAt: Timestamp | Date;
11106
+ email?: string | null | undefined;
11102
11107
  usedByUserRef?: string | undefined;
11103
11108
  }>;
11104
11109
  /**
@@ -11106,9 +11111,12 @@ declare const adminTokenSchema: z.ZodObject<{
11106
11111
  */
11107
11112
  declare const createAdminTokenSchema: z.ZodObject<{
11108
11113
  expiresInDays: z.ZodOptional<z.ZodNumber>;
11114
+ email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
11109
11115
  }, "strip", z.ZodTypeAny, {
11116
+ email?: string | null | undefined;
11110
11117
  expiresInDays?: number | undefined;
11111
11118
  }, {
11119
+ email?: string | null | undefined;
11112
11120
  expiresInDays?: number | undefined;
11113
11121
  }>;
11114
11122
  /**
@@ -11283,6 +11291,7 @@ declare const clinicGroupSchema: z.ZodObject<{
11283
11291
  adminTokens: z.ZodArray<z.ZodObject<{
11284
11292
  id: z.ZodString;
11285
11293
  token: z.ZodString;
11294
+ email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
11286
11295
  status: z.ZodNativeEnum<typeof AdminTokenStatus>;
11287
11296
  usedByUserRef: z.ZodOptional<z.ZodString>;
11288
11297
  createdAt: z.ZodUnion<[z.ZodType<Date, z.ZodTypeDef, Date>, z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>]>;
@@ -11293,6 +11302,7 @@ declare const clinicGroupSchema: z.ZodObject<{
11293
11302
  createdAt: Timestamp | Date;
11294
11303
  token: string;
11295
11304
  expiresAt: Timestamp | Date;
11305
+ email?: string | null | undefined;
11296
11306
  usedByUserRef?: string | undefined;
11297
11307
  }, {
11298
11308
  id: string;
@@ -11300,6 +11310,7 @@ declare const clinicGroupSchema: z.ZodObject<{
11300
11310
  createdAt: Timestamp | Date;
11301
11311
  token: string;
11302
11312
  expiresAt: Timestamp | Date;
11313
+ email?: string | null | undefined;
11303
11314
  usedByUserRef?: string | undefined;
11304
11315
  }>, "many">;
11305
11316
  ownerId: z.ZodNullable<z.ZodString>;
@@ -11377,6 +11388,7 @@ declare const clinicGroupSchema: z.ZodObject<{
11377
11388
  createdAt: Timestamp | Date;
11378
11389
  token: string;
11379
11390
  expiresAt: Timestamp | Date;
11391
+ email?: string | null | undefined;
11380
11392
  usedByUserRef?: string | undefined;
11381
11393
  }[];
11382
11394
  description?: string | null | undefined;
@@ -11450,6 +11462,7 @@ declare const clinicGroupSchema: z.ZodObject<{
11450
11462
  createdAt: Timestamp | Date;
11451
11463
  token: string;
11452
11464
  expiresAt: Timestamp | Date;
11465
+ email?: string | null | undefined;
11453
11466
  usedByUserRef?: string | undefined;
11454
11467
  }[];
11455
11468
  description?: string | null | undefined;
package/dist/index.js CHANGED
@@ -2517,6 +2517,7 @@ var clinicAdminSchema = import_zod9.z.object({
2517
2517
  var adminTokenSchema = import_zod9.z.object({
2518
2518
  id: import_zod9.z.string(),
2519
2519
  token: import_zod9.z.string(),
2520
+ email: import_zod9.z.string().email().optional().nullable(),
2520
2521
  status: import_zod9.z.nativeEnum(AdminTokenStatus),
2521
2522
  usedByUserRef: import_zod9.z.string().optional(),
2522
2523
  createdAt: import_zod9.z.instanceof(Date).or(import_zod9.z.instanceof(import_firestore10.Timestamp)),
@@ -2525,7 +2526,8 @@ var adminTokenSchema = import_zod9.z.object({
2525
2526
  // Timestamp
2526
2527
  });
2527
2528
  var createAdminTokenSchema = import_zod9.z.object({
2528
- expiresInDays: import_zod9.z.number().min(1).max(30).optional()
2529
+ expiresInDays: import_zod9.z.number().min(1).max(30).optional(),
2530
+ email: import_zod9.z.string().email().optional().nullable()
2529
2531
  });
2530
2532
  var clinicGroupSchema = import_zod9.z.object({
2531
2533
  id: import_zod9.z.string(),
@@ -4438,6 +4440,7 @@ async function createAdminToken(db, groupId, creatorAdminId, app, data) {
4438
4440
  }
4439
4441
  const now = import_firestore15.Timestamp.now();
4440
4442
  const expiresInDays = (data == null ? void 0 : data.expiresInDays) || 7;
4443
+ const email = (data == null ? void 0 : data.email) || null;
4441
4444
  const expiresAt = new import_firestore15.Timestamp(
4442
4445
  now.seconds + expiresInDays * 24 * 60 * 60,
4443
4446
  now.nanoseconds
@@ -4446,6 +4449,7 @@ async function createAdminToken(db, groupId, creatorAdminId, app, data) {
4446
4449
  id: generateId(),
4447
4450
  token: generateId(),
4448
4451
  status: "active" /* ACTIVE */,
4452
+ email,
4449
4453
  createdAt: now,
4450
4454
  expiresAt
4451
4455
  };
@@ -6597,22 +6601,10 @@ var ProcedureService = class extends BaseService {
6597
6601
  * console.log(allowedProcedures.categories); // ["category1", "category2"]
6598
6602
  * console.log(allowedProcedures.subcategories); // ["subcategory1", "subcategory2"]
6599
6603
  */
6600
- async getAllowedProcedures(practitioner) {
6604
+ async getAllowedTechnologies(practitioner) {
6601
6605
  const { technologies, families, categories, subcategories } = await this.technologyService.getAllowedTechnologies(practitioner);
6602
- const procedures = await Promise.all(
6603
- technologies.map(async (technology) => {
6604
- const q = (0, import_firestore21.query)(
6605
- (0, import_firestore21.collection)(this.db, PROCEDURES_COLLECTION),
6606
- (0, import_firestore21.where)("technologyId", "==", technology.id),
6607
- (0, import_firestore21.where)("isActive", "==", true)
6608
- );
6609
- const snapshot = await (0, import_firestore21.getDocs)(q);
6610
- return snapshot.docs.map((doc26) => doc26.data());
6611
- })
6612
- );
6613
- const flattenedProcedures = procedures.flat();
6614
6606
  return {
6615
- procedures: flattenedProcedures,
6607
+ technologies,
6616
6608
  families,
6617
6609
  categories,
6618
6610
  subcategories
package/dist/index.mjs CHANGED
@@ -2410,6 +2410,7 @@ var clinicAdminSchema = z9.object({
2410
2410
  var adminTokenSchema = z9.object({
2411
2411
  id: z9.string(),
2412
2412
  token: z9.string(),
2413
+ email: z9.string().email().optional().nullable(),
2413
2414
  status: z9.nativeEnum(AdminTokenStatus),
2414
2415
  usedByUserRef: z9.string().optional(),
2415
2416
  createdAt: z9.instanceof(Date).or(z9.instanceof(Timestamp5)),
@@ -2418,7 +2419,8 @@ var adminTokenSchema = z9.object({
2418
2419
  // Timestamp
2419
2420
  });
2420
2421
  var createAdminTokenSchema = z9.object({
2421
- expiresInDays: z9.number().min(1).max(30).optional()
2422
+ expiresInDays: z9.number().min(1).max(30).optional(),
2423
+ email: z9.string().email().optional().nullable()
2422
2424
  });
2423
2425
  var clinicGroupSchema = z9.object({
2424
2426
  id: z9.string(),
@@ -4359,6 +4361,7 @@ async function createAdminToken(db, groupId, creatorAdminId, app, data) {
4359
4361
  }
4360
4362
  const now = Timestamp10.now();
4361
4363
  const expiresInDays = (data == null ? void 0 : data.expiresInDays) || 7;
4364
+ const email = (data == null ? void 0 : data.email) || null;
4362
4365
  const expiresAt = new Timestamp10(
4363
4366
  now.seconds + expiresInDays * 24 * 60 * 60,
4364
4367
  now.nanoseconds
@@ -4367,6 +4370,7 @@ async function createAdminToken(db, groupId, creatorAdminId, app, data) {
4367
4370
  id: generateId(),
4368
4371
  token: generateId(),
4369
4372
  status: "active" /* ACTIVE */,
4373
+ email,
4370
4374
  createdAt: now,
4371
4375
  expiresAt
4372
4376
  };
@@ -6562,22 +6566,10 @@ var ProcedureService = class extends BaseService {
6562
6566
  * console.log(allowedProcedures.categories); // ["category1", "category2"]
6563
6567
  * console.log(allowedProcedures.subcategories); // ["subcategory1", "subcategory2"]
6564
6568
  */
6565
- async getAllowedProcedures(practitioner) {
6569
+ async getAllowedTechnologies(practitioner) {
6566
6570
  const { technologies, families, categories, subcategories } = await this.technologyService.getAllowedTechnologies(practitioner);
6567
- const procedures = await Promise.all(
6568
- technologies.map(async (technology) => {
6569
- const q = query10(
6570
- collection11(this.db, PROCEDURES_COLLECTION),
6571
- where10("technologyId", "==", technology.id),
6572
- where10("isActive", "==", true)
6573
- );
6574
- const snapshot = await getDocs10(q);
6575
- return snapshot.docs.map((doc26) => doc26.data());
6576
- })
6577
- );
6578
- const flattenedProcedures = procedures.flat();
6579
6571
  return {
6580
- procedures: flattenedProcedures,
6572
+ technologies,
6581
6573
  families,
6582
6574
  categories,
6583
6575
  subcategories
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.5.14",
4
+ "version": "1.5.16",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -478,6 +478,7 @@ export async function createAdminToken(
478
478
 
479
479
  const now = Timestamp.now();
480
480
  const expiresInDays = data?.expiresInDays || 7; // Default 7 days
481
+ const email = data?.email || null;
481
482
  const expiresAt = new Timestamp(
482
483
  now.seconds + expiresInDays * 24 * 60 * 60,
483
484
  now.nanoseconds
@@ -487,11 +488,13 @@ export async function createAdminToken(
487
488
  id: generateId(),
488
489
  token: generateId(),
489
490
  status: AdminTokenStatus.ACTIVE,
491
+ email,
490
492
  createdAt: now,
491
493
  expiresAt,
492
494
  };
493
495
 
494
496
  // Dodajemo token u grupu
497
+ // Ovo treba promeniti, staviti admin tokene u sub-kolekciju u klinickoj grupi
495
498
  await updateClinicGroup(
496
499
  db,
497
500
  groupId,
@@ -250,8 +250,8 @@ export class ProcedureService extends BaseService {
250
250
  * console.log(allowedProcedures.categories); // ["category1", "category2"]
251
251
  * console.log(allowedProcedures.subcategories); // ["subcategory1", "subcategory2"]
252
252
  */
253
- async getAllowedProcedures(practitioner: Practitioner): Promise<{
254
- procedures: Procedure[];
253
+ async getAllowedTechnologies(practitioner: Practitioner): Promise<{
254
+ technologies: Technology[];
255
255
  families: ProcedureFamily[];
256
256
  categories: string[];
257
257
  subcategories: string[];
@@ -260,24 +260,8 @@ export class ProcedureService extends BaseService {
260
260
  const { technologies, families, categories, subcategories } =
261
261
  await this.technologyService.getAllowedTechnologies(practitioner);
262
262
 
263
- // Get all procedures for these technologies
264
- const procedures = await Promise.all(
265
- technologies.map(async (technology) => {
266
- const q = query(
267
- collection(this.db, PROCEDURES_COLLECTION),
268
- where("technologyId", "==", technology.id),
269
- where("isActive", "==", true)
270
- );
271
- const snapshot = await getDocs(q);
272
- return snapshot.docs.map((doc) => doc.data() as Procedure);
273
- })
274
- );
275
-
276
- // Flatten the array of procedure arrays
277
- const flattenedProcedures = procedures.flat();
278
-
279
263
  return {
280
- procedures: flattenedProcedures,
264
+ technologies,
281
265
  families,
282
266
  categories,
283
267
  subcategories,
@@ -149,6 +149,7 @@ export enum AdminTokenStatus {
149
149
  export interface AdminToken {
150
150
  id: string;
151
151
  token: string;
152
+ email?: string | null;
152
153
  status: AdminTokenStatus;
153
154
  usedByUserRef?: string;
154
155
  createdAt: Timestamp;
@@ -234,6 +235,7 @@ export interface UpdateClinicGroupData extends Partial<CreateClinicGroupData> {
234
235
  */
235
236
  export interface CreateAdminTokenData {
236
237
  expiresInDays?: number; // How many days the token is valid, default 7
238
+ email?: string | null;
237
239
  }
238
240
 
239
241
  /**
@@ -172,6 +172,7 @@ export const clinicAdminSchema = z.object({
172
172
  export const adminTokenSchema = z.object({
173
173
  id: z.string(),
174
174
  token: z.string(),
175
+ email: z.string().email().optional().nullable(),
175
176
  status: z.nativeEnum(AdminTokenStatus),
176
177
  usedByUserRef: z.string().optional(),
177
178
  createdAt: z.instanceof(Date).or(z.instanceof(Timestamp)), // Timestamp
@@ -183,6 +184,7 @@ export const adminTokenSchema = z.object({
183
184
  */
184
185
  export const createAdminTokenSchema = z.object({
185
186
  expiresInDays: z.number().min(1).max(30).optional(),
187
+ email: z.string().email().optional().nullable(),
186
188
  });
187
189
 
188
190
  /**