@bizmap/sdk 0.0.41 → 0.0.43
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 +34 -1
- package/dist/main.js +63 -5
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -93,12 +93,14 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
93
93
|
totalUploads: z.ZodNumber;
|
|
94
94
|
invoiceNoCounter: z.ZodInt;
|
|
95
95
|
tktNoCounter: z.ZodInt;
|
|
96
|
+
tierName: z.ZodString;
|
|
96
97
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
97
98
|
}, z.core.$strip> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
98
99
|
availableBalance: z.ZodNumber;
|
|
99
100
|
totalUploads: z.ZodNumber;
|
|
100
101
|
invoiceNoCounter: z.ZodInt;
|
|
101
102
|
tktNoCounter: z.ZodInt;
|
|
103
|
+
tierName: z.ZodString;
|
|
102
104
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
103
105
|
}, z.core.$strip>>>;
|
|
104
106
|
preferences: z.ZodObject<{
|
|
@@ -461,12 +463,14 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
461
463
|
totalUploads: z.ZodNumber;
|
|
462
464
|
invoiceNoCounter: z.ZodInt;
|
|
463
465
|
tktNoCounter: z.ZodInt;
|
|
466
|
+
tierName: z.ZodString;
|
|
464
467
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
465
468
|
}, z.core.$strip> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
466
469
|
availableBalance: z.ZodNumber;
|
|
467
470
|
totalUploads: z.ZodNumber;
|
|
468
471
|
invoiceNoCounter: z.ZodInt;
|
|
469
472
|
tktNoCounter: z.ZodInt;
|
|
473
|
+
tierName: z.ZodString;
|
|
470
474
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
471
475
|
}, z.core.$strip>>>;
|
|
472
476
|
preferences: z.ZodObject<{
|
|
@@ -794,11 +798,40 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
794
798
|
}, z.core.$strip>;
|
|
795
799
|
type PartialCompanyDetails = z.infer<typeof PartialCompanyDetails>;
|
|
796
800
|
|
|
801
|
+
declare const TierList: z.ZodRecord<z.ZodEnum<{
|
|
802
|
+
free: "free";
|
|
803
|
+
pro: "pro";
|
|
804
|
+
premium: "premium";
|
|
805
|
+
gold: "gold";
|
|
806
|
+
}>, z.ZodObject<{
|
|
807
|
+
cost: z.ZodNumber;
|
|
808
|
+
perks: z.ZodArray<z.ZodString>;
|
|
809
|
+
}, z.core.$strip>>;
|
|
810
|
+
type TierList = z.infer<typeof TierList>;
|
|
811
|
+
declare const Notification: z.ZodObject<{
|
|
812
|
+
code: z.ZodLiteral<"COMPANY_INVITE" | "INVITE_RESPONSE" | "DEV_MESSAGE">;
|
|
813
|
+
payload: z.ZodString;
|
|
814
|
+
seen: z.ZodBoolean;
|
|
815
|
+
src: z.ZodObject<{
|
|
816
|
+
name: z.ZodString;
|
|
817
|
+
photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
818
|
+
}, z.core.$strip>;
|
|
819
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
820
|
+
createdAt: z.ZodInt;
|
|
821
|
+
}, z.core.$strip>;
|
|
822
|
+
type Notification = z.infer<typeof Notification>;
|
|
823
|
+
|
|
797
824
|
declare const InvoiceNo: z.ZodString;
|
|
798
825
|
declare const UuidV4: z.ZodReadonly<z.ZodString>;
|
|
799
826
|
declare const UuidV7: z.ZodReadonly<z.ZodString>;
|
|
827
|
+
declare const Jwt: z.ZodString;
|
|
800
828
|
declare const StandardTime: z.ZodString;
|
|
801
829
|
declare const Timestamp: z.ZodInt;
|
|
830
|
+
declare const InviteResponse: z.ZodEnum<{
|
|
831
|
+
accepted: "accepted";
|
|
832
|
+
declined: "declined";
|
|
833
|
+
}>;
|
|
834
|
+
type InviteResponse = z.infer<typeof InviteResponse>;
|
|
802
835
|
declare const TimeLog: z.ZodObject<{
|
|
803
836
|
createdAt: z.ZodReadonly<z.ZodInt>;
|
|
804
837
|
lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
@@ -863,4 +896,4 @@ declare const findConflictingPartners: (...partners: CompanyUser[]) => {
|
|
|
863
896
|
/**@returns the roles that are compatible with the selected role. */
|
|
864
897
|
declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
|
|
865
898
|
|
|
866
|
-
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 };
|
|
899
|
+
export { type AppointmentDistAlg, CompanyDetails, type CompanyPartnerRole, type CompanyServiceSelector, CompanyUser, type CompanyUserRole, type EmployeeRole, type HealthcareProviderRole, InviteResponse, InvoiceNo, Jwt, Notification, PartialCompanyDetails, PriceAdjustment, PriceTag, PricingRate, StandardTime, TierList, 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()
|
|
@@ -118,7 +124,7 @@ var CompanyUser = z4.object({
|
|
|
118
124
|
);
|
|
119
125
|
}
|
|
120
126
|
});
|
|
121
|
-
var
|
|
127
|
+
var CompanyIdentity = z4.object({
|
|
122
128
|
displayName: z4.string().min(3).max(20),
|
|
123
129
|
logo: z4.string().max(2500).nullish(),
|
|
124
130
|
contact: z4.object({
|
|
@@ -148,6 +154,7 @@ var CompanyState = z4.object({
|
|
|
148
154
|
invoiceNoCounter: z4.int().min(1),
|
|
149
155
|
/** A counter for the company's ticket no. */
|
|
150
156
|
tktNoCounter: z4.int().min(1),
|
|
157
|
+
tierName: z4.string(),
|
|
151
158
|
lastModified: Timestamp.nullable()
|
|
152
159
|
});
|
|
153
160
|
var CompanyPreferences = z4.object({
|
|
@@ -296,7 +303,7 @@ var Receipts = z4.array(PriceTag.omit({ uid: true, lastModified: true }));
|
|
|
296
303
|
var createCompanyDetails = (options) => {
|
|
297
304
|
return z4.object({
|
|
298
305
|
uid: UuidV7,
|
|
299
|
-
identity:
|
|
306
|
+
identity: CompanyIdentity,
|
|
300
307
|
receipts: options.partial ? Receipts.nullish() : Receipts,
|
|
301
308
|
state: options.partial ? CompanyState.nullish() : CompanyState,
|
|
302
309
|
preferences: options.partial ? CompanyPreferences.nullish() : CompanyPreferences,
|
|
@@ -308,6 +315,53 @@ var createCompanyDetails = (options) => {
|
|
|
308
315
|
var CompanyDetails = createCompanyDetails({ partial: false });
|
|
309
316
|
var PartialCompanyDetails = createCompanyDetails({ partial: true });
|
|
310
317
|
|
|
318
|
+
// src/schemas/Global.ts
|
|
319
|
+
import * as z5 from "zod";
|
|
320
|
+
var TierList = z5.record(
|
|
321
|
+
z5.enum(["free", "pro", "premium", "gold"]),
|
|
322
|
+
z5.object({
|
|
323
|
+
cost: z5.number().min(0),
|
|
324
|
+
perks: z5.array(z5.string()).min(1)
|
|
325
|
+
})
|
|
326
|
+
).superRefine((data, ctx) => {
|
|
327
|
+
if (data.free.cost !== 0) {
|
|
328
|
+
ctx.addIssue("The free tier must always cost $0.00");
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
var Notification = z5.object({
|
|
332
|
+
code: z5.literal(["COMPANY_INVITE", "INVITE_RESPONSE", "DEV_MESSAGE"]),
|
|
333
|
+
payload: z5.string(),
|
|
334
|
+
seen: z5.boolean(),
|
|
335
|
+
src: z5.object({
|
|
336
|
+
name: z5.string(),
|
|
337
|
+
photoUrl: z5.string().nullish()
|
|
338
|
+
}),
|
|
339
|
+
expiresAt: Timestamp.nullish(),
|
|
340
|
+
createdAt: Timestamp
|
|
341
|
+
}).superRefine((data, ctx) => {
|
|
342
|
+
switch (data.code) {
|
|
343
|
+
case "COMPANY_INVITE":
|
|
344
|
+
if (!Jwt.safeParse(data.payload).success) {
|
|
345
|
+
ctx.addIssue("The payload of company invite must be a valid jwt.");
|
|
346
|
+
}
|
|
347
|
+
break;
|
|
348
|
+
case "DEV_MESSAGE":
|
|
349
|
+
if ((data.payload?.length ?? 0) < 3) {
|
|
350
|
+
ctx.addIssue("A dev message must have at least (3) characters.");
|
|
351
|
+
}
|
|
352
|
+
break;
|
|
353
|
+
case "INVITE_RESPONSE":
|
|
354
|
+
if (!InviteResponse.safeParse(data.payload).success) {
|
|
355
|
+
ctx.addIssue(
|
|
356
|
+
`An invite response must be one of the following: ${InviteResponse.options.join()}.`
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
break;
|
|
360
|
+
default:
|
|
361
|
+
return data.code;
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
|
|
311
365
|
// src/functions/helper-functions.ts
|
|
312
366
|
var findConflictingPartners = (...partners) => {
|
|
313
367
|
let hasSingleDoctor = false;
|
|
@@ -341,12 +395,16 @@ var getCompatibleRoles = (role) => {
|
|
|
341
395
|
export {
|
|
342
396
|
CompanyDetails,
|
|
343
397
|
CompanyUser,
|
|
398
|
+
InviteResponse,
|
|
344
399
|
InvoiceNo,
|
|
400
|
+
Jwt,
|
|
401
|
+
Notification,
|
|
345
402
|
PartialCompanyDetails,
|
|
346
403
|
PriceAdjustment,
|
|
347
404
|
PriceTag,
|
|
348
405
|
PricingRate,
|
|
349
406
|
StandardTime,
|
|
407
|
+
TierList,
|
|
350
408
|
TimeLog,
|
|
351
409
|
Timestamp,
|
|
352
410
|
UuidV4,
|