@bizmap/sdk 0.0.76 → 0.0.78

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 CHANGED
@@ -251,6 +251,7 @@ declare const CompanyDetails: z.ZodObject<{
251
251
  version: z.ZodInt;
252
252
  members: z.ZodRecord<z.ZodUUID, z.ZodObject<{
253
253
  inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
254
+ lastModified: z.ZodNullable<z.ZodInt>;
254
255
  email: z.ZodEmail;
255
256
  name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
256
257
  status: z.ZodEnum<{
@@ -258,6 +259,10 @@ declare const CompanyDetails: z.ZodObject<{
258
259
  active: "active";
259
260
  inactive: "inactive";
260
261
  }>;
262
+ isBusy: z.ZodObject<{
263
+ value: z.ZodBoolean;
264
+ lastModified: z.ZodNullable<z.ZodInt>;
265
+ }, z.core.$strip>;
261
266
  appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
262
267
  roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
263
268
  doc: "doc";
@@ -672,6 +677,7 @@ type MutableCompanyPreferences = z.infer<typeof MutableCompanyPreferences>;
672
677
  declare const CompanyStaff: z.ZodObject<{
673
678
  members: z.ZodRecord<z.ZodUUID, z.ZodObject<{
674
679
  inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
680
+ lastModified: z.ZodNullable<z.ZodInt>;
675
681
  email: z.ZodEmail;
676
682
  name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
677
683
  status: z.ZodEnum<{
@@ -679,6 +685,10 @@ declare const CompanyStaff: z.ZodObject<{
679
685
  active: "active";
680
686
  inactive: "inactive";
681
687
  }>;
688
+ isBusy: z.ZodObject<{
689
+ value: z.ZodBoolean;
690
+ lastModified: z.ZodNullable<z.ZodInt>;
691
+ }, z.core.$strip>;
682
692
  appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
683
693
  roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
684
694
  doc: "doc";
@@ -740,7 +750,8 @@ declare const CompanyState: z.ZodObject<{
740
750
  type CompanyState = z.infer<typeof CompanyState>;
741
751
 
742
752
  declare const CompanyUserSession: z.ZodObject<{
743
- ip: z.ZodString;
753
+ _id: z.ZodUUID;
754
+ srcIp: z.ZodString;
744
755
  user: z.ZodObject<{
745
756
  _id: z.ZodUUID;
746
757
  email: z.ZodEmail;
@@ -763,12 +774,18 @@ declare const CompanyUserSession: z.ZodObject<{
763
774
  cshr: "cshr";
764
775
  founder: "founder";
765
776
  }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[]>>;
777
+ lastModified: z.ZodNullable<z.ZodInt>;
766
778
  expiresAfter: z.ZodDate;
767
779
  }, z.core.$strip>;
768
780
  declare const MiniCompanyUser: z.ZodObject<{
769
781
  lastActive: z.ZodNullable<z.ZodInt>;
770
782
  inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
771
783
  inviteAccepted: z.ZodNullable<z.ZodInt>;
784
+ lastModified: z.ZodNullable<z.ZodInt>;
785
+ isBusy: z.ZodObject<{
786
+ value: z.ZodBoolean;
787
+ lastModified: z.ZodNullable<z.ZodInt>;
788
+ }, z.core.$strip>;
772
789
  appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
773
790
  roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
774
791
  doc: "doc";
@@ -792,6 +809,11 @@ declare const CompanyUser: z.ZodObject<{
792
809
  lastActive: z.ZodNullable<z.ZodInt>;
793
810
  inviteSent: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
794
811
  inviteAccepted: z.ZodNullable<z.ZodInt>;
812
+ lastModified: z.ZodNullable<z.ZodInt>;
813
+ isBusy: z.ZodObject<{
814
+ value: z.ZodBoolean;
815
+ lastModified: z.ZodNullable<z.ZodInt>;
816
+ }, z.core.$strip>;
795
817
  appointments: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
796
818
  roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
797
819
  doc: "doc";
@@ -1652,9 +1674,14 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1652
1674
  };
1653
1675
  staffDetails: {
1654
1676
  members: Record<string, {
1677
+ lastModified: number | null;
1655
1678
  email: string;
1656
1679
  name: string;
1657
1680
  status: "inviteSent" | "active" | "inactive";
1681
+ isBusy: {
1682
+ value: boolean;
1683
+ lastModified: number | null;
1684
+ };
1658
1685
  appointments: Record<"ongoing" | "completed", number>;
1659
1686
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[];
1660
1687
  lastActive: number | null;
@@ -1838,12 +1865,22 @@ declare const findConflictingPartners: (...partners: (CompanyUser | MiniCompanyU
1838
1865
  name: string;
1839
1866
  lastActive: number | null;
1840
1867
  inviteAccepted: number | null;
1868
+ lastModified: number | null;
1869
+ isBusy: {
1870
+ value: boolean;
1871
+ lastModified: number | null;
1872
+ };
1841
1873
  appointments: Record<"ongoing" | "completed", number>;
1842
1874
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[];
1843
1875
  inviteSent?: number | null | undefined;
1844
1876
  } | {
1845
1877
  lastActive: number | null;
1846
1878
  inviteAccepted: number | null;
1879
+ lastModified: number | null;
1880
+ isBusy: {
1881
+ value: boolean;
1882
+ lastModified: number | null;
1883
+ };
1847
1884
  appointments: Record<"ongoing" | "completed", number>;
1848
1885
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "founder")[];
1849
1886
  _id: string;
package/dist/main.js CHANGED
@@ -111,13 +111,15 @@ var Receipts = z6.array(
111
111
 
112
112
  // src/schemas/company/components/State.ts
113
113
  import * as z7 from "zod";
114
+ import { upperFirst } from "@wavy/fn";
114
115
  var CompanyState = z7.object({
115
116
  _id: z7.string().toLowerCase().trim().min(3).max(63).transform((data) => data.replace(/-+/g, "-").replace(/\s+/g, "")).superRefine((data, ctx) => {
116
- const getTemplate = (subject) => `Invalid format: expected ${subject} character to be a letter.`;
117
+ const getTemplate = (subject) => `${upperFirst(subject)} character must be a letter.`;
117
118
  const invalidCharIdx = data.search(/[^a-z1-9\-]/);
118
119
  if (invalidCharIdx >= 0) {
120
+ const char = data[invalidCharIdx];
119
121
  ctx.addIssue(
120
- `Invalid format: expected character to either be a "-" or a character between a-z or 1-9, but received " ${data[invalidCharIdx]} ".`
122
+ `${/"|'|`/.test(char) ? `(${char})` : `"${char}"`} is not an allowed character.`
121
123
  );
122
124
  }
123
125
  if (!/[a-z]/.test(data[0])) {
@@ -388,7 +390,7 @@ import * as z15 from "zod";
388
390
  import * as z14 from "zod";
389
391
 
390
392
  // src/functions/helper-functions.ts
391
- import { upperFirst } from "@wavy/fn";
393
+ import { upperFirst as upperFirst2 } from "@wavy/fn";
392
394
  var findConflictingPartners = (...partners) => {
393
395
  let hasSingleDoctor = false;
394
396
  const conflicts = [];
@@ -419,7 +421,7 @@ var getCompatibleRoles = (role) => {
419
421
  return companyUserRoles.exclude([role]).options;
420
422
  };
421
423
  var normalizeCompanyId = (id) => {
422
- return id.split("-").map((value) => upperFirst(value.toLowerCase())).join(" ");
424
+ return id.split("-").map((value) => upperFirst2(value.toLowerCase())).join(" ");
423
425
  };
424
426
 
425
427
  // src/schemas/profiles/User.ts
@@ -453,7 +455,8 @@ var UserDetails = z13.object({
453
455
 
454
456
  // src/schemas/company/components/User.ts
455
457
  var CompanyUserSession = z14.object({
456
- ip: z14.string(),
458
+ _id: z14.uuidv4(),
459
+ srcIp: z14.string(),
457
460
  user: UserDetails.pick({ _id: true, name: true, email: true }),
458
461
  companyId: CompanyState.shape._id,
459
462
  isAvailable: z14.object({
@@ -476,13 +479,17 @@ var CompanyUserSession = z14.object({
476
479
  (role, i) => i === 0 || getCompatibleRoles(roles[0]).includes(role)
477
480
  );
478
481
  }, "A user is not allowed to have conflicting roles."),
482
+ lastModified: Timestamp.nullable(),
479
483
  expiresAfter: z14.date()
480
484
  });
481
485
  var MiniCompanyUser2 = z14.object({
482
486
  _id: UserDetails.shape._id,
483
487
  ...CompanyUserSession.pick({
484
- appointments: true,
485
- roles: true
488
+ roles: true,
489
+ /** Attached to help determine if a user is allowed to create a new session */
490
+ isBusy: true,
491
+ lastModified: true,
492
+ appointments: true
486
493
  }).shape,
487
494
  /** The time before the company session gets deleted */
488
495
  lastActive: Timestamp.nullable(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.76",
3
+ "version": "0.0.78",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",