@tbs-fitness/contract 0.10.0 → 0.12.0

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 (48) hide show
  1. package/README.md +36 -10
  2. package/dist/cjs/documents/document.dto.d.ts +105 -0
  3. package/dist/cjs/documents/document.dto.js +73 -0
  4. package/dist/cjs/documents/index.d.ts +1 -0
  5. package/dist/cjs/documents/index.js +17 -0
  6. package/dist/cjs/enums/index.d.ts +85 -0
  7. package/dist/cjs/enums/index.js +180 -1
  8. package/dist/cjs/meals/index.d.ts +1 -0
  9. package/dist/cjs/meals/index.js +17 -0
  10. package/dist/cjs/meals/meal.dto.d.ts +143 -0
  11. package/dist/cjs/meals/meal.dto.js +107 -0
  12. package/dist/cjs/nutrition-plans/index.d.ts +2 -0
  13. package/dist/cjs/nutrition-plans/index.js +18 -0
  14. package/dist/cjs/nutrition-plans/nutrition-math.d.ts +115 -0
  15. package/dist/cjs/nutrition-plans/nutrition-math.js +278 -0
  16. package/dist/cjs/nutrition-plans/nutrition-plan.dto.d.ts +914 -0
  17. package/dist/cjs/nutrition-plans/nutrition-plan.dto.js +289 -0
  18. package/dist/cjs/onboarding/index.d.ts +2 -0
  19. package/dist/cjs/onboarding/index.js +18 -0
  20. package/dist/cjs/onboarding/onboarding-steps.d.ts +270 -0
  21. package/dist/cjs/onboarding/onboarding-steps.js +265 -0
  22. package/dist/cjs/onboarding/onboarding.dto.d.ts +1497 -0
  23. package/dist/cjs/onboarding/onboarding.dto.js +81 -0
  24. package/dist/cjs/supplements/supplement.dto.d.ts +1 -1
  25. package/dist/esm/documents/document.dto.d.ts +105 -0
  26. package/dist/esm/documents/document.dto.js +70 -0
  27. package/dist/esm/documents/index.d.ts +1 -0
  28. package/dist/esm/documents/index.js +1 -0
  29. package/dist/esm/enums/index.d.ts +85 -0
  30. package/dist/esm/enums/index.js +178 -0
  31. package/dist/esm/meals/index.d.ts +1 -0
  32. package/dist/esm/meals/index.js +1 -0
  33. package/dist/esm/meals/meal.dto.d.ts +143 -0
  34. package/dist/esm/meals/meal.dto.js +103 -0
  35. package/dist/esm/nutrition-plans/index.d.ts +2 -0
  36. package/dist/esm/nutrition-plans/index.js +2 -0
  37. package/dist/esm/nutrition-plans/nutrition-math.d.ts +115 -0
  38. package/dist/esm/nutrition-plans/nutrition-math.js +261 -0
  39. package/dist/esm/nutrition-plans/nutrition-plan.dto.d.ts +914 -0
  40. package/dist/esm/nutrition-plans/nutrition-plan.dto.js +286 -0
  41. package/dist/esm/onboarding/index.d.ts +2 -0
  42. package/dist/esm/onboarding/index.js +2 -0
  43. package/dist/esm/onboarding/onboarding-steps.d.ts +270 -0
  44. package/dist/esm/onboarding/onboarding-steps.js +252 -0
  45. package/dist/esm/onboarding/onboarding.dto.d.ts +1497 -0
  46. package/dist/esm/onboarding/onboarding.dto.js +78 -0
  47. package/dist/esm/supplements/supplement.dto.d.ts +1 -1
  48. package/package.json +43 -3
package/README.md CHANGED
@@ -6,16 +6,18 @@ It is published as `@tbs-fitness/contract`. The package holds definitions only:
6
6
 
7
7
  ## What is in it
8
8
 
9
- | Import | Contents |
10
- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
- | `@tbs-fitness/contract/enums` | `ROLES`, `PERMISSIONS`, `CSRF_COOKIE_NAMES`, `CSRF_HEADER`, `ACCOUNT_STATUSES`, `TOKEN_TRANSPORTS`, `AUDIT_OUTCOMES`, `APP_ENVIRONMENTS`, `FEATURE_FLAG_RULE_TYPES` and their types |
12
- | `@tbs-fitness/contract/common` | Pagination, response envelopes (`{ data }`, `{ data, meta }`, `{ error }`), `emailSchema`, `phoneSchema`, `safeTextSchema` |
13
- | `@tbs-fitness/contract/auth` | Login, sessions, password changes and resets, account administration |
14
- | `@tbs-fitness/contract/client` | Client sign-up, one-time code verification and resend, client sign-in and profile, password recovery |
15
- | `@tbs-fitness/contract/coach` | Coach sign-up, one-time code verification and resend, coach sign-in and profile, password recovery |
16
- | `@tbs-fitness/contract/audit` | The audit log query and response |
17
- | `@tbs-fitness/contract/feature-flags` | Feature flag requests and responses |
18
- | `@tbs-fitness/contract/food` | Food library, metadata, CSV/XLSX import, client food suggestions and their review, and the shared nutrition helpers |
9
+ | Import | Contents |
10
+ | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
+ | `@tbs-fitness/contract/enums` | `ROLES`, `PERMISSIONS`, `CSRF_COOKIE_NAMES`, `CSRF_HEADER`, `ACCOUNT_STATUSES`, `TOKEN_TRANSPORTS`, `AUDIT_OUTCOMES`, `APP_ENVIRONMENTS`, `FEATURE_FLAG_RULE_TYPES` and their types |
12
+ | `@tbs-fitness/contract/common` | Pagination, response envelopes (`{ data }`, `{ data, meta }`, `{ error }`), `emailSchema`, `phoneSchema`, `safeTextSchema` |
13
+ | `@tbs-fitness/contract/auth` | Login, sessions, password changes and resets, account administration |
14
+ | `@tbs-fitness/contract/client` | Client sign-up, one-time code verification and resend, client sign-in and profile, password recovery |
15
+ | `@tbs-fitness/contract/coach` | Coach sign-up, one-time code verification and resend, coach sign-in and profile, password recovery |
16
+ | `@tbs-fitness/contract/audit` | The audit log query and response |
17
+ | `@tbs-fitness/contract/feature-flags` | Feature flag requests and responses |
18
+ | `@tbs-fitness/contract/food` | Food library, metadata, CSV/XLSX import, client food suggestions and their review, and the shared nutrition helpers |
19
+ | `@tbs-fitness/contract/meals` | The meal library: meals of library foods with servings, and their totals |
20
+ | `@tbs-fitness/contract/nutrition-plans` | Nutrition plans: drafts, publishing, a client's active plan, the Snapshot step, and the builder's shared sums and publish rules |
19
21
 
20
22
  Each domain has its own entry point, so names only need to be unique within a domain. `auditLogResponseSchema`, for example, exists in both `/audit` and `/feature-flags`.
21
23
 
@@ -43,6 +45,30 @@ const result = createFlagSchema.safeParse(input); // The same rules as the API.
43
45
 
44
46
  Requests have two types. Clients use `*Input`, where fields with a default are optional. The backend uses `*Body`, which is the result after validation. List queries come from the URL as strings, so they have no `*Input`: use `Partial<PaginationQuery>` or `Partial<AuditLogQuery>`.
45
47
 
48
+ ## Version 0.12.0
49
+
50
+ The meal library and nutrition plans for the Nutrition Plan Builder. Additive; consumers install `^0.12.0` explicitly.
51
+
52
+ - New `/meals`: `createMealSchema`, `updateMealSchema` (with `version`), `mealListQuerySchema`, `mealResponseSchema` (items with per-serving values and totals), `foodPortionSchema`, `servingsSchema` (0.5 to 10 in half steps), `macroTotalsSchema`, `normalizeMealName`.
53
+ - New `/nutrition-plans`:
54
+ - Requests: `createNutritionPlanSchema` (optional `fromPlanId`), `saveNutritionPlanSchema` (the whole plan with `version`; a half-built plan is valid), `publishNutritionPlanSchema` (`version`, optional `startsOn`), `nutritionPlanListQuerySchema`, `NUTRITION_PLAN_LIMITS`.
55
+ - Responses: `nutritionPlanResponseSchema` (with `dailyCalories`, `targets`, `dayTotals` and `publishIssues`), `currentNutritionPlansResponseSchema`, `nutritionPlanSummarySchema`, `clientNutritionPlanResponseSchema`, `nutritionPlanSnapshotResponseSchema`.
56
+ - Sums and rules shared with the builder: `NUTRITION_GUIDELINES`, `guidelineForGoalIcon`, `dailyCalories`, `macroTargets`, `recommendedWaterMl`, `defaultSlots`, `macroKcal`, `slotTargetKcal`, `addTotals`, `scaleTotals`, and `nutritionPlanPublishIssues` with `PUBLISH_ISSUE_CODES`.
57
+ - `/enums`: `MEAL_SORT_FIELDS`, `NUTRITION_PLAN_STATUSES`, `PLAN_SLOT_KINDS`, `PLAN_PHASES`, `PLAN_BLOCK_WEEKS`, `CHEAT_MEAL_PERIODS`, `NUTRITION_GUIDELINE_IDS`, and the permissions `meals:read`, `meals:create`, `meals:update`, `meals:delete`, `nutrition_plans:read`, `nutrition_plans:write`, `nutrition_plans:publish` and `nutrition_plans:read:self`.
58
+
59
+ ## Version 0.11.0
60
+
61
+ Client onboarding and generic documents. Additive; consumers install `^0.11.0` explicitly.
62
+
63
+ - New `/documents`: `documentUploadRequestSchema` (checked against `DOCUMENT_LIMITS` per type), `documentUploadResponseSchema` (the document and a signed PUT), `documentResponseSchema` (never a link to the file), `documentViewUrlResponseSchema` (a short-lived link per view).
64
+ - New `/onboarding`:
65
+ - Steps: `ONBOARDING_STEP_SCHEMAS` (one per step), `ONBOARDING_FLOW` (order, section, optional), `ONBOARDING_LIMITS`, `localTimeSchema`.
66
+ - Library picks: `goalChoiceSchema`, `supplementChoiceSchema` and `foodChoiceSchema`; an id of `null` means a typed entry.
67
+ - Helpers: `nextOnboardingStep`, `missingOnboardingSteps`, `onboardingProgress`, `onboardingSections`, `normalizeItemName`, and the cm/ft-in and kg/lb conversions.
68
+ - Requests: `saveOnboardingStepSchema` (an answer or a skip, with `version` and `mode`), `onboardingVersionSchema`, `updatePlanDueSchema`.
69
+ - Responses: `onboardingDraftSchema`, `onboardingStateResponseSchema`, `onboardingSubmissionResponseSchema`, `coachOnboardingResponseSchema`.
70
+ - `/enums`: `DOCUMENT_TYPES`, `DOCUMENT_STATUSES`, `ONBOARDING_STATUSES`, `ONBOARDING_STEPS`, `ONBOARDING_SECTIONS`, the answer enums (`GENDERS`, `EXPERIENCE_LEVELS`, `TRAINING_TIMES`, `WEEKDAYS`, `SESSION_LENGTHS`, `ACTIVITY_LEVELS`, `DIET_TYPES`, `ALLERGENS`, `WATER_INTAKES`, `ANABOLIC_USE`, `BODY_AREAS`, `SLEEP_DURATIONS`, `DIGESTION_QUALITIES`, `REFLUX_FREQUENCIES`, `DIGESTIVE_SYMPTOMS`, `KIDNEY_TEST_ANSWERS`, `HEIGHT_UNITS`, `WEIGHT_UNITS`), and the permissions `documents:write:self`, `documents:read:self`, `documents:read:assigned` and `documents:read:any`.
71
+
46
72
  ## Version 0.10.0
47
73
 
48
74
  The supplement library. Additive; consumers install `^0.10.0` explicitly.
@@ -0,0 +1,105 @@
1
+ import { z } from 'zod';
2
+ /** What each document type may be, so the upload screen can say it up front. */
3
+ export declare const DOCUMENT_LIMITS: {
4
+ readonly PROGRESS_PHOTO_FRONT: {
5
+ readonly contentTypes: readonly ["image/jpeg", "image/png", "image/webp"];
6
+ readonly maxBytes: number;
7
+ };
8
+ readonly PROGRESS_PHOTO_BACK: {
9
+ readonly contentTypes: readonly ["image/jpeg", "image/png", "image/webp"];
10
+ readonly maxBytes: number;
11
+ };
12
+ readonly PROGRESS_PHOTO_SIDE: {
13
+ readonly contentTypes: readonly ["image/jpeg", "image/png", "image/webp"];
14
+ readonly maxBytes: number;
15
+ };
16
+ readonly BLOODWORK_REPORT: {
17
+ readonly contentTypes: readonly ["application/pdf", "image/jpeg", "image/png"];
18
+ readonly maxBytes: number;
19
+ };
20
+ readonly OTHER: {
21
+ readonly contentTypes: readonly ["application/pdf", "image/jpeg", "image/png"];
22
+ readonly maxBytes: number;
23
+ };
24
+ };
25
+ export declare const documentIdParamSchema: z.ZodUUID;
26
+ /** Asks for an upload link. The content type and size are signed into it. */
27
+ export declare const documentUploadRequestSchema: z.ZodObject<{
28
+ documentType: z.ZodEnum<{
29
+ PROGRESS_PHOTO_FRONT: "PROGRESS_PHOTO_FRONT";
30
+ PROGRESS_PHOTO_BACK: "PROGRESS_PHOTO_BACK";
31
+ PROGRESS_PHOTO_SIDE: "PROGRESS_PHOTO_SIDE";
32
+ BLOODWORK_REPORT: "BLOODWORK_REPORT";
33
+ OTHER: "OTHER";
34
+ }>;
35
+ contentType: z.ZodString;
36
+ sizeBytes: z.ZodNumber;
37
+ }, z.core.$strict>;
38
+ export type DocumentUploadInput = z.input<typeof documentUploadRequestSchema>;
39
+ export type DocumentUploadBody = z.output<typeof documentUploadRequestSchema>;
40
+ /** A stored document. Never carries a link to the file. */
41
+ export declare const documentResponseSchema: z.ZodObject<{
42
+ id: z.ZodUUID;
43
+ userId: z.ZodUUID;
44
+ userRole: z.ZodEnum<{
45
+ ADMIN: "ADMIN";
46
+ COACH: "COACH";
47
+ CLIENT: "CLIENT";
48
+ }>;
49
+ documentType: z.ZodEnum<{
50
+ PROGRESS_PHOTO_FRONT: "PROGRESS_PHOTO_FRONT";
51
+ PROGRESS_PHOTO_BACK: "PROGRESS_PHOTO_BACK";
52
+ PROGRESS_PHOTO_SIDE: "PROGRESS_PHOTO_SIDE";
53
+ BLOODWORK_REPORT: "BLOODWORK_REPORT";
54
+ OTHER: "OTHER";
55
+ }>;
56
+ contentType: z.ZodString;
57
+ sizeBytes: z.ZodNumber;
58
+ status: z.ZodEnum<{
59
+ PENDING: "PENDING";
60
+ UPLOADED: "UPLOADED";
61
+ }>;
62
+ createdAt: z.ZodISODateTime;
63
+ confirmedAt: z.ZodNullable<z.ZodISODateTime>;
64
+ }, z.core.$strip>;
65
+ export type DocumentResponse = z.output<typeof documentResponseSchema>;
66
+ /** Where to PUT the file. Send exactly these headers, before `expiresAt`. */
67
+ export declare const documentUploadResponseSchema: z.ZodObject<{
68
+ document: z.ZodObject<{
69
+ id: z.ZodUUID;
70
+ userId: z.ZodUUID;
71
+ userRole: z.ZodEnum<{
72
+ ADMIN: "ADMIN";
73
+ COACH: "COACH";
74
+ CLIENT: "CLIENT";
75
+ }>;
76
+ documentType: z.ZodEnum<{
77
+ PROGRESS_PHOTO_FRONT: "PROGRESS_PHOTO_FRONT";
78
+ PROGRESS_PHOTO_BACK: "PROGRESS_PHOTO_BACK";
79
+ PROGRESS_PHOTO_SIDE: "PROGRESS_PHOTO_SIDE";
80
+ BLOODWORK_REPORT: "BLOODWORK_REPORT";
81
+ OTHER: "OTHER";
82
+ }>;
83
+ contentType: z.ZodString;
84
+ sizeBytes: z.ZodNumber;
85
+ status: z.ZodEnum<{
86
+ PENDING: "PENDING";
87
+ UPLOADED: "UPLOADED";
88
+ }>;
89
+ createdAt: z.ZodISODateTime;
90
+ confirmedAt: z.ZodNullable<z.ZodISODateTime>;
91
+ }, z.core.$strip>;
92
+ upload: z.ZodObject<{
93
+ url: z.ZodURL;
94
+ method: z.ZodLiteral<"PUT">;
95
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
96
+ expiresAt: z.ZodISODateTime;
97
+ }, z.core.$strip>;
98
+ }, z.core.$strip>;
99
+ export type DocumentUploadResponse = z.output<typeof documentUploadResponseSchema>;
100
+ /** A short-lived link to view or download a document. Ask again after it expires. */
101
+ export declare const documentViewUrlResponseSchema: z.ZodObject<{
102
+ url: z.ZodURL;
103
+ expiresAt: z.ZodISODateTime;
104
+ }, z.core.$strip>;
105
+ export type DocumentViewUrlResponse = z.output<typeof documentViewUrlResponseSchema>;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.documentViewUrlResponseSchema = exports.documentUploadResponseSchema = exports.documentResponseSchema = exports.documentUploadRequestSchema = exports.documentIdParamSchema = exports.DOCUMENT_LIMITS = void 0;
4
+ const zod_1 = require("zod");
5
+ const date_time_schema_js_1 = require("../common/date-time.schema.js");
6
+ const index_js_1 = require("../enums/index.js");
7
+ // A document is any file the app keeps for a user: progress photos, reports and
8
+ // more. The file itself lives in private storage. The API never stores or
9
+ // returns a lasting link: each view asks for a fresh one that expires quickly.
10
+ const MB = 1024 * 1024;
11
+ const PHOTO_TYPES = ['image/jpeg', 'image/png', 'image/webp'];
12
+ const REPORT_TYPES = ['application/pdf', 'image/jpeg', 'image/png'];
13
+ /** What each document type may be, so the upload screen can say it up front. */
14
+ exports.DOCUMENT_LIMITS = {
15
+ PROGRESS_PHOTO_FRONT: { contentTypes: PHOTO_TYPES, maxBytes: 10 * MB },
16
+ PROGRESS_PHOTO_BACK: { contentTypes: PHOTO_TYPES, maxBytes: 10 * MB },
17
+ PROGRESS_PHOTO_SIDE: { contentTypes: PHOTO_TYPES, maxBytes: 10 * MB },
18
+ BLOODWORK_REPORT: { contentTypes: REPORT_TYPES, maxBytes: 10 * MB },
19
+ OTHER: { contentTypes: REPORT_TYPES, maxBytes: 10 * MB },
20
+ };
21
+ exports.documentIdParamSchema = zod_1.z.uuid();
22
+ /** Asks for an upload link. The content type and size are signed into it. */
23
+ exports.documentUploadRequestSchema = zod_1.z
24
+ .strictObject({
25
+ documentType: zod_1.z.enum(index_js_1.DOCUMENT_TYPES),
26
+ contentType: zod_1.z.string().trim().toLowerCase(),
27
+ sizeBytes: zod_1.z.number().int().positive(),
28
+ })
29
+ .superRefine((body, ctx) => {
30
+ const limits = exports.DOCUMENT_LIMITS[body.documentType];
31
+ if (!limits.contentTypes.includes(body.contentType)) {
32
+ ctx.addIssue({
33
+ code: 'custom',
34
+ path: ['contentType'],
35
+ message: `Upload one of: ${limits.contentTypes.join(', ')}`,
36
+ });
37
+ }
38
+ if (body.sizeBytes > limits.maxBytes) {
39
+ ctx.addIssue({
40
+ code: 'custom',
41
+ path: ['sizeBytes'],
42
+ message: `The file is larger than ${String(limits.maxBytes / MB)} MB`,
43
+ });
44
+ }
45
+ });
46
+ // Responses
47
+ /** A stored document. Never carries a link to the file. */
48
+ exports.documentResponseSchema = zod_1.z.object({
49
+ id: zod_1.z.uuid(),
50
+ userId: zod_1.z.uuid(),
51
+ userRole: zod_1.z.enum(index_js_1.ROLES),
52
+ documentType: zod_1.z.enum(index_js_1.DOCUMENT_TYPES),
53
+ contentType: zod_1.z.string(),
54
+ sizeBytes: zod_1.z.number().int(),
55
+ status: zod_1.z.enum(index_js_1.DOCUMENT_STATUSES),
56
+ createdAt: date_time_schema_js_1.utcTimestampSchema,
57
+ confirmedAt: date_time_schema_js_1.utcTimestampSchema.nullable(),
58
+ });
59
+ /** Where to PUT the file. Send exactly these headers, before `expiresAt`. */
60
+ exports.documentUploadResponseSchema = zod_1.z.object({
61
+ document: exports.documentResponseSchema,
62
+ upload: zod_1.z.object({
63
+ url: zod_1.z.url(),
64
+ method: zod_1.z.literal('PUT'),
65
+ headers: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
66
+ expiresAt: date_time_schema_js_1.utcTimestampSchema,
67
+ }),
68
+ });
69
+ /** A short-lived link to view or download a document. Ask again after it expires. */
70
+ exports.documentViewUrlResponseSchema = zod_1.z.object({
71
+ url: zod_1.z.url(),
72
+ expiresAt: date_time_schema_js_1.utcTimestampSchema,
73
+ });
@@ -0,0 +1 @@
1
+ export * from './document.dto.js';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./document.dto.js"), exports);
@@ -44,6 +44,18 @@ export declare const PERMISSIONS: {
44
44
  readonly supplementsImport: "supplements:import";
45
45
  readonly supplementMetadataManage: "supplement_metadata:manage";
46
46
  readonly supplementsSearchSelf: "supplements:search:self";
47
+ readonly documentsWriteSelf: "documents:write:self";
48
+ readonly documentsReadSelf: "documents:read:self";
49
+ readonly documentsReadAssigned: "documents:read:assigned";
50
+ readonly documentsReadAny: "documents:read:any";
51
+ readonly mealsRead: "meals:read";
52
+ readonly mealsCreate: "meals:create";
53
+ readonly mealsUpdate: "meals:update";
54
+ readonly mealsDelete: "meals:delete";
55
+ readonly nutritionPlansRead: "nutrition_plans:read";
56
+ readonly nutritionPlansWrite: "nutrition_plans:write";
57
+ readonly nutritionPlansPublish: "nutrition_plans:publish";
58
+ readonly nutritionPlansReadSelf: "nutrition_plans:read:self";
47
59
  };
48
60
  export type Permission = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
49
61
  /**
@@ -147,3 +159,76 @@ export type GoalSortField = (typeof GOAL_SORT_FIELDS)[number];
147
159
  /** Where a supplement came from. Clients cannot suggest supplements, unlike foods. */
148
160
  export declare const SUPPLEMENT_SOURCES: readonly ["ADMIN", "COACH", "IMPORT"];
149
161
  export type SupplementSource = (typeof SUPPLEMENT_SOURCES)[number];
162
+ /** What a stored file is. Each feature that keeps files adds its own types here. */
163
+ export declare const DOCUMENT_TYPES: readonly ["PROGRESS_PHOTO_FRONT", "PROGRESS_PHOTO_BACK", "PROGRESS_PHOTO_SIDE", "BLOODWORK_REPORT", "OTHER"];
164
+ export type DocumentType = (typeof DOCUMENT_TYPES)[number];
165
+ /** A document is `PENDING` until its upload is confirmed. */
166
+ export declare const DOCUMENT_STATUSES: readonly ["PENDING", "UPLOADED"];
167
+ export type DocumentStatus = (typeof DOCUMENT_STATUSES)[number];
168
+ export declare const ONBOARDING_STATUSES: readonly ["NOT_STARTED", "IN_PROGRESS", "LOCKED", "PLEDGED"];
169
+ export type OnboardingStatus = (typeof ONBOARDING_STATUSES)[number];
170
+ /** Every question step, in the order the client answers them. */
171
+ export declare const ONBOARDING_STEPS: readonly ["name", "age", "gender", "height", "weight", "goal", "level", "schedule", "day", "working_hours", "diet", "fuel", "eating_routine", "supplements", "body", "sleep", "digestion", "photos", "bloodwork", "notes"];
172
+ export type OnboardingStep = (typeof ONBOARDING_STEPS)[number];
173
+ /** The sections of The File, in the order it lists them. */
174
+ export declare const ONBOARDING_SECTIONS: readonly ["basics", "goal_level", "training", "your_day", "sleep", "food_fuel", "body_health", "photos_bloodwork"];
175
+ export type OnboardingSection = (typeof ONBOARDING_SECTIONS)[number];
176
+ export declare const GENDERS: readonly ["MALE", "FEMALE"];
177
+ export type Gender = (typeof GENDERS)[number];
178
+ export declare const EXPERIENCE_LEVELS: readonly ["BEGINNER", "INTERMEDIATE", "ADVANCED"];
179
+ export type ExperienceLevel = (typeof EXPERIENCE_LEVELS)[number];
180
+ export declare const TRAINING_TIMES: readonly ["MORNING", "MIDDAY", "EVENING", "NIGHT"];
181
+ export type TrainingTime = (typeof TRAINING_TIMES)[number];
182
+ export declare const WEEKDAYS: readonly ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"];
183
+ export type Weekday = (typeof WEEKDAYS)[number];
184
+ export declare const SESSION_LENGTHS: readonly ["MIN_30", "MIN_45", "MIN_60", "MIN_90_PLUS"];
185
+ export type SessionLength = (typeof SESSION_LENGTHS)[number];
186
+ export declare const ACTIVITY_LEVELS: readonly ["SEDENTARY", "LIGHTLY_ACTIVE", "MODERATELY_ACTIVE", "VERY_ACTIVE", "PHYSICALLY_DEMANDING"];
187
+ export type ActivityLevel = (typeof ACTIVITY_LEVELS)[number];
188
+ export declare const DIET_TYPES: readonly ["VEGETARIAN", "NON_VEGETARIAN", "EGGETARIAN", "VEGAN"];
189
+ export type DietType = (typeof DIET_TYPES)[number];
190
+ export declare const ALLERGENS: readonly ["PEANUT", "DAIRY", "GLUTEN", "SHELLFISH", "SOY", "EGGS"];
191
+ export type Allergen = (typeof ALLERGENS)[number];
192
+ export declare const WATER_INTAKES: readonly ["UNDER_1L", "L1_TO_2", "L2_TO_3", "OVER_3L"];
193
+ export type WaterIntake = (typeof WATER_INTAKES)[number];
194
+ export declare const ANABOLIC_USE: readonly ["NONE", "PAST", "CURRENT"];
195
+ export type AnabolicUse = (typeof ANABOLIC_USE)[number];
196
+ export declare const BODY_AREAS: readonly ["SHOULDER", "LOWER_BACK", "KNEE", "WRIST_ELBOW", "NECK", "HIP"];
197
+ export type BodyArea = (typeof BODY_AREAS)[number];
198
+ export declare const SLEEP_DURATIONS: readonly ["UNDER_5H", "H5_TO_6", "H6_TO_7", "H7_TO_8", "OVER_8H"];
199
+ export type SleepDuration = (typeof SLEEP_DURATIONS)[number];
200
+ export declare const DIGESTION_QUALITIES: readonly ["GOOD", "AVERAGE", "POOR"];
201
+ export type DigestionQuality = (typeof DIGESTION_QUALITIES)[number];
202
+ export declare const REFLUX_FREQUENCIES: readonly ["NEVER", "OCCASIONALLY", "FREQUENTLY", "DAILY"];
203
+ export type RefluxFrequency = (typeof REFLUX_FREQUENCIES)[number];
204
+ export declare const DIGESTIVE_SYMPTOMS: readonly ["BLOATING", "CONSTIPATION", "GAS", "STOMACH_PAIN", "LOOSE_MOTIONS"];
205
+ export type DigestiveSymptom = (typeof DIGESTIVE_SYMPTOMS)[number];
206
+ export declare const KIDNEY_TEST_ANSWERS: readonly ["YES", "NO", "NOT_SURE"];
207
+ export type KidneyTestAnswer = (typeof KIDNEY_TEST_ANSWERS)[number];
208
+ export declare const HEIGHT_UNITS: readonly ["CM", "FT"];
209
+ export type HeightUnit = (typeof HEIGHT_UNITS)[number];
210
+ export declare const WEIGHT_UNITS: readonly ["KG", "LB"];
211
+ export type WeightUnit = (typeof WEIGHT_UNITS)[number];
212
+ export declare const MEAL_SORT_FIELDS: readonly ["name", "updatedAt"];
213
+ export type MealSortField = (typeof MEAL_SORT_FIELDS)[number];
214
+ /**
215
+ * A plan is built as a `DRAFT`, becomes `ACTIVE` when published, and is
216
+ * `ARCHIVED` when a newer plan replaces it. A client has at most one of each
217
+ * of the first two.
218
+ */
219
+ export declare const NUTRITION_PLAN_STATUSES: readonly ["DRAFT", "ACTIVE", "ARCHIVED"];
220
+ export type NutritionPlanStatus = (typeof NUTRITION_PLAN_STATUSES)[number];
221
+ export declare const PLAN_SLOT_KINDS: readonly ["MEAL", "SHAKE"];
222
+ export type PlanSlotKind = (typeof PLAN_SLOT_KINDS)[number];
223
+ /** The stretch of the training block the calorie base is set for. */
224
+ export declare const PLAN_PHASES: readonly ["WEEKS_1_2", "WEEKS_3_4", "WEEKS_5_6", "WEEKS_7_8"];
225
+ export type PlanPhase = (typeof PLAN_PHASES)[number];
226
+ /** How long a published plan runs, in weeks. */
227
+ export declare const PLAN_BLOCK_WEEKS: readonly [8, 12, 16];
228
+ export type PlanBlockWeeks = (typeof PLAN_BLOCK_WEEKS)[number];
229
+ /** The period a cheat-meal allowance resets over. Unused cheat meals do not carry over. */
230
+ export declare const CHEAT_MEAL_PERIODS: readonly ["WEEK", "TWO_WEEKS", "MONTH"];
231
+ export type CheatMealPeriod = (typeof CHEAT_MEAL_PERIODS)[number];
232
+ /** Starting points for the calorie base: calories per pound and a macro split. */
233
+ export declare const NUTRITION_GUIDELINE_IDS: readonly ["AGGRESSIVE_CUT", "MODERATE_CUT", "MAINTENANCE", "MUSCLE_GAIN", "AGGRESSIVE_BULK"];
234
+ export type NutritionGuidelineId = (typeof NUTRITION_GUIDELINE_IDS)[number];
@@ -2,7 +2,8 @@
2
2
  // These values are stored in the database and sent over the API. Renaming or
3
3
  // removing one is a breaking change, so it needs a major version.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.SUPPLEMENT_SOURCES = exports.GOAL_SORT_FIELDS = exports.GOAL_STATUSES = exports.GOAL_ICONS = exports.SORT_ORDERS = exports.FOOD_SORT_FIELDS = exports.FOOD_METADATA_SELECTIONS = exports.FOOD_IMPORT_ISSUE_SEVERITIES = exports.FOOD_IMPORT_FILE_TYPES = exports.FOOD_IMPORT_ROW_STATUSES = exports.FOOD_IMPORT_STATUSES = exports.FOOD_IMPORT_MODES = exports.FOOD_SUGGESTION_RESOLUTIONS = exports.FOOD_SUGGESTION_STATUSES = exports.NUTRITION_BASES = exports.PORTION_UNITS = exports.SERVING_UNITS = exports.FOOD_SOURCES = exports.TEMPLATE_STATUSES = exports.DELIVERY_STATUSES = exports.MESSAGE_TYPES = exports.COMMUNICATION_CHANNELS = exports.FEATURE_FLAG_RULE_TYPES = exports.AUDIT_OUTCOMES = exports.CSRF_HEADER = exports.CSRF_COOKIE_NAMES = exports.TOKEN_TRANSPORTS = exports.TIMEZONE_SOURCES = exports.ADMIN_SETTABLE_ACCOUNT_STATUSES = exports.ACCOUNT_STATUSES = exports.PERMISSIONS = exports.ROLES = exports.APP_ENVIRONMENTS = void 0;
5
+ exports.SLEEP_DURATIONS = exports.BODY_AREAS = exports.ANABOLIC_USE = exports.WATER_INTAKES = exports.ALLERGENS = exports.DIET_TYPES = exports.ACTIVITY_LEVELS = exports.SESSION_LENGTHS = exports.WEEKDAYS = exports.TRAINING_TIMES = exports.EXPERIENCE_LEVELS = exports.GENDERS = exports.ONBOARDING_SECTIONS = exports.ONBOARDING_STEPS = exports.ONBOARDING_STATUSES = exports.DOCUMENT_STATUSES = exports.DOCUMENT_TYPES = exports.SUPPLEMENT_SOURCES = exports.GOAL_SORT_FIELDS = exports.GOAL_STATUSES = exports.GOAL_ICONS = exports.SORT_ORDERS = exports.FOOD_SORT_FIELDS = exports.FOOD_METADATA_SELECTIONS = exports.FOOD_IMPORT_ISSUE_SEVERITIES = exports.FOOD_IMPORT_FILE_TYPES = exports.FOOD_IMPORT_ROW_STATUSES = exports.FOOD_IMPORT_STATUSES = exports.FOOD_IMPORT_MODES = exports.FOOD_SUGGESTION_RESOLUTIONS = exports.FOOD_SUGGESTION_STATUSES = exports.NUTRITION_BASES = exports.PORTION_UNITS = exports.SERVING_UNITS = exports.FOOD_SOURCES = exports.TEMPLATE_STATUSES = exports.DELIVERY_STATUSES = exports.MESSAGE_TYPES = exports.COMMUNICATION_CHANNELS = exports.FEATURE_FLAG_RULE_TYPES = exports.AUDIT_OUTCOMES = exports.CSRF_HEADER = exports.CSRF_COOKIE_NAMES = exports.TOKEN_TRANSPORTS = exports.TIMEZONE_SOURCES = exports.ADMIN_SETTABLE_ACCOUNT_STATUSES = exports.ACCOUNT_STATUSES = exports.PERMISSIONS = exports.ROLES = exports.APP_ENVIRONMENTS = void 0;
6
+ exports.NUTRITION_GUIDELINE_IDS = exports.CHEAT_MEAL_PERIODS = exports.PLAN_BLOCK_WEEKS = exports.PLAN_PHASES = exports.PLAN_SLOT_KINDS = exports.NUTRITION_PLAN_STATUSES = exports.MEAL_SORT_FIELDS = exports.WEIGHT_UNITS = exports.HEIGHT_UNITS = exports.KIDNEY_TEST_ANSWERS = exports.DIGESTIVE_SYMPTOMS = exports.REFLUX_FREQUENCIES = exports.DIGESTION_QUALITIES = void 0;
6
7
  exports.APP_ENVIRONMENTS = [
7
8
  'development',
8
9
  'staging',
@@ -51,6 +52,18 @@ exports.PERMISSIONS = {
51
52
  supplementsImport: 'supplements:import',
52
53
  supplementMetadataManage: 'supplement_metadata:manage',
53
54
  supplementsSearchSelf: 'supplements:search:self',
55
+ documentsWriteSelf: 'documents:write:self',
56
+ documentsReadSelf: 'documents:read:self',
57
+ documentsReadAssigned: 'documents:read:assigned',
58
+ documentsReadAny: 'documents:read:any',
59
+ mealsRead: 'meals:read',
60
+ mealsCreate: 'meals:create',
61
+ mealsUpdate: 'meals:update',
62
+ mealsDelete: 'meals:delete',
63
+ nutritionPlansRead: 'nutrition_plans:read',
64
+ nutritionPlansWrite: 'nutrition_plans:write',
65
+ nutritionPlansPublish: 'nutrition_plans:publish',
66
+ nutritionPlansReadSelf: 'nutrition_plans:read:self',
54
67
  };
55
68
  /**
56
69
  * `pending_verification` is a self-registered user who has not yet proved they
@@ -186,3 +199,169 @@ exports.GOAL_STATUSES = ['active', 'inactive'];
186
199
  exports.GOAL_SORT_FIELDS = ['sortOrder', 'name', 'updatedAt'];
187
200
  /** Where a supplement came from. Clients cannot suggest supplements, unlike foods. */
188
201
  exports.SUPPLEMENT_SOURCES = ['ADMIN', 'COACH', 'IMPORT'];
202
+ /** What a stored file is. Each feature that keeps files adds its own types here. */
203
+ exports.DOCUMENT_TYPES = [
204
+ 'PROGRESS_PHOTO_FRONT',
205
+ 'PROGRESS_PHOTO_BACK',
206
+ 'PROGRESS_PHOTO_SIDE',
207
+ 'BLOODWORK_REPORT',
208
+ 'OTHER',
209
+ ];
210
+ /** A document is `PENDING` until its upload is confirmed. */
211
+ exports.DOCUMENT_STATUSES = ['PENDING', 'UPLOADED'];
212
+ // Client onboarding
213
+ exports.ONBOARDING_STATUSES = [
214
+ 'NOT_STARTED',
215
+ 'IN_PROGRESS',
216
+ 'LOCKED',
217
+ 'PLEDGED',
218
+ ];
219
+ /** Every question step, in the order the client answers them. */
220
+ exports.ONBOARDING_STEPS = [
221
+ 'name',
222
+ 'age',
223
+ 'gender',
224
+ 'height',
225
+ 'weight',
226
+ 'goal',
227
+ 'level',
228
+ 'schedule',
229
+ 'day',
230
+ 'working_hours',
231
+ 'diet',
232
+ 'fuel',
233
+ 'eating_routine',
234
+ 'supplements',
235
+ 'body',
236
+ 'sleep',
237
+ 'digestion',
238
+ 'photos',
239
+ 'bloodwork',
240
+ 'notes',
241
+ ];
242
+ /** The sections of The File, in the order it lists them. */
243
+ exports.ONBOARDING_SECTIONS = [
244
+ 'basics',
245
+ 'goal_level',
246
+ 'training',
247
+ 'your_day',
248
+ 'sleep',
249
+ 'food_fuel',
250
+ 'body_health',
251
+ 'photos_bloodwork',
252
+ ];
253
+ exports.GENDERS = ['MALE', 'FEMALE'];
254
+ exports.EXPERIENCE_LEVELS = [
255
+ 'BEGINNER',
256
+ 'INTERMEDIATE',
257
+ 'ADVANCED',
258
+ ];
259
+ exports.TRAINING_TIMES = [
260
+ 'MORNING',
261
+ 'MIDDAY',
262
+ 'EVENING',
263
+ 'NIGHT',
264
+ ];
265
+ exports.WEEKDAYS = [
266
+ 'MON',
267
+ 'TUE',
268
+ 'WED',
269
+ 'THU',
270
+ 'FRI',
271
+ 'SAT',
272
+ 'SUN',
273
+ ];
274
+ exports.SESSION_LENGTHS = [
275
+ 'MIN_30',
276
+ 'MIN_45',
277
+ 'MIN_60',
278
+ 'MIN_90_PLUS',
279
+ ];
280
+ exports.ACTIVITY_LEVELS = [
281
+ 'SEDENTARY',
282
+ 'LIGHTLY_ACTIVE',
283
+ 'MODERATELY_ACTIVE',
284
+ 'VERY_ACTIVE',
285
+ 'PHYSICALLY_DEMANDING',
286
+ ];
287
+ exports.DIET_TYPES = [
288
+ 'VEGETARIAN',
289
+ 'NON_VEGETARIAN',
290
+ 'EGGETARIAN',
291
+ 'VEGAN',
292
+ ];
293
+ exports.ALLERGENS = [
294
+ 'PEANUT',
295
+ 'DAIRY',
296
+ 'GLUTEN',
297
+ 'SHELLFISH',
298
+ 'SOY',
299
+ 'EGGS',
300
+ ];
301
+ exports.WATER_INTAKES = [
302
+ 'UNDER_1L',
303
+ 'L1_TO_2',
304
+ 'L2_TO_3',
305
+ 'OVER_3L',
306
+ ];
307
+ exports.ANABOLIC_USE = ['NONE', 'PAST', 'CURRENT'];
308
+ exports.BODY_AREAS = [
309
+ 'SHOULDER',
310
+ 'LOWER_BACK',
311
+ 'KNEE',
312
+ 'WRIST_ELBOW',
313
+ 'NECK',
314
+ 'HIP',
315
+ ];
316
+ exports.SLEEP_DURATIONS = [
317
+ 'UNDER_5H',
318
+ 'H5_TO_6',
319
+ 'H6_TO_7',
320
+ 'H7_TO_8',
321
+ 'OVER_8H',
322
+ ];
323
+ exports.DIGESTION_QUALITIES = ['GOOD', 'AVERAGE', 'POOR'];
324
+ exports.REFLUX_FREQUENCIES = [
325
+ 'NEVER',
326
+ 'OCCASIONALLY',
327
+ 'FREQUENTLY',
328
+ 'DAILY',
329
+ ];
330
+ exports.DIGESTIVE_SYMPTOMS = [
331
+ 'BLOATING',
332
+ 'CONSTIPATION',
333
+ 'GAS',
334
+ 'STOMACH_PAIN',
335
+ 'LOOSE_MOTIONS',
336
+ ];
337
+ exports.KIDNEY_TEST_ANSWERS = ['YES', 'NO', 'NOT_SURE'];
338
+ exports.HEIGHT_UNITS = ['CM', 'FT'];
339
+ exports.WEIGHT_UNITS = ['KG', 'LB'];
340
+ // Meal library and nutrition plans
341
+ exports.MEAL_SORT_FIELDS = ['name', 'updatedAt'];
342
+ /**
343
+ * A plan is built as a `DRAFT`, becomes `ACTIVE` when published, and is
344
+ * `ARCHIVED` when a newer plan replaces it. A client has at most one of each
345
+ * of the first two.
346
+ */
347
+ exports.NUTRITION_PLAN_STATUSES = ['DRAFT', 'ACTIVE', 'ARCHIVED'];
348
+ exports.PLAN_SLOT_KINDS = ['MEAL', 'SHAKE'];
349
+ /** The stretch of the training block the calorie base is set for. */
350
+ exports.PLAN_PHASES = [
351
+ 'WEEKS_1_2',
352
+ 'WEEKS_3_4',
353
+ 'WEEKS_5_6',
354
+ 'WEEKS_7_8',
355
+ ];
356
+ /** How long a published plan runs, in weeks. */
357
+ exports.PLAN_BLOCK_WEEKS = [8, 12, 16];
358
+ /** The period a cheat-meal allowance resets over. Unused cheat meals do not carry over. */
359
+ exports.CHEAT_MEAL_PERIODS = ['WEEK', 'TWO_WEEKS', 'MONTH'];
360
+ /** Starting points for the calorie base: calories per pound and a macro split. */
361
+ exports.NUTRITION_GUIDELINE_IDS = [
362
+ 'AGGRESSIVE_CUT',
363
+ 'MODERATE_CUT',
364
+ 'MAINTENANCE',
365
+ 'MUSCLE_GAIN',
366
+ 'AGGRESSIVE_BULK',
367
+ ];
@@ -0,0 +1 @@
1
+ export * from './meal.dto.js';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./meal.dto.js"), exports);