@cravery/core 0.0.1 → 0.0.2
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/config/collections.d.ts +8 -0
- package/dist/config/collections.d.ts.map +1 -0
- package/dist/config/collections.js +11 -0
- package/dist/config/collections.js.map +1 -0
- package/dist/config/common.d.ts +2 -0
- package/dist/config/common.d.ts.map +1 -0
- package/dist/config/common.js +5 -0
- package/dist/config/common.js.map +1 -0
- package/dist/config/credits.d.ts +2 -0
- package/dist/config/credits.d.ts.map +1 -0
- package/dist/config/credits.js +5 -0
- package/dist/config/credits.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +19 -0
- package/dist/config/index.js.map +1 -0
- package/dist/enums/allergen.d.ts +19 -0
- package/dist/enums/allergen.d.ts.map +1 -0
- package/dist/enums/allergen.js +21 -0
- package/dist/enums/allergen.js.map +1 -0
- package/dist/enums/cuisine.d.ts +39 -0
- package/dist/enums/cuisine.d.ts.map +1 -0
- package/dist/enums/cuisine.js +41 -0
- package/dist/enums/cuisine.js.map +1 -0
- package/dist/enums/dietary_tag.d.ts +21 -0
- package/dist/enums/dietary_tag.d.ts.map +1 -0
- package/dist/enums/dietary_tag.js +23 -0
- package/dist/enums/dietary_tag.js.map +1 -0
- package/dist/enums/difficulty.d.ts +10 -0
- package/dist/enums/difficulty.d.ts.map +1 -0
- package/dist/enums/difficulty.js +12 -0
- package/dist/enums/difficulty.js.map +1 -0
- package/dist/enums/image_type.d.ts +8 -0
- package/dist/enums/image_type.d.ts.map +1 -0
- package/dist/enums/image_type.js +7 -0
- package/dist/enums/image_type.js.map +1 -0
- package/dist/enums/index.d.ts +22 -0
- package/dist/enums/index.d.ts.map +1 -0
- package/dist/enums/index.js +38 -0
- package/dist/enums/index.js.map +1 -0
- package/dist/enums/locale.d.ts +11 -0
- package/dist/enums/locale.d.ts.map +1 -0
- package/dist/enums/locale.js +7 -0
- package/dist/enums/locale.js.map +1 -0
- package/dist/enums/meal_type.d.ts +14 -0
- package/dist/enums/meal_type.d.ts.map +1 -0
- package/dist/enums/meal_type.js +16 -0
- package/dist/enums/meal_type.js.map +1 -0
- package/dist/enums/moderation_status.d.ts +9 -0
- package/dist/enums/moderation_status.d.ts.map +1 -0
- package/dist/enums/moderation_status.js +11 -0
- package/dist/enums/moderation_status.js.map +1 -0
- package/dist/enums/priority.d.ts +9 -0
- package/dist/enums/priority.d.ts.map +1 -0
- package/dist/enums/priority.js +7 -0
- package/dist/enums/priority.js.map +1 -0
- package/dist/enums/profile_status.d.ts +10 -0
- package/dist/enums/profile_status.d.ts.map +1 -0
- package/dist/enums/profile_status.js +12 -0
- package/dist/enums/profile_status.js.map +1 -0
- package/dist/enums/recipe_source.d.ts +10 -0
- package/dist/enums/recipe_source.d.ts.map +1 -0
- package/dist/enums/recipe_source.js +7 -0
- package/dist/enums/recipe_source.js.map +1 -0
- package/dist/enums/recipe_status.d.ts +10 -0
- package/dist/enums/recipe_status.d.ts.map +1 -0
- package/dist/enums/recipe_status.js +12 -0
- package/dist/enums/recipe_status.js.map +1 -0
- package/dist/enums/role.d.ts +11 -0
- package/dist/enums/role.d.ts.map +1 -0
- package/dist/enums/role.js +13 -0
- package/dist/enums/role.js.map +1 -0
- package/dist/enums/severity.d.ts +9 -0
- package/dist/enums/severity.d.ts.map +1 -0
- package/dist/enums/severity.js +7 -0
- package/dist/enums/severity.js.map +1 -0
- package/dist/enums/spiciness.d.ts +10 -0
- package/dist/enums/spiciness.d.ts.map +1 -0
- package/dist/enums/spiciness.js +7 -0
- package/dist/enums/spiciness.js.map +1 -0
- package/dist/enums/status.d.ts +11 -0
- package/dist/enums/status.d.ts.map +1 -0
- package/dist/enums/status.js +13 -0
- package/dist/enums/status.js.map +1 -0
- package/dist/enums/subscription_tier.d.ts +8 -0
- package/dist/enums/subscription_tier.d.ts.map +1 -0
- package/dist/enums/subscription_tier.js +6 -0
- package/dist/enums/subscription_tier.js.map +1 -0
- package/dist/enums/suggestion_category.d.ts +11 -0
- package/dist/enums/suggestion_category.d.ts.map +1 -0
- package/dist/enums/suggestion_category.js +13 -0
- package/dist/enums/suggestion_category.js.map +1 -0
- package/dist/enums/temperature_unit.d.ts +8 -0
- package/dist/enums/temperature_unit.d.ts.map +1 -0
- package/dist/enums/temperature_unit.js +7 -0
- package/dist/enums/temperature_unit.js.map +1 -0
- package/dist/enums/unit.d.ts +43 -0
- package/dist/enums/unit.d.ts.map +1 -0
- package/dist/enums/unit.js +53 -0
- package/dist/enums/unit.js.map +1 -0
- package/dist/enums/url_type.d.ts +13 -0
- package/dist/enums/url_type.d.ts.map +1 -0
- package/dist/enums/url_type.js +15 -0
- package/dist/enums/url_type.js.map +1 -0
- package/dist/enums/user_status.d.ts +10 -0
- package/dist/enums/user_status.d.ts.map +1 -0
- package/dist/enums/user_status.js +12 -0
- package/dist/enums/user_status.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +3 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/types/ai/config.d.ts +20 -0
- package/dist/types/ai/config.d.ts.map +1 -0
- package/dist/types/ai/config.js +3 -0
- package/dist/types/ai/config.js.map +1 -0
- package/dist/types/ai/filters.d.ts +82 -0
- package/dist/types/ai/filters.d.ts.map +1 -0
- package/dist/types/ai/filters.js +16 -0
- package/dist/types/ai/filters.js.map +1 -0
- package/dist/types/ai/index.d.ts +5 -0
- package/dist/types/ai/index.d.ts.map +1 -0
- package/dist/types/ai/index.js +21 -0
- package/dist/types/ai/index.js.map +1 -0
- package/dist/types/ai/recipe.d.ts +179 -0
- package/dist/types/ai/recipe.d.ts.map +1 -0
- package/dist/types/ai/recipe.js +28 -0
- package/dist/types/ai/recipe.js.map +1 -0
- package/dist/types/ai/translation.d.ts +26 -0
- package/dist/types/ai/translation.d.ts.map +1 -0
- package/dist/types/ai/translation.js +16 -0
- package/dist/types/ai/translation.js.map +1 -0
- package/dist/types/equipment.d.ts +20 -0
- package/dist/types/equipment.d.ts.map +1 -0
- package/dist/types/equipment.js +16 -0
- package/dist/types/equipment.js.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +28 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/ingredient.d.ts +209 -0
- package/dist/types/ingredient.d.ts.map +1 -0
- package/dist/types/ingredient.js +33 -0
- package/dist/types/ingredient.js.map +1 -0
- package/dist/types/instruction.d.ts +32 -0
- package/dist/types/instruction.d.ts.map +1 -0
- package/dist/types/instruction.js +16 -0
- package/dist/types/instruction.js.map +1 -0
- package/dist/types/moderation.d.ts +87 -0
- package/dist/types/moderation.d.ts.map +1 -0
- package/dist/types/moderation.js +38 -0
- package/dist/types/moderation.js.map +1 -0
- package/dist/types/nutrition.d.ts +18 -0
- package/dist/types/nutrition.d.ts.map +1 -0
- package/dist/types/nutrition.js +20 -0
- package/dist/types/nutrition.js.map +1 -0
- package/dist/types/profile.d.ts +30 -0
- package/dist/types/profile.d.ts.map +1 -0
- package/dist/types/profile.js +26 -0
- package/dist/types/profile.js.map +1 -0
- package/dist/types/recipe.d.ts +448 -0
- package/dist/types/recipe.d.ts.map +1 -0
- package/dist/types/recipe.js +82 -0
- package/dist/types/recipe.js.map +1 -0
- package/dist/types/subscription.d.ts +16 -0
- package/dist/types/subscription.d.ts.map +1 -0
- package/dist/types/subscription.js +14 -0
- package/dist/types/subscription.js.map +1 -0
- package/dist/types/temperature.d.ts +10 -0
- package/dist/types/temperature.d.ts.map +1 -0
- package/dist/types/temperature.js +10 -0
- package/dist/types/temperature.js.map +1 -0
- package/dist/types/user.d.ts +26 -0
- package/dist/types/user.d.ts.map +1 -0
- package/dist/types/user.js +17 -0
- package/dist/types/user.js.map +1 -0
- package/package.json +3 -1
- package/src/config/collections.ts +7 -0
- package/src/config/common.ts +1 -0
- package/src/config/index.ts +2 -0
- package/src/enums/allergen.ts +19 -0
- package/src/enums/cuisine.ts +39 -0
- package/src/enums/dietary_tag.ts +21 -0
- package/src/enums/difficulty.ts +10 -0
- package/src/enums/image_type.ts +5 -0
- package/src/enums/index.ts +21 -0
- package/src/enums/locale.ts +5 -0
- package/src/enums/meal_type.ts +14 -0
- package/src/enums/moderation_status.ts +9 -0
- package/src/enums/priority.ts +5 -0
- package/src/enums/profile_status.ts +10 -0
- package/src/enums/recipe_source.ts +5 -0
- package/src/enums/recipe_status.ts +10 -0
- package/src/enums/role.ts +11 -0
- package/src/enums/severity.ts +5 -0
- package/src/enums/spiciness.ts +5 -0
- package/src/enums/status.ts +11 -0
- package/src/enums/subscription_tier.ts +4 -0
- package/src/enums/suggestion_category.ts +11 -0
- package/src/enums/temperature_unit.ts +5 -0
- package/src/enums/unit.ts +51 -0
- package/src/enums/url_type.ts +13 -0
- package/src/enums/user_status.ts +10 -0
- package/src/index.ts +4 -0
- package/src/lib/index.ts +0 -0
- package/src/types/ai/config.ts +26 -0
- package/src/types/ai/filters.ts +20 -0
- package/src/types/ai/index.ts +4 -0
- package/src/types/ai/recipe.ts +33 -0
- package/src/types/ai/translation.ts +14 -0
- package/src/types/equipment.ts +21 -0
- package/src/types/index.ts +11 -0
- package/src/types/ingredient.ts +46 -0
- package/src/types/instruction.ts +21 -0
- package/src/types/moderation.ts +48 -0
- package/src/types/nutrition.ts +18 -0
- package/src/types/profile.ts +27 -0
- package/src/types/recipe.ts +109 -0
- package/src/types/subscription.ts +13 -0
- package/src/types/temperature.ts +8 -0
- package/src/types/user.ts +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cravery/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Clean architecture foundation for Cravery",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"keywords": [],
|
|
17
17
|
"dependencies": {
|
|
18
|
+
"@genkit-ai/vertexai": "^1.27.0",
|
|
19
|
+
"genkit": "^1.27.0",
|
|
18
20
|
"zod": "^4.3.5"
|
|
19
21
|
},
|
|
20
22
|
"devDependencies": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SlugRegex = /^[a-z][a-z0-9-]*[a-z0-9]$/;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const ALLERGEN_VALUES = [
|
|
4
|
+
"celery",
|
|
5
|
+
"dairy",
|
|
6
|
+
"eggs",
|
|
7
|
+
"fish",
|
|
8
|
+
"gluten",
|
|
9
|
+
"lupin",
|
|
10
|
+
"mustard",
|
|
11
|
+
"nuts",
|
|
12
|
+
"peanuts",
|
|
13
|
+
"sesame",
|
|
14
|
+
"shellfish",
|
|
15
|
+
"soy",
|
|
16
|
+
"sulfites",
|
|
17
|
+
] as const;
|
|
18
|
+
export const AllergenSchema = z.enum(ALLERGEN_VALUES);
|
|
19
|
+
export type Allergen = (typeof ALLERGEN_VALUES)[number];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const CUISINE_VALUES = [
|
|
4
|
+
"african",
|
|
5
|
+
"american",
|
|
6
|
+
"brazilian",
|
|
7
|
+
"british",
|
|
8
|
+
"caribbean",
|
|
9
|
+
"chinese",
|
|
10
|
+
"egyptian",
|
|
11
|
+
"emirati",
|
|
12
|
+
"ethiopian",
|
|
13
|
+
"filipino",
|
|
14
|
+
"french",
|
|
15
|
+
"fusion",
|
|
16
|
+
"german",
|
|
17
|
+
"greek",
|
|
18
|
+
"indian",
|
|
19
|
+
"indonesian",
|
|
20
|
+
"italian",
|
|
21
|
+
"japanese",
|
|
22
|
+
"korean",
|
|
23
|
+
"lebanese",
|
|
24
|
+
"malaysian",
|
|
25
|
+
"mexican",
|
|
26
|
+
"moroccan",
|
|
27
|
+
"pakistani",
|
|
28
|
+
"persian",
|
|
29
|
+
"russian",
|
|
30
|
+
"saudi",
|
|
31
|
+
"spanish",
|
|
32
|
+
"sudanese",
|
|
33
|
+
"thai",
|
|
34
|
+
"turkish",
|
|
35
|
+
"vietnamese",
|
|
36
|
+
"other",
|
|
37
|
+
] as const;
|
|
38
|
+
export const CuisineSchema = z.enum(CUISINE_VALUES);
|
|
39
|
+
export type Cuisine = (typeof CUISINE_VALUES)[number];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const DIETARY_TAG_VALUES = [
|
|
4
|
+
"dairy_free",
|
|
5
|
+
"egg_free",
|
|
6
|
+
"gluten_free",
|
|
7
|
+
"halal",
|
|
8
|
+
"high_protein",
|
|
9
|
+
"keto",
|
|
10
|
+
"low_carb",
|
|
11
|
+
"low_fat",
|
|
12
|
+
"low_sodium",
|
|
13
|
+
"low_sugar",
|
|
14
|
+
"nut_free",
|
|
15
|
+
"pescatarian",
|
|
16
|
+
"soy_free",
|
|
17
|
+
"vegan",
|
|
18
|
+
"vegetarian",
|
|
19
|
+
] as const;
|
|
20
|
+
export const DietaryTagSchema = z.enum(DIETARY_TAG_VALUES);
|
|
21
|
+
export type DietaryTag = (typeof DIETARY_TAG_VALUES)[number];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from "./allergen";
|
|
2
|
+
export * from "./cuisine";
|
|
3
|
+
export * from "./dietary_tag";
|
|
4
|
+
export * from "./difficulty";
|
|
5
|
+
export * from "./image_type";
|
|
6
|
+
export * from "./locale";
|
|
7
|
+
export * from "./meal_type";
|
|
8
|
+
export * from "./moderation_status";
|
|
9
|
+
export * from "./priority";
|
|
10
|
+
export * from "./profile_status";
|
|
11
|
+
export * from "./recipe_source";
|
|
12
|
+
export * from "./recipe_status";
|
|
13
|
+
export * from "./role";
|
|
14
|
+
export * from "./severity";
|
|
15
|
+
export * from "./spiciness";
|
|
16
|
+
export * from "./subscription_tier";
|
|
17
|
+
export * from "./suggestion_category";
|
|
18
|
+
export * from "./temperature_unit";
|
|
19
|
+
export * from "./unit";
|
|
20
|
+
export * from "./url_type";
|
|
21
|
+
export * from "./user_status";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const MEAL_TYPE_VALUES = [
|
|
4
|
+
"appetizer",
|
|
5
|
+
"breakfast",
|
|
6
|
+
"brunch",
|
|
7
|
+
"dessert",
|
|
8
|
+
"dinner",
|
|
9
|
+
"drink",
|
|
10
|
+
"lunch",
|
|
11
|
+
"snack",
|
|
12
|
+
] as const;
|
|
13
|
+
export const MealTypeSchema = z.enum(MEAL_TYPE_VALUES);
|
|
14
|
+
export type MealType = (typeof MEAL_TYPE_VALUES)[number];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const MODERATION_STATUS_VALUES = [
|
|
4
|
+
"approved",
|
|
5
|
+
"pending",
|
|
6
|
+
"rejected",
|
|
7
|
+
] as const;
|
|
8
|
+
export const ModerationStatusSchema = z.enum(MODERATION_STATUS_VALUES);
|
|
9
|
+
export type ModerationStatus = (typeof MODERATION_STATUS_VALUES)[number];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
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];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const RECIPE_STATUS_VALUES = [
|
|
4
|
+
"active",
|
|
5
|
+
"archived",
|
|
6
|
+
"deleted",
|
|
7
|
+
"pending",
|
|
8
|
+
] as const;
|
|
9
|
+
export const RecipeStatusSchema = z.enum(RECIPE_STATUS_VALUES);
|
|
10
|
+
export type RecipeStatus = (typeof RECIPE_STATUS_VALUES)[number];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const SUGGESTION_CATEGORY_VALUES = [
|
|
4
|
+
"missing_info",
|
|
5
|
+
"unclear_instruction",
|
|
6
|
+
"image_quality",
|
|
7
|
+
"nutrition",
|
|
8
|
+
"safety",
|
|
9
|
+
] as const;
|
|
10
|
+
export const SuggestionCategorySchema = z.enum(SUGGESTION_CATEGORY_VALUES);
|
|
11
|
+
export type SuggestionCategory = z.infer<typeof SuggestionCategorySchema>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const UNIT_VALUES = [
|
|
4
|
+
// Volume (metric)
|
|
5
|
+
"ml",
|
|
6
|
+
"l",
|
|
7
|
+
// Volume (imperial)
|
|
8
|
+
"tsp",
|
|
9
|
+
"tbsp",
|
|
10
|
+
"fl_oz",
|
|
11
|
+
"cup",
|
|
12
|
+
"pint",
|
|
13
|
+
"quart",
|
|
14
|
+
"gallon",
|
|
15
|
+
// Weight (metric)
|
|
16
|
+
"mg",
|
|
17
|
+
"g",
|
|
18
|
+
"kg",
|
|
19
|
+
// Weight (imperial)
|
|
20
|
+
"oz",
|
|
21
|
+
"lb",
|
|
22
|
+
// Count/portion
|
|
23
|
+
"piece",
|
|
24
|
+
"whole",
|
|
25
|
+
"half",
|
|
26
|
+
"quarter",
|
|
27
|
+
"slice",
|
|
28
|
+
"serving",
|
|
29
|
+
// Produce-specific
|
|
30
|
+
"clove",
|
|
31
|
+
"stalk",
|
|
32
|
+
"sprig",
|
|
33
|
+
"leaf",
|
|
34
|
+
"bunch",
|
|
35
|
+
"head",
|
|
36
|
+
"fillet",
|
|
37
|
+
"stick",
|
|
38
|
+
"sheet",
|
|
39
|
+
// Container
|
|
40
|
+
"can",
|
|
41
|
+
"package",
|
|
42
|
+
"bottle",
|
|
43
|
+
"jar",
|
|
44
|
+
// Imprecise
|
|
45
|
+
"handful",
|
|
46
|
+
"pinch",
|
|
47
|
+
"dash",
|
|
48
|
+
"drop",
|
|
49
|
+
] as const;
|
|
50
|
+
export const UnitSchema = z.enum(UNIT_VALUES);
|
|
51
|
+
export type Unit = (typeof UNIT_VALUES)[number];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
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>;
|
package/src/index.ts
CHANGED
package/src/lib/index.ts
ADDED
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI model configuration, costs are in USD:
|
|
3
|
+
* - multimodal: cost per 1,000,000 input/output tokens
|
|
4
|
+
* - image: cost per image
|
|
5
|
+
* - embedding: cost per 1,000 input tokens
|
|
6
|
+
*/
|
|
7
|
+
export type AIModel =
|
|
8
|
+
| "Gemini25Flash"
|
|
9
|
+
| "Gemini25Pro"
|
|
10
|
+
| "Imagen4Fast"
|
|
11
|
+
| "TextEmbedding005";
|
|
12
|
+
export type AIModelType = "multimodal" | "image" | "embedding";
|
|
13
|
+
|
|
14
|
+
export interface AIModelCost {
|
|
15
|
+
input: number;
|
|
16
|
+
output: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface AIModelConfig {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
type: AIModelType;
|
|
23
|
+
cost: AIModelCost;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type AIConfig = Record<AIModel, AIModelConfig>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
CuisineSchema,
|
|
4
|
+
DietaryTagSchema,
|
|
5
|
+
DifficultySchema,
|
|
6
|
+
MealTypeSchema,
|
|
7
|
+
SpicinessSchema,
|
|
8
|
+
} from "../../enums";
|
|
9
|
+
|
|
10
|
+
export const RecipeFiltersSchema = z.object({
|
|
11
|
+
cuisines: z.array(CuisineSchema).optional(),
|
|
12
|
+
dietaryTags: z.array(DietaryTagSchema).optional(),
|
|
13
|
+
difficulty: DifficultySchema.optional(),
|
|
14
|
+
excludeIngredients: z.array(z.string()).optional(),
|
|
15
|
+
includeIngredients: z.array(z.string()).optional(),
|
|
16
|
+
mealTypes: z.array(MealTypeSchema).optional(),
|
|
17
|
+
spiciness: SpicinessSchema.optional(),
|
|
18
|
+
timeLimit: z.number().int().min(5).max(180).optional(),
|
|
19
|
+
});
|
|
20
|
+
export type RecipeFilters = z.infer<typeof RecipeFiltersSchema>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
AllergenSchema,
|
|
4
|
+
CuisineSchema,
|
|
5
|
+
DietaryTagSchema,
|
|
6
|
+
DifficultySchema,
|
|
7
|
+
MealTypeSchema,
|
|
8
|
+
SpicinessSchema,
|
|
9
|
+
} from "../../enums";
|
|
10
|
+
import { EquipmentSchema } from "../equipment";
|
|
11
|
+
import { IngredientSectionSchema } from "../ingredient";
|
|
12
|
+
import { InstructionSchema } from "../instruction";
|
|
13
|
+
import { NutritionSchema } from "../nutrition";
|
|
14
|
+
|
|
15
|
+
export const AIRecipeSchema = z.object({
|
|
16
|
+
allergens: z.array(AllergenSchema),
|
|
17
|
+
confidence: z.number().min(0).max(1),
|
|
18
|
+
cuisine: CuisineSchema,
|
|
19
|
+
description: z.string().min(10).max(2000),
|
|
20
|
+
dietaryTags: z.array(DietaryTagSchema),
|
|
21
|
+
difficulty: DifficultySchema,
|
|
22
|
+
equipment: z.array(EquipmentSchema).max(20).optional(),
|
|
23
|
+
ingredientSections: z.array(IngredientSectionSchema).min(1).max(10),
|
|
24
|
+
instructions: z.array(InstructionSchema).min(1).max(50),
|
|
25
|
+
mealTypes: z.array(MealTypeSchema).min(1),
|
|
26
|
+
nutrition: NutritionSchema.optional(),
|
|
27
|
+
servings: z.number().int().min(1).max(100),
|
|
28
|
+
spiciness: SpicinessSchema,
|
|
29
|
+
time: z.number().int().min(1).max(1440),
|
|
30
|
+
tips: z.array(z.string().max(500)).max(10).optional(),
|
|
31
|
+
title: z.string().min(3).max(200),
|
|
32
|
+
});
|
|
33
|
+
export type AIRecipe = z.infer<typeof AIRecipeSchema>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EquipmentContentSchema } from "../equipment";
|
|
3
|
+
import { IngredientSectionContentSchema } from "../ingredient";
|
|
4
|
+
import { InstructionContentSchema } from "../instruction";
|
|
5
|
+
|
|
6
|
+
export const AIRecipeTranslationSchema = z.object({
|
|
7
|
+
description: z.string().min(10).max(2000),
|
|
8
|
+
equipment: z.array(EquipmentContentSchema).optional(),
|
|
9
|
+
ingredientSections: z.array(IngredientSectionContentSchema).min(1),
|
|
10
|
+
instructions: z.array(InstructionContentSchema).min(1),
|
|
11
|
+
tips: z.array(z.string().max(500)).optional(),
|
|
12
|
+
title: z.string().min(3).max(200),
|
|
13
|
+
});
|
|
14
|
+
export type AIRecipeTranslation = z.infer<typeof AIRecipeTranslationSchema>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { SlugRegex } from "../config";
|
|
3
|
+
|
|
4
|
+
export const EquipmentMetaSchema = z.object({
|
|
5
|
+
optional: z.boolean().optional(),
|
|
6
|
+
slug: z.string().regex(SlugRegex),
|
|
7
|
+
});
|
|
8
|
+
export type EquipmentMeta = z.infer<typeof EquipmentMetaSchema>;
|
|
9
|
+
|
|
10
|
+
export const EquipmentContentSchema = z.object({
|
|
11
|
+
name: z.string().min(1).max(100),
|
|
12
|
+
notes: z.string().max(200).optional(),
|
|
13
|
+
slug: z.string().regex(SlugRegex),
|
|
14
|
+
});
|
|
15
|
+
export type EquipmentContent = z.infer<typeof EquipmentContentSchema>;
|
|
16
|
+
|
|
17
|
+
export const EquipmentSchema = z.object({
|
|
18
|
+
...EquipmentMetaSchema.shape,
|
|
19
|
+
...EquipmentContentSchema.shape,
|
|
20
|
+
});
|
|
21
|
+
export type Equipment = z.infer<typeof EquipmentSchema>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./ai";
|
|
2
|
+
export * from "./equipment";
|
|
3
|
+
export * from "./ingredient";
|
|
4
|
+
export * from "./instruction";
|
|
5
|
+
export * from "./moderation";
|
|
6
|
+
export * from "./nutrition";
|
|
7
|
+
export * from "./profile";
|
|
8
|
+
export * from "./recipe";
|
|
9
|
+
export * from "./subscription";
|
|
10
|
+
export * from "./temperature";
|
|
11
|
+
export * from "./user";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { SlugRegex } from "../config";
|
|
3
|
+
import { UnitSchema } from "../enums";
|
|
4
|
+
|
|
5
|
+
export const IngredientMetaSchema = z.object({
|
|
6
|
+
optional: z.boolean().optional(),
|
|
7
|
+
quantity: z.number().positive().optional(),
|
|
8
|
+
slug: z.string().regex(SlugRegex),
|
|
9
|
+
unit: UnitSchema.optional(),
|
|
10
|
+
});
|
|
11
|
+
export type IngredientMeta = z.infer<typeof IngredientMetaSchema>;
|
|
12
|
+
|
|
13
|
+
export const IngredientContentSchema = z.object({
|
|
14
|
+
name: z.string().min(1).max(100),
|
|
15
|
+
notes: z.string().max(200).optional(),
|
|
16
|
+
slug: z.string().regex(SlugRegex),
|
|
17
|
+
});
|
|
18
|
+
export type IngredientContent = z.infer<typeof IngredientContentSchema>;
|
|
19
|
+
|
|
20
|
+
export const IngredientSchema = z.object({
|
|
21
|
+
...IngredientMetaSchema.shape,
|
|
22
|
+
...IngredientContentSchema.shape,
|
|
23
|
+
});
|
|
24
|
+
export type Ingredient = z.infer<typeof IngredientSchema>;
|
|
25
|
+
|
|
26
|
+
export const IngredientSectionMetaSchema = z.object({
|
|
27
|
+
ingredients: z.array(IngredientMetaSchema).min(1),
|
|
28
|
+
slug: z.string().regex(SlugRegex),
|
|
29
|
+
});
|
|
30
|
+
export type IngredientSectionMeta = z.infer<typeof IngredientSectionMetaSchema>;
|
|
31
|
+
|
|
32
|
+
export const IngredientSectionContentSchema = z.object({
|
|
33
|
+
ingredients: z.array(IngredientContentSchema).min(1),
|
|
34
|
+
slug: z.string().regex(SlugRegex),
|
|
35
|
+
title: z.string().max(100).optional(),
|
|
36
|
+
});
|
|
37
|
+
export type IngredientSectionContent = z.infer<
|
|
38
|
+
typeof IngredientSectionContentSchema
|
|
39
|
+
>;
|
|
40
|
+
|
|
41
|
+
export const IngredientSectionSchema = z.object({
|
|
42
|
+
ingredients: z.array(IngredientSchema).min(1),
|
|
43
|
+
slug: z.string().regex(SlugRegex),
|
|
44
|
+
title: z.string().max(100).optional(),
|
|
45
|
+
});
|
|
46
|
+
export type IngredientSection = z.infer<typeof IngredientSectionSchema>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TemperatureSchema } from "./temperature";
|
|
3
|
+
|
|
4
|
+
export const InstructionMetaSchema = z.object({
|
|
5
|
+
duration: z.number().int().positive().optional(),
|
|
6
|
+
step: z.number().int().positive(),
|
|
7
|
+
temperature: TemperatureSchema.optional(),
|
|
8
|
+
});
|
|
9
|
+
export type InstructionMeta = z.infer<typeof InstructionMetaSchema>;
|
|
10
|
+
|
|
11
|
+
export const InstructionContentSchema = z.object({
|
|
12
|
+
step: z.number().int().positive(),
|
|
13
|
+
text: z.string().min(1).max(1000),
|
|
14
|
+
});
|
|
15
|
+
export type InstructionContent = z.infer<typeof InstructionContentSchema>;
|
|
16
|
+
|
|
17
|
+
export const InstructionSchema = z.object({
|
|
18
|
+
...InstructionMetaSchema.shape,
|
|
19
|
+
...InstructionContentSchema.shape,
|
|
20
|
+
});
|
|
21
|
+
export type Instruction = z.infer<typeof InstructionSchema>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Timestamp } from "firebase-admin/firestore";
|
|
3
|
+
import {
|
|
4
|
+
ModerationStatusSchema,
|
|
5
|
+
PrioritySchema,
|
|
6
|
+
SeveritySchema,
|
|
7
|
+
SuggestionCategorySchema,
|
|
8
|
+
} from "../enums";
|
|
9
|
+
|
|
10
|
+
export const ModerationSuggestionSchema = z.object({
|
|
11
|
+
category: SuggestionCategorySchema,
|
|
12
|
+
field: z.string(),
|
|
13
|
+
severity: SeveritySchema,
|
|
14
|
+
suggestion: z.string(),
|
|
15
|
+
});
|
|
16
|
+
export type ModerationSuggestion = z.infer<typeof ModerationSuggestionSchema>;
|
|
17
|
+
|
|
18
|
+
export const ModerationSchema = z.object({
|
|
19
|
+
id: z.string(),
|
|
20
|
+
recipeId: z.string(),
|
|
21
|
+
userId: z.string(),
|
|
22
|
+
status: ModerationStatusSchema,
|
|
23
|
+
priority: PrioritySchema,
|
|
24
|
+
qualityScore: z.number().min(0).max(1).optional(),
|
|
25
|
+
aiSuggestions: z.array(ModerationSuggestionSchema).optional(),
|
|
26
|
+
rejectionReason: z.string().optional(),
|
|
27
|
+
createdAt: z.custom<Timestamp>(),
|
|
28
|
+
assessedAt: z.custom<Timestamp>().optional(),
|
|
29
|
+
reviewedBy: z.string().optional(),
|
|
30
|
+
reviewedAt: z.custom<Timestamp>().optional(),
|
|
31
|
+
});
|
|
32
|
+
export type Moderation = z.infer<typeof ModerationSchema>;
|
|
33
|
+
|
|
34
|
+
export const ModerateRecipeInputSchema = z.object({
|
|
35
|
+
moderationId: z.string(),
|
|
36
|
+
recipeId: z.string(),
|
|
37
|
+
userId: z.string(),
|
|
38
|
+
});
|
|
39
|
+
export type ModerateRecipeInput = z.infer<typeof ModerateRecipeInputSchema>;
|
|
40
|
+
|
|
41
|
+
export const ModerateRecipeOutputSchema = z.object({
|
|
42
|
+
qualityScore: z.number().min(0).max(1),
|
|
43
|
+
suggestions: z.array(ModerationSuggestionSchema),
|
|
44
|
+
autoApproved: z.boolean(),
|
|
45
|
+
autoRejected: z.boolean(),
|
|
46
|
+
rejectionReason: z.string().optional(),
|
|
47
|
+
});
|
|
48
|
+
export type ModerateRecipeOutput = z.infer<typeof ModerateRecipeOutputSchema>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Nutrition data per serving.
|
|
5
|
+
* Units: calories (kcal), fat/carbs/protein/fiber/sugar (g), cholesterol/sodium (mg)
|
|
6
|
+
*/
|
|
7
|
+
export const NutritionSchema = z.object({
|
|
8
|
+
calories: z.number().nonnegative(),
|
|
9
|
+
carbs: z.number().nonnegative().optional(),
|
|
10
|
+
cholesterol: z.number().nonnegative().optional(),
|
|
11
|
+
fat: z.number().nonnegative().optional(),
|
|
12
|
+
fiber: z.number().nonnegative().optional(),
|
|
13
|
+
protein: z.number().nonnegative().optional(),
|
|
14
|
+
saturatedFat: z.number().nonnegative().optional(),
|
|
15
|
+
sodium: z.number().nonnegative().optional(),
|
|
16
|
+
sugar: z.number().nonnegative().optional(),
|
|
17
|
+
});
|
|
18
|
+
export type Nutrition = z.infer<typeof NutritionSchema>;
|