90dc-core 1.14.2 → 1.14.4

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.
@@ -3,8 +3,10 @@ import type { Optional } from "sequelize";
3
3
  import { TranslatedRecipe } from "./TranslatedRecipe.js";
4
4
  import { RecipeTag } from "./RecipeTag.js";
5
5
  import { RecipeIngredient } from "./RecipeIngredient.js";
6
+ import { PersistedUser } from "../user/PersistedUser.js";
6
7
  export interface RecipeAttributes {
7
8
  uuid: string;
9
+ createdBy?: string | null;
8
10
  title: string;
9
11
  duration: string;
10
12
  content: string;
@@ -26,10 +28,11 @@ export interface RecipeAttributes {
26
28
  createdAt?: Date;
27
29
  updatedAt?: Date;
28
30
  }
29
- export interface RecipeCreationAttributes extends Optional<RecipeAttributes, "uuid" | "createdAt" | "updatedAt" | "coverImageUrl" | "ingredientsImageUrl" | "methodImageUrl" | "imageUploadedAt"> {
31
+ export interface RecipeCreationAttributes extends Optional<RecipeAttributes, "uuid" | "createdBy" | "createdAt" | "updatedAt" | "coverImageUrl" | "ingredientsImageUrl" | "methodImageUrl" | "imageUploadedAt"> {
30
32
  }
31
33
  export declare class Recipe extends Model<RecipeAttributes, RecipeCreationAttributes> {
32
34
  uuid: string;
35
+ createdBy: string | null;
33
36
  title: string;
34
37
  duration: string;
35
38
  content: string;
@@ -51,5 +54,6 @@ export declare class Recipe extends Model<RecipeAttributes, RecipeCreationAttrib
51
54
  imageUploadedAt?: Date | null;
52
55
  translatedRecipes: TranslatedRecipe[];
53
56
  recipeIngredients: RecipeIngredient[];
57
+ creator: PersistedUser;
54
58
  }
55
59
  //# sourceMappingURL=Recipe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Recipe.d.ts","sourceRoot":"","sources":["../../../../src/lib/dbmodels/diet/Recipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,EAEN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,QAAQ,EAAE,MA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,CAAC;IAGhB,WAAW,EAAE,MAAM,CAAC;IAGpB,MAAM,EAAE,MAAM,CAAC;IAGf,aAAa,EAAE,MAAM,CAAC;IAGtB,kBAAkB,EAAE,OAAO,CAAC;IAG5B,kBAAkB,EAAE,OAAO,CAAC;IAI5B,gBAAgB,EAAE,OAAO,CAAC;IAG1B,IAAI,EAAE,SAAS,EAAE,CAAC;IAGlB,KAAK,EAAE,MAAM,CAAC;IAGd,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGpC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG/B,eAAe,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAG9B,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IAGtC,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IAGtC,OAAO,EAAE,aAAa,CAAC;CAChC"}
@@ -4,11 +4,12 @@ function _ts_decorate(decorators, target, key, desc) {
4
4
  else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  }
7
- import { BelongsToMany, Column, DataType, Default, HasMany, Model, Table } from "sequelize-typescript";
7
+ import { BelongsTo, BelongsToMany, Column, DataType, Default, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
8
8
  import { TranslatedRecipe } from "./TranslatedRecipe.js";
9
9
  import { RecipeTag } from "./RecipeTag.js";
10
10
  import { RecipeTags } from "./RecipeTags.js";
11
11
  import { RecipeIngredient } from "./RecipeIngredient.js";
12
+ import { PersistedUser } from "../user/PersistedUser.js";
12
13
  export class Recipe extends Model {
13
14
  }
14
15
  _ts_decorate([
@@ -20,6 +21,13 @@ _ts_decorate([
20
21
  primaryKey: true
21
22
  })
22
23
  ], Recipe.prototype, "uuid", void 0);
24
+ _ts_decorate([
25
+ ForeignKey(()=>PersistedUser),
26
+ Column({
27
+ type: DataType.UUID,
28
+ allowNull: true
29
+ })
30
+ ], Recipe.prototype, "createdBy", void 0);
23
31
  _ts_decorate([
24
32
  Column({
25
33
  type: DataType.TEXT,
@@ -148,6 +156,9 @@ _ts_decorate([
148
156
  onDelete: "CASCADE"
149
157
  })
150
158
  ], Recipe.prototype, "recipeIngredients", void 0);
159
+ _ts_decorate([
160
+ BelongsTo(()=>PersistedUser)
161
+ ], Recipe.prototype, "creator", void 0);
151
162
  Recipe = _ts_decorate([
152
163
  Table
153
164
  ], Recipe);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/dbmodels/diet/Recipe.ts"],"sourcesContent":["import {\n BelongsToMany,\n Column,\n DataType,\n Default,\n HasMany,\n Model,\n Table,\n} from \"sequelize-typescript\";\nimport type { Optional } from \"sequelize\";\nimport { TranslatedRecipe } from \"./TranslatedRecipe.js\";\nimport { RecipeTag } from \"./RecipeTag.js\";\nimport { RecipeTags } from \"./RecipeTags.js\";\nimport { RecipeIngredient } from \"./RecipeIngredient.js\";\n\nexport interface RecipeAttributes {\n uuid: string;\n title: string;\n duration: string;\n content: string;\n kcal: string;\n fat: string;\n carbs: string;\n protein: string;\n ingredients: string;\n method: string;\n tipsAndTricks: string;\n ShowForFreeVersion: boolean;\n LockForFreeVersion: boolean;\n isCoachingRecipe: boolean;\n order: number;\n coverImageUrl?: string | null;\n ingredientsImageUrl?: string | null;\n methodImageUrl?: string | null;\n imageUploadedAt?: Date | null;\n createdAt?: Date;\n updatedAt?: Date;\n}\n\nexport interface RecipeCreationAttributes extends Optional<RecipeAttributes, \"uuid\" | \"createdAt\" | \"updatedAt\" | \"coverImageUrl\" | \"ingredientsImageUrl\" | \"methodImageUrl\" | \"imageUploadedAt\"> {\n}\n\n@Table\nexport class Recipe extends Model<RecipeAttributes, RecipeCreationAttributes> {\n @Default(DataType.UUIDV4)\n @Column({\n type: DataType.UUID,\n defaultValue: DataType.UUID,\n allowNull: false,\n primaryKey: true,\n })\n declare uuid: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare title: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare duration: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare content: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare kcal: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare fat: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare carbs: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare protein: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare ingredients: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare method: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare tipsAndTricks: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false, defaultValue: false })\n declare ShowForFreeVersion: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false, defaultValue: false })\n declare LockForFreeVersion: boolean;\n\n @Default(true)\n @Column({ type: DataType.BOOLEAN, allowNull: false, defaultValue: false })\n declare isCoachingRecipe: boolean;\n\n @BelongsToMany(() => RecipeTag, { through: () => RecipeTags, as: \"tags\" })\n declare tags: RecipeTag[];\n\n @Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 0 })\n declare order: number;\n\n @Column({ type: DataType.STRING(500), allowNull: true })\n declare coverImageUrl?: string | null;\n\n @Column({ type: DataType.STRING(500), allowNull: true })\n declare ingredientsImageUrl?: string | null;\n\n @Column({ type: DataType.STRING(500), allowNull: true })\n declare methodImageUrl?: string | null;\n\n @Column({ type: DataType.DATE, allowNull: true })\n declare imageUploadedAt?: Date | null;\n\n @HasMany(() => TranslatedRecipe)\n declare translatedRecipes: TranslatedRecipe[];\n\n @HasMany(() => RecipeIngredient, { foreignKey: \"recipeUuid\", onDelete: \"CASCADE\" })\n declare recipeIngredients: RecipeIngredient[];\n}\n"],"names":["BelongsToMany","Column","DataType","Default","HasMany","Model","Table","TranslatedRecipe","RecipeTag","RecipeTags","RecipeIngredient","Recipe","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","TEXT","BOOLEAN","through","as","INTEGER","STRING","DATE","foreignKey","onDelete"],"mappings":";;;;;;AAAA,SACEA,aAAa,EACbC,MAAM,EACNC,QAAQ,EACRC,OAAO,EACPC,OAAO,EACPC,KAAK,EACLC,KAAK,QACA,uBAAuB;AAE9B,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,gBAAgB,QAAQ,wBAAwB;AA8BzD,OAAO,MAAMC,eAAeN;AAyE5B;;qBAxEoBO;;QAEhBC,MAAMX,SAASY,IAAI;QACnBC,cAAcb,SAASY,IAAI;QAC3BE,WAAW;QACXC,YAAY;;;;;QAIJJ,MAAMX,SAASgB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMX,SAASgB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMX,SAASgB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMX,SAASgB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMX,SAASgB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMX,SAASgB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMX,SAASgB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMX,SAASgB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMX,SAASgB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMX,SAASgB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMX,SAASiB,OAAO;QAAEH,WAAW;QAAOD,cAAc;;;;;QAGxDF,MAAMX,SAASiB,OAAO;QAAEH,WAAW;QAAOD,cAAc;;;;;;QAIxDF,MAAMX,SAASiB,OAAO;QAAEH,WAAW;QAAOD,cAAc;;;;sBAG7CP;QAAaY,SAAS,IAAMX;QAAYY,IAAI;;;;;QAGvDR,MAAMX,SAASoB,OAAO;QAAEN,WAAW;QAAOD,cAAc;;;;;QAGxDF,MAAMX,SAASqB,MAAM,CAAC;QAAMP,WAAW;;;;;QAGvCH,MAAMX,SAASqB,MAAM,CAAC;QAAMP,WAAW;;;;;QAGvCH,MAAMX,SAASqB,MAAM,CAAC;QAAMP,WAAW;;;;;QAGvCH,MAAMX,SAASsB,IAAI;QAAER,WAAW;;;;gBAG3BT;;;gBAGAG;QAAoBe,YAAY;QAAcC,UAAU"}
1
+ {"version":3,"sources":["../../../../src/lib/dbmodels/diet/Recipe.ts"],"sourcesContent":["import {\n BelongsTo,\n BelongsToMany,\n Column,\n DataType,\n Default,\n ForeignKey,\n HasMany,\n Model,\n Table,\n} from \"sequelize-typescript\";\nimport type { Optional } from \"sequelize\";\nimport { TranslatedRecipe } from \"./TranslatedRecipe.js\";\nimport { RecipeTag } from \"./RecipeTag.js\";\nimport { RecipeTags } from \"./RecipeTags.js\";\nimport { RecipeIngredient } from \"./RecipeIngredient.js\";\nimport { PersistedUser } from \"../user/PersistedUser.js\";\n\nexport interface RecipeAttributes {\n uuid: string;\n createdBy?: string | null;\n title: string;\n duration: string;\n content: string;\n kcal: string;\n fat: string;\n carbs: string;\n protein: string;\n ingredients: string;\n method: string;\n tipsAndTricks: string;\n ShowForFreeVersion: boolean;\n LockForFreeVersion: boolean;\n isCoachingRecipe: boolean;\n order: number;\n coverImageUrl?: string | null;\n ingredientsImageUrl?: string | null;\n methodImageUrl?: string | null;\n imageUploadedAt?: Date | null;\n createdAt?: Date;\n updatedAt?: Date;\n}\n\nexport interface RecipeCreationAttributes extends Optional<RecipeAttributes, \"uuid\" | \"createdBy\" | \"createdAt\" | \"updatedAt\" | \"coverImageUrl\" | \"ingredientsImageUrl\" | \"methodImageUrl\" | \"imageUploadedAt\"> {\n}\n\n@Table\nexport class Recipe extends Model<RecipeAttributes, RecipeCreationAttributes> {\n @Default(DataType.UUIDV4)\n @Column({\n type: DataType.UUID,\n defaultValue: DataType.UUID,\n allowNull: false,\n primaryKey: true,\n })\n declare uuid: string;\n\n @ForeignKey(() => PersistedUser)\n @Column({\n type: DataType.UUID,\n allowNull: true,\n })\n declare createdBy: string | null;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare title: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare duration: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare content: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare kcal: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare fat: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare carbs: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare protein: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare ingredients: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare method: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare tipsAndTricks: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false, defaultValue: false })\n declare ShowForFreeVersion: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false, defaultValue: false })\n declare LockForFreeVersion: boolean;\n\n @Default(true)\n @Column({ type: DataType.BOOLEAN, allowNull: false, defaultValue: false })\n declare isCoachingRecipe: boolean;\n\n @BelongsToMany(() => RecipeTag, { through: () => RecipeTags, as: \"tags\" })\n declare tags: RecipeTag[];\n\n @Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 0 })\n declare order: number;\n\n @Column({ type: DataType.STRING(500), allowNull: true })\n declare coverImageUrl?: string | null;\n\n @Column({ type: DataType.STRING(500), allowNull: true })\n declare ingredientsImageUrl?: string | null;\n\n @Column({ type: DataType.STRING(500), allowNull: true })\n declare methodImageUrl?: string | null;\n\n @Column({ type: DataType.DATE, allowNull: true })\n declare imageUploadedAt?: Date | null;\n\n @HasMany(() => TranslatedRecipe)\n declare translatedRecipes: TranslatedRecipe[];\n\n @HasMany(() => RecipeIngredient, { foreignKey: \"recipeUuid\", onDelete: \"CASCADE\" })\n declare recipeIngredients: RecipeIngredient[];\n\n @BelongsTo(() => PersistedUser)\n declare creator: PersistedUser;\n}\n"],"names":["BelongsTo","BelongsToMany","Column","DataType","Default","ForeignKey","HasMany","Model","Table","TranslatedRecipe","RecipeTag","RecipeTags","RecipeIngredient","PersistedUser","Recipe","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","TEXT","BOOLEAN","through","as","INTEGER","STRING","DATE","foreignKey","onDelete"],"mappings":";;;;;;AAAA,SACEA,SAAS,EACTC,aAAa,EACbC,MAAM,EACNC,QAAQ,EACRC,OAAO,EACPC,UAAU,EACVC,OAAO,EACPC,KAAK,EACLC,KAAK,QACA,uBAAuB;AAE9B,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,aAAa,QAAQ,2BAA2B;AA+BzD,OAAO,MAAMC,eAAeP;AAmF5B;;qBAlFoBQ;;QAEhBC,MAAMb,SAASc,IAAI;QACnBC,cAAcf,SAASc,IAAI;QAC3BE,WAAW;QACXC,YAAY;;;;mBAIIP;;QAEhBG,MAAMb,SAASc,IAAI;QACnBE,WAAW;;;;;QAIHH,MAAMb,SAASkB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMb,SAASkB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMb,SAASkB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMb,SAASkB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMb,SAASkB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMb,SAASkB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMb,SAASkB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMb,SAASkB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMb,SAASkB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMb,SAASkB,IAAI;QAAEF,WAAW;;;;;QAGhCH,MAAMb,SAASmB,OAAO;QAAEH,WAAW;QAAOD,cAAc;;;;;QAGxDF,MAAMb,SAASmB,OAAO;QAAEH,WAAW;QAAOD,cAAc;;;;;;QAIxDF,MAAMb,SAASmB,OAAO;QAAEH,WAAW;QAAOD,cAAc;;;;sBAG7CR;QAAaa,SAAS,IAAMZ;QAAYa,IAAI;;;;;QAGvDR,MAAMb,SAASsB,OAAO;QAAEN,WAAW;QAAOD,cAAc;;;;;QAGxDF,MAAMb,SAASuB,MAAM,CAAC;QAAMP,WAAW;;;;;QAGvCH,MAAMb,SAASuB,MAAM,CAAC;QAAMP,WAAW;;;;;QAGvCH,MAAMb,SAASuB,MAAM,CAAC;QAAMP,WAAW;;;;;QAGvCH,MAAMb,SAASwB,IAAI;QAAER,WAAW;;;;gBAG3BV;;;gBAGAG;QAAoBgB,YAAY;QAAcC,UAAU;;;;kBAGtDhB"}
@@ -20,6 +20,7 @@ export declare class ExercisesModels extends Model implements ExerciseModel {
20
20
  programType: ProgramTypes[];
21
21
  graphData: "reps" | "weight";
22
22
  imageUrl: string;
23
+ createdBy: string | null;
23
24
  translatedExercises: TranslatedExerciseModel[];
24
25
  }
25
26
  //# sourceMappingURL=ExerciseModels.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExerciseModels.d.ts","sourceRoot":"","sources":["../../../../src/lib/dbmodels/program/ExerciseModels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,EAAS,MAAM,sBAAsB,CAAC;AACxF,OAAO,KAAK,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AAErE,qBACa,eAAgB,SAAQ,KAAM,YAAW,aAAa;IAQvD,IAAI,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,MAAM,CAAC;IAGb,QAAQ,EAAE,MAAM,CAAC;IAGjB,QAAQ,EAAE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;IAGnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAGlB,WAAW,EAAE,OAAO,CAAC;IAGrB,cAAc,EAAE,OAAO,CAAC;IAGxB,WAAW,EAAE,YAAY,EAAE,CAAC;IAG5B,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;IAG7B,QAAQ,EAAE,MAAM,CAAC;IAGjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAGzB,mBAAmB,EAAE,uBAAuB,EAAE,CAAC;CAC1D"}
@@ -120,6 +120,12 @@ _ts_decorate([
120
120
  allowNull: false
121
121
  })
122
122
  ], ExercisesModels.prototype, "imageUrl", void 0);
123
+ _ts_decorate([
124
+ Column({
125
+ type: DataType.STRING,
126
+ allowNull: true
127
+ })
128
+ ], ExercisesModels.prototype, "createdBy", void 0);
123
129
  _ts_decorate([
124
130
  HasMany(()=>TranslatedExerciseModel)
125
131
  ], ExercisesModels.prototype, "translatedExercises", void 0);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/dbmodels/program/ExerciseModels.ts"],"sourcesContent":["import { Column, DataType, Default, HasMany, Model, Table } from \"sequelize-typescript\";\nimport type {ExerciseModel, ProgramTypes} from '../../models/ExerciseInterfaces.js';\nimport {TranslatedExerciseModel} from './TranslatedExerciseModel.js';\n\n@Table\nexport class ExercisesModels extends Model implements ExerciseModel {\n @Default(DataType.UUIDV4)\n @Column({\n type: DataType.UUID,\n defaultValue: DataType.UUID,\n allowNull: false,\n primaryKey: true,\n })\n declare uuid: string;\n\n @Column({ type: DataType.STRING, allowNull: false })\n declare name: string;\n\n @Column({ type: DataType.STRING, allowNull: true })\n declare restTime: string;\n\n @Column({ type: DataType.STRING(2048), allowNull: false })\n declare pointers: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare isCustom: boolean;\n\n @Column({ type: DataType.STRING, allowNull: false })\n declare url: string;\n\n @Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n declare level: string[];\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare hasPriority: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare isCompound: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare hasVariations: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare needsEquipment: boolean;\n\n @Column({ type: DataType.JSONB, allowNull: false })\n declare variations: object;\n\n @Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n declare muscles: string[];\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare homeWorkout: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false, defaultValue: false })\n declare isBandAssisted: boolean;\n\n @Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n declare programType: ProgramTypes[];\n\n @Column({ type: DataType.STRING, allowNull: false })\n declare graphData: \"reps\" | \"weight\";\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare imageUrl: string;\n\n @HasMany(() => TranslatedExerciseModel)\n declare translatedExercises: TranslatedExerciseModel[];\n}\n"],"names":["Column","DataType","Default","HasMany","Model","Table","TranslatedExerciseModel","ExercisesModels","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","STRING","BOOLEAN","ARRAY","JSONB","TEXT"],"mappings":";;;;;;AAAA,SAASA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,EAAEC,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAExF,SAAQC,uBAAuB,QAAO,+BAA+B;AAGrE,OAAO,MAAMC,wBAAwBH;AA+DrC;;qBA9DsBI;;QAEdC,MAAMR,SAASS,IAAI;QACnBC,cAAcV,SAASS,IAAI;QAC3BE,WAAW;QACXC,YAAY;;;;;QAINJ,MAAMR,SAASa,MAAM;QAAEF,WAAW;;;;;QAGlCH,MAAMR,SAASa,MAAM;QAAEF,WAAW;;;;;QAGlCH,MAAMR,SAASa,MAAM,CAAC;QAAOF,WAAW;;;;;QAGxCH,MAAMR,SAASc,OAAO;QAAEH,WAAW;;;;;QAGnCH,MAAMR,SAASa,MAAM;QAAEF,WAAW;;;;;QAGlCH,MAAMR,SAASe,KAAK,CAACf,SAASa,MAAM;QAAGF,WAAW;;;;;QAGlDH,MAAMR,SAASc,OAAO;QAAEH,WAAW;;;;;QAGnCH,MAAMR,SAASc,OAAO;QAAEH,WAAW;;;;;QAGnCH,MAAMR,SAASc,OAAO;QAAEH,WAAW;;;;;QAGnCH,MAAMR,SAASc,OAAO;QAAEH,WAAW;;;;;QAGnCH,MAAMR,SAASgB,KAAK;QAAEL,WAAW;;;;;QAGjCH,MAAMR,SAASe,KAAK,CAACf,SAASa,MAAM;QAAGF,WAAW;;;;;QAGlDH,MAAMR,SAASc,OAAO;QAAEH,WAAW;;;;;QAGnCH,MAAMR,SAASc,OAAO;QAAEH,WAAW;QAAOD,cAAc;;;;;QAGxDF,MAAMR,SAASe,KAAK,CAACf,SAASa,MAAM;QAAGF,WAAW;;;;;QAGlDH,MAAMR,SAASa,MAAM;QAAEF,WAAW;;;;;QAGlCH,MAAMR,SAASiB,IAAI;QAAEN,WAAW;;;;gBAG3BN"}
1
+ {"version":3,"sources":["../../../../src/lib/dbmodels/program/ExerciseModels.ts"],"sourcesContent":["import { Column, DataType, Default, HasMany, Model, Table } from \"sequelize-typescript\";\nimport type {ExerciseModel, ProgramTypes} from '../../models/ExerciseInterfaces.js';\nimport {TranslatedExerciseModel} from './TranslatedExerciseModel.js';\n\n@Table\nexport class ExercisesModels extends Model implements ExerciseModel {\n @Default(DataType.UUIDV4)\n @Column({\n type: DataType.UUID,\n defaultValue: DataType.UUID,\n allowNull: false,\n primaryKey: true,\n })\n declare uuid: string;\n\n @Column({ type: DataType.STRING, allowNull: false })\n declare name: string;\n\n @Column({ type: DataType.STRING, allowNull: true })\n declare restTime: string;\n\n @Column({ type: DataType.STRING(2048), allowNull: false })\n declare pointers: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare isCustom: boolean;\n\n @Column({ type: DataType.STRING, allowNull: false })\n declare url: string;\n\n @Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n declare level: string[];\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare hasPriority: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare isCompound: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare hasVariations: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare needsEquipment: boolean;\n\n @Column({ type: DataType.JSONB, allowNull: false })\n declare variations: object;\n\n @Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n declare muscles: string[];\n\n @Column({ type: DataType.BOOLEAN, allowNull: false })\n declare homeWorkout: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: false, defaultValue: false })\n declare isBandAssisted: boolean;\n\n @Column({ type: DataType.ARRAY(DataType.STRING), allowNull: false })\n declare programType: ProgramTypes[];\n\n @Column({ type: DataType.STRING, allowNull: false })\n declare graphData: \"reps\" | \"weight\";\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare imageUrl: string;\n\n @Column({ type: DataType.STRING, allowNull: true })\n declare createdBy: string | null;\n\n @HasMany(() => TranslatedExerciseModel)\n declare translatedExercises: TranslatedExerciseModel[];\n}\n"],"names":["Column","DataType","Default","HasMany","Model","Table","TranslatedExerciseModel","ExercisesModels","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","STRING","BOOLEAN","ARRAY","JSONB","TEXT"],"mappings":";;;;;;AAAA,SAASA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,EAAEC,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAExF,SAAQC,uBAAuB,QAAO,+BAA+B;AAGrE,OAAO,MAAMC,wBAAwBH;AAkErC;;qBAjEsBI;;QAEdC,MAAMR,SAASS,IAAI;QACnBC,cAAcV,SAASS,IAAI;QAC3BE,WAAW;QACXC,YAAY;;;;;QAINJ,MAAMR,SAASa,MAAM;QAAEF,WAAW;;;;;QAGlCH,MAAMR,SAASa,MAAM;QAAEF,WAAW;;;;;QAGlCH,MAAMR,SAASa,MAAM,CAAC;QAAOF,WAAW;;;;;QAGxCH,MAAMR,SAASc,OAAO;QAAEH,WAAW;;;;;QAGnCH,MAAMR,SAASa,MAAM;QAAEF,WAAW;;;;;QAGlCH,MAAMR,SAASe,KAAK,CAACf,SAASa,MAAM;QAAGF,WAAW;;;;;QAGlDH,MAAMR,SAASc,OAAO;QAAEH,WAAW;;;;;QAGnCH,MAAMR,SAASc,OAAO;QAAEH,WAAW;;;;;QAGnCH,MAAMR,SAASc,OAAO;QAAEH,WAAW;;;;;QAGnCH,MAAMR,SAASc,OAAO;QAAEH,WAAW;;;;;QAGnCH,MAAMR,SAASgB,KAAK;QAAEL,WAAW;;;;;QAGjCH,MAAMR,SAASe,KAAK,CAACf,SAASa,MAAM;QAAGF,WAAW;;;;;QAGlDH,MAAMR,SAASc,OAAO;QAAEH,WAAW;;;;;QAGnCH,MAAMR,SAASc,OAAO;QAAEH,WAAW;QAAOD,cAAc;;;;;QAGxDF,MAAMR,SAASe,KAAK,CAACf,SAASa,MAAM;QAAGF,WAAW;;;;;QAGlDH,MAAMR,SAASa,MAAM;QAAEF,WAAW;;;;;QAGlCH,MAAMR,SAASiB,IAAI;QAAEN,WAAW;;;;;QAGhCH,MAAMR,SAASa,MAAM;QAAEF,WAAW;;;;gBAG7BN"}
@@ -13,6 +13,7 @@ export interface ExerciseModel {
13
13
  variations: object;
14
14
  muscles: string[];
15
15
  homeWorkout: boolean;
16
+ createdBy?: string | null;
16
17
  }
17
18
  export interface ExerciseProgress {
18
19
  exerciseUuid: string;
@@ -1 +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,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,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB"}
@@ -1 +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}\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":"AAiFA,WAIC"}
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}\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":"AAkFA,WAIC"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S,GAAG,MAAM,GAAG,OAAO,CAAC;AAE7E,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,aAAa,EACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC5B,IAAI,CAkBN"}
@@ -24,7 +24,6 @@ const SENSITIVE_FIELDS = [
24
24
  "password",
25
25
  "token",
26
26
  "apikey",
27
- "authorization",
28
27
  "secret",
29
28
  "cookie"
30
29
  ];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/utils/SentryUtil.ts"],"sourcesContent":["import * as Sentry from \"@sentry/node\";\nimport type { Context } from \"koa\";\n\nlet sentryInitialized = false;\n\nexport function initializeSentry(): void {\n if (sentryInitialized) {\n return;\n }\n\n const dsn = process.env.SENTRY_DSN;\n const nodeEnv = process.env.NODE_ENV;\n\n if (!dsn || nodeEnv !== \"production\") {\n return;\n }\n\n Sentry.init({\n dsn,\n environment: nodeEnv,\n enabled: true,\n tracesSampleRate: 0,\n });\n\n sentryInitialized = true;\n}\n\nexport function isSentryEnabled(): boolean {\n return sentryInitialized;\n}\n\nconst SENSITIVE_FIELDS = [\n \"password\",\n \"token\",\n \"apikey\",\n \"authorization\",\n \"secret\",\n \"cookie\",\n];\n\nexport function scrubObject(obj: any, depth = 0): any {\n if (depth > 10) {\n return \"[Max Depth]\";\n }\n\n if (obj === null || obj === undefined) {\n return obj;\n }\n\n if (typeof obj !== \"object\") {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map((item) => scrubObject(item, depth + 1));\n }\n\n const scrubbedObj: any = {};\n for (const [key, value] of Object.entries(obj)) {\n const keyLower = key.toLowerCase();\n const isSensitive = SENSITIVE_FIELDS.some((field) =>\n keyLower.includes(field),\n );\n\n if (isSensitive) {\n scrubbedObj[key] = \"[REDACTED]\";\n } else if (typeof value === \"object\" && value !== null) {\n scrubbedObj[key] = scrubObject(value, depth + 1);\n } else {\n scrubbedObj[key] = value;\n }\n }\n\n return scrubbedObj;\n}\n\nconst MAX_BODY_SIZE = 10 * 1024;\n\nexport function captureRequestBody(body: any): any {\n if (!body) {\n return body;\n }\n\n const bodyString = JSON.stringify(body);\n if (bodyString.length > MAX_BODY_SIZE) {\n return {\n _truncated: true,\n _originalSize: bodyString.length,\n preview: bodyString.substring(0, MAX_BODY_SIZE),\n };\n }\n\n return scrubObject(body);\n}\n\nexport function extractUserContext(ctx: Context): { id?: string } {\n const user = (ctx.state as any)?.user;\n if (user?.userUuid) {\n return { id: user.userUuid };\n }\n return {};\n}\n\nexport function buildRequestContext(ctx: Context): {\n method: string;\n url: string;\n query: any;\n headers: any;\n data: any;\n ip?: string;\n} {\n return {\n method: ctx.method,\n url: ctx.url,\n query: ctx.query,\n headers: scrubObject(ctx.headers),\n data: captureRequestBody((ctx.request as any).body),\n ip: ctx.ip,\n };\n}\n\nexport function buildResponseContext(ctx: Context): { status_code: number } {\n return {\n status_code: ctx.status,\n };\n}\n\nexport interface ErrorReportOptions {\n operational?: boolean;\n errorType?: string;\n statusCode?: number;\n}\n\nexport function reportErrorToSentry(\n error: Error,\n ctx?: Context,\n options?: ErrorReportOptions,\n): void {\n if (!isSentryEnabled()) {\n return;\n }\n\n Sentry.withScope((scope) => {\n if (ctx) {\n scope.setContext(\"request\", buildRequestContext(ctx));\n scope.setContext(\"response\", buildResponseContext(ctx));\n scope.setUser(extractUserContext(ctx));\n }\n\n if (options?.operational !== undefined) {\n scope.setTag(\"error.operational\", options.operational);\n }\n if (options?.errorType) {\n scope.setTag(\"error.type\", options.errorType);\n }\n if (options?.statusCode) {\n scope.setTag(\"http.status_code\", options.statusCode);\n }\n\n scope.setTag(\"source\", \"middleware\");\n\n Sentry.captureException(error);\n });\n\n (error as any)._sentryReported = true;\n}\n\nexport type SeverityLevel = \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\";\n\nexport function reportMessageToSentry(\n message: string,\n level: SeverityLevel,\n context?: Record<string, any>,\n): void {\n if (!isSentryEnabled()) {\n return;\n }\n\n Sentry.withScope((scope) => {\n if (context) {\n for (const [key, value] of Object.entries(context)) {\n if (key === \"logger_name\" || key === \"source\") {\n scope.setTag(key, value);\n } else {\n scope.setContext(key, value);\n }\n }\n }\n\n Sentry.captureMessage(message, level);\n });\n}\n"],"names":["Sentry","sentryInitialized","initializeSentry","dsn","process","env","SENTRY_DSN","nodeEnv","NODE_ENV","init","environment","enabled","tracesSampleRate","isSentryEnabled","SENSITIVE_FIELDS","scrubObject","obj","depth","undefined","Array","isArray","map","item","scrubbedObj","key","value","Object","entries","keyLower","toLowerCase","isSensitive","some","field","includes","MAX_BODY_SIZE","captureRequestBody","body","bodyString","JSON","stringify","length","_truncated","_originalSize","preview","substring","extractUserContext","ctx","user","state","userUuid","id","buildRequestContext","method","url","query","headers","data","request","ip","buildResponseContext","status_code","status","reportErrorToSentry","error","options","withScope","scope","setContext","setUser","operational","setTag","errorType","statusCode","captureException","_sentryReported","reportMessageToSentry","message","level","context","captureMessage"],"mappings":"AAAA,YAAYA,YAAY,eAAe;AAGvC,IAAIC,oBAAoB;AAExB,OAAO,SAASC;IACd,IAAID,mBAAmB;QACrB;IACF;IAEA,MAAME,MAAMC,QAAQC,GAAG,CAACC,UAAU;IAClC,MAAMC,UAAUH,QAAQC,GAAG,CAACG,QAAQ;IAEpC,IAAI,CAACL,OAAOI,YAAY,cAAc;QACpC;IACF;IAEAP,OAAOS,IAAI,CAAC;QACVN;QACAO,aAAaH;QACbI,SAAS;QACTC,kBAAkB;IACpB;IAEAX,oBAAoB;AACtB;AAEA,OAAO,SAASY;IACd,OAAOZ;AACT;AAEA,MAAMa,mBAAmB;IACvB;IACA;IACA;IACA;IACA;IACA;CACD;AAED,OAAO,SAASC,YAAYC,GAAQ,EAAEC,QAAQ,CAAC;IAC7C,IAAIA,QAAQ,IAAI;QACd,OAAO;IACT;IAEA,IAAID,QAAQ,QAAQA,QAAQE,WAAW;QACrC,OAAOF;IACT;IAEA,IAAI,OAAOA,QAAQ,UAAU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AACF"}
1
+ {"version":3,"sources":["../../../src/lib/utils/SentryUtil.ts"],"sourcesContent":["import * as Sentry from \"@sentry/node\";\nimport type { Context } from \"koa\";\n\nlet sentryInitialized = false;\n\nexport function initializeSentry(): void {\n if (sentryInitialized) {\n return;\n }\n\n const dsn = process.env.SENTRY_DSN;\n const nodeEnv = process.env.NODE_ENV;\n\n if (!dsn || nodeEnv !== \"production\") {\n return;\n }\n\n Sentry.init({\n dsn,\n environment: nodeEnv,\n enabled: true,\n tracesSampleRate: 0,\n });\n\n sentryInitialized = true;\n}\n\nexport function isSentryEnabled(): boolean {\n return sentryInitialized;\n}\n\nconst SENSITIVE_FIELDS = [\n \"password\",\n \"token\",\n \"apikey\",\n \"secret\",\n \"cookie\",\n];\n\nexport function scrubObject(obj: any, depth = 0): any {\n if (depth > 10) {\n return \"[Max Depth]\";\n }\n\n if (obj === null || obj === undefined) {\n return obj;\n }\n\n if (typeof obj !== \"object\") {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map((item) => scrubObject(item, depth + 1));\n }\n\n const scrubbedObj: any = {};\n for (const [key, value] of Object.entries(obj)) {\n const keyLower = key.toLowerCase();\n const isSensitive = SENSITIVE_FIELDS.some((field) =>\n keyLower.includes(field),\n );\n\n if (isSensitive) {\n scrubbedObj[key] = \"[REDACTED]\";\n } else if (typeof value === \"object\" && value !== null) {\n scrubbedObj[key] = scrubObject(value, depth + 1);\n } else {\n scrubbedObj[key] = value;\n }\n }\n\n return scrubbedObj;\n}\n\nconst MAX_BODY_SIZE = 10 * 1024;\n\nexport function captureRequestBody(body: any): any {\n if (!body) {\n return body;\n }\n\n const bodyString = JSON.stringify(body);\n if (bodyString.length > MAX_BODY_SIZE) {\n return {\n _truncated: true,\n _originalSize: bodyString.length,\n preview: bodyString.substring(0, MAX_BODY_SIZE),\n };\n }\n\n return scrubObject(body);\n}\n\nexport function extractUserContext(ctx: Context): { id?: string } {\n const user = (ctx.state as any)?.user;\n if (user?.userUuid) {\n return { id: user.userUuid };\n }\n return {};\n}\n\nexport function buildRequestContext(ctx: Context): {\n method: string;\n url: string;\n query: any;\n headers: any;\n data: any;\n ip?: string;\n} {\n return {\n method: ctx.method,\n url: ctx.url,\n query: ctx.query,\n headers: scrubObject(ctx.headers),\n data: captureRequestBody((ctx.request as any).body),\n ip: ctx.ip,\n };\n}\n\nexport function buildResponseContext(ctx: Context): { status_code: number } {\n return {\n status_code: ctx.status,\n };\n}\n\nexport interface ErrorReportOptions {\n operational?: boolean;\n errorType?: string;\n statusCode?: number;\n}\n\nexport function reportErrorToSentry(\n error: Error,\n ctx?: Context,\n options?: ErrorReportOptions,\n): void {\n if (!isSentryEnabled()) {\n return;\n }\n\n Sentry.withScope((scope) => {\n if (ctx) {\n scope.setContext(\"request\", buildRequestContext(ctx));\n scope.setContext(\"response\", buildResponseContext(ctx));\n scope.setUser(extractUserContext(ctx));\n }\n\n if (options?.operational !== undefined) {\n scope.setTag(\"error.operational\", options.operational);\n }\n if (options?.errorType) {\n scope.setTag(\"error.type\", options.errorType);\n }\n if (options?.statusCode) {\n scope.setTag(\"http.status_code\", options.statusCode);\n }\n\n scope.setTag(\"source\", \"middleware\");\n\n Sentry.captureException(error);\n });\n\n (error as any)._sentryReported = true;\n}\n\nexport type SeverityLevel = \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\";\n\nexport function reportMessageToSentry(\n message: string,\n level: SeverityLevel,\n context?: Record<string, any>,\n): void {\n if (!isSentryEnabled()) {\n return;\n }\n\n Sentry.withScope((scope) => {\n if (context) {\n for (const [key, value] of Object.entries(context)) {\n if (key === \"logger_name\" || key === \"source\") {\n scope.setTag(key, value);\n } else {\n scope.setContext(key, value);\n }\n }\n }\n\n Sentry.captureMessage(message, level);\n });\n}\n"],"names":["Sentry","sentryInitialized","initializeSentry","dsn","process","env","SENTRY_DSN","nodeEnv","NODE_ENV","init","environment","enabled","tracesSampleRate","isSentryEnabled","SENSITIVE_FIELDS","scrubObject","obj","depth","undefined","Array","isArray","map","item","scrubbedObj","key","value","Object","entries","keyLower","toLowerCase","isSensitive","some","field","includes","MAX_BODY_SIZE","captureRequestBody","body","bodyString","JSON","stringify","length","_truncated","_originalSize","preview","substring","extractUserContext","ctx","user","state","userUuid","id","buildRequestContext","method","url","query","headers","data","request","ip","buildResponseContext","status_code","status","reportErrorToSentry","error","options","withScope","scope","setContext","setUser","operational","setTag","errorType","statusCode","captureException","_sentryReported","reportMessageToSentry","message","level","context","captureMessage"],"mappings":"AAAA,YAAYA,YAAY,eAAe;AAGvC,IAAIC,oBAAoB;AAExB,OAAO,SAASC;IACd,IAAID,mBAAmB;QACrB;IACF;IAEA,MAAME,MAAMC,QAAQC,GAAG,CAACC,UAAU;IAClC,MAAMC,UAAUH,QAAQC,GAAG,CAACG,QAAQ;IAEpC,IAAI,CAACL,OAAOI,YAAY,cAAc;QACpC;IACF;IAEAP,OAAOS,IAAI,CAAC;QACVN;QACAO,aAAaH;QACbI,SAAS;QACTC,kBAAkB;IACpB;IAEAX,oBAAoB;AACtB;AAEA,OAAO,SAASY;IACd,OAAOZ;AACT;AAEA,MAAMa,mBAAmB;IACvB;IACA;IACA;IACA;IACA;CACD;AAED,OAAO,SAASC,YAAYC,GAAQ,EAAEC,QAAQ,CAAC;IAC7C,IAAIA,QAAQ,IAAI;QACd,OAAO;IACT;IAEA,IAAID,QAAQ,QAAQA,QAAQE,WAAW;QACrC,OAAOF;IACT;IAEA,IAAI,OAAOA,QAAQ,UAAU;QAC3B,OAAOA;IACT;IAEA,IAAIG,MAAMC,OAAO,CAACJ,MAAM;QACtB,OAAOA,IAAIK,GAAG,CAAC,CAACC,OAASP,YAAYO,MAAML,QAAQ;IACrD;IAEA,MAAMM,cAAmB,CAAC;IAC1B,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACX,KAAM;QAC9C,MAAMY,WAAWJ,IAAIK,WAAW;QAChC,MAAMC,cAAchB,iBAAiBiB,IAAI,CAAC,CAACC,QACzCJ,SAASK,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ACPoB,MAAMC,UAAU,CAAC,WAAWhB,oBAAoBL;YAChDoB,MAAMC,UAAU,CAAC,YAAYR,qBAAqBb;YAClDoB,MAAME,OAAO,CAACvB,mBAAmBC;QACnC;QAEA,IAAIkB,SAASK,gBAAgBnD,WAAW;YACtCgD,MAAMI,MAAM,CAAC,qBAAqBN,QAAQK,WAAW;QACvD;QACA,IAAIL,SAASO,WAAW;YACtBL,MAAMI,MAAM,CAAC,cAAcN,QAAQO,SAAS;QAC9C;QACA,IAAIP,SAASQ,YAAY;YACvBN,MAAMI,MAAM,CAAC,oBAAoBN,QAAQQ,UAAU;QACrD;QAEAN,MAAMI,MAAM,CAAC,UAAU;QAEvBtE,OAAOyE,gBAAgB,CAACV;IAC1B;IAECA,MAAcW,eAAe,GAAG;AACnC;AAIA,OAAO,SAASC,sBACdC,OAAe,EACfC,KAAoB,EACpBC,OAA6B;IAE7B,IAAI,CAACjE,mBAAmB;QACtB;IACF;IAEAb,OAAOiE,SAAS,CAAC,CAACC;QAChB,IAAIY,SAAS;YACX,KAAK,MAAM,CAACtD,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACmD,SAAU;gBAClD,IAAItD,QAAQ,iBAAiBA,QAAQ,UAAU;oBAC7C0C,MAAMI,MAAM,CAAC9C,KAAKC;gBACpB,OAAO;oBACLyC,MAAMC,UAAU,CAAC3C,KAAKC;gBACxB;YACF;QACF;QAEAzB,OAAO+E,cAAc,CAACH,SAASC;IACjC;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "90dc-core",
3
- "version": "1.14.2",
3
+ "version": "1.14.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",