@cravery/core 0.0.21 → 0.0.23

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 (76) hide show
  1. package/dist/lib/ai/embedding.d.ts +1 -1
  2. package/dist/lib/ai/embedding.d.ts.map +1 -1
  3. package/dist/lib/ai/embedding.js +12 -9
  4. package/dist/lib/ai/embedding.js.map +1 -1
  5. package/dist/lib/ai/genkit.d.ts +3 -3
  6. package/dist/lib/ai/genkit.d.ts.map +1 -1
  7. package/dist/lib/ai/genkit.js +12 -8
  8. package/dist/lib/ai/genkit.js.map +1 -1
  9. package/dist/types/ai/recipe.d.ts.map +1 -1
  10. package/dist/types/ai/recipe.js +17 -10
  11. package/dist/types/ai/recipe.js.map +1 -1
  12. package/dist/types/core/settings.d.ts.map +1 -1
  13. package/dist/types/core/settings.js.map +1 -1
  14. package/dist/types/iam/user.d.ts.map +1 -1
  15. package/dist/types/iam/user.js.map +1 -1
  16. package/dist/types/recipe/equipment.d.ts.map +1 -1
  17. package/dist/types/recipe/equipment.js +4 -5
  18. package/dist/types/recipe/equipment.js.map +1 -1
  19. package/dist/types/recipe/ingredient.d.ts.map +1 -1
  20. package/dist/types/recipe/ingredient.js +13 -14
  21. package/dist/types/recipe/ingredient.js.map +1 -1
  22. package/dist/types/recipe/instruction.js +4 -4
  23. package/dist/types/recipe/instruction.js.map +1 -1
  24. package/dist/types/recipe/nutrition.js +9 -9
  25. package/dist/types/recipe/nutrition.js.map +1 -1
  26. package/package.json +56 -56
  27. package/src/lib/ai/embedding.ts +15 -9
  28. package/src/lib/ai/flow.ts +89 -89
  29. package/src/lib/ai/genkit.ts +18 -12
  30. package/src/lib/api.ts +103 -103
  31. package/src/lib/utils/sanitize.ts +38 -38
  32. package/src/types/ai/recipe.ts +68 -61
  33. package/src/types/ai/translation.ts +27 -27
  34. package/src/types/core/asset.ts +17 -17
  35. package/src/types/core/enums/image_type.ts +5 -5
  36. package/src/types/core/enums/locale.ts +5 -5
  37. package/src/types/core/enums/measurement_system.ts +5 -5
  38. package/src/types/core/enums/theme.ts +5 -5
  39. package/src/types/core/enums/url_type.ts +13 -13
  40. package/src/types/core/settings.ts +68 -61
  41. package/src/types/iam/enums/profile_status.ts +10 -10
  42. package/src/types/iam/enums/subscription_role.ts +5 -5
  43. package/src/types/iam/enums/subscription_status.ts +10 -10
  44. package/src/types/iam/enums/subscription_tier.ts +4 -4
  45. package/src/types/iam/enums/user_role.ts +11 -11
  46. package/src/types/iam/enums/user_status.ts +10 -10
  47. package/src/types/iam/profile.ts +45 -45
  48. package/src/types/iam/subscription.ts +45 -45
  49. package/src/types/iam/user.ts +36 -31
  50. package/src/types/moderation/enums/moderation_status.ts +9 -9
  51. package/src/types/moderation/enums/priority.ts +5 -5
  52. package/src/types/moderation/enums/severity.ts +5 -5
  53. package/src/types/moderation/enums/suggestion_category.ts +11 -11
  54. package/src/types/moderation/moderation.ts +87 -87
  55. package/src/types/recipe/enums/allergen.ts +19 -19
  56. package/src/types/recipe/enums/cuisine.ts +39 -39
  57. package/src/types/recipe/enums/dietary_tag.ts +21 -21
  58. package/src/types/recipe/enums/difficulty.ts +10 -10
  59. package/src/types/recipe/enums/meal_type.ts +14 -14
  60. package/src/types/recipe/enums/recipe_source.ts +5 -5
  61. package/src/types/recipe/enums/recipe_status.ts +12 -12
  62. package/src/types/recipe/enums/spiciness.ts +5 -5
  63. package/src/types/recipe/enums/temperature_unit.ts +5 -5
  64. package/src/types/recipe/enums/unit.ts +51 -51
  65. package/src/types/recipe/equipment.ts +30 -31
  66. package/src/types/recipe/filters.ts +35 -35
  67. package/src/types/recipe/ingredient.ts +69 -70
  68. package/src/types/recipe/instruction.ts +31 -31
  69. package/src/types/recipe/nutrition.ts +29 -29
  70. package/src/types/recipe/recipe.ts +198 -198
  71. package/src/types/recipe/temperature.ts +12 -12
  72. package/src/types/report/enums/report_priority.ts +10 -10
  73. package/src/types/report/enums/report_status.ts +10 -10
  74. package/src/types/report/enums/report_target_type.ts +10 -10
  75. package/src/types/report/enums/report_type.ts +12 -12
  76. package/src/types/report/report.ts +68 -68
@@ -1,27 +1,27 @@
1
- import { z } from "genkit";
2
- import {
3
- EquipmentContentSchema,
4
- IngredientSectionContentSchema,
5
- InstructionContentSchema,
6
- type EquipmentContent,
7
- type IngredientSectionContent,
8
- type InstructionContent,
9
- } from "../recipe";
10
-
11
- export interface AIRecipeTranslation {
12
- description: string;
13
- equipment?: EquipmentContent[];
14
- ingredientSections: IngredientSectionContent[];
15
- instructions: InstructionContent[];
16
- tips?: string[];
17
- title: string;
18
- }
19
-
20
- export const AIRecipeTranslationSchema = z.object({
21
- description: z.string().min(10).max(2000),
22
- equipment: z.array(EquipmentContentSchema).optional(),
23
- ingredientSections: z.array(IngredientSectionContentSchema).min(1),
24
- instructions: z.array(InstructionContentSchema).min(1),
25
- tips: z.array(z.string().max(500)).optional(),
26
- title: z.string().min(3).max(200),
27
- }) satisfies z.ZodType<AIRecipeTranslation>;
1
+ import { z } from "genkit";
2
+ import {
3
+ EquipmentContentSchema,
4
+ IngredientSectionContentSchema,
5
+ InstructionContentSchema,
6
+ type EquipmentContent,
7
+ type IngredientSectionContent,
8
+ type InstructionContent,
9
+ } from "../recipe";
10
+
11
+ export interface AIRecipeTranslation {
12
+ description: string;
13
+ equipment?: EquipmentContent[];
14
+ ingredientSections: IngredientSectionContent[];
15
+ instructions: InstructionContent[];
16
+ tips?: string[];
17
+ title: string;
18
+ }
19
+
20
+ export const AIRecipeTranslationSchema = z.object({
21
+ description: z.string().min(10).max(2000),
22
+ equipment: z.array(EquipmentContentSchema).optional(),
23
+ ingredientSections: z.array(IngredientSectionContentSchema).min(1),
24
+ instructions: z.array(InstructionContentSchema).min(1),
25
+ tips: z.array(z.string().max(500)).optional(),
26
+ title: z.string().min(3).max(200),
27
+ }) satisfies z.ZodType<AIRecipeTranslation>;
@@ -1,17 +1,17 @@
1
- import { z } from "genkit";
2
- import type { Timestamp } from "firebase-admin/firestore";
3
- import { SLUG_REGEX } from "../../config";
4
-
5
- export interface Asset {
6
- createdAt: Timestamp;
7
- id: string;
8
- imageUrl?: string;
9
- updatedAt: Timestamp;
10
- }
11
-
12
- export const AssetSchema = z.object({
13
- createdAt: z.custom<Timestamp>(),
14
- id: z.string().regex(SLUG_REGEX),
15
- imageUrl: z.string().optional(),
16
- updatedAt: z.custom<Timestamp>(),
17
- });
1
+ import { z } from "genkit";
2
+ import type { Timestamp } from "firebase-admin/firestore";
3
+ import { SLUG_REGEX } from "../../config";
4
+
5
+ export interface Asset {
6
+ createdAt: Timestamp;
7
+ id: string;
8
+ imageUrl?: string;
9
+ updatedAt: Timestamp;
10
+ }
11
+
12
+ export const AssetSchema = z.object({
13
+ createdAt: z.custom<Timestamp>(),
14
+ id: z.string().regex(SLUG_REGEX),
15
+ imageUrl: z.string().optional(),
16
+ updatedAt: z.custom<Timestamp>(),
17
+ });
@@ -1,5 +1,5 @@
1
- import { z } from "genkit";
2
-
3
- export const IMAGE_TYPE_VALUES = ["recipe", "ingredients"] as const;
4
- export const ImageTypeSchema = z.enum(IMAGE_TYPE_VALUES);
5
- export type ImageType = z.infer<typeof ImageTypeSchema>;
1
+ import { z } from "genkit";
2
+
3
+ export const IMAGE_TYPE_VALUES = ["recipe", "ingredients"] as const;
4
+ export const ImageTypeSchema = z.enum(IMAGE_TYPE_VALUES);
5
+ export type ImageType = z.infer<typeof ImageTypeSchema>;
@@ -1,5 +1,5 @@
1
- import { z } from "genkit";
2
-
3
- export const LOCALE_VALUES = ["en", "ar", "es", "fr", "ru"] as const;
4
- export const LocaleSchema = z.enum(LOCALE_VALUES);
5
- export type Locale = (typeof LOCALE_VALUES)[number];
1
+ import { z } from "genkit";
2
+
3
+ export const LOCALE_VALUES = ["en", "ar", "es", "fr", "ru"] as const;
4
+ export const LocaleSchema = z.enum(LOCALE_VALUES);
5
+ export type Locale = (typeof LOCALE_VALUES)[number];
@@ -1,5 +1,5 @@
1
- import { z } from "genkit";
2
-
3
- export const MEASUREMENT_SYSTEM_VALUES = ["metric", "imperial"] as const;
4
- export const MeasurementSystemSchema = z.enum(MEASUREMENT_SYSTEM_VALUES);
5
- export type MeasurementSystem = (typeof MEASUREMENT_SYSTEM_VALUES)[number];
1
+ import { z } from "genkit";
2
+
3
+ export const MEASUREMENT_SYSTEM_VALUES = ["metric", "imperial"] as const;
4
+ export const MeasurementSystemSchema = z.enum(MEASUREMENT_SYSTEM_VALUES);
5
+ export type MeasurementSystem = (typeof MEASUREMENT_SYSTEM_VALUES)[number];
@@ -1,5 +1,5 @@
1
- import { z } from "genkit";
2
-
3
- export const THEME_VALUES = ["light", "dark", "system"] as const;
4
- export const ThemeSchema = z.enum(THEME_VALUES);
5
- export type Theme = (typeof THEME_VALUES)[number];
1
+ import { z } from "genkit";
2
+
3
+ export const THEME_VALUES = ["light", "dark", "system"] as const;
4
+ export const ThemeSchema = z.enum(THEME_VALUES);
5
+ export type Theme = (typeof THEME_VALUES)[number];
@@ -1,13 +1,13 @@
1
- import { z } from "genkit";
2
-
3
- export const URL_TYPE_VALUES = [
4
- "facebook",
5
- "instagram",
6
- "pdf",
7
- "pinterest",
8
- "tiktok",
9
- "website",
10
- "youtube",
11
- ] as const;
12
- export const UrlTypeSchema = z.enum(URL_TYPE_VALUES);
13
- export type UrlType = z.infer<typeof UrlTypeSchema>;
1
+ import { z } from "genkit";
2
+
3
+ export const URL_TYPE_VALUES = [
4
+ "facebook",
5
+ "instagram",
6
+ "pdf",
7
+ "pinterest",
8
+ "tiktok",
9
+ "website",
10
+ "youtube",
11
+ ] as const;
12
+ export const UrlTypeSchema = z.enum(URL_TYPE_VALUES);
13
+ export type UrlType = z.infer<typeof UrlTypeSchema>;
@@ -1,61 +1,68 @@
1
- import { z } from "genkit";
2
- import type { Timestamp } from "firebase-admin/firestore";
3
- import { LocaleSchema, MeasurementSystemSchema, ThemeSchema, type Locale, type MeasurementSystem, type Theme } from "./enums";
4
- import {
5
- AllergenSchema,
6
- CuisineSchema,
7
- DietaryTagSchema,
8
- SpicinessSchema,
9
- TemperatureUnitSchema,
10
- type Allergen,
11
- type Cuisine,
12
- type DietaryTag,
13
- type Spiciness,
14
- type TemperatureUnit,
15
- } from "../recipe";
16
-
17
- export interface NotificationSettings {
18
- email: boolean;
19
- push: boolean;
20
- marketing: boolean;
21
- weeklyDigest: boolean;
22
- }
23
-
24
- export const NotificationSettingsSchema = z.object({
25
- email: z.boolean(),
26
- push: z.boolean(),
27
- marketing: z.boolean(),
28
- weeklyDigest: z.boolean(),
29
- }) satisfies z.ZodType<NotificationSettings>;
30
-
31
- export interface Settings {
32
- id: string;
33
- allergens: Allergen[];
34
- dietaryTags: DietaryTag[];
35
- cuisines: Cuisine[];
36
- spiciness?: Spiciness;
37
- excludedIngredients: string[];
38
- locale: Locale;
39
- temperatureUnit: TemperatureUnit;
40
- measurementSystem: MeasurementSystem;
41
- theme: Theme;
42
- notifications: NotificationSettings;
43
- createdAt: Timestamp;
44
- updatedAt: Timestamp;
45
- }
46
-
47
- export const SettingsSchema = z.object({
48
- id: z.string(),
49
- allergens: z.array(AllergenSchema),
50
- dietaryTags: z.array(DietaryTagSchema),
51
- cuisines: z.array(CuisineSchema),
52
- spiciness: SpicinessSchema.optional(),
53
- excludedIngredients: z.array(z.string()),
54
- locale: LocaleSchema,
55
- temperatureUnit: TemperatureUnitSchema,
56
- measurementSystem: MeasurementSystemSchema,
57
- theme: ThemeSchema,
58
- notifications: NotificationSettingsSchema,
59
- createdAt: z.custom<Timestamp>(),
60
- updatedAt: z.custom<Timestamp>(),
61
- });
1
+ import { z } from "genkit";
2
+ import type { Timestamp } from "firebase-admin/firestore";
3
+ import {
4
+ LocaleSchema,
5
+ MeasurementSystemSchema,
6
+ ThemeSchema,
7
+ type Locale,
8
+ type MeasurementSystem,
9
+ type Theme,
10
+ } from "./enums";
11
+ import {
12
+ AllergenSchema,
13
+ CuisineSchema,
14
+ DietaryTagSchema,
15
+ SpicinessSchema,
16
+ TemperatureUnitSchema,
17
+ type Allergen,
18
+ type Cuisine,
19
+ type DietaryTag,
20
+ type Spiciness,
21
+ type TemperatureUnit,
22
+ } from "../recipe";
23
+
24
+ export interface NotificationSettings {
25
+ email: boolean;
26
+ push: boolean;
27
+ marketing: boolean;
28
+ weeklyDigest: boolean;
29
+ }
30
+
31
+ export const NotificationSettingsSchema = z.object({
32
+ email: z.boolean(),
33
+ push: z.boolean(),
34
+ marketing: z.boolean(),
35
+ weeklyDigest: z.boolean(),
36
+ }) satisfies z.ZodType<NotificationSettings>;
37
+
38
+ export interface Settings {
39
+ id: string;
40
+ allergens: Allergen[];
41
+ dietaryTags: DietaryTag[];
42
+ cuisines: Cuisine[];
43
+ spiciness?: Spiciness;
44
+ excludedIngredients: string[];
45
+ locale: Locale;
46
+ temperatureUnit: TemperatureUnit;
47
+ measurementSystem: MeasurementSystem;
48
+ theme: Theme;
49
+ notifications: NotificationSettings;
50
+ createdAt: Timestamp;
51
+ updatedAt: Timestamp;
52
+ }
53
+
54
+ export const SettingsSchema = z.object({
55
+ id: z.string(),
56
+ allergens: z.array(AllergenSchema),
57
+ dietaryTags: z.array(DietaryTagSchema),
58
+ cuisines: z.array(CuisineSchema),
59
+ spiciness: SpicinessSchema.optional(),
60
+ excludedIngredients: z.array(z.string()),
61
+ locale: LocaleSchema,
62
+ temperatureUnit: TemperatureUnitSchema,
63
+ measurementSystem: MeasurementSystemSchema,
64
+ theme: ThemeSchema,
65
+ notifications: NotificationSettingsSchema,
66
+ createdAt: z.custom<Timestamp>(),
67
+ updatedAt: z.custom<Timestamp>(),
68
+ });
@@ -1,10 +1,10 @@
1
- import { z } from "genkit";
2
-
3
- export const PROFILE_STATUS_VALUES = [
4
- "active",
5
- "deleted",
6
- "pending",
7
- "suspended",
8
- ] as const;
9
- export const ProfileStatusSchema = z.enum(PROFILE_STATUS_VALUES);
10
- export type ProfileStatus = (typeof PROFILE_STATUS_VALUES)[number];
1
+ import { z } from "genkit";
2
+
3
+ export const PROFILE_STATUS_VALUES = [
4
+ "active",
5
+ "deleted",
6
+ "pending",
7
+ "suspended",
8
+ ] as const;
9
+ export const ProfileStatusSchema = z.enum(PROFILE_STATUS_VALUES);
10
+ export type ProfileStatus = (typeof PROFILE_STATUS_VALUES)[number];
@@ -1,5 +1,5 @@
1
- import { z } from "genkit";
2
-
3
- export const SUBSCRIPTION_ROLE_VALUES = ["member", "owner"] as const;
4
- export const SubscriptionRoleSchema = z.enum(SUBSCRIPTION_ROLE_VALUES);
5
- export type SubscriptionRole = (typeof SUBSCRIPTION_ROLE_VALUES)[number];
1
+ import { z } from "genkit";
2
+
3
+ export const SUBSCRIPTION_ROLE_VALUES = ["member", "owner"] as const;
4
+ export const SubscriptionRoleSchema = z.enum(SUBSCRIPTION_ROLE_VALUES);
5
+ export type SubscriptionRole = (typeof SUBSCRIPTION_ROLE_VALUES)[number];
@@ -1,10 +1,10 @@
1
- import { z } from "genkit";
2
-
3
- export const SUBSCRIPTION_STATUS_VALUES = [
4
- "active",
5
- "deleted",
6
- "pending",
7
- "rejected",
8
- ] as const;
9
- export const SubscriptionStatusSchema = z.enum(SUBSCRIPTION_STATUS_VALUES);
10
- export type SubscriptionStatus = (typeof SUBSCRIPTION_STATUS_VALUES)[number];
1
+ import { z } from "genkit";
2
+
3
+ export const SUBSCRIPTION_STATUS_VALUES = [
4
+ "active",
5
+ "deleted",
6
+ "pending",
7
+ "rejected",
8
+ ] as const;
9
+ export const SubscriptionStatusSchema = z.enum(SUBSCRIPTION_STATUS_VALUES);
10
+ export type SubscriptionStatus = (typeof SUBSCRIPTION_STATUS_VALUES)[number];
@@ -1,4 +1,4 @@
1
- import { z } from "genkit";
2
-
3
- export const SubscriptionTierSchema = z.enum(["family", "free", "pro"]);
4
- export type SubscriptionTier = z.infer<typeof SubscriptionTierSchema>;
1
+ import { z } from "genkit";
2
+
3
+ export const SubscriptionTierSchema = z.enum(["family", "free", "pro"]);
4
+ export type SubscriptionTier = z.infer<typeof SubscriptionTierSchema>;
@@ -1,11 +1,11 @@
1
- import { z } from "genkit";
2
-
3
- export const USER_ROLE_VALUES = [
4
- "admin",
5
- "moderator",
6
- "translator",
7
- "user",
8
- "guest",
9
- ] as const;
10
- export const UserRoleSchema = z.enum(USER_ROLE_VALUES);
11
- export type UserRole = (typeof USER_ROLE_VALUES)[number];
1
+ import { z } from "genkit";
2
+
3
+ export const USER_ROLE_VALUES = [
4
+ "admin",
5
+ "moderator",
6
+ "translator",
7
+ "user",
8
+ "guest",
9
+ ] as const;
10
+ export const UserRoleSchema = z.enum(USER_ROLE_VALUES);
11
+ export type UserRole = (typeof USER_ROLE_VALUES)[number];
@@ -1,10 +1,10 @@
1
- import { z } from "genkit";
2
-
3
- export const USER_STATUS_VALUES = [
4
- "active",
5
- "deleted",
6
- "pending",
7
- "suspended",
8
- ] as const;
9
- export const UserStatusSchema = z.enum(USER_STATUS_VALUES);
10
- export type UserStatus = (typeof USER_STATUS_VALUES)[number];
1
+ import { z } from "genkit";
2
+
3
+ export const USER_STATUS_VALUES = [
4
+ "active",
5
+ "deleted",
6
+ "pending",
7
+ "suspended",
8
+ ] as const;
9
+ export const UserStatusSchema = z.enum(USER_STATUS_VALUES);
10
+ export type UserStatus = (typeof USER_STATUS_VALUES)[number];
@@ -1,45 +1,45 @@
1
- import { z } from "genkit";
2
- import type { Timestamp } from "firebase-admin/firestore";
3
- import { ProfileStatusSchema, type ProfileStatus } from "./enums";
4
-
5
- export interface Profile {
6
- bio?: string;
7
- createdAt: Timestamp;
8
- id: string;
9
- imageUrl?: string;
10
- name: string;
11
- public: boolean;
12
- status: ProfileStatus;
13
- updatedAt: Timestamp;
14
- verified: boolean;
15
- }
16
-
17
- export const ProfileSchema = z.object({
18
- bio: z.string().max(280).optional(),
19
- createdAt: z.custom<Timestamp>(),
20
- id: z.string(),
21
- imageUrl: z.string().url().optional(),
22
- name: z.string().min(1).max(50),
23
- public: z.boolean(),
24
- status: ProfileStatusSchema,
25
- updatedAt: z.custom<Timestamp>(),
26
- verified: z.boolean(),
27
- });
28
-
29
- export interface ProfileStats {
30
- followers: number;
31
- following: number;
32
- likes: number;
33
- recipes: number;
34
- saves: number;
35
- updatedAt: number;
36
- }
37
-
38
- export const ProfileStatsSchema = z.object({
39
- followers: z.number().int().nonnegative(),
40
- following: z.number().int().nonnegative(),
41
- likes: z.number().int().nonnegative(),
42
- recipes: z.number().int().nonnegative(),
43
- saves: z.number().int().nonnegative(),
44
- updatedAt: z.number().int(),
45
- }) satisfies z.ZodType<ProfileStats>;
1
+ import { z } from "genkit";
2
+ import type { Timestamp } from "firebase-admin/firestore";
3
+ import { ProfileStatusSchema, type ProfileStatus } from "./enums";
4
+
5
+ export interface Profile {
6
+ bio?: string;
7
+ createdAt: Timestamp;
8
+ id: string;
9
+ imageUrl?: string;
10
+ name: string;
11
+ public: boolean;
12
+ status: ProfileStatus;
13
+ updatedAt: Timestamp;
14
+ verified: boolean;
15
+ }
16
+
17
+ export const ProfileSchema = z.object({
18
+ bio: z.string().max(280).optional(),
19
+ createdAt: z.custom<Timestamp>(),
20
+ id: z.string(),
21
+ imageUrl: z.string().url().optional(),
22
+ name: z.string().min(1).max(50),
23
+ public: z.boolean(),
24
+ status: ProfileStatusSchema,
25
+ updatedAt: z.custom<Timestamp>(),
26
+ verified: z.boolean(),
27
+ });
28
+
29
+ export interface ProfileStats {
30
+ followers: number;
31
+ following: number;
32
+ likes: number;
33
+ recipes: number;
34
+ saves: number;
35
+ updatedAt: number;
36
+ }
37
+
38
+ export const ProfileStatsSchema = z.object({
39
+ followers: z.number().int().nonnegative(),
40
+ following: z.number().int().nonnegative(),
41
+ likes: z.number().int().nonnegative(),
42
+ recipes: z.number().int().nonnegative(),
43
+ saves: z.number().int().nonnegative(),
44
+ updatedAt: z.number().int(),
45
+ }) satisfies z.ZodType<ProfileStats>;
@@ -1,45 +1,45 @@
1
- import { z } from "genkit";
2
- import type { Timestamp } from "firebase-admin/firestore";
3
- import {
4
- SubscriptionRoleSchema,
5
- SubscriptionStatusSchema,
6
- SubscriptionTierSchema,
7
- type SubscriptionRole,
8
- type SubscriptionStatus,
9
- type SubscriptionTier,
10
- } from "./enums";
11
- import { MAX_MEMBERS_FAMILY_PLAN } from "../../config";
12
-
13
- export interface Member {
14
- userId: string;
15
- role: SubscriptionRole;
16
- status: SubscriptionStatus;
17
- invitedAt: Timestamp;
18
- joinedAt?: Timestamp;
19
- }
20
-
21
- export const MemberSchema = z.object({
22
- userId: z.string(),
23
- role: SubscriptionRoleSchema,
24
- status: SubscriptionStatusSchema,
25
- invitedAt: z.custom<Timestamp>(),
26
- joinedAt: z.custom<Timestamp>().optional(),
27
- });
28
-
29
- export interface Subscription {
30
- expiresAt: Timestamp;
31
- id: string;
32
- members?: Member[];
33
- providerId: string;
34
- tier: SubscriptionTier;
35
- updatedAt: Timestamp;
36
- }
37
-
38
- export const SubscriptionSchema = z.object({
39
- expiresAt: z.custom<Timestamp>(),
40
- id: z.string(),
41
- members: z.array(MemberSchema).max(MAX_MEMBERS_FAMILY_PLAN).optional(),
42
- providerId: z.string(),
43
- tier: SubscriptionTierSchema,
44
- updatedAt: z.custom<Timestamp>(),
45
- });
1
+ import { z } from "genkit";
2
+ import type { Timestamp } from "firebase-admin/firestore";
3
+ import {
4
+ SubscriptionRoleSchema,
5
+ SubscriptionStatusSchema,
6
+ SubscriptionTierSchema,
7
+ type SubscriptionRole,
8
+ type SubscriptionStatus,
9
+ type SubscriptionTier,
10
+ } from "./enums";
11
+ import { MAX_MEMBERS_FAMILY_PLAN } from "../../config";
12
+
13
+ export interface Member {
14
+ userId: string;
15
+ role: SubscriptionRole;
16
+ status: SubscriptionStatus;
17
+ invitedAt: Timestamp;
18
+ joinedAt?: Timestamp;
19
+ }
20
+
21
+ export const MemberSchema = z.object({
22
+ userId: z.string(),
23
+ role: SubscriptionRoleSchema,
24
+ status: SubscriptionStatusSchema,
25
+ invitedAt: z.custom<Timestamp>(),
26
+ joinedAt: z.custom<Timestamp>().optional(),
27
+ });
28
+
29
+ export interface Subscription {
30
+ expiresAt: Timestamp;
31
+ id: string;
32
+ members?: Member[];
33
+ providerId: string;
34
+ tier: SubscriptionTier;
35
+ updatedAt: Timestamp;
36
+ }
37
+
38
+ export const SubscriptionSchema = z.object({
39
+ expiresAt: z.custom<Timestamp>(),
40
+ id: z.string(),
41
+ members: z.array(MemberSchema).max(MAX_MEMBERS_FAMILY_PLAN).optional(),
42
+ providerId: z.string(),
43
+ tier: SubscriptionTierSchema,
44
+ updatedAt: z.custom<Timestamp>(),
45
+ });
@@ -1,31 +1,36 @@
1
- import { z } from "genkit";
2
- import type { Timestamp } from "firebase-admin/firestore";
3
- import { UserRoleSchema, UserStatusSchema, type UserRole, type UserStatus } from "./enums";
4
-
5
- export interface User {
6
- createdAt: Timestamp;
7
- deletedAt?: Timestamp;
8
- email: string;
9
- id: string;
10
- imageUrl?: string;
11
- name: string;
12
- role: UserRole;
13
- status: UserStatus;
14
- subscriptionId?: string;
15
- updatedAt: Timestamp;
16
- verified: boolean;
17
- }
18
-
19
- export const UserSchema = z.object({
20
- createdAt: z.custom<Timestamp>(),
21
- deletedAt: z.custom<Timestamp>().optional(),
22
- email: z.string().email(),
23
- id: z.string(),
24
- imageUrl: z.string().url().optional(),
25
- name: z.string().min(1).max(50),
26
- role: UserRoleSchema,
27
- status: UserStatusSchema,
28
- subscriptionId: z.string().optional(),
29
- updatedAt: z.custom<Timestamp>(),
30
- verified: z.boolean(),
31
- });
1
+ import { z } from "genkit";
2
+ import type { Timestamp } from "firebase-admin/firestore";
3
+ import {
4
+ UserRoleSchema,
5
+ UserStatusSchema,
6
+ type UserRole,
7
+ type UserStatus,
8
+ } from "./enums";
9
+
10
+ export interface User {
11
+ createdAt: Timestamp;
12
+ deletedAt?: Timestamp;
13
+ email: string;
14
+ id: string;
15
+ imageUrl?: string;
16
+ name: string;
17
+ role: UserRole;
18
+ status: UserStatus;
19
+ subscriptionId?: string;
20
+ updatedAt: Timestamp;
21
+ verified: boolean;
22
+ }
23
+
24
+ export const UserSchema = z.object({
25
+ createdAt: z.custom<Timestamp>(),
26
+ deletedAt: z.custom<Timestamp>().optional(),
27
+ email: z.string().email(),
28
+ id: z.string(),
29
+ imageUrl: z.string().url().optional(),
30
+ name: z.string().min(1).max(50),
31
+ role: UserRoleSchema,
32
+ status: UserStatusSchema,
33
+ subscriptionId: z.string().optional(),
34
+ updatedAt: z.custom<Timestamp>(),
35
+ verified: z.boolean(),
36
+ });