yazio-mcp 0.0.15 → 0.0.16-beta.1

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/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  > [!IMPORTANT]
4
4
  > This is **not an official MCP server** and Yazio does **not provide an official API**.
5
- > This server uses an [unofficial reverse-engineered API](https://github.com/juriadams/yazio) and may stop working at any time.
6
5
 
7
6
  An MCP (Model Context Protocol) server that connects Claude/Cursor to your Yazio nutrition data. Track your diet, search food products, and manage your nutrition goals directly from your AI assistant.
8
7
 
@@ -16,6 +15,8 @@ An MCP (Model Context Protocol) server that connects Claude/Cursor to your Yazio
16
15
  - 📊 **Nutrition Analysis** - Get comprehensive diet data and insights
17
16
  - 🍎 **Food Tracking** - Search, add, and manage food entries
18
17
  - 🏃‍♂️ **Fitness Data** - Track exercises and water intake
18
+ - 📓 **Diary Notes** - Read and write daily notes and feeling tags
19
+ - 🥣 **Recipes** - Create, log, and delete your own recipes
19
20
  - ⚖️ **Weight Monitoring** - View weight history and trends
20
21
  - 🎯 **Goal Management** - Access and manage nutrition goals
21
22
  - 🔍 **Product Search** - Search Yazio's extensive [food database](https://www.yazio.com/en/foods)
@@ -89,18 +90,30 @@ Easily log meals you forgot to track in the Yazio app directly from Claude or Cu
89
90
 
90
91
  | Tool | Description | Key Parameters |
91
92
  |------|-------------|----------------|
93
+ | `get_user` | Get user profile | - |
92
94
  | `get_user_daily_summary` | Get daily nutrition summary | `date` |
93
95
  | `get_user_consumed_items` | Get food entries for a date | `date` |
94
- | `get_user_weight` | Get weight data | - |
96
+ | `get_user_weight` | Get weight data | `date` (optional) |
95
97
  | `get_user_exercises` | Get exercise data | `date` |
96
98
  | `get_user_water_intake` | Get water intake | `date` |
97
- | `get_user_goals` | Get nutrition goals | - |
99
+ | `get_user_goals` | Get nutrition goals | `date` (optional) |
98
100
  | `get_user_settings` | Get user preferences | - |
101
+ | `get_user_dietary_preferences` | Get dietary preferences | - |
102
+ | `get_user_suggested_products` | Get suggested products for a meal | `date`, `daytime`, `limit` (all optional) |
99
103
  | `search_products` | Search food database | `query` |
100
104
  | `get_product` | Get detailed product info | `id` |
101
- | `add_user_consumed_item` | Add food to your log | `productId`, `amount`, `date`, `mealType` |
105
+ | `get_recipe` | Get a recipe with ingredients and nutrients | `id` |
106
+ | `get_user_recipes` | Get your own recipes | - |
107
+ | `delete_user_recipe` | Delete one of your own recipes | `id` |
108
+ | `add_user_consumed_item` | Add food to your log | `product_id`, `amount`, `date`, `daytime` |
102
109
  | `add_user_water_intake` | Add water intake entry (cumulative value in ml) | `date`, `water_intake` |
103
110
  | `remove_user_consumed_item` | Remove food from log | `itemId` |
111
+ | `create_product` | Create a custom product from label values per 100 g/ml | `name`, `category`, `energy_per_100`, `protein_per_100`, `fat_per_100`, `carb_per_100` |
112
+ | `add_quick_entry` | Log a one-off entry with total nutrition, without a product ("quick add") | `name`, `date`, `daytime`, `energy` |
113
+ | `add_user_consumed_recipe` | Log portions of a recipe | `recipe_id`, `portion_count`, `date`, `daytime` |
114
+ | `create_user_recipe` | Create a recipe from products; nutrients per portion are calculated | `name`, `portion_count`, `ingredients` |
115
+ | `get_user_note` | Get the diary note and feeling tags for a date | `date` |
116
+ | `set_user_note` | Set the diary note and/or feeling tags for a date | `date`, `note`, `tags` |
104
117
 
105
118
  ## Test Connection
106
119
 
@@ -110,13 +123,12 @@ YAZIO_USERNAME='your_email' YAZIO_PASSWORD='your_password' npx yazio-mcp
110
123
 
111
124
  ## ⚠️ Important Disclaimers
112
125
 
113
- - **Unofficial API**: This uses a [reverse-engineered API](https://github.com/juriadams/yazio) that may break
114
126
  - **Credentials**: Your Yazio credentials are only used for auth on Yazio servers
115
127
  - **Use at Your Own Risk**: API changes could affect functionality
116
128
 
117
129
  ## 📋 Requirements
118
130
 
119
- - Node.js 18+ (for npx)
131
+ - Node.js 20+ (for npx)
120
132
  - Valid Yazio account
121
133
  - MCP-compatible client (Claude Desktop, Cursor, etc.)
122
134
 
@@ -128,6 +140,13 @@ YAZIO_USERNAME='your_email' YAZIO_PASSWORD='your_password' npx yazio-mcp
128
140
  ```
129
141
  YAZIO_USERNAME=X YAZIO_PASSWORD=X npx -y @modelcontextprotocol/inspector npx <local-path>/yazio-mcp
130
142
  ```
143
+
144
+ ## Releasing
145
+
146
+ Publishing a GitHub Release publishes the package. Release Drafter keeps a stable and a beta draft up to date.
147
+
148
+ - **Beta:** publish the beta draft (tag `vX.Y.Z-beta.N`, marked as pre-release). It goes to npm `beta`: `npx yazio-mcp@beta`.
149
+ - **Stable:** run `npm run release:prepare -- X.Y.Z`, commit and merge, then publish the stable draft with tag `vX.Y.Z`. It goes to npm `latest` and the MCP Registry.
131
150
  ---
132
151
 
133
152
  ## 📄 License
@@ -0,0 +1,49 @@
1
+ import * as z from 'zod';
2
+ export declare const API_BASE_URL = "https://yzapi.yazio.com/v15";
3
+ export declare const DEFAULT_CLIENT_ID = "1_4hiybetvfksgw40o0sog4s884kwc840wwso8go4k8c04goo4c";
4
+ export declare const DEFAULT_CLIENT_SECRET = "6rok2m65xuskgkgogw40wkkk8sw0osg84s8cggsc4woos4s8o";
5
+ export interface Credentials {
6
+ username: string;
7
+ password: string;
8
+ clientId?: string;
9
+ clientSecret?: string;
10
+ }
11
+ export interface Token {
12
+ token_type: string;
13
+ access_token: string;
14
+ refresh_token: string;
15
+ expires_in: number;
16
+ /** Epoch ms */
17
+ expires_at: number;
18
+ }
19
+ export type QueryValue = string | number | boolean | undefined;
20
+ export interface RequestOptions<T> {
21
+ query?: Record<string, QueryValue>;
22
+ body?: unknown;
23
+ schema?: z.ZodType<T>;
24
+ }
25
+ export interface YazioHttpOptions {
26
+ fetch?: typeof fetch;
27
+ }
28
+ export declare class YazioApiError extends Error {
29
+ readonly method: string;
30
+ readonly path: string;
31
+ readonly status: number;
32
+ readonly statusText: string;
33
+ readonly body: string;
34
+ constructor(method: string, path: string, status: number, statusText: string, body: string);
35
+ }
36
+ export declare class YazioHttp {
37
+ private readonly fetch;
38
+ private token;
39
+ private pendingToken;
40
+ private readonly credentials;
41
+ constructor(credentials: Credentials, options?: YazioHttpOptions);
42
+ request<T = void>(method: string, path: string, options?: RequestOptions<T>): Promise<T>;
43
+ authenticate(): Promise<Token>;
44
+ private invalidate;
45
+ private renewToken;
46
+ private requestToken;
47
+ private send;
48
+ private buildUrl;
49
+ }
@@ -0,0 +1,4 @@
1
+ export { YazioApi, today } from './yazio.js';
2
+ export { YazioHttp, YazioApiError, API_BASE_URL, DEFAULT_CLIENT_ID, DEFAULT_CLIENT_SECRET, type Credentials, type Token } from './http.js';
3
+ export type * from './types.js';
4
+ export * as schemas from './schemas.js';
@@ -0,0 +1,409 @@
1
+ import * as z from 'zod';
2
+ export declare const DaytimeSchema: z.ZodEnum<{
3
+ breakfast: "breakfast";
4
+ lunch: "lunch";
5
+ dinner: "dinner";
6
+ snack: "snack";
7
+ }>;
8
+ export declare const ProductCategorySchema: z.ZodEnum<{
9
+ babyfood: "babyfood";
10
+ bakedgoods: "bakedgoods";
11
+ bakingingredients: "bakingingredients";
12
+ bread: "bread";
13
+ candy: "candy";
14
+ cerealproducts: "cerealproducts";
15
+ cheese: "cheese";
16
+ chocolate: "chocolate";
17
+ dishes: "dishes";
18
+ drinksalcoholic: "drinksalcoholic";
19
+ drinksnonalcoholic: "drinksnonalcoholic";
20
+ fastfood: "fastfood";
21
+ fish: "fish";
22
+ fruits: "fruits";
23
+ icecream: "icecream";
24
+ legumes: "legumes";
25
+ meat: "meat";
26
+ milk: "milk";
27
+ miscellaneous: "miscellaneous";
28
+ nutritionalsupplements: "nutritionalsupplements";
29
+ oils: "oils";
30
+ pasta: "pasta";
31
+ potatoproducts: "potatoproducts";
32
+ poultry: "poultry";
33
+ riceproducts: "riceproducts";
34
+ sauces: "sauces";
35
+ seeds: "seeds";
36
+ soyproducts: "soyproducts";
37
+ spices: "spices";
38
+ spreads: "spreads";
39
+ vegetables: "vegetables";
40
+ }>;
41
+ export declare const ServingNameSchema: z.ZodEnum<{
42
+ bar: "bar";
43
+ bottle: "bottle";
44
+ can: "can";
45
+ cup: "cup";
46
+ each: "each";
47
+ glass: "glass";
48
+ package: "package";
49
+ piece: "piece";
50
+ portion: "portion";
51
+ slice: "slice";
52
+ tablespoon: "tablespoon";
53
+ tablet: "tablet";
54
+ teaspoon: "teaspoon";
55
+ }>;
56
+ export declare const NutrientsSchema: z.ZodRecord<z.ZodString, z.ZodNumber>;
57
+ export declare const BasicNutrientsSchema: z.ZodObject<{
58
+ 'energy.energy': z.ZodNumber;
59
+ 'nutrient.carb': z.ZodNumber;
60
+ 'nutrient.protein': z.ZodNumber;
61
+ 'nutrient.fat': z.ZodNumber;
62
+ }, z.core.$loose>;
63
+ export declare const ProductNutrientsSchema: z.ZodObject<{
64
+ 'energy.energy': z.ZodNumber;
65
+ 'nutrient.carb': z.ZodNumber;
66
+ 'nutrient.protein': z.ZodNumber;
67
+ 'nutrient.fat': z.ZodNumber;
68
+ 'mineral.calcium': z.ZodOptional<z.ZodNumber>;
69
+ 'mineral.chlorine': z.ZodOptional<z.ZodNumber>;
70
+ 'mineral.copper': z.ZodOptional<z.ZodNumber>;
71
+ 'mineral.fluorine': z.ZodOptional<z.ZodNumber>;
72
+ 'mineral.iron': z.ZodOptional<z.ZodNumber>;
73
+ 'mineral.magnesium': z.ZodOptional<z.ZodNumber>;
74
+ 'mineral.manganese': z.ZodOptional<z.ZodNumber>;
75
+ 'mineral.phosphorus': z.ZodOptional<z.ZodNumber>;
76
+ 'mineral.potassium': z.ZodOptional<z.ZodNumber>;
77
+ 'mineral.sulfur': z.ZodOptional<z.ZodNumber>;
78
+ 'mineral.zinc': z.ZodOptional<z.ZodNumber>;
79
+ 'nutrient.dietaryfiber': z.ZodOptional<z.ZodNumber>;
80
+ 'nutrient.sugar': z.ZodOptional<z.ZodNumber>;
81
+ 'vitamin.a': z.ZodOptional<z.ZodNumber>;
82
+ 'vitamin.b1': z.ZodOptional<z.ZodNumber>;
83
+ 'vitamin.b12': z.ZodOptional<z.ZodNumber>;
84
+ 'vitamin.b2': z.ZodOptional<z.ZodNumber>;
85
+ 'vitamin.b6': z.ZodOptional<z.ZodNumber>;
86
+ 'vitamin.d': z.ZodOptional<z.ZodNumber>;
87
+ 'vitamin.e': z.ZodOptional<z.ZodNumber>;
88
+ }, z.core.$loose>;
89
+ export declare const TokenResponseSchema: z.ZodObject<{
90
+ token_type: z.ZodString;
91
+ access_token: z.ZodString;
92
+ refresh_token: z.ZodString;
93
+ expires_in: z.ZodNumber;
94
+ }, z.core.$loose>;
95
+ export declare const UserSchema: z.ZodObject<{
96
+ diet: z.ZodNullable<z.ZodObject<{
97
+ carb_percentage: z.ZodNumber;
98
+ fat_percentage: z.ZodNumber;
99
+ protein_percentage: z.ZodNumber;
100
+ name: z.ZodString;
101
+ }, z.core.$loose>>;
102
+ email: z.ZodString;
103
+ premium_type: z.ZodString;
104
+ sex: z.ZodEnum<{
105
+ male: "male";
106
+ female: "female";
107
+ other: "other";
108
+ }>;
109
+ first_name: z.ZodString;
110
+ last_name: z.ZodString;
111
+ city: z.ZodString;
112
+ country: z.ZodString;
113
+ weight_change_per_week: z.ZodNumber;
114
+ body_height: z.ZodNumber;
115
+ goal: z.ZodString;
116
+ date_of_birth: z.ZodString;
117
+ registration_date: z.ZodString;
118
+ timezone_offset: z.ZodNumber;
119
+ unit_length: z.ZodString;
120
+ unit_mass: z.ZodString;
121
+ unit_glucose: z.ZodString;
122
+ unit_serving: z.ZodString;
123
+ unit_energy: z.ZodString;
124
+ food_database_country: z.ZodString;
125
+ profile_image: z.ZodNullable<z.ZodString>;
126
+ user_token: z.ZodString;
127
+ start_weight: z.ZodNumber;
128
+ email_confirmation_status: z.ZodString;
129
+ newsletter_opt_in: z.ZodBoolean;
130
+ login_type: z.ZodString;
131
+ siwa_user_id: z.ZodNullable<z.ZodString>;
132
+ uuid: z.ZodString;
133
+ reset_date: z.ZodNullable<z.ZodString>;
134
+ activity_degree: z.ZodString;
135
+ stripe_customer_id: z.ZodNullable<z.ZodString>;
136
+ }, z.core.$loose>;
137
+ export declare const UserSettingsSchema: z.ZodObject<{
138
+ has_water_tracker: z.ZodBoolean;
139
+ has_diary_tipps: z.ZodBoolean;
140
+ has_meal_reminders: z.ZodBoolean;
141
+ has_usage_reminders: z.ZodBoolean;
142
+ has_weight_reminders: z.ZodBoolean;
143
+ has_water_reminders: z.ZodBoolean;
144
+ consume_activity_calories: z.ZodBoolean;
145
+ has_feelings: z.ZodBoolean;
146
+ has_fasting_tracker_reminders: z.ZodBoolean;
147
+ has_fasting_stage_reminders: z.ZodBoolean;
148
+ }, z.core.$loose>;
149
+ export declare const DietaryPreferencesSchema: z.ZodObject<{
150
+ restriction: z.ZodNullable<z.ZodString>;
151
+ }, z.core.$loose>;
152
+ export declare const GoalsSchema: z.ZodObject<{
153
+ 'energy.energy': z.ZodNumber;
154
+ 'nutrient.protein': z.ZodNumber;
155
+ 'nutrient.fat': z.ZodNumber;
156
+ 'nutrient.carb': z.ZodNumber;
157
+ 'activity.step': z.ZodNumber;
158
+ 'bodyvalue.weight': z.ZodNumber;
159
+ water: z.ZodNumber;
160
+ }, z.core.$loose>;
161
+ export declare const DailySummarySchema: z.ZodObject<{
162
+ activity_energy: z.ZodNumber;
163
+ consume_activity_energy: z.ZodBoolean;
164
+ steps: z.ZodNumber;
165
+ water_intake: z.ZodNumber;
166
+ goals: z.ZodObject<{
167
+ 'energy.energy': z.ZodNumber;
168
+ 'nutrient.protein': z.ZodNumber;
169
+ 'nutrient.fat': z.ZodNumber;
170
+ 'nutrient.carb': z.ZodNumber;
171
+ 'activity.step': z.ZodNumber;
172
+ 'bodyvalue.weight': z.ZodNumber;
173
+ water: z.ZodNumber;
174
+ }, z.core.$loose>;
175
+ units: z.ZodObject<{
176
+ unit_mass: z.ZodString;
177
+ unit_energy: z.ZodString;
178
+ unit_serving: z.ZodString;
179
+ unit_length: z.ZodString;
180
+ }, z.core.$loose>;
181
+ meals: z.ZodObject<{
182
+ breakfast: z.ZodObject<{
183
+ energy_goal: z.ZodNumber;
184
+ nutrients: z.ZodObject<{
185
+ 'energy.energy': z.ZodNumber;
186
+ 'nutrient.carb': z.ZodNumber;
187
+ 'nutrient.protein': z.ZodNumber;
188
+ 'nutrient.fat': z.ZodNumber;
189
+ }, z.core.$loose>;
190
+ }, z.core.$loose>;
191
+ lunch: z.ZodObject<{
192
+ energy_goal: z.ZodNumber;
193
+ nutrients: z.ZodObject<{
194
+ 'energy.energy': z.ZodNumber;
195
+ 'nutrient.carb': z.ZodNumber;
196
+ 'nutrient.protein': z.ZodNumber;
197
+ 'nutrient.fat': z.ZodNumber;
198
+ }, z.core.$loose>;
199
+ }, z.core.$loose>;
200
+ dinner: z.ZodObject<{
201
+ energy_goal: z.ZodNumber;
202
+ nutrients: z.ZodObject<{
203
+ 'energy.energy': z.ZodNumber;
204
+ 'nutrient.carb': z.ZodNumber;
205
+ 'nutrient.protein': z.ZodNumber;
206
+ 'nutrient.fat': z.ZodNumber;
207
+ }, z.core.$loose>;
208
+ }, z.core.$loose>;
209
+ snack: z.ZodObject<{
210
+ energy_goal: z.ZodNumber;
211
+ nutrients: z.ZodObject<{
212
+ 'energy.energy': z.ZodNumber;
213
+ 'nutrient.carb': z.ZodNumber;
214
+ 'nutrient.protein': z.ZodNumber;
215
+ 'nutrient.fat': z.ZodNumber;
216
+ }, z.core.$loose>;
217
+ }, z.core.$loose>;
218
+ }, z.core.$loose>;
219
+ user: z.ZodObject<{
220
+ start_weight: z.ZodOptional<z.ZodNumber>;
221
+ current_weight: z.ZodOptional<z.ZodNumber>;
222
+ goal: z.ZodOptional<z.ZodString>;
223
+ sex: z.ZodOptional<z.ZodString>;
224
+ }, z.core.$loose>;
225
+ active_fasting_countdown_template_key: z.ZodNullable<z.ZodString>;
226
+ }, z.core.$loose>;
227
+ export declare const WeightEntrySchema: z.ZodObject<{
228
+ id: z.ZodString;
229
+ date: z.ZodString;
230
+ value: z.ZodNullable<z.ZodNumber>;
231
+ external_id: z.ZodNullable<z.ZodString>;
232
+ gateway: z.ZodNullable<z.ZodString>;
233
+ source: z.ZodNullable<z.ZodString>;
234
+ }, z.core.$loose>;
235
+ export declare const ExercisesSchema: z.ZodObject<{
236
+ training: z.ZodArray<z.ZodObject<{
237
+ id: z.ZodString;
238
+ note: z.ZodNullable<z.ZodString>;
239
+ date: z.ZodString;
240
+ name: z.ZodString;
241
+ external_id: z.ZodNullable<z.ZodString>;
242
+ energy: z.ZodNumber;
243
+ distance: z.ZodNumber;
244
+ duration: z.ZodNumber;
245
+ source: z.ZodNullable<z.ZodString>;
246
+ gateway: z.ZodNullable<z.ZodString>;
247
+ steps: z.ZodNumber;
248
+ }, z.core.$loose>>;
249
+ custom_training: z.ZodArray<z.ZodObject<{
250
+ id: z.ZodString;
251
+ note: z.ZodNullable<z.ZodString>;
252
+ date: z.ZodString;
253
+ name: z.ZodString;
254
+ external_id: z.ZodNullable<z.ZodString>;
255
+ energy: z.ZodNumber;
256
+ distance: z.ZodNumber;
257
+ duration: z.ZodNumber;
258
+ source: z.ZodNullable<z.ZodString>;
259
+ gateway: z.ZodNullable<z.ZodString>;
260
+ steps: z.ZodNumber;
261
+ }, z.core.$loose>>;
262
+ }, z.core.$loose>;
263
+ export declare const SuggestedProductsSchema: z.ZodArray<z.ZodObject<{
264
+ product_id: z.ZodString;
265
+ amount: z.ZodNumber;
266
+ serving: z.ZodNullable<z.ZodString>;
267
+ serving_quantity: z.ZodNullable<z.ZodNumber>;
268
+ }, z.core.$loose>>;
269
+ export declare const WaterIntakeSchema: z.ZodObject<{
270
+ water_intake: z.ZodNumber;
271
+ gateway: z.ZodNullable<z.ZodString>;
272
+ source: z.ZodNullable<z.ZodString>;
273
+ }, z.core.$loose>;
274
+ export declare const ConsumedItemsSchema: z.ZodObject<{
275
+ products: z.ZodArray<z.ZodObject<{
276
+ id: z.ZodString;
277
+ date: z.ZodString;
278
+ daytime: z.ZodEnum<{
279
+ breakfast: "breakfast";
280
+ lunch: "lunch";
281
+ dinner: "dinner";
282
+ snack: "snack";
283
+ }>;
284
+ type: z.ZodString;
285
+ product_id: z.ZodString;
286
+ amount: z.ZodNumber;
287
+ serving: z.ZodNullable<z.ZodString>;
288
+ serving_quantity: z.ZodNullable<z.ZodNumber>;
289
+ }, z.core.$loose>>;
290
+ recipe_portions: z.ZodArray<z.ZodObject<{
291
+ id: z.ZodString;
292
+ date: z.ZodString;
293
+ daytime: z.ZodEnum<{
294
+ breakfast: "breakfast";
295
+ lunch: "lunch";
296
+ dinner: "dinner";
297
+ snack: "snack";
298
+ }>;
299
+ type: z.ZodOptional<z.ZodString>;
300
+ recipe_id: z.ZodString;
301
+ portion_count: z.ZodNumber;
302
+ }, z.core.$loose>>;
303
+ simple_products: z.ZodArray<z.ZodObject<{
304
+ id: z.ZodString;
305
+ date: z.ZodString;
306
+ daytime: z.ZodEnum<{
307
+ breakfast: "breakfast";
308
+ lunch: "lunch";
309
+ dinner: "dinner";
310
+ snack: "snack";
311
+ }>;
312
+ type: z.ZodOptional<z.ZodString>;
313
+ name: z.ZodString;
314
+ nutrients: z.ZodRecord<z.ZodString, z.ZodNumber>;
315
+ is_ai_generated: z.ZodOptional<z.ZodBoolean>;
316
+ }, z.core.$loose>>;
317
+ }, z.core.$loose>;
318
+ export declare const ProductSearchResultsSchema: z.ZodArray<z.ZodObject<{
319
+ score: z.ZodNumber;
320
+ name: z.ZodString;
321
+ product_id: z.ZodString;
322
+ serving: z.ZodString;
323
+ serving_quantity: z.ZodNumber;
324
+ amount: z.ZodNumber;
325
+ base_unit: z.ZodString;
326
+ producer: z.ZodNullable<z.ZodString>;
327
+ is_verified: z.ZodBoolean;
328
+ nutrients: z.ZodObject<{
329
+ 'energy.energy': z.ZodNumber;
330
+ 'nutrient.carb': z.ZodNumber;
331
+ 'nutrient.protein': z.ZodNumber;
332
+ 'nutrient.fat': z.ZodNumber;
333
+ }, z.core.$loose>;
334
+ countries: z.ZodArray<z.ZodString>;
335
+ language: z.ZodString;
336
+ }, z.core.$loose>>;
337
+ export declare const ProductSchema: z.ZodObject<{
338
+ id: z.ZodString;
339
+ name: z.ZodString;
340
+ is_verified: z.ZodBoolean;
341
+ is_private: z.ZodBoolean;
342
+ is_deleted: z.ZodBoolean;
343
+ has_ean: z.ZodBoolean;
344
+ category: z.ZodString;
345
+ producer: z.ZodNullable<z.ZodString>;
346
+ nutrients: z.ZodObject<{
347
+ 'energy.energy': z.ZodNumber;
348
+ 'nutrient.carb': z.ZodNumber;
349
+ 'nutrient.protein': z.ZodNumber;
350
+ 'nutrient.fat': z.ZodNumber;
351
+ 'mineral.calcium': z.ZodOptional<z.ZodNumber>;
352
+ 'mineral.chlorine': z.ZodOptional<z.ZodNumber>;
353
+ 'mineral.copper': z.ZodOptional<z.ZodNumber>;
354
+ 'mineral.fluorine': z.ZodOptional<z.ZodNumber>;
355
+ 'mineral.iron': z.ZodOptional<z.ZodNumber>;
356
+ 'mineral.magnesium': z.ZodOptional<z.ZodNumber>;
357
+ 'mineral.manganese': z.ZodOptional<z.ZodNumber>;
358
+ 'mineral.phosphorus': z.ZodOptional<z.ZodNumber>;
359
+ 'mineral.potassium': z.ZodOptional<z.ZodNumber>;
360
+ 'mineral.sulfur': z.ZodOptional<z.ZodNumber>;
361
+ 'mineral.zinc': z.ZodOptional<z.ZodNumber>;
362
+ 'nutrient.dietaryfiber': z.ZodOptional<z.ZodNumber>;
363
+ 'nutrient.sugar': z.ZodOptional<z.ZodNumber>;
364
+ 'vitamin.a': z.ZodOptional<z.ZodNumber>;
365
+ 'vitamin.b1': z.ZodOptional<z.ZodNumber>;
366
+ 'vitamin.b12': z.ZodOptional<z.ZodNumber>;
367
+ 'vitamin.b2': z.ZodOptional<z.ZodNumber>;
368
+ 'vitamin.b6': z.ZodOptional<z.ZodNumber>;
369
+ 'vitamin.d': z.ZodOptional<z.ZodNumber>;
370
+ 'vitamin.e': z.ZodOptional<z.ZodNumber>;
371
+ }, z.core.$loose>;
372
+ updated_at: z.ZodString;
373
+ servings: z.ZodArray<z.ZodObject<{
374
+ serving: z.ZodString;
375
+ amount: z.ZodNumber;
376
+ }, z.core.$loose>>;
377
+ base_unit: z.ZodString;
378
+ eans: z.ZodArray<z.ZodString>;
379
+ language: z.ZodString;
380
+ countries: z.ZodArray<z.ZodString>;
381
+ }, z.core.$loose>;
382
+ export declare const RecipeSchema: z.ZodObject<{
383
+ id: z.ZodString;
384
+ yazio_id: z.ZodNullable<z.ZodString>;
385
+ locale: z.ZodString;
386
+ name: z.ZodString;
387
+ portion_count: z.ZodNumber;
388
+ nutrients: z.ZodRecord<z.ZodString, z.ZodNumber>;
389
+ image: z.ZodNullable<z.ZodString>;
390
+ instructions: z.ZodArray<z.ZodString>;
391
+ is_yazio_recipe: z.ZodBoolean;
392
+ available_since: z.ZodNullable<z.ZodString>;
393
+ is_pro_recipe: z.ZodBoolean;
394
+ servings: z.ZodArray<z.ZodObject<{
395
+ producer: z.ZodNullable<z.ZodString>;
396
+ name: z.ZodString;
397
+ amount: z.ZodNumber;
398
+ base_unit: z.ZodString;
399
+ serving: z.ZodNullable<z.ZodString>;
400
+ serving_quantity: z.ZodNullable<z.ZodNumber>;
401
+ note: z.ZodNullable<z.ZodString>;
402
+ product_id: z.ZodString;
403
+ }, z.core.$loose>>;
404
+ }, z.core.$loose>;
405
+ export declare const RecipeIdsSchema: z.ZodArray<z.ZodString>;
406
+ export declare const FeelingSchema: z.ZodObject<{
407
+ note: z.ZodNullable<z.ZodString>;
408
+ tags: z.ZodArray<z.ZodString>;
409
+ }, z.core.$loose>;
@@ -0,0 +1,104 @@
1
+ import type * as z from 'zod';
2
+ import type * as S from './schemas.js';
3
+ export type YazioUserInfo = z.infer<typeof S.UserSchema>;
4
+ export type YazioSettings = z.infer<typeof S.UserSettingsSchema>;
5
+ export type YazioDietaryPreferences = z.infer<typeof S.DietaryPreferencesSchema>;
6
+ export type YazioGoals = z.infer<typeof S.GoalsSchema>;
7
+ export type YazioDailySummary = z.infer<typeof S.DailySummarySchema>;
8
+ export type YazioWeightEntry = z.infer<typeof S.WeightEntrySchema>;
9
+ export type YazioExercises = z.infer<typeof S.ExercisesSchema>;
10
+ export type YazioSuggestedProduct = z.infer<typeof S.SuggestedProductsSchema>[number];
11
+ export type YazioWaterIntake = z.infer<typeof S.WaterIntakeSchema>;
12
+ export type YazioConsumedItems = z.infer<typeof S.ConsumedItemsSchema>;
13
+ export type YazioProductSearchResult = z.infer<typeof S.ProductSearchResultsSchema>[number];
14
+ export type YazioProduct = z.infer<typeof S.ProductSchema>;
15
+ export type YazioRecipe = z.infer<typeof S.RecipeSchema>;
16
+ export type YazioFeeling = z.infer<typeof S.FeelingSchema>;
17
+ export type Daytime = z.infer<typeof S.DaytimeSchema>;
18
+ /** "YYYY-MM-DD" or "YYYY-MM-DD HH:mm:ss" (local time, sent as is) */
19
+ export type YazioDateTime = string;
20
+ /** "YYYY-MM-DD HH:mm:ss" */
21
+ export type DateTimeString = `${string}-${string}-${string} ${string}:${string}:${string}`;
22
+ interface ConsumedProductBase {
23
+ id: string;
24
+ product_id: string;
25
+ date: YazioDateTime;
26
+ daytime: Daytime;
27
+ amount: number;
28
+ }
29
+ export type ConsumedProductDto = (ConsumedProductBase & {
30
+ serving: string;
31
+ serving_quantity: number;
32
+ }) | (ConsumedProductBase & {
33
+ serving?: undefined;
34
+ serving_quantity?: undefined;
35
+ });
36
+ export interface ConsumedRecipePortionDto {
37
+ id: string;
38
+ recipe_id: string;
39
+ date: YazioDateTime;
40
+ daytime: Daytime;
41
+ portion_count: number;
42
+ }
43
+ export interface ConsumedSimpleProductDto {
44
+ id: string;
45
+ date: YazioDateTime;
46
+ daytime: Daytime;
47
+ name: string;
48
+ nutrients: Record<string, number>;
49
+ }
50
+ export interface AddConsumedItemsDto {
51
+ products?: ConsumedProductDto[];
52
+ simple_products?: ConsumedSimpleProductDto[];
53
+ recipe_portions?: ConsumedRecipePortionDto[];
54
+ }
55
+ export interface CreateProductDto {
56
+ id: string;
57
+ name: string;
58
+ category: z.infer<typeof S.ProductCategorySchema>;
59
+ base_unit: 'g' | 'ml';
60
+ is_private: boolean;
61
+ /** Per 1 g/ml of the base unit */
62
+ nutrients: Record<string, number>;
63
+ servings: {
64
+ serving: z.infer<typeof S.ServingNameSchema>;
65
+ amount: number;
66
+ }[];
67
+ producer: string | null;
68
+ }
69
+ export interface CreateUserRecipeDto {
70
+ id: string;
71
+ name: string;
72
+ portion_count: number;
73
+ /** Per portion; energy.energy, nutrient.fat, nutrient.protein and nutrient.carb are required */
74
+ nutrients: Record<string, number>;
75
+ /** At least 2 */
76
+ servings: {
77
+ product_id: string;
78
+ name: string;
79
+ producer: string | null;
80
+ amount: number;
81
+ base_unit: string;
82
+ serving: string | null;
83
+ serving_quantity: number | null;
84
+ }[];
85
+ instructions: string[];
86
+ }
87
+ /**
88
+ * POST /user/water-intake, found in https://github.com/juriadams/yazio/issues/3:
89
+ * - the body is a bare array of entries, not wrapped in an object;
90
+ * - `date` must include the time ("YYYY-MM-DD HH:mm:ss"), a date alone is rejected;
91
+ * - `water_intake` is a number in ml (not "250ml") and cumulative: the day's total at that time,
92
+ * so the last entry of a day is its total.
93
+ */
94
+ export interface WaterIntakeEntry {
95
+ date: DateTimeString;
96
+ water_intake: number;
97
+ }
98
+ export interface ProductSearchOptions {
99
+ query: string;
100
+ sex?: 'male' | 'female';
101
+ countries?: string[];
102
+ locales?: string[];
103
+ }
104
+ export {};