@cravery/core 0.0.24 → 0.0.26

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 (294) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +0 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/ai/embedding.d.ts +2 -1
  6. package/dist/lib/ai/embedding.d.ts.map +1 -1
  7. package/dist/lib/ai/embedding.js +4 -17
  8. package/dist/lib/ai/embedding.js.map +1 -1
  9. package/dist/lib/ai/genkit.d.ts +1 -0
  10. package/dist/lib/ai/genkit.d.ts.map +1 -1
  11. package/dist/lib/ai/genkit.js +14 -1
  12. package/dist/lib/ai/genkit.js.map +1 -1
  13. package/dist/types/ai/recipe.d.ts +1 -244
  14. package/dist/types/ai/recipe.d.ts.map +1 -1
  15. package/dist/types/ai/recipe.js +0 -28
  16. package/dist/types/ai/recipe.js.map +1 -1
  17. package/dist/types/ai/translation.d.ts +1 -107
  18. package/dist/types/ai/translation.d.ts.map +1 -1
  19. package/dist/types/ai/translation.js +0 -11
  20. package/dist/types/ai/translation.js.map +1 -1
  21. package/dist/types/core/api.d.ts +4 -4
  22. package/dist/types/core/api.d.ts.map +1 -1
  23. package/dist/types/core/asset.d.ts +2 -22
  24. package/dist/types/core/asset.d.ts.map +1 -1
  25. package/dist/types/core/asset.js +0 -9
  26. package/dist/types/core/asset.js.map +1 -1
  27. package/dist/types/core/entity.d.ts +7 -0
  28. package/dist/types/core/entity.d.ts.map +1 -0
  29. package/dist/types/core/entity.js +3 -0
  30. package/dist/types/core/entity.js.map +1 -0
  31. package/dist/types/core/index.d.ts +5 -1
  32. package/dist/types/core/index.d.ts.map +1 -1
  33. package/dist/types/core/index.js +5 -1
  34. package/dist/types/core/index.js.map +1 -1
  35. package/dist/types/core/locale.d.ts +3 -0
  36. package/dist/types/core/locale.d.ts.map +1 -0
  37. package/dist/types/core/locale.js +5 -0
  38. package/dist/types/core/locale.js.map +1 -0
  39. package/dist/types/core/measurement_system.d.ts +3 -0
  40. package/dist/types/core/measurement_system.d.ts.map +1 -0
  41. package/dist/types/core/measurement_system.js +5 -0
  42. package/dist/types/core/measurement_system.js.map +1 -0
  43. package/dist/types/core/settings.d.ts +5 -88
  44. package/dist/types/core/settings.d.ts.map +1 -1
  45. package/dist/types/core/settings.js +0 -25
  46. package/dist/types/core/settings.js.map +1 -1
  47. package/dist/types/core/theme.d.ts +3 -0
  48. package/dist/types/core/theme.d.ts.map +1 -0
  49. package/dist/types/core/theme.js +5 -0
  50. package/dist/types/core/theme.js.map +1 -0
  51. package/dist/types/core/timestamp.d.ts +5 -0
  52. package/dist/types/core/timestamp.d.ts.map +1 -0
  53. package/dist/types/core/timestamp.js +3 -0
  54. package/dist/types/core/timestamp.js.map +1 -0
  55. package/dist/types/iam/index.d.ts +6 -1
  56. package/dist/types/iam/index.d.ts.map +1 -1
  57. package/dist/types/iam/index.js +6 -1
  58. package/dist/types/iam/index.js.map +1 -1
  59. package/dist/types/iam/profile.d.ts +2 -56
  60. package/dist/types/iam/profile.d.ts.map +1 -1
  61. package/dist/types/iam/profile.js +0 -22
  62. package/dist/types/iam/profile.js.map +1 -1
  63. package/dist/types/iam/profile_status.d.ts +3 -0
  64. package/dist/types/iam/profile_status.d.ts.map +1 -0
  65. package/dist/types/iam/profile_status.js +10 -0
  66. package/dist/types/iam/profile_status.js.map +1 -0
  67. package/dist/types/iam/subscription.d.ts +4 -80
  68. package/dist/types/iam/subscription.d.ts.map +1 -1
  69. package/dist/types/iam/subscription.js +0 -19
  70. package/dist/types/iam/subscription.js.map +1 -1
  71. package/dist/types/iam/subscription_role.d.ts +3 -0
  72. package/dist/types/iam/subscription_role.d.ts.map +1 -0
  73. package/dist/types/iam/subscription_role.js +5 -0
  74. package/dist/types/iam/subscription_role.js.map +1 -0
  75. package/dist/types/iam/subscription_status.d.ts +3 -0
  76. package/dist/types/iam/subscription_status.d.ts.map +1 -0
  77. package/dist/types/iam/subscription_status.js +10 -0
  78. package/dist/types/iam/subscription_status.js.map +1 -0
  79. package/dist/types/iam/subscription_tier.d.ts +3 -0
  80. package/dist/types/iam/subscription_tier.d.ts.map +1 -0
  81. package/dist/types/iam/subscription_tier.js +5 -0
  82. package/dist/types/iam/subscription_tier.js.map +1 -0
  83. package/dist/types/iam/user.d.ts +3 -42
  84. package/dist/types/iam/user.d.ts.map +1 -1
  85. package/dist/types/iam/user.js +0 -16
  86. package/dist/types/iam/user.js.map +1 -1
  87. package/dist/types/iam/user_role.d.ts +5 -0
  88. package/dist/types/iam/user_role.d.ts.map +1 -0
  89. package/dist/types/iam/user_role.js +16 -0
  90. package/dist/types/iam/user_role.js.map +1 -0
  91. package/dist/types/iam/user_status.d.ts +3 -0
  92. package/dist/types/iam/user_status.d.ts.map +1 -0
  93. package/dist/types/iam/user_status.js +10 -0
  94. package/dist/types/iam/user_status.js.map +1 -0
  95. package/dist/types/moderation/index.d.ts +4 -1
  96. package/dist/types/moderation/index.d.ts.map +1 -1
  97. package/dist/types/moderation/index.js +4 -1
  98. package/dist/types/moderation/index.js.map +1 -1
  99. package/dist/types/moderation/moderation.d.ts +5 -137
  100. package/dist/types/moderation/moderation.d.ts.map +1 -1
  101. package/dist/types/moderation/moderation.js +0 -37
  102. package/dist/types/moderation/moderation.js.map +1 -1
  103. package/dist/types/moderation/moderation_status.d.ts +3 -0
  104. package/dist/types/moderation/moderation_status.d.ts.map +1 -0
  105. package/dist/types/moderation/moderation_status.js +9 -0
  106. package/dist/types/moderation/moderation_status.js.map +1 -0
  107. package/dist/types/moderation/priority.d.ts +3 -0
  108. package/dist/types/moderation/priority.d.ts.map +1 -0
  109. package/dist/types/moderation/priority.js +5 -0
  110. package/dist/types/moderation/priority.js.map +1 -0
  111. package/dist/types/moderation/severity.d.ts +3 -0
  112. package/dist/types/moderation/severity.d.ts.map +1 -0
  113. package/dist/types/moderation/severity.js +5 -0
  114. package/dist/types/moderation/severity.js.map +1 -0
  115. package/dist/types/moderation/suggestion_category.d.ts +3 -0
  116. package/dist/types/moderation/suggestion_category.d.ts.map +1 -0
  117. package/dist/types/moderation/suggestion_category.js +11 -0
  118. package/dist/types/moderation/suggestion_category.js.map +1 -0
  119. package/dist/types/recipe/allergen.d.ts +3 -0
  120. package/dist/types/recipe/allergen.d.ts.map +1 -0
  121. package/dist/types/recipe/allergen.js +19 -0
  122. package/dist/types/recipe/allergen.js.map +1 -0
  123. package/dist/types/recipe/cuisine.d.ts +3 -0
  124. package/dist/types/recipe/cuisine.d.ts.map +1 -0
  125. package/dist/types/recipe/cuisine.js +39 -0
  126. package/dist/types/recipe/cuisine.js.map +1 -0
  127. package/dist/types/recipe/dietary_tag.d.ts +3 -0
  128. package/dist/types/recipe/dietary_tag.d.ts.map +1 -0
  129. package/dist/types/recipe/dietary_tag.js +21 -0
  130. package/dist/types/recipe/dietary_tag.js.map +1 -0
  131. package/dist/types/recipe/difficulty.d.ts +3 -0
  132. package/dist/types/recipe/difficulty.d.ts.map +1 -0
  133. package/dist/types/recipe/difficulty.js +10 -0
  134. package/dist/types/recipe/difficulty.js.map +1 -0
  135. package/dist/types/recipe/equipment.d.ts +0 -40
  136. package/dist/types/recipe/equipment.d.ts.map +1 -1
  137. package/dist/types/recipe/equipment.js +0 -12
  138. package/dist/types/recipe/equipment.js.map +1 -1
  139. package/dist/types/recipe/filters.d.ts +5 -30
  140. package/dist/types/recipe/filters.d.ts.map +1 -1
  141. package/dist/types/recipe/filters.js +0 -13
  142. package/dist/types/recipe/filters.js.map +1 -1
  143. package/dist/types/recipe/index.d.ts +10 -1
  144. package/dist/types/recipe/index.d.ts.map +1 -1
  145. package/dist/types/recipe/index.js +10 -1
  146. package/dist/types/recipe/index.js.map +1 -1
  147. package/dist/types/recipe/ingredient.d.ts +1 -169
  148. package/dist/types/recipe/ingredient.d.ts.map +1 -1
  149. package/dist/types/recipe/ingredient.js +0 -29
  150. package/dist/types/recipe/ingredient.js.map +1 -1
  151. package/dist/types/recipe/instruction.d.ts +2 -72
  152. package/dist/types/recipe/instruction.d.ts.map +1 -1
  153. package/dist/types/recipe/instruction.js +0 -13
  154. package/dist/types/recipe/instruction.js.map +1 -1
  155. package/dist/types/recipe/meal_type.d.ts +3 -0
  156. package/dist/types/recipe/meal_type.d.ts.map +1 -0
  157. package/dist/types/recipe/meal_type.js +14 -0
  158. package/dist/types/recipe/meal_type.js.map +1 -0
  159. package/dist/types/recipe/nutrition.d.ts +0 -36
  160. package/dist/types/recipe/nutrition.d.ts.map +1 -1
  161. package/dist/types/recipe/nutrition.js +0 -13
  162. package/dist/types/recipe/nutrition.js.map +1 -1
  163. package/dist/types/recipe/recipe.d.ts +14 -525
  164. package/dist/types/recipe/recipe.d.ts.map +1 -1
  165. package/dist/types/recipe/recipe.js +0 -80
  166. package/dist/types/recipe/recipe.js.map +1 -1
  167. package/dist/types/recipe/recipe_source.d.ts +3 -0
  168. package/dist/types/recipe/recipe_source.d.ts.map +1 -0
  169. package/dist/types/recipe/recipe_source.js +5 -0
  170. package/dist/types/recipe/recipe_source.js.map +1 -0
  171. package/dist/types/recipe/recipe_status.d.ts +3 -0
  172. package/dist/types/recipe/recipe_status.d.ts.map +1 -0
  173. package/dist/types/recipe/recipe_status.js +12 -0
  174. package/dist/types/recipe/recipe_status.js.map +1 -0
  175. package/dist/types/recipe/spiciness.d.ts +3 -0
  176. package/dist/types/recipe/spiciness.d.ts.map +1 -0
  177. package/dist/types/recipe/spiciness.js +5 -0
  178. package/dist/types/recipe/spiciness.js.map +1 -0
  179. package/dist/types/recipe/temperature.d.ts +1 -12
  180. package/dist/types/recipe/temperature.d.ts.map +1 -1
  181. package/dist/types/recipe/temperature.js +0 -7
  182. package/dist/types/recipe/temperature.js.map +1 -1
  183. package/dist/types/recipe/temperature_unit.d.ts +3 -0
  184. package/dist/types/recipe/temperature_unit.d.ts.map +1 -0
  185. package/dist/types/recipe/temperature_unit.js +5 -0
  186. package/dist/types/recipe/temperature_unit.js.map +1 -0
  187. package/dist/types/recipe/unit.d.ts +3 -0
  188. package/dist/types/recipe/unit.d.ts.map +1 -0
  189. package/dist/types/recipe/unit.js +51 -0
  190. package/dist/types/recipe/unit.js.map +1 -0
  191. package/dist/types/report/index.d.ts +4 -1
  192. package/dist/types/report/index.d.ts.map +1 -1
  193. package/dist/types/report/index.js +4 -1
  194. package/dist/types/report/index.js.map +1 -1
  195. package/dist/types/report/report.d.ts +5 -94
  196. package/dist/types/report/report.d.ts.map +1 -1
  197. package/dist/types/report/report.js +0 -29
  198. package/dist/types/report/report.js.map +1 -1
  199. package/dist/types/report/report_priority.d.ts +3 -0
  200. package/dist/types/report/report_priority.d.ts.map +1 -0
  201. package/dist/types/report/report_priority.js +10 -0
  202. package/dist/types/report/report_priority.js.map +1 -0
  203. package/dist/types/report/report_status.d.ts +3 -0
  204. package/dist/types/report/report_status.d.ts.map +1 -0
  205. package/dist/types/report/report_status.js +10 -0
  206. package/dist/types/report/report_status.js.map +1 -0
  207. package/dist/types/report/report_target_type.d.ts +3 -0
  208. package/dist/types/report/report_target_type.d.ts.map +1 -0
  209. package/dist/types/report/report_target_type.js +10 -0
  210. package/dist/types/report/report_target_type.js.map +1 -0
  211. package/dist/types/report/report_type.d.ts +3 -0
  212. package/dist/types/report/report_type.d.ts.map +1 -0
  213. package/dist/types/report/report_type.js +12 -0
  214. package/dist/types/report/report_type.js.map +1 -0
  215. package/package.json +3 -14
  216. package/src/index.ts +0 -1
  217. package/src/types/ai/recipe.ts +10 -47
  218. package/src/types/ai/translation.ts +1 -18
  219. package/src/types/core/api.ts +4 -4
  220. package/src/types/core/asset.ts +2 -14
  221. package/src/types/core/entity.ts +7 -0
  222. package/src/types/core/index.ts +5 -1
  223. package/src/types/core/{enums/locale.ts → locale.ts} +0 -3
  224. package/src/types/core/{enums/measurement_system.ts → measurement_system.ts} +0 -3
  225. package/src/types/core/settings.ts +9 -43
  226. package/src/types/core/{enums/theme.ts → theme.ts} +0 -3
  227. package/src/types/core/timestamp.ts +4 -0
  228. package/src/types/iam/index.ts +6 -1
  229. package/src/types/iam/profile.ts +2 -24
  230. package/src/types/iam/{enums/profile_status.ts → profile_status.ts} +0 -3
  231. package/src/types/iam/subscription.ts +4 -28
  232. package/src/types/iam/{enums/subscription_role.ts → subscription_role.ts} +0 -3
  233. package/src/types/iam/{enums/subscription_status.ts → subscription_status.ts} +0 -3
  234. package/src/types/iam/subscription_tier.ts +2 -0
  235. package/src/types/iam/user.ts +3 -22
  236. package/src/types/iam/user_role.ts +15 -0
  237. package/src/types/iam/{enums/user_status.ts → user_status.ts} +0 -3
  238. package/src/types/moderation/index.ts +4 -1
  239. package/src/types/moderation/moderation.ts +5 -50
  240. package/src/types/moderation/{enums/moderation_status.ts → moderation_status.ts} +0 -3
  241. package/src/types/moderation/{enums/priority.ts → priority.ts} +0 -3
  242. package/src/types/moderation/{enums/severity.ts → severity.ts} +0 -3
  243. package/src/types/moderation/suggestion_category.ts +8 -0
  244. package/src/types/recipe/{enums/allergen.ts → allergen.ts} +0 -3
  245. package/src/types/recipe/{enums/cuisine.ts → cuisine.ts} +0 -3
  246. package/src/types/recipe/{enums/dietary_tag.ts → dietary_tag.ts} +0 -3
  247. package/src/types/recipe/{enums/difficulty.ts → difficulty.ts} +0 -3
  248. package/src/types/recipe/equipment.ts +0 -18
  249. package/src/types/recipe/filters.ts +5 -24
  250. package/src/types/recipe/index.ts +10 -1
  251. package/src/types/recipe/ingredient.ts +1 -37
  252. package/src/types/recipe/instruction.ts +2 -19
  253. package/src/types/recipe/{enums/meal_type.ts → meal_type.ts} +0 -3
  254. package/src/types/recipe/nutrition.ts +0 -18
  255. package/src/types/recipe/recipe.ts +18 -118
  256. package/src/types/recipe/{enums/recipe_source.ts → recipe_source.ts} +0 -3
  257. package/src/types/recipe/{enums/recipe_status.ts → recipe_status.ts} +0 -3
  258. package/src/types/recipe/{enums/spiciness.ts → spiciness.ts} +0 -3
  259. package/src/types/recipe/temperature.ts +1 -7
  260. package/src/types/recipe/{enums/temperature_unit.ts → temperature_unit.ts} +0 -3
  261. package/src/types/recipe/{enums/unit.ts → unit.ts} +0 -3
  262. package/src/types/report/index.ts +4 -1
  263. package/src/types/report/report.ts +5 -40
  264. package/src/types/report/{enums/report_priority.ts → report_priority.ts} +0 -3
  265. package/src/types/report/{enums/report_status.ts → report_status.ts} +0 -3
  266. package/src/types/report/{enums/report_target_type.ts → report_target_type.ts} +0 -3
  267. package/src/types/report/{enums/report_type.ts → report_type.ts} +0 -3
  268. package/src/lib/ai/cost.ts +0 -82
  269. package/src/lib/ai/embedding.ts +0 -64
  270. package/src/lib/ai/errors.ts +0 -43
  271. package/src/lib/ai/flow.ts +0 -134
  272. package/src/lib/ai/genkit.ts +0 -24
  273. package/src/lib/ai/image.ts +0 -27
  274. package/src/lib/ai/index.ts +0 -6
  275. package/src/lib/api.ts +0 -103
  276. package/src/lib/firebase.ts +0 -5
  277. package/src/lib/iam.ts +0 -37
  278. package/src/lib/index.ts +0 -7
  279. package/src/lib/storage.ts +0 -60
  280. package/src/lib/usage/index.ts +0 -1
  281. package/src/lib/usage/usage.service.ts +0 -192
  282. package/src/lib/utils/index.ts +0 -2
  283. package/src/lib/utils/sanitize.ts +0 -38
  284. package/src/lib/utils/slug.ts +0 -33
  285. package/src/types/core/enums/image_type.ts +0 -5
  286. package/src/types/core/enums/index.ts +0 -5
  287. package/src/types/core/enums/url_type.ts +0 -13
  288. package/src/types/iam/enums/index.ts +0 -6
  289. package/src/types/iam/enums/subscription_tier.ts +0 -4
  290. package/src/types/iam/enums/user_role.ts +0 -11
  291. package/src/types/moderation/enums/index.ts +0 -4
  292. package/src/types/moderation/enums/suggestion_category.ts +0 -11
  293. package/src/types/recipe/enums/index.ts +0 -10
  294. package/src/types/report/enums/index.ts +0 -4
@@ -1,12 +1,4 @@
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";
1
+ import { EquipmentContent, IngredientSectionContent, InstructionContent } from "../recipe";
10
2
 
11
3
  export interface AIRecipeTranslation {
12
4
  description: string;
@@ -16,12 +8,3 @@ export interface AIRecipeTranslation {
16
8
  tips?: string[];
17
9
  title: string;
18
10
  }
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,16 +1,16 @@
1
- export type ApiSuccessResponse<T> = {
1
+ export interface ApiSuccessResponse<T> {
2
2
  success: true;
3
3
  data: T;
4
- };
4
+ }
5
5
 
6
- export type ApiErrorResponse = {
6
+ export interface ApiErrorResponse {
7
7
  success: false;
8
8
  error: {
9
9
  code: string;
10
10
  message: string;
11
11
  details?: unknown;
12
12
  };
13
- };
13
+ }
14
14
 
15
15
  export type ApiResponse<T> = ApiSuccessResponse<T> | ApiErrorResponse;
16
16
 
@@ -1,17 +1,5 @@
1
- import { z } from "genkit";
2
- import type { Timestamp } from "firebase-admin/firestore";
3
- import { SLUG_REGEX } from "../../config";
1
+ import { Entity } from "./entity";
4
2
 
5
- export interface Asset {
6
- createdAt: Timestamp;
7
- id: string;
3
+ export interface Asset extends Entity {
8
4
  imageUrl?: string;
9
- updatedAt: Timestamp;
10
5
  }
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
- });
@@ -0,0 +1,7 @@
1
+ import { Timestamp } from "./timestamp";
2
+
3
+ export interface Entity {
4
+ id: string;
5
+ createdAt: Timestamp;
6
+ updatedAt: Timestamp;
7
+ }
@@ -1,5 +1,9 @@
1
1
  export * from "./api";
2
2
  export * from "./asset";
3
- export * from "./enums";
3
+ export * from "./entity";
4
4
  export * from "./errors";
5
+ export * from "./locale";
6
+ export * from "./measurement_system";
5
7
  export * from "./settings";
8
+ export * from "./theme";
9
+ export * from "./timestamp";
@@ -1,5 +1,2 @@
1
- import { z } from "genkit";
2
-
3
1
  export const LOCALE_VALUES = ["en", "ar", "es", "fr", "ru"] as const;
4
- export const LocaleSchema = z.enum(LOCALE_VALUES);
5
2
  export type Locale = (typeof LOCALE_VALUES)[number];
@@ -1,5 +1,2 @@
1
- import { z } from "genkit";
2
-
3
1
  export const MEASUREMENT_SYSTEM_VALUES = ["metric", "imperial"] as const;
4
- export const MeasurementSystemSchema = z.enum(MEASUREMENT_SYSTEM_VALUES);
5
2
  export type MeasurementSystem = (typeof MEASUREMENT_SYSTEM_VALUES)[number];
@@ -1,25 +1,14 @@
1
- import { z } from "genkit";
2
- import type { Timestamp } from "firebase-admin/firestore";
3
1
  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,
2
+ Allergen,
3
+ Cuisine,
4
+ DietaryTag,
5
+ Spiciness,
6
+ TemperatureUnit,
22
7
  } from "../recipe";
8
+ import { Locale } from "./locale";
9
+ import { MeasurementSystem } from "./measurement_system";
10
+ import { Theme } from "./theme";
11
+ import { Timestamp } from "./timestamp";
23
12
 
24
13
  export interface NotificationSettings {
25
14
  email: boolean;
@@ -28,13 +17,6 @@ export interface NotificationSettings {
28
17
  weeklyDigest: boolean;
29
18
  }
30
19
 
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
20
  export interface Settings {
39
21
  id: string;
40
22
  allergens: Allergen[];
@@ -50,19 +32,3 @@ export interface Settings {
50
32
  createdAt: Timestamp;
51
33
  updatedAt: Timestamp;
52
34
  }
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,5 +1,2 @@
1
- import { z } from "genkit";
2
-
3
1
  export const THEME_VALUES = ["light", "dark", "system"] as const;
4
- export const ThemeSchema = z.enum(THEME_VALUES);
5
2
  export type Theme = (typeof THEME_VALUES)[number];
@@ -0,0 +1,4 @@
1
+ export interface Timestamp {
2
+ seconds: number;
3
+ nanoseconds: number;
4
+ }
@@ -1,4 +1,9 @@
1
- export * from "./enums";
1
+ export * from "./profile_status";
2
2
  export * from "./profile";
3
+ export * from "./subscription_role";
4
+ export * from "./subscription_status";
5
+ export * from "./subscription_tier";
3
6
  export * from "./subscription";
7
+ export * from "./user_role";
8
+ export * from "./user_status";
4
9
  export * from "./user";
@@ -1,6 +1,5 @@
1
- import { z } from "genkit";
2
- import type { Timestamp } from "firebase-admin/firestore";
3
- import { ProfileStatusSchema, type ProfileStatus } from "./enums";
1
+ import { Timestamp } from "../core";
2
+ import { ProfileStatus } from "./profile_status";
4
3
 
5
4
  export interface Profile {
6
5
  bio?: string;
@@ -14,18 +13,6 @@ export interface Profile {
14
13
  verified: boolean;
15
14
  }
16
15
 
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
16
  export interface ProfileStats {
30
17
  followers: number;
31
18
  following: number;
@@ -34,12 +21,3 @@ export interface ProfileStats {
34
21
  saves: number;
35
22
  updatedAt: number;
36
23
  }
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,10 +1,7 @@
1
- import { z } from "genkit";
2
-
3
1
  export const PROFILE_STATUS_VALUES = [
4
2
  "active",
5
3
  "deleted",
6
4
  "pending",
7
5
  "suspended",
8
6
  ] as const;
9
- export const ProfileStatusSchema = z.enum(PROFILE_STATUS_VALUES);
10
7
  export type ProfileStatus = (typeof PROFILE_STATUS_VALUES)[number];
@@ -1,14 +1,7 @@
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";
1
+ import { Timestamp } from "../core";
2
+ import { SubscriptionRole } from "./subscription_role";
3
+ import { SubscriptionStatus } from "./subscription_status";
4
+ import { SubscriptionTier } from "./subscription_tier";
12
5
 
13
6
  export interface Member {
14
7
  userId: string;
@@ -18,14 +11,6 @@ export interface Member {
18
11
  joinedAt?: Timestamp;
19
12
  }
20
13
 
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
14
  export interface Subscription {
30
15
  expiresAt: Timestamp;
31
16
  id: string;
@@ -34,12 +19,3 @@ export interface Subscription {
34
19
  tier: SubscriptionTier;
35
20
  updatedAt: Timestamp;
36
21
  }
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,5 +1,2 @@
1
- import { z } from "genkit";
2
-
3
1
  export const SUBSCRIPTION_ROLE_VALUES = ["member", "owner"] as const;
4
- export const SubscriptionRoleSchema = z.enum(SUBSCRIPTION_ROLE_VALUES);
5
2
  export type SubscriptionRole = (typeof SUBSCRIPTION_ROLE_VALUES)[number];
@@ -1,10 +1,7 @@
1
- import { z } from "genkit";
2
-
3
1
  export const SUBSCRIPTION_STATUS_VALUES = [
4
2
  "active",
5
3
  "deleted",
6
4
  "pending",
7
5
  "rejected",
8
6
  ] as const;
9
- export const SubscriptionStatusSchema = z.enum(SUBSCRIPTION_STATUS_VALUES);
10
7
  export type SubscriptionStatus = (typeof SUBSCRIPTION_STATUS_VALUES)[number];
@@ -0,0 +1,2 @@
1
+ export const SUBSCRIPTION_TIER_VALUES = ["family", "free", "pro"] as const;
2
+ export type SubscriptionTier = (typeof SUBSCRIPTION_TIER_VALUES)[number];
@@ -1,11 +1,6 @@
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";
1
+ import { Timestamp } from "../core";
2
+ import { UserRole } from "./user_role";
3
+ import { UserStatus } from "./user_status";
9
4
 
10
5
  export interface User {
11
6
  createdAt: Timestamp;
@@ -20,17 +15,3 @@ export interface User {
20
15
  updatedAt: Timestamp;
21
16
  verified: boolean;
22
17
  }
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
- });
@@ -0,0 +1,15 @@
1
+ export const USER_ROLE_VALUES = [
2
+ "admin",
3
+ "moderator",
4
+ "translator",
5
+ "user",
6
+ "guest",
7
+ ] as const;
8
+ export type UserRole = (typeof USER_ROLE_VALUES)[number];
9
+
10
+ export const PRIVILEGED_USER_ROLES: UserRole[] = [
11
+ "admin",
12
+ "moderator",
13
+ "translator",
14
+ ];
15
+ export type PrivilegedUserRole = (typeof PRIVILEGED_USER_ROLES)[number];
@@ -1,10 +1,7 @@
1
- import { z } from "genkit";
2
-
3
1
  export const USER_STATUS_VALUES = [
4
2
  "active",
5
3
  "deleted",
6
4
  "pending",
7
5
  "suspended",
8
6
  ] as const;
9
- export const UserStatusSchema = z.enum(USER_STATUS_VALUES);
10
7
  export type UserStatus = (typeof USER_STATUS_VALUES)[number];
@@ -1,2 +1,5 @@
1
- export * from "./enums";
1
+ export * from "./moderation_status";
2
2
  export * from "./moderation";
3
+ export * from "./priority";
4
+ export * from "./severity";
5
+ export * from "./suggestion_category";
@@ -1,16 +1,8 @@
1
- import { z } from "genkit";
2
- import type { Timestamp } from "firebase-admin/firestore";
3
- import { LocaleSchema, type Locale } from "../core";
4
- import {
5
- ModerationStatusSchema,
6
- PrioritySchema,
7
- SeveritySchema,
8
- SuggestionCategorySchema,
9
- type ModerationStatus,
10
- type Priority,
11
- type Severity,
12
- type SuggestionCategory,
13
- } from "./enums";
1
+ import { Locale, Timestamp } from "../core";
2
+ import { ModerationStatus } from "./moderation_status";
3
+ import { Priority } from "./priority";
4
+ import { Severity } from "./severity";
5
+ import { SuggestionCategory } from "./suggestion_category";
14
6
 
15
7
  export interface ModerationSuggestion {
16
8
  category: SuggestionCategory;
@@ -19,13 +11,6 @@ export interface ModerationSuggestion {
19
11
  suggestion: string;
20
12
  }
21
13
 
22
- export const ModerationSuggestionSchema = z.object({
23
- category: SuggestionCategorySchema,
24
- field: z.string(),
25
- severity: SeveritySchema,
26
- suggestion: z.string(),
27
- }) satisfies z.ZodType<ModerationSuggestion>;
28
-
29
14
  export interface Moderation {
30
15
  assessedAt?: Timestamp;
31
16
  createdAt: Timestamp;
@@ -42,34 +27,12 @@ export interface Moderation {
42
27
  userId: string;
43
28
  }
44
29
 
45
- export const ModerationSchema = z.object({
46
- assessedAt: z.custom<Timestamp>().optional(),
47
- createdAt: z.custom<Timestamp>(),
48
- id: z.string(),
49
- originalLocale: LocaleSchema,
50
- priority: PrioritySchema,
51
- qualityScore: z.number().min(0).max(1).optional(),
52
- recipeId: z.string(),
53
- rejectionReason: z.string().optional(),
54
- reviewedAt: z.custom<Timestamp>().optional(),
55
- reviewedBy: z.string().optional(),
56
- status: ModerationStatusSchema,
57
- suggestions: z.array(ModerationSuggestionSchema).optional(),
58
- userId: z.string(),
59
- });
60
-
61
30
  export interface ModerateRecipeInput {
62
31
  moderationId: string;
63
32
  recipeId: string;
64
33
  userId: string;
65
34
  }
66
35
 
67
- export const ModerateRecipeInputSchema = z.object({
68
- moderationId: z.string(),
69
- recipeId: z.string(),
70
- userId: z.string(),
71
- }) satisfies z.ZodType<ModerateRecipeInput>;
72
-
73
36
  export interface ModerateRecipeOutput {
74
37
  autoApproved: boolean;
75
38
  autoRejected: boolean;
@@ -77,11 +40,3 @@ export interface ModerateRecipeOutput {
77
40
  rejectionReason?: string;
78
41
  suggestions: ModerationSuggestion[];
79
42
  }
80
-
81
- export const ModerateRecipeOutputSchema = z.object({
82
- autoApproved: z.boolean(),
83
- autoRejected: z.boolean(),
84
- qualityScore: z.number().min(0).max(1),
85
- rejectionReason: z.string().optional(),
86
- suggestions: z.array(ModerationSuggestionSchema),
87
- }) satisfies z.ZodType<ModerateRecipeOutput>;
@@ -1,9 +1,6 @@
1
- import { z } from "genkit";
2
-
3
1
  export const MODERATION_STATUS_VALUES = [
4
2
  "approved",
5
3
  "pending",
6
4
  "rejected",
7
5
  ] as const;
8
- export const ModerationStatusSchema = z.enum(MODERATION_STATUS_VALUES);
9
6
  export type ModerationStatus = (typeof MODERATION_STATUS_VALUES)[number];
@@ -1,5 +1,2 @@
1
- import { z } from "genkit";
2
-
3
1
  export const PRIORITY_VALUES = ["low", "medium", "high"] as const;
4
- export const PrioritySchema = z.enum(PRIORITY_VALUES);
5
2
  export type Priority = (typeof PRIORITY_VALUES)[number];
@@ -1,5 +1,2 @@
1
- import { z } from "genkit";
2
-
3
1
  export const SEVERITY_VALUES = ["low", "medium", "high"] as const;
4
- export const SeveritySchema = z.enum(SEVERITY_VALUES);
5
2
  export type Severity = (typeof SEVERITY_VALUES)[number];
@@ -0,0 +1,8 @@
1
+ export const SUGGESTION_CATEGORY_VALUES = [
2
+ "missing_info",
3
+ "unclear_instruction",
4
+ "image_quality",
5
+ "nutrition",
6
+ "safety",
7
+ ] as const;
8
+ export type SuggestionCategory = (typeof SUGGESTION_CATEGORY_VALUES)[number];
@@ -1,5 +1,3 @@
1
- import { z } from "genkit";
2
-
3
1
  export const ALLERGEN_VALUES = [
4
2
  "celery",
5
3
  "dairy",
@@ -15,5 +13,4 @@ export const ALLERGEN_VALUES = [
15
13
  "soy",
16
14
  "sulfites",
17
15
  ] as const;
18
- export const AllergenSchema = z.enum(ALLERGEN_VALUES);
19
16
  export type Allergen = (typeof ALLERGEN_VALUES)[number];
@@ -1,5 +1,3 @@
1
- import { z } from "genkit";
2
-
3
1
  export const CUISINE_VALUES = [
4
2
  "african",
5
3
  "american",
@@ -35,5 +33,4 @@ export const CUISINE_VALUES = [
35
33
  "vietnamese",
36
34
  "other",
37
35
  ] as const;
38
- export const CuisineSchema = z.enum(CUISINE_VALUES);
39
36
  export type Cuisine = (typeof CUISINE_VALUES)[number];
@@ -1,5 +1,3 @@
1
- import { z } from "genkit";
2
-
3
1
  export const DIETARY_TAG_VALUES = [
4
2
  "dairy_free",
5
3
  "egg_free",
@@ -17,5 +15,4 @@ export const DIETARY_TAG_VALUES = [
17
15
  "vegan",
18
16
  "vegetarian",
19
17
  ] as const;
20
- export const DietaryTagSchema = z.enum(DIETARY_TAG_VALUES);
21
18
  export type DietaryTag = (typeof DIETARY_TAG_VALUES)[number];
@@ -1,10 +1,7 @@
1
- import { z } from "genkit";
2
-
3
1
  export const DIFFICULTY_VALUES = [
4
2
  "beginner",
5
3
  "intermediate",
6
4
  "advanced",
7
5
  "expert",
8
6
  ] as const;
9
- export const DifficultySchema = z.enum(DIFFICULTY_VALUES);
10
7
  export type Difficulty = (typeof DIFFICULTY_VALUES)[number];
@@ -1,30 +1,12 @@
1
- import { z } from "genkit";
2
-
3
1
  export interface EquipmentMeta {
4
2
  required?: boolean;
5
3
  slug: string;
6
4
  }
7
5
 
8
- export const EquipmentMetaSchema = z.object({
9
- required: z.boolean().optional(),
10
- slug: z.string(),
11
- }) satisfies z.ZodType<EquipmentMeta>;
12
-
13
6
  export interface EquipmentContent {
14
7
  name: string;
15
8
  notes?: string;
16
9
  slug: string;
17
10
  }
18
11
 
19
- export const EquipmentContentSchema = z.object({
20
- name: z.string(),
21
- notes: z.string().optional(),
22
- slug: z.string(),
23
- }) satisfies z.ZodType<EquipmentContent>;
24
-
25
12
  export interface Equipment extends EquipmentMeta, EquipmentContent {}
26
-
27
- export const EquipmentSchema = z.object({
28
- ...EquipmentMetaSchema.shape,
29
- ...EquipmentContentSchema.shape,
30
- }) satisfies z.ZodType<Equipment>;
@@ -1,16 +1,8 @@
1
- import { z } from "genkit";
2
- import {
3
- CuisineSchema,
4
- DietaryTagSchema,
5
- DifficultySchema,
6
- MealTypeSchema,
7
- SpicinessSchema,
8
- type Cuisine,
9
- type DietaryTag,
10
- type Difficulty,
11
- type MealType,
12
- type Spiciness,
13
- } from "./enums";
1
+ import { Cuisine } from "./cuisine";
2
+ import { DietaryTag } from "./dietary_tag";
3
+ import { Difficulty } from "./difficulty";
4
+ import { MealType } from "./meal_type";
5
+ import { Spiciness } from "./spiciness";
14
6
 
15
7
  export interface RecipeFilters {
16
8
  cuisines?: Cuisine[];
@@ -22,14 +14,3 @@ export interface RecipeFilters {
22
14
  spiciness?: Spiciness;
23
15
  timeLimit?: number;
24
16
  }
25
-
26
- export const RecipeFiltersSchema = z.object({
27
- cuisines: z.array(CuisineSchema).optional(),
28
- dietaryTags: z.array(DietaryTagSchema).optional(),
29
- difficulty: DifficultySchema.optional(),
30
- excludeIngredients: z.array(z.string()).optional(),
31
- includeIngredients: z.array(z.string()).optional(),
32
- mealTypes: z.array(MealTypeSchema).optional(),
33
- spiciness: SpicinessSchema.optional(),
34
- timeLimit: z.number().int().min(5).max(300).optional(),
35
- }) satisfies z.ZodType<RecipeFilters>;
@@ -1,8 +1,17 @@
1
- export * from "./enums";
1
+ export * from "./allergen";
2
+ export * from "./cuisine";
3
+ export * from "./dietary_tag";
4
+ export * from "./difficulty";
2
5
  export * from "./equipment";
3
6
  export * from "./filters";
4
7
  export * from "./ingredient";
5
8
  export * from "./instruction";
9
+ export * from "./meal_type";
6
10
  export * from "./nutrition";
11
+ export * from "./recipe_source";
12
+ export * from "./recipe_status";
7
13
  export * from "./recipe";
14
+ export * from "./spiciness";
15
+ export * from "./temperature_unit";
8
16
  export * from "./temperature";
17
+ export * from "./unit";