@bizmap/sdk 0.0.123 → 0.0.125
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 +21 -21
- package/dist/main.js +24 -24
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -26,11 +26,11 @@ declare const healthcareProviderRoles: z.ZodEnum<{
|
|
|
26
26
|
physAsst: "physAsst";
|
|
27
27
|
}>;
|
|
28
28
|
type HealthcareProviderRole = z.infer<typeof healthcareProviderRoles>;
|
|
29
|
-
declare const
|
|
29
|
+
declare const serviceDistAlgs: z.ZodEnum<{
|
|
30
30
|
RR: "RR";
|
|
31
31
|
LOR: "LOR";
|
|
32
32
|
}>;
|
|
33
|
-
type
|
|
33
|
+
type ServiceDistAlg = z.infer<typeof serviceDistAlgs>;
|
|
34
34
|
declare const companyServiceSelectors: z.ZodEnum<{
|
|
35
35
|
scheduler: "scheduler";
|
|
36
36
|
doctor: "doctor";
|
|
@@ -122,11 +122,11 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
122
122
|
scheduler: "scheduler";
|
|
123
123
|
doctor: "doctor";
|
|
124
124
|
}>;
|
|
125
|
-
|
|
125
|
+
serviceDistAlg: z.ZodEnum<{
|
|
126
126
|
RR: "RR";
|
|
127
127
|
LOR: "LOR";
|
|
128
128
|
}>;
|
|
129
|
-
|
|
129
|
+
pps: z.ZodBoolean;
|
|
130
130
|
servicesDeployed: z.ZodBoolean;
|
|
131
131
|
}, z.core.$strip>;
|
|
132
132
|
billing: z.ZodObject<{
|
|
@@ -196,7 +196,7 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
196
196
|
"a/r": "a/r";
|
|
197
197
|
ceo: "ceo";
|
|
198
198
|
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "a/r" | "ceo")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "a/r" | "ceo")[]>>;
|
|
199
|
-
|
|
199
|
+
dailyServiceCounter: z.ZodOptional<z.ZodRecord<z.ZodLiteral<"undone" | "done">, z.ZodInt>>;
|
|
200
200
|
}, z.core.$strip>>;
|
|
201
201
|
partnerMap: z.ZodOptional<z.ZodRecord<z.ZodUUID, z.ZodRecord<z.ZodUUID, z.ZodObject<{
|
|
202
202
|
addedAt: z.ZodISODateTime;
|
|
@@ -238,11 +238,11 @@ declare const MutableCompanyDetails: z.ZodObject<{
|
|
|
238
238
|
scheduler: "scheduler";
|
|
239
239
|
doctor: "doctor";
|
|
240
240
|
}>>;
|
|
241
|
-
|
|
241
|
+
serviceDistAlg: z.ZodOptional<z.ZodEnum<{
|
|
242
242
|
RR: "RR";
|
|
243
243
|
LOR: "LOR";
|
|
244
244
|
}>>;
|
|
245
|
-
|
|
245
|
+
pps: z.ZodOptional<z.ZodBoolean>;
|
|
246
246
|
servicesDeployed: z.ZodOptional<z.ZodBoolean>;
|
|
247
247
|
}, z.core.$strip>>;
|
|
248
248
|
billing: z.ZodOptional<z.ZodObject<{
|
|
@@ -492,8 +492,8 @@ declare const CompanyPreferences: z.ZodObject<{
|
|
|
492
492
|
scheduler: "scheduler";
|
|
493
493
|
doctor: "doctor";
|
|
494
494
|
}>;
|
|
495
|
-
|
|
496
|
-
|
|
495
|
+
pps: z.ZodBoolean;
|
|
496
|
+
serviceDistAlg: z.ZodEnum<{
|
|
497
497
|
RR: "RR";
|
|
498
498
|
LOR: "LOR";
|
|
499
499
|
}>;
|
|
@@ -506,11 +506,11 @@ declare const MutableCompanyPreferences: z.ZodObject<{
|
|
|
506
506
|
scheduler: "scheduler";
|
|
507
507
|
doctor: "doctor";
|
|
508
508
|
}>;
|
|
509
|
-
|
|
509
|
+
serviceDistAlg: z.ZodEnum<{
|
|
510
510
|
RR: "RR";
|
|
511
511
|
LOR: "LOR";
|
|
512
512
|
}>;
|
|
513
|
-
|
|
513
|
+
pps: z.ZodBoolean;
|
|
514
514
|
servicesDeployed: z.ZodBoolean;
|
|
515
515
|
}, z.core.$strip>;
|
|
516
516
|
type MutableCompanyPreferences = z.infer<typeof MutableCompanyPreferences>;
|
|
@@ -531,7 +531,7 @@ declare const CompanyStaff: z.ZodObject<{
|
|
|
531
531
|
"a/r": "a/r";
|
|
532
532
|
ceo: "ceo";
|
|
533
533
|
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "a/r" | "ceo")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "a/r" | "ceo")[]>>;
|
|
534
|
-
|
|
534
|
+
dailyServiceCounter: z.ZodOptional<z.ZodRecord<z.ZodLiteral<"undone" | "done">, z.ZodInt>>;
|
|
535
535
|
}, z.core.$strip>>;
|
|
536
536
|
partnerMap: z.ZodOptional<z.ZodRecord<z.ZodUUID, z.ZodRecord<z.ZodUUID, z.ZodObject<{
|
|
537
537
|
addedAt: z.ZodISODateTime;
|
|
@@ -649,7 +649,7 @@ declare const CompanySession: z.ZodObject<{
|
|
|
649
649
|
value: z.ZodBoolean;
|
|
650
650
|
lastModified: z.ZodOptional<z.ZodISODateTime>;
|
|
651
651
|
}, z.core.$strip>;
|
|
652
|
-
|
|
652
|
+
serviceCounter: z.ZodRecord<z.ZodLiteral<"undone" | "done">, z.ZodInt>;
|
|
653
653
|
roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
654
654
|
doc: "doc";
|
|
655
655
|
physAsst: "physAsst";
|
|
@@ -908,13 +908,13 @@ declare const ClientForm: z.ZodObject<{
|
|
|
908
908
|
}, z.core.$strip>;
|
|
909
909
|
type ClientForm = z.infer<typeof ClientForm>;
|
|
910
910
|
|
|
911
|
-
declare const
|
|
911
|
+
declare const ServiceSeverity: z.ZodObject<{
|
|
912
912
|
"1": z.ZodLiteral<"Emergency">;
|
|
913
913
|
"2": z.ZodLiteral<"Important">;
|
|
914
914
|
"3": z.ZodLiteral<"Average">;
|
|
915
915
|
}, z.core.$strip>;
|
|
916
|
-
type
|
|
917
|
-
declare const
|
|
916
|
+
type ServiceSeverity = z.infer<typeof ServiceSeverity>;
|
|
917
|
+
declare const ServiceDetails: z.ZodObject<{
|
|
918
918
|
createdAt: z.ZodReadonly<z.ZodISODateTime>;
|
|
919
919
|
lastModified: z.ZodOptional<z.ZodISODateTime>;
|
|
920
920
|
_id: z.ZodUUID;
|
|
@@ -1049,8 +1049,8 @@ declare const TaskDetails: z.ZodObject<{
|
|
|
1049
1049
|
changes: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1050
1050
|
}, z.core.$strip>>>;
|
|
1051
1051
|
}, z.core.$strip>;
|
|
1052
|
-
type
|
|
1053
|
-
declare const
|
|
1052
|
+
type ServiceDetails = z.infer<typeof ServiceDetails>;
|
|
1053
|
+
declare const MutableServiceDetails: z.ZodObject<{
|
|
1054
1054
|
createdAt: z.ZodReadonly<z.ZodISODateTime>;
|
|
1055
1055
|
lastModified: z.ZodOptional<z.ZodISODateTime>;
|
|
1056
1056
|
_id: z.ZodUUID;
|
|
@@ -1186,10 +1186,10 @@ declare const MutableTaskDetails: z.ZodObject<{
|
|
|
1186
1186
|
}, z.core.$strip>>>;
|
|
1187
1187
|
_hash: z.ZodString;
|
|
1188
1188
|
}, z.core.$strip>;
|
|
1189
|
-
type
|
|
1189
|
+
type MutableServiceDetails = z.infer<typeof MutableServiceDetails>;
|
|
1190
1190
|
|
|
1191
1191
|
/** @disclaimer This doesn't handle currency conversion */
|
|
1192
|
-
declare function calcBalance(components: Prettify<Partial<Pick<
|
|
1192
|
+
declare function calcBalance(components: Prettify<Partial<Pick<ServiceDetails, "charges" | "discounts" | "additionalFees" | "prepayments" | "payments">>>, options?: {
|
|
1193
1193
|
logger?: boolean;
|
|
1194
1194
|
}): number;
|
|
1195
1195
|
declare const calcPriceMod: (mods: PriceModList | null | undefined, subtotal: number) => number;
|
|
@@ -1209,4 +1209,4 @@ declare function createNotifId(options?: {
|
|
|
1209
1209
|
to: string;
|
|
1210
1210
|
}): string;
|
|
1211
1211
|
|
|
1212
|
-
export { type AcceptedCurrency, AlphaNumeric, COMPANY_USER_RELATIONSHIP, ClientDetails, ClientForm, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyIndustry, CompanyNotifications, CompanyPreferences, type CompanyServiceSelector, CompanySession, CompanyStaff, CompanyState, type CompanyUserRole, CreateCompanyForm, CreditCurrency, type EmployeeRole, type Gender, type HealthcareProviderRole, InviteResponse, InvoiceNo, MAX_COMPANY_PRICE_MODS, MedicalDetails, Medicine, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, MutableCompanyStaff,
|
|
1212
|
+
export { type AcceptedCurrency, AlphaNumeric, COMPANY_USER_RELATIONSHIP, ClientDetails, ClientForm, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyIndustry, CompanyNotifications, CompanyPreferences, type CompanyServiceSelector, CompanySession, CompanyStaff, CompanyState, type CompanyUserRole, CreateCompanyForm, CreditCurrency, type EmployeeRole, type Gender, type HealthcareProviderRole, InviteResponse, InvoiceNo, MAX_COMPANY_PRICE_MODS, MedicalDetails, Medicine, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, MutableCompanyStaff, MutableServiceDetails, Notification, PaymentDetails, type PaymentMethod, PriceMod, PriceModList, PriceTag, Reason, Receipts, ServiceDetails, type ServiceDistAlg, ServiceSeverity, StandardTime, TicketNo, type Tier, TierList, TimeLog, Timestamp, Trn, UserDetails, Vitals, acceptedCurrencies, adminRoles, calcBalance, calcPriceMod, companyServiceSelectors, companyUserRoles, createNotifId, employeeRoles, genders, getCompatibleRoles, getIncompatibleRoles, healthcareProviderRoles, normalizeCompanyId, normalizeNidKey, parseClientName, paymentMethods, serviceDistAlgs, tiers, vitalKeys };
|
package/dist/main.js
CHANGED
|
@@ -15,7 +15,7 @@ var healthcareProviderRoles = companyUserRoles.extract([
|
|
|
15
15
|
"physAsst",
|
|
16
16
|
"doc"
|
|
17
17
|
]);
|
|
18
|
-
var
|
|
18
|
+
var serviceDistAlgs = z.enum(["RR", "LOR"]);
|
|
19
19
|
var companyServiceSelectors = z.enum(["scheduler", "doctor"]);
|
|
20
20
|
|
|
21
21
|
// src/enums/Global.ts
|
|
@@ -186,7 +186,7 @@ var MutableCompanyBilling = CompanyBilling.omit({
|
|
|
186
186
|
import * as z9 from "zod";
|
|
187
187
|
import { Address, PhoneNumber } from "@wavy/util";
|
|
188
188
|
|
|
189
|
-
// src/schemas/company/
|
|
189
|
+
// src/schemas/company/core/CompanyIndustry.ts
|
|
190
190
|
import * as z8 from "zod";
|
|
191
191
|
var CompanyIndustry = z8.object({
|
|
192
192
|
healthcare: z8.object({
|
|
@@ -198,7 +198,7 @@ var CompanyIndustry = z8.object({
|
|
|
198
198
|
})
|
|
199
199
|
});
|
|
200
200
|
|
|
201
|
-
// src/schemas/company/
|
|
201
|
+
// src/schemas/company/core/utils.ts
|
|
202
202
|
var getInvalidSectorError = (industry, sector) => `Invalid sector: "${sector}" isn't a sector under the "${industry}" industry.`;
|
|
203
203
|
var COMPANY_USER_RELATIONSHIP = {
|
|
204
204
|
doc: ["physAsst"],
|
|
@@ -256,18 +256,18 @@ var CompanyPreferences = z10.object({
|
|
|
256
256
|
_id: CompanyState.shape._id,
|
|
257
257
|
/** The user that's allowed to record the client's services. */
|
|
258
258
|
serviceSelector: companyServiceSelectors,
|
|
259
|
-
/** Pay per
|
|
260
|
-
|
|
259
|
+
/** Pay per service */
|
|
260
|
+
pps: z10.boolean(),
|
|
261
261
|
/**
|
|
262
262
|
* @property RR (Round Robin): Even distribution.
|
|
263
263
|
* @property LOR (Least Outstanding Requests): Distribute based on availability.
|
|
264
264
|
*/
|
|
265
|
-
|
|
265
|
+
serviceDistAlg: serviceDistAlgs,
|
|
266
266
|
servicesDeployed: z10.boolean(),
|
|
267
267
|
...TimeLog.shape
|
|
268
268
|
}).refine(
|
|
269
|
-
(data) => !data.
|
|
270
|
-
`Pay per
|
|
269
|
+
(data) => !data.pps || data.pps && data.serviceSelector === "scheduler",
|
|
270
|
+
`Pay per service is only allowed when the service selector is the "${"scheduler"}".`
|
|
271
271
|
);
|
|
272
272
|
var MutableCompanyPreferences = CompanyPreferences.omit({
|
|
273
273
|
_id: true,
|
|
@@ -409,7 +409,7 @@ var parseClientName = ({
|
|
|
409
409
|
lastName
|
|
410
410
|
}) => [firstName, middleName[0] + ".", lastName].join(" ");
|
|
411
411
|
|
|
412
|
-
// src/schemas/company/
|
|
412
|
+
// src/schemas/company/core/CompanySession.ts
|
|
413
413
|
import * as z13 from "zod";
|
|
414
414
|
var CompanySession = z13.object({
|
|
415
415
|
_id: z13.uuidv4(),
|
|
@@ -425,7 +425,7 @@ var CompanySession = z13.object({
|
|
|
425
425
|
value: z13.boolean(),
|
|
426
426
|
lastModified: Timestamp.optional()
|
|
427
427
|
}),
|
|
428
|
-
|
|
428
|
+
serviceCounter: z13.record(z13.literal(["undone", "done"]), z13.int().min(0)),
|
|
429
429
|
roles: CompanyMemberRoles,
|
|
430
430
|
ttl: z13.number(),
|
|
431
431
|
expiresAfter: z13.date(),
|
|
@@ -447,7 +447,7 @@ var CompanyStaff = z14.object({
|
|
|
447
447
|
joinedAt: Timestamp,
|
|
448
448
|
lastActive: Timestamp,
|
|
449
449
|
roles: CompanyMemberRoles,
|
|
450
|
-
|
|
450
|
+
dailyServiceCounter: CompanySession.shape.serviceCounter.optional()
|
|
451
451
|
})
|
|
452
452
|
),
|
|
453
453
|
/**
|
|
@@ -626,7 +626,7 @@ var CompanyNotifications = z17.array(Notification).refine(
|
|
|
626
626
|
"A company can't receive a company invite."
|
|
627
627
|
);
|
|
628
628
|
|
|
629
|
-
// src/schemas/company/
|
|
629
|
+
// src/schemas/company/core/CreateCompanyForm.ts
|
|
630
630
|
import * as z18 from "zod";
|
|
631
631
|
var CreateCompanyForm = z18.object({
|
|
632
632
|
alias: CompanyIdentity.shape.alias.optional(),
|
|
@@ -645,7 +645,7 @@ var CreateCompanyForm = z18.object({
|
|
|
645
645
|
}
|
|
646
646
|
});
|
|
647
647
|
|
|
648
|
-
// src/schemas/
|
|
648
|
+
// src/schemas/company/core/service/payloads/Medical.ts
|
|
649
649
|
import * as z19 from "zod";
|
|
650
650
|
var Vitals = z19.record(
|
|
651
651
|
vitalKeys,
|
|
@@ -680,20 +680,20 @@ var MedicalDetails = z19.object({
|
|
|
680
680
|
).optional()
|
|
681
681
|
});
|
|
682
682
|
|
|
683
|
-
// src/schemas/
|
|
683
|
+
// src/schemas/company/core/service/ServiceDetails.ts
|
|
684
684
|
import * as z20 from "zod";
|
|
685
|
-
var
|
|
685
|
+
var ServiceSeverity = z20.object({
|
|
686
686
|
"1": z20.literal("Emergency"),
|
|
687
687
|
"2": z20.literal("Important"),
|
|
688
688
|
"3": z20.literal("Average")
|
|
689
689
|
});
|
|
690
|
-
var
|
|
690
|
+
var ServiceDetails = z20.object({
|
|
691
691
|
/** A random uid that identifies the document. */
|
|
692
692
|
_id: z20.uuidv4(),
|
|
693
693
|
/** The amount of credits used to create the appointment */
|
|
694
694
|
_cost: z20.number().readonly(),
|
|
695
695
|
// This helps to identify the urgency of the appointment
|
|
696
|
-
severity: z20.string().refine((data) =>
|
|
696
|
+
severity: z20.string().refine((data) => ServiceSeverity.keyof().safeParse(data).success),
|
|
697
697
|
/** The company's uid */
|
|
698
698
|
src: CompanyState.shape._id,
|
|
699
699
|
/** The ticket number */
|
|
@@ -744,8 +744,8 @@ var TaskDetails = z20.object({
|
|
|
744
744
|
lockedBy: UserDetails.shape._id.optional(),
|
|
745
745
|
/** Role based access control
|
|
746
746
|
* If a role is:
|
|
747
|
-
* [1] Ommitted -> any user with that role that's from the same company can access the
|
|
748
|
-
* [1] Addded -> only the users that have that role and an id in the respective array can access the
|
|
747
|
+
* [1] Ommitted -> any user with that role that's from the same company can access the ServiceDetails.
|
|
748
|
+
* [1] Addded -> only the users that have that role and an id in the respective array can access the ServiceDetails.
|
|
749
749
|
*/
|
|
750
750
|
rbac: z20.record(companyUserRoles, z20.array(UserDetails.shape._id).optional()),
|
|
751
751
|
timeline: z20.record(
|
|
@@ -778,7 +778,7 @@ var TaskDetails = z20.object({
|
|
|
778
778
|
// } satisfies Record<z.infer<typeof serviceProviders>, any>),
|
|
779
779
|
...TimeLog.shape
|
|
780
780
|
});
|
|
781
|
-
var
|
|
781
|
+
var MutableServiceDetails = ServiceDetails.safeExtend(
|
|
782
782
|
z20.object({
|
|
783
783
|
/**
|
|
784
784
|
* @description An encrypted copy of the last state of the appointment.
|
|
@@ -856,7 +856,7 @@ export {
|
|
|
856
856
|
MutableCompanyIdentity,
|
|
857
857
|
MutableCompanyPreferences,
|
|
858
858
|
MutableCompanyStaff,
|
|
859
|
-
|
|
859
|
+
MutableServiceDetails,
|
|
860
860
|
Notification,
|
|
861
861
|
PaymentDetails,
|
|
862
862
|
PriceMod,
|
|
@@ -864,9 +864,9 @@ export {
|
|
|
864
864
|
PriceTag,
|
|
865
865
|
Reason,
|
|
866
866
|
Receipts,
|
|
867
|
+
ServiceDetails,
|
|
868
|
+
ServiceSeverity,
|
|
867
869
|
StandardTime,
|
|
868
|
-
TaskDetails,
|
|
869
|
-
TaskSeverity,
|
|
870
870
|
TicketNo,
|
|
871
871
|
TierList,
|
|
872
872
|
TimeLog,
|
|
@@ -890,7 +890,7 @@ export {
|
|
|
890
890
|
normalizeNidKey,
|
|
891
891
|
parseClientName,
|
|
892
892
|
paymentMethods,
|
|
893
|
-
|
|
893
|
+
serviceDistAlgs,
|
|
894
894
|
tiers,
|
|
895
895
|
vitalKeys
|
|
896
896
|
};
|