@cravery/core 0.0.10 → 0.0.12

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 (402) hide show
  1. package/README.md +80 -0
  2. package/dist/config/ai.d.ts.map +1 -1
  3. package/dist/config/ai.js +5 -0
  4. package/dist/config/ai.js.map +1 -1
  5. package/dist/config/collections.d.ts +1 -1
  6. package/dist/config/collections.js +2 -2
  7. package/dist/config/common.d.ts +1 -1
  8. package/dist/config/common.d.ts.map +1 -1
  9. package/dist/config/common.js +2 -2
  10. package/dist/config/common.js.map +1 -1
  11. package/dist/config/limits.d.ts +3 -3
  12. package/dist/config/limits.d.ts.map +1 -1
  13. package/dist/config/limits.js +20 -14
  14. package/dist/config/limits.js.map +1 -1
  15. package/dist/config/subscription.d.ts +1 -1
  16. package/dist/config/subscription.d.ts.map +1 -1
  17. package/dist/config/subscription.js +2 -2
  18. package/dist/config/subscription.js.map +1 -1
  19. package/dist/index.d.ts +0 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +0 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/lib/ai/cost.d.ts.map +1 -1
  24. package/dist/lib/ai/cost.js +3 -2
  25. package/dist/lib/ai/cost.js.map +1 -1
  26. package/dist/lib/ai/embedding.js +2 -2
  27. package/dist/lib/ai/embedding.js.map +1 -1
  28. package/dist/lib/ai/errors.d.ts +1 -1
  29. package/dist/lib/ai/flow.d.ts +8 -8
  30. package/dist/lib/ai/flow.d.ts.map +1 -1
  31. package/dist/lib/ai/flow.js.map +1 -1
  32. package/dist/lib/iam.d.ts +3 -0
  33. package/dist/lib/iam.d.ts.map +1 -1
  34. package/dist/lib/iam.js +17 -2
  35. package/dist/lib/iam.js.map +1 -1
  36. package/dist/lib/index.d.ts +0 -2
  37. package/dist/lib/index.d.ts.map +1 -1
  38. package/dist/lib/index.js +0 -2
  39. package/dist/lib/index.js.map +1 -1
  40. package/dist/lib/repository/equipment.repository.js +1 -1
  41. package/dist/lib/repository/ingredient.repository.js +1 -1
  42. package/dist/lib/repository/profile.repository.js +1 -1
  43. package/dist/lib/repository/recipe-queue.repository.js +1 -1
  44. package/dist/lib/repository/recipe.repository.js +1 -1
  45. package/dist/lib/repository/report.repository.js +1 -1
  46. package/dist/lib/repository/settings.repository.js +1 -1
  47. package/dist/lib/repository/user.repository.js +1 -1
  48. package/dist/lib/storage.js +5 -5
  49. package/dist/lib/storage.js.map +1 -1
  50. package/dist/lib/usage/usage.service.d.ts +1 -2
  51. package/dist/lib/usage/usage.service.d.ts.map +1 -1
  52. package/dist/lib/usage/usage.service.js +4 -4
  53. package/dist/lib/usage/usage.service.js.map +1 -1
  54. package/dist/types/ai/config.d.ts +2 -1
  55. package/dist/types/ai/config.d.ts.map +1 -1
  56. package/dist/types/ai/index.d.ts +0 -2
  57. package/dist/types/ai/index.d.ts.map +1 -1
  58. package/dist/types/ai/index.js +0 -2
  59. package/dist/types/ai/index.js.map +1 -1
  60. package/dist/types/ai/recipe.d.ts +50 -50
  61. package/dist/types/ai/recipe.d.ts.map +1 -1
  62. package/dist/types/ai/recipe.js +11 -15
  63. package/dist/types/ai/recipe.js.map +1 -1
  64. package/dist/types/ai/translation.d.ts +14 -14
  65. package/dist/types/ai/translation.d.ts.map +1 -1
  66. package/dist/types/ai/translation.js +4 -6
  67. package/dist/types/ai/translation.js.map +1 -1
  68. package/dist/types/api.d.ts +14 -0
  69. package/dist/types/api.d.ts.map +1 -0
  70. package/dist/types/api.js +3 -0
  71. package/dist/types/api.js.map +1 -0
  72. package/dist/types/core/api.d.ts +14 -0
  73. package/dist/types/core/api.d.ts.map +1 -0
  74. package/dist/types/core/api.js +3 -0
  75. package/dist/types/core/api.js.map +1 -0
  76. package/dist/types/core/asset.d.ts +19 -0
  77. package/dist/types/core/asset.d.ts.map +1 -0
  78. package/dist/types/core/asset.js +12 -0
  79. package/dist/types/core/asset.js.map +1 -0
  80. package/dist/types/core/enums/image_type.d.ts +5 -0
  81. package/dist/types/core/enums/image_type.d.ts.map +1 -0
  82. package/dist/types/core/enums/image_type.js +7 -0
  83. package/dist/types/core/enums/image_type.js.map +1 -0
  84. package/dist/types/core/enums/index.d.ts +6 -0
  85. package/dist/types/core/enums/index.d.ts.map +1 -0
  86. package/dist/types/core/enums/index.js +22 -0
  87. package/dist/types/core/enums/index.js.map +1 -0
  88. package/dist/types/core/enums/locale.d.ts +5 -0
  89. package/dist/types/core/enums/locale.d.ts.map +1 -0
  90. package/dist/types/core/enums/locale.js +7 -0
  91. package/dist/types/core/enums/locale.js.map +1 -0
  92. package/dist/types/core/enums/measurement_system.d.ts +5 -0
  93. package/dist/types/core/enums/measurement_system.d.ts.map +1 -0
  94. package/dist/types/core/enums/measurement_system.js +7 -0
  95. package/dist/types/core/enums/measurement_system.js.map +1 -0
  96. package/dist/types/core/enums/theme.d.ts +5 -0
  97. package/dist/types/core/enums/theme.d.ts.map +1 -0
  98. package/dist/types/core/enums/theme.js +7 -0
  99. package/dist/types/core/enums/theme.js.map +1 -0
  100. package/dist/types/core/enums/url_type.d.ts +5 -0
  101. package/dist/types/core/enums/url_type.d.ts.map +1 -0
  102. package/dist/types/core/enums/url_type.js +15 -0
  103. package/dist/types/core/enums/url_type.js.map +1 -0
  104. package/dist/types/core/errors.d.ts +37 -0
  105. package/dist/types/core/errors.d.ts.map +1 -0
  106. package/dist/types/core/errors.js +89 -0
  107. package/dist/types/core/errors.js.map +1 -0
  108. package/dist/types/core/index.d.ts +6 -0
  109. package/dist/types/core/index.d.ts.map +1 -0
  110. package/dist/types/core/index.js +22 -0
  111. package/dist/types/core/index.js.map +1 -0
  112. package/dist/types/core/settings.d.ts +88 -0
  113. package/dist/types/core/settings.d.ts.map +1 -0
  114. package/dist/types/core/settings.js +28 -0
  115. package/dist/types/core/settings.js.map +1 -0
  116. package/dist/types/enums/index.d.ts +2 -0
  117. package/dist/types/enums/index.d.ts.map +1 -1
  118. package/dist/types/enums/index.js +2 -0
  119. package/dist/types/enums/index.js.map +1 -1
  120. package/dist/types/enums/recipe_source.d.ts +2 -2
  121. package/dist/types/enums/recipe_source.d.ts.map +1 -1
  122. package/dist/types/enums/recipe_source.js +1 -1
  123. package/dist/types/enums/recipe_source.js.map +1 -1
  124. package/dist/types/enums/recipe_status.d.ts +2 -2
  125. package/dist/types/enums/recipe_status.d.ts.map +1 -1
  126. package/dist/types/enums/recipe_status.js +0 -1
  127. package/dist/types/enums/recipe_status.js.map +1 -1
  128. package/dist/types/enums/subscription_role.d.ts +5 -0
  129. package/dist/types/enums/subscription_role.d.ts.map +1 -0
  130. package/dist/types/enums/subscription_role.js +13 -0
  131. package/dist/types/enums/subscription_role.js.map +1 -0
  132. package/dist/types/enums/subscription_status.d.ts +5 -0
  133. package/dist/types/enums/subscription_status.d.ts.map +1 -0
  134. package/dist/types/enums/subscription_status.js +14 -0
  135. package/dist/types/enums/subscription_status.js.map +1 -0
  136. package/dist/types/iam/enums/index.d.ts +7 -0
  137. package/dist/types/iam/enums/index.d.ts.map +1 -0
  138. package/dist/types/iam/enums/index.js +23 -0
  139. package/dist/types/iam/enums/index.js.map +1 -0
  140. package/dist/types/iam/enums/profile_status.d.ts +5 -0
  141. package/dist/types/iam/enums/profile_status.d.ts.map +1 -0
  142. package/dist/types/iam/enums/profile_status.js +12 -0
  143. package/dist/types/iam/enums/profile_status.js.map +1 -0
  144. package/dist/types/iam/enums/subscription_role.d.ts +5 -0
  145. package/dist/types/iam/enums/subscription_role.d.ts.map +1 -0
  146. package/dist/types/iam/enums/subscription_role.js +7 -0
  147. package/dist/types/iam/enums/subscription_role.js.map +1 -0
  148. package/dist/types/iam/enums/subscription_status.d.ts +5 -0
  149. package/dist/types/iam/enums/subscription_status.d.ts.map +1 -0
  150. package/dist/types/iam/enums/subscription_status.js +12 -0
  151. package/dist/types/iam/enums/subscription_status.js.map +1 -0
  152. package/dist/types/iam/enums/subscription_tier.d.ts +4 -0
  153. package/dist/types/iam/enums/subscription_tier.d.ts.map +1 -0
  154. package/dist/types/iam/enums/subscription_tier.js +6 -0
  155. package/dist/types/iam/enums/subscription_tier.js.map +1 -0
  156. package/dist/types/iam/enums/user_role.d.ts +5 -0
  157. package/dist/types/iam/enums/user_role.d.ts.map +1 -0
  158. package/dist/types/iam/enums/user_role.js +13 -0
  159. package/dist/types/iam/enums/user_role.js.map +1 -0
  160. package/dist/types/iam/enums/user_status.d.ts +5 -0
  161. package/dist/types/iam/enums/user_status.d.ts.map +1 -0
  162. package/dist/types/iam/enums/user_status.js +12 -0
  163. package/dist/types/iam/enums/user_status.js.map +1 -0
  164. package/dist/types/iam/index.d.ts +1 -0
  165. package/dist/types/iam/index.d.ts.map +1 -1
  166. package/dist/types/iam/index.js +1 -0
  167. package/dist/types/iam/index.js.map +1 -1
  168. package/dist/types/iam/profile.d.ts +9 -26
  169. package/dist/types/iam/profile.d.ts.map +1 -1
  170. package/dist/types/iam/profile.js +1 -2
  171. package/dist/types/iam/profile.js.map +1 -1
  172. package/dist/types/iam/settings.d.ts +96 -0
  173. package/dist/types/iam/settings.d.ts.map +1 -0
  174. package/dist/types/iam/settings.js +31 -0
  175. package/dist/types/iam/settings.js.map +1 -0
  176. package/dist/types/iam/subscription.d.ts +7 -7
  177. package/dist/types/iam/subscription.d.ts.map +1 -1
  178. package/dist/types/iam/subscription.js +5 -5
  179. package/dist/types/iam/subscription.js.map +1 -1
  180. package/dist/types/iam/user.d.ts +1 -15
  181. package/dist/types/iam/user.d.ts.map +1 -1
  182. package/dist/types/iam/user.js +2 -2
  183. package/dist/types/iam/user.js.map +1 -1
  184. package/dist/types/index.d.ts +1 -4
  185. package/dist/types/index.d.ts.map +1 -1
  186. package/dist/types/index.js +1 -4
  187. package/dist/types/index.js.map +1 -1
  188. package/dist/types/moderation/enums/index.d.ts +5 -0
  189. package/dist/types/moderation/enums/index.d.ts.map +1 -0
  190. package/dist/types/moderation/enums/index.js +21 -0
  191. package/dist/types/moderation/enums/index.js.map +1 -0
  192. package/dist/types/moderation/enums/moderation_status.d.ts +5 -0
  193. package/dist/types/moderation/enums/moderation_status.d.ts.map +1 -0
  194. package/dist/types/moderation/enums/moderation_status.js +11 -0
  195. package/dist/types/moderation/enums/moderation_status.js.map +1 -0
  196. package/dist/types/moderation/enums/priority.d.ts +5 -0
  197. package/dist/types/moderation/enums/priority.d.ts.map +1 -0
  198. package/dist/types/moderation/enums/priority.js +7 -0
  199. package/dist/types/moderation/enums/priority.js.map +1 -0
  200. package/dist/types/moderation/enums/severity.d.ts +5 -0
  201. package/dist/types/moderation/enums/severity.d.ts.map +1 -0
  202. package/dist/types/moderation/enums/severity.js +7 -0
  203. package/dist/types/moderation/enums/severity.js.map +1 -0
  204. package/dist/types/moderation/enums/suggestion_category.d.ts +5 -0
  205. package/dist/types/moderation/enums/suggestion_category.d.ts.map +1 -0
  206. package/dist/types/moderation/enums/suggestion_category.js +13 -0
  207. package/dist/types/moderation/enums/suggestion_category.js.map +1 -0
  208. package/dist/types/moderation/index.d.ts +3 -0
  209. package/dist/types/moderation/index.d.ts.map +1 -0
  210. package/dist/types/moderation/index.js +19 -0
  211. package/dist/types/moderation/index.js.map +1 -0
  212. package/dist/types/moderation/moderation.d.ts +139 -0
  213. package/dist/types/moderation/moderation.d.ts.map +1 -0
  214. package/dist/types/moderation/moderation.js +40 -0
  215. package/dist/types/moderation/moderation.js.map +1 -0
  216. package/dist/types/moderation.d.ts +36 -28
  217. package/dist/types/moderation.d.ts.map +1 -1
  218. package/dist/types/recipe/enums/allergen.d.ts +5 -0
  219. package/dist/types/recipe/enums/allergen.d.ts.map +1 -0
  220. package/dist/types/recipe/enums/allergen.js +21 -0
  221. package/dist/types/recipe/enums/allergen.js.map +1 -0
  222. package/dist/types/recipe/enums/cuisine.d.ts +5 -0
  223. package/dist/types/recipe/enums/cuisine.d.ts.map +1 -0
  224. package/dist/types/recipe/enums/cuisine.js +41 -0
  225. package/dist/types/recipe/enums/cuisine.js.map +1 -0
  226. package/dist/types/recipe/enums/dietary_tag.d.ts +5 -0
  227. package/dist/types/recipe/enums/dietary_tag.d.ts.map +1 -0
  228. package/dist/types/recipe/enums/dietary_tag.js +23 -0
  229. package/dist/types/recipe/enums/dietary_tag.js.map +1 -0
  230. package/dist/types/recipe/enums/difficulty.d.ts +5 -0
  231. package/dist/types/recipe/enums/difficulty.d.ts.map +1 -0
  232. package/dist/types/recipe/enums/difficulty.js +12 -0
  233. package/dist/types/recipe/enums/difficulty.js.map +1 -0
  234. package/dist/types/recipe/enums/index.d.ts +11 -0
  235. package/dist/types/recipe/enums/index.d.ts.map +1 -0
  236. package/dist/types/recipe/enums/index.js +27 -0
  237. package/dist/types/recipe/enums/index.js.map +1 -0
  238. package/dist/types/recipe/enums/meal_type.d.ts +5 -0
  239. package/dist/types/recipe/enums/meal_type.d.ts.map +1 -0
  240. package/dist/types/recipe/enums/meal_type.js +16 -0
  241. package/dist/types/recipe/enums/meal_type.js.map +1 -0
  242. package/dist/types/recipe/enums/recipe_source.d.ts +5 -0
  243. package/dist/types/recipe/enums/recipe_source.d.ts.map +1 -0
  244. package/dist/types/recipe/enums/recipe_source.js +7 -0
  245. package/dist/types/recipe/enums/recipe_source.js.map +1 -0
  246. package/dist/types/recipe/enums/recipe_status.d.ts +5 -0
  247. package/dist/types/recipe/enums/recipe_status.d.ts.map +1 -0
  248. package/dist/types/recipe/enums/recipe_status.js +14 -0
  249. package/dist/types/recipe/enums/recipe_status.js.map +1 -0
  250. package/dist/types/recipe/enums/spiciness.d.ts +5 -0
  251. package/dist/types/recipe/enums/spiciness.d.ts.map +1 -0
  252. package/dist/types/recipe/enums/spiciness.js +7 -0
  253. package/dist/types/recipe/enums/spiciness.js.map +1 -0
  254. package/dist/types/recipe/enums/temperature_unit.d.ts +5 -0
  255. package/dist/types/recipe/enums/temperature_unit.d.ts.map +1 -0
  256. package/dist/types/recipe/enums/temperature_unit.js +7 -0
  257. package/dist/types/recipe/enums/temperature_unit.js.map +1 -0
  258. package/dist/types/recipe/enums/unit.d.ts +5 -0
  259. package/dist/types/recipe/enums/unit.d.ts.map +1 -0
  260. package/dist/types/recipe/enums/unit.js +53 -0
  261. package/dist/types/recipe/enums/unit.js.map +1 -0
  262. package/dist/types/recipe/equipment.js +2 -2
  263. package/dist/types/recipe/equipment.js.map +1 -1
  264. package/dist/types/recipe/filters.d.ts +31 -0
  265. package/dist/types/recipe/filters.d.ts.map +1 -0
  266. package/dist/types/recipe/filters.js +16 -0
  267. package/dist/types/recipe/filters.js.map +1 -0
  268. package/dist/types/recipe/index.d.ts +2 -0
  269. package/dist/types/recipe/index.d.ts.map +1 -1
  270. package/dist/types/recipe/index.js +2 -0
  271. package/dist/types/recipe/index.js.map +1 -1
  272. package/dist/types/recipe/ingredient.d.ts +18 -18
  273. package/dist/types/recipe/ingredient.js +6 -6
  274. package/dist/types/recipe/ingredient.js.map +1 -1
  275. package/dist/types/recipe/recipe.d.ts +35 -65
  276. package/dist/types/recipe/recipe.d.ts.map +1 -1
  277. package/dist/types/recipe/recipe.js +6 -5
  278. package/dist/types/recipe/recipe.js.map +1 -1
  279. package/dist/types/recipe/temperature.js +2 -2
  280. package/dist/types/recipe/temperature.js.map +1 -1
  281. package/dist/types/report/enums/index.d.ts +5 -0
  282. package/dist/types/report/enums/index.d.ts.map +1 -0
  283. package/dist/types/report/enums/index.js +21 -0
  284. package/dist/types/report/enums/index.js.map +1 -0
  285. package/dist/types/report/enums/report_priority.d.ts +5 -0
  286. package/dist/types/report/enums/report_priority.d.ts.map +1 -0
  287. package/dist/types/report/enums/report_priority.js +12 -0
  288. package/dist/types/report/enums/report_priority.js.map +1 -0
  289. package/dist/types/report/enums/report_status.d.ts +5 -0
  290. package/dist/types/report/enums/report_status.d.ts.map +1 -0
  291. package/dist/types/report/enums/report_status.js +12 -0
  292. package/dist/types/report/enums/report_status.js.map +1 -0
  293. package/dist/types/report/enums/report_target_type.d.ts +5 -0
  294. package/dist/types/report/enums/report_target_type.d.ts.map +1 -0
  295. package/dist/types/report/enums/report_target_type.js +12 -0
  296. package/dist/types/report/enums/report_target_type.js.map +1 -0
  297. package/dist/types/report/enums/report_type.d.ts +5 -0
  298. package/dist/types/report/enums/report_type.d.ts.map +1 -0
  299. package/dist/types/report/enums/report_type.js +14 -0
  300. package/dist/types/report/enums/report_type.js.map +1 -0
  301. package/dist/types/report/index.d.ts +3 -0
  302. package/dist/types/report/index.d.ts.map +1 -0
  303. package/dist/types/report/index.js +19 -0
  304. package/dist/types/report/index.js.map +1 -0
  305. package/dist/types/report/report.d.ts +95 -0
  306. package/dist/types/report/report.d.ts.map +1 -0
  307. package/dist/types/report/report.js +32 -0
  308. package/dist/types/report/report.js.map +1 -0
  309. package/dist/types/report.d.ts +46 -38
  310. package/dist/types/report.d.ts.map +1 -1
  311. package/package.json +1 -1
  312. package/src/config/ai.ts +5 -0
  313. package/src/config/collections.ts +1 -1
  314. package/src/config/common.ts +1 -1
  315. package/src/config/limits.ts +21 -15
  316. package/src/config/subscription.ts +1 -1
  317. package/src/index.ts +0 -1
  318. package/src/lib/ai/cost.ts +3 -2
  319. package/src/lib/ai/embedding.ts +1 -1
  320. package/src/lib/ai/flow.ts +1 -0
  321. package/src/lib/iam.ts +18 -3
  322. package/src/lib/index.ts +0 -2
  323. package/src/lib/storage.ts +1 -1
  324. package/src/lib/usage/usage.service.ts +7 -4
  325. package/src/types/ai/config.ts +2 -1
  326. package/src/types/ai/index.ts +0 -2
  327. package/src/types/ai/recipe.ts +6 -5
  328. package/src/types/ai/translation.ts +5 -3
  329. package/src/types/core/api.ts +15 -0
  330. package/src/types/core/asset.ts +11 -0
  331. package/src/types/core/enums/index.ts +5 -0
  332. package/src/types/core/enums/measurement_system.ts +5 -0
  333. package/src/types/core/enums/theme.ts +5 -0
  334. package/src/{lib/errors/index.ts → types/core/errors.ts} +19 -27
  335. package/src/types/core/index.ts +5 -0
  336. package/src/types/{settings.ts → core/settings.ts} +8 -17
  337. package/src/types/iam/enums/index.ts +6 -0
  338. package/src/types/iam/enums/subscription_role.ts +5 -0
  339. package/src/types/iam/enums/subscription_status.ts +10 -0
  340. package/src/types/iam/enums/user_role.ts +11 -0
  341. package/src/types/iam/index.ts +1 -0
  342. package/src/types/iam/profile.ts +2 -17
  343. package/src/types/iam/subscription.ts +10 -6
  344. package/src/types/iam/user.ts +3 -25
  345. package/src/types/index.ts +1 -4
  346. package/src/types/moderation/enums/index.ts +4 -0
  347. package/src/types/moderation/index.ts +2 -0
  348. package/src/types/{moderation.ts → moderation/moderation.ts} +6 -32
  349. package/src/types/recipe/enums/index.ts +10 -0
  350. package/src/types/{enums → recipe/enums}/recipe_source.ts +1 -1
  351. package/src/types/{enums → recipe/enums}/recipe_status.ts +0 -1
  352. package/src/types/recipe/equipment.ts +3 -3
  353. package/src/types/{ai → recipe}/filters.ts +2 -2
  354. package/src/types/recipe/index.ts +2 -0
  355. package/src/types/recipe/ingredient.ts +7 -7
  356. package/src/types/recipe/recipe.ts +4 -40
  357. package/src/types/recipe/temperature.ts +2 -2
  358. package/src/types/report/enums/index.ts +4 -0
  359. package/src/types/report/enums/report_priority.ts +10 -0
  360. package/src/types/report/enums/report_status.ts +10 -0
  361. package/src/types/report/enums/report_target_type.ts +10 -0
  362. package/src/types/report/enums/report_type.ts +12 -0
  363. package/src/types/report/index.ts +2 -0
  364. package/src/types/report/report.ts +38 -0
  365. package/src/lib/repository/equipment.repository.ts +0 -93
  366. package/src/lib/repository/errors.ts +0 -37
  367. package/src/lib/repository/factory.ts +0 -29
  368. package/src/lib/repository/firestore.repository.ts +0 -633
  369. package/src/lib/repository/index.ts +0 -12
  370. package/src/lib/repository/ingredient.repository.ts +0 -93
  371. package/src/lib/repository/profile.repository.ts +0 -51
  372. package/src/lib/repository/recipe-queue.repository.ts +0 -49
  373. package/src/lib/repository/recipe.repository.ts +0 -51
  374. package/src/lib/repository/report.repository.ts +0 -85
  375. package/src/lib/repository/rtdb.repository.ts +0 -67
  376. package/src/lib/repository/settings.repository.ts +0 -57
  377. package/src/lib/repository/user.repository.ts +0 -44
  378. package/src/types/ai/flow.ts +0 -82
  379. package/src/types/asset.ts +0 -19
  380. package/src/types/enums/index.ts +0 -21
  381. package/src/types/enums/role.ts +0 -11
  382. package/src/types/report.ts +0 -90
  383. package/src/types/repository.ts +0 -140
  384. package/src/types/response.ts +0 -30
  385. /package/src/types/{enums → core/enums}/image_type.ts +0 -0
  386. /package/src/types/{enums → core/enums}/locale.ts +0 -0
  387. /package/src/types/{enums → core/enums}/url_type.ts +0 -0
  388. /package/src/types/{enums → iam/enums}/profile_status.ts +0 -0
  389. /package/src/types/{enums → iam/enums}/subscription_tier.ts +0 -0
  390. /package/src/types/{enums → iam/enums}/user_status.ts +0 -0
  391. /package/src/types/{enums → moderation/enums}/moderation_status.ts +0 -0
  392. /package/src/types/{enums → moderation/enums}/priority.ts +0 -0
  393. /package/src/types/{enums → moderation/enums}/severity.ts +0 -0
  394. /package/src/types/{enums → moderation/enums}/suggestion_category.ts +0 -0
  395. /package/src/types/{enums → recipe/enums}/allergen.ts +0 -0
  396. /package/src/types/{enums → recipe/enums}/cuisine.ts +0 -0
  397. /package/src/types/{enums → recipe/enums}/dietary_tag.ts +0 -0
  398. /package/src/types/{enums → recipe/enums}/difficulty.ts +0 -0
  399. /package/src/types/{enums → recipe/enums}/meal_type.ts +0 -0
  400. /package/src/types/{enums → recipe/enums}/spiciness.ts +0 -0
  401. /package/src/types/{enums → recipe/enums}/temperature_unit.ts +0 -0
  402. /package/src/types/{enums → recipe/enums}/unit.ts +0 -0
@@ -1,93 +0,0 @@
1
- import {
2
- Firestore,
3
- Timestamp,
4
- QueryDocumentSnapshot,
5
- DocumentData,
6
- } from "firebase-admin/firestore";
7
- import { FirestoreRepository } from "./firestore.repository";
8
- import type { Asset, AssetLocale } from "../../types/asset";
9
- import { AssetSchema } from "../../types/asset";
10
- import { Collections } from "../../config/collections";
11
- import { RepositoryError, RepositoryErrorCode } from "./errors";
12
- import type { Locale } from "../../types/enums";
13
-
14
- export class IngredientRepository extends FirestoreRepository<Asset> {
15
- constructor(firestore: Firestore) {
16
- super(firestore, Collections.Ingredients, {
17
- enableTimestamps: true,
18
- enableSoftDelete: false,
19
- validateOnWrite: true,
20
- });
21
- }
22
-
23
- protected validate(data: Partial<Asset>): void {
24
- const result = AssetSchema.partial().safeParse(data);
25
- if (!result.success) {
26
- throw new RepositoryError(
27
- RepositoryErrorCode.VALIDATION_ERROR,
28
- "Ingredient validation failed",
29
- { errors: result.error.issues },
30
- );
31
- }
32
- }
33
-
34
- async findBySlug(slug: string): Promise<Asset | null> {
35
- return this.findById(slug);
36
- }
37
-
38
- async slugExists(slug: string): Promise<boolean> {
39
- return this.exists(slug);
40
- }
41
-
42
- async getLocale(slug: string, locale: Locale): Promise<AssetLocale | null> {
43
- const docRef = this.collection.doc(slug).collection("locales").doc(locale);
44
- const doc = await docRef.get();
45
- if (!doc.exists) return null;
46
- return { locale, ...doc.data() } as AssetLocale;
47
- }
48
-
49
- async setLocale(
50
- slug: string,
51
- locale: Locale,
52
- data: Omit<AssetLocale, "locale">,
53
- ): Promise<void> {
54
- const docRef = this.collection.doc(slug).collection("locales").doc(locale);
55
- await docRef.set({ locale, ...data });
56
- }
57
-
58
- async getAllLocales(slug: string): Promise<AssetLocale[]> {
59
- const snapshot = await this.collection
60
- .doc(slug)
61
- .collection("locales")
62
- .get();
63
- return snapshot.docs.map(
64
- (doc: QueryDocumentSnapshot<DocumentData>) =>
65
- ({ locale: doc.id, ...doc.data() }) as AssetLocale,
66
- );
67
- }
68
-
69
- async createWithLocale(
70
- slug: string,
71
- imageUrl: string | undefined,
72
- locale: Locale,
73
- localeData: Omit<AssetLocale, "locale">,
74
- ): Promise<Asset> {
75
- const now = Timestamp.now();
76
- const batch = this.firestore.batch();
77
-
78
- const docRef = this.collection.doc(slug);
79
- const assetData: Asset = {
80
- id: slug,
81
- imageUrl,
82
- createdAt: now,
83
- updatedAt: now,
84
- };
85
- batch.set(docRef, assetData);
86
-
87
- const localeRef = docRef.collection("locales").doc(locale);
88
- batch.set(localeRef, { locale, ...localeData });
89
-
90
- await batch.commit();
91
- return assetData;
92
- }
93
- }
@@ -1,51 +0,0 @@
1
- import { Firestore } from "firebase-admin/firestore";
2
- import { FirestoreRepository } from "./firestore.repository";
3
- import type { Profile } from "../../types/iam/profile";
4
- import { ProfileSchema } from "../../types/iam/profile";
5
- import { Collections } from "../../config/collections";
6
- import { RepositoryError, RepositoryErrorCode } from "./errors";
7
-
8
- export class ProfileRepository extends FirestoreRepository<Profile> {
9
- constructor(firestore: Firestore) {
10
- super(firestore, Collections.Profiles, {
11
- enableTimestamps: true,
12
- enableSoftDelete: true,
13
- validateOnWrite: true,
14
- });
15
- }
16
-
17
- protected validate(data: Partial<Profile>): void {
18
- const result = ProfileSchema.partial().safeParse(data);
19
- if (!result.success) {
20
- throw new RepositoryError(
21
- RepositoryErrorCode.VALIDATION_ERROR,
22
- "Profile validation failed",
23
- { errors: result.error.issues },
24
- );
25
- }
26
- }
27
-
28
- async findByHandle(handle: string): Promise<Profile | null> {
29
- const results = await this.findWhere(
30
- [{ field: "handle", op: "==", value: handle }],
31
- { limit: 1 },
32
- );
33
- return results[0] ?? null;
34
- }
35
-
36
- async findByUserId(userId: string): Promise<Profile | null> {
37
- return this.findById(userId);
38
- }
39
-
40
- async createWithUserId(
41
- userId: string,
42
- data: Omit<Profile, "id">,
43
- ): Promise<Profile> {
44
- return this.create(data, userId);
45
- }
46
-
47
- async handleExists(handle: string): Promise<boolean> {
48
- const profile = await this.findByHandle(handle);
49
- return profile !== null;
50
- }
51
- }
@@ -1,49 +0,0 @@
1
- import { Firestore } from "firebase-admin/firestore";
2
- import { FirestoreRepository } from "./firestore.repository";
3
- import type { RecipeMeta } from "../../types/recipe";
4
- import { RecipeMetaSchema } from "../../types/recipe";
5
- import { Collections } from "../../config/collections";
6
- import { RepositoryError, RepositoryErrorCode } from "./errors";
7
-
8
- export class RecipeQueueRepository extends FirestoreRepository<RecipeMeta> {
9
- constructor(firestore: Firestore) {
10
- super(firestore, Collections.RecipeQueue, {
11
- enableTimestamps: true,
12
- enableSoftDelete: false,
13
- validateOnWrite: true,
14
- });
15
- }
16
-
17
- protected validate(data: Partial<RecipeMeta>): void {
18
- const result = RecipeMetaSchema.partial().safeParse(data);
19
- if (!result.success) {
20
- throw new RepositoryError(
21
- RepositoryErrorCode.VALIDATION_ERROR,
22
- "Recipe queue validation failed",
23
- { errors: result.error.issues },
24
- );
25
- }
26
- }
27
-
28
- async findBySourceUrl(sourceUrl: string): Promise<RecipeMeta | null> {
29
- const results = await this.findWhere(
30
- [{ field: "sourceUrl", op: "==", value: sourceUrl }],
31
- { limit: 1 },
32
- );
33
- return results[0] ?? null;
34
- }
35
-
36
- async findBySourceUrlAndUser(
37
- sourceUrl: string,
38
- userId: string,
39
- ): Promise<RecipeMeta | null> {
40
- const results = await this.findWhere(
41
- [
42
- { field: "sourceUrl", op: "==", value: sourceUrl },
43
- { field: "createdBy", op: "==", value: userId },
44
- ],
45
- { limit: 1 },
46
- );
47
- return results[0] ?? null;
48
- }
49
- }
@@ -1,51 +0,0 @@
1
- import { Firestore } from "firebase-admin/firestore";
2
- import { FirestoreRepository } from "./firestore.repository";
3
- import type { RecipeMeta } from "../../types/recipe";
4
- import { RecipeMetaSchema } from "../../types/recipe";
5
- import { Collections } from "../../config/collections";
6
- import { RepositoryError, RepositoryErrorCode } from "./errors";
7
-
8
- export class RecipeRepository extends FirestoreRepository<RecipeMeta> {
9
- constructor(firestore: Firestore) {
10
- super(firestore, Collections.Recipes, {
11
- enableTimestamps: true,
12
- enableSoftDelete: true,
13
- validateOnWrite: true,
14
- });
15
- }
16
-
17
- protected validate(data: Partial<RecipeMeta>): void {
18
- const result = RecipeMetaSchema.partial().safeParse(data);
19
- if (!result.success) {
20
- throw new RepositoryError(
21
- RepositoryErrorCode.VALIDATION_ERROR,
22
- "Recipe validation failed",
23
- { errors: result.error.issues },
24
- );
25
- }
26
- }
27
-
28
- async findBySourceUrl(sourceUrl: string): Promise<RecipeMeta | null> {
29
- const results = await this.findWhere(
30
- [{ field: "sourceUrl", op: "==", value: sourceUrl }],
31
- { limit: 1 },
32
- );
33
- return results[0] ?? null;
34
- }
35
-
36
- async hardDelete(id: string): Promise<void> {
37
- const docRef = this.collection.doc(id);
38
- const contentRef = docRef.collection("content");
39
-
40
- const batch = this.firestore.batch();
41
-
42
- const contentDocs = await contentRef.listDocuments();
43
- for (const doc of contentDocs) {
44
- batch.delete(doc);
45
- }
46
-
47
- batch.delete(docRef);
48
-
49
- await batch.commit();
50
- }
51
- }
@@ -1,85 +0,0 @@
1
- import { Firestore } from "firebase-admin/firestore";
2
- import { FirestoreRepository } from "./firestore.repository";
3
- import type { Report, ReportStatus, ReportType } from "../../types/report";
4
- import { ReportSchema } from "../../types/report";
5
- import { Collections } from "../../config/collections";
6
- import { RepositoryError, RepositoryErrorCode } from "./errors";
7
- import type { WhereClause, QueryOptions } from "../../types/repository";
8
-
9
- export class ReportRepository extends FirestoreRepository<Report> {
10
- constructor(firestore: Firestore) {
11
- super(firestore, Collections.Reports, {
12
- enableTimestamps: true,
13
- enableSoftDelete: false,
14
- validateOnWrite: true,
15
- });
16
- }
17
-
18
- protected validate(data: Partial<Report>): void {
19
- const result = ReportSchema.partial().safeParse(data);
20
- if (!result.success) {
21
- throw new RepositoryError(
22
- RepositoryErrorCode.VALIDATION_ERROR,
23
- "Report validation failed",
24
- { errors: result.error.issues },
25
- );
26
- }
27
- }
28
-
29
- async findByStatus(
30
- status: ReportStatus,
31
- options?: QueryOptions,
32
- ): Promise<Report[]> {
33
- return this.findWhere([{ field: "status", op: "==", value: status }], {
34
- orderBy: { field: "createdAt", direction: "desc" },
35
- ...options,
36
- });
37
- }
38
-
39
- async findByType(
40
- type: ReportType,
41
- options?: QueryOptions,
42
- ): Promise<Report[]> {
43
- return this.findWhere([{ field: "type", op: "==", value: type }], {
44
- orderBy: { field: "createdAt", direction: "desc" },
45
- ...options,
46
- });
47
- }
48
-
49
- async findByUserId(
50
- userId: string,
51
- options?: QueryOptions,
52
- ): Promise<Report[]> {
53
- return this.findWhere([{ field: "userId", op: "==", value: userId }], {
54
- orderBy: { field: "createdAt", direction: "desc" },
55
- ...options,
56
- });
57
- }
58
-
59
- async findByTargetId(
60
- targetId: string,
61
- options?: QueryOptions,
62
- ): Promise<Report[]> {
63
- return this.findWhere([{ field: "targetId", op: "==", value: targetId }], {
64
- orderBy: { field: "createdAt", direction: "desc" },
65
- ...options,
66
- });
67
- }
68
-
69
- async findPending(options?: QueryOptions): Promise<Report[]> {
70
- return this.findByStatus("pending", options);
71
- }
72
-
73
- async countByUserInPeriod(
74
- userId: string,
75
- startDate: Date,
76
- endDate: Date,
77
- ): Promise<number> {
78
- const clauses: WhereClause[] = [
79
- { field: "userId", op: "==", value: userId },
80
- { field: "createdAt", op: ">=", value: startDate },
81
- { field: "createdAt", op: "<=", value: endDate },
82
- ];
83
- return this.count(clauses);
84
- }
85
- }
@@ -1,67 +0,0 @@
1
- import { Database, Reference } from "firebase-admin/database";
2
- import type { IRTDBRepository } from "../../types/repository";
3
-
4
- export abstract class RTDBRepository<
5
- T extends { id: string },
6
- > implements IRTDBRepository<T> {
7
- protected readonly ref: Reference;
8
-
9
- constructor(
10
- protected readonly database: Database,
11
- protected readonly path: string,
12
- ) {
13
- this.ref = database.ref(path);
14
- }
15
-
16
- protected toDocument(entity: Partial<T>): Record<string, unknown> {
17
- return { ...entity };
18
- }
19
-
20
- protected fromDocument(id: string, data: Record<string, unknown>): T {
21
- return { id, ...data } as T;
22
- }
23
-
24
- async get(id: string): Promise<T | null> {
25
- const snapshot = await this.ref.child(id).get();
26
- if (!snapshot.exists()) return null;
27
- return this.fromDocument(id, snapshot.val());
28
- }
29
-
30
- async getAll(): Promise<T[]> {
31
- const snapshot = await this.ref.get();
32
- if (!snapshot.exists()) return [];
33
-
34
- const results: T[] = [];
35
- snapshot.forEach((child) => {
36
- results.push(this.fromDocument(child.key!, child.val()));
37
- });
38
- return results;
39
- }
40
-
41
- async set(id: string, data: T): Promise<void> {
42
- const docData = this.toDocument(data);
43
- await this.ref.child(id).set(docData);
44
- }
45
-
46
- async update(id: string, data: Partial<T>): Promise<void> {
47
- const docData = this.toDocument(data);
48
- await this.ref.child(id).update(docData);
49
- }
50
-
51
- async remove(id: string): Promise<void> {
52
- await this.ref.child(id).remove();
53
- }
54
-
55
- async increment(id: string, field: string, delta: number = 1): Promise<void> {
56
- const fieldRef = this.ref.child(id).child(field);
57
- await fieldRef.transaction((current) => (current || 0) + delta);
58
- }
59
-
60
- async decrement(id: string, field: string, delta: number = 1): Promise<void> {
61
- await this.increment(id, field, -delta);
62
- }
63
-
64
- async multiUpdate(updates: Record<string, unknown>): Promise<void> {
65
- await this.ref.update(updates);
66
- }
67
- }
@@ -1,57 +0,0 @@
1
- import { Firestore } from "firebase-admin/firestore";
2
- import { FirestoreRepository } from "./firestore.repository";
3
- import type { Settings, SettingsInput } from "../../types/settings";
4
- import { SettingsSchema } from "../../types/settings";
5
- import { Collections } from "../../config/collections";
6
- import { RepositoryError, RepositoryErrorCode } from "./errors";
7
-
8
- export class SettingsRepository extends FirestoreRepository<Settings> {
9
- constructor(firestore: Firestore) {
10
- super(firestore, Collections.Settings, {
11
- enableTimestamps: true,
12
- enableSoftDelete: false,
13
- validateOnWrite: true,
14
- });
15
- }
16
-
17
- protected validate(data: Partial<Settings>): void {
18
- const result = SettingsSchema.partial().safeParse(data);
19
- if (!result.success) {
20
- throw new RepositoryError(
21
- RepositoryErrorCode.VALIDATION_ERROR,
22
- "Settings validation failed",
23
- { errors: result.error.issues },
24
- );
25
- }
26
- }
27
-
28
- async findByUserId(userId: string): Promise<Settings | null> {
29
- return this.findById(userId);
30
- }
31
-
32
- async createForUser(
33
- userId: string,
34
- data: Omit<Settings, "id">,
35
- ): Promise<Settings> {
36
- return this.create(data, userId);
37
- }
38
-
39
- static createDefaultSettings(): SettingsInput {
40
- return {
41
- allergens: [],
42
- dietaryTags: [],
43
- cuisines: [],
44
- excludedIngredients: [],
45
- locale: "en",
46
- temperatureUnit: "celsius",
47
- measurementSystem: "metric",
48
- theme: "system",
49
- notifications: {
50
- email: true,
51
- push: true,
52
- marketing: false,
53
- weeklyDigest: true,
54
- },
55
- };
56
- }
57
- }
@@ -1,44 +0,0 @@
1
- import { Firestore } from "firebase-admin/firestore";
2
- import { FirestoreRepository } from "./firestore.repository";
3
- import type { User } from "../../types/iam/user";
4
- import { UserSchema } from "../../types/iam/user";
5
- import { Collections } from "../../config/collections";
6
- import { RepositoryError, RepositoryErrorCode } from "./errors";
7
-
8
- export class UserRepository extends FirestoreRepository<User> {
9
- constructor(firestore: Firestore) {
10
- super(firestore, Collections.Users, {
11
- enableTimestamps: true,
12
- enableSoftDelete: true,
13
- validateOnWrite: true,
14
- });
15
- }
16
-
17
- protected validate(data: Partial<User>): void {
18
- const result = UserSchema.partial().safeParse(data);
19
- if (!result.success) {
20
- throw new RepositoryError(
21
- RepositoryErrorCode.VALIDATION_ERROR,
22
- "User validation failed",
23
- { errors: result.error.issues },
24
- );
25
- }
26
- }
27
-
28
- async findByEmail(email: string): Promise<User | null> {
29
- const results = await this.findWhere(
30
- [{ field: "email", op: "==", value: email }],
31
- { limit: 1 },
32
- );
33
- return results[0] ?? null;
34
- }
35
-
36
- async createWithId(uid: string, data: Omit<User, "id">): Promise<User> {
37
- return this.create(data, uid);
38
- }
39
-
40
- async emailExists(email: string): Promise<boolean> {
41
- const user = await this.findByEmail(email);
42
- return user !== null;
43
- }
44
- }
@@ -1,82 +0,0 @@
1
- import { z } from "genkit";
2
- import {
3
- LocaleSchema,
4
- SeveritySchema,
5
- SuggestionCategorySchema,
6
- } from "../enums";
7
- import { EquipmentContentSchema } from "../recipe/equipment";
8
- import { IngredientSectionContentSchema } from "../recipe/ingredient";
9
- import { InstructionContentSchema } from "../recipe/instruction";
10
-
11
- // Moderation flow schemas
12
- export const ModerationFlowSuggestionSchema = z.object({
13
- category: SuggestionCategorySchema,
14
- field: z.string(),
15
- severity: SeveritySchema,
16
- suggestion: z.string(),
17
- });
18
-
19
- export const ModerationFlowInputSchema = z.object({
20
- locale: LocaleSchema,
21
- title: z.string(),
22
- description: z.string(),
23
- ingredients: z.array(z.string()),
24
- instructions: z.array(z.string()),
25
- });
26
-
27
- export const ModerationFlowOutputSchema = z.object({
28
- qualityScore: z.number().min(0).max(1),
29
- suggestions: z.array(ModerationFlowSuggestionSchema),
30
- autoApproved: z.boolean(),
31
- autoRejected: z.boolean(),
32
- rejectionReason: z.string().optional(),
33
- });
34
-
35
- export type ModerationFlowInput = z.infer<typeof ModerationFlowInputSchema>;
36
- export type ModerationFlowOutput = z.infer<typeof ModerationFlowOutputSchema>;
37
-
38
- // Translation flow schemas
39
- export const TranslationFlowInputSchema = z.object({
40
- sourceLocale: LocaleSchema,
41
- targetLocale: LocaleSchema,
42
- title: z.string(),
43
- description: z.string(),
44
- ingredientSections: z.array(IngredientSectionContentSchema),
45
- instructions: z.array(InstructionContentSchema),
46
- equipment: z.array(EquipmentContentSchema).optional(),
47
- tips: z.array(z.string()).optional(),
48
- });
49
-
50
- export const TranslationFlowOutputSchema = z.object({
51
- title: z.string(),
52
- description: z.string(),
53
- ingredientSections: z.array(IngredientSectionContentSchema),
54
- instructions: z.array(InstructionContentSchema),
55
- equipment: z.array(EquipmentContentSchema).optional(),
56
- tips: z.array(z.string()).optional(),
57
- });
58
-
59
- export type TranslationFlowInput = z.infer<typeof TranslationFlowInputSchema>;
60
- export type TranslationFlowOutput = z.infer<typeof TranslationFlowOutputSchema>;
61
-
62
- // Image safety flow schemas
63
- const IMAGE_SAFETY_CATEGORY_VALUES = [
64
- "appropriate",
65
- "violence",
66
- "adult",
67
- "hate",
68
- "dangerous",
69
- ] as const;
70
-
71
- export const ImageSafetyFlowInputSchema = z.object({
72
- imageUrl: z.string(),
73
- });
74
-
75
- export const ImageSafetyFlowOutputSchema = z.object({
76
- safe: z.boolean(),
77
- reason: z.string().optional(),
78
- categories: z.array(z.enum(IMAGE_SAFETY_CATEGORY_VALUES)),
79
- });
80
-
81
- export type ImageSafetyFlowInput = z.infer<typeof ImageSafetyFlowInputSchema>;
82
- export type ImageSafetyFlowOutput = z.infer<typeof ImageSafetyFlowOutputSchema>;
@@ -1,19 +0,0 @@
1
- import { z } from "genkit";
2
- import type { Timestamp } from "firebase-admin/firestore";
3
- import { SlugRegex } from "../config";
4
- import { LocaleSchema } from "./enums";
5
-
6
- export const AssetSchema = z.object({
7
- createdAt: z.custom<Timestamp>(),
8
- id: z.string().regex(SlugRegex),
9
- imageUrl: z.string().optional(),
10
- updatedAt: z.custom<Timestamp>(),
11
- });
12
- export type Asset = z.infer<typeof AssetSchema>;
13
-
14
- export const AssetLocaleSchema = z.object({
15
- description: z.string().max(500).optional(),
16
- locale: LocaleSchema,
17
- name: z.string().min(1).max(100),
18
- });
19
- export type AssetLocale = z.infer<typeof AssetLocaleSchema>;
@@ -1,21 +0,0 @@
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";
@@ -1,11 +0,0 @@
1
- import { z } from "genkit";
2
-
3
- export const ROLE_VALUES = [
4
- "admin",
5
- "moderator",
6
- "translator",
7
- "user",
8
- "guest",
9
- ] as const;
10
- export const RoleSchema = z.enum(ROLE_VALUES);
11
- export type Role = (typeof ROLE_VALUES)[number];