@bizmap/sdk 0.0.41 → 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 +30 -1
- package/dist/main.js +57 -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,36 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
794
798
|
}, z.core.$strip>;
|
|
795
799
|
type PartialCompanyDetails = z.infer<typeof PartialCompanyDetails>;
|
|
796
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
|
+
|
|
797
820
|
declare const InvoiceNo: z.ZodString;
|
|
798
821
|
declare const UuidV4: z.ZodReadonly<z.ZodString>;
|
|
799
822
|
declare const UuidV7: z.ZodReadonly<z.ZodString>;
|
|
823
|
+
declare const Jwt: z.ZodString;
|
|
800
824
|
declare const StandardTime: z.ZodString;
|
|
801
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>;
|
|
802
831
|
declare const TimeLog: z.ZodObject<{
|
|
803
832
|
createdAt: z.ZodReadonly<z.ZodInt>;
|
|
804
833
|
lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
@@ -863,4 +892,4 @@ declare const findConflictingPartners: (...partners: CompanyUser[]) => {
|
|
|
863
892
|
/**@returns the roles that are compatible with the selected role. */
|
|
864
893
|
declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
|
|
865
894
|
|
|
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 };
|
|
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()
|
|
@@ -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,47 @@ 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 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
|
+
|
|
311
359
|
// src/functions/helper-functions.ts
|
|
312
360
|
var findConflictingPartners = (...partners) => {
|
|
313
361
|
let hasSingleDoctor = false;
|
|
@@ -341,12 +389,16 @@ var getCompatibleRoles = (role) => {
|
|
|
341
389
|
export {
|
|
342
390
|
CompanyDetails,
|
|
343
391
|
CompanyUser,
|
|
392
|
+
InviteResponse,
|
|
344
393
|
InvoiceNo,
|
|
394
|
+
Jwt,
|
|
395
|
+
Notification,
|
|
345
396
|
PartialCompanyDetails,
|
|
346
397
|
PriceAdjustment,
|
|
347
398
|
PriceTag,
|
|
348
399
|
PricingRate,
|
|
349
400
|
StandardTime,
|
|
401
|
+
Tier,
|
|
350
402
|
TimeLog,
|
|
351
403
|
Timestamp,
|
|
352
404
|
UuidV4,
|