@sunsteel/contracts 0.63.0 → 0.64.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 +42 -2
- package/dist/index.d.cts +1376 -1284
- package/dist/index.d.ts +1376 -1284
- package/dist/index.js +38 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -363,6 +363,40 @@ var ROUTINE_TRAINING_BLOCK_SOURCE_KINDS = [
|
|
|
363
363
|
"CURRENT_ROUTINE",
|
|
364
364
|
"SAVED_VERSION"
|
|
365
365
|
];
|
|
366
|
+
function trainingBlockCovers(block, date) {
|
|
367
|
+
return block.startDate <= date && date <= block.endDate;
|
|
368
|
+
}
|
|
369
|
+
function resolveActiveTrainingBlock(blocks, date) {
|
|
370
|
+
return blocks?.find((block) => trainingBlockCovers(block, date)) ?? null;
|
|
371
|
+
}
|
|
372
|
+
function resolveRoutinePlan(routine, date) {
|
|
373
|
+
const block = resolveActiveTrainingBlock(routine.trainingBlocks, date);
|
|
374
|
+
if (block) {
|
|
375
|
+
return {
|
|
376
|
+
block: {
|
|
377
|
+
id: block.id,
|
|
378
|
+
seriesId: block.seriesId,
|
|
379
|
+
revision: block.revision,
|
|
380
|
+
name: block.name,
|
|
381
|
+
startDate: block.startDate,
|
|
382
|
+
endDate: block.endDate
|
|
383
|
+
},
|
|
384
|
+
scheduleMode: block.scheduleMode,
|
|
385
|
+
restDays: block.restDays,
|
|
386
|
+
rotationWeekdays: block.rotationWeekdays,
|
|
387
|
+
nextRotationDayId: block.nextRotationDayId,
|
|
388
|
+
days: block.days
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
return {
|
|
392
|
+
block: null,
|
|
393
|
+
scheduleMode: routine.scheduleMode,
|
|
394
|
+
restDays: routine.restDays,
|
|
395
|
+
rotationWeekdays: routine.rotationWeekdays ?? [],
|
|
396
|
+
nextRotationDayId: routine.nextRotationDayId ?? null,
|
|
397
|
+
days: routine.days
|
|
398
|
+
};
|
|
399
|
+
}
|
|
366
400
|
|
|
367
401
|
// src/routine-sharing.ts
|
|
368
402
|
var ROUTINE_VISIBILITY_VALUES = [
|
|
@@ -708,7 +742,10 @@ export {
|
|
|
708
742
|
accountExportFileName,
|
|
709
743
|
isWithinQuietHours,
|
|
710
744
|
matchesDeletionConfirmation,
|
|
745
|
+
resolveActiveTrainingBlock,
|
|
746
|
+
resolveRoutinePlan,
|
|
711
747
|
routineDayLabel,
|
|
712
748
|
sessionCorrectionWindow,
|
|
713
|
-
setLogValuesDiffer
|
|
749
|
+
setLogValuesDiffer,
|
|
750
|
+
trainingBlockCovers
|
|
714
751
|
};
|