@bizmap/sdk 0.0.125 → 0.0.127

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
@@ -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>;
@@ -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, 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, serviceDistAlgs, tiers, vitalKeys };
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
@@ -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
- // src/schemas/company/core/utils.ts
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
- if (!CompanyIndustry.shape[data.industry].safeParse(data.sector).success) {
242
- ctx.addIssue(getInvalidSectorError(data.industry, data.sector));
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({
@@ -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(
@@ -640,8 +646,9 @@ var CreateCompanyForm = z18.object({
640
646
  sector: true
641
647
  }).shape
642
648
  }).superRefine((data, ctx) => {
643
- if (!CompanyIndustry.shape[data.industry].safeParse(data.sector).success) {
644
- ctx.addIssue(getInvalidSectorError(data.industry, data.sector));
649
+ const parsedSector = safeParseSector(data.industry, data.sector);
650
+ if (!parsedSector.success) {
651
+ ctx.addIssue(parsedSector.error.message);
645
652
  }
646
653
  });
647
654
 
@@ -890,6 +897,7 @@ export {
890
897
  normalizeNidKey,
891
898
  parseClientName,
892
899
  paymentMethods,
900
+ safeParseSector,
893
901
  serviceDistAlgs,
894
902
  tiers,
895
903
  vitalKeys
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.125",
3
+ "version": "0.0.127",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",
@@ -16,13 +16,13 @@
16
16
  "author": "",
17
17
  "license": "MIT",
18
18
  "peerDependencies": {
19
- "@wavy/fn": "^0.0.43",
19
+ "@wavy/fn": "^0.0.44",
20
20
  "@wavy/util": ">=0.0.12",
21
21
  "zod": "^4.2.1"
22
22
  },
23
23
  "description": "",
24
24
  "devDependencies": {
25
- "@wavy/fn": "^0.0.43",
25
+ "@wavy/fn": "^0.0.44",
26
26
  "@wavy/util": "^0.0.18",
27
27
  "tsup": "^8.5.0",
28
28
  "typescript": "^5.9.2",