@jsdev_ninja/core 0.8.55 → 0.8.56

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.
@@ -8,17 +8,8 @@ export declare const ProfileSchema: z.ZodObject<{
8
8
  clientType: z.ZodEnum<["user", "company"]>;
9
9
  displayName: z.ZodString;
10
10
  email: z.ZodString;
11
- phoneNumber: z.ZodObject<{
12
- code: z.ZodString;
13
- number: z.ZodString;
14
- }, "strip", z.ZodTypeAny, {
15
- number: string;
16
- code: string;
17
- }, {
18
- number: string;
19
- code: string;
20
- }>;
21
- address: z.ZodObject<{
11
+ phoneNumber: z.ZodOptional<z.ZodString>;
12
+ address: z.ZodOptional<z.ZodObject<{
22
13
  country: z.ZodString;
23
14
  city: z.ZodString;
24
15
  street: z.ZodString;
@@ -42,7 +33,7 @@ export declare const ProfileSchema: z.ZodObject<{
42
33
  floor: string;
43
34
  apartmentEnterNumber: string;
44
35
  apartmentNumber: string;
45
- }>;
36
+ }>>;
46
37
  isAnonymous: z.ZodBoolean;
47
38
  createdDate: z.ZodNumber;
48
39
  lastActivityDate: z.ZodNumber;
@@ -55,11 +46,11 @@ export declare const ProfileSchema: z.ZodObject<{
55
46
  clientType: "user" | "company";
56
47
  displayName: string;
57
48
  email: string;
58
- phoneNumber: {
59
- number: string;
60
- code: string;
61
- };
62
- address: {
49
+ isAnonymous: boolean;
50
+ createdDate: number;
51
+ lastActivityDate: number;
52
+ phoneNumber?: string | undefined;
53
+ address?: {
63
54
  country: string;
64
55
  city: string;
65
56
  street: string;
@@ -67,10 +58,7 @@ export declare const ProfileSchema: z.ZodObject<{
67
58
  floor: string;
68
59
  apartmentEnterNumber: string;
69
60
  apartmentNumber: string;
70
- };
71
- isAnonymous: boolean;
72
- createdDate: number;
73
- lastActivityDate: number;
61
+ } | undefined;
74
62
  }, {
75
63
  type: "Profile";
76
64
  id: string;
@@ -80,11 +68,11 @@ export declare const ProfileSchema: z.ZodObject<{
80
68
  clientType: "user" | "company";
81
69
  displayName: string;
82
70
  email: string;
83
- phoneNumber: {
84
- number: string;
85
- code: string;
86
- };
87
- address: {
71
+ isAnonymous: boolean;
72
+ createdDate: number;
73
+ lastActivityDate: number;
74
+ phoneNumber?: string | undefined;
75
+ address?: {
88
76
  country: string;
89
77
  city: string;
90
78
  street: string;
@@ -92,10 +80,7 @@ export declare const ProfileSchema: z.ZodObject<{
92
80
  floor: string;
93
81
  apartmentEnterNumber: string;
94
82
  apartmentNumber: string;
95
- };
96
- isAnonymous: boolean;
97
- createdDate: number;
98
- lastActivityDate: number;
83
+ } | undefined;
99
84
  }>;
100
85
  export type TProfile = z.infer<typeof ProfileSchema>;
101
86
  export declare function createEmptyProfile(): TProfile;
@@ -1 +1 @@
1
- {"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../lib/entities/Profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBxB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAErD,wBAAgB,kBAAkB,IAAI,QAAQ,CAwB7C"}
1
+ {"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../lib/entities/Profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcxB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAErD,wBAAgB,kBAAkB,IAAI,QAAQ,CAwB7C"}
@@ -1,19 +1,17 @@
1
1
  import { z } from "zod";
2
2
  import { AddressSchema } from "./Address";
3
+ import { notEmptyTextSchema } from "./Atoms";
3
4
  export const ProfileSchema = z.object({
4
5
  type: z.literal("Profile"),
5
- id: z.string(),
6
- companyId: z.string(),
7
- storeId: z.string(),
8
- tenantId: z.string(),
6
+ id: notEmptyTextSchema,
7
+ companyId: notEmptyTextSchema,
8
+ storeId: notEmptyTextSchema,
9
+ tenantId: notEmptyTextSchema,
9
10
  clientType: z.enum(["user", "company"]),
10
- displayName: z.string().min(1),
11
+ displayName: notEmptyTextSchema,
11
12
  email: z.string().email(),
12
- phoneNumber: z.object({
13
- code: z.string(),
14
- number: z.string(),
15
- }),
16
- address: AddressSchema,
13
+ phoneNumber: notEmptyTextSchema.optional(),
14
+ address: AddressSchema.optional(),
17
15
  isAnonymous: z.boolean(),
18
16
  createdDate: z.number(),
19
17
  lastActivityDate: z.number(),
@@ -28,7 +26,7 @@ export function createEmptyProfile() {
28
26
  clientType: "user",
29
27
  displayName: "",
30
28
  email: "",
31
- phoneNumber: { code: "+972", number: "" },
29
+ phoneNumber: "",
32
30
  address: {
33
31
  country: "",
34
32
  city: "",
@@ -11,6 +11,7 @@ export declare const storeCollections: {
11
11
  readonly categories: "categories";
12
12
  readonly favorites: "favorites";
13
13
  readonly payments: "payments";
14
+ readonly settings: "settings";
14
15
  };
15
16
  export declare const FirestoreApi: {
16
17
  systemCollections: {
@@ -26,6 +27,7 @@ export declare const FirestoreApi: {
26
27
  readonly categories: "categories";
27
28
  readonly favorites: "favorites";
28
29
  readonly payments: "payments";
30
+ readonly settings: "settings";
29
31
  };
30
32
  getPath: ({ companyId, storeId, collectionName, id, }: {
31
33
  companyId: string;
@@ -50,6 +52,7 @@ export declare const FirebaseAPI: {
50
52
  readonly categories: "categories";
51
53
  readonly favorites: "favorites";
52
54
  readonly payments: "payments";
55
+ readonly settings: "settings";
53
56
  };
54
57
  getPath: ({ companyId, storeId, collectionName, id, }: {
55
58
  companyId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/firebase-api/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;;;;CASnB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;2DASrB;QACF,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;QAC9C,EAAE,CAAC,EAAE,MAAM,CAAC;KACZ;iCAI4B,MAAM,OAAO,gBAAgB;CAG1D,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;+DAdpB;YACF,SAAS,EAAE,MAAM,CAAC;YAClB,OAAO,EAAE,MAAM,CAAC;YAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;YAC9C,EAAE,CAAC,EAAE,MAAM,CAAC;SACZ;qCAI4B,MAAM,OAAO,gBAAgB;;CAO1D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/firebase-api/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;;;;;CAUnB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;2DASrB;QACF,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;QAC9C,EAAE,CAAC,EAAE,MAAM,CAAC;KACZ;iCAI4B,MAAM,OAAO,gBAAgB;CAG1D,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;+DAdpB;YACF,SAAS,EAAE,MAAM,CAAC;YAClB,OAAO,EAAE,MAAM,CAAC;YAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;YAC9C,EAAE,CAAC,EAAE,MAAM,CAAC;SACZ;qCAI4B,MAAM,OAAO,gBAAgB;;CAO1D,CAAC"}
@@ -11,6 +11,7 @@ export const storeCollections = {
11
11
  categories: "categories",
12
12
  favorites: "favorites",
13
13
  payments: "payments",
14
+ settings: "settings",
14
15
  };
15
16
  export const FirestoreApi = {
16
17
  systemCollections,
@@ -1,13 +1,14 @@
1
1
  import { z } from "zod";
2
+ import { notEmptyTextSchema } from "./Atoms";
2
3
 
3
4
  export const AddressSchema = z.object({
4
- country: z.string(),
5
- city: z.string(),
6
- street: z.string(),
7
- streetNumber: z.string(),
8
- floor: z.string(),
9
- apartmentEnterNumber: z.string(),
10
- apartmentNumber: z.string(),
5
+ country: notEmptyTextSchema,
6
+ city: notEmptyTextSchema,
7
+ street: notEmptyTextSchema,
8
+ streetNumber: notEmptyTextSchema,
9
+ floor: notEmptyTextSchema,
10
+ apartmentEnterNumber: notEmptyTextSchema,
11
+ apartmentNumber: notEmptyTextSchema,
11
12
  });
12
13
 
13
14
  export type TAddress = z.infer<typeof AddressSchema>;
@@ -1,4 +1,4 @@
1
1
  import { z } from "zod";
2
2
 
3
- export const notEmptyTextSchema = z.string().min(1);
3
+ export const notEmptyTextSchema = z.string().min(1, { message: "שדה חובה" });
4
4
  export const numericTextSchema = z.string().regex(/^\d+$/, "Must be a numeric string");
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
 
3
3
  export const LocaleSchema = z.object({
4
4
  lang: z.enum(["he"]),
5
- value: z.string().min(1),
5
+ value: z.string(),
6
6
  });
7
7
 
8
8
  export const LocaleValueSchema = z.array(LocaleSchema);
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { ProfileSchema } from "./Profile";
3
3
  import { ProductSchema } from "./Product";
4
+ import { notEmptyTextSchema } from "./Atoms";
4
5
 
5
6
  // pending - order created / by user
6
7
  // processing order accepted by store by admin
@@ -12,10 +13,10 @@ import { ProductSchema } from "./Product";
12
13
 
13
14
  export const OrderSchema = z.object({
14
15
  type: z.literal("Order"),
15
- id: z.string(),
16
- companyId: z.string(),
17
- storeId: z.string(),
18
- userId: z.string(),
16
+ id: notEmptyTextSchema,
17
+ companyId: notEmptyTextSchema,
18
+ storeId: notEmptyTextSchema,
19
+ userId: notEmptyTextSchema,
19
20
  status: z.enum([
20
21
  "pending",
21
22
  "processing",
@@ -37,7 +38,8 @@ export const OrderSchema = z.object({
37
38
  actualAmount: z.number().positive().optional(), // what store charge
38
39
  date: z.number(),
39
40
  deliveryDate: z.number().optional(),
40
- client: ProfileSchema,
41
+ createdAt: z.number().optional(),
42
+ client: ProfileSchema.required({}),
41
43
  });
42
44
 
43
45
  export type TOrder = z.infer<typeof OrderSchema>;
@@ -2,15 +2,15 @@ import { z } from "zod";
2
2
  import { LocaleSchema } from "./Locale";
3
3
  import { CategorySchema } from "./Category";
4
4
 
5
- const text = z.string();
5
+ const text = z.string().min(1);
6
6
 
7
7
  export const ProductSchema = z.object({
8
8
  type: z.literal("Product"),
9
9
  storeId: text,
10
10
  companyId: text,
11
- id: z.string(),
12
- objectID: z.string(),
13
- sku: z.string().min(1),
11
+ id: text,
12
+ objectID: text,
13
+ sku: text,
14
14
  name: z.array(LocaleSchema),
15
15
  description: z.array(LocaleSchema),
16
16
  isPublished: z.boolean(),
@@ -36,7 +36,7 @@ export const ProductSchema = z.object({
36
36
  unit: z.enum(["liter", "ml", "none"]),
37
37
  }),
38
38
  images: z.array(z.object({ url: z.string().url(), id: z.string() })),
39
- manufacturer: text,
39
+ manufacturer: z.string(),
40
40
  brand: z.string(),
41
41
  importer: z.string(),
42
42
  supplier: z.string(),
@@ -55,20 +55,10 @@ export const ProductSchema = z.object({
55
55
  }),
56
56
  categoryNames: z.array(z.string()),
57
57
  });
58
+ export type TProduct = z.infer<typeof ProductSchema>;
58
59
 
59
- export const NewProductSchema = ProductSchema.omit({
60
- id: true,
61
- categories: true,
62
- images: true,
63
- }).extend({
64
- image: z.instanceof(File).optional(),
65
- });
66
- export const EditProductSchema = ProductSchema.extend({
60
+ export const NewProductSchema = ProductSchema.extend({
67
61
  image: z.instanceof(File).optional(),
68
62
  });
69
63
 
70
64
  export type TNewProduct = z.infer<typeof NewProductSchema>;
71
-
72
- export type TEditProduct = z.infer<typeof EditProductSchema>;
73
-
74
- export type TProduct = z.infer<typeof ProductSchema>;
@@ -1,20 +1,18 @@
1
1
  import { z } from "zod";
2
2
  import { AddressSchema } from "./Address";
3
+ import { notEmptyTextSchema } from "./Atoms";
3
4
 
4
5
  export const ProfileSchema = z.object({
5
6
  type: z.literal("Profile"),
6
- id: z.string(),
7
- companyId: z.string(),
8
- storeId: z.string(),
9
- tenantId: z.string(),
7
+ id: notEmptyTextSchema,
8
+ companyId: notEmptyTextSchema,
9
+ storeId: notEmptyTextSchema,
10
+ tenantId: notEmptyTextSchema,
10
11
  clientType: z.enum(["user", "company"]),
11
- displayName: z.string().min(1),
12
+ displayName: notEmptyTextSchema,
12
13
  email: z.string().email(),
13
- phoneNumber: z.object({
14
- code: z.string(),
15
- number: z.string(),
16
- }),
17
- address: AddressSchema,
14
+ phoneNumber: notEmptyTextSchema.optional(),
15
+ address: AddressSchema.optional(),
18
16
  isAnonymous: z.boolean(),
19
17
  createdDate: z.number(),
20
18
  lastActivityDate: z.number(),
@@ -32,7 +30,7 @@ export function createEmptyProfile(): TProfile {
32
30
  clientType: "user",
33
31
  displayName: "",
34
32
  email: "",
35
- phoneNumber: { code: "+972", number: "" },
33
+ phoneNumber: "",
36
34
  address: {
37
35
  country: "",
38
36
  city: "",
@@ -12,6 +12,7 @@ export const storeCollections = {
12
12
  categories: "categories",
13
13
  favorites: "favorites",
14
14
  payments: "payments",
15
+ settings: "settings",
15
16
  } as const;
16
17
 
17
18
  export const FirestoreApi = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsdev_ninja/core",
3
- "version": "0.8.55",
3
+ "version": "0.8.56",
4
4
  "main": "dist/core.cjs.js",
5
5
  "module": "dist/core.es.js",
6
6
  "types": "dist/index.d.ts",