@bizmap/sdk 0.0.113 → 0.0.115

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
@@ -284,11 +284,6 @@ declare const MutableCompanyDetails: z.ZodObject<{
284
284
  phoneNumber: z.ZodOptional<z.ZodString>;
285
285
  emailVerified: z.ZodBoolean;
286
286
  }, z.core.$strip>>;
287
- legal: z.ZodOptional<z.ZodOptional<z.ZodObject<{
288
- regNo: z.ZodReadonly<z.ZodString>;
289
- trn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
290
- gctRegNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
291
- }, z.core.$strip>>>;
292
287
  }, z.core.$strip>>;
293
288
  preferences: z.ZodOptional<z.ZodObject<{
294
289
  version: z.ZodOptional<z.ZodInt>;
@@ -541,11 +536,6 @@ declare const MutableCompanyIdentity: z.ZodObject<{
541
536
  phoneNumber: z.ZodOptional<z.ZodString>;
542
537
  emailVerified: z.ZodBoolean;
543
538
  }, z.core.$strip>;
544
- legal: z.ZodOptional<z.ZodObject<{
545
- regNo: z.ZodReadonly<z.ZodString>;
546
- trn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
547
- gctRegNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
548
- }, z.core.$strip>>;
549
539
  }, z.core.$strip>;
550
540
  type MutableCompanyIdentity = z.infer<typeof MutableCompanyIdentity>;
551
541
 
@@ -764,6 +754,7 @@ declare const CreateCompanyForm: z.ZodPipe<z.ZodObject<{
764
754
  industry: z.ZodReadonly<z.ZodEnum<{
765
755
  healthcare: "healthcare";
766
756
  }>>;
757
+ sector: z.ZodString;
767
758
  address: z.ZodNonOptional<z.ZodOptional<z.ZodObject<{
768
759
  streetAddress: z.ZodString;
769
760
  city: z.ZodOptional<z.ZodString>;
@@ -777,6 +768,7 @@ declare const CreateCompanyForm: z.ZodPipe<z.ZodObject<{
777
768
  logo: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
778
769
  }, z.core.$strip>, z.ZodTransform<{
779
770
  industry: "healthcare";
771
+ sector: string;
780
772
  address: {
781
773
  streetAddress: string;
782
774
  parish: string;
@@ -790,6 +782,7 @@ declare const CreateCompanyForm: z.ZodPipe<z.ZodObject<{
790
782
  logo?: string | null | undefined;
791
783
  }, {
792
784
  industry: "healthcare";
785
+ sector: string;
793
786
  address: {
794
787
  streetAddress: string;
795
788
  parish: string;
package/dist/main.js CHANGED
@@ -125,11 +125,11 @@ var Receipts = z6.array(
125
125
 
126
126
  // src/schemas/company/components/State.ts
127
127
  import * as z7 from "zod";
128
- import { upperFirst } from "@wavy/fn";
129
128
  var CompanyState = z7.object({
130
- _id: z7.string().toLowerCase().trim().min(3).max(63).transform((data) => data.replace(/-+/g, "-").replace(/\s+/g, "")).superRefine((data, ctx) => {
131
- const getTemplate = (subject) => `${upperFirst(subject)} character must be a letter.`;
132
- const invalidCharIdx = data.search(/[^a-z1-9\-]/);
129
+ _id: z7.string().toLowerCase().trim().min(3).max(63).transform(
130
+ (data) => data.replace(/-+/g, "-").replace(/_+/g, "_").replace(/\.+/g, ".").replace(/\s+/g, "")
131
+ ).superRefine((data, ctx) => {
132
+ const invalidCharIdx = data.search(/[^a-z0-9\-_\.]/);
133
133
  if (invalidCharIdx >= 0) {
134
134
  const char = data[invalidCharIdx];
135
135
  ctx.addIssue(
@@ -137,10 +137,10 @@ var CompanyState = z7.object({
137
137
  );
138
138
  }
139
139
  if (!/[a-z]/.test(data[0])) {
140
- ctx.addIssue(getTemplate("first"));
140
+ ctx.addIssue("The first character must be a letter.");
141
141
  }
142
- if (!/[a-z]/.test(data[data.length - 1])) {
143
- ctx.addIssue(getTemplate("last"));
142
+ if (!/[a-z0-9]/.test(data[data.length - 1])) {
143
+ ctx.addIssue("The last character must either be a letter or a number.");
144
144
  }
145
145
  }),
146
146
  credits: z7.object({
@@ -210,6 +210,9 @@ var CompanyIndustry = z9.object({
210
210
  ])
211
211
  });
212
212
 
213
+ // src/schemas/company/utils/utils.ts
214
+ var getInvalidSectorError = (industry, sector) => `Invalid sector: "${sector}" isn't a sector under the "${industry}" industry.`;
215
+
213
216
  // src/schemas/company/components/Identity.ts
214
217
  var CompanyIdentity = z10.object({
215
218
  _id: CompanyState.shape._id,
@@ -254,16 +257,14 @@ var CompanyIdentity = z10.object({
254
257
  ctx.addIssue("Unverified companies can't have the legal field defined.");
255
258
  }
256
259
  if (!CompanyIndustry.shape[data.industry].safeParse(data.sector).success) {
257
- ctx.addIssue(
258
- `Invalid sector: "${data.sector}" isn't a sector under the "${data.industry}" industry.`
259
- );
260
+ ctx.addIssue(getInvalidSectorError(data.industry, data.sector));
260
261
  }
261
262
  });
262
263
  var MutableCompanyIdentity = CompanyIdentity.pick({
263
264
  address: true,
264
265
  contact: true,
265
266
  logo: true,
266
- legal: true,
267
+ // legal: true,
267
268
  alias: true
268
269
  });
269
270
 
@@ -422,7 +423,7 @@ import * as z17 from "zod";
422
423
  import * as z16 from "zod";
423
424
 
424
425
  // src/functions/helper-functions.ts
425
- import { camelCaseToLetter, upperFirst as upperFirst2 } from "@wavy/fn";
426
+ import { camelCaseToLetter, upperFirst } from "@wavy/fn";
426
427
 
427
428
  // src/schemas/profiles/Client.ts
428
429
  import * as z15 from "zod";
@@ -551,7 +552,7 @@ var getIncompatibleRoles = (role) => {
551
552
  );
552
553
  };
553
554
  var normalizeCompanyId = (id) => {
554
- return id.split("-").map((value) => upperFirst2(value.toLowerCase())).join(" ");
555
+ return id.split("-").map((value) => upperFirst(value.toLowerCase())).join(" ");
555
556
  };
556
557
  var normalizeNidKey = (value) => {
557
558
  value = ClientIdentity.shape.nid.unwrap().keyof().parse(value);
@@ -748,12 +749,17 @@ var CreateCompanyForm = z20.object({
748
749
  logo: CompanyIdentity.shape.logo.optional(),
749
750
  ...CompanyIdentity.shape.contact.pick({ email: true, phoneNumber: true }).shape,
750
751
  industry: CompanyIdentity.shape.industry,
752
+ sector: CompanyIdentity.shape.sector,
751
753
  address: CompanyIdentity.shape.address.nonoptional()
752
754
  }).transform((data) => {
753
755
  if (!("alias" in data)) {
754
756
  data.alias = normalizeCompanyId(data._id);
755
757
  }
756
758
  return data;
759
+ }).superRefine((data, ctx) => {
760
+ if (!CompanyIndustry.shape[data.industry].safeParse(data.sector).success) {
761
+ ctx.addIssue(getInvalidSectorError(data.industry, data.sector));
762
+ }
757
763
  });
758
764
 
759
765
  // src/schemas/appointment/components/Medical.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.113",
3
+ "version": "0.0.115",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",