@bizmap/sdk 0.0.108 → 0.0.110
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/main.d.ts +3 -6
- package/dist/main.js +23 -27
- package/package.json +3 -3
package/dist/main.d.ts
CHANGED
|
@@ -10,11 +10,6 @@ declare const companyUserRoles: z.ZodEnum<{
|
|
|
10
10
|
founder: "founder";
|
|
11
11
|
}>;
|
|
12
12
|
type CompanyUserRole = z.infer<typeof companyUserRoles>;
|
|
13
|
-
declare const companyPartnerRoles: z.ZodEnum<{
|
|
14
|
-
doc: "doc";
|
|
15
|
-
physAsst: "physAsst";
|
|
16
|
-
}>;
|
|
17
|
-
type CompanyPartnerRole = z.infer<typeof companyPartnerRoles>;
|
|
18
13
|
declare const employeeRoles: z.ZodEnum<{
|
|
19
14
|
doc: "doc";
|
|
20
15
|
physAsst: "physAsst";
|
|
@@ -676,6 +671,7 @@ declare const CompanyState: z.ZodObject<{
|
|
|
676
671
|
}, z.core.$strip>;
|
|
677
672
|
type CompanyState = z.infer<typeof CompanyState>;
|
|
678
673
|
|
|
674
|
+
declare const COMPANY_USER_RELATIONSHIP: Partial<Record<CompanyUserRole, CompanyUserRole[]>>;
|
|
679
675
|
declare const CompanyUserSession: z.ZodObject<{
|
|
680
676
|
_id: z.ZodUUID;
|
|
681
677
|
user: z.ZodObject<{
|
|
@@ -1875,6 +1871,7 @@ declare function findAvailableStaff(role: CompanyUserRole, staff: CompanyStaff):
|
|
|
1875
1871
|
declare function findNextAvailableStaff(userUids: string[], algorithm: CompanyPreferences["apptDistAlg"], staff: CompanyStaff): string | null;
|
|
1876
1872
|
|
|
1877
1873
|
/**
|
|
1874
|
+
* @deprecated I don't like this for some reason (please remove/replace it!)
|
|
1878
1875
|
* @param {...CompanyUser|MiniCompanyUser} partners
|
|
1879
1876
|
* @returns {(CompanyUser|MiniCompanyUser)[]|null} an array of the users that have conflicting roles or roles that are
|
|
1880
1877
|
* incompatible with the other partners, or null if none was found. */
|
|
@@ -1921,4 +1918,4 @@ declare function createNotifId(options?: {
|
|
|
1921
1918
|
to: string;
|
|
1922
1919
|
}): string;
|
|
1923
1920
|
|
|
1924
|
-
export { type AcceptedCurrency, AlphaNumeric, AppointmentDetails, type AppointmentDistAlg, AppointmentSeverity, ClientForm, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications,
|
|
1921
|
+
export { type AcceptedCurrency, AlphaNumeric, AppointmentDetails, type AppointmentDistAlg, AppointmentSeverity, COMPANY_USER_RELATIONSHIP, ClientForm, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, CompanyUser, type CompanyUserRole, CompanyUserSession, CreateCompanyForm, CreditCurrency, type EmployeeRole, type Gender, type HealthcareProviderRole, type Industry, InviteResponse, InvoiceNo, MAX_COMPANY_PRICE_MODS, MedicalDetails, Medicine, MiniAppointmentDetails, MiniCompanyUser, MutableAppointmentDetails, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, Notification, PaymentDetails, type PaymentMethod, PriceMod, PriceModList, PriceTag, Reason, Receipts, ScheduleAppointmentForm, StandardTime, TicketNo, type Tier, TierList, TimeLog, Timestamp, Trn, UserDetails, Version, Vitals, acceptedCurrencies, adminRoles, appointmentDistAlgs, calcBalance, calcPriceMod, companyServiceSelectors, companyUserRoles, createNotifId, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, genders, getCompatibleRoles, getIncompatibleRoles, healthcareProviderRoles, industries, normalizeCompanyId, normalizeNidKey, parseClientName, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
|
package/dist/main.js
CHANGED
|
@@ -9,10 +9,6 @@ var companyUserRoles = z.enum([
|
|
|
9
9
|
"founder"
|
|
10
10
|
// "admin",
|
|
11
11
|
]);
|
|
12
|
-
var companyPartnerRoles = companyUserRoles.extract([
|
|
13
|
-
"doc",
|
|
14
|
-
"physAsst"
|
|
15
|
-
]);
|
|
16
12
|
var employeeRoles = companyUserRoles.exclude(["founder"]);
|
|
17
13
|
var adminRoles = companyUserRoles.extract(["founder"]);
|
|
18
14
|
var healthcareProviderRoles = companyUserRoles.extract([
|
|
@@ -511,9 +507,7 @@ var findConflictingPartners = (...partners) => {
|
|
|
511
507
|
const conflicts = [];
|
|
512
508
|
if (!partners) return partners;
|
|
513
509
|
for (const partner of partners) {
|
|
514
|
-
if (!partner.roles || partner.roles.some(
|
|
515
|
-
(r) => !companyPartnerRoles.options.includes(r)
|
|
516
|
-
) || !CompanyUser.shape.roles.safeParse(partner.roles).success) {
|
|
510
|
+
if (!partner.roles || partner.roles.some((r) => !(r in COMPANY_USER_RELATIONSHIP))) {
|
|
517
511
|
conflicts.push(partner);
|
|
518
512
|
continue;
|
|
519
513
|
}
|
|
@@ -527,17 +521,15 @@ var findConflictingPartners = (...partners) => {
|
|
|
527
521
|
return conflicts.length === 0 ? null : conflicts;
|
|
528
522
|
};
|
|
529
523
|
var getCompatibleRoles = (role) => {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
if (adminRoles.safeParse(role).success || role === "doc") {
|
|
534
|
-
return companyUserRoles.exclude(["physAsst", role]).options;
|
|
535
|
-
}
|
|
536
|
-
return companyUserRoles.exclude([role]).options;
|
|
524
|
+
return companyUserRoles.options.filter(
|
|
525
|
+
(r) => !COMPANY_USER_RELATIONSHIP[role]?.includes(r)
|
|
526
|
+
);
|
|
537
527
|
};
|
|
538
528
|
var getIncompatibleRoles = (role) => {
|
|
539
529
|
const compatibleRoles = getCompatibleRoles(role);
|
|
540
|
-
return companyUserRoles.options.filter(
|
|
530
|
+
return companyUserRoles.options.filter(
|
|
531
|
+
(r) => !compatibleRoles.includes(r) && r !== role
|
|
532
|
+
);
|
|
541
533
|
};
|
|
542
534
|
var normalizeCompanyId = (id) => {
|
|
543
535
|
return id.split("-").map((value) => upperFirst2(value.toLowerCase())).join(" ");
|
|
@@ -555,6 +547,10 @@ var parseClientName = ({
|
|
|
555
547
|
}) => [firstName, middleName[0] + ".", lastName].join(" ");
|
|
556
548
|
|
|
557
549
|
// src/schemas/company/components/User.ts
|
|
550
|
+
var COMPANY_USER_RELATIONSHIP = {
|
|
551
|
+
doc: ["physAsst"],
|
|
552
|
+
physAsst: ["doc"]
|
|
553
|
+
};
|
|
558
554
|
var CompanyUserSession = z15.object({
|
|
559
555
|
_id: z15.uuidv4(),
|
|
560
556
|
user: UserDetails.pick({ _id: true, name: true, email: true }),
|
|
@@ -598,7 +594,7 @@ var MiniCompanyUser2 = z15.object({
|
|
|
598
594
|
inviteSent: Timestamp.nullish(),
|
|
599
595
|
inviteAccepted: Timestamp.nullable()
|
|
600
596
|
});
|
|
601
|
-
var
|
|
597
|
+
var CompanyUser2 = z15.object({
|
|
602
598
|
...MiniCompanyUser2.shape,
|
|
603
599
|
...CompanyUserSession.shape.user.shape,
|
|
604
600
|
// Only true when the user's data is retrieved from the session pool
|
|
@@ -618,15 +614,15 @@ var MiniRawCompanyStaff = z16.object({
|
|
|
618
614
|
* @relationship one -> many
|
|
619
615
|
*@description A map of doctor `uids` to their assistants `uids` */
|
|
620
616
|
partnerMap: z16.record(
|
|
621
|
-
|
|
622
|
-
z16.record(
|
|
617
|
+
CompanyUser2.shape._id,
|
|
618
|
+
z16.record(CompanyUser2.shape._id, z16.object({ addedAt: Timestamp }))
|
|
623
619
|
),
|
|
624
620
|
updateQueue: z16.record(
|
|
625
|
-
|
|
621
|
+
CompanyUser2.shape._id,
|
|
626
622
|
z16.object({
|
|
627
623
|
$REMOVE: z16.object({ addedAt: Timestamp }),
|
|
628
624
|
$CHANGE_ROLES: z16.object({
|
|
629
|
-
newRoles:
|
|
625
|
+
newRoles: CompanyUser2.shape.roles,
|
|
630
626
|
addedAt: Timestamp
|
|
631
627
|
})
|
|
632
628
|
}).partial()
|
|
@@ -636,7 +632,7 @@ var MiniRawCompanyStaff = z16.object({
|
|
|
636
632
|
});
|
|
637
633
|
var RawCompanyStaff = z16.object({
|
|
638
634
|
...MiniRawCompanyStaff.shape,
|
|
639
|
-
members: z16.record(
|
|
635
|
+
members: z16.record(CompanyUser2.shape._id, CompanyUser2.omit({ _id: true }))
|
|
640
636
|
});
|
|
641
637
|
var transformStaff = (object17) => {
|
|
642
638
|
return object17.transform((d) => {
|
|
@@ -718,8 +714,8 @@ var MutableCompanyDetails = z17.object({
|
|
|
718
714
|
// src/schemas/company/utils/InviteList.ts
|
|
719
715
|
import * as z18 from "zod";
|
|
720
716
|
var CompanyInviteList = z18.record(
|
|
721
|
-
|
|
722
|
-
z18.object({ createdAt: Timestamp, roles:
|
|
717
|
+
CompanyUser2.shape.email,
|
|
718
|
+
z18.object({ createdAt: Timestamp, roles: CompanyUser2.shape.roles })
|
|
723
719
|
).refine(
|
|
724
720
|
(data) => Object.keys(data).length > 0,
|
|
725
721
|
"Insufficient amount of members invited."
|
|
@@ -809,7 +805,7 @@ var calcPriceMod = (mods, subtotal) => {
|
|
|
809
805
|
// src/schemas/appointment/Appointment.ts
|
|
810
806
|
var TimelineActivity = z21.object({
|
|
811
807
|
postedAt: Timestamp.nullish(),
|
|
812
|
-
userUid:
|
|
808
|
+
userUid: CompanyUser2.shape._id.nonoptional()
|
|
813
809
|
});
|
|
814
810
|
var AppointmentSeverity = z21.object({
|
|
815
811
|
"1": z21.literal("Emergency"),
|
|
@@ -909,7 +905,7 @@ var MutableAppointmentDetails = AppointmentDetails.safeExtend(
|
|
|
909
905
|
);
|
|
910
906
|
var ScheduleAppointmentForm = z21.object({
|
|
911
907
|
clientId: ClientIdentity.shape._id,
|
|
912
|
-
serviceProviderId:
|
|
908
|
+
serviceProviderId: CompanyUser2.shape._id.or(z21.literal("next")),
|
|
913
909
|
category: AppointmentDetails.shape.severity,
|
|
914
910
|
appointmentReason: AppointmentDetails.shape.reason,
|
|
915
911
|
charges: AppointmentDetails.shape.charges.optional(),
|
|
@@ -1120,6 +1116,7 @@ export {
|
|
|
1120
1116
|
AlphaNumeric,
|
|
1121
1117
|
AppointmentDetails,
|
|
1122
1118
|
AppointmentSeverity,
|
|
1119
|
+
COMPANY_USER_RELATIONSHIP,
|
|
1123
1120
|
ClientForm,
|
|
1124
1121
|
ClientIdentity,
|
|
1125
1122
|
CompanyBilling,
|
|
@@ -1130,7 +1127,7 @@ export {
|
|
|
1130
1127
|
CompanyPreferences,
|
|
1131
1128
|
CompanyStaff,
|
|
1132
1129
|
CompanyState,
|
|
1133
|
-
CompanyUser,
|
|
1130
|
+
CompanyUser2 as CompanyUser,
|
|
1134
1131
|
CompanyUserSession,
|
|
1135
1132
|
CreateCompanyForm,
|
|
1136
1133
|
CreditCurrency,
|
|
@@ -1168,7 +1165,6 @@ export {
|
|
|
1168
1165
|
appointmentDistAlgs,
|
|
1169
1166
|
calcBalance,
|
|
1170
1167
|
calcPriceMod,
|
|
1171
|
-
companyPartnerRoles,
|
|
1172
1168
|
companyServiceSelectors,
|
|
1173
1169
|
companyUserRoles,
|
|
1174
1170
|
createNotifId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bizmap/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.110",
|
|
4
4
|
"main": "./dist/main.js",
|
|
5
5
|
"types": "./dist/main.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"author": "",
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@wavy/fn": "^0.0.
|
|
19
|
+
"@wavy/fn": "^0.0.42",
|
|
20
20
|
"@wavy/util": ">=0.0.12",
|
|
21
21
|
"zod": "^4.2.1"
|
|
22
22
|
},
|
|
23
23
|
"description": "",
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@wavy/fn": "^0.0.
|
|
25
|
+
"@wavy/fn": "^0.0.42",
|
|
26
26
|
"@wavy/util": "^0.0.18",
|
|
27
27
|
"tsup": "^8.5.0",
|
|
28
28
|
"typescript": "^5.9.2",
|