90dc-core 1.19.4 → 1.19.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/Errors/AppError.js +104 -0
- package/dist/lib/Errors/AppError.js.map +1 -0
- package/dist/lib/Errors/Errors.js +42 -0
- package/dist/lib/Errors/Errors.js.map +1 -0
- package/dist/lib/classes/Database.js +154 -0
- package/dist/lib/classes/Database.js.map +1 -0
- package/dist/lib/classes/Redis.js +63 -0
- package/dist/lib/classes/Redis.js.map +1 -0
- package/dist/lib/clients/EmailClient.js +188 -0
- package/dist/lib/clients/EmailClient.js.map +1 -0
- package/dist/lib/clients/FirebasePushNotificationClient.js +688 -0
- package/dist/lib/clients/FirebasePushNotificationClient.js.map +1 -0
- package/dist/lib/clients/ImagesClient.d.ts +2 -1
- package/dist/lib/clients/ImagesClient.d.ts.map +1 -1
- package/dist/lib/clients/ImagesClient.js +436 -0
- package/dist/lib/clients/ImagesClient.js.map +1 -0
- package/dist/lib/clients/MailingClient.js +84 -0
- package/dist/lib/clients/MailingClient.js.map +1 -0
- package/dist/lib/clients/PushNotificationClient.js +478 -0
- package/dist/lib/clients/PushNotificationClient.js.map +1 -0
- package/dist/lib/clients/types/email.types.js +3 -0
- package/dist/lib/clients/types/email.types.js.map +1 -0
- package/dist/lib/clients/types/images.types.js +3 -0
- package/dist/lib/clients/types/images.types.js.map +1 -0
- package/dist/lib/clients/types/mailing.types.js +3 -0
- package/dist/lib/clients/types/mailing.types.js.map +1 -0
- package/dist/lib/config/ConfigValidator.js +162 -0
- package/dist/lib/config/ConfigValidator.js.map +1 -0
- package/dist/lib/controllers/BaseController.js +64 -0
- package/dist/lib/controllers/BaseController.js.map +1 -0
- package/dist/lib/db/migrations/20260330000000-create-user-progress-photos.js +60 -0
- package/dist/lib/db/migrations/20260330000000-create-user-progress-photos.js.map +1 -0
- package/dist/lib/dbmodels/coaching/Answer.js +51 -0
- package/dist/lib/dbmodels/coaching/Answer.js.map +1 -0
- package/dist/lib/dbmodels/coaching/ClientNote.js +75 -0
- package/dist/lib/dbmodels/coaching/ClientNote.js.map +1 -0
- package/dist/lib/dbmodels/coaching/ClientTag.js +45 -0
- package/dist/lib/dbmodels/coaching/ClientTag.js.map +1 -0
- package/dist/lib/dbmodels/coaching/Question.js +60 -0
- package/dist/lib/dbmodels/coaching/Question.js.map +1 -0
- package/dist/lib/dbmodels/coaching/Questionnaire.js +39 -0
- package/dist/lib/dbmodels/coaching/Questionnaire.js.map +1 -0
- package/dist/lib/dbmodels/coaching/QuestionnaireResponse.js +42 -0
- package/dist/lib/dbmodels/coaching/QuestionnaireResponse.js.map +1 -0
- package/dist/lib/dbmodels/coaching/WeeklyCheckIn.js +69 -0
- package/dist/lib/dbmodels/coaching/WeeklyCheckIn.js.map +1 -0
- package/dist/lib/dbmodels/coaching/WeightRecord.js +49 -0
- package/dist/lib/dbmodels/coaching/WeightRecord.js.map +1 -0
- package/dist/lib/dbmodels/diet/DietDay.js +50 -0
- package/dist/lib/dbmodels/diet/DietDay.js.map +1 -0
- package/dist/lib/dbmodels/diet/DietMeal.js +74 -0
- package/dist/lib/dbmodels/diet/DietMeal.js.map +1 -0
- package/dist/lib/dbmodels/diet/DietMealCompletion.js +69 -0
- package/dist/lib/dbmodels/diet/DietMealCompletion.js.map +1 -0
- package/dist/lib/dbmodels/diet/DietMealRecipe.js +67 -0
- package/dist/lib/dbmodels/diet/DietMealRecipe.js.map +1 -0
- package/dist/lib/dbmodels/diet/DietMealRecipeIngredient.js +46 -0
- package/dist/lib/dbmodels/diet/DietMealRecipeIngredient.js.map +1 -0
- package/dist/lib/dbmodels/diet/DietProgram.js +98 -0
- package/dist/lib/dbmodels/diet/DietProgram.js.map +1 -0
- package/dist/lib/dbmodels/diet/Ingredient.js +88 -0
- package/dist/lib/dbmodels/diet/Ingredient.js.map +1 -0
- package/dist/lib/dbmodels/diet/IngredientTag.js +64 -0
- package/dist/lib/dbmodels/diet/IngredientTag.js.map +1 -0
- package/dist/lib/dbmodels/diet/IngredientTags.js +29 -0
- package/dist/lib/dbmodels/diet/IngredientTags.js.map +1 -0
- package/dist/lib/dbmodels/diet/Recipe.js +173 -0
- package/dist/lib/dbmodels/diet/Recipe.js.map +1 -0
- package/dist/lib/dbmodels/diet/RecipeIngredient.js +78 -0
- package/dist/lib/dbmodels/diet/RecipeIngredient.js.map +1 -0
- package/dist/lib/dbmodels/diet/RecipeTag.js +44 -0
- package/dist/lib/dbmodels/diet/RecipeTag.js.map +1 -0
- package/dist/lib/dbmodels/diet/RecipeTags.js +24 -0
- package/dist/lib/dbmodels/diet/RecipeTags.js.map +1 -0
- package/dist/lib/dbmodels/diet/ShoppingList.js +69 -0
- package/dist/lib/dbmodels/diet/ShoppingList.js.map +1 -0
- package/dist/lib/dbmodels/diet/ShoppingListItem.js +66 -0
- package/dist/lib/dbmodels/diet/ShoppingListItem.js.map +1 -0
- package/dist/lib/dbmodels/diet/TranslatedRecipe.js +122 -0
- package/dist/lib/dbmodels/diet/TranslatedRecipe.js.map +1 -0
- package/dist/lib/dbmodels/diet/TranslatedRecipeTag.js +47 -0
- package/dist/lib/dbmodels/diet/TranslatedRecipeTag.js.map +1 -0
- package/dist/lib/dbmodels/diet/TranslatedRecipeTags.js +24 -0
- package/dist/lib/dbmodels/diet/TranslatedRecipeTags.js.map +1 -0
- package/dist/lib/dbmodels/diet/UserDietPreferences.js +85 -0
- package/dist/lib/dbmodels/diet/UserDietPreferences.js.map +1 -0
- package/dist/lib/dbmodels/gamification/Badge.js +62 -0
- package/dist/lib/dbmodels/gamification/Badge.js.map +1 -0
- package/dist/lib/dbmodels/gamification/StreaksLog.js +37 -0
- package/dist/lib/dbmodels/gamification/StreaksLog.js.map +1 -0
- package/dist/lib/dbmodels/gamification/TranslatedBadge.js +45 -0
- package/dist/lib/dbmodels/gamification/TranslatedBadge.js.map +1 -0
- package/dist/lib/dbmodels/gamification/xpAndLeaderboards/UserRankHistory.js +48 -0
- package/dist/lib/dbmodels/gamification/xpAndLeaderboards/UserRankHistory.js.map +1 -0
- package/dist/lib/dbmodels/gamification/xpAndLeaderboards/XpEvent.js +53 -0
- package/dist/lib/dbmodels/gamification/xpAndLeaderboards/XpEvent.js.map +1 -0
- package/dist/lib/dbmodels/gamification/xpAndLeaderboards/XpTransaction.js +68 -0
- package/dist/lib/dbmodels/gamification/xpAndLeaderboards/XpTransaction.js.map +1 -0
- package/dist/lib/dbmodels/index.js +288 -0
- package/dist/lib/dbmodels/index.js.map +1 -0
- package/dist/lib/dbmodels/nonconsprogram/NonConsumableProgram.d.ts +32 -0
- package/dist/lib/dbmodels/nonconsprogram/NonConsumableProgram.d.ts.map +1 -0
- package/dist/lib/dbmodels/nonconsprogram/NonConsumableProgram.js +155 -0
- package/dist/lib/dbmodels/nonconsprogram/NonConsumableProgram.js.map +1 -0
- package/dist/lib/dbmodels/nonconsprogram/NonConsumableProgramWebContent.d.ts +22 -0
- package/dist/lib/dbmodels/nonconsprogram/NonConsumableProgramWebContent.d.ts.map +1 -0
- package/dist/lib/dbmodels/nonconsprogram/NonConsumableProgramWebContent.js +108 -0
- package/dist/lib/dbmodels/nonconsprogram/NonConsumableProgramWebContent.js.map +1 -0
- package/dist/lib/dbmodels/nonconsprogram/TranslatedConsumableProgram.d.ts +20 -0
- package/dist/lib/dbmodels/nonconsprogram/TranslatedConsumableProgram.d.ts.map +1 -0
- package/dist/lib/dbmodels/nonconsprogram/TranslatedConsumableProgram.js +97 -0
- package/dist/lib/dbmodels/nonconsprogram/TranslatedConsumableProgram.js.map +1 -0
- package/dist/lib/dbmodels/nonconsprogram/TranslatedNonConsumableProgramWebContent.d.ts +22 -0
- package/dist/lib/dbmodels/nonconsprogram/TranslatedNonConsumableProgramWebContent.d.ts.map +1 -0
- package/dist/lib/dbmodels/nonconsprogram/TranslatedNonConsumableProgramWebContent.js +115 -0
- package/dist/lib/dbmodels/nonconsprogram/TranslatedNonConsumableProgramWebContent.js.map +1 -0
- package/dist/lib/dbmodels/nonconsprogram/UserNonConsumableProgram.d.ts +7 -0
- package/dist/lib/dbmodels/nonconsprogram/UserNonConsumableProgram.d.ts.map +1 -0
- package/dist/lib/dbmodels/nonconsprogram/UserNonConsumableProgram.js +41 -0
- package/dist/lib/dbmodels/nonconsprogram/UserNonConsumableProgram.js.map +1 -0
- package/dist/lib/dbmodels/notifications/NotificationModels.js +38 -0
- package/dist/lib/dbmodels/notifications/NotificationModels.js.map +1 -0
- package/dist/lib/dbmodels/notifications/TranslatedNotification.js +45 -0
- package/dist/lib/dbmodels/notifications/TranslatedNotification.js.map +1 -0
- package/dist/lib/dbmodels/program/Challenge.d.ts +13 -0
- package/dist/lib/dbmodels/program/Challenge.d.ts.map +1 -0
- package/dist/lib/dbmodels/program/Challenge.js +63 -0
- package/dist/lib/dbmodels/program/Challenge.js.map +1 -0
- package/dist/lib/dbmodels/program/ChallengeBlueprint.js +75 -0
- package/dist/lib/dbmodels/program/ChallengeBlueprint.js.map +1 -0
- package/dist/lib/dbmodels/program/CircularProgramDraft.js +82 -0
- package/dist/lib/dbmodels/program/CircularProgramDraft.js.map +1 -0
- package/dist/lib/dbmodels/program/CoachExerciseNote.js +61 -0
- package/dist/lib/dbmodels/program/CoachExerciseNote.js.map +1 -0
- package/dist/lib/dbmodels/program/CustomProgramBlueprint.js +84 -0
- package/dist/lib/dbmodels/program/CustomProgramBlueprint.js.map +1 -0
- package/dist/lib/dbmodels/program/CustomStrengthTest.js +55 -0
- package/dist/lib/dbmodels/program/CustomStrengthTest.js.map +1 -0
- package/dist/lib/dbmodels/program/CustomStrengthTestExercises.js +69 -0
- package/dist/lib/dbmodels/program/CustomStrengthTestExercises.js.map +1 -0
- package/dist/lib/dbmodels/program/CustomWorkoutBlueprint.js +58 -0
- package/dist/lib/dbmodels/program/CustomWorkoutBlueprint.js.map +1 -0
- package/dist/lib/dbmodels/program/Exercise.d.ts +23 -0
- package/dist/lib/dbmodels/program/Exercise.d.ts.map +1 -0
- package/dist/lib/dbmodels/program/Exercise.js +101 -0
- package/dist/lib/dbmodels/program/Exercise.js.map +1 -0
- package/dist/lib/dbmodels/program/ExerciseModels.d.ts +28 -0
- package/dist/lib/dbmodels/program/ExerciseModels.d.ts.map +1 -0
- package/dist/lib/dbmodels/program/ExerciseModels.js +149 -0
- package/dist/lib/dbmodels/program/ExerciseModels.js.map +1 -0
- package/dist/lib/dbmodels/program/Program.d.ts +15 -0
- package/dist/lib/dbmodels/program/Program.d.ts.map +1 -0
- package/dist/lib/dbmodels/program/Program.js +76 -0
- package/dist/lib/dbmodels/program/Program.js.map +1 -0
- package/dist/lib/dbmodels/program/ProgressEntry.d.ts +26 -0
- package/dist/lib/dbmodels/program/ProgressEntry.d.ts.map +1 -0
- package/dist/lib/dbmodels/program/ProgressEntry.js +77 -0
- package/dist/lib/dbmodels/program/ProgressEntry.js.map +1 -0
- package/dist/lib/dbmodels/program/RestDay.js +33 -0
- package/dist/lib/dbmodels/program/RestDay.js.map +1 -0
- package/dist/lib/dbmodels/program/StrengthTest.d.ts +10 -0
- package/dist/lib/dbmodels/program/StrengthTest.d.ts.map +1 -0
- package/dist/lib/dbmodels/program/StrengthTest.js +39 -0
- package/dist/lib/dbmodels/program/StrengthTest.js.map +1 -0
- package/dist/lib/dbmodels/program/StrengthTestExercise.d.ts +15 -0
- package/dist/lib/dbmodels/program/StrengthTestExercise.d.ts.map +1 -0
- package/dist/lib/dbmodels/program/StrengthTestExercise.js +72 -0
- package/dist/lib/dbmodels/program/StrengthTestExercise.js.map +1 -0
- package/dist/lib/dbmodels/program/StrengthTestSession.js +73 -0
- package/dist/lib/dbmodels/program/StrengthTestSession.js.map +1 -0
- package/dist/lib/dbmodels/program/Superset.d.ts +13 -0
- package/dist/lib/dbmodels/program/Superset.d.ts.map +1 -0
- package/dist/lib/dbmodels/program/Superset.js +46 -0
- package/dist/lib/dbmodels/program/Superset.js.map +1 -0
- package/dist/lib/dbmodels/program/ThirtyDayChallenge.js +70 -0
- package/dist/lib/dbmodels/program/ThirtyDayChallenge.js.map +1 -0
- package/dist/lib/dbmodels/program/ThirtyDayChallengeStrengthTest.js +55 -0
- package/dist/lib/dbmodels/program/ThirtyDayChallengeStrengthTest.js.map +1 -0
- package/dist/lib/dbmodels/program/TranslatedChallenge.d.ts +15 -0
- package/dist/lib/dbmodels/program/TranslatedChallenge.d.ts.map +1 -0
- package/dist/lib/dbmodels/program/TranslatedChallenge.js +69 -0
- package/dist/lib/dbmodels/program/TranslatedChallenge.js.map +1 -0
- package/dist/lib/dbmodels/program/TranslatedExerciseModel.d.ts +25 -0
- package/dist/lib/dbmodels/program/TranslatedExerciseModel.d.ts.map +1 -0
- package/dist/lib/dbmodels/program/TranslatedExerciseModel.js +123 -0
- package/dist/lib/dbmodels/program/TranslatedExerciseModel.js.map +1 -0
- package/dist/lib/dbmodels/program/TranslatedStrengthTest.d.ts +12 -0
- package/dist/lib/dbmodels/program/TranslatedStrengthTest.d.ts.map +1 -0
- package/dist/lib/dbmodels/program/TranslatedStrengthTest.js +45 -0
- package/dist/lib/dbmodels/program/TranslatedStrengthTest.js.map +1 -0
- package/dist/lib/dbmodels/program/TranslatedStrengthTestExercise.d.ts +16 -0
- package/dist/lib/dbmodels/program/TranslatedStrengthTestExercise.d.ts.map +1 -0
- package/dist/lib/dbmodels/program/TranslatedStrengthTestExercise.js +78 -0
- package/dist/lib/dbmodels/program/TranslatedStrengthTestExercise.js.map +1 -0
- package/dist/lib/dbmodels/program/UserChallenge.d.ts +10 -0
- package/dist/lib/dbmodels/program/UserChallenge.d.ts.map +1 -0
- package/dist/lib/dbmodels/program/UserChallenge.js +47 -0
- package/dist/lib/dbmodels/program/UserChallenge.js.map +1 -0
- package/dist/lib/dbmodels/program/UserExerciseNote.js +61 -0
- package/dist/lib/dbmodels/program/UserExerciseNote.js.map +1 -0
- package/dist/lib/dbmodels/program/UserStrengthTests.d.ts +11 -0
- package/dist/lib/dbmodels/program/UserStrengthTests.d.ts.map +1 -0
- package/dist/lib/dbmodels/program/UserStrengthTests.js +54 -0
- package/dist/lib/dbmodels/program/UserStrengthTests.js.map +1 -0
- package/dist/lib/dbmodels/program/Workout.d.ts +14 -0
- package/dist/lib/dbmodels/program/Workout.d.ts.map +1 -0
- package/dist/lib/dbmodels/program/Workout.js +66 -0
- package/dist/lib/dbmodels/program/Workout.js.map +1 -0
- package/dist/lib/dbmodels/program/WorkoutCompletion.js +65 -0
- package/dist/lib/dbmodels/program/WorkoutCompletion.js.map +1 -0
- package/dist/lib/dbmodels/program/WorkoutSession.js +93 -0
- package/dist/lib/dbmodels/program/WorkoutSession.js.map +1 -0
- package/dist/lib/dbmodels/subscription/Subscription.d.ts +19 -0
- package/dist/lib/dbmodels/subscription/Subscription.d.ts.map +1 -0
- package/dist/lib/dbmodels/subscription/Subscription.js +91 -0
- package/dist/lib/dbmodels/subscription/Subscription.js.map +1 -0
- package/dist/lib/dbmodels/subscription/SubscriptionEvent.js +79 -0
- package/dist/lib/dbmodels/subscription/SubscriptionEvent.js.map +1 -0
- package/dist/lib/dbmodels/subscription/SubscriptionLog.d.ts +9 -0
- package/dist/lib/dbmodels/subscription/SubscriptionLog.d.ts.map +1 -0
- package/dist/lib/dbmodels/subscription/SubscriptionLog.js +42 -0
- package/dist/lib/dbmodels/subscription/SubscriptionLog.js.map +1 -0
- package/dist/lib/dbmodels/subscription/SubscriptionRefund.js +92 -0
- package/dist/lib/dbmodels/subscription/SubscriptionRefund.js.map +1 -0
- package/dist/lib/dbmodels/user/DeviceTokens.js +34 -0
- package/dist/lib/dbmodels/user/DeviceTokens.js.map +1 -0
- package/dist/lib/dbmodels/user/PersistedUser.d.ts +43 -0
- package/dist/lib/dbmodels/user/PersistedUser.d.ts.map +1 -0
- package/dist/lib/dbmodels/user/PersistedUser.js +237 -0
- package/dist/lib/dbmodels/user/PersistedUser.js.map +1 -0
- package/dist/lib/dbmodels/user/UserAddons.js +26 -0
- package/dist/lib/dbmodels/user/UserAddons.js.map +1 -0
- package/dist/lib/dbmodels/user/UserBadges.js +63 -0
- package/dist/lib/dbmodels/user/UserBadges.js.map +1 -0
- package/dist/lib/dbmodels/user/UserCoach.js +40 -0
- package/dist/lib/dbmodels/user/UserCoach.js.map +1 -0
- package/dist/lib/dbmodels/user/UserDiscount.js +24 -0
- package/dist/lib/dbmodels/user/UserDiscount.js.map +1 -0
- package/dist/lib/dbmodels/user/UserOptions.js +34 -0
- package/dist/lib/dbmodels/user/UserOptions.js.map +1 -0
- package/dist/lib/dbmodels/user/UserProgressPhoto.js +59 -0
- package/dist/lib/dbmodels/user/UserProgressPhoto.js.map +1 -0
- package/dist/lib/dbmodels/user/UserStreaks.js +64 -0
- package/dist/lib/dbmodels/user/UserStreaks.js.map +1 -0
- package/dist/lib/dbmodels/user/UsersFriends.js +46 -0
- package/dist/lib/dbmodels/user/UsersFriends.js.map +1 -0
- package/dist/lib/enums/ProgramEnums.d.ts +18 -0
- package/dist/lib/enums/ProgramEnums.d.ts.map +1 -0
- package/dist/lib/enums/ProgramEnums.js +22 -0
- package/dist/lib/enums/ProgramEnums.js.map +1 -0
- package/dist/lib/enums/ProgramTemplates.js +738 -0
- package/dist/lib/enums/ProgramTemplates.js.map +1 -0
- package/dist/lib/middlewares/ErrorMiddleware.js +141 -0
- package/dist/lib/middlewares/ErrorMiddleware.js.map +1 -0
- package/dist/lib/middlewares/ValidationMiddleware.js +24 -0
- package/dist/lib/middlewares/ValidationMiddleware.js.map +1 -0
- package/dist/lib/models/BlueprintInterfaces.js +3 -0
- package/dist/lib/models/BlueprintInterfaces.js.map +1 -0
- package/dist/lib/models/ExerciseInterfaces.d.ts +68 -0
- package/dist/lib/models/ExerciseInterfaces.d.ts.map +1 -0
- package/dist/lib/models/ExerciseInterfaces.js +3 -0
- package/dist/lib/models/ExerciseInterfaces.js.map +1 -0
- package/dist/lib/models/NotificationInterfaces.js +11 -0
- package/dist/lib/models/NotificationInterfaces.js.map +1 -0
- package/dist/lib/models/ProgramInterfaces.js +3 -0
- package/dist/lib/models/ProgramInterfaces.js.map +1 -0
- package/dist/lib/models/UserInterfaces.js +3 -0
- package/dist/lib/models/UserInterfaces.js.map +1 -0
- package/dist/lib/models/WorkoutInterfaces.js +3 -0
- package/dist/lib/models/WorkoutInterfaces.js.map +1 -0
- package/dist/lib/scripts/cli.js +82 -0
- package/dist/lib/scripts/cli.js.map +1 -0
- package/dist/lib/scripts/populate-exercise-thumbnails.js +64 -0
- package/dist/lib/scripts/populate-exercise-thumbnails.js.map +1 -0
- package/dist/lib/scripts/setup-database.js +43 -0
- package/dist/lib/scripts/setup-database.js.map +1 -0
- package/dist/lib/scripts/verify-indexes.js +94 -0
- package/dist/lib/scripts/verify-indexes.js.map +1 -0
- package/dist/lib/testing/testFixtures.js +520 -0
- package/dist/lib/testing/testFixtures.js.map +1 -0
- package/dist/lib/testing/testHelpers.js +149 -0
- package/dist/lib/testing/testHelpers.js.map +1 -0
- package/dist/lib/utils/AuthenticationUtil.js +481 -0
- package/dist/lib/utils/AuthenticationUtil.js.map +1 -0
- package/dist/lib/utils/Logger.js +242 -0
- package/dist/lib/utils/Logger.js.map +1 -0
- package/dist/lib/utils/NotificationClient.js +371 -0
- package/dist/lib/utils/NotificationClient.js.map +1 -0
- package/dist/lib/utils/NotificationsUtil.js +95 -0
- package/dist/lib/utils/NotificationsUtil.js.map +1 -0
- package/dist/lib/utils/SecretManager.js +107 -0
- package/dist/lib/utils/SecretManager.js.map +1 -0
- package/dist/lib/utils/SentryUtil.js +140 -0
- package/dist/lib/utils/SentryUtil.js.map +1 -0
- package/dist/lib/utils/imageValidation.js +31 -0
- package/dist/lib/utils/imageValidation.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/enums/ProgramTemplates.ts"],"sourcesContent":["export const ThreeDaysTemplate = [\n\t'StrengthTest',\n\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\t'Rest',\n\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\t'Rest',\n\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\t'Rest',\n\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\t'Rest',\n\n\t'StrengthTest',\n\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\t'Rest',\n\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\t'Rest',\n\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\t'Rest',\n\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\t'Rest',\n\n\t'Workout',\n\n\t'StrengthTest',\n\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\t'Rest',\n\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\t'Rest',\n\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\t'Rest',\n\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\t'Rest',\n\n\t'Workout',\n\t'Rest',\n\n\t'StrengthTest'\n];\n\nexport const FourDaysTemplate = [\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\n\t'StrengthTest',\n\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Rest',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\n\t'StrengthTest'\n];\n\nexport const FourDaysBodyWeightTemplate = [\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Rest',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Rest',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Rest',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Rest',\n\t'Challenge',\n\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Rest',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Rest',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Rest',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Rest',\n\t'Challenge',\n\n\t'Workout',\n\n\t'StrengthTest',\n\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Rest',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Rest',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Rest',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Rest',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\n\t'StrengthTest'\n];\n\nexport const FiveDaysTemplate = [\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\n\t'StrengthTest'\n];\n\nexport const FiveDaysHomeWorkoutTemplate = [\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Challenge',\n\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\n\t'StrengthTest'\n];\n\nexport const FiveDaysBodyWeightTemplate = [\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\n\t'StrengthTest'\n];\n\nexport const SixDaysTemplate = [\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\n\t'StrengthTest',\n\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\n\t'StrengthTest'\n];\n\nexport const SixDaysHomeWorkoutTemplate = [\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'StrengthTest',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\n\t'StrengthTest',\n\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\t'MergedWorkout',\n\t'Workout',\n\t'Workout',\n\t'Workout',\n\t'Challenge',\n\n\t'Workout',\n\t'Workout',\n\n\t'StrengthTest'\n];"],"names":["ThreeDaysTemplate","FourDaysTemplate","FourDaysBodyWeightTemplate","FiveDaysTemplate","FiveDaysHomeWorkoutTemplate","FiveDaysBodyWeightTemplate","SixDaysTemplate","SixDaysHomeWorkoutTemplate"],"mappings":"AAAA,OAAO,MAAMA,oBAAoB;IAChC;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;CACA,CAAC;AAEF,OAAO,MAAMC,mBAAmB;IAC/B;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;CACA,CAAC;AAEF,OAAO,MAAMC,6BAA6B;IACzC;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;CACA,CAAC;AAEF,OAAO,MAAMC,mBAAmB;IAC/B;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;CACA,CAAC;AAEF,OAAO,MAAMC,8BAA8B;IAC1C;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;CACA,CAAC;AAEF,OAAO,MAAMC,6BAA6B;IACzC;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;CACA,CAAC;AAEF,OAAO,MAAMC,kBAAkB;IAC9B;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;CACA,CAAC;AAEF,OAAO,MAAMC,6BAA6B;IACzC;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;CACA,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AppError, toAppError } from "../Errors/AppError.js";
|
|
3
|
+
import { initializeSentry, isSentryEnabled, reportErrorToSentry, reportMessageToSentry, scrubObject, captureRequestBody } from "../utils/SentryUtil.js";
|
|
4
|
+
import { Log } from "../utils/Logger.js";
|
|
5
|
+
const dclogger = Log.getInstance().extend("ErrorMiddleware");
|
|
6
|
+
export function ErrorMiddleware(config = {}) {
|
|
7
|
+
const { exposeErrorDetails = false, logErrors = true, logger, formatter, disableSentry = false } = config;
|
|
8
|
+
initializeSentry();
|
|
9
|
+
return async (ctx, next)=>{
|
|
10
|
+
try {
|
|
11
|
+
await next();
|
|
12
|
+
} catch (err) {
|
|
13
|
+
let appError;
|
|
14
|
+
if (err instanceof z.ZodError) {
|
|
15
|
+
const validationErrors = formatZodErrors(err);
|
|
16
|
+
const requestContext = {
|
|
17
|
+
method: ctx.method,
|
|
18
|
+
path: ctx.path,
|
|
19
|
+
body: captureRequestBody(ctx.request.body),
|
|
20
|
+
query: scrubObject(ctx.query),
|
|
21
|
+
headers: scrubObject(ctx.headers),
|
|
22
|
+
userUuid: ctx.state.user?.userUuid,
|
|
23
|
+
validationErrors: validationErrors.validationErrors,
|
|
24
|
+
traceId: ctx.state.traceId,
|
|
25
|
+
ip: ctx.ip
|
|
26
|
+
};
|
|
27
|
+
// Log validation error with full request context and validation details
|
|
28
|
+
dclogger.error("Validation error", requestContext);
|
|
29
|
+
// Report to Sentry with full context
|
|
30
|
+
if (!disableSentry && isSentryEnabled()) {
|
|
31
|
+
reportMessageToSentry("Validation error", "error", {
|
|
32
|
+
request: requestContext,
|
|
33
|
+
validationErrors
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
appError = new AppError("VALIDATION_ERROR", "Request validation failed", 400, validationErrors);
|
|
37
|
+
} else {
|
|
38
|
+
const requestContext = {
|
|
39
|
+
method: ctx.method,
|
|
40
|
+
path: ctx.path,
|
|
41
|
+
body: captureRequestBody(ctx.request.body),
|
|
42
|
+
query: scrubObject(ctx.query),
|
|
43
|
+
headers: scrubObject(ctx.headers),
|
|
44
|
+
userUuid: ctx.state.user?.userUuid,
|
|
45
|
+
error: err instanceof Error ? err.message : String(err),
|
|
46
|
+
stack: err instanceof Error ? err.stack : undefined,
|
|
47
|
+
traceId: ctx.state.traceId,
|
|
48
|
+
ip: ctx.ip
|
|
49
|
+
};
|
|
50
|
+
// Log error with full request context
|
|
51
|
+
dclogger.error("Error processing request", requestContext);
|
|
52
|
+
appError = toAppError(err);
|
|
53
|
+
}
|
|
54
|
+
if (!disableSentry && isSentryEnabled() && appError.statusCode !== 401) {
|
|
55
|
+
reportErrorToSentry(appError, ctx, {
|
|
56
|
+
operational: appError.isOperational,
|
|
57
|
+
errorType: appError.constructor.name,
|
|
58
|
+
statusCode: appError.statusCode
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (logErrors) {
|
|
62
|
+
if (logger) {
|
|
63
|
+
logger(appError, ctx);
|
|
64
|
+
} else {
|
|
65
|
+
defaultErrorLogger(appError, ctx);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
ctx.status = appError.statusCode;
|
|
69
|
+
ctx.set("X-Error-Code", appError.code);
|
|
70
|
+
ctx.type = "application/json";
|
|
71
|
+
const responseBody = formatter ? formatter(appError, ctx) : formatErrorResponse(appError, exposeErrorDetails);
|
|
72
|
+
ctx.body = responseBody;
|
|
73
|
+
// Log response body for debugging (only in non-production or for server errors)
|
|
74
|
+
if (process.env.NODE_ENV !== "production" || appError.statusCode >= 500) {
|
|
75
|
+
dclogger.error("Error response sent", {
|
|
76
|
+
statusCode: appError.statusCode,
|
|
77
|
+
errorCode: appError.code,
|
|
78
|
+
responseBody: scrubObject(responseBody),
|
|
79
|
+
traceId: ctx.state.traceId
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function defaultErrorLogger(error, ctx) {
|
|
86
|
+
const isDev = process.env.NODE_ENV === "development";
|
|
87
|
+
if (error.statusCode >= 500) {
|
|
88
|
+
if (!isDev) {
|
|
89
|
+
const prodLogData = {
|
|
90
|
+
error: {
|
|
91
|
+
code: error.code,
|
|
92
|
+
message: error.message,
|
|
93
|
+
statusCode: error.statusCode
|
|
94
|
+
},
|
|
95
|
+
request: {
|
|
96
|
+
path: ctx.path
|
|
97
|
+
},
|
|
98
|
+
user: {
|
|
99
|
+
uuid: ctx.state.user?.userUuid
|
|
100
|
+
},
|
|
101
|
+
traceId: ctx.state.traceId
|
|
102
|
+
};
|
|
103
|
+
console.error("Server Error:", JSON.stringify(prodLogData, null, 2));
|
|
104
|
+
} else {
|
|
105
|
+
console.error("Server Error:", error.stack || error.message);
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
console.warn("Client Error:", JSON.stringify({
|
|
109
|
+
code: error.code,
|
|
110
|
+
message: error.message,
|
|
111
|
+
statusCode: error.statusCode,
|
|
112
|
+
path: ctx.path
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function formatErrorResponse(error, exposeDetails) {
|
|
117
|
+
const response = {
|
|
118
|
+
code: error.code,
|
|
119
|
+
message: error.message
|
|
120
|
+
};
|
|
121
|
+
if (exposeDetails || error.statusCode < 500) {
|
|
122
|
+
if (error.details !== undefined) {
|
|
123
|
+
response.details = error.details;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (exposeDetails && error.stack) {
|
|
127
|
+
response.stack = error.stack;
|
|
128
|
+
}
|
|
129
|
+
return response;
|
|
130
|
+
}
|
|
131
|
+
export function formatZodErrors(error) {
|
|
132
|
+
return {
|
|
133
|
+
validationErrors: error.issues.map((issue)=>({
|
|
134
|
+
path: issue.path.join("."),
|
|
135
|
+
message: issue.message,
|
|
136
|
+
code: issue.code
|
|
137
|
+
}))
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
//# sourceMappingURL=ErrorMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/middlewares/ErrorMiddleware.ts"],"sourcesContent":["import type { Context, Next } from \"koa\";\nimport { z } from \"zod\";\nimport { AppError, toAppError } from \"../Errors/AppError.js\";\nimport {\n initializeSentry,\n isSentryEnabled,\n reportErrorToSentry,\n reportMessageToSentry,\n scrubObject,\n captureRequestBody,\n} from \"../utils/SentryUtil.js\";\nimport { Log } from \"../utils/Logger.js\";\n\nconst dclogger = Log.getInstance().extend(\"ErrorMiddleware\");\n\nexport interface ErrorMiddlewareConfig {\n exposeErrorDetails?: boolean;\n logErrors?: boolean;\n logger?: (error: Error, ctx: Context) => void;\n formatter?: (error: AppError, ctx: Context) => unknown;\n disableSentry?: boolean;\n}\n\nexport function ErrorMiddleware(config: ErrorMiddlewareConfig = {}) {\n const {\n exposeErrorDetails = false,\n logErrors = true,\n logger,\n formatter,\n disableSentry = false,\n } = config;\n\n initializeSentry();\n\n return async (ctx: Context, next: Next) => {\n try {\n await next();\n } catch (err) {\n let appError: AppError;\n\n if (err instanceof z.ZodError) {\n const validationErrors = formatZodErrors(err);\n const requestContext = {\n method: ctx.method,\n path: ctx.path,\n body: captureRequestBody((ctx.request as any).body),\n query: scrubObject(ctx.query),\n headers: scrubObject(ctx.headers),\n userUuid: ctx.state.user?.userUuid,\n validationErrors: validationErrors.validationErrors,\n traceId: ctx.state.traceId,\n ip: ctx.ip,\n };\n\n // Log validation error with full request context and validation details\n dclogger.error(\"Validation error\", requestContext);\n\n // Report to Sentry with full context\n if (!disableSentry && isSentryEnabled()) {\n reportMessageToSentry(\n \"Validation error\",\n \"error\",\n {\n request: requestContext,\n validationErrors,\n }\n );\n }\n\n appError = new AppError(\n \"VALIDATION_ERROR\",\n \"Request validation failed\",\n 400,\n validationErrors\n );\n } else {\n const requestContext = {\n method: ctx.method,\n path: ctx.path,\n body: captureRequestBody((ctx.request as any).body),\n query: scrubObject(ctx.query),\n headers: scrubObject(ctx.headers),\n userUuid: ctx.state.user?.userUuid,\n error: err instanceof Error ? err.message : String(err),\n stack: err instanceof Error ? err.stack : undefined,\n traceId: ctx.state.traceId,\n ip: ctx.ip,\n };\n\n // Log error with full request context\n dclogger.error(\"Error processing request\", requestContext);\n\n appError = toAppError(err);\n }\n\n if (!disableSentry && isSentryEnabled() && appError.statusCode !== 401) {\n reportErrorToSentry(appError, ctx, {\n operational: appError.isOperational,\n errorType: appError.constructor.name,\n statusCode: appError.statusCode,\n });\n }\n\n if (logErrors) {\n if (logger) {\n logger(appError, ctx);\n } else {\n defaultErrorLogger(appError, ctx);\n }\n }\n\n ctx.status = appError.statusCode;\n ctx.set(\"X-Error-Code\", appError.code);\n ctx.type = \"application/json\";\n\n const responseBody = formatter\n ? formatter(appError, ctx)\n : formatErrorResponse(appError, exposeErrorDetails);\n\n ctx.body = responseBody;\n\n // Log response body for debugging (only in non-production or for server errors)\n if (process.env.NODE_ENV !== \"production\" || appError.statusCode >= 500) {\n dclogger.error(\"Error response sent\", {\n statusCode: appError.statusCode,\n errorCode: appError.code,\n responseBody: scrubObject(responseBody),\n traceId: ctx.state.traceId,\n });\n }\n\n }\n };\n}\n\nfunction defaultErrorLogger(error: AppError, ctx: Context): void {\n const isDev = process.env.NODE_ENV === \"development\";\n\n if (error.statusCode >= 500) {\n if (!isDev) {\n const prodLogData = {\n error: {\n code: error.code,\n message: error.message,\n statusCode: error.statusCode,\n },\n request: {\n path: ctx.path,\n },\n user: {\n uuid: ctx.state.user?.userUuid,\n },\n traceId: ctx.state.traceId,\n };\n console.error(\"Server Error:\", JSON.stringify(prodLogData, null, 2));\n } else {\n console.error(\"Server Error:\", error.stack || error.message);\n }\n } else {\n console.warn(\"Client Error:\", JSON.stringify({\n code: error.code,\n message: error.message,\n statusCode: error.statusCode,\n path: ctx.path,\n }));\n }\n}\n\n\nfunction formatErrorResponse(error: AppError, exposeDetails: boolean): unknown {\n const response: {\n code: string;\n message: string;\n details?: unknown;\n stack?: string;\n } = {\n code: error.code,\n message: error.message,\n };\n\n if (exposeDetails || error.statusCode < 500) {\n if (error.details !== undefined) {\n response.details = error.details;\n }\n }\n\n if (exposeDetails && error.stack) {\n response.stack = error.stack;\n }\n\n return response;\n}\n\nexport function formatZodErrors(error: z.ZodError): {\n validationErrors: { path: string; message: string; code: string }[];\n} {\n return {\n validationErrors: error.issues.map((issue) => ({\n path: issue.path.join(\".\"),\n message: issue.message,\n code: issue.code,\n })),\n };\n}"],"names":["z","AppError","toAppError","initializeSentry","isSentryEnabled","reportErrorToSentry","reportMessageToSentry","scrubObject","captureRequestBody","Log","dclogger","getInstance","extend","ErrorMiddleware","config","exposeErrorDetails","logErrors","logger","formatter","disableSentry","ctx","next","err","appError","ZodError","validationErrors","formatZodErrors","requestContext","method","path","body","request","query","headers","userUuid","state","user","traceId","ip","error","Error","message","String","stack","undefined","statusCode","operational","isOperational","errorType","name","defaultErrorLogger","status","set","code","type","responseBody","formatErrorResponse","process","env","NODE_ENV","errorCode","isDev","prodLogData","uuid","console","JSON","stringify","warn","exposeDetails","response","details","issues","map","issue","join"],"mappings":"AACA,SAASA,CAAC,QAAQ,MAAM;AACxB,SAASC,QAAQ,EAAEC,UAA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AS1B,KAAK,GAAGJ,MAAMI,KAAK;IAC9B;IAEA,OAAO0B;AACT;AAEA,OAAO,SAAS3C,gBAAgBa,KAAiB;IAG/C,OAAO;QACLd,kBAAkBc,MAAMgC,MAAM,CAACC,GAAG,CAAC,CAACC,QAAW,CAAA;gBAC7C5C,MAAM4C,MAAM5C,IAAI,CAAC6C,IAAI,CAAC;gBACtBjC,SAASgC,MAAMhC,OAAO;gBACtBY,MAAMoB,MAAMpB,IAAI;YAClB,CAAA;IACF;AACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function validate(config) {
|
|
2
|
+
return async (ctx, next)=>{
|
|
3
|
+
// Validate params
|
|
4
|
+
if (config.params) {
|
|
5
|
+
ctx.state.params = config.params.parse(ctx.params);
|
|
6
|
+
}
|
|
7
|
+
// Validate query
|
|
8
|
+
if (config.query) {
|
|
9
|
+
ctx.state.query = config.query.parse(ctx.query);
|
|
10
|
+
}
|
|
11
|
+
// Validate body
|
|
12
|
+
if (config.body) {
|
|
13
|
+
ctx.state.body = config.body.parse(ctx.request.body);
|
|
14
|
+
}
|
|
15
|
+
// Call next middleware/handler
|
|
16
|
+
await next();
|
|
17
|
+
// Validate response
|
|
18
|
+
if (config.response && ctx.body !== undefined) {
|
|
19
|
+
ctx.body = config.response.parse(ctx.body);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=ValidationMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/middlewares/ValidationMiddleware.ts"],"sourcesContent":["import type { Context, Next, Middleware } from \"koa\";\nimport { type ZodSchema } from \"zod\";\n\nexport interface ValidationConfig {\n params?: ZodSchema;\n query?: ZodSchema;\n body?: ZodSchema;\n response?: ZodSchema;\n}\n\nexport function validate(config: ValidationConfig): Middleware {\n return async (ctx: Context, next: Next): Promise<void> => {\n // Validate params\n if (config.params) {\n ctx.state.params = config.params.parse(ctx.params);\n }\n\n // Validate query\n if (config.query) {\n ctx.state.query = config.query.parse(ctx.query);\n }\n\n // Validate body\n if (config.body) {\n ctx.state.body = config.body.parse((ctx.request as any).body);\n }\n\n // Call next middleware/handler\n await next();\n\n // Validate response\n if (config.response && ctx.body !== undefined) {\n ctx.body = config.response.parse(ctx.body);\n }\n };\n}"],"names":["validate","config","ctx","next","params","state","parse","query","body","request","response","undefined"],"mappings":"AAUA,OAAO,SAASA,SAASC,MAAwB;IAC/C,OAAO,OAAOC,KAAcC;QAC1B,kBAAkB;QAClB,IAAIF,OAAOG,MAAM,EAAE;YACjBF,IAAIG,KAAK,CAACD,MAAM,GAAGH,OAAOG,MAAM,CAACE,KAAK,CAACJ,IAAIE,MAAM;QACnD;QAEA,iBAAiB;QACjB,IAAIH,OAAOM,KAAK,EAAE;YAChBL,IAAIG,KAAK,CAACE,KAAK,GAAGN,OAAOM,KAAK,CAACD,KAAK,CAACJ,IAAIK,KAAK;QAChD;QAEA,gBAAgB;QAChB,IAAIN,OAAOO,IAAI,EAAE;YACfN,IAAIG,KAAK,CAACG,IAAI,GAAGP,OAAOO,IAAI,CAACF,KAAK,CAAC,AAACJ,IAAIO,OAAO,CAASD,IAAI;QAC9D;QAEA,+BAA+B;QAC/B,MAAML;QAEN,oBAAoB;QACpB,IAAIF,OAAOS,QAAQ,IAAIR,IAAIM,IAAI,KAAKG,WAAW;YAC7CT,IAAIM,IAAI,GAAGP,OAAOS,QAAQ,CAACJ,KAAK,CAACJ,IAAIM,IAAI;QAC3C;IACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/models/BlueprintInterfaces.ts"],"sourcesContent":["import type { SupersetModel } from './WorkoutInterfaces.js';\n\nexport interface ExerciseBlueprint {\n uuid: string;\n hasPriority: boolean;\n isCompound: boolean;\n homeWorkout: boolean;\n needsEquipment: boolean;\n isSuperset: boolean;\n isFixed: boolean;\n muscle: string;\n rir: number;\n order: number;\n reps: string;\n sets: string;\n}\n\nexport interface ProgramBlueprint {\n programId: string;\n title: string;\n level: string;\n numberOfDays: number;\n workouts: WorkoutBlueprint[];\n}\n\nexport interface WorkoutBlueprint {\n uuid: string;\n title: string;\n duration: string;\n exercises: ExerciseBlueprint[];\n superset: SupersetModel[];\n}\n\nexport interface SupersetBlueprint {\n uuid: string;\n workout: WorkoutBlueprint;\n exercise: ExerciseBlueprint[];\n}\n"],"names":[],"mappings":"AAiCA,WAIC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { UserStrengthTests } from '../dbmodels/program/UserStrengthTests.js';
|
|
2
|
+
import type { UserChallenge } from '../dbmodels/program/UserChallenge.js';
|
|
3
|
+
import type { TranslatedStrengthTestExercise } from '../dbmodels/program/TranslatedStrengthTestExercise.js';
|
|
4
|
+
import type { ExercisesModels } from '../dbmodels/program/ExerciseModels.js';
|
|
5
|
+
export interface ExerciseModel {
|
|
6
|
+
uuid: string;
|
|
7
|
+
name: string;
|
|
8
|
+
level: string[];
|
|
9
|
+
isCompound: boolean;
|
|
10
|
+
needsEquipment: boolean;
|
|
11
|
+
hasPriority: boolean;
|
|
12
|
+
hasVariations: boolean;
|
|
13
|
+
variations: object;
|
|
14
|
+
muscles: string[];
|
|
15
|
+
homeWorkout: boolean;
|
|
16
|
+
createdBy?: string | null;
|
|
17
|
+
isPublic: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface ExerciseProgress {
|
|
20
|
+
exerciseUuid: string;
|
|
21
|
+
progress: Progress[];
|
|
22
|
+
}
|
|
23
|
+
export interface UpdateSTRequest {
|
|
24
|
+
body: UserStrengthTests;
|
|
25
|
+
}
|
|
26
|
+
export interface UpdateUserChallengeRequest {
|
|
27
|
+
body: UserChallenge;
|
|
28
|
+
}
|
|
29
|
+
export interface STExerciseProgress {
|
|
30
|
+
exerciseUuid: string;
|
|
31
|
+
progress: Progress;
|
|
32
|
+
}
|
|
33
|
+
export interface ExercisePerformance {
|
|
34
|
+
workoutIndex: number;
|
|
35
|
+
progress: Progress[];
|
|
36
|
+
}
|
|
37
|
+
export interface SwapExerciseRequest {
|
|
38
|
+
exerciseUuid: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ChangeExerciseRequest {
|
|
41
|
+
oldExerciseUuid: string;
|
|
42
|
+
newExercise: ExercisesModels;
|
|
43
|
+
}
|
|
44
|
+
export interface ReducedExercise {
|
|
45
|
+
uuid: string;
|
|
46
|
+
name: string;
|
|
47
|
+
order: number;
|
|
48
|
+
progress?: Progress[];
|
|
49
|
+
sets: string;
|
|
50
|
+
reps: string;
|
|
51
|
+
restTime?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface UpdateTranslatedStrengthTestExercisesRequest {
|
|
54
|
+
exercises: TranslatedStrengthTestExercise[];
|
|
55
|
+
}
|
|
56
|
+
export interface AddTranslatedStrengthTestExercisesRequest {
|
|
57
|
+
exercises: TranslatedStrengthTestExercise[];
|
|
58
|
+
}
|
|
59
|
+
export type ProgramTypes = "BodyweightHomeWorkout" | "BodyweightOnlyBodyweight" | "BodyweightWeightedCali" | "Weights" | "Both";
|
|
60
|
+
export interface Progress {
|
|
61
|
+
[key: string]: number | string | undefined;
|
|
62
|
+
}
|
|
63
|
+
export interface ProgressByExercise {
|
|
64
|
+
name: string;
|
|
65
|
+
totalRepsDone: number;
|
|
66
|
+
weight: number;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=ExerciseInterfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExerciseInterfaces.d.ts","sourceRoot":"","sources":["../../../src/lib/models/ExerciseInterfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,0CAA0C,CAAC;AAChF,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,sCAAsC,CAAC;AACxE,OAAO,KAAK,EAAC,8BAA8B,EAAC,MAAM,uDAAuD,CAAC;AAC1G,OAAO,KAAK,EAAC,eAAe,EAAC,M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b,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,4CAA4C;IAC3D,SAAS,EAAE,8BAA8B,EAAE,CAAC;CAC7C;AAED,MAAM,WAAW,yCAAyC;IACxD,SAAS,EAAE,8BAA8B,EAAE,CAAC;CAC7C;AAED,MAAM,MAAM,YAAY,GAClB,uBAAuB,GACvB,0BAA0B,GAC1B,wBAAwB,GACxB,SAAS,GACT,MAAM,CAAC;AAEb,MAAM,WAAW,QAAQ;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAC5C;AAID,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/models/ExerciseInterfaces.ts"],"sourcesContent":["import type {UserStrengthTests} from '../dbmodels/program/UserStrengthTests.js';\nimport type {UserChallenge} from '../dbmodels/program/UserChallenge.js';\nimport type {TranslatedStrengthTestExercise} from '../dbmodels/program/TranslatedStrengthTestExercise.js';\nimport type {ExercisesModels} from '../dbmodels/program/ExerciseModels.js';\n\nexport interface ExerciseModel {\n uuid: string;\n name: string;\n level: string[];\n isCompound: boolean;\n needsEquipment: boolean;\n hasPriority: boolean;\n hasVariations: boolean;\n variations: object;\n muscles: string[];\n homeWorkout: boolean;\n createdBy?: string | null;\n isPublic: boolean;\n}\n\nexport interface ExerciseProgress {\n exerciseUuid: string;\n progress: Progress[];\n}\n\nexport interface UpdateSTRequest {\n body: UserStrengthTests;\n}\n\nexport interface UpdateUserChallengeRequest {\n body: UserChallenge;\n}\n\nexport interface STExerciseProgress {\n exerciseUuid: string;\n progress: Progress;\n}\n\nexport interface ExercisePerformance {\n workoutIndex: number;\n progress: Progress[];\n}\n\nexport interface SwapExerciseRequest {\n exerciseUuid: string;\n}\n\nexport interface ChangeExerciseRequest {\n oldExerciseUuid: string;\n newExercise: ExercisesModels;\n}\n\nexport interface ReducedExercise {\n uuid: string;\n name: string;\n order: number;\n progress?: Progress[];\n sets: string;\n reps: string;\n restTime?: string;\n}\n\nexport interface UpdateTranslatedStrengthTestExercisesRequest {\n exercises: TranslatedStrengthTestExercise[];\n}\n\nexport interface AddTranslatedStrengthTestExercisesRequest {\n exercises: TranslatedStrengthTestExercise[];\n}\n\nexport type ProgramTypes =\n | \"BodyweightHomeWorkout\"\n | \"BodyweightOnlyBodyweight\"\n | \"BodyweightWeightedCali\"\n | \"Weights\"\n | \"Both\";\n\nexport interface Progress {\n [key: string]: number | string | undefined;\n}\n\n\n\nexport interface ProgressByExercise {\n name: string;\n totalRepsDone: number;\n weight: number;\n}\n"],"names":[],"mappings":"AAmFA,WAIC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var NotificationGroups = /*#__PURE__*/ function(NotificationGroups) {
|
|
2
|
+
NotificationGroups["ALL"] = "ALL";
|
|
3
|
+
NotificationGroups["PREMIUM"] = "PREMIUM";
|
|
4
|
+
NotificationGroups["FREE"] = "FREE";
|
|
5
|
+
NotificationGroups["ALL_SHRED"] = "ALL_SHRED";
|
|
6
|
+
NotificationGroups["PREMIUM_SHRED"] = "PREMIUM_SHRED";
|
|
7
|
+
NotificationGroups["FREE_SHRED"] = "FREE_SHRED";
|
|
8
|
+
return NotificationGroups;
|
|
9
|
+
}({});
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=NotificationInterfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/models/NotificationInterfaces.ts"],"sourcesContent":["export interface AndroidMessage {\n message: {\n token: string | string[];\n notification: { body: string; title: string };\n };\n}\n\nexport interface NotificationPayload {\n name: string;\n userUuid: string;\n reminderType?: string;\n delayHours?: number;\n}\n\nexport interface EmailReminderPayload {\n email: string,\n timeZone?: string\n}\n\nexport interface NotificationTranslationRequest {\n language: string;\n text: string;\n type?: NotificationTypes;\n originalNotificationUuid: string;\n}\n\nexport type NotificationTypes =\n | \"challenge_reminder_no_streak\"\n | \"challenge_reminder_streak\"\n | \"workout_reminder_no_streak\"\n | \"workout_reminder\"\n | \"rest_reminder_no_streak\"\n | \"rest_reminder\"\n | \"challenge_alert\"\n | \"workout_alert\"\n | \"rest_alert\"\n | \"workout_exp_alert\"\n | \"challenge_exp_alert\";\n\nexport interface CreateNotificationRequest {\n text: string;\n type: NotificationTypes;\n}\n\nexport interface WorkoutReminder extends NotificationPayload {\n programUuid: string;\n}\nexport interface NotificationRequest {\n title: string;\n body: string;\n redirectPath?: string;\n}\n\nexport interface GroupNotificationRequest {\n notification: NotificationRequest;\n group: NotificationGroups;\n}\n\nexport enum NotificationGroups {\n ALL = \"ALL\",\n PREMIUM = \"PREMIUM\",\n FREE = \"FREE\",\n ALL_SHRED = \"ALL_SHRED\",\n PREMIUM_SHRED = \"PREMIUM_SHRED\",\n FREE_SHRED = \"FREE_SHRED\",\n}\n"],"names":["NotificationGroups"],"mappings":"AA0DA,OAAO,IAAA,AAAKA,4CAAAA;;;;;;;WAAAA;MAOX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/models/ProgramInterfaces.ts"],"sourcesContent":["import type { WorkoutBlueprint } from './BlueprintInterfaces.js';\n\nexport interface ProgramModel {\n programId: string;\n userUuid: string;\n}\nexport interface ProgramIdRequest {\n programId: string;\n}\nexport interface ProgramUserRequest {\n userUuid: string;\n}\nexport interface UserProgramOptions {\n level: string;\n type: string;\n numberOfDays: number;\n userUuid: string;\n}\n\nexport interface ProgramBlueprint {\n programId: string;\n title: string;\n level: string;\n numberOfDays: number;\n workouts: WorkoutBlueprint[];\n}\n"],"names":[],"mappings":"AAmBA,WAMC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/models/UserInterfaces.ts"],"sourcesContent":["import type jwt from \"jsonwebtoken\";\n\nexport interface UserTypes {\n userUuid: string;\n email: string;\n firstName: string;\n lastName: string;\n avatar: string;\n role: string;\n isSubscriptionActive: boolean;\n}\n\nexport interface VerificationStatus {\n status: string;\n}\n\nexport interface TransactionsResponse {\n revision: string;\n bundleId: string;\n environment: string;\n hasMore: boolean;\n signedTransactions: string[];\n errorCode?: number;\n}\n\nexport interface UserInfoModel {\n userUuid: string;\n height: string;\n weight: string;\n}\n\nexport interface SingleTransactionResponse {\n revision: string;\n bundleId: string;\n environment: string;\n hasMore: boolean;\n signedTransactionInfo: string;\n errorCode?: number;\n}\n\nexport interface SubscriptionStatus {\n originalTransactionId: string;\n status: number;\n signedTransactionInfo: string;\n signedRenewalInfo: string;\n}\n\nexport interface SubscriptionStatusResponse {\n environment: string;\n bundleId: string;\n data: [\n {\n subscriptionGroupIdentifier: string;\n lastTransactions: SubscriptionStatus[];\n }\n ];\n errorCode?: number;\n}\n\nexport interface SubscriptionStatusResponseError {\n errorCode: number;\n errorMessage: string;\n}\n\nexport interface SubscriptionStatusResult {\n originalTransactionId: string;\n status: number;\n signedTransactionInfo: string | jwt.JwtPayload | null;\n signedRenewalInfo: string | jwt.JwtPayload | null;\n}\n\nexport interface SignedTransactions {\n transactionId: string;\n originalTransactionId: string;\n webOrderLineItemId: string;\n bundleId: string;\n productId: string;\n subscriptionGroupIdentifier: string;\n purchaseDate: number;\n originalPurchaseDate: number;\n expiresDate: number;\n quantity: number;\n type: string;\n inAppOwnershipType: string;\n signedDate: number;\n environment: string;\n transactionReason: string;\n storefront: string;\n storefrontId: string;\n}\n\nexport interface Credentials {\n refresh_token?: string | null,\n expiry_date?: number | null,\n access_token?: string | null,\n token_type?: string | null ,\n id_token?: string | null,\n scope?: string\n}\n\n\nexport interface LoginRequest {\n email: string;\n password: string;\n}\n\nexport interface UserPhotoRequest {\n base64: string;\n}\n\nexport interface ProgressPhoto {\n date: Date;\n progressPhoto: string;\n userUuid: string;\n}\n\nexport interface ForgotPassword {\n uuid: string;\n userUuid: string;\n token: string;\n date: Date;\n}\n\nexport interface RefreshPayload {\n userUuid: string;\n}\n\nexport interface TokenRequest {\n token: string;\n}\n\nexport interface RefreshRequest {\n refreshToken: string;\n}\n\nexport interface UuidRequest {\n userUuid: string;\n}\n\nexport interface EmailRequest {\n email: string;\n}\n\nexport interface TitleRequest {\n title: string;\n}\n\nexport interface UserPhoto {\n base64: string;\n title: string;\n}\n\nexport default interface AuthenticationToken {\n type: string;\n contents: string;\n}\n\nexport interface RestorePasswordRequest {\n email: string;\n}\n\nexport interface BeforeSubscriptionOptions {\n firstName: string;\n lastName: string;\n sex: string;\n goal: string;\n weightGoal: string;\n level: string;\n type: string;\n days: number;\n}\n\nexport interface AfterSubscriptionOptions {\n dateOfBirth: string;\n metricSystem: string;\n height: string;\n weight: string;\n}\n"],"names":[],"mappings":"AA4KA,WAKC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/models/WorkoutInterfaces.ts"],"sourcesContent":["import type { ExerciseBlueprint } from './BlueprintInterfaces.js';\nimport type {Challenge} from '../dbmodels/program/Challenge.js';\nimport type {StrengthTest} from '../dbmodels/program/StrengthTest.js';\nimport type {TranslatedStrengthTest} from '../dbmodels/program/TranslatedStrengthTest.js';\nimport type {TranslatedChallenge} from '../dbmodels/program/TranslatedChallenge.js';\n\nexport interface WorkoutModel {\n uuid: string;\n isFinished: boolean;\n}\nexport interface SupersetModel {\n uuid: string;\n}\nexport interface WorkoutExerciseModel {\n WorkoutUuid: string;\n ExerciseUuid: string;\n}\nexport interface SupersetExerciseModel {\n SupersetUuid: string;\n ExerciseUuid: string;\n}\nexport interface WorkoutBlueprint {\n uuid: string;\n title: string;\n duration: string;\n exercises: ExerciseBlueprint[];\n superset: SupersetModel[];\n}\n\nexport interface SupersetBlueprint {\n uuid: string;\n workout: WorkoutBlueprint;\n exercise: ExerciseBlueprint[];\n}\n\n\nexport interface WorkoutUuidRequest {\n workoutUuid: string;\n}\n\nexport interface StrengthTestRequest {\n STArray: StrengthTest[] | TranslatedStrengthTest[];\n language: string;\n}\n\nexport interface ChallengeRequest {\n challengeArray: Challenge[] | TranslatedChallenge[];\n language: string;\n}\n\nexport interface UserStrengthTestRequest {\n STid: string;\n}\n\nexport interface WorkoutExerciseModel {\n WorkoutUuid: string;\n ExerciseUuid: string;\n}\n"],"names":[],"mappings":"AAsDA,WAGC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Sequelize CLI wrapper for 90dc-core migrations and seeders
|
|
4
|
+
* This allows services to run migrations/seeders without changing directories
|
|
5
|
+
*/ import { spawn } from "child_process";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
import path from "path";
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = path.dirname(__filename);
|
|
10
|
+
// Get the scripts directory (where migrations and seeders are located)
|
|
11
|
+
const scriptsDir = __dirname;
|
|
12
|
+
const command = process.argv[2];
|
|
13
|
+
const args = process.argv.slice(3);
|
|
14
|
+
if (!command) {
|
|
15
|
+
console.error('❌ No command provided');
|
|
16
|
+
console.log('');
|
|
17
|
+
console.log('Usage:');
|
|
18
|
+
console.log(' node node_modules/90dc-core/scripts/cli.js <command> [args]');
|
|
19
|
+
console.log('');
|
|
20
|
+
console.log('Available commands:');
|
|
21
|
+
console.log(' migrate - Run all pending migrations');
|
|
22
|
+
console.log(' migrate:undo - Undo last migration');
|
|
23
|
+
console.log(' migrate:status - Show migration status');
|
|
24
|
+
console.log(' seed - Run all seeders');
|
|
25
|
+
console.log(' seed:undo - Undo all seeders');
|
|
26
|
+
console.log(' migration:generate - Generate new migration');
|
|
27
|
+
console.log(' seed:generate - Generate new seeder');
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
// Map friendly commands to sequelize-cli commands
|
|
31
|
+
const commandMap = {
|
|
32
|
+
'migrate': [
|
|
33
|
+
'db:migrate'
|
|
34
|
+
],
|
|
35
|
+
'migrate:undo': [
|
|
36
|
+
'db:migrate:undo'
|
|
37
|
+
],
|
|
38
|
+
'migrate:undo:all': [
|
|
39
|
+
'db:migrate:undo:all'
|
|
40
|
+
],
|
|
41
|
+
'migrate:status': [
|
|
42
|
+
'db:migrate:status'
|
|
43
|
+
],
|
|
44
|
+
'seed': [
|
|
45
|
+
'db:seed:all'
|
|
46
|
+
],
|
|
47
|
+
'seed:undo': [
|
|
48
|
+
'db:seed:undo:all'
|
|
49
|
+
],
|
|
50
|
+
'migration:generate': [
|
|
51
|
+
'migration:generate',
|
|
52
|
+
'--name',
|
|
53
|
+
...args
|
|
54
|
+
],
|
|
55
|
+
'seed:generate': [
|
|
56
|
+
'seed:generate',
|
|
57
|
+
'--name',
|
|
58
|
+
...args
|
|
59
|
+
]
|
|
60
|
+
};
|
|
61
|
+
const sequelizeArgs = commandMap[command];
|
|
62
|
+
if (!sequelizeArgs) {
|
|
63
|
+
console.error(`❌ Unknown command: ${command}`);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
// Run sequelize-cli from the scripts directory
|
|
67
|
+
// Set the --options-path to use .sequelizerc.cjs
|
|
68
|
+
const sequelizeCli = spawn('npx', [
|
|
69
|
+
'sequelize-cli',
|
|
70
|
+
'--options-path',
|
|
71
|
+
path.join(scriptsDir, '.sequelizerc.cjs'),
|
|
72
|
+
...sequelizeArgs
|
|
73
|
+
], {
|
|
74
|
+
cwd: scriptsDir,
|
|
75
|
+
stdio: 'inherit',
|
|
76
|
+
shell: true
|
|
77
|
+
});
|
|
78
|
+
sequelizeCli.on('exit', (code)=>{
|
|
79
|
+
process.exit(code);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/scripts/cli.mjs"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * Sequelize CLI wrapper for 90dc-core migrations and seeders\n * This allows services to run migrations/seeders without changing directories\n */\n\nimport { spawn } from 'child_process';\nimport { fileURLToPath } from 'url';\nimport path from 'path';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\n// Get the scripts directory (where migrations and seeders are located)\nconst scriptsDir = __dirname;\nconst command = process.argv[2];\nconst args = process.argv.slice(3);\n\nif (!command) {\n console.error('❌ No command provided');\n console.log('');\n console.log('Usage:');\n console.log(' node node_modules/90dc-core/scripts/cli.js <command> [args]');\n console.log('');\n console.log('Available commands:');\n console.log(' migrate - Run all pending migrations');\n console.log(' migrate:undo - Undo last migration');\n console.log(' migrate:status - Show migration status');\n console.log(' seed - Run all seeders');\n console.log(' seed:undo - Undo all seeders');\n console.log(' migration:generate - Generate new migration');\n console.log(' seed:generate - Generate new seeder');\n process.exit(1);\n}\n\n// Map friendly commands to sequelize-cli commands\nconst commandMap = {\n 'migrate': ['db:migrate'],\n 'migrate:undo': ['db:migrate:undo'],\n 'migrate:undo:all': ['db:migrate:undo:all'],\n 'migrate:status': ['db:migrate:status'],\n 'seed': ['db:seed:all'],\n 'seed:undo': ['db:seed:undo:all'],\n 'migration:generate': ['migration:generate', '--name', ...args],\n 'seed:generate': ['seed:generate', '--name', ...args],\n};\n\nconst sequelizeArgs = commandMap[command];\n\nif (!sequelizeArgs) {\n console.error(`❌ Unknown command: ${command}`);\n process.exit(1);\n}\n\n// Run sequelize-cli from the scripts directory\n// Set the --options-path to use .sequelizerc.cjs\nconst sequelizeCli = spawn(\n 'npx',\n ['sequelize-cli', '--options-path', path.join(scriptsDir, '.sequelizerc.cjs'), ...sequelizeArgs],\n {\n cwd: scriptsDir,\n stdio: 'inherit',\n shell: true\n }\n);\n\nsequelizeCli.on('exit', (code) => {\n process.exit(code);\n});\n"],"names":["spawn","fileURLToPath","path","__filename","url","__dirname","dirname","scriptsDir","command","process","argv","args","slice","console","error","log","exit","commandMap","sequelizeArgs","sequelizeCli","join","cwd","stdio","shell","on","code"],"m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B,IAAI,CAACb,YAAY;OAAwBW;CAAc,EAChG;IACEG,KAAKd;IACLe,OAAO;IACPC,OAAO;AACT;AAGFJ,aAAaK,EAAE,CAAC,QAAQ,CAACC;IACvBhB,QAAQO,IAAI,CAACS;AACf"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ExercisesModels } from "../dbmodels/program/ExerciseModels.js";
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import { DatabaseClient } from "../classes/Database.js";
|
|
4
|
+
/**
|
|
5
|
+
* Script to populate thumbnailUrl for all exercises that have a Vimeo URL
|
|
6
|
+
* Run with: npx ts-node src/lib/scripts/populate-exercise-thumbnails.ts
|
|
7
|
+
*/ async function populateThumbnails() {
|
|
8
|
+
console.log("Starting thumbnail population...");
|
|
9
|
+
// Initialize database connection
|
|
10
|
+
console.log("Database connected");
|
|
11
|
+
// Fetch all exercises that have a URL but no thumbnail
|
|
12
|
+
const exercises = await ExercisesModels.findAll({
|
|
13
|
+
where: {
|
|
14
|
+
thumbnailUrl: null
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
console.log(`Found ${exercises.length} exercises without thumbnails`);
|
|
18
|
+
let successCount = 0;
|
|
19
|
+
let failCount = 0;
|
|
20
|
+
for (const exercise of exercises){
|
|
21
|
+
if (!exercise.url) {
|
|
22
|
+
console.log(`Skipping ${exercise.name} - no URL`);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
console.log(`Fetching thumbnail for: ${exercise.name}`);
|
|
27
|
+
const response = await axios.get(`https://vimeo.com/api/oembed.json?url=${exercise.url}`, {
|
|
28
|
+
timeout: 5000
|
|
29
|
+
});
|
|
30
|
+
const thumbnailUrl = response.data.thumbnail_url;
|
|
31
|
+
if (thumbnailUrl) {
|
|
32
|
+
await exercise.update({
|
|
33
|
+
thumbnailUrl
|
|
34
|
+
});
|
|
35
|
+
console.log(`✓ Updated ${exercise.name}`);
|
|
36
|
+
successCount++;
|
|
37
|
+
} else {
|
|
38
|
+
console.log(`✗ No thumbnail found for ${exercise.name}`);
|
|
39
|
+
failCount++;
|
|
40
|
+
}
|
|
41
|
+
// Rate limiting - wait 100ms between requests
|
|
42
|
+
await new Promise((resolve)=>setTimeout(resolve, 100));
|
|
43
|
+
} catch (error) {
|
|
44
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
45
|
+
console.error(`✗ Error fetching thumbnail for ${exercise.name}:`, errorMessage);
|
|
46
|
+
failCount++;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
console.log("\n=== Summary ===");
|
|
50
|
+
console.log(`Total exercises: ${exercises.length}`);
|
|
51
|
+
console.log(`✓ Success: ${successCount}`);
|
|
52
|
+
console.log(`✗ Failed: ${failCount}`);
|
|
53
|
+
await DatabaseClient.close();
|
|
54
|
+
console.log("Database connection closed");
|
|
55
|
+
}
|
|
56
|
+
populateThumbnails().then(()=>{
|
|
57
|
+
console.log("Script completed successfully");
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}).catch((error)=>{
|
|
60
|
+
console.error("Script failed:", error);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=populate-exercise-thumbnails.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/scripts/populate-exercise-thumbnails.ts"],"sourcesContent":["import { ExercisesModels } from \"../dbmodels/program/ExerciseModels.js\";\nimport axios from \"axios\";\nimport {DatabaseClient} from \"../classes/Database.js\";\n\n/**\n * Script to populate thumbnailUrl for all exercises that have a Vimeo URL\n * Run with: npx ts-node src/lib/scripts/populate-exercise-thumbnails.ts\n */\n\nasync function populateThumbnails() {\n console.log(\"Starting thumbnail population...\");\n\n // Initialize database connection\n console.log(\"Database connected\");\n\n // Fetch all exercises that have a URL but no thumbnail\n const exercises = await ExercisesModels.findAll({\n where: {\n thumbnailUrl: null,\n },\n });\n\n console.log(`Found ${exercises.length} exercises without thumbnails`);\n\n let successCount = 0;\n let failCount = 0;\n\n for (const exercise of exercises) {\n if (!exercise.url) {\n console.log(`Skipping ${exercise.name} - no URL`);\n continue;\n }\n\n try {\n console.log(`Fetching thumbnail for: ${exercise.name}`);\n const response = await axios.get(\n `https://vimeo.com/api/oembed.json?url=${exercise.url}`,\n { timeout: 5000 }\n );\n\n const thumbnailUrl = response.data.thumbnail_url;\n\n if (thumbnailUrl) {\n await exercise.update({ thumbnailUrl });\n console.log(`✓ Updated ${exercise.name}`);\n successCount++;\n } else {\n console.log(`✗ No thumbnail found for ${exercise.name}`);\n failCount++;\n }\n\n // Rate limiting - wait 100ms between requests\n await new Promise((resolve) => setTimeout(resolve, 100));\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n console.error(`✗ Error fetching thumbnail for ${exercise.name}:`, errorMessage);\n failCount++;\n }\n }\n\n console.log(\"\\n=== Summary ===\");\n console.log(`Total exercises: ${exercises.length}`);\n console.log(`✓ Success: ${successCount}`);\n console.log(`✗ Failed: ${failCount}`);\n\n await DatabaseClient.close();\n console.log(\"Database connection closed\");\n}\n\npopulateThumbnails()\n .then(() => {\n console.log(\"Script completed successfully\");\n process.exit(0);\n })\n .catch((error) => {\n console.error(\"Script failed:\", error);\n process.exit(1);\n });\n"],"names":["ExercisesModels","axios","DatabaseClient","populateThumbnails","console","log","exercises","findAll","where","thumbnailUrl","length","successCount","failCount","exercise","url","name","response","get","timeout","data","thumbnail_url","update","Promise","resolve","setTimeout","error","errorMessage","Error","message","String","close","then","process","exit","catch"],"mappings":"AAAA,SAASA,eAAe,QAAQ,wCAAwC;AACxE,OAAOC,WAAW,QAAQ;AAC1B,SAAQC,cAAc,QAAO,yBAAyB;AAEtD;;;CAGC,GAED,eAAeC;IACbC,QAAQC,GAAG,CAAC;IAEZ,iCAAiC;IACjCD,QAAQC,GAAG,CAAC;IAEZ,uDAAuD;IACvD,MAAMC,YAAY,MAAMN,gBAAgBO,OAAO,CAAC;QAC9CC,OAAO;YAC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W;IAEpC,MAAMV,eAAe4B,KAAK;IAC1B1B,QAAQC,GAAG,CAAC;AACd;AAEAF,qBACG4B,IAAI,CAAC;IACJ3B,QAAQC,GAAG,CAAC;IACZ2B,QAAQC,IAAI,CAAC;AACf,GACCC,KAAK,CAAC,CAACT;IACNrB,QAAQqB,KAAK,CAAC,kBAAkBA;IAChCO,QAAQC,IAAI,CAAC;AACf"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Database Setup Script for 90DC Project
|
|
4
|
+
* This script initializes the database and runs Sequelize sync to create all tables
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* npm run db:setup
|
|
8
|
+
* or
|
|
9
|
+
* node --loader ts-node/esm --es-module-specifier-resolution=node scripts/setup-database.ts
|
|
10
|
+
*/ import { Sequelize } from "sequelize";
|
|
11
|
+
const DB_HOST = process.env.DB_HOST || 'localhost';
|
|
12
|
+
const DB_NAME = process.env.DB_NAME || 'postgres';
|
|
13
|
+
const DB_USER = process.env.DB_USER || 'postgres';
|
|
14
|
+
const DB_PASSWORD = process.env.DB_PASSWORD || 'postgres_dev_password';
|
|
15
|
+
async function setupDatabase() {
|
|
16
|
+
console.log('🚀 Starting database setup...\n');
|
|
17
|
+
const sequelize = new Sequelize(DB_NAME, DB_USER, DB_PASSWORD, {
|
|
18
|
+
dialect: 'postgres',
|
|
19
|
+
host: DB_HOST,
|
|
20
|
+
logging: console.log
|
|
21
|
+
});
|
|
22
|
+
try {
|
|
23
|
+
console.log('📡 Testing database connection...');
|
|
24
|
+
await sequelize.authenticate();
|
|
25
|
+
console.log('✅ Database connection established successfully.\n');
|
|
26
|
+
console.log('🔧 Creating PostgreSQL extensions...');
|
|
27
|
+
await sequelize.query('CREATE EXTENSION IF NOT EXISTS "uuid-ossp"');
|
|
28
|
+
await sequelize.query('CREATE EXTENSION IF NOT EXISTS "pg_trgm"');
|
|
29
|
+
console.log('✅ Extensions created successfully.\n');
|
|
30
|
+
console.log('✨ Database setup completed successfully!\n');
|
|
31
|
+
console.log('Next steps:');
|
|
32
|
+
console.log(' Run the program service to sync models: cd 90dc-program-service/app && npm run dev');
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error('❌ Error setting up database:', error);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
} finally{
|
|
37
|
+
await sequelize.close();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Run the setup
|
|
41
|
+
setupDatabase();
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=setup-database.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/scripts/setup-database.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * Database Setup Script for 90DC Project\n * This script initializes the database and runs Sequelize sync to create all tables\n *\n * Usage:\n * npm run db:setup\n * or\n * node --loader ts-node/esm --es-module-specifier-resolution=node scripts/setup-database.ts\n */\n\nimport { Sequelize } from 'sequelize';\n\nconst DB_HOST = process.env.DB_HOST || 'localhost';\nconst DB_NAME = process.env.DB_NAME || 'postgres';\nconst DB_USER = process.env.DB_USER || 'postgres';\nconst DB_PASSWORD = process.env.DB_PASSWORD || 'postgres_dev_password';\n\nasync function setupDatabase() {\n console.log('🚀 Starting database setup...\\n');\n\n const sequelize = new Sequelize(DB_NAME, DB_USER, DB_PASSWORD, {\n dialect: 'postgres',\n host: DB_HOST,\n logging: console.log,\n });\n\n try {\n console.log('📡 Testing database connection...');\n await sequelize.authenticate();\n console.log('✅ Database connection established successfully.\\n');\n\n console.log('🔧 Creating PostgreSQL extensions...');\n await sequelize.query('CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\"');\n await sequelize.query('CREATE EXTENSION IF NOT EXISTS \"pg_trgm\"');\n console.log('✅ Extensions created successfully.\\n');\n\n console.log('✨ Database setup completed successfully!\\n');\n console.log('Next steps:');\n console.log(' Run the program service to sync models: cd 90dc-program-service/app && npm run dev');\n\n } catch (error) {\n console.error('❌ Error setting up database:', error);\n process.exit(1);\n } finally {\n await sequelize.close();\n }\n}\n\n// Run the setup\nsetupDatabase();\n"],"names":["Sequelize","DB_HOST","process","env","DB_NAME","DB_USER","DB_PASSWORD","setupDatabase","console","log","sequelize","dialect","host","logging","authenticate","query","error","exit","close"],"mappings":";AACA;;;;;;;;CAQC,GAED,SAASA,SAAS,QAAQ,YAAY;AAEtC,MAAMC,UAAUC,QAAQC,GAAG,CAACF,OAAO,IAAI;AACvC,MAAMG,UAAUF,QAAQC,GAAG,CAACC,OAAO,IAAI;AACvC,MAAMC,UAAUH,QAAQC,GAAG,CAACE,OAAO,IAAI;AACvC,MAAMC,cAAcJ,QAAQC,GAAG,CAACG,WAAW,IAAI;AAE/C,eAAeC;IACbC,QAAQC,GAAG,CAAC;IAEZ,MAAMC,YAAY,IAAIV,UAAUI,SAASC,SAASC,aAAa;QAC7DK,SAAS;QACTC,MAAMX;QACNY,SAASL,QAAQC,GAAG;IACtB;IAEA,IAAI;QACFD,QAAQC,GAAG,CAAC;QACZ,MAAMC,UAAUI,YAAY;QAC5BN,QAAQC,GAAG,CAAC;QAEZD,QAAQC,GAAG,CAAC;QACZ,MAAMC,UAAUK,KAAK,CAAC;QACtB,MAAML,UAAUK,KAAK,CAAC;QACtBP,QAAQC,GAAG,CAAC;QAEZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;IAEd,EAAE,OAAOO,OAAO;QACdR,QAAQQ,KAAK,CAAC,gCAAgCA;QAC9Cd,QAAQe,IAAI,CAAC;IACf,SAAU;QACR,MAAMP,UAAUQ,KAAK;IACvB;AACF;AAEA,gBAAgB;AAChBX"}
|