@bizmap/sdk 0.0.132 → 0.0.133

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
@@ -102,10 +102,6 @@ declare const CompanyDetails: z.ZodObject<{
102
102
  current: z.ZodNumber;
103
103
  lastModified: z.ZodOptional<z.ZodISODateTime>;
104
104
  }, z.core.$strip>;
105
- usedStorageInBytes: z.ZodObject<{
106
- current: z.ZodNumber;
107
- lastModified: z.ZodOptional<z.ZodISODateTime>;
108
- }, z.core.$strip>;
109
105
  tierId: z.ZodObject<{
110
106
  current: z.ZodString;
111
107
  lastModified: z.ZodOptional<z.ZodISODateTime>;
@@ -184,6 +180,7 @@ declare const CompanyDetails: z.ZodObject<{
184
180
  staff: z.ZodObject<{
185
181
  createdAt: z.ZodReadonly<z.ZodISODateTime>;
186
182
  lastModified: z.ZodOptional<z.ZodISODateTime>;
183
+ ownerId: z.ZodUUID;
187
184
  members: z.ZodRecord<z.ZodUUID, z.ZodObject<{
188
185
  invitedAt: z.ZodOptional<z.ZodISODateTime>;
189
186
  joinedAt: z.ZodISODateTime;
@@ -258,10 +255,6 @@ declare const _CompanyDetails: z.ZodObject<{
258
255
  current: z.ZodNumber;
259
256
  lastModified: z.ZodOptional<z.ZodISODateTime>;
260
257
  }, z.core.$strip>;
261
- usedStorageInBytes: z.ZodObject<{
262
- current: z.ZodNumber;
263
- lastModified: z.ZodOptional<z.ZodISODateTime>;
264
- }, z.core.$strip>;
265
258
  tierId: z.ZodObject<{
266
259
  current: z.ZodString;
267
260
  lastModified: z.ZodOptional<z.ZodISODateTime>;
@@ -343,6 +336,7 @@ declare const _CompanyDetails: z.ZodObject<{
343
336
  createdAt: z.ZodReadonly<z.ZodISODateTime>;
344
337
  lastModified: z.ZodOptional<z.ZodISODateTime>;
345
338
  _id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
339
+ ownerId: z.ZodUUID;
346
340
  members: z.ZodRecord<z.ZodUUID, z.ZodObject<{
347
341
  invitedAt: z.ZodOptional<z.ZodISODateTime>;
348
342
  joinedAt: z.ZodISODateTime;
@@ -689,6 +683,7 @@ declare const CompanyStaff: z.ZodObject<{
689
683
  createdAt: z.ZodReadonly<z.ZodISODateTime>;
690
684
  lastModified: z.ZodOptional<z.ZodISODateTime>;
691
685
  _id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
686
+ ownerId: z.ZodUUID;
692
687
  members: z.ZodRecord<z.ZodUUID, z.ZodObject<{
693
688
  invitedAt: z.ZodOptional<z.ZodISODateTime>;
694
689
  joinedAt: z.ZodISODateTime;
@@ -759,10 +754,6 @@ declare const CompanyState: z.ZodObject<{
759
754
  current: z.ZodNumber;
760
755
  lastModified: z.ZodOptional<z.ZodISODateTime>;
761
756
  }, z.core.$strip>;
762
- usedStorageInBytes: z.ZodObject<{
763
- current: z.ZodNumber;
764
- lastModified: z.ZodOptional<z.ZodISODateTime>;
765
- }, z.core.$strip>;
766
757
  tierId: z.ZodObject<{
767
758
  current: z.ZodString;
768
759
  lastModified: z.ZodOptional<z.ZodISODateTime>;
@@ -1071,7 +1062,11 @@ declare const UserDetails: z.ZodObject<{
1071
1062
  phoneNumber: z.ZodOptional<z.ZodString>;
1072
1063
  name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
1073
1064
  publicKey: z.ZodOptional<z.ZodString>;
1074
- availableStorageInBytes: z.ZodOptional<z.ZodNumber>;
1065
+ usedStorageInBytes: z.ZodReadonly<z.ZodRecord<z.ZodUnion<[z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodLiteral<"gp">]>, z.ZodObject<{
1066
+ createdAt: z.ZodReadonly<z.ZodISODateTime>;
1067
+ lastModified: z.ZodOptional<z.ZodISODateTime>;
1068
+ current: z.ZodNumber;
1069
+ }, z.core.$strip>>>;
1075
1070
  lastSignedIn: z.ZodObject<{
1076
1071
  auto: z.ZodOptional<z.ZodISODateTime>;
1077
1072
  manual: z.ZodOptional<z.ZodISODateTime>;
package/dist/main.js CHANGED
@@ -137,10 +137,6 @@ var CompanyState = z6.object({
137
137
  current: z6.number(),
138
138
  lastModified: Timestamp.optional()
139
139
  }),
140
- usedStorageInBytes: z6.object({
141
- current: z6.number(),
142
- lastModified: Timestamp.optional()
143
- }),
144
140
  tierId: z6.object({
145
141
  current: z6.string(),
146
142
  lastModified: Timestamp.optional()
@@ -314,12 +310,21 @@ var UserDetails = z11.object({
314
310
  }),
315
311
  email: UserModel.shape.email,
316
312
  publicKey: z11.string().optional(),
317
- availableStorageInBytes: z11.number().optional(),
313
+ // Used to track the user's general purpose (gp) storage and the total storage used by
314
+ // their companies.
315
+ usedStorageInBytes: z11.record(
316
+ CompanyState.shape._id.or(z11.literal("gp")),
317
+ z11.object({
318
+ current: z11.number().positive(),
319
+ ...TimeLog.shape
320
+ })
321
+ ).readonly(),
318
322
  // notifications: z.array(Notification),
319
323
  lastSignedIn: z11.object({
320
324
  auto: Timestamp,
321
325
  manual: Timestamp
322
326
  }).partial(),
327
+ // This is useful for tracking the companies that a non-company owner belongs to.
323
328
  companyIds: z11.array(CompanyState.shape._id).min(1).optional(),
324
329
  // resumeToken: z.uuidv4().optional(),
325
330
  ...TimeLog.shape
@@ -416,6 +421,7 @@ var CompanyMemberRoles = z13.array(companyUserRoles).transform((roles) => distin
416
421
  }, "A user is not allowed to have conflicting roles.");
417
422
  var CompanyStaff = z13.object({
418
423
  _id: CompanyState.shape._id,
424
+ ownerId: UserDetails.shape._id,
419
425
  members: z13.record(
420
426
  UserDetails.shape._id,
421
427
  z13.object({
@@ -447,17 +453,20 @@ var CompanyStaff = z13.object({
447
453
  }).partial()
448
454
  ).optional(),
449
455
  ...TimeLog.shape
450
- }).superRefine((details, ctx) => {
451
- for (const [_id, user] of Object.entries(details.members)) {
452
- if (user.roles.includes("doc") && details.partnerMap && _id in details.partnerMap) {
453
- for (const asstUid of Object.keys(details.partnerMap[_id])) {
454
- if (!details.members[asstUid].roles.includes("physAsst")) {
456
+ }).superRefine((data, ctx) => {
457
+ if (!(data.ownerId in data.members)) {
458
+ ctx.addIssue('"ownerId" missing from "members" object.');
459
+ }
460
+ for (const [_id, user] of Object.entries(data.members)) {
461
+ if (user.roles.includes("doc") && data.partnerMap && _id in data.partnerMap) {
462
+ for (const asstUid of Object.keys(data.partnerMap[_id])) {
463
+ if (!data.members[asstUid].roles.includes("physAsst")) {
455
464
  ctx.addIssue(
456
465
  `A partner group member must have the "physAsst" role (${_id}) -> (${asstUid}).`
457
466
  );
458
467
  }
459
468
  }
460
- } else if (details.partnerMap && _id in details.partnerMap) {
469
+ } else if (data.partnerMap && _id in data.partnerMap) {
461
470
  ctx.addIssue(
462
471
  `A partner group leader must have the "doc" role. (${_id})`
463
472
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.132",
3
+ "version": "0.0.133",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",