@bizmap/sdk 0.0.127 → 0.0.129
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 +82 -75
- package/dist/main.js +87 -86
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -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
|
+
serviceCounter: 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;
|
|
@@ -515,6 +515,15 @@ declare const MutableCompanyPreferences: z.ZodObject<{
|
|
|
515
515
|
}, z.core.$strip>;
|
|
516
516
|
type MutableCompanyPreferences = z.infer<typeof MutableCompanyPreferences>;
|
|
517
517
|
|
|
518
|
+
declare const CompanyMemberRoles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
519
|
+
doc: "doc";
|
|
520
|
+
physAsst: "physAsst";
|
|
521
|
+
rcpst: "rcpst";
|
|
522
|
+
cshr: "cshr";
|
|
523
|
+
"a/r": "a/r";
|
|
524
|
+
ceo: "ceo";
|
|
525
|
+
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "a/r" | "ceo")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "a/r" | "ceo")[]>>;
|
|
526
|
+
type CompanyMemberRoles = z.infer<typeof CompanyMemberRoles>;
|
|
518
527
|
declare const CompanyStaff: z.ZodObject<{
|
|
519
528
|
createdAt: z.ZodReadonly<z.ZodISODateTime>;
|
|
520
529
|
lastModified: z.ZodOptional<z.ZodISODateTime>;
|
|
@@ -531,7 +540,7 @@ declare const CompanyStaff: z.ZodObject<{
|
|
|
531
540
|
"a/r": "a/r";
|
|
532
541
|
ceo: "ceo";
|
|
533
542
|
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "a/r" | "ceo")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "a/r" | "ceo")[]>>;
|
|
534
|
-
|
|
543
|
+
serviceCounter: z.ZodOptional<z.ZodRecord<z.ZodLiteral<"undone" | "done">, z.ZodInt>>;
|
|
535
544
|
}, z.core.$strip>>;
|
|
536
545
|
partnerMap: z.ZodOptional<z.ZodRecord<z.ZodUUID, z.ZodRecord<z.ZodUUID, z.ZodObject<{
|
|
537
546
|
addedAt: z.ZodISODateTime;
|
|
@@ -601,7 +610,57 @@ declare const CompanyState: z.ZodObject<{
|
|
|
601
610
|
}, z.core.$strip>;
|
|
602
611
|
type CompanyState = z.infer<typeof CompanyState>;
|
|
603
612
|
|
|
604
|
-
declare const
|
|
613
|
+
declare const ClientDetails: z.ZodObject<{
|
|
614
|
+
createdAt: z.ZodReadonly<z.ZodISODateTime>;
|
|
615
|
+
lastModified: z.ZodOptional<z.ZodISODateTime>;
|
|
616
|
+
_id: z.ZodUUID;
|
|
617
|
+
photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
618
|
+
firstName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
619
|
+
middleName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
620
|
+
lastName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
621
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
622
|
+
dob: z.ZodISODateTime;
|
|
623
|
+
sex: z.ZodEnum<{
|
|
624
|
+
male: "male";
|
|
625
|
+
female: "female";
|
|
626
|
+
}>;
|
|
627
|
+
isGlobal: z.ZodBoolean;
|
|
628
|
+
origin: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
629
|
+
visits: z.ZodOptional<z.ZodRecord<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodArray<z.ZodISODateTime>>>;
|
|
630
|
+
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
631
|
+
nid: z.ZodOptional<z.ZodObject<{
|
|
632
|
+
trn: z.ZodOptional<z.ZodString>;
|
|
633
|
+
nin: z.ZodOptional<z.ZodString>;
|
|
634
|
+
passportNo: z.ZodOptional<z.ZodString>;
|
|
635
|
+
}, z.core.$strip>>;
|
|
636
|
+
attributes: z.ZodOptional<z.ZodObject<{
|
|
637
|
+
motherMaidenName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
638
|
+
fatherMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
639
|
+
motherMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
640
|
+
oldestSiblingMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
641
|
+
firstSchoolName: z.ZodOptional<z.ZodString>;
|
|
642
|
+
}, z.core.$strip>>;
|
|
643
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
644
|
+
streetAddress: z.ZodString;
|
|
645
|
+
city: z.ZodOptional<z.ZodString>;
|
|
646
|
+
parish: z.ZodString;
|
|
647
|
+
country: z.ZodString;
|
|
648
|
+
}, z.core.$strip>>;
|
|
649
|
+
linkedTo: z.ZodOptional<z.ZodUUID>;
|
|
650
|
+
}, z.core.$strip>;
|
|
651
|
+
type ClientDetails = z.infer<typeof ClientDetails>;
|
|
652
|
+
|
|
653
|
+
declare const ClientForm: z.ZodObject<{
|
|
654
|
+
firstName: z.ZodNonOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
655
|
+
lastName: z.ZodNonOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
656
|
+
middleName: z.ZodNonOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
657
|
+
dob: z.ZodNonOptional<z.ZodISODateTime>;
|
|
658
|
+
sex: z.ZodNonOptional<z.ZodEnum<{
|
|
659
|
+
male: "male";
|
|
660
|
+
female: "female";
|
|
661
|
+
}>>;
|
|
662
|
+
}, z.core.$strip>;
|
|
663
|
+
type ClientForm = z.infer<typeof ClientForm>;
|
|
605
664
|
|
|
606
665
|
declare const CreateCompanyForm: z.ZodObject<{
|
|
607
666
|
_id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -640,31 +699,30 @@ declare const CompanySession: z.ZodObject<{
|
|
|
640
699
|
createdAt: z.ZodReadonly<z.ZodISODateTime>;
|
|
641
700
|
lastModified: z.ZodOptional<z.ZodISODateTime>;
|
|
642
701
|
_id: z.ZodUUID;
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
702
|
+
user: z.ZodObject<{
|
|
703
|
+
_id: z.ZodUUID;
|
|
704
|
+
ip: z.ZodString;
|
|
705
|
+
email: z.ZodEmail;
|
|
706
|
+
roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
707
|
+
doc: "doc";
|
|
708
|
+
physAsst: "physAsst";
|
|
709
|
+
rcpst: "rcpst";
|
|
710
|
+
cshr: "cshr";
|
|
711
|
+
"a/r": "a/r";
|
|
712
|
+
ceo: "ceo";
|
|
713
|
+
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "a/r" | "ceo")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "a/r" | "ceo")[]>>;
|
|
714
|
+
available: z.ZodBoolean;
|
|
715
|
+
busy: z.ZodBoolean;
|
|
716
|
+
serviceCounter: z.ZodNonOptional<z.ZodOptional<z.ZodRecord<z.ZodLiteral<"undone" | "done">, z.ZodInt>>>;
|
|
653
717
|
}, z.core.$strip>;
|
|
654
|
-
|
|
655
|
-
roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
656
|
-
doc: "doc";
|
|
657
|
-
physAsst: "physAsst";
|
|
658
|
-
rcpst: "rcpst";
|
|
659
|
-
cshr: "cshr";
|
|
660
|
-
"a/r": "a/r";
|
|
661
|
-
ceo: "ceo";
|
|
662
|
-
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "a/r" | "ceo")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "a/r" | "ceo")[]>>;
|
|
718
|
+
companyId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
663
719
|
ttl: z.ZodNumber;
|
|
664
720
|
expiresAfter: z.ZodDate;
|
|
665
721
|
}, z.core.$strip>;
|
|
666
722
|
type CompanySession = z.infer<typeof CompanySession>;
|
|
667
723
|
|
|
724
|
+
declare const COMPANY_USER_RELATIONSHIP: Partial<Record<CompanyUserRole, CompanyUserRole[]>>;
|
|
725
|
+
|
|
668
726
|
declare const TierList: z.ZodRecord<z.ZodEnum<{
|
|
669
727
|
basic: "basic";
|
|
670
728
|
pro: "pro";
|
|
@@ -854,62 +912,11 @@ declare const UserDetails: z.ZodObject<{
|
|
|
854
912
|
auto: z.ZodOptional<z.ZodISODateTime>;
|
|
855
913
|
manual: z.ZodOptional<z.ZodISODateTime>;
|
|
856
914
|
}, z.core.$strip>;
|
|
857
|
-
|
|
915
|
+
companyIds: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
858
916
|
photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
859
917
|
}, z.core.$strip>;
|
|
860
918
|
type UserDetails = z.infer<typeof UserDetails>;
|
|
861
919
|
|
|
862
|
-
declare const ClientDetails: z.ZodObject<{
|
|
863
|
-
createdAt: z.ZodReadonly<z.ZodISODateTime>;
|
|
864
|
-
lastModified: z.ZodOptional<z.ZodISODateTime>;
|
|
865
|
-
_id: z.ZodUUID;
|
|
866
|
-
photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
867
|
-
firstName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
868
|
-
middleName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
869
|
-
lastName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
870
|
-
email: z.ZodOptional<z.ZodEmail>;
|
|
871
|
-
dob: z.ZodISODateTime;
|
|
872
|
-
sex: z.ZodEnum<{
|
|
873
|
-
male: "male";
|
|
874
|
-
female: "female";
|
|
875
|
-
}>;
|
|
876
|
-
isGlobal: z.ZodBoolean;
|
|
877
|
-
origin: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
878
|
-
visits: z.ZodOptional<z.ZodRecord<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodArray<z.ZodISODateTime>>>;
|
|
879
|
-
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
880
|
-
nid: z.ZodOptional<z.ZodObject<{
|
|
881
|
-
trn: z.ZodOptional<z.ZodString>;
|
|
882
|
-
nin: z.ZodOptional<z.ZodString>;
|
|
883
|
-
passportNo: z.ZodOptional<z.ZodString>;
|
|
884
|
-
}, z.core.$strip>>;
|
|
885
|
-
attributes: z.ZodOptional<z.ZodObject<{
|
|
886
|
-
motherMaidenName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
887
|
-
fatherMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
888
|
-
motherMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
889
|
-
oldestSiblingMiddleName: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
890
|
-
firstSchoolName: z.ZodOptional<z.ZodString>;
|
|
891
|
-
}, z.core.$strip>>;
|
|
892
|
-
address: z.ZodOptional<z.ZodObject<{
|
|
893
|
-
streetAddress: z.ZodString;
|
|
894
|
-
city: z.ZodOptional<z.ZodString>;
|
|
895
|
-
parish: z.ZodString;
|
|
896
|
-
country: z.ZodString;
|
|
897
|
-
}, z.core.$strip>>;
|
|
898
|
-
linkedTo: z.ZodOptional<z.ZodUUID>;
|
|
899
|
-
}, z.core.$strip>;
|
|
900
|
-
type ClientDetails = z.infer<typeof ClientDetails>;
|
|
901
|
-
declare const ClientForm: z.ZodObject<{
|
|
902
|
-
firstName: z.ZodNonOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
903
|
-
lastName: z.ZodNonOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
904
|
-
middleName: z.ZodNonOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
905
|
-
dob: z.ZodNonOptional<z.ZodISODateTime>;
|
|
906
|
-
sex: z.ZodNonOptional<z.ZodEnum<{
|
|
907
|
-
male: "male";
|
|
908
|
-
female: "female";
|
|
909
|
-
}>>;
|
|
910
|
-
}, z.core.$strip>;
|
|
911
|
-
type ClientForm = z.infer<typeof ClientForm>;
|
|
912
|
-
|
|
913
920
|
declare const ServiceSeverity: z.ZodObject<{
|
|
914
921
|
"1": z.ZodLiteral<"Emergency">;
|
|
915
922
|
"2": z.ZodLiteral<"Important">;
|
|
@@ -1211,4 +1218,4 @@ declare function createNotifId(options?: {
|
|
|
1211
1218
|
to: string;
|
|
1212
1219
|
}): string;
|
|
1213
1220
|
|
|
1214
|
-
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, safeParseSector, serviceDistAlgs, tiers, vitalKeys };
|
|
1221
|
+
export { type AcceptedCurrency, AlphaNumeric, COMPANY_USER_RELATIONSHIP, ClientDetails, ClientForm, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyIndustry, CompanyMemberRoles, 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, safeParseSector, serviceDistAlgs, tiers, vitalKeys };
|
package/dist/main.js
CHANGED
|
@@ -37,7 +37,7 @@ var vitalKeys = z3.enum([
|
|
|
37
37
|
]);
|
|
38
38
|
|
|
39
39
|
// src/schemas/company/CompanyDetails.ts
|
|
40
|
-
import * as
|
|
40
|
+
import * as z14 from "zod";
|
|
41
41
|
|
|
42
42
|
// src/schemas/company/components/Billing.ts
|
|
43
43
|
import * as z7 from "zod";
|
|
@@ -146,7 +146,7 @@ var CompanyState = z6.object({
|
|
|
146
146
|
lastModified: Timestamp.optional()
|
|
147
147
|
}),
|
|
148
148
|
count: z6.object({
|
|
149
|
-
invoiceNo: z6.int().
|
|
149
|
+
invoiceNo: z6.int().min(0),
|
|
150
150
|
tktNo: z6.int().min(1)
|
|
151
151
|
}),
|
|
152
152
|
// distRoleIds: z.array(z.string()),
|
|
@@ -186,7 +186,7 @@ var MutableCompanyBilling = CompanyBilling.omit({
|
|
|
186
186
|
import { Address, PhoneNumber } from "@wavy/util";
|
|
187
187
|
import * as z9 from "zod";
|
|
188
188
|
|
|
189
|
-
// src/schemas/company/
|
|
189
|
+
// src/schemas/company/entities/Industry.ts
|
|
190
190
|
import * as z8 from "zod";
|
|
191
191
|
var CompanyIndustry = z8.object({
|
|
192
192
|
healthcare: z8.object({
|
|
@@ -276,15 +276,15 @@ var MutableCompanyPreferences = CompanyPreferences.omit({
|
|
|
276
276
|
|
|
277
277
|
// src/schemas/company/components/Staff.ts
|
|
278
278
|
import { distinct } from "@wavy/fn";
|
|
279
|
-
import * as
|
|
279
|
+
import * as z13 from "zod";
|
|
280
280
|
|
|
281
281
|
// src/functions/helper-functions.ts
|
|
282
282
|
import { camelCaseToLetter, upperFirst } from "@wavy/fn";
|
|
283
283
|
|
|
284
|
-
// src/schemas/
|
|
284
|
+
// src/schemas/company/entities/client/Details.ts
|
|
285
285
|
import * as z12 from "zod";
|
|
286
286
|
|
|
287
|
-
// src/schemas/
|
|
287
|
+
// src/schemas/user/Details.ts
|
|
288
288
|
import { UserModel } from "@wavy/util";
|
|
289
289
|
import * as z11 from "zod";
|
|
290
290
|
|
|
@@ -292,7 +292,7 @@ import * as z11 from "zod";
|
|
|
292
292
|
var NOTIF_ID_DELIM = "::";
|
|
293
293
|
var MAX_NAME_LENGTH = 21;
|
|
294
294
|
|
|
295
|
-
// src/schemas/
|
|
295
|
+
// src/schemas/user/Details.ts
|
|
296
296
|
var UserDetails = z11.object({
|
|
297
297
|
...UserModel.shape,
|
|
298
298
|
_id: z11.uuidv4(),
|
|
@@ -320,12 +320,12 @@ var UserDetails = z11.object({
|
|
|
320
320
|
auto: Timestamp,
|
|
321
321
|
manual: Timestamp
|
|
322
322
|
}).partial(),
|
|
323
|
-
|
|
323
|
+
companyIds: z11.array(CompanyState.shape._id).min(1).optional(),
|
|
324
324
|
// resumeToken: z.uuidv4().optional(),
|
|
325
325
|
...TimeLog.shape
|
|
326
326
|
}).omit({ uid: true });
|
|
327
327
|
|
|
328
|
-
// src/schemas/
|
|
328
|
+
// src/schemas/company/entities/client/Details.ts
|
|
329
329
|
import { Address as Address2, PhoneNumber as PhoneNumber2 } from "@wavy/util";
|
|
330
330
|
var Name = z12.string().trim().min(2).max(MAX_NAME_LENGTH).transform((d) => d.replace(/-+/g, "-").replace(/'+/g, "'")).superRefine((data, ctx) => {
|
|
331
331
|
const invalidCharIdx = data.search(/[^a-z'-]/i);
|
|
@@ -374,15 +374,8 @@ var ClientDetails = UserDetails.pick({
|
|
|
374
374
|
linkedTo: UserDetails.shape._id.optional()
|
|
375
375
|
}).shape
|
|
376
376
|
);
|
|
377
|
-
var ClientForm = ClientDetails.pick({
|
|
378
|
-
firstName: true,
|
|
379
|
-
middleName: true,
|
|
380
|
-
lastName: true,
|
|
381
|
-
dob: true,
|
|
382
|
-
sex: true
|
|
383
|
-
}).required();
|
|
384
377
|
|
|
385
|
-
// src/schemas/company/
|
|
378
|
+
// src/schemas/company/entities/utils.ts
|
|
386
379
|
var COMPANY_USER_RELATIONSHIP = {
|
|
387
380
|
doc: ["physAsst"],
|
|
388
381
|
physAsst: ["doc"]
|
|
@@ -415,59 +408,36 @@ var parseClientName = ({
|
|
|
415
408
|
lastName
|
|
416
409
|
}) => [firstName, middleName[0] + ".", lastName].join(" ");
|
|
417
410
|
|
|
418
|
-
// src/schemas/company/core/CompanySession.ts
|
|
419
|
-
import * as z13 from "zod";
|
|
420
|
-
var CompanySession = z13.object({
|
|
421
|
-
_id: z13.uuidv4(),
|
|
422
|
-
userId: UserDetails.shape._id,
|
|
423
|
-
// user: UserDetails.pick({ _id: true, name: true, email: true }),
|
|
424
|
-
companyId: CompanyState.shape._id,
|
|
425
|
-
deviceId: z13.string().trim().min(15),
|
|
426
|
-
isAvailable: z13.object({
|
|
427
|
-
value: z13.boolean(),
|
|
428
|
-
lastModified: Timestamp.optional()
|
|
429
|
-
}),
|
|
430
|
-
isBusy: z13.object({
|
|
431
|
-
value: z13.boolean(),
|
|
432
|
-
lastModified: Timestamp.optional()
|
|
433
|
-
}),
|
|
434
|
-
serviceCounter: z13.record(z13.literal(["undone", "done"]), z13.int().min(0)),
|
|
435
|
-
roles: CompanyMemberRoles,
|
|
436
|
-
ttl: z13.number(),
|
|
437
|
-
expiresAfter: z13.date(),
|
|
438
|
-
...TimeLog.shape
|
|
439
|
-
});
|
|
440
|
-
|
|
441
411
|
// src/schemas/company/components/Staff.ts
|
|
442
|
-
var CompanyMemberRoles =
|
|
412
|
+
var CompanyMemberRoles = z13.array(companyUserRoles).transform((roles) => distinct(roles).sort()).refine((roles) => {
|
|
443
413
|
return !roles.find(
|
|
444
414
|
(role) => getIncompatibleRoles(role).some((r) => roles.includes(r))
|
|
445
415
|
);
|
|
446
416
|
}, "A user is not allowed to have conflicting roles.");
|
|
447
|
-
var CompanyStaff =
|
|
417
|
+
var CompanyStaff = z13.object({
|
|
448
418
|
_id: CompanyState.shape._id,
|
|
449
|
-
members:
|
|
419
|
+
members: z13.record(
|
|
450
420
|
UserDetails.shape._id,
|
|
451
|
-
|
|
421
|
+
z13.object({
|
|
452
422
|
invitedAt: Timestamp.optional(),
|
|
453
423
|
joinedAt: Timestamp,
|
|
454
424
|
lastActive: Timestamp,
|
|
455
425
|
roles: CompanyMemberRoles,
|
|
456
|
-
|
|
426
|
+
serviceCounter: z13.record(z13.literal(["undone", "done"]), z13.int().min(0)).optional()
|
|
457
427
|
})
|
|
458
428
|
),
|
|
459
429
|
/**
|
|
460
430
|
* @relationship one -> many
|
|
461
431
|
*@description A map of doctor `uids` to their assistants `uids` */
|
|
462
|
-
partnerMap:
|
|
432
|
+
partnerMap: z13.record(
|
|
463
433
|
UserDetails.shape._id,
|
|
464
|
-
|
|
434
|
+
z13.record(UserDetails.shape._id, z13.object({ addedAt: Timestamp }))
|
|
465
435
|
).optional(),
|
|
466
|
-
updateQueue:
|
|
436
|
+
updateQueue: z13.record(
|
|
467
437
|
UserDetails.shape._id,
|
|
468
|
-
|
|
469
|
-
$REMOVE:
|
|
470
|
-
$CHANGE_ROLES:
|
|
438
|
+
z13.object({
|
|
439
|
+
$REMOVE: z13.object({ addedAt: Timestamp }),
|
|
440
|
+
$CHANGE_ROLES: z13.object({
|
|
471
441
|
newRoles: CompanyMemberRoles,
|
|
472
442
|
addedAt: Timestamp
|
|
473
443
|
})
|
|
@@ -501,7 +471,7 @@ var MutableCompanyStaff = CompanyStaff.pick({
|
|
|
501
471
|
});
|
|
502
472
|
|
|
503
473
|
// src/schemas/company/CompanyDetails.ts
|
|
504
|
-
var CompanyDetails =
|
|
474
|
+
var CompanyDetails = z14.object({
|
|
505
475
|
_id: CompanyState.shape._id,
|
|
506
476
|
identity: CompanyIdentity.omit({ _id: true }),
|
|
507
477
|
// notifications: CompanyNotifications,
|
|
@@ -511,7 +481,7 @@ var CompanyDetails = z15.object({
|
|
|
511
481
|
billing: CompanyBilling.omit({ _id: true }),
|
|
512
482
|
staff: CompanyStaff.omit({ _id: true })
|
|
513
483
|
});
|
|
514
|
-
var MutableCompanyDetails =
|
|
484
|
+
var MutableCompanyDetails = z14.object({
|
|
515
485
|
_id: CompanyDetails.shape._id,
|
|
516
486
|
identity: MutableCompanyIdentity.partial().optional(),
|
|
517
487
|
preferences: MutableCompanyPreferences.partial().optional(),
|
|
@@ -520,28 +490,28 @@ var MutableCompanyDetails = z15.object({
|
|
|
520
490
|
});
|
|
521
491
|
|
|
522
492
|
// src/schemas/company/components/Notifications.ts
|
|
523
|
-
import * as
|
|
493
|
+
import * as z16 from "zod";
|
|
524
494
|
|
|
525
495
|
// src/schemas/Global.ts
|
|
526
|
-
import * as
|
|
527
|
-
var TierList =
|
|
496
|
+
import * as z15 from "zod";
|
|
497
|
+
var TierList = z15.record(
|
|
528
498
|
tiers,
|
|
529
|
-
|
|
530
|
-
cost:
|
|
531
|
-
perks:
|
|
499
|
+
z15.object({
|
|
500
|
+
cost: z15.number().min(0),
|
|
501
|
+
perks: z15.array(z15.string()).min(1)
|
|
532
502
|
})
|
|
533
503
|
).superRefine((data, ctx) => {
|
|
534
504
|
if (data.basic.cost !== 0) {
|
|
535
505
|
ctx.addIssue("The basic tier must always cost $0.00");
|
|
536
506
|
}
|
|
537
507
|
});
|
|
538
|
-
var Notification =
|
|
539
|
-
_id:
|
|
540
|
-
const isUUidV4 =
|
|
508
|
+
var Notification = z15.object({
|
|
509
|
+
_id: z15.string().superRefine((data, ctx) => {
|
|
510
|
+
const isUUidV4 = z15.uuidv4().safeParse(data).success;
|
|
541
511
|
if (isUUidV4) return;
|
|
542
512
|
let [from, to, nonce] = data.split(NOTIF_ID_DELIM);
|
|
543
513
|
nonce = nonce?.trim() || "";
|
|
544
|
-
const parsedFrom =
|
|
514
|
+
const parsedFrom = z15.uuidv4().or(z15.uuidv7()).safeParse(from);
|
|
545
515
|
if (!parsedFrom.success) {
|
|
546
516
|
ctx.addIssue({
|
|
547
517
|
code: "custom",
|
|
@@ -549,7 +519,7 @@ var Notification = z16.object({
|
|
|
549
519
|
path: ["from"]
|
|
550
520
|
});
|
|
551
521
|
}
|
|
552
|
-
const parsedTo =
|
|
522
|
+
const parsedTo = z15.uuidv4().safeParse(to);
|
|
553
523
|
if (!parsedTo.success) {
|
|
554
524
|
ctx.addIssue({
|
|
555
525
|
code: "custom",
|
|
@@ -565,19 +535,19 @@ var Notification = z16.object({
|
|
|
565
535
|
});
|
|
566
536
|
}
|
|
567
537
|
}),
|
|
568
|
-
code:
|
|
538
|
+
code: z15.literal([
|
|
569
539
|
"INVITE_RESPONSE",
|
|
570
540
|
"COMPANY_INVITE",
|
|
571
541
|
"DEV_MESSAGE",
|
|
572
542
|
"ALERT"
|
|
573
543
|
]),
|
|
574
|
-
payload:
|
|
575
|
-
isArchived:
|
|
576
|
-
rcpt:
|
|
577
|
-
src:
|
|
578
|
-
_id:
|
|
579
|
-
name:
|
|
580
|
-
photoUrl:
|
|
544
|
+
payload: z15.string(),
|
|
545
|
+
isArchived: z15.boolean().optional(),
|
|
546
|
+
rcpt: z15.uuidv4().or(z15.uuidv7()).nullable(),
|
|
547
|
+
src: z15.object({
|
|
548
|
+
_id: z15.uuidv4().or(z15.uuidv7()),
|
|
549
|
+
name: z15.string(),
|
|
550
|
+
photoUrl: z15.string().nullish()
|
|
581
551
|
}),
|
|
582
552
|
createdAt: Timestamp
|
|
583
553
|
}).superRefine((data, ctx) => {
|
|
@@ -588,7 +558,7 @@ var Notification = z16.object({
|
|
|
588
558
|
};
|
|
589
559
|
switch (data.code) {
|
|
590
560
|
case "COMPANY_INVITE":
|
|
591
|
-
if (!
|
|
561
|
+
if (!z15.jwt().safeParse(data.payload).success) {
|
|
592
562
|
ctx.addIssue("The payload of company invite must be a valid jwt.");
|
|
593
563
|
}
|
|
594
564
|
break;
|
|
@@ -609,32 +579,41 @@ var Notification = z16.object({
|
|
|
609
579
|
return data.code;
|
|
610
580
|
}
|
|
611
581
|
});
|
|
612
|
-
var CreditCurrency =
|
|
613
|
-
uid:
|
|
614
|
-
cost:
|
|
615
|
-
value:
|
|
582
|
+
var CreditCurrency = z15.object({
|
|
583
|
+
uid: z15.uuidv4(),
|
|
584
|
+
cost: z15.object({ value: z15.number().min(0), currency: acceptedCurrencies }),
|
|
585
|
+
value: z15.int().min(0),
|
|
616
586
|
...TimeLog.shape
|
|
617
587
|
});
|
|
618
|
-
var PaymentDetails =
|
|
588
|
+
var PaymentDetails = z15.object({
|
|
619
589
|
// Used to track the payments recorded by each paymentCollector
|
|
620
|
-
uid:
|
|
590
|
+
uid: z15.uuidv4(),
|
|
621
591
|
method: paymentMethods,
|
|
622
592
|
currency: acceptedCurrencies,
|
|
623
|
-
amount:
|
|
593
|
+
amount: z15.number().min(1),
|
|
624
594
|
// Rate chart id (used to identify the rate chart used to convert the amount )
|
|
625
595
|
// rcid: z.uuidv4(),
|
|
626
596
|
...TimeLog.shape
|
|
627
597
|
});
|
|
628
598
|
|
|
629
599
|
// src/schemas/company/components/Notifications.ts
|
|
630
|
-
var CompanyNotifications =
|
|
600
|
+
var CompanyNotifications = z16.array(Notification).refine(
|
|
631
601
|
(data) => data.every((notif) => notif.code !== "COMPANY_INVITE"),
|
|
632
602
|
"A company can't receive a company invite."
|
|
633
603
|
);
|
|
634
604
|
|
|
635
|
-
// src/schemas/company/
|
|
636
|
-
|
|
637
|
-
|
|
605
|
+
// src/schemas/company/entities/client/Form.ts
|
|
606
|
+
var ClientForm = ClientDetails.pick({
|
|
607
|
+
firstName: true,
|
|
608
|
+
middleName: true,
|
|
609
|
+
lastName: true,
|
|
610
|
+
dob: true,
|
|
611
|
+
sex: true
|
|
612
|
+
}).required();
|
|
613
|
+
|
|
614
|
+
// src/schemas/company/entities/CreateCompanyForm.ts
|
|
615
|
+
import * as z17 from "zod";
|
|
616
|
+
var CreateCompanyForm = z17.object({
|
|
638
617
|
alias: CompanyIdentity.shape.alias.optional(),
|
|
639
618
|
...CompanyIdentity.pick({
|
|
640
619
|
_id: true,
|
|
@@ -652,7 +631,28 @@ var CreateCompanyForm = z18.object({
|
|
|
652
631
|
}
|
|
653
632
|
});
|
|
654
633
|
|
|
655
|
-
// src/schemas/company/
|
|
634
|
+
// src/schemas/company/entities/Session.ts
|
|
635
|
+
import * as z18 from "zod";
|
|
636
|
+
var CompanySession = z18.object({
|
|
637
|
+
_id: z18.uuidv4(),
|
|
638
|
+
user: z18.object({
|
|
639
|
+
_id: UserDetails.shape._id,
|
|
640
|
+
ip: z18.string(),
|
|
641
|
+
email: UserDetails.shape.email,
|
|
642
|
+
roles: CompanyMemberRoles,
|
|
643
|
+
available: z18.boolean(),
|
|
644
|
+
busy: z18.boolean(),
|
|
645
|
+
serviceCounter: CompanyStaff.shape.members.valueType.shape.serviceCounter.nonoptional()
|
|
646
|
+
}),
|
|
647
|
+
companyId: CompanyState.shape._id,
|
|
648
|
+
ttl: z18.number(),
|
|
649
|
+
expiresAfter: z18.date(),
|
|
650
|
+
// Add in a future update...
|
|
651
|
+
// logs: z.record(Timestamp, z.object({ resource: z.string(), action: "remove" })),
|
|
652
|
+
...TimeLog.shape
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
// src/schemas/company/entities/service/payloads/Medical.ts
|
|
656
656
|
import * as z19 from "zod";
|
|
657
657
|
var Vitals = z19.record(
|
|
658
658
|
vitalKeys,
|
|
@@ -687,7 +687,7 @@ var MedicalDetails = z19.object({
|
|
|
687
687
|
).optional()
|
|
688
688
|
});
|
|
689
689
|
|
|
690
|
-
// src/schemas/company/
|
|
690
|
+
// src/schemas/company/entities/service/ServiceDetails.ts
|
|
691
691
|
import * as z20 from "zod";
|
|
692
692
|
var ServiceSeverity = z20.object({
|
|
693
693
|
"1": z20.literal("Emergency"),
|
|
@@ -846,6 +846,7 @@ export {
|
|
|
846
846
|
CompanyDetails,
|
|
847
847
|
CompanyIdentity,
|
|
848
848
|
CompanyIndustry,
|
|
849
|
+
CompanyMemberRoles,
|
|
849
850
|
CompanyNotifications,
|
|
850
851
|
CompanyPreferences,
|
|
851
852
|
CompanySession,
|