@strong-together/shared 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1516,7 +1516,7 @@ var exerciseToWorkoutSplitExpandedView = workoutSchema.view("v_exercise_to_worko
1516
1516
  orderIndex: (0, import_pg_core31.bigint)("order_index", {
1517
1517
  mode: "number"
1518
1518
  }),
1519
- setOrderIndex: (0, import_pg_core32.integer)("set_order_index"),
1519
+ setIndex: (0, import_pg_core32.integer)("set_index"),
1520
1520
  createdAt: (0, import_pg_core31.timestamp)("created_at", {
1521
1521
  withTimezone: true
1522
1522
  }),
@@ -1532,7 +1532,7 @@ var exerciseToWorkoutSplitExpandedView = workoutSchema.view("v_exercise_to_worko
1532
1532
  ex.name AS exercise,
1533
1533
  ws.name AS workout_split,
1534
1534
  workout_set.reps AS reps,
1535
- workout_set.order_index AS set_order_index,
1535
+ workout_set.order_index AS set_index,
1536
1536
  ews.order_index,
1537
1537
  ews.created_at,
1538
1538
  ews.is_active
@@ -1566,6 +1566,7 @@ var exerciseTrackingExpandedView = analyticsSchema.view("v_exercise_tracking_exp
1566
1566
  exerciseToSplitId: (0, import_pg_core33.bigint)("exercise_to_split_id", {
1567
1567
  mode: "number"
1568
1568
  }),
1569
+ isAssignedToSplit: (0, import_pg_core33.boolean)("is_assigned_to_split"),
1569
1570
  weight: (0, import_pg_core33.real)("weight"),
1570
1571
  reps: (0, import_pg_core33.bigint)("reps", {
1571
1572
  mode: "number"
@@ -1593,6 +1594,10 @@ var exerciseTrackingExpandedView = analyticsSchema.view("v_exercise_tracking_exp
1593
1594
  SELECT
1594
1595
  et.id,
1595
1596
  et.exercise_to_split_id,
1597
+ CASE
1598
+ WHEN et.exercise_to_split_id IS NOT NULL THEN TRUE
1599
+ WHEN et.exercise_id IS NOT NULL THEN FALSE
1600
+ END AS is_assigned_to_split,
1596
1601
  tracking_set.weight AS weight,
1597
1602
  tracking_set.reps AS reps,
1598
1603
  tracking_set.set_index AS set_index,
@@ -2160,12 +2165,20 @@ var addWorkoutContract = {
2160
2165
 
2161
2166
  // src/modules/workout/tracking/tracking.dtos.ts
2162
2167
  var import_v418 = require("zod/v4");
2163
- var finishedWorkoutEntryQueryDtoSchema = import_v418.z.object({
2164
- exerciseToSplitId: exerciseToWorkoutSplitDbSchema.shape.id,
2165
- weight: import_v418.z.array(trackingSetDbSchema.shape.weight),
2166
- reps: import_v418.z.array(trackingSetDbSchema.shape.reps),
2168
+ var trackedSetQueryDtoSchema = import_v418.z.object({
2169
+ reps: trackingSetDbSchema.shape.reps,
2170
+ weight: trackingSetDbSchema.shape.weight,
2171
+ setIndex: trackingSetDbSchema.shape.setIndex
2172
+ });
2173
+ var finishedWorkoutEntryBaseQueryDtoSchema = import_v418.z.object({
2174
+ trackedSets: import_v418.z.array(trackedSetQueryDtoSchema),
2167
2175
  notes: exerciseTrackingDbSchema.shape.notes.optional()
2168
2176
  });
2177
+ var finishedWorkoutEntryQueryDtoSchema = finishedWorkoutEntryBaseQueryDtoSchema.extend({
2178
+ isExerciseAssignedToSplit: import_v418.z.boolean(),
2179
+ exerciseToSplitId: exerciseTrackingDbSchema.shape.exerciseToSplitId,
2180
+ exerciseId: exerciseTrackingDbSchema.shape.exerciseId
2181
+ });
2169
2182
  var exerciseMetadataQueryDtoSchema = import_v418.z.object({
2170
2183
  targetMuscle: exerciseDbSchema.shape.targetMuscle,
2171
2184
  specificTargetMuscle: exerciseDbSchema.shape.specificTargetMuscle
package/dist/index.d.cts CHANGED
@@ -2505,8 +2505,8 @@ declare const exerciseToWorkoutSplitExpandedViewDbSchema: drizzle_zod.BuildSchem
2505
2505
  identity: undefined;
2506
2506
  generated: undefined;
2507
2507
  }, {}, {}>;
2508
- setOrderIndex: drizzle_orm_pg_core.PgColumn<{
2509
- name: "set_order_index";
2508
+ setIndex: drizzle_orm_pg_core.PgColumn<{
2509
+ name: "set_index";
2510
2510
  tableName: "v_exercise_to_workout_split_expanded";
2511
2511
  dataType: "number";
2512
2512
  columnType: "PgInteger";
@@ -3356,6 +3356,23 @@ declare const exerciseTrackingExpandedViewDbSchema: drizzle_zod.BuildSchema<"sel
3356
3356
  identity: undefined;
3357
3357
  generated: undefined;
3358
3358
  }, {}, {}>;
3359
+ isAssignedToSplit: drizzle_orm_pg_core.PgColumn<{
3360
+ name: "is_assigned_to_split";
3361
+ tableName: "v_exercise_tracking_expanded";
3362
+ dataType: "boolean";
3363
+ columnType: "PgBoolean";
3364
+ data: boolean;
3365
+ driverParam: boolean;
3366
+ notNull: false;
3367
+ hasDefault: false;
3368
+ isPrimaryKey: false;
3369
+ isAutoincrement: false;
3370
+ hasRuntimeDefault: false;
3371
+ enumValues: undefined;
3372
+ baseColumn: never;
3373
+ identity: undefined;
3374
+ generated: undefined;
3375
+ }, {}, {}>;
3359
3376
  weight: drizzle_orm_pg_core.PgColumn<{
3360
3377
  name: "weight";
3361
3378
  tableName: "v_exercise_tracking_expanded";
@@ -5793,10 +5810,15 @@ declare const getExerciseTrackingContract: {
5793
5810
  declare const finishWorkoutRequestSchema: z.ZodObject<{
5794
5811
  body: z.ZodObject<{
5795
5812
  workout: z.ZodArray<z.ZodObject<{
5796
- exerciseToSplitId: z.ZodInt;
5797
- weight: z.ZodArray<z.ZodNumber>;
5798
- reps: z.ZodArray<z.ZodInt>;
5813
+ trackedSets: z.ZodArray<z.ZodObject<{
5814
+ reps: z.ZodInt;
5815
+ weight: z.ZodNumber;
5816
+ setIndex: z.ZodInt;
5817
+ }, z.core.$strip>>;
5799
5818
  notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5819
+ isExerciseAssignedToSplit: z.ZodBoolean;
5820
+ exerciseToSplitId: z.ZodNullable<z.ZodInt>;
5821
+ exerciseId: z.ZodNullable<z.ZodInt>;
5800
5822
  }, z.core.$strip>>;
5801
5823
  tz: z.ZodOptional<z.ZodString>;
5802
5824
  workoutStartUtc: z.ZodString;
@@ -5884,10 +5906,15 @@ declare const finishUserWorkoutContract: {
5884
5906
  request: z.ZodObject<{
5885
5907
  body: z.ZodObject<{
5886
5908
  workout: z.ZodArray<z.ZodObject<{
5887
- exerciseToSplitId: z.ZodInt;
5888
- weight: z.ZodArray<z.ZodNumber>;
5889
- reps: z.ZodArray<z.ZodInt>;
5909
+ trackedSets: z.ZodArray<z.ZodObject<{
5910
+ reps: z.ZodInt;
5911
+ weight: z.ZodNumber;
5912
+ setIndex: z.ZodInt;
5913
+ }, z.core.$strip>>;
5890
5914
  notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5915
+ isExerciseAssignedToSplit: z.ZodBoolean;
5916
+ exerciseToSplitId: z.ZodNullable<z.ZodInt>;
5917
+ exerciseId: z.ZodNullable<z.ZodInt>;
5891
5918
  }, z.core.$strip>>;
5892
5919
  tz: z.ZodOptional<z.ZodString>;
5893
5920
  workoutStartUtc: z.ZodString;
@@ -5977,12 +6004,16 @@ type GetExerciseTrackingResponse = ResponseOf<typeof getExerciseTrackingContract
5977
6004
  type FinishUserWorkoutBody = BodyOf<typeof finishUserWorkoutContract>;
5978
6005
  type FinishUserWorkoutResponse = ResponseOf<typeof finishUserWorkoutContract>;
5979
6006
 
5980
- /** Finished exercise entry consumed by the workout-insertion query. */
5981
6007
  declare const finishedWorkoutEntryQueryDtoSchema: z.ZodObject<{
5982
- exerciseToSplitId: z.ZodInt;
5983
- weight: z.ZodArray<z.ZodNumber>;
5984
- reps: z.ZodArray<z.ZodInt>;
6008
+ trackedSets: z.ZodArray<z.ZodObject<{
6009
+ reps: z.ZodInt;
6010
+ weight: z.ZodNumber;
6011
+ setIndex: z.ZodInt;
6012
+ }, z.core.$strip>>;
5985
6013
  notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6014
+ isExerciseAssignedToSplit: z.ZodBoolean;
6015
+ exerciseToSplitId: z.ZodNullable<z.ZodInt>;
6016
+ exerciseId: z.ZodNullable<z.ZodInt>;
5986
6017
  }, z.core.$strip>;
5987
6018
  /** Target-muscle metadata nested in a tracking-map item. */
5988
6019
  declare const exerciseMetadataQueryDtoSchema: z.ZodObject<{
package/dist/index.d.ts CHANGED
@@ -2505,8 +2505,8 @@ declare const exerciseToWorkoutSplitExpandedViewDbSchema: drizzle_zod.BuildSchem
2505
2505
  identity: undefined;
2506
2506
  generated: undefined;
2507
2507
  }, {}, {}>;
2508
- setOrderIndex: drizzle_orm_pg_core.PgColumn<{
2509
- name: "set_order_index";
2508
+ setIndex: drizzle_orm_pg_core.PgColumn<{
2509
+ name: "set_index";
2510
2510
  tableName: "v_exercise_to_workout_split_expanded";
2511
2511
  dataType: "number";
2512
2512
  columnType: "PgInteger";
@@ -3356,6 +3356,23 @@ declare const exerciseTrackingExpandedViewDbSchema: drizzle_zod.BuildSchema<"sel
3356
3356
  identity: undefined;
3357
3357
  generated: undefined;
3358
3358
  }, {}, {}>;
3359
+ isAssignedToSplit: drizzle_orm_pg_core.PgColumn<{
3360
+ name: "is_assigned_to_split";
3361
+ tableName: "v_exercise_tracking_expanded";
3362
+ dataType: "boolean";
3363
+ columnType: "PgBoolean";
3364
+ data: boolean;
3365
+ driverParam: boolean;
3366
+ notNull: false;
3367
+ hasDefault: false;
3368
+ isPrimaryKey: false;
3369
+ isAutoincrement: false;
3370
+ hasRuntimeDefault: false;
3371
+ enumValues: undefined;
3372
+ baseColumn: never;
3373
+ identity: undefined;
3374
+ generated: undefined;
3375
+ }, {}, {}>;
3359
3376
  weight: drizzle_orm_pg_core.PgColumn<{
3360
3377
  name: "weight";
3361
3378
  tableName: "v_exercise_tracking_expanded";
@@ -5793,10 +5810,15 @@ declare const getExerciseTrackingContract: {
5793
5810
  declare const finishWorkoutRequestSchema: z.ZodObject<{
5794
5811
  body: z.ZodObject<{
5795
5812
  workout: z.ZodArray<z.ZodObject<{
5796
- exerciseToSplitId: z.ZodInt;
5797
- weight: z.ZodArray<z.ZodNumber>;
5798
- reps: z.ZodArray<z.ZodInt>;
5813
+ trackedSets: z.ZodArray<z.ZodObject<{
5814
+ reps: z.ZodInt;
5815
+ weight: z.ZodNumber;
5816
+ setIndex: z.ZodInt;
5817
+ }, z.core.$strip>>;
5799
5818
  notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5819
+ isExerciseAssignedToSplit: z.ZodBoolean;
5820
+ exerciseToSplitId: z.ZodNullable<z.ZodInt>;
5821
+ exerciseId: z.ZodNullable<z.ZodInt>;
5800
5822
  }, z.core.$strip>>;
5801
5823
  tz: z.ZodOptional<z.ZodString>;
5802
5824
  workoutStartUtc: z.ZodString;
@@ -5884,10 +5906,15 @@ declare const finishUserWorkoutContract: {
5884
5906
  request: z.ZodObject<{
5885
5907
  body: z.ZodObject<{
5886
5908
  workout: z.ZodArray<z.ZodObject<{
5887
- exerciseToSplitId: z.ZodInt;
5888
- weight: z.ZodArray<z.ZodNumber>;
5889
- reps: z.ZodArray<z.ZodInt>;
5909
+ trackedSets: z.ZodArray<z.ZodObject<{
5910
+ reps: z.ZodInt;
5911
+ weight: z.ZodNumber;
5912
+ setIndex: z.ZodInt;
5913
+ }, z.core.$strip>>;
5890
5914
  notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5915
+ isExerciseAssignedToSplit: z.ZodBoolean;
5916
+ exerciseToSplitId: z.ZodNullable<z.ZodInt>;
5917
+ exerciseId: z.ZodNullable<z.ZodInt>;
5891
5918
  }, z.core.$strip>>;
5892
5919
  tz: z.ZodOptional<z.ZodString>;
5893
5920
  workoutStartUtc: z.ZodString;
@@ -5977,12 +6004,16 @@ type GetExerciseTrackingResponse = ResponseOf<typeof getExerciseTrackingContract
5977
6004
  type FinishUserWorkoutBody = BodyOf<typeof finishUserWorkoutContract>;
5978
6005
  type FinishUserWorkoutResponse = ResponseOf<typeof finishUserWorkoutContract>;
5979
6006
 
5980
- /** Finished exercise entry consumed by the workout-insertion query. */
5981
6007
  declare const finishedWorkoutEntryQueryDtoSchema: z.ZodObject<{
5982
- exerciseToSplitId: z.ZodInt;
5983
- weight: z.ZodArray<z.ZodNumber>;
5984
- reps: z.ZodArray<z.ZodInt>;
6008
+ trackedSets: z.ZodArray<z.ZodObject<{
6009
+ reps: z.ZodInt;
6010
+ weight: z.ZodNumber;
6011
+ setIndex: z.ZodInt;
6012
+ }, z.core.$strip>>;
5985
6013
  notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6014
+ isExerciseAssignedToSplit: z.ZodBoolean;
6015
+ exerciseToSplitId: z.ZodNullable<z.ZodInt>;
6016
+ exerciseId: z.ZodNullable<z.ZodInt>;
5986
6017
  }, z.core.$strip>;
5987
6018
  /** Target-muscle metadata nested in a tracking-map item. */
5988
6019
  declare const exerciseMetadataQueryDtoSchema: z.ZodObject<{
package/dist/index.js CHANGED
@@ -1310,7 +1310,7 @@ var exerciseToWorkoutSplitExpandedView = workoutSchema.view("v_exercise_to_worko
1310
1310
  orderIndex: bigint12("order_index", {
1311
1311
  mode: "number"
1312
1312
  }),
1313
- setOrderIndex: integer5("set_order_index"),
1313
+ setIndex: integer5("set_index"),
1314
1314
  createdAt: timestamp11("created_at", {
1315
1315
  withTimezone: true
1316
1316
  }),
@@ -1326,7 +1326,7 @@ var exerciseToWorkoutSplitExpandedView = workoutSchema.view("v_exercise_to_worko
1326
1326
  ex.name AS exercise,
1327
1327
  ws.name AS workout_split,
1328
1328
  workout_set.reps AS reps,
1329
- workout_set.order_index AS set_order_index,
1329
+ workout_set.order_index AS set_index,
1330
1330
  ews.order_index,
1331
1331
  ews.created_at,
1332
1332
  ews.is_active
@@ -1351,7 +1351,7 @@ var exerciseToWorkoutSplitExpandedView = workoutSchema.view("v_exercise_to_worko
1351
1351
 
1352
1352
  // ../../src/infrastructure/db/schema/drizzle/analytics/views/exercise-tracking-expanded.view.ts
1353
1353
  import { sql as drizzleSql26 } from "drizzle-orm";
1354
- import { bigint as bigint13, real as real2, text as text10, timestamp as timestamp12, uuid as uuid12 } from "drizzle-orm/pg-core";
1354
+ import { bigint as bigint13, boolean as boolean8, real as real2, text as text10, timestamp as timestamp12, uuid as uuid12 } from "drizzle-orm/pg-core";
1355
1355
  import { integer as integer6 } from "drizzle-orm/pg-core";
1356
1356
  var exerciseTrackingExpandedView = analyticsSchema.view("v_exercise_tracking_expanded", {
1357
1357
  id: bigint13("id", {
@@ -1360,6 +1360,7 @@ var exerciseTrackingExpandedView = analyticsSchema.view("v_exercise_tracking_exp
1360
1360
  exerciseToSplitId: bigint13("exercise_to_split_id", {
1361
1361
  mode: "number"
1362
1362
  }),
1363
+ isAssignedToSplit: boolean8("is_assigned_to_split"),
1363
1364
  weight: real2("weight"),
1364
1365
  reps: bigint13("reps", {
1365
1366
  mode: "number"
@@ -1387,6 +1388,10 @@ var exerciseTrackingExpandedView = analyticsSchema.view("v_exercise_tracking_exp
1387
1388
  SELECT
1388
1389
  et.id,
1389
1390
  et.exercise_to_split_id,
1391
+ CASE
1392
+ WHEN et.exercise_to_split_id IS NOT NULL THEN TRUE
1393
+ WHEN et.exercise_id IS NOT NULL THEN FALSE
1394
+ END AS is_assigned_to_split,
1390
1395
  tracking_set.weight AS weight,
1391
1396
  tracking_set.reps AS reps,
1392
1397
  tracking_set.set_index AS set_index,
@@ -1954,12 +1959,20 @@ var addWorkoutContract = {
1954
1959
 
1955
1960
  // src/modules/workout/tracking/tracking.dtos.ts
1956
1961
  import { z as z18 } from "zod/v4";
1957
- var finishedWorkoutEntryQueryDtoSchema = z18.object({
1958
- exerciseToSplitId: exerciseToWorkoutSplitDbSchema.shape.id,
1959
- weight: z18.array(trackingSetDbSchema.shape.weight),
1960
- reps: z18.array(trackingSetDbSchema.shape.reps),
1962
+ var trackedSetQueryDtoSchema = z18.object({
1963
+ reps: trackingSetDbSchema.shape.reps,
1964
+ weight: trackingSetDbSchema.shape.weight,
1965
+ setIndex: trackingSetDbSchema.shape.setIndex
1966
+ });
1967
+ var finishedWorkoutEntryBaseQueryDtoSchema = z18.object({
1968
+ trackedSets: z18.array(trackedSetQueryDtoSchema),
1961
1969
  notes: exerciseTrackingDbSchema.shape.notes.optional()
1962
1970
  });
1971
+ var finishedWorkoutEntryQueryDtoSchema = finishedWorkoutEntryBaseQueryDtoSchema.extend({
1972
+ isExerciseAssignedToSplit: z18.boolean(),
1973
+ exerciseToSplitId: exerciseTrackingDbSchema.shape.exerciseToSplitId,
1974
+ exerciseId: exerciseTrackingDbSchema.shape.exerciseId
1975
+ });
1963
1976
  var exerciseMetadataQueryDtoSchema = z18.object({
1964
1977
  targetMuscle: exerciseDbSchema.shape.targetMuscle,
1965
1978
  specificTargetMuscle: exerciseDbSchema.shape.specificTargetMuscle
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strong-together/shared",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",