@bizmap/sdk 0.0.40 → 0.0.42
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 +44 -1
- package/dist/main.js +63 -5
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ declare const CompanyUser: z.ZodObject<{
|
|
|
45
45
|
cshr: "cshr";
|
|
46
46
|
admin: "admin";
|
|
47
47
|
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
|
|
48
|
+
isBusy: z.ZodBoolean;
|
|
48
49
|
appointmentCounter: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
|
|
49
50
|
lastActive: z.ZodInt;
|
|
50
51
|
name: z.ZodRecord<z.ZodEnum<{
|
|
@@ -92,12 +93,14 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
92
93
|
totalUploads: z.ZodNumber;
|
|
93
94
|
invoiceNoCounter: z.ZodInt;
|
|
94
95
|
tktNoCounter: z.ZodInt;
|
|
96
|
+
tierName: z.ZodString;
|
|
95
97
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
96
98
|
}, z.core.$strip> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
97
99
|
availableBalance: z.ZodNumber;
|
|
98
100
|
totalUploads: z.ZodNumber;
|
|
99
101
|
invoiceNoCounter: z.ZodInt;
|
|
100
102
|
tktNoCounter: z.ZodInt;
|
|
103
|
+
tierName: z.ZodString;
|
|
101
104
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
102
105
|
}, z.core.$strip>>>;
|
|
103
106
|
preferences: z.ZodObject<{
|
|
@@ -211,6 +214,7 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
211
214
|
cshr: "cshr";
|
|
212
215
|
admin: "admin";
|
|
213
216
|
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
|
|
217
|
+
isBusy: z.ZodBoolean;
|
|
214
218
|
appointmentCounter: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
|
|
215
219
|
lastActive: z.ZodInt;
|
|
216
220
|
name: z.ZodRecord<z.ZodEnum<{
|
|
@@ -250,6 +254,7 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
250
254
|
lastModified: number | null;
|
|
251
255
|
};
|
|
252
256
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
257
|
+
isBusy: boolean;
|
|
253
258
|
appointmentCounter: Record<"ongoing" | "completed", number>;
|
|
254
259
|
lastActive: number;
|
|
255
260
|
name: Record<"first" | "last", string>;
|
|
@@ -281,6 +286,7 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
281
286
|
lastModified: number | null;
|
|
282
287
|
};
|
|
283
288
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
289
|
+
isBusy: boolean;
|
|
284
290
|
appointmentCounter: Record<"ongoing" | "completed", number>;
|
|
285
291
|
lastActive: number;
|
|
286
292
|
name: Record<"first" | "last", string>;
|
|
@@ -323,6 +329,7 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
323
329
|
cshr: "cshr";
|
|
324
330
|
admin: "admin";
|
|
325
331
|
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
|
|
332
|
+
isBusy: z.ZodBoolean;
|
|
326
333
|
appointmentCounter: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
|
|
327
334
|
lastActive: z.ZodInt;
|
|
328
335
|
name: z.ZodRecord<z.ZodEnum<{
|
|
@@ -362,6 +369,7 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
362
369
|
lastModified: number | null;
|
|
363
370
|
};
|
|
364
371
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
372
|
+
isBusy: boolean;
|
|
365
373
|
appointmentCounter: Record<"ongoing" | "completed", number>;
|
|
366
374
|
lastActive: number;
|
|
367
375
|
name: Record<"first" | "last", string>;
|
|
@@ -393,6 +401,7 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
393
401
|
lastModified: number | null;
|
|
394
402
|
};
|
|
395
403
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
404
|
+
isBusy: boolean;
|
|
396
405
|
appointmentCounter: Record<"ongoing" | "completed", number>;
|
|
397
406
|
lastActive: number;
|
|
398
407
|
name: Record<"first" | "last", string>;
|
|
@@ -454,12 +463,14 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
454
463
|
totalUploads: z.ZodNumber;
|
|
455
464
|
invoiceNoCounter: z.ZodInt;
|
|
456
465
|
tktNoCounter: z.ZodInt;
|
|
466
|
+
tierName: z.ZodString;
|
|
457
467
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
458
468
|
}, z.core.$strip> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
459
469
|
availableBalance: z.ZodNumber;
|
|
460
470
|
totalUploads: z.ZodNumber;
|
|
461
471
|
invoiceNoCounter: z.ZodInt;
|
|
462
472
|
tktNoCounter: z.ZodInt;
|
|
473
|
+
tierName: z.ZodString;
|
|
463
474
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
464
475
|
}, z.core.$strip>>>;
|
|
465
476
|
preferences: z.ZodObject<{
|
|
@@ -573,6 +584,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
573
584
|
cshr: "cshr";
|
|
574
585
|
admin: "admin";
|
|
575
586
|
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
|
|
587
|
+
isBusy: z.ZodBoolean;
|
|
576
588
|
appointmentCounter: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
|
|
577
589
|
lastActive: z.ZodInt;
|
|
578
590
|
name: z.ZodRecord<z.ZodEnum<{
|
|
@@ -612,6 +624,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
612
624
|
lastModified: number | null;
|
|
613
625
|
};
|
|
614
626
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
627
|
+
isBusy: boolean;
|
|
615
628
|
appointmentCounter: Record<"ongoing" | "completed", number>;
|
|
616
629
|
lastActive: number;
|
|
617
630
|
name: Record<"first" | "last", string>;
|
|
@@ -643,6 +656,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
643
656
|
lastModified: number | null;
|
|
644
657
|
};
|
|
645
658
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
659
|
+
isBusy: boolean;
|
|
646
660
|
appointmentCounter: Record<"ongoing" | "completed", number>;
|
|
647
661
|
lastActive: number;
|
|
648
662
|
name: Record<"first" | "last", string>;
|
|
@@ -685,6 +699,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
685
699
|
cshr: "cshr";
|
|
686
700
|
admin: "admin";
|
|
687
701
|
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
|
|
702
|
+
isBusy: z.ZodBoolean;
|
|
688
703
|
appointmentCounter: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
|
|
689
704
|
lastActive: z.ZodInt;
|
|
690
705
|
name: z.ZodRecord<z.ZodEnum<{
|
|
@@ -724,6 +739,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
724
739
|
lastModified: number | null;
|
|
725
740
|
};
|
|
726
741
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
742
|
+
isBusy: boolean;
|
|
727
743
|
appointmentCounter: Record<"ongoing" | "completed", number>;
|
|
728
744
|
lastActive: number;
|
|
729
745
|
name: Record<"first" | "last", string>;
|
|
@@ -755,6 +771,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
755
771
|
lastModified: number | null;
|
|
756
772
|
};
|
|
757
773
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
774
|
+
isBusy: boolean;
|
|
758
775
|
appointmentCounter: Record<"ongoing" | "completed", number>;
|
|
759
776
|
lastActive: number;
|
|
760
777
|
name: Record<"first" | "last", string>;
|
|
@@ -781,11 +798,36 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
781
798
|
}, z.core.$strip>;
|
|
782
799
|
type PartialCompanyDetails = z.infer<typeof PartialCompanyDetails>;
|
|
783
800
|
|
|
801
|
+
declare const Tier: z.ZodObject<{
|
|
802
|
+
name: z.ZodLiteral<"free" | "pro" | "premium" | "gold">;
|
|
803
|
+
cost: z.ZodNumber;
|
|
804
|
+
perks: z.ZodArray<z.ZodString>;
|
|
805
|
+
}, z.core.$strip>;
|
|
806
|
+
type Tier = z.infer<typeof Tier>;
|
|
807
|
+
declare const Notification: z.ZodObject<{
|
|
808
|
+
code: z.ZodLiteral<"COMPANY_INVITE" | "INVITE_RESPONSE" | "DEV_MESSAGE">;
|
|
809
|
+
payload: z.ZodString;
|
|
810
|
+
seen: z.ZodBoolean;
|
|
811
|
+
src: z.ZodObject<{
|
|
812
|
+
name: z.ZodString;
|
|
813
|
+
photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
814
|
+
}, z.core.$strip>;
|
|
815
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
816
|
+
createdAt: z.ZodInt;
|
|
817
|
+
}, z.core.$strip>;
|
|
818
|
+
type Notification = z.infer<typeof Notification>;
|
|
819
|
+
|
|
784
820
|
declare const InvoiceNo: z.ZodString;
|
|
785
821
|
declare const UuidV4: z.ZodReadonly<z.ZodString>;
|
|
786
822
|
declare const UuidV7: z.ZodReadonly<z.ZodString>;
|
|
823
|
+
declare const Jwt: z.ZodString;
|
|
787
824
|
declare const StandardTime: z.ZodString;
|
|
788
825
|
declare const Timestamp: z.ZodInt;
|
|
826
|
+
declare const InviteResponse: z.ZodEnum<{
|
|
827
|
+
accepted: "accepted";
|
|
828
|
+
declined: "declined";
|
|
829
|
+
}>;
|
|
830
|
+
type InviteResponse = z.infer<typeof InviteResponse>;
|
|
789
831
|
declare const TimeLog: z.ZodObject<{
|
|
790
832
|
createdAt: z.ZodReadonly<z.ZodInt>;
|
|
791
833
|
lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
@@ -838,6 +880,7 @@ declare const findConflictingPartners: (...partners: CompanyUser[]) => {
|
|
|
838
880
|
lastModified: number | null;
|
|
839
881
|
};
|
|
840
882
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
883
|
+
isBusy: boolean;
|
|
841
884
|
appointmentCounter: Record<"ongoing" | "completed", number>;
|
|
842
885
|
lastActive: number;
|
|
843
886
|
name: Record<"first" | "last", string>;
|
|
@@ -849,4 +892,4 @@ declare const findConflictingPartners: (...partners: CompanyUser[]) => {
|
|
|
849
892
|
/**@returns the roles that are compatible with the selected role. */
|
|
850
893
|
declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
|
|
851
894
|
|
|
852
|
-
export { type AppointmentDistAlg, CompanyDetails, type CompanyPartnerRole, type CompanyServiceSelector, CompanyUser, type CompanyUserRole, type EmployeeRole, type HealthcareProviderRole, InvoiceNo, PartialCompanyDetails, PriceAdjustment, PriceTag, PricingRate, StandardTime, TimeLog, Timestamp, UuidV4, UuidV7, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyUserRoles, employeeRoles, findConflictingPartners, getCompatibleRoles, healthcareProviderRoles };
|
|
895
|
+
export { type AppointmentDistAlg, CompanyDetails, type CompanyPartnerRole, type CompanyServiceSelector, CompanyUser, type CompanyUserRole, type EmployeeRole, type HealthcareProviderRole, InviteResponse, InvoiceNo, Jwt, Notification, PartialCompanyDetails, PriceAdjustment, PriceTag, PricingRate, StandardTime, Tier, TimeLog, Timestamp, UuidV4, UuidV7, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyUserRoles, employeeRoles, findConflictingPartners, getCompatibleRoles, healthcareProviderRoles };
|
package/dist/main.js
CHANGED
|
@@ -16,13 +16,19 @@ var UuidV7 = z.string().readonly().refine(
|
|
|
16
16
|
(uid) => validate(uid) && version(uid) === 7,
|
|
17
17
|
"Expected a v7 uuid but received an invalid uuid."
|
|
18
18
|
);
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
var Jwt = z.string().regex(
|
|
20
|
+
/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/,
|
|
21
|
+
"An invalid jwt token was used."
|
|
22
|
+
);
|
|
23
|
+
var StandardTime = z.string().regex(
|
|
24
|
+
/^(01|(0[2-9])|(1[0-2])):(([1-5][0-9])|0[0-9]) (am|pm)/i,
|
|
25
|
+
"A standard time must match the pattern hh:mm A."
|
|
26
|
+
);
|
|
22
27
|
var Timestamp = z.int().refine(
|
|
23
28
|
(t) => t.toString().length === 13,
|
|
24
29
|
"A timestamp must have (13) digits."
|
|
25
30
|
).positive();
|
|
31
|
+
var InviteResponse = z.enum(["accepted", "declined"]);
|
|
26
32
|
var TimeLog = z.object({
|
|
27
33
|
createdAt: Timestamp.readonly(),
|
|
28
34
|
lastModified: Timestamp.nullish()
|
|
@@ -100,6 +106,7 @@ var CompanyUser = z4.object({
|
|
|
100
106
|
(role, i) => i === 0 || getCompatibleRoles(roles[0]).includes(role)
|
|
101
107
|
);
|
|
102
108
|
}, "A user is not allowed to have conflicting roles."),
|
|
109
|
+
isBusy: z4.boolean(),
|
|
103
110
|
/** This should reset at the end of every cycle. */
|
|
104
111
|
appointmentCounter: z4.record(
|
|
105
112
|
z4.literal(["ongoing", "completed"]),
|
|
@@ -117,7 +124,7 @@ var CompanyUser = z4.object({
|
|
|
117
124
|
);
|
|
118
125
|
}
|
|
119
126
|
});
|
|
120
|
-
var
|
|
127
|
+
var CompanyIdentity = z4.object({
|
|
121
128
|
displayName: z4.string().min(3).max(20),
|
|
122
129
|
logo: z4.string().max(2500).nullish(),
|
|
123
130
|
contact: z4.object({
|
|
@@ -147,6 +154,7 @@ var CompanyState = z4.object({
|
|
|
147
154
|
invoiceNoCounter: z4.int().min(1),
|
|
148
155
|
/** A counter for the company's ticket no. */
|
|
149
156
|
tktNoCounter: z4.int().min(1),
|
|
157
|
+
tierName: z4.string(),
|
|
150
158
|
lastModified: Timestamp.nullable()
|
|
151
159
|
});
|
|
152
160
|
var CompanyPreferences = z4.object({
|
|
@@ -284,13 +292,18 @@ var Staff = z4.object({
|
|
|
284
292
|
`All users that have the "doc" role must be the leader of a partner group. (${user.uid})`
|
|
285
293
|
);
|
|
286
294
|
}
|
|
295
|
+
if (!user.isBusy && user.uid in details.updateQueue) {
|
|
296
|
+
ctx.addIssue(
|
|
297
|
+
`Having users that aren't busy in the update queue is prohibited.`
|
|
298
|
+
);
|
|
299
|
+
}
|
|
287
300
|
}
|
|
288
301
|
});
|
|
289
302
|
var Receipts = z4.array(PriceTag.omit({ uid: true, lastModified: true }));
|
|
290
303
|
var createCompanyDetails = (options) => {
|
|
291
304
|
return z4.object({
|
|
292
305
|
uid: UuidV7,
|
|
293
|
-
identity:
|
|
306
|
+
identity: CompanyIdentity,
|
|
294
307
|
receipts: options.partial ? Receipts.nullish() : Receipts,
|
|
295
308
|
state: options.partial ? CompanyState.nullish() : CompanyState,
|
|
296
309
|
preferences: options.partial ? CompanyPreferences.nullish() : CompanyPreferences,
|
|
@@ -302,6 +315,47 @@ var createCompanyDetails = (options) => {
|
|
|
302
315
|
var CompanyDetails = createCompanyDetails({ partial: false });
|
|
303
316
|
var PartialCompanyDetails = createCompanyDetails({ partial: true });
|
|
304
317
|
|
|
318
|
+
// src/schemas/Global.ts
|
|
319
|
+
import * as z5 from "zod";
|
|
320
|
+
var Tier = z5.object({
|
|
321
|
+
name: z5.literal(["free", "pro", "premium", "gold"]),
|
|
322
|
+
cost: z5.number().min(0),
|
|
323
|
+
perks: z5.array(z5.string()).min(1)
|
|
324
|
+
});
|
|
325
|
+
var Notification = z5.object({
|
|
326
|
+
code: z5.literal(["COMPANY_INVITE", "INVITE_RESPONSE", "DEV_MESSAGE"]),
|
|
327
|
+
payload: z5.string(),
|
|
328
|
+
seen: z5.boolean(),
|
|
329
|
+
src: z5.object({
|
|
330
|
+
name: z5.string(),
|
|
331
|
+
photoUrl: z5.string().nullish()
|
|
332
|
+
}),
|
|
333
|
+
expiresAt: Timestamp.nullish(),
|
|
334
|
+
createdAt: Timestamp
|
|
335
|
+
}).superRefine((data, ctx) => {
|
|
336
|
+
switch (data.code) {
|
|
337
|
+
case "COMPANY_INVITE":
|
|
338
|
+
if (!Jwt.safeParse(data.payload).success) {
|
|
339
|
+
ctx.addIssue("A company invite's payload must be a valid jwt.");
|
|
340
|
+
}
|
|
341
|
+
break;
|
|
342
|
+
case "DEV_MESSAGE":
|
|
343
|
+
if ((data.payload?.length ?? 0) < 3) {
|
|
344
|
+
ctx.addIssue("A dev message must have at least (3) characters.");
|
|
345
|
+
}
|
|
346
|
+
break;
|
|
347
|
+
case "INVITE_RESPONSE":
|
|
348
|
+
if (!InviteResponse.safeParse(data.payload).success) {
|
|
349
|
+
ctx.addIssue(
|
|
350
|
+
`An invite response must be one of the following: ${InviteResponse.options.join()}.`
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
break;
|
|
354
|
+
default:
|
|
355
|
+
return data.code;
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
|
|
305
359
|
// src/functions/helper-functions.ts
|
|
306
360
|
var findConflictingPartners = (...partners) => {
|
|
307
361
|
let hasSingleDoctor = false;
|
|
@@ -335,12 +389,16 @@ var getCompatibleRoles = (role) => {
|
|
|
335
389
|
export {
|
|
336
390
|
CompanyDetails,
|
|
337
391
|
CompanyUser,
|
|
392
|
+
InviteResponse,
|
|
338
393
|
InvoiceNo,
|
|
394
|
+
Jwt,
|
|
395
|
+
Notification,
|
|
339
396
|
PartialCompanyDetails,
|
|
340
397
|
PriceAdjustment,
|
|
341
398
|
PriceTag,
|
|
342
399
|
PricingRate,
|
|
343
400
|
StandardTime,
|
|
401
|
+
Tier,
|
|
344
402
|
TimeLog,
|
|
345
403
|
Timestamp,
|
|
346
404
|
UuidV4,
|