@bizmap/sdk 0.0.127 → 0.0.128
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 +18 -21
- package/dist/main.js +67 -69
- 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;
|
|
@@ -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
|
+
serviceCounter: 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;
|
|
@@ -640,26 +640,23 @@ declare const CompanySession: z.ZodObject<{
|
|
|
640
640
|
createdAt: z.ZodReadonly<z.ZodISODateTime>;
|
|
641
641
|
lastModified: z.ZodOptional<z.ZodISODateTime>;
|
|
642
642
|
_id: z.ZodUUID;
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
643
|
+
user: z.ZodObject<{
|
|
644
|
+
_id: z.ZodUUID;
|
|
645
|
+
ip: z.ZodString;
|
|
646
|
+
email: z.ZodEmail;
|
|
647
|
+
roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
648
|
+
doc: "doc";
|
|
649
|
+
physAsst: "physAsst";
|
|
650
|
+
rcpst: "rcpst";
|
|
651
|
+
cshr: "cshr";
|
|
652
|
+
"a/r": "a/r";
|
|
653
|
+
ceo: "ceo";
|
|
654
|
+
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "a/r" | "ceo")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "a/r" | "ceo")[]>>;
|
|
655
|
+
available: z.ZodBoolean;
|
|
656
|
+
busy: z.ZodBoolean;
|
|
657
|
+
serviceCounter: z.ZodNonOptional<z.ZodOptional<z.ZodRecord<z.ZodLiteral<"undone" | "done">, z.ZodInt>>>;
|
|
653
658
|
}, 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")[]>>;
|
|
659
|
+
companyId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
663
660
|
ttl: z.ZodNumber;
|
|
664
661
|
expiresAfter: z.ZodDate;
|
|
665
662
|
}, z.core.$strip>;
|
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()),
|
|
@@ -276,7 +276,7 @@ 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";
|
|
@@ -415,59 +415,36 @@ var parseClientName = ({
|
|
|
415
415
|
lastName
|
|
416
416
|
}) => [firstName, middleName[0] + ".", lastName].join(" ");
|
|
417
417
|
|
|
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
418
|
// src/schemas/company/components/Staff.ts
|
|
442
|
-
var CompanyMemberRoles =
|
|
419
|
+
var CompanyMemberRoles = z13.array(companyUserRoles).transform((roles) => distinct(roles).sort()).refine((roles) => {
|
|
443
420
|
return !roles.find(
|
|
444
421
|
(role) => getIncompatibleRoles(role).some((r) => roles.includes(r))
|
|
445
422
|
);
|
|
446
423
|
}, "A user is not allowed to have conflicting roles.");
|
|
447
|
-
var CompanyStaff =
|
|
424
|
+
var CompanyStaff = z13.object({
|
|
448
425
|
_id: CompanyState.shape._id,
|
|
449
|
-
members:
|
|
426
|
+
members: z13.record(
|
|
450
427
|
UserDetails.shape._id,
|
|
451
|
-
|
|
428
|
+
z13.object({
|
|
452
429
|
invitedAt: Timestamp.optional(),
|
|
453
430
|
joinedAt: Timestamp,
|
|
454
431
|
lastActive: Timestamp,
|
|
455
432
|
roles: CompanyMemberRoles,
|
|
456
|
-
|
|
433
|
+
serviceCounter: z13.record(z13.literal(["undone", "done"]), z13.int().min(0)).optional()
|
|
457
434
|
})
|
|
458
435
|
),
|
|
459
436
|
/**
|
|
460
437
|
* @relationship one -> many
|
|
461
438
|
*@description A map of doctor `uids` to their assistants `uids` */
|
|
462
|
-
partnerMap:
|
|
439
|
+
partnerMap: z13.record(
|
|
463
440
|
UserDetails.shape._id,
|
|
464
|
-
|
|
441
|
+
z13.record(UserDetails.shape._id, z13.object({ addedAt: Timestamp }))
|
|
465
442
|
).optional(),
|
|
466
|
-
updateQueue:
|
|
443
|
+
updateQueue: z13.record(
|
|
467
444
|
UserDetails.shape._id,
|
|
468
|
-
|
|
469
|
-
$REMOVE:
|
|
470
|
-
$CHANGE_ROLES:
|
|
445
|
+
z13.object({
|
|
446
|
+
$REMOVE: z13.object({ addedAt: Timestamp }),
|
|
447
|
+
$CHANGE_ROLES: z13.object({
|
|
471
448
|
newRoles: CompanyMemberRoles,
|
|
472
449
|
addedAt: Timestamp
|
|
473
450
|
})
|
|
@@ -501,7 +478,7 @@ var MutableCompanyStaff = CompanyStaff.pick({
|
|
|
501
478
|
});
|
|
502
479
|
|
|
503
480
|
// src/schemas/company/CompanyDetails.ts
|
|
504
|
-
var CompanyDetails =
|
|
481
|
+
var CompanyDetails = z14.object({
|
|
505
482
|
_id: CompanyState.shape._id,
|
|
506
483
|
identity: CompanyIdentity.omit({ _id: true }),
|
|
507
484
|
// notifications: CompanyNotifications,
|
|
@@ -511,7 +488,7 @@ var CompanyDetails = z15.object({
|
|
|
511
488
|
billing: CompanyBilling.omit({ _id: true }),
|
|
512
489
|
staff: CompanyStaff.omit({ _id: true })
|
|
513
490
|
});
|
|
514
|
-
var MutableCompanyDetails =
|
|
491
|
+
var MutableCompanyDetails = z14.object({
|
|
515
492
|
_id: CompanyDetails.shape._id,
|
|
516
493
|
identity: MutableCompanyIdentity.partial().optional(),
|
|
517
494
|
preferences: MutableCompanyPreferences.partial().optional(),
|
|
@@ -520,28 +497,28 @@ var MutableCompanyDetails = z15.object({
|
|
|
520
497
|
});
|
|
521
498
|
|
|
522
499
|
// src/schemas/company/components/Notifications.ts
|
|
523
|
-
import * as
|
|
500
|
+
import * as z16 from "zod";
|
|
524
501
|
|
|
525
502
|
// src/schemas/Global.ts
|
|
526
|
-
import * as
|
|
527
|
-
var TierList =
|
|
503
|
+
import * as z15 from "zod";
|
|
504
|
+
var TierList = z15.record(
|
|
528
505
|
tiers,
|
|
529
|
-
|
|
530
|
-
cost:
|
|
531
|
-
perks:
|
|
506
|
+
z15.object({
|
|
507
|
+
cost: z15.number().min(0),
|
|
508
|
+
perks: z15.array(z15.string()).min(1)
|
|
532
509
|
})
|
|
533
510
|
).superRefine((data, ctx) => {
|
|
534
511
|
if (data.basic.cost !== 0) {
|
|
535
512
|
ctx.addIssue("The basic tier must always cost $0.00");
|
|
536
513
|
}
|
|
537
514
|
});
|
|
538
|
-
var Notification =
|
|
539
|
-
_id:
|
|
540
|
-
const isUUidV4 =
|
|
515
|
+
var Notification = z15.object({
|
|
516
|
+
_id: z15.string().superRefine((data, ctx) => {
|
|
517
|
+
const isUUidV4 = z15.uuidv4().safeParse(data).success;
|
|
541
518
|
if (isUUidV4) return;
|
|
542
519
|
let [from, to, nonce] = data.split(NOTIF_ID_DELIM);
|
|
543
520
|
nonce = nonce?.trim() || "";
|
|
544
|
-
const parsedFrom =
|
|
521
|
+
const parsedFrom = z15.uuidv4().or(z15.uuidv7()).safeParse(from);
|
|
545
522
|
if (!parsedFrom.success) {
|
|
546
523
|
ctx.addIssue({
|
|
547
524
|
code: "custom",
|
|
@@ -549,7 +526,7 @@ var Notification = z16.object({
|
|
|
549
526
|
path: ["from"]
|
|
550
527
|
});
|
|
551
528
|
}
|
|
552
|
-
const parsedTo =
|
|
529
|
+
const parsedTo = z15.uuidv4().safeParse(to);
|
|
553
530
|
if (!parsedTo.success) {
|
|
554
531
|
ctx.addIssue({
|
|
555
532
|
code: "custom",
|
|
@@ -565,19 +542,19 @@ var Notification = z16.object({
|
|
|
565
542
|
});
|
|
566
543
|
}
|
|
567
544
|
}),
|
|
568
|
-
code:
|
|
545
|
+
code: z15.literal([
|
|
569
546
|
"INVITE_RESPONSE",
|
|
570
547
|
"COMPANY_INVITE",
|
|
571
548
|
"DEV_MESSAGE",
|
|
572
549
|
"ALERT"
|
|
573
550
|
]),
|
|
574
|
-
payload:
|
|
575
|
-
isArchived:
|
|
576
|
-
rcpt:
|
|
577
|
-
src:
|
|
578
|
-
_id:
|
|
579
|
-
name:
|
|
580
|
-
photoUrl:
|
|
551
|
+
payload: z15.string(),
|
|
552
|
+
isArchived: z15.boolean().optional(),
|
|
553
|
+
rcpt: z15.uuidv4().or(z15.uuidv7()).nullable(),
|
|
554
|
+
src: z15.object({
|
|
555
|
+
_id: z15.uuidv4().or(z15.uuidv7()),
|
|
556
|
+
name: z15.string(),
|
|
557
|
+
photoUrl: z15.string().nullish()
|
|
581
558
|
}),
|
|
582
559
|
createdAt: Timestamp
|
|
583
560
|
}).superRefine((data, ctx) => {
|
|
@@ -588,7 +565,7 @@ var Notification = z16.object({
|
|
|
588
565
|
};
|
|
589
566
|
switch (data.code) {
|
|
590
567
|
case "COMPANY_INVITE":
|
|
591
|
-
if (!
|
|
568
|
+
if (!z15.jwt().safeParse(data.payload).success) {
|
|
592
569
|
ctx.addIssue("The payload of company invite must be a valid jwt.");
|
|
593
570
|
}
|
|
594
571
|
break;
|
|
@@ -609,32 +586,32 @@ var Notification = z16.object({
|
|
|
609
586
|
return data.code;
|
|
610
587
|
}
|
|
611
588
|
});
|
|
612
|
-
var CreditCurrency =
|
|
613
|
-
uid:
|
|
614
|
-
cost:
|
|
615
|
-
value:
|
|
589
|
+
var CreditCurrency = z15.object({
|
|
590
|
+
uid: z15.uuidv4(),
|
|
591
|
+
cost: z15.object({ value: z15.number().min(0), currency: acceptedCurrencies }),
|
|
592
|
+
value: z15.int().min(0),
|
|
616
593
|
...TimeLog.shape
|
|
617
594
|
});
|
|
618
|
-
var PaymentDetails =
|
|
595
|
+
var PaymentDetails = z15.object({
|
|
619
596
|
// Used to track the payments recorded by each paymentCollector
|
|
620
|
-
uid:
|
|
597
|
+
uid: z15.uuidv4(),
|
|
621
598
|
method: paymentMethods,
|
|
622
599
|
currency: acceptedCurrencies,
|
|
623
|
-
amount:
|
|
600
|
+
amount: z15.number().min(1),
|
|
624
601
|
// Rate chart id (used to identify the rate chart used to convert the amount )
|
|
625
602
|
// rcid: z.uuidv4(),
|
|
626
603
|
...TimeLog.shape
|
|
627
604
|
});
|
|
628
605
|
|
|
629
606
|
// src/schemas/company/components/Notifications.ts
|
|
630
|
-
var CompanyNotifications =
|
|
607
|
+
var CompanyNotifications = z16.array(Notification).refine(
|
|
631
608
|
(data) => data.every((notif) => notif.code !== "COMPANY_INVITE"),
|
|
632
609
|
"A company can't receive a company invite."
|
|
633
610
|
);
|
|
634
611
|
|
|
635
612
|
// src/schemas/company/core/CreateCompanyForm.ts
|
|
636
|
-
import * as
|
|
637
|
-
var CreateCompanyForm =
|
|
613
|
+
import * as z17 from "zod";
|
|
614
|
+
var CreateCompanyForm = z17.object({
|
|
638
615
|
alias: CompanyIdentity.shape.alias.optional(),
|
|
639
616
|
...CompanyIdentity.pick({
|
|
640
617
|
_id: true,
|
|
@@ -652,6 +629,27 @@ var CreateCompanyForm = z18.object({
|
|
|
652
629
|
}
|
|
653
630
|
});
|
|
654
631
|
|
|
632
|
+
// src/schemas/company/core/CompanySession.ts
|
|
633
|
+
import * as z18 from "zod";
|
|
634
|
+
var CompanySession = z18.object({
|
|
635
|
+
_id: z18.uuidv4(),
|
|
636
|
+
user: z18.object({
|
|
637
|
+
_id: UserDetails.shape._id,
|
|
638
|
+
ip: z18.string(),
|
|
639
|
+
email: UserDetails.shape.email,
|
|
640
|
+
roles: CompanyMemberRoles,
|
|
641
|
+
available: z18.boolean(),
|
|
642
|
+
busy: z18.boolean(),
|
|
643
|
+
serviceCounter: CompanyStaff.shape.members.valueType.shape.serviceCounter.nonoptional()
|
|
644
|
+
}),
|
|
645
|
+
companyId: CompanyState.shape._id,
|
|
646
|
+
ttl: z18.number(),
|
|
647
|
+
expiresAfter: z18.date(),
|
|
648
|
+
// Add in a future update...
|
|
649
|
+
// logs: z.record(Timestamp, z.object({ resource: z.string(), action: "remove" })),
|
|
650
|
+
...TimeLog.shape
|
|
651
|
+
});
|
|
652
|
+
|
|
655
653
|
// src/schemas/company/core/service/payloads/Medical.ts
|
|
656
654
|
import * as z19 from "zod";
|
|
657
655
|
var Vitals = z19.record(
|