feeef 0.0.9 → 0.0.10

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.
Files changed (47) hide show
  1. package/build/index.d.ts +1 -0
  2. package/build/index.js +1 -0
  3. package/build/src/core/core.d.ts +8 -0
  4. package/build/src/core/core.js +10 -0
  5. package/build/src/core/embadded/address.d.ts +13 -0
  6. package/build/src/core/embadded/address.js +1 -0
  7. package/build/src/core/embadded/category.d.ts +7 -0
  8. package/build/src/core/embadded/category.js +1 -0
  9. package/build/src/core/embadded/contact.d.ts +21 -0
  10. package/build/src/core/embadded/contact.js +17 -0
  11. package/build/src/core/entities/order.d.ts +49 -0
  12. package/build/src/core/entities/order.js +22 -0
  13. package/build/src/core/entities/product.d.ts +65 -0
  14. package/build/src/core/entities/product.js +19 -0
  15. package/build/src/core/entities/shipping_method.d.ts +29 -0
  16. package/build/src/core/entities/shipping_method.js +11 -0
  17. package/build/src/core/entities/store.d.ts +71 -0
  18. package/build/src/core/entities/store.js +15 -0
  19. package/build/src/core/entities/user.d.ts +23 -0
  20. package/build/src/core/entities/user.js +1 -0
  21. package/build/src/core/sdk/fif.d.ts +1 -0
  22. package/build/src/core/sdk/fif.js +4 -0
  23. package/build/src/feeef/feeef.d.ts +62 -0
  24. package/build/src/feeef/feeef.js +65 -0
  25. package/build/src/feeef/repositories/orders.d.ts +21 -0
  26. package/build/src/feeef/repositories/orders.js +27 -0
  27. package/build/src/feeef/repositories/products.d.ts +15 -0
  28. package/build/src/feeef/repositories/products.js +13 -0
  29. package/build/src/feeef/repositories/repository.d.ts +112 -0
  30. package/build/src/feeef/repositories/repository.js +96 -0
  31. package/build/src/feeef/repositories/stores.d.ts +22 -0
  32. package/build/src/feeef/repositories/stores.js +25 -0
  33. package/build/src/feeef/repositories/users.d.ts +51 -0
  34. package/build/src/feeef/repositories/users.js +65 -0
  35. package/build/src/feeef/validators/auth.js +46 -0
  36. package/build/src/feeef/validators/custom/datetime.d.ts +1 -0
  37. package/build/src/feeef/validators/custom/datetime.js +7 -0
  38. package/build/src/feeef/validators/helpers.js +65 -0
  39. package/build/src/feeef/validators/order.js +84 -0
  40. package/build/src/feeef/validators/product.js +92 -0
  41. package/build/src/feeef/validators/shipping_method.js +41 -0
  42. package/build/src/feeef/validators/stores.js +97 -0
  43. package/build/src/feeef/validators/user_stores.js +74 -0
  44. package/build/src/feeef/validators/users.js +67 -0
  45. package/build/vite.config.d.ts +2 -0
  46. package/build/vite.config.js +5 -0
  47. package/package.json +1 -1
@@ -0,0 +1,41 @@
1
+ import vine from "@vinejs/vine";
2
+ import { ImageFileSchema } from "./helpers.js";
3
+ import { ShippingMethodPolicy, ShippingMethodStatus } from "../../core/core.js";
4
+ // import { ShippingMethodPolicy, ShippingMethodStatus } from '#models/shipping_method'
5
+ export const CreateShippingMethodSchema = vine.object({
6
+ name: vine.string(),
7
+ description: vine.string().optional(),
8
+ photoUrl: vine.string().optional(),
9
+ ondarkPhotoUrl: vine.string().optional(),
10
+ photoFile: ImageFileSchema.optional(),
11
+ ondarkPhotoFile: ImageFileSchema.optional(),
12
+ price: vine.number(),
13
+ // forks: vine.number(),
14
+ // sourceId: vine.string(),
15
+ storeId: vine.string(),
16
+ rates: vine.array(vine.number().optional()),
17
+ status: vine.enum(ShippingMethodStatus),
18
+ policy: vine.enum(ShippingMethodPolicy),
19
+ // verifiedAt: vine.date(),
20
+ });
21
+ export const UpdateShippingMethodSchema = vine.object({
22
+ name: vine.string().optional(),
23
+ description: vine.string().optional(),
24
+ photoUrl: vine.string().optional(),
25
+ ondarkPhotoUrl: vine.string().optional(),
26
+ photoFile: ImageFileSchema.optional(),
27
+ ondarkPhotoFile: ImageFileSchema.optional(),
28
+ price: vine.number().optional(),
29
+ // forks: vine.number().optional(),
30
+ // sourceId: vine.string().optional(),
31
+ storeId: vine.string().optional(),
32
+ rates: vine.array(vine.number().optional()).optional(),
33
+ status: vine.enum(ShippingMethodStatus).optional(),
34
+ policy: vine.enum(ShippingMethodPolicy).optional(),
35
+ // verifiedAt: vine.date().optional(),
36
+ });
37
+ // ForkShippingMethodSchema
38
+ export const ForkShippingMethodSchema = vine.object({
39
+ sourceId: vine.string(),
40
+ storeId: vine.string(),
41
+ });
@@ -0,0 +1,97 @@
1
+ import vine from '@vinejs/vine';
2
+ import { AvatarFileSchema, ContactSchema, DomainSchema, EmbaddedAddressSchema, EmbaddedCategorySchema, StoreDecorationSchema, } from './helpers.js';
3
+ import { DefaultShippingRatesSchema } from './user_stores.js';
4
+ export const CreateStoreSchema = vine.object({
5
+ name: vine.string().minLength(2).maxLength(32),
6
+ slug: vine
7
+ .string()
8
+ .regex(/^[a-z0-9-]+$/)
9
+ .minLength(2)
10
+ .maxLength(32)
11
+ // .unique(async (db, value, field) => {
12
+ // const store = await db.from('stores').where('slug', value).first()
13
+ // return !store
14
+ // })
15
+ ,
16
+ domain: vine
17
+ .object({
18
+ name: vine.string().minLength(2).maxLength(32),
19
+ verifiedAt: vine.date().optional(),
20
+ metadata: vine.object({}).optional(),
21
+ })
22
+ .optional(),
23
+ decoration: vine
24
+ .object({
25
+ primaryColor: vine.number().min(0x0).max(0xffffffff),
26
+ metadata: vine.any().optional(),
27
+ })
28
+ .optional(),
29
+ logoUrl: vine.string().optional(),
30
+ ondarkLogoUrl: vine.string().optional(),
31
+ logoFile: AvatarFileSchema.optional(),
32
+ ondarkLogoFile: AvatarFileSchema.optional(),
33
+ userId: vine.string()
34
+ // .exists(async (db, value, field) => {
35
+ // const user = await db.from('users').where('id', value).first()
36
+ // return !!user
37
+ // })
38
+ ,
39
+ categories: vine.array(EmbaddedCategorySchema).optional(),
40
+ title: vine.string().minLength(2).maxLength(255).optional(),
41
+ description: vine.string().minLength(2).maxLength(255).optional(),
42
+ addresses: vine.array(EmbaddedAddressSchema).optional(),
43
+ metadata: vine.object({}).optional(),
44
+ contacts: vine
45
+ .array(vine.object({
46
+ type: vine.string().minLength(2).maxLength(32),
47
+ value: vine.string().minLength(2).maxLength(255),
48
+ metadata: vine.object({}).optional(),
49
+ }))
50
+ .optional(),
51
+ shippingRates: vine.array(vine.string().minLength(2).maxLength(48)).optional(),
52
+ verifiedAt: vine.date().optional(),
53
+ blockedAt: vine.date().optional(),
54
+ integrations: vine.array(vine.any()).optional(),
55
+ // default_shipping_rates
56
+ defaultShippingRates: DefaultShippingRatesSchema.optional(),
57
+ });
58
+ // UpdateStoreSchema
59
+ export const UpdateStoreSchema = vine.object({
60
+ name: vine.string().minLength(2).maxLength(32).optional(),
61
+ slug: vine
62
+ .string()
63
+ .regex(/^[a-z0-9-]+$/)
64
+ .minLength(2)
65
+ .maxLength(32)
66
+ // .unique(async (db, value, field) => {
67
+ // const store = await db.from('stores').where('slug', value).first()
68
+ // return !store
69
+ // })
70
+ .optional(),
71
+ domain: DomainSchema.optional(),
72
+ decoration: StoreDecorationSchema.optional(),
73
+ logoUrl: vine.string().optional(),
74
+ ondarkLogoUrl: vine.string().optional(),
75
+ logoFile: AvatarFileSchema.optional(),
76
+ ondarkLogoFile: AvatarFileSchema.optional(),
77
+ userId: vine
78
+ .string()
79
+ // .exists(async (db, value, field) => {
80
+ // const user = await db.from('users').where('id', value).first()
81
+ // return !!user
82
+ // })
83
+ .optional(),
84
+ categories: vine.array(EmbaddedCategorySchema).optional(),
85
+ title: vine.string().minLength(2).maxLength(255).optional(),
86
+ description: vine.string().minLength(2).maxLength(255).optional(),
87
+ addresses: vine.array(EmbaddedAddressSchema).optional(),
88
+ metadata: vine.object({}).optional(),
89
+ contacts: vine.array(ContactSchema).optional(),
90
+ shippingRates: vine.array(vine.string().minLength(2).maxLength(48)).optional(),
91
+ verifiedAt: vine.date().optional(),
92
+ blockedAt: vine.date().optional(),
93
+ // integrations
94
+ integrations: vine.array(vine.any()).optional(),
95
+ // default_shipping_rates
96
+ defaultShippingRates: DefaultShippingRatesSchema.optional(),
97
+ });
@@ -0,0 +1,74 @@
1
+ import vine from "@vinejs/vine";
2
+ import { AvatarFileSchema, ContactSchema, DomainSchema, EmbaddedAddressSchema, EmbaddedCategorySchema, StoreBunner, StoreDecorationSchema, } from "./helpers.js";
3
+ // "defaultShippingRates.1"
4
+ export const DefaultShippingRatesSchema = vine.array(vine.array(vine.number().min(0).max(10000).nullable()).nullable());
5
+ export const CreateUserStoreSchema = vine.object({
6
+ name: vine.string().minLength(2).maxLength(32),
7
+ slug: vine
8
+ .string()
9
+ .regex(/^[a-z0-9-]+$/)
10
+ .minLength(2)
11
+ .maxLength(32),
12
+ // .unique(async (db, value, field) => {
13
+ // const store = await db.from('stores').where('slug', value).first()
14
+ // return !store
15
+ // })
16
+ domain: vine
17
+ .object({
18
+ name: vine.string().minLength(2).maxLength(32),
19
+ })
20
+ .optional(),
21
+ decoration: vine
22
+ .object({
23
+ primaryColor: vine.number().min(0x0).max(0xffffffff),
24
+ })
25
+ .optional(),
26
+ banner: StoreBunner.optional(),
27
+ logoUrl: vine.string().optional(),
28
+ ondarkLogoUrl: vine.string().optional(),
29
+ logoFile: AvatarFileSchema.optional(),
30
+ ondarkLogoFile: AvatarFileSchema.optional(),
31
+ categories: vine.array(EmbaddedCategorySchema).optional(),
32
+ title: vine.string().minLength(2).maxLength(255).optional(),
33
+ description: vine.string().minLength(2).maxLength(255).optional(),
34
+ addresses: vine.array(EmbaddedAddressSchema).optional(),
35
+ metadata: vine.object({}).optional(),
36
+ contacts: vine
37
+ .array(vine.object({
38
+ type: vine.string().minLength(2).maxLength(32),
39
+ value: vine.string().minLength(2).maxLength(255),
40
+ metadata: vine.object({}).optional(),
41
+ }))
42
+ .optional(),
43
+ defaultShippingRates: DefaultShippingRatesSchema.optional(),
44
+ integrations: vine.array(vine.any()).optional(),
45
+ });
46
+ // UpdateStoreSchema
47
+ export const UpdateUserStoreSchema = vine.object({
48
+ name: vine.string().minLength(2).maxLength(32).optional(),
49
+ slug: vine
50
+ .string()
51
+ .regex(/^[a-z0-9-]+$/)
52
+ .minLength(2)
53
+ .maxLength(32)
54
+ // .unique(async (db, value, field) => {
55
+ // const store = await db.from('stores').where('slug', value).first()
56
+ // return !store
57
+ // })
58
+ .optional(),
59
+ domain: DomainSchema.optional(),
60
+ decoration: StoreDecorationSchema.optional(),
61
+ banner: StoreBunner.optional(),
62
+ logoUrl: vine.string().nullable().optional(),
63
+ ondarkLogoUrl: vine.string().nullable().optional(),
64
+ logoFile: AvatarFileSchema.optional(),
65
+ ondarkLogoFile: AvatarFileSchema.optional(),
66
+ categories: vine.array(EmbaddedCategorySchema).optional(),
67
+ title: vine.string().minLength(2).maxLength(255).optional(),
68
+ description: vine.string().minLength(2).maxLength(255).optional(),
69
+ addresses: vine.array(EmbaddedAddressSchema).optional(),
70
+ metadata: vine.object({}).optional(),
71
+ contacts: vine.array(ContactSchema).optional(),
72
+ defaultShippingRates: DefaultShippingRatesSchema.optional(),
73
+ integrations: vine.array(vine.any()).optional(),
74
+ });
@@ -0,0 +1,67 @@
1
+ import vine from "@vinejs/vine";
2
+ // User Schemas
3
+ //CreateUserSchema
4
+ export const CreateUserSchema = vine.object({
5
+ name: vine.string().minLength(2).maxLength(32),
6
+ email: vine.string(),
7
+ // .unique(async (db, value, field) => {
8
+ // const user = await db.from('users').where('email', value).first()
9
+ // return !user
10
+ // }),
11
+ phone: vine
12
+ .string()
13
+ .regex(/^0(5|6|7)\d{8}$|^0(2)\d{7}$/)
14
+ // .unique(async (db, value, field) => {
15
+ // const user = await db.from('users').where('phone', value).first()
16
+ // return !user
17
+ // })
18
+ .optional(),
19
+ password: vine.string().minLength(8).maxLength(32),
20
+ // for upload file
21
+ photoFile: vine.any(),
22
+ // .file({
23
+ // size: '1mb',
24
+ // extnames: ['jpg', 'jpeg', 'png', 'gif', 'webp'],
25
+ // })
26
+ // .optional(),
27
+ photoUrl: vine.string().optional(),
28
+ // metadata (any object)
29
+ metadata: vine.object({}).optional(),
30
+ // dates
31
+ emailVerifiedAt: vine.date().optional(),
32
+ phoneVerifiedAt: vine.date().optional(),
33
+ verifiedAt: vine.date().optional(),
34
+ blockedAt: vine.date().optional(),
35
+ });
36
+ //UpdateUserSchema
37
+ export const UpdateUserSchema = vine.object({
38
+ name: vine.string().minLength(2).maxLength(32).optional(),
39
+ email: vine
40
+ .string()
41
+ // .unique(async (db, value, field) => {
42
+ // const user = await db.from('users').where('email', value).first()
43
+ // return !user
44
+ // })
45
+ .optional(),
46
+ phone: vine
47
+ .string()
48
+ // must start with 0 then if secend is (5|6|7) then 8 digits and if secend is (2) then 7 digits
49
+ .regex(/^0(5|6|7)\d{8}$|^0(2)\d{7}$/)
50
+ .optional(),
51
+ password: vine.string().minLength(8).maxLength(32).confirmed().optional(),
52
+ // for upload file
53
+ photoFile: vine
54
+ // .file({
55
+ // size: '1mb',
56
+ // extnames: ['jpg', 'jpeg', 'png', 'gif', 'webp'],
57
+ // })
58
+ .any(),
59
+ photoUrl: vine.string().optional(),
60
+ // metadata (any object)
61
+ metadata: vine.object({}).optional(),
62
+ // dates
63
+ emailVerifiedAt: vine.date().optional(),
64
+ phoneVerifiedAt: vine.date().optional(),
65
+ verifiedAt: vine.string().optional(),
66
+ blockedAt: vine.date().optional(),
67
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vite").UserConfig;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { defineConfig } from "vite";
2
+ // https://vitejs.dev/config/
3
+ export default defineConfig({
4
+ plugins: [],
5
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "feeef",
3
3
  "description": "FeeeF sdk",
4
- "version": "0.0.9",
4
+ "version": "0.0.10",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
7
7
  "files": [