@jsdev_ninja/core 0.8.55 → 0.9.0
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/core.cjs.js +1 -1
- package/dist/core.cjs.js.map +1 -1
- package/dist/core.es.js +671 -679
- package/dist/core.es.js.map +1 -1
- package/dist/core.umd.js +1 -1
- package/dist/core.umd.js.map +1 -1
- package/dist/entities/Address.d.ts.map +1 -1
- package/dist/entities/Address.js +8 -7
- package/dist/entities/Atoms.d.ts.map +1 -1
- package/dist/entities/Atoms.js +1 -1
- package/dist/entities/Locale.js +1 -1
- package/dist/entities/Order.d.ts +30 -48
- package/dist/entities/Order.d.ts.map +1 -1
- package/dist/entities/Order.js +7 -5
- package/dist/entities/Product.d.ts +2 -320
- package/dist/entities/Product.d.ts.map +1 -1
- package/dist/entities/Product.js +6 -13
- package/dist/entities/Profile.d.ts +15 -30
- package/dist/entities/Profile.d.ts.map +1 -1
- package/dist/entities/Profile.js +9 -11
- package/dist/firebase-api/index.d.ts +3 -0
- package/dist/firebase-api/index.d.ts.map +1 -1
- package/dist/firebase-api/index.js +1 -0
- package/lib/entities/Address.ts +8 -7
- package/lib/entities/Atoms.ts +1 -1
- package/lib/entities/Locale.ts +1 -1
- package/lib/entities/Order.ts +7 -5
- package/lib/entities/Product.ts +7 -17
- package/lib/entities/Profile.ts +9 -11
- package/lib/firebase-api/index.ts +1 -0
- package/package.json +1 -1
|
@@ -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.
|
|
12
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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;
|
|
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"}
|
package/dist/entities/Profile.js
CHANGED
|
@@ -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:
|
|
6
|
-
companyId:
|
|
7
|
-
storeId:
|
|
8
|
-
tenantId:
|
|
6
|
+
id: notEmptyTextSchema,
|
|
7
|
+
companyId: notEmptyTextSchema,
|
|
8
|
+
storeId: notEmptyTextSchema,
|
|
9
|
+
tenantId: notEmptyTextSchema,
|
|
9
10
|
clientType: z.enum(["user", "company"]),
|
|
10
|
-
displayName:
|
|
11
|
+
displayName: notEmptyTextSchema,
|
|
11
12
|
email: z.string().email(),
|
|
12
|
-
phoneNumber:
|
|
13
|
-
|
|
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:
|
|
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
|
|
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"}
|
package/lib/entities/Address.ts
CHANGED
|
@@ -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:
|
|
5
|
-
city:
|
|
6
|
-
street:
|
|
7
|
-
streetNumber:
|
|
8
|
-
floor:
|
|
9
|
-
apartmentEnterNumber:
|
|
10
|
-
apartmentNumber:
|
|
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>;
|
package/lib/entities/Atoms.ts
CHANGED
package/lib/entities/Locale.ts
CHANGED
package/lib/entities/Order.ts
CHANGED
|
@@ -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:
|
|
16
|
-
companyId:
|
|
17
|
-
storeId:
|
|
18
|
-
userId:
|
|
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
|
-
|
|
41
|
+
createdAt: z.number().optional(),
|
|
42
|
+
client: ProfileSchema.required({}),
|
|
41
43
|
});
|
|
42
44
|
|
|
43
45
|
export type TOrder = z.infer<typeof OrderSchema>;
|
package/lib/entities/Product.ts
CHANGED
|
@@ -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:
|
|
12
|
-
objectID:
|
|
13
|
-
sku:
|
|
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:
|
|
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.
|
|
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>;
|
package/lib/entities/Profile.ts
CHANGED
|
@@ -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:
|
|
7
|
-
companyId:
|
|
8
|
-
storeId:
|
|
9
|
-
tenantId:
|
|
7
|
+
id: notEmptyTextSchema,
|
|
8
|
+
companyId: notEmptyTextSchema,
|
|
9
|
+
storeId: notEmptyTextSchema,
|
|
10
|
+
tenantId: notEmptyTextSchema,
|
|
10
11
|
clientType: z.enum(["user", "company"]),
|
|
11
|
-
displayName:
|
|
12
|
+
displayName: notEmptyTextSchema,
|
|
12
13
|
email: z.string().email(),
|
|
13
|
-
phoneNumber:
|
|
14
|
-
|
|
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:
|
|
33
|
+
phoneNumber: "",
|
|
36
34
|
address: {
|
|
37
35
|
country: "",
|
|
38
36
|
city: "",
|