@bizmap/sdk 0.0.124 → 0.0.126
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 +16 -14
- package/dist/main.js +31 -23
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -26,11 +26,11 @@ declare const healthcareProviderRoles: z.ZodEnum<{
|
|
|
26
26
|
physAsst: "physAsst";
|
|
27
27
|
}>;
|
|
28
28
|
type HealthcareProviderRole = z.infer<typeof healthcareProviderRoles>;
|
|
29
|
-
declare const
|
|
29
|
+
declare const serviceDistAlgs: z.ZodEnum<{
|
|
30
30
|
RR: "RR";
|
|
31
31
|
LOR: "LOR";
|
|
32
32
|
}>;
|
|
33
|
-
type
|
|
33
|
+
type ServiceDistAlg = z.infer<typeof serviceDistAlgs>;
|
|
34
34
|
declare const companyServiceSelectors: z.ZodEnum<{
|
|
35
35
|
scheduler: "scheduler";
|
|
36
36
|
doctor: "doctor";
|
|
@@ -122,11 +122,11 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
122
122
|
scheduler: "scheduler";
|
|
123
123
|
doctor: "doctor";
|
|
124
124
|
}>;
|
|
125
|
-
|
|
125
|
+
serviceDistAlg: z.ZodEnum<{
|
|
126
126
|
RR: "RR";
|
|
127
127
|
LOR: "LOR";
|
|
128
128
|
}>;
|
|
129
|
-
|
|
129
|
+
pps: z.ZodBoolean;
|
|
130
130
|
servicesDeployed: z.ZodBoolean;
|
|
131
131
|
}, z.core.$strip>;
|
|
132
132
|
billing: z.ZodObject<{
|
|
@@ -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
|
+
dailyServiceCounter: 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;
|
|
@@ -238,11 +238,11 @@ declare const MutableCompanyDetails: z.ZodObject<{
|
|
|
238
238
|
scheduler: "scheduler";
|
|
239
239
|
doctor: "doctor";
|
|
240
240
|
}>>;
|
|
241
|
-
|
|
241
|
+
serviceDistAlg: z.ZodOptional<z.ZodEnum<{
|
|
242
242
|
RR: "RR";
|
|
243
243
|
LOR: "LOR";
|
|
244
244
|
}>>;
|
|
245
|
-
|
|
245
|
+
pps: z.ZodOptional<z.ZodBoolean>;
|
|
246
246
|
servicesDeployed: z.ZodOptional<z.ZodBoolean>;
|
|
247
247
|
}, z.core.$strip>>;
|
|
248
248
|
billing: z.ZodOptional<z.ZodObject<{
|
|
@@ -492,8 +492,8 @@ declare const CompanyPreferences: z.ZodObject<{
|
|
|
492
492
|
scheduler: "scheduler";
|
|
493
493
|
doctor: "doctor";
|
|
494
494
|
}>;
|
|
495
|
-
|
|
496
|
-
|
|
495
|
+
pps: z.ZodBoolean;
|
|
496
|
+
serviceDistAlg: z.ZodEnum<{
|
|
497
497
|
RR: "RR";
|
|
498
498
|
LOR: "LOR";
|
|
499
499
|
}>;
|
|
@@ -506,11 +506,11 @@ declare const MutableCompanyPreferences: z.ZodObject<{
|
|
|
506
506
|
scheduler: "scheduler";
|
|
507
507
|
doctor: "doctor";
|
|
508
508
|
}>;
|
|
509
|
-
|
|
509
|
+
serviceDistAlg: z.ZodEnum<{
|
|
510
510
|
RR: "RR";
|
|
511
511
|
LOR: "LOR";
|
|
512
512
|
}>;
|
|
513
|
-
|
|
513
|
+
pps: z.ZodBoolean;
|
|
514
514
|
servicesDeployed: z.ZodBoolean;
|
|
515
515
|
}, z.core.$strip>;
|
|
516
516
|
type MutableCompanyPreferences = z.infer<typeof MutableCompanyPreferences>;
|
|
@@ -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
|
+
dailyServiceCounter: 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;
|
|
@@ -633,6 +633,8 @@ declare const CompanyIndustry: z.ZodObject<{
|
|
|
633
633
|
}, z.core.$strip>;
|
|
634
634
|
}, z.core.$strip>;
|
|
635
635
|
}, z.core.$strip>;
|
|
636
|
+
type CompanyIndustry = z.infer<typeof CompanyIndustry>;
|
|
637
|
+
declare const safeParseSector: <I extends keyof CompanyIndustry>(industry: I, sector: string) => z.ZodSafeParseResult<keyof CompanyIndustry[I]>;
|
|
636
638
|
|
|
637
639
|
declare const CompanySession: z.ZodObject<{
|
|
638
640
|
createdAt: z.ZodReadonly<z.ZodISODateTime>;
|
|
@@ -649,7 +651,7 @@ declare const CompanySession: z.ZodObject<{
|
|
|
649
651
|
value: z.ZodBoolean;
|
|
650
652
|
lastModified: z.ZodOptional<z.ZodISODateTime>;
|
|
651
653
|
}, z.core.$strip>;
|
|
652
|
-
|
|
654
|
+
serviceCounter: z.ZodRecord<z.ZodLiteral<"undone" | "done">, z.ZodInt>;
|
|
653
655
|
roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
654
656
|
doc: "doc";
|
|
655
657
|
physAsst: "physAsst";
|
|
@@ -1209,4 +1211,4 @@ declare function createNotifId(options?: {
|
|
|
1209
1211
|
to: string;
|
|
1210
1212
|
}): string;
|
|
1211
1213
|
|
|
1212
|
-
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, ServiceSeverity, StandardTime,
|
|
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 };
|
package/dist/main.js
CHANGED
|
@@ -15,7 +15,7 @@ var healthcareProviderRoles = companyUserRoles.extract([
|
|
|
15
15
|
"physAsst",
|
|
16
16
|
"doc"
|
|
17
17
|
]);
|
|
18
|
-
var
|
|
18
|
+
var serviceDistAlgs = z.enum(["RR", "LOR"]);
|
|
19
19
|
var companyServiceSelectors = z.enum(["scheduler", "doctor"]);
|
|
20
20
|
|
|
21
21
|
// src/enums/Global.ts
|
|
@@ -183,8 +183,8 @@ var MutableCompanyBilling = CompanyBilling.omit({
|
|
|
183
183
|
});
|
|
184
184
|
|
|
185
185
|
// src/schemas/company/components/Identity.ts
|
|
186
|
-
import * as z9 from "zod";
|
|
187
186
|
import { Address, PhoneNumber } from "@wavy/util";
|
|
187
|
+
import * as z9 from "zod";
|
|
188
188
|
|
|
189
189
|
// src/schemas/company/core/CompanyIndustry.ts
|
|
190
190
|
import * as z8 from "zod";
|
|
@@ -197,12 +197,8 @@ var CompanyIndustry = z8.object({
|
|
|
197
197
|
// })
|
|
198
198
|
})
|
|
199
199
|
});
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
var getInvalidSectorError = (industry, sector) => `Invalid sector: "${sector}" isn't a sector under the "${industry}" industry.`;
|
|
203
|
-
var COMPANY_USER_RELATIONSHIP = {
|
|
204
|
-
doc: ["physAsst"],
|
|
205
|
-
physAsst: ["doc"]
|
|
200
|
+
var safeParseSector = (industry, sector) => {
|
|
201
|
+
return CompanyIndustry.shape[industry].keyof().safeParse(sector);
|
|
206
202
|
};
|
|
207
203
|
|
|
208
204
|
// src/schemas/company/components/Identity.ts
|
|
@@ -238,8 +234,12 @@ var CompanyIdentity = z9.object({
|
|
|
238
234
|
} else if (!data.verified && hasLegalInfo) {
|
|
239
235
|
ctx.addIssue("Unverified companies can't have the legal field defined.");
|
|
240
236
|
}
|
|
241
|
-
|
|
242
|
-
|
|
237
|
+
const parsedSector = safeParseSector(data.industry, data.sector);
|
|
238
|
+
if (!parsedSector.success) {
|
|
239
|
+
ctx.addIssue({
|
|
240
|
+
...parsedSector.error,
|
|
241
|
+
path: ["sector"]
|
|
242
|
+
});
|
|
243
243
|
}
|
|
244
244
|
});
|
|
245
245
|
var MutableCompanyIdentity = CompanyIdentity.pick({
|
|
@@ -256,18 +256,18 @@ var CompanyPreferences = z10.object({
|
|
|
256
256
|
_id: CompanyState.shape._id,
|
|
257
257
|
/** The user that's allowed to record the client's services. */
|
|
258
258
|
serviceSelector: companyServiceSelectors,
|
|
259
|
-
/** Pay per
|
|
260
|
-
|
|
259
|
+
/** Pay per service */
|
|
260
|
+
pps: z10.boolean(),
|
|
261
261
|
/**
|
|
262
262
|
* @property RR (Round Robin): Even distribution.
|
|
263
263
|
* @property LOR (Least Outstanding Requests): Distribute based on availability.
|
|
264
264
|
*/
|
|
265
|
-
|
|
265
|
+
serviceDistAlg: serviceDistAlgs,
|
|
266
266
|
servicesDeployed: z10.boolean(),
|
|
267
267
|
...TimeLog.shape
|
|
268
268
|
}).refine(
|
|
269
|
-
(data) => !data.
|
|
270
|
-
`Pay per
|
|
269
|
+
(data) => !data.pps || data.pps && data.serviceSelector === "scheduler",
|
|
270
|
+
`Pay per service is only allowed when the service selector is the "${"scheduler"}".`
|
|
271
271
|
);
|
|
272
272
|
var MutableCompanyPreferences = CompanyPreferences.omit({
|
|
273
273
|
_id: true,
|
|
@@ -382,6 +382,12 @@ var ClientForm = ClientDetails.pick({
|
|
|
382
382
|
sex: true
|
|
383
383
|
}).required();
|
|
384
384
|
|
|
385
|
+
// src/schemas/company/core/utils.ts
|
|
386
|
+
var COMPANY_USER_RELATIONSHIP = {
|
|
387
|
+
doc: ["physAsst"],
|
|
388
|
+
physAsst: ["doc"]
|
|
389
|
+
};
|
|
390
|
+
|
|
385
391
|
// src/functions/helper-functions.ts
|
|
386
392
|
var getCompatibleRoles = (role) => {
|
|
387
393
|
return companyUserRoles.options.filter(
|
|
@@ -425,7 +431,7 @@ var CompanySession = z13.object({
|
|
|
425
431
|
value: z13.boolean(),
|
|
426
432
|
lastModified: Timestamp.optional()
|
|
427
433
|
}),
|
|
428
|
-
|
|
434
|
+
serviceCounter: z13.record(z13.literal(["undone", "done"]), z13.int().min(0)),
|
|
429
435
|
roles: CompanyMemberRoles,
|
|
430
436
|
ttl: z13.number(),
|
|
431
437
|
expiresAfter: z13.date(),
|
|
@@ -447,7 +453,7 @@ var CompanyStaff = z14.object({
|
|
|
447
453
|
joinedAt: Timestamp,
|
|
448
454
|
lastActive: Timestamp,
|
|
449
455
|
roles: CompanyMemberRoles,
|
|
450
|
-
|
|
456
|
+
dailyServiceCounter: CompanySession.shape.serviceCounter.optional()
|
|
451
457
|
})
|
|
452
458
|
),
|
|
453
459
|
/**
|
|
@@ -640,12 +646,13 @@ var CreateCompanyForm = z18.object({
|
|
|
640
646
|
sector: true
|
|
641
647
|
}).shape
|
|
642
648
|
}).superRefine((data, ctx) => {
|
|
643
|
-
|
|
644
|
-
|
|
649
|
+
const parsedSector = safeParseSector(data.industry, data.sector);
|
|
650
|
+
if (!parsedSector.success) {
|
|
651
|
+
ctx.addIssue(parsedSector.error.message);
|
|
645
652
|
}
|
|
646
653
|
});
|
|
647
654
|
|
|
648
|
-
// src/schemas/company/core/service/
|
|
655
|
+
// src/schemas/company/core/service/payloads/Medical.ts
|
|
649
656
|
import * as z19 from "zod";
|
|
650
657
|
var Vitals = z19.record(
|
|
651
658
|
vitalKeys,
|
|
@@ -744,8 +751,8 @@ var ServiceDetails = z20.object({
|
|
|
744
751
|
lockedBy: UserDetails.shape._id.optional(),
|
|
745
752
|
/** Role based access control
|
|
746
753
|
* If a role is:
|
|
747
|
-
* [1] Ommitted -> any user with that role that's from the same company can access the
|
|
748
|
-
* [1] Addded -> only the users that have that role and an id in the respective array can access the
|
|
754
|
+
* [1] Ommitted -> any user with that role that's from the same company can access the ServiceDetails.
|
|
755
|
+
* [1] Addded -> only the users that have that role and an id in the respective array can access the ServiceDetails.
|
|
749
756
|
*/
|
|
750
757
|
rbac: z20.record(companyUserRoles, z20.array(UserDetails.shape._id).optional()),
|
|
751
758
|
timeline: z20.record(
|
|
@@ -890,7 +897,8 @@ export {
|
|
|
890
897
|
normalizeNidKey,
|
|
891
898
|
parseClientName,
|
|
892
899
|
paymentMethods,
|
|
893
|
-
|
|
900
|
+
safeParseSector,
|
|
901
|
+
serviceDistAlgs,
|
|
894
902
|
tiers,
|
|
895
903
|
vitalKeys
|
|
896
904
|
};
|